@duckcodeailabs/dql-cli 1.13.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/args.d.ts +2 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +3 -0
- package/dist/args.js.map +1 -1
- package/dist/assets/dql-notebook/assets/{AgentAnswerCard-Cp0eh6zU.js → AgentAnswerCard-c8QUo6NH.js} +4 -4
- package/dist/assets/dql-notebook/assets/{AgentLogPage-CBGEoGmU.js → AgentLogPage-D6fgEAEy.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-CwAD3tXE.js → AiBuildDialog-8miXFPse.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildResult-CyqTuQe5.js → AiBuildResult-DPJ_SI0R.js} +3 -3
- package/dist/assets/dql-notebook/assets/{AiSidePanel-DjB8PWHG.js → AiSidePanel-NVA6lZnn.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AnalyticsHome-B7BkvA-R.js → AnalyticsHome-DgwnRW71.js} +2 -2
- package/dist/assets/dql-notebook/assets/AppsView-B6LYUpgm.js +4578 -0
- package/dist/assets/dql-notebook/assets/BlockStudio--jNw9XUI.js +60 -0
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-C4SZVNW-.js → BusinessArtifactView-DtRMiaF4.js} +1 -1
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DhBsLCYr.js +22 -0
- package/dist/assets/dql-notebook/assets/{GitPage-BfVD4tVq.js → GitPage-CazC-eTR.js} +1 -1
- package/dist/assets/dql-notebook/assets/GlobalAiRail-1Tgweuu2.js +1 -0
- package/dist/assets/dql-notebook/assets/GovernedContextPage-C7qGrH3d.js +16 -0
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-BDPNVot1.js → HelpDocsPage-DMHPsVqP.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HomePage-DiOnRhEG.js → HomePage-DcSI4dnU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDAG-BiUFX2KL.js → LineageDAG-BJ6xz06u.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDetailView-CfbSvlPJ.js → LineageDetailView-8WrQm-MF.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-CgTScaGB.js → LineageDrawer-hnqCW_t-.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-D7ZA7k68.js → LineagePathBreadcrumb-B4LZTUsl.js} +1 -1
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-GkD4y17x.js → MiniLineageGraph-CotnRuxa.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewBlockModal-B9TfRjt7.js → NewBlockModal-DHn-CEEW.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewNotebookModal-BbO9NKUl.js → NewNotebookModal-BPGp-8oq.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NotebookEditor-CuMpvXR9.js → NotebookEditor-B0OTHM6W.js} +26 -31
- package/dist/assets/dql-notebook/assets/{ReadinessPage-BROJ9YBM.js → ReadinessPage-CoOIpxWq.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-BCcZlpuQ.js → SetupOnboarding-DxK_mFzf.js} +1 -1
- package/dist/assets/dql-notebook/assets/{TrustBadge-vQQh8d0D.js → TrustBadge-ZuD5N5Ww.js} +1 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-duFXXNV_.js +88 -0
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-DuqCcDDl.js → answer-to-notebook-WAVAYjBv.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-CMe1kkOL.js → arrow-left-L8odLbyN.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-DvB_DONr.js → arrow-right-WIF1V9a9.js} +1 -1
- package/dist/assets/dql-notebook/assets/{book-open-text-CJ3NAvrs.js → book-open-text-BpqWMa4m.js} +1 -1
- package/dist/assets/dql-notebook/assets/{bot-CV8DYRrt.js → bot-CLR1V6dO.js} +1 -1
- package/dist/assets/dql-notebook/assets/{circle-x-BCgtha1W.js → circle-x-CQBOM0b0.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-GKp7qoUL.js → dagre.esm-DlZi7NR3.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-C-PXokWV.js → external-link-DYqdQIGp.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-B4EHbGXW.js → grip-vertical-HmUijbwN.js} +1 -1
- package/dist/assets/dql-notebook/assets/{index-1mIC_XX4.js → index-Cpx47jCH.js} +43 -43
- package/dist/assets/dql-notebook/assets/{list-tree-BRFpEmvV.js → list-tree-DGKqCxmz.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-CDwSCGlO.js → minimize-2-C8dvqCxX.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-CunA1xO7.js → panel-right-open-yuVkIo5n.js} +1 -1
- package/dist/assets/dql-notebook/assets/{rotate-ccw-DOrfTZk8.js → rotate-ccw-Di0kRnrM.js} +1 -1
- package/dist/assets/dql-notebook/assets/{semantic-fields-AfQvjt5R.js → semantic-fields-BMQV0li8.js} +1 -1
- package/dist/assets/dql-notebook/assets/sliders-horizontal-alebptlJ.js +6 -0
- package/dist/assets/dql-notebook/assets/{star-DDhv4e8M.js → star-CgCQbnXc.js} +1 -1
- package/dist/assets/dql-notebook/assets/{triangle-alert-2ZXx8wAu.js → triangle-alert-SyuSZ4ht.js} +1 -1
- package/dist/assets/dql-notebook/assets/upload-BPhfea_E.js +11 -0
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-Bnl9gWhj.js +28 -0
- package/dist/assets/dql-notebook/assets/{user-round-BA074kiQ.js → user-round-J4PQHxo9.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wand-sparkles-CEYHLt9b.js → wand-sparkles-c4WDXTCk.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-CZtyrcR-.js → workflow-NtRLaq7n.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wrench-Ong23-wu.js → wrench-CS1f1Zv4.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-CSo1M3tu.js → x-CbKEfe5m.js} +1 -1
- package/dist/assets/dql-notebook/index.html +1 -1
- package/dist/commands/model.d.ts.map +1 -1
- package/dist/commands/model.js +62 -1
- package/dist/commands/model.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/local-runtime.d.ts +10 -0
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +1061 -17
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +10 -10
- package/package.json +10 -10
- package/dist/assets/dql-notebook/assets/AppsView-CUrqtEGC.js +0 -4583
- package/dist/assets/dql-notebook/assets/BlockStudio-Bl0aGQJR.js +0 -60
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-B0uxitnx.js +0 -22
- package/dist/assets/dql-notebook/assets/GlobalAiRail-DUwdy3fB.js +0 -1
- package/dist/assets/dql-notebook/assets/GovernedContextPage-D9f26ZFb.js +0 -7
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-Dj4AXAhT.js +0 -83
- package/dist/assets/dql-notebook/assets/chevron-up-HxU1l85K.js +0 -6
- package/dist/assets/dql-notebook/assets/link-2-BLx-goet.js +0 -6
- package/dist/assets/dql-notebook/assets/maximize-2-CCd5uRIZ.js +0 -6
- package/dist/assets/dql-notebook/assets/pencil-D_I14Wyk.js +0 -6
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-3rzkZrqc.js +0 -18
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{c as Ue,u as ve,t as ke,r as d,a as M,j as e,a4 as oe,a0 as pe,L as F,S as te,P as ne,B as lt,d as Qe,T as re,l as Be,f as Ve,$ as Ee,a5 as at,Q as xe,N as Oe,aU as Je}from"./index-Cpx47jCH.js";import{T as Te}from"./triangle-alert-SyuSZ4ht.js";import{U as He,G as le}from"./user-round-J4PQHxo9.js";import{C as Ye,U as dt}from"./UnifiedAgentRunPanel-duFXXNV_.js";import{P as Xe,u as ct}from"./usePersistedAgentThreadId-Bnl9gWhj.js";import{X as ue}from"./x-CbKEfe5m.js";/**
|
|
2
|
+
* @license lucide-react v0.563.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const pt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],ut=Ue("file-diff",pt);/**
|
|
7
|
+
* @license lucide-react v0.563.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const xt=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],gt=Ue("tags",xt),de="dql-context-bootstrap-session",ce="dql-context-bootstrap-selection";function ht(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function Ne(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function ft(){return{id:"",name:"",owner:"",boundedContext:"",sourceSystems:[],description:""}}function yt({embedded:t=!1}={}){const{state:n,dispatch:s}=ve(),i=ke[n.themeMode],[l,a]=d.useState([]),[o,r]=d.useState(!0),[p,S]=d.useState(null),[w,c]=d.useState(null),[z,j]=d.useState(null),[h,u]=d.useState(!1),[D,T]=d.useState(null),[v,f]=d.useState(null),[x,b]=d.useState(!1),[W,O]=d.useState(!1),[N,A]=d.useState(null),[k,g]=d.useState([]),$=d.useCallback(()=>{let y=!1;return r(!0),S(null),M.getDomains().then(C=>{if(y)return;const R=Array.isArray(C==null?void 0:C.domains)?C.domains:[];a(R),s({type:"SET_AUTHORED_DOMAINS",domains:R})}).catch(C=>{y||(a([]),S(C instanceof Error&&C.message?C.message:"Could not load domains. Is the local DQL server running?"))}).finally(()=>{y||r(!1)}),()=>{y=!0}},[s]);d.useEffect(()=>$(),[$]),d.useEffect(()=>{const y=window.sessionStorage.getItem(de);let C=!1;const R=P=>{if(P&&!C){f(P);try{const H=JSON.parse(window.sessionStorage.getItem(ce)??"[]");g(Array.isArray(H)?H.filter(V=>typeof V=="string"):P.candidates.filter(V=>V.action!=="unchanged").map(V=>V.id))}catch{g(P.candidates.filter(H=>H.action!=="unchanged").map(H=>H.id))}}};return(y?M.getContextBootstrap(y):M.getLatestContextBootstrap()).then(R).catch(async()=>{window.sessionStorage.removeItem(de),window.sessionStorage.removeItem(ce),y&&R(await M.getLatestContextBootstrap().catch(()=>null))}),()=>{C=!0}},[]),d.useEffect(()=>{v&&(window.sessionStorage.setItem(de,v.id),window.sessionStorage.setItem(ce,JSON.stringify(k)))},[v==null?void 0:v.id,k]);const L=d.useMemo(()=>[...l].sort((y,C)=>y.name.localeCompare(C.name)),[l]),B=d.useCallback(y=>{a(C=>{const R=C.findIndex(P=>P.id===y.id),E=R===-1?[...C,y]:[...C];return R!==-1&&(E[R]=y),s({type:"SET_AUTHORED_DOMAINS",domains:E}),E}),c(null)},[s]),_=d.useCallback(async()=>{if(z){u(!0),T(null);try{await M.deleteDomain(z.id),a(y=>{const C=y.filter(R=>R.id!==z.id);return s({type:"SET_AUTHORED_DOMAINS",domains:C}),C}),j(null)}catch(y){T(y instanceof Error&&y.message?y.message:"Could not delete this domain.")}finally{u(!1)}}},[s,z]),Y=d.useCallback(async()=>{b(!0),A(null);try{const y=await M.startContextBootstrap({ai:!0});f(y);const C=y.candidates.filter(R=>R.action!=="unchanged").map(R=>R.id);g(C),window.sessionStorage.setItem(de,y.id),window.sessionStorage.setItem(ce,JSON.stringify(C))}catch(y){A(y instanceof Error?y.message:"Could not draft repository context.")}finally{b(!1)}},[]);d.useEffect(()=>{if(!t)return;const y=()=>{Y()};return window.addEventListener("dql:context-build",y),()=>window.removeEventListener("dql:context-build",y)},[t,Y]),d.useEffect(()=>{if(!v||["ready","needs_attention"].includes(v.status))return;let y=!1;const C=async()=>{try{const E=await M.getContextBootstrap(v.id);y||f(E)}catch(E){y||A(E instanceof Error?E.message:"Could not update AI draft progress.")}};C();const R=window.setInterval(()=>void C(),750);return()=>{y=!0,window.clearInterval(R)}},[v==null?void 0:v.id,v==null?void 0:v.status]);const G=d.useCallback(async()=>{if(!(!v||k.length===0)){O(!0),A(null);try{await M.saveContextBootstrapSelected(v.id,k),f(null),g([]),window.sessionStorage.removeItem(de),window.sessionStorage.removeItem(ce),$()}catch(y){A(y instanceof Error?y.message:"Could not save selected drafts.")}finally{O(!1)}}},[v,k,$]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:i.appBg},children:[e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:18,marginBottom:18},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(oe,{size:20,strokeWidth:1.9,color:i.accent}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:i.textPrimary},children:"Domains"})]}),e.jsx("div",{style:{fontSize:13,color:i.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:"Domains are the top of your business model — each one owns the terms, skills, and blocks beneath it. Name the business area, who owns it, the bounded context, and the source systems it draws from."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>$(),title:"Refresh",style:ie(i),children:[e.jsx(pe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void Y(),disabled:x,style:ie(i),children:[x?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(te,{size:13,strokeWidth:2})," Draft with AI"]}),e.jsxs("button",{type:"button",onClick:()=>c({kind:"create"}),style:ye(i),children:[e.jsx(ne,{size:14,strokeWidth:2.2})," Add domain"]})]})]}),o?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:i.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(F,{size:15,strokeWidth:2})," Loading domains…"]}):p?e.jsx(vt,{t:i,message:p,onRetry:()=>$()}):L.length===0?e.jsx(jt,{t:i,onAdd:()=>c({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:L.map(y=>e.jsx(mt,{domain:y,t:i,onEdit:()=>c({kind:"edit",domain:y}),onDelete:()=>{T(null),j(y)}},y.id))}),N?e.jsx("div",{style:{marginTop:12},children:e.jsx(fe,{t:i,tone:"error",children:N})}):null,v?e.jsxs("section",{style:{marginTop:18,border:`1px solid ${i.cellBorder}`,borderRadius:10,background:i.cellBg,padding:14},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:750,color:i.textPrimary},children:"Repository-guided AI draft"}),e.jsx("div",{style:{fontSize:12,color:i.textMuted,marginTop:3},children:"Inventory is deterministic; AI may enrich only grounded prose and guidance. Nothing is written to Git until you save."})]}),e.jsxs("button",{type:"button",disabled:W||k.length===0||!["ready","needs_attention"].includes(v.status),onClick:()=>void G(),style:{...ye(i),opacity:W||k.length===0||!["ready","needs_attention"].includes(v.status)?.55:1},children:[W?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(ne,{size:13,strokeWidth:2})," Save selected drafts"]})]}),e.jsx(kt,{t:i,session:v}),e.jsx("div",{style:{display:"grid",gap:9,marginTop:12},children:v.candidates.map(y=>{const C=y.action!=="unchanged",R=k.includes(y.id);return e.jsx(St,{candidate:y,selected:R,selectable:C,disabled:W,t:i,onToggle:()=>g(E=>R?E.filter(P=>P!==y.id):[...E,y.id])},y.id)})})]}):null]}),w?e.jsx(bt,{mode:w,existingIds:l.map(y=>y.id),domains:l,t:i,onClose:()=>c(null),onSaved:B}):null,z?e.jsx(wt,{domain:z,t:i,deleting:h,error:D,onCancel:()=>{h||j(null)},onConfirm:_}):null]})}function mt({domain:t,t:n,onEdit:s,onDelete:i}){const l=t.sourceSystems??[],[a,o]=d.useState(!1);return e.jsxs("section",{style:{border:`1px solid ${n.cellBorder}`,borderRadius:10,background:n.cellBg,padding:"13px 15px",display:"flex",alignItems:"flex-start",gap:14},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:750,color:n.textPrimary},children:t.name}),t.parent?e.jsxs("span",{style:We(n),children:["↳ ",t.parent]}):null,t.owner?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,color:n.textMuted},children:[e.jsx(He,{size:11,strokeWidth:2})," ",t.owner]}):null,t.businessOwner?e.jsxs("span",{style:We(n),children:[e.jsx(He,{size:10,strokeWidth:2.2})," Business owner: ",t.businessOwner]}):null]}),t.description?e.jsx("div",{style:{fontSize:12.5,color:n.textSecondary,marginTop:5,lineHeight:1.5},children:t.description}):e.jsx("div",{style:{fontSize:12,color:n.textMuted,marginTop:5,fontStyle:"italic"},children:"No description yet."}),l.length>0?e.jsx("div",{style:{display:"flex",gap:5,marginTop:9,flexWrap:"wrap"},children:l.map(r=>e.jsx("span",{style:$e(n),children:r},r))}):null,e.jsxs("div",{style:{display:"flex",gap:7,marginTop:9,flexWrap:"wrap"},children:[e.jsx(we,{t:n,icon:e.jsx(lt,{size:11,strokeWidth:2}),label:"blocks",count:t.blockCount??0}),e.jsx(we,{t:n,icon:e.jsx(le,{size:11,strokeWidth:2}),label:"skills",count:t.skillCount??0}),e.jsx(we,{t:n,icon:e.jsx(gt,{size:11,strokeWidth:2}),label:"terms",count:t.termCount??0})]}),a?e.jsxs("div",{style:{display:"grid",gap:9,marginTop:12,paddingTop:11,borderTop:`1px solid ${n.btnBorder}`},children:[t.boundedContext?e.jsx(_e,{t:n,label:"Business boundary",children:t.boundedContext}):null,t.businessOutcome?e.jsx(_e,{t:n,label:"Decision outcome",children:t.businessOutcome}):null,e.jsx(ge,{t:n,label:"In scope",values:t.inScope,empty:"Not defined yet"}),e.jsx(ge,{t:n,label:"Out of scope",values:t.outOfScope,empty:"Not defined yet"}),e.jsx(ge,{t:n,label:"Primary terms",values:t.primaryTerms,empty:"No terms linked yet"}),e.jsx(ge,{t:n,label:"Tags",values:t.tags,empty:"No tags"})]}):null]}),e.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>o(r=>!r),style:{...ie(n),padding:"5px 7px",fontSize:11.5},title:a?"Hide domain details":"Show domain details",children:[a?e.jsx(Ye,{size:13}):e.jsx(Qe,{size:13}),a?"Less":"Details"]}),e.jsx("button",{type:"button",onClick:s,style:Ie(n),title:"Edit domain",children:e.jsx(Xe,{size:13,strokeWidth:2})}),e.jsx("button",{type:"button",onClick:i,style:Ie(n),title:"Delete domain",children:e.jsx(re,{size:13,strokeWidth:2})})]})]})}function bt({mode:t,existingIds:n,domains:s,t:i,onClose:l,onSaved:a}){const o=t.kind==="edit",[r,p]=d.useState(()=>t.kind==="edit"?{...t.domain}:ft()),[S,w]=d.useState(o),[c,z]=d.useState(!1),[j,h]=d.useState(null),u=d.useCallback((x,b)=>{p(W=>({...W,[x]:b}))},[]),D=x=>{p(b=>({...b,name:x,...!o&&!S?{id:Ne(x)}:{}}))},T=!o&&r.id.length>0&&n.includes(r.id),v=r.id.trim().length>0&&r.name.trim().length>0&&!T&&!c,f=d.useCallback(async()=>{var b,W,O,N,A;const x={...r,id:r.id.trim(),name:r.name.trim(),owner:(b=r.owner)!=null&&b.trim()?r.owner.trim():void 0,businessOwner:(W=r.businessOwner)!=null&&W.trim()?r.businessOwner.trim():void 0,parent:(O=r.parent)!=null&&O.trim()?r.parent.trim():void 0,boundedContext:(N=r.boundedContext)!=null&&N.trim()?r.boundedContext.trim():void 0,description:(A=r.description)!=null&&A.trim()?r.description.trim():void 0,sourceSystems:(r.sourceSystems??[]).map(k=>k.trim()).filter(Boolean),primaryTerms:(r.primaryTerms??[]).map(k=>k.trim()).filter(Boolean),tags:(r.tags??[]).map(k=>k.trim()).filter(Boolean),inScope:(r.inScope??[]).map(k=>k.trim()).filter(Boolean),outOfScope:(r.outOfScope??[]).map(k=>k.trim()).filter(Boolean),dbtGroups:(r.dbtGroups??[]).map(k=>k.trim()).filter(Boolean),dbtPaths:(r.dbtPaths??[]).map(k=>k.trim()).filter(Boolean),dbtTags:(r.dbtTags??[]).map(k=>k.trim()).filter(Boolean),semanticDomains:(r.semanticDomains??[]).map(k=>k.trim()).filter(Boolean),semanticTags:(r.semanticTags??[]).map(k=>k.trim()).filter(Boolean)};z(!0),h(null);try{const k=o?await M.updateDomain(x.id,x):await M.createDomain(x);a(k.domain??x)}catch(k){h(k instanceof Error&&k.message?k.message:"Could not save this domain. Try again.")}finally{z(!1)}},[r,o,a]);return e.jsx("div",{style:Wt,onClick:()=>!c&&l(),children:e.jsxs("div",{style:Rt(i),onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{style:Tt(i),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(oe,{size:16,strokeWidth:2,color:i.accent}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:i.textPrimary},children:o?"Edit domain":"New domain"})]}),e.jsx("button",{type:"button",onClick:()=>!c&&l(),style:Ie(i),title:"Close",children:e.jsx(ue,{size:15,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"16px 18px",display:"grid",gap:16},children:[e.jsx(U,{label:"Name",t:i,hint:o?void 0:"A short, human label for this business area.",children:e.jsx("input",{type:"text",value:r.name,onChange:x=>D(x.target.value),placeholder:"Revenue",style:X(i)})}),e.jsxs(U,{label:"ID (slug)",t:i,hint:"Used as the on-disk identifier. Letters, numbers, and dashes.",children:[e.jsx("input",{type:"text",value:r.id,disabled:o,onChange:x=>{w(!0),u("id",ht(x.target.value))},onBlur:()=>u("id",Ne(r.id)),placeholder:"revenue",style:{...X(i),fontFamily:i.fontMono,opacity:o?.7:1}}),T?e.jsx(fe,{t:i,tone:"error",children:"A domain with this id already exists."}):null]}),e.jsx(U,{label:"Parent domain",t:i,hint:"Optional. Depth becomes Domain, Subdomain, Microdomain, and beyond.",children:e.jsxs("select",{value:r.parent??"",onChange:x=>u("parent",x.target.value||void 0),style:X(i),children:[e.jsx("option",{value:"",children:"Top-level domain"}),s.filter(x=>x.id!==r.id).map(x=>e.jsx("option",{value:x.id,children:x.name},x.id))]})}),e.jsx(U,{label:"Owner",t:i,hint:"The team or person accountable for this domain.",children:e.jsx("input",{type:"text",value:r.owner??"",onChange:x=>u("owner",x.target.value),placeholder:"finance-analytics",style:X(i)})}),e.jsx(U,{label:"Business owner",t:i,hint:"The stakeholder accountable for business use and definitions.",children:e.jsx("input",{type:"text",value:r.businessOwner??"",onChange:x=>u("businessOwner",x.target.value),placeholder:"Revenue Operations",style:X(i)})}),e.jsx(U,{label:"Bounded context",t:i,hint:"The conceptual boundary this domain owns, e.g. 'recognized revenue and invoicing'.",children:e.jsx("input",{type:"text",value:r.boundedContext??"",onChange:x=>u("boundedContext",x.target.value),placeholder:"Recognized revenue and invoicing",style:X(i)})}),e.jsx(U,{label:"Source systems",t:i,hint:"The upstream systems this domain draws from — type a name and press Enter.",children:e.jsx(Se,{t:i,values:r.sourceSystems??[],onChange:x=>u("sourceSystems",x),placeholder:"Add a source system…"})}),e.jsx(U,{label:"Primary terms",t:i,hint:"Business concepts the agent should use to recognize this domain.",children:e.jsx(Se,{t:i,values:r.primaryTerms??[],onChange:x=>u("primaryTerms",x),placeholder:"Add a term…"})}),e.jsx(U,{label:"Scope tags",t:i,hint:"Short labels used for routing and discovery.",children:e.jsx(Se,{t:i,values:r.tags??[],onChange:x=>u("tags",x),placeholder:"Add a tag…"})}),e.jsx(U,{label:"Description",t:i,hint:"What this domain covers and how it's used.",children:e.jsx("textarea",{value:r.description??"",onChange:x=>u("description",x.target.value),rows:5,placeholder:"All recognized-revenue metrics and the blocks that report them, sourced from the billing warehouse.",style:zt(i)})}),j?e.jsx(fe,{t:i,tone:"error",children:j}):null]}),e.jsxs("div",{style:$t(i),children:[e.jsx("button",{type:"button",onClick:()=>!c&&l(),style:ie(i),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:f,disabled:!v,style:{...ye(i),opacity:v?1:.55},children:[c?e.jsx(F,{size:13,strokeWidth:2}):null,c?"Saving…":o?"Save changes":"Create domain"]})]})]})})}function Se({t,values:n,onChange:s,placeholder:i}){const[l,a]=d.useState(""),o=r=>{const p=r.trim();!p||n.includes(p)||(s([...n,p]),a(""))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[n.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:n.map(r=>e.jsxs("span",{style:Bt(t),children:[r,e.jsx("button",{type:"button",onClick:()=>s(n.filter(p=>p!==r)),style:It(t),title:"Remove",children:e.jsx(ue,{size:11,strokeWidth:2.4})})]},r))}):null,e.jsx("input",{type:"text",value:l,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),o(l))},placeholder:i,style:X(t)})]})}function jt({t,onAdd:n}){return e.jsxs("div",{style:{border:`1px dashed ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:"34px 28px",textAlign:"center",display:"grid",gap:12,justifyItems:"center"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:`${t.accent}18`,color:t.accent,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(oe,{size:22,strokeWidth:1.9})}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:t.textPrimary},children:"Name your business domains"}),e.jsx("div",{style:{fontSize:13,color:t.textMuted,maxWidth:460,lineHeight:1.55},children:`Domains organize everything below them — terms, skills, and blocks. Add your first one, like "Revenue" or "Customer", and you'll be able to pick it when authoring blocks and skills.`}),e.jsxs("button",{type:"button",onClick:n,style:{...ye(t),marginTop:4},children:[e.jsx(ne,{size:14,strokeWidth:2.2})," Add your first domain"]})]})}function vt({t,message:n,onRetry:s}){return e.jsxs("div",{style:{border:`1px solid ${t.warning}55`,borderRadius:10,background:`${t.warning}12`,padding:"16px 18px",display:"flex",alignItems:"flex-start",gap:11},children:[e.jsx(Te,{size:16,strokeWidth:2,color:t.warning,style:{marginTop:1,flexShrink:0}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:650,color:t.textPrimary},children:"Domains are not available right now"}),e.jsx("div",{style:{fontSize:12.5,color:t.textSecondary,marginTop:4,lineHeight:1.5},children:n}),e.jsxs("button",{type:"button",onClick:s,style:{...ie(t),marginTop:10},children:[e.jsx(pe,{size:13,strokeWidth:2})," Retry"]})]})]})}function kt({t,session:n}){var l;const s=!["ready","needs_attention"].includes(n.status),i=n.ai.mode==="evidence_only"?"Evidence-only":n.ai.provider?`${n.ai.provider} grounded`:"Preparing AI";return e.jsxs("div",{style:{marginTop:14,padding:"10px 11px",borderRadius:8,background:t.appBg,border:`1px solid ${t.btnBorder}`},children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center",flexWrap:"wrap",fontSize:12,color:t.textSecondary},children:[s?e.jsx(F,{size:14,strokeWidth:2,color:t.accent}):e.jsx(te,{size:14,strokeWidth:2,color:t.accent}),e.jsx("strong",{style:{color:t.textPrimary,textTransform:"capitalize"},children:n.status.replace("_"," ")}),e.jsx("span",{children:i}),e.jsxs("span",{children:[n.progress.domains.ready,"/",n.progress.domains.total," domains"]}),e.jsxs("span",{children:[n.progress.skills.ready,"/",n.progress.skills.total," skills"]})]}),e.jsx("div",{style:{height:5,borderRadius:999,background:t.btnBg,overflow:"hidden",marginTop:9},children:e.jsx("div",{style:{width:`${Math.max(3,Math.min(100,n.progress.percent))}%`,height:"100%",background:t.accent,transition:"width 260ms ease"}})}),e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.textMuted,lineHeight:1.45},children:n.progress.message}),(l=n.warnings)!=null&&l.length?e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.warning,lineHeight:1.45},children:n.warnings.slice(-2).join(" ")}):null]})}function St({candidate:t,selected:n,selectable:s,disabled:i,t:l,onToggle:a}){var z,j,h,u,D,T,v,f,x,b,W,O,N,A,k,g,$,L,B,_,Y,G,y,C,R,E;const[o,r]=d.useState(!1),p=t.kind==="domain",S=((z=t.domain)==null?void 0:z.name)??((j=t.skill)==null?void 0:j.id)??t.id.replace(/^(domain|skill):/,""),w=p?((h=t.domain)==null?void 0:h.description)??((u=t.domain)==null?void 0:u.boundedContext):((D=t.skill)==null?void 0:D.description)??((v=(T=t.skill)==null?void 0:T.body)==null?void 0:v.split(`
|
|
12
|
+
`).find(Boolean)),c=p?[["Business outcome",(f=t.domain)==null?void 0:f.businessOutcome],["In scope",(b=(x=t.domain)==null?void 0:x.inScope)==null?void 0:b.join(" · ")],["Out of scope",(O=(W=t.domain)==null?void 0:W.outOfScope)==null?void 0:O.join(" · ")],["Primary terms",(A=(N=t.domain)==null?void 0:N.primaryTerms)==null?void 0:A.join(" · ")]]:[["Applies when",(g=(k=t.skill)==null?void 0:k.triggers)==null?void 0:g.join(" · ")],["Ask first when",(L=($=t.skill)==null?void 0:$.clarifyWhen)==null?void 0:L.join(" · ")],["Avoid when",(_=(B=t.skill)==null?void 0:B.exclusions)==null?void 0:_.join(" · ")],["Preferred metrics",(G=(Y=t.skill)==null?void 0:Y.preferredMetrics)==null?void 0:G.join(" · ")],["Preferred blocks",(C=(y=t.skill)==null?void 0:y.preferredBlocks)==null?void 0:C.join(" · ")]];return e.jsx("article",{style:{border:`1px solid ${n?`${l.accent}66`:l.btnBorder}`,background:n?`${l.accent}08`:l.appBg,borderRadius:8,padding:"10px 11px",opacity:s?1:.72},children:e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("input",{"aria-label":`Select ${p?"domain":"skill"} ${S}`,type:"checkbox",disabled:!s||i,checked:n,onChange:a,style:{marginTop:3}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("strong",{style:{color:l.textPrimary,fontSize:12.5},children:[p?"Domain":"Skill"," · ",S]}),e.jsx("span",{style:We(l),children:t.action.replace("_"," ")}),e.jsxs("span",{style:{fontSize:11,color:l.textMuted},children:[Math.round(t.confidence*100),"% evidence confidence"]})]}),w?e.jsx("p",{style:{marginTop:5,color:l.textSecondary,fontSize:12,lineHeight:1.45},children:w}):e.jsx("p",{style:{marginTop:5,color:l.textMuted,fontSize:12,fontStyle:"italic"},children:"Waiting for grounded guidance…"}),e.jsx("div",{style:{display:"flex",gap:5,marginTop:7,flexWrap:"wrap"},children:t.evidence.map(P=>e.jsx("span",{style:$e(l),children:P},P))}),o?e.jsxs("div",{style:{marginTop:9,display:"grid",gap:6,borderTop:`1px solid ${l.btnBorder}`,paddingTop:9},children:[c.filter(([,P])=>!!P).map(([P,H])=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"116px minmax(0, 1fr)",gap:8,fontSize:11.5,lineHeight:1.45},children:[e.jsx("strong",{style:{color:l.textMuted},children:P}),e.jsx("span",{style:{color:l.textSecondary},children:H})]},P)),!p&&((R=t.skill)!=null&&R.body)?e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontFamily:l.font,fontSize:11.5,color:l.textSecondary,background:l.cellBg,padding:9,borderRadius:6,maxHeight:180,overflow:"auto"},children:t.skill.body}):null,(E=t.notes)!=null&&E.length?e.jsx("div",{style:{fontSize:11.5,color:l.accent},children:t.notes.join(" ")}):null]}):null]}),e.jsxs("button",{type:"button",onClick:()=>r(P=>!P),style:{...ie(l),padding:"4px 6px",fontSize:11.5},"aria-expanded":o,children:[o?e.jsx(Ye,{size:13}):e.jsx(Qe,{size:13}),o?"Less":"Review"]})]})})}function wt({domain:t,t:n,deleting:s,error:i,onCancel:l,onConfirm:a}){return e.jsx("div",{style:Mt,onClick:l,children:e.jsxs("div",{style:Dt(n),onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(re,{size:16,strokeWidth:2,color:n.error}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:n.textPrimary},children:"Delete this domain?"})]}),e.jsxs("div",{style:{fontSize:13,color:n.textSecondary,lineHeight:1.55},children:[e.jsx("span",{style:{fontWeight:700,color:n.textPrimary},children:t.name})," will be removed. Blocks, skills, and terms that referenced it will become unassigned. This can't be undone."]}),i?e.jsx(fe,{t:n,tone:"error",children:i}):null,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:l,disabled:s,style:ie(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:a,disabled:s,style:{...Ct(n),opacity:s?.6:1},children:[s?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(re,{size:13,strokeWidth:2}),s?"Deleting…":"Delete"]})]})]})})}function we({t,icon:n,label:s,count:i}){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11,fontWeight:600,color:i>0?t.textSecondary:t.textMuted,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px"},children:[n,i," ",s]})}function _e({t,label:n,children:s}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:n}),e.jsx("span",{style:{color:t.textSecondary},children:s})]})}function ge({t,label:n,values:s,empty:i}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:n}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:s!=null&&s.length?s.map(l=>e.jsx("span",{style:$e(t),children:l},l)):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:i})})]})}function U({label:t,hint:n,t:s,children:i}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:s.textPrimary},children:t}),n?e.jsx("div",{style:{fontSize:11.5,color:s.textMuted,lineHeight:1.45,marginTop:-2},children:n}):null,i]})}function fe({t,tone:n,children:s}){const i=n==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:i,lineHeight:1.45},children:s})}function ye(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function ie(t){return{display:"inline-flex",alignItems:"center",gap:5,padding:"7px 11px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontSize:12,fontWeight:600,fontFamily:t.font,cursor:"pointer"}}function Ct(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.error}`,background:t.error,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function Ie(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,cursor:"pointer",flexShrink:0}}function X(t){return{width:"100%",border:`1px solid ${t.btnBorder}`,borderRadius:7,background:t.cellBg,color:t.textPrimary,fontSize:12.5,fontFamily:t.font,padding:"8px 10px",boxSizing:"border-box"}}function zt(t){return{...X(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function We(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:10.5,fontWeight:700,color:t.accent,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:999,padding:"2px 8px"}}function $e(t){return{fontSize:11,fontWeight:600,color:t.textSecondary,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px",fontFamily:t.fontMono}}function Bt(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11.5,fontWeight:600,color:t.textPrimary,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:6,padding:"3px 4px 3px 9px",fontFamily:t.fontMono}}function It(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:t.textMuted,cursor:"pointer",padding:2,borderRadius:4}}const Wt={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",justifyContent:"flex-end",zIndex:60};function Rt(t){return{width:"min(560px, 100%)",height:"100%",background:t.appBg,borderLeft:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",boxShadow:"-8px 0 28px rgba(0,0,0,0.18)"}}function Tt(t){return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:`1px solid ${t.headerBorder}`,flexShrink:0}}function $t(t){return{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"13px 18px",borderTop:`1px solid ${t.headerBorder}`,flexShrink:0}}const Mt={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function Dt(t){return{width:"min(420px, 100%)",background:t.cellBg,border:`1px solid ${t.cellBorder}`,borderRadius:12,padding:20,display:"grid",gap:13,boxShadow:"0 18px 48px rgba(0,0,0,0.3)"}}function Pt(t,n,s){var a,o;if(n&&t.domain!==n&&!((a=t.domains)!=null&&a.includes(n)))return!1;const i=(o=s==null?void 0:s.split("::").at(-1))==null?void 0:o.toLowerCase();if(!i)return!0;const l=(t.modelAreaRefs??[]).map(r=>{var p;return(p=r.split("::").at(-1))==null?void 0:p.toLowerCase()});return l.length===0||l.includes(i)}function Le(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}function At(t,n){if(!n)return!0;const s=Le(t.sourcePath);return n.some(i=>{const l=Le(i);return s===l||s.endsWith(`/${l}`)})}function Et({proposal:t,theme:n,onClose:s,onCommitted:i}){const[l,a]=d.useState(t),[o,r]=d.useState(()=>t.operations.map(f=>f.id)),[p,S]=d.useState(null),[w,c]=d.useState(null),[z,j]=d.useState(!1),h=l.diagnostics.filter(f=>f.severity==="blocking"),u=d.useMemo(()=>new Map(l.operations.map(f=>[f.id,l.patches.filter(x=>x.operationId===f.id)])),[l]),D=async(f,x)=>{const b=x?[...o,f]:o.filter(W=>W!==f);r(b),S("preview"),c(null),j(!1);try{const W=await M.repreviewContextProposal(l.id,b);a(W),r(W.operations.map(O=>O.id))}catch(W){r(o),c(W instanceof Error?W.message:String(W))}finally{S(null)}},T=async()=>{S("commit"),c(null),j(!1);try{const f=await M.commitContextProposal(l.id,l.proposalHash,crypto.randomUUID());a(f.proposal),i(f.proposal)}catch(f){c(f instanceof Error?f.message:String(f)),j(!0)}finally{S(null)}},v=async()=>{S("rebase"),c(null);try{const f=await M.repreviewContextProposal(l.id,o,{rebase:!0});a(f),r(f.operations.map(x=>x.id)),j(!1)}catch(f){c(f instanceof Error?f.message:String(f))}finally{S(null)}};return e.jsx("div",{role:"presentation",onClick:()=>!p&&s(),style:{position:"fixed",inset:0,zIndex:130,background:"rgba(8, 10, 16, .48)",display:"flex",justifyContent:"flex-end"},children:e.jsxs("aside",{role:"dialog","aria-modal":"true","aria-label":"Review context proposal",onClick:f=>f.stopPropagation(),style:{width:"min(720px, 96vw)",height:"100%",background:n.appBg,borderLeft:"1px solid var(--border-default)",boxShadow:"-18px 0 50px rgba(0,0,0,.24)",display:"flex",flexDirection:"column"},children:[e.jsxs("header",{style:{minHeight:58,padding:"0 18px",borderBottom:"1px solid var(--border-subtle)",display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{width:30,height:30,borderRadius:8,background:"var(--accent-dim)",color:n.accent,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(ut,{size:16})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("strong",{style:{fontSize:14},children:"Review exact proposal"}),e.jsxs("div",{style:{marginTop:2,fontSize:10.5,color:n.textMuted},children:[l.origin.replace(/_/g," ")," · immutable revision · ",l.trustState.replace(/_/g," ")]})]}),e.jsx("button",{type:"button","aria-label":"Close proposal",disabled:!!p,onClick:s,style:Ot(n),children:e.jsx(ue,{size:15})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:18},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:8,marginBottom:14},children:[e.jsx(Ce,{label:"Files",value:l.impact.files,theme:n}),e.jsx(Ce,{label:"Modeling",value:l.impact.modelingChanges,theme:n}),e.jsx(Ce,{label:"Skills",value:l.impact.skillChanges,theme:n})]}),e.jsxs("div",{style:{padding:"10px 12px",border:"1px solid var(--border-subtle)",borderRadius:9,background:"var(--bg-1)",color:n.textSecondary,fontSize:11,lineHeight:1.5,marginBottom:14},children:[e.jsx(Be,{size:14,style:{verticalAlign:-3,marginRight:7,color:n.accent}}),"Nothing below has changed source. Saving compiles the complete candidate and writes every selected patch together or writes nothing."]}),l.diagnostics.map((f,x)=>e.jsxs("div",{style:{display:"flex",gap:8,padding:"8px 10px",marginBottom:6,borderRadius:7,background:f.severity==="blocking"?"var(--status-error-bg, rgba(180,50,50,.1))":"var(--bg-1)",color:f.severity==="blocking"?"var(--status-error, #c45555)":n.textSecondary,fontSize:10.5},children:[f.severity==="blocking"?e.jsx(Te,{size:13}):e.jsx(Ve,{size:13}),e.jsxs("span",{children:[e.jsx("b",{children:f.code})," · ",f.message]})]},`${f.code}-${x}`)),e.jsx("div",{style:{display:"grid",gap:10,marginTop:14},children:l.operations.map(f=>{const x=u.get(f.id)??[];return e.jsxs("section",{style:{border:"1px solid var(--border-subtle)",borderRadius:9,overflow:"hidden",background:n.cellBg},children:[e.jsxs("label",{style:{display:"flex",gap:9,alignItems:"flex-start",padding:"11px 12px",cursor:p?"wait":"pointer"},children:[e.jsx("input",{type:"checkbox",checked:o.includes(f.id),disabled:!!p,onChange:b=>void D(f.id,b.target.checked)}),e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsx("b",{style:{display:"block",fontSize:11.5},children:f.kind.replace(/_/g," ")}),e.jsx("code",{style:{display:"block",marginTop:3,color:n.textMuted,fontSize:9.5,overflowWrap:"anywhere"},children:f.id})]}),e.jsxs("span",{style:{fontSize:10,color:n.textMuted},children:[x.length," patch",x.length===1?"":"es"]})]}),x.map(b=>e.jsxs("details",{style:{borderTop:"1px solid var(--border-subtle)"},children:[e.jsx("summary",{style:{padding:"8px 12px",cursor:"pointer",color:n.textSecondary,fontSize:10.5},children:e.jsx("code",{children:b.path})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1,background:"var(--border-subtle)"},children:[e.jsx(Fe,{title:"Before",value:b.before,theme:n}),e.jsx(Fe,{title:"After",value:b.after,theme:n})]})]},`${b.operationId}-${b.path}`))]},f.id)})}),w?e.jsx("div",{role:"alert",style:{color:"var(--status-error, #c45555)",fontSize:11,marginTop:12},children:w}):null]}),e.jsxs("footer",{style:{padding:"12px 18px",borderTop:"1px solid var(--border-subtle)",display:"flex",alignItems:"center",gap:9},children:[e.jsxs("span",{style:{flex:1,fontSize:10.5,color:n.textMuted},children:["Proposal ",e.jsx("code",{children:l.proposalHash.slice(0,12)})]}),z?e.jsxs("button",{type:"button",onClick:()=>void v(),disabled:!!p,style:Re(n),children:[e.jsx(pe,{size:13})," Rebase proposal"]}):null,e.jsx("button",{type:"button",onClick:s,disabled:!!p,style:Re(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>void T(),disabled:!!p||o.length===0||h.length>0,style:{...Ht(n),opacity:p||o.length===0||h.length?.55:1},children:[p?e.jsx(F,{size:13}):e.jsx(Be,{size:13})," ",p==="preview"?"Repreviewing…":p==="commit"?"Saving…":"Save as draft"]})]})]})})}function Ce({label:t,value:n,theme:s}){return e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:8,padding:"9px 10px",background:s.cellBg},children:[e.jsx("b",{style:{fontSize:15},children:n}),e.jsx("span",{style:{display:"block",marginTop:2,color:s.textMuted,fontSize:9.5},children:t})]})}function Fe({title:t,value:n,theme:s}){return e.jsxs("div",{style:{minWidth:0,background:"var(--bg-1)",padding:9},children:[e.jsx("b",{style:{fontSize:9,color:s.textMuted},children:t}),e.jsx("pre",{style:{margin:"7px 0 0",fontSize:9.5,lineHeight:1.45,whiteSpace:"pre-wrap",overflowWrap:"anywhere",maxHeight:240,overflow:"auto",color:s.textSecondary},children:n||"∅"})]})}const Ot=t=>({border:"1px solid var(--border-subtle)",background:t.cellBg,color:t.textSecondary,width:29,height:29,borderRadius:7,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer"}),Re=t=>({border:"1px solid var(--border-default)",background:t.cellBg,color:t.textPrimary,minHeight:31,borderRadius:7,padding:"0 12px",cursor:"pointer"}),Ht=t=>({...Re(t),background:t.accent,borderColor:t.accent,color:"var(--accent-fg)",display:"inline-flex",alignItems:"center",gap:6,fontWeight:650});function Nt(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function qe(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function _t(){return{id:"",scope:"project",description:"",body:"",preferredMetrics:[],preferredBlocks:[],vocabulary:{},sourcePath:""}}function Lt({embedded:t=!1,domainFilter:n=null,modelAreaFilter:s=null,sourcePathFilter:i}={}){var De;const{state:l}=ve(),a=ke[l.themeMode],[o,r]=d.useState([]),[p,S]=d.useState(!0),[w,c]=d.useState(null),[z,j]=d.useState({metrics:[],blocks:[],modelingRefs:[]}),h=l.authoredDomains,[u,D]=d.useState(null),[T,v]=d.useState(!1),[f,x]=d.useState("skills"),[b,W]=d.useState(!1),[O,N]=d.useState(null),[A,k]=d.useState(null),[g,$]=d.useState(!1),[L,B]=d.useState(null),[_,Y]=d.useState(()=>{try{const m=window.sessionStorage.getItem("dql-skill-ai-correction");return m?(window.sessionStorage.removeItem("dql-skill-ai-correction"),JSON.parse(m)):null}catch{return null}}),[G,y]=d.useState(null),[C,R]=d.useState(!1),[E,P]=d.useState(null),H=d.useCallback(()=>{let m=!1;return S(!0),c(null),M.getSkills().then(I=>{m||r(Array.isArray(I==null?void 0:I.skills)?I.skills:[])}).catch(I=>{m||(r([]),c(I instanceof Error&&I.message?I.message:"Could not load skills. Is the local DQL server running?"))}).finally(()=>{m||S(!1)}),M.getSkillOptions().then(I=>{m||j({metrics:Array.isArray(I==null?void 0:I.metrics)?I.metrics:[],blocks:Array.isArray(I==null?void 0:I.blocks)?I.blocks:[],modelingRefs:Array.isArray(I==null?void 0:I.modelingRefs)?I.modelingRefs:[]})}).catch(()=>{m||j({metrics:[],blocks:[],modelingRefs:[]})}),M.getSkillPathSettings().then(I=>{m||(D(I),x(I.path))}).catch(()=>{m||D(null)}),()=>{m=!0}},[]);d.useEffect(()=>H(),[H]),d.useEffect(()=>{_&&$(!0)},[_]);const V=d.useMemo(()=>o.filter(m=>Pt(m,n,s)).filter(m=>At(m,i)).sort((m,I)=>m.id.localeCompare(I.id)),[o,n,s,i]),rt=d.useCallback(m=>{r(I=>{const ae=I.findIndex(Ae=>(Ae.qualifiedId??Ae.id)===(m.qualifiedId??m.id));if(ae===-1)return[...I,m];const Pe=[...I];return Pe[ae]=m,Pe}),k(null)},[]),ot=d.useCallback(async()=>{if(G){R(!0),P(null);try{const m=G.qualifiedId??G.id;await M.deleteSkill(m),r(I=>I.filter(ae=>(ae.qualifiedId??ae.id)!==m)),y(null)}catch(m){P(m instanceof Error&&m.message?m.message:"Could not delete this skill.")}finally{R(!1)}}},[G]),Me=d.useCallback(async()=>{W(!0),N(null);try{const m=await M.updateSkillPath(f);D(m),x(m.path),v(!1),H()}catch(m){N(m instanceof Error&&m.message?m.message:"Could not use this Skills folder.")}finally{W(!1)}},[H,f]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:a.appBg},children:[e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:t?"18px 20px 40px":"22px 28px 40px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:18,marginBottom:18},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(le,{size:20,strokeWidth:1.9,color:a.accent}),e.jsx("div",{style:{fontSize:t?18:22,fontWeight:700,color:a.textPrimary},children:s?`${(De=s.split("::").at(-1))==null?void 0:De.replace(/_/g," ")} skills`:n?`${n} skills`:i?"Authored domain skills":"Skills"})]}),e.jsxs("div",{style:{fontSize:13,color:a.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:["Definitions, vocabulary, and instructions the AI follows when answering",s?" in this model area":n?" in this domain":i?" from authored domains":"",". Applied only when their triggers match — drafts never guide answers."]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:7,color:a.textMuted,fontSize:10.5,minWidth:0},children:[e.jsx(Ee,{size:12,strokeWidth:1.8}),e.jsx("span",{children:"Skill folder"}),e.jsx("code",{style:{color:a.textSecondary,fontFamily:a.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(u==null?void 0:u.path)??"skills"}),u?e.jsxs("span",{children:["· ",u.exists?`${u.skillCount} loaded${i?` · ${V.length} shown here`:""}`:"not found"]}):null]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>H(),title:"Refresh",style:J(a),children:[e.jsx(pe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>{N(null),v(m=>!m)},style:J(a),children:[e.jsx(Ee,{size:13,strokeWidth:2})," Skill folder"]}),e.jsxs("button",{type:"button",onClick:()=>$(m=>!m),style:J(a),children:[e.jsx(te,{size:13,strokeWidth:2})," Skills AI"]}),e.jsxs("button",{type:"button",onClick:()=>k({kind:"create"}),style:be(a),children:[e.jsx(ne,{size:14,strokeWidth:2.2})," Add skill"]})]})]}),T?e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:10,background:a.cellBg,padding:"12px 14px",marginBottom:16,display:"grid",gap:8},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:700,color:a.textPrimary},children:"Use an existing Skills folder"}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("input",{"aria-label":"Existing Skills folder",value:f,onChange:m=>x(m.target.value),onKeyDown:m=>{m.key==="Enter"&&f.trim()&&!b&&Me()},placeholder:"skills or ../skills",style:{...q(a),flex:1,fontFamily:a.fontMono}}),e.jsx("button",{type:"button",onClick:()=>v(!1),disabled:b,style:J(a),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>void Me(),disabled:!f.trim()||b,style:{...be(a),opacity:f.trim()&&!b?1:.55},children:[b?e.jsx(F,{size:13,strokeWidth:2}):null,b?"Connecting…":"Use folder"]})]}),e.jsxs("div",{style:{fontSize:10.5,lineHeight:1.45,color:a.textMuted},children:["Relative paths start from the DQL project. If DQL is in a ",e.jsx("code",{style:{fontFamily:a.fontMono},children:"/dql"})," folder inside your dbt repo, use ",e.jsx("code",{style:{fontFamily:a.fontMono},children:"../skills"}),". Existing ",e.jsx("code",{style:{fontFamily:a.fontMono},children:".skill.md"})," and Markdown skill files are loaded in place and stay Git-owned by that repo."]}),u!=null&&u.resolvedPath?e.jsxs("div",{style:{fontSize:10.5,color:a.textMuted,fontFamily:a.fontMono,overflowWrap:"anywhere"},children:["Resolved: ",u.resolvedPath]}):null,O?e.jsx(me,{t:a,tone:"error",children:O}):null]}):null,g?e.jsx(Ft,{themeMode:l.themeMode,domain:n,modelAreaId:s,selectedSkill:(A==null?void 0:A.kind)==="edit"?A.skill:o.find(m=>(m.qualifiedId??m.id)===(_==null?void 0:_.skillId)||m.id===(_==null?void 0:_.skillId)),correction:_,onCorrectionStarted:()=>Y(null),onReviewProposal:B}):null,p?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:a.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(F,{size:15,strokeWidth:2})," Loading skills…"]}):w?e.jsx(Vt,{t:a,message:w,onRetry:()=>H()}):V.length===0?e.jsx(Qt,{t:a,onAdd:()=>k({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:V.map(m=>e.jsx(qt,{skill:m,t:a,onEdit:()=>k({kind:"edit",skill:m}),onDelete:()=>{P(null),y(m)}},m.qualifiedId??m.id))})]}),A?e.jsx(Gt,{mode:A,options:z,domains:h,defaultDomain:n,defaultModelArea:s,existingIds:o.map(m=>m.id),t:a,onClose:()=>k(null),onSaved:rt}):null,G?e.jsx(Jt,{skill:G,t:a,deleting:C,error:E,onCancel:()=>{C||y(null)},onConfirm:ot}):null,L?e.jsx(Et,{proposal:L,theme:a,onClose:()=>B(null),onCommitted:()=>{B(null),H()}}):null]})}function Ft({themeMode:t,domain:n,modelAreaId:s,selectedSkill:i,correction:l,onCorrectionStarted:a,onReviewProposal:o}){const r=ke[t],p=`skills:${n??"all"}:${s??"all"}:${(i==null?void 0:i.qualifiedId)??(i==null?void 0:i.id)??"new"}`,{threadId:S,onThreadIdChange:w}=ct(p);return e.jsx("section",{style:{height:"min(600px, calc(100vh - 260px))",minHeight:400,marginBottom:18,border:"1px solid var(--border-default)",borderRadius:11,overflow:"hidden",background:r.cellBg},children:e.jsx(dt,{themeMode:t,title:"Skills AI",scopeHint:"Skill proposal · metadata only · activation stays separate",composerPlaceholder:"Describe skill guidance or a correction…",initialMode:"skill",selectedObject:i?{kind:"skill",id:i.qualifiedId??i.id,title:i.id,path:i.sourcePath}:s?{kind:"model_area",id:s}:n?{kind:"domain",id:n}:{kind:"workspace",title:"New skill draft"},workspaceContext:{domain:n,modelAreaId:s,targetSkillId:(i==null?void 0:i.qualifiedId)??(i==null?void 0:i.id),providerSafety:"metadata_only"},threadId:S,onThreadIdChange:w,autoRun:l&&i?{text:`${l.feedback??"Correct this skill."}
|
|
13
|
+
|
|
14
|
+
Applied skill: ${i.qualifiedId??i.id}
|
|
15
|
+
Question: ${l.question??"Not retained"}
|
|
16
|
+
Save any corrected version as draft and preserve its analytical policy.`,mode:"skill",nonce:1}:void 0,onRunningChange:c=>{c&&l&&a()},onReviewAuthoringProposal:c=>{const z=c.payload;(z==null?void 0:z.version)===1&&z.trustState==="review_required"&&o(z)},emptyHint:"Describe the skill guidance or correction. Skills AI can draft metadata and canonical references, but cannot activate, grant tools, or make joins permissible.",examplePrompts:[{label:"Create a skill",prompt:"Create a draft skill for the selected domain and area, with triggers, exclusions, clarification rules, and examples."},{label:"Improve this skill",prompt:"Improve the selected skill while preserving its analytical policy and governed references."},{label:"Add vocabulary rules",prompt:"Propose vocabulary and clarification guidance for this domain without inventing governed references."}]})})}function qt({skill:t,t:n,onEdit:s,onDelete:i}){var r,p,S,w;const[l,a]=d.useState(!1),o=(r=t.domains)!=null&&r.length?t.domains:t.domain?[t.domain]:[];return e.jsxs("section",{style:{border:"1px solid var(--border-subtle)",borderRadius:11,background:n.cellBg,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,padding:"12px 14px"},children:[e.jsx("span",{style:{width:28,height:28,borderRadius:7,background:"var(--accent-dim)",color:n.accent,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(le,{size:14,strokeWidth:1.75})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:650,color:n.textPrimary,fontFamily:n.fontMono},children:t.id}),t.status==="draft"?e.jsx("span",{style:Ge(n),children:"draft — inactive"}):null,t.status==="active"||!t.status?e.jsx("span",{style:Yt(n),children:"active"}):null,o.map(c=>e.jsx("span",{style:Xt(n),children:c},c)),t.isStarter?e.jsxs("span",{style:Ge(n),title:"A dbt-seeded starter — edit it to make it yours",children:[e.jsx(te,{size:10,strokeWidth:2.2})," starter — edit me"]}):null]}),e.jsx("div",{style:{fontSize:12,color:t.description?n.textSecondary:n.textMuted,fontStyle:t.description?void 0:"italic",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.description||"No description yet."}),e.jsx("div",{title:t.sourcePath,style:{marginTop:3,color:n.textMuted,fontSize:10,fontFamily:n.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.sourcePath})]}),e.jsx("button",{type:"button",onClick:()=>a(c=>!c),style:{...J(n),height:26,padding:"0 10px",fontSize:11},title:l?"Hide skill details":"Show skill details",children:l?"Hide details":"Details"}),e.jsx("button",{type:"button",onClick:s,style:{...je(n),width:26,height:26},title:"Edit skill",children:e.jsx(Xe,{size:12,strokeWidth:1.75})}),e.jsx("button",{type:"button",onClick:i,style:{...je(n),width:26,height:26},title:"Delete skill",children:e.jsx(re,{size:12,strokeWidth:1.75})})]}),l?e.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle)",padding:"12px 14px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px 20px"},children:[e.jsx(Z,{t:n,label:"Apply when",values:t.triggers,empty:"No trigger phrases defined"}),e.jsx(Z,{t:n,label:"Prefer these metrics",values:t.preferredMetrics,empty:"No preferred metrics",accent:!0,mono:!0}),e.jsx(Z,{t:n,label:"Reuse these blocks",values:t.preferredBlocks,empty:"No preferred blocks",accent:!0,mono:!0}),e.jsx(Z,{t:n,label:"Ask first when",values:t.clarifyWhen,empty:"No clarification rule defined"}),(p=t.exclusions)!=null&&p.length?e.jsx(Z,{t:n,label:"Avoid when",values:t.exclusions,empty:""}):null,(S=t.modelAreaRefs)!=null&&S.length?e.jsx(Z,{t:n,label:"Focus on model areas",values:t.modelAreaRefs,empty:"",mono:!0}):null,(w=t.sourceRefs)!=null&&w.length?e.jsx(Z,{t:n,label:"Guided modeling objects",values:t.sourceRefs,empty:"",mono:!0}):null,t.body?e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("div",{style:se(n),children:"Guidance"}),e.jsx("div",{style:{fontSize:12,lineHeight:1.6,color:n.textSecondary,background:"var(--bg-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"10px 12px",whiteSpace:"pre-wrap",maxHeight:220,overflow:"auto"},children:t.body})]}):null]}):null]})}function Gt({mode:t,options:n,domains:s,defaultDomain:i=null,defaultModelArea:l=null,existingIds:a,t:o,onClose:r,onSaved:p}){const{dispatch:S}=ve(),w=t.kind==="edit",[c,z]=d.useState(()=>t.kind==="edit"?{...t.skill}:{..._t(),domain:i??void 0,domains:i?[i]:[],modelAreaRefs:l?[l]:[]}),[j,h]=d.useState(w),[u,D]=d.useState(()=>t.kind==="edit"?t.skill.id:""),[T,v]=d.useState(!1),[f,x]=d.useState(null),b=d.useCallback((g,$)=>{z(L=>({...L,[g]:$}))},[]),W=g=>{D(g),!w&&!j&&b("id",qe(g))},O=!w&&c.id.length>0&&a.includes(c.id),N=c.id.trim().length>0&&c.body.trim().length>0&&!O&&!T,A=at(c.domain,s),k=d.useCallback(async()=>{var $,L;const g={...c,id:c.id.trim(),description:($=c.description)!=null&&$.trim()?c.description.trim():void 0,body:c.body,domain:(L=c.domain)!=null&&L.trim()?c.domain.trim():void 0,domains:(c.domains??(c.domain?[c.domain]:[])).map(B=>B.trim()).filter(Boolean),modelAreaRefs:(c.modelAreaRefs??[]).map(B=>B.trim()).filter(Boolean),triggers:(c.triggers??[]).map(B=>B.trim()).filter(Boolean),exclusions:(c.exclusions??[]).map(B=>B.trim()).filter(Boolean),preferredDimensions:(c.preferredDimensions??[]).map(B=>B.trim()).filter(Boolean),requiredFilters:(c.requiredFilters??[]).map(B=>B.trim()).filter(Boolean),clarifyWhen:(c.clarifyWhen??[]).map(B=>B.trim()).filter(Boolean),examples:(c.examples??[]).map(B=>B.trim()).filter(Boolean),sourceRefs:(c.sourceRefs??[]).map(B=>B.trim()).filter(Boolean)};v(!0),x(null);try{const B=w?await M.updateSkill(t.kind==="edit"?t.skill.qualifiedId??t.skill.id:g.id,g):await M.createSkill(g);p(B.skill??g)}catch(B){x(B instanceof Error&&B.message?B.message:"Could not save this skill. Try again.")}finally{v(!1)}},[c,w,t,p]);return e.jsx("div",{style:nn,onClick:()=>!T&&r(),children:e.jsxs("div",{style:sn(o),onClick:g=>g.stopPropagation(),children:[e.jsxs("div",{style:rn(),children:[e.jsx("span",{style:{width:30,height:30,borderRadius:8,background:"var(--accent-dim)",color:o.accent,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(le,{size:15,strokeWidth:1.75})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:o.textPrimary},children:w?"Edit skill":"New skill"}),e.jsx("div",{style:{fontSize:11,color:o.textMuted,marginTop:1},children:"Git-backed guidance · applied only when triggers match"})]}),e.jsx("button",{type:"button",onClick:()=>!T&&r(),style:{...je(o),width:26,height:26,border:"none",background:"none"},title:"Close",children:e.jsx(ue,{size:14,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"18px 22px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px 28px",alignContent:"start"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:se(o),children:"Identity"}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Name"}),e.jsx("input",{type:"text",value:u,onChange:g=>W(g.target.value),placeholder:"e.g. Revenue definition",style:q(o)}),e.jsxs("span",{style:{fontSize:10.5,color:o.textMuted},children:["Saved as"," ",e.jsx("input",{type:"text",value:`skills/${c.id}.skill.md`,disabled:w,onChange:g=>{h(!0),b("id",Nt(g.target.value.replace(/^skills\//,"").replace(/\.skill\.md$/,"")))},onBlur:()=>b("id",qe(c.id)),title:"File name — letters, numbers, and dashes",style:{border:"none",background:"none",outline:"none",padding:0,fontFamily:o.fontMono,fontSize:10.5,color:o.textSecondary,width:`${Math.max(20,c.id.length+15)}ch`,borderBottom:w?"none":`1px dashed ${o.btnBorder}`}})]}),O?e.jsx(me,{t:o,tone:"error",children:"A skill with this id already exists."}):null]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Domain"}),e.jsxs("select",{value:c.domain??"",onChange:g=>{const $=g.target.value||void 0;b("domain",$),b("domains",$?[$]:[])},style:{...q(o),cursor:"pointer",color:c.domain?o.textPrimary:o.textMuted},children:[e.jsx("option",{value:"",children:s.length===0?"No domains yet":"No domain"}),A.map(g=>e.jsx("option",{value:g.value,disabled:g.disabled,children:g.label},g.value))]})]}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Type"}),e.jsxs("select",{value:c.kind??"custom",onChange:g=>b("kind",g.target.value),style:{...q(o),cursor:"pointer"},children:[e.jsx("option",{value:"custom",children:"Custom guidance"}),e.jsx("option",{value:"domain_reference",children:"Domain reference — broad context"}),e.jsx("option",{value:"metric_policy",children:"Policy — focused rule"}),e.jsx("option",{value:"glossary",children:"Glossary"}),e.jsx("option",{value:"analysis_pattern",children:"Analysis pattern"}),e.jsx("option",{value:"sql_policy",children:"SQL policy"})]})]})]}),e.jsx("button",{type:"button",onClick:()=>S({type:"SET_MAIN_VIEW",view:"domains"}),style:{border:"none",background:"none",padding:0,fontSize:10.5,color:o.accent,cursor:"pointer",fontFamily:o.font,alignSelf:"flex-start"},title:"Create a new domain on the Domains page",children:"+ New domain"}),e.jsxs("div",{children:[e.jsx("span",{style:{...K(o),display:"block",marginBottom:5},children:"Lifecycle"}),e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.btnBorder}`,borderRadius:7,background:"var(--bg-1)"},children:["active","draft","deprecated"].map(g=>{const $=(c.status??"active")===g;return e.jsx("button",{type:"button",onClick:()=>b("status",g),style:{border:"none",borderRadius:5,padding:"4px 12px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:o.font,background:$?o.cellBg:"transparent",color:$?o.textPrimary:o.textMuted,boxShadow:$?"0 1px 3px rgba(26,26,26,0.1)":"none",textTransform:"capitalize"},children:g},g)})}),e.jsx("span",{style:{fontSize:10.5,color:o.textMuted,marginLeft:8},children:(c.status??"active")==="active"?"Guides matching answers.":c.status==="draft"?"Drafts never guide answers.":"Kept in Git for history only."})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:se(o),children:"When to apply"}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Apply when the question mentions"}),e.jsx(Kt,{t:o,values:c.triggers??[],onChange:g=>b("triggers",g),placeholder:"Add phrase, press Enter"})]}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Ask first when"}),e.jsx(xe,{values:c.clarifyWhen??[],onChange:g=>b("clarifyWhen",g),placeholder:"e.g. 'sales' could mean revenue or order count",style:q(o)})]}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Avoid when"}),e.jsx(xe,{values:c.exclusions??[],onChange:g=>b("exclusions",g),placeholder:"e.g. question is about pipeline or bookings",style:q(o)})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,gridRow:"span 2"},children:[e.jsx("div",{style:se(o),children:"Guidance"}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"One-line summary"}),e.jsx("input",{type:"text",value:c.description??"",onChange:g=>b("description",g.target.value),placeholder:"What rule does this skill encode?",style:q(o)})]}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Full guidance"}),e.jsx("textarea",{value:c.body,onChange:g=>b("body",g.target.value),rows:9,placeholder:"Definitions, exclusions, edge cases — written for the agent.",style:en(o)})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:se(o),children:"Prefer these assets"}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Metrics"}),e.jsx(ze,{t:o,options:n.metrics,optionKind:"metrics",selected:c.preferredMetrics,onChange:g=>b("preferredMetrics",g),placeholder:"Search metrics…",emptyOptionsHint:"No metrics available from the project yet."})]}),e.jsxs("label",{style:Q,children:[e.jsx("span",{style:K(o),children:"Blocks"}),e.jsx(ze,{t:o,options:n.blocks,optionKind:"blocks",selected:c.preferredBlocks,onChange:g=>b("preferredBlocks",g),placeholder:"Search blocks…",emptyOptionsHint:"No blocks available from the project yet."})]})]}),e.jsxs("details",{style:{gridColumn:"1 / -1"},children:[e.jsx("summary",{style:{fontSize:11.5,fontWeight:650,color:o.accent,cursor:"pointer"},children:"Advanced — model areas, dimensions, and vocabulary"}),e.jsxs("div",{style:{display:"grid",gap:14,marginTop:12},children:[e.jsx(he,{label:"Focused model areas (optional)",t:o,hint:"Comma-separated area ids from the Model workspace. This boosts the skill only inside its selected domain; it never expands access.",children:e.jsx(xe,{values:c.modelAreaRefs??[],onChange:g=>b("modelAreaRefs",g),placeholder:"customer_lifecycle, revenue_reporting",style:q(o)})}),e.jsx(he,{label:"Preferred dimensions",t:o,hint:"Business-safe dimensions the agent should prefer when they are compatible.",children:e.jsx(xe,{values:c.preferredDimensions??[],onChange:g=>b("preferredDimensions",g),placeholder:"region, month",style:q(o)})}),e.jsx(he,{label:"Qualified models and relationships",t:o,hint:"Optional canonical IDs from Modeling. Validated references create guided_by edges; legacy free text cannot authorize joins.",children:e.jsx(ze,{t:o,options:n.modelingRefs,optionKind:"modelingRefs",selected:c.sourceRefs??[],onChange:g=>b("sourceRefs",g),placeholder:"Search qualified models and relationships…",emptyOptionsHint:"No governed Modeling references are available yet."})}),e.jsx(he,{label:"Vocabulary",t:o,hint:"Map your terms to a target, e.g. arr → metric:arr or revenue → block:revenue_by_region.",children:e.jsx(Ut,{t:o,value:c.vocabulary,onChange:g=>b("vocabulary",g)})})]})]}),f?e.jsx("div",{style:{gridColumn:"1 / -1"},children:e.jsx(me,{t:o,tone:"error",children:f})}):null]}),e.jsxs("div",{style:on(),children:[e.jsx("span",{style:{fontSize:10.5,color:o.textMuted,flex:1,textAlign:"left"},children:"Saved to Git — review in source control before merging."}),e.jsx("button",{type:"button",onClick:()=>!T&&r(),style:J(o),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:k,disabled:!N,style:{...be(o),opacity:N?1:.55},children:[T?e.jsx(F,{size:13,strokeWidth:2}):null,T?"Saving…":w?"Save changes":"Create skill"]})]})]})})}function Kt({t,values:n,onChange:s,placeholder:i}){const[l,a]=d.useState(""),o=r=>{const p=r.trim().replace(/,$/,"");!p||n.includes(p)||(s([...n,p]),a(""))};return e.jsxs("div",{style:Ze(t),children:[n.map(r=>e.jsxs("span",{style:tt(t),children:[r,e.jsx("button",{type:"button",onClick:()=>s(n.filter(p=>p!==r)),style:nt(t),title:"Remove",children:"×"})]},r)),e.jsx("input",{type:"text",value:l,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"||r.key===","?(r.preventDefault(),o(l)):r.key==="Backspace"&&!l&&n.length&&s(n.slice(0,-1))},onBlur:()=>o(l),placeholder:n.length?"":i,style:et(t)})]})}function ze({t,options:n,optionKind:s,selected:i,onChange:l,placeholder:a,emptyOptionsHint:o}){const[r,p]=d.useState(""),[S,w]=d.useState(n);d.useEffect(()=>{let j=!1;const h=window.setTimeout(()=>{M.getSkillOptions(r).then(u=>{j||w(s==="metrics"?u.metrics:s==="blocks"?u.blocks:u.modelingRefs)}).catch(()=>{j||w(n)})},160);return()=>{j=!0,window.clearTimeout(h)}},[s,n,r]);const c=d.useMemo(()=>S.filter(j=>!i.includes(j)).filter(j=>r?j.toLowerCase().includes(r.toLowerCase()):!0).slice(0,8),[S,i,r]),z=j=>{const h=j.trim();!h||i.includes(h)||(l([...i,h]),p(""))};return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsxs("div",{style:Ze(t),children:[i.map(j=>e.jsxs("span",{style:{...tt(t),fontFamily:t.fontMono},children:[j,e.jsx("button",{type:"button",onClick:()=>l(i.filter(h=>h!==j)),style:nt(t),title:"Remove",children:"×"})]},j)),e.jsx("input",{type:"text",value:r,onChange:j=>p(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),z(r))},placeholder:i.length?"":a,style:et(t)})]}),c.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:c.map(j=>e.jsxs("button",{type:"button",onClick:()=>z(j),style:tn(t),children:[e.jsx(ne,{size:10,strokeWidth:2.4})," ",j]},j))}):S.length===0?e.jsxs("div",{style:{fontSize:11,color:t.textMuted},children:[o," You can still type a value and press Enter."]}):null]})}function Ut({t,value:n,onChange:s}){const[i,l]=d.useState(()=>Object.entries(n??{}).map(([r,p])=>({term:r,target:p}))),a=r=>{l(r);const p={};for(const S of r){const w=S.term.trim();w&&(p[w]=S.target.trim())}s(p)},o=(r,p)=>{a(i.map((S,w)=>w===r?{...S,...p}:S))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[i.map((r,p)=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{type:"text",value:r.term,onChange:S=>o(p,{term:S.target.value}),placeholder:"arr",style:{...q(t),flex:1}}),e.jsx("span",{style:{color:t.textMuted,fontSize:13},children:"→"}),e.jsx("input",{type:"text",value:r.target,onChange:S=>o(p,{target:S.target.value}),placeholder:"metric:arr",style:{...q(t),flex:1.3,fontFamily:t.fontMono}}),e.jsx("button",{type:"button",onClick:()=>a(i.filter((S,w)=>w!==p)),style:je(t),title:"Remove row",children:e.jsx(ue,{size:13,strokeWidth:2})})]},p)),e.jsxs("button",{type:"button",onClick:()=>l([...i,{term:"",target:""}]),style:{...J(t),justifySelf:"start"},children:[e.jsx(ne,{size:12,strokeWidth:2.2})," Add term"]})]})}function Qt({t,onAdd:n}){return e.jsxs("div",{style:{border:`1px dashed ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:"34px 28px",textAlign:"center",display:"grid",gap:12,justifyItems:"center"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:`${t.accent}18`,color:t.accent,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(le,{size:22,strokeWidth:1.9})}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:t.textPrimary},children:"Teach the AI your business rules"}),e.jsx("div",{style:{fontSize:13,color:t.textMuted,maxWidth:460,lineHeight:1.55},children:'Skills are the definitions, rules, and vocabulary the AI follows when it answers — like "revenue = recognized, not bookings" or "always exclude test accounts." Add your first one to start guiding every answer.'}),e.jsxs("button",{type:"button",onClick:n,style:{...be(t),marginTop:4},children:[e.jsx(ne,{size:14,strokeWidth:2.2})," Add your first skill"]})]})}function Vt({t,message:n,onRetry:s}){return e.jsxs("div",{style:{border:`1px solid ${t.warning}55`,borderRadius:10,background:`${t.warning}12`,padding:"16px 18px",display:"flex",alignItems:"flex-start",gap:11},children:[e.jsx(Te,{size:16,strokeWidth:2,color:t.warning,style:{marginTop:1,flexShrink:0}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:650,color:t.textPrimary},children:"Skills are not available right now"}),e.jsx("div",{style:{fontSize:12.5,color:t.textSecondary,marginTop:4,lineHeight:1.5},children:n}),e.jsxs("button",{type:"button",onClick:s,style:{...J(t),marginTop:10},children:[e.jsx(pe,{size:13,strokeWidth:2})," Retry"]})]})]})}function Jt({skill:t,t:n,deleting:s,error:i,onCancel:l,onConfirm:a}){return e.jsx("div",{style:ln,onClick:l,children:e.jsxs("div",{style:an(n),onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(re,{size:16,strokeWidth:2,color:n.error}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:n.textPrimary},children:"Delete this skill?"})]}),e.jsxs("div",{style:{fontSize:13,color:n.textSecondary,lineHeight:1.55},children:[e.jsx("span",{style:{fontFamily:n.fontMono,color:n.textPrimary},children:t.id})," will be removed and the AI will stop following it. This can't be undone."]}),i?e.jsx(me,{t:n,tone:"error",children:i}):null,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:l,disabled:s,style:J(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:a,disabled:s,style:{...Zt(n),opacity:s?.6:1},children:[s?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(re,{size:13,strokeWidth:2}),s?"Deleting…":"Delete"]})]})]})})}function se(t){return{fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:t.textMuted,marginBottom:5}}function Z({t,label:n,values:s,empty:i,accent:l=!1,mono:a=!1}){return e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:se(t),children:n}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:s!=null&&s.length?s.map(o=>e.jsx("span",{style:{fontSize:11,padding:"3px 9px",borderRadius:999,background:l?"var(--accent-dim)":"var(--bg-1)",color:l?t.accent:t.textSecondary,border:l?`1px solid ${t.accent}33`:"1px solid var(--border-subtle)",fontFamily:a?t.fontMono:void 0},children:o},o)):e.jsx("span",{style:{fontSize:11.5,color:t.textMuted,fontStyle:"italic"},children:i})})]})}function he({label:t,hint:n,t:s,children:i}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:s.textPrimary},children:t}),n?e.jsx("div",{style:{fontSize:11.5,color:s.textMuted,lineHeight:1.45,marginTop:-2},children:n}):null,i]})}function me({t,tone:n,children:s}){const i=n==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:i,lineHeight:1.45},children:s})}function Yt(t){return{display:"inline-flex",alignItems:"center",fontSize:10.5,fontWeight:700,color:t.success,background:`${t.success}14`,border:`1px solid ${t.success}38`,borderRadius:999,padding:"2px 7px"}}function Xt(t){return{display:"inline-flex",alignItems:"center",fontSize:10.5,fontWeight:700,color:t.accent,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:999,padding:"2px 7px"}}function be(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function J(t){return{display:"inline-flex",alignItems:"center",gap:5,padding:"7px 11px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontSize:12,fontWeight:600,fontFamily:t.font,cursor:"pointer"}}function Zt(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.error}`,background:t.error,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function je(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,cursor:"pointer",flexShrink:0}}function q(t){return{width:"100%",border:`1px solid ${t.btnBorder}`,borderRadius:7,background:t.cellBg,color:t.textPrimary,fontSize:12.5,fontFamily:t.font,padding:"8px 10px",boxSizing:"border-box"}}function en(t){return{...q(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function Ge(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,fontWeight:700,letterSpacing:"0.02em",color:t.warning,background:`${t.warning}16`,border:`1px solid ${t.warning}40`,borderRadius:999,padding:"2px 8px"}}function Ze(t){return{display:"flex",alignItems:"center",gap:5,flexWrap:"wrap",border:`1px solid ${t.btnBorder}`,background:t.cellBg,borderRadius:7,padding:"6px 8px"}}function et(t){return{flex:1,minWidth:110,border:"none",background:"none",outline:"none",fontSize:11.5,fontFamily:t.font,color:t.textPrimary,padding:2}}function tt(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,padding:"2.5px 8px",borderRadius:999,background:"var(--accent-dim)",color:t.accent,border:`1px solid ${t.accent}33`}}function nt(t){return{border:"none",background:"none",color:t.accent,cursor:"pointer",padding:0,fontSize:12,lineHeight:1,fontFamily:t.font}}const Q={display:"flex",flexDirection:"column",gap:4};function K(t){return{fontSize:11,fontWeight:650,color:t.textSecondary}}function tn(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,fontWeight:600,color:t.textSecondary,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px",cursor:"pointer",fontFamily:t.fontMono}}const nn={position:"fixed",inset:0,background:"rgba(26, 26, 26, 0.22)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60};function sn(t){return{width:"min(860px, 94vw)",height:"min(640px, 90vh)",background:t.cellBg,border:`1px solid ${t.headerBorder}`,borderRadius:14,display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 70px rgba(26,26,26,0.22)"}}function rn(t){return{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle)",flexShrink:0}}function on(t){return{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 18px",borderTop:"1px solid var(--border-subtle)",background:"var(--bg-1)",flexShrink:0}}const ln={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function an(t){return{width:"min(420px, 100%)",background:t.cellBg,border:`1px solid ${t.cellBorder}`,borderRadius:12,padding:20,display:"grid",gap:13,boxShadow:"0 18px 48px rgba(0,0,0,0.3)"}}function dn({initialTab:t="overview"}){const{state:n}=ve(),s=ke[n.themeMode],[i,l]=d.useState(t),[a,o]=d.useState([]),[r,p]=d.useState([]),[S,w]=d.useState(!0);d.useEffect(()=>l(t),[t]);const c=d.useCallback(()=>{let u=!1;return w(!0),Promise.all([M.getDomains(),M.getSkills()]).then(([D,T])=>{u||(o(Array.isArray(D.domains)?D.domains:[]),p(Array.isArray(T.skills)?T.skills:[]))}).catch(()=>{u||(o([]),p([]))}).finally(()=>{u||w(!1)}),()=>{u=!0}},[]);d.useEffect(()=>c(),[c]);const z=d.useMemo(()=>{const u=a.filter(v=>!!(v.businessOwner||v.owner)).length,D=r.filter(v=>!v.status||v.status==="active").length,T=r.filter(v=>v.status==="draft").length;return{ownedDomains:u,activeSkills:D,draftSkills:T}},[a,r]),j=d.useCallback(()=>{l("domains"),window.setTimeout(()=>window.dispatchEvent(new Event("dql:context-build")),50)},[]),h=[{id:"overview",label:"Overview"},{id:"domains",label:"Domains",count:a.length},{id:"skills",label:"Skills",count:r.length},{id:"knowledge",label:"Knowledge 360"}];return e.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto",background:s.appBg},children:e.jsxs("div",{style:{maxWidth:1040,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:18,marginBottom:15},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center"},children:[e.jsx(oe,{size:20,color:s.accent}),e.jsx("h1",{style:{fontSize:22,color:s.textPrimary},children:"Governed context"})]}),e.jsx("p",{style:{marginTop:6,fontSize:13,lineHeight:1.5,color:s.textMuted,maxWidth:700},children:"Domains define business boundaries. Skills teach the agent approved vocabulary, reuse rules, and when to ask for clarification."})]}),e.jsxs("button",{type:"button",onClick:j,style:st(s),children:[e.jsx(te,{size:14})," Build with AI"]})]}),e.jsx("nav",{"aria-label":"Governed context sections",style:{display:"flex",gap:3,borderBottom:`1px solid ${s.headerBorder}`,marginBottom:18},children:h.map(u=>e.jsxs("button",{type:"button",onClick:()=>l(u.id),style:{border:"none",borderBottom:`2px solid ${i===u.id?s.accent:"transparent"}`,background:"transparent",padding:"9px 12px",color:i===u.id?s.textPrimary:s.textMuted,fontWeight:i===u.id?700:600,cursor:"pointer",fontFamily:s.font,fontSize:12.5},children:[u.label,u.count!==void 0?` · ${u.count}`:""]},u.id))}),i==="overview"?e.jsx(cn,{t:s,loading:S,domains:a,skills:r,status:z,onBuild:j,onTab:l}):null,i==="domains"?e.jsx(yt,{embedded:!0}):null,i==="skills"?e.jsx(Lt,{embedded:!0}):null,i==="knowledge"?e.jsx(it,{t:s,domains:a}):null]})})}function it({t,domains:n,initialDomainId:s}){var z,j;const[i,l]=d.useState(s??((z=n[0])==null?void 0:z.id)??""),[a,o]=d.useState(null),[r,p]=d.useState(!1),[S,w]=d.useState(null);d.useEffect(()=>{var h;!i&&((h=n[0])!=null&&h.id)&&l(n[0].id)},[i,n]),d.useEffect(()=>{s&&n.some(h=>h.id===s)&&l(s)},[n,s]),d.useEffect(()=>{if(!i){o(null);return}let h=!1;return p(!0),w(null),M.getDomainKnowledge(i).then(u=>{h||o(u)}).catch(u=>{h||(o(null),w(u instanceof Error?u.message:"Could not load the compiled knowledge capsule."))}).finally(()=>{h||p(!1)}),()=>{h=!0}},[i]);const c=d.useMemo(()=>{const h={};for(const u of(a==null?void 0:a.objects)??[])h[u.kind]=(h[u.kind]??0)+1;return Object.entries(h).sort((u,D)=>D[1]-u[1]||u[0].localeCompare(D[0]))},[a]);return e.jsxs("div",{style:{display:"grid",gap:14},children:[e.jsx("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:15},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",color:t.textPrimary,fontWeight:700,fontSize:13},children:[e.jsx(Oe,{size:16,color:t.accent})," Compiled Domain 360"]}),e.jsx("div",{style:{marginTop:4,color:t.textMuted,fontSize:12},children:"The same qualified graph, route policy, and skill snapshot used by Ask."})]}),e.jsxs("select",{"aria-label":"Domain knowledge capsule",value:i,onChange:h=>l(h.target.value),style:{minWidth:210,border:`1px solid ${t.inputBorder}`,borderRadius:7,background:t.inputBg,color:t.textPrimary,padding:"7px 9px",fontFamily:t.font},children:[e.jsx("option",{value:"",children:"Select a domain"}),[...n].sort((h,u)=>h.name.localeCompare(u.name)).map(h=>e.jsx("option",{value:h.id,children:h.name},h.id))]})]})}),r?e.jsxs("div",{style:{color:t.textMuted,display:"flex",gap:8,alignItems:"center",padding:24},children:[e.jsx(F,{size:15})," Loading compiled knowledge…"]}):null,S?e.jsx("div",{style:{border:`1px solid ${t.error}`,background:t.cellBg,color:t.error,borderRadius:8,padding:12,fontSize:12.5},children:S}):null,a?e.jsxs(e.Fragment,{children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:9},children:[e.jsx(ee,{t,label:"Objects",value:a.counts.objects,detail:"qualified knowledge",icon:e.jsx(oe,{size:16})}),e.jsx(ee,{t,label:"Relations",value:a.counts.edges,detail:"provenance + policy",icon:e.jsx(Oe,{size:16})}),e.jsx(ee,{t,label:"Authorized",value:a.counts.routeStates.authorized??0,detail:"safe cross-domain routes",icon:e.jsx(Be,{size:16})}),e.jsx(ee,{t,label:"Blocked / stale",value:(a.counts.routeStates.blocked??0)+(a.counts.routeStates.stale??0),detail:"never auto-joined",icon:e.jsx(Je,{size:16})})]}),e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Knowledge capsule"}),e.jsx("p",{style:{color:t.textSecondary,fontSize:12.5,lineHeight:1.5,margin:"7px 0 11px"},children:((j=a.capsule)==null?void 0:j.description)||"Compiled domain boundary and governed references."}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:c.map(([h,u])=>e.jsxs("span",{style:{border:`1px solid ${t.cellBorder}`,background:t.pillBg,color:t.textSecondary,borderRadius:999,padding:"3px 7px",fontSize:11},children:[h.replace(/_/g," ")," · ",u]},h))}),e.jsxs("div",{style:{marginTop:11,color:t.textMuted,fontSize:11},children:["Snapshot ",a.snapshotId.slice(0,12)," · graph ",a.sourceFingerprint.slice(0,12),a.truncated?" · bounded response":""]})]}),e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Cross-domain routes"}),e.jsx("div",{style:{display:"grid",gap:7,marginTop:9},children:a.routes.length?a.routes.map(h=>e.jsxs("div",{style:{borderTop:`1px solid ${t.headerBorder}`,paddingTop:7},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,color:t.textSecondary,fontSize:12},children:[e.jsxs("span",{children:[h.providerDomainId," → ",h.consumerDomainId]}),e.jsx("span",{style:{color:h.state==="authorized"?t.success:h.state==="observed"?t.textMuted:t.warning,fontWeight:700},children:h.state})]}),e.jsx("div",{style:{marginTop:3,color:t.textMuted,fontSize:11},children:h.purpose||h.reasonCodes.join(", ")||"governed route"})]},h.id)):e.jsx("div",{style:{color:t.textMuted,fontSize:12,marginTop:8},children:"No cross-domain routes declared."})})]})]})]}):null]})}function cn({t,loading:n,domains:s,skills:i,status:l,onBuild:a,onTab:o}){if(n)return e.jsxs("div",{style:{padding:"42px 0",color:t.textMuted,display:"flex",gap:8,alignItems:"center",fontSize:13},children:[e.jsx(F,{size:15})," Loading governed context…"]});const r=[];return s.length?l.ownedDomains<s.length&&r.push(`${s.length-l.ownedDomains} domain${s.length-l.ownedDomains===1?"":"s"} still need an owner.`):r.push("Create a business domain before relying on AI guidance."),i.length||r.push("Draft a domain skill so the agent has governed business guidance."),l.draftSkills&&r.push(`${l.draftSkills} skill${l.draftSkills===1?" is":"s are"} still draft-only and will not guide answers.`),e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(ee,{t,label:"Domains",value:s.length,detail:`${l.ownedDomains} with an owner`,icon:e.jsx(oe,{size:17})}),e.jsx(ee,{t,label:"Active skills",value:l.activeSkills,detail:"available to the agent",icon:e.jsx(le,{size:17})}),e.jsx(ee,{t,label:"Draft skills",value:l.draftSkills,detail:"review before activation",icon:e.jsx(te,{size:17})})]}),e.jsxs("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:16,display:"grid",gap:10},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(Ve,{size:16,color:r.length?t.warning:t.success}),e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Readiness"})]}),r.length?e.jsx("div",{style:{display:"grid",gap:6},children:r.map(p=>e.jsxs("div",{style:{display:"flex",gap:7,color:t.textSecondary,fontSize:12.5},children:[e.jsx(Je,{size:14,color:t.warning}),p]},p))}):e.jsx("div",{style:{color:t.success,fontSize:12.5},children:"Your agent has owned domains and active governed skills available for retrieval."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:2},children:[e.jsxs("button",{type:"button",onClick:a,style:st(t),children:[e.jsx(te,{size:13})," Build domains & skills with AI"]}),e.jsx("button",{type:"button",onClick:()=>o("domains"),style:Ke(t),children:"Manage domains"}),e.jsx("button",{type:"button",onClick:()=>o("skills"),style:Ke(t),children:"Manage skills"})]})]})]})}function ee({t,label:n,value:s,detail:i,icon:l}){return e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:13},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:t.textMuted,fontSize:12},children:[n,l]}),e.jsx("div",{style:{color:t.textPrimary,fontSize:25,fontWeight:750,marginTop:7},children:s}),e.jsx("div",{style:{color:t.textMuted,fontSize:11.5,marginTop:3},children:i})]})}function st(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 12px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#fff",fontWeight:700,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}function Ke(t){return{display:"inline-flex",alignItems:"center",padding:"7px 12px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontWeight:650,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}const yn=Object.freeze(Object.defineProperty({__proto__:null,GovernedContextPage:dn,Knowledge360:it},Symbol.toStringTag,{value:"Module"}));export{Et as C,yn as G,it as K,Lt as S};
|
package/dist/assets/dql-notebook/assets/{HelpDocsPage-BDPNVot1.js → HelpDocsPage-DMHPsVqP.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as k,u as z,t as R,r as u,j as e,aC as I}from"./index-
|
|
1
|
+
import{c as k,u as z,t as R,r as u,j as e,aC as I}from"./index-Cpx47jCH.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ot,r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as rt,b as Je,d as st,e as at,L as lt,f as dt,G as Ne,D as be,N as ct,g as pt}from"./index-
|
|
1
|
+
import{c as ot,r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as rt,b as Je,d as st,e as at,L as lt,f as dt,G as Ne,D as be,N as ct,g as pt}from"./index-Cpx47jCH.js";import{T as xt}from"./TrustBadge-ZuD5N5Ww.js";import{A as he}from"./arrow-right-WIF1V9a9.js";import{T as Ke}from"./triangle-alert-SyuSZ4ht.js";import{B as Ee}from"./book-open-text-BpqWMa4m.js";import{W as ut}from"./workflow-NtRLaq7n.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as Se,i as je,k as Ce,t as Re,r as a,aw as O,a as pe,ax as Ee,ay as Le,az as Te,aA as Be,j as e,p as E,au as H,aB as Ie,l as ge}from"./index-1mIC_XX4.js";import{u as ze,a as We,M as Me,i as Fe,B as Ne,C as Pe,b as Oe,P as De,T as he,c as P,H as xe}from"./dagre.esm-GKp7qoUL.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Ee},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Le},{key:"end-to-end",label:"End-to-end",title:"Complete path from physical sources through governed meaning to consumption",types:O}],Y=[{type:"block",label:"Blocks"},{type:"app",label:"Apps"},{type:"notebook",label:"Notebooks"},{type:"dashboard",label:"Dashboards"}];function $e(n,h,o="flow",g="LR"){var v;const p=new he.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b=g==="LR";p.setGraph({rankdir:g,ranksep:o==="layered"?120:b?80:60,nodesep:b?40:50,marginx:32,marginy:32});for(const d of n){const y={width:190,height:58};if(o==="layered"&&((v=d.data)!=null&&v.layer)){const x=Ie.indexOf(d.data.layer);x>=0&&(y.rank=x)}p.setNode(d.id,y)}for(const d of h)p.setEdge(d.source,d.target);return he.layout(p),n.map(d=>{const y=p.node(d.id);return{...d,position:{x:y.x-95,y:y.y-29},data:{...d.data,direction:g}}})}function _e({data:n,selected:h}){const o=n.nodeType,g=E[o]??"var(--color-text-tertiary)",p=n.direction??"LR",b=p==="LR"?P.Left:P.Top,v=p==="LR"?P.Right:P.Bottom,d=!!n.dimmed,y=n.status==="certified";return e.jsxs("div",{style:{width:196,display:"flex",alignItems:"center",gap:8,background:"var(--color-bg-card)",border:`1.5px solid ${h?"var(--accent)":"var(--border-default)"}`,borderRadius:9,padding:"9px 11px",boxShadow:h?"0 1px 6px rgba(107,93,211,0.16)":"0 1px 4px rgba(26,26,26,0.05)",opacity:d?.3:1,transition:"opacity 0.15s ease"},children:[e.jsx(xe,{type:"target",position:b,style:{width:7,height:7,background:g,border:"none"}}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:g,flexShrink:0}}),e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{title:n.label,style:{fontSize:11.5,fontWeight:650,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:g},children:H[o]??o})]}),y?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null,e.jsx(xe,{type:"source",position:v,style:{width:7,height:7,background:g,border:"none"}})]})}const Ae={dagNode:_e};function Qe(){var ae,le,de;const n=Se(je(t=>({lineageFocusNodeId:t.lineageFocusNodeId,themeMode:t.themeMode}))),h=Ce(),o=Re[n.themeMode],[g,p]=a.useState(!0),[b,v]=a.useState({nodes:[],edges:[]}),[d,y]=a.useState({nodes:[],edges:[]}),[x,w]=a.useState(null),[c,L]=a.useState(null),[W,T]=a.useState(!1),[l,s]=a.useState(null),[f,j]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,M]=a.useState(null),[D,F]=a.useState(!1),[V,q]=a.useState("block"),[U,K]=a.useState(""),[X,N]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=ze([]),[be,oe,me]=We([]),re=a.useCallback(async()=>{p(!0);try{const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]})}finally{p(!1)}},[]);a.useEffect(()=>{re()},[re]);const R=a.useMemo(()=>b.nodes.filter(t=>Y.some(r=>r.type===t.type)).sort((t,r)=>t.name.localeCompare(r.name)),[b.nodes]),I=a.useCallback(async t=>{L(t),F(!1),M(null),s(null),T(!0);try{const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null)}finally{T(!1)}},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),M(null),F(!1),h({type:"SET_LINEAGE_FOCUS",nodeId:null})},[h]),a.useEffect(()=>{n.lineageFocusNodeId&&n.lineageFocusNodeId!==c&&I(n.lineageFocusNodeId)},[n.lineageFocusNodeId]);const m=a.useMemo(()=>{const t=new Set(d.nodes.filter(r=>f[r.type]??!0).map(r=>r.id));return{nodes:d.nodes.filter(r=>t.has(r.id)),edges:d.edges.filter(r=>t.has(r.source)&&t.has(r.target))}},[d,f]),z=a.useMemo(()=>{for(const t of G){const r=new Set(t.types);if(O.every(u=>(f[u]??!0)===r.has(u)))return t.key}return"custom"},[f]),ve=a.useCallback(t=>{const r=new Set(t);j(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),S=a.useMemo(()=>{if(!B)return null;const t=new Set([B]),r=new Set([B]);let i=!0;for(;i;){i=!1;for(const u of m.edges)t.has(u.target)&&!t.has(u.source)&&(t.add(u.source),i=!0),r.has(u.source)&&!r.has(u.target)&&(r.add(u.target),i=!0)}return new Set([...t,...r])},[B,m.edges]);a.useEffect(()=>{const t=m.nodes.map(i=>({id:i.id,type:"dagNode",selected:i.id===c,position:{x:0,y:0},data:{label:i.name,nodeType:i.type,domain:i.domain,status:i.status,layer:Te(i),dimmed:S?!S.has(i.id):!1}})),r=m.edges.map((i,u)=>{const A=S?S.has(i.source)&&S.has(i.target):!1,ce=A?"var(--accent)":Be[i.type]??"var(--color-text-tertiary)";return{id:`edge-${u}-${i.source}-${i.target}-${i.type}`,source:i.source,target:i.target,style:{stroke:ce,strokeWidth:A?2:1.5,opacity:S&&!A?.25:1},markerEnd:{type:Me.ArrowClosed,color:ce,width:12,height:12}}});te($e(t,r,k,C)),oe(r)},[m,k,C,S,c,oe,te]);const ke=a.useCallback((t,r)=>{M(r.id);const i=m.nodes.find(u=>u.id===r.id)??null;s(i)},[m.nodes]),$=a.useCallback(()=>{M(null),s(null)},[]),_=a.useMemo(()=>{if(!l)return null;const t=d.edges.filter(i=>i.target===l.id).length,r=d.edges.filter(i=>i.source===l.id).length;return{incoming:t,outgoing:r}},[d.edges,l]),ne=(x==null?void 0:x.name)??((ae=R.find(t=>t.id===c))==null?void 0:ae.name)??c??"",we=(x==null?void 0:x.type)??((le=R.find(t=>t.id===c))==null?void 0:le.type)??"block",ie=Z.trim().toLowerCase(),se=(ie?R.filter(t=>t.name.toLowerCase().includes(ie)):R).slice(0,40);return g?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"Loading lineage graph..."}):b.nodes.length===0?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"No lineage graph available yet."}):c?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)"},children:[e.jsx("div",{style:{padding:8,borderBottom:`1px solid ${o.headerBorder}`,background:o.sidebarBg},children:e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>F(t=>!t),title:"Change the traced entity",style:{display:"inline-flex",alignItems:"center",gap:7,height:30,padding:"0 11px",borderRadius:8,border:`1px solid ${D?o.accent:o.headerBorder}`,background:D?"var(--accent-dim)":o.cellBg,color:o.textPrimary,cursor:"pointer",fontFamily:o.font,maxWidth:320},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted},children:"Tracing"}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[we]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:650,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne}),e.jsx("span",{style:{fontSize:9,color:o.textMuted},children:"▾"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>F(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:340,background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:12},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:240})})]})]}),e.jsxs("div",{style:{position:"relative",flex:"0 1 300px",minWidth:160},children:[e.jsxs("svg",{style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:o.textMuted,pointerEvents:"none"},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]}),e.jsx("input",{value:Z,onChange:t=>{ee(t.target.value),N(!0)},onFocus:()=>N(!0),placeholder:"Search another block, app, or notebook…",style:{width:"100%",boxSizing:"border-box",height:30,padding:"0 10px 0 28px",borderRadius:8,border:`1px solid ${X?o.accent:o.headerBorder}`,background:"var(--color-bg-sunken)",color:o.textPrimary,fontSize:12,fontFamily:o.font,outline:"none"}}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:"min(340px, 90vw)",maxHeight:300,overflow:"auto",background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:4},children:se.length===0?e.jsx("div",{style:{padding:"12px 11px",fontSize:12,color:o.textMuted,fontFamily:o.font},children:"No matching block, app, or notebook."}):se.map(t=>e.jsxs("button",{onClick:()=>{I(t.id),ee(""),N(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"8px 10px",border:"none",borderRadius:7,background:t.id===c?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:o.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[t.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:550,color:o.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted,flexShrink:0},children:H[t.type]??t.type})]},t.id))})]})]}),e.jsx("div",{style:{width:1,height:20,background:o.headerBorder,margin:"0 2px"}}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>Q("flow"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:k==="flow"?"var(--color-bg-tertiary)":"transparent",color:k==="flow"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Flow"}),e.jsx("button",{onClick:()=>Q("layered"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:k==="layered"?"var(--color-bg-tertiary)":"transparent",color:k==="layered"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Layered"})]}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden",marginRight:4},children:[e.jsxs("button",{title:"Horizontal layout (left → right)",onClick:()=>J("LR"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:C==="LR"?"var(--color-bg-tertiary)":"transparent",color:C==="LR"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",children:[e.jsx("rect",{x:"0",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M9 3l2 2-2 2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor"})]}),"LR"]}),e.jsxs("button",{title:"Vertical layout (top → bottom)",onClick:()=>J("TB"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:C==="TB"?"var(--color-bg-tertiary)":"transparent",color:C==="TB"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",children:[e.jsx("rect",{x:"2",y:"0",width:"6",height:"4",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"5",y1:"4",x2:"5",y2:"10",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M3 9l2 2 2-2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"2",y:"10",width:"6",height:"4",rx:"1",fill:"currentColor"})]}),"TB"]})]}),e.jsx("div",{role:"group","aria-label":"Lineage view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.headerBorder}`,borderRadius:7,background:o.appBg,marginRight:4},children:G.map(t=>e.jsx("button",{onClick:()=>ve(t.types),title:t.title,"aria-pressed":z===t.key,style:{padding:"4px 11px",fontSize:11.5,fontWeight:600,border:"none",borderRadius:5,cursor:"pointer",fontFamily:o.font,whiteSpace:"nowrap",background:z===t.key?"var(--accent-dim)":"transparent",color:z===t.key?o.accent:o.textMuted},children:t.label},t.key))}),B&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:$,style:{borderRadius:7,border:`1px solid ${o.accent}`,background:"var(--accent-dim)",color:o.accent,cursor:"pointer",fontSize:11.5,fontWeight:650,padding:"5px 11px",whiteSpace:"nowrap"},children:"Show all"})]})]})}),e.jsx("div",{style:{flex:1,position:"relative"},children:e.jsxs(Fe,{nodes:ye,edges:be,onNodesChange:fe,onEdgesChange:me,onNodeClick:ke,onPaneClick:$,nodeTypes:Ae,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Ne,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Pe,{showInteractive:!1}),e.jsx(Oe,{nodeColor:t=>{var r;return E[((r=t.data)==null?void 0:r.nodeType)??"source_table"]??"var(--color-text-tertiary)"},maskColor:"color-mix(in srgb, var(--color-bg-primary) 55%, transparent)",style:{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-primary)"}}),e.jsx(De,{position:"bottom-left",children:l?e.jsxs("div",{style:{width:264,background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",borderRadius:11,boxShadow:"0 8px 26px rgba(26,26,26,0.13)",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[l.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:700,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),e.jsx("button",{onClick:$,title:"Clear focus",style:{width:20,height:20,borderRadius:5,border:"none",background:"none",color:"var(--color-text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,flexShrink:0},children:"×"})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginTop:3},children:[H[l.type]??l.type,_?` · ${_.incoming} upstream · ${_.outgoing} downstream`:""]}),l.domain?e.jsxs("div",{style:{fontSize:11.5,color:"var(--color-text-secondary)",lineHeight:1.5,marginTop:7},children:["Domain: ",l.domain]}):null,e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{onClick:()=>{l&&l.id!==c&&I(l.id)},disabled:!l||l.id===c,title:(l==null?void 0:l.id)===c?"Already the traced entity":"Re-scope lineage to this node",style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"none",background:"var(--accent)",color:"#fff",fontSize:11,fontWeight:650,cursor:(l==null?void 0:l.id)===c?"default":"pointer",opacity:(l==null?void 0:l.id)===c?.5:1},children:"Trace from here"}),e.jsx("button",{onClick:()=>h({type:"OPEN_GLOBAL_AI",autoRun:{text:`Explain the lineage of ${l.name} — where does it come from and what consumes it?`}}),style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"1px solid var(--color-border-primary)",background:"var(--color-bg-card)",color:"var(--color-text-secondary)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Ask about this"})]})]}):null})]})}),e.jsxs("div",{style:{height:28,flexShrink:0,borderTop:"1px solid var(--border-subtle)",background:"var(--color-bg-card)",display:"flex",alignItems:"center",gap:14,padding:"0 14px",fontSize:10.5,color:"var(--color-text-tertiary)"},children:[e.jsxs("span",{children:[z==="custom"?"Custom":(de=G.find(t=>t.key===z))==null?void 0:de.label," lineage of ",ne," · ",m.nodes.length," nodes · ",m.edges.length," edges",W?" · loading…":""]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:"var(--status-success)"}}),"Compiled from the dbt manifest"]}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{children:"Click a node to focus its path · click the canvas to clear"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)",alignItems:"center",justifyContent:"center",padding:24,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(560px, 100%)",border:`1px solid ${o.headerBorder}`,borderRadius:14,background:o.cellBg,padding:"22px 22px 18px",boxShadow:"0 1px 4px rgba(26,26,26,0.05)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:o.textPrimary,fontFamily:o.font},children:"Trace lineage"}),e.jsx("div",{style:{fontSize:12.5,color:o.textMuted,marginTop:3,lineHeight:1.5,fontFamily:o.font},children:"Pick a block, app, or notebook to see its upstream sources and downstream consumers — no project-wide noise."}),e.jsx("div",{style:{marginTop:16},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:300})})]})})}function ue({t:n,entities:h,activeType:o,onTypeChange:g,query:p,onQueryChange:b,onSelect:v,focalId:d,listHeight:y}){var T,l;const x=Y.filter(s=>h.some(f=>f.type===s.type)),w=x.some(s=>s.type===o)?o:((T=x[0])==null?void 0:T.type)??o,c=p.trim().toLowerCase(),L=h.filter(s=>s.type===w).filter(s=>!c||s.name.toLowerCase().includes(c)),W=((l=Y.find(s=>s.type===w))==null?void 0:l.label)??"items";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${n.headerBorder}`,borderRadius:8,background:n.appBg,alignSelf:"flex-start",flexWrap:"wrap"},children:x.map(s=>{const f=s.type===w,j=h.filter(k=>k.type===s.type).length;return e.jsxs("button",{onClick:()=>g(s.type),style:{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:6,padding:"5px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:n.font,background:f?"var(--accent-dim)":"transparent",color:f?n.accent:n.textMuted},children:[s.label,e.jsx("span",{style:{fontSize:10.5,color:f?n.accent:n.textMuted,opacity:.8},children:j})]},s.type)})}),e.jsx("input",{value:p,onChange:s=>b(s.target.value),placeholder:`Search ${W.toLowerCase()}…`,style:{padding:"8px 10px",borderRadius:8,border:`1px solid ${n.headerBorder}`,background:"var(--color-bg-sunken)",color:n.textPrimary,fontSize:12,fontFamily:n.font,outline:"none"}}),e.jsx("div",{style:{maxHeight:y,overflow:"auto",border:`1px solid ${n.headerBorder}`,borderRadius:8},children:L.length===0?e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:n.textMuted,fontFamily:n.font},children:h.some(s=>s.type===w)?"No matches.":`No ${W.toLowerCase()} in this project yet.`}):L.map((s,f)=>{const j=s.id===d;return e.jsxs("button",{onClick:()=>v(s.id),style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"9px 11px",border:"none",borderTop:f===0?"none":`1px solid ${n.headerBorder}`,background:j?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:n.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[s.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:j?650:500,color:n.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.status==="certified"?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null]},s.id)})})]})}export{Qe as LineageDAG};
|
|
1
|
+
import{h as Se,i as je,k as Ce,t as Re,r as a,aw as O,a as pe,ax as Ee,ay as Le,az as Te,aA as Be,j as e,p as E,au as H,aB as Ie,l as ge}from"./index-Cpx47jCH.js";import{u as ze,a as We,M as Me,i as Fe,B as Ne,C as Pe,b as Oe,P as De,T as he,c as P,H as xe}from"./dagre.esm-DlZi7NR3.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Ee},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Le},{key:"end-to-end",label:"End-to-end",title:"Complete path from physical sources through governed meaning to consumption",types:O}],Y=[{type:"block",label:"Blocks"},{type:"app",label:"Apps"},{type:"notebook",label:"Notebooks"},{type:"dashboard",label:"Dashboards"}];function $e(n,h,o="flow",g="LR"){var v;const p=new he.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b=g==="LR";p.setGraph({rankdir:g,ranksep:o==="layered"?120:b?80:60,nodesep:b?40:50,marginx:32,marginy:32});for(const d of n){const y={width:190,height:58};if(o==="layered"&&((v=d.data)!=null&&v.layer)){const x=Ie.indexOf(d.data.layer);x>=0&&(y.rank=x)}p.setNode(d.id,y)}for(const d of h)p.setEdge(d.source,d.target);return he.layout(p),n.map(d=>{const y=p.node(d.id);return{...d,position:{x:y.x-95,y:y.y-29},data:{...d.data,direction:g}}})}function _e({data:n,selected:h}){const o=n.nodeType,g=E[o]??"var(--color-text-tertiary)",p=n.direction??"LR",b=p==="LR"?P.Left:P.Top,v=p==="LR"?P.Right:P.Bottom,d=!!n.dimmed,y=n.status==="certified";return e.jsxs("div",{style:{width:196,display:"flex",alignItems:"center",gap:8,background:"var(--color-bg-card)",border:`1.5px solid ${h?"var(--accent)":"var(--border-default)"}`,borderRadius:9,padding:"9px 11px",boxShadow:h?"0 1px 6px rgba(107,93,211,0.16)":"0 1px 4px rgba(26,26,26,0.05)",opacity:d?.3:1,transition:"opacity 0.15s ease"},children:[e.jsx(xe,{type:"target",position:b,style:{width:7,height:7,background:g,border:"none"}}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:g,flexShrink:0}}),e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{title:n.label,style:{fontSize:11.5,fontWeight:650,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:g},children:H[o]??o})]}),y?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null,e.jsx(xe,{type:"source",position:v,style:{width:7,height:7,background:g,border:"none"}})]})}const Ae={dagNode:_e};function Qe(){var ae,le,de;const n=Se(je(t=>({lineageFocusNodeId:t.lineageFocusNodeId,themeMode:t.themeMode}))),h=Ce(),o=Re[n.themeMode],[g,p]=a.useState(!0),[b,v]=a.useState({nodes:[],edges:[]}),[d,y]=a.useState({nodes:[],edges:[]}),[x,w]=a.useState(null),[c,L]=a.useState(null),[W,T]=a.useState(!1),[l,s]=a.useState(null),[f,j]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,M]=a.useState(null),[D,F]=a.useState(!1),[V,q]=a.useState("block"),[U,K]=a.useState(""),[X,N]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=ze([]),[be,oe,me]=We([]),re=a.useCallback(async()=>{p(!0);try{const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]})}finally{p(!1)}},[]);a.useEffect(()=>{re()},[re]);const R=a.useMemo(()=>b.nodes.filter(t=>Y.some(r=>r.type===t.type)).sort((t,r)=>t.name.localeCompare(r.name)),[b.nodes]),I=a.useCallback(async t=>{L(t),F(!1),M(null),s(null),T(!0);try{const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null)}finally{T(!1)}},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),M(null),F(!1),h({type:"SET_LINEAGE_FOCUS",nodeId:null})},[h]),a.useEffect(()=>{n.lineageFocusNodeId&&n.lineageFocusNodeId!==c&&I(n.lineageFocusNodeId)},[n.lineageFocusNodeId]);const m=a.useMemo(()=>{const t=new Set(d.nodes.filter(r=>f[r.type]??!0).map(r=>r.id));return{nodes:d.nodes.filter(r=>t.has(r.id)),edges:d.edges.filter(r=>t.has(r.source)&&t.has(r.target))}},[d,f]),z=a.useMemo(()=>{for(const t of G){const r=new Set(t.types);if(O.every(u=>(f[u]??!0)===r.has(u)))return t.key}return"custom"},[f]),ve=a.useCallback(t=>{const r=new Set(t);j(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),S=a.useMemo(()=>{if(!B)return null;const t=new Set([B]),r=new Set([B]);let i=!0;for(;i;){i=!1;for(const u of m.edges)t.has(u.target)&&!t.has(u.source)&&(t.add(u.source),i=!0),r.has(u.source)&&!r.has(u.target)&&(r.add(u.target),i=!0)}return new Set([...t,...r])},[B,m.edges]);a.useEffect(()=>{const t=m.nodes.map(i=>({id:i.id,type:"dagNode",selected:i.id===c,position:{x:0,y:0},data:{label:i.name,nodeType:i.type,domain:i.domain,status:i.status,layer:Te(i),dimmed:S?!S.has(i.id):!1}})),r=m.edges.map((i,u)=>{const A=S?S.has(i.source)&&S.has(i.target):!1,ce=A?"var(--accent)":Be[i.type]??"var(--color-text-tertiary)";return{id:`edge-${u}-${i.source}-${i.target}-${i.type}`,source:i.source,target:i.target,style:{stroke:ce,strokeWidth:A?2:1.5,opacity:S&&!A?.25:1},markerEnd:{type:Me.ArrowClosed,color:ce,width:12,height:12}}});te($e(t,r,k,C)),oe(r)},[m,k,C,S,c,oe,te]);const ke=a.useCallback((t,r)=>{M(r.id);const i=m.nodes.find(u=>u.id===r.id)??null;s(i)},[m.nodes]),$=a.useCallback(()=>{M(null),s(null)},[]),_=a.useMemo(()=>{if(!l)return null;const t=d.edges.filter(i=>i.target===l.id).length,r=d.edges.filter(i=>i.source===l.id).length;return{incoming:t,outgoing:r}},[d.edges,l]),ne=(x==null?void 0:x.name)??((ae=R.find(t=>t.id===c))==null?void 0:ae.name)??c??"",we=(x==null?void 0:x.type)??((le=R.find(t=>t.id===c))==null?void 0:le.type)??"block",ie=Z.trim().toLowerCase(),se=(ie?R.filter(t=>t.name.toLowerCase().includes(ie)):R).slice(0,40);return g?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"Loading lineage graph..."}):b.nodes.length===0?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"No lineage graph available yet."}):c?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)"},children:[e.jsx("div",{style:{padding:8,borderBottom:`1px solid ${o.headerBorder}`,background:o.sidebarBg},children:e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>F(t=>!t),title:"Change the traced entity",style:{display:"inline-flex",alignItems:"center",gap:7,height:30,padding:"0 11px",borderRadius:8,border:`1px solid ${D?o.accent:o.headerBorder}`,background:D?"var(--accent-dim)":o.cellBg,color:o.textPrimary,cursor:"pointer",fontFamily:o.font,maxWidth:320},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted},children:"Tracing"}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[we]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:650,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne}),e.jsx("span",{style:{fontSize:9,color:o.textMuted},children:"▾"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>F(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:340,background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:12},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:240})})]})]}),e.jsxs("div",{style:{position:"relative",flex:"0 1 300px",minWidth:160},children:[e.jsxs("svg",{style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:o.textMuted,pointerEvents:"none"},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]}),e.jsx("input",{value:Z,onChange:t=>{ee(t.target.value),N(!0)},onFocus:()=>N(!0),placeholder:"Search another block, app, or notebook…",style:{width:"100%",boxSizing:"border-box",height:30,padding:"0 10px 0 28px",borderRadius:8,border:`1px solid ${X?o.accent:o.headerBorder}`,background:"var(--color-bg-sunken)",color:o.textPrimary,fontSize:12,fontFamily:o.font,outline:"none"}}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:"min(340px, 90vw)",maxHeight:300,overflow:"auto",background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:4},children:se.length===0?e.jsx("div",{style:{padding:"12px 11px",fontSize:12,color:o.textMuted,fontFamily:o.font},children:"No matching block, app, or notebook."}):se.map(t=>e.jsxs("button",{onClick:()=>{I(t.id),ee(""),N(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"8px 10px",border:"none",borderRadius:7,background:t.id===c?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:o.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[t.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:550,color:o.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted,flexShrink:0},children:H[t.type]??t.type})]},t.id))})]})]}),e.jsx("div",{style:{width:1,height:20,background:o.headerBorder,margin:"0 2px"}}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>Q("flow"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:k==="flow"?"var(--color-bg-tertiary)":"transparent",color:k==="flow"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Flow"}),e.jsx("button",{onClick:()=>Q("layered"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:k==="layered"?"var(--color-bg-tertiary)":"transparent",color:k==="layered"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Layered"})]}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden",marginRight:4},children:[e.jsxs("button",{title:"Horizontal layout (left → right)",onClick:()=>J("LR"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:C==="LR"?"var(--color-bg-tertiary)":"transparent",color:C==="LR"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",children:[e.jsx("rect",{x:"0",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M9 3l2 2-2 2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor"})]}),"LR"]}),e.jsxs("button",{title:"Vertical layout (top → bottom)",onClick:()=>J("TB"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:C==="TB"?"var(--color-bg-tertiary)":"transparent",color:C==="TB"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",children:[e.jsx("rect",{x:"2",y:"0",width:"6",height:"4",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"5",y1:"4",x2:"5",y2:"10",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M3 9l2 2 2-2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"2",y:"10",width:"6",height:"4",rx:"1",fill:"currentColor"})]}),"TB"]})]}),e.jsx("div",{role:"group","aria-label":"Lineage view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.headerBorder}`,borderRadius:7,background:o.appBg,marginRight:4},children:G.map(t=>e.jsx("button",{onClick:()=>ve(t.types),title:t.title,"aria-pressed":z===t.key,style:{padding:"4px 11px",fontSize:11.5,fontWeight:600,border:"none",borderRadius:5,cursor:"pointer",fontFamily:o.font,whiteSpace:"nowrap",background:z===t.key?"var(--accent-dim)":"transparent",color:z===t.key?o.accent:o.textMuted},children:t.label},t.key))}),B&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:$,style:{borderRadius:7,border:`1px solid ${o.accent}`,background:"var(--accent-dim)",color:o.accent,cursor:"pointer",fontSize:11.5,fontWeight:650,padding:"5px 11px",whiteSpace:"nowrap"},children:"Show all"})]})]})}),e.jsx("div",{style:{flex:1,position:"relative"},children:e.jsxs(Fe,{nodes:ye,edges:be,onNodesChange:fe,onEdgesChange:me,onNodeClick:ke,onPaneClick:$,nodeTypes:Ae,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Ne,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Pe,{showInteractive:!1}),e.jsx(Oe,{nodeColor:t=>{var r;return E[((r=t.data)==null?void 0:r.nodeType)??"source_table"]??"var(--color-text-tertiary)"},maskColor:"color-mix(in srgb, var(--color-bg-primary) 55%, transparent)",style:{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-primary)"}}),e.jsx(De,{position:"bottom-left",children:l?e.jsxs("div",{style:{width:264,background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",borderRadius:11,boxShadow:"0 8px 26px rgba(26,26,26,0.13)",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[l.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:700,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),e.jsx("button",{onClick:$,title:"Clear focus",style:{width:20,height:20,borderRadius:5,border:"none",background:"none",color:"var(--color-text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,flexShrink:0},children:"×"})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginTop:3},children:[H[l.type]??l.type,_?` · ${_.incoming} upstream · ${_.outgoing} downstream`:""]}),l.domain?e.jsxs("div",{style:{fontSize:11.5,color:"var(--color-text-secondary)",lineHeight:1.5,marginTop:7},children:["Domain: ",l.domain]}):null,e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{onClick:()=>{l&&l.id!==c&&I(l.id)},disabled:!l||l.id===c,title:(l==null?void 0:l.id)===c?"Already the traced entity":"Re-scope lineage to this node",style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"none",background:"var(--accent)",color:"#fff",fontSize:11,fontWeight:650,cursor:(l==null?void 0:l.id)===c?"default":"pointer",opacity:(l==null?void 0:l.id)===c?.5:1},children:"Trace from here"}),e.jsx("button",{onClick:()=>h({type:"OPEN_GLOBAL_AI",autoRun:{text:`Explain the lineage of ${l.name} — where does it come from and what consumes it?`}}),style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"1px solid var(--color-border-primary)",background:"var(--color-bg-card)",color:"var(--color-text-secondary)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Ask about this"})]})]}):null})]})}),e.jsxs("div",{style:{height:28,flexShrink:0,borderTop:"1px solid var(--border-subtle)",background:"var(--color-bg-card)",display:"flex",alignItems:"center",gap:14,padding:"0 14px",fontSize:10.5,color:"var(--color-text-tertiary)"},children:[e.jsxs("span",{children:[z==="custom"?"Custom":(de=G.find(t=>t.key===z))==null?void 0:de.label," lineage of ",ne," · ",m.nodes.length," nodes · ",m.edges.length," edges",W?" · loading…":""]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:"var(--status-success)"}}),"Compiled from the dbt manifest"]}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{children:"Click a node to focus its path · click the canvas to clear"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)",alignItems:"center",justifyContent:"center",padding:24,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(560px, 100%)",border:`1px solid ${o.headerBorder}`,borderRadius:14,background:o.cellBg,padding:"22px 22px 18px",boxShadow:"0 1px 4px rgba(26,26,26,0.05)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:o.textPrimary,fontFamily:o.font},children:"Trace lineage"}),e.jsx("div",{style:{fontSize:12.5,color:o.textMuted,marginTop:3,lineHeight:1.5,fontFamily:o.font},children:"Pick a block, app, or notebook to see its upstream sources and downstream consumers — no project-wide noise."}),e.jsx("div",{style:{marginTop:16},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:300})})]})})}function ue({t:n,entities:h,activeType:o,onTypeChange:g,query:p,onQueryChange:b,onSelect:v,focalId:d,listHeight:y}){var T,l;const x=Y.filter(s=>h.some(f=>f.type===s.type)),w=x.some(s=>s.type===o)?o:((T=x[0])==null?void 0:T.type)??o,c=p.trim().toLowerCase(),L=h.filter(s=>s.type===w).filter(s=>!c||s.name.toLowerCase().includes(c)),W=((l=Y.find(s=>s.type===w))==null?void 0:l.label)??"items";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${n.headerBorder}`,borderRadius:8,background:n.appBg,alignSelf:"flex-start",flexWrap:"wrap"},children:x.map(s=>{const f=s.type===w,j=h.filter(k=>k.type===s.type).length;return e.jsxs("button",{onClick:()=>g(s.type),style:{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:6,padding:"5px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:n.font,background:f?"var(--accent-dim)":"transparent",color:f?n.accent:n.textMuted},children:[s.label,e.jsx("span",{style:{fontSize:10.5,color:f?n.accent:n.textMuted,opacity:.8},children:j})]},s.type)})}),e.jsx("input",{value:p,onChange:s=>b(s.target.value),placeholder:`Search ${W.toLowerCase()}…`,style:{padding:"8px 10px",borderRadius:8,border:`1px solid ${n.headerBorder}`,background:"var(--color-bg-sunken)",color:n.textPrimary,fontSize:12,fontFamily:n.font,outline:"none"}}),e.jsx("div",{style:{maxHeight:y,overflow:"auto",border:`1px solid ${n.headerBorder}`,borderRadius:8},children:L.length===0?e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:n.textMuted,fontFamily:n.font},children:h.some(s=>s.type===w)?"No matches.":`No ${W.toLowerCase()} in this project yet.`}):L.map((s,f)=>{const j=s.id===d;return e.jsxs("button",{onClick:()=>v(s.id),style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"9px 11px",border:"none",borderTop:f===0?"none":`1px solid ${n.headerBorder}`,background:j?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:n.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[s.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:j?650:500,color:n.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.status==="certified"?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null]},s.id)})})]})}export{Qe as LineageDAG};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as O,t as N,r as u,a as A,j as t,p as C,q as E,au as W,av as R}from"./index-1mIC_XX4.js";import{M as _}from"./MiniLineageGraph-GkD4y17x.js";import{LineageDAG as H}from"./LineageDAG-BiUFX2KL.js";import{A as F}from"./arrow-left-CMe1kkOL.js";import{L as G}from"./list-tree-BRFpEmvV.js";import"./react-CRB3T2We.js";import"./dagre.esm-GKp7qoUL.js";function U(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function q(i){if(i==null)return null;if(typeof i=="string")return i.trim()||null;if(typeof i=="number"||typeof i=="boolean")return String(i);if(Array.isArray(i)){const n=i.map(e=>e==null?null:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):null).filter(e=>!!e);return n.length>0?n.join(", "):null}return null}function V(i){return i?i.type==="term"?"Business definition used by blocks, views, dashboards, and AI agents.":i.type==="business_view"?"Business composition built from trusted terms, DQL blocks, and other business views.":i.type==="block"?"Reusable DQL block with its technical inputs and business consumption paths.":i.type==="dbt_model"||i.type==="dbt_source"||i.type==="source_table"?"Technical data asset connected to semantic, business, and consumption lineage.":i.type==="dashboard"||i.type==="notebook"||i.type==="app"||i.type==="chart"?"Consumption surface showing which trusted blocks and business concepts feed the experience.":"Focused technical and business lineage for the selected item.":"Focused technical and business lineage for the selected item."}function se(){var z;const{state:i,dispatch:n}=O(),e=N[i.themeMode],s=i.lineageFocusNodeId,[o,l]=u.useState({nodes:[],edges:[],focalNode:null}),[d,h]=u.useState(!1),[c,x]=u.useState("details"),[w,S]=u.useState(!1);u.useEffect(()=>{if(!s)return;let r=!1;return h(!0),A.queryLineage({focus:s,upstreamDepth:3,downstreamDepth:3}).then(v=>{var I,L;r||(l({nodes:((I=v.graph)==null?void 0:I.nodes)??[],edges:((L=v.graph)==null?void 0:L.edges)??[],focalNode:v.focalNode??null}),h(!1))}).catch(()=>{r||h(!1)}),()=>{r=!0}},[s]);const a=o.focalNode,m=u.useMemo(()=>new Map(o.nodes.map(r=>[r.id,r])),[o.nodes]),b=u.useMemo(()=>a?o.edges.filter(r=>r.target===a.id).map(r=>({edge:r,node:m.get(r.source)})).filter(r=>!!r.node):[],[a,o.edges,m]),j=u.useMemo(()=>a?o.edges.filter(r=>r.source===a.id).map(r=>({edge:r,node:m.get(r.target)})).filter(r=>!!r.node):[],[a,o.edges,m]);if(!s||w)return t.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[w&&s?t.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderBottom:`1px solid ${e.headerBorder}`,background:e.cellBg},children:t.jsx("button",{type:"button",onClick:()=>S(!1),style:{border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"5px 11px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:e.font},children:"← Back to focused view"})}):null,t.jsx(H,{})]});const f=(a==null?void 0:a.type)??s.split(":")[0]??"node",D=C[f]??e.accent,P=E[f]??f.slice(0,4).toUpperCase(),B=(a==null?void 0:a.metadata)??{},k=B.path??B.filePath,$=(a==null?void 0:a.name)??s,g=i.sidebarOpen&&i.sidebarPanel==="lineage",p=((z=i.lineageReturnTarget)==null?void 0:z.view)==="apps"?i.lineageReturnTarget:null,T=p!=null&&p.label?`Back to ${p.label}`:"Back to app";return t.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:"var(--color-bg-primary)"},children:[t.jsx("div",{style:{padding:"22px 28px 18px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg},children:t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[t.jsx("span",{style:{color:e.appBg,background:D,borderRadius:5,padding:"3px 7px",fontSize:10,fontWeight:800,letterSpacing:0},title:W[f]??f,children:P}),t.jsxs("span",{style:{color:e.textMuted,fontSize:12},children:["Focused lineage · ↑ ",b.length," · ↓ ",j.length]})]}),t.jsx("h1",{style:{margin:0,fontSize:26,lineHeight:1.15,color:e.textPrimary},children:$}),t.jsx("div",{style:{marginTop:7,color:e.textMuted,fontSize:13,maxWidth:760,lineHeight:1.45},children:V(a)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[t.jsx("button",{type:"button",onClick:()=>S(!0),title:"Open the full lineage graph",style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"6px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:e.font,whiteSpace:"nowrap"},children:"Full graph"}),p?t.jsxs("button",{type:"button",onClick:()=>{n({type:"OPEN_APP",appId:p.appId,dashboardId:p.dashboardId??null,experience:p.experience,section:p.section})},title:T,style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${e.headerBorder}`,background:e.sidebarBg,color:e.textPrimary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx(F,{size:14}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:T})]}):null,t.jsxs("button",{type:"button",onClick:()=>{n(g?{type:"TOGGLE_SIDEBAR"}:{type:"SET_SIDEBAR_PANEL",panel:"lineage"})},style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${g?e.accent:e.headerBorder}`,background:g?`${e.accent}1a`:e.sidebarBg,color:g?e.textPrimary:e.textSecondary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap"},children:[t.jsx(G,{size:14}),g?"Hide list":"Browse lineage"]})]})]})}),t.jsxs("div",{style:{padding:16,display:"grid",gridTemplateColumns:"minmax(0, 1fr) clamp(190px, 26%, 280px)",gap:14,minHeight:"calc(100vh - 160px)",minWidth:0},children:[t.jsxs("section",{style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,overflow:"hidden",display:"flex",flexDirection:"column",minWidth:0,minHeight:560},children:[t.jsxs("div",{style:{padding:"10px 12px",borderBottom:`1px solid ${e.headerBorder}`,flexShrink:0},children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,fontSize:14},children:"Focused lineage"}),t.jsx("div",{style:{color:e.textMuted,fontSize:12,marginTop:3},children:"Technical chain, business concepts, and consumption endpoints for this item."})]}),t.jsx("div",{style:{flex:1,minHeight:490,padding:12},children:d?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"Loading lineage..."}):o.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"No lineage available."}):t.jsx(_,{nodes:o.nodes,edges:o.edges,focalNodeId:s,height:"100%",fitViewPadding:.04,onNodeClick:r=>{n({type:"OPEN_LINEAGE_DETAIL",nodeId:r})},interactive:!0})})]}),t.jsxs("aside",{"aria-label":"Lineage details",style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,minWidth:0,maxHeight:"calc(100vh - 160px)",overflow:"hidden",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{padding:8,borderBottom:`1px solid ${e.headerBorder}`,display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},children:[t.jsx(y,{label:"Details",active:c==="details",onClick:()=>x("details"),t:e}),t.jsx(y,{label:`Up ${b.length}`,active:c==="upstream",onClick:()=>x("upstream"),t:e}),t.jsx(y,{label:`Down ${j.length}`,active:c==="downstream",onClick:()=>x("downstream"),t:e}),t.jsx(y,{label:"Source",active:c==="source",onClick:()=>x("source"),t:e})]}),t.jsxs("div",{style:{padding:12,overflow:"auto",flex:1,minHeight:0},children:[c==="details"&&(a?t.jsx(Q,{node:a,t:e}):t.jsx(Y,{t:e,label:"No metadata available."})),c==="upstream"&&t.jsx(M,{title:"Upstream",connections:b,t:e}),c==="downstream"&&t.jsx(M,{title:"Downstream",connections:j,t:e}),c==="source"&&t.jsx(K,{filePath:typeof k=="string"?k:null,t:e})]})]})]})]})}function y({label:i,active:n,onClick:e,t:s}){return t.jsx("button",{onClick:e,style:{border:`1px solid ${n?s.accent:s.headerBorder}`,background:n?`${s.accent}1c`:"transparent",color:n?s.textPrimary:s.textMuted,borderRadius:5,padding:"5px 6px",fontSize:10,fontWeight:800,cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i})}function Y({t:i,label:n}){return t.jsx("div",{style:{color:i.textMuted,fontSize:12,lineHeight:1.45},children:n})}function Q({node:i,t:n}){const e=i.metadata??{},s=new Set,o=[],l=(d,h,c=d)=>{const x=q(h);!x||s.has(c)||(s.add(c),o.push({label:d,value:x}))};l("Type",W[i.type]??i.type,"type"),l("Domain",i.domain,"domain"),l("Owner",i.owner,"owner"),l("Status",i.status,"status"),l("Term Type",e.termType,"termType"),l("Block Type",e.blockType,"blockType"),l("Materialized As",e.materializedAs,"materializedAs"),l("Identifiers",e.identifiers,"identifiers"),l("Synonyms",e.synonyms,"synonyms"),l("Description",e.description,"description"),l("Business Outcome",e.businessOutcome,"businessOutcome"),l("Decision Use",e.decisionUse,"decisionUse"),l("Review Cadence",e.reviewCadence,"reviewCadence");for(const[d,h]of Object.entries(e))d==="path"||d==="filePath"||d==="sql"||d==="compiledSql"||l(U(d),h,d);return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Lineage metadata"}),o.length===0?t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No metadata available for this node."}):t.jsx("div",{style:{display:"grid",gap:8},children:o.map(d=>t.jsxs("div",{style:{display:"grid",gap:3},children:[t.jsx("div",{style:{color:n.textMuted,fontSize:10,fontWeight:800,textTransform:"uppercase"},children:d.label}),t.jsx("div",{style:{color:n.textSecondary,fontSize:12,lineHeight:1.45},children:d.value})]},d.label))})]})}function M({title:i,connections:n,t:e}){return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,marginBottom:10},children:i}),n.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:["No ",i.toLowerCase()," connections in this focused window."]}):t.jsxs("div",{style:{display:"grid",gap:7},children:[n.slice(0,10).map(({edge:s,node:o})=>{const l=C[o.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0,fontSize:12},children:[t.jsx("span",{style:{color:e.textMuted},children:R[s.type]??s.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:l,borderRadius:3,padding:"1px 4px",fontSize:9,fontWeight:800,flexShrink:0},children:E[o.type]??o.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.name,children:o.name})]})]},`${s.source}-${s.target}-${s.type}`)}),n.length>10&&t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:[n.length-10," more connection",n.length-10===1?"":"s"," in the graph"]})]})]})}function K({filePath:i,t:n}){const e=i==null?void 0:i.trim();return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Source file"}),e?t.jsx("div",{style:{color:n.textMuted,fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:e}):t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No source file path available for this node."})]})}export{se as LineageDetailView};
|
|
1
|
+
import{u as O,t as N,r as u,a as A,j as t,p as C,q as E,au as W,av as R}from"./index-Cpx47jCH.js";import{M as _}from"./MiniLineageGraph-CotnRuxa.js";import{LineageDAG as H}from"./LineageDAG-BJ6xz06u.js";import{A as F}from"./arrow-left-L8odLbyN.js";import{L as G}from"./list-tree-DGKqCxmz.js";import"./react-CRB3T2We.js";import"./dagre.esm-DlZi7NR3.js";function U(i){return i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function q(i){if(i==null)return null;if(typeof i=="string")return i.trim()||null;if(typeof i=="number"||typeof i=="boolean")return String(i);if(Array.isArray(i)){const n=i.map(e=>e==null?null:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):null).filter(e=>!!e);return n.length>0?n.join(", "):null}return null}function V(i){return i?i.type==="term"?"Business definition used by blocks, views, dashboards, and AI agents.":i.type==="business_view"?"Business composition built from trusted terms, DQL blocks, and other business views.":i.type==="block"?"Reusable DQL block with its technical inputs and business consumption paths.":i.type==="dbt_model"||i.type==="dbt_source"||i.type==="source_table"?"Technical data asset connected to semantic, business, and consumption lineage.":i.type==="dashboard"||i.type==="notebook"||i.type==="app"||i.type==="chart"?"Consumption surface showing which trusted blocks and business concepts feed the experience.":"Focused technical and business lineage for the selected item.":"Focused technical and business lineage for the selected item."}function se(){var z;const{state:i,dispatch:n}=O(),e=N[i.themeMode],s=i.lineageFocusNodeId,[o,l]=u.useState({nodes:[],edges:[],focalNode:null}),[d,h]=u.useState(!1),[c,x]=u.useState("details"),[w,S]=u.useState(!1);u.useEffect(()=>{if(!s)return;let r=!1;return h(!0),A.queryLineage({focus:s,upstreamDepth:3,downstreamDepth:3}).then(v=>{var I,L;r||(l({nodes:((I=v.graph)==null?void 0:I.nodes)??[],edges:((L=v.graph)==null?void 0:L.edges)??[],focalNode:v.focalNode??null}),h(!1))}).catch(()=>{r||h(!1)}),()=>{r=!0}},[s]);const a=o.focalNode,m=u.useMemo(()=>new Map(o.nodes.map(r=>[r.id,r])),[o.nodes]),b=u.useMemo(()=>a?o.edges.filter(r=>r.target===a.id).map(r=>({edge:r,node:m.get(r.source)})).filter(r=>!!r.node):[],[a,o.edges,m]),j=u.useMemo(()=>a?o.edges.filter(r=>r.source===a.id).map(r=>({edge:r,node:m.get(r.target)})).filter(r=>!!r.node):[],[a,o.edges,m]);if(!s||w)return t.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[w&&s?t.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",borderBottom:`1px solid ${e.headerBorder}`,background:e.cellBg},children:t.jsx("button",{type:"button",onClick:()=>S(!1),style:{border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"5px 11px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:e.font},children:"← Back to focused view"})}):null,t.jsx(H,{})]});const f=(a==null?void 0:a.type)??s.split(":")[0]??"node",D=C[f]??e.accent,P=E[f]??f.slice(0,4).toUpperCase(),B=(a==null?void 0:a.metadata)??{},k=B.path??B.filePath,$=(a==null?void 0:a.name)??s,g=i.sidebarOpen&&i.sidebarPanel==="lineage",p=((z=i.lineageReturnTarget)==null?void 0:z.view)==="apps"?i.lineageReturnTarget:null,T=p!=null&&p.label?`Back to ${p.label}`:"Back to app";return t.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:"var(--color-bg-primary)"},children:[t.jsx("div",{style:{padding:"22px 28px 18px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg},children:t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:16},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[t.jsx("span",{style:{color:e.appBg,background:D,borderRadius:5,padding:"3px 7px",fontSize:10,fontWeight:800,letterSpacing:0},title:W[f]??f,children:P}),t.jsxs("span",{style:{color:e.textMuted,fontSize:12},children:["Focused lineage · ↑ ",b.length," · ↓ ",j.length]})]}),t.jsx("h1",{style:{margin:0,fontSize:26,lineHeight:1.15,color:e.textPrimary},children:$}),t.jsx("div",{style:{marginTop:7,color:e.textMuted,fontSize:13,maxWidth:760,lineHeight:1.45},children:V(a)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[t.jsx("button",{type:"button",onClick:()=>S(!0),title:"Open the full lineage graph",style:{display:"inline-flex",alignItems:"center",gap:6,border:`1px solid ${e.headerBorder}`,background:e.cellBg,color:e.textSecondary,borderRadius:7,padding:"6px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:e.font,whiteSpace:"nowrap"},children:"Full graph"}),p?t.jsxs("button",{type:"button",onClick:()=>{n({type:"OPEN_APP",appId:p.appId,dashboardId:p.dashboardId??null,experience:p.experience,section:p.section})},title:T,style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${e.headerBorder}`,background:e.sidebarBg,color:e.textPrimary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis"},children:[t.jsx(F,{size:14}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:T})]}):null,t.jsxs("button",{type:"button",onClick:()=>{n(g?{type:"TOGGLE_SIDEBAR"}:{type:"SET_SIDEBAR_PANEL",panel:"lineage"})},style:{display:"inline-flex",alignItems:"center",gap:7,border:`1px solid ${g?e.accent:e.headerBorder}`,background:g?`${e.accent}1a`:e.sidebarBg,color:g?e.textPrimary:e.textSecondary,borderRadius:6,padding:"7px 10px",fontSize:12,fontWeight:800,cursor:"pointer",whiteSpace:"nowrap"},children:[t.jsx(G,{size:14}),g?"Hide list":"Browse lineage"]})]})]})}),t.jsxs("div",{style:{padding:16,display:"grid",gridTemplateColumns:"minmax(0, 1fr) clamp(190px, 26%, 280px)",gap:14,minHeight:"calc(100vh - 160px)",minWidth:0},children:[t.jsxs("section",{style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,overflow:"hidden",display:"flex",flexDirection:"column",minWidth:0,minHeight:560},children:[t.jsxs("div",{style:{padding:"10px 12px",borderBottom:`1px solid ${e.headerBorder}`,flexShrink:0},children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,fontSize:14},children:"Focused lineage"}),t.jsx("div",{style:{color:e.textMuted,fontSize:12,marginTop:3},children:"Technical chain, business concepts, and consumption endpoints for this item."})]}),t.jsx("div",{style:{flex:1,minHeight:490,padding:12},children:d?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"Loading lineage..."}):o.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12},children:"No lineage available."}):t.jsx(_,{nodes:o.nodes,edges:o.edges,focalNodeId:s,height:"100%",fitViewPadding:.04,onNodeClick:r=>{n({type:"OPEN_LINEAGE_DETAIL",nodeId:r})},interactive:!0})})]}),t.jsxs("aside",{"aria-label":"Lineage details",style:{border:`1px solid ${e.headerBorder}`,borderRadius:8,background:e.sidebarBg,minWidth:0,maxHeight:"calc(100vh - 160px)",overflow:"hidden",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{padding:8,borderBottom:`1px solid ${e.headerBorder}`,display:"grid",gridTemplateColumns:"1fr 1fr",gap:4},children:[t.jsx(y,{label:"Details",active:c==="details",onClick:()=>x("details"),t:e}),t.jsx(y,{label:`Up ${b.length}`,active:c==="upstream",onClick:()=>x("upstream"),t:e}),t.jsx(y,{label:`Down ${j.length}`,active:c==="downstream",onClick:()=>x("downstream"),t:e}),t.jsx(y,{label:"Source",active:c==="source",onClick:()=>x("source"),t:e})]}),t.jsxs("div",{style:{padding:12,overflow:"auto",flex:1,minHeight:0},children:[c==="details"&&(a?t.jsx(Q,{node:a,t:e}):t.jsx(Y,{t:e,label:"No metadata available."})),c==="upstream"&&t.jsx(M,{title:"Upstream",connections:b,t:e}),c==="downstream"&&t.jsx(M,{title:"Downstream",connections:j,t:e}),c==="source"&&t.jsx(K,{filePath:typeof k=="string"?k:null,t:e})]})]})]})]})}function y({label:i,active:n,onClick:e,t:s}){return t.jsx("button",{onClick:e,style:{border:`1px solid ${n?s.accent:s.headerBorder}`,background:n?`${s.accent}1c`:"transparent",color:n?s.textPrimary:s.textMuted,borderRadius:5,padding:"5px 6px",fontSize:10,fontWeight:800,cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i})}function Y({t:i,label:n}){return t.jsx("div",{style:{color:i.textMuted,fontSize:12,lineHeight:1.45},children:n})}function Q({node:i,t:n}){const e=i.metadata??{},s=new Set,o=[],l=(d,h,c=d)=>{const x=q(h);!x||s.has(c)||(s.add(c),o.push({label:d,value:x}))};l("Type",W[i.type]??i.type,"type"),l("Domain",i.domain,"domain"),l("Owner",i.owner,"owner"),l("Status",i.status,"status"),l("Term Type",e.termType,"termType"),l("Block Type",e.blockType,"blockType"),l("Materialized As",e.materializedAs,"materializedAs"),l("Identifiers",e.identifiers,"identifiers"),l("Synonyms",e.synonyms,"synonyms"),l("Description",e.description,"description"),l("Business Outcome",e.businessOutcome,"businessOutcome"),l("Decision Use",e.decisionUse,"decisionUse"),l("Review Cadence",e.reviewCadence,"reviewCadence");for(const[d,h]of Object.entries(e))d==="path"||d==="filePath"||d==="sql"||d==="compiledSql"||l(U(d),h,d);return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Lineage metadata"}),o.length===0?t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No metadata available for this node."}):t.jsx("div",{style:{display:"grid",gap:8},children:o.map(d=>t.jsxs("div",{style:{display:"grid",gap:3},children:[t.jsx("div",{style:{color:n.textMuted,fontSize:10,fontWeight:800,textTransform:"uppercase"},children:d.label}),t.jsx("div",{style:{color:n.textSecondary,fontSize:12,lineHeight:1.45},children:d.value})]},d.label))})]})}function M({title:i,connections:n,t:e}){return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:e.textPrimary,marginBottom:10},children:i}),n.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:["No ",i.toLowerCase()," connections in this focused window."]}):t.jsxs("div",{style:{display:"grid",gap:7},children:[n.slice(0,10).map(({edge:s,node:o})=>{const l=C[o.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0,fontSize:12},children:[t.jsx("span",{style:{color:e.textMuted},children:R[s.type]??s.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:l,borderRadius:3,padding:"1px 4px",fontSize:9,fontWeight:800,flexShrink:0},children:E[o.type]??o.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o.name,children:o.name})]})]},`${s.source}-${s.target}-${s.type}`)}),n.length>10&&t.jsxs("div",{style:{color:e.textMuted,fontSize:12},children:[n.length-10," more connection",n.length-10===1?"":"s"," in the graph"]})]})]})}function K({filePath:i,t:n}){const e=i==null?void 0:i.trim();return t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:800,color:n.textPrimary,marginBottom:10},children:"Source file"}),e?t.jsx("div",{style:{color:n.textMuted,fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:e}):t.jsx("div",{style:{color:n.textMuted,fontSize:12},children:"No source file path available for this node."})]})}export{se as LineageDetailView};
|
package/dist/assets/dql-notebook/assets/{LineageDrawer-CgTScaGB.js → LineageDrawer-hnqCW_t-.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as F,t as J,r as l,a as K,p as R,q as I,j as t,au as Q,av as Z}from"./index-1mIC_XX4.js";import{M as ee}from"./MiniLineageGraph-GkD4y17x.js";import{P as te}from"./panel-right-open-CunA1xO7.js";import{X as B}from"./x-CSo1M3tu.js";import{M as re}from"./minimize-2-CDwSCGlO.js";import{R as ie}from"./rotate-ccw-DOrfTZk8.js";import{G as ne}from"./grip-vertical-B4EHbGXW.js";import{E as se}from"./external-link-C-PXokWV.js";import"./react-CRB3T2We.js";import"./dagre.esm-GKp7qoUL.js";const O=320,oe=48;function T(){return typeof window>"u"?380:Math.min(420,Math.max(O,Math.round(window.innerWidth*.42)))}function ae(){return typeof window>"u"?760:Math.max(420,Math.min(880,Math.round(window.innerWidth*.72)))}function le(o){return Math.min(ae(),Math.max(O,o))}function be(){var E,D;const{state:o,dispatch:a}=F(),e=J[o.themeMode],n=o.lineageDrawerNodeId,[s,m]=l.useState({nodes:[],edges:[],focalNode:null}),[N,y]=l.useState(!1),j=l.useRef(null),[A,P]=l.useState(360),[w,S]=l.useState(()=>T()),[k,f]=l.useState(!1),[p,M]=l.useState(!1),b=l.useRef(w);l.useEffect(()=>{const r=j.current;if(!r)return;const d=new ResizeObserver(u=>{for(const c of u){const x=Math.max(160,c.contentRect.height);P(x)}});return d.observe(r),()=>d.disconnect()},[]),l.useEffect(()=>{if(!n)return;let r=!1;return y(!0),K.queryLineage({focus:n,upstreamDepth:2,downstreamDepth:2}).then(d=>{var u,c;r||(m({nodes:((u=d.graph)==null?void 0:u.nodes)??[],edges:((c=d.graph)==null?void 0:c.edges)??[],focalNode:d.focalNode??null}),y(!1))}).catch(()=>{r||y(!1)}),()=>{r=!0}},[n]);const i=s.focalNode,$=i?s.edges.filter(r=>r.target===i.id).length:0,_=i?s.edges.filter(r=>r.source===i.id).length:0,H=i?R[i.type]??e.textSecondary:e.textSecondary,G=i?I[i.type]??i.type.toUpperCase():"",g=l.useMemo(()=>new Map(s.nodes.map(r=>[r.id,r])),[s.nodes]),U=l.useMemo(()=>i?s.edges.filter(r=>r.target===i.id).map(r=>({edge:r,node:g.get(r.source)})).filter(r=>!!r.node):[],[i,s.edges,g]),X=l.useMemo(()=>i?s.edges.filter(r=>r.source===i.id).map(r=>({edge:r,node:g.get(r.target)})).filter(r=>!!r.node):[],[i,s.edges,g]),v=((E=i==null?void 0:i.metadata)==null?void 0:E.path)??((D=i==null?void 0:i.metadata)==null?void 0:D.filePath);if(!n)return null;const q=r=>{r!==n&&a({type:"OPEN_LINEAGE_DRAWER",nodeId:r})},Y=r=>{r.preventDefault(),r.stopPropagation(),k&&f(!1);const d=r.clientX,u=b.current;M(!0);const c=V=>{const L=le(u+(d-V.clientX));b.current=L,S(L)},x=()=>{M(!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",x)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",c),window.addEventListener("mouseup",x)},z=()=>{const r=T();b.current=r,S(r),f(!1)},W=()=>a({type:"CLOSE_LINEAGE_DRAWER"});return k?t.jsxs("aside",{"aria-label":"Collapsed lineage drawer",style:{width:oe,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"10px 6px",overflow:"hidden"},children:[t.jsx(h,{title:"Show lineage details",onClick:()=>f(!1),t:e,children:t.jsx(te,{size:15,strokeWidth:1.9})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:15,strokeWidth:2})}),t.jsx("div",{title:(i==null?void 0:i.name)??n,style:{writingMode:"vertical-rl",transform:"rotate(180deg)",color:e.textMuted,fontSize:11,fontWeight:700,lineHeight:1,marginTop:4,maxHeight:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(i==null?void 0:i.name)??"Lineage"})]}):t.jsxs("aside",{"aria-label":"Lineage drawer",style:{width:w,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",animation:"dql-drawer-slide-in 180ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:[t.jsx("div",{onMouseDown:Y,onDoubleClick:z,title:"Drag to resize. Double-click to reset width.",style:{position:"absolute",top:0,left:0,width:8,height:"100%",cursor:"col-resize",zIndex:20,display:"flex",alignItems:"center",justifyContent:"center",background:p?`${e.accent}1f`:"transparent",transition:p?"none":"background 0.15s"},onMouseEnter:r=>{p||(r.currentTarget.style.background=`${e.accent}14`)},onMouseLeave:r=>{p||(r.currentTarget.style.background="transparent")},children:t.jsx("div",{style:{width:3,height:44,borderRadius:999,background:p?e.accent:e.headerBorder,boxShadow:p?`0 0 0 3px ${e.accent}1f`:"none"}})}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px 11px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg,flexShrink:0},children:[t.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:38,padding:"2px 6px",background:H,color:e.appBg,fontSize:10,fontWeight:700,letterSpacing:0,borderRadius:4},title:i?Q[i.type]??i.type:"",children:G||"NODE"}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:800,marginBottom:3},children:"Lineage Inspector"}),t.jsx("div",{style:{fontSize:14,fontWeight:700,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:(i==null?void 0:i.name)??n,children:(i==null?void 0:i.name)??n}),t.jsxs("div",{style:{fontSize:11,color:e.textMuted,marginTop:2},children:["Lineage · ↑ ",$," · ↓ ",_]})]}),t.jsx(h,{title:"Collapse drawer",onClick:()=>f(!0),t:e,children:t.jsx(re,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Reset width",onClick:z,t:e,children:t.jsx(ie,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:14,strokeWidth:2})})]}),t.jsxs("div",{style:{height:30,padding:"0 14px",borderBottom:`1px solid ${e.headerBorder}`,display:"flex",alignItems:"center",gap:8,color:e.textMuted,fontSize:11,flexShrink:0,background:e.sidebarBg},children:[t.jsx(ne,{size:13,strokeWidth:1.8}),t.jsx("span",{children:"Drag the left edge to resize"}),t.jsxs("span",{style:{marginLeft:"auto",color:e.textMuted},children:[w,"px"]})]}),i&&t.jsx(de,{node:i,t:e}),t.jsx("div",{ref:j,style:{flex:1,minHeight:220,padding:12,overflow:"hidden",display:"flex",background:e.appBg},children:N?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"Loading lineage…"}):s.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"No lineage available for this node."}):t.jsx("div",{style:{flex:1,minWidth:0},children:t.jsx(ee,{nodes:s.nodes,edges:s.edges,focalNodeId:n,height:Math.max(0,A-24),onNodeClick:q,interactive:!0})})}),i&&t.jsxs("div",{style:{borderTop:`1px solid ${e.headerBorder}`,padding:"10px 12px",display:"grid",gap:10,maxHeight:280,overflow:"auto",background:e.sidebarBg,flexShrink:0},children:[t.jsx(C,{title:"Upstream",connections:U,t:e}),t.jsx(C,{title:"Downstream",connections:X,t:e})]}),typeof v=="string"&&t.jsxs("div",{style:{padding:"8px 14px",borderTop:`1px solid ${e.headerBorder}`,fontSize:11,color:e.textMuted,display:"flex",alignItems:"center",gap:6},children:[t.jsx(se,{size:11,strokeWidth:1.75}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:v,children:v})]})]})}function de({node:o,t:a}){const e=o.metadata??{},n=[];return o.domain&&n.push({label:"Domain",value:o.domain}),o.owner&&n.push({label:"Owner",value:o.owner}),o.status&&n.push({label:"Status",value:o.status}),o.type==="term"&&typeof e.termType=="string"&&n.push({label:"Term Type",value:e.termType}),o.type==="block"&&typeof e.blockType=="string"&&n.push({label:"Block Type",value:e.blockType}),typeof e.materializedAs=="string"&&n.push({label:"Materialized As",value:e.materializedAs}),Array.isArray(e.identifiers)&&e.identifiers.length>0&&n.push({label:"Identifiers",value:e.identifiers.map(String).join(", ")}),Array.isArray(e.synonyms)&&e.synonyms.length>0&&n.push({label:"Synonyms",value:e.synonyms.map(String).join(", ")}),typeof e.description=="string"&&e.description.trim()&&n.push({label:"Description",value:e.description}),typeof e.businessOutcome=="string"&&e.businessOutcome.trim()&&n.push({label:"Business Outcome",value:e.businessOutcome}),n.length===0?null:t.jsx("div",{style:{padding:"10px 14px",borderBottom:`1px solid ${a.headerBorder}`,display:"grid",gap:6,background:a.sidebarBg},children:n.slice(0,6).map(s=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0},children:[t.jsx("span",{style:{color:a.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase"},children:s.label}),t.jsx("span",{style:{color:a.textSecondary,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:s.value.length>90?"normal":"nowrap"},title:s.value,children:s.value})]},s.label))})}function C({title:o,connections:a,t:e}){return a.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[o,": none in this focused window"]}):t.jsxs("div",{children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase",marginBottom:5},children:o}),t.jsxs("div",{style:{display:"grid",gap:4},children:[a.slice(0,5).map(({edge:n,node:s})=>{const m=R[s.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"76px 1fr",gap:8,alignItems:"center",fontSize:11,minWidth:0},children:[t.jsx("span",{style:{color:e.textMuted},children:Z[n.type]??n.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:m,borderRadius:3,padding:"1px 4px",fontSize:8,fontWeight:700,flexShrink:0},children:I[s.type]??s.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.name,children:s.name})]})]},`${n.source}-${n.target}-${n.type}`)}),a.length>5&&t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[a.length-5," more connection",a.length-5===1?"":"s"," in the graph"]})]})]})}function h({title:o,onClick:a,children:e,t:n}){return t.jsx("button",{"aria-label":o,title:o,onClick:a,style:{width:26,height:26,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:`1px solid ${n.headerBorder}`,borderRadius:5,color:n.textSecondary,cursor:"pointer"},onMouseEnter:s=>{s.currentTarget.style.color=n.textPrimary,s.currentTarget.style.background=n.textPrimary+"0f"},onMouseLeave:s=>{s.currentTarget.style.color=n.textSecondary,s.currentTarget.style.background="transparent"},children:e})}export{be as LineageDrawer};
|
|
1
|
+
import{u as F,t as J,r as l,a as K,p as R,q as I,j as t,au as Q,av as Z}from"./index-Cpx47jCH.js";import{M as ee}from"./MiniLineageGraph-CotnRuxa.js";import{P as te}from"./panel-right-open-yuVkIo5n.js";import{X as B}from"./x-CbKEfe5m.js";import{M as re}from"./minimize-2-C8dvqCxX.js";import{R as ie}from"./rotate-ccw-Di0kRnrM.js";import{G as ne}from"./grip-vertical-HmUijbwN.js";import{E as se}from"./external-link-DYqdQIGp.js";import"./react-CRB3T2We.js";import"./dagre.esm-DlZi7NR3.js";const O=320,oe=48;function T(){return typeof window>"u"?380:Math.min(420,Math.max(O,Math.round(window.innerWidth*.42)))}function ae(){return typeof window>"u"?760:Math.max(420,Math.min(880,Math.round(window.innerWidth*.72)))}function le(o){return Math.min(ae(),Math.max(O,o))}function be(){var E,D;const{state:o,dispatch:a}=F(),e=J[o.themeMode],n=o.lineageDrawerNodeId,[s,m]=l.useState({nodes:[],edges:[],focalNode:null}),[N,y]=l.useState(!1),j=l.useRef(null),[A,P]=l.useState(360),[w,S]=l.useState(()=>T()),[k,f]=l.useState(!1),[p,M]=l.useState(!1),b=l.useRef(w);l.useEffect(()=>{const r=j.current;if(!r)return;const d=new ResizeObserver(u=>{for(const c of u){const x=Math.max(160,c.contentRect.height);P(x)}});return d.observe(r),()=>d.disconnect()},[]),l.useEffect(()=>{if(!n)return;let r=!1;return y(!0),K.queryLineage({focus:n,upstreamDepth:2,downstreamDepth:2}).then(d=>{var u,c;r||(m({nodes:((u=d.graph)==null?void 0:u.nodes)??[],edges:((c=d.graph)==null?void 0:c.edges)??[],focalNode:d.focalNode??null}),y(!1))}).catch(()=>{r||y(!1)}),()=>{r=!0}},[n]);const i=s.focalNode,$=i?s.edges.filter(r=>r.target===i.id).length:0,_=i?s.edges.filter(r=>r.source===i.id).length:0,H=i?R[i.type]??e.textSecondary:e.textSecondary,G=i?I[i.type]??i.type.toUpperCase():"",g=l.useMemo(()=>new Map(s.nodes.map(r=>[r.id,r])),[s.nodes]),U=l.useMemo(()=>i?s.edges.filter(r=>r.target===i.id).map(r=>({edge:r,node:g.get(r.source)})).filter(r=>!!r.node):[],[i,s.edges,g]),X=l.useMemo(()=>i?s.edges.filter(r=>r.source===i.id).map(r=>({edge:r,node:g.get(r.target)})).filter(r=>!!r.node):[],[i,s.edges,g]),v=((E=i==null?void 0:i.metadata)==null?void 0:E.path)??((D=i==null?void 0:i.metadata)==null?void 0:D.filePath);if(!n)return null;const q=r=>{r!==n&&a({type:"OPEN_LINEAGE_DRAWER",nodeId:r})},Y=r=>{r.preventDefault(),r.stopPropagation(),k&&f(!1);const d=r.clientX,u=b.current;M(!0);const c=V=>{const L=le(u+(d-V.clientX));b.current=L,S(L)},x=()=>{M(!1),document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",x)};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",c),window.addEventListener("mouseup",x)},z=()=>{const r=T();b.current=r,S(r),f(!1)},W=()=>a({type:"CLOSE_LINEAGE_DRAWER"});return k?t.jsxs("aside",{"aria-label":"Collapsed lineage drawer",style:{width:oe,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"10px 6px",overflow:"hidden"},children:[t.jsx(h,{title:"Show lineage details",onClick:()=>f(!1),t:e,children:t.jsx(te,{size:15,strokeWidth:1.9})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:15,strokeWidth:2})}),t.jsx("div",{title:(i==null?void 0:i.name)??n,style:{writingMode:"vertical-rl",transform:"rotate(180deg)",color:e.textMuted,fontSize:11,fontWeight:700,lineHeight:1,marginTop:4,maxHeight:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(i==null?void 0:i.name)??"Lineage"})]}):t.jsxs("aside",{"aria-label":"Lineage drawer",style:{width:w,flexShrink:0,borderLeft:`1px solid ${e.headerBorder}`,background:e.appBg,color:e.textPrimary,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",animation:"dql-drawer-slide-in 180ms cubic-bezier(0.22, 0.61, 0.36, 1)"},children:[t.jsx("div",{onMouseDown:Y,onDoubleClick:z,title:"Drag to resize. Double-click to reset width.",style:{position:"absolute",top:0,left:0,width:8,height:"100%",cursor:"col-resize",zIndex:20,display:"flex",alignItems:"center",justifyContent:"center",background:p?`${e.accent}1f`:"transparent",transition:p?"none":"background 0.15s"},onMouseEnter:r=>{p||(r.currentTarget.style.background=`${e.accent}14`)},onMouseLeave:r=>{p||(r.currentTarget.style.background="transparent")},children:t.jsx("div",{style:{width:3,height:44,borderRadius:999,background:p?e.accent:e.headerBorder,boxShadow:p?`0 0 0 3px ${e.accent}1f`:"none"}})}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 14px 11px",borderBottom:`1px solid ${e.headerBorder}`,background:e.appBg,flexShrink:0},children:[t.jsx("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:38,padding:"2px 6px",background:H,color:e.appBg,fontSize:10,fontWeight:700,letterSpacing:0,borderRadius:4},title:i?Q[i.type]??i.type:"",children:G||"NODE"}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:800,marginBottom:3},children:"Lineage Inspector"}),t.jsx("div",{style:{fontSize:14,fontWeight:700,color:e.textPrimary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:(i==null?void 0:i.name)??n,children:(i==null?void 0:i.name)??n}),t.jsxs("div",{style:{fontSize:11,color:e.textMuted,marginTop:2},children:["Lineage · ↑ ",$," · ↓ ",_]})]}),t.jsx(h,{title:"Collapse drawer",onClick:()=>f(!0),t:e,children:t.jsx(re,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Reset width",onClick:z,t:e,children:t.jsx(ie,{size:14,strokeWidth:1.8})}),t.jsx(h,{title:"Hide lineage drawer",onClick:W,t:e,children:t.jsx(B,{size:14,strokeWidth:2})})]}),t.jsxs("div",{style:{height:30,padding:"0 14px",borderBottom:`1px solid ${e.headerBorder}`,display:"flex",alignItems:"center",gap:8,color:e.textMuted,fontSize:11,flexShrink:0,background:e.sidebarBg},children:[t.jsx(ne,{size:13,strokeWidth:1.8}),t.jsx("span",{children:"Drag the left edge to resize"}),t.jsxs("span",{style:{marginLeft:"auto",color:e.textMuted},children:[w,"px"]})]}),i&&t.jsx(de,{node:i,t:e}),t.jsx("div",{ref:j,style:{flex:1,minHeight:220,padding:12,overflow:"hidden",display:"flex",background:e.appBg},children:N?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"Loading lineage…"}):s.nodes.length===0?t.jsx("div",{style:{color:e.textMuted,fontSize:12,padding:8},children:"No lineage available for this node."}):t.jsx("div",{style:{flex:1,minWidth:0},children:t.jsx(ee,{nodes:s.nodes,edges:s.edges,focalNodeId:n,height:Math.max(0,A-24),onNodeClick:q,interactive:!0})})}),i&&t.jsxs("div",{style:{borderTop:`1px solid ${e.headerBorder}`,padding:"10px 12px",display:"grid",gap:10,maxHeight:280,overflow:"auto",background:e.sidebarBg,flexShrink:0},children:[t.jsx(C,{title:"Upstream",connections:U,t:e}),t.jsx(C,{title:"Downstream",connections:X,t:e})]}),typeof v=="string"&&t.jsxs("div",{style:{padding:"8px 14px",borderTop:`1px solid ${e.headerBorder}`,fontSize:11,color:e.textMuted,display:"flex",alignItems:"center",gap:6},children:[t.jsx(se,{size:11,strokeWidth:1.75}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:v,children:v})]})]})}function de({node:o,t:a}){const e=o.metadata??{},n=[];return o.domain&&n.push({label:"Domain",value:o.domain}),o.owner&&n.push({label:"Owner",value:o.owner}),o.status&&n.push({label:"Status",value:o.status}),o.type==="term"&&typeof e.termType=="string"&&n.push({label:"Term Type",value:e.termType}),o.type==="block"&&typeof e.blockType=="string"&&n.push({label:"Block Type",value:e.blockType}),typeof e.materializedAs=="string"&&n.push({label:"Materialized As",value:e.materializedAs}),Array.isArray(e.identifiers)&&e.identifiers.length>0&&n.push({label:"Identifiers",value:e.identifiers.map(String).join(", ")}),Array.isArray(e.synonyms)&&e.synonyms.length>0&&n.push({label:"Synonyms",value:e.synonyms.map(String).join(", ")}),typeof e.description=="string"&&e.description.trim()&&n.push({label:"Description",value:e.description}),typeof e.businessOutcome=="string"&&e.businessOutcome.trim()&&n.push({label:"Business Outcome",value:e.businessOutcome}),n.length===0?null:t.jsx("div",{style:{padding:"10px 14px",borderBottom:`1px solid ${a.headerBorder}`,display:"grid",gap:6,background:a.sidebarBg},children:n.slice(0,6).map(s=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"92px 1fr",gap:8,minWidth:0},children:[t.jsx("span",{style:{color:a.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase"},children:s.label}),t.jsx("span",{style:{color:a.textSecondary,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:s.value.length>90?"normal":"nowrap"},title:s.value,children:s.value})]},s.label))})}function C({title:o,connections:a,t:e}){return a.length===0?t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[o,": none in this focused window"]}):t.jsxs("div",{children:[t.jsx("div",{style:{color:e.textMuted,fontSize:10,fontWeight:700,textTransform:"uppercase",marginBottom:5},children:o}),t.jsxs("div",{style:{display:"grid",gap:4},children:[a.slice(0,5).map(({edge:n,node:s})=>{const m=R[s.type]??e.textMuted;return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"76px 1fr",gap:8,alignItems:"center",fontSize:11,minWidth:0},children:[t.jsx("span",{style:{color:e.textMuted},children:Z[n.type]??n.type}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,minWidth:0},children:[t.jsx("span",{style:{color:e.appBg,background:m,borderRadius:3,padding:"1px 4px",fontSize:8,fontWeight:700,flexShrink:0},children:I[s.type]??s.type.slice(0,4).toUpperCase()}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:s.name,children:s.name})]})]},`${n.source}-${n.target}-${n.type}`)}),a.length>5&&t.jsxs("div",{style:{color:e.textMuted,fontSize:11},children:[a.length-5," more connection",a.length-5===1?"":"s"," in the graph"]})]})]})}function h({title:o,onClick:a,children:e,t:n}){return t.jsx("button",{"aria-label":o,title:o,onClick:a,style:{width:26,height:26,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:`1px solid ${n.headerBorder}`,borderRadius:5,color:n.textSecondary,cursor:"pointer"},onMouseEnter:s=>{s.currentTarget.style.color=n.textPrimary,s.currentTarget.style.background=n.textPrimary+"0f"},onMouseLeave:s=>{s.currentTarget.style.color=n.textSecondary,s.currentTarget.style.background="transparent"},children:e})}export{be as LineageDrawer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as v,j as d,t as _e,Z as Be,_ as he,aq as Ie,a as Te,ar as je,as as ze,at as Oe,R as ye,p as Ne,q as Ke}from"./index-
|
|
1
|
+
import{r as v,j as d,t as _e,Z as Be,_ as he,aq as Ie,a as Te,ar as je,as as ze,at as Oe,R as ye,p as Ne,q as Ke}from"./index-Cpx47jCH.js";import{S as V,g as ve,E as S,s as Qe,a as g,b as Se,c as Ze,P as Ge,d as Ue,e as Ve,F as He,f as Ye,h as we,V as Je,D as q,R as Xe,i as et,C as M,j as ke,k as y,r as tt,l as rt,m as nt,u as st,n as at,t as it,o as ot,p as lt,q as ct,v as ut,w as ht,x as dt,y as ft,z as pt,A as mt,B as gt,G as xt,H as bt,I as yt,J as vt,K as St,L as wt,M as kt,N as de,O as Ct,Q as u}from"./codemirror-DXt7RW72.js";const fe=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class _{constructor(e,r,n=0,s=e.length,a,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=a?o=>a(fe(o)):fe,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ue(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=et(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Ve(e);let s=this.normalize(r);if(s.length)for(let a=0,i=n;;a++){let o=s.charCodeAt(a),l=this.match(o,i,this.bufferPos+this.bufferStart);if(a==s.length-1){if(l)return this.value=l,this;break}i==n&&a<r.length&&r.charCodeAt(a)==o&&i++}}}match(e,r,n){let s=null;for(let a=0;a<this.matches.length;a+=2){let i=this.matches[a],o=!1;this.query.charCodeAt(i)==e&&(i==this.query.length-1?s={from:this.matches[a+1],to:n}:(this.matches[a]++,o=!0)),o||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:r,to:n}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(_.prototype[Symbol.iterator]=function(){return this});const Ce={from:-1,to:-1,match:/.*/.exec("")},ae="gm"+(/x/.unicode==null?"":"u");class Me{constructor(e,r,n,s=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=Ce,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new Le(e,r,n,s,a);this.re=new RegExp(r,ae+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let i=e.lineAt(s);this.curLineStart=i.from,this.matchPos=K(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=K(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<s||n>this.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const J=new WeakMap;class W{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let s=J.get(e);if(!s||s.from>=n||s.to<=r){let o=new W(r,e.sliceString(r,n));return J.set(e,o),o}if(s.from==r&&s.to==n)return s;let{text:a,from:i}=s;return i>r&&(a=e.sliceString(r,i)+a,i=r),s.to<n&&(a+=e.sliceString(s.to,n)),J.set(e,new W(i,a)),new W(r,a.slice(r-i,n-i))}}class Le{constructor(e,r,n,s,a){this.text=e,this.to=a,this.done=!1,this.value=Ce,this.matchPos=K(e,s),this.re=new RegExp(r,ae+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=W.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,match:r},this.matchPos=K(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=W.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Me.prototype[Symbol.iterator]=Le.prototype[Symbol.iterator]=function(){return this});function Mt(t){try{return new RegExp(t,ae),!0}catch{return!1}}function K(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const Lt=t=>{let{state:e}=t,r=String(e.doc.lineAt(t.state.selection.main.head).number),{close:n,result:s}=Qe(t,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:e.phrase("go")});return s.then(a=>{let i=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!i){t.dispatch({effects:n});return}let o=e.doc.lineAt(e.selection.main.head),[,l,c,m,w]=i,k=m?+m.slice(1):0,f=c?+c:o.number;if(c&&w){let E=f/100;l&&(E=E*(l=="-"?-1:1)+o.number/e.doc.lines),f=Math.round(e.doc.lines*E)}else c&&l&&(f=f*(l=="-"?-1:1)+o.number);let T=e.doc.line(Math.max(1,Math.min(e.doc.lines,f))),A=S.cursor(T.from+Math.max(0,Math.min(k,T.length)));t.dispatch({effects:[n,g.scrollIntoView(A.from,{y:"center"})],selection:A})}),!0},Et=({state:t,dispatch:e})=>{let{selection:r}=t,n=S.create(r.ranges.map(s=>t.wordAt(s.head)||S.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function qt(t,e){let{main:r,ranges:n}=t.selection,s=t.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let i=!1,o=new _(t.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new _(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}else{if(i&&n.some(l=>l.from==o.value.from))continue;if(a){let l=t.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}const Rt=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(a=>a.from===a.to))return Et({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(a=>t.sliceDoc(a.from,a.to)!=n))return!1;let s=qt(t,n);return s?(e(t.update({selection:t.selection.addRange(S.range(s.from,s.to),!1),effects:g.scrollIntoView(s.to)})),!0):!1},R=He.define({combine(t){return Ye(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Kt(e),scrollToMatch:e=>g.scrollIntoView(e)})}});function At(t){return t?[R.of(t),se]:se}class Ee{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Mt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
2
2
|
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new _t(this):new Wt(this)}getCursor(e,r=0,n){let s=e.doc?e:we.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?F(this,s,r,n):$(this,s,r,n)}}class qe{constructor(e){this.spec=e}}function $t(t,e,r){return(n,s,a,i)=>{if(r&&!r(n,s,a,i))return!1;let o=n>=i&&s<=i+a.length?a.slice(n-i,s-i):e.doc.sliceString(n,s);return t(o,e,n,s)}}function $(t,e,r,n){let s;return t.wholeWord&&(s=Ft(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=$t(t.test,e,s)),new _(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:a=>a.toLowerCase(),s)}function Ft(t,e){return(r,n,s,a)=>((a>r||a+s.length<n)&&(a=Math.max(0,r-2),s=t.sliceString(a,Math.min(t.length,n+2))),(e(Q(s,r-a))!=M.Word||e(Z(s,r-a))!=M.Word)&&(e(Z(s,n-a))!=M.Word||e(Q(s,n-a))!=M.Word))}class Wt extends qe{constructor(e){super(e)}nextMatch(e,r,n){let s=$(this.spec,e,n,e.doc.length).nextOverlapping();if(s.done){let a=Math.min(e.doc.length,r+this.spec.unquoted.length);s=$(this.spec,e,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==n?null:s.value}prevMatchInRange(e,r,n){for(let s=n;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),i=$(this.spec,e,a,s),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;if(a==r)return null;s-=1e4}}prevMatch(e,r,n){let s=this.prevMatchInRange(e,0,r);return s||(s=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=r||s.to!=n)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=$(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let a=$(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function Pt(t,e,r){return(n,s,a)=>(!r||r(n,s,a))&&t(a[0],e,n,s)}function F(t,e,r,n){let s;return t.wholeWord&&(s=Dt(e.charCategorizer(e.selection.main.head))),t.test&&(s=Pt(t.test,e,s)),new Me(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},r,n)}function Q(t,e){return t.slice(ke(t,e,!1),e)}function Z(t,e){return t.slice(e,ke(t,e))}function Dt(t){return(e,r,n)=>!n[0].length||(t(Q(n.input,n.index))!=M.Word||t(Z(n.input,n.index))!=M.Word)&&(t(Z(n.input,n.index+n[0].length))!=M.Word||t(Q(n.input,n.index+n[0].length))!=M.Word)}class _t extends qe{nextMatch(e,r,n){let s=F(this.spec,e,n,e.doc.length).next();return s.done&&(s=F(this.spec,e,0,r).next()),s.done?null:s.value}prevMatchInRange(e,r,n){for(let s=1;;s++){let a=Math.max(r,n-s*1e4),i=F(this.spec,e,a,n),o=null;for(;!i.next().done;)o=i.value;if(o&&(a==r||o.from>a+10))return o;if(a==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let a=+n.slice(0,s);if(a>0&&a<e.match.length)return e.match[a]+n.slice(s)}return r})}matchAll(e,r){let n=F(this.spec,e,0,e.doc.length),s=[];for(;!n.next().done;){if(s.length>=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let a=F(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const B=V.define(),ie=V.define(),L=Se.define({create(t){return new X(ne(t).create(),null)},update(t,e){for(let r of e.effects)r.is(B)?t=new X(r.value.create(),t.panel):r.is(ie)&&(t=new X(t.query,r.value?oe:null));return t},provide:t=>Ze.from(t,e=>e.panel)});class X{constructor(e,r){this.query=e,this.panel=r}}const Bt=q.mark({class:"cm-searchMatch"}),It=q.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Tt=Je.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(L))}update(t){let e=t.state.field(L);(e!=t.startState.field(L)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return q.none;let{view:r}=this,n=new Xe;for(let s=0,a=r.visibleRanges,i=a.length;s<i;s++){let{from:o,to:l}=a[s];for(;s<i-1&&l>a[s+1].from-500;)l=a[++s].to;t.highlight(r.state,o,l,(c,m)=>{let w=r.state.selection.ranges.some(k=>k.from==c&&k.to==m);n.add(c,m,w?It:Bt)})}return n.finish()}},{decorations:t=>t.decorations});function I(t){return e=>{let r=e.state.field(L,!1);return r&&r.query.spec.valid?t(e,r):$e(e)}}const G=I((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let s=S.single(n.from,n.to),a=t.state.facet(R);return t.dispatch({selection:s,effects:[le(t,n),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),Ae(t),!0}),U=I((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,s=e.prevMatch(r,n,n);if(!s)return!1;let a=S.single(s.from,s.to),i=t.state.facet(R);return t.dispatch({selection:a,effects:[le(t,s),i.scrollToMatch(a.main,t)],userEvent:"select.search"}),Ae(t),!0}),jt=I((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:S.create(r.map(n=>S.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),zt=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,a=[],i=0;for(let o=new _(t.doc,t.sliceDoc(n,s));!o.next().done;){if(a.length>1e3)return!1;o.value.from==n&&(i=a.length),a.push(S.range(o.value.from,o.value.to))}return e(t.update({selection:S.create(a,i),userEvent:"select.search.matches"})),!0},pe=I((t,{query:e})=>{let{state:r}=t,{from:n,to:s}=r.selection.main;if(r.readOnly)return!1;let a=e.nextMatch(r,n,n);if(!a)return!1;let i=a,o=[],l,c,m=[];i.from==n&&i.to==s&&(c=r.toText(e.getReplacement(i)),o.push({from:i.from,to:i.to,insert:c}),i=e.nextMatch(r,i.from,i.to),m.push(g.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let w=t.state.changes(o);return i&&(l=S.single(i.from,i.to).map(w),m.push(le(t,i)),m.push(r.facet(R).scrollToMatch(l.main,t))),t.dispatch({changes:w,selection:l,effects:m,userEvent:"input.replace"}),!0}),Ot=I((t,{query:e})=>{if(t.state.readOnly)return!1;let r=e.matchAll(t.state,1e9).map(s=>{let{from:a,to:i}=s;return{from:a,to:i,insert:e.getReplacement(s)}});if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:g.announce.of(n),userEvent:"input.replace.all"}),!0});function oe(t){return t.state.facet(R).createPanel(t)}function ne(t,e){var r,n,s,a,i;let o=t.selection.main,l=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!l)return e;let c=t.facet(R);return new Ee({search:((r=e==null?void 0:e.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e==null?void 0:e.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(s=e==null?void 0:e.literal)!==null&&s!==void 0?s:c.literal,regexp:(a=e==null?void 0:e.regexp)!==null&&a!==void 0?a:c.regexp,wholeWord:(i=e==null?void 0:e.wholeWord)!==null&&i!==void 0?i:c.wholeWord})}function Re(t){let e=ve(t,oe);return e&&e.dom.querySelector("[main-field]")}function Ae(t){let e=Re(t);e&&e==t.root.activeElement&&e.select()}const $e=t=>{let e=t.state.field(L,!1);if(e&&e.panel){let r=Re(t);if(r&&r!=t.root.activeElement){let n=ne(t.state,e.query.spec);n.valid&&t.dispatch({effects:B.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[ie.of(!0),e?B.of(ne(t.state,e.query.spec)):V.appendConfig.of(se)]});return!0},Fe=t=>{let e=t.state.field(L,!1);if(!e||!e.panel)return!1;let r=ve(t,oe);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ie.of(!1)}),!0},Nt=[{key:"Mod-f",run:$e,scope:"editor search-panel"},{key:"F3",run:G,shift:U,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:G,shift:U,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Fe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:zt},{key:"Mod-Alt-g",run:Lt},{key:"Mod-d",run:Rt,preventDefault:!0}];class Kt{constructor(e){this.view=e;let r=this.query=e.state.field(L).query.spec;this.commit=this.commit.bind(this),this.searchField=y("input",{value:r.search,placeholder:b(e,"Find"),"aria-label":b(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=y("input",{value:r.replace,placeholder:b(e,"Replace"),"aria-label":b(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=y("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=y("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=y("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(s,a,i){return y("button",{class:"cm-button",name:s,onclick:a,type:"button"},i)}this.dom=y("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>G(e),[b(e,"next")]),n("prev",()=>U(e),[b(e,"previous")]),n("select",()=>jt(e),[b(e,"all")]),y("label",null,[this.caseField,b(e,"match case")]),y("label",null,[this.reField,b(e,"regexp")]),y("label",null,[this.wordField,b(e,"by word")]),...e.state.readOnly?[]:[y("br"),this.replaceField,n("replace",()=>pe(e),[b(e,"replace")]),n("replaceAll",()=>Ot(e),[b(e,"replace all")])],y("button",{name:"close",onclick:()=>Fe(e),"aria-label":b(e,"close"),type:"button"},["×"])])}commit(){let e=new Ee({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:B.of(e)}))}keydown(e){tt(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?U:G)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),pe(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(B)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(R).top}}function b(t,e){return t.state.phrase(e)}const z=30,O=/[\s\.,:;?!]/;function le(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),s=t.state.doc.lineAt(r).to,a=Math.max(n.from,e-z),i=Math.min(s,r+z),o=t.state.sliceDoc(a,i);if(a!=n.from){for(let l=0;l<z;l++)if(!O.test(o[l+1])&&O.test(o[l])){o=o.slice(l);break}}if(i!=s){for(let l=o.length-1;l>o.length-z;l--)if(!O.test(o[l-1])&&O.test(o[l])){o=o.slice(0,l);break}}return g.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${n.number}.`)}const Qt=g.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),se=[L,Ge.low(Tt),Qt],me=[{name:"domain",detail:"business domain (namespace)"},{name:"owner",detail:"accountable owner — required to certify"},{name:"description",detail:"business-facing description"},{name:"status",detail:"draft | certified"},{name:"pattern",detail:"reusable block pattern"},{name:"grain",detail:'row grain, e.g. "one row per customer"'},{name:"outputs",detail:"declared output column names"},{name:"entities",detail:'business entities, e.g. ["order"]'},{name:"tags",detail:"discoverability tags"},{name:"llmContext",detail:"when an agent should use this block"},{name:"reviewCadence",detail:"how often to re-review"},{name:"sourceSystems",detail:"upstream source systems"},{name:"dimensions",detail:"queryable dimensions"},{name:"allowedFilters",detail:"filters an app may bind"},{name:"filterBindings",detail:"filter → column map (app-ready)",snippet:`filterBindings {
|
|
3
3
|
$0
|
|
4
4
|
}`},{name:"parameterPolicy",detail:"per-parameter reuse policy",snippet:`parameterPolicy {
|