@objectstack/console 11.5.0 → 11.6.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/.objectui-sha +1 -1
- package/dist/assets/{AdapterProvider-BoIMfid0.js → AdapterProvider-cQNLWqAj.js} +1 -1
- package/dist/assets/{AiPendingActionsPage-C2yWGA5c.js → AiPendingActionsPage-BZfkGc0a.js} +1 -1
- package/dist/assets/{ApiConsolePage-CbOA7yU_.js → ApiConsolePage-BNrBc-Od.js} +1 -1
- package/dist/assets/{AppDocsIndex-DG7I33Q0.js → AppDocsIndex-BL5bgCSE.js} +1 -1
- package/dist/assets/{AppManagementPage-pZT1FFC3.js → AppManagementPage-BPD202Gk.js} +1 -1
- package/dist/assets/{ApprovalsInboxPage-Bf1G6M2j.js → ApprovalsInboxPage-DvlDfedF.js} +1 -1
- package/dist/assets/{AuditLogPage-DhCB5Z43.js → AuditLogPage-CB99k9wq.js} +1 -1
- package/dist/assets/{ComponentNavView-DytkOwgZ.js → ComponentNavView-BuCUzee1.js} +1 -1
- package/dist/assets/ConsoleFloatingChatbot-CKCsvdjM.js +1 -0
- package/dist/assets/{DashboardView-DfLxEvu6.js → DashboardView-B6lZBdnt.js} +1 -1
- package/dist/assets/{DashboardWidgetInspector-kTGmMwv9.js → DashboardWidgetInspector-CnaDfNnP.js} +1 -1
- package/dist/assets/{DeveloperHubPage-D754TyQo.js → DeveloperHubPage-BJG70ylS.js} +1 -1
- package/dist/assets/{ExpressionProvider-4nWMRYZf.js → ExpressionProvider-DHcGo-ds.js} +1 -1
- package/dist/assets/{FlowRunsPage-vP2vIZpQ.js → FlowRunsPage-D8P2EBn0.js} +1 -1
- package/dist/assets/{IntegrationsPage-CUcCoo0I.js → IntegrationsPage-D11m2Mgs.js} +1 -1
- package/dist/assets/{InterfaceListPage-BnbDtTf1.js → InterfaceListPage-Blv6QsRk.js} +1 -1
- package/dist/assets/{ManagedByBadge-BOZOeONh.js → ManagedByBadge-B_3CAxVP.js} +1 -1
- package/dist/assets/{MarketplaceAccessDenied-DQriAyJJ.js → MarketplaceAccessDenied-H_Jx42ON.js} +1 -1
- package/dist/assets/{MarketplaceInstalledPage-HCwduRx9.js → MarketplaceInstalledPage-Cspj47M8.js} +1 -1
- package/dist/assets/{MarketplacePackagePage-zwcTnk73.js → MarketplacePackagePage-HsOJc8gO.js} +2 -2
- package/dist/assets/MarketplacePage-h3TH16Xi.js +1 -0
- package/dist/assets/{MetadataInspector-uzqN-c_S.js → MetadataInspector--jXw9q3_.js} +1 -1
- package/dist/assets/{MetadataProvider-C517hbHZ.js → MetadataProvider-CtxwKit6.js} +1 -1
- package/dist/assets/{PageView-C902zOSZ.js → PageView--__yPegB.js} +1 -1
- package/dist/assets/{ProfilePage-D4ODPlXD.js → ProfilePage-CGieHQKA.js} +1 -1
- package/dist/assets/{PublicFormsPage-DyuMcLOS.js → PublicFormsPage-DHB1GXYq.js} +1 -1
- package/dist/assets/RecordDetailView-DdNF49JU.js +9 -0
- package/dist/assets/{RecordFormPage-Brux9Pwn.js → RecordFormPage-D4slBdVF.js} +1 -1
- package/dist/assets/{ReportDefaultInspector-D5vXyOGX.js → ReportDefaultInspector-Dd6uMr1m.js} +2 -2
- package/dist/assets/{ReportView-C-5CEger.js → ReportView-BNSFl3JX.js} +1 -1
- package/dist/assets/{SearchResultsPage-DXcagT6P.js → SearchResultsPage-BxzH-_Ij.js} +1 -1
- package/dist/assets/{SettingsHub-D7rRZ-on.js → SettingsHub-Dgn8w9aO.js} +1 -1
- package/dist/assets/SettingsView-C9v8ffrk.js +1 -0
- package/dist/assets/{SystemHubPage-Do0l-rwF.js → SystemHubPage-DWlReITv.js} +1 -1
- package/dist/assets/data-adapter-BKbSi5kr.js +7 -0
- package/dist/assets/{framework-C3RMhKDr.js → framework-BzwUcFJm.js} +8 -7
- package/dist/assets/{highlighted-body-OFNGDK62-DLIcWL3h.js → highlighted-body-OFNGDK62-JtalCdv1.js} +1 -1
- package/dist/assets/index-Ba1vnWIZ.css +2 -0
- package/dist/assets/index-DZKZYBSE.js +2 -0
- package/dist/assets/mermaid-GHXKKRXX-G7SDbIK1.js +1 -0
- package/dist/assets/{metadata-admin-DigQrDYj.js → metadata-admin-J7IHY80h.js} +6 -6
- package/dist/assets/{plugin-calendar-Dt70natA.js → plugin-calendar-DVu__gQc.js} +1 -1
- package/dist/assets/plugin-charts-yK7P8AX5.js +7 -0
- package/dist/assets/plugin-chatbot-0LmsN1Va.js +120 -0
- package/dist/assets/plugin-dashboard-BCk2PLlx.js +6 -0
- package/dist/assets/plugin-form-DGPdqA5u.js +1 -0
- package/dist/assets/{plugin-gantt-DH-QLptQ.js → plugin-gantt-DcuxnZEc.js} +2 -2
- package/dist/assets/plugin-grid-BVUr9dNv.js +8 -0
- package/dist/assets/{plugin-kanban-BRV0WN7L.js → plugin-kanban-cqlDEL7v.js} +1 -1
- package/dist/assets/{plugin-map-CAe_xoWI.js → plugin-map-DufmkIU8.js} +1 -1
- package/dist/assets/{plugin-markdown-DVImgQYk.js → plugin-markdown-Dlim2oQH.js} +1 -1
- package/dist/assets/{plugin-report-B6rh7YXX.js → plugin-report-nKNTjtyj.js} +2 -2
- package/dist/assets/{plugin-timeline-ZyTfjz7e.js → plugin-timeline-HVMwCSYX.js} +1 -1
- package/dist/assets/{plugin-tree-DGkyQ0lj.js → plugin-tree-CVXeKvcL.js} +1 -1
- package/dist/assets/plugin-view-CF03uyex.js +1 -0
- package/dist/assets/plugins-views-D-6k7FrC.js +4 -0
- package/dist/assets/{skeletons-C-42w_MY.js → skeletons-CRKtyrMr.js} +1 -1
- package/dist/assets/{src-yxeLzGBZ.js → src-ClJ9jvV1.js} +1 -1
- package/dist/assets/src-d69UbmXO.js +12 -0
- package/dist/assets/{types-ChDtzQZB.js → types-BXER-wux.js} +1 -1
- package/dist/assets/ui-components-CLgu4Fon.js +42 -0
- package/dist/assets/{ui-layout-D1KjRJsh.js → ui-layout-FpTj4VqO.js} +1 -1
- package/dist/assets/{useActionModal-CsAqakCv.js → useActionModal-BPkUp8XL.js} +1 -1
- package/dist/assets/{useOpenRecordList-BYOFaY8y.js → useOpenRecordList-DYtGRFlK.js} +1 -1
- package/dist/assets/{useReconcileOnError-_QGJOfLf.js → useReconcileOnError-BPOKuFu7.js} +1 -1
- package/dist/assets/vendor-objectstack-DTDITeDR.js +95 -0
- package/dist/assets/vendor-zod-DNgwlUUI.js +65 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/ConsoleFloatingChatbot-5PFTo79W.js +0 -1
- package/dist/assets/MarketplacePage-Cr5TJn45.js +0 -1
- package/dist/assets/RecordDetailView-VR81HXSp.js +0 -9
- package/dist/assets/SettingsView-D0ApSSCe.js +0 -1
- package/dist/assets/data-adapter-BCQWtGB_.js +0 -1
- package/dist/assets/index-C_-Pgv1J.css +0 -2
- package/dist/assets/index-D27qs-mG.js +0 -2
- package/dist/assets/mermaid-GHXKKRXX-Du2PFYcS.js +0 -1
- package/dist/assets/plugin-charts-8ZEdKLDL.js +0 -7
- package/dist/assets/plugin-chatbot-CHOTmGHB.js +0 -120
- package/dist/assets/plugin-dashboard-Dpzs7Slc.js +0 -6
- package/dist/assets/plugin-form-ji-Rgf2e.js +0 -1
- package/dist/assets/plugin-grid-D1F45Vnr.js +0 -8
- package/dist/assets/plugin-view-24sHw0Ev.js +0 -1
- package/dist/assets/plugins-views-BT7UDPqk.js +0 -4
- package/dist/assets/src-rCeRf142.js +0 -12
- package/dist/assets/ui-components-CqkwtQve.js +0 -42
- package/dist/assets/vendor-objectstack-AFc_0VfZ.js +0 -96
- package/dist/assets/vendor-zod-BzP-Jkm3.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as e}from"./plugin-chatbot-CHOTmGHB.js";export{e as Mermaid};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{o as e,r as t}from"./rolldown-runtime-DAXXjFlN.js";import{_ as n,m as r,t as i}from"./vendor-react-slxo-5GC.js";import{Nt as a,V as o,Y as s,Z as c,b as l,ct as u,dt as d,ft as f,gt as p,ht as m,jt as h,mt as ee,n as te,ot as ne,pt as g,st as re,ut as ie}from"./framework-C3RMhKDr.js";import{A as _,B as v,C as y,D as b,E as ae,F as x,I as oe,L as se,M as S,N as C,O as w,P as ce,R as le,T,V as E,_ as ue,dt as D,g as O,h as de,j as k,k as fe,m as A,p as pe,ut as j,v as M,w as N,y as P,z as me}from"./vendor-charts-DVOdzzh2.js";import{Cr as he,Fs as ge,Gn as _e,Gt as F,Ht as ve,Kn as I,Lc as L,R as ye,Vt as be,Wt as R,Xn as xe,Yn as Se,bc as z,z as Ce,zt as B}from"./ui-components-CqkwtQve.js";var V=e(n(),1),H=i(),U=(...e)=>e.filter(Boolean).join(` `),we={light:``,dark:`.dark`},W=V.createContext(null);function Te(){let e=V.useContext(W);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function G({id:e,className:t,children:n,config:r,...i}){let a=V.useId(),o=`chart-${e||a.replace(/:/g,``)}`;return(0,H.jsx)(W.Provider,{value:{config:r},children:(0,H.jsxs)(`div`,{"data-slot":`chart`,"data-chart":o,className:U(`block w-full h-[350px] text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),style:{minHeight:280,minWidth:0,...i.style},...i,children:[(0,H.jsx)(Ee,{id:o,config:r}),(0,H.jsx)(D,{width:`100%`,height:`100%`,children:n})]})})}var Ee=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,H.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(we).map(([t,r])=>`
|
|
2
|
-
${r} [data-chart=${e}] {
|
|
3
|
-
${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
|
|
4
|
-
`)}
|
|
5
|
-
}
|
|
6
|
-
`).join(`
|
|
7
|
-
`)}}):null},K=E;function q({active:e,payload:t,className:n,indicator:r=`dot`,hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:s,labelClassName:c,formatter:l,color:u,nameKey:d,labelKey:f}){let{config:p}=Te(),m=V.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=De(p,e,`${f||e?.dataKey||e?.name||`value`}`),r=!f&&typeof o==`string`?p[o]?.label||o:n?.label;return s?(0,H.jsx)(`div`,{className:U(`font-medium`,c),children:s(r,t)}):r?(0,H.jsx)(`div`,{className:U(`font-medium`,c),children:r}):null},[o,s,t,i,c,p,f]);if(!e||!t?.length)return null;let h=t.length===1&&r!==`dot`;return(0,H.jsxs)(`div`,{className:U(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,n),children:[h?null:m,(0,H.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=De(p,e,`${d||e.name||e.dataKey||`value`}`),i=u||e.payload.fill||e.color;return(0,H.jsx)(`div`,{className:U(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,r===`dot`?`items-center`:``),children:l&&e?.value!==void 0&&e.name?l(e.value,e.name,e,t,e.payload):(0,H.jsxs)(H.Fragment,{children:[n?.icon?(0,H.jsx)(n.icon,{}):!a&&(0,H.jsx)(`div`,{className:U(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,r===`dot`?`h-2.5 w-2.5`:``,r===`line`?`w-1`:``,r===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,h&&r===`dashed`?`my-0.5`:``),style:{"--color-bg":i,"--color-border":i}}),(0,H.jsxs)(`div`,{className:U(`flex flex-1 justify-between leading-none`,h?`items-end`:`items-center`),children:[(0,H.jsxs)(`div`,{className:`grid gap-1.5`,children:[h?m:null,(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label||e.name})]}),e.value&&(0,H.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}var J=j;function Y({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:i}){let{config:a}=Te();return n?.length?(0,H.jsx)(`div`,{className:U(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=De(a,e,`${i||e.dataKey||`value`}`);return(0,H.jsxs)(`div`,{className:U(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[n?.icon&&!t?(0,H.jsx)(n.icon,{}):(0,H.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null}function De(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}function Oe(e){return e?.[0]?.dataKey||`value`}function ke(e,t,n){if(!e)return null;let r=e.payload??e,i=r?.[t];if(i==null)return null;let a=Oe(n);return{category:String(i),series:a,value:typeof r?.[a]==`number`?r[a]:void 0}}function Ae(e,t){if(!e)return null;let n=e.name??e.payload?.name??e.root?.name;if(n==null)return null;let r=e.value??e.size??e.payload?.size;return{category:String(n),series:Oe(t),value:typeof r==`number`?r:void 0}}function je(e,t){if(!e)return null;let n=e.payload??e,r=n?.name;return r==null||n?.depth===0?null:{category:String(r),series:Oe(t),value:typeof n?.value==`number`?n.value:void 0}}var Me=t({default:()=>Fe}),Ne=`hsl(var(--primary))`,Pe={slate:`#64748b`,gray:`#6b7280`,zinc:`#71717a`,neutral:`#737373`,stone:`#78716c`,red:`#ef4444`,orange:`#f97316`,amber:`#f59e0b`,yellow:`#eab308`,lime:`#84cc16`,green:`#22c55e`,emerald:`#10b981`,teal:`#14b8a6`,cyan:`#06b6d4`,sky:`#0ea5e9`,blue:`#3b82f6`,indigo:`#6366f1`,violet:`#8b5cf6`,purple:`#a855f7`,fuchsia:`#d946ef`,pink:`#ec4899`,rose:`#f43f5e`},X=e=>Pe[e]||e,Z=(e,t)=>e?.variant===`comparison`?{strokeOpacity:typeof e.opacity==`number`?e.opacity:t===`line`||t===`scatter`?.5:.6,fillOpacity:typeof e.opacity==`number`?e.opacity:t===`bar`?.4:t===`area`?.2:.5,strokeDasharray:e.dashArray??(t===`line`||t===`area`?`4 4`:void 0)}:null;function Fe({chartType:e=`bar`,data:t=[],config:n={},xAxisKey:r=`name`,series:i=[],className:a=``,colors:o,categoryColors:s,onChartClick:c,isAnimationActive:l}){let u=e===`column`?`bar`:e,d=Array.isArray(t)?t:[],f=l===!1?{isAnimationActive:!1}:{},[p,m]=V.useState(!1),h=V.useCallback(e=>{if(!c||!e)return;let t=Array.isArray(e.activePayload)?e.activePayload[0]:void 0;c({category:e.activeLabel==null?void 0:String(e.activeLabel),series:t?.dataKey?String(t.dataKey):void 0,value:typeof t?.value==`number`?t.value:void 0})},[c]),ee=V.useCallback(e=>{if(!c||!e)return;let t=e.payload?.[r],n=i[0]?.dataKey||`value`;c({category:t==null?void 0:String(t),series:n,value:typeof e.payload?.[n]==`number`?e.payload[n]:void 0})},[c,r,i]),te=c?{onClick:h,style:{cursor:`pointer`}}:{},ne=c?{onClick:ee,style:{cursor:`pointer`}}:{},g=V.useCallback((e,t,n)=>s&&s[e==null?``:String(e)]||n[t%n.length],[s]),re=V.useCallback(e=>{if(!c)return;let t=ke(e,r,i);t&&c(t)},[c,r,i]),ie=V.useCallback(e=>{if(!c)return;let t=Ae(e,i);t&&c(t)},[c,i]),D=V.useCallback(e=>{if(!c)return;let t=je(e,i);t&&c(t)},[c,i]),j=c?{onClick:re,cursor:`pointer`}:{},he=c?{onClick:ie,style:{cursor:`pointer`}}:{},ge=c?{onClick:D,style:{cursor:`pointer`}}:{};V.useEffect(()=>{let e=()=>m(window.innerWidth<640);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let _e={bar:N,"horizontal-bar":N,line:T,area:de,pie:y,donut:y,radar:ue,scatter:O,funnel:pe,combo:N,treemap:N,sankey:N}[u]||N,F=V.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`string`?e:String(e);if(/^\d{4}-\d{2}-\d{2}/.test(t)){let e=new Date(t);if(!Number.isNaN(e.getTime())){let t=(d.length>1?Math.abs(new Date(String(d[d.length-1][r]??``)).getTime()-new Date(String(d[0][r]??``)).getTime()):0)/(1e3*60*60*24);try{return t<=62?e.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):e.toLocaleDateString(void 0,{month:`short`,year:`numeric`})}catch{return e.toISOString().slice(0,10)}}}return p&&t.length>8?t.slice(0,8)+`…`:t},[d,r,p]),ve=V.useMemo(()=>d.some(e=>String(e[r]||``).length>5),[d,r]),I=()=>Array.isArray(o)&&o.length>0?o:[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`,`hsl(var(--chart-4))`,`hsl(var(--chart-5))`],L=V.useCallback(e=>{if(e==null||e===``)return``;let t=typeof e==`number`?e:Number(e);if(!Number.isFinite(t))return String(e);try{return new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(t)}catch{return String(t)}},[]),ye=V.useMemo(()=>({tickLine:!1,tickMargin:10,axisLine:!1,interval:`preserveStartEnd`,minTickGap:p?32:48,tickFormatter:F,...!p&&ve&&{angle:-35,textAnchor:`end`,height:60}}),[p,ve,F]);if(u===`pie`||u===`donut`){let e=u===`donut`?`52%`:0,t=I(),o={...n};return d.forEach((e,n)=>{let i=e?.[r];if(i==null||i===``)return;let a=String(i);o[a]||(o[a]={label:a,color:g(i,n,t)})}),(0,H.jsx)(G,{config:o,className:a,children:(0,H.jsxs)(y,{children:[(0,H.jsx)(K,{cursor:!1,content:(0,H.jsx)(q,{hideLabel:!0})}),(0,H.jsx)(x,{data:d,dataKey:i[0]?.dataKey||`value`,nameKey:r||`name`,innerRadius:e,strokeWidth:5,paddingAngle:2,outerRadius:`85%`,...f,...ne,children:d.map((e,n)=>(0,H.jsx)(v,{fill:X(g(e?.[r],n,t))},`cell-${n}`))}),(0,H.jsx)(J,{verticalAlign:`bottom`,wrapperStyle:{fontSize:p?`11px`:`12px`,paddingTop:`8px`},content:(0,H.jsx)(Y,{nameKey:r,className:`flex-wrap`})})]})})}if(u===`funnel`){let e=i[0]?.dataKey||`value`,t=I(),o=c?t=>{t&&c({category:t?.payload?.[r]??t?.[r],value:t?.payload?.[e]??t?.[e]})}:void 0,s=o?{onClick:o,style:{cursor:`pointer`}}:{},l=[...d].sort((t,n)=>{let r=Number(t?.[e]??0);return Number(n?.[e]??0)-r});return(0,H.jsx)(G,{config:n,className:a,children:(0,H.jsxs)(pe,{children:[(0,H.jsx)(K,{content:(0,H.jsx)(q,{})}),(0,H.jsxs)(A,{dataKey:e,data:l,nameKey:r,isAnimationActive:!0,...s,children:[(0,H.jsx)(me,{position:`right`,fill:`hsl(var(--foreground))`,stroke:`none`,dataKey:r}),l.map((e,n)=>(0,H.jsx)(v,{fill:X(t[n%t.length])},`funnel-cell-${n}`))]})]})})}if(u===`treemap`){let e=i[0]?.dataKey||`value`,t=I(),o=d.map((n,i)=>({name:String(n?.[r]??``),size:Number(n?.[e])||0,fill:X(t[i%t.length])}));return(0,H.jsx)(G,{config:n,className:a,children:(0,H.jsx)(P,{data:o,dataKey:`size`,nameKey:`name`,isAnimationActive:!0,content:(0,H.jsx)(e=>{let{x:t,y:n,width:r,height:i,name:a,fill:o}=e;return r<=0||i<=0?null:(0,H.jsxs)(`g`,{children:[(0,H.jsx)(`rect`,{x:t,y:n,width:r,height:i,fill:o,stroke:`hsl(var(--background))`,strokeWidth:2}),r>48&&i>18?(0,H.jsx)(`text`,{x:t+6,y:n+18,fill:`#fff`,fontSize:12,className:`pointer-events-none`,children:a}):null]})},{}),...he,children:(0,H.jsx)(E,{})})})}if(u===`sankey`){let e=i[0]?.dataKey||`value`,t=i[0]?.label||e,o=d.filter(t=>(Number(t?.[e])||0)>0),s=[{name:t},...o.map(e=>({name:String(e?.[r]??``)}))],c=o.map((t,n)=>({source:0,target:n+1,value:Number(t?.[e])||0}));return c.length===0?(0,H.jsx)(`div`,{className:a}):(0,H.jsx)(G,{config:n,className:a,children:(0,H.jsx)(M,{data:{nodes:s,links:c},nodePadding:24,link:{stroke:`hsl(var(--muted-foreground))`,strokeOpacity:.25},node:{fill:`hsl(var(--chart-1))`},...ge,children:(0,H.jsx)(E,{})})})}if(u===`radar`)return(0,H.jsx)(G,{config:n,className:a,children:(0,H.jsxs)(ue,{data:d,children:[(0,H.jsx)(le,{}),(0,H.jsx)(oe,{dataKey:r}),(0,H.jsx)(se,{}),(0,H.jsx)(K,{content:(0,H.jsx)(q,{})}),(0,H.jsx)(J,{content:(0,H.jsx)(Y,{}),...p&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map(e=>{let t=X(n[e.dataKey]?.color||Ne);return(0,H.jsx)(ce,{dataKey:e.dataKey,stroke:t,fill:t,fillOpacity:.6},e.dataKey)})]})});if(u===`scatter`)return(0,H.jsx)(G,{config:n,className:a,children:(0,H.jsxs)(O,{children:[(0,H.jsx)(C,{vertical:!1}),(0,H.jsx)(w,{type:`number`,dataKey:r,name:String(n[r]?.label||r),tickLine:!1,axisLine:!1,minTickGap:p?32:48}),(0,H.jsx)(b,{type:`number`,dataKey:i[0]?.dataKey||`value`,name:String(n[i[0]?.dataKey]?.label||i[0]?.dataKey),tickLine:!1,axisLine:!1,tickFormatter:L,width:48}),(0,H.jsx)(ae,{type:`number`,range:[60,400]}),(0,H.jsx)(K,{content:(0,H.jsx)(q,{})}),(0,H.jsx)(J,{content:(0,H.jsx)(Y,{}),...p&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map((e,t)=>{let r=I(),i=X(n[e.dataKey]?.color||r[t%r.length]),a=Z(e,`scatter`);return(0,H.jsx)(fe,{name:n[e.dataKey]?.label||e.dataKey,data:d,fill:i,fillOpacity:a?.fillOpacity,...j},e.dataKey)})]})});if(u===`combo`)return(0,H.jsx)(G,{config:n,className:a,children:(0,H.jsxs)(N,{data:d,children:[(0,H.jsx)(C,{vertical:!1}),(0,H.jsx)(w,{dataKey:r,...ye}),(0,H.jsx)(b,{yAxisId:`left`,tickLine:!1,axisLine:!1,tickFormatter:L,width:48}),(0,H.jsx)(b,{yAxisId:`right`,orientation:`right`,tickLine:!1,axisLine:!1,tickFormatter:L,width:48}),(0,H.jsx)(K,{content:(0,H.jsx)(q,{})}),(0,H.jsx)(J,{content:(0,H.jsx)(Y,{}),...p&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map((e,t)=>{let r=X(n[e.dataKey]?.color||Ne),i=e.chartType||(t===0?`bar`:`line`),a=i===`bar`?`left`:`right`,o=Z(e,i);return i===`line`?(0,H.jsx)(S,{yAxisId:a,type:`monotone`,dataKey:e.dataKey,stroke:r,strokeWidth:2,dot:!1,strokeOpacity:o?.strokeOpacity,strokeDasharray:o?.strokeDasharray,...f},e.dataKey):i===`area`?(0,H.jsx)(k,{yAxisId:a,type:`monotone`,dataKey:e.dataKey,fill:r,stroke:r,fillOpacity:o?.fillOpacity??.4,strokeOpacity:o?.strokeOpacity,strokeDasharray:o?.strokeDasharray,...f},e.dataKey):(0,H.jsx)(_,{yAxisId:a,dataKey:e.dataKey,fill:r,radius:4,fillOpacity:o?.fillOpacity,...f},e.dataKey)})]})});let be=u===`horizontal-bar`,R=I(),xe=s?Object.values(s).map(e=>X(String(e))):[],Se=Array.from(new Set([...R,...xe,...i.map((e,t)=>X(n[e.dataKey]?.color||R[t%R.length]||Ne))])),z=e=>`g`+e.replace(/[^a-zA-Z0-9]/g,``);return(0,H.jsx)(G,{config:n,className:a,children:(0,H.jsxs)(_e,{data:d,layout:be?`vertical`:`horizontal`,...te,children:[(0,H.jsx)(`defs`,{children:Se.map(e=>(0,H.jsxs)(V.Fragment,{children:[(0,H.jsxs)(`linearGradient`,{id:`bg-${z(e)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,H.jsx)(`stop`,{offset:`0%`,style:{stopColor:e},stopOpacity:.95}),(0,H.jsx)(`stop`,{offset:`100%`,style:{stopColor:e},stopOpacity:.5})]}),(0,H.jsxs)(`linearGradient`,{id:`ag-${z(e)}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,H.jsx)(`stop`,{offset:`0%`,style:{stopColor:e},stopOpacity:.5}),(0,H.jsx)(`stop`,{offset:`95%`,style:{stopColor:e},stopOpacity:.05})]})]},z(e)))}),(0,H.jsx)(C,{vertical:!1}),be?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(w,{type:`number`,tickLine:!1,axisLine:!1,tickFormatter:L}),(0,H.jsx)(b,{type:`category`,dataKey:r,tickLine:!1,axisLine:!1,width:Math.min(140,Math.max(60,Math.max(...d.map(e=>String(e[r]??``).length))*7)),tickFormatter:F})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(w,{dataKey:r,...ye}),(0,H.jsx)(b,{tickLine:!1,axisLine:!1,tickFormatter:L,width:48})]}),(0,H.jsx)(K,{content:(0,H.jsx)(q,{})}),(0,H.jsx)(J,{content:(0,H.jsx)(Y,{}),...p&&{verticalAlign:`bottom`,wrapperStyle:{fontSize:`11px`,paddingTop:`8px`}}}),i.map((e,t)=>{let a=I(),o=e.variant===`comparison`,s=o?i.slice(0,t).find(e=>e.variant!==`comparison`)||i[0]:e,c=o?i.indexOf(s):t,l=X(n[s.dataKey]?.color||a[c%a.length]||Ne);if(u===`bar`||u===`horizontal-bar`){let t=i.filter(e=>e.variant!==`comparison`).length===1&&!o&&i.length===1&&d.length>1,n=Z(e,`bar`);return(0,H.jsx)(_,{dataKey:e.dataKey,fill:`url(#bg-${z(l)})`,radius:4,fillOpacity:n?.fillOpacity,...f,children:t&&d.map((e,t)=>(0,H.jsx)(v,{fill:`url(#bg-${z(X(g(e?.[r],t,a)))})`},`cell-${t}`))},e.dataKey)}if(u===`line`){let t=Z(e,`line`);return(0,H.jsx)(S,{type:`monotone`,dataKey:e.dataKey,stroke:l,strokeWidth:2,dot:!1,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray,...f},e.dataKey)}if(u===`area`){let t=Z(e,`area`);return(0,H.jsx)(k,{type:`monotone`,dataKey:e.dataKey,fill:`url(#ag-${z(l)})`,stroke:l,strokeWidth:2,fillOpacity:t?.fillOpacity??1,strokeOpacity:t?.strokeOpacity,strokeDasharray:t?.strokeDasharray,...f},e.dataKey)}return null})]})})}var Ie=t({default:()=>ze});function Le(e,t=14){return e.length>t?`${e.slice(0,t-1)}…`:e}function Re({x:e,y:t,payload:n}){let r=String(n?.value??``),i=Le(r);return(0,H.jsx)(`g`,{transform:`translate(${e},${t})`,children:(0,H.jsxs)(`text`,{dy:10,textAnchor:`end`,transform:`rotate(-32)`,fill:`hsl(var(--muted-foreground))`,fontSize:11,fontFamily:`monospace`,children:[r!==i&&(0,H.jsx)(`title`,{children:r}),i]})})}function ze({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:i=``,color:a=`hsl(var(--primary))`}){let o=e.map(e=>String(e?.[n]??``)),s=o.length>4||o.some(e=>e.length>8);return(0,H.jsx)(`div`,{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${i}`,children:(0,H.jsx)(D,{width:`100%`,height:r,children:(0,H.jsxs)(N,{data:e,margin:{top:10,right:10,left:10,bottom:s?24:5},children:[(0,H.jsxs)(`defs`,{children:[(0,H.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,H.jsx)(`stop`,{offset:`0%`,stopColor:a,stopOpacity:1}),(0,H.jsx)(`stop`,{offset:`90%`,stopColor:a,stopOpacity:.6}),(0,H.jsx)(`stop`,{offset:`100%`,stopColor:a,stopOpacity:.3})]}),(0,H.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,H.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,H.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,H.jsx)(`feFlood`,{floodColor:a,floodOpacity:`0.5`,result:`offsetColor`}),(0,H.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,H.jsxs)(`feMerge`,{children:[(0,H.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,H.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,H.jsx)(C,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,H.jsx)(w,{dataKey:n,tick:s?(0,H.jsx)(Re,{}):{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},interval:s?0:`preserveStartEnd`,height:s?56:void 0,dy:s?void 0:10}),(0,H.jsx)(b,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,H.jsx)(E,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,H.jsx)(j,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,H.jsx)(_,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var Be=V.lazy(()=>r(()=>Promise.resolve().then(()=>Ie),void 0,import.meta.url)),Ve=V.lazy(()=>r(()=>Promise.resolve().then(()=>Me),void 0,import.meta.url)),He=({schema:e})=>(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(B,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,H.jsx)(Be,{data:e.data,dataKey:e.dataKey,xAxisKey:e.xAxisKey,height:e.height,className:e.className,color:e.color})}),Q=({schema:e,onChartClick:t})=>{let n=V.useMemo(()=>{let t=e.series,n=e.xAxisKey,r=e.config;if(n||(e.index?n=e.index:e.category&&(n=e.category)),t||(e.categories?t=e.categories.map(e=>({dataKey:e})):e.value&&(t=[{dataKey:e.value}])),!r&&t){let n=e.colors||[`hsl(var(--chart-1))`,`hsl(var(--chart-2))`,`hsl(var(--chart-3))`],i={};t.forEach((e,t)=>{i[e.dataKey]={label:e.label||e.dataKey,color:n[t%n.length]}}),r=i}return{chartType:e.chartType,data:Array.isArray(e.data)?e.data:[],config:r,xAxisKey:n,series:t,className:e.className}},[e]);return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(B,{className:`w-full h-48 sm:h-64 md:h-80 lg:h-[400px]`}),children:(0,H.jsx)(Ve,{chartType:n.chartType,data:n.data,config:n.config,xAxisKey:n.xAxisKey,series:n.series,className:n.className,colors:Array.isArray(e.colors)?e.colors:void 0,categoryColors:e.categoryColors,isAnimationActive:e.isAnimationActive,onChartClick:t})})};function $(e){return e.replace(/[_-]/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Ue(e,t){let{field:n,function:r,groupBy:i}=t,a={};for(let t of e){let e=String(t[i]??`Unknown`);a[e]||(a[e]=[]),a[e].push(t)}return Object.entries(a).map(([e,t])=>{let a=t.map(e=>Number(e[n])||0),o;switch(r){case`count`:o=t.length;break;case`avg`:o=a.length>0?a.reduce((e,t)=>e+t,0)/a.length:0;break;case`min`:o=a.length>0?Math.min(...a):0;break;case`max`:o=a.length>0?Math.max(...a):0;break;default:o=a.reduce((e,t)=>e+t,0);break}return{[i]:e,[n]:o}})}async function We(e,t,n,r,i){if(!e.length||!t)return e;let a=i||((e,t)=>t),o=`__raw_${t}`,s=n?.fields?.[t];if(!s){let n=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let r=e[t],i=String(r??``),s=n.test(i)?i:$(i);return{...e,[t]:a(i,s),[o]:r}})}let c=s.type;if(c===`select`||c===`picklist`||c===`dropdown`){let n=s.options||[];if(n.length===0)return e.map(e=>{let n=e[t],r=String(n??``),i=$(r);return{...e,[t]:a(r,i),[o]:n}});let r={};for(let e of n)typeof e==`string`?r[e]=e:e&&typeof e==`object`&&(r[String(e.value)]=e.label||String(e.value));return e.map(e=>{let n=e[t],i=String(n??``),s=r[i]||$(i);return{...e,[t]:a(i,s),[o]:n}})}if(c===`lookup`||c===`master_detail`){let n=s.reference_to||s.reference;if(!n||!r||typeof r.find!=`function`)return e.map(e=>({...e,[o]:e[t]}));let i=[...new Set(e.map(e=>e[t]).filter(e=>e!=null))];if(i.length===0)return e.map(e=>({...e,[o]:e[t]}));let a=s.id_field||`id`;try{let c=h(await r.find(n,{$filter:{[a]:{$in:i}},$top:i.length})),l=s.reference_field||s.display_field||`name`,u={};for(let e of c){let t=String(e[a]??e.id??e._id??``),n=e[l]||e.name||e.label||e.title||t;t&&(u[t]=String(n))}return e.map(e=>{let n=e[t],r=String(n??``);return{...e,[t]:u[r]||r,[o]:n}})}catch(n){return console.warn(`[ObjectChart] Failed to resolve lookup labels:`,n),e.map(e=>({...e,[o]:e[t]}))}}if(c===`date`||c===`datetime`||c===`date_time`||c===`timestamp`||c===`time`)return e.map(e=>({...e,[o]:e[t]}));let l=/^\d{4}-\d{2}-\d{2}/;return e.map(e=>{let n=e[t],r=String(n??``);return{...e,[t]:l.test(r)?r:$(r),[o]:n}})}var Ge=e=>{let{schema:t}=e,n=e.onSegmentClick,r=(0,V.useContext)(s),i=e.dataSource||r?.dataSource,a=c(t.bind),{fieldOptionLabel:_}=L(),v=(0,V.useRef)(_);(0,V.useEffect)(()=>{v.current=_},[_]);let[y,b]=(0,V.useState)([]),[ae,x]=(0,V.useState)(()=>!(Array.isArray(t.data)&&t.data.length>0)&&(!!t.objectName||!!t.dataset)),[oe,se]=(0,V.useState)(null),[S,C]=(0,V.useState)(null),[w,ce]=(0,V.useState)(null),[le,T]=(0,V.useState)(null),{openRecordList:E}=l(),ue=te(),D=(0,V.useMemo)(()=>t.aggregate?JSON.stringify(t.aggregate):``,[t.aggregate]),O=(0,V.useMemo)(()=>t.filter?JSON.stringify(t.filter):``,[t.filter]),de=(0,V.useMemo)(()=>t.compareTo?JSON.stringify(t.compareTo):``,[t.compareTo]),k=(0,V.useMemo)(()=>t.dataset?JSON.stringify({d:t.dataset,dim:t.dimensions??[],val:t.values??[]}):``,[t.dataset,t.dimensions,t.values]),fe=e=>e!==`pie`&&e!==`donut`&&e!==`funnel`;(0,V.useEffect)(()=>{let e=!1;return(async()=>{try{let n={headers:{accept:`application/json`},credentials:`include`},r=t.objectName,i,a=null,o=t.aggregate?.groupBy;if(r)i=o&&typeof o==`object`&&!Array.isArray(o)?o.field:typeof o==`string`?o:t.xAxisKey;else if(t.dataset){let e=Array.isArray(t.dimensions)&&t.dimensions.length?t.dimensions[0]:void 0,o=await(await fetch(`/api/v1/meta/dataset/${encodeURIComponent(t.dataset)}`,n)).json().catch(()=>null);a=o?.item??o?.data??o,r=a?.object,i=((a?.dimensions||[]).find(t=>t?.name===e)??(a?.dimensions||[])[0])?.field??e}if(!r||!i){e||(ce(null),T(null));return}let s=await(await fetch(`/api/v1/meta/object/${encodeURIComponent(r)}`,n)).json().catch(()=>null),c=s?.item??s?.data??s,l=u(c?.fields?.[i]?.options),d=null;if(t.dataset&&Array.isArray(t.dimensions)){let e={};for(let n of t.dimensions){let t=(a?.dimensions||[]).find(e=>e?.name===n)?.field??n,r=re(c?.fields?.[t]?.options);r&&(e[n]=r)}Object.keys(e).length>0&&(d=e)}e||(ce(l),T(d))}catch{e||(ce(null),T(null))}})(),()=>{e=!0}},[t.objectName,t.dataset,k,D,t.xAxisKey]);let A=(0,V.useCallback)(async(e,n)=>{if(t.aggregate&&typeof e.aggregate==`function`){let r=t.aggregate.groupBy;if(r&&typeof r==`object`&&!Array.isArray(r)){let i=t.aggregate.field,a=t.aggregate.function,o={function:a,alias:i||a};a!==`count`&&i&&(o.field=i);let s=await e.aggregate(t.objectName,{groupBy:[r],aggregations:[o],where:n});return Array.isArray(s)?s:[]}let i=await e.aggregate(t.objectName,{field:t.aggregate.field,function:t.aggregate.function,groupBy:r,filter:n});return Array.isArray(i)?i:[]}if(typeof e.find==`function`){let r=h(await e.find(t.objectName,{$filter:n}));return t.aggregate&&r.length>0&&(r=Ue(r,t.aggregate)),r}return[]},[t.objectName,D]),pe=(0,V.useCallback)(async(e,n)=>{if(!e||!t.objectName&&!t.dataset){n.current&&x(!1);return}n.current&&(x(!0),se(null));try{if(t.dataset&&typeof e.queryDataset==`function`){let r=g(t.filter),i=await e.queryDataset(t.dataset,{dimensions:Array.isArray(t.dimensions)?t.dimensions:[],measures:Array.isArray(t.values)?t.values:[],...r?{runtimeFilter:r}:{}});n.current&&b(Array.isArray(i?.rows)?i.rows:[]);return}let r=g(t.filter),i=t.compareTo,a=!!i&&fe(t.chartType),o=a?f(t.filter,i):null,[s,c]=await Promise.all([A(e,r),o?A(e,o):Promise.resolve([])]),l=s,u=t.aggregate?.groupBy,d=u&&typeof u==`object`&&!Array.isArray(u)?u.alias||u.field:u||t.xAxisKey;if(a&&c.length>0&&t.aggregate){let e=t.aggregate.field,n=t.aggregate.function,r=t=>{if(t==null)return null;let r=`${e}_${n}`;return r in t?Number(t[r]):n===`count`&&`${e}_count`in t?Number(t[`${e}_count`]):e in t?Number(t[e]):`value`in t?Number(t.value):`count`in t?Number(t.count):null},i=`${e}__comparison`,a=d;if(a&&l.some(e=>e[a]!=null)&&c.some(e=>e[a]!=null)){let e=new Map;for(let t of c){let n=String(t[a]??``);e.set(n,r(t))}l=l.map(t=>{let n=String(t[a]??``),r=e.get(n);return r==null?t:{...t,[i]:r}});let t=new Set(l.map(e=>String(e[a]??``)));for(let e of c){let n=String(e[a]??``);t.has(n)||l.push({[a]:n,[i]:r(e)})}}else{let e=Math.max(l.length,c.length),t=[];for(let n=0;n<e;n++){let e=l[n]||{},a=c[n];t.push(a?{...e,[i]:r(a)}:e)}l=t}}if(d&&typeof e.getObjectSchema==`function`)try{let n=await e.getObjectSchema(t.objectName);l=await We(l,d,n,e,(e,n)=>v.current(t.objectName,d,e,n))}catch{}n.current&&b(l)}catch(e){console.error(`[ObjectChart] Fetch error:`,e),n.current&&se(e instanceof Error?e.message:`Failed to load chart data`)}finally{n.current&&x(!1)}},[t.objectName,k,D,O,de,t.xAxisKey,t.chartType,A]);(0,V.useEffect)(()=>{let e={current:!0};return(t.objectName||t.dataset)&&!a&&!t.data?pe(i,e):e.current&&x(!1),()=>{e.current=!1}},[t.objectName,k,i,a,t.data,O,D,de,pe]);let j=a||t.data||y,M=Array.isArray(j)?j:[],N=t.drillDown,P=t.aggregate?.groupBy||t.xAxisKey,me=(0,V.useMemo)(()=>{if(!P)return new Map;let e=new Map,t=`__raw_${P}`;for(let n of M){let r=n?.[P];if(r==null)continue;let i=t in(n||{})?n[t]:r;e.set(String(r),i)}return e},[M,P]),B=t.compareTo,U=!!B&&fe(t.chartType)&&!!t.aggregate&&M.some(e=>e[`${t.aggregate.field}__comparison`]!=null),we=(0,V.useMemo)(()=>{let e=Array.isArray(t.series)?t.series:null;if(!U)return e;let n=e||[{dataKey:t.aggregate.field}],r={vsLastWeek:`Previous week`,vsLastMonth:`Previous month`,vsLastQuarter:`Previous quarter`,vsLastYear:`Previous year`,vsYesterday:`Yesterday`,vsPreviousPeriod:`Previous period`}[d(B,t.filter)]||`Previous period`;return[...n.map(e=>({...e,variant:e.variant||`current`})),{dataKey:`${t.aggregate.field}__comparison`,label:r,variant:`comparison`}]},[U,t.series,t.aggregate,t.filter,B]),W=t.dataset?ne(ie(M,le),t.dimensions,t.values):null,Te=W?{...t,data:W.data,xAxisKey:W.xAxisKey,series:W.series}:{...t,data:M,...we?{series:we}:{}},G=t.colors&&!Array.isArray(t.colors)&&typeof t.colors==`object`?t.colors:null,Ee=Array.isArray(t.colors)?t.colors:void 0,K=w||G?{...w||{},...G||{}}:void 0,q={...Te,colors:Ee,...K?{categoryColors:K}:{}};if(ae&&M.length===0)return(0,H.jsxs)(`div`,{className:`p-2 `+(t.className||``),"data-testid":`chart-loading`,role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:`Loading chart data…`}),(0,H.jsx)(Ce,{className:`h-full`})]});if(oe)return(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 p-4 `+(t.className||``),"data-testid":`chart-error`,role:`alert`,children:[(0,H.jsx)(ge,{className:`h-6 w-6 text-destructive opacity-60`}),(0,H.jsx)(`p`,{className:`text-xs text-destructive font-medium`,children:`Failed to load chart data`}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground max-w-xs text-center`,children:oe})]});if(!i&&t.objectName&&M.length===0)return(0,H.jsxs)(`div`,{className:`flex items-center justify-center text-muted-foreground text-sm p-4 `+(t.className||``),"data-testid":`chart-no-datasource`,children:[`No data source available for “`,t.objectName,`”`]});let J=m(N)?e=>{let t=e.category,n=t!=null&&me.has(String(t))?me.get(String(t)):t;C({...e,category:n,categoryLabel:t,scope:`cell`})}:void 0,Y=n??J,De=!n&&S&&t.objectName?(()=>{let e=ee(N,S,{groupByField:P}),n={...t.filter||{},...e},r=p(N,S,t.title||`Details`),a=N?.target??`drawer`,s=(0,H.jsx)(`div`,{className:`overflow-auto`,"data-testid":`chart-drill-body`,children:(0,H.jsx)(o,{schema:{type:`object-data-table`,objectName:t.objectName,filter:n,pagination:!0,pageSize:N?.maxRows,columns:N?.columns?.map(e=>({accessorKey:e,header:e})),drillDown:{enabled:!0,mode:`record`,target:`dialog`}},dataSource:i})}),c=E&&t.objectName?(0,H.jsxs)(he,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`drill-open-in-list`,onClick:()=>{E(t.objectName,n),C(null)},children:[ue(`dashboard.openInList`,`Open in list`),(0,H.jsx)(z,{className:`ml-1 h-3.5 w-3.5`})]}):null;return a===`dialog`?(0,H.jsx)(_e,{open:!0,onOpenChange:e=>!e&&C(null),children:(0,H.jsxs)(I,{className:`max-w-4xl`,children:[(0,H.jsxs)(Se,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,H.jsx)(xe,{children:r}),c]}),s]})}):(0,H.jsx)(be,{open:!0,onOpenChange:e=>!e&&C(null),children:(0,H.jsxs)(ve,{side:`right`,className:`w-full sm:max-w-2xl md:max-w-3xl lg:max-w-4xl flex flex-col`,children:[(0,H.jsxs)(R,{className:`flex-row items-center justify-between gap-4 pr-8`,children:[(0,H.jsx)(F,{children:r}),c]}),(0,H.jsx)(`div`,{className:`flex-1 overflow-hidden mt-2`,children:s})]})})})():null;return(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(ye,{active:ae&&M.length>0}),(0,H.jsx)(Q,{...e,schema:q,onChartClick:Y}),De]})};a.register(`object-chart`,Ge,{namespace:`plugin-charts`,label:`Object Chart`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Optional static data`},{name:`filter`,type:`array`,label:`Filter`},{name:`aggregate`,type:`object`,label:`Aggregate`,description:`Aggregation config: { field, function, groupBy }`}]});var Ke=t({ChartBarRenderer:()=>He,ChartRenderer:()=>Q,ObjectChart:()=>Ge,chartComponents:()=>qe}),qe={"bar-chart":He,chart:Q};a.register(`bar-chart`,He,{namespace:`plugin-charts`,label:`Bar Chart`,category:`plugin`,inputs:[{name:`data`,type:`array`,label:`Data`,required:!0},{name:`dataKey`,type:`string`,label:`Data Key`,defaultValue:`value`},{name:`xAxisKey`,type:`string`,label:`X-Axis Key`,defaultValue:`name`},{name:`height`,type:`number`,label:`Height`,defaultValue:400},{name:`color`,type:`color`,label:`Color`,defaultValue:`#8884d8`}],defaultProps:{data:[{name:`Jan`,value:400},{name:`Feb`,value:300},{name:`Mar`,value:600},{name:`Apr`,value:800},{name:`May`,value:500}],dataKey:`value`,xAxisKey:`name`,height:400,color:`#8884d8`}}),a.register(`chart`,Ge,{namespace:`view`,category:`view`,label:`Chart`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`type`,type:`string`,label:`Chart Type`},{name:`categoryField`,type:`string`,label:`Category Field`},{name:`valueField`,type:`string`,label:`Value Field`}]}),a.register(`chart`,Q,{namespace:`plugin-charts`,label:`Chart`,category:`plugin`,inputs:[{name:`chartType`,type:`enum`,label:`Chart Type`,enum:[{label:`Bar`,value:`bar`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Pie`,value:`pie`},{label:`Donut`,value:`donut`},{label:`Radar`,value:`radar`},{label:`Scatter`,value:`scatter`}],defaultValue:`bar`},{name:`data`,type:`code`,label:`Data (JSON)`,required:!0},{name:`config`,type:`code`,label:`Config (JSON)`},{name:`xAxisKey`,type:`string`,label:`X Axis Key`,defaultValue:`name`},{name:`series`,type:`code`,label:`Series (JSON Array)`,required:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{chartType:`bar`,data:[{name:`Jan`,sales:400,revenue:240},{name:`Feb`,sales:300,revenue:139},{name:`Mar`,sales:600,revenue:380},{name:`Apr`,sales:800,revenue:430},{name:`May`,sales:500,revenue:220}],config:{sales:{label:`Sales`,color:`#8884d8`},revenue:{label:`Revenue`,color:`#82ca9d`}},xAxisKey:`name`,series:[{dataKey:`sales`},{dataKey:`revenue`}]}}),a.register(`chart:bar`,Q,{namespace:`plugin-charts`,label:`Bar Chart (Alias)`,category:`plugin`,defaultProps:{chartType:`bar`}}),a.register(`pie-chart`,Q,{namespace:`plugin-charts`,label:`Pie Chart`,category:`plugin`,defaultProps:{chartType:`pie`}}),a.register(`donut-chart`,Q,{namespace:`plugin-charts`,label:`Donut Chart`,category:`plugin`,defaultProps:{chartType:`donut`}}),a.register(`radar-chart`,Q,{namespace:`plugin-charts`,label:`Radar Chart`,category:`plugin`,defaultProps:{chartType:`radar`}}),a.register(`scatter-chart`,Q,{namespace:`plugin-charts`,label:`Scatter Chart`,category:`plugin`,defaultProps:{chartType:`scatter`}});export{Ke as t};
|