@dbt-tools/web 0.5.8 → 0.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
**Artifact-driven investigation UI** for dbt: dependency and lineage graphs, execution timelines (critical path, bottlenecks), inventory and search, and health-oriented summaries—**deterministic views from `manifest.json` / `run_results.json` (and related artifacts). No LLM or chat surface is required**; the app is designed to answer operational questions (what failed, what was slow, what sits on the critical path, what depends on a node, what to inspect next) from structured analysis alone. Optional **S3/GCS** artifact sources are configured infrastructure, not a multi-tenant SaaS model—see [ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md) and [ADR-0008](../../docs/adr/0008-dbt-tools-operational-intelligence-and-positioning-boundaries.md).
|
|
4
4
|
|
|
5
|
+
## When to use this app
|
|
6
|
+
|
|
7
|
+
Use **`dbt-tools-web`** when you want a **browser UI** to explore dbt artifacts: lineage graphs, execution timelines, inventory search, and run health views over a local `target/` directory or optional **S3/GCS** sources. Credentials and artifact I/O stay on the **Node server** (or Vite dev middleware); the browser only talks to same-origin `/api/...` routes.
|
|
8
|
+
|
|
5
9
|
**End users:** install from npm and run **`dbt-tools-web`** (see below). **Contributors:** clone the monorepo and use Vite — see [Developing from source](#developing-from-source) and [AGENTS.md](../../AGENTS.md).
|
|
6
10
|
|
|
7
11
|
Operator topics (**remote sources**, **Docker / GHCR**, **Vite-only env and file watch**) are covered in this README (the **Configuration** section below, [Docker and container images](#docker-and-container-images), and [Vite dev server (monorepo)](#vite-dev-server-monorepo)). Remote semantics: [ADR-0004](../../docs/adr/0004-remote-object-storage-artifact-sources-and-auto-reload.md).
|
|
@@ -77,14 +81,14 @@ graph TD
|
|
|
77
81
|
|
|
78
82
|
APP[React_app_static_dist]
|
|
79
83
|
WW[Web_Worker]
|
|
80
|
-
CORE[
|
|
84
|
+
CORE[Analysis_in_web_worker]
|
|
81
85
|
|
|
82
86
|
HTTP -->|static_files| APP
|
|
83
87
|
APP -->|postMessage| WW
|
|
84
88
|
WW --> CORE
|
|
85
89
|
```
|
|
86
90
|
|
|
87
|
-
Heavy analysis runs in a **web worker**
|
|
91
|
+
Heavy analysis runs in a **web worker** (browser-safe shared library). The same artifact HTTP surface is used in **Vite dev** (monorepo) with extra file-watching behavior — see [Vite dev server (monorepo)](#vite-dev-server-monorepo).
|
|
88
92
|
|
|
89
93
|
---
|
|
90
94
|
|
|
@@ -104,7 +108,7 @@ Set these in the environment for the **Node process** that runs `dbt-tools-web`
|
|
|
104
108
|
|
|
105
109
|
### Remote artifact sources
|
|
106
110
|
|
|
107
|
-
**Variable:** `DBT_TOOLS_REMOTE_SOURCE`. The dev server and **`dbt-tools-web`** can list keys under a bucket prefix
|
|
111
|
+
**Variable:** `DBT_TOOLS_REMOTE_SOURCE`. The dev server and **`dbt-tools-web`** can list keys under a bucket prefix that points at a **single run** (root-level `manifest.json` and `run_results.json`), **poll** for changes, and surface newer artifact versions in the UI **without switching your selected location automatically**. Credentials stay in the **Node process** (AWS default chain, GCS ADC / `GOOGLE_APPLICATION_CREDENTIALS`), not in the browser.
|
|
108
112
|
|
|
109
113
|
Example (shape only — adjust bucket/prefix):
|
|
110
114
|
|
|
@@ -189,15 +193,15 @@ For **clone, pnpm install, build order, lint, and tests**, use [AGENTS.md](../..
|
|
|
189
193
|
|
|
190
194
|
### Tech stack
|
|
191
195
|
|
|
192
|
-
| Layer | Technology
|
|
193
|
-
| -------------- |
|
|
194
|
-
| UI | [React](https://react.dev/)
|
|
195
|
-
| Build | [Vite](https://vitejs.dev/)
|
|
196
|
-
| Charts | [Recharts](https://recharts.org/)
|
|
197
|
-
| Virtualization | [@tanstack/react-virtual](https://tanstack.com/virtual)
|
|
198
|
-
| Analysis |
|
|
199
|
-
| E2E | [Playwright](https://playwright.dev/)
|
|
200
|
-
| Language | TypeScript
|
|
196
|
+
| Layer | Technology |
|
|
197
|
+
| -------------- | ------------------------------------------------------- |
|
|
198
|
+
| UI | [React](https://react.dev/) |
|
|
199
|
+
| Build | [Vite](https://vitejs.dev/) |
|
|
200
|
+
| Charts | [Recharts](https://recharts.org/) |
|
|
201
|
+
| Virtualization | [@tanstack/react-virtual](https://tanstack.com/virtual) |
|
|
202
|
+
| Analysis | Shared analysis library (browser build) in a web worker |
|
|
203
|
+
| E2E | [Playwright](https://playwright.dev/) |
|
|
204
|
+
| Language | TypeScript |
|
|
201
205
|
|
|
202
206
|
### Monorepo commands
|
|
203
207
|
|
|
@@ -304,16 +308,6 @@ pnpm test:e2e
|
|
|
304
308
|
|
|
305
309
|
---
|
|
306
310
|
|
|
307
|
-
## Related packages
|
|
308
|
-
|
|
309
|
-
| Package | Role |
|
|
310
|
-
| -------------------------------------- | ------------------------------------ |
|
|
311
|
-
| [`@dbt-tools/core`](../core/README.md) | Analysis engine |
|
|
312
|
-
| [`@dbt-tools/cli`](../cli/README.md) | CLI (`dbt-tools`) |
|
|
313
|
-
| `dbt-artifacts-parser` | External artifact parsing dependency |
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
311
|
## License
|
|
318
312
|
|
|
319
313
|
The `@dbt-tools/*` packages use a **custom source-available license**; they are **not** OSI “open source.” The following is a **short summary** — the binding terms are in the **`LICENSE`** file at the root of each published npm package (`package.json` uses `SEE LICENSE IN LICENSE`).
|
|
@@ -33,4 +33,4 @@ import{n as e,r as t,t as n}from"./rolldown-runtime-Dw2cE7zH.js";import{i as r,n
|
|
|
33
33
|
`)}):null,r.length>0?(0,u.jsx)(`div`,{style:{marginTop:i.length>0?`0.35rem`:0,whiteSpace:`pre-wrap`,fontSize:`0.82rem`,lineHeight:1.35},"aria-label":`Additional adapter response fields`,children:r.map(e=>`${e.label}: ${e.displayValue}`).join(`
|
|
34
34
|
`)}):null]})}function Z_({label:e,value:t}){return(0,u.jsxs)(`div`,{children:[(0,u.jsxs)(`span`,{style:Zg,children:[e,`: `]}),t]})}function Q_({semantics:e,materialized:t}){return e?(0,u.jsxs)(`div`,{style:{marginTop:`0.25rem`,maxWidth:340},children:[(0,u.jsx)(`div`,{children:(0,u.jsx)(`span`,{style:Zg,children:`Semantics: `})}),(0,u.jsx)(`div`,{style:{whiteSpace:`pre-wrap`,fontSize:`0.82rem`,lineHeight:1.35},children:oa(e)})]}):t?(0,u.jsx)(Z_,{label:`Materialization`,value:q_(t)}):null}function $_({hover:e,runStartedAt:t,canShowTimestamps:n,timeZone:r}){let i=n&&t!=null?e_(t+e.item.start,r):`+${$g(e.item.start)}`,a=n&&t!=null?e_(t+e.item.end,r):`+${$g(e.item.end)}`;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Z_,{label:`Start`,value:i}),(0,u.jsx)(Z_,{label:`End`,value:a}),(0,u.jsx)(Z_,{label:`Duration`,value:$g(e.item.duration)})]})}function ev({label:e,start:t,end:n}){return t==null||n==null||n<=t?null:(0,u.jsx)(Z_,{label:e,value:$g(n-t)})}function tv({testStats:e}){if(!e)return null;let t=[e.pass>0?`✓${e.pass}`:null,e.error>0?`✗${e.error}`:null,e.warn>0?`!${e.warn}`:null,e.skipped>0?`−${e.skipped}`:null].filter(Boolean);return t.length===0?null:(0,u.jsx)(Z_,{label:`Tests`,value:t.join(` · `)})}function nv({hover:e,frameWidth:t,frameHeight:n,runStartedAt:r,canShowTimestamps:i,timeZone:a,testStats:o,resourceByUniqueId:s}){let l=(0,c.useRef)(null),[d,f]=(0,c.useState)(()=>J_({hoverX:e.x,hoverY:e.y,frameWidth:t,frameHeight:n,tooltipWidth:220,tooltipHeight:160})),p=s?.get(e.item.unique_id),m=Y_(p);return(0,c.useLayoutEffect)(()=>{let r=l.current;if(!r)return;let i=J_({hoverX:e.x,hoverY:e.y,frameWidth:t,frameHeight:n,tooltipWidth:r.offsetWidth,tooltipHeight:r.offsetHeight});f(e=>e.left===i.left&&e.top===i.top?e:i)},[n,t,e.x,e.y,e.item.unique_id,m]),(0,u.jsxs)(`div`,{ref:l,className:`chart-tooltip`,style:{position:`absolute`,left:d.left,top:d.top,pointerEvents:`none`,zIndex:20,minWidth:180},children:[(0,u.jsx)(`div`,{style:{fontWeight:700,marginBottom:`0.3rem`},children:e.item.name||e.item.unique_id}),(0,u.jsx)(Z_,{label:`Status`,value:e.item.status}),e.item.resourceType&&(0,u.jsx)(Z_,{label:`Type`,value:e.item.resourceType}),(0,u.jsx)(Q_,{semantics:e.item.semantics,materialized:e.item.materialized}),(0,u.jsx)($_,{hover:e,runStartedAt:r,canShowTimestamps:i,timeZone:a}),(0,u.jsx)(ev,{label:`Compile`,start:e.item.compileStart,end:e.item.compileEnd}),(0,u.jsx)(ev,{label:`Execute`,start:e.item.executeStart,end:e.item.executeEnd}),(0,u.jsx)(tv,{testStats:o}),(0,u.jsx)(X_,{resource:p})]})}function rv({canvasRef:e,scrollRef:t,edges:n,edgeFocusId:r,itemById:i,bundleIndexById:a,bundles:o,rowOffsets:s,containerWidth:l,effectiveLabelW:d,rangeStart:f,rangeEnd:p,scrollTop:m,viewportH:h,needsScroll:g,totalScrollH:_,theme:v,showTests:y,hover:b,runStartedAt:x,canShowTimestamps:S,timeZone:C,testStatsById:w,resourceByUniqueId:T,selectedId:E,onSelect:D,onPointer:O,onHoverClear:k,labelColumnResize:A}){let j=(0,c.useRef)(null),[M,N]=(0,c.useState)(0);return(0,c.useLayoutEffect)(()=>{let e=j.current;if(!e)return;let t=()=>N(e.getBoundingClientRect().width);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,u.jsxs)(`section`,{ref:j,className:`chart-frame`,style:{position:`relative`,userSelect:`none`},children:[(0,u.jsx)(`canvas`,{ref:e,style:{position:`absolute`,top:0,left:0,width:`100%`,height:h,pointerEvents:`none`,display:`block`}}),(0,u.jsx)(V_,{edges:n,focusId:r,itemById:i,bundleIndexById:a,bundles:o,rowOffsets:s,canvasWidth:l>0?l:600,effectiveLabelW:d,rangeStart:f,rangeEnd:p,scrollTop:m,viewportH:h,theme:v,showTests:y}),(0,u.jsx)(`div`,{ref:t,className:`chart-frame__viewport`,role:`region`,tabIndex:0,"aria-label":`Timeline chart viewport — use arrow keys to scroll`,style:{position:`relative`,height:h,overflowY:g?`auto`:`hidden`},onMouseMove:e=>O(e,`move`),onClick:e=>O(e,`click`),onKeyDown:e=>{if(e.key!==`Enter`&&e.key!==` `)return;e.preventDefault();let t=b?.item.unique_id??E;t&&D?.(t)},onMouseLeave:k,children:(0,u.jsx)(`div`,{style:{height:_}})}),A?(0,u.jsx)(U_,{labelColumnW:A.width,viewportH:A.viewportH,minW:A.minW,maxW:A.maxW,onWidthChange:A.onChange}):null,b&&(0,u.jsx)(nv,{hover:b,frameWidth:M>0?M:l,frameHeight:h,runStartedAt:x,canShowTimestamps:S,timeZone:C,testStats:w?.get(b.item.unique_id),resourceByUniqueId:T})]})}function iv({activeMode:e,onChange:t,activeTimeZone:n,timeZones:r,onTimeZoneChange:i}){return(0,u.jsx)(`div`,{className:`gantt-controls`,children:(0,u.jsxs)(`div`,{className:`gantt-controls__cluster`,children:[e===`timestamps`&&(0,u.jsxs)(`label`,{className:`gantt-timezone-select`,children:[(0,u.jsx)(`span`,{children:`Timezone`}),(0,u.jsx)(`select`,{value:n,onChange:e=>i(e.target.value),children:r.map(e=>(0,u.jsx)(`option`,{value:e,children:e},e))})]}),(0,u.jsxs)(`div`,{className:`gantt-mode-toggle`,children:[(0,u.jsx)(`button`,{type:`button`,className:e===`duration`?`active`:``,onClick:()=>t(`duration`),children:`Duration`}),(0,u.jsx)(`button`,{type:`button`,className:e===`timestamps`?`active`:``,onClick:()=>t(`timestamps`),children:`Timestamps`})]})]})})}var av=1e3;function ov(e,t){let n=t?.get(e.item.unique_id);return n&&n.error+n.warn>0?!0:o_(e.item.status)||e.tests.some(e=>o_(e.status))}function sv(e,t,n){return{start:Math.max(0,Math.min(e,n)),end:Math.max(0,Math.min(t,n))}}function cv({bundles:e,maxEnd:t,timeWindow:n,testStatsById:r,onChange:i}){let a=(0,c.useRef)(null),[o,s]=(0,c.useState)(null),l=(0,c.useRef)(null),d=Math.min(Math.max(av,t*.01),t),f=n?.start??0,p=n?.end??t,m=n!=null;function h(e){let n=a.current;if(!n)return 0;let r=n.clientWidth;return r<=0||t<=0?0:(e-n.getBoundingClientRect().left)/r*t}function g(e,r){if(!a.current||a.current.clientWidth<=0||t<=0)return;let i=h(e.clientX);l.current={mode:r,startPx:e.clientX,initialStart:r===`create`?i:f,initialEnd:r===`create`?i:p,currentStart:r===`create`?i:f,currentEnd:r===`create`?i:p},s(r===`create`?{start:i,end:i}:n),a.current.setPointerCapture(e.pointerId)}function _(e){let n=l.current,r=a.current;if(!n||!r||t<=0)return;let i=r.clientWidth;if(i<=0)return;let o=(e.clientX-n.startPx)/i*t,c=n.initialEnd-n.initialStart,u=h(e.clientX);if(n.mode===`create`){let e={start:Math.min(n.initialStart,u),end:Math.max(n.initialStart,u)};l.current={...n,currentStart:e.start,currentEnd:e.end},s(e);return}if(n.mode===`pan`){let e=Math.min(Math.max(0,n.initialStart+o),t-c),r={start:e,end:e+c};l.current={...n,currentStart:r.start,currentEnd:r.end},s(r);return}if(n.mode===`start`){let e={start:Math.min(Math.max(0,n.initialStart+o),n.initialEnd-d),end:n.initialEnd};l.current={...n,currentStart:e.start,currentEnd:e.end},s(e);return}let f=Math.max(Math.min(t,n.initialEnd+o),n.initialStart+d),p={start:n.initialStart,end:f};l.current={...n,currentStart:p.start,currentEnd:p.end},s(p)}function v(e){let n=l.current;if(n&&a.current?.hasPointerCapture(e.pointerId)&&a.current.releasePointerCapture(e.pointerId),n){let e=sv(n.currentStart,n.currentEnd,t),r=e.end-e.start;(n.mode!==`create`||r>=d)&&(e.start<=0&&e.end>=t?i(null):i(e))}l.current=null,s(null)}let y=o??(m?{start:f,end:p}:{start:0,end:t}),b=y==null?0:Math.max(0,Math.min(100,y.start/t*100)),x=y==null?0:Math.max(0,Math.min(100,y.end/t*100)),S=Math.max(0,x-b);return(0,u.jsxs)(`div`,{className:`gantt-brush-wrap`,children:[(0,u.jsxs)(`div`,{className:`gantt-brush__header`,children:[(0,u.jsx)(`p`,{className:`gantt-brush__title`,children:`Time range`}),(0,u.jsx)(`button`,{type:`button`,className:`workspace-pill`,disabled:!m,onClick:()=>i(null),children:`Reset zoom`})]}),(0,u.jsxs)(`div`,{ref:a,className:`gantt-brush`,onPointerDown:e=>{e.target!==e.currentTarget||e.button!==0||g(e,`create`)},onPointerMove:_,onPointerUp:v,onPointerCancel:v,role:`slider`,"aria-label":`Timeline time range`,"aria-valuemin":0,"aria-valuemax":Math.round(t),"aria-valuenow":Math.round(f),"aria-valuetext":`${Math.round(f)} to ${Math.round(p)} ms`,children:[e.map(e=>{let n=Math.max(0,e.item.start),i=Math.max(n,e.item.end),a=n/t*100,o=Math.max(.2,(i-n)/t*100),s=ov(e,r);return(0,u.jsx)(`span`,{className:s?`gantt-brush__bar gantt-brush__bar--issue`:`gantt-brush__bar`,"data-issue":s?`true`:`false`,style:{left:`${a}%`,width:`${o}%`}},e.item.unique_id)}),y!=null&&(0,u.jsxs)(`div`,{className:m||o!=null?`gantt-brush__selection`:`gantt-brush__selection gantt-brush__selection--default`,"data-default-range":m||o!=null?`false`:`true`,style:{left:`${b}%`,width:`${S}%`},onPointerDown:e=>g(e,`pan`),children:[(0,u.jsx)(`span`,{className:`gantt-brush__handle gantt-brush__handle--start`,onPointerDown:e=>{e.stopPropagation(),g(e,`start`)}}),(0,u.jsx)(`span`,{className:`gantt-brush__handle gantt-brush__handle--end`,onPointerDown:e=>{e.stopPropagation(),g(e,`end`)}})]})]})]})}function lv(e,t,n,r,i,a,o=2){let s=Math.max(1,t-e),c=i+a,l=i+(n-e)/s*a,u=i+(r-e)/s*a,d=Math.max(i,Math.min(l,u));return{x:d,width:Math.max(o,Math.min(c,Math.max(l,u))-d)}}function uv(e,t){return t&&e.laneCount>0?49+e.laneCount*14+5:44}function dv(e,t){let n=[],r=[],i=0;for(let a of e){n.push(i);let e=uv(a,t);r.push(e),i+=e}return{rowOffsets:n,rowHeights:r,totalHeight:i}}function fv(e,t,n){if(e.length===0)return-1;let r=0,i=e.length-1;for(;r<=i;){let a=Math.floor((r+i)/2),o=e[a]??0,s=t[a]??44;if(o>n)i=a-1;else if(o+s<=n)r=a+1;else return a}return-1}function pv(e,t,n,r,i,a,o,s){let c=(e,t,n)=>({item:e,x:t,y:n}),l=(e,t,n,r,i,a)=>e>=t&&e<=t+n&&(r==null||i==null||a==null||r>=i&&r<=i+a),{rowOffsets:u,rowHeights:d,showTests:f}=n;if(!s)return null;let p=e.currentTarget.getBoundingClientRect(),m=e.clientX-p.left,h=e.clientY-p.top;if(h<32||m<0)return null;let g=fv(u,d,h-32+r);if(g<0||g>=t.length)return null;let _=t[g];if(!_)return null;let v=s.getBoundingClientRect().width-o-24,y=32+(u[g]??0)-r;if(m<o)return c(_.item,m,h);let b=o,{x,width:S}=lv(i,a,_.item.start,_.item.end,b,v);if(l(m,x,S))return c(_.item,m,h);if(f&&_.lanes.length>0)for(let{item:e,lane:t}of _.lanes){let{x:n,width:r}=lv(i,a,e.start,e.end,b,v,4);if(l(m,n,r,h,y+44+5+t*14,10))return c(e,m,h)}return null}function mv(e,t,n){let{bundles:r,layout:i,scrollTop:a,rangeStart:o,rangeEnd:s,effectiveLabelW:c,canvas:l,setHover:u,onSelect:d}=n,f=pv(e,r,i,a,o,s,c,l);if(!f){t===`move`?u(null):d?.(null);return}if(t===`move`){u({item:f.item,x:f.x,y:f.y});return}d?.(f.item.unique_id)}var hv={...$n};function gv(e,t=`light`){return(t===`dark`?er:$n)[e.toLowerCase()]??Qn(t).textSoft}function _v(e,t=`light`){let n=dr(t);return(e&&n[e])??Qn(t).borderSubtle}var vv=3,yv=2.25;function bv(e){return(e?.error??0)+(e?.warn??0)>0}function xv(e,t,n,r,i,a){r<2*a&&(a=r/2),i<2*a&&(a=i/2),e.beginPath(),e.moveTo(t+a,n),e.arcTo(t+r,n,t+r,n+i,a),e.arcTo(t+r,n+i,t,n+i,a),e.arcTo(t,n+i,t,n,a),e.arcTo(t,n,t+r,n,a),e.closePath()}function Sv(e,t,n,r,i,a){xv(e,t,n,r,i,a),e.fill()}function Cv(e,t,n,r,i,a){xv(e,t,n,r,i,a),e.stroke()}function wv(e,t){let{rangeStart:n,rangeEnd:r,chartLeft:i,chartW:a,compileStart:o,compileEnd:s,barX:c,barY:l,barW:u,barH:d,radius:f,theme:p}=t;if(o==null||s==null||s<=o)return;let m=Math.max(1,r-n),h=i+(o-n)/m*a,g=i+(s-n)/m*a,_=Math.max(c,h),v=Math.min(c+u,g)-_;v<=.5||(e.save(),xv(e,c,l,u,d,f),e.clip(),e.fillStyle=p===`dark`?`rgba(0, 0, 0, 0.24)`:`rgba(0, 0, 0, 0.12)`,e.fillRect(_,l,v,d),e.restore())}function Tv(e,t,n,r,i,a,o,s){t%2==0&&(e.fillStyle=o?s.rowStripeHover:s.rowStripe,e.globalAlpha=a?1:.35,e.fillRect(0,n,r,i),e.globalAlpha=1)}function Ev({ctx:e,item:t,rowY:n,labelW:r,xOffset:i,emphasis:a,palette:o}){e.save(),e.globalAlpha=a,e.beginPath(),e.rect(i,n,r-10-i,44),e.clip(),e.textAlign=`left`,e.textBaseline=`middle`,e.font=`12px "IBM Plex Sans", "Avenir Next", sans-serif`,e.fillStyle=o.labelText,e.fillText(t.name||t.unique_id,i+2,n+44/2),e.restore()}function Dv({ctx:e,item:t,rowY:n,rangeStart:r,rangeEnd:i,chartW:a,labelW:o,emphasis:s,isHovered:c,attachedTestStats:l,palette:u,theme:d}){let f=n+6,{x:p,width:m}=lv(r,i,t.start,t.end,o,a),h=bv(l),g=o_(t.status)||h;e.save(),e.globalAlpha=s,e.fillStyle=pr(t.resourceType,d),Sv(e,p,f,m,14,3),wv(e,{rangeStart:r,rangeEnd:i,chartLeft:o,chartW:a,compileStart:t.compileStart,compileEnd:t.compileEnd,barX:p,barY:f,barW:m,barH:14,radius:3,theme:d}),h&&i_(t.status)&&(e.fillStyle=u.testFailStripe,Sv(e,p,f+14-4,m,4,2)),e.strokeStyle=g?u.testFailStripe:gv(t.status,d),e.lineWidth=g?vv:2,Cv(e,p,f,m,14,3),e.restore(),c&&(e.save(),e.globalAlpha=1,e.strokeStyle=u.barHoverStroke,e.lineWidth=1.5,Cv(e,p,f,m,14,3),e.restore())}function Ov({ctx:e,test:t,chipY:n,rangeStart:r,rangeEnd:i,chartW:a,labelW:o,palette:s,theme:c,emphasis:l,isHovered:u}){let{x:d,width:f}=lv(r,i,t.start,t.end,o,a,4),p=o_(t.status);e.save(),e.globalAlpha=l,e.fillStyle=pr(t.resourceType,c),Sv(e,d,n,f,10,2),wv(e,{rangeStart:r,rangeEnd:i,chartLeft:o,chartW:a,compileStart:t.compileStart,compileEnd:t.compileEnd,barX:d,barY:n,barW:f,barH:10,radius:2,theme:c}),e.strokeStyle=p?s.testFailStripe:gv(t.status,c),e.lineWidth=p?yv:1.5,Cv(e,d,n,f,10,2),e.restore(),u&&(e.save(),e.globalAlpha=1,e.strokeStyle=s.barHoverStroke,e.lineWidth=1,Cv(e,d,n,f,10,2),e.restore())}function kv(e,t){let n=e.getContext(`2d`);if(!n)return null;let r=e.getBoundingClientRect(),i=window.devicePixelRatio||1,a=r.width,o=r.height;return a===0||o===0?null:(e.width=a*i,e.height=o*i,n.scale(i,i),n.clearRect(0,0,a,o),{ctx:n,w:a,h:o,chartW:a-t-24})}function Av({ctx:e,labelW:t,chartW:n,h:r,rangeStart:i,rangeEnd:a,displayMode:o,runStartedAt:s,timeZone:c,palette:l}){let u=Math.max(1,a-i),d=u_(i,a);e.font=`11px 'IBM Plex Mono', 'Fira Mono', monospace`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillStyle=l.axisTick;let f=e=>o===`timestamps`&&s!=null?e_(s+e.ms,c):e.label,p=d_(d,i,a,n,f,t=>e.measureText(t).width);for(let a of p){let o=t+(a.ms-i)/u*n;e.strokeStyle=l.gridLine,e.lineWidth=1,e.beginPath(),e.moveTo(o,32),e.lineTo(o,r),e.stroke(),e.fillText(f(a),o,32/2)}}function jv(e){let{ctx:t,bundle:n,rowIndex:r,rowY:i,bundleRowHeightPx:a,w:o,labelW:s,chartW:c,rangeStart:l,rangeEnd:u,focusIds:d,hoveredId:f,theme:p,palette:m,testStatsById:h,showTests:g}=e,_=d==null||d.has(n.item.unique_id)||n.lanes.some(e=>d.has(e.item.unique_id)),v=d==null||d.has(n.item.unique_id),y=f===n.item.unique_id,b=v?1:.18;if(Tv(t,r,i,o,a,_,y,m),Ev({ctx:t,item:n.item,rowY:i,labelW:s,xOffset:0,emphasis:b,palette:m}),Dv({ctx:t,item:n.item,rowY:i,rangeStart:l,rangeEnd:u,chartW:c,labelW:s,emphasis:b,isHovered:y,attachedTestStats:h?.get(n.item.unique_id),palette:m,theme:p}),!(!g||n.lanes.length===0))for(let{item:e,lane:r}of n.lanes){let n=i+44+5+r*14,a=f===e.unique_id;Ov({ctx:t,test:e,chipY:n,rangeStart:l,rangeEnd:u,chartW:c,labelW:s,palette:m,theme:p,emphasis:d==null||d.has(e.unique_id)?1:.18,isHovered:a})}}function Mv(e,t,n,r,{scrollTop:i,rangeStart:a,rangeEnd:o,displayMode:s,runStartedAt:c,focusIds:l,hoveredId:u,labelW:d=160,timeZone:f,testStatsById:p,theme:m=`light`,showTests:h=!1}){let g=kv(e,d);if(!g)return;let{ctx:_,w:v,h:y,chartW:b}=g,x=gr(m);if(Av({ctx:_,labelW:d,chartW:b,h:y,rangeStart:a,rangeEnd:o,displayMode:s,runStartedAt:c,timeZone:f,palette:x}),t.length===0)return;let S=y-32,C=Nv(n,i),w=Pv(n,r,i,S);_.textBaseline=`middle`;for(let e=C;e<=w;e++){let s=t[e];if(!s)continue;let c=32+(n[e]??0)-i;jv({ctx:_,bundle:s,rowIndex:e,rowY:c,bundleRowHeightPx:r[e]??44,w:v,labelW:d,chartW:b,rangeStart:a,rangeEnd:o,focusIds:l,hoveredId:u,theme:m,palette:x,testStatsById:p,showTests:h})}}function Nv(e,t){if(e.length===0)return 0;let n=0,r=e.length-1;for(;n<r;){let i=Math.floor((n+r)/2);(e[i]??0)<t?n=i+1:r=i}return Math.max(0,n-1)}function Pv(e,t,n,r){let i=n+r,a=0;for(let r=0;r<e.length;r++){let o=e[r]??0;if(!(o+(t[r]??44)<=n)){if(o>=i)break;a=r}}return a}function Fv({canvasRef:e,bundles:t,rowOffsets:n,rowHeights:r,scrollTop:i,rangeStart:a,rangeEnd:o,activeMode:s,runStartedAt:l,focusedIds:u,hoveredId:d,effectiveLabelW:f,timeZone:p,testStatsById:m,theme:h,showTests:g,setContainerWidth:_}){(0,c.useEffect)(()=>{if(t.length===0)return;function c(){let c=e.current;c&&Mv(c,t,n,r,{scrollTop:i,rangeStart:a,rangeEnd:o,displayMode:s,runStartedAt:l,focusIds:u,hoveredId:d,labelW:f,timeZone:p,testStatsById:m,theme:h,showTests:g})}let v=e.current;if(!v)return;c();let y=new ResizeObserver(e=>{let t=e[0];t&&_(t.contentRect.width),c()});return y.observe(v),()=>y.disconnect()},[t,n,r,i,a,o,s,l,u,d,f,p,m,h,g,_])}function Iv(e){return Math.max(1,Math.min(3,Math.trunc(e)))}function Lv(e){let t=Iv(e.dependencyDepthHops);return{includeUpstream:e.dependencyDirection!==`downstream`,includeDownstream:e.dependencyDirection!==`upstream`,showAllUpstream:!1,maxUpstreamEdges:8,showAllDownstream:!1,maxDownstreamEdges:8,extendedDeps:t>1?{enabled:!0,maxHops:Iv(t),maxEdgesPerDirection:12}:{enabled:!1}}}function Rv({edgeFocusId:e,timelineAdjacency:t,itemById:n,bundleIndexById:r,dependencyDirection:i,dependencyDepthHops:a}){let o=(0,c.useMemo)(()=>Lv({dependencyDirection:i,dependencyDepthHops:a}),[a,i]),{edges:s}=(0,c.useMemo)(()=>P_(e,t,n,r,o),[e,t,n,r,o]);return{edges:s}}function zv({data:e,runStartedAt:t,timelineAdjacency:n,testStatsById:r,resourceByUniqueId:i,showTests:a=!1,dependencyDirection:o=`both`,dependencyDepthHops:l=2,selectedId:d=null,onSelect:f,timeWindow:p=null,onTimeWindowChange:m}){let h=di(),g=(0,c.useRef)(null),_=(0,c.useRef)(null),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(`duration`),[S,C]=(0,c.useState)(n_),[w,T]=(0,c.useState)(0),[E,D]=(0,c.useState)(()=>typeof window>`u`?900:window.innerHeight),O=(0,c.useMemo)(()=>t_(),[]),k=t!=null,A=k?b:`duration`;(0,c.useEffect)(()=>{try{window.localStorage.setItem(Qg,S)}catch{}},[S]);let{effectiveLabelW:j,maxLabelW:M,onLabelColumnWidthDrag:N}=p_(w),P=(0,c.useMemo)(()=>qg(e),[e]),ee=(0,c.useMemo)(()=>{let e=1;for(let t of P){e=Math.max(e,t.item.end);for(let n of t.tests)e=Math.max(e,n.end)}return e},[P]),F=(0,c.useMemo)(()=>{if(!p)return P;let{start:t,end:n}=p,r=new Set;for(let e of P)for(let i of e.tests)if(i.end>t&&i.start<n){r.add(e.item.unique_id);break}return qg(e.filter(e=>e.end>t&&e.start<n?!0:r.has(e.unique_id)))},[e,P,p]),te=p?.start??0,ne=p?p.end:ee,re=te,ie=ne,{rowOffsets:ae,rowHeights:oe}=(0,c.useMemo)(()=>dv(F,a),[F,a]),se=(0,c.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.unique_id,n);return t},[e]),ce=s({count:F.length,getScrollElement:()=>_.current,estimateSize:e=>F[e]?uv(F[e],a):44,getItemKey:e=>F[e]?.item.unique_id??e,overscan:10}),le=ce.scrollOffset??0;(0,c.useLayoutEffect)(()=>{ce.measure()},[F,a,ce]);let ue=(0,c.useMemo)(()=>({rowOffsets:ae,rowHeights:oe,showTests:a}),[ae,oe,a]),de=(0,c.useMemo)(()=>{let e=new Map;for(let t=0;t<F.length;t++){let n=F[t];if(n){e.set(n.item.unique_id,t);for(let r of n.tests)e.set(r.unique_id,t)}}return e},[F]),fe=d??v?.item.unique_id??null,{edges:pe}=Rv({edgeFocusId:fe,timelineAdjacency:n,itemById:se,bundleIndexById:de,dependencyDirection:o,dependencyDepthHops:l}),me=(0,c.useMemo)(()=>{if(!fe)return null;let e=new Set([fe]);for(let t of pe)e.add(t.fromId),e.add(t.toId);return e},[fe,pe]),he=32+ce.getTotalSize(),ge=Math.max(240,Math.min(E-320,Math.round(E*Xg))),_e=Math.max(240,Math.min(ge,he)),ve=he>_e;if((0,c.useEffect)(()=>{let e=()=>D(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),Fv({canvasRef:g,bundles:F,rowOffsets:ae,rowHeights:oe,scrollTop:le,rangeStart:re,rangeEnd:ie,activeMode:A,runStartedAt:t,focusedIds:me,hoveredId:v?.item.unique_id??null,effectiveLabelW:j,timeZone:S,testStatsById:r,theme:h,showTests:a,setContainerWidth:T}),P.length===0)return(0,u.jsx)(`div`,{className:`empty-state empty-state--chart`,children:`No Gantt data (run_results may lack timing info)`});function ye(e,t){mv(e,t,{bundles:F,layout:ue,scrollTop:le,rangeStart:re,rangeEnd:ie,effectiveLabelW:j,canvas:g.current,setHover:y,onSelect:f})}return(0,u.jsxs)(`div`,{className:`gantt-shell`,role:`region`,"aria-label":`Execution timeline`,children:[k&&(0,u.jsx)(iv,{activeMode:A,onChange:x,activeTimeZone:S,timeZones:O,onTimeZoneChange:C}),(0,u.jsx)(cv,{bundles:P,maxEnd:ee,timeWindow:p,testStatsById:r,onChange:m??(()=>{})}),(0,u.jsx)(rv,{canvasRef:g,scrollRef:_,edges:pe,edgeFocusId:fe,itemById:se,bundleIndexById:de,bundles:F,rowOffsets:ae,containerWidth:w,effectiveLabelW:j,rangeStart:re,rangeEnd:ie,scrollTop:le,viewportH:_e,needsScroll:ve,totalScrollH:he,theme:h,showTests:a,hover:v,runStartedAt:t,canShowTimestamps:k,timeZone:S,testStatsById:r,resourceByUniqueId:i,selectedId:d,onSelect:f,onPointer:ye,onHoverClear:()=>y(null),labelColumnResize:{width:j,viewportH:_e,minW:120,maxW:M,onChange:N}})]})}var Bv={display:`inline-block`,width:10,height:10,borderRadius:2,flexShrink:0},Vv=` gantt-legend__item--active`;function Hv(e){return`gantt-legend__item${e?Vv:``}`}function Uv(e,t){return{...Bv,background:e.bgSoft,borderLeft:`3px solid ${t}`,borderRadius:0}}function Wv({theme:e,themeHex:t,showCompileExecuteLegend:n}){let r=pr(`model`,e),i=gv(`success`,e);return(0,u.jsxs)(`div`,{className:`gantt-legend__group gantt-legend__group--bar-key`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__label`,children:`Bars`}),(0,u.jsxs)(`div`,{className:`gantt-legend__bar-key-row`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-swatch`,style:{background:r,border:`2px solid ${t.borderDefault}`,borderRadius:3},title:`Bar fill follows resource type`,"aria-hidden":!0}),(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-caption`,children:`Fill = type`}),(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-swatch`,style:{background:t.bgSoft,border:`2px solid ${i}`,borderRadius:3},title:`Bar outline follows run status`,"aria-hidden":!0}),(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-caption`,children:`Border = status`})]}),n?(0,u.jsxs)(`div`,{className:`gantt-legend__bar-key-row gantt-legend__bar-key-row--phases`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-swatch`,style:{background:e===`dark`?`rgba(0, 0, 0, 0.24)`:`rgba(0, 0, 0, 0.12)`,border:`1px solid ${t.borderDefault}`,borderRadius:2},"aria-hidden":!0}),(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-caption`,children:`Compile (darker)`}),(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-swatch`,style:{background:r,border:`1px solid ${t.borderDefault}`,borderRadius:2},"aria-hidden":!0}),(0,u.jsx)(`span`,{className:`gantt-legend__bar-key-caption`,children:`Execute`})]}):null]})}function Gv({visibleStatuses:e,statusCounts:t,activeStatuses:n,onToggleStatus:r,failuresOnly:i,onToggleFailuresOnly:a,theme:o}){return e.length===0&&a==null?null:(0,u.jsxs)(`div`,{className:`gantt-legend__group`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__label`,children:`Status`}),e.map(e=>{let i=n?.has(e)??!1,a=gv(e,o),s=t[e]??0;return(0,u.jsxs)(`button`,{type:`button`,className:Hv(i),onClick:()=>r?.(e),title:`${e} (${s})`,children:[(0,u.jsx)(`span`,{style:{...Bv,background:a}}),(0,u.jsx)(`span`,{className:`gantt-legend__name`,children:e}),(0,u.jsx)(`span`,{className:`gantt-legend__count`,children:s})]},e)}),a!=null&&(0,u.jsxs)(`button`,{type:`button`,className:Hv(!!i),onClick:a,title:i?`Show all parent rows`:`Show only parents with errors or failing tests`,"aria-pressed":i??!1,children:[(0,u.jsx)(`span`,{style:{...Bv,background:gv(`fail`,o)},"aria-hidden":!0}),(0,u.jsx)(`span`,{className:`gantt-legend__name`,children:`failures only`})]})]})}function Kv({visibleTypes:e,typeCounts:t,activeTypes:n,onToggleType:r,showTests:i,onToggleShowTests:a,testsLegendCount:o,theme:s,themeHex:c}){return e.length===0&&a==null?null:(0,u.jsxs)(`div`,{className:`gantt-legend__group`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__label`,children:`Type`}),e.map(e=>{let i=n?.has(e)??!1,a=_v(e,s),o=t[e]??0;return(0,u.jsxs)(`button`,{type:`button`,className:Hv(i),onClick:()=>r?.(e),title:`${e} (${o})`,children:[(0,u.jsx)(`span`,{style:Uv(c,a)}),(0,u.jsx)(`span`,{className:`gantt-legend__name`,children:e}),(0,u.jsx)(`span`,{className:`gantt-legend__count`,children:o})]},e)}),a!=null&&(0,u.jsxs)(`button`,{type:`button`,className:Hv(!!i),onClick:a,title:i?`Hide test chips`:`Show test chips`,"aria-pressed":i??!1,children:[(0,u.jsx)(`span`,{style:Uv(c,_v(`test`,s)),"aria-hidden":!0}),(0,u.jsx)(`span`,{className:`gantt-legend__name`,children:`tests`}),(0,u.jsx)(`span`,{className:`gantt-legend__count`,children:o})]})]})}function qv({materializationRows:e,materializationCounts:t,themeHex:n}){return e.length===0||t==null?null:(0,u.jsxs)(`div`,{className:`gantt-legend__group gantt-legend__group--materialization`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__label`,children:`Materialization`}),(0,u.jsx)(`span`,{className:`gantt-legend__hint`,children:`Manifest-derived; not a bar color.`}),e.map(e=>{let r=t[e]??0;return(0,u.jsxs)(`div`,{className:`gantt-legend__item gantt-legend__item--static`,title:`Normalized from manifest config.materialized and resource type`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__mat-icon`,"aria-hidden":!0,style:{...Bv,borderRadius:0,border:`2px dashed ${n.borderDefault}`,background:n.bgSoft}}),(0,u.jsx)(`span`,{className:`gantt-legend__name`,children:aa(e)}),(0,u.jsx)(`span`,{className:`gantt-legend__count`,children:r})]},e)})]})}function Jv({statusCounts:e,typeCounts:t,activeStatuses:n,activeTypes:r,onToggleStatus:i,onToggleType:a,showTests:o,onToggleShowTests:s,testsLegendCount:c=0,failuresOnly:l,onToggleFailuresOnly:d,showBarEncodingKey:f=!0,showCompileExecuteLegend:p=!1,materializationCounts:m}){let h=di(),g=Qn(h),_=Object.keys(hv).filter(t=>(e[t]??0)>0),v=[...new Set([...Sr,...Object.keys(t)])].sort((e,t)=>e.localeCompare(t)),y=m==null?[]:na.filter(e=>(m[e]??0)>0);return _.length>0||v.length>0||s!=null||d!=null||y.length>0?(0,u.jsxs)(`div`,{className:`gantt-legend`,children:[f?(0,u.jsx)(Wv,{theme:h,themeHex:g,showCompileExecuteLegend:p}):null,(0,u.jsx)(Gv,{visibleStatuses:_,statusCounts:e,activeStatuses:n,onToggleStatus:i,failuresOnly:l,onToggleFailuresOnly:d,theme:h}),(0,u.jsx)(Kv,{visibleTypes:v,typeCounts:t,activeTypes:r,onToggleType:a,showTests:o,onToggleShowTests:s,testsLegendCount:c,theme:h,themeHex:g}),(0,u.jsx)(qv,{materializationRows:y,materializationCounts:m,themeHex:g})]}):null}var Yv=[{value:`upstream`,label:`Upstream`,glyph:`←`},{value:`both`,label:`Both`,glyph:`⇄`},{value:`downstream`,label:`Downstream`,glyph:`→`}];function Xv({filters:e,setFilters:t}){let n=Iv(e.dependencyDepthHops),r=e=>t(t=>({...t,dependencyDepthHops:Iv(e)}));return(0,u.jsx)(`div`,{className:`timeline-dependency-controls gantt-legend`,"aria-label":`Dependency visualization controls`,children:(0,u.jsxs)(`div`,{className:`timeline-dependency-controls__top-row`,children:[(0,u.jsxs)(`div`,{className:`timeline-dependency-controls__zone`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__label`,children:`Depth`}),(0,u.jsxs)(`div`,{className:`timeline-dependency-controls__stepper`,role:`group`,"aria-label":`Dependency depth`,children:[(0,u.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>r(n-1),disabled:n<=1,"aria-label":`Decrease dependency depth`,children:`-`}),(0,u.jsx)(`span`,{className:`timeline-dependency-controls__depth-value`,children:n}),(0,u.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>r(n+1),disabled:n>=3,"aria-label":`Increase dependency depth`,children:`+`})]}),(0,u.jsx)(`button`,{type:`button`,className:`workspace-pill timeline-dependency-controls__max-button`,onClick:()=>r(3),children:`Max`})]}),(0,u.jsx)(`div`,{className:`timeline-dependency-controls__divider`,"aria-hidden":`true`}),(0,u.jsxs)(`div`,{className:`timeline-dependency-controls__zone timeline-dependency-controls__zone--direction`,children:[(0,u.jsx)(`span`,{className:`gantt-legend__label`,children:`Direction`}),(0,u.jsx)(`div`,{className:`workspace-segmented-control`,role:`tablist`,"aria-label":`Dependency direction`,children:Yv.map(n=>{let r=e.dependencyDirection===n.value;return(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:r?`workspace-segmented-control__button workspace-segmented-control__button--active`:`workspace-segmented-control__button`,onClick:()=>t(e=>({...e,dependencyDirection:n.value})),children:[(0,u.jsx)(`span`,{"aria-hidden":`true`,children:n.glyph}),` `,n.label]},n.value)})})]})]})})}function Zv(e,t,n){let r=(0,c.useMemo)(()=>new Set(n.map(e=>e.unique_id)),[n]),i=(0,c.useMemo)(()=>new Map(e.ganttData.map(e=>[e.unique_id,e])),[e.ganttData]),a=(0,c.useMemo)(()=>M_(t.selectedExecutionId,r,i),[t.selectedExecutionId,r,i]),o=(0,c.useMemo)(()=>N_({focusId:a,timelineAdjacency:e.timelineAdjacency,candidateIds:r,dependencyDirection:t.dependencyDirection,dependencyDepthHops:t.dependencyDepthHops}),[a,e.timelineAdjacency,r,t.dependencyDirection,t.dependencyDepthHops]),s=(0,c.useMemo)(()=>t.selectedExecutionId==null||t.neighborhoodRowsShowAll?n:n.filter(e=>o.has(e.unique_id)),[n,t.selectedExecutionId,t.neighborhoodRowsShowAll,o]),l=(0,c.useMemo)(()=>n.filter(e=>o.has(e.unique_id)).length,[n,o]);return{displayedParents:s,neighborhoodUi:(0,c.useMemo)(()=>t.selectedExecutionId==null||n.length===0||l>=n.length?null:t.neighborhoodRowsShowAll?{mode:`expanded`,total:n.length,narrowedCount:l}:{mode:`narrowed`,shown:l,total:n.length},[t.selectedExecutionId,t.neighborhoodRowsShowAll,n.length,l])}}function Qv({filters:e,hasActiveFilters:t,typeFilterHint:n,setFilters:r}){return(0,u.jsxs)(`div`,{className:`timeline-toolbar`,children:[(0,u.jsxs)(`label`,{className:`workspace-search workspace-search--compact timeline-toolbar__search`,children:[(0,u.jsx)(`span`,{children:`Search nodes`}),(0,u.jsxs)(`div`,{className:`workspace-search__input-row`,children:[(0,u.jsx)(`input`,{value:e.query,onChange:e=>r(t=>({...t,query:e.target.value})),placeholder:`Filter by name or id…`,"aria-label":`Search timeline nodes`}),e.query&&(0,u.jsx)(`button`,{type:`button`,className:`workspace-search__clear`,"aria-label":`Clear search`,onClick:()=>r(e=>({...e,query:``})),children:`✕`})]})]}),(n!=null||t)&&(0,u.jsxs)(`div`,{className:`timeline-toolbar__actions`,children:[n!=null&&(0,u.jsxs)(`p`,{className:`timeline-toolbar__hint`,role:`status`,children:[n.shown.length>0?`Showing types: ${n.shown.join(`, `)}. `:``,`Hidden by type filter:`,` `,n.hidden.map(({type:e,count:t})=>`${e} (${t})`).join(`, `),`.`]}),(0,u.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>{r(e=>({...e,query:``,activeStatuses:new Set,activeTypes:new Set,selectedExecutionId:null,dependencyDirection:`both`,dependencyDepthHops:2,neighborhoodRowsShowAll:!1}))},children:`Clear all filters`})]})]})}function $v({ui:e,setFilters:t}){return e.mode===`narrowed`?(0,u.jsxs)(u.Fragment,{children:[`Showing `,e.shown.toLocaleString(),` of `,e.total.toLocaleString(),` timeline rows (dependency neighborhood)`,` — `,(0,u.jsx)(`button`,{type:`button`,className:`timeline-neighborhood-action`,onClick:()=>t(e=>({...e,neighborhoodRowsShowAll:!0})),children:`Show all rows`})]}):(0,u.jsxs)(u.Fragment,{children:[`Showing all `,e.total.toLocaleString(),` timeline rows`,` — `,(0,u.jsxs)(`button`,{type:`button`,className:`timeline-neighborhood-action`,onClick:()=>t(e=>({...e,neighborhoodRowsShowAll:!1})),children:[`Neighborhood only (`,e.narrowedCount.toLocaleString(),` rows)`]})]})}function ey(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ty(e,t,n){let r=n.get(e.unique_id),i=r?r.error+r.warn>0:t.some(e=>!i_(e.status));return!i_(e.status)||i}function ny(e,t){let n=t.trim().toLowerCase();return n?e.name.toLowerCase().includes(n)||e.unique_id.toLowerCase().includes(n):!0}function ry({analysis:e,filters:t,effectiveActiveTypes:n,filteredData:r,bundleRowCount:i,neighborhoodUi:a,statusCounts:o,typeCounts:s,materializationCounts:l,testsLegendCount:d,hasActiveFilters:f,typeFilterHint:p,testStatsById:m,resourceByUniqueId:h,setFilters:g,toggleStatus:_,toggleType:v,onInvestigationSelectionChange:y}){let b=(0,c.useMemo)(()=>Kr(e.ganttData),[e.ganttData]),{timeWindow:x}=t;return(0,u.jsxs)(yi,{title:`Execution timeline`,subtitle:`Relative start and duration for each executed node.`,children:[(0,u.jsx)(Jv,{statusCounts:o,typeCounts:s,testsLegendCount:d,materializationCounts:l,activeStatuses:t.activeStatuses,activeTypes:n,onToggleStatus:_,onToggleType:v,showTests:t.showTests,onToggleShowTests:()=>g(e=>({...e,showTests:!e.showTests})),failuresOnly:t.failuresOnly,onToggleFailuresOnly:()=>g(e=>({...e,failuresOnly:!e.failuresOnly})),showCompileExecuteLegend:b}),(0,u.jsx)(Qv,{filters:t,hasActiveFilters:f,typeFilterHint:p,setFilters:g}),(0,u.jsx)(Xv,{filters:t,setFilters:g}),x!=null&&(0,u.jsxs)(`p`,{className:`timeline-zoom-active`,role:`status`,children:[`Zoomed to `,$g(x.end-x.start),` window`,` — `,(0,u.jsx)(`button`,{type:`button`,className:`timeline-zoom-clear`,onClick:()=>g(e=>({...e,timeWindow:null})),children:`Clear zoom ×`})]}),a!=null&&(0,u.jsx)(`p`,{className:`timeline-neighborhood-active`,role:`status`,children:(0,u.jsx)($v,{ui:a,setFilters:g})}),i>=2e4?(0,u.jsxs)(`p`,{className:`timeline-large-dataset-hint`,role:`status`,children:[`Showing `,i.toLocaleString(),` timeline rows. Use search or type and status filters to narrow the list.`]}):null,(0,u.jsx)(zv,{data:r,runStartedAt:e.runStartedAt,timelineAdjacency:e.timelineAdjacency,testStatsById:m,resourceByUniqueId:h,showTests:t.showTests,dependencyDirection:t.dependencyDirection,dependencyDepthHops:t.dependencyDepthHops,selectedId:t.selectedExecutionId,timeWindow:x,onTimeWindowChange:e=>g(t=>({...t,timeWindow:e})),onSelect:t=>{g(e=>{let n=t==null,r=t!==e.selectedExecutionId,i=n||r?!1:e.neighborhoodRowsShowAll;return{...e,selectedExecutionId:t,neighborhoodRowsShowAll:i}}),y(n=>({...n,selectedExecutionId:t,selectedResourceId:t==null?n.selectedResourceId:e.resources.find(e=>e.uniqueId===t)?.uniqueId??n.selectedResourceId,sourceLens:`timeline`}))}})]})}function iy({analysis:e,filters:t,setFilters:n,onInvestigationSelectionChange:r}){let i=(0,c.useDeferredValue)(t.query),a=e.projectName??Vr(e.executions),o=(0,c.useMemo)(()=>Array.from(new Set(e.ganttData.filter(e=>Gr(e,a)).map(e=>e.resourceType).filter(e=>!!e))).sort(),[e.ganttData,a]),s=(0,c.useMemo)(()=>Wr(o),[o]),l=t.activeTypes.size>0?t.activeTypes:s;function d(e){n(t=>{let n=new Set(t.activeStatuses);return n.has(e)?n.delete(e):n.add(e),{...t,activeStatuses:n}})}function f(e){n(t=>{let n=new Set(t.activeTypes.size>0?t.activeTypes:s);return n.has(e)?n.delete(e):n.add(e),{...t,activeTypes:n}})}let p=(0,c.useMemo)(()=>ma(e.resources,e.dependencyIndex),[e.dependencyIndex,e.resources]),m=(0,c.useMemo)(()=>new Map(e.resources.map(e=>[e.uniqueId,e])),[e.resources]),h=(0,c.useMemo)(()=>{let t=new Map;for(let n of e.ganttData){if(!H.has(n.resourceType)||n.parentId==null)continue;let e=t.get(n.parentId)??[];e.push(n),t.set(n.parentId,e)}return t},[e.ganttData]),{displayedParents:g,neighborhoodUi:_}=Zv(e,t,(0,c.useMemo)(()=>e.ganttData.filter(e=>H.has(e.resourceType)||t.activeTypes.size===0&&!Gr(e,a)||t.activeStatuses.size>0&&!t.activeStatuses.has(e.status.toLowerCase())||l.size>0&&!l.has(e.resourceType??``)||!ny(e,i)?!1:t.failuresOnly?ty(e,h.get(e.unique_id)??[],p):!0),[e.ganttData,i,l,t.activeStatuses,t.failuresOnly,t.activeTypes.size,a,p,h])),v=(0,c.useMemo)(()=>new Set(g.map(e=>e.unique_id)),[g]),y=(0,c.useMemo)(()=>t.showTests?e.ganttData.filter(e=>H.has(e.resourceType)&&e.parentId!=null&&v.has(e.parentId)):[],[e.ganttData,t.showTests,v]),b=(0,c.useMemo)(()=>[...g,...y],[g,y]),x=(0,c.useMemo)(()=>{let e={};for(let t of b){let n=t.semantics?.materialization??`unknown`;e[n]=(e[n]??0)+1}return e},[b]),{statusCounts:S,typeCounts:C}=(0,c.useMemo)(()=>{let t={},n={};for(let r of e.ganttData){if(!Gr(r,a))continue;let e=r.status.toLowerCase();t[e]=(t[e]??0)+1;let i=r.resourceType;n[i]=(n[i]??0)+1}return{statusCounts:t,typeCounts:n}},[e.ganttData,a]),w=(0,c.useMemo)(()=>qr(e.ganttData,a),[e.ganttData,a]),T=!ey(l,s),E=(0,c.useMemo)(()=>{if(!T)return null;let e=[...l].filter(e=>s.has(e)).sort(),t=[...s].filter(e=>!l.has(e)).sort().map(e=>({type:e,count:C[e]??0}));return t.length===0?null:{shown:e,hidden:t}},[s,l,T,C]),D=t.activeStatuses.size>0||T||t.query.length>0;return(0,u.jsx)(Ci,{title:`Timeline`,description:`Runtime timing, concurrency, bottlenecks, and execution order.`,className:`timeline-view`,children:(0,u.jsx)(ry,{analysis:e,filters:t,effectiveActiveTypes:l,filteredData:b,bundleRowCount:g.length,neighborhoodUi:_,statusCounts:S,typeCounts:C,materializationCounts:x,testsLegendCount:w,hasActiveFilters:D,typeFilterHint:E,testStatsById:p,resourceByUniqueId:m,setFilters:n,toggleStatus:d,toggleType:f,onInvestigationSelectionChange:r})})}var ay=100;function oy(){return{status:{all:0,positive:0,warning:0,danger:0},facets:{all:0,models:0,tests:0,seeds:0,snapshots:0,operations:0,healthy:0,warnings:0,errors:0,issues:0},resourceTypes:{},threadIds:{}}}function sy(e,t,n=!0){let r=(0,c.useRef)(null),i=(0,c.useRef)(0),[a,o]=(0,c.useState)(!1),[s,l]=(0,c.useState)(ay),[u,d]=(0,c.useState)([]),[f,p]=(0,c.useState)(0),[m,h]=(0,c.useState)(oy),[g,_]=(0,c.useState)(!0),[v,y]=(0,c.useState)(!1),[b,x]=(0,c.useState)(null);return(0,c.useEffect)(()=>{l(ay)},[t.kind,t.status,t.query,t.durationBand,t.sortBy,t.sortDirection,t.resourceTypes,t.materializationKinds,t.threadIds,e]),(0,c.useEffect)(()=>{if(!n){o(!1),_(!1),y(!1),d([]),p(0),h(oy()),x(null);return}let t=new Worker(new URL(`/assets/resultsQuery.worker-BrgyEpD8.js`,``+import.meta.url),{type:`module`});return r.current=t,o(!1),_(!0),d([]),p(0),h(oy()),x(null),t.onmessage=e=>{let t=e.data;if(t.type===`ready`){o(!0),_(!1),h(t.summary);return}if(t.type===`query-result`){if(t.requestId!==i.current)return;d(t.rows),p(t.totalMatches),h(t.summary),y(!1);return}x(t.message),_(!1),y(!1)},t.postMessage({type:`init`,rows:e}),()=>{t.terminate(),r.current=null}},[e,n]),(0,c.useEffect)(()=>{if(!n||!a||r.current==null)return;let e=i.current+1;i.current=e,y(!0),x(null),r.current.postMessage({type:`query`,requestId:e,kind:t.kind,status:t.status,query:t.query,resourceTypes:Array.from(t.resourceTypes),materializationKinds:Array.from(t.materializationKinds),threadIds:Array.from(t.threadIds),durationBand:t.durationBand,sortBy:t.sortBy,sortDirection:t.sortDirection,limit:s})},[n,a,s,t]),(0,c.useMemo)(()=>({rows:u,totalMatches:f,totalVisible:u.length,summary:m,hasMore:u.length<f,isIndexing:g,isLoading:v,error:b,loadMore:()=>l(e=>e+ay)}),[u,f,m,g,v,b])}function cy(e){return e.kind===`number`?0:1}function ly(e){return`adapter:${e}`}function uy(e){return e.startsWith(`adapter:`)}function dy(e,t){let n=Vn([e.adapterMetrics]).find(e=>e.key===t),r=n?zn(e.adapterMetrics,n.key):void 0;if(!(n==null||r===void 0))return{displayValue:Bn(n,r),sortValue:typeof r==`number`||typeof r==`string`?r:void 0,isScalar:!0}}function fy(e){let t=Vn(e.map(e=>e.adapterMetrics)).map(t=>({id:ly(t.key),key:t.key,label:t.shortLabel,kind:t.kind,align:t.kind===`number`?`end`:`start`,isScalar:!0,presenceCount:e.filter(e=>zn(e.adapterMetrics,t.key)!==void 0).length})).sort((e,t)=>{let n=cy(e),r=cy(t);return n===r?e.presenceCount===t.presenceCount?e.key.localeCompare(t.key):t.presenceCount-e.presenceCount:n-r});return{allColumns:t,visibleColumns:t.slice(0,6),overflowColumns:t.slice(6)}}function py(e,t){return t.map(t=>{let n=dy(e,t.key);return`${t.label}: ${n?.displayValue??`—`}`}).join(`
|
|
35
35
|
`)}var my=`Raw adapter response fields`,hy=`Adapter metrics`;function gy({row:e,visibleColumns:t,overflowColumns:n,onNavigateTo:r}){if(!e)return null;let i=e.adapterResponseFields?.length??0,a=Gn(e.adapterMetrics,e.adapterResponseFields),o=t.length>0||n.length>0?[...t.length>0?[{label:hy,value:py(e,t)}]:[],...n.length>0?[{label:`More adapter metrics`,value:py(e,n)}]:[]]:e.adapterMetrics?[{label:hy,value:`This row has normalized adapter metrics but none are configured as visible columns.`}]:[],s=i===0?[{label:my,value:`This row has no adapter_response fields.`}]:a.length>0?[{label:my,value:a.map(e=>`${e.label}: ${e.displayValue}`).join(`
|
|
36
|
-
`)}]:[],c=[...o,...s];return(0,u.jsx)(Ti,{eyebrow:`Selected run item`,title:e.name,typeLabel:Dr(e.resourceType),stats:[{label:`Status`,value:e.status},{label:`Duration`,value:Er(e.executionTime)},{label:`Thread`,value:e.threadId??`n/a`},{label:hy,value:String(t.length+n.length)},{label:`Extra raw fields`,value:String(a.length)}],sections:c,actions:[{label:`Open in Timeline`,onClick:()=>r(`timeline`,{resourceId:e.uniqueId,executionId:e.uniqueId})},{label:`Open in Inventory`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},{label:`Open in Lineage`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`lineage`,rootResourceId:e.uniqueId})}]})}function _y(e){if(uy(e))return`desc`;switch(e){case`attention`:case`duration`:case`start`:return`desc`;default:return`asc`}}function vy(e,t){return t.sortBy===e?{sortBy:e,sortDirection:t.sortDirection===`asc`?`desc`:`asc`}:{sortBy:e,sortDirection:_y(e)}}function yy(e,t,n){return e===t?n===`asc`?{indicator:`↑`,ariaSort:`ascending`}:{indicator:`↓`,ariaSort:`descending`}:{indicator:` `,ariaSort:`none`}}function by(e){let t=[`minmax(280px, 2.5fr)`,`minmax(108px, 0.85fr)`,`minmax(92px, 0.7fr)`,`minmax(132px, 0.95fr)`,`minmax(96px, 0.72fr)`],n=e.map(e=>e.align===`end`?`minmax(120px, 0.95fr)`:`minmax(148px, 1.1fr)`);return[...t,...n,`minmax(160px, 1fr)`].join(` `)}function xy(e,t){return dy(e,t.key)?.displayValue??`—`}var Sy=`results-table__cell--align-end`;function Cy({sortKey:e,label:t,alignEnd:n,cellClassName:r,runsViewState:i,onRunsViewStateChange:a}){let o=yy(i.sortBy,e,i.sortDirection);return(0,u.jsx)(`div`,{className:`results-table__cell${r?` ${r}`:``}${n?` ${Sy}`:``}`,role:`columnheader`,"aria-sort":o.ariaSort,children:(0,u.jsxs)(`button`,{type:`button`,className:`results-table__sort-button${n?` results-table__sort-button--align-end`:``}`,onClick:()=>a(t=>({...t,...vy(e,t)})),children:[t,(0,u.jsx)(`span`,{className:`results-table__sort-indicator`,"aria-hidden":`true`,children:o.indicator})]})})}function wy({analysis:e,runsResults:t,runsViewState:n,adapterColumns:r,onRunsViewStateChange:i,onInvestigationSelectionChange:a}){let o=(0,c.useRef)(null),l=(0,c.useRef)(null),[d,f]=(0,c.useState)(44);(0,c.useLayoutEffect)(()=>{let e=l.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{f(Math.max(1,Math.ceil(e.getBoundingClientRect().height)))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r.length]);let p=s({count:t.rows.length,getScrollElement:()=>o.current,estimateSize:()=>76,overscan:10,scrollMargin:d});(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let n=()=>{e.scrollHeight-e.scrollTop-e.clientHeight<220&&t.hasMore&&!t.isLoading&&!t.isIndexing&&t.loadMore()};return e.addEventListener(`scroll`,n),n(),()=>e.removeEventListener(`scroll`,n)},[t]);let m={"--results-table-columns":by(r)},h=Math.min(560,Math.max(120,t.rows.length*76)),g=p.options.scrollMargin;return(0,u.jsx)(`div`,{className:`results-table`,style:m,children:(0,u.jsxs)(`div`,{ref:o,className:`results-table__scroll`,style:{height:h,overflowY:`auto`,position:`relative`},children:[(0,u.jsxs)(`div`,{ref:l,className:`results-table__header results-table__header--sticky`,role:`row`,children:[(0,u.jsx)(Cy,{sortKey:`name`,label:`Item`,cellClassName:`results-table__cell--item`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`resourceType`,label:`Type`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`materialization`,label:`Materialization`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`status`,label:`Status`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`duration`,label:`Duration`,alignEnd:!0,runsViewState:n,onRunsViewStateChange:i}),r.map(e=>{let t=e.align===`end`;return e.isScalar?(0,u.jsx)(Cy,{sortKey:e.id,label:e.label,alignEnd:t,runsViewState:n,onRunsViewStateChange:i},e.id):(0,u.jsx)(`div`,{className:`results-table__cell${t?` ${Sy}`:``}`,role:`columnheader`,title:e.label,children:e.label},e.id)}),(0,u.jsx)(Cy,{sortKey:`thread`,label:`Thread`,runsViewState:n,onRunsViewStateChange:i})]}),(0,u.jsx)(`div`,{className:`results-table__body`,children:(0,u.jsx)(`div`,{style:{height:p.getTotalSize(),position:`relative`},children:p.getVirtualItems().map(o=>{let s=t.rows[o.index];return s?(0,u.jsxs)(`button`,{type:`button`,className:`results-table__row${s.uniqueId===n.selectedExecutionId?` results-table__row--active`:``}`,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${o.start-g}px)`},onClick:()=>{let t=e.resources.find(e=>e.uniqueId===s.uniqueId)??null;i(e=>({...e,selectedExecutionId:s.uniqueId})),a(e=>({...e,selectedExecutionId:s.uniqueId,selectedResourceId:t?.uniqueId??s.uniqueId,sourceLens:`runs`}))},children:[(0,u.jsx)(`div`,{className:`results-table__cell results-table__cell--item`,"data-label":`Item`,title:s.name,children:(0,u.jsx)(`strong`,{children:s.name})}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Type`,title:s.resourceType,children:s.resourceType}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Materialization`,children:s.semantics?(0,u.jsx)(ua,{semantics:s.semantics,variant:`compact`}):`—`}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Status`,children:(0,u.jsx)(`span`,{className:Mr(s.statusTone),children:s.status})}),(0,u.jsx)(`div`,{className:`results-table__cell ${Sy}`,"data-label":`Duration`,children:Er(s.executionTime)}),r.map(e=>{let t=xy(s,e);return(0,u.jsx)(`div`,{className:`results-table__cell${e.align===`end`?` ${Sy}`:``}`,"data-label":e.label,title:t,children:t},e.id)}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Thread`,title:s.threadId??`n/a`,children:s.threadId??`n/a`})]},s.uniqueId):null})})})]})})}function Ty({kinds:e,activeKinds:t,onToggleKind:n,buttonTitle:r}){return(0,u.jsx)(`div`,{className:`pill-row`,children:e.map(e=>(0,u.jsx)(`button`,{type:`button`,className:t.size===0||t.has(e)?vr:yr,title:r,onClick:()=>n(e),children:aa(e)},e))})}var Ey=[{label:`All`,countKey:`all`},{kind:`models`,label:`Models`,countKey:`models`},{kind:`tests`,label:`Tests`,countKey:`tests`},{kind:`seeds`,label:`Seeds`,countKey:`seeds`},{kind:`snapshots`,label:`Snapshots`,countKey:`snapshots`},{kind:`operations`,label:`Operations`,countKey:`operations`},{status:`positive`,label:`Healthy`,countKey:`healthy`},{status:`issues`,label:`Issues`,countKey:`issues`},{status:`warning`,label:`Warnings`,countKey:`warnings`},{status:`danger`,label:`Errors`,countKey:`errors`}];function Dy(e){return e.facets}function Oy({runsViewState:e,runsResults:t,adapterColumnLayout:n,adapterMetricsAvailable:r,availableMaterializationKinds:i,onRunsViewStateChange:a}){let o=n.visibleColumns.filter(e=>e.isScalar),s=e.showAdapterMetrics&&o.length>0;return(0,u.jsxs)(`div`,{className:`runs-toolbar runs-toolbar--stacked`,children:[(0,u.jsxs)(`div`,{className:`runs-toolbar__controls`,children:[(0,u.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__search`,children:[(0,u.jsx)(`span`,{children:`Search`}),(0,u.jsx)(`input`,{value:e.query,onChange:e=>a(t=>({...t,query:e.target.value})),placeholder:`Filter by name, type, status, thread…`})]}),(0,u.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__sort`,children:[(0,u.jsx)(`span`,{children:`Sort`}),(0,u.jsxs)(`select`,{value:e.sortBy,onChange:e=>{let t=e.target.value;a(e=>({...e,sortBy:t,sortDirection:_y(t)}))},children:[(0,u.jsx)(`option`,{value:`attention`,children:`Attention`}),(0,u.jsx)(`option`,{value:`duration`,children:`Duration`}),(0,u.jsx)(`option`,{value:`name`,children:`Name`}),(0,u.jsx)(`option`,{value:`status`,children:`Status`}),(0,u.jsx)(`option`,{value:`start`,children:`Start`}),(0,u.jsx)(`option`,{value:`materialization`,children:`Materialization`}),s?o.map(e=>(0,u.jsx)(`option`,{value:e.id,children:e.label},e.id)):null]})]}),(0,u.jsxs)(`label`,{className:`runs-toolbar__toggle`,title:r?`Show normalized adapter metrics derived from the current run`:`No normalized adapter metrics are available in this run`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.showAdapterMetrics,disabled:!r,onChange:e=>{let t=e.target.checked;a(e=>({...e,showAdapterMetrics:t,sortBy:!t&&uy(e.sortBy)?`attention`:e.sortBy,sortDirection:!t&&uy(e.sortBy)?`desc`:e.sortDirection}))}}),(0,u.jsx)(`span`,{children:`Adapter metrics`})]})]}),i.length>0?(0,u.jsxs)(`div`,{className:`runs-toolbar__mat-filters`,role:`group`,"aria-label":`Materialization filters`,children:[(0,u.jsx)(`span`,{className:`runs-toolbar__mat-filters-label`,children:`Materialization (manifest)`}),(0,u.jsx)(Ty,{kinds:i,activeKinds:e.materializationKinds,onToggleKind:e=>a(t=>{let n=new Set(t.materializationKinds);return n.has(e)?n.delete(e):n.add(e),{...t,materializationKinds:n}}),buttonTitle:`Filter run rows by normalized manifest materialization`})]}):null,e.showAdapterMetrics&&n.overflowColumns.length>0?(0,u.jsxs)(`p`,{className:`runs-toolbar__meta`,children:[`Showing `,n.visibleColumns.length,` of`,` `,n.allColumns.length,` adapter metrics. Select a row to inspect the remaining `,n.overflowColumns.length,`.`]}):null,(0,u.jsx)(`div`,{className:`runs-toolbar__facets`,children:Ey.map(n=>{let r=Dy(t.summary);return(0,u.jsxs)(`button`,{type:`button`,className:n.kind!=null&&e.kind===n.kind||n.status!=null&&e.status===n.status||n.kind==null&&n.status==null&&e.kind===`all`&&e.status===`all`?`workspace-pill workspace-pill--active`:`workspace-pill`,onClick:()=>a(e=>({...e,kind:n.kind??`all`,status:n.status??`all`})),children:[n.label,` (`,r[n.countKey],`)`]},n.label)})})]})}function ky({analysis:e,runsViewState:t,onRunsViewStateChange:n,onInvestigationSelectionChange:r,onNavigateTo:i}){let a=(0,c.useMemo)(()=>fy(e.executions),[e.executions]),o=a.allColumns.length>0,s=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.visibleColumns:[],[a.visibleColumns,o,t.showAdapterMetrics]),l=(0,c.useMemo)(()=>sa(e.executions.map(e=>e.semantics)),[e.executions]),d=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.overflowColumns:[],[a.overflowColumns,o,t.showAdapterMetrics]);(0,c.useEffect)(()=>{let e=t.sortBy;uy(e)&&!s.some(t=>t.id===e&&t.isScalar)&&n(e=>({...e,sortBy:`attention`,sortDirection:`desc`}))},[n,t.sortBy,s]),(0,c.useEffect)(()=>{!o&&t.showAdapterMetrics&&n(e=>({...e,showAdapterMetrics:!1}))},[o,n,t.showAdapterMetrics]);let f=sy(e.executions,t,!0),p=e.executions.find(e=>e.uniqueId===t.selectedExecutionId)??null;return(0,u.jsx)(Ci,{title:`Runs`,description:`Execution and quality evidence across models, tests, seeds, snapshots, and operations.`,toolbar:(0,u.jsx)(Oy,{runsViewState:t,runsResults:f,adapterColumnLayout:a,adapterMetricsAvailable:o,availableMaterializationKinds:l,onRunsViewStateChange:n}),inspector:p?(0,u.jsx)(gy,{row:p,visibleColumns:s,overflowColumns:d,onNavigateTo:i}):null,className:`runs-view`,children:(0,u.jsx)(wy,{analysis:e,runsResults:f,runsViewState:t,adapterColumns:s,onRunsViewStateChange:n,onInvestigationSelectionChange:r})})}var $={resourceTypeSummaryAriaLabel:`Run outcomes for executed dbt assets (non-test resources such as models and sources), grouped by resource type. Counts are how many assets succeeded versus had warnings or failures. These are not dbt test pass or fail totals.`,resourceTypeSummaryTitle:`Run outcomes for executed dbt assets by type (excludes tests). Not dbt test pass or fail totals.`,resourceTypeSummaryItemTitle(e){return`${e}: executed asset run outcomes for this type, not dbt test totals.`},treeTestStatsTitle:`Attention-only rollup of executed dbt test outcomes for this folder or row: failed or errored, warning, and dbt-skipped. Passing tests and tests with no run result (not executed) are not shown here. A test that depends on multiple resources may be counted more than once in folder totals.`,treeTestStatsBranchAriaLabel:`Dbt test attention rollup for resources in this folder: failed or error, warning, and skipped counts only. Passing tests and not-executed tests are not shown. Tests with multiple upstream dependencies may be counted more than once when summed at higher folders.`,treeTestStatsLeafAriaLabel:`Dbt test attention outcomes for this resource: failed or error, warning, and skipped only. Passing tests and not-executed tests are not shown.`,treeTestStatErrorTitle(e){return`Failed or errored dbt test attachments: ${e}`},treeTestStatWarnTitle(e){return`Warning dbt test attachments: ${e}`},treeTestStatSkippedTitle(e){return`Dbt skipped or no-op test attachments: ${e}. Folder rollups may count one test multiple times when it depends on several resources.`},treeEmptyHeadline:`No resources found`,treeEmptyDefaultSubtext:`Adjust filters or search to find matching branches or assets.`,treeEmptySearchSubtext:`Try clearing or changing the resource search box.`,treeEmptyResourceTypesSubtext:`One or more dbt resource types are narrowed; add types or reset type filters to see more assets.`,treeEmptyMaterializationSubtext:`Materialization filters are narrowing the tree; clear or broaden them to see more assets (values come from manifest metadata).`,treeEmptyExecutionFilterSubtext(e){switch(e){case`danger`:return`Execution status is Fail: only assets with a failed or errored result in this run are shown. Assets without a run row are treated as Not executed, not Fail. For models whose run succeeded but dbt tests failed, use Issues. Try Execution status All, or confirm run results are loaded for this workspace.`;case`issues`:return`Execution status is Issues: assets with a failed or errored run result, or with failed, warned, or skipped dbt test attachments in this run. Fail shows execution failures only.`;case`neutral`:return`Execution status is Not executed: only assets without a matching run result (or unknown status) are shown. Try All or confirm run results are loaded.`;case`positive`:return`Execution status is Success: only successful runs are shown. Try All or adjust other filters.`;case`warning`:return`Execution status is Warn: only warned runs are shown. Try All or adjust other filters.`;case`skipped`:return`Execution status is Skipped: only skipped runs are shown. Try All or adjust other filters.`;default:return``}},executionStatusSectionTitle:`Filter by run & tests`,executionStatusRunOutcomeSubLabel:`Run outcome`,executionStatusProblemsSubLabel:`Run + dbt tests`};function Ay(e){switch(e){case`all`:return`All`;case`positive`:return`Success`;case`warning`:return`Warn`;case`danger`:return`Fail (run)`;case`skipped`:return`Skipped`;case`neutral`:return`Not executed`;case`issues`:return`Issues (run or tests)`;default:return e}}function jy(e){return e===`all`?`Show all assets regardless of run outcome or attached dbt test results.`:$.treeEmptyExecutionFilterSubtext(e)}function My(e){let t=[];return e.status!==`all`&&t.push($.treeEmptyExecutionFilterSubtext(e.status)),e.resourceQuery.trim()&&t.push($.treeEmptySearchSubtext),e.activeResourceTypeCount>0&&t.push($.treeEmptyResourceTypesSubtext),(e.activeMaterializationKindCount??0)>0&&t.push($.treeEmptyMaterializationSubtext),t.length===0?$.treeEmptyDefaultSubtext:t.join(` `)}var Ny=`dbt-tools.explorerFiltersExpanded`;function Py(){try{let e=window.localStorage.getItem(Ny);if(e!==null)return e===`true`}catch{}return!1}function Fy({filtersExpanded:e,setFiltersExpandedPersisted:t,activeFilterCount:n,filterSummary:r,resourceQuery:i,setResourceQuery:a,status:o,setStatus:s,availableResourceTypes:c,activeResourceTypes:l,toggleResourceType:d,availableMaterializationKinds:f,activeMaterializationKinds:p,toggleMaterializationKind:m}){return(0,u.jsxs)(`section`,{className:`explorer-filters`,"aria-label":`Explorer filters`,children:[(0,u.jsxs)(`button`,{type:`button`,className:`explorer-filters__toggle`,"aria-expanded":e,onClick:()=>t(!e),children:[(0,u.jsxs)(`span`,{className:`explorer-filters__toggle-copy`,children:[(0,u.jsx)(`span`,{className:`explorer-filters__toggle-label`,children:`Filters`}),(0,u.jsx)(`span`,{className:`explorer-filters__toggle-summary`,children:r})]}),(0,u.jsxs)(`span`,{className:`explorer-filters__toggle-meta`,children:[n>0&&(0,u.jsx)(`span`,{className:`explorer-filters__badge`,children:n}),(0,u.jsx)(`span`,{className:`explorer-filters__chevron${e?` explorer-filters__chevron--expanded`:``}`,"aria-hidden":`true`,children:`▾`})]})]}),e&&(0,u.jsxs)(`div`,{className:`explorer-filter-stack`,children:[(0,u.jsxs)(`label`,{className:`workspace-search`,children:[(0,u.jsx)(`span`,{children:`Search resources`}),(0,u.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Filter tree by name, path, type, or id`})]}),(0,u.jsxs)(`div`,{className:`explorer-filter-group`,children:[(0,u.jsx)(`span`,{className:`explorer-filter-group__label`,children:$.executionStatusSectionTitle}),(0,u.jsxs)(`div`,{className:`explorer-status-filters`,children:[(0,u.jsxs)(`div`,{className:`explorer-status-filters__block`,children:[(0,u.jsx)(`span`,{className:`explorer-status-filters__sublabel`,id:`explorer-status-run-outcome-label`,children:$.executionStatusRunOutcomeSubLabel}),(0,u.jsx)(`div`,{className:`pill-row`,role:`group`,"aria-labelledby":`explorer-status-run-outcome-label`,children:[`all`,`positive`,`warning`,`danger`,`skipped`,`neutral`].map(e=>(0,u.jsx)(`button`,{type:`button`,className:o===e?`workspace-pill workspace-pill--active`:`workspace-pill`,title:jy(e),"aria-label":`${Ay(e)}. ${jy(e)}`,onClick:()=>s(e),children:Ay(e)},e))})]}),(0,u.jsxs)(`div`,{className:`explorer-status-filters__block explorer-status-filters__block--problems`,children:[(0,u.jsx)(`span`,{className:`explorer-status-filters__sublabel`,id:`explorer-status-problems-label`,children:$.executionStatusProblemsSubLabel}),(0,u.jsx)(`div`,{className:`pill-row`,role:`group`,"aria-labelledby":`explorer-status-problems-label`,children:(0,u.jsx)(`button`,{type:`button`,className:o===`issues`?`workspace-pill workspace-pill--active`:`workspace-pill`,title:jy(`issues`),"aria-label":`${Ay(`issues`)}. ${jy(`issues`)}`,onClick:()=>s(`issues`),children:Ay(`issues`)})})]})]})]}),c.length>0&&(0,u.jsxs)(`div`,{className:`explorer-filter-group`,children:[(0,u.jsx)(`span`,{className:`explorer-filter-group__label`,children:`dbt resource type`}),(0,u.jsx)(`div`,{className:`pill-row`,children:c.map(e=>(0,u.jsx)(`button`,{type:`button`,className:l.size===0||l.has(e)?`workspace-pill workspace-pill--active`:`workspace-pill`,onClick:()=>d(e),children:Dr(e)},e))})]}),f.length>0&&(0,u.jsxs)(`div`,{className:`explorer-filter-group`,children:[(0,u.jsx)(`span`,{className:`explorer-filter-group__label`,children:`Materialization (manifest)`}),(0,u.jsx)(Ty,{kinds:f,activeKinds:p,onToggleKind:m,buttonTitle:`Filter by normalized config.materialized / resource kind`})]})]})]})}function Iy(e){let t=Dr(e.resourceType),n=xa(e);return n?`${e.name}, ${t}, file ${n}`:`${e.name}, ${t}`}function Ly({testStats:e,variant:t}){return pa(e)?(0,u.jsxs)(`span`,{className:`explorer-tree__test-stats-wrap`,role:`group`,"aria-label":t===`branch`?$.treeTestStatsBranchAriaLabel:$.treeTestStatsLeafAriaLabel,title:$.treeTestStatsTitle,children:[(0,u.jsx)(`span`,{className:`explorer-tree__test-stats-label`,"aria-hidden":`true`,children:`Test issues`}),(0,u.jsxs)(`span`,{className:`explorer-tree__test-stats`,children:[e.error>0&&(0,u.jsxs)(`span`,{className:`explorer-tree__test-stat explorer-tree__test-stat--fail`,title:$.treeTestStatErrorTitle(e.error),children:[`✗`,e.error]}),e.warn>0&&(0,u.jsxs)(`span`,{className:`explorer-tree__test-stat explorer-tree__test-stat--warn`,title:$.treeTestStatWarnTitle(e.warn),children:[`!`,e.warn]}),e.skipped>0&&(0,u.jsxs)(`span`,{className:`explorer-tree__test-stat explorer-tree__test-stat--skipped`,title:$.treeTestStatSkippedTitle(e.skipped),children:[`−`,e.skipped]})]})]}):null}function Ry({virtualRow:e,measureRow:t,children:n}){return(0,u.jsx)(`div`,{"data-index":e.index,ref:t,className:`explorer-tree__virtual-row`,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:n})}function zy({treeRows:e,explorerMode:t,expandedNodeIds:n,toggleExpandedNode:r,selectedResourceId:i,setSelectedResourceId:a,treeEmptyDisplay:o}){let l=(0,c.useRef)(null),d=s({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>30,overscan:16}),f=d.measureElement;return e.length===0?(0,u.jsx)(`div`,{ref:l,className:`explorer-tree`,children:(0,u.jsx)($r,{icon:`🔍`,headline:o?.headline??$.treeEmptyHeadline,subtext:o?.subtext??$.treeEmptyDefaultSubtext})}):(0,u.jsx)(`div`,{ref:l,className:`explorer-tree`,children:(0,u.jsx)(`div`,{className:`explorer-tree__virtual-spacer`,style:{height:d.getTotalSize(),width:`100%`,position:`relative`},children:d.getVirtualItems().map(o=>{let s=e[o.index];if(!s)return null;let{node:c,depth:l}=s;if(c.kind===`branch`){let e=n.has(c.id);return(0,u.jsx)(Ry,{virtualRow:o,measureRow:f,children:(0,u.jsxs)(`button`,{type:`button`,className:`explorer-tree__row explorer-tree__row--branch`,style:{paddingLeft:`${.9+l*1.05}rem`},onClick:()=>r(c.id),children:[(0,u.jsx)(`span`,{className:`explorer-tree__chevron${e?` explorer-tree__chevron--expanded`:``}`,"aria-hidden":`true`,children:`▸`}),(0,u.jsx)(`span`,{className:`explorer-tree__folder`,"aria-hidden":`true`,children:(0,u.jsx)(Si,{mode:t,depth:l})}),(0,u.jsx)(`span`,{className:`explorer-tree__label`,children:c.label}),c.testStats&&(0,u.jsx)(Ly,{testStats:c.testStats,variant:`branch`})]})},o.key)}let d=c.resource;return(0,u.jsx)(Ry,{virtualRow:o,measureRow:f,children:(0,u.jsxs)(`button`,{type:`button`,className:d.uniqueId===i?`explorer-tree__row explorer-tree__row--leaf explorer-tree__row--active`:`explorer-tree__row explorer-tree__row--leaf`,style:{paddingLeft:`${.9+l*1.05}rem`},onClick:()=>a(d.uniqueId),title:d.uniqueId,"aria-label":Iy(d),children:[(0,u.jsx)(`span`,{className:`explorer-tree__leaf-icon`,"aria-hidden":`true`,children:(0,u.jsx)(xi,{resourceType:d.resourceType})}),(0,u.jsx)(`span`,{className:`explorer-tree__resource-body`,children:(0,u.jsx)(`span`,{className:`explorer-tree__label`,children:d.name})}),d.semantics?(0,u.jsx)(ua,{semantics:d.semantics,variant:`compact`}):null,c.testStats&&(0,u.jsx)(Ly,{testStats:c.testStats,variant:`leaf`})]})},o.key)})})})}function By({mode:e}){return e===`project`?(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:(0,u.jsx)(`path`,{d:`M3.5 7.5h6l1.8 2h8.7v7.8a1.2 1.2 0 0 1-1.2 1.2H4.7a1.2 1.2 0 0 1-1.2-1.2V8.7a1.2 1.2 0 0 1 1.2-1.2Z`})}):e===`database`?(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,u.jsx)(`ellipse`,{cx:`12`,cy:`6.2`,rx:`6.5`,ry:`2.7`}),(0,u.jsx)(`path`,{d:`M5.5 6.2v5.6c0 1.5 2.9 2.7 6.5 2.7s6.5-1.2 6.5-2.7V6.2`}),(0,u.jsx)(`path`,{d:`M5.5 11.8v5.8c0 1.5 2.9 2.7 6.5 2.7s6.5-1.2 6.5-2.7v-5.8`})]}):null}function Vy({resources:e}){let t=e.filter(e=>!H.has(e.resourceType)&&e.statusTone!==`neutral`);if(t.length===0)return null;let n=new Map;for(let e of t){let t=n.get(e.resourceType)??{pass:0,fail:0};e.statusTone===`positive`?t.pass++:(e.statusTone===`danger`||e.statusTone===`warning`)&&t.fail++,n.set(e.resourceType,t)}let r=Array.from(n.entries()).sort(([e],[t])=>e.localeCompare(t));return(0,u.jsx)(`div`,{className:`resource-type-summary`,"aria-label":$.resourceTypeSummaryAriaLabel,title:$.resourceTypeSummaryTitle,children:r.map(([e,{pass:t,fail:n}])=>{let r=Dr(e);return(0,u.jsxs)(`span`,{className:`resource-type-summary__item`,title:$.resourceTypeSummaryItemTitle(r),children:[(0,u.jsx)(`span`,{className:`resource-type-summary__type`,children:r}),t>0&&(0,u.jsxs)(`span`,{className:`resource-type-summary__pass`,children:[`✓`,t]}),n>0&&(0,u.jsxs)(`span`,{className:`resource-type-summary__fail`,children:[`✗`,n]})]},e)})})}function Hy({treeRows:e,filteredResources:t,totalResources:n,matchedResources:r,explorerMode:i,setExplorerMode:a,status:o,setStatus:s,availableResourceTypes:l,activeResourceTypes:d,toggleResourceType:f,availableMaterializationKinds:p,activeMaterializationKinds:m,toggleMaterializationKind:h,resourceQuery:g,setResourceQuery:_,selectedResourceId:v,expandedNodeIds:y,toggleExpandedNode:b,setSelectedResourceId:x}){let[S,C]=(0,c.useState)(Py),w=e=>{C(e);try{window.localStorage.setItem(Ny,String(e))}catch{}},T=+!!g.trim()+(o===`all`?0:1)+ +(d.size>0)+ +(m.size>0),E=T>0?`${T} active`:`Search, status, and type`;return(0,u.jsxs)(`aside`,{className:`explorer-pane`,children:[(0,u.jsxs)(`div`,{className:`explorer-pane__header`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Asset explorer`}),(0,u.jsx)(`h2`,{children:`Workspace inventory`})]}),(0,u.jsxs)(`div`,{className:`explorer-pane__count`,children:[r,r!==n&&(0,u.jsxs)(`span`,{className:`explorer-pane__count-subtext`,children:[`of `,n]})]})]}),(0,u.jsx)(`div`,{className:`explorer-mode-tabs`,role:`tablist`,"aria-label":`Explorer modes`,children:[`project`,`database`].map(e=>(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i===e,className:i===e?`explorer-mode-tab explorer-mode-tab--active`:`explorer-mode-tab`,onClick:()=>a(e),children:[(0,u.jsx)(`span`,{className:`explorer-mode-tab__icon`,"aria-hidden":`true`,children:(0,u.jsx)(By,{mode:e})}),wr[e]]},e))}),(0,u.jsx)(Fy,{filtersExpanded:S,setFiltersExpandedPersisted:w,activeFilterCount:T,filterSummary:E,resourceQuery:g,setResourceQuery:_,status:o,setStatus:s,availableResourceTypes:l,activeResourceTypes:d,toggleResourceType:f,availableMaterializationKinds:p,activeMaterializationKinds:m,toggleMaterializationKind:h}),(0,u.jsx)(Vy,{resources:t}),(0,u.jsx)(zy,{treeRows:e,explorerMode:i,expandedNodeIds:y,toggleExpandedNode:b,selectedResourceId:v,setSelectedResourceId:x,treeEmptyDisplay:e.length===0?{headline:$.treeEmptyHeadline,subtext:My({status:o,resourceQuery:g,activeResourceTypeCount:d.size,activeMaterializationKindCount:m.size})}:void 0})]})}function Uy(e,t,n,r,i,a,o){(0,c.useEffect)(()=>{if(e.length===0||a==null)return;let t=Ma(e,a);t.size!==0&&o(e=>[...t].filter(t=>!e.expandedNodeIds.has(t)).length===0?e:{...e,expandedNodeIds:new Set([...e.expandedNodeIds,...t])})},[e,o,a]),(0,c.useEffect)(()=>{if(i!==`project`||a!=null||e.length===0||n.size>0)return;let s=Ea(r);t.has(s)&&o(e=>e.explorerMode!==`project`||e.selectedResourceId!=null||e.expandedNodeIds.has(s)?e:{...e,expandedNodeIds:new Set([...e.expandedNodeIds,s])})},[t,i,n.size,e.length,o,r,a])}function Wy(e){return e===`inventory`}function Gy({analysis:e,projectName:t,activeView:n,assetViewState:r,onAssetViewStateChange:i,onInvestigationSelectionChange:a}){let o=(0,c.useMemo)(()=>r.explorerMode!==`project`||t==null?e.resources:e.resources.filter(e=>Hr(e,t)),[e.resources,r.explorerMode,t]),s=(0,c.useMemo)(()=>Array.from(new Set(o.map(e=>e.resourceType))).sort(),[o]),l=(0,c.useMemo)(()=>sa(o.map(e=>e.semantics)),[o]),d=(0,c.useMemo)(()=>ma(o,e.dependencyIndex),[e.dependencyIndex,o]),f=(0,c.useMemo)(()=>o.filter(e=>Ir(e,r.status,d)&&Lr(e,r.resourceTypes)&&Rr(e,r.materializationKinds)&&Fr(e,r.resourceQuery)),[r.materializationKinds,r.resourceQuery,r.resourceTypes,r.status,d,o]),p=(0,c.useMemo)(()=>Da(f,r.explorerMode,t,e.dependencyIndex),[e.dependencyIndex,r.explorerMode,f,t]),m=(0,c.useMemo)(()=>ka(p),[p]),h=(0,c.useMemo)(()=>new Set([...r.expandedNodeIds].filter(e=>m.has(e))),[m,r.expandedNodeIds]),g=(0,c.useMemo)(()=>Oa(p,h),[h,p]),_=(0,c.useMemo)(()=>Aa(p),[p]),v=r.selectedResourceId;return Uy(p,m,h,t,r.explorerMode,v,i),{explorerPane:Wy(n)?(0,u.jsx)(Hy,{treeRows:g,filteredResources:f,totalResources:o.length,matchedResources:_.length,explorerMode:r.explorerMode,setExplorerMode:e=>i(t=>({...t,explorerMode:e})),status:r.status,setStatus:e=>i(t=>({...t,status:e})),availableResourceTypes:s,activeResourceTypes:r.resourceTypes,toggleResourceType:e=>i(t=>{let n=new Set(t.resourceTypes);return n.has(e)?n.delete(e):n.add(e),{...t,resourceTypes:n}}),availableMaterializationKinds:l,activeMaterializationKinds:r.materializationKinds,toggleMaterializationKind:e=>i(t=>{let n=new Set(t.materializationKinds);return n.has(e)?n.delete(e):n.add(e),{...t,materializationKinds:n}}),resourceQuery:r.resourceQuery,setResourceQuery:e=>i(t=>({...t,resourceQuery:e})),selectedResourceId:v,expandedNodeIds:h,toggleExpandedNode:e=>i(t=>{let n=new Set(t.expandedNodeIds);return n.has(e)?n.delete(e):n.add(e),{...t,expandedNodeIds:n}}),setSelectedResourceId:e=>{i(t=>({...t,selectedResourceId:e})),a(t=>({...t,selectedResourceId:e,sourceLens:`inventory`}))}}):null}}function Ky({analysis:e,activeView:t,analysisSource:n,overviewFilters:r,onOverviewFiltersChange:i,timelineFilters:a,onTimelineFiltersChange:o,assetViewState:s,onAssetViewStateChange:c,runsViewState:l,onRunsViewStateChange:d,lineageViewState:f,onLineageViewStateChange:p,onInvestigationSelectionChange:m,onNavigateTo:h,workspaceSignals:g}){let _=e.projectName??Vr(e.executions),{explorerPane:v}=Gy({analysis:e,projectName:_,activeView:t,assetViewState:s,onAssetViewStateChange:c,onInvestigationSelectionChange:m}),y=s.selectedResourceId,b=e.resources.find(e=>e.uniqueId===y)??null;return(0,u.jsxs)(`div`,{className:`workspace-layout${v?``:` workspace-layout--full`}`,children:[v,(0,u.jsxs)(`div`,{className:`workspace-main-panel`,children:[t===`health`&&(0,u.jsx)(la,{analysis:e,projectName:_,analysisSource:n,filters:r,setFilters:i,workspaceSignals:g}),t===`inventory`&&(0,u.jsx)(Kg,{analysis:e,resource:b,onSelectResource:e=>c(t=>({...t,selectedResourceId:e})),assetViewState:{...s,selectedResourceId:y},onAssetViewStateChange:c,lineageViewState:f,onLineageViewStateChange:p,onInvestigationSelectionChange:m,onNavigateTo:h}),t===`runs`&&(0,u.jsx)(ky,{analysis:e,runsViewState:l,onRunsViewStateChange:d,onInvestigationSelectionChange:m,onNavigateTo:h}),t===`timeline`&&(0,u.jsx)(iy,{analysis:e,filters:a,setFilters:o,onInvestigationSelectionChange:m})]})]})}var qy=(0,c.createContext)({toast:()=>{}}),Jy=0,Yy=4e3;function Xy({children:e}){let[t,n]=(0,c.useState)([]),r=(0,c.useCallback)((e,t=`neutral`)=>{let r=++Jy;n(n=>[...n,{id:r,message:e,tone:t}]),setTimeout(()=>{n(e=>e.filter(e=>e.id!==r))},Yy)},[]);function i(e){n(t=>t.filter(t=>t.id!==e))}return(0,u.jsxs)(qy.Provider,{value:{toast:r},children:[e,t.length>0&&(0,u.jsx)(`div`,{className:`toast-portal`,role:`status`,"aria-live":`polite`,children:t.map(e=>(0,u.jsxs)(`div`,{className:`toast toast--${e.tone}`,children:[(0,u.jsx)(`span`,{className:`toast__dot`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`toast__message`,children:e.message}),(0,u.jsx)(`button`,{type:`button`,className:`toast__dismiss`,"aria-label":`Dismiss notification`,onClick:()=>i(e.id),children:`✕`})]},e.id))})]})}function Zy(){return(0,c.useContext)(qy)}var Qy={manifest:`/api/manifest.json`,runResults:`/api/run_results.json`,catalog:`/api/catalog.json`,sources:`/api/sources.json`},$y=[{manifest:`/api/artifacts/current/manifest.json`,runResults:`/api/artifacts/current/run_results.json`,catalog:`/api/artifacts/current/catalog.json`,sources:`/api/artifacts/current/sources.json`},Qy];function eb(){return{checkedAtMs:Date.now(),remoteProvider:null,remoteLocation:null,pollIntervalMs:null,currentRun:null,pendingRun:null,supportsSwitch:!1,needsSelection:!1,candidates:void 0,discoveryError:null,sourceKind:null,locationDisplay:null,missingOptionalArtifacts:void 0}}function tb(e,t,n){return{mode:e,currentSource:t,label:n,...eb()}}async function nb(e){let t=await fetch(e);if(!t.ok)return null;let n=t.headers?.get?.(`content-type`)?.toLowerCase();return n!=null&&!n.includes(`application/json`)?null:t.arrayBuffer()}async function rb(e){try{return await nb(e)}catch{return null}}async function ib(e){try{return await nb(e)}catch{return null}}async function ab(e){let[t,n,r,i]=await Promise.all([rb(e.manifest),rb(e.runResults),ib(e.catalog),ib(e.sources)]);return t==null||n==null?null:{manifestBytes:t,runResultsBytes:n,...r==null?{}:{catalogBytes:r},...i==null?{}:{sourcesBytes:i}}}async function ob(e=$y){for(let t of e){let e=await ab(t);if(e!=null)return e}return null}async function sb(){let e=await ob([Qy]);return e==null?null:C(e,`preload`)}async function cb(){let e=await sb();return{status:tb(e==null?`none`:`preload`,e==null?null:`preload`,e==null?`Waiting for artifacts`:`Live target`),result:e}}async function lb(){let e=await fetch(`/api/artifact-source`);if(!e.ok)throw Error(`Failed to load artifact source status`);return await e.json()}async function ub(e=`preload`){let t=await ob();return t==null?null:C(t,e)}async function db(){let e;try{e=await fetch(`/api/artifact-source`)}catch{return cb()}if(e.status===404||!e.ok)return cb();let t;try{t=await e.json()}catch{return cb()}return t.currentSource==null?{status:t,result:null}:{status:t,result:await ub(t.currentSource)}}async function fb(e){let t=await fetch(`/api/artifact-source/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{runId:e}:{})});if(!t.ok)throw Error(`Failed to switch artifact source run`);return await t.json()}async function pb(e,t){let n=await fetch(`/api/artifact-source/discover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:e,location:t})}),r=await n.json().catch(()=>({}));if(!n.ok){let e=typeof r.error==`string`&&r.error.trim()!==``?r.error:`Failed to configure artifact source`;throw Error(e)}return r}async function mb(e,t,n){let r=await fetch(`/api/artifact-source/configure`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:e,location:t,...n!=null&&n.trim()!==``?{runId:n}:{}})}),i=await r.json().catch(()=>({}));if(!r.ok){let e=typeof i.error==`string`&&i.error.trim()!==``?i.error:`Failed to configure artifact source`;throw Error(e)}return i}function hb(e){return e===`local`?`/path/to/target or relative/path`:e===`s3`?`s3://bucket/prefix or bucket/prefix`:`gs://bucket/prefix or bucket/prefix`}function gb(e){let t=e.selectedRunId!=null&&e.selectedRunId.trim()!==``;return e.discoverLoading?`Scanning for artifact runs…`:e.discoveryError?e.discoveryError:e.candidateRunIds.length>0&&t?`Ready to load the workspace.`:e.candidateRunIds.length>1&&!t?`Pick a candidate set, then load.`:e.location.trim()===``?`Enter a location, then press Enter or move focus away to scan.`:e.candidateRunIds.length===0?`Press Enter or leave the Location field to scan for artifact runs.`:`Press Enter or leave the field to refresh the scan, then load.`}function _b(e){if(e.loadLoading)return`Loading artifact workspace…`;if(e.canLoad)return;if(e.discoverLoading)return`Scanning for artifact runs…`;if(e.discoveryError!=null)return e.discoveryError;if(e.location.trim()===``)return`Enter a path, then press Enter or leave the Location field to scan.`;if(e.candidateRunIds.length===0)return`Press Enter or blur Location to scan, then click Load workspace.`;let t=e.selectedRunId!=null&&e.selectedRunId.trim()!==``;return e.candidateRunIds.length>1&&!t?`Pick a candidate run, then click Load workspace.`:`Press Enter or blur Location to scan, then click Load workspace.`}function vb({readinessRegionId:e,readinessLabel:t,sourceKind:n,onSourceKindChange:r,location:i,onLocationChange:a,onLocationBlur:o,onLocationKeyDown:s,candidateRunIds:c,selectedRunId:l,onSelectRunId:d,discoverLoading:f,canLoad:p,loadLoading:m,loadWorkspaceHint:h,onLoadWorkspace:g}){return(0,u.jsxs)(`div`,{className:`upload-panel`,children:[(0,u.jsxs)(`div`,{className:`upload-panel__header`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Artifact source`}),(0,u.jsx)(`h3`,{children:`Configure directory or prefix`})]}),(0,u.jsx)(`span`,{id:e,className:`upload-panel__status`,role:`status`,children:f?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Lg,{size:16}),` `,t]}):t})]}),(0,u.jsxs)(`div`,{className:`upload-panel__inputs artifact-load-panel__inputs`,children:[(0,u.jsxs)(`div`,{className:`file-input-card`,children:[(0,u.jsx)(`label`,{htmlFor:`artifact-source-kind`,children:`Source type`}),(0,u.jsxs)(`select`,{id:`artifact-source-kind`,value:n,onChange:e=>r(e.target.value),children:[(0,u.jsx)(`option`,{value:`local`,children:`Local directory`}),(0,u.jsx)(`option`,{value:`s3`,children:`Amazon S3`}),(0,u.jsx)(`option`,{value:`gcs`,children:`Google Cloud Storage`})]})]}),(0,u.jsxs)(`div`,{className:`file-input-card`,children:[(0,u.jsx)(`label`,{htmlFor:`artifact-location-input`,children:`Location`}),(0,u.jsx)(`input`,{id:`artifact-location-input`,type:`text`,autoComplete:`off`,placeholder:hb(n),value:i,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:s})]}),c.length>0?(0,u.jsxs)(`fieldset`,{className:`file-input-card`,children:[(0,u.jsxs)(`legend`,{children:[`Candidate sets`,c.length>1?` — choose one before loading.`:null]}),c.map(e=>(0,u.jsxs)(`label`,{className:`artifact-load-panel__radio-row`,htmlFor:`artifact-run-${e}`,children:[(0,u.jsx)(`input`,{id:`artifact-run-${e}`,type:`radio`,name:`artifact-run`,value:e,checked:l===e,onChange:()=>d(e)}),(0,u.jsx)(`span`,{children:e})]},e))]}):null]}),(0,u.jsxs)(`div`,{className:`upload-panel__tips`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`strong`,{children:`Local paths`}),(0,u.jsxs)(`span`,{children:[`Resolved on the machine running the dev server or `,(0,u.jsx)(`code`,{children:`dbt-tools-web`}),`, not in your browser.`]})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`strong`,{children:`S3 and GCS`}),(0,u.jsx)(`span`,{children:`Use default SDK credential chains on the server. UI never receives cloud keys.`})]})]}),(0,u.jsx)(`div`,{className:`artifact-load-panel__actions artifact-load-panel__actions--load-only`,children:(0,u.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:!p||c.length===0||m,"aria-busy":m,"aria-describedby":e,title:h??void 0,onClick:()=>{g()},children:m?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Lg,{size:16}),` Loading…`]}):`Load workspace`})})]})}var yb=[{title:`Health-first overview`,body:`Spot failing nodes, long-running bottlenecks, and critical-path pressure before opening individual assets.`},{title:`Catalog-style context`,body:`Browse lineage-adjacent metadata such as descriptions, packages, execution status, and dependency depth in one flow.`},{title:`Timeline investigation`,body:`Shift from summary to execution sequencing without leaving the workspace, inspired by dbt docs and observability tools.`}];function bb(){return(0,u.jsxs)(`div`,{className:`upload-hero__copy`,children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Load artifacts`}),(0,u.jsx)(`h2`,{children:`Point the workspace at a directory or cloud prefix that contains dbt JSON artifacts.`}),(0,u.jsxs)(`p`,{children:[`The server discovers `,(0,u.jsx)(`code`,{children:`manifest.json`}),` and `,(0,u.jsx)(`code`,{children:`run_results.json`}),` `,`(required), plus optional `,(0,u.jsx)(`code`,{children:`catalog.json`}),` and `,(0,u.jsx)(`code`,{children:`sources.json`}),`. Cloud access uses server-side credentials only.`]}),(0,u.jsxs)(`div`,{className:`upload-hero__callout`,children:[(0,u.jsx)(`span`,{className:`upload-hero__callout-badge`,children:`Layout`}),(0,u.jsx)(`strong`,{children:`Artifacts at the location root or one subdirectory deep.`}),(0,u.jsx)(`p`,{children:`Multiple complete pairs under the same location require an explicit choice—nothing is auto-picked when several candidates exist.`})]}),(0,u.jsx)(`div`,{className:`upload-feature-grid`,children:yb.map(e=>(0,u.jsxs)(`article`,{className:`upload-feature-card`,children:[(0,u.jsx)(`strong`,{children:e.title}),(0,u.jsx)(`p`,{children:e.body})]},e.title))})]})}function xb({onManagedLoad:e,onError:t}){let{toast:n}=Zy(),r=(0,c.useId)(),[i,a]=(0,c.useState)(`local`),[o,s]=(0,c.useState)(``),[l,d]=(0,c.useState)(!1),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)([]),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(null),b=(0,c.useRef)(o),x=(0,c.useRef)(i);b.current=o,x.current=i;let S=(0,c.useRef)(0),C=(0,c.useRef)(``),w=(0,c.useMemo)(()=>({discoverLoading:l,discoveryError:v,candidateRunIds:m,selectedRunId:g,location:o}),[m,l,v,o,g]),T=(0,c.useMemo)(()=>gb(w),[w]),E=m.length>0&&g!=null&&g.trim()!==``&&!f&&v==null,D=(0,c.useMemo)(()=>_b({...w,loadLoading:f,canLoad:E}),[E,f,w]),O=(0,c.useCallback)(async r=>{if(r.trim()===``){t(`Select a candidate artifact set.`);return}p(!0),t(null);try{let i=await mb(x.current,b.current.trim(),r),a=i.currentSource;if(a!==`preload`&&a!==`remote`){t(`Artifacts are not ready to load.`);return}let o=i.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1};if(o.missingCatalog||o.missingSources){let e=[];o.missingCatalog&&e.push(`catalog.json`),o.missingSources&&e.push(`sources.json`),n(`Optional artifacts not loaded: ${e.join(`, `)}. Related inventory panels may be limited.`,`positive`)}let s=await ub(a);if(s==null){t(`Could not read artifact bytes from the server.`);return}e(s,a,o)}catch(e){let r=e instanceof Error?e.message:`Failed to load artifacts.`;t(r),n(r,`danger`)}finally{p(!1)}},[t,e,n]),k=(0,c.useCallback)(async e=>{let n=x.current,r=b.current.trim(),i=`${n}|${r}`;if(r===``){t(`Enter a directory or bucket prefix.`);return}if(!e&&i===C.current)return;let a=++S.current;d(!0),t(null),y(null),h([]),_(null);try{let e=await pb(n,r);if(a!==S.current)return;if(e.discoveryError!=null){y(e.discoveryError),t(e.discoveryError);return}let o=e.candidates?.map(e=>e.runId)??[],s=e.needsSelection===!0;h(o),o.length===1?_(o[0]):o.length>1&&_(null),C.current=i,o.length===1&&!s&&await O(o[0])}catch(e){if(a!==S.current)return;let n=e instanceof Error?e.message:`Discovery failed.`;y(n),t(n)}finally{a===S.current&&d(!1)}},[O,t]);async function A(){if(g==null||g.trim()===``){t(`Select a candidate artifact set.`);return}await O(g)}return(0,u.jsxs)(`section`,{className:`upload-hero`,children:[(0,u.jsx)(bb,{}),(0,u.jsx)(vb,{readinessRegionId:r,readinessLabel:T,sourceKind:i,onSourceKindChange:e=>{a(e),h([]),_(null),y(null),C.current=``,t(null)},location:o,onLocationChange:s,onLocationBlur:()=>{b.current.trim()!==``&&k(!1)},onLocationKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),k(!1))},candidateRunIds:m,selectedRunId:g,onSelectRunId:_,discoverLoading:l,canLoad:E,loadLoading:f,loadWorkspaceHint:D,onLoadWorkspace:()=>{A()}})]})}function Sb({className:e,style:t}){return(0,u.jsx)(`div`,{className:[`skeleton`,e].filter(Boolean).join(` `),style:t,"aria-hidden":`true`})}function Cb(){return(0,u.jsxs)(`div`,{className:`loading-card`,children:[(0,u.jsx)(Sb,{className:`loading-card__skeleton-icon`}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(Sb,{className:`loading-card__skeleton-title`}),(0,u.jsx)(Sb,{className:`loading-card__skeleton-body`})]})]})}var wb=`workspace-pill workspace-pill--active`,Tb=`workspace-pill`;function Eb(e){return e?wb:Tb}function Db({open:e,onClose:t,returnFocusRef:n,onManagedAnalysisLoaded:r,onError:i}){let a=(0,c.useRef)(null),o=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(!e){o.current&&n.current?.focus(),o.current=!1;return}o.current=!0,a.current?.focus();let r=e=>{e.key===`Escape`&&(e.preventDefault(),t())};document.addEventListener(`keydown`,r);let i=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,r),document.body.style.overflow=i}},[e,t,n]),e?(0,u.jsxs)(`div`,{className:`settings-artifact-dialog`,"aria-hidden":!1,children:[(0,u.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__backdrop`,"aria-label":`Close change location dialog`,onClick:()=>{i(null),t()}}),(0,u.jsxs)(`div`,{ref:a,className:`settings-artifact-dialog__panel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-artifact-dialog-title`,tabIndex:-1,children:[(0,u.jsxs)(`header`,{className:`settings-artifact-dialog__header`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Artifacts`}),(0,u.jsx)(`h2`,{id:`settings-artifact-dialog-title`,children:`Change artifact location`}),(0,u.jsx)(`p`,{className:`settings-artifact-dialog__lede`,children:`Use the same directory or cloud prefix flow as the main workspace load screen. Credentials stay on the server.`})]}),(0,u.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__close`,"aria-label":`Close`,onClick:()=>{i(null),t()},children:(0,u.jsx)(`span`,{"aria-hidden":`true`,children:`×`})})]}),(0,u.jsx)(`div`,{className:`settings-artifact-dialog__body`,children:(0,u.jsx)(xb,{onManagedLoad:r,onError:i})})]})]}):null}function Ob({analysisSource:e,executionCount:t}){return(0,u.jsxs)(`section`,{className:`settings-hero`,"aria-label":`Workspace preferences`,children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Workspace profile`}),(0,u.jsx)(`h3`,{children:`Configure how this console looks and behaves by default.`}),(0,u.jsx)(`p`,{children:`Changes save locally and apply to the current workspace immediately when the relevant view is open.`}),(0,u.jsxs)(`div`,{className:`settings-chip-row`,children:[(0,u.jsx)(`span`,{className:`app-badge`,children:j(e)}),(0,u.jsx)(`span`,{className:`settings-chip`,children:t==null?`No artifacts loaded`:`${t} executions loaded`})]})]})}function kb({themePreference:e,onThemeChange:t}){return(0,u.jsx)(yi,{title:`Appearance`,subtitle:`Choose how the workspace chrome should render by default.`,children:(0,u.jsxs)(`div`,{className:`settings-field-group`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Theme`}),(0,u.jsx)(`div`,{className:`settings-segmented`,children:[`system`,`light`,`dark`].map(n=>(0,u.jsx)(`button`,{type:`button`,className:Eb(e===n),onClick:()=>t(n),children:n===`system`?`System`:n.charAt(0).toUpperCase()+n.slice(1)},n))})]})})}function Ab({analysisSource:e,executionCount:t,artifactLocationSnapshot:n,onOpenChangeLocation:r,changeLocationTriggerRef:i,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:s}){let c=A(n?.sourceKind),l=n?.locationDisplay!=null&&n.locationDisplay.trim()!==``?n.locationDisplay:null;return(0,u.jsx)(yi,{title:`Session`,subtitle:`Current artifact source and data-loading controls.`,children:(0,u.jsxs)(`div`,{className:`settings-stack`,children:[(0,u.jsxs)(`div`,{className:`settings-readout`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Current source`}),(0,u.jsx)(`strong`,{children:j(e)}),(0,u.jsx)(`p`,{children:t==null?`Load artifacts to unlock analysis views.`:`${t} executions are available in this session.`})]}),(0,u.jsxs)(`div`,{className:`settings-readout`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Configured location`}),l==null?c==null?(0,u.jsx)(`p`,{className:`settings-readout-muted`,children:`Nothing configured yet. Use Change location… to open the load wizard and point this session at a directory or cloud prefix.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`strong`,{children:c}),(0,u.jsx)(`p`,{className:`settings-readout-muted`,children:`Path label was not returned for this session.`})]}):(0,u.jsxs)(u.Fragment,{children:[c==null?null:(0,u.jsx)(`strong`,{children:c}),(0,u.jsx)(`p`,{className:`settings-mono-path settings-session__path`,title:l,children:l})]})]}),(0,u.jsx)(`div`,{className:`settings-session__actions`,children:(0,u.jsx)(`button`,{ref:i,type:`button`,className:`primary-action settings-primary-action`,onClick:r,children:`Change location…`})}),a&&(0,u.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>void s(),disabled:o,children:o?`Switching…`:`Load ${a.label}`})]})})}function jb({preferences:e,setPreferences:t}){return(0,u.jsx)(yi,{title:`Shell Defaults`,subtitle:`Control the default shape of the workspace chrome.`,children:(0,u.jsxs)(`div`,{className:`settings-field-group`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Sidebar`}),(0,u.jsxs)(`div`,{className:`settings-segmented`,children:[(0,u.jsx)(`button`,{type:`button`,className:Eb(!e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!1})),children:`Expanded`}),(0,u.jsx)(`button`,{type:`button`,className:Eb(e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!0})),children:`Collapsed`})]})]})})}function Mb({preferences:e,setPreferences:t}){return(0,u.jsx)(yi,{title:`Timeline Defaults`,subtitle:`Set the default execution timeline filters and dependency focus.`,children:(0,u.jsxs)(`div`,{className:`settings-stack`,children:[(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-toggle`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.showTests,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,showTests:e.target.checked}}))}),(0,u.jsx)(`span`,{children:`Show tests by default`})]}),(0,u.jsxs)(`label`,{className:`settings-toggle`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.failuresOnly,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,failuresOnly:e.target.checked}}))}),(0,u.jsx)(`span`,{children:`Start with failures-only emphasis`})]})]}),(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Dependency direction`}),(0,u.jsxs)(`select`,{value:e.timelineDefaults.dependencyDirection,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDirection:e.target.value}})),children:[(0,u.jsx)(`option`,{value:`upstream`,children:`Upstream`}),(0,u.jsx)(`option`,{value:`both`,children:`Both`}),(0,u.jsx)(`option`,{value:`downstream`,children:`Downstream`})]})]}),(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Dependency depth`}),(0,u.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.timelineDefaults.dependencyDepthHops,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDepthHops:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]})]})})}function Nb({preferences:e,setPreferences:t}){return(0,u.jsx)(yi,{title:`Inventory Defaults`,subtitle:`Choose how asset exploration and lineage open by default.`,children:(0,u.jsxs)(`div`,{className:`settings-stack`,children:[(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Explorer mode`}),(0,u.jsxs)(`select`,{value:e.inventoryDefaults.explorerMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,explorerMode:e.target.value}})),children:[(0,u.jsx)(`option`,{value:`project`,children:`Project`}),(0,u.jsx)(`option`,{value:`database`,children:`Database`})]})]}),(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Lineage lens`}),(0,u.jsxs)(`select`,{value:e.inventoryDefaults.lineageLensMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageLensMode:e.target.value}})),children:[(0,u.jsx)(`option`,{value:`type`,children:`Type`}),(0,u.jsx)(`option`,{value:`status`,children:`Status`}),(0,u.jsx)(`option`,{value:`coverage`,children:`Coverage`})]})]})]}),(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Upstream depth`}),(0,u.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageUpstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageUpstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]}),(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Downstream depth`}),(0,u.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageDownstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageDownstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]}),(0,u.jsxs)(`label`,{className:`settings-toggle`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.inventoryDefaults.allDepsMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,allDepsMode:e.target.checked}}))}),(0,u.jsx)(`span`,{children:`Open lineage with all dependencies expanded`})]})]})})}function Pb({preferences:e,setPreferences:t,themePreference:n,setThemePreference:r,analysisSource:i,artifactLocationSnapshot:a,executionCount:o,onManagedAnalysisLoaded:s,onError:l,pendingRemoteRun:d,acceptingRemoteRun:f,onAcceptPendingRemoteRun:p}){let[m,h]=(0,c.useState)(!1),g=(0,c.useRef)(null),_=(0,c.useCallback)((e,t,n)=>{h(!1),s(e,t,n)},[s]);return(0,u.jsxs)(Ci,{title:`Settings`,description:`Workspace defaults, visual preferences, and session controls.`,className:`settings-view`,children:[(0,u.jsx)(Db,{open:m,onClose:()=>{l(null),h(!1)},returnFocusRef:g,onManagedAnalysisLoaded:_,onError:l}),(0,u.jsxs)(`div`,{className:`settings-grid`,children:[(0,u.jsx)(Ob,{analysisSource:i,executionCount:o}),(0,u.jsx)(kb,{themePreference:n,onThemeChange:e=>{r(e),t(t=>({...t,theme:e}))}}),(0,u.jsx)(Ab,{analysisSource:i,executionCount:o,artifactLocationSnapshot:a,onOpenChangeLocation:()=>h(!0),changeLocationTriggerRef:g,pendingRemoteRun:d,acceptingRemoteRun:f,onAcceptPendingRemoteRun:p}),(0,u.jsx)(jb,{preferences:e,setPreferences:t}),(0,u.jsx)(Mb,{preferences:e,setPreferences:t}),(0,u.jsx)(Nb,{preferences:e,setPreferences:t})]})]})}function Fb({kind:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`};return e===`invocation`?(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{...t,d:`M20 12.5V7a2 2 0 0 0-2-2h-6.2a2 2 0 0 0-1.4.58l-4.82 4.82A2 2 0 0 0 5 11.82V17a2 2 0 0 0 2 2h5.5`}),(0,u.jsx)(`path`,{...t,d:`M9 5v4a2 2 0 0 1-2 2H5`}),(0,u.jsx)(`circle`,{...t,cx:`17.5`,cy:`17.5`,r:`3.5`})]}):e===`time`?(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`circle`,{...t,cx:`12`,cy:`12`,r:`8`}),(0,u.jsx)(`path`,{...t,d:`M12 7.8v4.6l3 1.8`})]}):e===`project`?(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,u.jsx)(`path`,{...t,d:`M3.5 8.5a2 2 0 0 1 2-2h3l1.4 1.7h8.6a2 2 0 0 1 2 2v7.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z`})}):(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{...t,d:`M11.25 4.75 5.5 7.7v4.55c0 3.65 2.7 6.95 6.5 7.95 3.8-1 6.5-4.3 6.5-7.95V7.7z`}),(0,u.jsx)(`path`,{...t,d:`M9.4 12.15 11.2 14l3.35-3.45`})]})}function Ib(e,t){let n=e?.projectName??null,r=e?.invocationId??null,i=e?.warehouseType??null,a=e?jr(e):null,o=a==null?null:Ar(a);return{label:n??`Workspace session`,subtitle:n==null&&r==null&&o==null?`Load artifacts to populate session details.`:null,summaryItems:[r?{key:`invocation`,label:`Invocation ID`,value:r,icon:`invocation`}:null,o?{key:`timestamp`,label:`Timestamp`,value:o,icon:`time`}:null,{key:`source`,label:`Source mode`,value:j(t),icon:`source`},i?{key:`warehouse`,label:`Warehouse type`,value:i.charAt(0).toUpperCase()+i.slice(1),icon:`project`}:null].filter(e=>e!=null)}}function Lb({summaryItems:e}){return(0,u.jsx)(`div`,{className:`app-header__summary-grid`,"aria-label":`Session metadata`,children:e.map(e=>(0,u.jsxs)(`div`,{className:`app-header__summary-item`,children:[(0,u.jsx)(`span`,{className:`app-header__summary-icon`,children:(0,u.jsx)(Fb,{kind:e.icon})}),(0,u.jsxs)(`span`,{className:`app-header__summary-copy`,children:[(0,u.jsx)(`span`,{className:`app-header__summary-label`,children:e.label}),(0,u.jsx)(`strong`,{className:`app-header__summary-value`,children:e.value})]})]},e.key))})}function Rb({header:e}){return(0,u.jsxs)(`div`,{className:`app-header__identity`,children:[(0,u.jsx)(`p`,{className:`eyebrow`,title:e.label,children:e.label}),e.subtitle?(0,u.jsx)(`p`,{className:`app-header__subheadline`,children:e.subtitle}):null,(0,u.jsx)(Lb,{summaryItems:e.summaryItems})]})}function zb({analysis:e,searchState:t,setSearchState:n,omniboxResults:r,handleNavigateTo:i}){let a=t.query.trim().length>0;return(0,u.jsxs)(`div`,{className:`app-header__omnibox`,children:[(0,u.jsx)(`label`,{className:`app-header__search-control`,children:(0,u.jsxs)(`div`,{className:`app-header__search-shell`,children:[(0,u.jsxs)(`svg`,{className:`workspace-search__icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`}),(0,u.jsx)(`path`,{d:`M16 16l4 4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`})]}),(0,u.jsx)(`input`,{value:t.query,onFocus:()=>n(e=>({...e,isOpen:!0})),onChange:e=>n(t=>({...t,query:e.target.value,isOpen:!0})),placeholder:`Search runs, pipelines, assets...`,"aria-label":`Global search`})]})}),t.isOpen&&e&&(0,u.jsx)(`div`,{className:`omnibox-results`,children:r.loading&&a?(0,u.jsx)(`div`,{className:`omnibox-results__empty`,children:`Searching…`}):r.results.length>0?r.results.map(e=>(0,u.jsxs)(`button`,{type:`button`,className:`omnibox-results__item`,onClick:()=>{n(t=>({...t,isOpen:!1,recentResourceIds:[e.uniqueId,...t.recentResourceIds.filter(t=>t!==e.uniqueId)].slice(0,8)})),i(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},children:[(0,u.jsx)(`strong`,{children:e.name}),(0,u.jsx)(`span`,{children:e.resourceType})]},e.uniqueId)):(0,u.jsx)(`div`,{className:`omnibox-results__empty`,children:a?`No matching resources`:`Recent items will appear here`})})]})}function Bb({activeView:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:i,pendingRemoteRun:a,acceptingRemoteRun:o,preferences:s,setPreferences:c,themePreference:l,setThemePreference:d,onManagedAnalysisLoaded:f,onError:p,onAcceptPendingRemoteRun:m,workspaceSignals:h,overviewFilters:g,setOverviewFilters:_,timelineFilters:v,setTimelineFilters:y,assetViewState:b,setAssetViewState:x,runsViewState:S,setRunsViewState:C,lineageViewState:w,setLineageViewState:T,setInvestigationSelection:E,handleNavigateTo:D}){return e===`settings`?(0,u.jsx)(Pb,{preferences:s,setPreferences:c,themePreference:l,setThemePreference:d,analysisSource:n,artifactLocationSnapshot:r,executionCount:t?.summary.total_nodes??null,onManagedAnalysisLoaded:f,onError:p,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:m}):t?(0,u.jsx)(Ky,{analysis:t,activeView:e,analysisSource:n,overviewFilters:g,onOverviewFiltersChange:_,timelineFilters:v,onTimelineFiltersChange:y,assetViewState:b,onAssetViewStateChange:x,runsViewState:S,onRunsViewStateChange:C,lineageViewState:w,onLineageViewStateChange:T,onInvestigationSelectionChange:E,onNavigateTo:D,workspaceSignals:h}):i?(0,u.jsx)(Cb,{}):(0,u.jsx)(xb,{onManagedLoad:f,onError:p})}function Vb({workspace:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,error:i,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:f,themePreference:p,setThemePreference:m,preferences:h,setPreferences:g,workspaceSignals:_}){let{activeView:v,sidebarCollapsed:y,setSidebarCollapsed:b,sidebarOpen:x,setSidebarOpen:S,overviewFilters:C,setOverviewFilters:w,timelineFilters:T,setTimelineFilters:E,assetViewState:D,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,searchState:P,setSearchState:ee,setInvestigationSelection:F,setNavigationTarget:te,handleNavigateTo:ne,frameClass:re}=e,ie=O(t,P),ae=Ib(t,n);return(0,u.jsxs)(`div`,{className:re,children:[x&&(0,u.jsx)(`div`,{className:`sidebar-backdrop`,role:`presentation`,onClick:()=>S(!1)}),(0,u.jsx)(xe,{activeView:v,setNavigationTarget:te,sidebarCollapsed:y,setSidebarCollapsed:b,onNavigate:()=>S(!1),analysis:t,analysisSource:n}),(0,u.jsxs)(`main`,{className:`app-main`,children:[(0,u.jsxs)(`header`,{className:`app-header app-header--workspace`,children:[(0,u.jsx)(`button`,{type:`button`,className:`hamburger-btn`,"aria-label":`Open navigation`,"aria-expanded":x,"aria-controls":`app-sidebar`,onClick:()=>S(!0),children:(0,u.jsx)(`span`,{"aria-hidden":`true`,children:`☰`})}),(0,u.jsx)(Rb,{header:ae}),(0,u.jsx)(zb,{analysis:t,searchState:P,setSearchState:ee,omniboxResults:ie,handleNavigateTo:ne})]}),i&&(0,u.jsx)(d,{message:i}),(0,u.jsx)(Se,{pendingRemoteRun:o,acceptingRemoteRun:s,onAcceptPendingRemoteRun:f}),(0,u.jsx)(Bb,{activeView:v,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,preferences:h,setPreferences:g,themePreference:p,setThemePreference:m,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:f,workspaceSignals:_,overviewFilters:C,setOverviewFilters:w,timelineFilters:T,setTimelineFilters:E,assetViewState:D,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,setInvestigationSelection:F,handleNavigateTo:ne})]})]})}function Hb(e,t,n){return t===`preload`?{value:`Live target`,detail:`Synced from DBT_TOOLS_TARGET_DIR with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:t===`remote`?{value:`Remote source`,detail:`Managed from remote object storage with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:{value:`Artifact upload`,detail:`${e.summary.total_nodes} executions loaded from local artifacts${n>0?`, including ${n} tests`:``}.`}}function Ub(e,t){let n=e.executions.filter(e=>e.statusTone===`danger`).length,r=e.executions.filter(e=>e.statusTone===`warning`).length,i=e.executions.filter(e=>[`test`,`unit_test`].includes(e.resourceType)).length,a=e.resources.filter(e=>!!e.description?.trim()).length,o=e.resources.length>0?Math.round(a/e.resources.length*100):0,s=Hb(e,t,i);return[{label:`Run posture`,value:n>0?`${n} failing`:r>0?`${r} warning`:`Healthy`,detail:n>0?`Prioritize failing nodes before reviewing downstream impact.`:r>0?`Warnings detected; review tests and exposures next.`:`No failing nodes surfaced in this run.`,tone:n>0?`danger`:r>0?`warning`:`positive`},{label:`Metadata coverage`,value:`${o}%`,detail:`${a} of ${e.resources.length} resources include descriptions for catalog-style discovery.`,tone:o>=70?`positive`:o>=35?`warning`:`neutral`},{label:`Workspace mode`,value:s.value,detail:s.detail,tone:`neutral`}]}function Wb({setPreloadLoading:e,setAnalysis:t,setAnalysisSource:n,setPendingRemoteRun:r,setRemotePollIntervalMs:i,setError:a,pendingMetricsRef:o,setArtifactCapability:s,onArtifactSourceStatus:l}){let u=(0,c.useRef)(!1);(0,c.useEffect)(()=>{u.current||(u.current=!0,p(`Preload: fetching current managed artifacts`),db().then(({result:c,status:u})=>{e(!1),r(u.pendingRun),i(u.pollIntervalMs),l?.(u),c?(p(`Preload: success, analysis loaded`),o.current=c.metrics,t(c.analysis),n(u.currentSource),a(null),s(u.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})):(n(u.currentSource),s({missingCatalog:!1,missingSources:!1}))}).catch(t=>{e(!1),p(`Preload: error`,t),a(t instanceof Error?t.message:`Failed to load artifacts from server`)}))},[o,e,t,n,r,i,a,s,l])}function Gb(e,t,n,r){(0,c.useEffect)(()=>{},[e,r,t,n])}function Kb(e,t,n,r,i){(0,c.useEffect)(()=>{if(e!==`remote`){t(null),n(null);return}let a=!1,o=async()=>{try{let e=await lb();a||(t(e.pendingRun),n(e.pollIntervalMs),i?.(e))}catch(e){p(`Artifact source poll failed`,e)}};o();let s=window.setInterval(()=>{o()},r??3e4);return()=>{a=!0,window.clearInterval(s)}},[e,r,t,n,i])}function qb(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(null),[i,a]=(0,c.useState)(null),[o,s]=(0,c.useState)(!0),[l,u]=(0,c.useState)(null),[d,f]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)({missingCatalog:!1,missingSources:!1}),[b,x]=(0,c.useState)(null),S=(0,c.useRef)(null),C=(0,c.useCallback)(e=>{x(t=>{let n=k(e);return n==null&&t==null||n!=null&&t!=null&&n.sourceKind===t.sourceKind&&n.locationDisplay===t.locationDisplay?t:n})},[]);return Wb({setPreloadLoading:s,setAnalysis:t,setAnalysisSource:a,setPendingRemoteRun:u,setRemotePollIntervalMs:_,setError:r,pendingMetricsRef:S,setArtifactCapability:y,onArtifactSourceStatus:C}),Gb(i,t,r,S),Kb(i,u,_,g,C),(0,c.useEffect)(()=>{if(e==null||S.current==null)return;let t=S.current;S.current=null,requestAnimationFrame(()=>{let e=`analysis-load:${t.requestId}:interactive`,n=`analysis-load:${t.requestId}:first-interactive-frame`;m(e),h(n,t.dispatchMarkName,e),p(`Analysis load metrics`,{requestId:t.requestId,source:t.source,timings:t.timings})})},[e]),{analysis:e,analysisSource:i,artifactLocationSnapshot:b,artifactCapability:v,error:n,preloadLoading:o,pendingRemoteRun:l,acceptingRemoteRun:d,onLoadDifferent:()=>{t(null),a(null),u(null),_(null),r(null),x(null),y({missingCatalog:!1,missingSources:!1})},onManagedAnalysisLoaded:(e,n,r)=>{S.current=e.metrics,a(n),u(null),t(e.analysis),y(r),lb().then(C).catch(()=>{})},onError:r,onAcceptPendingRemoteRun:async()=>{if(l!=null){f(!0);try{let e=await fb(l.runId),n=await ub(`remote`);n!=null&&(S.current=n.metrics,t(n.analysis),a(e.currentSource),_(e.pollIntervalMs),r(null),y(e.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})),u(e.pendingRun),C(e)}catch(e){r(e instanceof Error?e.message:`Failed to switch remote artifact run`)}finally{f(!1)}}}}}var Jb=`dbt-tools.workspacePreferences`,Yb={theme:`system`,sidebarCollapsedDefault:!0,timelineDefaults:{showTests:!1,failuresOnly:!1,dependencyDirection:`both`,dependencyDepthHops:2},inventoryDefaults:{explorerMode:`project`,lineageLensMode:`type`,lineageUpstreamDepth:2,lineageDownstreamDepth:2,allDepsMode:!1}};function Xb(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.max(1,Math.min(10,Math.round(e)))}function Zb(e){return e===`upstream`||e===`both`||e===`downstream`}function Qb(e){return e===`project`||e===`database`}function $b(e){return e===`status`||e===`type`||e===`coverage`}function ex(e){return e===`light`||e===`dark`||e===`system`}function tx(e){if(!e)return Yb;try{let t=JSON.parse(e);return{theme:ex(t.theme)?t.theme:Yb.theme,sidebarCollapsedDefault:typeof t.sidebarCollapsedDefault==`boolean`?t.sidebarCollapsedDefault:Yb.sidebarCollapsedDefault,timelineDefaults:{showTests:typeof t.timelineDefaults?.showTests==`boolean`?t.timelineDefaults.showTests:Yb.timelineDefaults.showTests,failuresOnly:typeof t.timelineDefaults?.failuresOnly==`boolean`?t.timelineDefaults.failuresOnly:Yb.timelineDefaults.failuresOnly,dependencyDirection:Zb(t.timelineDefaults?.dependencyDirection)?t.timelineDefaults.dependencyDirection:Yb.timelineDefaults.dependencyDirection,dependencyDepthHops:Xb(t.timelineDefaults?.dependencyDepthHops,Yb.timelineDefaults.dependencyDepthHops)},inventoryDefaults:{explorerMode:Qb(t.inventoryDefaults?.explorerMode)?t.inventoryDefaults.explorerMode:Yb.inventoryDefaults.explorerMode,lineageLensMode:$b(t.inventoryDefaults?.lineageLensMode)?t.inventoryDefaults.lineageLensMode:Yb.inventoryDefaults.lineageLensMode,lineageUpstreamDepth:Xb(t.inventoryDefaults?.lineageUpstreamDepth,Yb.inventoryDefaults.lineageUpstreamDepth),lineageDownstreamDepth:Xb(t.inventoryDefaults?.lineageDownstreamDepth,Yb.inventoryDefaults.lineageDownstreamDepth),allDepsMode:typeof t.inventoryDefaults?.allDepsMode==`boolean`?t.inventoryDefaults.allDepsMode:Yb.inventoryDefaults.allDepsMode}}}catch{return Yb}}function nx(){let[e,t]=(0,c.useState)(()=>{try{return tx(window.localStorage.getItem(Jb))}catch{return Yb}});return(0,c.useEffect)(()=>{try{window.localStorage.setItem(Jb,JSON.stringify(e))}catch{}},[e]),{preferences:e,setPreferences:t}}function rx(e,t){let n=t!==e.selectedExecutionId;return{...e,selectedExecutionId:t,...n?{neighborhoodRowsShowAll:!1}:{}}}var ix=(e,t)=>({activeTab:se(e),expandedNodeIds:new Set,explorerMode:t?.inventoryDefaults.explorerMode??`project`,status:`all`,resourceTypes:new Set,materializationKinds:new Set,resourceQuery:``,selectedResourceId:ie(e),upstreamDepth:de(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:fe(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:pe(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:ue(e)??t?.inventoryDefaults.lineageLensMode??`type`,activeLegendKeys:new Set}),ax=e=>{let t=re(e);return{kind:ce(e)??`all`,status:`all`,query:``,resourceTypes:new Set,materializationKinds:new Set,threadIds:new Set,durationBand:`all`,sortBy:`attention`,sortDirection:`desc`,groupBy:`none`,selectedExecutionId:t===`runs`?ae(e):null,showAdapterMetrics:t===`runs`?le(e):!1}},ox=(e,t)=>{let n=re(e),r=n===`runs`||n===`timeline`?ae(e):null;return{query:``,activeStatuses:new Set,activeTypes:new Set,selectedExecutionId:r,showTests:t?.timelineDefaults.showTests??!1,failuresOnly:t?.timelineDefaults.failuresOnly??!1,dependencyDirection:t?.timelineDefaults.dependencyDirection??`both`,dependencyDepthHops:t?.timelineDefaults.dependencyDepthHops??2,timeWindow:null,neighborhoodRowsShowAll:!1}};function sx(e){let t=new URLSearchParams(e);if(re(e)!==`inventory`)return null;let n=[],r=t.get(`q`)?.trim()??``;r!==``&&n.push(r);for(let e of[`type`,`package`,`tag`,`path`]){let r=t.get(e)?.trim()??``;r!==``&&n.push(`${e}:${r}`)}return n.join(` `).trim()}function cx(e,t){let n=sx(e);return n===null?t:{...t,resourceQuery:n}}var lx=e=>{let t=re(e)??`health`,n=ie(e),r=ae(e);return{selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:null}};function ux(e,t){return{activeView:re(e)??`health`,assetViewState:cx(e,ix(e,t)),runsViewState:ax(e),timelineFilters:ox(e,t),lineageViewState:{...he(e),upstreamDepth:de(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:fe(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:pe(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:ue(e)??t?.inventoryDefaults.lineageLensMode??`type`},investigationSelection:lx(e)}}function dx(e){let t=re(e),n=ie(e),r=ae(e);return{activeView:t??void 0,assetViewState:t=>cx(e,{...t,selectedResourceId:n,activeTab:se(e)}),runsViewState:n=>({...n,kind:ce(e)??n.kind,selectedExecutionId:t===`runs`?r:null,showAdapterMetrics:t===`runs`?le(e):n.showAdapterMetrics}),timelineFilters:e=>rx(e,t===`timeline`?r:null),lineageViewState:he(e),investigationSelection:e=>({...e,selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:e.sourceLens})}}var fx=[`resource`,`assetTab`,`selected`,`kind`,`adapter`,`up`,`down`,`allDeps`,`lens`,`q`];function px(e,t){for(let n of fx)t?.has(n)||e.searchParams.delete(n)}function mx(e,t,n){t.selectedResourceId?e.searchParams.set(`resource`,t.selectedResourceId):e.searchParams.delete(`resource`),e.searchParams.set(`assetTab`,t.activeTab);let r=t.resourceQuery.trim();r===``?e.searchParams.delete(`q`):e.searchParams.set(`q`,r),e.searchParams.delete(`kind`),t.activeTab===`lineage`?(n.selectedResourceId?e.searchParams.set(`selected`,n.selectedResourceId):e.searchParams.delete(`selected`),e.searchParams.set(`up`,String(n.upstreamDepth)),e.searchParams.set(`down`,String(n.downstreamDepth)),e.searchParams.set(`allDeps`,n.allDepsMode?`1`:`0`),e.searchParams.set(`lens`,n.lensMode)):px(e,new Set([`resource`,`assetTab`,`q`]))}function hx(e,t){e.searchParams.set(`kind`,t.kind),t.selectedExecutionId?e.searchParams.set(`selected`,t.selectedExecutionId):e.searchParams.delete(`selected`),t.showAdapterMetrics?e.searchParams.delete(`adapter`):e.searchParams.set(`adapter`,`0`),px(e,new Set([`kind`,`selected`,`adapter`]))}function gx(e,t){t?e.searchParams.set(`selected`,t):e.searchParams.delete(`selected`),px(e,new Set([`selected`]))}function _x(e){let{pathname:t,hash:n,activeView:r,assetViewState:i,runsViewState:a,timelineSelectedExecutionId:o,lineageViewState:s}=e,c=new URL(`http://local.invalid${t}${n}`);return c.searchParams.set(`view`,r),r===`inventory`?mx(c,i,s):r===`runs`?hx(c,a):r===`timeline`?gx(c,o):px(c),`${t}${c.search}${n}`}function vx(e){let t=(0,c.useRef)(!1),n=ux(window.location.search,e),[r,i]=(0,c.useState)(()=>n.activeView),[a,o]=(0,c.useState)(()=>_e(e.sidebarCollapsedDefault)),[s,l]=(0,c.useState)(!1),[u,d]=(0,c.useState)({status:`all`,resourceTypes:new Set,query:``}),[f,p]=(0,c.useState)(()=>n.timelineFilters),[m,h]=(0,c.useState)(()=>n.assetViewState),[g,_]=(0,c.useState)(()=>n.runsViewState),[v,y]=(0,c.useState)(()=>n.lineageViewState),[b,x]=(0,c.useState)({query:``,recentResourceIds:[],isOpen:!1}),[S,C]=(0,c.useState)(()=>n.investigationSelection),w=(0,c.useCallback)(e=>{o(t=>{let n=e(t);try{window.localStorage.setItem(ge,String(n))}catch{}return n})},[]),T=(0,c.useCallback)(e=>{i(e.view===`search`?`inventory`:e.view)},[]),E=(0,c.useCallback)((e,t)=>{i(e),t?.resourceId?(h(e=>({...e,selectedResourceId:t.resourceId??e.selectedResourceId,activeTab:t.assetTab??e.activeTab})),y(e=>({...e,rootResourceId:t.rootResourceId??t.resourceId??e.rootResourceId,selectedResourceId:t.resourceId??e.selectedResourceId}))):t?.assetTab&&e===`inventory`&&h(e=>({...e,activeTab:t.assetTab??e.activeTab})),t?.executionId&&(_(e=>({...e,selectedExecutionId:t.executionId??e.selectedExecutionId})),p(e=>rx(e,t.executionId??e.selectedExecutionId))),e===`runs`&&t?.resourceId&&_(e=>({...e,query:t.resourceId??e.query})),C(n=>({selectedResourceId:t?.resourceId??n.selectedResourceId,selectedExecutionId:t?.executionId??n.selectedExecutionId,sourceLens:e}))},[]);return(0,c.useEffect)(()=>{let e=_x({pathname:window.location.pathname,hash:window.location.hash,activeView:r,assetViewState:m,runsViewState:g,timelineSelectedExecutionId:f.selectedExecutionId,lineageViewState:v});e!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.pushState(null,``,e)},[r,m,g,f.selectedExecutionId,v]),(0,c.useEffect)(()=>{let e=()=>{let e=dx(window.location.search);e.activeView!==void 0&&i(e.activeView),h(t=>e.assetViewState(t)),_(t=>e.runsViewState(t)),p(t=>e.timelineFilters(t)),y(e.lineageViewState),C(t=>e.investigationSelection(t))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,c.useEffect)(()=>{if(!t.current){t.current=!0;return}p(t=>({...t,showTests:e.timelineDefaults.showTests,failuresOnly:e.timelineDefaults.failuresOnly,dependencyDirection:e.timelineDefaults.dependencyDirection,dependencyDepthHops:e.timelineDefaults.dependencyDepthHops})),h(t=>({...t,explorerMode:e.inventoryDefaults.explorerMode})),y(t=>({...t,upstreamDepth:e.inventoryDefaults.lineageUpstreamDepth,downstreamDepth:e.inventoryDefaults.lineageDownstreamDepth,allDepsMode:e.inventoryDefaults.allDepsMode,lensMode:e.inventoryDefaults.lineageLensMode})),o(e.sidebarCollapsedDefault);try{window.localStorage.setItem(ge,String(e.sidebarCollapsedDefault))}catch{}},[e]),(0,c.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),x(e=>({...e,isOpen:!0}))),e.key===`Escape`&&(l(!1),x(e=>({...e,isOpen:!1})))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),{activeView:r,sidebarCollapsed:a,setSidebarCollapsed:w,sidebarOpen:s,setSidebarOpen:l,overviewFilters:u,setOverviewFilters:d,timelineFilters:f,setTimelineFilters:p,assetViewState:m,setAssetViewState:h,runsViewState:g,setRunsViewState:_,lineageViewState:v,setLineageViewState:y,searchState:b,setSearchState:x,investigationSelection:S,setInvestigationSelection:C,setNavigationTarget:T,handleNavigateTo:E,frameClass:[`app-frame`,a?`app-frame--sidebar-collapsed`:``,s?`app-frame--nav-open`:``].filter(Boolean).join(` `)}}function yx(){let{toast:e}=Zy(),{preferences:t,setPreferences:n}=nx(),r=vx(t),{analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:d,acceptingRemoteRun:f,onManagedAnalysisLoaded:p,artifactCapability:m,onError:h,onAcceptPendingRemoteRun:g}=qb(),{themePreference:_,setThemePreference:v}=fi();(0,c.useEffect)(()=>{t.theme!==_&&v(t.theme)},[t.theme,v,_]);let y=(0,c.useRef)(null);(0,c.useEffect)(()=>{i&&!y.current&&a===`preload`&&e(`Workspace loaded — ${i.summary.total_nodes} executions`,`positive`),i&&!y.current&&a===`remote`&&e(`Remote workspace loaded — ${i.summary.total_nodes} executions`,`positive`),y.current=i},[i,a,e]);let b=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(d==null){b.current=null;return}b.current!==d.runId&&(b.current=d.runId,e(`A newer remote run is available: ${d.label}`,`warning`))},[d,e]);let x=i?Ub(i,a):[];return(0,u.jsx)(Dg.Provider,{value:m,children:(0,u.jsx)(Vb,{workspace:r,analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:d,acceptingRemoteRun:f,onManagedAnalysisLoaded:p,onError:h,onAcceptPendingRemoteRun:g,themePreference:_,setPreferences:n,preferences:t,setThemePreference:v,workspaceSignals:x})})}function bx(){return(0,u.jsx)(Xy,{children:(0,u.jsx)(yx,{})})}(0,l.createRoot)(document.getElementById(`root`)).render((0,u.jsx)(c.StrictMode,{children:(0,u.jsx)(bx,{})}));
|
|
36
|
+
`)}]:[],c=[...o,...s];return(0,u.jsx)(Ti,{eyebrow:`Selected run item`,title:e.name,typeLabel:Dr(e.resourceType),stats:[{label:`Status`,value:e.status},{label:`Duration`,value:Er(e.executionTime)},{label:`Thread`,value:e.threadId??`n/a`},{label:hy,value:String(t.length+n.length)},{label:`Extra raw fields`,value:String(a.length)}],sections:c,actions:[{label:`Open in Timeline`,onClick:()=>r(`timeline`,{resourceId:e.uniqueId,executionId:e.uniqueId})},{label:`Open in Inventory`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},{label:`Open in Lineage`,onClick:()=>r(`inventory`,{resourceId:e.uniqueId,assetTab:`lineage`,rootResourceId:e.uniqueId})}]})}function _y(e){if(uy(e))return`desc`;switch(e){case`attention`:case`duration`:case`start`:return`desc`;default:return`asc`}}function vy(e,t){return t.sortBy===e?{sortBy:e,sortDirection:t.sortDirection===`asc`?`desc`:`asc`}:{sortBy:e,sortDirection:_y(e)}}function yy(e,t,n){return e===t?n===`asc`?{indicator:`↑`,ariaSort:`ascending`}:{indicator:`↓`,ariaSort:`descending`}:{indicator:` `,ariaSort:`none`}}function by(e){let t=[`minmax(280px, 2.5fr)`,`minmax(108px, 0.85fr)`,`minmax(92px, 0.7fr)`,`minmax(132px, 0.95fr)`,`minmax(96px, 0.72fr)`],n=e.map(e=>e.align===`end`?`minmax(120px, 0.95fr)`:`minmax(148px, 1.1fr)`);return[...t,...n,`minmax(160px, 1fr)`].join(` `)}function xy(e,t){return dy(e,t.key)?.displayValue??`—`}var Sy=`results-table__cell--align-end`;function Cy({sortKey:e,label:t,alignEnd:n,cellClassName:r,runsViewState:i,onRunsViewStateChange:a}){let o=yy(i.sortBy,e,i.sortDirection);return(0,u.jsx)(`div`,{className:`results-table__cell${r?` ${r}`:``}${n?` ${Sy}`:``}`,role:`columnheader`,"aria-sort":o.ariaSort,children:(0,u.jsxs)(`button`,{type:`button`,className:`results-table__sort-button${n?` results-table__sort-button--align-end`:``}`,onClick:()=>a(t=>({...t,...vy(e,t)})),children:[t,(0,u.jsx)(`span`,{className:`results-table__sort-indicator`,"aria-hidden":`true`,children:o.indicator})]})})}function wy({analysis:e,runsResults:t,runsViewState:n,adapterColumns:r,onRunsViewStateChange:i,onInvestigationSelectionChange:a}){let o=(0,c.useRef)(null),l=(0,c.useRef)(null),[d,f]=(0,c.useState)(44);(0,c.useLayoutEffect)(()=>{let e=l.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{f(Math.max(1,Math.ceil(e.getBoundingClientRect().height)))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[r.length]);let p=s({count:t.rows.length,getScrollElement:()=>o.current,estimateSize:()=>76,overscan:10,scrollMargin:d});(0,c.useEffect)(()=>{let e=o.current;if(!e)return;let n=()=>{e.scrollHeight-e.scrollTop-e.clientHeight<220&&t.hasMore&&!t.isLoading&&!t.isIndexing&&t.loadMore()};return e.addEventListener(`scroll`,n),n(),()=>e.removeEventListener(`scroll`,n)},[t]);let m={"--results-table-columns":by(r)},h=Math.min(560,Math.max(120,t.rows.length*76)),g=p.options.scrollMargin;return(0,u.jsx)(`div`,{className:`results-table`,style:m,children:(0,u.jsxs)(`div`,{ref:o,className:`results-table__scroll`,style:{height:h,overflowY:`auto`,position:`relative`},children:[(0,u.jsxs)(`div`,{ref:l,className:`results-table__header results-table__header--sticky`,role:`row`,children:[(0,u.jsx)(Cy,{sortKey:`name`,label:`Item`,cellClassName:`results-table__cell--item`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`resourceType`,label:`Type`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`materialization`,label:`Materialization`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`status`,label:`Status`,runsViewState:n,onRunsViewStateChange:i}),(0,u.jsx)(Cy,{sortKey:`duration`,label:`Duration`,alignEnd:!0,runsViewState:n,onRunsViewStateChange:i}),r.map(e=>{let t=e.align===`end`;return e.isScalar?(0,u.jsx)(Cy,{sortKey:e.id,label:e.label,alignEnd:t,runsViewState:n,onRunsViewStateChange:i},e.id):(0,u.jsx)(`div`,{className:`results-table__cell${t?` ${Sy}`:``}`,role:`columnheader`,title:e.label,children:e.label},e.id)}),(0,u.jsx)(Cy,{sortKey:`thread`,label:`Thread`,runsViewState:n,onRunsViewStateChange:i})]}),(0,u.jsx)(`div`,{className:`results-table__body`,children:(0,u.jsx)(`div`,{style:{height:p.getTotalSize(),position:`relative`},children:p.getVirtualItems().map(o=>{let s=t.rows[o.index];return s?(0,u.jsxs)(`button`,{type:`button`,className:`results-table__row${s.uniqueId===n.selectedExecutionId?` results-table__row--active`:``}`,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${o.start-g}px)`},onClick:()=>{let t=e.resources.find(e=>e.uniqueId===s.uniqueId)??null;i(e=>({...e,selectedExecutionId:s.uniqueId})),a(e=>({...e,selectedExecutionId:s.uniqueId,selectedResourceId:t?.uniqueId??s.uniqueId,sourceLens:`runs`}))},children:[(0,u.jsx)(`div`,{className:`results-table__cell results-table__cell--item`,"data-label":`Item`,title:s.name,children:(0,u.jsx)(`strong`,{children:s.name})}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Type`,title:s.resourceType,children:s.resourceType}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Materialization`,children:s.semantics?(0,u.jsx)(ua,{semantics:s.semantics,variant:`compact`}):`—`}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Status`,children:(0,u.jsx)(`span`,{className:Mr(s.statusTone),children:s.status})}),(0,u.jsx)(`div`,{className:`results-table__cell ${Sy}`,"data-label":`Duration`,children:Er(s.executionTime)}),r.map(e=>{let t=xy(s,e);return(0,u.jsx)(`div`,{className:`results-table__cell${e.align===`end`?` ${Sy}`:``}`,"data-label":e.label,title:t,children:t},e.id)}),(0,u.jsx)(`div`,{className:`results-table__cell`,"data-label":`Thread`,title:s.threadId??`n/a`,children:s.threadId??`n/a`})]},s.uniqueId):null})})})]})})}function Ty({kinds:e,activeKinds:t,onToggleKind:n,buttonTitle:r}){return(0,u.jsx)(`div`,{className:`pill-row`,children:e.map(e=>(0,u.jsx)(`button`,{type:`button`,className:t.size===0||t.has(e)?vr:yr,title:r,onClick:()=>n(e),children:aa(e)},e))})}var Ey=[{label:`All`,countKey:`all`},{kind:`models`,label:`Models`,countKey:`models`},{kind:`tests`,label:`Tests`,countKey:`tests`},{kind:`seeds`,label:`Seeds`,countKey:`seeds`},{kind:`snapshots`,label:`Snapshots`,countKey:`snapshots`},{kind:`operations`,label:`Operations`,countKey:`operations`},{status:`positive`,label:`Healthy`,countKey:`healthy`},{status:`issues`,label:`Issues`,countKey:`issues`},{status:`warning`,label:`Warnings`,countKey:`warnings`},{status:`danger`,label:`Errors`,countKey:`errors`}];function Dy(e){return e.facets}function Oy({runsViewState:e,runsResults:t,adapterColumnLayout:n,adapterMetricsAvailable:r,availableMaterializationKinds:i,onRunsViewStateChange:a}){let o=n.visibleColumns.filter(e=>e.isScalar),s=e.showAdapterMetrics&&o.length>0;return(0,u.jsxs)(`div`,{className:`runs-toolbar runs-toolbar--stacked`,children:[(0,u.jsxs)(`div`,{className:`runs-toolbar__controls`,children:[(0,u.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__search`,children:[(0,u.jsx)(`span`,{children:`Search`}),(0,u.jsx)(`input`,{value:e.query,onChange:e=>a(t=>({...t,query:e.target.value})),placeholder:`Filter by name, type, status, thread…`})]}),(0,u.jsxs)(`label`,{className:`workspace-search workspace-search--compact runs-toolbar__sort`,children:[(0,u.jsx)(`span`,{children:`Sort`}),(0,u.jsxs)(`select`,{value:e.sortBy,onChange:e=>{let t=e.target.value;a(e=>({...e,sortBy:t,sortDirection:_y(t)}))},children:[(0,u.jsx)(`option`,{value:`attention`,children:`Attention`}),(0,u.jsx)(`option`,{value:`duration`,children:`Duration`}),(0,u.jsx)(`option`,{value:`name`,children:`Name`}),(0,u.jsx)(`option`,{value:`status`,children:`Status`}),(0,u.jsx)(`option`,{value:`start`,children:`Start`}),(0,u.jsx)(`option`,{value:`materialization`,children:`Materialization`}),s?o.map(e=>(0,u.jsx)(`option`,{value:e.id,children:e.label},e.id)):null]})]}),(0,u.jsxs)(`label`,{className:`runs-toolbar__toggle`,title:r?`Show normalized adapter metrics derived from the current run`:`No normalized adapter metrics are available in this run`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.showAdapterMetrics,disabled:!r,onChange:e=>{let t=e.target.checked;a(e=>({...e,showAdapterMetrics:t,sortBy:!t&&uy(e.sortBy)?`attention`:e.sortBy,sortDirection:!t&&uy(e.sortBy)?`desc`:e.sortDirection}))}}),(0,u.jsx)(`span`,{children:`Adapter metrics`})]})]}),i.length>0?(0,u.jsxs)(`div`,{className:`runs-toolbar__mat-filters`,role:`group`,"aria-label":`Materialization filters`,children:[(0,u.jsx)(`span`,{className:`runs-toolbar__mat-filters-label`,children:`Materialization (manifest)`}),(0,u.jsx)(Ty,{kinds:i,activeKinds:e.materializationKinds,onToggleKind:e=>a(t=>{let n=new Set(t.materializationKinds);return n.has(e)?n.delete(e):n.add(e),{...t,materializationKinds:n}}),buttonTitle:`Filter run rows by normalized manifest materialization`})]}):null,e.showAdapterMetrics&&n.overflowColumns.length>0?(0,u.jsxs)(`p`,{className:`runs-toolbar__meta`,children:[`Showing `,n.visibleColumns.length,` of`,` `,n.allColumns.length,` adapter metrics. Select a row to inspect the remaining `,n.overflowColumns.length,`.`]}):null,(0,u.jsx)(`div`,{className:`runs-toolbar__facets`,children:Ey.map(n=>{let r=Dy(t.summary);return(0,u.jsxs)(`button`,{type:`button`,className:n.kind!=null&&e.kind===n.kind||n.status!=null&&e.status===n.status||n.kind==null&&n.status==null&&e.kind===`all`&&e.status===`all`?`workspace-pill workspace-pill--active`:`workspace-pill`,onClick:()=>a(e=>({...e,kind:n.kind??`all`,status:n.status??`all`})),children:[n.label,` (`,r[n.countKey],`)`]},n.label)})})]})}function ky({analysis:e,runsViewState:t,onRunsViewStateChange:n,onInvestigationSelectionChange:r,onNavigateTo:i}){let a=(0,c.useMemo)(()=>fy(e.executions),[e.executions]),o=a.allColumns.length>0,s=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.visibleColumns:[],[a.visibleColumns,o,t.showAdapterMetrics]),l=(0,c.useMemo)(()=>sa(e.executions.map(e=>e.semantics)),[e.executions]),d=(0,c.useMemo)(()=>t.showAdapterMetrics&&o?a.overflowColumns:[],[a.overflowColumns,o,t.showAdapterMetrics]);(0,c.useEffect)(()=>{let e=t.sortBy;uy(e)&&!s.some(t=>t.id===e&&t.isScalar)&&n(e=>({...e,sortBy:`attention`,sortDirection:`desc`}))},[n,t.sortBy,s]),(0,c.useEffect)(()=>{!o&&t.showAdapterMetrics&&n(e=>({...e,showAdapterMetrics:!1}))},[o,n,t.showAdapterMetrics]);let f=sy(e.executions,t,!0),p=e.executions.find(e=>e.uniqueId===t.selectedExecutionId)??null;return(0,u.jsx)(Ci,{title:`Runs`,description:`Execution and quality evidence across models, tests, seeds, snapshots, and operations.`,toolbar:(0,u.jsx)(Oy,{runsViewState:t,runsResults:f,adapterColumnLayout:a,adapterMetricsAvailable:o,availableMaterializationKinds:l,onRunsViewStateChange:n}),inspector:p?(0,u.jsx)(gy,{row:p,visibleColumns:s,overflowColumns:d,onNavigateTo:i}):null,className:`runs-view`,children:(0,u.jsx)(wy,{analysis:e,runsResults:f,runsViewState:t,adapterColumns:s,onRunsViewStateChange:n,onInvestigationSelectionChange:r})})}var $={resourceTypeSummaryAriaLabel:`Run outcomes for executed dbt assets (non-test resources such as models and sources), grouped by resource type. Counts are how many assets succeeded versus had warnings or failures. These are not dbt test pass or fail totals.`,resourceTypeSummaryTitle:`Run outcomes for executed dbt assets by type (excludes tests). Not dbt test pass or fail totals.`,resourceTypeSummaryItemTitle(e){return`${e}: executed asset run outcomes for this type, not dbt test totals.`},treeTestStatsTitle:`Attention-only rollup of executed dbt test outcomes for this folder or row: failed or errored, warning, and dbt-skipped. Passing tests and tests with no run result (not executed) are not shown here. A test that depends on multiple resources may be counted more than once in folder totals.`,treeTestStatsBranchAriaLabel:`Dbt test attention rollup for resources in this folder: failed or error, warning, and skipped counts only. Passing tests and not-executed tests are not shown. Tests with multiple upstream dependencies may be counted more than once when summed at higher folders.`,treeTestStatsLeafAriaLabel:`Dbt test attention outcomes for this resource: failed or error, warning, and skipped only. Passing tests and not-executed tests are not shown.`,treeTestStatErrorTitle(e){return`Failed or errored dbt test attachments: ${e}`},treeTestStatWarnTitle(e){return`Warning dbt test attachments: ${e}`},treeTestStatSkippedTitle(e){return`Dbt skipped or no-op test attachments: ${e}. Folder rollups may count one test multiple times when it depends on several resources.`},treeEmptyHeadline:`No resources found`,treeEmptyDefaultSubtext:`Adjust filters or search to find matching branches or assets.`,treeEmptySearchSubtext:`Try clearing or changing the resource search box.`,treeEmptyResourceTypesSubtext:`One or more dbt resource types are narrowed; add types or reset type filters to see more assets.`,treeEmptyMaterializationSubtext:`Materialization filters are narrowing the tree; clear or broaden them to see more assets (values come from manifest metadata).`,treeEmptyExecutionFilterSubtext(e){switch(e){case`danger`:return`Execution status is Fail: only assets with a failed or errored result in this run are shown. Assets without a run row are treated as Not executed, not Fail. For models whose run succeeded but dbt tests failed, use Issues. Try Execution status All, or confirm run results are loaded for this workspace.`;case`issues`:return`Execution status is Issues: assets with a failed or errored run result, or with failed, warned, or skipped dbt test attachments in this run. Fail shows execution failures only.`;case`neutral`:return`Execution status is Not executed: only assets without a matching run result (or unknown status) are shown. Try All or confirm run results are loaded.`;case`positive`:return`Execution status is Success: only successful runs are shown. Try All or adjust other filters.`;case`warning`:return`Execution status is Warn: only warned runs are shown. Try All or adjust other filters.`;case`skipped`:return`Execution status is Skipped: only skipped runs are shown. Try All or adjust other filters.`;default:return``}},executionStatusSectionTitle:`Filter by run & tests`,executionStatusRunOutcomeSubLabel:`Run outcome`,executionStatusProblemsSubLabel:`Run + dbt tests`};function Ay(e){switch(e){case`all`:return`All`;case`positive`:return`Success`;case`warning`:return`Warn`;case`danger`:return`Fail (run)`;case`skipped`:return`Skipped`;case`neutral`:return`Not executed`;case`issues`:return`Issues (run or tests)`;default:return e}}function jy(e){return e===`all`?`Show all assets regardless of run outcome or attached dbt test results.`:$.treeEmptyExecutionFilterSubtext(e)}function My(e){let t=[];return e.status!==`all`&&t.push($.treeEmptyExecutionFilterSubtext(e.status)),e.resourceQuery.trim()&&t.push($.treeEmptySearchSubtext),e.activeResourceTypeCount>0&&t.push($.treeEmptyResourceTypesSubtext),(e.activeMaterializationKindCount??0)>0&&t.push($.treeEmptyMaterializationSubtext),t.length===0?$.treeEmptyDefaultSubtext:t.join(` `)}var Ny=`dbt-tools.explorerFiltersExpanded`;function Py(){try{let e=window.localStorage.getItem(Ny);if(e!==null)return e===`true`}catch{}return!1}function Fy({filtersExpanded:e,setFiltersExpandedPersisted:t,activeFilterCount:n,filterSummary:r,resourceQuery:i,setResourceQuery:a,status:o,setStatus:s,availableResourceTypes:c,activeResourceTypes:l,toggleResourceType:d,availableMaterializationKinds:f,activeMaterializationKinds:p,toggleMaterializationKind:m}){return(0,u.jsxs)(`section`,{className:`explorer-filters`,"aria-label":`Explorer filters`,children:[(0,u.jsxs)(`button`,{type:`button`,className:`explorer-filters__toggle`,"aria-expanded":e,onClick:()=>t(!e),children:[(0,u.jsxs)(`span`,{className:`explorer-filters__toggle-copy`,children:[(0,u.jsx)(`span`,{className:`explorer-filters__toggle-label`,children:`Filters`}),(0,u.jsx)(`span`,{className:`explorer-filters__toggle-summary`,children:r})]}),(0,u.jsxs)(`span`,{className:`explorer-filters__toggle-meta`,children:[n>0&&(0,u.jsx)(`span`,{className:`explorer-filters__badge`,children:n}),(0,u.jsx)(`span`,{className:`explorer-filters__chevron${e?` explorer-filters__chevron--expanded`:``}`,"aria-hidden":`true`,children:`▾`})]})]}),e&&(0,u.jsxs)(`div`,{className:`explorer-filter-stack`,children:[(0,u.jsxs)(`label`,{className:`workspace-search`,children:[(0,u.jsx)(`span`,{children:`Search resources`}),(0,u.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Filter tree by name, path, type, or id`})]}),(0,u.jsxs)(`div`,{className:`explorer-filter-group`,children:[(0,u.jsx)(`span`,{className:`explorer-filter-group__label`,children:$.executionStatusSectionTitle}),(0,u.jsxs)(`div`,{className:`explorer-status-filters`,children:[(0,u.jsxs)(`div`,{className:`explorer-status-filters__block`,children:[(0,u.jsx)(`span`,{className:`explorer-status-filters__sublabel`,id:`explorer-status-run-outcome-label`,children:$.executionStatusRunOutcomeSubLabel}),(0,u.jsx)(`div`,{className:`pill-row`,role:`group`,"aria-labelledby":`explorer-status-run-outcome-label`,children:[`all`,`positive`,`warning`,`danger`,`skipped`,`neutral`].map(e=>(0,u.jsx)(`button`,{type:`button`,className:o===e?`workspace-pill workspace-pill--active`:`workspace-pill`,title:jy(e),"aria-label":`${Ay(e)}. ${jy(e)}`,onClick:()=>s(e),children:Ay(e)},e))})]}),(0,u.jsxs)(`div`,{className:`explorer-status-filters__block explorer-status-filters__block--problems`,children:[(0,u.jsx)(`span`,{className:`explorer-status-filters__sublabel`,id:`explorer-status-problems-label`,children:$.executionStatusProblemsSubLabel}),(0,u.jsx)(`div`,{className:`pill-row`,role:`group`,"aria-labelledby":`explorer-status-problems-label`,children:(0,u.jsx)(`button`,{type:`button`,className:o===`issues`?`workspace-pill workspace-pill--active`:`workspace-pill`,title:jy(`issues`),"aria-label":`${Ay(`issues`)}. ${jy(`issues`)}`,onClick:()=>s(`issues`),children:Ay(`issues`)})})]})]})]}),c.length>0&&(0,u.jsxs)(`div`,{className:`explorer-filter-group`,children:[(0,u.jsx)(`span`,{className:`explorer-filter-group__label`,children:`dbt resource type`}),(0,u.jsx)(`div`,{className:`pill-row`,children:c.map(e=>(0,u.jsx)(`button`,{type:`button`,className:l.size===0||l.has(e)?`workspace-pill workspace-pill--active`:`workspace-pill`,onClick:()=>d(e),children:Dr(e)},e))})]}),f.length>0&&(0,u.jsxs)(`div`,{className:`explorer-filter-group`,children:[(0,u.jsx)(`span`,{className:`explorer-filter-group__label`,children:`Materialization (manifest)`}),(0,u.jsx)(Ty,{kinds:f,activeKinds:p,onToggleKind:m,buttonTitle:`Filter by normalized config.materialized / resource kind`})]})]})]})}function Iy(e){let t=Dr(e.resourceType),n=xa(e);return n?`${e.name}, ${t}, file ${n}`:`${e.name}, ${t}`}function Ly({testStats:e,variant:t}){return pa(e)?(0,u.jsxs)(`span`,{className:`explorer-tree__test-stats-wrap`,role:`group`,"aria-label":t===`branch`?$.treeTestStatsBranchAriaLabel:$.treeTestStatsLeafAriaLabel,title:$.treeTestStatsTitle,children:[(0,u.jsx)(`span`,{className:`explorer-tree__test-stats-label`,"aria-hidden":`true`,children:`Test issues`}),(0,u.jsxs)(`span`,{className:`explorer-tree__test-stats`,children:[e.error>0&&(0,u.jsxs)(`span`,{className:`explorer-tree__test-stat explorer-tree__test-stat--fail`,title:$.treeTestStatErrorTitle(e.error),children:[`✗`,e.error]}),e.warn>0&&(0,u.jsxs)(`span`,{className:`explorer-tree__test-stat explorer-tree__test-stat--warn`,title:$.treeTestStatWarnTitle(e.warn),children:[`!`,e.warn]}),e.skipped>0&&(0,u.jsxs)(`span`,{className:`explorer-tree__test-stat explorer-tree__test-stat--skipped`,title:$.treeTestStatSkippedTitle(e.skipped),children:[`−`,e.skipped]})]})]}):null}function Ry({virtualRow:e,measureRow:t,children:n}){return(0,u.jsx)(`div`,{"data-index":e.index,ref:t,className:`explorer-tree__virtual-row`,style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${e.start}px)`},children:n})}function zy({treeRows:e,explorerMode:t,expandedNodeIds:n,toggleExpandedNode:r,selectedResourceId:i,setSelectedResourceId:a,treeEmptyDisplay:o}){let l=(0,c.useRef)(null),d=s({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>30,overscan:16}),f=d.measureElement;return e.length===0?(0,u.jsx)(`div`,{ref:l,className:`explorer-tree`,children:(0,u.jsx)($r,{icon:`🔍`,headline:o?.headline??$.treeEmptyHeadline,subtext:o?.subtext??$.treeEmptyDefaultSubtext})}):(0,u.jsx)(`div`,{ref:l,className:`explorer-tree`,children:(0,u.jsx)(`div`,{className:`explorer-tree__virtual-spacer`,style:{height:d.getTotalSize(),width:`100%`,position:`relative`},children:d.getVirtualItems().map(o=>{let s=e[o.index];if(!s)return null;let{node:c,depth:l}=s;if(c.kind===`branch`){let e=n.has(c.id);return(0,u.jsx)(Ry,{virtualRow:o,measureRow:f,children:(0,u.jsxs)(`button`,{type:`button`,className:`explorer-tree__row explorer-tree__row--branch`,style:{paddingLeft:`${.9+l*1.05}rem`},onClick:()=>r(c.id),children:[(0,u.jsx)(`span`,{className:`explorer-tree__chevron${e?` explorer-tree__chevron--expanded`:``}`,"aria-hidden":`true`,children:`▸`}),(0,u.jsx)(`span`,{className:`explorer-tree__folder`,"aria-hidden":`true`,children:(0,u.jsx)(Si,{mode:t,depth:l})}),(0,u.jsx)(`span`,{className:`explorer-tree__label`,children:c.label}),c.testStats&&(0,u.jsx)(Ly,{testStats:c.testStats,variant:`branch`})]})},o.key)}let d=c.resource;return(0,u.jsx)(Ry,{virtualRow:o,measureRow:f,children:(0,u.jsxs)(`button`,{type:`button`,className:d.uniqueId===i?`explorer-tree__row explorer-tree__row--leaf explorer-tree__row--active`:`explorer-tree__row explorer-tree__row--leaf`,style:{paddingLeft:`${.9+l*1.05}rem`},onClick:()=>a(d.uniqueId),title:d.uniqueId,"aria-label":Iy(d),children:[(0,u.jsx)(`span`,{className:`explorer-tree__leaf-icon`,"aria-hidden":`true`,children:(0,u.jsx)(xi,{resourceType:d.resourceType})}),(0,u.jsx)(`span`,{className:`explorer-tree__resource-body`,children:(0,u.jsx)(`span`,{className:`explorer-tree__label`,children:d.name})}),d.semantics?(0,u.jsx)(ua,{semantics:d.semantics,variant:`compact`}):null,c.testStats&&(0,u.jsx)(Ly,{testStats:c.testStats,variant:`leaf`})]})},o.key)})})})}function By({mode:e}){return e===`project`?(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:(0,u.jsx)(`path`,{d:`M3.5 7.5h6l1.8 2h8.7v7.8a1.2 1.2 0 0 1-1.2 1.2H4.7a1.2 1.2 0 0 1-1.2-1.2V8.7a1.2 1.2 0 0 1 1.2-1.2Z`})}):e===`database`?(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,children:[(0,u.jsx)(`ellipse`,{cx:`12`,cy:`6.2`,rx:`6.5`,ry:`2.7`}),(0,u.jsx)(`path`,{d:`M5.5 6.2v5.6c0 1.5 2.9 2.7 6.5 2.7s6.5-1.2 6.5-2.7V6.2`}),(0,u.jsx)(`path`,{d:`M5.5 11.8v5.8c0 1.5 2.9 2.7 6.5 2.7s6.5-1.2 6.5-2.7v-5.8`})]}):null}function Vy({resources:e}){let t=e.filter(e=>!H.has(e.resourceType)&&e.statusTone!==`neutral`);if(t.length===0)return null;let n=new Map;for(let e of t){let t=n.get(e.resourceType)??{pass:0,fail:0};e.statusTone===`positive`?t.pass++:(e.statusTone===`danger`||e.statusTone===`warning`)&&t.fail++,n.set(e.resourceType,t)}let r=Array.from(n.entries()).sort(([e],[t])=>e.localeCompare(t));return(0,u.jsx)(`div`,{className:`resource-type-summary`,"aria-label":$.resourceTypeSummaryAriaLabel,title:$.resourceTypeSummaryTitle,children:r.map(([e,{pass:t,fail:n}])=>{let r=Dr(e);return(0,u.jsxs)(`span`,{className:`resource-type-summary__item`,title:$.resourceTypeSummaryItemTitle(r),children:[(0,u.jsx)(`span`,{className:`resource-type-summary__type`,children:r}),t>0&&(0,u.jsxs)(`span`,{className:`resource-type-summary__pass`,children:[`✓`,t]}),n>0&&(0,u.jsxs)(`span`,{className:`resource-type-summary__fail`,children:[`✗`,n]})]},e)})})}function Hy({treeRows:e,filteredResources:t,totalResources:n,matchedResources:r,explorerMode:i,setExplorerMode:a,status:o,setStatus:s,availableResourceTypes:l,activeResourceTypes:d,toggleResourceType:f,availableMaterializationKinds:p,activeMaterializationKinds:m,toggleMaterializationKind:h,resourceQuery:g,setResourceQuery:_,selectedResourceId:v,expandedNodeIds:y,toggleExpandedNode:b,setSelectedResourceId:x}){let[S,C]=(0,c.useState)(Py),w=e=>{C(e);try{window.localStorage.setItem(Ny,String(e))}catch{}},T=+!!g.trim()+(o===`all`?0:1)+ +(d.size>0)+ +(m.size>0),E=T>0?`${T} active`:`Search, status, and type`;return(0,u.jsxs)(`aside`,{className:`explorer-pane`,children:[(0,u.jsxs)(`div`,{className:`explorer-pane__header`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Asset explorer`}),(0,u.jsx)(`h2`,{children:`Workspace inventory`})]}),(0,u.jsxs)(`div`,{className:`explorer-pane__count`,children:[r,r!==n&&(0,u.jsxs)(`span`,{className:`explorer-pane__count-subtext`,children:[`of `,n]})]})]}),(0,u.jsx)(`div`,{className:`explorer-mode-tabs`,role:`tablist`,"aria-label":`Explorer modes`,children:[`project`,`database`].map(e=>(0,u.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i===e,className:i===e?`explorer-mode-tab explorer-mode-tab--active`:`explorer-mode-tab`,onClick:()=>a(e),children:[(0,u.jsx)(`span`,{className:`explorer-mode-tab__icon`,"aria-hidden":`true`,children:(0,u.jsx)(By,{mode:e})}),wr[e]]},e))}),(0,u.jsx)(Fy,{filtersExpanded:S,setFiltersExpandedPersisted:w,activeFilterCount:T,filterSummary:E,resourceQuery:g,setResourceQuery:_,status:o,setStatus:s,availableResourceTypes:l,activeResourceTypes:d,toggleResourceType:f,availableMaterializationKinds:p,activeMaterializationKinds:m,toggleMaterializationKind:h}),(0,u.jsx)(Vy,{resources:t}),(0,u.jsx)(zy,{treeRows:e,explorerMode:i,expandedNodeIds:y,toggleExpandedNode:b,selectedResourceId:v,setSelectedResourceId:x,treeEmptyDisplay:e.length===0?{headline:$.treeEmptyHeadline,subtext:My({status:o,resourceQuery:g,activeResourceTypeCount:d.size,activeMaterializationKindCount:m.size})}:void 0})]})}function Uy(e,t,n,r,i,a,o){(0,c.useEffect)(()=>{if(e.length===0||a==null)return;let t=Ma(e,a);t.size!==0&&o(e=>[...t].filter(t=>!e.expandedNodeIds.has(t)).length===0?e:{...e,expandedNodeIds:new Set([...e.expandedNodeIds,...t])})},[e,o,a]),(0,c.useEffect)(()=>{if(i!==`project`||a!=null||e.length===0||n.size>0)return;let s=Ea(r);t.has(s)&&o(e=>e.explorerMode!==`project`||e.selectedResourceId!=null||e.expandedNodeIds.has(s)?e:{...e,expandedNodeIds:new Set([...e.expandedNodeIds,s])})},[t,i,n.size,e.length,o,r,a])}function Wy(e){return e===`inventory`}function Gy({analysis:e,projectName:t,activeView:n,assetViewState:r,onAssetViewStateChange:i,onInvestigationSelectionChange:a}){let o=(0,c.useMemo)(()=>r.explorerMode!==`project`||t==null?e.resources:e.resources.filter(e=>Hr(e,t)),[e.resources,r.explorerMode,t]),s=(0,c.useMemo)(()=>Array.from(new Set(o.map(e=>e.resourceType))).sort(),[o]),l=(0,c.useMemo)(()=>sa(o.map(e=>e.semantics)),[o]),d=(0,c.useMemo)(()=>ma(o,e.dependencyIndex),[e.dependencyIndex,o]),f=(0,c.useMemo)(()=>o.filter(e=>Ir(e,r.status,d)&&Lr(e,r.resourceTypes)&&Rr(e,r.materializationKinds)&&Fr(e,r.resourceQuery)),[r.materializationKinds,r.resourceQuery,r.resourceTypes,r.status,d,o]),p=(0,c.useMemo)(()=>Da(f,r.explorerMode,t,e.dependencyIndex),[e.dependencyIndex,r.explorerMode,f,t]),m=(0,c.useMemo)(()=>ka(p),[p]),h=(0,c.useMemo)(()=>new Set([...r.expandedNodeIds].filter(e=>m.has(e))),[m,r.expandedNodeIds]),g=(0,c.useMemo)(()=>Oa(p,h),[h,p]),_=(0,c.useMemo)(()=>Aa(p),[p]),v=r.selectedResourceId;return Uy(p,m,h,t,r.explorerMode,v,i),{explorerPane:Wy(n)?(0,u.jsx)(Hy,{treeRows:g,filteredResources:f,totalResources:o.length,matchedResources:_.length,explorerMode:r.explorerMode,setExplorerMode:e=>i(t=>({...t,explorerMode:e})),status:r.status,setStatus:e=>i(t=>({...t,status:e})),availableResourceTypes:s,activeResourceTypes:r.resourceTypes,toggleResourceType:e=>i(t=>{let n=new Set(t.resourceTypes);return n.has(e)?n.delete(e):n.add(e),{...t,resourceTypes:n}}),availableMaterializationKinds:l,activeMaterializationKinds:r.materializationKinds,toggleMaterializationKind:e=>i(t=>{let n=new Set(t.materializationKinds);return n.has(e)?n.delete(e):n.add(e),{...t,materializationKinds:n}}),resourceQuery:r.resourceQuery,setResourceQuery:e=>i(t=>({...t,resourceQuery:e})),selectedResourceId:v,expandedNodeIds:h,toggleExpandedNode:e=>i(t=>{let n=new Set(t.expandedNodeIds);return n.has(e)?n.delete(e):n.add(e),{...t,expandedNodeIds:n}}),setSelectedResourceId:e=>{i(t=>({...t,selectedResourceId:e})),a(t=>({...t,selectedResourceId:e,sourceLens:`inventory`}))}}):null}}function Ky({analysis:e,activeView:t,analysisSource:n,overviewFilters:r,onOverviewFiltersChange:i,timelineFilters:a,onTimelineFiltersChange:o,assetViewState:s,onAssetViewStateChange:c,runsViewState:l,onRunsViewStateChange:d,lineageViewState:f,onLineageViewStateChange:p,onInvestigationSelectionChange:m,onNavigateTo:h,workspaceSignals:g}){let _=e.projectName??Vr(e.executions),{explorerPane:v}=Gy({analysis:e,projectName:_,activeView:t,assetViewState:s,onAssetViewStateChange:c,onInvestigationSelectionChange:m}),y=s.selectedResourceId,b=e.resources.find(e=>e.uniqueId===y)??null;return(0,u.jsxs)(`div`,{className:`workspace-layout${v?``:` workspace-layout--full`}`,children:[v,(0,u.jsxs)(`div`,{className:`workspace-main-panel`,children:[t===`health`&&(0,u.jsx)(la,{analysis:e,projectName:_,analysisSource:n,filters:r,setFilters:i,workspaceSignals:g}),t===`inventory`&&(0,u.jsx)(Kg,{analysis:e,resource:b,onSelectResource:e=>c(t=>({...t,selectedResourceId:e})),assetViewState:{...s,selectedResourceId:y},onAssetViewStateChange:c,lineageViewState:f,onLineageViewStateChange:p,onInvestigationSelectionChange:m,onNavigateTo:h}),t===`runs`&&(0,u.jsx)(ky,{analysis:e,runsViewState:l,onRunsViewStateChange:d,onInvestigationSelectionChange:m,onNavigateTo:h}),t===`timeline`&&(0,u.jsx)(iy,{analysis:e,filters:a,setFilters:o,onInvestigationSelectionChange:m})]})]})}var qy=(0,c.createContext)({toast:()=>{}}),Jy=0,Yy=4e3;function Xy({children:e}){let[t,n]=(0,c.useState)([]),r=(0,c.useCallback)((e,t=`neutral`)=>{let r=++Jy;n(n=>[...n,{id:r,message:e,tone:t}]),setTimeout(()=>{n(e=>e.filter(e=>e.id!==r))},Yy)},[]);function i(e){n(t=>t.filter(t=>t.id!==e))}return(0,u.jsxs)(qy.Provider,{value:{toast:r},children:[e,t.length>0&&(0,u.jsx)(`div`,{className:`toast-portal`,role:`status`,"aria-live":`polite`,children:t.map(e=>(0,u.jsxs)(`div`,{className:`toast toast--${e.tone}`,children:[(0,u.jsx)(`span`,{className:`toast__dot`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`toast__message`,children:e.message}),(0,u.jsx)(`button`,{type:`button`,className:`toast__dismiss`,"aria-label":`Dismiss notification`,onClick:()=>i(e.id),children:`✕`})]},e.id))})]})}function Zy(){return(0,c.useContext)(qy)}function Qy(e,t){if(e!==`gcs`||t==null)return{};let n=t.impersonatedServiceAccount?.trim();return n==null||n===``?{}:{options:{impersonatedServiceAccount:n}}}function $y(e,t){if(typeof e!=`object`||!e)return t;let n=e.error;return typeof n==`string`&&n.trim()!==``?n:t}var eb={manifest:`/api/manifest.json`,runResults:`/api/run_results.json`,catalog:`/api/catalog.json`,sources:`/api/sources.json`},tb=[{manifest:`/api/artifacts/current/manifest.json`,runResults:`/api/artifacts/current/run_results.json`,catalog:`/api/artifacts/current/catalog.json`,sources:`/api/artifacts/current/sources.json`},eb];function nb(){return{checkedAtMs:Date.now(),remoteProvider:null,remoteLocation:null,pollIntervalMs:null,currentRun:null,pendingRun:null,supportsSwitch:!1,discoveryError:null,sourceKind:null,locationDisplay:null,missingOptionalArtifacts:void 0}}function rb(e,t,n){return{mode:e,currentSource:t,label:n,...nb()}}async function ib(e){let t=await fetch(e);if(!t.ok)return null;let n=t.headers?.get?.(`content-type`)?.toLowerCase();return n!=null&&!n.includes(`application/json`)?null:t.arrayBuffer()}async function ab(e){try{return await ib(e)}catch{return null}}async function ob(e){try{return await ib(e)}catch{return null}}async function sb(e){let[t,n,r,i]=await Promise.all([ab(e.manifest),ab(e.runResults),ob(e.catalog),ob(e.sources)]);return t==null||n==null?null:{manifestBytes:t,runResultsBytes:n,...r==null?{}:{catalogBytes:r},...i==null?{}:{sourcesBytes:i}}}async function cb(e=tb){for(let t of e){let e=await sb(t);if(e!=null)return e}return null}async function lb(){let e=await cb([eb]);return e==null?null:C(e,`preload`)}async function ub(){let e=await lb();return{status:rb(e==null?`none`:`preload`,e==null?null:`preload`,e==null?`Waiting for artifacts`:`Live target`),result:e}}async function db(){let e=await fetch(`/api/artifact-source`);if(!e.ok)throw Error(`Failed to load artifact source status`);return await e.json()}async function fb(e=`preload`){let t=await cb();return t==null?null:C(t,e)}async function pb(){let e;try{e=await fetch(`/api/artifact-source`)}catch{return ub()}if(e.status===404||!e.ok)return ub();let t;try{t=await e.json()}catch{return ub()}return t.currentSource==null?{status:t,result:null}:{status:t,result:await fb(t.currentSource)}}async function mb(e){let t=await fetch(`/api/artifact-source/switch`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{runId:e}:{})});if(!t.ok)throw Error(`Failed to switch artifact source run`);return await t.json()}async function hb(e,t,n){let r=e===`local`?{type:`local`,location:t}:e===`s3`?{type:`s3`,location:t}:{type:`gcs`,location:t,...Qy(e,n)},i=await fetch(`/api/artifact-source/discover`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}),a=await i.json().catch(()=>({}));if(!i.ok)throw Error($y(a,`Failed to discover artifact source`));return a}async function gb(e,t,n,r){let i={...e===`local`?{type:`local`,location:t}:e===`s3`?{type:`s3`,location:t}:{type:`gcs`,location:t},...n!=null&&n.trim()!==``?{runId:n}:{},...Qy(e,r)},a=await fetch(`/api/artifact-source/configure`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),o=await a.json().catch(()=>({}));if(!a.ok)throw Error($y(o,`Failed to configure artifact source`));return o}function _b(e){return e===`local`?`/path/to/target or relative/path`:e===`s3`?`s3://bucket/prefix or bucket/prefix`:`gs://bucket/prefix or bucket/prefix`}function vb(e){return e===`local`?`Resolved on the server running this app, not in your browser.`:`Uses server-side SDK credentials; keys never enter the browser.`}function yb(e){return e.discoverLoading?`Scanning for artifacts…`:e.discoveryError==null?e.scanSucceeded?`Artifacts found. You can load the workspace again if needed.`:e.location.trim()===``?`Enter a location, then scan.`:`Press Enter or Scan to check this location.`:`Scan failed. Fix the location and scan again.`}function bb(e){if(e.loadLoading)return`Loading artifact workspace…`;if(!e.canLoad){if(e.discoverLoading)return`Scanning for artifacts…`;if(e.discoveryError!=null)return`Fix the error below, then scan again.`;if(e.location.trim()===``)return`Enter a path, then press Enter, blur the field, or click Scan location.`;if(!e.scanSucceeded)return`Press Enter, blur Location, or click Scan location, then click Load workspace.`}}var xb=[{value:`local`,label:`Local directory`},{value:`s3`,label:`Amazon S3`},{value:`gcs`,label:`Google Cloud Storage`}];function Sb(e){return e?`workspace-segmented-control__button workspace-segmented-control__button--active`:`workspace-segmented-control__button`}function Cb({readinessRegionId:e,readinessLabel:t,sourceKind:n,onSourceKindChange:r,location:i,onLocationChange:a,onLocationBlur:o,onLocationKeyDown:s,impersonatedServiceAccount:c,onImpersonatedServiceAccountChange:l,onImpersonatedServiceAccountBlur:d,discoveryError:f,onScan:p,discoverLoading:m,canLoad:h,loadLoading:g,loadWorkspaceHint:_,onLoadWorkspace:v}){let y=[`artifact-location-helper`,f==null?void 0:`artifact-location-error`,e].filter(Boolean).join(` `);return(0,u.jsxs)(`div`,{className:`upload-panel`,children:[(0,u.jsxs)(`header`,{className:`upload-panel__header`,children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Artifact source`}),(0,u.jsx)(`h3`,{children:`Artifact location`}),(0,u.jsxs)(`p`,{className:`upload-panel__lede`,children:[`Folder or prefix with `,(0,u.jsx)(`code`,{children:`manifest.json`}),` and `,(0,u.jsx)(`code`,{children:`run_results.json`}),` at the root.`]})]}),(0,u.jsxs)(`div`,{className:`upload-panel__body artifact-load-panel__inputs`,children:[(0,u.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,u.jsx)(`span`,{className:`upload-panel__label`,id:`artifact-source-kind-label`,children:`Connection`}),(0,u.jsx)(`div`,{className:`workspace-segmented-control`,role:`tablist`,"aria-labelledby":`artifact-source-kind-label`,children:xb.map(e=>{let t=n===e.value;return(0,u.jsx)(`button`,{type:`button`,role:`tab`,id:`artifact-source-tab-${e.value}`,"aria-selected":t,className:Sb(t),onClick:()=>r(e.value),children:e.label},e.value)})})]}),(0,u.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,u.jsx)(`label`,{className:`upload-panel__label`,htmlFor:`artifact-location-input`,children:`Location`}),(0,u.jsxs)(`div`,{className:`upload-panel__location-row`,children:[(0,u.jsx)(`input`,{id:`artifact-location-input`,type:`text`,autoComplete:`off`,"aria-invalid":f!=null,"aria-describedby":y,placeholder:_b(n),value:i,onChange:e=>a(e.target.value),onBlur:o,onKeyDown:s}),(0,u.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:m||i.trim()===``,"aria-busy":m,onClick:p,children:m?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Lg,{size:16}),` Scanning…`]}):`Scan location`})]}),(0,u.jsx)(`p`,{id:`artifact-location-helper`,className:`upload-panel__helper`,children:vb(n)}),f==null?null:(0,u.jsx)(`p`,{id:`artifact-location-error`,className:`upload-panel__error`,role:`alert`,children:f})]}),n===`gcs`?(0,u.jsxs)(`div`,{className:`upload-panel__field`,children:[(0,u.jsx)(`label`,{className:`upload-panel__label`,htmlFor:`artifact-gcs-impersonated-service-account`,children:`Impersonated service account`}),(0,u.jsx)(`input`,{id:`artifact-gcs-impersonated-service-account`,type:`text`,autoComplete:`off`,placeholder:`target-sa@project.iam.gserviceaccount.com`,value:c,onChange:e=>l(e.target.value),onBlur:()=>{d?.()}}),(0,u.jsx)(`p`,{className:`upload-panel__helper`,children:`Optional. Uses server-side Google credentials to impersonate this service account for GCS access. After editing, leave this field or run Scan location (or press Enter in Location).`})]}):null]}),(0,u.jsxs)(`footer`,{className:`upload-panel__footer`,children:[(0,u.jsx)(`span`,{id:e,className:`upload-panel__footer-status`,role:`status`,children:m?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Lg,{size:16}),` `,t]}):t}),(0,u.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:!h||g,"aria-busy":g,"aria-describedby":e,title:_??void 0,onClick:v,children:g?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(Lg,{size:16}),` Loading…`]}):`Load workspace`})]})]})}var wb=[{title:`Health-first overview`,body:`Spot failing nodes, long-running bottlenecks, and critical-path pressure before opening individual assets.`},{title:`Catalog-style context`,body:`Browse lineage-adjacent metadata such as descriptions, packages, execution status, and dependency depth in one flow.`},{title:`Timeline investigation`,body:`Shift from summary to execution sequencing without leaving the workspace, inspired by dbt docs and observability tools.`}];function Tb(){return(0,u.jsxs)(`div`,{className:`upload-hero__copy`,children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Load artifacts`}),(0,u.jsx)(`h2`,{children:`Point the workspace at a directory or cloud prefix that contains dbt JSON artifacts.`}),(0,u.jsxs)(`p`,{children:[`The server discovers `,(0,u.jsx)(`code`,{children:`manifest.json`}),` and `,(0,u.jsx)(`code`,{children:`run_results.json`}),` `,`(required), plus optional `,(0,u.jsx)(`code`,{children:`catalog.json`}),` and `,(0,u.jsx)(`code`,{children:`sources.json`}),`. Cloud access uses server-side credentials only.`]}),(0,u.jsxs)(`div`,{className:`upload-hero__callout`,children:[(0,u.jsx)(`span`,{className:`upload-hero__callout-badge`,children:`Layout`}),(0,u.jsx)(`strong`,{children:`Artifacts must be at the location root (typical dbt target/).`}),(0,u.jsx)(`p`,{children:`Point at the directory or prefix that directly contains manifest.json and run_results.json.`})]}),(0,u.jsx)(`div`,{className:`upload-feature-grid`,children:wb.map(e=>(0,u.jsxs)(`article`,{className:`upload-feature-card`,children:[(0,u.jsx)(`strong`,{children:e.title}),(0,u.jsx)(`p`,{children:e.body})]},e.title))})]})}function Eb(e,t,n){return e===`gcs`?`gcs|${t}|${n}`:`${e}|${t}`}function Db(e,t,n,r){if(t===``)return null;let i=Eb(e,t,n);return r!==``&&i===r?null:`Run artifact discovery again after changing the location or connection settings.`}function Ob(e,t,n,r,i){return i?`Wait for artifact discovery to finish, then try loading again.`:Db(e,t,n,r)}function kb(e,t){if(e===`gcs`)return{impersonatedServiceAccount:t}}function Ab({onManagedLoad:e,onError:t}){let{toast:n}=Zy(),r=(0,c.useId)(),[i,a]=(0,c.useState)(`local`),[o,s]=(0,c.useState)(``),[l,d]=(0,c.useState)(``),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(``),[v,y]=(0,c.useState)(null),b=(0,c.useRef)(o),x=(0,c.useRef)(i),S=(0,c.useRef)(l),C=(0,c.useRef)(g);b.current=o,x.current=i,S.current=l,C.current=g;let w=(0,c.useRef)(0),T=(0,c.useRef)(!1),E=Eb(i,o.trim(),l.trim()),D=g!==``&&E===g,O=(0,c.useMemo)(()=>({discoverLoading:f,discoveryError:v,scanSucceeded:D,location:o}),[f,v,o,D]),k=(0,c.useMemo)(()=>yb(O),[O]),A=D&&!m&&!f&&v==null,j=(0,c.useMemo)(()=>bb({...O,loadLoading:m,canLoad:A}),[A,m,O]),M=(0,c.useCallback)(async()=>{let r=x.current,i=Ob(r,b.current.trim(),S.current.trim(),C.current,T.current);if(i!=null){t(i);return}h(!0),t(null);try{let r=await gb(x.current,b.current.trim(),void 0,kb(x.current,S.current)),i=r.currentSource;if(i!==`preload`&&i!==`remote`){t(`Artifacts are not ready to load.`);return}let a=r.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1};if(a.missingCatalog||a.missingSources){let e=[];a.missingCatalog&&e.push(`catalog.json`),a.missingSources&&e.push(`sources.json`),n(`Optional artifacts not loaded: ${e.join(`, `)}. Related inventory panels may be limited.`,`positive`)}let o=await fb(i);if(o==null){t(`Could not read artifact bytes from the server.`);return}e(o,i,a),x.current===`gcs`&&(C.current=``,_(``)),d(``)}catch(e){let r=e instanceof Error?e.message:`Failed to load artifacts.`;t(r),n(r,`danger`)}finally{h(!1)}},[t,e,n]),N=(0,c.useCallback)(async e=>{let n=x.current,r=b.current.trim(),i=Eb(n,r,n===`gcs`?S.current.trim():``);if(r===``){t(`Enter a directory or bucket prefix.`);return}if(!e&&i===C.current)return;let a=++w.current;T.current=!0,p(!0),t(null),y(null),C.current=``,_(``);try{let e=await hb(n,r,kb(n,S.current));if(a!==w.current)return;if(e.discoveryError!=null){y(e.discoveryError),t(e.discoveryError);return}C.current=i,_(i),T.current=!1,await M()}catch(e){if(a!==w.current)return;let n=e instanceof Error?e.message:`Discovery failed.`;y(n),t(n)}finally{a===w.current&&(T.current=!1,p(!1))}},[M,t]);return(0,u.jsxs)(`section`,{className:`upload-hero`,children:[(0,u.jsx)(Tb,{}),(0,u.jsx)(Cb,{readinessRegionId:r,readinessLabel:k,discoveryError:v,onScan:()=>{N(!0)},sourceKind:i,onSourceKindChange:e=>{a(e),y(null),C.current=``,_(``),t(null)},location:o,onLocationChange:s,impersonatedServiceAccount:l,onImpersonatedServiceAccountChange:d,onImpersonatedServiceAccountBlur:()=>{x.current===`gcs`&&b.current.trim()!==``&&N(!1)},onLocationBlur:()=>{b.current.trim()!==``&&N(!1)},onLocationKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),N(!1))},discoverLoading:f,canLoad:A,loadLoading:m,loadWorkspaceHint:j,onLoadWorkspace:()=>{M()}})]})}function jb({className:e,style:t}){return(0,u.jsx)(`div`,{className:[`skeleton`,e].filter(Boolean).join(` `),style:t,"aria-hidden":`true`})}function Mb(){return(0,u.jsxs)(`div`,{className:`loading-card`,children:[(0,u.jsx)(jb,{className:`loading-card__skeleton-icon`}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(jb,{className:`loading-card__skeleton-title`}),(0,u.jsx)(jb,{className:`loading-card__skeleton-body`})]})]})}var Nb=`workspace-pill workspace-pill--active`,Pb=`workspace-pill`;function Fb(e){return e?Nb:Pb}function Ib({open:e,onClose:t,returnFocusRef:n,onManagedAnalysisLoaded:r,onError:i}){let a=(0,c.useRef)(null),o=(0,c.useRef)(!1);return(0,c.useEffect)(()=>{if(!e){o.current&&n.current?.focus(),o.current=!1;return}o.current=!0,a.current?.focus();let r=e=>{e.key===`Escape`&&(e.preventDefault(),t())};document.addEventListener(`keydown`,r);let i=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,r),document.body.style.overflow=i}},[e,t,n]),e?(0,u.jsxs)(`div`,{className:`settings-artifact-dialog`,"aria-hidden":!1,children:[(0,u.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__backdrop`,"aria-label":`Close change location dialog`,onClick:()=>{i(null),t()}}),(0,u.jsxs)(`div`,{ref:a,className:`settings-artifact-dialog__panel`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-artifact-dialog-title`,tabIndex:-1,children:[(0,u.jsxs)(`header`,{className:`settings-artifact-dialog__header`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Artifacts`}),(0,u.jsx)(`h2`,{id:`settings-artifact-dialog-title`,children:`Change artifact location`}),(0,u.jsx)(`p`,{className:`settings-artifact-dialog__lede`,children:`Use the same directory or cloud prefix flow as the main workspace load screen. Credentials stay on the server.`})]}),(0,u.jsx)(`button`,{type:`button`,className:`settings-artifact-dialog__close`,"aria-label":`Close`,onClick:()=>{i(null),t()},children:(0,u.jsx)(`span`,{"aria-hidden":`true`,children:`×`})})]}),(0,u.jsx)(`div`,{className:`settings-artifact-dialog__body`,children:(0,u.jsx)(Ab,{onManagedLoad:r,onError:i})})]})]}):null}function Lb({analysisSource:e,executionCount:t}){return(0,u.jsxs)(`section`,{className:`settings-hero`,"aria-label":`Workspace preferences`,children:[(0,u.jsx)(`p`,{className:`eyebrow`,children:`Workspace profile`}),(0,u.jsx)(`h3`,{children:`Configure how this console looks and behaves by default.`}),(0,u.jsx)(`p`,{children:`Changes save locally and apply to the current workspace immediately when the relevant view is open.`}),(0,u.jsxs)(`div`,{className:`settings-chip-row`,children:[(0,u.jsx)(`span`,{className:`app-badge`,children:j(e)}),(0,u.jsx)(`span`,{className:`settings-chip`,children:t==null?`No artifacts loaded`:`${t} executions loaded`})]})]})}function Rb({themePreference:e,onThemeChange:t}){return(0,u.jsx)(yi,{title:`Appearance`,subtitle:`Choose how the workspace chrome should render by default.`,children:(0,u.jsxs)(`div`,{className:`settings-field-group`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Theme`}),(0,u.jsx)(`div`,{className:`settings-segmented`,children:[`system`,`light`,`dark`].map(n=>(0,u.jsx)(`button`,{type:`button`,className:Fb(e===n),onClick:()=>t(n),children:n===`system`?`System`:n.charAt(0).toUpperCase()+n.slice(1)},n))})]})})}function zb({analysisSource:e,executionCount:t,artifactLocationSnapshot:n,onOpenChangeLocation:r,changeLocationTriggerRef:i,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:s}){let c=A(n?.sourceKind),l=n?.locationDisplay!=null&&n.locationDisplay.trim()!==``?n.locationDisplay:null;return(0,u.jsx)(yi,{title:`Session`,subtitle:`Current artifact source and data-loading controls.`,children:(0,u.jsxs)(`div`,{className:`settings-stack`,children:[(0,u.jsxs)(`div`,{className:`settings-readout`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Current source`}),(0,u.jsx)(`strong`,{children:j(e)}),(0,u.jsx)(`p`,{children:t==null?`Load artifacts to unlock analysis views.`:`${t} executions are available in this session.`})]}),(0,u.jsxs)(`div`,{className:`settings-readout`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Configured location`}),l==null?c==null?(0,u.jsx)(`p`,{className:`settings-readout-muted`,children:`Nothing configured yet. Use Change location… to open the load wizard and point this session at a directory or cloud prefix.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`strong`,{children:c}),(0,u.jsx)(`p`,{className:`settings-readout-muted`,children:`Path label was not returned for this session.`})]}):(0,u.jsxs)(u.Fragment,{children:[c==null?null:(0,u.jsx)(`strong`,{children:c}),(0,u.jsx)(`p`,{className:`settings-mono-path settings-session__path`,title:l,children:l})]})]}),(0,u.jsx)(`div`,{className:`settings-session__actions`,children:(0,u.jsx)(`button`,{ref:i,type:`button`,className:`primary-action settings-primary-action`,onClick:r,children:`Change location…`})}),a&&(0,u.jsx)(`button`,{type:`button`,className:`workspace-pill`,onClick:()=>void s(),disabled:o,children:o?`Switching…`:`Load ${a.label}`})]})})}function Bb({preferences:e,setPreferences:t}){return(0,u.jsx)(yi,{title:`Shell Defaults`,subtitle:`Control the default shape of the workspace chrome.`,children:(0,u.jsxs)(`div`,{className:`settings-field-group`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Sidebar`}),(0,u.jsxs)(`div`,{className:`settings-segmented`,children:[(0,u.jsx)(`button`,{type:`button`,className:Fb(!e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!1})),children:`Expanded`}),(0,u.jsx)(`button`,{type:`button`,className:Fb(e.sidebarCollapsedDefault),onClick:()=>t(e=>({...e,sidebarCollapsedDefault:!0})),children:`Collapsed`})]})]})})}function Vb({preferences:e,setPreferences:t}){return(0,u.jsx)(yi,{title:`Timeline Defaults`,subtitle:`Set the default execution timeline filters and dependency focus.`,children:(0,u.jsxs)(`div`,{className:`settings-stack`,children:[(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-toggle`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.showTests,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,showTests:e.target.checked}}))}),(0,u.jsx)(`span`,{children:`Show tests by default`})]}),(0,u.jsxs)(`label`,{className:`settings-toggle`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.timelineDefaults.failuresOnly,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,failuresOnly:e.target.checked}}))}),(0,u.jsx)(`span`,{children:`Start with failures-only emphasis`})]})]}),(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Dependency direction`}),(0,u.jsxs)(`select`,{value:e.timelineDefaults.dependencyDirection,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDirection:e.target.value}})),children:[(0,u.jsx)(`option`,{value:`upstream`,children:`Upstream`}),(0,u.jsx)(`option`,{value:`both`,children:`Both`}),(0,u.jsx)(`option`,{value:`downstream`,children:`Downstream`})]})]}),(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Dependency depth`}),(0,u.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.timelineDefaults.dependencyDepthHops,onChange:e=>t(t=>({...t,timelineDefaults:{...t.timelineDefaults,dependencyDepthHops:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]})]})})}function Hb({preferences:e,setPreferences:t}){return(0,u.jsx)(yi,{title:`Inventory Defaults`,subtitle:`Choose how asset exploration and lineage open by default.`,children:(0,u.jsxs)(`div`,{className:`settings-stack`,children:[(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Explorer mode`}),(0,u.jsxs)(`select`,{value:e.inventoryDefaults.explorerMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,explorerMode:e.target.value}})),children:[(0,u.jsx)(`option`,{value:`project`,children:`Project`}),(0,u.jsx)(`option`,{value:`database`,children:`Database`})]})]}),(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Lineage lens`}),(0,u.jsxs)(`select`,{value:e.inventoryDefaults.lineageLensMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageLensMode:e.target.value}})),children:[(0,u.jsx)(`option`,{value:`type`,children:`Type`}),(0,u.jsx)(`option`,{value:`status`,children:`Status`}),(0,u.jsx)(`option`,{value:`coverage`,children:`Coverage`})]})]})]}),(0,u.jsxs)(`div`,{className:`settings-inline-grid`,children:[(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Upstream depth`}),(0,u.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageUpstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageUpstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]}),(0,u.jsxs)(`label`,{className:`settings-field`,children:[(0,u.jsx)(`span`,{className:`settings-field-label`,children:`Downstream depth`}),(0,u.jsx)(`input`,{type:`number`,min:`1`,max:`10`,value:e.inventoryDefaults.lineageDownstreamDepth,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,lineageDownstreamDepth:Math.max(1,Math.min(10,Number(e.target.value)||1))}}))})]})]}),(0,u.jsxs)(`label`,{className:`settings-toggle`,children:[(0,u.jsx)(`input`,{type:`checkbox`,checked:e.inventoryDefaults.allDepsMode,onChange:e=>t(t=>({...t,inventoryDefaults:{...t.inventoryDefaults,allDepsMode:e.target.checked}}))}),(0,u.jsx)(`span`,{children:`Open lineage with all dependencies expanded`})]})]})})}function Ub({preferences:e,setPreferences:t,themePreference:n,setThemePreference:r,analysisSource:i,artifactLocationSnapshot:a,executionCount:o,onManagedAnalysisLoaded:s,onError:l,pendingRemoteRun:d,acceptingRemoteRun:f,onAcceptPendingRemoteRun:p}){let[m,h]=(0,c.useState)(!1),g=(0,c.useRef)(null),_=(0,c.useCallback)((e,t,n)=>{h(!1),s(e,t,n)},[s]);return(0,u.jsxs)(Ci,{title:`Settings`,description:`Workspace defaults, visual preferences, and session controls.`,className:`settings-view`,children:[(0,u.jsx)(Ib,{open:m,onClose:()=>{l(null),h(!1)},returnFocusRef:g,onManagedAnalysisLoaded:_,onError:l}),(0,u.jsxs)(`div`,{className:`settings-grid`,children:[(0,u.jsx)(Lb,{analysisSource:i,executionCount:o}),(0,u.jsx)(Rb,{themePreference:n,onThemeChange:e=>{r(e),t(t=>({...t,theme:e}))}}),(0,u.jsx)(zb,{analysisSource:i,executionCount:o,artifactLocationSnapshot:a,onOpenChangeLocation:()=>h(!0),changeLocationTriggerRef:g,pendingRemoteRun:d,acceptingRemoteRun:f,onAcceptPendingRemoteRun:p}),(0,u.jsx)(Bb,{preferences:e,setPreferences:t}),(0,u.jsx)(Vb,{preferences:e,setPreferences:t}),(0,u.jsx)(Hb,{preferences:e,setPreferences:t})]})]})}function Wb({kind:e}){let t={fill:`none`,stroke:`currentColor`,strokeWidth:1.8,strokeLinecap:`round`,strokeLinejoin:`round`};return e===`invocation`?(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{...t,d:`M20 12.5V7a2 2 0 0 0-2-2h-6.2a2 2 0 0 0-1.4.58l-4.82 4.82A2 2 0 0 0 5 11.82V17a2 2 0 0 0 2 2h5.5`}),(0,u.jsx)(`path`,{...t,d:`M9 5v4a2 2 0 0 1-2 2H5`}),(0,u.jsx)(`circle`,{...t,cx:`17.5`,cy:`17.5`,r:`3.5`})]}):e===`time`?(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`circle`,{...t,cx:`12`,cy:`12`,r:`8`}),(0,u.jsx)(`path`,{...t,d:`M12 7.8v4.6l3 1.8`})]}):e===`project`?(0,u.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,u.jsx)(`path`,{...t,d:`M3.5 8.5a2 2 0 0 1 2-2h3l1.4 1.7h8.6a2 2 0 0 1 2 2v7.5a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z`})}):(0,u.jsxs)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`path`,{...t,d:`M11.25 4.75 5.5 7.7v4.55c0 3.65 2.7 6.95 6.5 7.95 3.8-1 6.5-4.3 6.5-7.95V7.7z`}),(0,u.jsx)(`path`,{...t,d:`M9.4 12.15 11.2 14l3.35-3.45`})]})}function Gb(e,t){let n=e?.projectName??null,r=e?.invocationId??null,i=e?.warehouseType??null,a=e?jr(e):null,o=a==null?null:Ar(a);return{label:n??`Workspace session`,subtitle:n==null&&r==null&&o==null?`Load artifacts to populate session details.`:null,summaryItems:[r?{key:`invocation`,label:`Invocation ID`,value:r,icon:`invocation`}:null,o?{key:`timestamp`,label:`Timestamp`,value:o,icon:`time`}:null,{key:`source`,label:`Source mode`,value:j(t),icon:`source`},i?{key:`warehouse`,label:`Warehouse type`,value:i.charAt(0).toUpperCase()+i.slice(1),icon:`project`}:null].filter(e=>e!=null)}}function Kb({summaryItems:e}){return(0,u.jsx)(`div`,{className:`app-header__summary-grid`,"aria-label":`Session metadata`,children:e.map(e=>(0,u.jsxs)(`div`,{className:`app-header__summary-item`,children:[(0,u.jsx)(`span`,{className:`app-header__summary-icon`,children:(0,u.jsx)(Wb,{kind:e.icon})}),(0,u.jsxs)(`span`,{className:`app-header__summary-copy`,children:[(0,u.jsx)(`span`,{className:`app-header__summary-label`,children:e.label}),(0,u.jsx)(`strong`,{className:`app-header__summary-value`,children:e.value})]})]},e.key))})}function qb({header:e}){return(0,u.jsxs)(`div`,{className:`app-header__identity`,children:[(0,u.jsx)(`p`,{className:`eyebrow`,title:e.label,children:e.label}),e.subtitle?(0,u.jsx)(`p`,{className:`app-header__subheadline`,children:e.subtitle}):null,(0,u.jsx)(Kb,{summaryItems:e.summaryItems})]})}function Jb({analysis:e,searchState:t,setSearchState:n,omniboxResults:r,handleNavigateTo:i}){let a=t.query.trim().length>0;return(0,u.jsxs)(`div`,{className:`app-header__omnibox`,children:[(0,u.jsx)(`label`,{className:`app-header__search-control`,children:(0,u.jsxs)(`div`,{className:`app-header__search-shell`,children:[(0,u.jsxs)(`svg`,{className:`workspace-search__icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,u.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`}),(0,u.jsx)(`path`,{d:`M16 16l4 4`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`})]}),(0,u.jsx)(`input`,{value:t.query,onFocus:()=>n(e=>({...e,isOpen:!0})),onChange:e=>n(t=>({...t,query:e.target.value,isOpen:!0})),placeholder:`Search runs, pipelines, assets...`,"aria-label":`Global search`})]})}),t.isOpen&&e&&(0,u.jsx)(`div`,{className:`omnibox-results`,children:r.loading&&a?(0,u.jsx)(`div`,{className:`omnibox-results__empty`,children:`Searching…`}):r.results.length>0?r.results.map(e=>(0,u.jsxs)(`button`,{type:`button`,className:`omnibox-results__item`,onClick:()=>{n(t=>({...t,isOpen:!1,recentResourceIds:[e.uniqueId,...t.recentResourceIds.filter(t=>t!==e.uniqueId)].slice(0,8)})),i(`inventory`,{resourceId:e.uniqueId,assetTab:`summary`})},children:[(0,u.jsx)(`strong`,{children:e.name}),(0,u.jsx)(`span`,{children:e.resourceType})]},e.uniqueId)):(0,u.jsx)(`div`,{className:`omnibox-results__empty`,children:a?`No matching resources`:`Recent items will appear here`})})]})}function Yb({activeView:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:i,pendingRemoteRun:a,acceptingRemoteRun:o,preferences:s,setPreferences:c,themePreference:l,setThemePreference:d,onManagedAnalysisLoaded:f,onError:p,onAcceptPendingRemoteRun:m,workspaceSignals:h,overviewFilters:g,setOverviewFilters:_,timelineFilters:v,setTimelineFilters:y,assetViewState:b,setAssetViewState:x,runsViewState:S,setRunsViewState:C,lineageViewState:w,setLineageViewState:T,setInvestigationSelection:E,handleNavigateTo:D}){return e===`settings`?(0,u.jsx)(Ub,{preferences:s,setPreferences:c,themePreference:l,setThemePreference:d,analysisSource:n,artifactLocationSnapshot:r,executionCount:t?.summary.total_nodes??null,onManagedAnalysisLoaded:f,onError:p,pendingRemoteRun:a,acceptingRemoteRun:o,onAcceptPendingRemoteRun:m}):t?(0,u.jsx)(Ky,{analysis:t,activeView:e,analysisSource:n,overviewFilters:g,onOverviewFiltersChange:_,timelineFilters:v,onTimelineFiltersChange:y,assetViewState:b,onAssetViewStateChange:x,runsViewState:S,onRunsViewStateChange:C,lineageViewState:w,onLineageViewStateChange:T,onInvestigationSelectionChange:E,onNavigateTo:D,workspaceSignals:h}):i?(0,u.jsx)(Mb,{}):(0,u.jsx)(Ab,{onManagedLoad:f,onError:p})}function Xb({workspace:e,analysis:t,analysisSource:n,artifactLocationSnapshot:r,error:i,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:f,themePreference:p,setThemePreference:m,preferences:h,setPreferences:g,workspaceSignals:_}){let{activeView:v,sidebarCollapsed:y,setSidebarCollapsed:b,sidebarOpen:x,setSidebarOpen:S,overviewFilters:C,setOverviewFilters:w,timelineFilters:T,setTimelineFilters:E,assetViewState:D,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,searchState:P,setSearchState:ee,setInvestigationSelection:F,setNavigationTarget:te,handleNavigateTo:ne,frameClass:re}=e,ie=O(t,P),ae=Gb(t,n);return(0,u.jsxs)(`div`,{className:re,children:[x&&(0,u.jsx)(`div`,{className:`sidebar-backdrop`,role:`presentation`,onClick:()=>S(!1)}),(0,u.jsx)(xe,{activeView:v,setNavigationTarget:te,sidebarCollapsed:y,setSidebarCollapsed:b,onNavigate:()=>S(!1),analysis:t,analysisSource:n}),(0,u.jsxs)(`main`,{className:`app-main`,children:[(0,u.jsxs)(`header`,{className:`app-header app-header--workspace`,children:[(0,u.jsx)(`button`,{type:`button`,className:`hamburger-btn`,"aria-label":`Open navigation`,"aria-expanded":x,"aria-controls":`app-sidebar`,onClick:()=>S(!0),children:(0,u.jsx)(`span`,{"aria-hidden":`true`,children:`☰`})}),(0,u.jsx)(qb,{header:ae}),(0,u.jsx)(Jb,{analysis:t,searchState:P,setSearchState:ee,omniboxResults:ie,handleNavigateTo:ne})]}),i&&(0,u.jsx)(d,{message:i}),(0,u.jsx)(Se,{pendingRemoteRun:o,acceptingRemoteRun:s,onAcceptPendingRemoteRun:f}),(0,u.jsx)(Yb,{activeView:v,analysis:t,analysisSource:n,artifactLocationSnapshot:r,preloadLoading:a,pendingRemoteRun:o,acceptingRemoteRun:s,preferences:h,setPreferences:g,themePreference:p,setThemePreference:m,onManagedAnalysisLoaded:c,onError:l,onAcceptPendingRemoteRun:f,workspaceSignals:_,overviewFilters:C,setOverviewFilters:w,timelineFilters:T,setTimelineFilters:E,assetViewState:D,setAssetViewState:k,runsViewState:A,setRunsViewState:j,lineageViewState:M,setLineageViewState:N,setInvestigationSelection:F,handleNavigateTo:ne})]})]})}function Zb(e,t,n){return t===`preload`?{value:`Live target`,detail:`Synced from DBT_TOOLS_TARGET_DIR with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:t===`remote`?{value:`Remote source`,detail:`Managed from remote object storage with ${e.graphSummary.totalEdges} dependency edges ready for investigation.`}:{value:`Artifact upload`,detail:`${e.summary.total_nodes} executions loaded from local artifacts${n>0?`, including ${n} tests`:``}.`}}function Qb(e,t){let n=e.executions.filter(e=>e.statusTone===`danger`).length,r=e.executions.filter(e=>e.statusTone===`warning`).length,i=e.executions.filter(e=>[`test`,`unit_test`].includes(e.resourceType)).length,a=e.resources.filter(e=>!!e.description?.trim()).length,o=e.resources.length>0?Math.round(a/e.resources.length*100):0,s=Zb(e,t,i);return[{label:`Run posture`,value:n>0?`${n} failing`:r>0?`${r} warning`:`Healthy`,detail:n>0?`Prioritize failing nodes before reviewing downstream impact.`:r>0?`Warnings detected; review tests and exposures next.`:`No failing nodes surfaced in this run.`,tone:n>0?`danger`:r>0?`warning`:`positive`},{label:`Metadata coverage`,value:`${o}%`,detail:`${a} of ${e.resources.length} resources include descriptions for catalog-style discovery.`,tone:o>=70?`positive`:o>=35?`warning`:`neutral`},{label:`Workspace mode`,value:s.value,detail:s.detail,tone:`neutral`}]}function $b({setPreloadLoading:e,setAnalysis:t,setAnalysisSource:n,setPendingRemoteRun:r,setRemotePollIntervalMs:i,setError:a,pendingMetricsRef:o,setArtifactCapability:s,onArtifactSourceStatus:l}){let u=(0,c.useRef)(!1);(0,c.useEffect)(()=>{u.current||(u.current=!0,p(`Preload: fetching current managed artifacts`),pb().then(({result:c,status:u})=>{e(!1),r(u.pendingRun),i(u.pollIntervalMs),l?.(u),c?(p(`Preload: success, analysis loaded`),o.current=c.metrics,t(c.analysis),n(u.currentSource),a(null),s(u.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})):(n(u.currentSource),s({missingCatalog:!1,missingSources:!1}))}).catch(t=>{e(!1),p(`Preload: error`,t),a(t instanceof Error?t.message:`Failed to load artifacts from server`)}))},[o,e,t,n,r,i,a,s,l])}function ex(e,t,n,r){(0,c.useEffect)(()=>{},[e,r,t,n])}function tx(e,t,n,r,i){(0,c.useEffect)(()=>{if(e!==`remote`){t(null),n(null);return}let a=!1,o=async()=>{try{let e=await db();a||(t(e.pendingRun),n(e.pollIntervalMs),i?.(e))}catch(e){p(`Artifact source poll failed`,e)}};o();let s=window.setInterval(()=>{o()},r??3e4);return()=>{a=!0,window.clearInterval(s)}},[e,r,t,n,i])}function nx(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(null),[i,a]=(0,c.useState)(null),[o,s]=(0,c.useState)(!0),[l,u]=(0,c.useState)(null),[d,f]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)({missingCatalog:!1,missingSources:!1}),[b,x]=(0,c.useState)(null),S=(0,c.useRef)(null),C=(0,c.useCallback)(e=>{x(t=>{let n=k(e);return n==null&&t==null||n!=null&&t!=null&&n.sourceKind===t.sourceKind&&n.locationDisplay===t.locationDisplay?t:n})},[]);return $b({setPreloadLoading:s,setAnalysis:t,setAnalysisSource:a,setPendingRemoteRun:u,setRemotePollIntervalMs:_,setError:r,pendingMetricsRef:S,setArtifactCapability:y,onArtifactSourceStatus:C}),ex(i,t,r,S),tx(i,u,_,g,C),(0,c.useEffect)(()=>{if(e==null||S.current==null)return;let t=S.current;S.current=null,requestAnimationFrame(()=>{let e=`analysis-load:${t.requestId}:interactive`,n=`analysis-load:${t.requestId}:first-interactive-frame`;m(e),h(n,t.dispatchMarkName,e),p(`Analysis load metrics`,{requestId:t.requestId,source:t.source,timings:t.timings})})},[e]),{analysis:e,analysisSource:i,artifactLocationSnapshot:b,artifactCapability:v,error:n,preloadLoading:o,pendingRemoteRun:l,acceptingRemoteRun:d,onLoadDifferent:()=>{t(null),a(null),u(null),_(null),r(null),x(null),y({missingCatalog:!1,missingSources:!1})},onManagedAnalysisLoaded:(e,n,r)=>{S.current=e.metrics,a(n),u(null),t(e.analysis),y(r),db().then(C).catch(()=>{})},onError:r,onAcceptPendingRemoteRun:async()=>{if(l!=null){f(!0);try{let e=await mb(l.runId),n=await fb(`remote`);n!=null&&(S.current=n.metrics,t(n.analysis),a(e.currentSource),_(e.pollIntervalMs),r(null),y(e.missingOptionalArtifacts??{missingCatalog:!1,missingSources:!1})),u(e.pendingRun),C(e)}catch(e){r(e instanceof Error?e.message:`Failed to switch remote artifact run`)}finally{f(!1)}}}}}var rx=`dbt-tools.workspacePreferences`,ix={theme:`system`,sidebarCollapsedDefault:!0,timelineDefaults:{showTests:!1,failuresOnly:!1,dependencyDirection:`both`,dependencyDepthHops:2},inventoryDefaults:{explorerMode:`project`,lineageLensMode:`type`,lineageUpstreamDepth:2,lineageDownstreamDepth:2,allDepsMode:!1}};function ax(e,t){return typeof e!=`number`||!Number.isFinite(e)?t:Math.max(1,Math.min(10,Math.round(e)))}function ox(e){return e===`upstream`||e===`both`||e===`downstream`}function sx(e){return e===`project`||e===`database`}function cx(e){return e===`status`||e===`type`||e===`coverage`}function lx(e){return e===`light`||e===`dark`||e===`system`}function ux(e){if(!e)return ix;try{let t=JSON.parse(e);return{theme:lx(t.theme)?t.theme:ix.theme,sidebarCollapsedDefault:typeof t.sidebarCollapsedDefault==`boolean`?t.sidebarCollapsedDefault:ix.sidebarCollapsedDefault,timelineDefaults:{showTests:typeof t.timelineDefaults?.showTests==`boolean`?t.timelineDefaults.showTests:ix.timelineDefaults.showTests,failuresOnly:typeof t.timelineDefaults?.failuresOnly==`boolean`?t.timelineDefaults.failuresOnly:ix.timelineDefaults.failuresOnly,dependencyDirection:ox(t.timelineDefaults?.dependencyDirection)?t.timelineDefaults.dependencyDirection:ix.timelineDefaults.dependencyDirection,dependencyDepthHops:ax(t.timelineDefaults?.dependencyDepthHops,ix.timelineDefaults.dependencyDepthHops)},inventoryDefaults:{explorerMode:sx(t.inventoryDefaults?.explorerMode)?t.inventoryDefaults.explorerMode:ix.inventoryDefaults.explorerMode,lineageLensMode:cx(t.inventoryDefaults?.lineageLensMode)?t.inventoryDefaults.lineageLensMode:ix.inventoryDefaults.lineageLensMode,lineageUpstreamDepth:ax(t.inventoryDefaults?.lineageUpstreamDepth,ix.inventoryDefaults.lineageUpstreamDepth),lineageDownstreamDepth:ax(t.inventoryDefaults?.lineageDownstreamDepth,ix.inventoryDefaults.lineageDownstreamDepth),allDepsMode:typeof t.inventoryDefaults?.allDepsMode==`boolean`?t.inventoryDefaults.allDepsMode:ix.inventoryDefaults.allDepsMode}}}catch{return ix}}function dx(){let[e,t]=(0,c.useState)(()=>{try{return ux(window.localStorage.getItem(rx))}catch{return ix}});return(0,c.useEffect)(()=>{try{window.localStorage.setItem(rx,JSON.stringify(e))}catch{}},[e]),{preferences:e,setPreferences:t}}function fx(e,t){let n=t!==e.selectedExecutionId;return{...e,selectedExecutionId:t,...n?{neighborhoodRowsShowAll:!1}:{}}}var px=(e,t)=>({activeTab:se(e),expandedNodeIds:new Set,explorerMode:t?.inventoryDefaults.explorerMode??`project`,status:`all`,resourceTypes:new Set,materializationKinds:new Set,resourceQuery:``,selectedResourceId:ie(e),upstreamDepth:de(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:fe(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:pe(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:ue(e)??t?.inventoryDefaults.lineageLensMode??`type`,activeLegendKeys:new Set}),mx=e=>{let t=re(e);return{kind:ce(e)??`all`,status:`all`,query:``,resourceTypes:new Set,materializationKinds:new Set,threadIds:new Set,durationBand:`all`,sortBy:`attention`,sortDirection:`desc`,groupBy:`none`,selectedExecutionId:t===`runs`?ae(e):null,showAdapterMetrics:t===`runs`?le(e):!1}},hx=(e,t)=>{let n=re(e),r=n===`runs`||n===`timeline`?ae(e):null;return{query:``,activeStatuses:new Set,activeTypes:new Set,selectedExecutionId:r,showTests:t?.timelineDefaults.showTests??!1,failuresOnly:t?.timelineDefaults.failuresOnly??!1,dependencyDirection:t?.timelineDefaults.dependencyDirection??`both`,dependencyDepthHops:t?.timelineDefaults.dependencyDepthHops??2,timeWindow:null,neighborhoodRowsShowAll:!1}};function gx(e){let t=new URLSearchParams(e);if(re(e)!==`inventory`)return null;let n=[],r=t.get(`q`)?.trim()??``;r!==``&&n.push(r);for(let e of[`type`,`package`,`tag`,`path`]){let r=t.get(e)?.trim()??``;r!==``&&n.push(`${e}:${r}`)}return n.join(` `).trim()}function _x(e,t){let n=gx(e);return n===null?t:{...t,resourceQuery:n}}var vx=e=>{let t=re(e)??`health`,n=ie(e),r=ae(e);return{selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:null}};function yx(e,t){return{activeView:re(e)??`health`,assetViewState:_x(e,px(e,t)),runsViewState:mx(e),timelineFilters:hx(e,t),lineageViewState:{...he(e),upstreamDepth:de(e)??t?.inventoryDefaults.lineageUpstreamDepth??2,downstreamDepth:fe(e)??t?.inventoryDefaults.lineageDownstreamDepth??2,allDepsMode:pe(e)??t?.inventoryDefaults.allDepsMode??!1,lensMode:ue(e)??t?.inventoryDefaults.lineageLensMode??`type`},investigationSelection:vx(e)}}function bx(e){let t=re(e),n=ie(e),r=ae(e);return{activeView:t??void 0,assetViewState:t=>_x(e,{...t,selectedResourceId:n,activeTab:se(e)}),runsViewState:n=>({...n,kind:ce(e)??n.kind,selectedExecutionId:t===`runs`?r:null,showAdapterMetrics:t===`runs`?le(e):n.showAdapterMetrics}),timelineFilters:e=>fx(e,t===`timeline`?r:null),lineageViewState:he(e),investigationSelection:e=>({...e,selectedResourceId:n,selectedExecutionId:t===`runs`||t===`timeline`?r:null,sourceLens:e.sourceLens})}}var xx=[`resource`,`assetTab`,`selected`,`kind`,`adapter`,`up`,`down`,`allDeps`,`lens`,`q`];function Sx(e,t){for(let n of xx)t?.has(n)||e.searchParams.delete(n)}function Cx(e,t,n){t.selectedResourceId?e.searchParams.set(`resource`,t.selectedResourceId):e.searchParams.delete(`resource`),e.searchParams.set(`assetTab`,t.activeTab);let r=t.resourceQuery.trim();r===``?e.searchParams.delete(`q`):e.searchParams.set(`q`,r),e.searchParams.delete(`kind`),t.activeTab===`lineage`?(n.selectedResourceId?e.searchParams.set(`selected`,n.selectedResourceId):e.searchParams.delete(`selected`),e.searchParams.set(`up`,String(n.upstreamDepth)),e.searchParams.set(`down`,String(n.downstreamDepth)),e.searchParams.set(`allDeps`,n.allDepsMode?`1`:`0`),e.searchParams.set(`lens`,n.lensMode)):Sx(e,new Set([`resource`,`assetTab`,`q`]))}function wx(e,t){e.searchParams.set(`kind`,t.kind),t.selectedExecutionId?e.searchParams.set(`selected`,t.selectedExecutionId):e.searchParams.delete(`selected`),t.showAdapterMetrics?e.searchParams.delete(`adapter`):e.searchParams.set(`adapter`,`0`),Sx(e,new Set([`kind`,`selected`,`adapter`]))}function Tx(e,t){t?e.searchParams.set(`selected`,t):e.searchParams.delete(`selected`),Sx(e,new Set([`selected`]))}function Ex(e){let{pathname:t,hash:n,activeView:r,assetViewState:i,runsViewState:a,timelineSelectedExecutionId:o,lineageViewState:s}=e,c=new URL(`http://local.invalid${t}${n}`);return c.searchParams.set(`view`,r),r===`inventory`?Cx(c,i,s):r===`runs`?wx(c,a):r===`timeline`?Tx(c,o):Sx(c),`${t}${c.search}${n}`}function Dx(e){let t=(0,c.useRef)(!1),n=yx(window.location.search,e),[r,i]=(0,c.useState)(()=>n.activeView),[a,o]=(0,c.useState)(()=>_e(e.sidebarCollapsedDefault)),[s,l]=(0,c.useState)(!1),[u,d]=(0,c.useState)({status:`all`,resourceTypes:new Set,query:``}),[f,p]=(0,c.useState)(()=>n.timelineFilters),[m,h]=(0,c.useState)(()=>n.assetViewState),[g,_]=(0,c.useState)(()=>n.runsViewState),[v,y]=(0,c.useState)(()=>n.lineageViewState),[b,x]=(0,c.useState)({query:``,recentResourceIds:[],isOpen:!1}),[S,C]=(0,c.useState)(()=>n.investigationSelection),w=(0,c.useCallback)(e=>{o(t=>{let n=e(t);try{window.localStorage.setItem(ge,String(n))}catch{}return n})},[]),T=(0,c.useCallback)(e=>{i(e.view===`search`?`inventory`:e.view)},[]),E=(0,c.useCallback)((e,t)=>{i(e),t?.resourceId?(h(e=>({...e,selectedResourceId:t.resourceId??e.selectedResourceId,activeTab:t.assetTab??e.activeTab})),y(e=>({...e,rootResourceId:t.rootResourceId??t.resourceId??e.rootResourceId,selectedResourceId:t.resourceId??e.selectedResourceId}))):t?.assetTab&&e===`inventory`&&h(e=>({...e,activeTab:t.assetTab??e.activeTab})),t?.executionId&&(_(e=>({...e,selectedExecutionId:t.executionId??e.selectedExecutionId})),p(e=>fx(e,t.executionId??e.selectedExecutionId))),e===`runs`&&t?.resourceId&&_(e=>({...e,query:t.resourceId??e.query})),C(n=>({selectedResourceId:t?.resourceId??n.selectedResourceId,selectedExecutionId:t?.executionId??n.selectedExecutionId,sourceLens:e}))},[]);return(0,c.useEffect)(()=>{let e=Ex({pathname:window.location.pathname,hash:window.location.hash,activeView:r,assetViewState:m,runsViewState:g,timelineSelectedExecutionId:f.selectedExecutionId,lineageViewState:v});e!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.pushState(null,``,e)},[r,m,g,f.selectedExecutionId,v]),(0,c.useEffect)(()=>{let e=()=>{let e=bx(window.location.search);e.activeView!==void 0&&i(e.activeView),h(t=>e.assetViewState(t)),_(t=>e.runsViewState(t)),p(t=>e.timelineFilters(t)),y(e.lineageViewState),C(t=>e.investigationSelection(t))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,c.useEffect)(()=>{if(!t.current){t.current=!0;return}p(t=>({...t,showTests:e.timelineDefaults.showTests,failuresOnly:e.timelineDefaults.failuresOnly,dependencyDirection:e.timelineDefaults.dependencyDirection,dependencyDepthHops:e.timelineDefaults.dependencyDepthHops})),h(t=>({...t,explorerMode:e.inventoryDefaults.explorerMode})),y(t=>({...t,upstreamDepth:e.inventoryDefaults.lineageUpstreamDepth,downstreamDepth:e.inventoryDefaults.lineageDownstreamDepth,allDepsMode:e.inventoryDefaults.allDepsMode,lensMode:e.inventoryDefaults.lineageLensMode})),o(e.sidebarCollapsedDefault);try{window.localStorage.setItem(ge,String(e.sidebarCollapsedDefault))}catch{}},[e]),(0,c.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),x(e=>({...e,isOpen:!0}))),e.key===`Escape`&&(l(!1),x(e=>({...e,isOpen:!1})))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),{activeView:r,sidebarCollapsed:a,setSidebarCollapsed:w,sidebarOpen:s,setSidebarOpen:l,overviewFilters:u,setOverviewFilters:d,timelineFilters:f,setTimelineFilters:p,assetViewState:m,setAssetViewState:h,runsViewState:g,setRunsViewState:_,lineageViewState:v,setLineageViewState:y,searchState:b,setSearchState:x,investigationSelection:S,setInvestigationSelection:C,setNavigationTarget:T,handleNavigateTo:E,frameClass:[`app-frame`,a?`app-frame--sidebar-collapsed`:``,s?`app-frame--nav-open`:``].filter(Boolean).join(` `)}}function Ox(){let{toast:e}=Zy(),{preferences:t,setPreferences:n}=dx(),r=Dx(t),{analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:d,acceptingRemoteRun:f,onManagedAnalysisLoaded:p,artifactCapability:m,onError:h,onAcceptPendingRemoteRun:g}=nx(),{themePreference:_,setThemePreference:v}=fi();(0,c.useEffect)(()=>{t.theme!==_&&v(t.theme)},[t.theme,v,_]);let y=(0,c.useRef)(null);(0,c.useEffect)(()=>{i&&!y.current&&a===`preload`&&e(`Workspace loaded — ${i.summary.total_nodes} executions`,`positive`),i&&!y.current&&a===`remote`&&e(`Remote workspace loaded — ${i.summary.total_nodes} executions`,`positive`),y.current=i},[i,a,e]);let b=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(d==null){b.current=null;return}b.current!==d.runId&&(b.current=d.runId,e(`A newer remote run is available: ${d.label}`,`warning`))},[d,e]);let x=i?Qb(i,a):[];return(0,u.jsx)(Dg.Provider,{value:m,children:(0,u.jsx)(Xb,{workspace:r,analysis:i,analysisSource:a,artifactLocationSnapshot:o,error:s,preloadLoading:l,pendingRemoteRun:d,acceptingRemoteRun:f,onManagedAnalysisLoaded:p,onError:h,onAcceptPendingRemoteRun:g,themePreference:_,setPreferences:n,preferences:t,setThemePreference:v,workspaceSignals:x})})}function kx(){return(0,u.jsx)(Xy,{children:(0,u.jsx)(Ox,{})})}(0,l.createRoot)(document.getElementById(`root`)).render((0,u.jsx)(c.StrictMode,{children:(0,u.jsx)(kx,{})}));
|