yamchart 0.10.2 → 0.10.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.
Files changed (66) hide show
  1. package/dist/{advisor-5F73GF54.js → advisor-XTJQU7E4.js} +12 -12
  2. package/dist/{chunk-5CRXV5PQ.js → chunk-2XJZJ6IA.js} +2 -2
  3. package/dist/{chunk-X3UG6T3Q.js → chunk-6ELSQNIH.js} +2 -2
  4. package/dist/{chunk-UOSOZT47.js → chunk-KDDO4UII.js} +57 -5
  5. package/dist/chunk-KDDO4UII.js.map +1 -0
  6. package/dist/{chunk-25ES7MGF.js → chunk-ODSPBOJW.js} +4 -4
  7. package/dist/{chunk-7HWFVUGP.js → chunk-OYBI433Z.js} +59 -2
  8. package/dist/chunk-OYBI433Z.js.map +1 -0
  9. package/dist/{chunk-WVSDQNAN.js → chunk-PXFTWXSV.js} +2 -2
  10. package/dist/{chunk-PYVROL7Z.js → chunk-XNMB25GT.js} +4 -4
  11. package/dist/{connection-utils-HNX3473B.js → connection-utils-S7EFPTLY.js} +5 -5
  12. package/dist/{describe-KDGXFPDQ.js → describe-TA2CTODC.js} +6 -6
  13. package/dist/{dev-KOWFGDOP.js → dev-PHFYLJPJ.js} +1336 -796
  14. package/dist/dev-PHFYLJPJ.js.map +1 -0
  15. package/dist/{dist-WMP7BFKP.js → dist-F6TVLP6C.js} +12 -4
  16. package/dist/{dist-YB5RBWCC.js → dist-Q5ETETUU.js} +4 -4
  17. package/dist/{dist-LK3ZG74Q.js → dist-YJOOH65Y.js} +9 -5
  18. package/dist/index.js +26 -26
  19. package/dist/public/assets/DataView-V-E6oxy6.js +9 -0
  20. package/dist/public/assets/{EventManagement-BIkVUSCe.js → EventManagement-Do2xU5lV.js} +1 -1
  21. package/dist/public/assets/{ExplorePage-CeaAulqT.js → ExplorePage-Dg50mvGB.js} +1 -1
  22. package/dist/public/assets/{LoginPage-4WeNcdRi.js → LoginPage-DmYGIXcu.js} +1 -1
  23. package/dist/public/assets/{PublicViewer-CkW-G56D.js → PublicViewer-CJTgc9OF.js} +1 -1
  24. package/dist/public/assets/{SetupWizard-CwTr3PCy.js → SetupWizard-Bo-zmh43.js} +1 -1
  25. package/dist/public/assets/{ShareManagement-DSon6CoC.js → ShareManagement-6Wp6b2Gp.js} +1 -1
  26. package/dist/public/assets/{SourceDetailView-BA4XVKqV.js → SourceDetailView-CTzSXhZc.js} +1 -1
  27. package/dist/public/assets/{UserManagement-BWD2Ugkv.js → UserManagement-DQhB13T0.js} +1 -1
  28. package/dist/public/assets/{index-iR9gLdl9.js → index-CY8xsfQH.js} +31 -31
  29. package/dist/public/assets/{index-Cb4omrVn.css → index-Dkn-tJCT.css} +1 -1
  30. package/dist/public/assets/{index.es-BuEtjxhO.js → index.es-Bc3yys5L.js} +1 -1
  31. package/dist/public/assets/{jspdf.es.min-CScx2_oK.js → jspdf.es.min-D94JEH-J.js} +3 -3
  32. package/dist/public/index.html +2 -2
  33. package/dist/{query-7XHKSZ5H.js → query-AX4BOPMH.js} +5 -5
  34. package/dist/{sample-YNSJ3I3T.js → sample-4NUBJGIL.js} +5 -5
  35. package/dist/{search-NKRXXLRS.js → search-IBVVYN4I.js} +6 -6
  36. package/dist/{semantic-NBAX4WU4.js → semantic-33YIUMUV.js} +3 -3
  37. package/dist/{semantic-DD7P4634.js → semantic-5WGVZ7HY.js} +3 -3
  38. package/dist/{source-resolver-7NY3KEZ2.js → source-resolver-GYXIRIVK.js} +6 -6
  39. package/dist/{sync-warehouse-PK7HXW7U.js → sync-warehouse-5NKENCOZ.js} +5 -5
  40. package/dist/{tables-WQTRZSXR.js → tables-QMZMYYV5.js} +6 -6
  41. package/dist/{test-MKNKUR3N.js → test-6MCPGXJP.js} +5 -5
  42. package/package.json +5 -5
  43. package/dist/chunk-7HWFVUGP.js.map +0 -1
  44. package/dist/chunk-UOSOZT47.js.map +0 -1
  45. package/dist/dev-KOWFGDOP.js.map +0 -1
  46. package/dist/public/assets/DataView-BfwnWnLH.js +0 -9
  47. /package/dist/{advisor-5F73GF54.js.map → advisor-XTJQU7E4.js.map} +0 -0
  48. /package/dist/{chunk-5CRXV5PQ.js.map → chunk-2XJZJ6IA.js.map} +0 -0
  49. /package/dist/{chunk-X3UG6T3Q.js.map → chunk-6ELSQNIH.js.map} +0 -0
  50. /package/dist/{chunk-25ES7MGF.js.map → chunk-ODSPBOJW.js.map} +0 -0
  51. /package/dist/{chunk-WVSDQNAN.js.map → chunk-PXFTWXSV.js.map} +0 -0
  52. /package/dist/{chunk-PYVROL7Z.js.map → chunk-XNMB25GT.js.map} +0 -0
  53. /package/dist/{connection-utils-HNX3473B.js.map → connection-utils-S7EFPTLY.js.map} +0 -0
  54. /package/dist/{describe-KDGXFPDQ.js.map → describe-TA2CTODC.js.map} +0 -0
  55. /package/dist/{dist-LK3ZG74Q.js.map → dist-F6TVLP6C.js.map} +0 -0
  56. /package/dist/{dist-WMP7BFKP.js.map → dist-Q5ETETUU.js.map} +0 -0
  57. /package/dist/{dist-YB5RBWCC.js.map → dist-YJOOH65Y.js.map} +0 -0
  58. /package/dist/{query-7XHKSZ5H.js.map → query-AX4BOPMH.js.map} +0 -0
  59. /package/dist/{sample-YNSJ3I3T.js.map → sample-4NUBJGIL.js.map} +0 -0
  60. /package/dist/{search-NKRXXLRS.js.map → search-IBVVYN4I.js.map} +0 -0
  61. /package/dist/{semantic-NBAX4WU4.js.map → semantic-33YIUMUV.js.map} +0 -0
  62. /package/dist/{semantic-DD7P4634.js.map → semantic-5WGVZ7HY.js.map} +0 -0
  63. /package/dist/{source-resolver-7NY3KEZ2.js.map → source-resolver-GYXIRIVK.js.map} +0 -0
  64. /package/dist/{sync-warehouse-PK7HXW7U.js.map → sync-warehouse-5NKENCOZ.js.map} +0 -0
  65. /package/dist/{tables-WQTRZSXR.js.map → tables-QMZMYYV5.js.map} +0 -0
  66. /package/dist/{test-MKNKUR3N.js.map → test-6MCPGXJP.js.map} +0 -0
