@duckcodeailabs/dql-cli 1.13.1 → 1.13.3
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 +249 -7
- package/dist/apps-api.d.ts.map +1 -1
- package/dist/apps-api.js +2855 -160
- package/dist/apps-api.js.map +1 -1
- package/dist/assets/dql-notebook/assets/{AgentLogPage-D6fgEAEy.js → AgentLogPage-B3ugEb3H.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-8miXFPse.js → AiBuildDialog-BK_TDNcM.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildResult-DPJ_SI0R.js → AiBuildResult-Cob_Lj05.js} +8 -8
- package/dist/assets/dql-notebook/assets/{AiSidePanel-NVA6lZnn.js → AiSidePanel-CzIgxmP9.js} +1 -1
- package/dist/assets/dql-notebook/assets/AnalyticsHome-C2vJ2fxY.js +6 -0
- package/dist/assets/dql-notebook/assets/AppsView-DEWQ0sHT.js +5588 -0
- package/dist/assets/dql-notebook/assets/BlockStudio-CaDNTKMM.js +55 -0
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-DtRMiaF4.js → BusinessArtifactView-zwUOtddi.js} +1 -1
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-BlnhTMu3.js +22 -0
- package/dist/assets/dql-notebook/assets/{GitPage-CazC-eTR.js → GitPage-Coevr9NJ.js} +3 -3
- package/dist/assets/dql-notebook/assets/GlobalAiRail-BTZS11x5.js +1 -0
- package/dist/assets/dql-notebook/assets/GovernedContextPage-CjyyM_ne.js +7 -0
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-DMHPsVqP.js → HelpDocsPage-C1UeP85v.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HomePage-DcSI4dnU.js → HomePage-zGPFIvOY.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDAG-BJ6xz06u.js → LineageDAG-DbXnQWu3.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDetailView-8WrQm-MF.js → LineageDetailView-Ch1Db01I.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-hnqCW_t-.js → LineageDrawer-DLxqJO6D.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-B4LZTUsl.js → LineagePathBreadcrumb-B2tNdkr_.js} +3 -3
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-CotnRuxa.js → MiniLineageGraph-0gY-ZwCy.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewBlockModal-DHn-CEEW.js → NewBlockModal-DKVkXD20.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewNotebookModal-BPGp-8oq.js → NewNotebookModal-BUIByvYT.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NotebookEditor-B0OTHM6W.js → NotebookEditor-D2fIUxjE.js} +5 -5
- package/dist/assets/dql-notebook/assets/{ReadinessPage-CoOIpxWq.js → ReadinessPage-Ci4LyNiQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-DxK_mFzf.js → SetupOnboarding-BF7ai_0t.js} +1 -1
- package/dist/assets/dql-notebook/assets/SkillsPage-BgYrgirJ.js +10 -0
- package/dist/assets/dql-notebook/assets/{TrustBadge-ZuD5N5Ww.js → TrustBadge-Bob1Laiq.js} +1 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-IxDUKSG8.js +88 -0
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-WAVAYjBv.js → answer-to-notebook-Dk42N0pU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-L8odLbyN.js → arrow-left-DKuuTw9l.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-WIF1V9a9.js → arrow-right-TH8_ufKG.js} +1 -1
- package/dist/assets/dql-notebook/assets/{book-open-text-BpqWMa4m.js → book-open-text-B-dcHHn0.js} +1 -1
- package/dist/assets/dql-notebook/assets/{circle-x-CQBOM0b0.js → circle-x-BOc2KCZQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-DlZi7NR3.js → dagre.esm-CPT_vn5p.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-DYqdQIGp.js → external-link-DtOfpYc6.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-HmUijbwN.js → grip-vertical-B8joDDH9.js} +1 -1
- package/dist/assets/dql-notebook/assets/index-B3shyZsg.css +1 -0
- package/dist/assets/dql-notebook/assets/index-DJRMz64S.js +635 -0
- package/dist/assets/dql-notebook/assets/link-2-DMZPHawg.js +6 -0
- package/dist/assets/dql-notebook/assets/{list-tree-DGKqCxmz.js → list-tree-Dw0qlxPK.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-C8dvqCxX.js → minimize-2-DUiSrPS3.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-yuVkIo5n.js → panel-right-open-BrrFrRZQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{bot-CLR1V6dO.js → play-Ced0HT9g.js} +7 -2
- package/dist/assets/dql-notebook/assets/{rotate-ccw-Di0kRnrM.js → rotate-ccw-D_9U9o7X.js} +1 -1
- package/dist/assets/dql-notebook/assets/{semantic-fields-BMQV0li8.js → semantic-fields-BlDOaonV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{sliders-horizontal-alebptlJ.js → sliders-horizontal-BDt6KRGR.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-CgCQbnXc.js → star-CxUbF_BW.js} +1 -1
- package/dist/assets/dql-notebook/assets/{triangle-alert-SyuSZ4ht.js → triangle-alert-COWnsSdh.js} +1 -1
- package/dist/assets/dql-notebook/assets/upload-DSFC2kJX.js +6 -0
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-DYdx896E.js +32 -0
- package/dist/assets/dql-notebook/assets/{user-round-J4PQHxo9.js → user-round-Bfu7fosn.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wand-sparkles-c4WDXTCk.js → wand-sparkles-DSpG0c0j.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-NtRLaq7n.js → workflow-B1_pj9gq.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wrench-CS1f1Zv4.js → wrench-CvfM03KZ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-CbKEfe5m.js → x-B4coLiOl.js} +1 -1
- package/dist/assets/dql-notebook/index.html +2 -2
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +65 -133
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/model.js +21 -2
- package/dist/commands/model.js.map +1 -1
- package/dist/llm/providers/dql-agent-provider.d.ts +16 -0
- package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
- package/dist/llm/providers/dql-agent-provider.js +65 -2
- package/dist/llm/providers/dql-agent-provider.js.map +1 -1
- package/dist/local-runtime.d.ts +112 -19
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +2026 -694
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +10 -10
- package/dist/sql-result-filter.d.ts +9 -0
- package/dist/sql-result-filter.d.ts.map +1 -1
- package/dist/sql-result-filter.js +25 -0
- package/dist/sql-result-filter.js.map +1 -1
- package/package.json +10 -10
- package/dist/assets/dql-notebook/assets/AgentAnswerCard-c8QUo6NH.js +0 -5
- package/dist/assets/dql-notebook/assets/AnalyticsHome-DgwnRW71.js +0 -6
- package/dist/assets/dql-notebook/assets/AppsView-B6LYUpgm.js +0 -4578
- package/dist/assets/dql-notebook/assets/BlockStudio--jNw9XUI.js +0 -60
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DhBsLCYr.js +0 -22
- package/dist/assets/dql-notebook/assets/GlobalAiRail-1Tgweuu2.js +0 -1
- package/dist/assets/dql-notebook/assets/GovernedContextPage-C7qGrH3d.js +0 -16
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-duFXXNV_.js +0 -88
- package/dist/assets/dql-notebook/assets/index-Cpx47jCH.js +0 -634
- package/dist/assets/dql-notebook/assets/index-DKu4CZt3.css +0 -1
- package/dist/assets/dql-notebook/assets/upload-BPhfea_E.js +0 -11
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-Bnl9gWhj.js +0 -28
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{c as Ye,t as Ze,h as et,r as d,a as g,j as t,a0 as we,G as ne,d as tt,g as re,P as nt,
|
|
1
|
+
import{c as Ye,t as Ze,h as et,r as d,a as g,j as t,a0 as we,G as ne,d as tt,g as re,P as nt,aF as rt,aG as ze,ar as it,l as st,aH as ot,S as lt}from"./index-DJRMz64S.js";import{E as $e}from"./external-link-DtOfpYc6.js";import{X as at}from"./x-B4coLiOl.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const dt=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],be=Ye("git-pull-request",dt),ct=[{key:"all",label:"All changes"},{key:"M",label:"Modified"},{key:"A",label:"Added"},{key:"D",label:"Deleted"},{key:"R",label:"Renamed"},{key:"?",label:"Untracked"}];function ut(e){const n=e;return n.trim()==="??"?"?":n[0]==="R"||n[1]==="R"?"R":n.includes("A")?"A":n.includes("D")?"D":"M"}function ht(e){const n=[];for(const r of e){const s=r.status[0]??" ",a=r.status[1]??" ",u=ut(r.status);if(r.status==="??"){n.push({path:r.path,status:"?",staged:!1,partiallyStaged:!1});continue}const o=s!==" "&&s!=="?";o&&(a!==" "&&a!=="?")?(n.push({path:r.path,status:u,staged:!0,partiallyStaged:!0}),n.push({path:r.path,status:u,staged:!1,partiallyStaged:!0})):o?n.push({path:r.path,status:u,staged:!0,partiallyStaged:!1}):n.push({path:r.path,status:u,staged:!1,partiallyStaged:!1})}return n}function At(){const e=Ze[et(i=>i.themeMode)],[n,r]=d.useState(null),[s,a]=d.useState({current:null,branches:[]}),[u,o]=d.useState({url:null,name:null}),[l,x]=d.useState(null),[h,f]=d.useState(!1),[b,k]=d.useState(null),[M,S]=d.useState(!1),[N,A]=d.useState(null),[P,w]=d.useState(""),[D,U]=d.useState("all"),[C,z]=d.useState(""),[q,T]=d.useState(null),[E,ie]=d.useState(null),[Re,se]=d.useState(!1),[Me,De]=d.useState(!1),[oe,le]=d.useState(null),[O,G]=d.useState(!1),[Fe,_]=d.useState(!1),[ae,de]=d.useState(""),[Q,K]=d.useState(null),[ce,ue]=d.useState(!1),[Pe,Te]=d.useState(null),[he,Ie]=d.useState("plain"),[I,xe]=d.useState(null),[pe,Ne]=d.useState(()=>typeof window<"u"&&window.innerWidth<980);d.useEffect(()=>{const i=()=>Ne(window.innerWidth<980);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const V=d.useRef(null),B=d.useCallback(async()=>{se(!0),le(null);try{const[i,c,p,j]=await Promise.all([g.fetchGitStatus(),g.fetchGitBranches(),g.fetchGitRemote(),g.fetchGitGovernedContext()]);r(m=>bt(m,i)?m:i),a(m=>m.current===c.current&&mt(m.branches,c.branches)?m:{current:c.current,branches:c.branches}),o(m=>m.url===p.url&&m.name===p.name?m:{url:p.url,name:p.name}),Te(j)}catch(i){le(i instanceof Error?i.message:String(i))}finally{De(!0),window.setTimeout(()=>se(!1),350)}},[]);d.useEffect(()=>{B()},[B]),d.useEffect(()=>{let i=!1;const c=window.setInterval(()=>{document.visibilityState!=="visible"||i||(i=!0,B().finally(()=>{i=!1}))},4e3);return()=>window.clearInterval(c)},[B]),d.useEffect(()=>{if(!O)return;const i=c=>{V.current&&!V.current.contains(c.target)&&(G(!1),_(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[O]);const Ae=d.useMemo(()=>{var i;return((i=((n==null?void 0:n.changes)??[]).find(c=>c.path===l))==null?void 0:i.status)??""},[l,n==null?void 0:n.changes]);d.useEffect(()=>{if(!l){k(null),A(null),S(!1);return}let i=!1;return S(!0),A(null),g.fetchGitDiff(l,h).then(c=>{i||k(c)}).catch(c=>{i||A(c instanceof Error?c.message:String(c))}).finally(()=>{i||S(!1)}),()=>{i=!0}},[l,h,Ae]);const W=d.useMemo(()=>ht((n==null?void 0:n.changes)??[]),[n==null?void 0:n.changes]),R=W.filter(i=>i.staged),X=W.filter(i=>!i.staged),ge=d.useCallback(i=>!(D!=="all"&&i.status!==D||P&&!i.path.toLowerCase().includes(P.toLowerCase())),[D,P]),J=R.filter(ge).sort(je),Y=X.filter(ge).sort(je);d.useEffect(()=>{if(l&&W.some(p=>p.path===l&&p.staged===h))return;const i=Y[0]??J[0];i?(x(i.path),f(i.staged)):x(null)},[W,l,h,J,Y]);const v=d.useCallback((i,c)=>{ie({kind:i,text:c}),window.setTimeout(()=>ie(null),3e3)},[]),y=d.useCallback(async(i,c,p)=>{T(i);try{const j=await c();return j.ok?(p&&v("ok",p),await B()):v("err",j.error??`${i} failed`),j}finally{T(null)}},[v,B]),fe=i=>y("stage",()=>g.gitStage([i])),ye=i=>y("unstage",()=>g.gitUnstage([i])),qe=i=>{window.confirm(`Discard local changes to ${i}? This cannot be undone.`)&&y("discard",()=>g.gitDiscard([i]),"Discarded local changes")},Ee=()=>y("stage",async()=>{const i=X.map(c=>c.path);return i.length===0?{ok:!0}:g.gitStage(i)}),Ge=async()=>{const i=C.trim();if(!i)return v("err","Commit message required");const c=R.length===0;(await y("commit",()=>g.gitCommit(i,c),"Committed")).ok&&z("")},Le=async()=>{const i=C.trim();if(!i)return v("err","Commit message required");const c=R.length===0;(await y("commit",()=>g.gitCommit(i,c))).ok&&(z(""),await y("push",()=>g.gitPush(),"Pushed to remote"))},me=async()=>{const i=C.trim()||(I==null?void 0:I.message)||"";if(!i)return v("err","Review title required");if(I){const j=await y("request review",()=>g.gitOpenReview({title:i,body:"Created from DQL Source Control. Review the governed analytics changes before merging.",base:I.base}));if(!j.ok)return;K(j.prUrl??null),v("ok",j.warning??"Review request opened.");return}const c=Array.from(new Set(W.map(j=>j.path)));if(c.length===0)return v("err","No changes to request review for");const p=await y("request review",()=>g.gitCreateReview({paths:c,title:i,body:"Created from DQL Source Control. Review the governed analytics changes before merging.",base:ve(s.current)}));p.ok&&(z(""),K(p.prUrl??null),v("ok",p.warning??`Review branch ${p.branch??""} is ready${p.prUrl?".":"; create the PR from your Git host."}`))},He=async()=>{(await y("enable governed tracking",()=>g.enableGitGovernedContextTracking())).ok&&v("ok","Governed project source and Hint Graph files are now visible to source control.")},Ue=()=>y("pull",()=>g.gitPull(),"Pulled from remote"),Oe=()=>y("push",()=>g.gitPush(),"Pushed to remote"),_e=()=>{const i=R;if(i.length===0)return v("err","Include at least one change first");const c={M:"Updated",A:"Added",D:"Removed",R:"Renamed","?":"Added"},p=i.slice(0,3).map(m=>{var L;return`${c[m.status]} ${((L=m.path.split("/").pop())==null?void 0:L.replace(/\.(dql|md|json|ya?ml|sql)$/i,""))??m.path}`}),j=i.length>3?` and ${i.length-3} more change${i.length-3===1?"":"s"}`:"";z(`${p.join(", ")}${j}.`)},Qe=async()=>{const i=C.trim();if(!i)return v("err","Describe your change first");if(R.length===0)return v("err","Include at least one change first");if(!u.url)return v("err","Add a Git remote before sharing changes");const c=R.length,p=ve(s.current);if(!s.current||s.current==="HEAD"||s.current==="main"||s.current==="master"){const L=yt(i);if(!(await y("branch",()=>g.gitCreateBranch(L,!0))).ok)return}if(!(await y("commit",()=>g.gitCommit(i,!1))).ok)return;(await y("push",()=>g.gitPush(),"Shared to your branch")).ok&&xe({count:c,message:i,base:p}),z("")},Ke=()=>{xe(null),K(null),z(""),B()},Ve=i=>{G(!1),y("checkout",()=>g.gitCheckout(i),`Switched to ${i}`)},Xe=async()=>{const i=ae.trim();i&&(G(!1),_(!1),de(""),y("branch",()=>g.gitCreateBranch(i,!0),`Created and switched to ${i}`))},F=W.find(i=>i.path===l&&i.staged===h)??null,Je=d.useMemo(()=>Q??ft(u.url,s.current),[u.url,s.current,Q]);return Me?oe&&!n?t.jsx(pt,{t:e,message:oe,onRetry:()=>void B()}):n&&!n.inRepo?t.jsx(Dt,{t:e}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:e.appBg},children:[t.jsx(gt,{t:e,branchCurrent:s.current,branches:s.branches,ahead:(n==null?void 0:n.ahead)??0,behind:(n==null?void 0:n.behind)??0,remoteUrl:u.url,refreshing:Re,busy:q,onPull:Ue,onPush:Oe,onRefresh:()=>void B(),prUrl:Je,onCheckout:Ve,branchMenuOpen:O,setBranchMenuOpen:G,newBranchOpen:Fe,setNewBranchOpen:_,newBranchName:ae,setNewBranchName:de,onCreateBranch:Xe,branchMenuRef:V}),t.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,overflow:"hidden"},children:[t.jsx(St,{t:e,stagedFiles:J,unstagedFiles:Y,totalCount:W.length,selectedPath:l,selectedStaged:h,onSelect:(i,c)=>{x(i),f(c)},query:P,setQuery:w,statusFilter:D,setStatusFilter:U,onStage:fe,onUnstage:ye,onStageAll:Ee,ahead:(n==null?void 0:n.ahead)??0,behind:(n==null?void 0:n.behind)??0,branchCurrent:s.current}),t.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden",background:e.appBg},children:[F?t.jsxs(t.Fragment,{children:[t.jsx(wt,{t:e,entry:F,onStage:()=>fe(F.path),onUnstage:()=>ye(F.path),onDiscard:()=>qe(F.path),stagedView:h,diffView:he,onDiffView:Ie}),he==="plain"&&!M&&!N?t.jsx(zt,{t:e,diff:(b==null?void 0:b.diff)??"",entry:F}):t.jsx($t,{t:e,diff:(b==null?void 0:b.diff)??"",entry:F,loading:M,error:N})]}):t.jsx(Ct,{t:e,hasFiles:W.length>0}),pe?t.jsx(Rt,{t:e,commitMsg:C,setCommitMsg:z,stagedCount:R.length,unstagedCount:X.length,onCommit:Ge,onCommitAndPush:Le,onRequestReview:me,advancedOpen:ce,onToggleAdvanced:()=>ue(i=>!i),busy:q}):null]}),pe?null:t.jsx(vt,{t:e,branch:s.current,pickedCount:R.length,totalCount:W.length,commitMsg:C,setCommitMsg:z,busy:q,sharedInfo:I,reviewUrl:Q,onSuggest:_e,onShare:()=>void Qe(),onRequestReview:()=>void me(),onStartNew:Ke,advancedOpen:ce,onToggleAdvanced:()=>ue(i=>!i),context:Pe,onEnableTracking:He})]}),E&&t.jsx(Mt,{t:e,kind:E.kind,text:E.text})]}):t.jsx(xt,{t:e})}function xt({t:e}){return t.jsxs("div",{style:{height:"100%",display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary},children:[t.jsxs("div",{role:"status",style:{display:"flex",alignItems:"center",gap:9,fontSize:12.5},children:[t.jsx(we,{size:15,strokeWidth:1.8,style:{animation:"dql-spin 0.8s linear infinite"}}),"Loading current repository state…"]}),t.jsx("style",{children:"@keyframes dql-spin { to { transform: rotate(360deg); } }"})]})}function pt({t:e,message:n,onRetry:r}){return t.jsx("div",{style:{height:"100%",display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary},children:t.jsxs("div",{style:{display:"grid",justifyItems:"center",gap:9,fontSize:12.5},children:[t.jsx("span",{children:"Source Control could not load the current repository state."}),t.jsx("span",{style:{color:e.textMuted,fontSize:11},children:n}),t.jsx("button",{type:"button",onClick:r,style:$(e,"primary"),children:"Retry"})]})})}function gt(e){const{t:n}=e;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 20px",borderBottom:`1px solid ${n.headerBorder}`,background:n.appBg,flexShrink:0,whiteSpace:"nowrap"},children:[t.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,fontWeight:700,letterSpacing:"0.08em",padding:"3px 7px",borderRadius:3,background:`${n.accent}1f`,color:n.accent,border:`1px solid ${n.accent}40`},children:"GIT"}),t.jsx("span",{style:{fontSize:14,fontWeight:500,color:n.textPrimary},children:"Source control"}),t.jsxs("div",{ref:e.branchMenuRef,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>e.setBranchMenuOpen(!e.branchMenuOpen),style:{display:"inline-flex",alignItems:"center",gap:5,background:n.cellBg,border:`1px solid ${n.cellBorder}`,color:n.textPrimary,padding:"3px 8px",borderRadius:4,fontSize:11,fontFamily:n.fontMono,cursor:"pointer"},children:[t.jsx(ne,{size:11,strokeWidth:1.75}),e.branchCurrent??"detached",t.jsx(tt,{size:10,strokeWidth:1.75,style:{opacity:.6}})]}),e.branchMenuOpen&&t.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:220,maxHeight:360,overflow:"auto",background:n.cellBg,border:`1px solid ${n.cellBorder}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",padding:"6px 0",zIndex:100},children:[e.branches.map(r=>t.jsxs("button",{onClick:()=>e.onCheckout(r),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"5px 10px",background:"transparent",border:"none",fontFamily:n.fontMono,fontSize:12,color:n.textPrimary,cursor:"pointer",textAlign:"left"},onMouseEnter:s=>s.currentTarget.style.background=n.btnHover,onMouseLeave:s=>s.currentTarget.style.background="transparent",children:[r===e.branchCurrent?t.jsx(re,{size:11,strokeWidth:2,color:n.success}):t.jsx("span",{style:{width:11,display:"inline-block"}}),r]},r)),t.jsx("div",{style:{borderTop:`1px solid ${n.cellBorder}`,margin:"4px 0"}}),e.newBranchOpen?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px"},children:[t.jsx("input",{autoFocus:!0,value:e.newBranchName,onChange:r=>e.setNewBranchName(r.target.value),onKeyDown:r=>{r.key==="Enter"&&e.onCreateBranch(),r.key==="Escape"&&(e.setNewBranchOpen(!1),e.setNewBranchName(""))},placeholder:"new-branch-name",style:{flex:1,background:n.appBg,color:n.textPrimary,border:`1px solid ${n.cellBorder}`,borderRadius:4,padding:"4px 7px",fontSize:12,fontFamily:n.fontMono,outline:"none"}}),t.jsx("button",{onClick:e.onCreateBranch,style:$(n,"primary"),children:"Create"})]}):t.jsxs("button",{onClick:()=>e.setNewBranchOpen(!0),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"6px 10px",background:"transparent",border:"none",fontSize:12,color:n.accent,cursor:"pointer",textAlign:"left"},onMouseEnter:r=>r.currentTarget.style.background=n.btnHover,onMouseLeave:r=>r.currentTarget.style.background="transparent",children:[t.jsx(nt,{size:11,strokeWidth:1.75}),"Create new branch…"]})]})]}),e.remoteUrl&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{fontSize:11,color:n.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:n.textMuted,fontFamily:n.fontMono,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},title:e.remoteUrl,children:Be(e.remoteUrl)})]}),t.jsx("span",{style:{fontSize:11,color:n.textMuted},children:"·"}),t.jsxs("span",{style:{fontSize:11,color:n.success,display:"inline-flex",alignItems:"center",gap:5},children:[t.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:n.success}}),"ready"]}),t.jsx("div",{style:{flex:1}}),t.jsx("button",{onClick:e.onRefresh,title:"Refresh",style:{background:"transparent",border:`1px solid ${n.btnBorder}`,padding:"6px 8px",borderRadius:5,cursor:"pointer",color:n.textMuted},children:t.jsx(we,{size:12,strokeWidth:1.75,style:{animation:e.refreshing?"dql-spin 0.6s linear":void 0}})}),t.jsx("style",{children:"@keyframes dql-spin { to { transform: rotate(360deg); } }"}),t.jsxs("button",{onClick:e.onPull,disabled:!!e.busy,style:Z(n),title:"Get updates from the shared project",children:[t.jsx(rt,{size:12,strokeWidth:1.75,color:n.warning}),"Get updates",e.behind>0&&t.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,color:n.textMuted,marginLeft:2},children:e.behind})]}),t.jsxs("button",{onClick:e.onPush,disabled:!!e.busy,style:Z(n,!0),title:"Send the current branch to the shared project",children:[t.jsx(ze,{size:12,strokeWidth:1.75}),"Send branch",e.ahead>0&&t.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,opacity:.75,marginLeft:2},children:e.ahead})]}),e.prUrl&&t.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noreferrer",style:{...Z(n),textDecoration:"none"},children:[t.jsx($e,{size:12,strokeWidth:1.75}),"Open PR"]})]})}function Z(e,n=!1){return{display:"inline-flex",alignItems:"center",gap:5,background:n?e.accent:e.cellBg,color:n?"#fff":e.textPrimary,border:`1px solid ${n?e.accent:e.btnBorder}`,padding:"5px 12px",borderRadius:6,fontSize:12,fontFamily:e.font,fontWeight:n?500:400,cursor:"pointer",whiteSpace:"nowrap"}}function $(e,n="default"){return{background:n==="primary"?e.accent:e.cellBg,color:n==="primary"?"#fff":e.textPrimary,border:`1px solid ${n==="primary"?e.accent:e.btnBorder}`,padding:"4px 9px",borderRadius:4,fontSize:11,cursor:"pointer",whiteSpace:"nowrap",fontFamily:e.font}}function Be(e){return e.replace(/^git@([^:]+):/,"$1/").replace(/^https?:\/\//,"").replace(/\.git$/,"")}function ft(e,n){if(!e||!n||n==="main"||n==="master"||n==="HEAD")return null;const r=Be(e),s=/(?:^|\/)github\.com\/([^/]+\/[^/]+)$/.exec(r);return s?`https://github.com/${s[1]}/compare/${encodeURIComponent(n)}?expand=1`:null}function yt(e){return`dql/review/${e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,46)||"governed-update"}-${Date.now().toString(36)}`}function ve(e){return e==="master"?"master":"main"}function mt(e,n){return e.length===n.length&&e.every((r,s)=>r===n[s])}function bt(e,n){return!!e&&e.inRepo===n.inRepo&&e.branch===n.branch&&e.ahead===n.ahead&&e.behind===n.behind&&e.changes.length===n.changes.length&&e.changes.every((r,s)=>{var a,u;return r.path===((a=n.changes[s])==null?void 0:a.path)&&r.status===((u=n.changes[s])==null?void 0:u.status)})}function H({t:e,state:n,index:r}){const s=n==="done"?{background:"var(--status-success-bg)",color:"var(--status-success)",border:"1.5px solid var(--status-success-border)"}:n==="active"?{background:"var(--accent-dim)",color:e.accent,border:`1.5px solid ${e.accent}`}:{background:e.appBg,color:e.textMuted,border:`1.5px solid ${e.headerBorder}`};return t.jsx("span",{style:{width:24,height:24,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700,flexShrink:0,...s},children:n==="done"?t.jsx(re,{size:12,strokeWidth:3}):r})}function vt({t:e,branch:n,pickedCount:r,totalCount:s,commitMsg:a,setCommitMsg:u,busy:o,sharedInfo:l,reviewUrl:x,onSuggest:h,onShare:f,onRequestReview:b,onStartNew:k,advancedOpen:M,onToggleAdvanced:S,context:N,onEnableTracking:A}){const P=o==="commit"||o==="push",w=l!==null,D=x!==null&&w,U=r>0||w?"done":"active",C=w||a.trim()?"done":r>0?"active":"todo",z=w?"done":a.trim()?"active":"todo",q=D?"done":w?"active":"todo",T=t.jsx("span",{style:{width:1.5,flex:1,background:"var(--border-subtle)",margin:"4px 0"}});return t.jsxs("aside",{style:{width:"clamp(280px, 26vw, 350px)",flexShrink:0,background:e.cellBg,borderLeft:`1px solid ${e.headerBorder}`,display:"flex",flexDirection:"column",minHeight:0,overflow:"auto"},children:[t.jsxs("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid var(--border-subtle)"},children:[t.jsx("div",{style:{fontSize:13,fontWeight:700,color:e.textPrimary},children:"Share your work"}),t.jsx("div",{style:{fontSize:11,color:e.textMuted,marginTop:2},children:"Four steps — no git commands needed."})]}),t.jsxs("div",{style:{padding:"14px 16px 20px",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[t.jsx(H,{t:e,state:U,index:1}),T]}),t.jsxs("div",{style:{flex:1,minWidth:0,paddingBottom:18},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Pick what to share"}),t.jsx("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:w?`${l.count} change${l.count===1?"":"s"} shared.`:`${r} of ${s} change${s===1?"":"s"} selected in the left panel. Review each one before moving on.`})]})]}),t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[t.jsx(H,{t:e,state:C,index:2}),T]}),t.jsxs("div",{style:{flex:1,minWidth:0,paddingBottom:18},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Describe your change"}),w?t.jsxs("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:["“",l.message,"”"]}):t.jsxs("div",{style:{marginTop:7,display:"flex",flexDirection:"column",gap:6},children:[t.jsx("textarea",{rows:2,value:a,onChange:E=>u(E.target.value),placeholder:"What did you change, in plain words?",style:{border:`1px solid ${e.headerBorder}`,background:e.appBg,borderRadius:8,padding:"8px 10px",fontSize:12,lineHeight:1.5,fontFamily:e.font,color:e.textPrimary,outline:"none",resize:"vertical"}}),t.jsxs("button",{type:"button",onClick:h,style:{display:"inline-flex",alignItems:"center",gap:5,width:"fit-content",border:"none",background:"none",color:e.accent,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,padding:0},children:[t.jsx(lt,{size:11})," Write it for me from the changes"]})]})]})]}),t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[t.jsx(H,{t:e,state:z,index:3}),T]}),t.jsxs("div",{style:{flex:1,minWidth:0,paddingBottom:18},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Share to your branch"}),t.jsxs("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:["Saves your work to ",n&&n!=="main"&&n!=="master"?t.jsx("span",{style:{fontFamily:e.fontMono,fontSize:10.5},children:n}):"a new review branch"," — main stays untouched."]}),P?t.jsx("div",{style:{marginTop:8,fontSize:12,fontWeight:700,backgroundImage:`linear-gradient(100deg, ${e.textPrimary} 25%, ${e.accent} 50%, ${e.textPrimary} 75%)`,backgroundSize:"220% 100%",WebkitBackgroundClip:"text",backgroundClip:"text",color:"transparent",WebkitTextFillColor:"transparent",animation:"dql-git-shimmer 2s linear infinite"},children:"Sharing your changes…"}):w?t.jsxs("div",{style:{marginTop:6,display:"inline-flex",alignItems:"center",gap:6,fontSize:11.5,color:"var(--status-success)",fontWeight:600},children:[t.jsx(re,{size:12,strokeWidth:2.5})," Shared · ",l.count," change",l.count===1?"":"s"," on your branch"]}):t.jsxs("button",{type:"button",onClick:f,disabled:!a.trim()||r===0,style:{marginTop:8,display:"inline-flex",alignItems:"center",gap:7,height:32,padding:"0 14px",borderRadius:8,border:"none",background:a.trim()&&r>0?e.accent:e.btnBg,color:a.trim()&&r>0?"#fff":e.textMuted,fontSize:12,fontWeight:650,cursor:a.trim()&&r>0?"pointer":"default",fontFamily:e.font,boxShadow:a.trim()&&r>0?"0 1px 4px rgba(107,93,211,0.25)":"none"},children:[t.jsx(ze,{size:12,strokeWidth:2})," Share ",r>0?`${r} change${r===1?"":"s"}`:"changes"]})]})]}),t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:t.jsx(H,{t:e,state:q,index:4})}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Ask for review"}),D?t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{marginTop:8,border:"1px solid var(--status-success-border)",background:"var(--status-success-bg)",borderRadius:10,padding:"11px 13px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[t.jsx(be,{size:13,color:"var(--status-success)"}),t.jsx("span",{style:{fontSize:12,fontWeight:700,color:"var(--status-success)"},children:"Review request opened"})]}),t.jsxs("div",{style:{fontSize:11.5,color:"var(--status-success)",lineHeight:1.55,marginTop:5},children:["“",l==null?void 0:l.message,"” — you'll be notified on approval. Nothing reaches main until then."]}),t.jsxs("a",{href:x,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:5,marginTop:9,fontSize:11.5,fontWeight:600,color:e.accent,textDecoration:"none"},children:["View on GitHub ",t.jsx($e,{size:11})]})]}),t.jsx("button",{type:"button",onClick:k,style:{marginTop:10,border:"none",background:"none",color:e.textMuted,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,padding:0},children:"Start a new change"})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:"A teammate approves before anything reaches main."}),w?t.jsxs("button",{type:"button",onClick:b,disabled:o==="request review",style:{marginTop:8,display:"inline-flex",alignItems:"center",gap:7,height:32,padding:"0 14px",borderRadius:8,border:"none",background:e.accent,color:"#fff",fontSize:12,fontWeight:650,cursor:"pointer",fontFamily:e.font,width:"fit-content",boxShadow:"0 1px 4px rgba(107,93,211,0.25)",opacity:o==="request review"?.7:1},children:[t.jsx(be,{size:12,strokeWidth:1.75})," ",o==="request review"?"Opening…":"Open review request"]}):null]})]})]})]}),t.jsxs("div",{style:{marginTop:"auto",borderTop:"1px solid var(--border-subtle)"},children:[t.jsxs("button",{type:"button",onClick:S,style:{width:"100%",textAlign:"left",border:"none",background:"none",color:e.textMuted,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,padding:"10px 16px"},children:[M?"▾":"▸"," Advanced"]}),M&&N?t.jsx("div",{style:{padding:"0 16px 14px"},children:t.jsx(jt,{t:e,context:N,onEnableTracking:A})}):null]}),t.jsx("style",{children:"@keyframes dql-git-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }"})]})}function jt({t:e,context:n,onEnableTracking:r}){const s=(o,l)=>l.total===0?`${o}: none yet`:l.ignored>0?`${o}: ${l.total} found · ${l.ignored} hidden from Git`:l.changed>0||l.untracked>0?`${o}: ${l.total} · ${l.changed+l.untracked} need review`:`${o}: ${l.total} tracked`,a=[["Domains",n.domains],["Skills",n.skills],["Project source",n.artifacts],["Governed learning",n.learning]],u=!n.trackingReady;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 10px",background:u?`${e.warning}10`:`${e.success}0d`,border:`1px solid ${u?`${e.warning}45`:`${e.success}35`}`,borderRadius:6,flexWrap:"wrap"},children:[t.jsx("span",{style:{fontSize:10,fontWeight:750,letterSpacing:"0.05em",textTransform:"uppercase",color:u?e.warning:e.success},children:"Governed context"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Domains",n.domains)}),t.jsx("span",{style:{color:e.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Skills",n.skills)}),t.jsx("span",{style:{color:e.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Project source",n.artifacts)}),t.jsx("span",{style:{color:e.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Governed learning",n.learning)}),t.jsx("div",{style:{flex:1}}),u?t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{fontSize:10,color:e.textMuted},children:n.legacyBroadIgnore?"A legacy .dql/ rule is hiding governed learning.":"Some shared project source is hidden from Git."}),t.jsx("button",{type:"button",onClick:r,style:$(e,"primary"),children:"Repair source-control tracking"})]}):t.jsx("span",{style:{fontSize:10,color:e.textMuted},children:"Shared project source"}),t.jsxs("details",{style:{width:"100%",borderTop:`1px solid ${e.headerBorder}`,paddingTop:5},children:[t.jsx("summary",{style:{cursor:"pointer",fontSize:10,color:e.textSecondary},children:"View governed source inventory"}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(210px, 1fr))",gap:8,marginTop:7},children:a.map(([o,l])=>t.jsxs("div",{style:{minWidth:0},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:e.textPrimary,marginBottom:3},children:o}),l.paths.length===0?t.jsx("div",{style:{fontSize:10,color:e.textMuted},children:"No files yet"}):l.paths.map(x=>t.jsxs("div",{title:x.path,style:{display:"flex",gap:5,minWidth:0,fontSize:9.5,lineHeight:1.5},children:[t.jsx("span",{style:{color:x.state==="ignored"?e.error:x.state==="tracked"?e.success:e.warning,flexShrink:0},children:x.state}),t.jsx("span",{style:{color:e.textSecondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.path})]},`${o}:${x.path}`))]},o))})]})]})}function ee(e){return e.startsWith(".dql/local/")||/ai[-_]?pin|saved[-_]?view|layout[-_]?override/i.test(e)?{id:"local",label:"Local/private",tone:"danger",rank:4}:e.startsWith(".dql/cache/")||e.startsWith(".dql/imports/")||e.startsWith("data/")||e==="dql-manifest.json"||/\.run\.json$/i.test(e)||/\.(sqlite|duckdb|duckdb\.wal)$/i.test(e)?{id:"generated",label:"Generated",tone:"warn",rank:3}:/\.dqlnb$/i.test(e)?{id:"notebooks",label:"Curated notebook",tone:"neutral",rank:2}:/\/apps\/[^/]+\/dql\.app\.json$/.test(e)||/^apps\/[^/]+\/dql\.app\.json$/.test(e)||/\/dashboards\/[^/]+\.dqld$/.test(e)||/^apps\/[^/]+\/dashboards\/[^/]+\.dqld$/.test(e)?{id:"apps",label:"Shared app",tone:"neutral",rank:1}:e.startsWith("skills/")||e.startsWith(".dql/skills/")||/^domains\//i.test(e)||/^\.dql\/(hints|traces|evaluations|reviews)\//i.test(e)?{id:"business",label:"Governed context",tone:"good",rank:0}:/\.dql$/i.test(e)||e.startsWith("semantic-layer/")||/\.(ya?ml)$/i.test(e)||e==="dql.config.json"||e==="package.json"?{id:"business",label:"Business logic",tone:"good",rank:0}:{id:"apps",label:"Shared source",tone:"neutral",rank:1}}function je(e,n){const r=ee(e.path),s=ee(n.path);return r.rank-s.rank||e.path.localeCompare(n.path)}function St(e){const{t:n}=e;return t.jsxs("div",{style:{width:300,flexShrink:0,background:n.sidebarBg,borderRight:`1px solid ${n.headerBorder}`,display:"flex",flexDirection:"column",overflow:"hidden"},children:[t.jsxs("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${n.headerBorder}`},children:[t.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8,fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:n.textMuted},children:"Source control"}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginBottom:10},children:[t.jsx("span",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.01em",color:n.textPrimary},children:"Changes"}),t.jsxs("span",{style:{fontSize:11,color:n.textMuted},children:[e.totalCount," files"]}),t.jsx("div",{style:{flex:1}}),e.unstagedFiles.length>0&&t.jsx("button",{onClick:e.onStageAll,style:$(n),children:"Include all"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,background:n.cellBg,border:`1px solid ${n.cellBorder}`,borderRadius:6,padding:"5px 9px",marginBottom:7},children:[t.jsx(it,{size:11,strokeWidth:1.75,color:n.textMuted}),t.jsx("input",{value:e.query,onChange:r=>e.setQuery(r.target.value),placeholder:"Filter by path…",style:{background:"transparent",border:"none",outline:"none",color:n.textPrimary,fontSize:12,flex:1,width:"100%",fontFamily:n.font}}),e.query&&t.jsx("button",{onClick:()=>e.setQuery(""),style:{background:"transparent",border:"none",color:n.textMuted,cursor:"pointer",padding:0},children:t.jsx(at,{size:11,strokeWidth:1.75})})]}),t.jsx("select",{value:e.statusFilter,onChange:r=>e.setStatusFilter(r.target.value),style:{width:"100%",background:n.cellBg,color:n.textPrimary,border:`1px solid ${n.cellBorder}`,borderRadius:6,padding:"5px 9px",fontSize:12,cursor:"pointer",fontFamily:n.font},children:ct.map(r=>t.jsx("option",{value:r.key,children:r.label},r.key))})]}),t.jsxs("div",{style:{flex:1,overflow:"auto",padding:"6px 8px"},children:[t.jsx(Se,{t:n,label:"Included",count:e.stagedFiles.length}),e.stagedFiles.length===0?t.jsx("div",{style:{fontSize:11,color:n.textMuted,padding:"4px 10px",fontStyle:"italic"},children:"No files included yet"}):e.stagedFiles.map(r=>t.jsx(ke,{t:n,file:r,active:e.selectedPath===r.path&&e.selectedStaged===!0,onClick:()=>e.onSelect(r.path,!0),actionLabel:"Remove",onAction:()=>e.onUnstage(r.path)},`staged-${r.path}`)),t.jsx("div",{style:{height:8}}),t.jsx(Se,{t:n,label:"Needs review",count:e.unstagedFiles.length}),e.unstagedFiles.length===0?t.jsx("div",{style:{fontSize:11,color:n.textMuted,padding:"4px 10px",fontStyle:"italic"},children:e.totalCount===0?"Everything is up to date":"No additional files to review"}):e.unstagedFiles.map(r=>t.jsx(ke,{t:n,file:r,active:e.selectedPath===r.path&&e.selectedStaged===!1,onClick:()=>e.onSelect(r.path,!1),actionLabel:"Include",onAction:()=>e.onStage(r.path)},`unstaged-${r.path}`))]}),t.jsx("div",{style:{padding:"10px 14px",borderTop:"1px solid var(--border-subtle)",fontSize:10.5,color:n.textMuted,lineHeight:1.5},children:"Unselected changes stay safely in your workspace — nothing is lost."}),t.jsxs("div",{style:{padding:"8px 14px",borderTop:"1px solid var(--border-subtle)",fontSize:10,color:n.textMuted,display:"flex",alignItems:"center",gap:6},children:[t.jsx(ne,{size:11,strokeWidth:1.75}),t.jsx("span",{style:{fontFamily:n.fontMono,color:n.textPrimary},children:e.branchCurrent??"detached"}),t.jsx("span",{children:"·"}),e.behind>0&&t.jsxs("span",{style:{color:n.warning},children:["↓",e.behind]}),e.ahead>0&&t.jsxs("span",{style:{color:n.success},children:["↑",e.ahead]}),e.behind===0&&e.ahead===0&&t.jsx("span",{children:"up to date"})]})]})}function Se({t:e,label:n,count:r}){return t.jsxs("div",{style:{fontSize:10,color:e.textMuted,fontWeight:600,letterSpacing:"0.07em",textTransform:"uppercase",padding:"6px 8px 4px",display:"flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:n}),t.jsx("span",{style:{color:e.textMuted,opacity:.7},children:"·"}),t.jsx("span",{style:{color:e.textMuted},children:r})]})}function ke({t:e,file:n,active:r,onClick:s,actionLabel:a,onAction:u}){const[o,l]=d.useState(!1),x=n.path.split("/").slice(0,-1).join("/"),h=n.path.split("/").pop()??n.path,f=ee(n.path);return t.jsxs("div",{onClick:s,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:5,marginBottom:1,cursor:"pointer",background:r?`${e.accent}18`:o?e.btnHover:"transparent",border:r?`1px solid ${e.accent}45`:"1px solid transparent"},children:[t.jsx(We,{t:e,status:n.status}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:12,color:e.textPrimary,fontFamily:e.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h}),x&&t.jsx("div",{style:{fontSize:10,color:e.textMuted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x}),t.jsx("div",{style:{marginTop:4,display:"flex",alignItems:"center",gap:5},children:t.jsx("span",{style:kt(e,f),children:f.label})})]}),o&&t.jsx("button",{onClick:b=>{b.stopPropagation(),u()},style:{background:e.cellBg,border:`1px solid ${e.btnBorder}`,color:e.textPrimary,padding:"2px 7px",borderRadius:3,fontSize:10,cursor:"pointer",flexShrink:0,fontFamily:e.font},children:a})]})}function kt(e,n){const r=n.tone==="good"?e.success:n.tone==="warn"?e.warning:n.tone==="danger"?e.error:e.textMuted;return{display:"inline-flex",alignItems:"center",minWidth:0,maxWidth:"100%",border:`1px solid ${r}35`,background:`${r}12`,color:r,borderRadius:3,padding:"1px 5px",fontSize:9,fontWeight:650,lineHeight:"14px",whiteSpace:"nowrap"}}function We({t:e,status:n}){const r={M:{label:"Edited",color:e.warning},A:{label:"New",color:e.success},D:{label:"Removed",color:e.error},R:{label:"Renamed",color:e.accent},"?":{label:"New",color:e.success}},{label:s,color:a}=r[n];return t.jsx("span",{style:{flexShrink:0,padding:"1.5px 7px",borderRadius:999,background:`${a}1a`,color:a,fontSize:9.5,fontWeight:700,fontFamily:e.font,whiteSpace:"nowrap"},children:s})}function wt({t:e,entry:n,stagedView:r,onStage:s,onUnstage:a,onDiscard:u,diffView:o,onDiffView:l}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 16px",borderBottom:`1px solid ${e.headerBorder}`,background:e.cellBg,flexShrink:0},children:[t.jsx("div",{style:{fontSize:12,fontWeight:650,color:e.textPrimary,fontFamily:e.fontMono,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path}),t.jsx(We,{t:e,status:n.status}),n.partiallyStaged&&t.jsx("span",{style:{fontSize:10.5,color:e.warning,whiteSpace:"nowrap"},children:"partially included"}),t.jsx("div",{style:{flex:1}}),t.jsxs("div",{role:"group","aria-label":"Diff view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${e.headerBorder}`,borderRadius:7,background:e.appBg,flexShrink:0},children:[t.jsx("button",{type:"button",onClick:()=>l("plain"),style:{border:"none",borderRadius:5,padding:"3.5px 10px",fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,background:o==="plain"?"var(--accent-dim)":"transparent",color:o==="plain"?e.accent:e.textMuted},children:"What changed"}),t.jsx("button",{type:"button",onClick:()=>l("code"),style:{border:"none",borderRadius:5,padding:"3.5px 10px",fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,background:o==="code"?"var(--accent-dim)":"transparent",color:o==="code"?e.accent:e.textMuted},children:"Code view"})]}),!r&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:u,style:$(e),children:"Discard"}),t.jsx("button",{onClick:s,style:$(e,"primary"),children:"Include"})]}),r&&t.jsx("button",{onClick:a,style:$(e),children:"Remove"})]})}function zt({t:e,diff:n,entry:r}){const s=Ce(n),a=[];let u="",o=0,l=0;for(const h of s)if(h.kind==="hunk"&&(u=h.text.replace(/^@@[^@]*@@\s*/,"").trim()),h.kind==="add"&&(o+=1),h.kind==="del"&&(l+=1),(h.kind==="add"||h.kind==="del")&&a.length<5){const f=h.text.replace(/^[+-]\s?/,"").trim();f&&!a.some(b=>b.text.includes(f.slice(0,40)))&&a.push({mark:h.kind==="add"?"+":"−",text:`${h.kind==="add"?"Added":"Removed"}${u?` in ${u}`:""}: ${f.slice(0,90)}`})}const x={"+":{bg:"var(--status-success-bg)",color:"var(--status-success)"},"−":{bg:"var(--status-error-bg)",color:"var(--status-error)"},"±":{bg:"var(--status-warning-bg)",color:"var(--status-warning)"}};return t.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,maxWidth:560},children:[t.jsx("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:e.textMuted},children:"Summary of this change"}),t.jsx("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:10,background:e.cellBg,overflow:"hidden"},children:a.length===0?t.jsx("div",{style:{padding:"10px 13px",fontSize:12.5,color:e.textMuted},children:r.status==="?"?"A brand-new file — everything in it is an addition.":"No line-level changes to summarize for this selection."}):a.map((h,f)=>t.jsxs("div",{style:{display:"flex",gap:9,padding:"10px 13px",borderBottom:f<a.length-1?"1px solid var(--border-subtle)":"none",alignItems:"flex-start"},children:[t.jsx("span",{style:{flexShrink:0,width:18,height:18,borderRadius:5,background:x[h.mark].bg,color:x[h.mark].color,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700},children:h.mark}),t.jsx("span",{style:{fontSize:12.5,color:e.textPrimary,lineHeight:1.5,fontFamily:e.fontMono,overflowWrap:"anywhere"},children:h.text})]},f))}),t.jsxs("div",{style:{fontSize:11,color:e.textMuted},children:[o," addition",o===1?"":"s"," · ",l," removal",l===1?"":"s"," — switch to Code view for the full detail."]}),t.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start",border:"1px solid var(--status-success-border)",background:"var(--status-success-bg)",borderRadius:10,padding:"10px 13px"},children:[t.jsx(st,{size:13,color:"var(--status-success)",style:{flexShrink:0,marginTop:1}}),t.jsx("span",{style:{fontSize:12,color:"var(--status-success)",lineHeight:1.55},children:"Nothing reaches main until a reviewer approves — your workspace stays safe."})]})]})})}function $t({t:e,diff:n,entry:r,loading:s,error:a}){return s?t.jsx(te,{t:e,title:"Loading diff",body:"Preparing the selected change for review."}):a?t.jsx(te,{t:e,title:"Could not load diff",body:a,tone:"error"}):t.jsx(Bt,{t:e,diff:n,entry:r})}function Bt({t:e,diff:n,entry:r}){return n.trim()?t.jsx("div",{style:{flex:1,overflow:"auto",background:e.cellBg,fontFamily:e.fontMono,fontSize:12,lineHeight:"20px"},children:Ce(n).map((s,a)=>t.jsx(Wt,{t:e,line:s},a))}):t.jsx(te,{t:e,title:"No text hunks to review",body:r.status==="?"?"This untracked item does not expose a readable text diff yet. Stage it to include it in the next commit.":"Git reports this file changed, but there are no line-level text hunks for this selection."})}function te({t:e,title:n,body:r,tone:s="muted"}){const a=s==="error"?e.error:e.textMuted;return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:e.appBg,padding:32},children:t.jsxs("div",{style:{maxWidth:420,border:`1px solid ${s==="error"?`${e.error}55`:e.cellBorder}`,background:e.cellBg,borderRadius:8,padding:18,display:"flex",flexDirection:"column",gap:7,textAlign:"center"},children:[t.jsx("div",{style:{fontSize:14,fontWeight:600,color:s==="error"?e.error:e.textPrimary},children:n}),t.jsx("div",{style:{fontSize:12,lineHeight:1.5,color:a},children:r})]})})}function Ce(e){const n=[];let r=0,s=0;const a=e.split(`
|
|
7
|
-
`);let u=0;for(const o of a){if(u++>1e3){n.push({kind:"meta",text:"… diff truncated (over 1000 lines)",oldNum:null,newNum:null});break}if(!(o.startsWith("diff --git")||o.startsWith("index ")||o.startsWith("+++ ")||o.startsWith("--- "))){if(o.startsWith("new file mode ")||o.startsWith("deleted file mode ")||o.startsWith("old mode ")||o.startsWith("new mode ")||o.startsWith("rename from ")||o.startsWith("rename to ")||o.startsWith("Binary file ")||o.startsWith("# ")){n.push({kind:"meta",text:o,oldNum:null,newNum:null});continue}if(o.startsWith("@@")){const l=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(o);l&&(r=Number(l[1]),s=Number(l[2])),n.push({kind:"hunk",text:o,oldNum:null,newNum:null});continue}o.startsWith("+")?n.push({kind:"add",text:o.slice(1),oldNum:null,newNum:s++}):o.startsWith("-")?n.push({kind:"del",text:o.slice(1),oldNum:r++,newNum:null}):o.startsWith("\\")?n.push({kind:"meta",text:o,oldNum:null,newNum:null}):n.push({kind:"ctx",text:o.startsWith(" ")?o.slice(1):o,oldNum:r++,newNum:s++})}}return n}function Wt({t:e,line:n}){if(n.kind==="hunk")return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr",background:`${e.accent}14`,borderTop:`1px solid ${e.accent}30`,borderBottom:`1px solid ${e.accent}30`,color:e.accent},children:[t.jsx("div",{style:{padding:"2px 10px",textAlign:"right",borderRight:`1px solid ${e.accent}30`,color:e.textMuted},children:"⋯"}),t.jsx("div",{style:{padding:"2px 12px",whiteSpace:"pre"},children:n.text})]});if(n.kind==="meta")return t.jsx("div",{style:{padding:"2px 12px",color:e.textMuted,fontStyle:"italic"},children:n.text});const r={add:{bg:`${e.success}18`,gutter:`${e.success}55`,ch:"+",chColor:e.success},del:{bg:`${e.error}18`,gutter:`${e.error}55`,ch:"−",chColor:e.error},ctx:{bg:"transparent",gutter:e.cellBorder,ch:" ",chColor:e.textMuted}}[n.kind];return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px 40px 20px 1fr",background:r.bg,borderLeft:`3px solid ${r.gutter}`},children:[t.jsx("div",{style:{padding:"0 6px",color:e.textMuted,textAlign:"right",userSelect:"none"},children:n.oldNum??""}),t.jsx("div",{style:{padding:"0 6px",color:e.textMuted,textAlign:"right",userSelect:"none",borderRight:`1px solid ${e.cellBorder}`},children:n.newNum??""}),t.jsx("div",{style:{padding:"0 4px",color:r.chColor,textAlign:"center",userSelect:"none"},children:r.ch}),t.jsx("div",{style:{padding:"0 10px",whiteSpace:"pre",color:e.textPrimary,overflow:"hidden"},children:n.text})]})}function Ct({t:e,hasFiles:n}){return t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,color:e.textMuted,fontSize:13,background:e.appBg},children:[t.jsx(ot,{size:28,strokeWidth:1.5,color:e.textMuted,style:{opacity:.4}}),n?"Select a file to view its diff":"Working tree clean — no changes to review"]})}function Rt({t:e,commitMsg:n,setCommitMsg:r,stagedCount:s,unstagedCount:a,onCommit:u,onCommitAndPush:o,onRequestReview:l,advancedOpen:x,onToggleAdvanced:h,busy:f}){const b=s===0&&a>0,k=s===0&&a===0,M=b?`${a} change${a===1?"":"s"} will be included in the review request`:s>0?`${s} change${s===1?"":"s"} prepared for review`:"No changes to share";return t.jsxs("div",{style:{padding:"12px 20px",borderTop:`1px solid ${e.headerBorder}`,background:e.cellBg,flexShrink:0,display:"flex",flexDirection:"column",gap:6},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("div",{style:{fontSize:11,color:e.textMuted,flex:1},children:M}),t.jsx("span",{style:{fontSize:10,color:e.textMuted},children:"A review branch is created when needed."})]}),t.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[t.jsx("input",{value:n,onChange:S=>r(S.target.value),onKeyDown:S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),l())},placeholder:"Describe this update for your reviewer…",style:{flex:1,background:e.appBg,color:e.textPrimary,border:`1px solid ${e.cellBorder}`,borderRadius:6,padding:"7px 10px",fontSize:12,outline:"none",fontFamily:e.font}}),t.jsx("button",{onClick:l,disabled:!!f||k||!n.trim(),style:{background:e.accent,color:"#fff",border:`1px solid ${e.accent}`,padding:"7px 14px",borderRadius:6,fontSize:12,fontWeight:700,cursor:"pointer",opacity:k||!n.trim()?.5:1,fontFamily:e.font},children:"Request review"}),t.jsx("button",{onClick:h,style:$(e),children:x?"Hide details":"More options"})]}),x&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,paddingTop:2},children:[t.jsx("span",{style:{fontSize:10,color:e.textMuted,flex:1},children:"Advanced Git actions are optional. They do not merge changes."}),t.jsx("button",{onClick:u,disabled:!!f||k||!n.trim(),style:{...$(e),opacity:k||!n.trim()?.45:1},children:"Save locally"}),t.jsx("button",{onClick:o,disabled:!!f||k||!n.trim(),style:{...$(e),opacity:k||!n.trim()?.45:1},children:"Commit & push"})]})]})}function Mt({t:e,kind:n,text:r}){const s=n==="ok"?e.success:e.error;return t.jsx("div",{style:{position:"absolute",bottom:80,right:24,background:e.cellBg,border:`1px solid ${s}55`,borderLeft:`3px solid ${s}`,borderRadius:6,padding:"8px 14px",fontSize:12,color:e.textPrimary,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",maxWidth:420,zIndex:200},children:r})}function
|
|
6
|
+
*/const dt=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]],be=Ye("git-pull-request",dt),ct=[{key:"all",label:"All changes"},{key:"M",label:"Modified"},{key:"A",label:"Added"},{key:"D",label:"Deleted"},{key:"R",label:"Renamed"},{key:"?",label:"Untracked"}];function ut(e){const n=e;return n.trim()==="??"?"?":n[0]==="R"||n[1]==="R"?"R":n.includes("A")?"A":n.includes("D")?"D":"M"}function ht(e){const n=[];for(const r of e){const s=r.status[0]??" ",a=r.status[1]??" ",u=ut(r.status);if(r.status==="??"){n.push({path:r.path,status:"?",staged:!1,partiallyStaged:!1});continue}const o=s!==" "&&s!=="?";o&&(a!==" "&&a!=="?")?(n.push({path:r.path,status:u,staged:!0,partiallyStaged:!0}),n.push({path:r.path,status:u,staged:!1,partiallyStaged:!0})):o?n.push({path:r.path,status:u,staged:!0,partiallyStaged:!1}):n.push({path:r.path,status:u,staged:!1,partiallyStaged:!1})}return n}function At(){const e=Ze[et(i=>i.themeMode)],[n,r]=d.useState(null),[s,a]=d.useState({current:null,branches:[]}),[u,o]=d.useState({url:null,name:null}),[l,x]=d.useState(null),[h,f]=d.useState(!1),[b,k]=d.useState(null),[M,S]=d.useState(!1),[N,A]=d.useState(null),[D,w]=d.useState(""),[F,U]=d.useState("all"),[C,z]=d.useState(""),[q,T]=d.useState(null),[E,ie]=d.useState(null),[Re,se]=d.useState(!1),[Me,Fe]=d.useState(!1),[oe,le]=d.useState(null),[O,G]=d.useState(!1),[Pe,_]=d.useState(!1),[ae,de]=d.useState(""),[Q,K]=d.useState(null),[ce,ue]=d.useState(!1),[De,Te]=d.useState(null),[he,Ie]=d.useState("plain"),[I,xe]=d.useState(null),[pe,Ne]=d.useState(()=>typeof window<"u"&&window.innerWidth<980);d.useEffect(()=>{const i=()=>Ne(window.innerWidth<980);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);const V=d.useRef(null),B=d.useCallback(async()=>{se(!0),le(null);try{const[i,c,p,j]=await Promise.all([g.fetchGitStatus(),g.fetchGitBranches(),g.fetchGitRemote(),g.fetchGitGovernedContext()]);r(m=>bt(m,i)?m:i),a(m=>m.current===c.current&&mt(m.branches,c.branches)?m:{current:c.current,branches:c.branches}),o(m=>m.url===p.url&&m.name===p.name?m:{url:p.url,name:p.name}),Te(j)}catch(i){le(i instanceof Error?i.message:String(i))}finally{Fe(!0),window.setTimeout(()=>se(!1),350)}},[]);d.useEffect(()=>{B()},[B]),d.useEffect(()=>{let i=!1;const c=window.setInterval(()=>{document.visibilityState!=="visible"||i||(i=!0,B().finally(()=>{i=!1}))},4e3);return()=>window.clearInterval(c)},[B]),d.useEffect(()=>{if(!O)return;const i=c=>{V.current&&!V.current.contains(c.target)&&(G(!1),_(!1))};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[O]);const Ae=d.useMemo(()=>{var i;return((i=((n==null?void 0:n.changes)??[]).find(c=>c.path===l))==null?void 0:i.status)??""},[l,n==null?void 0:n.changes]);d.useEffect(()=>{if(!l){k(null),A(null),S(!1);return}let i=!1;return S(!0),A(null),g.fetchGitDiff(l,h).then(c=>{i||k(c)}).catch(c=>{i||A(c instanceof Error?c.message:String(c))}).finally(()=>{i||S(!1)}),()=>{i=!0}},[l,h,Ae]);const W=d.useMemo(()=>ht((n==null?void 0:n.changes)??[]),[n==null?void 0:n.changes]),R=W.filter(i=>i.staged),X=W.filter(i=>!i.staged),ge=d.useCallback(i=>!(F!=="all"&&i.status!==F||D&&!i.path.toLowerCase().includes(D.toLowerCase())),[F,D]),J=R.filter(ge).sort(je),Y=X.filter(ge).sort(je);d.useEffect(()=>{if(l&&W.some(p=>p.path===l&&p.staged===h))return;const i=Y[0]??J[0];i?(x(i.path),f(i.staged)):x(null)},[W,l,h,J,Y]);const v=d.useCallback((i,c)=>{ie({kind:i,text:c}),window.setTimeout(()=>ie(null),3e3)},[]),y=d.useCallback(async(i,c,p)=>{T(i);try{const j=await c();return j.ok?(p&&v("ok",p),await B()):v("err",j.error??`${i} failed`),j}finally{T(null)}},[v,B]),fe=i=>y("stage",()=>g.gitStage([i])),ye=i=>y("unstage",()=>g.gitUnstage([i])),qe=i=>{window.confirm(`Discard local changes to ${i}? This cannot be undone.`)&&y("discard",()=>g.gitDiscard([i]),"Discarded local changes")},Ee=()=>y("stage",async()=>{const i=X.map(c=>c.path);return i.length===0?{ok:!0}:g.gitStage(i)}),Ge=async()=>{const i=C.trim();if(!i)return v("err","Commit message required");const c=R.length===0;(await y("commit",()=>g.gitCommit(i,c),"Committed")).ok&&z("")},Le=async()=>{const i=C.trim();if(!i)return v("err","Commit message required");const c=R.length===0;(await y("commit",()=>g.gitCommit(i,c))).ok&&(z(""),await y("push",()=>g.gitPush(),"Pushed to remote"))},me=async()=>{const i=C.trim()||(I==null?void 0:I.message)||"";if(!i)return v("err","Review title required");if(I){const j=await y("request review",()=>g.gitOpenReview({title:i,body:"Created from DQL Source Control. Review the governed analytics changes before merging.",base:I.base}));if(!j.ok)return;K(j.prUrl??null),v("ok",j.warning??"Review request opened.");return}const c=Array.from(new Set(W.map(j=>j.path)));if(c.length===0)return v("err","No changes to request review for");const p=await y("request review",()=>g.gitCreateReview({paths:c,title:i,body:"Created from DQL Source Control. Review the governed analytics changes before merging.",base:ve(s.current)}));p.ok&&(z(""),K(p.prUrl??null),v("ok",p.warning??`Review branch ${p.branch??""} is ready${p.prUrl?".":"; create the PR from your Git host."}`))},He=async()=>{(await y("enable governed tracking",()=>g.enableGitGovernedContextTracking())).ok&&v("ok","Governed project source and Hint Graph files are now visible to source control.")},Ue=()=>y("pull",()=>g.gitPull(),"Pulled from remote"),Oe=()=>y("push",()=>g.gitPush(),"Pushed to remote"),_e=()=>{const i=R;if(i.length===0)return v("err","Include at least one change first");const c={M:"Updated",A:"Added",D:"Removed",R:"Renamed","?":"Added"},p=i.slice(0,3).map(m=>{var L;return`${c[m.status]} ${((L=m.path.split("/").pop())==null?void 0:L.replace(/\.(dql|md|json|ya?ml|sql)$/i,""))??m.path}`}),j=i.length>3?` and ${i.length-3} more change${i.length-3===1?"":"s"}`:"";z(`${p.join(", ")}${j}.`)},Qe=async()=>{const i=C.trim();if(!i)return v("err","Describe your change first");if(R.length===0)return v("err","Include at least one change first");if(!u.url)return v("err","Add a Git remote before sharing changes");const c=R.length,p=ve(s.current);if(!s.current||s.current==="HEAD"||s.current==="main"||s.current==="master"){const L=yt(i);if(!(await y("branch",()=>g.gitCreateBranch(L,!0))).ok)return}if(!(await y("commit",()=>g.gitCommit(i,!1))).ok)return;(await y("push",()=>g.gitPush(),"Shared to your branch")).ok&&xe({count:c,message:i,base:p}),z("")},Ke=()=>{xe(null),K(null),z(""),B()},Ve=i=>{G(!1),y("checkout",()=>g.gitCheckout(i),`Switched to ${i}`)},Xe=async()=>{const i=ae.trim();i&&(G(!1),_(!1),de(""),y("branch",()=>g.gitCreateBranch(i,!0),`Created and switched to ${i}`))},P=W.find(i=>i.path===l&&i.staged===h)??null,Je=d.useMemo(()=>Q??ft(u.url,s.current),[u.url,s.current,Q]);return Me?oe&&!n?t.jsx(pt,{t:e,message:oe,onRetry:()=>void B()}):n&&!n.inRepo?t.jsx(Ft,{t:e}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,background:e.appBg},children:[t.jsx(gt,{t:e,branchCurrent:s.current,branches:s.branches,ahead:(n==null?void 0:n.ahead)??0,behind:(n==null?void 0:n.behind)??0,remoteUrl:u.url,refreshing:Re,busy:q,onPull:Ue,onPush:Oe,onRefresh:()=>void B(),prUrl:Je,onCheckout:Ve,branchMenuOpen:O,setBranchMenuOpen:G,newBranchOpen:Pe,setNewBranchOpen:_,newBranchName:ae,setNewBranchName:de,onCreateBranch:Xe,branchMenuRef:V}),t.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,overflow:"hidden"},children:[t.jsx(St,{t:e,stagedFiles:J,unstagedFiles:Y,totalCount:W.length,selectedPath:l,selectedStaged:h,onSelect:(i,c)=>{x(i),f(c)},query:D,setQuery:w,statusFilter:F,setStatusFilter:U,onStage:fe,onUnstage:ye,onStageAll:Ee,ahead:(n==null?void 0:n.ahead)??0,behind:(n==null?void 0:n.behind)??0,branchCurrent:s.current}),t.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden",background:e.appBg},children:[P?t.jsxs(t.Fragment,{children:[t.jsx(wt,{t:e,entry:P,onStage:()=>fe(P.path),onUnstage:()=>ye(P.path),onDiscard:()=>qe(P.path),stagedView:h,diffView:he,onDiffView:Ie}),he==="plain"&&!M&&!N?t.jsx(zt,{t:e,diff:(b==null?void 0:b.diff)??"",entry:P}):t.jsx($t,{t:e,diff:(b==null?void 0:b.diff)??"",entry:P,loading:M,error:N})]}):t.jsx(Ct,{t:e,hasFiles:W.length>0}),pe?t.jsx(Rt,{t:e,commitMsg:C,setCommitMsg:z,stagedCount:R.length,unstagedCount:X.length,onCommit:Ge,onCommitAndPush:Le,onRequestReview:me,advancedOpen:ce,onToggleAdvanced:()=>ue(i=>!i),busy:q}):null]}),pe?null:t.jsx(vt,{t:e,branch:s.current,pickedCount:R.length,totalCount:W.length,commitMsg:C,setCommitMsg:z,busy:q,sharedInfo:I,reviewUrl:Q,onSuggest:_e,onShare:()=>void Qe(),onRequestReview:()=>void me(),onStartNew:Ke,advancedOpen:ce,onToggleAdvanced:()=>ue(i=>!i),context:De,onEnableTracking:He})]}),E&&t.jsx(Mt,{t:e,kind:E.kind,text:E.text})]}):t.jsx(xt,{t:e})}function xt({t:e}){return t.jsxs("div",{style:{height:"100%",display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary},children:[t.jsxs("div",{role:"status",style:{display:"flex",alignItems:"center",gap:9,fontSize:12.5},children:[t.jsx(we,{size:15,strokeWidth:1.8,style:{animation:"dql-spin 0.8s linear infinite"}}),"Loading current repository state…"]}),t.jsx("style",{children:"@keyframes dql-spin { to { transform: rotate(360deg); } }"})]})}function pt({t:e,message:n,onRetry:r}){return t.jsx("div",{style:{height:"100%",display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary},children:t.jsxs("div",{style:{display:"grid",justifyItems:"center",gap:9,fontSize:12.5},children:[t.jsx("span",{children:"Source Control could not load the current repository state."}),t.jsx("span",{style:{color:e.textMuted,fontSize:11},children:n}),t.jsx("button",{type:"button",onClick:r,style:$(e,"primary"),children:"Retry"})]})})}function gt(e){const{t:n}=e;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 20px",borderBottom:`1px solid ${n.headerBorder}`,background:n.appBg,flexShrink:0,whiteSpace:"nowrap"},children:[t.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,fontWeight:700,letterSpacing:"0.08em",padding:"3px 7px",borderRadius:3,background:`${n.accent}1f`,color:n.accent,border:`1px solid ${n.accent}40`},children:"GIT"}),t.jsx("span",{style:{fontSize:14,fontWeight:500,color:n.textPrimary},children:"Source control"}),t.jsxs("div",{ref:e.branchMenuRef,style:{position:"relative"},children:[t.jsxs("button",{onClick:()=>e.setBranchMenuOpen(!e.branchMenuOpen),style:{display:"inline-flex",alignItems:"center",gap:5,background:n.cellBg,border:`1px solid ${n.cellBorder}`,color:n.textPrimary,padding:"3px 8px",borderRadius:4,fontSize:11,fontFamily:n.fontMono,cursor:"pointer"},children:[t.jsx(ne,{size:11,strokeWidth:1.75}),e.branchCurrent??"detached",t.jsx(tt,{size:10,strokeWidth:1.75,style:{opacity:.6}})]}),e.branchMenuOpen&&t.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:220,maxHeight:360,overflow:"auto",background:n.cellBg,border:`1px solid ${n.cellBorder}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",padding:"6px 0",zIndex:100},children:[e.branches.map(r=>t.jsxs("button",{onClick:()=>e.onCheckout(r),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"5px 10px",background:"transparent",border:"none",fontFamily:n.fontMono,fontSize:12,color:n.textPrimary,cursor:"pointer",textAlign:"left"},onMouseEnter:s=>s.currentTarget.style.background=n.btnHover,onMouseLeave:s=>s.currentTarget.style.background="transparent",children:[r===e.branchCurrent?t.jsx(re,{size:11,strokeWidth:2,color:n.success}):t.jsx("span",{style:{width:11,display:"inline-block"}}),r]},r)),t.jsx("div",{style:{borderTop:`1px solid ${n.cellBorder}`,margin:"4px 0"}}),e.newBranchOpen?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px"},children:[t.jsx("input",{autoFocus:!0,value:e.newBranchName,onChange:r=>e.setNewBranchName(r.target.value),onKeyDown:r=>{r.key==="Enter"&&e.onCreateBranch(),r.key==="Escape"&&(e.setNewBranchOpen(!1),e.setNewBranchName(""))},placeholder:"new-branch-name",style:{flex:1,background:n.appBg,color:n.textPrimary,border:`1px solid ${n.cellBorder}`,borderRadius:4,padding:"4px 7px",fontSize:12,fontFamily:n.fontMono,outline:"none"}}),t.jsx("button",{onClick:e.onCreateBranch,style:$(n,"primary"),children:"Create"})]}):t.jsxs("button",{onClick:()=>e.setNewBranchOpen(!0),style:{width:"100%",display:"flex",alignItems:"center",gap:6,padding:"6px 10px",background:"transparent",border:"none",fontSize:12,color:n.accent,cursor:"pointer",textAlign:"left"},onMouseEnter:r=>r.currentTarget.style.background=n.btnHover,onMouseLeave:r=>r.currentTarget.style.background="transparent",children:[t.jsx(nt,{size:11,strokeWidth:1.75}),"Create new branch…"]})]})]}),e.remoteUrl&&t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{fontSize:11,color:n.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:n.textMuted,fontFamily:n.fontMono,maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},title:e.remoteUrl,children:Be(e.remoteUrl)})]}),t.jsx("span",{style:{fontSize:11,color:n.textMuted},children:"·"}),t.jsxs("span",{style:{fontSize:11,color:n.success,display:"inline-flex",alignItems:"center",gap:5},children:[t.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:n.success}}),"ready"]}),t.jsx("div",{style:{flex:1}}),t.jsx("button",{onClick:e.onRefresh,title:"Refresh",style:{background:"transparent",border:`1px solid ${n.btnBorder}`,padding:"6px 8px",borderRadius:5,cursor:"pointer",color:n.textMuted},children:t.jsx(we,{size:12,strokeWidth:1.75,style:{animation:e.refreshing?"dql-spin 0.6s linear":void 0}})}),t.jsx("style",{children:"@keyframes dql-spin { to { transform: rotate(360deg); } }"}),t.jsxs("button",{onClick:e.onPull,disabled:!!e.busy,style:Z(n),title:"Get updates from the shared project",children:[t.jsx(rt,{size:12,strokeWidth:1.75,color:n.warning}),"Get updates",e.behind>0&&t.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,color:n.textMuted,marginLeft:2},children:e.behind})]}),t.jsxs("button",{onClick:e.onPush,disabled:!!e.busy,style:Z(n,!0),title:"Send the current branch to the shared project",children:[t.jsx(ze,{size:12,strokeWidth:1.75}),"Send branch",e.ahead>0&&t.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,opacity:.75,marginLeft:2},children:e.ahead})]}),e.prUrl&&t.jsxs("a",{href:e.prUrl,target:"_blank",rel:"noreferrer",style:{...Z(n),textDecoration:"none"},children:[t.jsx($e,{size:12,strokeWidth:1.75}),"Open PR"]})]})}function Z(e,n=!1){return{display:"inline-flex",alignItems:"center",gap:5,background:n?e.accent:e.cellBg,color:n?"#fff":e.textPrimary,border:`1px solid ${n?e.accent:e.btnBorder}`,padding:"5px 12px",borderRadius:6,fontSize:12,fontFamily:e.font,fontWeight:n?500:400,cursor:"pointer",whiteSpace:"nowrap"}}function $(e,n="default"){return{background:n==="primary"?e.accent:e.cellBg,color:n==="primary"?"#fff":e.textPrimary,border:`1px solid ${n==="primary"?e.accent:e.btnBorder}`,padding:"4px 9px",borderRadius:4,fontSize:11,cursor:"pointer",whiteSpace:"nowrap",fontFamily:e.font}}function Be(e){return e.replace(/^git@([^:]+):/,"$1/").replace(/^https?:\/\//,"").replace(/\.git$/,"")}function ft(e,n){if(!e||!n||n==="main"||n==="master"||n==="HEAD")return null;const r=Be(e),s=/(?:^|\/)github\.com\/([^/]+\/[^/]+)$/.exec(r);return s?`https://github.com/${s[1]}/compare/${encodeURIComponent(n)}?expand=1`:null}function yt(e){return`dql/review/${e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,46)||"governed-update"}-${Date.now().toString(36)}`}function ve(e){return e==="master"?"master":"main"}function mt(e,n){return e.length===n.length&&e.every((r,s)=>r===n[s])}function bt(e,n){return!!e&&e.inRepo===n.inRepo&&e.branch===n.branch&&e.ahead===n.ahead&&e.behind===n.behind&&e.changes.length===n.changes.length&&e.changes.every((r,s)=>{var a,u;return r.path===((a=n.changes[s])==null?void 0:a.path)&&r.status===((u=n.changes[s])==null?void 0:u.status)})}function H({t:e,state:n,index:r}){const s=n==="done"?{background:"var(--status-success-bg)",color:"var(--status-success)",border:"1.5px solid var(--status-success-border)"}:n==="active"?{background:"var(--accent-dim)",color:e.accent,border:`1.5px solid ${e.accent}`}:{background:e.appBg,color:e.textMuted,border:`1.5px solid ${e.headerBorder}`};return t.jsx("span",{style:{width:24,height:24,borderRadius:999,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700,flexShrink:0,...s},children:n==="done"?t.jsx(re,{size:12,strokeWidth:3}):r})}function vt({t:e,branch:n,pickedCount:r,totalCount:s,commitMsg:a,setCommitMsg:u,busy:o,sharedInfo:l,reviewUrl:x,onSuggest:h,onShare:f,onRequestReview:b,onStartNew:k,advancedOpen:M,onToggleAdvanced:S,context:N,onEnableTracking:A}){const D=o==="commit"||o==="push",w=l!==null,F=x!==null&&w,U=r>0||w?"done":"active",C=w||a.trim()?"done":r>0?"active":"todo",z=w?"done":a.trim()?"active":"todo",q=F?"done":w?"active":"todo",T=t.jsx("span",{style:{width:1.5,flex:1,background:"var(--border-subtle)",margin:"4px 0"}});return t.jsxs("aside",{style:{width:"clamp(280px, 26vw, 350px)",flexShrink:0,background:e.cellBg,borderLeft:`1px solid ${e.headerBorder}`,display:"flex",flexDirection:"column",minHeight:0,overflow:"auto"},children:[t.jsxs("div",{style:{padding:"14px 16px 12px",borderBottom:"1px solid var(--border-subtle)"},children:[t.jsx("div",{style:{fontSize:13,fontWeight:700,color:e.textPrimary},children:"Share your work"}),t.jsx("div",{style:{fontSize:11,color:e.textMuted,marginTop:2},children:"Four steps — no git commands needed."})]}),t.jsxs("div",{style:{padding:"14px 16px 20px",display:"flex",flexDirection:"column"},children:[t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[t.jsx(H,{t:e,state:U,index:1}),T]}),t.jsxs("div",{style:{flex:1,minWidth:0,paddingBottom:18},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Pick what to share"}),t.jsx("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:w?`${l.count} change${l.count===1?"":"s"} shared.`:`${r} of ${s} change${s===1?"":"s"} selected in the left panel. Review each one before moving on.`})]})]}),t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[t.jsx(H,{t:e,state:C,index:2}),T]}),t.jsxs("div",{style:{flex:1,minWidth:0,paddingBottom:18},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Describe your change"}),w?t.jsxs("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:["“",l.message,"”"]}):t.jsxs("div",{style:{marginTop:7,display:"flex",flexDirection:"column",gap:6},children:[t.jsx("textarea",{rows:2,value:a,onChange:E=>u(E.target.value),placeholder:"What did you change, in plain words?",style:{border:`1px solid ${e.headerBorder}`,background:e.appBg,borderRadius:8,padding:"8px 10px",fontSize:12,lineHeight:1.5,fontFamily:e.font,color:e.textPrimary,outline:"none",resize:"vertical"}}),t.jsxs("button",{type:"button",onClick:h,style:{display:"inline-flex",alignItems:"center",gap:5,width:"fit-content",border:"none",background:"none",color:e.accent,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,padding:0},children:[t.jsx(lt,{size:11})," Write it for me from the changes"]})]})]})]}),t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[t.jsx(H,{t:e,state:z,index:3}),T]}),t.jsxs("div",{style:{flex:1,minWidth:0,paddingBottom:18},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Share to your branch"}),t.jsxs("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:["Saves your work to ",n&&n!=="main"&&n!=="master"?t.jsx("span",{style:{fontFamily:e.fontMono,fontSize:10.5},children:n}):"a new review branch"," — main stays untouched."]}),D?t.jsx("div",{style:{marginTop:8,fontSize:12,fontWeight:700,backgroundImage:`linear-gradient(100deg, ${e.textPrimary} 25%, ${e.accent} 50%, ${e.textPrimary} 75%)`,backgroundSize:"220% 100%",WebkitBackgroundClip:"text",backgroundClip:"text",color:"transparent",WebkitTextFillColor:"transparent",animation:"dql-git-shimmer 2s linear infinite"},children:"Sharing your changes…"}):w?t.jsxs("div",{style:{marginTop:6,display:"inline-flex",alignItems:"center",gap:6,fontSize:11.5,color:"var(--status-success)",fontWeight:600},children:[t.jsx(re,{size:12,strokeWidth:2.5})," Shared · ",l.count," change",l.count===1?"":"s"," on your branch"]}):t.jsxs("button",{type:"button",onClick:f,disabled:!a.trim()||r===0,style:{marginTop:8,display:"inline-flex",alignItems:"center",gap:7,height:32,padding:"0 14px",borderRadius:8,border:"none",background:a.trim()&&r>0?e.accent:e.btnBg,color:a.trim()&&r>0?"#fff":e.textMuted,fontSize:12,fontWeight:650,cursor:a.trim()&&r>0?"pointer":"default",fontFamily:e.font,boxShadow:a.trim()&&r>0?"0 1px 4px rgba(107,93,211,0.25)":"none"},children:[t.jsx(ze,{size:12,strokeWidth:2})," Share ",r>0?`${r} change${r===1?"":"s"}`:"changes"]})]})]}),t.jsxs("div",{style:{display:"flex",gap:11},children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:t.jsx(H,{t:e,state:q,index:4})}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:12.5,fontWeight:650,color:e.textPrimary},children:"Ask for review"}),F?t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{marginTop:8,border:"1px solid var(--status-success-border)",background:"var(--status-success-bg)",borderRadius:10,padding:"11px 13px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7},children:[t.jsx(be,{size:13,color:"var(--status-success)"}),t.jsx("span",{style:{fontSize:12,fontWeight:700,color:"var(--status-success)"},children:"Review request opened"})]}),t.jsxs("div",{style:{fontSize:11.5,color:"var(--status-success)",lineHeight:1.55,marginTop:5},children:["“",l==null?void 0:l.message,"” — you'll be notified on approval. Nothing reaches main until then."]}),t.jsxs("a",{href:x,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:5,marginTop:9,fontSize:11.5,fontWeight:600,color:e.accent,textDecoration:"none"},children:["View on GitHub ",t.jsx($e,{size:11})]})]}),t.jsx("button",{type:"button",onClick:k,style:{marginTop:10,border:"none",background:"none",color:e.textMuted,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,padding:0},children:"Start a new change"})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.5,marginTop:2},children:"A teammate approves before anything reaches main."}),w?t.jsxs("button",{type:"button",onClick:b,disabled:o==="request review",style:{marginTop:8,display:"inline-flex",alignItems:"center",gap:7,height:32,padding:"0 14px",borderRadius:8,border:"none",background:e.accent,color:"#fff",fontSize:12,fontWeight:650,cursor:"pointer",fontFamily:e.font,width:"fit-content",boxShadow:"0 1px 4px rgba(107,93,211,0.25)",opacity:o==="request review"?.7:1},children:[t.jsx(be,{size:12,strokeWidth:1.75})," ",o==="request review"?"Opening…":"Open review request"]}):null]})]})]})]}),t.jsxs("div",{style:{marginTop:"auto",borderTop:"1px solid var(--border-subtle)"},children:[t.jsxs("button",{type:"button",onClick:S,style:{width:"100%",textAlign:"left",border:"none",background:"none",color:e.textMuted,fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,padding:"10px 16px"},children:[M?"▾":"▸"," Advanced"]}),M&&N?t.jsx("div",{style:{padding:"0 16px 14px"},children:t.jsx(jt,{t:e,context:N,onEnableTracking:A})}):null]}),t.jsx("style",{children:"@keyframes dql-git-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }"})]})}function jt({t:e,context:n,onEnableTracking:r}){const s=(o,l)=>l.total===0?`${o}: none yet`:l.ignored>0?`${o}: ${l.total} found · ${l.ignored} hidden from Git`:l.changed>0||l.untracked>0?`${o}: ${l.total} · ${l.changed+l.untracked} need review`:`${o}: ${l.total} tracked`,a=[["Domains",n.domains],["Skills",n.skills],["Project source",n.artifacts],["Governed learning",n.learning]],u=!n.trackingReady;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"7px 10px",background:u?`${e.warning}10`:`${e.success}0d`,border:`1px solid ${u?`${e.warning}45`:`${e.success}35`}`,borderRadius:6,flexWrap:"wrap"},children:[t.jsx("span",{style:{fontSize:10,fontWeight:750,letterSpacing:"0.05em",textTransform:"uppercase",color:u?e.warning:e.success},children:"Governed context"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Domains",n.domains)}),t.jsx("span",{style:{color:e.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Skills",n.skills)}),t.jsx("span",{style:{color:e.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Project source",n.artifacts)}),t.jsx("span",{style:{color:e.textMuted},children:"·"}),t.jsx("span",{style:{fontSize:11,color:e.textPrimary},children:s("Governed learning",n.learning)}),t.jsx("div",{style:{flex:1}}),u?t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{fontSize:10,color:e.textMuted},children:n.legacyBroadIgnore?"A legacy .dql/ rule is hiding governed learning.":"Some shared project source is hidden from Git."}),t.jsx("button",{type:"button",onClick:r,style:$(e,"primary"),children:"Repair source-control tracking"})]}):t.jsx("span",{style:{fontSize:10,color:e.textMuted},children:"Shared project source"}),t.jsxs("details",{style:{width:"100%",borderTop:`1px solid ${e.headerBorder}`,paddingTop:5},children:[t.jsx("summary",{style:{cursor:"pointer",fontSize:10,color:e.textSecondary},children:"View governed source inventory"}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(210px, 1fr))",gap:8,marginTop:7},children:a.map(([o,l])=>t.jsxs("div",{style:{minWidth:0},children:[t.jsx("div",{style:{fontSize:10,fontWeight:700,color:e.textPrimary,marginBottom:3},children:o}),l.paths.length===0?t.jsx("div",{style:{fontSize:10,color:e.textMuted},children:"No files yet"}):l.paths.map(x=>t.jsxs("div",{title:x.path,style:{display:"flex",gap:5,minWidth:0,fontSize:9.5,lineHeight:1.5},children:[t.jsx("span",{style:{color:x.state==="ignored"?e.error:x.state==="tracked"?e.success:e.warning,flexShrink:0},children:x.state}),t.jsx("span",{style:{color:e.textSecondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.path})]},`${o}:${x.path}`))]},o))})]})]})}function ee(e){return e.startsWith(".dql/local/")||/ai[-_]?pin|saved[-_]?view|layout[-_]?override/i.test(e)?{id:"local",label:"Local/private",tone:"danger",rank:4}:e.startsWith(".dql/cache/")||e.startsWith(".dql/imports/")||e.startsWith("data/")||e==="dql-manifest.json"||/\.run\.json$/i.test(e)||/\.(sqlite|duckdb|duckdb\.wal)$/i.test(e)?{id:"generated",label:"Generated",tone:"warn",rank:3}:/\.dqlnb$/i.test(e)?{id:"notebooks",label:"Curated notebook",tone:"neutral",rank:2}:/\/apps\/[^/]+\/dql\.app\.json$/.test(e)||/^apps\/[^/]+\/dql\.app\.json$/.test(e)||/\/dashboards\/[^/]+\.dqld$/.test(e)||/^apps\/[^/]+\/dashboards\/[^/]+\.dqld$/.test(e)?{id:"apps",label:"Shared app",tone:"neutral",rank:1}:e.startsWith("skills/")||e.startsWith(".dql/skills/")||/^domains\//i.test(e)||/^\.dql\/(hints|traces|evaluations|reviews)\//i.test(e)?{id:"business",label:"Governed context",tone:"good",rank:0}:/\.dql$/i.test(e)||e.startsWith("semantic-layer/")||/\.(ya?ml)$/i.test(e)||e==="dql.config.json"||e==="package.json"?{id:"business",label:"Business logic",tone:"good",rank:0}:{id:"apps",label:"Shared source",tone:"neutral",rank:1}}function je(e,n){const r=ee(e.path),s=ee(n.path);return r.rank-s.rank||e.path.localeCompare(n.path)}function St(e){const{t:n}=e;return t.jsxs("div",{style:{width:300,flexShrink:0,background:n.sidebarBg,borderRight:`1px solid ${n.headerBorder}`,display:"flex",flexDirection:"column",overflow:"hidden"},children:[t.jsxs("div",{style:{padding:"12px 14px 10px",borderBottom:`1px solid ${n.headerBorder}`},children:[t.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8,fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:n.textMuted},children:"Source control"}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8,marginBottom:10},children:[t.jsx("span",{style:{fontSize:18,fontWeight:700,letterSpacing:"-0.01em",color:n.textPrimary},children:"Changes"}),t.jsxs("span",{style:{fontSize:11,color:n.textMuted},children:[e.totalCount," files"]}),t.jsx("div",{style:{flex:1}}),e.unstagedFiles.length>0&&t.jsx("button",{onClick:e.onStageAll,style:$(n),children:"Include all"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,background:n.cellBg,border:`1px solid ${n.cellBorder}`,borderRadius:6,padding:"5px 9px",marginBottom:7},children:[t.jsx(it,{size:11,strokeWidth:1.75,color:n.textMuted}),t.jsx("input",{value:e.query,onChange:r=>e.setQuery(r.target.value),placeholder:"Filter by path…",style:{background:"transparent",border:"none",outline:"none",color:n.textPrimary,fontSize:12,flex:1,width:"100%",fontFamily:n.font}}),e.query&&t.jsx("button",{onClick:()=>e.setQuery(""),style:{background:"transparent",border:"none",color:n.textMuted,cursor:"pointer",padding:0},children:t.jsx(at,{size:11,strokeWidth:1.75})})]}),t.jsx("select",{value:e.statusFilter,onChange:r=>e.setStatusFilter(r.target.value),style:{width:"100%",background:n.cellBg,color:n.textPrimary,border:`1px solid ${n.cellBorder}`,borderRadius:6,padding:"5px 9px",fontSize:12,cursor:"pointer",fontFamily:n.font},children:ct.map(r=>t.jsx("option",{value:r.key,children:r.label},r.key))})]}),t.jsxs("div",{style:{flex:1,overflow:"auto",padding:"6px 8px"},children:[t.jsx(Se,{t:n,label:"Included",count:e.stagedFiles.length}),e.stagedFiles.length===0?t.jsx("div",{style:{fontSize:11,color:n.textMuted,padding:"4px 10px",fontStyle:"italic"},children:"No files included yet"}):e.stagedFiles.map(r=>t.jsx(ke,{t:n,file:r,active:e.selectedPath===r.path&&e.selectedStaged===!0,onClick:()=>e.onSelect(r.path,!0),actionLabel:"Remove",onAction:()=>e.onUnstage(r.path)},`staged-${r.path}`)),t.jsx("div",{style:{height:8}}),t.jsx(Se,{t:n,label:"Needs review",count:e.unstagedFiles.length}),e.unstagedFiles.length===0?t.jsx("div",{style:{fontSize:11,color:n.textMuted,padding:"4px 10px",fontStyle:"italic"},children:e.totalCount===0?"Everything is up to date":"No additional files to review"}):e.unstagedFiles.map(r=>t.jsx(ke,{t:n,file:r,active:e.selectedPath===r.path&&e.selectedStaged===!1,onClick:()=>e.onSelect(r.path,!1),actionLabel:"Include",onAction:()=>e.onStage(r.path)},`unstaged-${r.path}`))]}),t.jsx("div",{style:{padding:"10px 14px",borderTop:"1px solid var(--border-subtle)",fontSize:10.5,color:n.textMuted,lineHeight:1.5},children:"Unselected changes stay safely in your workspace — nothing is lost."}),t.jsxs("div",{style:{padding:"8px 14px",borderTop:"1px solid var(--border-subtle)",fontSize:10,color:n.textMuted,display:"flex",alignItems:"center",gap:6},children:[t.jsx(ne,{size:11,strokeWidth:1.75}),t.jsx("span",{style:{fontFamily:n.fontMono,color:n.textPrimary},children:e.branchCurrent??"detached"}),t.jsx("span",{children:"·"}),e.behind>0&&t.jsxs("span",{style:{color:n.warning},children:["↓",e.behind]}),e.ahead>0&&t.jsxs("span",{style:{color:n.success},children:["↑",e.ahead]}),e.behind===0&&e.ahead===0&&t.jsx("span",{children:"up to date"})]})]})}function Se({t:e,label:n,count:r}){return t.jsxs("div",{style:{fontSize:10,color:e.textMuted,fontWeight:600,letterSpacing:"0.07em",textTransform:"uppercase",padding:"6px 8px 4px",display:"flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:n}),t.jsx("span",{style:{color:e.textMuted,opacity:.7},children:"·"}),t.jsx("span",{style:{color:e.textMuted},children:r})]})}function ke({t:e,file:n,active:r,onClick:s,actionLabel:a,onAction:u}){const[o,l]=d.useState(!1),x=n.path.split("/").slice(0,-1).join("/"),h=n.path.split("/").pop()??n.path,f=ee(n.path);return t.jsxs("div",{onClick:s,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:5,marginBottom:1,cursor:"pointer",background:r?`${e.accent}18`:o?e.btnHover:"transparent",border:r?`1px solid ${e.accent}45`:"1px solid transparent"},children:[t.jsx(We,{t:e,status:n.status}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx("div",{style:{fontSize:12,color:e.textPrimary,fontFamily:e.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h}),x&&t.jsx("div",{style:{fontSize:10,color:e.textMuted,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x}),t.jsx("div",{style:{marginTop:4,display:"flex",alignItems:"center",gap:5},children:t.jsx("span",{style:kt(e,f),children:f.label})})]}),o&&t.jsx("button",{onClick:b=>{b.stopPropagation(),u()},style:{background:e.cellBg,border:`1px solid ${e.btnBorder}`,color:e.textPrimary,padding:"2px 7px",borderRadius:3,fontSize:10,cursor:"pointer",flexShrink:0,fontFamily:e.font},children:a})]})}function kt(e,n){const r=n.tone==="good"?e.success:n.tone==="warn"?e.warning:n.tone==="danger"?e.error:e.textMuted;return{display:"inline-flex",alignItems:"center",minWidth:0,maxWidth:"100%",border:`1px solid ${r}35`,background:`${r}12`,color:r,borderRadius:3,padding:"1px 5px",fontSize:9,fontWeight:650,lineHeight:"14px",whiteSpace:"nowrap"}}function We({t:e,status:n}){const r={M:{label:"Edited",color:e.warning},A:{label:"New",color:e.success},D:{label:"Removed",color:e.error},R:{label:"Renamed",color:e.accent},"?":{label:"New",color:e.success}},{label:s,color:a}=r[n];return t.jsx("span",{style:{flexShrink:0,padding:"1.5px 7px",borderRadius:999,background:`${a}1a`,color:a,fontSize:9.5,fontWeight:700,fontFamily:e.font,whiteSpace:"nowrap"},children:s})}function wt({t:e,entry:n,stagedView:r,onStage:s,onUnstage:a,onDiscard:u,diffView:o,onDiffView:l}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 16px",borderBottom:`1px solid ${e.headerBorder}`,background:e.cellBg,flexShrink:0},children:[t.jsx("div",{style:{fontSize:12,fontWeight:650,color:e.textPrimary,fontFamily:e.fontMono,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path}),t.jsx(We,{t:e,status:n.status}),n.partiallyStaged&&t.jsx("span",{style:{fontSize:10.5,color:e.warning,whiteSpace:"nowrap"},children:"partially included"}),t.jsx("div",{style:{flex:1}}),t.jsxs("div",{role:"group","aria-label":"Diff view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${e.headerBorder}`,borderRadius:7,background:e.appBg,flexShrink:0},children:[t.jsx("button",{type:"button",onClick:()=>l("plain"),style:{border:"none",borderRadius:5,padding:"3.5px 10px",fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,background:o==="plain"?"var(--accent-dim)":"transparent",color:o==="plain"?e.accent:e.textMuted},children:"What changed"}),t.jsx("button",{type:"button",onClick:()=>l("code"),style:{border:"none",borderRadius:5,padding:"3.5px 10px",fontSize:11,fontWeight:600,cursor:"pointer",fontFamily:e.font,background:o==="code"?"var(--accent-dim)":"transparent",color:o==="code"?e.accent:e.textMuted},children:"Code view"})]}),!r&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:u,style:$(e),children:"Discard"}),t.jsx("button",{onClick:s,style:$(e,"primary"),children:"Include"})]}),r&&t.jsx("button",{onClick:a,style:$(e),children:"Remove"})]})}function zt({t:e,diff:n,entry:r}){const s=Ce(n),a=[];let u="",o=0,l=0;for(const h of s)if(h.kind==="hunk"&&(u=h.text.replace(/^@@[^@]*@@\s*/,"").trim()),h.kind==="add"&&(o+=1),h.kind==="del"&&(l+=1),(h.kind==="add"||h.kind==="del")&&a.length<5){const f=h.text.replace(/^[+-]\s?/,"").trim();f&&!a.some(b=>b.text.includes(f.slice(0,40)))&&a.push({mark:h.kind==="add"?"+":"−",text:`${h.kind==="add"?"Added":"Removed"}${u?` in ${u}`:""}: ${f.slice(0,90)}`})}const x={"+":{bg:"var(--status-success-bg)",color:"var(--status-success)"},"−":{bg:"var(--status-error-bg)",color:"var(--status-error)"},"±":{bg:"var(--status-warning-bg)",color:"var(--status-warning)"}};return t.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,maxWidth:560},children:[t.jsx("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:e.textMuted},children:"Summary of this change"}),t.jsx("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:10,background:e.cellBg,overflow:"hidden"},children:a.length===0?t.jsx("div",{style:{padding:"10px 13px",fontSize:12.5,color:e.textMuted},children:r.status==="?"?"A brand-new file — everything in it is an addition.":"No line-level changes to summarize for this selection."}):a.map((h,f)=>t.jsxs("div",{style:{display:"flex",gap:9,padding:"10px 13px",borderBottom:f<a.length-1?"1px solid var(--border-subtle)":"none",alignItems:"flex-start"},children:[t.jsx("span",{style:{flexShrink:0,width:18,height:18,borderRadius:5,background:x[h.mark].bg,color:x[h.mark].color,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700},children:h.mark}),t.jsx("span",{style:{fontSize:12.5,color:e.textPrimary,lineHeight:1.5,fontFamily:e.fontMono,overflowWrap:"anywhere"},children:h.text})]},f))}),t.jsxs("div",{style:{fontSize:11,color:e.textMuted},children:[o," addition",o===1?"":"s"," · ",l," removal",l===1?"":"s"," — switch to Code view for the full detail."]}),t.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start",border:"1px solid var(--status-success-border)",background:"var(--status-success-bg)",borderRadius:10,padding:"10px 13px"},children:[t.jsx(st,{size:13,color:"var(--status-success)",style:{flexShrink:0,marginTop:1}}),t.jsx("span",{style:{fontSize:12,color:"var(--status-success)",lineHeight:1.55},children:"Nothing reaches main until a reviewer approves — your workspace stays safe."})]})]})})}function $t({t:e,diff:n,entry:r,loading:s,error:a}){return s?t.jsx(te,{t:e,title:"Loading diff",body:"Preparing the selected change for review."}):a?t.jsx(te,{t:e,title:"Could not load diff",body:a,tone:"error"}):t.jsx(Bt,{t:e,diff:n,entry:r})}function Bt({t:e,diff:n,entry:r}){return n.trim()?t.jsx("div",{style:{flex:1,overflow:"auto",background:e.cellBg,fontFamily:e.fontMono,fontSize:12,lineHeight:"20px"},children:Ce(n).map((s,a)=>t.jsx(Wt,{t:e,line:s},a))}):t.jsx(te,{t:e,title:"No text hunks to review",body:r.status==="?"?"This untracked item does not expose a readable text diff yet. Stage it to include it in the next commit.":"Git reports this file changed, but there are no line-level text hunks for this selection."})}function te({t:e,title:n,body:r,tone:s="muted"}){const a=s==="error"?e.error:e.textMuted;return t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:e.appBg,padding:32},children:t.jsxs("div",{style:{maxWidth:420,border:`1px solid ${s==="error"?`${e.error}55`:e.cellBorder}`,background:e.cellBg,borderRadius:8,padding:18,display:"flex",flexDirection:"column",gap:7,textAlign:"center"},children:[t.jsx("div",{style:{fontSize:14,fontWeight:600,color:s==="error"?e.error:e.textPrimary},children:n}),t.jsx("div",{style:{fontSize:12,lineHeight:1.5,color:a},children:r})]})})}function Ce(e){const n=[];let r=0,s=0;const a=e.split(`
|
|
7
|
+
`);let u=0;for(const o of a){if(u++>1e3){n.push({kind:"meta",text:"… diff truncated (over 1000 lines)",oldNum:null,newNum:null});break}if(!(o.startsWith("diff --git")||o.startsWith("index ")||o.startsWith("+++ ")||o.startsWith("--- "))){if(o.startsWith("new file mode ")||o.startsWith("deleted file mode ")||o.startsWith("old mode ")||o.startsWith("new mode ")||o.startsWith("rename from ")||o.startsWith("rename to ")||o.startsWith("Binary file ")||o.startsWith("# ")){n.push({kind:"meta",text:o,oldNum:null,newNum:null});continue}if(o.startsWith("@@")){const l=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(o);l&&(r=Number(l[1]),s=Number(l[2])),n.push({kind:"hunk",text:o,oldNum:null,newNum:null});continue}o.startsWith("+")?n.push({kind:"add",text:o.slice(1),oldNum:null,newNum:s++}):o.startsWith("-")?n.push({kind:"del",text:o.slice(1),oldNum:r++,newNum:null}):o.startsWith("\\")?n.push({kind:"meta",text:o,oldNum:null,newNum:null}):n.push({kind:"ctx",text:o.startsWith(" ")?o.slice(1):o,oldNum:r++,newNum:s++})}}return n}function Wt({t:e,line:n}){if(n.kind==="hunk")return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr",background:`${e.accent}14`,borderTop:`1px solid ${e.accent}30`,borderBottom:`1px solid ${e.accent}30`,color:e.accent},children:[t.jsx("div",{style:{padding:"2px 10px",textAlign:"right",borderRight:`1px solid ${e.accent}30`,color:e.textMuted},children:"⋯"}),t.jsx("div",{style:{padding:"2px 12px",whiteSpace:"pre"},children:n.text})]});if(n.kind==="meta")return t.jsx("div",{style:{padding:"2px 12px",color:e.textMuted,fontStyle:"italic"},children:n.text});const r={add:{bg:`${e.success}18`,gutter:`${e.success}55`,ch:"+",chColor:e.success},del:{bg:`${e.error}18`,gutter:`${e.error}55`,ch:"−",chColor:e.error},ctx:{bg:"transparent",gutter:e.cellBorder,ch:" ",chColor:e.textMuted}}[n.kind];return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px 40px 20px 1fr",background:r.bg,borderLeft:`3px solid ${r.gutter}`},children:[t.jsx("div",{style:{padding:"0 6px",color:e.textMuted,textAlign:"right",userSelect:"none"},children:n.oldNum??""}),t.jsx("div",{style:{padding:"0 6px",color:e.textMuted,textAlign:"right",userSelect:"none",borderRight:`1px solid ${e.cellBorder}`},children:n.newNum??""}),t.jsx("div",{style:{padding:"0 4px",color:r.chColor,textAlign:"center",userSelect:"none"},children:r.ch}),t.jsx("div",{style:{padding:"0 10px",whiteSpace:"pre",color:e.textPrimary,overflow:"hidden"},children:n.text})]})}function Ct({t:e,hasFiles:n}){return t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:8,color:e.textMuted,fontSize:13,background:e.appBg},children:[t.jsx(ot,{size:28,strokeWidth:1.5,color:e.textMuted,style:{opacity:.4}}),n?"Select a file to view its diff":"Working tree clean — no changes to review"]})}function Rt({t:e,commitMsg:n,setCommitMsg:r,stagedCount:s,unstagedCount:a,onCommit:u,onCommitAndPush:o,onRequestReview:l,advancedOpen:x,onToggleAdvanced:h,busy:f}){const b=s===0&&a>0,k=s===0&&a===0,M=b?`${a} change${a===1?"":"s"} will be included in the review request`:s>0?`${s} change${s===1?"":"s"} prepared for review`:"No changes to share";return t.jsxs("div",{style:{padding:"12px 20px",borderTop:`1px solid ${e.headerBorder}`,background:e.cellBg,flexShrink:0,display:"flex",flexDirection:"column",gap:6},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("div",{style:{fontSize:11,color:e.textMuted,flex:1},children:M}),t.jsx("span",{style:{fontSize:10,color:e.textMuted},children:"A review branch is created when needed."})]}),t.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[t.jsx("input",{value:n,onChange:S=>r(S.target.value),onKeyDown:S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),l())},placeholder:"Describe this update for your reviewer…",style:{flex:1,background:e.appBg,color:e.textPrimary,border:`1px solid ${e.cellBorder}`,borderRadius:6,padding:"7px 10px",fontSize:12,outline:"none",fontFamily:e.font}}),t.jsx("button",{onClick:l,disabled:!!f||k||!n.trim(),style:{background:e.accent,color:"#fff",border:`1px solid ${e.accent}`,padding:"7px 14px",borderRadius:6,fontSize:12,fontWeight:700,cursor:"pointer",opacity:k||!n.trim()?.5:1,fontFamily:e.font},children:"Request review"}),t.jsx("button",{onClick:h,style:$(e),children:x?"Hide details":"More options"})]}),x&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,paddingTop:2},children:[t.jsx("span",{style:{fontSize:10,color:e.textMuted,flex:1},children:"Advanced Git actions are optional. They do not merge changes."}),t.jsx("button",{onClick:u,disabled:!!f||k||!n.trim(),style:{...$(e),opacity:k||!n.trim()?.45:1},children:"Save locally"}),t.jsx("button",{onClick:o,disabled:!!f||k||!n.trim(),style:{...$(e),opacity:k||!n.trim()?.45:1},children:"Commit & push"})]})]})}function Mt({t:e,kind:n,text:r}){const s=n==="ok"?e.success:e.error;return t.jsx("div",{style:{position:"absolute",bottom:80,right:24,background:e.cellBg,border:`1px solid ${s}55`,borderLeft:`3px solid ${s}`,borderRadius:6,padding:"8px 14px",fontSize:12,color:e.textPrimary,boxShadow:"0 8px 24px rgba(0,0,0,0.18)",maxWidth:420,zIndex:200},children:r})}function Ft({t:e}){return t.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:12,padding:40,background:e.appBg},children:[t.jsx(ne,{size:36,strokeWidth:1.5,color:e.textMuted,style:{opacity:.5}}),t.jsx("div",{style:{fontSize:16,fontWeight:600,color:e.textPrimary},children:"Not a git repository"}),t.jsxs("div",{style:{fontSize:13,color:e.textMuted,maxWidth:420,textAlign:"center"},children:["Initialize this folder with ",t.jsx("code",{style:{fontFamily:e.fontMono},children:"git init"})," to start tracking changes."]})]})}export{At as GitPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as h,t as g,r as x,j as l,a as b}from"./index-DJRMz64S.js";import{U as E}from"./UnifiedAgentRunPanel-IxDUKSG8.js";import{A as P,a as _,b as w}from"./AiSidePanel-CzIgxmP9.js";import{u as I}from"./usePersistedAgentThreadId-DYdx896E.js";import"./react-CRB3T2We.js";import"./AiBuildResult-Cob_Lj05.js";import"./user-round-Bfu7fosn.js";import"./triangle-alert-COWnsSdh.js";import"./rotate-ccw-D_9U9o7X.js";import"./x-B4coLiOl.js";import"./list-tree-Dw0qlxPK.js";import"./wrench-CvfM03KZ.js";import"./minimize-2-DUiSrPS3.js";import"./arrow-right-TH8_ufKG.js";import"./TrustBadge-Bob1Laiq.js";function M(){const{state:o,dispatch:i}=h(),r=g[o.themeMode],{audience:d,context:e}=o.globalAi,m=e.selectedObject,s=I("global-rail"),[a,c]=x.useState(!1),u=(t,n,p)=>{i(p?{type:"OPEN_APP_DRAFT",draftId:p,appId:t,dashboardId:n}:{type:"OPEN_APP",appId:t,dashboardId:n,experience:"view",section:"dashboards"}),i({type:"CLOSE_GLOBAL_AI"}),b.listApps().then(A=>i({type:"SET_APPS",apps:A})).catch(()=>{})};return l.jsx(P,{t:r,title:e.title??"AI copilot",subtitle:e.scopeHint??"Ask a follow-up about what you are viewing",expanded:a,onToggleExpanded:()=>c(t=>!t),resizable:!0,minResizeWidth:360,maxResizeWidth:1200,onClose:()=>i({type:"CLOSE_GLOBAL_AI"}),ariaLabel:"App AI",style:{position:"relative",width:a?`min(${_}px, calc(100vw - 96px))`:`min(${w}px, calc(100vw - 64px))`,maxWidth:a?"62vw":"46vw",minWidth:320,flex:"0 0 auto"},children:l.jsx(E,{themeMode:o.themeMode,title:e.title??"AI copilot",scopeHint:e.scopeHint??"Ask a follow-up about what you are viewing",audience:d,selectedObject:m,workspaceContext:e.workspaceContext,examplePrompts:Array.isArray(e.suggestedQuestions)&&e.suggestedQuestions.length>0?e.suggestedQuestions.filter(t=>typeof t=="string").slice(0,4).map(t=>({label:t,prompt:t})):void 0,autoRun:o.globalAi.autoRun?{text:o.globalAi.autoRun.text,mode:o.globalAi.autoRun.mode,nonce:o.globalAi.autoRun.nonce}:void 0,threadId:s.threadId,onThreadIdChange:s.onThreadIdChange,initialMode:"auto",onOpenApp:u})})}export{M as GlobalAiRail};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as ke,u as ge,t as he,r as a,a as B,j as e,a4 as K,a0 as fe,L,S as Y,P as se,B as we,d as ye,T as re,N as de,l as Ce,aK as me,f as ze}from"./index-DJRMz64S.js";import{T as Be}from"./triangle-alert-COWnsSdh.js";import{U as ce,G as be}from"./user-round-Bfu7fosn.js";import{C as je}from"./UnifiedAgentRunPanel-IxDUKSG8.js";import{P as Te}from"./usePersistedAgentThreadId-DYdx896E.js";import{X as ve}from"./x-B4coLiOl.js";import{S as We}from"./SkillsPage-BgYrgirJ.js";import"./react-CRB3T2We.js";import"./AiBuildResult-Cob_Lj05.js";import"./rotate-ccw-D_9U9o7X.js";import"./list-tree-Dw0qlxPK.js";import"./wrench-CvfM03KZ.js";import"./minimize-2-DUiSrPS3.js";import"./arrow-right-TH8_ufKG.js";import"./TrustBadge-Bob1Laiq.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 Ie=[["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"}]],De=ke("tags",Ie),U="dql-context-bootstrap-session",J="dql-context-bootstrap-selection";function Re(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function pe(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function Ee(){return{id:"",name:"",owner:"",boundedContext:"",sourceSystems:[],description:""}}function $e({embedded:t=!1}={}){const{state:i,dispatch:r}=ge(),n=he[i.themeMode],[o,c]=a.useState([]),[h,s]=a.useState(!0),[y,T]=a.useState(null),[z,b]=a.useState(null),[v,S]=a.useState(null),[p,d]=a.useState(!1),[w,C]=a.useState(null),[g,E]=a.useState(null),[u,W]=a.useState(!1),[I,M]=a.useState(!1),[P,D]=a.useState(null),[x,A]=a.useState([]),$=a.useCallback(()=>{let l=!1;return s(!0),T(null),B.getDomains().then(f=>{if(l)return;const m=Array.isArray(f==null?void 0:f.domains)?f.domains:[];c(m),r({type:"SET_AUTHORED_DOMAINS",domains:m})}).catch(f=>{l||(c([]),T(f instanceof Error&&f.message?f.message:"Could not load domains. Is the local DQL server running?"))}).finally(()=>{l||s(!1)}),()=>{l=!0}},[r]);a.useEffect(()=>$(),[$]),a.useEffect(()=>{const l=window.sessionStorage.getItem(U);let f=!1;const m=j=>{if(j&&!f){E(j);try{const O=JSON.parse(window.sessionStorage.getItem(J)??"[]");A(Array.isArray(O)?O.filter(G=>typeof G=="string"):j.candidates.filter(G=>G.action!=="unchanged").map(G=>G.id))}catch{A(j.candidates.filter(O=>O.action!=="unchanged").map(O=>O.id))}}};return(l?B.getContextBootstrap(l):B.getLatestContextBootstrap()).then(m).catch(async()=>{window.sessionStorage.removeItem(U),window.sessionStorage.removeItem(J),l&&m(await B.getLatestContextBootstrap().catch(()=>null))}),()=>{f=!0}},[]),a.useEffect(()=>{g&&(window.sessionStorage.setItem(U,g.id),window.sessionStorage.setItem(J,JSON.stringify(x)))},[g==null?void 0:g.id,x]);const q=a.useMemo(()=>[...o].sort((l,f)=>l.name.localeCompare(f.name)),[o]),Q=a.useCallback(l=>{c(f=>{const m=f.findIndex(j=>j.id===l.id),k=m===-1?[...f,l]:[...f];return m!==-1&&(k[m]=l),r({type:"SET_AUTHORED_DOMAINS",domains:k}),k}),b(null)},[r]),V=a.useCallback(async()=>{if(v){d(!0),C(null);try{await B.deleteDomain(v.id),c(l=>{const f=l.filter(m=>m.id!==v.id);return r({type:"SET_AUTHORED_DOMAINS",domains:f}),f}),S(null)}catch(l){C(l instanceof Error&&l.message?l.message:"Could not delete this domain.")}finally{d(!1)}}},[r,v]),_=a.useCallback(async()=>{W(!0),D(null);try{const l=await B.startContextBootstrap({ai:!0});E(l);const f=l.candidates.filter(m=>m.action!=="unchanged").map(m=>m.id);A(f),window.sessionStorage.setItem(U,l.id),window.sessionStorage.setItem(J,JSON.stringify(f))}catch(l){D(l instanceof Error?l.message:"Could not draft repository context.")}finally{W(!1)}},[]);a.useEffect(()=>{if(!t)return;const l=()=>{_()};return window.addEventListener("dql:context-build",l),()=>window.removeEventListener("dql:context-build",l)},[t,_]),a.useEffect(()=>{if(!g||["ready","needs_attention"].includes(g.status))return;let l=!1;const f=async()=>{try{const k=await B.getContextBootstrap(g.id);l||E(k)}catch(k){l||D(k instanceof Error?k.message:"Could not update AI draft progress.")}};f();const m=window.setInterval(()=>void f(),750);return()=>{l=!0,window.clearInterval(m)}},[g==null?void 0:g.id,g==null?void 0:g.status]);const X=a.useCallback(async()=>{if(!(!g||x.length===0)){M(!0),D(null);try{await B.saveContextBootstrapSelected(g.id,x),E(null),A([]),window.sessionStorage.removeItem(U),window.sessionStorage.removeItem(J),$()}catch(l){D(l instanceof Error?l.message:"Could not save selected drafts.")}finally{M(!1)}}},[g,x,$]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:n.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(K,{size:20,strokeWidth:1.9,color:n.accent}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:n.textPrimary},children:"Domains"})]}),e.jsx("div",{style:{fontSize:13,color:n.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:"Domains are the top of your business model — each one owns the terms, skills, and blocks beneath it. Name the business area, who owns it, the bounded context, and the source systems it draws from."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>$(),title:"Refresh",style:F(n),children:[e.jsx(fe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void _(),disabled:u,style:F(n),children:[u?e.jsx(L,{size:13,strokeWidth:2}):e.jsx(Y,{size:13,strokeWidth:2})," Draft with AI"]}),e.jsxs("button",{type:"button",onClick:()=>b({kind:"create"}),style:te(n),children:[e.jsx(se,{size:14,strokeWidth:2.2})," Add domain"]})]})]}),h?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:n.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(L,{size:15,strokeWidth:2})," Loading domains…"]}):y?e.jsx(Oe,{t:n,message:y,onRetry:()=>$()}):q.length===0?e.jsx(Ae,{t:n,onAdd:()=>b({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:q.map(l=>e.jsx(Me,{domain:l,t:n,onEdit:()=>b({kind:"edit",domain:l}),onDelete:()=>{C(null),S(l)}},l.id))}),P?e.jsx("div",{style:{marginTop:12},children:e.jsx(ee,{t:n,tone:"error",children:P})}):null,g?e.jsxs("section",{style:{marginTop:18,border:`1px solid ${n.cellBorder}`,borderRadius:10,background:n.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:n.textPrimary},children:"Repository-guided AI draft"}),e.jsx("div",{style:{fontSize:12,color:n.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:I||x.length===0||!["ready","needs_attention"].includes(g.status),onClick:()=>void X(),style:{...te(n),opacity:I||x.length===0||!["ready","needs_attention"].includes(g.status)?.55:1},children:[I?e.jsx(L,{size:13,strokeWidth:2}):e.jsx(se,{size:13,strokeWidth:2})," Save selected drafts"]})]}),e.jsx(Ne,{t:n,session:g}),e.jsx("div",{style:{display:"grid",gap:9,marginTop:12},children:g.candidates.map(l=>{const f=l.action!=="unchanged",m=x.includes(l.id);return e.jsx(Le,{candidate:l,selected:m,selectable:f,disabled:I,t:n,onToggle:()=>A(k=>m?k.filter(j=>j!==l.id):[...k,l.id])},l.id)})})]}):null]}),z?e.jsx(Pe,{mode:z,existingIds:o.map(l=>l.id),domains:o,t:n,onClose:()=>b(null),onSaved:Q}):null,v?e.jsx(He,{domain:v,t:n,deleting:p,error:w,onCancel:()=>{p||S(null)},onConfirm:V}):null]})}function Me({domain:t,t:i,onEdit:r,onDelete:n}){const o=t.sourceSystems??[],[c,h]=a.useState(!1);return e.jsxs("section",{style:{border:`1px solid ${i.cellBorder}`,borderRadius:10,background:i.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:i.textPrimary},children:t.name}),t.parent?e.jsxs("span",{style:le(i),children:["↳ ",t.parent]}):null,t.owner?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,color:i.textMuted},children:[e.jsx(ce,{size:11,strokeWidth:2})," ",t.owner]}):null,t.businessOwner?e.jsxs("span",{style:le(i),children:[e.jsx(ce,{size:10,strokeWidth:2.2})," Business owner: ",t.businessOwner]}):null]}),t.description?e.jsx("div",{style:{fontSize:12.5,color:i.textSecondary,marginTop:5,lineHeight:1.5},children:t.description}):e.jsx("div",{style:{fontSize:12,color:i.textMuted,marginTop:5,fontStyle:"italic"},children:"No description yet."}),o.length>0?e.jsx("div",{style:{display:"flex",gap:5,marginTop:9,flexWrap:"wrap"},children:o.map(s=>e.jsx("span",{style:ae(i),children:s},s))}):null,e.jsxs("div",{style:{display:"flex",gap:7,marginTop:9,flexWrap:"wrap"},children:[e.jsx(ie,{t:i,icon:e.jsx(we,{size:11,strokeWidth:2}),label:"blocks",count:t.blockCount??0}),e.jsx(ie,{t:i,icon:e.jsx(be,{size:11,strokeWidth:2}),label:"skills",count:t.skillCount??0}),e.jsx(ie,{t:i,icon:e.jsx(De,{size:11,strokeWidth:2}),label:"terms",count:t.termCount??0})]}),c?e.jsxs("div",{style:{display:"grid",gap:9,marginTop:12,paddingTop:11,borderTop:`1px solid ${i.btnBorder}`},children:[t.boundedContext?e.jsx(ue,{t:i,label:"Business boundary",children:t.boundedContext}):null,t.businessOutcome?e.jsx(ue,{t:i,label:"Decision outcome",children:t.businessOutcome}):null,e.jsx(Z,{t:i,label:"In scope",values:t.inScope,empty:"Not defined yet"}),e.jsx(Z,{t:i,label:"Out of scope",values:t.outOfScope,empty:"Not defined yet"}),e.jsx(Z,{t:i,label:"Primary terms",values:t.primaryTerms,empty:"No terms linked yet"}),e.jsx(Z,{t:i,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:()=>h(s=>!s),style:{...F(i),padding:"5px 7px",fontSize:11.5},title:c?"Hide domain details":"Show domain details",children:[c?e.jsx(je,{size:13}):e.jsx(ye,{size:13}),c?"Less":"Details"]}),e.jsx("button",{type:"button",onClick:r,style:oe(i),title:"Edit domain",children:e.jsx(Te,{size:13,strokeWidth:2})}),e.jsx("button",{type:"button",onClick:n,style:oe(i),title:"Delete domain",children:e.jsx(re,{size:13,strokeWidth:2})})]})]})}function Pe({mode:t,existingIds:i,domains:r,t:n,onClose:o,onSaved:c}){const h=t.kind==="edit",[s,y]=a.useState(()=>t.kind==="edit"?{...t.domain}:Ee()),[T,z]=a.useState(h),[b,v]=a.useState(!1),[S,p]=a.useState(null),d=a.useCallback((u,W)=>{y(I=>({...I,[u]:W}))},[]),w=u=>{y(W=>({...W,name:u,...!h&&!T?{id:pe(u)}:{}}))},C=!h&&s.id.length>0&&i.includes(s.id),g=s.id.trim().length>0&&s.name.trim().length>0&&!C&&!b,E=a.useCallback(async()=>{var W,I,M,P,D;const u={...s,id:s.id.trim(),name:s.name.trim(),owner:(W=s.owner)!=null&&W.trim()?s.owner.trim():void 0,businessOwner:(I=s.businessOwner)!=null&&I.trim()?s.businessOwner.trim():void 0,parent:(M=s.parent)!=null&&M.trim()?s.parent.trim():void 0,boundedContext:(P=s.boundedContext)!=null&&P.trim()?s.boundedContext.trim():void 0,description:(D=s.description)!=null&&D.trim()?s.description.trim():void 0,sourceSystems:(s.sourceSystems??[]).map(x=>x.trim()).filter(Boolean),primaryTerms:(s.primaryTerms??[]).map(x=>x.trim()).filter(Boolean),tags:(s.tags??[]).map(x=>x.trim()).filter(Boolean),inScope:(s.inScope??[]).map(x=>x.trim()).filter(Boolean),outOfScope:(s.outOfScope??[]).map(x=>x.trim()).filter(Boolean),dbtGroups:(s.dbtGroups??[]).map(x=>x.trim()).filter(Boolean),dbtPaths:(s.dbtPaths??[]).map(x=>x.trim()).filter(Boolean),dbtTags:(s.dbtTags??[]).map(x=>x.trim()).filter(Boolean),semanticDomains:(s.semanticDomains??[]).map(x=>x.trim()).filter(Boolean),semanticTags:(s.semanticTags??[]).map(x=>x.trim()).filter(Boolean)};v(!0),p(null);try{const x=h?await B.updateDomain(u.id,u):await B.createDomain(u);c(x.domain??u)}catch(x){p(x instanceof Error&&x.message?x.message:"Could not save this domain. Try again.")}finally{v(!1)}},[s,h,c]);return e.jsx("div",{style:Ge,onClick:()=>!b&&o(),children:e.jsxs("div",{style:Ue(n),onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{style:Je(n),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(K,{size:16,strokeWidth:2,color:n.accent}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:n.textPrimary},children:h?"Edit domain":"New domain"})]}),e.jsx("button",{type:"button",onClick:()=>!b&&o(),style:oe(n),title:"Close",children:e.jsx(ve,{size:15,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"16px 18px",display:"grid",gap:16},children:[e.jsx(R,{label:"Name",t:n,hint:h?void 0:"A short, human label for this business area.",children:e.jsx("input",{type:"text",value:s.name,onChange:u=>w(u.target.value),placeholder:"Revenue",style:N(n)})}),e.jsxs(R,{label:"ID (slug)",t:n,hint:"Used as the on-disk identifier. Letters, numbers, and dashes.",children:[e.jsx("input",{type:"text",value:s.id,disabled:h,onChange:u=>{z(!0),d("id",Re(u.target.value))},onBlur:()=>d("id",pe(s.id)),placeholder:"revenue",style:{...N(n),fontFamily:n.fontMono,opacity:h?.7:1}}),C?e.jsx(ee,{t:n,tone:"error",children:"A domain with this id already exists."}):null]}),e.jsx(R,{label:"Parent domain",t:n,hint:"Optional. Depth becomes Domain, Subdomain, Microdomain, and beyond.",children:e.jsxs("select",{value:s.parent??"",onChange:u=>d("parent",u.target.value||void 0),style:N(n),children:[e.jsx("option",{value:"",children:"Top-level domain"}),r.filter(u=>u.id!==s.id).map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))]})}),e.jsx(R,{label:"Owner",t:n,hint:"The team or person accountable for this domain.",children:e.jsx("input",{type:"text",value:s.owner??"",onChange:u=>d("owner",u.target.value),placeholder:"finance-analytics",style:N(n)})}),e.jsx(R,{label:"Business owner",t:n,hint:"The stakeholder accountable for business use and definitions.",children:e.jsx("input",{type:"text",value:s.businessOwner??"",onChange:u=>d("businessOwner",u.target.value),placeholder:"Revenue Operations",style:N(n)})}),e.jsx(R,{label:"Bounded context",t:n,hint:"The conceptual boundary this domain owns, e.g. 'recognized revenue and invoicing'.",children:e.jsx("input",{type:"text",value:s.boundedContext??"",onChange:u=>d("boundedContext",u.target.value),placeholder:"Recognized revenue and invoicing",style:N(n)})}),e.jsx(R,{label:"Source systems",t:n,hint:"The upstream systems this domain draws from — type a name and press Enter.",children:e.jsx(ne,{t:n,values:s.sourceSystems??[],onChange:u=>d("sourceSystems",u),placeholder:"Add a source system…"})}),e.jsx(R,{label:"Primary terms",t:n,hint:"Business concepts the agent should use to recognize this domain.",children:e.jsx(ne,{t:n,values:s.primaryTerms??[],onChange:u=>d("primaryTerms",u),placeholder:"Add a term…"})}),e.jsx(R,{label:"Scope tags",t:n,hint:"Short labels used for routing and discovery.",children:e.jsx(ne,{t:n,values:s.tags??[],onChange:u=>d("tags",u),placeholder:"Add a tag…"})}),e.jsx(R,{label:"Description",t:n,hint:"What this domain covers and how it's used.",children:e.jsx("textarea",{value:s.description??"",onChange:u=>d("description",u.target.value),rows:5,placeholder:"All recognized-revenue metrics and the blocks that report them, sourced from the billing warehouse.",style:_e(n)})}),S?e.jsx(ee,{t:n,tone:"error",children:S}):null]}),e.jsxs("div",{style:Ye(n),children:[e.jsx("button",{type:"button",onClick:()=>!b&&o(),style:F(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:E,disabled:!g,style:{...te(n),opacity:g?1:.55},children:[b?e.jsx(L,{size:13,strokeWidth:2}):null,b?"Saving…":h?"Save changes":"Create domain"]})]})]})})}function ne({t,values:i,onChange:r,placeholder:n}){const[o,c]=a.useState(""),h=s=>{const y=s.trim();!y||i.includes(y)||(r([...i,y]),c(""))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[i.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:i.map(s=>e.jsxs("span",{style:Ke(t),children:[s,e.jsx("button",{type:"button",onClick:()=>r(i.filter(y=>y!==s)),style:qe(t),title:"Remove",children:e.jsx(ve,{size:11,strokeWidth:2.4})})]},s))}):null,e.jsx("input",{type:"text",value:o,onChange:s=>c(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),h(o))},placeholder:n,style:N(t)})]})}function Ae({t,onAdd:i}){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(K,{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:i,style:{...te(t),marginTop:4},children:[e.jsx(se,{size:14,strokeWidth:2.2})," Add your first domain"]})]})}function Oe({t,message:i,onRetry:r}){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(Be,{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:i}),e.jsxs("button",{type:"button",onClick:r,style:{...F(t),marginTop:10},children:[e.jsx(fe,{size:13,strokeWidth:2})," Retry"]})]})]})}function Ne({t,session:i}){var o;const r=!["ready","needs_attention"].includes(i.status),n=i.ai.mode==="evidence_only"?"Evidence-only":i.ai.provider?`${i.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:[r?e.jsx(L,{size:14,strokeWidth:2,color:t.accent}):e.jsx(Y,{size:14,strokeWidth:2,color:t.accent}),e.jsx("strong",{style:{color:t.textPrimary,textTransform:"capitalize"},children:i.status.replace("_"," ")}),e.jsx("span",{children:n}),e.jsxs("span",{children:[i.progress.domains.ready,"/",i.progress.domains.total," domains"]}),e.jsxs("span",{children:[i.progress.skills.ready,"/",i.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,i.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:i.progress.message}),(o=i.warnings)!=null&&o.length?e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.warning,lineHeight:1.45},children:i.warnings.slice(-2).join(" ")}):null]})}function Le({candidate:t,selected:i,selectable:r,disabled:n,t:o,onToggle:c}){var v,S,p,d,w,C,g,E,u,W,I,M,P,D,x,A,$,q,Q,V,_,X,l,f,m,k;const[h,s]=a.useState(!1),y=t.kind==="domain",T=((v=t.domain)==null?void 0:v.name)??((S=t.skill)==null?void 0:S.id)??t.id.replace(/^(domain|skill):/,""),z=y?((p=t.domain)==null?void 0:p.description)??((d=t.domain)==null?void 0:d.boundedContext):((w=t.skill)==null?void 0:w.description)??((g=(C=t.skill)==null?void 0:C.body)==null?void 0:g.split(`
|
|
7
|
+
`).find(Boolean)),b=y?[["Business outcome",(E=t.domain)==null?void 0:E.businessOutcome],["In scope",(W=(u=t.domain)==null?void 0:u.inScope)==null?void 0:W.join(" · ")],["Out of scope",(M=(I=t.domain)==null?void 0:I.outOfScope)==null?void 0:M.join(" · ")],["Primary terms",(D=(P=t.domain)==null?void 0:P.primaryTerms)==null?void 0:D.join(" · ")]]:[["Applies when",(A=(x=t.skill)==null?void 0:x.triggers)==null?void 0:A.join(" · ")],["Ask first when",(q=($=t.skill)==null?void 0:$.clarifyWhen)==null?void 0:q.join(" · ")],["Avoid when",(V=(Q=t.skill)==null?void 0:Q.exclusions)==null?void 0:V.join(" · ")],["Preferred metrics",(X=(_=t.skill)==null?void 0:_.preferredMetrics)==null?void 0:X.join(" · ")],["Preferred blocks",(f=(l=t.skill)==null?void 0:l.preferredBlocks)==null?void 0:f.join(" · ")]];return e.jsx("article",{style:{border:`1px solid ${i?`${o.accent}66`:o.btnBorder}`,background:i?`${o.accent}08`:o.appBg,borderRadius:8,padding:"10px 11px",opacity:r?1:.72},children:e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("input",{"aria-label":`Select ${y?"domain":"skill"} ${T}`,type:"checkbox",disabled:!r||n,checked:i,onChange:c,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:o.textPrimary,fontSize:12.5},children:[y?"Domain":"Skill"," · ",T]}),e.jsx("span",{style:le(o),children:t.action.replace("_"," ")}),e.jsxs("span",{style:{fontSize:11,color:o.textMuted},children:[Math.round(t.confidence*100),"% evidence confidence"]})]}),z?e.jsx("p",{style:{marginTop:5,color:o.textSecondary,fontSize:12,lineHeight:1.45},children:z}):e.jsx("p",{style:{marginTop:5,color:o.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(j=>e.jsx("span",{style:ae(o),children:j},j))}),h?e.jsxs("div",{style:{marginTop:9,display:"grid",gap:6,borderTop:`1px solid ${o.btnBorder}`,paddingTop:9},children:[b.filter(([,j])=>!!j).map(([j,O])=>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:o.textMuted},children:j}),e.jsx("span",{style:{color:o.textSecondary},children:O})]},j)),!y&&((m=t.skill)!=null&&m.body)?e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontFamily:o.font,fontSize:11.5,color:o.textSecondary,background:o.cellBg,padding:9,borderRadius:6,maxHeight:180,overflow:"auto"},children:t.skill.body}):null,(k=t.notes)!=null&&k.length?e.jsx("div",{style:{fontSize:11.5,color:o.accent},children:t.notes.join(" ")}):null]}):null]}),e.jsxs("button",{type:"button",onClick:()=>s(j=>!j),style:{...F(o),padding:"4px 6px",fontSize:11.5},"aria-expanded":h,children:[h?e.jsx(je,{size:13}):e.jsx(ye,{size:13}),h?"Less":"Review"]})]})})}function He({domain:t,t:i,deleting:r,error:n,onCancel:o,onConfirm:c}){return e.jsx("div",{style:Qe,onClick:o,children:e.jsxs("div",{style:Ve(i),onClick:h=>h.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(re,{size:16,strokeWidth:2,color:i.error}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:i.textPrimary},children:"Delete this domain?"})]}),e.jsxs("div",{style:{fontSize:13,color:i.textSecondary,lineHeight:1.55},children:[e.jsx("span",{style:{fontWeight:700,color:i.textPrimary},children:t.name})," will be removed. Blocks, skills, and terms that referenced it will become unassigned. This can't be undone."]}),n?e.jsx(ee,{t:i,tone:"error",children:n}):null,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:o,disabled:r,style:F(i),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:c,disabled:r,style:{...Fe(i),opacity:r?.6:1},children:[r?e.jsx(L,{size:13,strokeWidth:2}):e.jsx(re,{size:13,strokeWidth:2}),r?"Deleting…":"Delete"]})]})]})})}function ie({t,icon:i,label:r,count:n}){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11,fontWeight:600,color:n>0?t.textSecondary:t.textMuted,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px"},children:[i,n," ",r]})}function ue({t,label:i,children:r}){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:i}),e.jsx("span",{style:{color:t.textSecondary},children:r})]})}function Z({t,label:i,values:r,empty:n}){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:i}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:r!=null&&r.length?r.map(o=>e.jsx("span",{style:ae(t),children:o},o)):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:n})})]})}function R({label:t,hint:i,t:r,children:n}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:r.textPrimary},children:t}),i?e.jsx("div",{style:{fontSize:11.5,color:r.textMuted,lineHeight:1.45,marginTop:-2},children:i}):null,n]})}function ee({t,tone:i,children:r}){const n=i==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:n,lineHeight:1.45},children:r})}function te(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 F(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 Fe(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 oe(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 N(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 _e(t){return{...N(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function le(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 ae(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 Ke(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 qe(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:t.textMuted,cursor:"pointer",padding:2,borderRadius:4}}const Ge={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",justifyContent:"flex-end",zIndex:60};function Ue(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 Je(t){return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:`1px solid ${t.headerBorder}`,flexShrink:0}}function Ye(t){return{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"13px 18px",borderTop:`1px solid ${t.headerBorder}`,flexShrink:0}}const Qe={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function Ve(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 ht({initialTab:t="overview"}){const{state:i}=ge(),r=he[i.themeMode],[n,o]=a.useState(t),[c,h]=a.useState([]),[s,y]=a.useState([]),[T,z]=a.useState(!0);a.useEffect(()=>o(t),[t]);const b=a.useCallback(()=>{let d=!1;return z(!0),Promise.all([B.getDomains(),B.getSkills()]).then(([w,C])=>{d||(h(Array.isArray(w.domains)?w.domains:[]),y(Array.isArray(C.skills)?C.skills:[]))}).catch(()=>{d||(h([]),y([]))}).finally(()=>{d||z(!1)}),()=>{d=!0}},[]);a.useEffect(()=>b(),[b]);const v=a.useMemo(()=>{const d=c.filter(g=>!!(g.businessOwner||g.owner)).length,w=s.filter(g=>!g.status||g.status==="active").length,C=s.filter(g=>g.status==="draft").length;return{ownedDomains:d,activeSkills:w,draftSkills:C}},[c,s]),S=a.useCallback(()=>{o("domains"),window.setTimeout(()=>window.dispatchEvent(new Event("dql:context-build")),50)},[]),p=[{id:"overview",label:"Overview"},{id:"domains",label:"Domains",count:c.length},{id:"skills",label:"Skills",count:s.length},{id:"knowledge",label:"Knowledge 360"}];return e.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto",background:r.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(K,{size:20,color:r.accent}),e.jsx("h1",{style:{fontSize:22,color:r.textPrimary},children:"Governed context"})]}),e.jsx("p",{style:{marginTop:6,fontSize:13,lineHeight:1.5,color:r.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:S,style:Se(r),children:[e.jsx(Y,{size:14})," Build with AI"]})]}),e.jsx("nav",{"aria-label":"Governed context sections",style:{display:"flex",gap:3,borderBottom:`1px solid ${r.headerBorder}`,marginBottom:18},children:p.map(d=>e.jsxs("button",{type:"button",onClick:()=>o(d.id),style:{border:"none",borderBottom:`2px solid ${n===d.id?r.accent:"transparent"}`,background:"transparent",padding:"9px 12px",color:n===d.id?r.textPrimary:r.textMuted,fontWeight:n===d.id?700:600,cursor:"pointer",fontFamily:r.font,fontSize:12.5},children:[d.label,d.count!==void 0?` · ${d.count}`:""]},d.id))}),n==="overview"?e.jsx(Ze,{t:r,loading:T,domains:c,skills:s,status:v,onBuild:S,onTab:o}):null,n==="domains"?e.jsx($e,{embedded:!0}):null,n==="skills"?e.jsx(We,{embedded:!0}):null,n==="knowledge"?e.jsx(Xe,{t:r,domains:c}):null]})})}function Xe({t,domains:i,initialDomainId:r}){var v,S;const[n,o]=a.useState(r??((v=i[0])==null?void 0:v.id)??""),[c,h]=a.useState(null),[s,y]=a.useState(!1),[T,z]=a.useState(null);a.useEffect(()=>{var p;!n&&((p=i[0])!=null&&p.id)&&o(i[0].id)},[n,i]),a.useEffect(()=>{r&&i.some(p=>p.id===r)&&o(r)},[i,r]),a.useEffect(()=>{if(!n){h(null);return}let p=!1;return y(!0),z(null),B.getDomainKnowledge(n).then(d=>{p||h(d)}).catch(d=>{p||(h(null),z(d instanceof Error?d.message:"Could not load the compiled knowledge capsule."))}).finally(()=>{p||y(!1)}),()=>{p=!0}},[n]);const b=a.useMemo(()=>{const p={};for(const d of(c==null?void 0:c.objects)??[])p[d.kind]=(p[d.kind]??0)+1;return Object.entries(p).sort((d,w)=>w[1]-d[1]||d[0].localeCompare(w[0]))},[c]);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(de,{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:n,onChange:p=>o(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"}),[...i].sort((p,d)=>p.name.localeCompare(d.name)).map(p=>e.jsx("option",{value:p.id,children:p.name},p.id))]})]})}),s?e.jsxs("div",{style:{color:t.textMuted,display:"flex",gap:8,alignItems:"center",padding:24},children:[e.jsx(L,{size:15})," Loading compiled knowledge…"]}):null,T?e.jsx("div",{style:{border:`1px solid ${t.error}`,background:t.cellBg,color:t.error,borderRadius:8,padding:12,fontSize:12.5},children:T}):null,c?e.jsxs(e.Fragment,{children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:9},children:[e.jsx(H,{t,label:"Objects",value:c.counts.objects,detail:"qualified knowledge",icon:e.jsx(K,{size:16})}),e.jsx(H,{t,label:"Relations",value:c.counts.edges,detail:"provenance + policy",icon:e.jsx(de,{size:16})}),e.jsx(H,{t,label:"Authorized",value:c.counts.routeStates.authorized??0,detail:"safe cross-domain routes",icon:e.jsx(Ce,{size:16})}),e.jsx(H,{t,label:"Blocked / stale",value:(c.counts.routeStates.blocked??0)+(c.counts.routeStates.stale??0),detail:"never auto-joined",icon:e.jsx(me,{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:((S=c.capsule)==null?void 0:S.description)||"Compiled domain boundary and governed references."}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:b.map(([p,d])=>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," ")," · ",d]},p))}),e.jsxs("div",{style:{marginTop:11,color:t.textMuted,fontSize:11},children:["Snapshot ",c.snapshotId.slice(0,12)," · graph ",c.sourceFingerprint.slice(0,12),c.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:c.routes.length?c.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 Ze({t,loading:i,domains:r,skills:n,status:o,onBuild:c,onTab:h}){if(i)return e.jsxs("div",{style:{padding:"42px 0",color:t.textMuted,display:"flex",gap:8,alignItems:"center",fontSize:13},children:[e.jsx(L,{size:15})," Loading governed context…"]});const s=[];return r.length?o.ownedDomains<r.length&&s.push(`${r.length-o.ownedDomains} domain${r.length-o.ownedDomains===1?"":"s"} still need an owner.`):s.push("Create a business domain before relying on AI guidance."),n.length||s.push("Draft a domain skill so the agent has governed business guidance."),o.draftSkills&&s.push(`${o.draftSkills} skill${o.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(H,{t,label:"Domains",value:r.length,detail:`${o.ownedDomains} with an owner`,icon:e.jsx(K,{size:17})}),e.jsx(H,{t,label:"Active skills",value:o.activeSkills,detail:"available to the agent",icon:e.jsx(be,{size:17})}),e.jsx(H,{t,label:"Draft skills",value:o.draftSkills,detail:"review before activation",icon:e.jsx(Y,{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(ze,{size:16,color:s.length?t.warning:t.success}),e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Readiness"})]}),s.length?e.jsx("div",{style:{display:"grid",gap:6},children:s.map(y=>e.jsxs("div",{style:{display:"flex",gap:7,color:t.textSecondary,fontSize:12.5},children:[e.jsx(me,{size:14,color:t.warning}),y]},y))}):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:c,style:Se(t),children:[e.jsx(Y,{size:13})," Build domains & skills with AI"]}),e.jsx("button",{type:"button",onClick:()=>h("domains"),style:xe(t),children:"Manage domains"}),e.jsx("button",{type:"button",onClick:()=>h("skills"),style:xe(t),children:"Manage skills"})]})]})]})}function H({t,label:i,value:r,detail:n,icon:o}){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:[i,o]}),e.jsx("div",{style:{color:t.textPrimary,fontSize:25,fontWeight:750,marginTop:7},children:r}),e.jsx("div",{style:{color:t.textMuted,fontSize:11.5,marginTop:3},children:n})]})}function Se(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 xe(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"}}export{ht as GovernedContextPage,Xe as Knowledge360};
|
package/dist/assets/dql-notebook/assets/{HelpDocsPage-DMHPsVqP.js → HelpDocsPage-C1UeP85v.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as k,u as z,t as R,r as u,j as e,
|
|
1
|
+
import{c as k,u as z,t as R,r as u,j as e,aE as I}from"./index-DJRMz64S.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ot,r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as rt,b as Je,d as st,e as at,L as lt,f as dt,G as Ne,D as be,N as ct,g as pt}from"./index-
|
|
1
|
+
import{c as ot,r as c,a as q,j as e,u as Be,t as Ye,S as Ie,B as ue,C as rt,b as Je,d as st,e as at,L as lt,f as dt,G as Ne,D as be,N as ct,g as pt}from"./index-DJRMz64S.js";import{T as xt}from"./TrustBadge-Bob1Laiq.js";import{A as he}from"./arrow-right-TH8_ufKG.js";import{T as Ke}from"./triangle-alert-COWnsSdh.js";import{B as Ee}from"./book-open-text-B-dcHHn0.js";import{W as ut}from"./workflow-B1_pj9gq.js";import"./react-CRB3T2We.js";/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as Se,i as je,k as Ce,t as Re,r as a,aw as O,a as pe,ax as Ee,ay as Le,az as Te,aA as Be,j as e,p as E,au as H,aB as Ie,l as ge}from"./index-Cpx47jCH.js";import{u as ze,a as We,M as Me,i as Fe,B as Ne,C as Pe,b as Oe,P as De,T as he,c as P,H as xe}from"./dagre.esm-DlZi7NR3.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Ee},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Le},{key:"end-to-end",label:"End-to-end",title:"Complete path from physical sources through governed meaning to consumption",types:O}],Y=[{type:"block",label:"Blocks"},{type:"app",label:"Apps"},{type:"notebook",label:"Notebooks"},{type:"dashboard",label:"Dashboards"}];function $e(n,h,o="flow",g="LR"){var v;const p=new he.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b=g==="LR";p.setGraph({rankdir:g,ranksep:o==="layered"?120:b?80:60,nodesep:b?40:50,marginx:32,marginy:32});for(const d of n){const y={width:190,height:58};if(o==="layered"&&((v=d.data)!=null&&v.layer)){const x=Ie.indexOf(d.data.layer);x>=0&&(y.rank=x)}p.setNode(d.id,y)}for(const d of h)p.setEdge(d.source,d.target);return he.layout(p),n.map(d=>{const y=p.node(d.id);return{...d,position:{x:y.x-95,y:y.y-29},data:{...d.data,direction:g}}})}function _e({data:n,selected:h}){const o=n.nodeType,g=E[o]??"var(--color-text-tertiary)",p=n.direction??"LR",b=p==="LR"?P.Left:P.Top,v=p==="LR"?P.Right:P.Bottom,d=!!n.dimmed,y=n.status==="certified";return e.jsxs("div",{style:{width:196,display:"flex",alignItems:"center",gap:8,background:"var(--color-bg-card)",border:`1.5px solid ${h?"var(--accent)":"var(--border-default)"}`,borderRadius:9,padding:"9px 11px",boxShadow:h?"0 1px 6px rgba(107,93,211,0.16)":"0 1px 4px rgba(26,26,26,0.05)",opacity:d?.3:1,transition:"opacity 0.15s ease"},children:[e.jsx(xe,{type:"target",position:b,style:{width:7,height:7,background:g,border:"none"}}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:g,flexShrink:0}}),e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{title:n.label,style:{fontSize:11.5,fontWeight:650,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:g},children:H[o]??o})]}),y?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null,e.jsx(xe,{type:"source",position:v,style:{width:7,height:7,background:g,border:"none"}})]})}const Ae={dagNode:_e};function Qe(){var ae,le,de;const n=Se(je(t=>({lineageFocusNodeId:t.lineageFocusNodeId,themeMode:t.themeMode}))),h=Ce(),o=Re[n.themeMode],[g,p]=a.useState(!0),[b,v]=a.useState({nodes:[],edges:[]}),[d,y]=a.useState({nodes:[],edges:[]}),[x,w]=a.useState(null),[c,L]=a.useState(null),[W,T]=a.useState(!1),[l,s]=a.useState(null),[f,j]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,M]=a.useState(null),[D,F]=a.useState(!1),[V,q]=a.useState("block"),[U,K]=a.useState(""),[X,N]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=ze([]),[be,oe,me]=We([]),re=a.useCallback(async()=>{p(!0);try{const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]})}finally{p(!1)}},[]);a.useEffect(()=>{re()},[re]);const R=a.useMemo(()=>b.nodes.filter(t=>Y.some(r=>r.type===t.type)).sort((t,r)=>t.name.localeCompare(r.name)),[b.nodes]),I=a.useCallback(async t=>{L(t),F(!1),M(null),s(null),T(!0);try{const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null)}finally{T(!1)}},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),M(null),F(!1),h({type:"SET_LINEAGE_FOCUS",nodeId:null})},[h]),a.useEffect(()=>{n.lineageFocusNodeId&&n.lineageFocusNodeId!==c&&I(n.lineageFocusNodeId)},[n.lineageFocusNodeId]);const m=a.useMemo(()=>{const t=new Set(d.nodes.filter(r=>f[r.type]??!0).map(r=>r.id));return{nodes:d.nodes.filter(r=>t.has(r.id)),edges:d.edges.filter(r=>t.has(r.source)&&t.has(r.target))}},[d,f]),z=a.useMemo(()=>{for(const t of G){const r=new Set(t.types);if(O.every(u=>(f[u]??!0)===r.has(u)))return t.key}return"custom"},[f]),ve=a.useCallback(t=>{const r=new Set(t);j(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),S=a.useMemo(()=>{if(!B)return null;const t=new Set([B]),r=new Set([B]);let i=!0;for(;i;){i=!1;for(const u of m.edges)t.has(u.target)&&!t.has(u.source)&&(t.add(u.source),i=!0),r.has(u.source)&&!r.has(u.target)&&(r.add(u.target),i=!0)}return new Set([...t,...r])},[B,m.edges]);a.useEffect(()=>{const t=m.nodes.map(i=>({id:i.id,type:"dagNode",selected:i.id===c,position:{x:0,y:0},data:{label:i.name,nodeType:i.type,domain:i.domain,status:i.status,layer:Te(i),dimmed:S?!S.has(i.id):!1}})),r=m.edges.map((i,u)=>{const A=S?S.has(i.source)&&S.has(i.target):!1,ce=A?"var(--accent)":Be[i.type]??"var(--color-text-tertiary)";return{id:`edge-${u}-${i.source}-${i.target}-${i.type}`,source:i.source,target:i.target,style:{stroke:ce,strokeWidth:A?2:1.5,opacity:S&&!A?.25:1},markerEnd:{type:Me.ArrowClosed,color:ce,width:12,height:12}}});te($e(t,r,k,C)),oe(r)},[m,k,C,S,c,oe,te]);const ke=a.useCallback((t,r)=>{M(r.id);const i=m.nodes.find(u=>u.id===r.id)??null;s(i)},[m.nodes]),$=a.useCallback(()=>{M(null),s(null)},[]),_=a.useMemo(()=>{if(!l)return null;const t=d.edges.filter(i=>i.target===l.id).length,r=d.edges.filter(i=>i.source===l.id).length;return{incoming:t,outgoing:r}},[d.edges,l]),ne=(x==null?void 0:x.name)??((ae=R.find(t=>t.id===c))==null?void 0:ae.name)??c??"",we=(x==null?void 0:x.type)??((le=R.find(t=>t.id===c))==null?void 0:le.type)??"block",ie=Z.trim().toLowerCase(),se=(ie?R.filter(t=>t.name.toLowerCase().includes(ie)):R).slice(0,40);return g?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"Loading lineage graph..."}):b.nodes.length===0?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"No lineage graph available yet."}):c?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)"},children:[e.jsx("div",{style:{padding:8,borderBottom:`1px solid ${o.headerBorder}`,background:o.sidebarBg},children:e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>F(t=>!t),title:"Change the traced entity",style:{display:"inline-flex",alignItems:"center",gap:7,height:30,padding:"0 11px",borderRadius:8,border:`1px solid ${D?o.accent:o.headerBorder}`,background:D?"var(--accent-dim)":o.cellBg,color:o.textPrimary,cursor:"pointer",fontFamily:o.font,maxWidth:320},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted},children:"Tracing"}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[we]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:650,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne}),e.jsx("span",{style:{fontSize:9,color:o.textMuted},children:"▾"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>F(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:340,background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:12},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:240})})]})]}),e.jsxs("div",{style:{position:"relative",flex:"0 1 300px",minWidth:160},children:[e.jsxs("svg",{style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:o.textMuted,pointerEvents:"none"},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]}),e.jsx("input",{value:Z,onChange:t=>{ee(t.target.value),N(!0)},onFocus:()=>N(!0),placeholder:"Search another block, app, or notebook…",style:{width:"100%",boxSizing:"border-box",height:30,padding:"0 10px 0 28px",borderRadius:8,border:`1px solid ${X?o.accent:o.headerBorder}`,background:"var(--color-bg-sunken)",color:o.textPrimary,fontSize:12,fontFamily:o.font,outline:"none"}}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:"min(340px, 90vw)",maxHeight:300,overflow:"auto",background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:4},children:se.length===0?e.jsx("div",{style:{padding:"12px 11px",fontSize:12,color:o.textMuted,fontFamily:o.font},children:"No matching block, app, or notebook."}):se.map(t=>e.jsxs("button",{onClick:()=>{I(t.id),ee(""),N(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"8px 10px",border:"none",borderRadius:7,background:t.id===c?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:o.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[t.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:550,color:o.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted,flexShrink:0},children:H[t.type]??t.type})]},t.id))})]})]}),e.jsx("div",{style:{width:1,height:20,background:o.headerBorder,margin:"0 2px"}}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>Q("flow"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:k==="flow"?"var(--color-bg-tertiary)":"transparent",color:k==="flow"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Flow"}),e.jsx("button",{onClick:()=>Q("layered"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:k==="layered"?"var(--color-bg-tertiary)":"transparent",color:k==="layered"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Layered"})]}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden",marginRight:4},children:[e.jsxs("button",{title:"Horizontal layout (left → right)",onClick:()=>J("LR"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:C==="LR"?"var(--color-bg-tertiary)":"transparent",color:C==="LR"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",children:[e.jsx("rect",{x:"0",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M9 3l2 2-2 2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor"})]}),"LR"]}),e.jsxs("button",{title:"Vertical layout (top → bottom)",onClick:()=>J("TB"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:C==="TB"?"var(--color-bg-tertiary)":"transparent",color:C==="TB"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",children:[e.jsx("rect",{x:"2",y:"0",width:"6",height:"4",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"5",y1:"4",x2:"5",y2:"10",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M3 9l2 2 2-2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"2",y:"10",width:"6",height:"4",rx:"1",fill:"currentColor"})]}),"TB"]})]}),e.jsx("div",{role:"group","aria-label":"Lineage view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.headerBorder}`,borderRadius:7,background:o.appBg,marginRight:4},children:G.map(t=>e.jsx("button",{onClick:()=>ve(t.types),title:t.title,"aria-pressed":z===t.key,style:{padding:"4px 11px",fontSize:11.5,fontWeight:600,border:"none",borderRadius:5,cursor:"pointer",fontFamily:o.font,whiteSpace:"nowrap",background:z===t.key?"var(--accent-dim)":"transparent",color:z===t.key?o.accent:o.textMuted},children:t.label},t.key))}),B&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:$,style:{borderRadius:7,border:`1px solid ${o.accent}`,background:"var(--accent-dim)",color:o.accent,cursor:"pointer",fontSize:11.5,fontWeight:650,padding:"5px 11px",whiteSpace:"nowrap"},children:"Show all"})]})]})}),e.jsx("div",{style:{flex:1,position:"relative"},children:e.jsxs(Fe,{nodes:ye,edges:be,onNodesChange:fe,onEdgesChange:me,onNodeClick:ke,onPaneClick:$,nodeTypes:Ae,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Ne,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Pe,{showInteractive:!1}),e.jsx(Oe,{nodeColor:t=>{var r;return E[((r=t.data)==null?void 0:r.nodeType)??"source_table"]??"var(--color-text-tertiary)"},maskColor:"color-mix(in srgb, var(--color-bg-primary) 55%, transparent)",style:{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-primary)"}}),e.jsx(De,{position:"bottom-left",children:l?e.jsxs("div",{style:{width:264,background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",borderRadius:11,boxShadow:"0 8px 26px rgba(26,26,26,0.13)",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[l.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:700,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),e.jsx("button",{onClick:$,title:"Clear focus",style:{width:20,height:20,borderRadius:5,border:"none",background:"none",color:"var(--color-text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,flexShrink:0},children:"×"})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginTop:3},children:[H[l.type]??l.type,_?` · ${_.incoming} upstream · ${_.outgoing} downstream`:""]}),l.domain?e.jsxs("div",{style:{fontSize:11.5,color:"var(--color-text-secondary)",lineHeight:1.5,marginTop:7},children:["Domain: ",l.domain]}):null,e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{onClick:()=>{l&&l.id!==c&&I(l.id)},disabled:!l||l.id===c,title:(l==null?void 0:l.id)===c?"Already the traced entity":"Re-scope lineage to this node",style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"none",background:"var(--accent)",color:"#fff",fontSize:11,fontWeight:650,cursor:(l==null?void 0:l.id)===c?"default":"pointer",opacity:(l==null?void 0:l.id)===c?.5:1},children:"Trace from here"}),e.jsx("button",{onClick:()=>h({type:"OPEN_GLOBAL_AI",autoRun:{text:`Explain the lineage of ${l.name} — where does it come from and what consumes it?`}}),style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"1px solid var(--color-border-primary)",background:"var(--color-bg-card)",color:"var(--color-text-secondary)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Ask about this"})]})]}):null})]})}),e.jsxs("div",{style:{height:28,flexShrink:0,borderTop:"1px solid var(--border-subtle)",background:"var(--color-bg-card)",display:"flex",alignItems:"center",gap:14,padding:"0 14px",fontSize:10.5,color:"var(--color-text-tertiary)"},children:[e.jsxs("span",{children:[z==="custom"?"Custom":(de=G.find(t=>t.key===z))==null?void 0:de.label," lineage of ",ne," · ",m.nodes.length," nodes · ",m.edges.length," edges",W?" · loading…":""]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:"var(--status-success)"}}),"Compiled from the dbt manifest"]}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{children:"Click a node to focus its path · click the canvas to clear"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)",alignItems:"center",justifyContent:"center",padding:24,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(560px, 100%)",border:`1px solid ${o.headerBorder}`,borderRadius:14,background:o.cellBg,padding:"22px 22px 18px",boxShadow:"0 1px 4px rgba(26,26,26,0.05)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:o.textPrimary,fontFamily:o.font},children:"Trace lineage"}),e.jsx("div",{style:{fontSize:12.5,color:o.textMuted,marginTop:3,lineHeight:1.5,fontFamily:o.font},children:"Pick a block, app, or notebook to see its upstream sources and downstream consumers — no project-wide noise."}),e.jsx("div",{style:{marginTop:16},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:300})})]})})}function ue({t:n,entities:h,activeType:o,onTypeChange:g,query:p,onQueryChange:b,onSelect:v,focalId:d,listHeight:y}){var T,l;const x=Y.filter(s=>h.some(f=>f.type===s.type)),w=x.some(s=>s.type===o)?o:((T=x[0])==null?void 0:T.type)??o,c=p.trim().toLowerCase(),L=h.filter(s=>s.type===w).filter(s=>!c||s.name.toLowerCase().includes(c)),W=((l=Y.find(s=>s.type===w))==null?void 0:l.label)??"items";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${n.headerBorder}`,borderRadius:8,background:n.appBg,alignSelf:"flex-start",flexWrap:"wrap"},children:x.map(s=>{const f=s.type===w,j=h.filter(k=>k.type===s.type).length;return e.jsxs("button",{onClick:()=>g(s.type),style:{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:6,padding:"5px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:n.font,background:f?"var(--accent-dim)":"transparent",color:f?n.accent:n.textMuted},children:[s.label,e.jsx("span",{style:{fontSize:10.5,color:f?n.accent:n.textMuted,opacity:.8},children:j})]},s.type)})}),e.jsx("input",{value:p,onChange:s=>b(s.target.value),placeholder:`Search ${W.toLowerCase()}…`,style:{padding:"8px 10px",borderRadius:8,border:`1px solid ${n.headerBorder}`,background:"var(--color-bg-sunken)",color:n.textPrimary,fontSize:12,fontFamily:n.font,outline:"none"}}),e.jsx("div",{style:{maxHeight:y,overflow:"auto",border:`1px solid ${n.headerBorder}`,borderRadius:8},children:L.length===0?e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:n.textMuted,fontFamily:n.font},children:h.some(s=>s.type===w)?"No matches.":`No ${W.toLowerCase()} in this project yet.`}):L.map((s,f)=>{const j=s.id===d;return e.jsxs("button",{onClick:()=>v(s.id),style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"9px 11px",border:"none",borderTop:f===0?"none":`1px solid ${n.headerBorder}`,background:j?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:n.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[s.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:j?650:500,color:n.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.status==="certified"?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null]},s.id)})})]})}export{Qe as LineageDAG};
|
|
1
|
+
import{h as Se,i as je,k as Ce,t as Re,r as a,ay as O,a as pe,az as Ee,aA as Le,aB as Te,aC as Be,j as e,p as E,aw as H,aD as Ie,l as ge}from"./index-DJRMz64S.js";import{u as ze,a as We,M as Me,i as Fe,B as Ne,C as Pe,b as Oe,P as De,T as he,c as P,H as xe}from"./dagre.esm-CPT_vn5p.js";import"./react-CRB3T2We.js";const G=[{key:"technical",label:"Technical",title:"Physical sources and dbt transformations",types:Ee},{key:"domain",label:"Domain",title:"Business terms, governed domains, semantic metrics, and certified blocks",types:Le},{key:"end-to-end",label:"End-to-end",title:"Complete path from physical sources through governed meaning to consumption",types:O}],Y=[{type:"block",label:"Blocks"},{type:"app",label:"Apps"},{type:"notebook",label:"Notebooks"},{type:"dashboard",label:"Dashboards"}];function $e(n,h,o="flow",g="LR"){var v;const p=new he.graphlib.Graph().setDefaultEdgeLabel(()=>({})),b=g==="LR";p.setGraph({rankdir:g,ranksep:o==="layered"?120:b?80:60,nodesep:b?40:50,marginx:32,marginy:32});for(const d of n){const y={width:190,height:58};if(o==="layered"&&((v=d.data)!=null&&v.layer)){const x=Ie.indexOf(d.data.layer);x>=0&&(y.rank=x)}p.setNode(d.id,y)}for(const d of h)p.setEdge(d.source,d.target);return he.layout(p),n.map(d=>{const y=p.node(d.id);return{...d,position:{x:y.x-95,y:y.y-29},data:{...d.data,direction:g}}})}function _e({data:n,selected:h}){const o=n.nodeType,g=E[o]??"var(--color-text-tertiary)",p=n.direction??"LR",b=p==="LR"?P.Left:P.Top,v=p==="LR"?P.Right:P.Bottom,d=!!n.dimmed,y=n.status==="certified";return e.jsxs("div",{style:{width:196,display:"flex",alignItems:"center",gap:8,background:"var(--color-bg-card)",border:`1.5px solid ${h?"var(--accent)":"var(--border-default)"}`,borderRadius:9,padding:"9px 11px",boxShadow:h?"0 1px 6px rgba(107,93,211,0.16)":"0 1px 4px rgba(26,26,26,0.05)",opacity:d?.3:1,transition:"opacity 0.15s ease"},children:[e.jsx(xe,{type:"target",position:b,style:{width:7,height:7,background:g,border:"none"}}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:g,flexShrink:0}}),e.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[e.jsx("span",{title:n.label,style:{fontSize:11.5,fontWeight:650,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.label}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:g},children:H[o]??o})]}),y?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null,e.jsx(xe,{type:"source",position:v,style:{width:7,height:7,background:g,border:"none"}})]})}const Ae={dagNode:_e};function Qe(){var ae,le,de;const n=Se(je(t=>({lineageFocusNodeId:t.lineageFocusNodeId,themeMode:t.themeMode}))),h=Ce(),o=Re[n.themeMode],[g,p]=a.useState(!0),[b,v]=a.useState({nodes:[],edges:[]}),[d,y]=a.useState({nodes:[],edges:[]}),[x,w]=a.useState(null),[c,L]=a.useState(null),[W,T]=a.useState(!1),[l,s]=a.useState(null),[f,j]=a.useState(Object.fromEntries(O.map(t=>[t,!0]))),[k,Q]=a.useState("flow"),[C,J]=a.useState("LR"),[B,M]=a.useState(null),[D,F]=a.useState(!1),[V,q]=a.useState("block"),[U,K]=a.useState(""),[X,N]=a.useState(!1),[Z,ee]=a.useState(""),[ye,te,fe]=ze([]),[be,oe,me]=We([]),re=a.useCallback(async()=>{p(!0);try{const t=await pe.fetchLineage();v({nodes:t.nodes??[],edges:t.edges??[]})}finally{p(!1)}},[]);a.useEffect(()=>{re()},[re]);const R=a.useMemo(()=>b.nodes.filter(t=>Y.some(r=>r.type===t.type)).sort((t,r)=>t.name.localeCompare(r.name)),[b.nodes]),I=a.useCallback(async t=>{L(t),F(!1),M(null),s(null),T(!0);try{const r=await pe.queryLineage({focus:t,upstreamDepth:12,downstreamDepth:12});y(r.graph??{nodes:[],edges:[]}),w(r.focalNode??null)}finally{T(!1)}},[]);a.useCallback(()=>{L(null),y({nodes:[],edges:[]}),w(null),s(null),M(null),F(!1),h({type:"SET_LINEAGE_FOCUS",nodeId:null})},[h]),a.useEffect(()=>{n.lineageFocusNodeId&&n.lineageFocusNodeId!==c&&I(n.lineageFocusNodeId)},[n.lineageFocusNodeId]);const m=a.useMemo(()=>{const t=new Set(d.nodes.filter(r=>f[r.type]??!0).map(r=>r.id));return{nodes:d.nodes.filter(r=>t.has(r.id)),edges:d.edges.filter(r=>t.has(r.source)&&t.has(r.target))}},[d,f]),z=a.useMemo(()=>{for(const t of G){const r=new Set(t.types);if(O.every(u=>(f[u]??!0)===r.has(u)))return t.key}return"custom"},[f]),ve=a.useCallback(t=>{const r=new Set(t);j(Object.fromEntries(O.map(i=>[i,r.has(i)])))},[]),S=a.useMemo(()=>{if(!B)return null;const t=new Set([B]),r=new Set([B]);let i=!0;for(;i;){i=!1;for(const u of m.edges)t.has(u.target)&&!t.has(u.source)&&(t.add(u.source),i=!0),r.has(u.source)&&!r.has(u.target)&&(r.add(u.target),i=!0)}return new Set([...t,...r])},[B,m.edges]);a.useEffect(()=>{const t=m.nodes.map(i=>({id:i.id,type:"dagNode",selected:i.id===c,position:{x:0,y:0},data:{label:i.name,nodeType:i.type,domain:i.domain,status:i.status,layer:Te(i),dimmed:S?!S.has(i.id):!1}})),r=m.edges.map((i,u)=>{const A=S?S.has(i.source)&&S.has(i.target):!1,ce=A?"var(--accent)":Be[i.type]??"var(--color-text-tertiary)";return{id:`edge-${u}-${i.source}-${i.target}-${i.type}`,source:i.source,target:i.target,style:{stroke:ce,strokeWidth:A?2:1.5,opacity:S&&!A?.25:1},markerEnd:{type:Me.ArrowClosed,color:ce,width:12,height:12}}});te($e(t,r,k,C)),oe(r)},[m,k,C,S,c,oe,te]);const ke=a.useCallback((t,r)=>{M(r.id);const i=m.nodes.find(u=>u.id===r.id)??null;s(i)},[m.nodes]),$=a.useCallback(()=>{M(null),s(null)},[]),_=a.useMemo(()=>{if(!l)return null;const t=d.edges.filter(i=>i.target===l.id).length,r=d.edges.filter(i=>i.source===l.id).length;return{incoming:t,outgoing:r}},[d.edges,l]),ne=(x==null?void 0:x.name)??((ae=R.find(t=>t.id===c))==null?void 0:ae.name)??c??"",we=(x==null?void 0:x.type)??((le=R.find(t=>t.id===c))==null?void 0:le.type)??"block",ie=Z.trim().toLowerCase(),se=(ie?R.filter(t=>t.name.toLowerCase().includes(ie)):R).slice(0,40);return g?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"Loading lineage graph..."}):b.nodes.length===0?e.jsx("div",{style:{padding:16,color:o.textMuted,fontSize:12},children:"No lineage graph available yet."}):c?e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)"},children:[e.jsx("div",{style:{padding:8,borderBottom:`1px solid ${o.headerBorder}`,background:o.sidebarBg},children:e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>F(t=>!t),title:"Change the traced entity",style:{display:"inline-flex",alignItems:"center",gap:7,height:30,padding:"0 11px",borderRadius:8,border:`1px solid ${D?o.accent:o.headerBorder}`,background:D?"var(--accent-dim)":o.cellBg,color:o.textPrimary,cursor:"pointer",fontFamily:o.font,maxWidth:320},children:[e.jsx("span",{style:{fontSize:10.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted},children:"Tracing"}),e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[we]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{fontSize:12.5,fontWeight:650,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ne}),e.jsx("span",{style:{fontSize:9,color:o.textMuted},children:"▾"})]}),D&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>F(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:340,background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:12},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:240})})]})]}),e.jsxs("div",{style:{position:"relative",flex:"0 1 300px",minWidth:160},children:[e.jsxs("svg",{style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:o.textMuted,pointerEvents:"none"},width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.3-4.3"})]}),e.jsx("input",{value:Z,onChange:t=>{ee(t.target.value),N(!0)},onFocus:()=>N(!0),placeholder:"Search another block, app, or notebook…",style:{width:"100%",boxSizing:"border-box",height:30,padding:"0 10px 0 28px",borderRadius:8,border:`1px solid ${X?o.accent:o.headerBorder}`,background:"var(--color-bg-sunken)",color:o.textPrimary,fontSize:12,fontFamily:o.font,outline:"none"}}),X&&e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:()=>N(!1),style:{position:"fixed",inset:0,zIndex:30}}),e.jsx("div",{style:{position:"absolute",top:"calc(100% + 6px)",left:0,zIndex:31,width:"min(340px, 90vw)",maxHeight:300,overflow:"auto",background:o.cellBg,border:`1px solid ${o.headerBorder}`,borderRadius:11,boxShadow:"0 10px 30px rgba(26,26,26,0.14)",padding:4},children:se.length===0?e.jsx("div",{style:{padding:"12px 11px",fontSize:12,color:o.textMuted,fontFamily:o.font},children:"No matching block, app, or notebook."}):se.map(t=>e.jsxs("button",{onClick:()=>{I(t.id),ee(""),N(!1)},style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"8px 10px",border:"none",borderRadius:7,background:t.id===c?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:o.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[t.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:550,color:o.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name}),e.jsx("span",{style:{fontSize:9.5,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:o.textMuted,flexShrink:0},children:H[t.type]??t.type})]},t.id))})]})]}),e.jsx("div",{style:{width:1,height:20,background:o.headerBorder,margin:"0 2px"}}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>Q("flow"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:k==="flow"?"var(--color-bg-tertiary)":"transparent",color:k==="flow"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Flow"}),e.jsx("button",{onClick:()=>Q("layered"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:k==="layered"?"var(--color-bg-tertiary)":"transparent",color:k==="layered"?"var(--color-text-primary)":"var(--color-text-tertiary)"},children:"Layered"})]}),e.jsxs("div",{style:{display:"flex",borderRadius:6,border:`1px solid ${o.headerBorder}`,overflow:"hidden",marginRight:4},children:[e.jsxs("button",{title:"Horizontal layout (left → right)",onClick:()=>J("LR"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",cursor:"pointer",background:C==="LR"?"var(--color-bg-tertiary)":"transparent",color:C==="LR"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"14",height:"10",viewBox:"0 0 14 10",fill:"none",children:[e.jsx("rect",{x:"0",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"4",y1:"5",x2:"10",y2:"5",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M9 3l2 2-2 2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"10",y:"2",width:"4",height:"6",rx:"1",fill:"currentColor"})]}),"LR"]}),e.jsxs("button",{title:"Vertical layout (top → bottom)",onClick:()=>J("TB"),style:{padding:"4px 8px",fontSize:10,fontWeight:700,border:"none",borderLeft:`1px solid ${o.headerBorder}`,cursor:"pointer",background:C==="TB"?"var(--color-bg-tertiary)":"transparent",color:C==="TB"?"var(--color-text-primary)":"var(--color-text-tertiary)",display:"flex",alignItems:"center",gap:3},children:[e.jsxs("svg",{width:"10",height:"14",viewBox:"0 0 10 14",fill:"none",children:[e.jsx("rect",{x:"2",y:"0",width:"6",height:"4",rx:"1",fill:"currentColor",opacity:"0.7"}),e.jsx("line",{x1:"5",y1:"4",x2:"5",y2:"10",stroke:"currentColor",strokeWidth:"1.2"}),e.jsx("path",{d:"M3 9l2 2 2-2",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),e.jsx("rect",{x:"2",y:"10",width:"6",height:"4",rx:"1",fill:"currentColor"})]}),"TB"]})]}),e.jsx("div",{role:"group","aria-label":"Lineage view",style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.headerBorder}`,borderRadius:7,background:o.appBg,marginRight:4},children:G.map(t=>e.jsx("button",{onClick:()=>ve(t.types),title:t.title,"aria-pressed":z===t.key,style:{padding:"4px 11px",fontSize:11.5,fontWeight:600,border:"none",borderRadius:5,cursor:"pointer",fontFamily:o.font,whiteSpace:"nowrap",background:z===t.key?"var(--accent-dim)":"transparent",color:z===t.key?o.accent:o.textMuted},children:t.label},t.key))}),B&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:$,style:{borderRadius:7,border:`1px solid ${o.accent}`,background:"var(--accent-dim)",color:o.accent,cursor:"pointer",fontSize:11.5,fontWeight:650,padding:"5px 11px",whiteSpace:"nowrap"},children:"Show all"})]})]})}),e.jsx("div",{style:{flex:1,position:"relative"},children:e.jsxs(Fe,{nodes:ye,edges:be,onNodesChange:fe,onEdgesChange:me,onNodeClick:ke,onPaneClick:$,nodeTypes:Ae,fitView:!0,fitViewOptions:{padding:.18},proOptions:{hideAttribution:!0},style:{background:"var(--bg-canvas)"},children:[e.jsx(Ne,{color:"var(--border-strong)",gap:22,size:1}),e.jsx(Pe,{showInteractive:!1}),e.jsx(Oe,{nodeColor:t=>{var r;return E[((r=t.data)==null?void 0:r.nodeType)??"source_table"]??"var(--color-text-tertiary)"},maskColor:"color-mix(in srgb, var(--color-bg-primary) 55%, transparent)",style:{background:"var(--color-bg-sunken)",border:"1px solid var(--color-border-primary)"}}),e.jsx(De,{position:"bottom-left",children:l?e.jsxs("div",{style:{width:264,background:"var(--color-bg-card)",border:"1px solid var(--color-border-primary)",borderRadius:11,boxShadow:"0 8px 26px rgba(26,26,26,0.13)",padding:"12px 14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[l.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:700,color:"var(--color-text-primary)",fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.name}),e.jsx("button",{onClick:$,title:"Clear focus",style:{width:20,height:20,borderRadius:5,border:"none",background:"none",color:"var(--color-text-tertiary)",display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0,flexShrink:0},children:"×"})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginTop:3},children:[H[l.type]??l.type,_?` · ${_.incoming} upstream · ${_.outgoing} downstream`:""]}),l.domain?e.jsxs("div",{style:{fontSize:11.5,color:"var(--color-text-secondary)",lineHeight:1.5,marginTop:7},children:["Domain: ",l.domain]}):null,e.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[e.jsx("button",{onClick:()=>{l&&l.id!==c&&I(l.id)},disabled:!l||l.id===c,title:(l==null?void 0:l.id)===c?"Already the traced entity":"Re-scope lineage to this node",style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"none",background:"var(--accent)",color:"#fff",fontSize:11,fontWeight:650,cursor:(l==null?void 0:l.id)===c?"default":"pointer",opacity:(l==null?void 0:l.id)===c?.5:1},children:"Trace from here"}),e.jsx("button",{onClick:()=>h({type:"OPEN_GLOBAL_AI",autoRun:{text:`Explain the lineage of ${l.name} — where does it come from and what consumes it?`}}),style:{display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:"1px solid var(--color-border-primary)",background:"var(--color-bg-card)",color:"var(--color-text-secondary)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Ask about this"})]})]}):null})]})}),e.jsxs("div",{style:{height:28,flexShrink:0,borderTop:"1px solid var(--border-subtle)",background:"var(--color-bg-card)",display:"flex",alignItems:"center",gap:14,padding:"0 14px",fontSize:10.5,color:"var(--color-text-tertiary)"},children:[e.jsxs("span",{children:[z==="custom"?"Custom":(de=G.find(t=>t.key===z))==null?void 0:de.label," lineage of ",ne," · ",m.nodes.length," nodes · ",m.edges.length," edges",W?" · loading…":""]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:999,background:"var(--status-success)"}}),"Compiled from the dbt manifest"]}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{children:"Click a node to focus its path · click the canvas to clear"})]})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--color-bg-primary)",alignItems:"center",justifyContent:"center",padding:24,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(560px, 100%)",border:`1px solid ${o.headerBorder}`,borderRadius:14,background:o.cellBg,padding:"22px 22px 18px",boxShadow:"0 1px 4px rgba(26,26,26,0.05)"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:o.textPrimary,fontFamily:o.font},children:"Trace lineage"}),e.jsx("div",{style:{fontSize:12.5,color:o.textMuted,marginTop:3,lineHeight:1.5,fontFamily:o.font},children:"Pick a block, app, or notebook to see its upstream sources and downstream consumers — no project-wide noise."}),e.jsx("div",{style:{marginTop:16},children:e.jsx(ue,{t:o,entities:R,activeType:V,onTypeChange:q,query:U,onQueryChange:K,onSelect:t=>void I(t),focalId:c,listHeight:300})})]})})}function ue({t:n,entities:h,activeType:o,onTypeChange:g,query:p,onQueryChange:b,onSelect:v,focalId:d,listHeight:y}){var T,l;const x=Y.filter(s=>h.some(f=>f.type===s.type)),w=x.some(s=>s.type===o)?o:((T=x[0])==null?void 0:T.type)??o,c=p.trim().toLowerCase(),L=h.filter(s=>s.type===w).filter(s=>!c||s.name.toLowerCase().includes(c)),W=((l=Y.find(s=>s.type===w))==null?void 0:l.label)??"items";return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${n.headerBorder}`,borderRadius:8,background:n.appBg,alignSelf:"flex-start",flexWrap:"wrap"},children:x.map(s=>{const f=s.type===w,j=h.filter(k=>k.type===s.type).length;return e.jsxs("button",{onClick:()=>g(s.type),style:{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:6,padding:"5px 11px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:n.font,background:f?"var(--accent-dim)":"transparent",color:f?n.accent:n.textMuted},children:[s.label,e.jsx("span",{style:{fontSize:10.5,color:f?n.accent:n.textMuted,opacity:.8},children:j})]},s.type)})}),e.jsx("input",{value:p,onChange:s=>b(s.target.value),placeholder:`Search ${W.toLowerCase()}…`,style:{padding:"8px 10px",borderRadius:8,border:`1px solid ${n.headerBorder}`,background:"var(--color-bg-sunken)",color:n.textPrimary,fontSize:12,fontFamily:n.font,outline:"none"}}),e.jsx("div",{style:{maxHeight:y,overflow:"auto",border:`1px solid ${n.headerBorder}`,borderRadius:8},children:L.length===0?e.jsx("div",{style:{padding:"14px 12px",fontSize:12,color:n.textMuted,fontFamily:n.font},children:h.some(s=>s.type===w)?"No matches.":`No ${W.toLowerCase()} in this project yet.`}):L.map((s,f)=>{const j=s.id===d;return e.jsxs("button",{onClick:()=>v(s.id),style:{width:"100%",display:"flex",alignItems:"center",gap:9,textAlign:"left",padding:"9px 11px",border:"none",borderTop:f===0?"none":`1px solid ${n.headerBorder}`,background:j?"var(--accent-dim)":"transparent",cursor:"pointer",fontFamily:n.font},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:999,background:E[s.type]??"var(--color-text-tertiary)",flexShrink:0}}),e.jsx("span",{style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:j?650:500,color:n.textPrimary,fontFamily:"'JetBrains Mono', monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),s.status==="certified"?e.jsx(ge,{size:12,color:"var(--status-success)",strokeWidth:2,style:{flexShrink:0}}):null]},s.id)})})]})}export{Qe as LineageDAG};
|