@duckcodeailabs/dql-cli 1.12.10 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps-api.d.ts +151 -3
- package/dist/apps-api.d.ts.map +1 -1
- package/dist/apps-api.js +675 -97
- package/dist/apps-api.js.map +1 -1
- package/dist/assets/dql-notebook/assets/AgentAnswerCard-Cp0eh6zU.js +5 -0
- package/dist/assets/dql-notebook/assets/{AgentLogPage-uvVs284-.js → AgentLogPage-CBGEoGmU.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-DEUS19WF.js → AiBuildDialog-CwAD3tXE.js} +1 -1
- package/dist/assets/dql-notebook/assets/AiBuildResult-CyqTuQe5.js +33 -0
- package/dist/assets/dql-notebook/assets/AiSidePanel-DjB8PWHG.js +6 -0
- package/dist/assets/dql-notebook/assets/AnalyticsHome-B7BkvA-R.js +6 -0
- package/dist/assets/dql-notebook/assets/AppsView-CUrqtEGC.js +4583 -0
- package/dist/assets/dql-notebook/assets/BlockStudio-Bl0aGQJR.js +60 -0
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-D8FIgrkF.js → BusinessArtifactView-C4SZVNW-.js} +1 -1
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-B0uxitnx.js +22 -0
- package/dist/assets/dql-notebook/assets/GitPage-BfVD4tVq.js +7 -0
- package/dist/assets/dql-notebook/assets/GlobalAiRail-DUwdy3fB.js +1 -0
- package/dist/assets/dql-notebook/assets/GovernedContextPage-D9f26ZFb.js +7 -0
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-Bc5pLakt.js → HelpDocsPage-BDPNVot1.js} +3 -3
- package/dist/assets/dql-notebook/assets/{HomePage-DQSo-K4y.js → HomePage-DiOnRhEG.js} +9 -4
- package/dist/assets/dql-notebook/assets/LineageDAG-BiUFX2KL.js +1 -0
- package/dist/assets/dql-notebook/assets/{LineageDetailView-CZEx2r1H.js → LineageDetailView-CfbSvlPJ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-P7ZdOW8-.js → LineageDrawer-CgTScaGB.js} +1 -1
- package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-D7ZA7k68.js +14 -0
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-Ctp_yFh8.js → MiniLineageGraph-GkD4y17x.js} +1 -1
- package/dist/assets/dql-notebook/assets/NewBlockModal-B9TfRjt7.js +1 -0
- package/dist/assets/dql-notebook/assets/NewNotebookModal-BbO9NKUl.js +46 -0
- package/dist/assets/dql-notebook/assets/NotebookEditor-CuMpvXR9.js +200 -0
- package/dist/assets/dql-notebook/assets/ReadinessPage-BROJ9YBM.js +1 -0
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-DX2f53J2.js → SetupOnboarding-BCcZlpuQ.js} +2 -2
- package/dist/assets/dql-notebook/assets/{TrustBadge-DPnKzRSY.js → TrustBadge-vQQh8d0D.js} +1 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-Dj4AXAhT.js +83 -0
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-Bm9oByWA.js → answer-to-notebook-DuqCcDDl.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-D2FbLWqh.js → arrow-left-CMe1kkOL.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-OYItAZ-s.js → arrow-right-DvB_DONr.js} +2 -2
- package/dist/assets/dql-notebook/assets/{book-open-text-BnnirfAc.js → book-open-text-CJ3NAvrs.js} +1 -1
- package/dist/assets/dql-notebook/assets/{bot-BJNxPYFm.js → bot-CV8DYRrt.js} +1 -1
- package/dist/assets/dql-notebook/assets/{chevron-up-DM5LX-26.js → chevron-up-HxU1l85K.js} +2 -2
- package/dist/assets/dql-notebook/assets/{circle-x-Dic_-4tF.js → circle-x-BCgtha1W.js} +1 -1
- package/dist/assets/dql-notebook/assets/{codemirror-1_I9gm6Z.js → codemirror-DXt7RW72.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-C9zxjHHX.js → dagre.esm-GKp7qoUL.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-DHxAcoCE.js → external-link-C-PXokWV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-02I-EOjL.js → grip-vertical-B4EHbGXW.js} +1 -1
- package/dist/assets/dql-notebook/assets/index-1mIC_XX4.js +634 -0
- package/dist/assets/dql-notebook/assets/{link-2-Delh-lai.js → link-2-BLx-goet.js} +2 -2
- package/dist/assets/dql-notebook/assets/{list-tree-BrIZg6l6.js → list-tree-BRFpEmvV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{maximize-2-CQOA-bbN.js → maximize-2-CCd5uRIZ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-CUDBPkwe.js → minimize-2-CDwSCGlO.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-CwhZfkKJ.js → panel-right-open-CunA1xO7.js} +2 -2
- package/dist/assets/dql-notebook/assets/{pencil-Cf6-MgpT.js → pencil-D_I14Wyk.js} +2 -2
- package/dist/assets/dql-notebook/assets/{rotate-ccw-DndbJAiz.js → rotate-ccw-DOrfTZk8.js} +2 -2
- package/dist/assets/dql-notebook/assets/{semantic-fields-DwKPY_mU.js → semantic-fields-AfQvjt5R.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-DvcMC9wZ.js → star-DDhv4e8M.js} +2 -2
- package/dist/assets/dql-notebook/assets/{triangle-alert-DUf4Ook0.js → triangle-alert-2ZXx8wAu.js} +1 -1
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-3rzkZrqc.js +18 -0
- package/dist/assets/dql-notebook/assets/{user-round-DSt0xU3K.js → user-round-BA074kiQ.js} +3 -3
- package/dist/assets/dql-notebook/assets/{wand-sparkles-ro8Cq0ro.js → wand-sparkles-CEYHLt9b.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-DVJXehjU.js → workflow-CZtyrcR-.js} +2 -2
- package/dist/assets/dql-notebook/assets/{wrench-DxUnoHtz.js → wrench-Ong23-wu.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-9Gtb3EAd.js → x-CSo1M3tu.js} +2 -2
- package/dist/assets/dql-notebook/index.html +1 -1
- package/dist/llm/providers/dql-agent-provider.d.ts +4 -3
- package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
- package/dist/llm/providers/dql-agent-provider.js +13 -10
- package/dist/llm/providers/dql-agent-provider.js.map +1 -1
- package/dist/local-operation-coordinator.d.ts +59 -0
- package/dist/local-operation-coordinator.d.ts.map +1 -0
- package/dist/local-operation-coordinator.js +256 -0
- package/dist/local-operation-coordinator.js.map +1 -0
- package/dist/local-runtime.d.ts +89 -2
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +2158 -461
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +12 -11
- package/dist/project-refresh-coordinator.d.ts +19 -0
- package/dist/project-refresh-coordinator.d.ts.map +1 -0
- package/dist/project-refresh-coordinator.js +134 -0
- package/dist/project-refresh-coordinator.js.map +1 -0
- package/dist/project-refresh-worker.d.ts +13 -0
- package/dist/project-refresh-worker.d.ts.map +1 -0
- package/dist/project-refresh-worker.js +58 -0
- package/dist/project-refresh-worker.js.map +1 -0
- package/package.json +13 -11
- package/dist/assets/dql-notebook/assets/AgentAnswerCard-Dp4odOLE.js +0 -5
- package/dist/assets/dql-notebook/assets/AiBuildResult-B9KmBRsh.js +0 -33
- package/dist/assets/dql-notebook/assets/AiSidePanel-C7BZVSkM.js +0 -6
- package/dist/assets/dql-notebook/assets/AnalyticsHome-4TgtH6SB.js +0 -6
- package/dist/assets/dql-notebook/assets/AppsView-CnfNtk5W.js +0 -4466
- package/dist/assets/dql-notebook/assets/BlockStudio-DUXN3MKz.js +0 -60
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DR8hTZ95.js +0 -22
- package/dist/assets/dql-notebook/assets/GitPage-BS2sm9zh.js +0 -7
- package/dist/assets/dql-notebook/assets/GlobalAiRail-B_MZsB0z.js +0 -1
- package/dist/assets/dql-notebook/assets/GovernedContextPage-CNM5UCAH.js +0 -7
- package/dist/assets/dql-notebook/assets/LineageDAG-RdpWmGmR.js +0 -1
- package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-DTUMFkJ8.js +0 -14
- package/dist/assets/dql-notebook/assets/NewBlockModal-BLtjuWGy.js +0 -1
- package/dist/assets/dql-notebook/assets/NewNotebookModal-xgaKB2kI.js +0 -46
- package/dist/assets/dql-notebook/assets/NotebookEditor-D6RgLQw-.js +0 -202
- package/dist/assets/dql-notebook/assets/ReadinessPage-C8hATaT_.js +0 -1
- package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-CwxQ4T19.js +0 -83
- package/dist/assets/dql-notebook/assets/index-Ca3UeUWI.js +0 -644
- package/dist/assets/dql-notebook/assets/usePersistedAgentThreadId-DbdBi0oH.js +0 -18
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{g as C,r as W,j as n,t as R,aJ as be,L as ve,e as ge,h as je,S as se,b as Se,d as we}from"./index-Ca3UeUWI.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 Me=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],$e=C("code-xml",Me);/**
|
|
7
|
-
* @license lucide-react v0.563.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Ae=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],ke=C("file-search",Ae);/**
|
|
12
|
-
* @license lucide-react v0.563.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ze=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Mt=C("send",ze),_e=/date|time|_at$|_on$|timestamp/i;function Te(t){return typeof t=="number"||typeof t=="string"&&t!==""&&!isNaN(Number(t))}function Fe(t,s){if(_e.test(t))return"date";const e=s.slice(0,40).map(l=>l[t]).filter(l=>l!=null);return e.length===0?"string":e.every(l=>typeof l=="boolean")?"bool":e.every(l=>typeof l=="object")?"json":e.filter(Te).length/e.length>.8?"numeric":"string"}function $t(t){return t==="numeric"?"measure":t==="date"?"temporal":"dimension"}const le=/(?:^|_)(?:revenue|sales|spend|amount|price|cost|profit|income|expense|balance|budget|bookings|arr|mrr|gmv|fee|fees|charge|charges|tax|value)(?:_|$)/i,Ie=/(?:^|_)(?:percent|percentage|pct|ratio|share|conversion|churn|retention|utilization)(?:_|$)|(?:^|_)margin(?:_|$)/i,Ne=/(?:^|_)(?:count|orders?|customers?|accounts?|users?|products?|items?|units?|quantity|rank|position|days?|months?|years?|distinct)(?:_|$)/i,re=/(?:^|_)(?:average|avg|mean)(?:_|$)/i,We=/(?:^|_)(?:year|yr)$/i,Le=/(?:^|_)(?:month|month_num|month_number|month_of_year)$/i,Be=/(?:^|_)(?:date|day|month|quarter|year|time|timestamp)(?:_|$)|_(?:at|on)$/i,Ee=/^(\d{4})-(\d{2})$/,ee=/^(\d{4})-(\d{2})-(\d{2})$/,Pe=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?$/;function te(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"&&t.trim()!==""&&Number.isFinite(Number(t)))return Number(t)}function Re(t){if(t==="currency"||t==="percent"||t==="number")return t;if(t==="duration")return"number"}function He(t,s=[],e){const o=Re(e);if(o)return o;if(Le.test(t))return"month";if(We.test(t))return"year";if(Be.test(t))return"date";if(re.test(t)&&le.test(t))return"currency";if(Ie.test(t))return"percent";if(re.test(t))return"number";if(Ne.test(t))return"integer";if(le.test(t))return"currency";const l=s.filter(r=>r!=null&&r!=="");return l.length===0?"text":l.every(r=>typeof r=="boolean")?"boolean":l.every(r=>te(r)!==void 0)?"number":l.every(r=>typeof r=="object")?"json":"text"}function De(t,s=!1){return t?{notation:"compact",maximumFractionDigits:1}:s?{maximumFractionDigits:0}:{maximumFractionDigits:2}}function ne(t,s,e=[],o={}){if(s==null)return"";const l=He(t,e,o.format),r=te(s);if(l==="year"){const i=typeof s=="string"&&ee.test(s)?Number(s.slice(0,4)):r;if(i!==void 0&&Number.isInteger(i))return new Intl.NumberFormat("en-US",{useGrouping:!1,maximumFractionDigits:0}).format(i)}if(l==="month"){const i=Ue(s);if(i)return i}if(l==="date"&&typeof s=="string"){const i=Ve(s);if(i)return i}if(r!==void 0){if(l==="currency")return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",...o.compact?{notation:"compact",maximumFractionDigits:1}:{minimumFractionDigits:2,maximumFractionDigits:2}}).format(r);if(l==="percent"){const i=Math.abs(r)<=1?r:r/100;return new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:2}).format(i)}return new Intl.NumberFormat("en-US",De(!!o.compact,l==="integer")).format(r)}return l==="boolean"?s?"Yes":"No":l==="json"||typeof s=="object"?JSON.stringify(s):String(s)}function Oe(t,s,e){return ne(t,s,[s],{compact:!0,format:e})}function Ue(t){const s=te(t);if(s!==void 0&&Number.isInteger(s)&&s>=1&&s<=12)return new Intl.DateTimeFormat("en-US",{month:"short",timeZone:"UTC"}).format(new Date(Date.UTC(2e3,s-1,1)));if(typeof t!="string")return;const e=Ee.exec(t),o=ee.exec(t),l=e??o;if(!l)return;const r=Number(l[1]),i=Number(l[2]);if(!(i<1||i>12))return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",timeZone:"UTC"}).format(new Date(Date.UTC(r,i-1,1)))}function Ve(t){const s=ee.exec(t);if(s)return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",timeZone:"UTC"}).format(new Date(Date.UTC(Number(s[1]),Number(s[2])-1,Number(s[3]))));if(!Pe.test(t))return;const e=new Date(t);if(Number.isNaN(e.getTime()))return;const o=e.getUTCHours()===0&&e.getUTCMinutes()===0&&e.getUTCSeconds()===0;return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",...o?{}:{hour:"numeric",minute:"2-digit"},timeZone:"UTC"}).format(e)}const Ye=[25,50,100,500];function K(t){return typeof t=="number"?!0:typeof t=="string"?!isNaN(Number(t))&&t.trim()!=="":!1}function Ge(t){switch(t){case"numeric":return{icon:"#",color:"#79c0ff"};case"date":return{icon:"D",color:"#e3b341"};case"bool":return{icon:"B",color:"#a371f7"};case"json":return{icon:"{}",color:"#ff7b72"};case"string":default:return{icon:"A",color:"#56d364"}}}function Ze(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}function qe(t,s){return t==null?1:s==null?-1:K(t)&&K(s)?Number(t)-Number(s):String(t).localeCompare(String(s))}function Xe(t,s){const e=i=>i.includes(",")||i.includes('"')||i.includes(`
|
|
17
|
-
`)?`"${i.replace(/"/g,'""')}"`:i,o=t.columns.map(e).join(","),l=t.rows.map(i=>t.columns.map(k=>e(Ze(i[k]))).join(",")),r=[o,...l].join(`
|
|
18
|
-
`);ue(r,"export.csv","text/csv")}function Ke(t,s){const e=JSON.stringify(t.rows,null,2);ue(e,"export.json","application/json")}function ue(t,s,e){const o=new Blob([t],{type:e}),l=URL.createObjectURL(o),r=document.createElement("a");r.href=l,r.download=s,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(l)}function Je({dir:t,color:s}){return t?n.jsx("svg",{width:"8",height:"10",viewBox:"0 0 8 10",fill:s,style:{marginLeft:3,flexShrink:0},children:t==="asc"?n.jsx("path",{d:"M4 0L7 4H1L4 0Z"}):n.jsx("path",{d:"M4 10L1 6H7L4 10Z"})}):n.jsxs("svg",{width:"8",height:"10",viewBox:"0 0 8 10",fill:s,opacity:.3,style:{marginLeft:3,flexShrink:0},children:[n.jsx("path",{d:"M4 0L7 3.5H1L4 0Z"}),n.jsx("path",{d:"M4 10L1 6.5H7L4 10Z"})]})}function J({result:t,themeMode:s}){const e=R[s],[o,l]=W.useState(null),[r,i]=W.useState(null),[k,A]=W.useState(null),[y,g]=W.useState(""),[b,v]=W.useState(50),[w,p]=W.useState(0),u=W.useCallback(a=>{r===a?k==="asc"?A("desc"):k==="desc"?(i(null),A(null)):A("asc"):(i(a),A("asc")),p(0)},[r,k]),S=W.useMemo(()=>{if(!y.trim())return t.rows;const a=y.toLowerCase();return t.rows.filter(x=>t.columns.some($=>{const f=x[$];return f==null?!1:String(f).toLowerCase().includes(a)}))},[t.rows,t.columns,y]),m=W.useMemo(()=>{if(!r||!k)return S;const a=[...S];return a.sort((x,$)=>{const f=qe(x[r],$[r]);return k==="desc"?-f:f}),a},[S,r,k]),d=W.useMemo(()=>{const a=new Map;for(const x of t.columns)a.set(x,Fe(x,t.rows));return a},[t.columns,t.rows]),c=W.useMemo(()=>new Map(t.columns.map(a=>[a,t.rows.map(x=>x[a])])),[t.columns,t.rows]),[z,F]=W.useState(!1),T=Math.max(1,Math.ceil(m.length/b)),j=Math.min(w,T-1),_=m.slice(j*b,(j+1)*b);return t.columns.length===0?n.jsx("div",{style:{padding:"12px 16px",color:e.textMuted,fontSize:12,fontFamily:e.font,fontStyle:"italic"},children:"Query executed successfully. No columns to display."}):n.jsxs("div",{children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderBottom:`1px solid ${e.tableBorder}`,background:`${e.tableHeaderBg}60`,flexWrap:"wrap"},children:[n.jsxs("div",{style:{position:"relative",flex:"0 1 200px",minWidth:120},children:[n.jsx("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:e.textMuted,style:{position:"absolute",left:6,top:6},children:n.jsx("path",{d:"M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"})}),n.jsx("input",{value:y,onChange:a=>{g(a.target.value),p(0)},placeholder:"Filter rows...",style:{width:"100%",background:e.inputBg,border:`1px solid ${e.inputBorder}`,borderRadius:4,color:e.textPrimary,fontSize:11,fontFamily:e.font,padding:"3px 8px 3px 22px",outline:"none"}}),y&&n.jsx("button",{onClick:()=>g(""),style:{position:"absolute",right:4,top:3,background:"none",border:"none",color:e.textMuted,cursor:"pointer",fontSize:12,padding:"0 2px"},children:"×"})]}),n.jsxs("span",{style:{fontSize:10,color:e.textMuted,fontFamily:e.font},children:[y?`${m.length} of ${t.rows.length}`:`${t.rows.length}`," ",t.rows.length===1?"row":"rows"]}),n.jsx("div",{style:{flex:1}}),n.jsx(ie,{label:"CSV",onClick:()=>Xe(t),t:e}),n.jsx(ie,{label:"JSON",onClick:()=>Ke(t),t:e}),n.jsx("select",{value:b,onChange:a=>{v(Number(a.target.value)),p(0)},style:{background:e.inputBg,border:`1px solid ${e.inputBorder}`,borderRadius:3,color:e.textSecondary,fontSize:10,fontFamily:e.font,padding:"2px 4px",outline:"none"},children:Ye.map(a=>n.jsxs("option",{value:a,children:[a," / page"]},a))}),T>1&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[n.jsx(Y,{disabled:j===0,onClick:()=>p(0),t:e,children:"«"}),n.jsx(Y,{disabled:j===0,onClick:()=>p(j-1),t:e,children:"‹"}),n.jsxs("span",{style:{fontSize:10,color:e.textSecondary,fontFamily:e.font,padding:"0 4px"},children:[j+1,"/",T]}),n.jsx(Y,{disabled:j>=T-1,onClick:()=>p(j+1),t:e,children:"›"}),n.jsx(Y,{disabled:j>=T-1,onClick:()=>p(T-1),t:e,children:"»"})]})]}),n.jsx("div",{style:{maxHeight:440,overflow:"auto",position:"relative"},onScroll:a=>F(a.target.scrollTop>0),children:n.jsxs("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:0,tableLayout:"auto",fontSize:12.5,fontFamily:e.fontMono},children:[n.jsx("thead",{children:n.jsx("tr",{children:t.columns.map(a=>{const x=d.get(a)??"string",$=x==="numeric";return n.jsx("th",{onClick:()=>u(a),style:{background:e.tableHeaderBg,color:e.textSecondary,fontWeight:600,fontSize:11,textAlign:$?"right":"left",padding:"8px 14px",borderBottom:`1px solid ${e.tableBorder}`,minWidth:80,maxWidth:320,whiteSpace:"nowrap",position:"sticky",top:0,zIndex:1,fontFamily:e.font,letterSpacing:"0.03em",overflow:"hidden",textOverflow:"ellipsis",cursor:"pointer",userSelect:"none",boxShadow:z?"0 2px 4px -2px rgba(0,0,0,0.18)":"none",transition:"background 0.1s, box-shadow 0.18s"},children:n.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,justifyContent:$?"flex-end":"flex-start"},children:[(()=>{const f=Ge(x);return n.jsx("span",{title:x,style:{fontSize:9,fontFamily:e.fontMono,fontWeight:700,color:f.color,background:`${f.color}15`,border:`1px solid ${f.color}40`,borderRadius:3,padding:"0 4px",minWidth:14,textAlign:"center",lineHeight:"14px",flexShrink:0},children:f.icon})})(),n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a}),n.jsx(Je,{dir:r===a?k:null,color:r===a?e.accent:e.textMuted})]})},a)})})}),n.jsx("tbody",{children:_.map((a,x)=>{const $=o===x,I=x%2===1?e.tableHeaderBg:"transparent";return n.jsx("tr",{onMouseEnter:()=>l(x),onMouseLeave:()=>l(null),style:{transition:"background 0.1s"},children:t.columns.map(L=>{const B=a[L],h=B==null,M=K(B);return n.jsx("td",{style:{padding:"7px 14px",borderBottom:`1px solid ${e.tableBorder}`,background:$?e.tableRowHover:I,color:h?e.textMuted:e.textPrimary,fontStyle:h?"italic":"normal",fontVariantNumeric:M?"tabular-nums":"normal",textAlign:M?"right":"left",whiteSpace:"nowrap",maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",transition:"background 0.1s"},children:h?"—":ne(L,B,c.get(L)??[])},L)})},x)})})]})}),n.jsxs("div",{style:{padding:"5px 10px",color:e.textMuted,fontSize:10,fontFamily:e.font,borderTop:`1px solid ${e.tableBorder}`,background:`${e.tableHeaderBg}60`,display:"flex",alignItems:"center",gap:4},children:[T>1&&n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[n.jsx(Y,{disabled:j===0,onClick:()=>p(j-1),t:e,children:"‹"}),Qe(T,j).map((a,x)=>a==="…"?n.jsx("span",{style:{color:e.textMuted,fontSize:10,padding:"0 2px"},children:"…"},`gap-${x}`):n.jsx("button",{onClick:()=>p(a-1),style:{background:a-1===j?`${e.accent}20`:"transparent",border:"none",color:a-1===j?e.accent:e.textSecondary,fontSize:10,fontFamily:e.font,fontWeight:a-1===j?700:400,padding:"1px 6px",borderRadius:3,cursor:"pointer",minWidth:20},children:a},a)),n.jsx(Y,{disabled:j>=T-1,onClick:()=>p(j+1),t:e,children:"›"})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("span",{style:{fontSize:10,color:e.textSecondary,fontFamily:e.font,marginLeft:6,whiteSpace:"nowrap"},children:[m.length.toLocaleString()," ",m.length===1?"row":"rows",y&&t.rows.length!==m.length&&` of ${t.rows.length.toLocaleString()}`]})]})]})}function Qe(t,s){if(t<=7)return Array.from({length:t},(l,r)=>r+1);const e=s+1,o=[1];e>3&&o.push("…");for(let l=Math.max(2,e-1);l<=Math.min(t-1,e+1);l++)o.push(l);return e<t-2&&o.push("…"),o.push(t),o}function ie({label:t,onClick:s,t:e}){const[o,l]=W.useState(!1);return n.jsxs("button",{onClick:s,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),style:{background:o?e.btnHover:"transparent",border:`1px solid ${o?e.btnBorder:"transparent"}`,borderRadius:3,cursor:"pointer",color:o?e.textSecondary:e.textMuted,fontSize:10,fontFamily:e.font,fontWeight:600,padding:"2px 6px",transition:"all 0.15s",display:"flex",alignItems:"center",gap:3},children:[n.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 16 16",fill:"currentColor",children:[n.jsx("path",{d:"M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"}),n.jsx("path",{d:"M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.97a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.779a.749.749 0 1 1 1.06-1.06l1.97 1.97Z"})]}),t]})}function Y({disabled:t,onClick:s,children:e,t:o}){return n.jsx("button",{disabled:t,onClick:s,style:{background:"transparent",border:"none",cursor:t?"default":"pointer",color:t?o.textMuted:o.textSecondary,fontSize:12,fontFamily:o.font,padding:"0 3px",opacity:t?.4:1,transition:"opacity 0.1s"},children:e})}const At=[{value:"bar",label:"Bar"},{value:"grouped-bar",label:"Grouped Bar"},{value:"stacked-bar",label:"Stacked Bar"},{value:"line",label:"Line"},{value:"area",label:"Area"},{value:"scatter",label:"Scatter"},{value:"pie",label:"Pie"},{value:"donut",label:"Donut"},{value:"heatmap",label:"Heatmap"},{value:"histogram",label:"Histogram"},{value:"funnel",label:"Funnel"},{value:"sankey",label:"Sankey"},{value:"waterfall",label:"Waterfall"},{value:"gauge",label:"Gauge"},{value:"kpi",label:"KPI"}],Ce=/date|time|at|day|month|year/i,pe=/^(label|name|category|status|type|group)$/i,me=/^(value|count|total|revenue|amount|sum|avg|price|quantity|sales)$/i;function U(t){return typeof t=="number"?!0:typeof t=="string"?t.trim()!==""&&!isNaN(Number(t)):!1}function et(t){return typeof t=="string"||typeof t=="number"}const tt=new Set(["bar","line","area","pie","donut","scatter","heatmap","funnel","waterfall","histogram","gauge","stacked-bar","grouped-bar","sankey","kpi","table"]);function nt(t,s){if(s!=null&&s.chart){const e=s.chart.toLowerCase().replace(/_/g,"-");if(tt.has(e))return e}return ot(t)}function ot(t){const{columns:s,rows:e}=t;if(s.length<2||e.length===0)return"table";const o=s[0],l=s[1],r=e.slice(0,5),i=r.every(b=>U(b[l])),k=r.every(b=>et(b[o]));if(Ce.test(o)&&i&&k)return"line";const A=s.find(b=>pe.test(b)),y=s.find(b=>me.test(b));return A&&y&&r.every(v=>U(v[y]))?"bar":r.every(b=>U(b[o]))&&i&&s.length>=2?"scatter":s.length===2&&k&&i?"bar":"table"}const Q={default:["#388bfd","#56d364","#e3b341","#f78166","#a371f7","#39c5cf","#ffa657","#ff7b72","#89d185","#d2a8ff","#58a6ff","#3fb950"],warm:["#f85149","#f78166","#ffa657","#e3b341","#d29922","#db6d28","#ff7b72","#ffa198","#ffdfb6","#e6c174","#c4a35a","#b08c3e"],cool:["#388bfd","#58a6ff","#79c0ff","#39c5cf","#56d364","#3fb950","#a371f7","#d2a8ff","#bc8cff","#6cb6ff","#2ea043","#1f6feb"],mono:["#c9d1d9","#b1bac4","#8b949e","#6e7681","#484f58","#30363d","#21262d","#161b22","#a0a8b2","#9e9e9e","#757575","#616161"],pastel:["#b8d8f8","#b4e6c8","#f4e6a0","#f8c4a4","#d2b8f0","#a8e0e0","#f8d8a0","#f4b8b4","#c0e8c0","#e0d0f8","#a8d8f8","#b0e8b0"],corporate:["#2563eb","#16a34a","#7c3aed","#0891b2","#f59e0b","#dc2626","#475569","#0f766e","#9333ea","#0284c7","#65a30d","#ea580c"]};function D(t){return Q[t??"default"]??Q.default}function E(t,s="value",e){return Oe(s,t,e)}function ae(t,s=8){if(/^\d{4}-\d{2}(-\d{2})?/.test(t)){const e=/^\d{4}-\d{2}$/.test(t),o=new Date(e?`${t}-01T00:00:00Z`:t);if(!isNaN(o.getTime()))return o.toLocaleDateString("en-US",e?{year:"numeric",month:"short",timeZone:"UTC"}:{month:"short",day:"numeric",timeZone:"UTC"})}return String(t).length>s?String(t).slice(0,s):String(t)}function G(t,s){const e=(s!=null&&s.x&&t.columns.includes(s.x)?s.x:void 0)??t.columns.find(l=>pe.test(l))??t.columns[0],o=(s!=null&&s.y&&t.columns.includes(s.y)?s.y:void 0)??t.columns.find(l=>me.test(l))??t.columns[1];return{labelCol:e,valueCol:o}}const V=20;function oe({result:t,themeMode:s,chartConfig:e}){const o=R[s],[l,r]=W.useState(null),{labelCol:i,valueCol:k}=G(t,e),A=(e==null?void 0:e.maxItems)??V,y=D(e==null?void 0:e.colorPalette),g=t.rows.slice(0,A).map(d=>({label:String(d[i]??""),value:Number(d[k]??0)})),b=t.rows.length>A,v=Math.max(...g.map(d=>d.value),1),w=28,p=120,u=6,S=12,m=g.length*(w+u)+S*2;return n.jsxs("div",{style:{padding:"8px 0"},children:[n.jsx("svg",{width:"100%",height:m,viewBox:`0 0 600 ${m}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible"},children:g.map((d,c)=>{const z=S+c*(w+u),F=600-p-84,T=Math.max(d.value/v*F,2),j=l===c,_=y[c%y.length];return n.jsxs("g",{onMouseEnter:()=>r(c),onMouseLeave:()=>r(null),style:{cursor:"default"},children:[n.jsx("text",{x:p-8,y:z+w/2+4,textAnchor:"end",fontSize:11,fontFamily:o.font,fill:o.textSecondary,children:d.label.length>16?d.label.slice(0,15)+"…":d.label}),n.jsx("rect",{x:p,y:z,width:T,height:w,rx:3,fill:_,opacity:j?1:.88,style:{transition:"opacity 0.15s"}}),n.jsx("text",{x:p+T+6,y:z+w/2+4,textAnchor:"start",fontSize:11,fontFamily:o.fontMono,fill:o.textMuted,children:E(d.value,k,e==null?void 0:e.format)})]},c)})}),b&&n.jsxs("div",{style:{fontSize:11,color:o.textMuted,fontFamily:o.font,fontStyle:"italic",padding:"4px 12px"},children:["Showing ",V," of ",t.rows.length," rows"]})]})}function st({result:t,themeMode:s,chartConfig:e}){const o=R[s],[l,r]=W.useState(null),i=D(e==null?void 0:e.colorPalette),k=e!=null&&e.x&&t.columns.includes(e.x)?e.x:t.columns[0],A=t.rows.slice(0,5),y=t.columns.filter(d=>d!==k&&A.some(c=>U(c[d])));if(y.length===0)return n.jsx(oe,{result:t,themeMode:s,chartConfig:e});const g=t.rows.slice(0,V).map(d=>String(d[k]??"")),b=Math.max(...t.rows.slice(0,V).flatMap(d=>y.map(c=>Math.abs(Number(d[c]??0)))),1),v=24,w=v/y.length,p=120,u=12,S=8,m=g.length*(v+S)+u*2;return n.jsxs("div",{style:{padding:"8px 0"},children:[n.jsx("div",{style:{display:"flex",gap:12,padding:"0 12px 6px",flexWrap:"wrap"},children:y.map((d,c)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[n.jsx("div",{style:{width:10,height:10,borderRadius:2,background:i[c%i.length]}}),n.jsx("span",{style:{fontSize:10,fontFamily:o.font,color:o.textSecondary},children:d})]},d))}),n.jsx("svg",{width:"100%",height:m,viewBox:`0 0 600 ${m}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible"},children:g.map((d,c)=>{const z=u+c*(v+S),F=t.rows[c];return n.jsxs("g",{children:[n.jsx("text",{x:p-8,y:z+v/2+4,textAnchor:"end",fontSize:11,fontFamily:o.font,fill:o.textSecondary,children:d.length>16?d.slice(0,15)+"…":d}),y.map((T,j)=>{const _=Number(F[T]??0),a=600-p-60,x=Math.max(Math.abs(_)/b*a,1),$=z+j*w,f=`${c}-${j}`;return n.jsxs("g",{onMouseEnter:()=>r(f),onMouseLeave:()=>r(null),children:[n.jsx("rect",{x:p,y:$,width:x,height:w-1,rx:2,fill:i[j%i.length],opacity:l===f?1:.85,style:{transition:"opacity 0.15s"}}),l===f&&n.jsx("text",{x:p+x+4,y:$+w/2+3,fontSize:10,fontFamily:o.fontMono,fill:o.textMuted,children:E(_,T,e==null?void 0:e.format)})]},j)})]},c)})})]})}function lt({result:t,themeMode:s,chartConfig:e}){const o=R[s],[l,r]=W.useState(null),i=D(e==null?void 0:e.colorPalette),k=e!=null&&e.x&&t.columns.includes(e.x)?e.x:t.columns[0],A=t.rows.slice(0,5),y=t.columns.filter(d=>d!==k&&A.some(c=>U(c[d])));if(y.length===0)return n.jsx(oe,{result:t,themeMode:s,chartConfig:e});const g=t.rows.slice(0,V),b=g.map(d=>String(d[k]??"")),v=Math.max(...g.map(d=>y.reduce((c,z)=>c+Math.abs(Number(d[z]??0)),0)),1),w=28,p=120,u=12,S=6,m=b.length*(w+S)+u*2;return n.jsxs("div",{style:{padding:"8px 0"},children:[n.jsx("div",{style:{display:"flex",gap:12,padding:"0 12px 6px",flexWrap:"wrap"},children:y.map((d,c)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[n.jsx("div",{style:{width:10,height:10,borderRadius:2,background:i[c%i.length]}}),n.jsx("span",{style:{fontSize:10,fontFamily:o.font,color:o.textSecondary},children:d})]},d))}),n.jsx("svg",{width:"100%",height:m,viewBox:`0 0 600 ${m}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible"},children:b.map((d,c)=>{const z=u+c*(w+S),F=g[c],T=600-p-60;let j=p;return n.jsxs("g",{children:[n.jsx("text",{x:p-8,y:z+w/2+4,textAnchor:"end",fontSize:11,fontFamily:o.font,fill:o.textSecondary,children:d.length>16?d.slice(0,15)+"…":d}),y.map((_,a)=>{const x=Math.abs(Number(F[_]??0)),$=Math.max(x/v*T,0),f=j;j+=$;const I=`${c}-${a}`;return n.jsxs("g",{onMouseEnter:()=>r(I),onMouseLeave:()=>r(null),children:[n.jsx("rect",{x:f,y:z,width:$,height:w,rx:a===0?3:0,fill:i[a%i.length],opacity:l===I?1:.85,style:{transition:"opacity 0.15s"}}),l===I&&$>30&&n.jsx("text",{x:f+$/2,y:z+w/2+4,textAnchor:"middle",fontSize:10,fontFamily:o.fontMono,fill:"#fff",fontWeight:600,children:E(x,_,e==null?void 0:e.format)})]},a)})]},c)})})]})}function ce({result:t,themeMode:s,showArea:e,chartConfig:o}){const l=R[s],[r,i]=W.useState(null),A=D(o==null?void 0:o.colorPalette)[0]??l.accent,{labelCol:y,valueCol:g}=G(t,o),b=t.rows.map(M=>({label:String(M[y]??""),value:Number(M[g]??0)}));if(b.length<2)return null;const v=560,w=212,p=56,u=16,S=16,m=48,d=v-p-u,c=w-S-m,z=Math.min(...b.map(M=>M.value)),T=Math.max(...b.map(M=>M.value))-z||1,j=d/(b.length-1),_=M=>p+M*j,a=M=>S+c-(M-z)/T*c,x=b.map((M,N)=>({x:_(N),y:a(M.value)})),$=x.reduce((M,N,P)=>{if(P===0)return`M ${N.x},${N.y}`;const H=x[P-1],O=H.x+(N.x-H.x)/2;return`${M} C ${O},${H.y} ${O},${N.y} ${N.x},${N.y}`},""),f=`${$} L ${x[x.length-1].x},${S+c} L ${p},${S+c} Z`,I=5,L=Array.from({length:I+1},(M,N)=>{const P=z+T*N/I;return{val:P,y:a(P)}}),B=Math.ceil(b.length/8),h=b.filter((M,N)=>N%B===0||N===b.length-1);return n.jsx("div",{style:{position:"relative",padding:"8px 0"},children:n.jsxs("svg",{width:"100%",height:w,viewBox:`0 0 ${v} ${w}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible"},onMouseLeave:()=>i(null),children:[L.map((M,N)=>n.jsxs("g",{children:[n.jsx("line",{x1:p,y1:M.y,x2:p+d,y2:M.y,stroke:l.tableBorder,strokeWidth:.5}),n.jsx("text",{x:p-6,y:M.y+4,textAnchor:"end",fontSize:10,fontFamily:l.fontMono,fill:l.textMuted,children:E(M.val,g,o==null?void 0:o.format)})]},N)),n.jsx("path",{d:f,fill:A,opacity:e?.3:.15}),n.jsx("path",{d:$,fill:"none",stroke:A,strokeWidth:2,strokeLinejoin:"round"}),x.map((M,N)=>n.jsx("circle",{cx:M.x,cy:M.y,r:3,fill:A,style:{cursor:"crosshair"},onMouseEnter:()=>i({x:M.x,y:M.y,label:b[N].label,value:b[N].value})},N)),h.map((M,N)=>{const P=b.indexOf(M);return n.jsx("text",{x:_(P),y:S+c+16,textAnchor:"middle",fontSize:10,fontFamily:l.font,fill:l.textMuted,children:ae(M.label)},N)}),n.jsx("line",{x1:p,y1:S,x2:p,y2:S+c,stroke:l.tableBorder,strokeWidth:1}),n.jsx("line",{x1:p,y1:S+c,x2:p+d,y2:S+c,stroke:l.tableBorder,strokeWidth:1}),n.jsx("text",{x:p+d/2,y:w-4,textAnchor:"middle",fontSize:10,fontWeight:600,fontFamily:l.font,fill:l.textMuted,letterSpacing:"0.04em",children:y}),n.jsx("text",{x:12,y:S+c/2,textAnchor:"middle",fontSize:10,fontWeight:600,fontFamily:l.font,fill:l.textMuted,letterSpacing:"0.04em",transform:`rotate(-90, 12, ${S+c/2})`,children:g}),r&&n.jsxs("g",{children:[n.jsx("rect",{x:r.x+8,y:r.y-20,width:90,height:32,rx:4,fill:l.cellBg,stroke:l.cellBorder,strokeWidth:1}),n.jsx("text",{x:r.x+13,y:r.y-8,fontSize:10,fontFamily:l.font,fill:l.textSecondary,children:ae(r.label,12)}),n.jsx("text",{x:r.x+13,y:r.y+6,fontSize:11,fontFamily:l.fontMono,fill:l.textPrimary,fontWeight:600,children:E(r.value,g,o==null?void 0:o.format)})]})]})})}function rt({result:t,themeMode:s,chartConfig:e}){const o=R[s],[l,r]=W.useState(null),i=D(e==null?void 0:e.colorPalette),k=e!=null&&e.x&&t.columns.includes(e.x)?e.x:t.columns[0],A=e!=null&&e.y&&t.columns.includes(e.y)?e.y:t.columns[1],y=e!=null&&e.color&&t.columns.includes(e.color)?e.color:void 0,g=t.rows.slice(0,200).map(f=>({x:Number(f[k]??0),y:Number(f[A]??0),color:y?String(f[y]??""):void 0})),b=560,v=300,w=52,p=16,u=16,S=36,m=b-w-p,d=v-u-S,c=Math.min(...g.map(f=>f.x)),z=Math.max(...g.map(f=>f.x)),F=Math.min(...g.map(f=>f.y)),T=Math.max(...g.map(f=>f.y)),j=z-c||1,_=T-F||1,a=f=>w+(f-c)/j*m,x=f=>u+d-(f-F)/_*d,$=y?[...new Set(g.map(f=>f.color))]:[];return n.jsxs("div",{style:{padding:"8px 0"},children:[y&&$.length>0&&n.jsx("div",{style:{display:"flex",gap:12,padding:"0 12px 6px",flexWrap:"wrap"},children:$.slice(0,12).map((f,I)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[n.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i[I%i.length]}}),n.jsx("span",{style:{fontSize:10,fontFamily:o.font,color:o.textSecondary},children:f})]},f))}),n.jsxs("svg",{width:"100%",height:v,viewBox:`0 0 ${b} ${v}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible"},children:[Array.from({length:6},(f,I)=>{const L=F+_*I/5,B=x(L);return n.jsxs("g",{children:[n.jsx("line",{x1:w,y1:B,x2:w+m,y2:B,stroke:o.tableBorder,strokeWidth:.5}),n.jsx("text",{x:w-6,y:B+4,textAnchor:"end",fontSize:10,fontFamily:o.fontMono,fill:o.textMuted,children:E(L,A,e==null?void 0:e.format)})]},I)}),Array.from({length:6},(f,I)=>{const L=c+j*I/5,B=a(L);return n.jsx("text",{x:B,y:u+d+16,textAnchor:"middle",fontSize:10,fontFamily:o.fontMono,fill:o.textMuted,children:E(L,k)},I)}),n.jsx("line",{x1:w,y1:u,x2:w,y2:u+d,stroke:o.tableBorder,strokeWidth:1}),n.jsx("line",{x1:w,y1:u+d,x2:w+m,y2:u+d,stroke:o.tableBorder,strokeWidth:1}),n.jsx("text",{x:w+m/2,y:v-2,textAnchor:"middle",fontSize:10,fontFamily:o.font,fill:o.textMuted,children:k}),n.jsx("text",{x:10,y:u+d/2,textAnchor:"middle",fontSize:10,fontFamily:o.font,fill:o.textMuted,transform:`rotate(-90, 10, ${u+d/2})`,children:A}),g.map((f,I)=>{const L=y?$.indexOf(f.color):0;return n.jsx("circle",{cx:a(f.x),cy:x(f.y),r:l===I?5:3.5,fill:i[L%i.length],opacity:l===I?1:.7,style:{cursor:"crosshair",transition:"r 0.1s, opacity 0.1s"},onMouseEnter:()=>r(I),onMouseLeave:()=>r(null)},I)}),l!==null&&n.jsxs("g",{children:[n.jsx("rect",{x:a(g[l].x)+8,y:x(g[l].y)-24,width:100,height:28,rx:4,fill:o.cellBg,stroke:o.cellBorder,strokeWidth:1}),n.jsxs("text",{x:a(g[l].x)+13,y:x(g[l].y)-8,fontSize:10,fontFamily:o.fontMono,fill:o.textPrimary,children:["(",E(g[l].x,k),", ",E(g[l].y,A,e==null?void 0:e.format),")"]})]})]})]})}const it=12;function de({result:t,themeMode:s,chartConfig:e,isDonut:o}){const l=R[s],[r,i]=W.useState(null),{labelCol:k,valueCol:A}=G(t,e),y=D(e==null?void 0:e.colorPalette),g=t.rows.slice(0,it).map(c=>({label:String(c[k]??""),value:Math.abs(Number(c[A]??0))})),b=g.reduce((c,z)=>c+z.value,0)||1,v=90,w=90,p=70,u=o?40:0,S=[];let m=-Math.PI/2;g.forEach((c,z)=>{const F=c.value/b*2*Math.PI,T=m,j=m+F,_=v+p*Math.cos(T),a=w+p*Math.sin(T),x=v+p*Math.cos(j),$=w+p*Math.sin(j),f=F>Math.PI?1:0;let I;if(u>0){const L=v+u*Math.cos(T),B=w+u*Math.sin(T),h=v+u*Math.cos(j),M=w+u*Math.sin(j);I=`M ${_} ${a} A ${p} ${p} 0 ${f} 1 ${x} ${$} L ${h} ${M} A ${u} ${u} 0 ${f} 0 ${L} ${B} Z`}else I=`M ${v} ${w} L ${_} ${a} A ${p} ${p} 0 ${f} 1 ${x} ${$} Z`;S.push({path:I,color:y[z%y.length],label:c.label,value:c.value,pct:c.value/b*100}),m=j});const d=r!==null?S[r]:null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 12px",flexWrap:"wrap"},children:[n.jsxs("svg",{width:180,height:180,style:{flexShrink:0},onMouseLeave:()=>i(null),children:[S.map((c,z)=>n.jsx("path",{d:c.path,fill:c.color,opacity:r===null||r===z?1:.55,style:{cursor:"pointer",transition:"opacity 0.15s"},onMouseEnter:()=>i(z)},z)),o&&n.jsxs(n.Fragment,{children:[n.jsx("text",{x:v,y:w-5,textAnchor:"middle",fontSize:11,fontFamily:l.fontMono,fill:l.textSecondary,children:E(d?d.value:b,A,e==null?void 0:e.format)}),n.jsx("text",{x:v,y:w+9,textAnchor:"middle",fontSize:9,fontFamily:l.font,fill:l.textMuted,children:d?`${d.pct.toFixed(1)}%`:"total"})]})]}),n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,maxHeight:180,overflowY:"auto",flex:1},children:S.map((c,z)=>n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,cursor:"default",opacity:r===null||r===z?1:.5},onMouseEnter:()=>i(z),onMouseLeave:()=>i(null),children:[n.jsx("div",{style:{width:10,height:10,borderRadius:2,background:c.color,flexShrink:0}}),n.jsx("span",{style:{fontSize:11,fontFamily:l.font,color:l.textSecondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.label}),n.jsxs("span",{style:{fontSize:11,fontFamily:l.fontMono,color:l.textMuted,marginLeft:"auto",flexShrink:0},children:[c.pct.toFixed(1),"%"]})]},z))})]})}function at({result:t,themeMode:s}){const e=R[s],[o,l]=W.useState(null),r=t.columns[0],i=t.columns.slice(1),k=t.rows.slice(0,30),A=k.flatMap(S=>i.map(m=>Number(S[m]??0))),y=Math.min(...A),b=Math.max(...A)-y||1,v=Math.min(50,480/i.length),w=24,p=100;function u(S){const m=(S-y)/b,d=Math.round(56+m*192),c=Math.round(139+m*-58),z=Math.round(253+m*-180);return`rgb(${d},${c},${z})`}return n.jsx("div",{style:{padding:"8px 0",overflowX:"auto"},children:n.jsxs("svg",{width:p+i.length*v+20,height:k.length*w+w+16,style:{display:"block",overflow:"visible"},children:[i.map((S,m)=>n.jsx("text",{x:p+m*v+v/2,y:14,textAnchor:"middle",fontSize:9,fontFamily:e.font,fill:e.textMuted,transform:`rotate(-30, ${p+m*v+v/2}, 14)`,children:S.length>8?S.slice(0,7)+"…":S},m)),k.map((S,m)=>{const d=String(S[r]??""),c=w+m*w;return n.jsxs("g",{children:[n.jsx("text",{x:p-6,y:c+w/2+4,textAnchor:"end",fontSize:10,fontFamily:e.font,fill:e.textSecondary,children:d.length>14?d.slice(0,13)+"…":d}),i.map((z,F)=>{const T=Number(S[z]??0),j=(o==null?void 0:o.r)===m&&(o==null?void 0:o.c)===F;return n.jsxs("g",{onMouseEnter:()=>l({r:m,c:F}),onMouseLeave:()=>l(null),children:[n.jsx("rect",{x:p+F*v,y:c,width:v-1,height:w-1,rx:2,fill:u(T),opacity:j?1:.85,stroke:j?e.accent:"none",strokeWidth:j?1.5:0}),j&&n.jsx("text",{x:p+F*v+v/2,y:c+w/2+4,textAnchor:"middle",fontSize:10,fontFamily:e.fontMono,fill:"#fff",fontWeight:600,children:E(T,z)})]},F)})]},m)})]})})}function ct({result:t,themeMode:s,chartConfig:e}){const o=R[s],[l,r]=W.useState(null),k=D(e==null?void 0:e.colorPalette)[0]??o.accent,A=(e!=null&&e.x&&t.columns.includes(e.x)?e.x:void 0)??t.columns.find(x=>t.rows.slice(0,5).some($=>U($[x])))??t.columns[0],y=t.rows.map(x=>Number(x[A]??0)).filter(x=>!isNaN(x));if(y.length===0)return null;const g=Math.min(20,Math.max(5,Math.ceil(Math.sqrt(y.length)))),b=Math.min(...y),p=(Math.max(...y)-b||1)/g,u=Array.from({length:g},(x,$)=>({low:b+$*p,high:b+($+1)*p,count:0}));y.forEach(x=>{const $=Math.min(Math.floor((x-b)/p),g-1);u[$].count++});const S=Math.max(...u.map(x=>x.count),1),m=560,d=200,c=52,z=16,F=16,T=36,j=m-c-z,_=d-F-T,a=j/g;return n.jsx("div",{style:{padding:"8px 0"},children:n.jsxs("svg",{width:"100%",height:d,viewBox:`0 0 ${m} ${d}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible"},children:[Array.from({length:5},(x,$)=>{const f=S*($+1)/5,I=F+_-f/S*_;return n.jsxs("g",{children:[n.jsx("line",{x1:c,y1:I,x2:c+j,y2:I,stroke:o.tableBorder,strokeWidth:.5}),n.jsx("text",{x:c-6,y:I+4,textAnchor:"end",fontSize:10,fontFamily:o.fontMono,fill:o.textMuted,children:Math.round(f)})]},$)}),u.map((x,$)=>{const f=x.count/S*_,I=c+$*a,L=F+_-f,B=l===$;return n.jsxs("g",{onMouseEnter:()=>r($),onMouseLeave:()=>r(null),children:[n.jsx("rect",{x:I+1,y:L,width:a-2,height:f,rx:1,fill:k,opacity:B?1:.85,style:{transition:"opacity 0.1s"}}),B&&n.jsx("text",{x:I+a/2,y:L-4,textAnchor:"middle",fontSize:10,fontFamily:o.fontMono,fill:o.textPrimary,children:x.count})]},$)}),u.filter((x,$)=>$%Math.ceil(g/6)===0).map((x,$)=>{const f=u.indexOf(x);return n.jsx("text",{x:c+f*a+a/2,y:F+_+16,textAnchor:"middle",fontSize:10,fontFamily:o.fontMono,fill:o.textMuted,children:E(x.low,A,e==null?void 0:e.format)},$)}),n.jsx("line",{x1:c,y1:F,x2:c,y2:F+_,stroke:o.tableBorder,strokeWidth:1}),n.jsx("line",{x1:c,y1:F+_,x2:c+j,y2:F+_,stroke:o.tableBorder,strokeWidth:1}),n.jsx("text",{x:c+j/2,y:d-2,textAnchor:"middle",fontSize:10,fontFamily:o.font,fill:o.textMuted,children:A})]})})}function dt({result:t,themeMode:s,chartConfig:e}){const o=R[s],[l,r]=W.useState(null),{labelCol:i,valueCol:k}=G(t,e),A=D(e==null?void 0:e.colorPalette),y=t.rows.slice(0,10).map(m=>({label:String(m[i]??""),value:Math.abs(Number(m[k]??0))}));if(y.length===0)return null;const g=y[0].value||1,b=400,v=36,w=4,p=16,u=y.length*(v+w)+p*2,S=b/2;return n.jsx("div",{style:{padding:"8px 0",display:"flex",justifyContent:"center"},children:n.jsx("svg",{width:b,height:u,style:{display:"block"},children:y.map((m,d)=>{const c=p+d*(v+w),z=m.value/g,F=Math.max(z*(b-80),40),T=l===d,j=d<y.length-1?y[d+1].value/g:z*.8,_=Math.max(j*(b-80),40),a=S-F/2,x=S+F/2,$=S+_/2,f=S-_/2,I=`M ${a} ${c} L ${x} ${c} L ${$} ${c+v} L ${f} ${c+v} Z`;return n.jsxs("g",{onMouseEnter:()=>r(d),onMouseLeave:()=>r(null),style:{cursor:"default"},children:[n.jsx("path",{d:I,fill:A[d%A.length],opacity:T?1:.85,style:{transition:"opacity 0.15s"}}),n.jsx("text",{x:S,y:c+v/2+1,textAnchor:"middle",fontSize:11,fontFamily:o.font,fill:"#fff",fontWeight:500,children:m.label}),n.jsxs("text",{x:S,y:c+v/2+13,textAnchor:"middle",fontSize:9,fontFamily:o.fontMono,fill:"rgba(255,255,255,0.7)",children:[E(m.value,k,e==null?void 0:e.format)," (",(z*100).toFixed(0),"%)"]})]},d)})})})}function xt({result:t,themeMode:s,chartConfig:e}){const o=R[s],l=D(e==null?void 0:e.colorPalette),[r,i]=W.useState(null),k=t.rows.slice(0,20),A=t.columns.filter(h=>k.some(M=>U(M[h]))),y=t.columns.filter(h=>!A.includes(h)),g=e!=null&&e.x&&y.includes(e.x)?e.x:y.find(h=>/(?:^|_)(?:source|from|origin|upstream|supplier|producer|category)(?:_|$)/i.test(h))??y[0],b=e!=null&&e.color&&y.includes(e.color)&&e.color!==g?e.color:y.find(h=>h!==g&&/(?:^|_)(?:target|to|destination|downstream|consumer|customer|product)(?:_|$)/i.test(h))??y.find(h=>h!==g),v=e!=null&&e.y&&A.includes(e.y)?e.y:A[0];if(!g||!b||!v)return n.jsx(J,{result:t,themeMode:s});const w=new Map;for(const h of t.rows){const M=String(h[g]??"").trim(),N=String(h[b]??"").trim(),P=Math.abs(Number(h[v]??0));if(!M||!N||!Number.isFinite(P)||P<=0)continue;const H=`${M}\0${N}`,O=w.get(H);w.set(H,{source:M,target:N,value:((O==null?void 0:O.value)??0)+P})}const p=[...w.values()].sort((h,M)=>M.value-h.value);if(p.length===0)return n.jsx(J,{result:t,themeMode:s});const u=new Map,S=new Map;p.forEach(h=>{u.set(h.source,(u.get(h.source)??0)+h.value),S.set(h.target,(S.get(h.target)??0)+h.value)});const m=[...u].sort((h,M)=>M[1]-h[1]).slice(0,12).map(([h])=>h),d=[...S].sort((h,M)=>M[1]-h[1]).slice(0,12).map(([h])=>h),c=new Set(m),z=new Set(d),F=p.filter(h=>c.has(h.source)&&z.has(h.target)).slice(0,40),T=Math.max(...F.map(h=>h.value),1),j=640,_=Math.max(250,Math.max(m.length,d.length)*34+40),a=132,x=j-144,$=12,f=28,I=(h,M)=>M<=1?_/2:f+h*((_-f*2)/(M-1)),L=new Map(m.map((h,M)=>[h,M])),B=new Map(d.map((h,M)=>[h,M]));return n.jsx("div",{style:{padding:"8px 0",overflowX:"auto"},children:n.jsxs("svg",{role:"img","aria-label":`${g} to ${b} flow by ${v}`,width:"100%",height:_,viewBox:`0 0 ${j} ${_}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",minWidth:520},children:[n.jsx("text",{x:a,y:14,textAnchor:"middle",fontSize:10,fontWeight:700,fontFamily:o.font,fill:o.textMuted,children:g}),n.jsx("text",{x,y:14,textAnchor:"middle",fontSize:10,fontWeight:700,fontFamily:o.font,fill:o.textMuted,children:b}),F.map((h,M)=>{const N=I(L.get(h.source)??0,m.length),P=I(B.get(h.target)??0,d.length),H=`${h.source}\0${h.target}`,O=r===H,he=`M ${a+$},${N} C ${a+150},${N} ${x-150},${P} ${x},${P}`,Z=j/2,q=(N+P)/2;return n.jsxs("g",{onMouseEnter:()=>i(H),onMouseLeave:()=>i(null),children:[n.jsx("path",{d:he,fill:"none",stroke:l[M%l.length],strokeWidth:Math.max(2,h.value/T*18),opacity:r===null||O?.7:.14,strokeLinecap:"round",style:{transition:"opacity 0.15s",cursor:"default"}}),O?n.jsxs("g",{pointerEvents:"none",children:[n.jsx("rect",{x:Z-72,y:q-18,width:144,height:36,rx:5,fill:o.cellBg,stroke:o.cellBorder}),n.jsxs("text",{x:Z,y:q-3,textAnchor:"middle",fontSize:9.5,fontFamily:o.font,fill:o.textSecondary,children:[h.source," → ",h.target]}),n.jsx("text",{x:Z,y:q+11,textAnchor:"middle",fontSize:11,fontWeight:700,fontFamily:o.fontMono,fill:o.textPrimary,children:E(h.value,v,e==null?void 0:e.format)})]}):null]},H)}),m.map((h,M)=>{const N=I(M,m.length);return n.jsxs("g",{children:[n.jsx("rect",{x:a,y:N-9,width:$,height:18,rx:3,fill:l[M%l.length]}),n.jsx("text",{x:a-7,y:N+3,textAnchor:"end",fontSize:10.5,fontFamily:o.font,fill:o.textSecondary,children:h.length>18?`${h.slice(0,17)}…`:h})]},`source-${h}`)}),d.map((h,M)=>{const N=I(M,d.length);return n.jsxs("g",{children:[n.jsx("rect",{x,y:N-9,width:$,height:18,rx:3,fill:l[(M+m.length)%l.length]}),n.jsx("text",{x:x+$+7,y:N+3,textAnchor:"start",fontSize:10.5,fontFamily:o.font,fill:o.textSecondary,children:h.length>18?`${h.slice(0,17)}…`:h})]},`target-${h}`)})]})})}function ut({result:t,themeMode:s,chartConfig:e}){const o=R[s],[l,r]=W.useState(null),{labelCol:i,valueCol:k}=G(t,e),A=t.rows.slice(0,15).map(a=>({label:String(a[i]??""),value:Number(a[k]??0)}));if(A.length===0)return null;let y=0;const g=A.map(a=>{const x=y;return y+=a.value,{...a,start:x,end:y}}),b=g.flatMap(a=>[a.start,a.end]),v=Math.min(0,...b),p=Math.max(0,...b)-v||1,u=560,S=240,m=52,d=16,c=16,z=44,F=u-m-d,T=S-c-z,j=F/g.length,_=a=>c+T-(a-v)/p*T;return n.jsx("div",{style:{padding:"8px 0"},children:n.jsxs("svg",{width:"100%",height:S,viewBox:`0 0 ${u} ${S}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",overflow:"visible"},children:[Array.from({length:6},(a,x)=>{const $=v+p*x/5,f=_($);return n.jsxs("g",{children:[n.jsx("line",{x1:m,y1:f,x2:m+F,y2:f,stroke:o.tableBorder,strokeWidth:.5}),n.jsx("text",{x:m-6,y:f+4,textAnchor:"end",fontSize:10,fontFamily:o.fontMono,fill:o.textMuted,children:E($,k,e==null?void 0:e.format)})]},x)}),n.jsx("line",{x1:m,y1:_(0),x2:m+F,y2:_(0),stroke:o.textMuted,strokeWidth:1,strokeDasharray:"3,3"}),g.map((a,x)=>{const $=m+x*j,f=_(Math.max(a.start,a.end)),L=_(Math.min(a.start,a.end))-f,B=a.value>=0,h=l===x;return n.jsxs("g",{onMouseEnter:()=>r(x),onMouseLeave:()=>r(null),children:[x<g.length-1&&n.jsx("line",{x1:$+j-2,y1:_(a.end),x2:$+j+2,y2:_(a.end),stroke:o.textMuted,strokeWidth:1,strokeDasharray:"2,2"}),n.jsx("rect",{x:$+4,y:f,width:j-8,height:Math.max(L,1),rx:2,fill:B?o.success:o.error,opacity:h?1:.8,style:{transition:"opacity 0.1s"}}),h&&n.jsxs("text",{x:$+j/2,y:f-4,textAnchor:"middle",fontSize:10,fontFamily:o.fontMono,fill:o.textPrimary,children:[a.value>=0?"+":"",E(a.value,k,e==null?void 0:e.format)]})]},x)}),g.map((a,x)=>n.jsx("text",{x:m+x*j+j/2,y:S-6,textAnchor:"middle",fontSize:9,fontFamily:o.font,fill:o.textMuted,transform:`rotate(-20, ${m+x*j+j/2}, ${S-6})`,children:a.label.length>8?a.label.slice(0,7)+"…":a.label},x)),n.jsx("line",{x1:m,y1:c,x2:m,y2:c+T,stroke:o.tableBorder,strokeWidth:1}),n.jsx("line",{x1:m,y1:c+T,x2:m+F,y2:c+T,stroke:o.tableBorder,strokeWidth:1})]})})}function pt({result:t,themeMode:s,chartConfig:e}){const o=R[s],l=t.rows[0];if(!l)return null;const r=(e!=null&&e.y&&t.columns.includes(e.y)?e.y:void 0)??t.columns.find(_=>U(l[_]))??t.columns[0],i=Number(l[r]??0),k=(e==null?void 0:e.title)??r,A=i>100?i*1.2:100,y=Math.min(Math.max(i/A,0),1),g=120,b=110,v=80,w=Math.PI,p=0,u=w-(w-p)*y,S=g+v*Math.cos(w),m=b+v*Math.sin(w),d=g+v*Math.cos(u),c=b+v*Math.sin(u),z=y>.5?1:0,F=g+v*Math.cos(p),T=b+v*Math.sin(p),j=y<.33?o.error:y<.66?o.warning:o.success;return n.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"16px 24px"},children:n.jsxs("svg",{width:240,height:140,style:{display:"block",overflow:"visible"},children:[n.jsx("path",{d:`M ${S} ${m} A ${v} ${v} 0 1 1 ${F} ${T}`,fill:"none",stroke:o.tableBorder,strokeWidth:12,strokeLinecap:"round"}),y>0&&n.jsx("path",{d:`M ${S} ${m} A ${v} ${v} 0 ${z} 1 ${d} ${c}`,fill:"none",stroke:j,strokeWidth:12,strokeLinecap:"round"}),n.jsx("text",{x:g,y:b-4,textAnchor:"middle",fontSize:28,fontFamily:o.fontMono,fill:j,fontWeight:700,children:E(i,r,e==null?void 0:e.format)}),n.jsx("text",{x:g,y:b+16,textAnchor:"middle",fontSize:11,fontFamily:o.font,fill:o.textMuted,children:k})]})})}function mt(t,s,e,o){const l=Number(s);return s==null||typeof s!="number"&&isNaN(l)?s==null?"—":String(s):ne(t,s,e,{compact:Math.abs(l)>=1e5,format:o})}function ye({result:t,themeMode:s,chartConfig:e}){const o=R[s],l=D(e==null?void 0:e.colorPalette),r=t.rows[0];if(!r)return null;const i=e!=null&&e.y&&t.columns.includes(e.y)?e.y:t.columns.find(A=>U(r[A]))??t.columns[0],k=mt(i,r[i],t.rows.map(A=>A[i]),e==null?void 0:e.format);return n.jsx("div",{style:{containerType:"inline-size",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",padding:"8px 4px",boxSizing:"border-box",minWidth:0},children:n.jsx("span",{title:String(r[i]),style:{fontSize:"clamp(14px, 13cqw, 40px)",fontWeight:750,fontFamily:o.fontMono,color:l[0]??o.accent,lineHeight:1.1,maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k})})}function yt({config:t,columns:s,onChange:e,onClose:o,t:l}){const r={background:l.inputBg,border:`1px solid ${l.inputBorder}`,borderRadius:4,color:l.textPrimary,fontSize:11,fontFamily:l.font,padding:"4px 8px",outline:"none",width:"100%",boxSizing:"border-box"};return n.jsxs("div",{style:{position:"absolute",top:4,right:4,zIndex:100,background:l.cellBg,border:`1px solid ${l.headerBorder}`,borderRadius:8,padding:12,width:240,boxShadow:"0 4px 16px rgba(0,0,0,0.3)",display:"grid",gap:8},onClick:i=>i.stopPropagation(),children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[n.jsx("span",{style:{fontSize:11,fontWeight:600,color:l.textPrimary,fontFamily:l.font},children:"Chart Settings"}),n.jsx("button",{onClick:o,style:{background:"none",border:"none",color:l.textMuted,cursor:"pointer",fontSize:14},children:"×"})]}),n.jsxs("label",{style:{fontSize:10,color:l.textMuted,fontFamily:l.font},children:["Title",n.jsx("input",{value:t.title??"",onChange:i=>e({title:i.target.value||void 0}),placeholder:"Chart title",style:{...r,marginTop:2}})]}),n.jsxs("label",{style:{fontSize:10,color:l.textMuted,fontFamily:l.font},children:["X-axis label",n.jsx("input",{value:t.xLabel??"",onChange:i=>e({xLabel:i.target.value||void 0}),placeholder:"Auto",style:{...r,marginTop:2}})]}),n.jsxs("label",{style:{fontSize:10,color:l.textMuted,fontFamily:l.font},children:["Y-axis label",n.jsx("input",{value:t.yLabel??"",onChange:i=>e({yLabel:i.target.value||void 0}),placeholder:"Auto",style:{...r,marginTop:2}})]}),n.jsxs("label",{style:{fontSize:10,color:l.textMuted,fontFamily:l.font},children:["Legend",n.jsxs("select",{value:t.legendPosition??"top",onChange:i=>e({legendPosition:i.target.value}),style:{...r,marginTop:2},children:[n.jsx("option",{value:"top",children:"Top"}),n.jsx("option",{value:"bottom",children:"Bottom"}),n.jsx("option",{value:"left",children:"Left"}),n.jsx("option",{value:"right",children:"Right"}),n.jsx("option",{value:"none",children:"Hidden"})]})]}),n.jsxs("label",{style:{fontSize:10,color:l.textMuted,fontFamily:l.font},children:["Color palette",n.jsx("select",{value:t.colorPalette??"default",onChange:i=>e({colorPalette:i.target.value}),style:{...r,marginTop:2},children:Object.keys(Q).map(i=>n.jsx("option",{value:i,children:i.charAt(0).toUpperCase()+i.slice(1)},i))})]}),n.jsxs("label",{style:{fontSize:10,color:l.textMuted,fontFamily:l.font},children:["Max items",n.jsx("input",{type:"number",value:t.maxItems??V,min:5,max:200,onChange:i=>e({maxItems:parseInt(i.target.value)||V}),style:{...r,marginTop:2}})]})]})}function kt({result:t,themeMode:s,chartConfig:e,onConfigChange:o}){const l=R[s],r=nt(t,e),[i,k]=W.useState(!1);return r==="kpi"?n.jsx(ye,{result:t,themeMode:s,chartConfig:e}):n.jsxs("div",{style:{position:"relative"},children:[(e==null?void 0:e.title)&&n.jsx("div",{style:{padding:"8px 12px 0",fontSize:13,fontWeight:600,color:l.textPrimary,fontFamily:l.font,textAlign:"center"},children:e.title}),o&&n.jsx("button",{onClick:()=>k(!i),title:"Chart settings",style:{position:"absolute",top:4,right:4,zIndex:50,background:i?`${l.accent}18`:"transparent",border:`1px solid ${i?l.accent:"transparent"}`,borderRadius:4,color:i?l.accent:l.textMuted,cursor:"pointer",fontSize:14,padding:"2px 6px",lineHeight:1},children:"⚙"}),i&&o&&n.jsx(yt,{config:e??{},columns:t.columns,onChange:A=>o(A),onClose:()=>k(!1),t:l}),ft(r,t,s,e)]})}function ft(t,s,e,o){const l=o!=null&&o.x&&s.columns.includes(o.x)?o.x:void 0,r=o!=null&&o.y&&s.columns.includes(o.y)?o.y:void 0,i=l||r?ht(s,l,r):s;switch(t){case"line":return n.jsx(ce,{result:i,themeMode:e,chartConfig:o});case"area":return n.jsx(ce,{result:i,themeMode:e,chartConfig:o,showArea:!0});case"bar":return n.jsx(oe,{result:i,themeMode:e,chartConfig:o});case"grouped-bar":return n.jsx(st,{result:i,themeMode:e,chartConfig:o});case"stacked-bar":return n.jsx(lt,{result:i,themeMode:e,chartConfig:o});case"scatter":return n.jsx(rt,{result:s,themeMode:e,chartConfig:o});case"pie":return n.jsx(de,{result:s,themeMode:e,chartConfig:o,isDonut:!1});case"donut":return n.jsx(de,{result:s,themeMode:e,chartConfig:o,isDonut:!0});case"heatmap":return n.jsx(at,{result:s,themeMode:e});case"histogram":return n.jsx(ct,{result:s,themeMode:e,chartConfig:o});case"funnel":return n.jsx(dt,{result:s,themeMode:e,chartConfig:o});case"sankey":return n.jsx(xt,{result:s,themeMode:e,chartConfig:o});case"waterfall":return n.jsx(ut,{result:s,themeMode:e,chartConfig:o});case"gauge":return n.jsx(pt,{result:s,themeMode:e,chartConfig:o});case"kpi":return n.jsx(ye,{result:s,themeMode:e,chartConfig:o});default:return n.jsx(J,{result:s,themeMode:e})}}function ht(t,s,e){const o=t.columns,l=[];s&&o.includes(s)&&l.push(s),e&&o.includes(e)&&l.push(e);for(const r of o)l.includes(r)||l.push(r);return l.join(",")===o.join(",")?t:{...t,columns:l,rows:t.rows.map(r=>{const i={};for(const k of l)i[k]=r[k];return i})}}function zt(t){return new Set(t.tiles.filter(s=>!s.error&&s.selectedByDefault).map(s=>s.id))}function _t({proposal:t,t:s,selected:e,onToggle:o,onCreate:l,busy:r,error:i,compact:k}){const A=t.tiles.filter(u=>!u.error),y=t.tiles.filter(u=>u.error),g=A.filter(u=>e.has(u.id)).length,b=A.filter(u=>e.has(u.id)&&u.certification==="ai_generated").length,v=A.filter(u=>e.has(u.id)&&u.certification==="reviewed_semantic").length,p=A.filter(u=>e.has(u.id)&&u.certification==="certified").length+v>0;return n.jsxs("div",{style:{display:"grid",gap:10},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[n.jsx("span",{style:{fontSize:12.5,fontWeight:800,color:s.textPrimary},children:"Proposed app content"}),n.jsxs("span",{style:{fontSize:11,color:s.textMuted},children:[t.coverage.certifiedTiles," certified",t.coverage.semanticTiles>0?` · ${t.coverage.semanticTiles} reviewed semantic`:"",t.coverage.generatedTiles>0?` · ${t.coverage.generatedTiles} AI-generated`:"",t.coverage.gaps>0?` · ${t.coverage.gaps} uncovered`:""]})]}),n.jsxs("div",{style:{display:"grid",gap:6},children:[A.map(u=>n.jsx(bt,{tile:u,t:s,checked:e.has(u.id),onToggle:()=>o(u.id),compact:k},u.id)),y.map(u=>n.jsxs("div",{style:{...fe(s),opacity:.75},children:[n.jsx(be,{size:13,color:s.warning,style:{flexShrink:0,marginTop:2}}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsx("div",{style:{fontSize:12,fontWeight:700,color:s.textSecondary},children:u.title}),n.jsx("div",{style:{fontSize:11,color:s.textMuted,marginTop:1},children:u.error})]})]},u.id))]}),t.gaps.length>0?n.jsxs("div",{style:{display:"grid",gap:4},children:[n.jsx("div",{style:{fontSize:11,fontWeight:800,color:s.textMuted,textTransform:"uppercase",letterSpacing:"0.04em"},children:"Not covered yet"}),t.gaps.map(u=>n.jsxs("div",{style:{display:"flex",gap:7,alignItems:"flex-start",fontSize:11.5,color:s.textMuted},children:[n.jsx(ke,{size:12,style:{flexShrink:0,marginTop:2}}),n.jsx("span",{style:{lineHeight:1.4},children:u.question})]},u.id))]}):null,i?n.jsx("div",{style:{fontSize:12,color:s.error},children:i}):null,n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,flexWrap:"wrap"},children:[n.jsxs("button",{type:"button",className:"dql-hover",onClick:l,disabled:r||!p,style:St(s,p&&!r),children:[r?n.jsx(ve,{size:13,style:{animation:"dql-agent-run-spin 0.8s linear infinite"}}):n.jsx(ge,{size:13}),n.jsx("span",{children:r?"Creating app…":`Create app (${g} tile${g===1?"":"s"})`})]}),n.jsx("span",{style:{fontSize:11,color:s.textMuted},children:p?v>0?`${v} semantic tile${v===1?"":"s"} will compile against the governed semantic layer at run time.`:b>0?`${b} AI-generated tile${b===1?"":"s"} will stay review-required until certified.`:"Nothing is created until you confirm.":"Select at least one certified block or reviewed semantic tile."})]})]})}function bt({tile:t,t:s,checked:e,onToggle:o,compact:l}){const[r,i]=W.useState(!1),k=t.certification==="certified",A=t.certification==="reviewed_semantic",y=!!(t.sql||t.answer||t.preview&&t.preview.rows.length>0);return n.jsxs("div",{style:fe(s),children:[n.jsx("input",{type:"checkbox",checked:e,onChange:o,"aria-label":`Include ${t.title}`,style:{marginTop:2,accentColor:s.accent,cursor:"pointer",flexShrink:0}}),n.jsxs("div",{style:{minWidth:0,flex:1},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[n.jsx("span",{style:{fontSize:12.5,fontWeight:750,color:s.textPrimary},children:t.title}),k?n.jsxs("span",{style:X(s.success),children:[n.jsx(je,{size:10})," certified"]}):A?n.jsxs("span",{style:X(s.accent),children:[n.jsx(se,{size:10})," reviewed semantic"]}):n.jsxs("span",{style:X(s.warning),children:[n.jsx(se,{size:10})," AI-generated · needs review"]}),n.jsx("span",{style:{fontSize:10,color:s.textMuted},children:t.viz})]}),t.description&&!l?n.jsx("div",{style:{fontSize:11.5,color:s.textSecondary,marginTop:2,lineHeight:1.4},children:t.description}):null,t.question&&t.question!==t.title?n.jsxs("div",{style:{fontSize:11,color:s.textMuted,marginTop:2},children:["Answers: ",t.question]}):null,y?n.jsxs("button",{type:"button",onClick:()=>i(g=>!g),style:{border:"none",background:"transparent",color:s.accent,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:3,fontSize:10.5,fontWeight:700,padding:0,marginTop:4,fontFamily:s.font},children:[r?n.jsx(Se,{size:11}):n.jsx(we,{size:11}),n.jsx($e,{size:11})," ",r?"Hide details":"Show SQL & preview"]}):null,r&&t.answer?n.jsx("div",{style:{fontSize:11.5,color:s.textSecondary,marginTop:5,lineHeight:1.4},children:t.answer}):null,r&&t.sql?n.jsx("pre",{style:jt(s),children:t.sql}):null,r&&t.preview&&t.preview.rows.length>0?n.jsx(vt,{preview:t.preview,t:s}):null]})]})}function vt({preview:t,t:s}){const e=t.columns.slice(0,5),o=t.rows.slice(0,5);return n.jsxs("div",{style:{marginTop:5,overflow:"auto",border:`1px solid ${s.headerBorder}`,borderRadius:6},children:[n.jsxs("table",{style:{borderCollapse:"collapse",fontSize:10.5,fontFamily:s.fontMono,width:"100%"},children:[n.jsx("thead",{children:n.jsx("tr",{children:e.map(l=>n.jsx("th",{style:{textAlign:"left",padding:"3px 8px",color:s.textMuted,borderBottom:`1px solid ${s.headerBorder}`,fontWeight:700,whiteSpace:"nowrap"},children:l},l))})}),n.jsx("tbody",{children:o.map((l,r)=>n.jsx("tr",{children:e.map(i=>n.jsx("td",{style:{padding:"3px 8px",color:s.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:160},children:gt(l[i])},i))},r))})]}),typeof t.rowCount=="number"&&t.rowCount>o.length?n.jsxs("div",{style:{fontSize:10,color:s.textMuted,padding:"3px 8px"},children:[t.rowCount," rows total"]}):null]})}function gt(t){return t==null?"":typeof t=="number"?Number.isInteger(t)?String(t):t.toFixed(2):String(t)}function fe(t){return{display:"flex",gap:9,alignItems:"flex-start",border:`1px solid ${t.cellBorder}`,background:t.cellBg,borderRadius:8,padding:"9px 11px"}}function X(t){return{display:"inline-flex",alignItems:"center",gap:3,border:`1px solid ${t}55`,color:t,background:`${t}12`,borderRadius:999,padding:"1px 7px",fontSize:9.5,fontWeight:800}}function jt(t){return{margin:"5px 0 0",maxHeight:140,overflow:"auto",border:`1px solid ${t.headerBorder}`,background:t.editorBg,borderRadius:6,padding:8,fontSize:10.5,fontFamily:t.fontMono,color:t.textSecondary,lineHeight:1.45,whiteSpace:"pre-wrap"}}function St(t,s){return{display:"inline-flex",alignItems:"center",gap:6,border:"none",borderRadius:8,padding:"8px 14px",fontSize:12.5,fontWeight:800,fontFamily:t.font,cursor:s?"pointer":"default",background:s?t.accent:`${t.accent}55`,color:"#fff"}}function Tt(t){const s=`dql.agent.threadId.${t}`,[e,o]=W.useState(()=>xe(s));W.useEffect(()=>{o(xe(s))},[s]);const l=W.useCallback(i=>{o(i);try{window.localStorage.setItem(s,i)}catch{}},[s]),r=W.useCallback(()=>{o(void 0);try{window.localStorage.removeItem(s)}catch{}},[s]);return{threadId:e,onThreadIdChange:l,resetThreadId:r}}function xe(t){try{return window.localStorage.getItem(t)??void 0}catch{return}}export{_t as A,At as C,ke as F,Mt as S,J as T,nt as a,kt as b,$t as c,$e as d,zt as e,ne as f,Fe as i,ft as r,Tt as u};
|