@@ -1,9 +0,0 @@
1
- import{R as N,j as e,v as J,u as M,U as V,w as P,A as Z,V as Q,f as L,a as ee}from"./index-iR9gLdl9.js";import{a as b}from"./echarts-DtOYsfLX.js";import{l as G}from"./data-3vtzSuAZ.js";async function Y(){return N("/admin/config")}const oe=o=>N("/admin/connections/test",{method:"POST",body:JSON.stringify(o)}),te=(o,t)=>N(t?`/admin/connections/${encodeURIComponent(o.name)}`:"/admin/connections",{method:t?"PUT":"POST",body:JSON.stringify(o)}),se=o=>N(`/admin/connections/${encodeURIComponent(o)}`,{method:"DELETE"}),re=o=>N("/admin/knowledge-db/test",{method:"POST",body:JSON.stringify({url:o})}),ne=o=>N("/admin/knowledge-db",{method:"PUT",body:JSON.stringify({url:o})}),ae=o=>N("/admin/knowledge-db/migrate",{method:"POST",body:JSON.stringify({url:o})}),ce=()=>N("/admin/knowledge-db/reembed",{method:"POST",body:JSON.stringify({})}),le=o=>N("/admin/ai",{method:"PUT",body:JSON.stringify(o)}),ie=(o,t)=>N("/admin/ai/test",{method:"POST",body:JSON.stringify({provider:o,kind:t})}),de=["postgres","mysql","bigquery","snowflake","duckdb","sqlite"],E={postgres:[{key:"config.host",label:"Host"},{key:"config.port",label:"Port",numeric:!0},{key:"config.database",label:"Database"},{key:"config.schema",label:"Schema"},{key:"secrets.user",label:"User"},{key:"secrets.password",label:"Password",secret:!0}],mysql:[{key:"config.host",label:"Host"},{key:"config.port",label:"Port",numeric:!0},{key:"config.database",label:"Database"},{key:"secrets.user",label:"User"},{key:"secrets.password",label:"Password",secret:!0}],bigquery:[{key:"config.project_id",label:"Project ID"},{key:"config.dataset",label:"Dataset"},{key:"config.location",label:"Location"},{key:"secrets.credentials_json",label:"Service Account JSON",secret:!0}],snowflake:[{key:"config.account",label:"Account"},{key:"config.warehouse",label:"Warehouse"},{key:"config.database",label:"Database"},{key:"config.schema",label:"Schema"},{key:"config.role",label:"Role"},{key:"secrets.user",label:"User"},{key:"secrets.password",label:"Password",secret:!0}],duckdb:[{key:"config.path",label:"Path"}],sqlite:[{key:"config.path",label:"Path"}]};function pe(o,t,n){const[s,a]=t.split(".");!s||!a||(o[s]=o[s]??{},o[s][a]=n)}function ue(o){if(!o)return{};const t={},n=E[o.type]??[];for(const s of n){if(s.secret)continue;const[a,i]=s.key.split(".");if(!a||!i)continue;const d=o[a],l=d==null?void 0:d[i];l!=null&&(t[s.key]=String(l))}return t}function ye({mode:o,initial:t,onClose:n,onApplying:s}){const[a,i]=b.useState((t==null?void 0:t.type)??"postgres"),[d,l]=b.useState((t==null?void 0:t.name)??""),[p,g]=b.useState(()=>ue(t)),[u,j]=b.useState(null),[v,r]=b.useState(!1),[m,y]=b.useState(null);b.useEffect(()=>{const x=w=>{w.key==="Escape"&&n()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);const h=()=>{const x={name:d,type:a,config:{},secrets:{}};for(const w of E[a]){const S=p[w.key];S===void 0||S===""||pe(x,w.key,w.numeric?Number(S):S)}return Object.keys(x.secrets).length===0&&delete x.secrets,x},c=async()=>{r(!0),y(null);try{j(await oe(h()))}catch(x){y(x instanceof Error?x.message:"Test failed")}finally{r(!1)}},k=async()=>{r(!0),y(null);try{await te(h(),o==="edit"),s(),n()}catch(x){y(x instanceof Error?x.message:"Save failed")}finally{r(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",onClick:n,children:e.jsxs("div",{className:"bg-[var(--surface)] rounded-lg p-6 w-[480px] max-h-[85vh] overflow-auto",onClick:x=>x.stopPropagation(),style:{backgroundColor:"var(--yc-color-surface)",color:"var(--yc-color-text)"},children:[e.jsx("h2",{className:"text-lg font-semibold mb-4",children:o==="add"?"Add data source":"Edit data source"}),e.jsxs("label",{className:"block text-sm mb-2",children:["Name",e.jsx("input",{"aria-label":"Name",className:"mt-1 w-full border rounded px-2 py-1",value:d,disabled:o==="edit",onChange:x=>l(x.target.value),style:{borderColor:"var(--yc-color-border)",backgroundColor:"var(--yc-color-bg)"}})]}),e.jsxs("label",{className:"block text-sm mb-2",children:["Type",e.jsx("select",{"aria-label":"Type",className:"mt-1 w-full border rounded px-2 py-1",value:a,disabled:o==="edit",onChange:x=>{i(x.target.value),j(null)},style:{borderColor:"var(--yc-color-border)",backgroundColor:"var(--yc-color-bg)"},children:de.map(x=>e.jsx("option",{value:x,children:x},x))})]}),E[a].map(x=>e.jsxs("label",{className:"block text-sm mb-2",children:[x.label,e.jsx("input",{"aria-label":x.label,type:x.secret?"password":"text",className:"mt-1 w-full border rounded px-2 py-1",placeholder:o==="edit"&&x.secret?"Leave blank to keep current":void 0,value:p[x.key]??"",onChange:w=>g(S=>({...S,[x.key]:w.target.value})),style:{borderColor:"var(--yc-color-border)",backgroundColor:"var(--yc-color-bg)"}})]},x.key)),u&&e.jsx("p",{className:u.status==="healthy"?"text-green-600":"text-red-600",children:u.status==="healthy"?`Healthy (${u.latencyMs}ms)`:`Unhealthy: ${u.error}`}),m&&e.jsx("p",{className:"text-red-600 text-sm",children:m}),e.jsxs("div",{className:"flex gap-2 justify-end mt-4",children:[e.jsx("button",{className:"px-3 py-1",onClick:n,children:"Cancel"}),e.jsx("button",{className:"px-3 py-1 border rounded",disabled:v,onClick:c,children:"Test"}),e.jsx("button",{className:"px-3 py-1 bg-blue-600 text-white rounded",disabled:v,onClick:k,children:"Save"})]})]})})}function D({label:o,value:t}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx("span",{style:{fontSize:"18px",fontWeight:600,color:"var(--yc-color-text)"},children:t}),e.jsx("span",{style:{fontSize:"12px",color:"var(--yc-color-text-secondary)"},children:o})]})}const q={fontSize:"13px",fontWeight:500,background:"none",border:"none",padding:0,cursor:"pointer"};function xe({source:o,onOpen:t,admin:n,onEdit:s,onDelete:a}){const i=(n==null?void 0:n.source)==="runtime",d=(n==null?void 0:n.source)==="git";return e.jsxs("div",{onClick:()=>t(o.name),style:{border:"1px solid var(--yc-color-border)",borderRadius:"8px",padding:"16px",background:"var(--yc-color-surface)",cursor:"pointer",display:"flex",flexDirection:"column",gap:"12px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:"15px",fontWeight:600,color:"var(--yc-color-text)"},children:o.name}),e.jsx("span",{style:{fontSize:"11px",fontWeight:500,padding:"2px 8px",borderRadius:"9999px",background:"var(--yc-color-bg)",color:"var(--yc-color-text-secondary)",border:"1px solid var(--yc-color-border)",letterSpacing:"0.04em"},children:o.type.toUpperCase()})]}),e.jsxs("div",{style:{display:"flex",gap:"24px"},children:[e.jsx(D,{label:"Tables",value:o.counts.tables}),e.jsx(D,{label:"Hunches",value:o.counts.pendingHunches}),e.jsx(D,{label:"Blindspots",value:o.counts.openBlindspots})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[e.jsx("button",{onClick:l=>{l.stopPropagation(),t(o.name)},style:{...q,color:"var(--yc-color-primary)"},children:"Open →"}),i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:l=>{l.stopPropagation(),s==null||s(n)},style:{...q,color:"var(--yc-color-text-secondary)"},children:"Edit"}),e.jsx("button",{onClick:l=>{l.stopPropagation(),a==null||a(n)},style:{...q,color:"var(--yc-color-danger)"},children:"Delete"})]}),d&&e.jsx("span",{title:"Defined in your project's connections/ directory — edit it in Git.",style:{fontSize:"11px",color:"var(--yc-color-text-secondary)",border:"1px solid var(--yc-color-border)",borderRadius:"9999px",padding:"2px 8px"},children:"managed in Git"})]})]})}function me(o){if(o&&typeof o=="object"&&"data"in o){const t=o.data;if(Array.isArray(t==null?void 0:t.references))return t.references}return[]}function he(o){return{name:o.name,type:o.type,config:o.config??{},secrets:o.secrets}}function ge(){const o=J(),t=M(h=>h.auth),n=V(h=>h.setApplying),s=t.status==="disabled"||t.status==="authenticated"&&t.user.role==="admin",[a,i]=b.useState(null),[d,l]=b.useState(null),{data:p,isLoading:g,error:u}=P({queryKey:["sources"],queryFn:G}),{data:j}=P({queryKey:["admin","config"],queryFn:Y,enabled:s}),v={};for(const h of(j==null?void 0:j.connections)??[])v[h.name]=h;const r=h=>{window.location.hash=`/data/sources/${encodeURIComponent(h)}`},m=()=>{n(!0),o.invalidateQueries({queryKey:["sources"]}),o.invalidateQueries({queryKey:["admin","config"]})},y=async h=>{if(l(null),!!window.confirm(`Delete data source "${h.name}"? This applies on restart.`))try{await se(h.name),m()}catch(c){if(c instanceof Z&&c.status===409){const k=me(c);l(k.length?`In use by ${k.map(x=>`${x.kind} "${x.name}"`).join(", ")} — remove or update these first.`:c.message||`"${h.name}" is in use by charts or models — remove or update those first.`)}else l(c instanceof Error?c.message:"Delete failed")}};return e.jsxs("div",{className:"p-6 w-full",children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"var(--yc-color-text)"},children:"Data Sources"}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--yc-color-text-secondary)"},children:"Your connected data sources. Open one to browse its tables and add business context."})]}),s&&e.jsx("button",{onClick:()=>i({mode:"add"}),className:"text-sm font-medium rounded px-3 py-1.5",style:{backgroundColor:"var(--yc-color-primary)",color:"#fff"},children:"Add data source"})]}),d&&e.jsx("p",{className:"text-sm mb-3",style:{color:"var(--yc-color-danger)"},children:d}),u&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load sources."}),g?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):!p||p.length===0?e.jsxs("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:["No connections configured. Add one in your project's ",e.jsx("code",{children:"connections/"})," directory."]}):e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px, 1fr))",gap:"16px"},children:p.map(h=>e.jsx(xe,{source:h,onOpen:r,admin:s?v[h.name]:void 0,onEdit:c=>i({mode:"edit",initial:he(c)}),onDelete:y},h.name))}),a&&e.jsx(ye,{mode:a.mode,initial:a.mode==="edit"?a.initial:void 0,onClose:()=>i(null),onApplying:m})]})}function X(o){const t=o.match(/event:\s*(\w+)\s*\ndata:\s*(\{[\s\S]*\})/);if(!t)return null;try{return{event:t[1],data:JSON.parse(t[2])}}catch{return null}}async function R(o,t="pending"){const n=new URLSearchParams({status:t,...o?{connection:o}:{}}),s=await fetch(`/api/hunches?${n}`);if(!s.ok)throw new Error("Failed to load hunches");return s.json()}async function fe(o,t){return(await fetch(`/api/hunches/${o}/confirm`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t?{sql:t}:{})})).json()}async function be(o){return(await fetch(`/api/hunches/${o}/reject`,{method:"POST"})).json()}async function ve(o){return(await fetch(`/api/hunches/${o}/run`,{method:"POST"})).json()}async function je(o,t){const s=(await fetch("/api/learn",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connection:o})})).body.getReader(),a=new TextDecoder;let i="";for(;;){const{done:d,value:l}=await s.read();if(d)break;i+=a.decode(l,{stream:!0});const p=i.split(`
2
-
3
- `);i=p.pop()??"";for(const g of p){const u=X(g+`
4
-
5
- `);u&&t(u)}}}async function A(o="open",t){const n=new URLSearchParams({status:o});return t&&n.set("connection",t),(await fetch(`/api/blindspots?${n}`)).json()}async function ke(o,t){return(await fetch(`/api/blindspots/${o}/answer`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:t})})).json()}async function K(o){return(await fetch(`/api/blindspots/${o}/dismiss`,{method:"POST"})).json()}async function Se(o,t){const s=(await fetch("/api/blindspots/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connection:o})})).body.getReader(),a=new TextDecoder;let i="";for(;;){const{done:d,value:l}=await s.read();if(d)break;i+=a.decode(l,{stream:!0});const p=i.split(`
6
-
7
- `);i=p.pop()??"";for(const g of p){const u=X(g+`
8
-
9
- `);u&&t(u)}}}const B=Q(o=>({learning:!1,hunches:[],setLearning:t=>o({learning:t}),setPhase:t=>o({phase:t}),setHunches:t=>o({hunches:t}),removeHunch:t=>o(n=>({hunches:n.hunches.filter(s=>s.id!==t)}))}));function U({hunch:o,onConfirm:t,onReject:n,onRun:s,running:a,runError:i}){const[d,l]=b.useState(o.sql);return e.jsxs("div",{className:"rounded-lg p-4 mb-3",style:{border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:o.question}),o.confidence!=null&&e.jsxs("span",{className:"text-xs whitespace-nowrap",style:{color:"var(--yc-color-text-muted)"},children:[Math.round(o.confidence*100),"%"]})]}),o.rationale&&e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:o.rationale}),e.jsx("textarea",{className:"w-full font-mono text-sm mt-2 p-2 rounded",style:{backgroundColor:"var(--yc-color-input-bg)",border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},rows:3,value:d,onChange:p=>l(p.target.value),spellCheck:!1}),i&&e.jsx("p",{className:"text-xs mt-2",style:{color:"var(--yc-color-danger)"},children:i}),o.lastRunSample&&e.jsx("div",{className:"text-xs mt-2 overflow-auto max-h-40 rounded p-2",style:{backgroundColor:"var(--yc-color-input-bg)",color:"var(--yc-color-text-secondary)"},children:e.jsx("pre",{className:"font-mono",children:JSON.stringify(o.lastRunSample.rows.slice(0,5),null,2)})}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsx("button",{onClick:()=>t(o.id,d),className:"px-3 py-1 rounded text-white text-sm hover:opacity-90",style:{backgroundColor:"var(--yc-color-primary)"},children:"Confirm"}),e.jsx("button",{onClick:()=>s(o.id,d),disabled:a,className:"px-3 py-1 rounded text-sm hover:opacity-80 disabled:opacity-50",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},children:a?"Running…":"Run"}),e.jsx("button",{onClick:()=>n(o.id),className:"px-3 py-1 rounded text-sm hover:opacity-80",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text-secondary)"},children:"Reject"})]})]})}function we({connection:o}={}){var F,H,W;const{data:t}=L(),n=((F=t==null?void 0:t.defaults)==null?void 0:F.connection)??((W=(H=t==null?void 0:t.connections)==null?void 0:H[0])==null?void 0:W.name)??"",s=o??n,[a,i]=b.useState("pending"),d=B(f=>f.hunches),l=B(f=>f.setHunches),p=B(f=>f.removeHunch),[g,u]=b.useState(null),[j,v]=b.useState({}),{data:r,isLoading:m,error:y}=P({queryKey:["hunches",s,"pending"],queryFn:()=>R(s||void 0,"pending"),enabled:!!s&&a==="pending"}),{data:h,isLoading:c,error:k}=P({queryKey:["hunches",s,"confirmed"],queryFn:()=>R(s||void 0,"confirmed"),enabled:!!s&&a==="approved"});b.useEffect(()=>{r&&l(r)},[r,l]);const x=async(f,C)=>{p(f);try{await fe(f,C)}catch{l(await R(s||void 0,"pending"))}},w=async f=>{p(f);try{await be(f)}catch{l(await R(s||void 0,"pending"))}},S=async f=>{u(f),v(C=>{const T={...C};return delete T[f],T});try{const C=await ve(f);C.error?v(T=>({...T,[f]:C.error})):C.sample&&l(B.getState().hunches.map(T=>T.id===f?{...T,lastRunSample:C.sample}:T))}finally{u(null)}},$=(f,C)=>e.jsx("button",{onClick:()=>i(f),style:{color:a===f?"var(--yc-color-primary)":"var(--yc-color-text-secondary)",borderBottom:a===f?"2px solid var(--yc-color-primary)":"2px solid transparent",paddingBottom:"6px",marginRight:"16px",background:"none",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:a===f?600:400},children:C});return e.jsxs("div",{className:"p-6 max-w-3xl mx-auto w-full",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"var(--yc-color-text)"},children:"Hunches"}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--yc-color-text-secondary)"},children:"Confirm, edit, run, or reject the questions learned from your source."}),e.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--yc-color-border)",marginBottom:"16px"},children:[$("pending","Pending"),$("approved","Approved")]}),a==="pending"&&e.jsxs(e.Fragment,{children:[!s&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No connection configured."}),y&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load hunches."}),m?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):d.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No pending hunches. Learn this source to generate some."}):d.map(f=>e.jsx(U,{hunch:f,onConfirm:x,onReject:w,onRun:S,running:g===f.id,runError:j[f.id]},f.id))]}),a==="approved"&&e.jsxs(e.Fragment,{children:[k&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load approved hunches."}),c?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):!h||h.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No approved hunches yet. Confirm some from the Pending tab."}):h.map(f=>e.jsx(U,{hunch:f,onConfirm:x,onReject:w,onRun:S,running:g===f.id},f.id))]})]})}const O=Q(o=>({scanning:!1,blindspots:[],setScanning:t=>o({scanning:t}),setPhase:t=>o({phase:t}),setBlindspots:t=>o({blindspots:t}),removeBlindspot:t=>o(n=>({blindspots:n.blindspots.filter(s=>s.id!==t)}))}));function Ce({blindspot:o,onAnswer:t,onDismiss:n,onAccept:s}){const[a,i]=b.useState(""),d=o.kind==="opportunity";return e.jsxs("div",{className:"rounded-lg p-4 mb-3",style:{border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)"},children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text-secondary)"},children:d?"opportunity":"context"}),e.jsx("h3",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:o.title})]}),e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:o.detail}),d&&o.suggestedModel&&e.jsxs("div",{className:"text-xs mt-2 p-2 rounded",style:{backgroundColor:"var(--yc-color-input-bg)"},children:[e.jsx("div",{className:"font-mono",style:{color:"var(--yc-color-text)"},children:o.suggestedModel.name}),e.jsx("div",{style:{color:"var(--yc-color-text-secondary)"},children:o.suggestedModel.description}),o.suggestedModel.columns.length>0&&e.jsxs("div",{className:"mt-1",style:{color:"var(--yc-color-text-secondary)"},children:["cols: ",o.suggestedModel.columns.map(l=>l.name).join(", ")]})]}),!d&&e.jsx("textarea",{className:"w-full text-sm mt-2 p-2 rounded",style:{backgroundColor:"var(--yc-color-input-bg)",border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text)"},rows:2,placeholder:"Explain this in business terms…",value:a,onChange:l=>i(l.target.value)}),e.jsxs("div",{className:"flex gap-2 mt-3",children:[d?e.jsx("button",{onClick:()=>s(o.id),className:"px-3 py-1 rounded text-white text-sm hover:opacity-90",style:{backgroundColor:"var(--yc-color-primary)"},children:"Accept"}):e.jsx("button",{onClick:()=>t(o.id,a),className:"px-3 py-1 rounded text-white text-sm hover:opacity-90",style:{backgroundColor:"var(--yc-color-primary)"},children:"Save"}),e.jsx("button",{onClick:()=>n(o.id),className:"px-3 py-1 rounded text-sm hover:opacity-80",style:{border:"1px solid var(--yc-color-border)",color:"var(--yc-color-text-secondary)"},children:"Dismiss"})]})]})}function Ne({connection:o}={}){var m,y,h;const{data:t}=L(),n=((m=t==null?void 0:t.defaults)==null?void 0:m.connection)??((h=(y=t==null?void 0:t.connections)==null?void 0:y[0])==null?void 0:h.name)??"",s=o??n,a=O(c=>c.blindspots),i=O(c=>c.setBlindspots),d=O(c=>c.removeBlindspot),l=ee(c=>c.addToast),{data:p,isLoading:g,error:u}=P({queryKey:["blindspots",s,"open"],queryFn:()=>A("open",s||void 0),enabled:!!s});b.useEffect(()=>{p&&i(p)},[p,i]);const j=async(c,k)=>{if(k.trim()){d(c);try{await ke(c,k)}catch{i(await A("open",s||void 0))}}},v=async c=>{d(c);try{await K(c)}catch{i(await A("open",s||void 0))}},r=async c=>{d(c);try{await K(c),l("Sent to the dbt advisor — coming soon")}catch{i(await A("open",s||void 0))}};return e.jsxs("div",{className:"p-6 max-w-3xl mx-auto w-full",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"var(--yc-color-text)"},children:"Blindspots"}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--yc-color-text-secondary)"},children:"Where the system lacks business context, plus useful marts it thinks are missing."}),u&&e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-danger)"},children:"Failed to load blindspots."}),g?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):a.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:'No open blindspots. Use "Scan Data Source" to find some.'}):a.map(c=>e.jsx(Ce,{blindspot:c,onAnswer:j,onDismiss:v,onAccept:r},c.id))]})}function Te({connection:o}={}){var d,l,p;const{data:t}=L(),n=((d=t==null?void 0:t.defaults)==null?void 0:d.connection)??((p=(l=t==null?void 0:t.connections)==null?void 0:l[0])==null?void 0:p.name)??"",s=o??n,{data:a,isLoading:i}=P({queryKey:["coverage",s],queryFn:async()=>{const g=s?`?connection=${encodeURIComponent(s)}`:"";return(await fetch(`/api/coverage${g}`)).json()},enabled:!!s});return e.jsxs("div",{className:"p-6 max-w-3xl mx-auto w-full",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"var(--yc-color-text)"},children:"Coverage"}),e.jsx("p",{className:"text-sm mb-4",style:{color:"var(--yc-color-text-secondary)"},children:"How many hunches and blindspots each warehouse table has."}),i?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"Loading…"}):!a||a.length===0?e.jsx("p",{className:"text-sm",style:{color:"var(--yc-color-text-secondary)"},children:"No profile data yet. Run a scan to see coverage."}):e.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--yc-color-border)"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{backgroundColor:"var(--yc-color-surface)"},children:[e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontSize:"12px",fontWeight:600,color:"var(--yc-color-text-secondary)",borderBottom:"1px solid var(--yc-color-border)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Table"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"center",fontSize:"12px",fontWeight:600,color:"var(--yc-color-text-secondary)",borderBottom:"1px solid var(--yc-color-border)",textTransform:"uppercase",letterSpacing:"0.05em",width:"120px"},children:"Hunches"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"center",fontSize:"12px",fontWeight:600,color:"var(--yc-color-text-secondary)",borderBottom:"1px solid var(--yc-color-border)",textTransform:"uppercase",letterSpacing:"0.05em",width:"120px"},children:"Blindspots"})]})}),e.jsx("tbody",{children:a.map((g,u)=>e.jsxs("tr",{style:{borderBottom:u<a.length-1?"1px solid var(--yc-color-border)":"none"},children:[e.jsx("td",{style:{padding:"10px 16px",fontFamily:"monospace",fontSize:"13px",color:"var(--yc-color-text)"},children:g.name}),e.jsx("td",{style:{padding:"10px 16px",textAlign:"center"},children:e.jsx(_,{count:g.hunches,color:"green"})}),e.jsx("td",{style:{padding:"10px 16px",textAlign:"center"},children:e.jsx(_,{count:g.blindspots,color:"amber"})})]},g.name))})]})})]})}function _({count:o,color:t}){if(o===0)return e.jsx("span",{style:{display:"inline-block",minWidth:"28px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:500,textAlign:"center",backgroundColor:"var(--yc-color-surface)",color:"var(--yc-color-text-secondary)",border:"1px solid var(--yc-color-border)"},children:"0"});const n=t==="green"?{backgroundColor:"rgba(34, 197, 94, 0.15)",color:"#15803d",border:"1px solid rgba(34, 197, 94, 0.3)"}:{backgroundColor:"rgba(245, 158, 11, 0.15)",color:"#b45309",border:"1px solid rgba(245, 158, 11, 0.3)"};return e.jsx("span",{style:{display:"inline-block",minWidth:"28px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:600,textAlign:"center",...n},children:o})}function Be(o){return o==="profiling"?"Profiling source…":o==="generating"?"Generating hunches…":o==="blindspots"?"Scanning for blindspots…":o==="error"?"Something went wrong.":"Scanning…"}function I({connection:o,onComplete:t}){const[n,s]=b.useState(!1),[a,i]=b.useState(void 0),d=async()=>{if(!o)return;s(!0),i("profiling");let l=[],p=!1;try{if(await je(o,u=>{u.event==="status"?u.data.phase==="generating"&&i("generating"):u.event==="done"?l=u.data.hunches??[]:u.event==="error"&&(p=!0,i("error"))}),p)return;i("blindspots");let g=[];await Se(o,u=>{u.event==="done"?g=u.data.blindspots??[]:u.event==="error"&&(p=!0,i("error"))}),p||t(l,g)}catch{i("error")}finally{s(!1)}};return e.jsxs("div",{className:"rounded-lg p-5 mb-4 flex items-center justify-between gap-4",style:{border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)"},children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",style:{color:"var(--yc-color-text)"},children:"Scan Data Source"}),e.jsx("p",{className:"text-sm mt-1",style:{color:"var(--yc-color-text-secondary)"},children:o?e.jsxs(e.Fragment,{children:["Profile ",e.jsx("span",{className:"font-mono",children:o}),", generate hunches, and scan for blindspots."]}):"No connection configured."}),n&&e.jsx("p",{className:"text-sm mt-2",style:{color:"var(--yc-color-primary)"},children:Be(a)}),a==="error"&&!n&&e.jsx("p",{className:"text-sm mt-2",style:{color:"var(--yc-color-danger)"},children:"Something went wrong. Please try again."})]}),e.jsx("button",{onClick:d,disabled:n||!o,className:"px-4 py-2 rounded text-white text-sm whitespace-nowrap hover:opacity-90 disabled:opacity-50",style:{backgroundColor:"var(--yc-color-primary)"},children:n?"Scanning…":"Scan Data Source"})]})}function Pe({onApplying:o}){const[t,n]=b.useState(""),[s,a]=b.useState(!1),[i,d]=b.useState(null),l=async v=>{a(!0),d(null);try{await v()}catch(r){d({kind:"err",text:r instanceof Error?r.message:"Failed"})}finally{a(!1)}},p=()=>l(async()=>{const v=await re(t);d(v.ok?{kind:"ok",text:"Connection OK — schema ready."}:{kind:"err",text:v.error??"Connection failed"})}),g=()=>l(async()=>{const r=(await ae(t)).migrated;d({kind:"ok",text:`Copied ${r.hunches} hunches, ${r.blindspots} blindspots, ${r.knowledgeDocs} docs, ${r.embeddings} embeddings.`})}),u=()=>l(async()=>{const v=await ce();d({kind:"ok",text:`Rebuilt ${v.embedded} embeddings.`})}),j=()=>l(async()=>{await ne(t),o()});return e.jsxs("div",{style:{padding:"24px",maxWidth:640},children:[e.jsx("h3",{style:{fontSize:16,fontWeight:600,marginBottom:8},children:"Knowledge database"}),e.jsx("p",{style:{fontSize:13,color:"var(--yc-color-text-secondary)",marginBottom:16},children:"Postgres connection for learned Hunches, Blindspots, knowledge docs, and embeddings. Changing it restarts the server."}),e.jsx("label",{htmlFor:"kdb-url",style:{display:"block",fontSize:13,marginBottom:4},children:"Database URL"}),e.jsx("input",{id:"kdb-url","aria-label":"Database URL",type:"password",value:t,onChange:v=>n(v.target.value),placeholder:"postgres://user:pass@host:5432/db",style:{width:"100%",padding:"6px 8px",borderRadius:6,border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)",color:"var(--yc-color-text)"}}),i&&e.jsx("p",{style:{marginTop:12,fontSize:13,color:i.kind==="ok"?"var(--yc-color-success, #16a34a)":"var(--yc-color-danger, #dc2626)"},children:i.text}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:16,flexWrap:"wrap"},children:[e.jsx("button",{disabled:s||!t.trim(),onClick:p,children:"Test"}),e.jsx("button",{disabled:s||!t.trim(),onClick:g,children:"Copy existing knowledge →"}),e.jsx("button",{disabled:s,onClick:u,children:"Rebuild embeddings now"}),e.jsx("button",{disabled:s||!t.trim(),onClick:j,style:{marginLeft:"auto",background:"var(--yc-color-primary)",color:"#fff",padding:"6px 14px",borderRadius:6},children:"Save & restart"})]})]})}const Re=["anthropic","openai","gemini","ollama","ollama_cloud","openai_compatible"],Ae=["hunch_generation","blindspot_scan","answer","advisor"];function Oe({onApplying:o}){const[t,n]=b.useState(null),[s,a]=b.useState(!1),[i,d]=b.useState(null);if(b.useEffect(()=>{Y().then(r=>n(r.ai??{providers:{}}))},[]),!t)return e.jsx("div",{style:{padding:24},children:"Loading…"});const l=t.providers??{},p=r=>n({...r}),g=(r,m)=>{const y=l[r]??{provider:"anthropic"};p({...t,providers:{...l,[r]:{...y,...m}}})},u=async r=>{a(!0),d(null);try{await r()}catch(m){d({kind:"err",text:m instanceof Error?m.message:"Failed"})}finally{a(!1)}},j=r=>u(async()=>{const m=l[r],y=m.api_key&&m.api_key.startsWith("••••")?{...m,api_key:void 0}:m,h=await ie(y,"llm");d(h.ok?{kind:"ok",text:`${r}: OK`}:{kind:"err",text:`${r}: ${h.error??"failed"}`})}),v=()=>u(async()=>{var m,y,h;const r=JSON.parse(JSON.stringify(t));for(const c of Object.values(r.providers??{}))(m=c.api_key)!=null&&m.startsWith("••••")&&delete c.api_key;(h=(y=r.embedding)==null?void 0:y.api_key)!=null&&h.startsWith("••••")&&delete r.embedding.api_key,r.tasks&&(r.tasks=Object.fromEntries(Object.entries(r.tasks).filter(([,c])=>c))),await le(r),o()});return e.jsxs("div",{style:{padding:24,maxWidth:720},children:[e.jsx("h3",{style:{fontSize:16,fontWeight:600,marginBottom:8},children:"AI providers"}),e.jsx("p",{style:{fontSize:13,color:"var(--yc-color-text-secondary)",marginBottom:16},children:"Configure the LLM providers, per-task routing, and the embedding model. API keys are encrypted at rest; saving restarts the server."}),e.jsxs("label",{style:{display:"block",fontSize:13,marginBottom:12},children:["Default provider",e.jsx("input",{"aria-label":"Default provider",value:t.default??"",onChange:r=>p({...t,default:r.target.value}),style:{display:"block",marginTop:4,padding:"6px 8px",borderRadius:6,border:"1px solid var(--yc-color-border)",background:"var(--yc-color-surface)",color:"var(--yc-color-text)"}})]}),Object.entries(l).map(([r,m])=>e.jsxs("div",{style:{border:"1px solid var(--yc-color-border)",borderRadius:8,padding:12,marginBottom:12},children:[e.jsx("strong",{style:{fontSize:14},children:r}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,marginTop:8},children:[e.jsxs("label",{style:{fontSize:12},children:["Type",e.jsx("select",{"aria-label":`${r} type`,value:m.provider,onChange:y=>g(r,{provider:y.target.value}),style:{display:"block",width:"100%",marginTop:2},children:Re.map(y=>e.jsx("option",{value:y,children:y},y))})]}),e.jsxs("label",{style:{fontSize:12},children:["Model",e.jsx("input",{"aria-label":`${r} model`,value:m.model??"",onChange:y=>g(r,{model:y.target.value}),style:{display:"block",width:"100%",marginTop:2}})]}),e.jsxs("label",{style:{fontSize:12},children:["Base URL",e.jsx("input",{"aria-label":`${r} base_url`,value:m.base_url??"",onChange:y=>g(r,{base_url:y.target.value}),style:{display:"block",width:"100%",marginTop:2}})]}),e.jsxs("label",{style:{fontSize:12},children:["API key",e.jsx("input",{"aria-label":`${r} api_key`,type:"password",placeholder:"leave blank to keep current",value:m.api_key??"",onChange:y=>g(r,{api_key:y.target.value}),style:{display:"block",width:"100%",marginTop:2}})]})]}),e.jsx("button",{disabled:s,onClick:()=>j(r),style:{marginTop:8},children:"Test"})]},r)),e.jsx("h4",{style:{fontSize:14,fontWeight:600,margin:"16px 0 8px"},children:"Task routing"}),Ae.map(r=>{var m;return e.jsxs("label",{style:{display:"block",fontSize:13,marginBottom:6},children:[r,e.jsxs("select",{"aria-label":`route ${r}`,value:((m=t.tasks)==null?void 0:m[r])??"",onChange:y=>p({...t,tasks:{...t.tasks,[r]:y.target.value}}),style:{marginLeft:8},children:[e.jsx("option",{value:"",children:"(default)"}),Object.keys(l).map(y=>e.jsx("option",{value:y,children:y},y))]})]},r)}),i&&e.jsx("p",{style:{marginTop:12,fontSize:13,color:i.kind==="ok"?"var(--yc-color-success, #16a34a)":"var(--yc-color-danger, #dc2626)"},children:i.text}),e.jsx("div",{style:{marginTop:16},children:e.jsx("button",{disabled:s,onClick:v,style:{background:"var(--yc-color-primary)",color:"#fff",padding:"6px 14px",borderRadius:6},children:"Save & restart"})})]})}const De=[{id:"sources",label:"Data Sources"},{id:"hunches",label:"Hunches"},{id:"blindspots",label:"Blindspots"},{id:"coverage",label:"Coverage"}];function z({value:o,onChange:t}){const{data:n}=P({queryKey:["sources"],queryFn:G});return e.jsxs("div",{style:{padding:"12px 24px 0",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("label",{htmlFor:"source-selector",style:{fontSize:"13px",color:"var(--yc-color-text-secondary)",whiteSpace:"nowrap"},children:"Source:"}),e.jsxs("select",{id:"source-selector",value:o,onChange:s=>t(s.target.value),style:{fontSize:"13px",padding:"4px 8px",borderRadius:"6px",border:"1px solid var(--yc-color-border)",backgroundColor:"var(--yc-color-surface)",color:"var(--yc-color-text)",cursor:"pointer"},children:[e.jsx("option",{value:"",children:"All sources"}),n==null?void 0:n.map(s=>e.jsx("option",{value:s.name,children:s.name},s.name))]})]})}function Le({tab:o,onTabChange:t}){const[n,s]=b.useState(""),[a,i]=b.useState(""),[d,l]=b.useState(""),p=M(c=>c.auth),g=p.status==="disabled"||p.status==="authenticated"&&p.user.role==="admin",u=V(c=>c.setApplying),j=J(),v=B(c=>c.setHunches),r=O(c=>c.setBlindspots),m=o==="blindspots"?a:n,y=(c,k)=>{const x=new Set(B.getState().hunches.map(S=>S.id)),w=c.filter(S=>!x.has(S.id));v([...w,...B.getState().hunches]),r(k),j.invalidateQueries({queryKey:["hunches"]}),j.invalidateQueries({queryKey:["blindspots"]})},h=(c,k)=>e.jsx("button",{onClick:()=>t(c),style:{color:o===c?"var(--yc-color-primary)":"var(--yc-color-text-secondary)",borderBottom:o===c?"2px solid var(--yc-color-primary)":"2px solid transparent",paddingBottom:"6px",marginRight:"16px",background:"none",border:"none",cursor:"pointer",fontSize:"14px",fontWeight:o===c?600:400},children:k},c);return e.jsxs("div",{className:"flex flex-col h-full w-full",children:[e.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--yc-color-border)",padding:"16px 24px 0"},children:[De.map(c=>h(c.id,c.label)),g&&h("settings","Settings")]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o==="sources"&&e.jsx(ge,{}),o==="hunches"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{value:n,onChange:s}),m&&e.jsx("div",{className:"px-6 pt-4",children:e.jsx(I,{connection:m,onComplete:y})}),e.jsx(we,{connection:n||void 0})]}),o==="blindspots"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{value:a,onChange:i}),m&&e.jsx("div",{className:"px-6 pt-4",children:e.jsx(I,{connection:m,onComplete:y})}),e.jsx(Ne,{connection:a||void 0})]}),o==="coverage"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{value:d,onChange:l}),e.jsx(Te,{connection:d||void 0})]}),o==="settings"&&g&&e.jsxs(e.Fragment,{children:[e.jsx(Pe,{onApplying:()=>u(!0)}),e.jsx(Oe,{onApplying:()=>u(!0)})]})]})]})}export{Le as DataView};