import{j as r}from"./cm-1.0.63-CSIRHMXC.js";import{r as y}from"./redux-1.0.63-Df-eBzJn.js";import{w as A,x as M}from"./index-1.0.63-Cr9ps5ft.js";import{u as T}from"./useTableColumnOrder-1.0.63-CK5iViyi.js";import{a as I}from"./hooks-1.0.63-CWs3kTdT.js";import{a as L}from"./useChartSettings-1.0.63-BMkc1WeB.js";import{a2 as v}from"./lib-1.0.63-DJZPtMem.js";import{a as S}from"./useRemoveAppFromStore-1.0.63-DNpeLtWd.js";import{u as F}from"./useLocaleMrt-1.0.63-GdlE-vXx.js";import{B as d}from"./Spinner-1.0.63-zcgIyS7Z.js";import{F as B,I as O,T as P}from"./TextField-1.0.63-C35Mfi1Q.js";import{S as k}from"./Select-1.0.63-BMejr8a7.js";import{M as w}from"./MenuItem-1.0.63-Bvb3IjMP.js";import{e as E}from"./index-1.0.63-oIDff4nA.js";import{I as R}from"./iconBase-1.0.63-CFvHhC4t.js";import{A as _}from"./Autocomplete-1.0.63-pp6oOzlN.js";import{C as G}from"./Chip-1.0.63-QLWMq6MQ.js";const to=({appId:n,metaData:a,tableStore:x,setUpdateStatus:p})=>{const g=I(),e=L(n),c=T(n),f=y.useMemo(()=>{const o=[];return c.map(t=>{var l;const s=(l=a==null?void 0:a.columns)==null?void 0:l.findIndex(m=>m.column_name===t);if(s!==-1)switch(a.columns[s].data_type.toLowerCase()){case"decimal":case"double":case"double precision":case"float":case"real":case"bit":case"tinyint":case"smallint":case"int":case"integer":case"mediumint":case"bigint":o.push({columnName:t,dataType:"number"});break}}),o},[c]),h=S(n),{mrtLocale:C,mrtIsLoading:b}=F(h.language.code),u=o=>{g(v({appId:n,property:o})),p&&p(!0)},i=o=>{const t=x.columns.filter(s=>s.columnName===o);return t.length===1?t[0].columnLabel:o};return b?null:r.jsxs(r.Fragment,{children:[r.jsxs(d,{sx:{display:"grid",gridTemplateColumns:"1fr auto",alignItems:"center"},children:[r.jsx(d,{sx:{marginRight:"12px"},children:r.jsxs(B,{fullWidth:!0,sx:{marginTop:"5px"},children:[r.jsx(O,{variant:"outlined",children:"Major Axis"}),r.jsx(k,{label:"Major Axis",variant:"outlined",value:e==null?void 0:e.majorAxisColumn,onChange:o=>{u({majorAxisColumn:o.target.value??""}),o.stopPropagation()},className:"pp-chart-category-column",sx:{"&.pp-chart-category-column .MuiSelect-select, &.pp-chart-category-column input":{padding:"16.5px 14px"}},children:c.map(function(o){if(i(o)!=="")return r.jsx(w,{"data-id":"ppChartCategoryColumn",value:o,children:i(o)},o)})})]})}),r.jsx(E,{title:C.groupedBy,children:r.jsx(R,{color:"primary",onClick:o=>{u({grouped:!e.grouped}),o.stopPropagation()},children:e.grouped?r.jsx(A,{}):r.jsx(M,{})})})]}),r.jsx(_,{multiple:!0,options:f.map(o=>o.columnName),getOptionLabel:o=>i(o),value:e.minorAxisColumns,disableCloseOnSelect:!0,onChange:(o,t)=>{u({minorAxisColumns:t}),o.stopPropagation()},renderInput:o=>r.jsx(P,{...o,label:"Minor Axis",variant:"outlined"}),renderTags:(o,t)=>o.map((s,l)=>{const{key:m,...j}=t({index:l});return r.jsx(G,{variant:"outlined",label:i(s),...j},m)}),className:"pp-chart-category-column",sx:{"&.pp-chart-category-column .MuiInputBase-root":{backgroundColor:"transparent"}}})]})};export{to as T};
