@duckcodeailabs/dql-cli 1.12.11 → 1.13.0
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/apps-api.d.ts +151 -3
- package/dist/apps-api.d.ts.map +1 -1
- package/dist/apps-api.js +675 -97
- package/dist/apps-api.js.map +1 -1
- package/dist/assets/dql-notebook/assets/AgentAnswerCard-Cp0eh6zU.js +5 -0
- package/dist/assets/dql-notebook/assets/{AgentLogPage-hzHqpD3-.js → AgentLogPage-CBGEoGmU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-BQRWoxp9.js → AiBuildDialog-CwAD3tXE.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildResult-D9t_4sQl.js → AiBuildResult-CyqTuQe5.js} +1 -1
- package/dist/assets/dql-notebook/assets/AiSidePanel-DjB8PWHG.js +6 -0
- package/dist/assets/dql-notebook/assets/AnalyticsHome-B7BkvA-R.js +6 -0
- package/dist/assets/dql-notebook/assets/AppsView-CUrqtEGC.js +4583 -0
- package/dist/assets/dql-notebook/assets/BlockStudio-Bl0aGQJR.js +60 -0
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-CnTbFVGT.js → BusinessArtifactView-C4SZVNW-.js} +1 -1
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-B0uxitnx.js +22 -0
- package/dist/assets/dql-notebook/assets/GitPage-BfVD4tVq.js +7 -0
- package/dist/assets/dql-notebook/assets/GlobalAiRail-DUwdy3fB.js +1 -0
- package/dist/assets/dql-notebook/assets/GovernedContextPage-D9f26ZFb.js +7 -0
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-CL0vbSER.js → HelpDocsPage-BDPNVot1.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HomePage-DzAucwBW.js → HomePage-DiOnRhEG.js} +1 -1
- package/dist/assets/dql-notebook/assets/LineageDAG-BiUFX2KL.js +1 -0
- package/dist/assets/dql-notebook/assets/{LineageDetailView-DdVH-nz6.js → LineageDetailView-CfbSvlPJ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-BvrVZNKY.js → LineageDrawer-CgTScaGB.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-CSut-zvm.js → LineagePathBreadcrumb-D7ZA7k68.js} +3 -3
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-zg_1wW3M.js → MiniLineageGraph-GkD4y17x.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewBlockModal-9cDletl-.js → NewBlockModal-B9TfRjt7.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewNotebookModal-V6de8L4d.js → NewNotebookModal-BbO9NKUl.js} +2 -2
- package/dist/assets/dql-notebook/assets/NotebookEditor-CuMpvXR9.js +200 -0
- package/dist/assets/dql-notebook/assets/ReadinessPage-BROJ9YBM.js +1 -0
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-Bg-MjbC9.js → SetupOnboarding-BCcZlpuQ.js} +2 -2
- package/dist/assets/dql-notebook/assets/{TrustBadge-DGuHB8kP.js → TrustBadge-vQQh8d0D.js} +1 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-Dj4AXAhT.js +83 -0
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-BDzY4MuQ.js → answer-to-notebook-DuqCcDDl.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-IjlnAihE.js → arrow-left-CMe1kkOL.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-BI4cXgOY.js → arrow-right-DvB_DONr.js} +1 -1
- package/dist/assets/dql-notebook/assets/{book-open-text-i6xhxu_I.js → book-open-text-CJ3NAvrs.js} +1 -1
- package/dist/assets/dql-notebook/assets/{bot-C6DE7Q6m.js → bot-CV8DYRrt.js} +1 -1
- package/dist/assets/dql-notebook/assets/{chevron-up-DSEILnDs.js → chevron-up-HxU1l85K.js} +1 -1
- package/dist/assets/dql-notebook/assets/{circle-x-BoAorVSm.js → circle-x-BCgtha1W.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-CycymVj6.js → dagre.esm-GKp7qoUL.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-ZwE5iHsX.js → external-link-C-PXokWV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-Dnp2st8l.js → grip-vertical-B4EHbGXW.js} +1 -1
- package/dist/assets/dql-notebook/assets/index-1mIC_XX4.js +634 -0
- package/dist/assets/dql-notebook/assets/{link-2-CTKe6Snr.js → link-2-BLx-goet.js} +1 -1
- package/dist/assets/dql-notebook/assets/{list-tree-Ced8e_S1.js → list-tree-BRFpEmvV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{maximize-2-Cojc6867.js → maximize-2-CCd5uRIZ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-CBIAE0XH.js → minimize-2-CDwSCGlO.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-po3bWSeL.js → panel-right-open-CunA1xO7.js} +1 -1
- package/dist/assets/dql-notebook/assets/{pencil-Cb45c6WU.js → pencil-D_I14Wyk.js} +1 -1
- package/dist/assets/dql-notebook/assets/{rotate-ccw-B9v1LTJ0.js → rotate-ccw-DOrfTZk8.js} +1 -1
- package/dist/assets/dql-notebook/assets/{semantic-fields-B6ii0an0.js → semantic-fields-AfQvjt5R.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-CO4tfaDq.js → star-DDhv4e8M.js} +1 -1
- package/dist/assets/dql-notebook/assets/{triangle-alert-BSdIu2El.js → triangle-alert-2ZXx8wAu.js} +1 -1
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-3rzkZrqc.js +18 -0
- package/dist/assets/dql-notebook/assets/{user-round-BfrV8U-W.js → user-round-BA074kiQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wand-sparkles-BgTxZNBc.js → wand-sparkles-CEYHLt9b.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow--2ycp0yy.js → workflow-CZtyrcR-.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wrench-LMCrpa9_.js → wrench-Ong23-wu.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-CeNgQwGm.js → x-CSo1M3tu.js} +1 -1
- package/dist/assets/dql-notebook/index.html +1 -1
- package/dist/llm/providers/dql-agent-provider.d.ts +4 -3
- package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
- package/dist/llm/providers/dql-agent-provider.js +13 -10
- package/dist/llm/providers/dql-agent-provider.js.map +1 -1
- package/dist/local-operation-coordinator.d.ts +59 -0
- package/dist/local-operation-coordinator.d.ts.map +1 -0
- package/dist/local-operation-coordinator.js +256 -0
- package/dist/local-operation-coordinator.js.map +1 -0
- package/dist/local-runtime.d.ts +49 -1
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +1590 -323
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +12 -11
- package/dist/project-refresh-coordinator.d.ts +19 -0
- package/dist/project-refresh-coordinator.d.ts.map +1 -0
- package/dist/project-refresh-coordinator.js +134 -0
- package/dist/project-refresh-coordinator.js.map +1 -0
- package/dist/project-refresh-worker.d.ts +13 -0
- package/dist/project-refresh-worker.d.ts.map +1 -0
- package/dist/project-refresh-worker.js +58 -0
- package/dist/project-refresh-worker.js.map +1 -0
- package/package.json +13 -11
- package/dist/assets/dql-notebook/assets/AgentAnswerCard-CpL2kDCV.js +0 -5
- package/dist/assets/dql-notebook/assets/AiSidePanel-BCQB9rVF.js +0 -6
- package/dist/assets/dql-notebook/assets/AnalyticsHome-Ba4Ve_Gd.js +0 -6
- package/dist/assets/dql-notebook/assets/AppsView-CdAT9BOq.js +0 -4466
- package/dist/assets/dql-notebook/assets/BlockStudio-Brg4fwn5.js +0 -60
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-CQe2FUZq.js +0 -22
- package/dist/assets/dql-notebook/assets/GitPage-DHyDBChc.js +0 -7
- package/dist/assets/dql-notebook/assets/GlobalAiRail-Cys4n_rq.js +0 -1
- package/dist/assets/dql-notebook/assets/GovernedContextPage-DyKoDSZ2.js +0 -7
- package/dist/assets/dql-notebook/assets/LineageDAG-QHqd_AM5.js +0 -1
- package/dist/assets/dql-notebook/assets/NotebookEditor-EZ0pfWVs.js +0 -200
- package/dist/assets/dql-notebook/assets/ReadinessPage-BaGvjyfd.js +0 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BlWAVEwO.js +0 -83
- package/dist/assets/dql-notebook/assets/index-BTuliKhK.js +0 -634
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-CkVFrrjk.js +0 -18
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{c as Ue,u as he,t as Se,r as a,a as D,j as e,a0 as se,Y as fe,L as F,S as ne,P as X,B as Qe,d as Ee,T as ie,X as Be,a1 as Ye,J as ae,N as We,h as Je,aG as Ae,f as Ve}from"./index-BTuliKhK.js";import{T as Oe}from"./triangle-alert-BSdIu2El.js";import{U as Ie,G as re}from"./user-round-BfrV8U-W.js";import{C as Le}from"./chevron-up-DSEILnDs.js";import{P as Ne}from"./pencil-Cb45c6WU.js";import{X as ye}from"./x-CeNgQwGm.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 Xe=[["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"}]],Ze=Ue("tags",Xe),oe="dql-context-bootstrap-session",le="dql-context-bootstrap-selection";function et(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function Te(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function tt(){return{id:"",name:"",owner:"",boundedContext:"",sourceSystems:[],description:""}}function nt({embedded:t=!1}={}){const{state:n,dispatch:l}=he(),i=Se[n.themeMode],[s,d]=a.useState([]),[o,r]=a.useState(!0),[g,S]=a.useState(null),[v,c]=a.useState(null),[W,j]=a.useState(null),[p,h]=a.useState(!1),[R,I]=a.useState(null),[m,E]=a.useState(null),[y,w]=a.useState(!1),[P,A]=a.useState(!1),[O,$]=a.useState(null),[b,x]=a.useState([]),T=a.useCallback(()=>{let f=!1;return r(!0),S(null),D.getDomains().then(C=>{if(f)return;const B=Array.isArray(C==null?void 0:C.domains)?C.domains:[];d(B),l({type:"SET_AUTHORED_DOMAINS",domains:B})}).catch(C=>{f||(d([]),S(C instanceof Error&&C.message?C.message:"Could not load domains. Is the local DQL server running?"))}).finally(()=>{f||r(!1)}),()=>{f=!0}},[l]);a.useEffect(()=>T(),[T]),a.useEffect(()=>{const f=window.sessionStorage.getItem(oe);let C=!1;const B=u=>{if(u&&!C){E(u);try{const k=JSON.parse(window.sessionStorage.getItem(le)??"[]");x(Array.isArray(k)?k.filter(_=>typeof _=="string"):u.candidates.filter(_=>_.action!=="unchanged").map(_=>_.id))}catch{x(u.candidates.filter(k=>k.action!=="unchanged").map(k=>k.id))}}};return(f?D.getContextBootstrap(f):D.getLatestContextBootstrap()).then(B).catch(async()=>{window.sessionStorage.removeItem(oe),window.sessionStorage.removeItem(le),f&&B(await D.getLatestContextBootstrap().catch(()=>null))}),()=>{C=!0}},[]),a.useEffect(()=>{m&&(window.sessionStorage.setItem(oe,m.id),window.sessionStorage.setItem(le,JSON.stringify(b)))},[m==null?void 0:m.id,b]);const L=a.useMemo(()=>[...s].sort((f,C)=>f.name.localeCompare(C.name)),[s]),z=a.useCallback(f=>{d(C=>{const B=C.findIndex(u=>u.id===f.id),M=B===-1?[...C,f]:[...C];return B!==-1&&(M[B]=f),l({type:"SET_AUTHORED_DOMAINS",domains:M}),M}),c(null)},[l]),U=a.useCallback(async()=>{if(W){h(!0),I(null);try{await D.deleteDomain(W.id),d(f=>{const C=f.filter(B=>B.id!==W.id);return l({type:"SET_AUTHORED_DOMAINS",domains:C}),C}),j(null)}catch(f){I(f instanceof Error&&f.message?f.message:"Could not delete this domain.")}finally{h(!1)}}},[l,W]),N=a.useCallback(async()=>{w(!0),$(null);try{const f=await D.startContextBootstrap({ai:!0});E(f);const C=f.candidates.filter(B=>B.action!=="unchanged").map(B=>B.id);x(C),window.sessionStorage.setItem(oe,f.id),window.sessionStorage.setItem(le,JSON.stringify(C))}catch(f){$(f instanceof Error?f.message:"Could not draft repository context.")}finally{w(!1)}},[]);a.useEffect(()=>{if(!t)return;const f=()=>{N()};return window.addEventListener("dql:context-build",f),()=>window.removeEventListener("dql:context-build",f)},[t,N]),a.useEffect(()=>{if(!m||["ready","needs_attention"].includes(m.status))return;let f=!1;const C=async()=>{try{const M=await D.getContextBootstrap(m.id);f||E(M)}catch(M){f||$(M instanceof Error?M.message:"Could not update AI draft progress.")}};C();const B=window.setInterval(()=>void C(),750);return()=>{f=!0,window.clearInterval(B)}},[m==null?void 0:m.id,m==null?void 0:m.status]);const J=a.useCallback(async()=>{if(!(!m||b.length===0)){A(!0),$(null);try{await D.saveContextBootstrapSelected(m.id,b),E(null),x([]),window.sessionStorage.removeItem(oe),window.sessionStorage.removeItem(le),T()}catch(f){$(f instanceof Error?f.message:"Could not save selected drafts.")}finally{A(!1)}}},[m,b,T]);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(se,{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:()=>T(),title:"Refresh",style:Z(i),children:[e.jsx(fe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void N(),disabled:y,style:Z(i),children:[y?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(ne,{size:13,strokeWidth:2})," Draft with AI"]}),e.jsxs("button",{type:"button",onClick:()=>c({kind:"create"}),style:pe(i),children:[e.jsx(X,{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…"]}):g?e.jsx(ot,{t:i,message:g,onRetry:()=>T()}):L.length===0?e.jsx(rt,{t:i,onAdd:()=>c({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:L.map(f=>e.jsx(it,{domain:f,t:i,onEdit:()=>c({kind:"edit",domain:f}),onDelete:()=>{I(null),j(f)}},f.id))}),O?e.jsx("div",{style:{marginTop:12},children:e.jsx(ce,{t:i,tone:"error",children:O})}):null,m?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:P||b.length===0||!["ready","needs_attention"].includes(m.status),onClick:()=>void J(),style:{...pe(i),opacity:P||b.length===0||!["ready","needs_attention"].includes(m.status)?.55:1},children:[P?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(X,{size:13,strokeWidth:2})," Save selected drafts"]})]}),e.jsx(lt,{t:i,session:m}),e.jsx("div",{style:{display:"grid",gap:9,marginTop:12},children:m.candidates.map(f=>{const C=f.action!=="unchanged",B=b.includes(f.id);return e.jsx(at,{candidate:f,selected:B,selectable:C,disabled:P,t:i,onToggle:()=>x(M=>B?M.filter(u=>u!==f.id):[...M,f.id])},f.id)})})]}):null]}),v?e.jsx(st,{mode:v,existingIds:s.map(f=>f.id),domains:s,t:i,onClose:()=>c(null),onSaved:z}):null,W?e.jsx(dt,{domain:W,t:i,deleting:p,error:R,onCancel:()=>{p||j(null)},onConfirm:U}):null]})}function it({domain:t,t:n,onEdit:l,onDelete:i}){const s=t.sourceSystems??[],[d,o]=a.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:ke(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(Ie,{size:11,strokeWidth:2})," ",t.owner]}):null,t.businessOwner?e.jsxs("span",{style:ke(n),children:[e.jsx(Ie,{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."}),s.length>0?e.jsx("div",{style:{display:"flex",gap:5,marginTop:9,flexWrap:"wrap"},children:s.map(r=>e.jsx("span",{style:we(n),children:r},r))}):null,e.jsxs("div",{style:{display:"flex",gap:7,marginTop:9,flexWrap:"wrap"},children:[e.jsx(be,{t:n,icon:e.jsx(Qe,{size:11,strokeWidth:2}),label:"blocks",count:t.blockCount??0}),e.jsx(be,{t:n,icon:e.jsx(re,{size:11,strokeWidth:2}),label:"skills",count:t.skillCount??0}),e.jsx(be,{t:n,icon:e.jsx(Ze,{size:11,strokeWidth:2}),label:"terms",count:t.termCount??0})]}),d?e.jsxs("div",{style:{display:"grid",gap:9,marginTop:12,paddingTop:11,borderTop:`1px solid ${n.btnBorder}`},children:[t.boundedContext?e.jsx(De,{t:n,label:"Business boundary",children:t.boundedContext}):null,t.businessOutcome?e.jsx(De,{t:n,label:"Decision outcome",children:t.businessOutcome}):null,e.jsx(de,{t:n,label:"In scope",values:t.inScope,empty:"Not defined yet"}),e.jsx(de,{t:n,label:"Out of scope",values:t.outOfScope,empty:"Not defined yet"}),e.jsx(de,{t:n,label:"Primary terms",values:t.primaryTerms,empty:"No terms linked yet"}),e.jsx(de,{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:{...Z(n),padding:"5px 7px",fontSize:11.5},title:d?"Hide domain details":"Show domain details",children:[d?e.jsx(Le,{size:13}):e.jsx(Ee,{size:13}),d?"Less":"Details"]}),e.jsx("button",{type:"button",onClick:l,style:ve(n),title:"Edit domain",children:e.jsx(Ne,{size:13,strokeWidth:2})}),e.jsx("button",{type:"button",onClick:i,style:ve(n),title:"Delete domain",children:e.jsx(ie,{size:13,strokeWidth:2})})]})]})}function st({mode:t,existingIds:n,domains:l,t:i,onClose:s,onSaved:d}){const o=t.kind==="edit",[r,g]=a.useState(()=>t.kind==="edit"?{...t.domain}:tt()),[S,v]=a.useState(o),[c,W]=a.useState(!1),[j,p]=a.useState(null),h=a.useCallback((y,w)=>{g(P=>({...P,[y]:w}))},[]),R=y=>{g(w=>({...w,name:y,...!o&&!S?{id:Te(y)}:{}}))},I=!o&&r.id.length>0&&n.includes(r.id),m=r.id.trim().length>0&&r.name.trim().length>0&&!I&&!c,E=a.useCallback(async()=>{var w,P,A,O,$;const y={...r,id:r.id.trim(),name:r.name.trim(),owner:(w=r.owner)!=null&&w.trim()?r.owner.trim():void 0,businessOwner:(P=r.businessOwner)!=null&&P.trim()?r.businessOwner.trim():void 0,parent:(A=r.parent)!=null&&A.trim()?r.parent.trim():void 0,boundedContext:(O=r.boundedContext)!=null&&O.trim()?r.boundedContext.trim():void 0,description:($=r.description)!=null&&$.trim()?r.description.trim():void 0,sourceSystems:(r.sourceSystems??[]).map(b=>b.trim()).filter(Boolean),primaryTerms:(r.primaryTerms??[]).map(b=>b.trim()).filter(Boolean),tags:(r.tags??[]).map(b=>b.trim()).filter(Boolean),inScope:(r.inScope??[]).map(b=>b.trim()).filter(Boolean),outOfScope:(r.outOfScope??[]).map(b=>b.trim()).filter(Boolean),dbtGroups:(r.dbtGroups??[]).map(b=>b.trim()).filter(Boolean),dbtPaths:(r.dbtPaths??[]).map(b=>b.trim()).filter(Boolean),dbtTags:(r.dbtTags??[]).map(b=>b.trim()).filter(Boolean),semanticDomains:(r.semanticDomains??[]).map(b=>b.trim()).filter(Boolean),semanticTags:(r.semanticTags??[]).map(b=>b.trim()).filter(Boolean)};W(!0),p(null);try{const b=o?await D.updateDomain(y.id,y):await D.createDomain(y);d(b.domain??y)}catch(b){p(b instanceof Error&&b.message?b.message:"Could not save this domain. Try again.")}finally{W(!1)}},[r,o,d]);return e.jsx("div",{style:gt,onClick:()=>!c&&s(),children:e.jsxs("div",{style:ht(i),onClick:y=>y.stopPropagation(),children:[e.jsxs("div",{style:ft(i),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(se,{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&&s(),style:ve(i),title:"Close",children:e.jsx(ye,{size:15,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"16px 18px",display:"grid",gap:16},children:[e.jsx(G,{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:y=>R(y.target.value),placeholder:"Revenue",style:Q(i)})}),e.jsxs(G,{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:y=>{v(!0),h("id",et(y.target.value))},onBlur:()=>h("id",Te(r.id)),placeholder:"revenue",style:{...Q(i),fontFamily:i.fontMono,opacity:o?.7:1}}),I?e.jsx(ce,{t:i,tone:"error",children:"A domain with this id already exists."}):null]}),e.jsx(G,{label:"Parent domain",t:i,hint:"Optional. Depth becomes Domain, Subdomain, Microdomain, and beyond.",children:e.jsxs("select",{value:r.parent??"",onChange:y=>h("parent",y.target.value||void 0),style:Q(i),children:[e.jsx("option",{value:"",children:"Top-level domain"}),l.filter(y=>y.id!==r.id).map(y=>e.jsx("option",{value:y.id,children:y.name},y.id))]})}),e.jsx(G,{label:"Owner",t:i,hint:"The team or person accountable for this domain.",children:e.jsx("input",{type:"text",value:r.owner??"",onChange:y=>h("owner",y.target.value),placeholder:"finance-analytics",style:Q(i)})}),e.jsx(G,{label:"Business owner",t:i,hint:"The stakeholder accountable for business use and definitions.",children:e.jsx("input",{type:"text",value:r.businessOwner??"",onChange:y=>h("businessOwner",y.target.value),placeholder:"Revenue Operations",style:Q(i)})}),e.jsx(G,{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:y=>h("boundedContext",y.target.value),placeholder:"Recognized revenue and invoicing",style:Q(i)})}),e.jsx(G,{label:"Source systems",t:i,hint:"The upstream systems this domain draws from — type a name and press Enter.",children:e.jsx(me,{t:i,values:r.sourceSystems??[],onChange:y=>h("sourceSystems",y),placeholder:"Add a source system…"})}),e.jsx(G,{label:"Primary terms",t:i,hint:"Business concepts the agent should use to recognize this domain.",children:e.jsx(me,{t:i,values:r.primaryTerms??[],onChange:y=>h("primaryTerms",y),placeholder:"Add a term…"})}),e.jsx(G,{label:"Scope tags",t:i,hint:"Short labels used for routing and discovery.",children:e.jsx(me,{t:i,values:r.tags??[],onChange:y=>h("tags",y),placeholder:"Add a tag…"})}),e.jsx(G,{label:"Description",t:i,hint:"What this domain covers and how it's used.",children:e.jsx("textarea",{value:r.description??"",onChange:y=>h("description",y.target.value),rows:5,placeholder:"All recognized-revenue metrics and the blocks that report them, sourced from the billing warehouse.",style:pt(i)})}),j?e.jsx(ce,{t:i,tone:"error",children:j}):null]}),e.jsxs("div",{style:yt(i),children:[e.jsx("button",{type:"button",onClick:()=>!c&&s(),style:Z(i),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:E,disabled:!m,style:{...pe(i),opacity:m?1:.55},children:[c?e.jsx(F,{size:13,strokeWidth:2}):null,c?"Saving…":o?"Save changes":"Create domain"]})]})]})})}function me({t,values:n,onChange:l,placeholder:i}){const[s,d]=a.useState(""),o=r=>{const g=r.trim();!g||n.includes(g)||(l([...n,g]),d(""))};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:ut(t),children:[r,e.jsx("button",{type:"button",onClick:()=>l(n.filter(g=>g!==r)),style:xt(t),title:"Remove",children:e.jsx(ye,{size:11,strokeWidth:2.4})})]},r))}):null,e.jsx("input",{type:"text",value:s,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),o(s))},placeholder:i,style:Q(t)})]})}function rt({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(se,{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:{...pe(t),marginTop:4},children:[e.jsx(X,{size:14,strokeWidth:2.2})," Add your first domain"]})]})}function ot({t,message:n,onRetry:l}){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(Oe,{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:l,style:{...Z(t),marginTop:10},children:[e.jsx(fe,{size:13,strokeWidth:2})," Retry"]})]})]})}function lt({t,session:n}){var s;const l=!["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:[l?e.jsx(F,{size:14,strokeWidth:2,color:t.accent}):e.jsx(ne,{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}),(s=n.warnings)!=null&&s.length?e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.warning,lineHeight:1.45},children:n.warnings.slice(-2).join(" ")}):null]})}function at({candidate:t,selected:n,selectable:l,disabled:i,t:s,onToggle:d}){var W,j,p,h,R,I,m,E,y,w,P,A,O,$,b,x,T,L,z,U,N,J,f,C,B,M;const[o,r]=a.useState(!1),g=t.kind==="domain",S=((W=t.domain)==null?void 0:W.name)??((j=t.skill)==null?void 0:j.id)??t.id.replace(/^(domain|skill):/,""),v=g?((p=t.domain)==null?void 0:p.description)??((h=t.domain)==null?void 0:h.boundedContext):((R=t.skill)==null?void 0:R.description)??((m=(I=t.skill)==null?void 0:I.body)==null?void 0:m.split(`
|
|
7
|
-
`).find(Boolean)),c=g?[["Business outcome",(E=t.domain)==null?void 0:E.businessOutcome],["In scope",(w=(y=t.domain)==null?void 0:y.inScope)==null?void 0:w.join(" · ")],["Out of scope",(A=(P=t.domain)==null?void 0:P.outOfScope)==null?void 0:A.join(" · ")],["Primary terms",($=(O=t.domain)==null?void 0:O.primaryTerms)==null?void 0:$.join(" · ")]]:[["Applies when",(x=(b=t.skill)==null?void 0:b.triggers)==null?void 0:x.join(" · ")],["Ask first when",(L=(T=t.skill)==null?void 0:T.clarifyWhen)==null?void 0:L.join(" · ")],["Avoid when",(U=(z=t.skill)==null?void 0:z.exclusions)==null?void 0:U.join(" · ")],["Preferred metrics",(J=(N=t.skill)==null?void 0:N.preferredMetrics)==null?void 0:J.join(" · ")],["Preferred blocks",(C=(f=t.skill)==null?void 0:f.preferredBlocks)==null?void 0:C.join(" · ")]];return e.jsx("article",{style:{border:`1px solid ${n?`${s.accent}66`:s.btnBorder}`,background:n?`${s.accent}08`:s.appBg,borderRadius:8,padding:"10px 11px",opacity:l?1:.72},children:e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("input",{"aria-label":`Select ${g?"domain":"skill"} ${S}`,type:"checkbox",disabled:!l||i,checked:n,onChange:d,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:s.textPrimary,fontSize:12.5},children:[g?"Domain":"Skill"," · ",S]}),e.jsx("span",{style:ke(s),children:t.action.replace("_"," ")}),e.jsxs("span",{style:{fontSize:11,color:s.textMuted},children:[Math.round(t.confidence*100),"% evidence confidence"]})]}),v?e.jsx("p",{style:{marginTop:5,color:s.textSecondary,fontSize:12,lineHeight:1.45},children:v}):e.jsx("p",{style:{marginTop:5,color:s.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(u=>e.jsx("span",{style:we(s),children:u},u))}),o?e.jsxs("div",{style:{marginTop:9,display:"grid",gap:6,borderTop:`1px solid ${s.btnBorder}`,paddingTop:9},children:[c.filter(([,u])=>!!u).map(([u,k])=>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:s.textMuted},children:u}),e.jsx("span",{style:{color:s.textSecondary},children:k})]},u)),!g&&((B=t.skill)!=null&&B.body)?e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontFamily:s.font,fontSize:11.5,color:s.textSecondary,background:s.cellBg,padding:9,borderRadius:6,maxHeight:180,overflow:"auto"},children:t.skill.body}):null,(M=t.notes)!=null&&M.length?e.jsx("div",{style:{fontSize:11.5,color:s.accent},children:t.notes.join(" ")}):null]}):null]}),e.jsxs("button",{type:"button",onClick:()=>r(u=>!u),style:{...Z(s),padding:"4px 6px",fontSize:11.5},"aria-expanded":o,children:[o?e.jsx(Le,{size:13}):e.jsx(Ee,{size:13}),o?"Less":"Review"]})]})})}function dt({domain:t,t:n,deleting:l,error:i,onCancel:s,onConfirm:d}){return e.jsx("div",{style:mt,onClick:s,children:e.jsxs("div",{style:bt(n),onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(ie,{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(ce,{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:s,disabled:l,style:Z(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:d,disabled:l,style:{...ct(n),opacity:l?.6:1},children:[l?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(ie,{size:13,strokeWidth:2}),l?"Deleting…":"Delete"]})]})]})})}function be({t,icon:n,label:l,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," ",l]})}function De({t,label:n,children:l}){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:l})]})}function de({t,label:n,values:l,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:l!=null&&l.length?l.map(s=>e.jsx("span",{style:we(t),children:s},s)):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:i})})]})}function G({label:t,hint:n,t:l,children:i}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:l.textPrimary},children:t}),n?e.jsx("div",{style:{fontSize:11.5,color:l.textMuted,lineHeight:1.45,marginTop:-2},children:n}):null,i]})}function ce({t,tone:n,children:l}){const i=n==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:i,lineHeight:1.45},children:l})}function pe(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 Z(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 ve(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 pt(t){return{...Q(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function ke(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 we(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 ut(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 xt(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:t.textMuted,cursor:"pointer",padding:2,borderRadius:4}}const gt={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",justifyContent:"flex-end",zIndex:60};function ht(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 ft(t){return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:`1px solid ${t.headerBorder}`,flexShrink:0}}function yt(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 bt(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 jt(t,n,l){var d,o;if(n&&t.domain!==n&&!((d=t.domains)!=null&&d.includes(n)))return!1;const i=(o=l==null?void 0:l.split("::").at(-1))==null?void 0:o.toLowerCase();if(!i)return!0;const s=(t.modelAreaRefs??[]).map(r=>{var g;return(g=r.split("::").at(-1))==null?void 0:g.toLowerCase()});return s.length===0||s.includes(i)}function vt(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function $e(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function kt(){return{id:"",scope:"project",description:"",body:"",preferredMetrics:[],preferredBlocks:[],vocabulary:{},sourcePath:""}}function St({embedded:t=!1,domainFilter:n=null,modelAreaFilter:l=null}={}){var M;const{state:i}=he(),s=Se[i.themeMode],[d,o]=a.useState([]),[r,g]=a.useState(!0),[S,v]=a.useState(null),[c,W]=a.useState({metrics:[],blocks:[]}),j=i.authoredDomains,[p,h]=a.useState(null),[R,I]=a.useState(!1),[m,E]=a.useState("skills"),[y,w]=a.useState(!1),[P,A]=a.useState(null),[O,$]=a.useState(null),[b,x]=a.useState(null),[T,L]=a.useState(!1),[z,U]=a.useState(null),N=a.useCallback(()=>{let u=!1;return g(!0),v(null),D.getSkills().then(k=>{u||o(Array.isArray(k==null?void 0:k.skills)?k.skills:[])}).catch(k=>{u||(o([]),v(k instanceof Error&&k.message?k.message:"Could not load skills. Is the local DQL server running?"))}).finally(()=>{u||g(!1)}),D.getSkillOptions().then(k=>{u||W({metrics:Array.isArray(k==null?void 0:k.metrics)?k.metrics:[],blocks:Array.isArray(k==null?void 0:k.blocks)?k.blocks:[]})}).catch(()=>{u||W({metrics:[],blocks:[]})}),D.getSkillPathSettings().then(k=>{u||(h(k),E(k.path))}).catch(()=>{u||h(null)}),()=>{u=!0}},[]);a.useEffect(()=>N(),[N]);const J=a.useMemo(()=>d.filter(u=>jt(u,n,l)).sort((u,k)=>u.id.localeCompare(k.id)),[d,n,l]),f=a.useCallback(u=>{o(k=>{const _=k.findIndex(ze=>(ze.qualifiedId??ze.id)===(u.qualifiedId??u.id));if(_===-1)return[...k,u];const Ce=[...k];return Ce[_]=u,Ce}),$(null)},[]),C=a.useCallback(async()=>{if(b){L(!0),U(null);try{const u=b.qualifiedId??b.id;await D.deleteSkill(u),o(k=>k.filter(_=>(_.qualifiedId??_.id)!==u)),x(null)}catch(u){U(u instanceof Error&&u.message?u.message:"Could not delete this skill.")}finally{L(!1)}}},[b]),B=a.useCallback(async()=>{w(!0),A(null);try{const u=await D.updateSkillPath(m);h(u),E(u.path),I(!1),N()}catch(u){A(u instanceof Error&&u.message?u.message:"Could not use this Skills folder.")}finally{w(!1)}},[N,m]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:s.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(re,{size:20,strokeWidth:1.9,color:s.accent}),e.jsx("div",{style:{fontSize:t?18:22,fontWeight:700,color:s.textPrimary},children:l?`${(M=l.split("::").at(-1))==null?void 0:M.replace(/_/g," ")} skills`:n?`${n} skills`:"Skills"})]}),e.jsxs("div",{style:{fontSize:13,color:s.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:["Definitions, vocabulary, and instructions the AI follows when answering",l?" in this model area":n?" in this domain":"",". Applied only when their triggers match — drafts never guide answers."]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:7,color:s.textMuted,fontSize:10.5,minWidth:0},children:[e.jsx(Be,{size:12,strokeWidth:1.8}),e.jsx("span",{children:"Skill folder"}),e.jsx("code",{style:{color:s.textSecondary,fontFamily:s.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.path)??"skills"}),p?e.jsxs("span",{children:["· ",p.exists?`${p.skillCount} loaded`:"not found"]}):null]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>N(),title:"Refresh",style:Y(s),children:[e.jsx(fe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>{A(null),I(u=>!u)},style:Y(s),children:[e.jsx(Be,{size:13,strokeWidth:2})," Skill folder"]}),e.jsxs("button",{type:"button",onClick:()=>$({kind:"create"}),style:xe(s),children:[e.jsx(X,{size:14,strokeWidth:2.2})," Add skill"]})]})]}),R?e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:10,background:s.cellBg,padding:"12px 14px",marginBottom:16,display:"grid",gap:8},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:700,color:s.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:m,onChange:u=>E(u.target.value),onKeyDown:u=>{u.key==="Enter"&&m.trim()&&!y&&B()},placeholder:"skills or ../skills",style:{...H(s),flex:1,fontFamily:s.fontMono}}),e.jsx("button",{type:"button",onClick:()=>I(!1),disabled:y,style:Y(s),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>void B(),disabled:!m.trim()||y,style:{...xe(s),opacity:m.trim()&&!y?1:.55},children:[y?e.jsx(F,{size:13,strokeWidth:2}):null,y?"Connecting…":"Use folder"]})]}),e.jsxs("div",{style:{fontSize:10.5,lineHeight:1.45,color:s.textMuted},children:["Relative paths start from the DQL project. If DQL is in a ",e.jsx("code",{style:{fontFamily:s.fontMono},children:"/dql"})," folder inside your dbt repo, use ",e.jsx("code",{style:{fontFamily:s.fontMono},children:"../skills"}),". Existing ",e.jsx("code",{style:{fontFamily:s.fontMono},children:".skill.md"})," and Markdown skill files are loaded in place and stay Git-owned by that repo."]}),p!=null&&p.resolvedPath?e.jsxs("div",{style:{fontSize:10.5,color:s.textMuted,fontFamily:s.fontMono,overflowWrap:"anywhere"},children:["Resolved: ",p.resolvedPath]}):null,P?e.jsx(ue,{t:s,tone:"error",children:P}):null]}):null,r?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:s.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(F,{size:15,strokeWidth:2})," Loading skills…"]}):S?e.jsx(It,{t:s,message:S,onRetry:()=>N()}):J.length===0?e.jsx(Wt,{t:s,onAdd:()=>$({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:J.map(u=>e.jsx(wt,{skill:u,t:s,onEdit:()=>$({kind:"edit",skill:u}),onDelete:()=>{U(null),x(u)}},u.qualifiedId??u.id))})]}),O?e.jsx(Ct,{mode:O,options:c,domains:j,defaultDomain:n,defaultModelArea:l,existingIds:d.map(u=>u.id),t:s,onClose:()=>$(null),onSaved:f}):null,b?e.jsx(Tt,{skill:b,t:s,deleting:T,error:z,onCancel:()=>{T||x(null)},onConfirm:C}):null]})}function wt({skill:t,t:n,onEdit:l,onDelete:i}){var r,g,S;const[s,d]=a.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(re,{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:Me(n),children:"draft — inactive"}):null,t.status==="active"||!t.status?e.jsx("span",{style:Dt(n),children:"active"}):null,o.map(v=>e.jsx("span",{style:$t(n),children:v},v)),t.isStarter?e.jsxs("span",{style:Me(n),title:"A dbt-seeded starter — edit it to make it yours",children:[e.jsx(ne,{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:()=>d(v=>!v),style:{...Y(n),height:26,padding:"0 10px",fontSize:11},title:s?"Hide skill details":"Show skill details",children:s?"Hide details":"Details"}),e.jsx("button",{type:"button",onClick:l,style:{...ge(n),width:26,height:26},title:"Edit skill",children:e.jsx(Ne,{size:12,strokeWidth:1.75})}),e.jsx("button",{type:"button",onClick:i,style:{...ge(n),width:26,height:26},title:"Delete skill",children:e.jsx(ie,{size:12,strokeWidth:1.75})})]}),s?e.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle)",padding:"12px 14px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px 20px"},children:[e.jsx(ee,{t:n,label:"Apply when",values:t.triggers,empty:"No trigger phrases defined"}),e.jsx(ee,{t:n,label:"Prefer these metrics",values:t.preferredMetrics,empty:"No preferred metrics",accent:!0,mono:!0}),e.jsx(ee,{t:n,label:"Reuse these blocks",values:t.preferredBlocks,empty:"No preferred blocks",accent:!0,mono:!0}),e.jsx(ee,{t:n,label:"Ask first when",values:t.clarifyWhen,empty:"No clarification rule defined"}),(g=t.exclusions)!=null&&g.length?e.jsx(ee,{t:n,label:"Avoid when",values:t.exclusions,empty:""}):null,(S=t.modelAreaRefs)!=null&&S.length?e.jsx(ee,{t:n,label:"Focus on model areas",values:t.modelAreaRefs,empty:"",mono:!0}):null,t.body?e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("div",{style:te(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 Ct({mode:t,options:n,domains:l,defaultDomain:i=null,defaultModelArea:s=null,existingIds:d,t:o,onClose:r,onSaved:g}){const{dispatch:S}=he(),v=t.kind==="edit",[c,W]=a.useState(()=>t.kind==="edit"?{...t.skill}:{...kt(),domain:i??void 0,domains:i?[i]:[],modelAreaRefs:s?[s]:[]}),[j,p]=a.useState(v),[h,R]=a.useState(()=>t.kind==="edit"?t.skill.id:""),[I,m]=a.useState(!1),[E,y]=a.useState(null),w=a.useCallback((x,T)=>{W(L=>({...L,[x]:T}))},[]),P=x=>{R(x),!v&&!j&&w("id",$e(x))},A=!v&&c.id.length>0&&d.includes(c.id),O=c.id.trim().length>0&&c.body.trim().length>0&&!A&&!I,$=Ye(c.domain,l),b=a.useCallback(async()=>{var T,L;const x={...c,id:c.id.trim(),description:(T=c.description)!=null&&T.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(z=>z.trim()).filter(Boolean),modelAreaRefs:(c.modelAreaRefs??[]).map(z=>z.trim()).filter(Boolean),triggers:(c.triggers??[]).map(z=>z.trim()).filter(Boolean),exclusions:(c.exclusions??[]).map(z=>z.trim()).filter(Boolean),preferredDimensions:(c.preferredDimensions??[]).map(z=>z.trim()).filter(Boolean),requiredFilters:(c.requiredFilters??[]).map(z=>z.trim()).filter(Boolean),clarifyWhen:(c.clarifyWhen??[]).map(z=>z.trim()).filter(Boolean),examples:(c.examples??[]).map(z=>z.trim()).filter(Boolean)};m(!0),y(null);try{const z=v?await D.updateSkill(x.id,x):await D.createSkill(x);g(z.skill??x)}catch(z){y(z instanceof Error&&z.message?z.message:"Could not save this skill. Try again.")}finally{m(!1)}},[c,v,g]);return e.jsx("div",{style:Et,onClick:()=>!I&&r(),children:e.jsxs("div",{style:At(o),onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{style:Ot(),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(re,{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:v?"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:()=>!I&&r(),style:{...ge(o),width:26,height:26,border:"none",background:"none"},title:"Close",children:e.jsx(ye,{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:te(o),children:"Identity"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Name"}),e.jsx("input",{type:"text",value:h,onChange:x=>P(x.target.value),placeholder:"e.g. Revenue definition",style:H(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:v,onChange:x=>{p(!0),w("id",vt(x.target.value.replace(/^skills\//,"").replace(/\.skill\.md$/,"")))},onBlur:()=>w("id",$e(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:v?"none":`1px dashed ${o.btnBorder}`}})]}),A?e.jsx(ue,{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:K,children:[e.jsx("span",{style:q(o),children:"Domain"}),e.jsxs("select",{value:c.domain??"",onChange:x=>{const T=x.target.value||void 0;w("domain",T),w("domains",T?[T]:[])},style:{...H(o),cursor:"pointer",color:c.domain?o.textPrimary:o.textMuted},children:[e.jsx("option",{value:"",children:l.length===0?"No domains yet":"No domain"}),$.map(x=>e.jsx("option",{value:x.value,disabled:x.disabled,children:x.label},x.value))]})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Type"}),e.jsxs("select",{value:c.kind??"custom",onChange:x=>w("kind",x.target.value),style:{...H(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:{...q(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(x=>{const T=(c.status??"active")===x;return e.jsx("button",{type:"button",onClick:()=>w("status",x),style:{border:"none",borderRadius:5,padding:"4px 12px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:o.font,background:T?o.cellBg:"transparent",color:T?o.textPrimary:o.textMuted,boxShadow:T?"0 1px 3px rgba(26,26,26,0.1)":"none",textTransform:"capitalize"},children:x},x)})}),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:te(o),children:"When to apply"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Apply when the question mentions"}),e.jsx(zt,{t:o,values:c.triggers??[],onChange:x=>w("triggers",x),placeholder:"Add phrase, press Enter"})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Ask first when"}),e.jsx(ae,{values:c.clarifyWhen??[],onChange:x=>w("clarifyWhen",x),placeholder:"e.g. 'sales' could mean revenue or order count",style:H(o)})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Avoid when"}),e.jsx(ae,{values:c.exclusions??[],onChange:x=>w("exclusions",x),placeholder:"e.g. question is about pipeline or bookings",style:H(o)})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,gridRow:"span 2"},children:[e.jsx("div",{style:te(o),children:"Guidance"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"One-line summary"}),e.jsx("input",{type:"text",value:c.description??"",onChange:x=>w("description",x.target.value),placeholder:"What rule does this skill encode?",style:H(o)})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Full guidance"}),e.jsx("textarea",{value:c.body,onChange:x=>w("body",x.target.value),rows:9,placeholder:"Definitions, exclusions, edge cases — written for the agent.",style:Mt(o)})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:te(o),children:"Prefer these assets"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Metrics"}),e.jsx(Re,{t:o,options:n.metrics,optionKind:"metrics",selected:c.preferredMetrics,onChange:x=>w("preferredMetrics",x),placeholder:"Search metrics…",emptyOptionsHint:"No metrics available from the project yet."})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Blocks"}),e.jsx(Re,{t:o,options:n.blocks,optionKind:"blocks",selected:c.preferredBlocks,onChange:x=>w("preferredBlocks",x),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(je,{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(ae,{values:c.modelAreaRefs??[],onChange:x=>w("modelAreaRefs",x),placeholder:"customer_lifecycle, revenue_reporting",style:H(o)})}),e.jsx(je,{label:"Preferred dimensions",t:o,hint:"Business-safe dimensions the agent should prefer when they are compatible.",children:e.jsx(ae,{values:c.preferredDimensions??[],onChange:x=>w("preferredDimensions",x),placeholder:"region, month",style:H(o)})}),e.jsx(je,{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(Bt,{t:o,value:c.vocabulary,onChange:x=>w("vocabulary",x)})})]})]}),E?e.jsx("div",{style:{gridColumn:"1 / -1"},children:e.jsx(ue,{t:o,tone:"error",children:E})}):null]}),e.jsxs("div",{style:Lt(),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:()=>!I&&r(),style:Y(o),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:b,disabled:!O,style:{...xe(o),opacity:O?1:.55},children:[I?e.jsx(F,{size:13,strokeWidth:2}):null,I?"Saving…":v?"Save changes":"Create skill"]})]})]})})}function zt({t,values:n,onChange:l,placeholder:i}){const[s,d]=a.useState(""),o=r=>{const g=r.trim().replace(/,$/,"");!g||n.includes(g)||(l([...n,g]),d(""))};return e.jsxs("div",{style:He(t),children:[n.map(r=>e.jsxs("span",{style:_e(t),children:[r,e.jsx("button",{type:"button",onClick:()=>l(n.filter(g=>g!==r)),style:qe(t),title:"Remove",children:"×"})]},r)),e.jsx("input",{type:"text",value:s,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"||r.key===","?(r.preventDefault(),o(s)):r.key==="Backspace"&&!s&&n.length&&l(n.slice(0,-1))},onBlur:()=>o(s),placeholder:n.length?"":i,style:Fe(t)})]})}function Re({t,options:n,optionKind:l,selected:i,onChange:s,placeholder:d,emptyOptionsHint:o}){const[r,g]=a.useState(""),[S,v]=a.useState(n);a.useEffect(()=>{let j=!1;const p=window.setTimeout(()=>{D.getSkillOptions(r).then(h=>{j||v(l==="metrics"?h.metrics:h.blocks)}).catch(()=>{j||v(n)})},160);return()=>{j=!0,window.clearTimeout(p)}},[l,n,r]);const c=a.useMemo(()=>S.filter(j=>!i.includes(j)).filter(j=>r?j.toLowerCase().includes(r.toLowerCase()):!0).slice(0,8),[S,i,r]),W=j=>{const p=j.trim();!p||i.includes(p)||(s([...i,p]),g(""))};return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsxs("div",{style:He(t),children:[i.map(j=>e.jsxs("span",{style:{..._e(t),fontFamily:t.fontMono},children:[j,e.jsx("button",{type:"button",onClick:()=>s(i.filter(p=>p!==j)),style:qe(t),title:"Remove",children:"×"})]},j)),e.jsx("input",{type:"text",value:r,onChange:j=>g(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),W(r))},placeholder:i.length?"":d,style:Fe(t)})]}),c.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:c.map(j=>e.jsxs("button",{type:"button",onClick:()=>W(j),style:Pt(t),children:[e.jsx(X,{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 Bt({t,value:n,onChange:l}){const[i,s]=a.useState(()=>Object.entries(n??{}).map(([r,g])=>({term:r,target:g}))),d=r=>{s(r);const g={};for(const S of r){const v=S.term.trim();v&&(g[v]=S.target.trim())}l(g)},o=(r,g)=>{d(i.map((S,v)=>v===r?{...S,...g}:S))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[i.map((r,g)=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{type:"text",value:r.term,onChange:S=>o(g,{term:S.target.value}),placeholder:"arr",style:{...H(t),flex:1}}),e.jsx("span",{style:{color:t.textMuted,fontSize:13},children:"→"}),e.jsx("input",{type:"text",value:r.target,onChange:S=>o(g,{target:S.target.value}),placeholder:"metric:arr",style:{...H(t),flex:1.3,fontFamily:t.fontMono}}),e.jsx("button",{type:"button",onClick:()=>d(i.filter((S,v)=>v!==g)),style:ge(t),title:"Remove row",children:e.jsx(ye,{size:13,strokeWidth:2})})]},g)),e.jsxs("button",{type:"button",onClick:()=>s([...i,{term:"",target:""}]),style:{...Y(t),justifySelf:"start"},children:[e.jsx(X,{size:12,strokeWidth:2.2})," Add term"]})]})}function Wt({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(re,{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:{...xe(t),marginTop:4},children:[e.jsx(X,{size:14,strokeWidth:2.2})," Add your first skill"]})]})}function It({t,message:n,onRetry:l}){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(Oe,{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:l,style:{...Y(t),marginTop:10},children:[e.jsx(fe,{size:13,strokeWidth:2})," Retry"]})]})]})}function Tt({skill:t,t:n,deleting:l,error:i,onCancel:s,onConfirm:d}){return e.jsx("div",{style:Nt,onClick:s,children:e.jsxs("div",{style:Ht(n),onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(ie,{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(ue,{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:s,disabled:l,style:Y(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:d,disabled:l,style:{...Rt(n),opacity:l?.6:1},children:[l?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(ie,{size:13,strokeWidth:2}),l?"Deleting…":"Delete"]})]})]})})}function te(t){return{fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:t.textMuted,marginBottom:5}}function ee({t,label:n,values:l,empty:i,accent:s=!1,mono:d=!1}){return e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:te(t),children:n}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:l!=null&&l.length?l.map(o=>e.jsx("span",{style:{fontSize:11,padding:"3px 9px",borderRadius:999,background:s?"var(--accent-dim)":"var(--bg-1)",color:s?t.accent:t.textSecondary,border:s?`1px solid ${t.accent}33`:"1px solid var(--border-subtle)",fontFamily:d?t.fontMono:void 0},children:o},o)):e.jsx("span",{style:{fontSize:11.5,color:t.textMuted,fontStyle:"italic"},children:i})})]})}function je({label:t,hint:n,t:l,children:i}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:l.textPrimary},children:t}),n?e.jsx("div",{style:{fontSize:11.5,color:l.textMuted,lineHeight:1.45,marginTop:-2},children:n}):null,i]})}function ue({t,tone:n,children:l}){const i=n==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:i,lineHeight:1.45},children:l})}function Dt(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 $t(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 xe(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 Y(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 Rt(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 ge(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 H(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 Mt(t){return{...H(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function Me(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 He(t){return{display:"flex",alignItems:"center",gap:5,flexWrap:"wrap",border:`1px solid ${t.btnBorder}`,background:t.cellBg,borderRadius:7,padding:"6px 8px"}}function Fe(t){return{flex:1,minWidth:110,border:"none",background:"none",outline:"none",fontSize:11.5,fontFamily:t.font,color:t.textPrimary,padding:2}}function _e(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 qe(t){return{border:"none",background:"none",color:t.accent,cursor:"pointer",padding:0,fontSize:12,lineHeight:1,fontFamily:t.font}}const K={display:"flex",flexDirection:"column",gap:4};function q(t){return{fontSize:11,fontWeight:650,color:t.textSecondary}}function Pt(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 Et={position:"fixed",inset:0,background:"rgba(26, 26, 26, 0.22)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60};function At(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 Ot(t){return{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle)",flexShrink:0}}function Lt(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 Nt={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function Ht(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 Ft({initialTab:t="overview"}){const{state:n}=he(),l=Se[n.themeMode],[i,s]=a.useState(t),[d,o]=a.useState([]),[r,g]=a.useState([]),[S,v]=a.useState(!0);a.useEffect(()=>s(t),[t]);const c=a.useCallback(()=>{let h=!1;return v(!0),Promise.all([D.getDomains(),D.getSkills()]).then(([R,I])=>{h||(o(Array.isArray(R.domains)?R.domains:[]),g(Array.isArray(I.skills)?I.skills:[]))}).catch(()=>{h||(o([]),g([]))}).finally(()=>{h||v(!1)}),()=>{h=!0}},[]);a.useEffect(()=>c(),[c]);const W=a.useMemo(()=>{const h=d.filter(m=>!!(m.businessOwner||m.owner)).length,R=r.filter(m=>!m.status||m.status==="active").length,I=r.filter(m=>m.status==="draft").length;return{ownedDomains:h,activeSkills:R,draftSkills:I}},[d,r]),j=a.useCallback(()=>{s("domains"),window.setTimeout(()=>window.dispatchEvent(new Event("dql:context-build")),50)},[]),p=[{id:"overview",label:"Overview"},{id:"domains",label:"Domains",count:d.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:l.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(se,{size:20,color:l.accent}),e.jsx("h1",{style:{fontSize:22,color:l.textPrimary},children:"Governed context"})]}),e.jsx("p",{style:{marginTop:6,fontSize:13,lineHeight:1.5,color:l.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:Ke(l),children:[e.jsx(ne,{size:14})," Build with AI"]})]}),e.jsx("nav",{"aria-label":"Governed context sections",style:{display:"flex",gap:3,borderBottom:`1px solid ${l.headerBorder}`,marginBottom:18},children:p.map(h=>e.jsxs("button",{type:"button",onClick:()=>s(h.id),style:{border:"none",borderBottom:`2px solid ${i===h.id?l.accent:"transparent"}`,background:"transparent",padding:"9px 12px",color:i===h.id?l.textPrimary:l.textMuted,fontWeight:i===h.id?700:600,cursor:"pointer",fontFamily:l.font,fontSize:12.5},children:[h.label,h.count!==void 0?` · ${h.count}`:""]},h.id))}),i==="overview"?e.jsx(_t,{t:l,loading:S,domains:d,skills:r,status:W,onBuild:j,onTab:s}):null,i==="domains"?e.jsx(nt,{embedded:!0}):null,i==="skills"?e.jsx(St,{embedded:!0}):null,i==="knowledge"?e.jsx(Ge,{t:l,domains:d}):null]})})}function Ge({t,domains:n,initialDomainId:l}){var W,j;const[i,s]=a.useState(l??((W=n[0])==null?void 0:W.id)??""),[d,o]=a.useState(null),[r,g]=a.useState(!1),[S,v]=a.useState(null);a.useEffect(()=>{var p;!i&&((p=n[0])!=null&&p.id)&&s(n[0].id)},[i,n]),a.useEffect(()=>{l&&n.some(p=>p.id===l)&&s(l)},[n,l]),a.useEffect(()=>{if(!i){o(null);return}let p=!1;return g(!0),v(null),D.getDomainKnowledge(i).then(h=>{p||o(h)}).catch(h=>{p||(o(null),v(h instanceof Error?h.message:"Could not load the compiled knowledge capsule."))}).finally(()=>{p||g(!1)}),()=>{p=!0}},[i]);const c=a.useMemo(()=>{const p={};for(const h of(d==null?void 0:d.objects)??[])p[h.kind]=(p[h.kind]??0)+1;return Object.entries(p).sort((h,R)=>R[1]-h[1]||h[0].localeCompare(R[0]))},[d]);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(We,{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:p=>s(p.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((p,h)=>p.name.localeCompare(h.name)).map(p=>e.jsx("option",{value:p.id,children:p.name},p.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,d?e.jsxs(e.Fragment,{children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:9},children:[e.jsx(V,{t,label:"Objects",value:d.counts.objects,detail:"qualified knowledge",icon:e.jsx(se,{size:16})}),e.jsx(V,{t,label:"Relations",value:d.counts.edges,detail:"provenance + policy",icon:e.jsx(We,{size:16})}),e.jsx(V,{t,label:"Authorized",value:d.counts.routeStates.authorized??0,detail:"safe cross-domain routes",icon:e.jsx(Je,{size:16})}),e.jsx(V,{t,label:"Blocked / stale",value:(d.counts.routeStates.blocked??0)+(d.counts.routeStates.stale??0),detail:"never auto-joined",icon:e.jsx(Ae,{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=d.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(([p,h])=>e.jsxs("span",{style:{border:`1px solid ${t.cellBorder}`,background:t.pillBg,color:t.textSecondary,borderRadius:999,padding:"3px 7px",fontSize:11},children:[p.replace(/_/g," ")," · ",h]},p))}),e.jsxs("div",{style:{marginTop:11,color:t.textMuted,fontSize:11},children:["Snapshot ",d.snapshotId.slice(0,12)," · graph ",d.sourceFingerprint.slice(0,12),d.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:d.routes.length?d.routes.map(p=>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:[p.providerDomainId," → ",p.consumerDomainId]}),e.jsx("span",{style:{color:p.state==="authorized"?t.success:p.state==="observed"?t.textMuted:t.warning,fontWeight:700},children:p.state})]}),e.jsx("div",{style:{marginTop:3,color:t.textMuted,fontSize:11},children:p.purpose||p.reasonCodes.join(", ")||"governed route"})]},p.id)):e.jsx("div",{style:{color:t.textMuted,fontSize:12,marginTop:8},children:"No cross-domain routes declared."})})]})]})]}):null]})}function _t({t,loading:n,domains:l,skills:i,status:s,onBuild:d,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 l.length?s.ownedDomains<l.length&&r.push(`${l.length-s.ownedDomains} domain${l.length-s.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."),s.draftSkills&&r.push(`${s.draftSkills} skill${s.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(V,{t,label:"Domains",value:l.length,detail:`${s.ownedDomains} with an owner`,icon:e.jsx(se,{size:17})}),e.jsx(V,{t,label:"Active skills",value:s.activeSkills,detail:"available to the agent",icon:e.jsx(re,{size:17})}),e.jsx(V,{t,label:"Draft skills",value:s.draftSkills,detail:"review before activation",icon:e.jsx(ne,{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(g=>e.jsxs("div",{style:{display:"flex",gap:7,color:t.textSecondary,fontSize:12.5},children:[e.jsx(Ae,{size:14,color:t.warning}),g]},g))}):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:d,style:Ke(t),children:[e.jsx(ne,{size:13})," Build domains & skills with AI"]}),e.jsx("button",{type:"button",onClick:()=>o("domains"),style:Pe(t),children:"Manage domains"}),e.jsx("button",{type:"button",onClick:()=>o("skills"),style:Pe(t),children:"Manage skills"})]})]})]})}function V({t,label:n,value:l,detail:i,icon:s}){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,s]}),e.jsx("div",{style:{color:t.textPrimary,fontSize:25,fontWeight:750,marginTop:7},children:l}),e.jsx("div",{style:{color:t.textMuted,fontSize:11.5,marginTop:3},children:i})]})}function Ke(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 Pe(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 Jt=Object.freeze(Object.defineProperty({__proto__:null,GovernedContextPage:Ft,Knowledge360:Ge},Symbol.toStringTag,{value:"Module"}));export{Jt as G,Ge as K,St as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as je,t as Se,r as a,aq as O,a as pe,ar as Ce,as as Re,at as Ee,au as Le,j as e,l as E,ao as H,av as Te,h as ge}from"./index-BTuliKhK.js";import{u as Be,a as Ie,M as ze,i as We,B as Pe,C as Me,b as Fe,P as Ne,T as he,c as N,H as xe}from"./dagre.esm-CycymVj6.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Ce},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Re},{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 Oe(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=Te.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"?N.Left:N.Top,v=p==="LR"?N.Right:N.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 De={dagNode:$e};function He(){var ae,le,de;const{state:n,dispatch:h}=je(),o=Se[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,S]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,P]=a.useState(null),[$,M]=a.useState(!1),[q,V]=a.useState("block"),[U,K]=a.useState(""),[X,F]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=Be([]),[be,oe,me]=Ie([]),re=a.useCallback(async()=>{p(!0);const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]}),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),M(!1),P(null),s(null),T(!0);const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null),T(!1)},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),P(null),M(!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);S(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),j=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:Ee(i),dimmed:j?!j.has(i.id):!1}})),r=m.edges.map((i,u)=>{const A=j?j.has(i.source)&&j.has(i.target):!1,ce=A?"var(--accent)":Le[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:j&&!A?.25:1},markerEnd:{type:ze.ArrowClosed,color:ce,width:12,height:12}}});te(Oe(t,r,k,C)),oe(r)},[m,k,C,j,c,oe,te]);const ke=a.useCallback((t,r)=>{P(r.id);const i=m.nodes.find(u=>u.id===r.id)??null;s(i)},[m.nodes]),D=a.useCallback(()=>{P(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:()=>M(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 ${$?o.accent:o.headerBorder}`,background:$?"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:"▾"})]}),$&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>M(!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:q,onTypeChange:V,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),F(!0)},onFocus:()=>F(!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:()=>F(!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(""),F(!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:D,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(We,{nodes:ye,edges:be,onNodesChange:fe,onEdgesChange:me,onNodeClick:ke,onPaneClick:D,nodeTypes:De,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Pe,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Me,{showInteractive:!1}),e.jsx(Fe,{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(Ne,{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:D,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:q,onTypeChange:V,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,S=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:S})]},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 S=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:S?"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:S?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{He as LineageDAG};
|