orbcafe-ui 1.2.4 → 1.2.5

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/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- import {a}from'./chunk-74Z76O3S.mjs';export{b as COrbCanvas}from'./chunk-74Z76O3S.mjs';import*as st from'react';import st__default,{createContext,useMemo,useContext,useState,useEffect,useCallback,Fragment as Fragment$1,useRef}from'react';import {usePathname,useRouter}from'next/navigation';import {ChevronRight,Search,Plus,Mic,ThumbsDown,ThumbsUp,Volume2,RefreshCw,Copy,Terminal,Clock,X,ChevronDown,Box as Box$1,Lightbulb,AlertCircle,RotateCw,Check,Clipboard,CheckCircle,XCircle,Loader2,AlertTriangle,Info,BarChart,MapPin,Globe,TrendingDown,GitBranch,Grid as Grid$1,Activity,PieChart,LineChart}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Slot}from'@radix-ui/react-slot';import {cva}from'class-variance-authority';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Jd from'@mui/material/Dialog';import ep from'@mui/material/DialogTitle';import tp from'@mui/material/DialogContent';import mg from'@mui/material/DialogContentText';import op from'@mui/material/DialogActions';import kn from'@mui/material/Box';import hg from'@mui/icons-material/CheckCircle';import yg from'@mui/icons-material/Warning';import bg from'@mui/icons-material/Error';import xg from'@mui/icons-material/Info';import {styled,Box,Typography,Paper,Stack,Link,Dialog,DialogTitle,IconButton,DialogContent,MenuItem,DialogActions,Button,Chip,InputBase,useTheme,Autocomplete,TextField,Tooltip,FormControlLabel,Checkbox,Menu,ListItemText,Divider,Collapse,Grid,ListItemIcon,CircularProgress,Alert,TableContainer,Table,TableHead,TableRow,TableCell,TableBody,Tabs,Tab,LinearProgress,Avatar,AppBar,Toolbar,InputAdornment,createTheme,ThemeProvider,FormControl,Select,Switch,Portal,useMediaQuery,Drawer,Popover,ListSubheader,Badge,TableFooter}from'@mui/material';import Cy from'@mui/material/Paper';import ky from'@mui/material/Table';import Sy from'@mui/material/TableBody';import Js from'@mui/material/TableCell';import np from'@mui/material/TableContainer';import Kg from'@mui/material/TableHead';import qg from'@mui/material/TableRow';import ap from'@mui/material/TextField';import Vi from'@mui/material/Button';import rp from'@mui/material/Alert';import {DndContext,closestCenter,useSensors,useSensor,PointerSensor,TouchSensor,closestCorners,DragOverlay,useDroppable,useDraggable}from'@dnd-kit/core';import {restrictToHorizontalAxis}from'@dnd-kit/modifiers';import $d from'@mui/icons-material/Search';import Ag from'@mui/icons-material/ViewColumn';import Zd from'@mui/icons-material/Save';import Fg from'@mui/icons-material/Download';import Eg from'@mui/icons-material/AccountTree';import Lg from'@mui/icons-material/Functions';import Ng from'@mui/icons-material/Insights';import zg from'@mui/icons-material/Add';import Vg from'@mui/icons-material/Edit';import Og from'@mui/icons-material/Delete';import $g from'@mui/icons-material/KeyboardArrowLeft';import Wg from'@mui/icons-material/KeyboardArrowRight';import _g from'@mui/material/Checkbox';import Zg from'@mui/material/TableSortLabel';import jg from'@mui/material/IconButton';import Qg from'@mui/material/Tooltip';import Xg from'@mui/icons-material/UnfoldMore';import Yg from'@mui/icons-material/UnfoldLess';import rf from'@mui/icons-material/KeyboardArrowDown';import xf from'@mui/icons-material/Check';import vf from'@mui/icons-material/ClearAll';import _f from'@mui/icons-material/Close';import th from'@mui/icons-material/MicNoneOutlined';import oh from'@mui/icons-material/SettingsOutlined';import ah from'@mui/icons-material/SendOutlined';import Jh from'@mui/icons-material/Settings';import ey from'@mui/icons-material/KeyboardArrowUp';import oy from'@mui/icons-material/ArrowRightAlt';import wh from'@mui/icons-material/Star';import {DateCalendar}from'@mui/x-date-pickers/DateCalendar';import {PickersDay}from'@mui/x-date-pickers/PickersDay';import {LocalizationProvider}from'@mui/x-date-pickers/LocalizationProvider';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import Oh from'@mui/icons-material/CalendarMonth';import $h from'@mui/icons-material/Clear';import Wh from'@mui/icons-material/ArrowForward';import _a from'dayjs';import Hh from'dayjs/plugin/isBetween';import Gh from'dayjs/plugin/localizedFormat';import'dayjs/locale/zh-cn';import'dayjs/locale/fr';import'dayjs/locale/de';import'dayjs/locale/ja';import'dayjs/locale/ko';import hy from'@mui/icons-material/StarBorder';import yy from'@mui/icons-material/ViewQuilt';import Ob from'@mui/icons-material/CloseOutlined';import Oy from'@mui/icons-material/ContentCopyOutlined';import $y from'@mui/icons-material/CheckOutlined';import fb from'@mui/icons-material/ExpandMore';import {arrayMove,SortableContext,verticalListSortingStrategy,useSortable}from'@dnd-kit/sortable';import {alpha,useTheme as useTheme$1,createTheme as createTheme$1,ThemeProvider as ThemeProvider$1}from'@mui/material/styles';import zp from'@mui/icons-material/Language';import wx from'@mui/icons-material/DesktopWindows';import Ix from'@mui/icons-material/DarkMode';import Tx from'@mui/icons-material/LightMode';import Rx from'@mui/icons-material/Logout';import G0 from'@mui/icons-material/DeleteOutline';import Xx from'@mui/icons-material/DragIndicator';import f0 from'@mui/icons-material/FilterList';import h0 from'@mui/icons-material/TableRows';import o0 from'@mui/icons-material/LayersClear';import gv from'@mui/icons-material/CameraAltRounded';import fv from'@mui/icons-material/QrCodeScannerRounded';import xv from'@mui/icons-material/DragIndicatorRounded';import Sv from'@mui/icons-material/BackspaceRounded';import wv from'@mui/icons-material/CloseRounded';import Iv from'@mui/icons-material/CheckRounded';import $v from'@mui/icons-material/SearchRounded';import Wv from'@mui/icons-material/MenuOpenRounded';import Hv from'@mui/icons-material/MenuRounded';import Gv from'@mui/icons-material/ExpandMoreRounded';import Uv from'@mui/icons-material/ChevronRightRounded';import dC from'next/dynamic';import {AnimatePresence,motion}from'framer-motion';import wk from'react-markdown';import Ik from'remark-gfm';import Tk from'remark-math';import Pk from'rehype-katex';import Rk from'rehype-raw';import {Prism}from'react-syntax-highlighter';import {oneDark,oneLight}from'react-syntax-highlighter/dist/esm/styles/prism';import {useTheme as useTheme$2}from'next-themes';import cm from'mermaid';import Ok from'@mui/icons-material/MicRounded';import $k from'@mui/icons-material/MicOffRounded';import {InsertDriveFile,Close,Stop}from'@mui/icons-material';import Kk from'@mui/icons-material/SendRounded';import qk from'@mui/icons-material/AddRounded';import _k from'@mui/icons-material/HardwareRounded';function io(...e){return twMerge(clsx(e))}var Hs={primary:"#000000",primaryHover:"#333333"},Xn={primary:"bg-primary text-primary-foreground hover:bg-primary/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground"},an={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},Bc=()=>"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50";var Wm=cva(Bc(),{variants:{variant:{default:`${Xn.primary} shadow-sm`,destructive:"bg-red-500 text-white hover:bg-red-600 active:bg-red-700 dark:bg-red-600 dark:hover:bg-red-500 dark:active:bg-red-700 shadow-sm",outline:`${Xn.outline} shadow-sm`,secondary:"bg-gray-200 text-gray-700 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600 dark:active:bg-gray-500 shadow-sm",ghost:Xn.ghost,link:"text-blue-600 dark:text-blue-400 underline-offset-4 hover:underline hover:text-blue-700 dark:hover:text-blue-300 active:text-blue-800 dark:active:text-blue-200","chat-tool":"bg-[var(--orbai-surface-2)] border border-[var(--orbai-border-soft)] text-[var(--orbai-text-2)] hover:bg-[var(--orbai-surface-3)] hover:border-[var(--orbai-border-strong)] hover:text-[var(--orbai-text-1)] active:scale-95 transition-all duration-200","chat-send":`bg-[${Hs.primary}] hover:bg-[${Hs.primaryHover}] text-white border border-[var(--orbai-border-strong)] shadow-[var(--orbai-shadow-soft-sm)] hover:shadow-[var(--orbai-shadow-soft-md)] active:scale-95 transition-all duration-200`,"chat-stop":"bg-red-500 hover:bg-red-600 border border-[var(--orbai-border-strong)] shadow-[var(--orbai-shadow-soft-sm)] hover:shadow-[var(--orbai-shadow-soft-md)] active:scale-95 text-white transition-all duration-200","chat-disabled":"cursor-not-allowed opacity-50 bg-[var(--orbai-surface-2)] border border-[var(--orbai-border-soft)] text-[var(--orbai-muted)]"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10","chat-sm":"h-8 w-8 rounded-full","chat-md":"h-10 w-10 rounded-full","chat-lg":"h-12 w-12 rounded-full"},rounded:{none:an.none,sm:an.sm,md:an.md,full:an.full}},defaultVariants:{variant:"default",size:"default",rounded:"md"}}),Gs=st.forwardRef(({className:e,variant:t,size:o,asChild:a=false,...r},n)=>jsx(a?Slot:"button",{className:io(Wm({variant:t,size:o,className:e})),ref:n,...r}));Gs.displayName="Button";var Gm={"common.cancel":"Cancel","common.save":"Save","common.ok":"OK","common.done":"Done","common.search":"Search","common.none":"None","common.all":"All","common.noData":"No data","common.copy":"Copy","common.delete":"Delete","common.loading":"Loading...","header.searchPlaceholder":"Ask me...","header.theme.system":"Theme: System","header.theme.dark":"Theme: Dark","header.theme.light":"Theme: Light","header.menu.setting":"Setting","header.menu.logout":"Logout","navigation.expand":"Expand navigation","navigation.collapse":"Collapse navigation","navigation.searchPlaceholder":"Search menu...","navigation.noMatch":"No matching menu items","navigation.noAccessibleApp":"No accessible applications","navigation.noItems":"No items to display","navigation.expandView":"Expand {title}","table.toolbar.searchPlaceholder":"Search...","table.title.default":"Data Table","table.toolbar.groupBy":"Group By","table.toolbar.summary":"Summary","table.toolbar.columns":"Columns","table.toolbar.export":"Export","table.toolbar.itemsPerPage":"Items per page:","table.toolbar.pageOf":"Page {current} of {total}","table.toolbar.newItem":"New Item","table.toolbar.editItem":"Edit Item","table.toolbar.deleteItem":"Delete Item","table.toolbar.graphicReport":"Graphic Report","table.toolbar.saveLayout":"Save Layout","table.menu.groupBy":"Group By","table.menu.clearAll":"Clear All","table.menu.visibleColumns":"Visible Columns","table.menu.showSummaryRow":"Show Summary Row","table.menu.noNumericColumns":"No numeric columns","table.group.expandAll":"Expand All Groups","table.group.collapseAll":"Collapse All Groups","table.mobile.notImplemented":"Mobile View Not Implemented","pivot.title.default":"Pivot Table Builder","pivot.subtitle.default":"Drag fields to configure the pivot table.","pivot.empty":"Drag at least one field into Values to render the pivot result.","pivot.records":"Records","pivot.afterFilter":"After filter","pivot.grandTotal":"Grand Total","pivot.resultLabel":"Result","pivot.valueLabel":"Value","pivot.table.dimensions":"Dimensions","pivot.config.title":"Configuration","pivot.fieldList":"Field List","pivot.availableDimensions":"Available dimensions","pivot.allFieldsInUse":"All fields are in use.","pivot.zone.rows":"Rows","pivot.zone.columns":"Columns","pivot.zone.filters":"Filters","pivot.zone.values":"Values","pivot.hint.rows":"Drag fields here to build row hierarchy","pivot.hint.columns":"Drag fields here to build column hierarchy","pivot.hint.filters":"Drag fields here for report filters","pivot.hint.values":"Drag numeric fields here for aggregation","pivot.clearArea":"Clear area","pivot.filter.na":"N/A","pivot.filter.noValues":"No values","pivot.filter.noneSelected":"None selected","pivot.filter.allValues":"All values","pivot.filter.selectedCount":"{selected} / {total} selected","pivot.filter.selectAll":"Select All","pivot.filter.deselectAll":"Deselect All","pivot.filter.noResults":"No results","pivot.collapse.ariaExpand":"Expand configuration area","pivot.collapse.ariaCollapse":"Collapse configuration area","pivot.agg.sum":"Sum","pivot.agg.count":"Count","pivot.agg.avg":"Average","pivot.agg.min":"Min","pivot.agg.max":"Max","pivot.preset.selectPlaceholder":"Select preset","pivot.preset.save":"Save preset","pivot.preset.delete":"Delete preset","pivot.preset.saveDialogTitle":"Save current preset","pivot.preset.nameLabel":"Preset name","pivot.preset.defaultName":"Preset {index}","pivot.table.sectionTitle":"Pivot Result","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"Expand pivot result","pivot.table.collapse.ariaCollapse":"Collapse pivot result","pivot.chart.title":"Pivot Chart","pivot.chart.subtitle":"Map one dimension and up to two measures into a compact chart.","pivot.chart.subtitleReady":"{dimension} by {measure}","pivot.chart.emptyNoDimension":"Add at least one row or column field to render the chart.","pivot.chart.emptyNoValue":"Add at least one value field to render the chart.","pivot.chart.emptyNoData":"No data available for the current chart selection.","pivot.chart.dimension":"Dimension","pivot.chart.primaryMeasure":"Measure","pivot.chart.secondaryMeasure":"Compare measure","pivot.chart.chartType":"Chart type","pivot.chart.style.barVertical":"Vertical bars","pivot.chart.style.barHorizontal":"Horizontal bars","pivot.chart.style.line":"Line","pivot.chart.style.scatter":"Scatter","pivot.chart.collapse.ariaExpand":"Expand chart area","pivot.chart.collapse.ariaCollapse":"Collapse chart area","smartFilter.adaptFilters":"Adapt Filters","smartFilter.addFilters":"Add Filters","smartFilter.go":"Go","smartFilter.visibleFilters":"Visible Filters","smartFilter.searchPlaceholder":"Search...","smartFilter.noOptionsFound":"No options found","smartFilter.min":"Min","smartFilter.max":"Max","smartFilter.minMaxPlaceholder":"Min - Max","smartFilter.operator.equals":"Equals","smartFilter.operator.contains":"Contains","smartFilter.operator.notContains":"Does Not Contain","smartFilter.operator.wildcard":"Wildcard Search","smartFilter.operator.notEquals":"Not Equals","smartFilter.operator.greaterThan":"Greater Than","smartFilter.operator.lessThan":"Less Than","smartFilter.operator.greaterOrEqual":"Greater Than or Equal","smartFilter.operator.lessOrEqual":"Less Than or Equal","smartFilter.operator.between":"Between","variant.noOptions":"No options","variant.defaultSuffix":"Default","variant.selectVariant":"Select Variant","variant.saveView":"Save View","variant.newVariant":"New Variant","variant.viewName":"View Name","variant.setDefault":"Set as Default","variant.publicAllUsers":"Public (All Users)","variant.toast.fetchFailed":"Failed to load variants","variant.toast.saveFailed":"Failed to save variant","variant.toast.saveSuccess":"Variant saved successfully","variant.toast.deleteFailed":"Failed to delete variant","variant.toast.deleteSuccess":"Variant deleted successfully","variant.toast.defaultFailed":"Failed to update default variant","variant.toast.defaultSuccess":"Default variant updated","layout.saveLayout":"Save Layout","layout.layoutOptions":"Layout Options","layout.selectLayout":"Select Layout","layout.saveCurrentLayout":"Save Current Layout...","layout.noSavedLayouts":"No saved layouts","layout.removeDefault":"Remove Default","layout.setAsDefault":"Set as Default","layout.layoutName":"Layout Name","layout.layoutDescription":"Description","layout.layoutNameHelper":"e.g., 'Compact View'","layout.warningOverwrite":"Warning: Existing layout will be overwritten","layout.useAsDefault":"Use as Default Layout","layout.publicAllUsers":"Public (Visible to all users)","layout.toast.loadFallback":"Failed to load layouts from backend, fallback to local storage","layout.toast.saveSuccess":"Layout saved successfully","layout.toast.saveLocalSuccess":"Layout saved to local storage","layout.toast.backendUnavailableSavedLocal":"Backend unavailable, saved to local storage","layout.toast.deleteSuccess":"Layout deleted successfully","layout.toast.deleteLocalSuccess":"Layout deleted from local storage","layout.toast.backendUnavailableDeletedLocal":"Backend unavailable, deleted from local storage","layout.toast.defaultSuccess":"Default layout set","layout.toast.defaultLocalSuccess":"Default layout set in local storage","layout.toast.backendUnavailableDefaultLocal":"Backend unavailable, default saved to local storage","dateRange.label":"Date Range","dateRange.startDate":"Start Date","dateRange.endDate":"End Date","dateRange.select":"Select...","dateRange.today":"Today","dateRange.thisWeek":"This Week","dateRange.thisMonth":"This Month","graph.records":"{count} records","graph.kpi.totalRecords":"Total Records","graph.kpi.totalReport":"Total Report","graph.kpi.totalBillable":"Total Billable","graph.kpi.efficiency":"Efficiency","graph.kpi.amount":"Amount","graph.kpi.flagged":"Flagged","graph.chart.billable.title":"Billable by Dimension","graph.chart.billable.subtitle":"Top values by billable hours","graph.chart.efficiency.title":"Efficiency by Person","graph.chart.efficiency.subtitle":"Lowest efficiency first","graph.chart.status.title":"Status Distribution","graph.chart.status.subtitle":"Record ratio by status","graph.dataBody":"Data Body","graph.reportTitle":"Graphic Report","graph.unassigned":"Unassigned","graph.column.reportHours":"Report Hours","graph.column.billableHours":"Billable Hours","detail.searchAi.placeholder":"Search fields, or ask AI if no match...","detail.searchAi.matches":"{count} matches found","detail.searchAi.noMatch":"No matching field found.","detail.searchAi.autoAiFallback":"No direct match. Triggering AI analysis...","detail.searchAi.aiResultTitle":"AI Insight","detail.table.title":"Related Records","kanban.empty":"Drop cards here","kanban.bucket.limit":"Limit","kanban.bucket.dropHere":"Release to move into this bucket","kanban.card.progress":"Progress","kanban.card.openDetail":"Open Detail","kanban.priority.critical":"Critical","kanban.priority.high":"High","kanban.priority.medium":"Medium","kanban.priority.low":"Low","quickCreate.newItem":"New Item","quickCreate.createWithTitle":"Create {title}","quickEdit.editWithTitle":"Edit {title}","quickDelete.confirmTitle":"Confirm Delete","quickDelete.confirmMessageSingle":"Are you sure you want to delete the selected record?","quickDelete.confirmMessageMultiple":"Are you sure you want to delete {count} selected records?","messageBox.confirm":"OK","messageBox.cancel":"Cancel"},Um={"common.cancel":"\u53D6\u6D88","common.save":"\u4FDD\u5B58","common.ok":"\u786E\u5B9A","common.done":"\u5B8C\u6210","common.search":"\u641C\u7D22","common.none":"\u65E0","common.all":"\u5168\u90E8","common.noData":"\u6682\u65E0\u6570\u636E","common.copy":"\u590D\u5236","common.delete":"\u5220\u9664","common.loading":"\u52A0\u8F7D\u4E2D...","header.searchPlaceholder":"\u95EE\u6211\u70B9\u4EC0\u4E48...","header.theme.system":"\u4E3B\u9898\uFF1A\u8DDF\u968F\u7CFB\u7EDF","header.theme.dark":"\u4E3B\u9898\uFF1A\u6DF1\u8272","header.theme.light":"\u4E3B\u9898\uFF1A\u6D45\u8272","header.menu.setting":"\u8BBE\u7F6E","header.menu.logout":"\u6CE8\u9500","navigation.expand":"\u5C55\u5F00\u5BFC\u822A","navigation.collapse":"\u6298\u53E0\u5BFC\u822A","navigation.searchPlaceholder":"\u641C\u7D22\u83DC\u5355...","navigation.noMatch":"\u672A\u627E\u5230\u5339\u914D\u7684\u83DC\u5355\u9879","navigation.noAccessibleApp":"\u6682\u65E0\u53EF\u8BBF\u95EE\u7684\u5E94\u7528","navigation.noItems":"\u6682\u65E0\u53EF\u663E\u793A\u9879","navigation.expandView":"\u5C55\u5F00\u67E5\u770B {title}","table.toolbar.searchPlaceholder":"\u641C\u7D22...","table.title.default":"\u6570\u636E\u8868","table.toolbar.groupBy":"\u5206\u7EC4","table.toolbar.summary":"\u6C47\u603B","table.toolbar.columns":"\u5217","table.toolbar.export":"\u5BFC\u51FA","table.toolbar.itemsPerPage":"\u6BCF\u9875\u6761\u6570\uFF1A","table.toolbar.pageOf":"\u7B2C {current} / {total} \u9875","table.toolbar.newItem":"\u65B0\u5EFA\u6761\u76EE","table.toolbar.editItem":"\u7F16\u8F91\u6761\u76EE","table.toolbar.deleteItem":"\u5220\u9664\u6761\u76EE","table.toolbar.graphicReport":"\u56FE\u8868\u62A5\u8868","table.toolbar.saveLayout":"\u4FDD\u5B58\u5E03\u5C40","table.menu.groupBy":"\u5206\u7EC4","table.menu.clearAll":"\u6E05\u7A7A","table.menu.visibleColumns":"\u53EF\u89C1\u5217","table.menu.showSummaryRow":"\u663E\u793A\u6C47\u603B\u884C","table.menu.noNumericColumns":"\u6CA1\u6709\u6570\u503C\u5217","table.group.expandAll":"\u5C55\u5F00\u5168\u90E8\u5206\u7EC4","table.group.collapseAll":"\u6298\u53E0\u5168\u90E8\u5206\u7EC4","table.mobile.notImplemented":"\u79FB\u52A8\u7AEF\u89C6\u56FE\u6682\u672A\u5B9E\u73B0","pivot.title.default":"\u6570\u636E\u900F\u89C6\u8868","pivot.subtitle.default":"\u62D6\u62FD\u5B57\u6BB5\u4EE5\u914D\u7F6E\u900F\u89C6\u8868\u3002","pivot.empty":"\u8BF7\u81F3\u5C11\u62D6\u5165\u4E00\u4E2A\u503C\u5B57\u6BB5\u540E\u518D\u67E5\u770B\u900F\u89C6\u7ED3\u679C\u3002","pivot.records":"\u8BB0\u5F55\u6570","pivot.afterFilter":"\u7B5B\u9009\u540E","pivot.grandTotal":"\u603B\u8BA1","pivot.resultLabel":"\u7ED3\u679C","pivot.valueLabel":"\u503C","pivot.table.dimensions":"\u7EF4\u5EA6","pivot.config.title":"\u5E03\u5C40\u914D\u7F6E","pivot.fieldList":"\u5B57\u6BB5\u5217\u8868","pivot.availableDimensions":"\u53EF\u7528\u7EF4\u5EA6","pivot.allFieldsInUse":"\u6240\u6709\u5B57\u6BB5\u90FD\u5DF2\u4F7F\u7528\u3002","pivot.zone.rows":"\u884C","pivot.zone.columns":"\u5217","pivot.zone.filters":"\u7B5B\u9009","pivot.zone.values":"\u503C","pivot.hint.rows":"\u5C06\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u6784\u5EFA\u884C\u5C42\u7EA7","pivot.hint.columns":"\u5C06\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u6784\u5EFA\u5217\u5C42\u7EA7","pivot.hint.filters":"\u5C06\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u4F5C\u4E3A\u62A5\u8868\u7B5B\u9009","pivot.hint.values":"\u5C06\u6570\u503C\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u8FDB\u884C\u805A\u5408","pivot.clearArea":"\u6E05\u7A7A\u533A\u57DF","pivot.filter.na":"\u4E0D\u53EF\u7528","pivot.filter.noValues":"\u65E0\u53EF\u9009\u503C","pivot.filter.noneSelected":"\u672A\u9009\u62E9","pivot.filter.allValues":"\u5168\u90E8\u503C","pivot.filter.selectedCount":"\u5DF2\u9009 {selected} / {total}","pivot.filter.selectAll":"\u5168\u9009","pivot.filter.deselectAll":"\u53D6\u6D88\u5168\u9009","pivot.filter.noResults":"\u65E0\u5339\u914D\u7ED3\u679C","pivot.collapse.ariaExpand":"\u5C55\u5F00\u914D\u7F6E\u533A\u57DF","pivot.collapse.ariaCollapse":"\u6298\u53E0\u914D\u7F6E\u533A\u57DF","pivot.agg.sum":"\u6C42\u548C","pivot.agg.count":"\u8BA1\u6570","pivot.agg.avg":"\u5E73\u5747\u503C","pivot.agg.min":"\u6700\u5C0F\u503C","pivot.agg.max":"\u6700\u5927\u503C","pivot.preset.selectPlaceholder":"\u9009\u62E9\u65B9\u6848","pivot.preset.save":"\u4FDD\u5B58\u65B9\u6848","pivot.preset.delete":"\u5220\u9664\u65B9\u6848","pivot.preset.saveDialogTitle":"\u4FDD\u5B58\u5F53\u524D\u65B9\u6848","pivot.preset.nameLabel":"\u65B9\u6848\u540D\u79F0","pivot.preset.defaultName":"\u65B9\u6848 {index}","pivot.table.sectionTitle":"\u900F\u89C6\u7ED3\u679C","pivot.table.expandRowsAll":"\u884C\u5168\u90E8\u6253\u5F00","pivot.table.collapseRowsAll":"\u884C\u5168\u90E8\u6298\u53E0","pivot.table.expandColumnsAll":"\u5217\u5168\u90E8\u6253\u5F00","pivot.table.collapseColumnsAll":"\u5217\u5168\u90E8\u6298\u53E0","pivot.table.collapse.ariaExpand":"\u5C55\u5F00\u900F\u89C6\u7ED3\u679C","pivot.table.collapse.ariaCollapse":"\u6298\u53E0\u900F\u89C6\u7ED3\u679C","pivot.chart.title":"\u900F\u89C6\u56FE\u8868","pivot.chart.subtitle":"\u5C06\u4E00\u4E2A\u7EF4\u5EA6\u4E0E\u6700\u591A\u4E24\u4E2A\u5EA6\u91CF\u6620\u5C04\u4E3A\u7D27\u51D1\u56FE\u8868\u3002","pivot.chart.subtitleReady":"{dimension} \xB7 {measure}","pivot.chart.emptyNoDimension":"\u8BF7\u81F3\u5C11\u653E\u5165\u4E00\u4E2A\u884C\u6216\u5217\u5B57\u6BB5\u540E\u518D\u67E5\u770B\u56FE\u8868\u3002","pivot.chart.emptyNoValue":"\u8BF7\u81F3\u5C11\u653E\u5165\u4E00\u4E2A\u503C\u5B57\u6BB5\u540E\u518D\u67E5\u770B\u56FE\u8868\u3002","pivot.chart.emptyNoData":"\u5F53\u524D\u56FE\u8868\u9009\u62E9\u4E0B\u6682\u65E0\u53EF\u5C55\u793A\u6570\u636E\u3002","pivot.chart.dimension":"\u56FE\u8868\u7EF4\u5EA6","pivot.chart.primaryMeasure":"\u4E3B\u5EA6\u91CF","pivot.chart.secondaryMeasure":"\u5BF9\u6BD4\u5EA6\u91CF","pivot.chart.chartType":"\u56FE\u8868\u7C7B\u578B","pivot.chart.style.barVertical":"\u7EB5\u5411\u67F1\u72B6\u56FE","pivot.chart.style.barHorizontal":"\u6A2A\u5411\u67F1\u72B6\u56FE","pivot.chart.style.line":"\u6298\u7EBF\u56FE","pivot.chart.style.scatter":"\u6563\u70B9\u56FE","pivot.chart.collapse.ariaExpand":"\u5C55\u5F00\u56FE\u8868\u533A\u57DF","pivot.chart.collapse.ariaCollapse":"\u6298\u53E0\u56FE\u8868\u533A\u57DF","smartFilter.adaptFilters":"\u7B5B\u9009\u8BBE\u7F6E","smartFilter.addFilters":"\u6DFB\u52A0\u7B5B\u9009","smartFilter.go":"\u6267\u884C","smartFilter.visibleFilters":"\u53EF\u89C1\u7B5B\u9009\u9879","smartFilter.searchPlaceholder":"\u641C\u7D22...","smartFilter.noOptionsFound":"\u672A\u627E\u5230\u9009\u9879","smartFilter.min":"\u6700\u5C0F\u503C","smartFilter.max":"\u6700\u5927\u503C","smartFilter.minMaxPlaceholder":"\u6700\u5C0F\u503C - \u6700\u5927\u503C","smartFilter.operator.equals":"\u7B49\u4E8E","smartFilter.operator.contains":"\u5305\u542B","smartFilter.operator.notContains":"\u4E0D\u5305\u542B","smartFilter.operator.wildcard":"\u901A\u914D\u7B26\u641C\u7D22","smartFilter.operator.notEquals":"\u4E0D\u7B49\u4E8E","smartFilter.operator.greaterThan":"\u5927\u4E8E","smartFilter.operator.lessThan":"\u5C0F\u4E8E","smartFilter.operator.greaterOrEqual":"\u5927\u4E8E\u7B49\u4E8E","smartFilter.operator.lessOrEqual":"\u5C0F\u4E8E\u7B49\u4E8E","smartFilter.operator.between":"\u533A\u95F4","variant.noOptions":"\u65E0\u9009\u9879","variant.defaultSuffix":"\u9ED8\u8BA4","variant.selectVariant":"\u9009\u62E9\u89C6\u56FE","variant.saveView":"\u4FDD\u5B58\u89C6\u56FE","variant.newVariant":"\u65B0\u89C6\u56FE","variant.viewName":"\u89C6\u56FE\u540D\u79F0","variant.setDefault":"\u8BBE\u4E3A\u9ED8\u8BA4","variant.publicAllUsers":"\u516C\u5F00\uFF08\u6240\u6709\u7528\u6237\uFF09","variant.toast.fetchFailed":"\u52A0\u8F7D\u89C6\u56FE\u5931\u8D25","variant.toast.saveFailed":"\u4FDD\u5B58\u89C6\u56FE\u5931\u8D25","variant.toast.saveSuccess":"\u89C6\u56FE\u4FDD\u5B58\u6210\u529F","variant.toast.deleteFailed":"\u5220\u9664\u89C6\u56FE\u5931\u8D25","variant.toast.deleteSuccess":"\u89C6\u56FE\u5220\u9664\u6210\u529F","variant.toast.defaultFailed":"\u66F4\u65B0\u9ED8\u8BA4\u89C6\u56FE\u5931\u8D25","variant.toast.defaultSuccess":"\u9ED8\u8BA4\u89C6\u56FE\u5DF2\u66F4\u65B0","layout.saveLayout":"\u4FDD\u5B58\u5E03\u5C40","layout.layoutOptions":"\u5E03\u5C40\u9009\u9879","layout.selectLayout":"\u9009\u62E9\u5E03\u5C40","layout.saveCurrentLayout":"\u4FDD\u5B58\u5F53\u524D\u5E03\u5C40...","layout.noSavedLayouts":"\u6682\u65E0\u5DF2\u4FDD\u5B58\u5E03\u5C40","layout.removeDefault":"\u53D6\u6D88\u9ED8\u8BA4","layout.setAsDefault":"\u8BBE\u4E3A\u9ED8\u8BA4","layout.layoutName":"\u5E03\u5C40\u540D\u79F0","layout.layoutDescription":"\u63CF\u8FF0","layout.layoutNameHelper":"\u4F8B\u5982\uFF1A\u7D27\u51D1\u89C6\u56FE","layout.warningOverwrite":"\u8B66\u544A\uFF1A\u5C06\u8986\u76D6\u540C\u540D\u5E03\u5C40","layout.useAsDefault":"\u7528\u4F5C\u9ED8\u8BA4\u5E03\u5C40","layout.publicAllUsers":"\u516C\u5F00\uFF08\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09","layout.toast.loadFallback":"\u540E\u7AEF\u52A0\u8F7D\u5E03\u5C40\u5931\u8D25\uFF0C\u5DF2\u56DE\u9000\u5230\u672C\u5730\u5B58\u50A8","layout.toast.saveSuccess":"\u5E03\u5C40\u4FDD\u5B58\u6210\u529F","layout.toast.saveLocalSuccess":"\u5E03\u5C40\u5DF2\u4FDD\u5B58\u5230\u672C\u5730\u5B58\u50A8","layout.toast.backendUnavailableSavedLocal":"\u540E\u7AEF\u4E0D\u53EF\u7528\uFF0C\u5DF2\u4FDD\u5B58\u5230\u672C\u5730\u5B58\u50A8","layout.toast.deleteSuccess":"\u5E03\u5C40\u5220\u9664\u6210\u529F","layout.toast.deleteLocalSuccess":"\u5E03\u5C40\u5DF2\u4ECE\u672C\u5730\u5B58\u50A8\u5220\u9664","layout.toast.backendUnavailableDeletedLocal":"\u540E\u7AEF\u4E0D\u53EF\u7528\uFF0C\u5DF2\u4ECE\u672C\u5730\u5B58\u50A8\u5220\u9664","layout.toast.defaultSuccess":"\u9ED8\u8BA4\u5E03\u5C40\u5DF2\u8BBE\u7F6E","layout.toast.defaultLocalSuccess":"\u9ED8\u8BA4\u5E03\u5C40\u5DF2\u5728\u672C\u5730\u5B58\u50A8\u8BBE\u7F6E","layout.toast.backendUnavailableDefaultLocal":"\u540E\u7AEF\u4E0D\u53EF\u7528\uFF0C\u9ED8\u8BA4\u5E03\u5C40\u5DF2\u4FDD\u5B58\u5230\u672C\u5730\u5B58\u50A8","dateRange.label":"\u65E5\u671F\u8303\u56F4","dateRange.startDate":"\u5F00\u59CB\u65E5\u671F","dateRange.endDate":"\u7ED3\u675F\u65E5\u671F","dateRange.select":"\u8BF7\u9009\u62E9...","dateRange.today":"\u4ECA\u5929","dateRange.thisWeek":"\u672C\u5468","dateRange.thisMonth":"\u672C\u6708","graph.records":"{count} \u6761\u8BB0\u5F55","graph.kpi.totalRecords":"\u603B\u8BB0\u5F55\u6570","graph.kpi.totalReport":"\u603B\u7533\u62A5\u5DE5\u65F6","graph.kpi.totalBillable":"\u603B\u53EF\u8BA1\u8D39\u5DE5\u65F6","graph.kpi.efficiency":"\u6548\u7387","graph.kpi.amount":"\u91D1\u989D","graph.kpi.flagged":"\u6807\u8BB0","graph.chart.billable.title":"\u7EF4\u5EA6\u8BA1\u8D39\u5DE5\u65F6","graph.chart.billable.subtitle":"\u6309\u53EF\u8BA1\u8D39\u5DE5\u65F6\u6392\u5E8F\u524D\u5217","graph.chart.efficiency.title":"\u4EBA\u5458\u6548\u7387","graph.chart.efficiency.subtitle":"\u6309\u6700\u4F4E\u6548\u7387\u4F18\u5148","graph.chart.status.title":"\u72B6\u6001\u5206\u5E03","graph.chart.status.subtitle":"\u6309\u72B6\u6001\u8BB0\u5F55\u5360\u6BD4","graph.dataBody":"\u6570\u636E\u660E\u7EC6","graph.reportTitle":"\u56FE\u8868\u62A5\u8868","graph.unassigned":"\u672A\u5206\u914D","graph.column.reportHours":"\u7533\u62A5\u5DE5\u65F6","graph.column.billableHours":"\u53EF\u8BA1\u8D39\u5DE5\u65F6","detail.searchAi.placeholder":"\u641C\u7D22\u5B57\u6BB5\uFF1B\u5982\u65E0\u7ED3\u679C\u5219\u81EA\u52A8\u89E6\u53D1 AI...","detail.searchAi.matches":"{count} \u6761\u5339\u914D\u7ED3\u679C","detail.searchAi.noMatch":"\u672A\u627E\u5230\u5339\u914D\u5B57\u6BB5\u3002","detail.searchAi.autoAiFallback":"\u672A\u547D\u4E2D\u5B57\u6BB5\uFF0C\u6B63\u5728\u89E6\u53D1 AI \u5206\u6790...","detail.searchAi.aiResultTitle":"AI \u5206\u6790\u7ED3\u679C","detail.table.title":"\u5173\u8054\u8BB0\u5F55","kanban.empty":"\u5C06\u5361\u7247\u62D6\u5230\u8FD9\u91CC","kanban.bucket.limit":"\u4E0A\u9650","kanban.bucket.dropHere":"\u91CA\u653E\u540E\u79FB\u52A8\u5230\u8BE5 bucket","kanban.card.progress":"\u8FDB\u5EA6","kanban.card.openDetail":"\u6253\u5F00\u8BE6\u60C5","kanban.priority.critical":"\u7D27\u6025","kanban.priority.high":"\u9AD8","kanban.priority.medium":"\u4E2D","kanban.priority.low":"\u4F4E","quickCreate.newItem":"\u65B0\u5EFA\u6761\u76EE","quickCreate.createWithTitle":"\u521B\u5EFA{title}","quickEdit.editWithTitle":"\u7F16\u8F91{title}","quickDelete.confirmTitle":"\u786E\u8BA4\u5220\u9664","quickDelete.confirmMessageSingle":"\u786E\u8BA4\u5220\u9664\u5F53\u524D\u9009\u4E2D\u8BB0\u5F55\u5417\uFF1F","quickDelete.confirmMessageMultiple":"\u786E\u8BA4\u5220\u9664\u5DF2\u9009\u4E2D\u7684 {count} \u6761\u8BB0\u5F55\u5417\uFF1F","messageBox.confirm":"\u786E\u5B9A","messageBox.cancel":"\u53D6\u6D88"},Km={"common.cancel":"Annuler","common.save":"Enregistrer","common.ok":"OK","common.done":"Terminer","common.search":"Rechercher","common.none":"Aucun","common.all":"Tout","common.noData":"Aucune donn\xE9e","common.copy":"Copier","common.delete":"Supprimer","common.loading":"Chargement...","header.searchPlaceholder":"Demandez-moi...","header.theme.system":"Th\xE8me : Syst\xE8me","header.theme.dark":"Th\xE8me : Sombre","header.theme.light":"Th\xE8me : Clair","header.menu.setting":"Param\xE8tres","header.menu.logout":"Se d\xE9connecter","navigation.expand":"D\xE9velopper la navigation","navigation.collapse":"R\xE9duire la navigation","navigation.searchPlaceholder":"Rechercher dans le menu...","navigation.noMatch":"Aucun \xE9l\xE9ment correspondant","navigation.noAccessibleApp":"Aucune application accessible","navigation.noItems":"Aucun \xE9l\xE9ment \xE0 afficher","navigation.expandView":"D\xE9velopper {title}","table.toolbar.searchPlaceholder":"Rechercher...","table.title.default":"Tableau de donn\xE9es","table.toolbar.groupBy":"Grouper","table.toolbar.summary":"R\xE9sum\xE9","table.toolbar.columns":"Colonnes","table.toolbar.export":"Exporter","table.toolbar.itemsPerPage":"Lignes par page :","table.toolbar.pageOf":"Page {current} sur {total}","table.toolbar.newItem":"Nouvel \xE9l\xE9ment","table.toolbar.editItem":"Modifier l'\xE9l\xE9ment","table.toolbar.deleteItem":"Supprimer l'\xE9l\xE9ment","table.toolbar.graphicReport":"Rapport graphique","table.toolbar.saveLayout":"Enregistrer la vue","table.menu.groupBy":"Grouper","table.menu.clearAll":"Tout effacer","table.menu.visibleColumns":"Colonnes visibles","table.menu.showSummaryRow":"Afficher la ligne de r\xE9sum\xE9","table.menu.noNumericColumns":"Aucune colonne num\xE9rique","table.group.expandAll":"D\xE9velopper tous les groupes","table.group.collapseAll":"R\xE9duire tous les groupes","table.mobile.notImplemented":"Vue mobile non impl\xE9ment\xE9e","pivot.title.default":"Tableau crois\xE9 dynamique","pivot.subtitle.default":"Faites glisser les champs pour configurer le tableau crois\xE9.","pivot.empty":"Ajoutez au moins un champ de valeur pour afficher le r\xE9sultat.","pivot.records":"Enregistrements","pivot.afterFilter":"Apr\xE8s filtre","pivot.grandTotal":"Total g\xE9n\xE9ral","pivot.resultLabel":"R\xE9sultat","pivot.valueLabel":"Valeur","pivot.table.dimensions":"Dimensions","pivot.config.title":"Configuration","pivot.fieldList":"Liste des champs","pivot.availableDimensions":"Dimensions disponibles","pivot.allFieldsInUse":"Tous les champs sont d\xE9j\xE0 utilis\xE9s.","pivot.zone.rows":"Lignes","pivot.zone.columns":"Colonnes","pivot.zone.filters":"Filtres","pivot.zone.values":"Valeurs","pivot.hint.rows":"D\xE9posez les champs ici pour construire la hi\xE9rarchie des lignes","pivot.hint.columns":"D\xE9posez les champs ici pour construire la hi\xE9rarchie des colonnes","pivot.hint.filters":"D\xE9posez les champs ici pour les filtres du rapport","pivot.hint.values":"D\xE9posez les champs num\xE9riques ici pour les agr\xE9gations","pivot.clearArea":"Vider la zone","pivot.filter.na":"N/A","pivot.filter.noValues":"Aucune valeur","pivot.filter.noneSelected":"Aucune s\xE9lection","pivot.filter.allValues":"Toutes les valeurs","pivot.filter.selectedCount":"{selected} / {total} s\xE9lectionn\xE9es","pivot.filter.selectAll":"Tout s\xE9lectionner","pivot.filter.deselectAll":"Tout d\xE9s\xE9lectionner","pivot.filter.noResults":"Aucun r\xE9sultat","pivot.collapse.ariaExpand":"D\xE9velopper la zone de configuration","pivot.collapse.ariaCollapse":"R\xE9duire la zone de configuration","pivot.agg.sum":"Somme","pivot.agg.count":"Compte","pivot.agg.avg":"Moyenne","pivot.agg.min":"Min","pivot.agg.max":"Max","pivot.preset.selectPlaceholder":"S\xE9lectionner un preset","pivot.preset.save":"Enregistrer le preset","pivot.preset.delete":"Supprimer le preset","pivot.preset.saveDialogTitle":"Enregistrer le preset actuel","pivot.preset.nameLabel":"Nom du preset","pivot.preset.defaultName":"Preset {index}","pivot.table.sectionTitle":"R\xE9sultat du pivot","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"D\xE9velopper le r\xE9sultat du pivot","pivot.table.collapse.ariaCollapse":"R\xE9duire le r\xE9sultat du pivot","pivot.chart.title":"Graphique pivot","pivot.chart.subtitle":"Associez une dimension et jusqu\u2019\xE0 deux mesures dans un graphique compact.","pivot.chart.subtitleReady":"{dimension} par {measure}","pivot.chart.emptyNoDimension":"Ajoutez au moins un champ de ligne ou de colonne pour afficher le graphique.","pivot.chart.emptyNoValue":"Ajoutez au moins un champ de valeur pour afficher le graphique.","pivot.chart.emptyNoData":"Aucune donn\xE9e disponible pour la s\xE9lection actuelle du graphique.","pivot.chart.dimension":"Dimension","pivot.chart.primaryMeasure":"Mesure","pivot.chart.secondaryMeasure":"Mesure de comparaison","pivot.chart.chartType":"Type de graphique","pivot.chart.style.barVertical":"Barres verticales","pivot.chart.style.barHorizontal":"Barres horizontales","pivot.chart.style.line":"Ligne","pivot.chart.style.scatter":"Nuage de points","pivot.chart.collapse.ariaExpand":"D\xE9velopper la zone du graphique","pivot.chart.collapse.ariaCollapse":"R\xE9duire la zone du graphique","smartFilter.adaptFilters":"Adapter les filtres","smartFilter.addFilters":"Ajouter des filtres","smartFilter.go":"Ex\xE9cuter","smartFilter.visibleFilters":"Filtres visibles","smartFilter.searchPlaceholder":"Rechercher...","smartFilter.noOptionsFound":"Aucune option trouv\xE9e","smartFilter.min":"Min","smartFilter.max":"Max","smartFilter.minMaxPlaceholder":"Min - Max","smartFilter.operator.equals":"\xC9gal \xE0","smartFilter.operator.contains":"Contient","smartFilter.operator.notContains":"Ne contient pas","smartFilter.operator.wildcard":"Recherche g\xE9n\xE9rique","smartFilter.operator.notEquals":"Diff\xE9rent de","smartFilter.operator.greaterThan":"Sup\xE9rieur \xE0","smartFilter.operator.lessThan":"Inf\xE9rieur \xE0","smartFilter.operator.greaterOrEqual":"Sup\xE9rieur ou \xE9gal","smartFilter.operator.lessOrEqual":"Inf\xE9rieur ou \xE9gal","smartFilter.operator.between":"Entre","variant.noOptions":"Aucune option","variant.defaultSuffix":"Par d\xE9faut","variant.selectVariant":"S\xE9lectionner une vue","variant.saveView":"Enregistrer la vue","variant.newVariant":"Nouvelle vue","variant.viewName":"Nom de la vue","variant.setDefault":"D\xE9finir par d\xE9faut","variant.publicAllUsers":"Public (tous les utilisateurs)","variant.toast.fetchFailed":"\xC9chec du chargement des vues","variant.toast.saveFailed":"\xC9chec de l'enregistrement de la vue","variant.toast.saveSuccess":"Vue enregistr\xE9e avec succ\xE8s","variant.toast.deleteFailed":"\xC9chec de la suppression de la vue","variant.toast.deleteSuccess":"Vue supprim\xE9e avec succ\xE8s","variant.toast.defaultFailed":"\xC9chec de la mise \xE0 jour de la vue par d\xE9faut","variant.toast.defaultSuccess":"Vue par d\xE9faut mise \xE0 jour","layout.saveLayout":"Enregistrer la vue","layout.layoutOptions":"Options de vue","layout.selectLayout":"S\xE9lectionner une vue","layout.saveCurrentLayout":"Enregistrer la vue actuelle...","layout.noSavedLayouts":"Aucune vue enregistr\xE9e","layout.removeDefault":"Retirer le d\xE9faut","layout.setAsDefault":"D\xE9finir par d\xE9faut","layout.layoutName":"Nom de la vue","layout.layoutDescription":"Description","layout.layoutNameHelper":"ex. : Vue compacte","layout.warningOverwrite":"Attention : la vue existante sera \xE9cras\xE9e","layout.useAsDefault":"Utiliser comme vue par d\xE9faut","layout.publicAllUsers":"Public (visible par tous les utilisateurs)","layout.toast.loadFallback":"\xC9chec du chargement depuis le backend, bascule vers le stockage local","layout.toast.saveSuccess":"Vue enregistr\xE9e avec succ\xE8s","layout.toast.saveLocalSuccess":"Vue enregistr\xE9e dans le stockage local","layout.toast.backendUnavailableSavedLocal":"Backend indisponible, enregistr\xE9 en local","layout.toast.deleteSuccess":"Vue supprim\xE9e avec succ\xE8s","layout.toast.deleteLocalSuccess":"Vue supprim\xE9e du stockage local","layout.toast.backendUnavailableDeletedLocal":"Backend indisponible, supprim\xE9 en local","layout.toast.defaultSuccess":"Vue par d\xE9faut d\xE9finie","layout.toast.defaultLocalSuccess":"Vue par d\xE9faut d\xE9finie en local","layout.toast.backendUnavailableDefaultLocal":"Backend indisponible, d\xE9faut enregistr\xE9 en local","dateRange.label":"Plage de dates","dateRange.startDate":"Date de d\xE9but","dateRange.endDate":"Date de fin","dateRange.select":"S\xE9lectionner...","dateRange.today":"Aujourd'hui","dateRange.thisWeek":"Cette semaine","dateRange.thisMonth":"Ce mois-ci","graph.records":"{count} enregistrements","graph.kpi.totalRecords":"Total des enregistrements","graph.kpi.totalReport":"Total d\xE9clar\xE9","graph.kpi.totalBillable":"Total facturable","graph.kpi.efficiency":"Efficacit\xE9","graph.kpi.amount":"Montant","graph.kpi.flagged":"Signal\xE9","graph.chart.billable.title":"Facturable par dimension","graph.chart.billable.subtitle":"Top valeurs par heures facturables","graph.chart.efficiency.title":"Efficacit\xE9 par personne","graph.chart.efficiency.subtitle":"Efficacit\xE9 la plus faible en premier","graph.chart.status.title":"R\xE9partition des statuts","graph.chart.status.subtitle":"Ratio des enregistrements par statut","graph.dataBody":"Donn\xE9es","graph.reportTitle":"Rapport graphique","graph.unassigned":"Non attribu\xE9","graph.column.reportHours":"Heures d\xE9clar\xE9es","graph.column.billableHours":"Heures facturables","detail.searchAi.placeholder":"Rechercher des champs, ou interroger l\u2019IA en cas d\u2019absence de r\xE9sultat...","detail.searchAi.matches":"{count} correspondances trouv\xE9es","detail.searchAi.noMatch":"Aucun champ correspondant trouv\xE9.","detail.searchAi.autoAiFallback":"Aucune correspondance directe. Analyse IA en cours...","detail.searchAi.aiResultTitle":"Analyse IA","detail.table.title":"Enregistrements li\xE9s","kanban.empty":"D\xE9posez les cartes ici","kanban.bucket.limit":"Limite","kanban.bucket.dropHere":"Rel\xE2chez pour d\xE9placer dans cette colonne","kanban.card.progress":"Progression","kanban.card.openDetail":"Ouvrir le d\xE9tail","kanban.priority.critical":"Critique","kanban.priority.high":"\xC9lev\xE9e","kanban.priority.medium":"Moyenne","kanban.priority.low":"Faible","quickCreate.newItem":"Nouvel \xE9l\xE9ment","quickCreate.createWithTitle":"Cr\xE9er {title}","quickEdit.editWithTitle":"Modifier {title}","quickDelete.confirmTitle":"Confirmer la suppression","quickDelete.confirmMessageSingle":"Voulez-vous vraiment supprimer l\u2019enregistrement s\xE9lectionn\xE9 ?","quickDelete.confirmMessageMultiple":"Voulez-vous vraiment supprimer les {count} enregistrements s\xE9lectionn\xE9s ?","messageBox.confirm":"OK","messageBox.cancel":"Annuler"},qm={"common.cancel":"Abbrechen","common.save":"Speichern","common.ok":"OK","common.done":"Fertig","common.search":"Suchen","common.none":"Keine","common.all":"Alle","common.noData":"Keine Daten","common.copy":"Kopieren","common.delete":"L\xF6schen","common.loading":"Wird geladen...","header.searchPlaceholder":"Frag mich...","header.theme.system":"Theme: System","header.theme.dark":"Theme: Dunkel","header.theme.light":"Theme: Hell","header.menu.setting":"Einstellungen","header.menu.logout":"Abmelden","navigation.expand":"Navigation erweitern","navigation.collapse":"Navigation einklappen","navigation.searchPlaceholder":"Men\xFC suchen...","navigation.noMatch":"Keine passenden Men\xFCeintr\xE4ge","navigation.noAccessibleApp":"Keine verf\xFCgbaren Anwendungen","navigation.noItems":"Keine Eintr\xE4ge vorhanden","navigation.expandView":"{title} aufklappen","table.toolbar.searchPlaceholder":"Suchen...","table.title.default":"Datentabelle","table.toolbar.groupBy":"Gruppieren","table.toolbar.summary":"Zusammenfassung","table.toolbar.columns":"Spalten","table.toolbar.export":"Export","table.toolbar.itemsPerPage":"Zeilen pro Seite:","table.toolbar.pageOf":"Seite {current} von {total}","table.toolbar.newItem":"Neuer Eintrag","table.toolbar.editItem":"Eintrag bearbeiten","table.toolbar.deleteItem":"Eintrag l\xF6schen","table.toolbar.graphicReport":"Grafikbericht","table.toolbar.saveLayout":"Layout speichern","table.menu.groupBy":"Gruppieren","table.menu.clearAll":"Alles l\xF6schen","table.menu.visibleColumns":"Sichtbare Spalten","table.menu.showSummaryRow":"Summenzeile anzeigen","table.menu.noNumericColumns":"Keine numerischen Spalten","table.group.expandAll":"Alle Gruppen aufklappen","table.group.collapseAll":"Alle Gruppen zuklappen","table.mobile.notImplemented":"Mobile Ansicht nicht implementiert","pivot.title.default":"Pivot-Tabelle","pivot.subtitle.default":"Ziehen Sie Felder, um die Pivot-Tabelle zu konfigurieren.","pivot.empty":"Ziehen Sie mindestens ein Wertefeld, um das Ergebnis anzuzeigen.","pivot.records":"Datens\xE4tze","pivot.afterFilter":"Nach Filter","pivot.grandTotal":"Gesamtsumme","pivot.resultLabel":"Ergebnis","pivot.valueLabel":"Wert","pivot.table.dimensions":"Dimensionen","pivot.config.title":"Konfiguration","pivot.fieldList":"Feldliste","pivot.availableDimensions":"Verf\xFCgbare Dimensionen","pivot.allFieldsInUse":"Alle Felder sind bereits verwendet.","pivot.zone.rows":"Zeilen","pivot.zone.columns":"Spalten","pivot.zone.filters":"Filter","pivot.zone.values":"Werte","pivot.hint.rows":"Felder hierhin ziehen, um die Zeilenhierarchie zu erstellen","pivot.hint.columns":"Felder hierhin ziehen, um die Spaltenhierarchie zu erstellen","pivot.hint.filters":"Felder hierhin ziehen f\xFCr Berichtsfilter","pivot.hint.values":"Numerische Felder hierhin ziehen f\xFCr Aggregation","pivot.clearArea":"Bereich leeren","pivot.filter.na":"N/V","pivot.filter.noValues":"Keine Werte","pivot.filter.noneSelected":"Nichts ausgew\xE4hlt","pivot.filter.allValues":"Alle Werte","pivot.filter.selectedCount":"{selected} / {total} ausgew\xE4hlt","pivot.filter.selectAll":"Alle ausw\xE4hlen","pivot.filter.deselectAll":"Alle abw\xE4hlen","pivot.filter.noResults":"Keine Ergebnisse","pivot.collapse.ariaExpand":"Konfigurationsbereich erweitern","pivot.collapse.ariaCollapse":"Konfigurationsbereich reduzieren","pivot.agg.sum":"Summe","pivot.agg.count":"Anzahl","pivot.agg.avg":"Durchschnitt","pivot.agg.min":"Min","pivot.agg.max":"Max","pivot.preset.selectPlaceholder":"Preset w\xE4hlen","pivot.preset.save":"Preset speichern","pivot.preset.delete":"Preset l\xF6schen","pivot.preset.saveDialogTitle":"Aktuelles Preset speichern","pivot.preset.nameLabel":"Preset-Name","pivot.preset.defaultName":"Preset {index}","pivot.table.sectionTitle":"Pivot-Ergebnis","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"Pivot-Ergebnis erweitern","pivot.table.collapse.ariaCollapse":"Pivot-Ergebnis reduzieren","pivot.chart.title":"Pivot-Diagramm","pivot.chart.subtitle":"Eine Dimension und bis zu zwei Kennzahlen in einem kompakten Diagramm abbilden.","pivot.chart.subtitleReady":"{dimension} nach {measure}","pivot.chart.emptyNoDimension":"F\xFCgen Sie mindestens ein Zeilen- oder Spaltenfeld hinzu, um das Diagramm anzuzeigen.","pivot.chart.emptyNoValue":"F\xFCgen Sie mindestens ein Wertefeld hinzu, um das Diagramm anzuzeigen.","pivot.chart.emptyNoData":"F\xFCr die aktuelle Diagrammauswahl sind keine Daten verf\xFCgbar.","pivot.chart.dimension":"Dimension","pivot.chart.primaryMeasure":"Kennzahl","pivot.chart.secondaryMeasure":"Vergleichskennzahl","pivot.chart.chartType":"Diagrammtyp","pivot.chart.style.barVertical":"Vertikale Balken","pivot.chart.style.barHorizontal":"Horizontale Balken","pivot.chart.style.line":"Linie","pivot.chart.style.scatter":"Streudiagramm","pivot.chart.collapse.ariaExpand":"Diagrammbereich erweitern","pivot.chart.collapse.ariaCollapse":"Diagrammbereich reduzieren","smartFilter.adaptFilters":"Filter anpassen","smartFilter.addFilters":"Filter hinzuf\xFCgen","smartFilter.go":"Los","smartFilter.visibleFilters":"Sichtbare Filter","smartFilter.searchPlaceholder":"Suchen...","smartFilter.noOptionsFound":"Keine Optionen gefunden","smartFilter.min":"Min","smartFilter.max":"Max","smartFilter.minMaxPlaceholder":"Min - Max","smartFilter.operator.equals":"Gleich","smartFilter.operator.contains":"Enth\xE4lt","smartFilter.operator.notContains":"Enth\xE4lt nicht","smartFilter.operator.wildcard":"Wildcard-Suche","smartFilter.operator.notEquals":"Ungleich","smartFilter.operator.greaterThan":"Gr\xF6\xDFer als","smartFilter.operator.lessThan":"Kleiner als","smartFilter.operator.greaterOrEqual":"Gr\xF6\xDFer gleich","smartFilter.operator.lessOrEqual":"Kleiner gleich","smartFilter.operator.between":"Zwischen","variant.noOptions":"Keine Optionen","variant.defaultSuffix":"Standard","variant.selectVariant":"Variante w\xE4hlen","variant.saveView":"Ansicht speichern","variant.newVariant":"Neue Variante","variant.viewName":"Ansichtsname","variant.setDefault":"Als Standard setzen","variant.publicAllUsers":"\xD6ffentlich (alle Benutzer)","variant.toast.fetchFailed":"Varianten konnten nicht geladen werden","variant.toast.saveFailed":"Variante konnte nicht gespeichert werden","variant.toast.saveSuccess":"Variante erfolgreich gespeichert","variant.toast.deleteFailed":"Variante konnte nicht gel\xF6scht werden","variant.toast.deleteSuccess":"Variante erfolgreich gel\xF6scht","variant.toast.defaultFailed":"Standardvariante konnte nicht aktualisiert werden","variant.toast.defaultSuccess":"Standardvariante aktualisiert","layout.saveLayout":"Layout speichern","layout.layoutOptions":"Layout-Optionen","layout.selectLayout":"Layout w\xE4hlen","layout.saveCurrentLayout":"Aktuelles Layout speichern...","layout.noSavedLayouts":"Keine gespeicherten Layouts","layout.removeDefault":"Standard entfernen","layout.setAsDefault":"Als Standard setzen","layout.layoutName":"Layoutname","layout.layoutDescription":"Beschreibung","layout.layoutNameHelper":"z. B. Kompaktansicht","layout.warningOverwrite":"Warnung: Vorhandenes Layout wird \xFCberschrieben","layout.useAsDefault":"Als Standardlayout verwenden","layout.publicAllUsers":"\xD6ffentlich (f\xFCr alle sichtbar)","layout.toast.loadFallback":"Layouts konnten nicht vom Backend geladen werden, Wechsel zu lokalem Speicher","layout.toast.saveSuccess":"Layout erfolgreich gespeichert","layout.toast.saveLocalSuccess":"Layout im lokalen Speicher gespeichert","layout.toast.backendUnavailableSavedLocal":"Backend nicht verf\xFCgbar, lokal gespeichert","layout.toast.deleteSuccess":"Layout erfolgreich gel\xF6scht","layout.toast.deleteLocalSuccess":"Layout aus lokalem Speicher gel\xF6scht","layout.toast.backendUnavailableDeletedLocal":"Backend nicht verf\xFCgbar, lokal gel\xF6scht","layout.toast.defaultSuccess":"Standardlayout gesetzt","layout.toast.defaultLocalSuccess":"Standardlayout lokal gesetzt","layout.toast.backendUnavailableDefaultLocal":"Backend nicht verf\xFCgbar, Standard lokal gespeichert","dateRange.label":"Datumsbereich","dateRange.startDate":"Startdatum","dateRange.endDate":"Enddatum","dateRange.select":"Ausw\xE4hlen...","dateRange.today":"Heute","dateRange.thisWeek":"Diese Woche","dateRange.thisMonth":"Diesen Monat","graph.records":"{count} Datens\xE4tze","graph.kpi.totalRecords":"Gesamt Datens\xE4tze","graph.kpi.totalReport":"Gesamt Report","graph.kpi.totalBillable":"Gesamt abrechenbar","graph.kpi.efficiency":"Effizienz","graph.kpi.amount":"Betrag","graph.kpi.flagged":"Markiert","graph.chart.billable.title":"Abrechenbar nach Dimension","graph.chart.billable.subtitle":"Top-Werte nach abrechenbaren Stunden","graph.chart.efficiency.title":"Effizienz pro Person","graph.chart.efficiency.subtitle":"Niedrigste Effizienz zuerst","graph.chart.status.title":"Statusverteilung","graph.chart.status.subtitle":"Anteil je Status","graph.dataBody":"Datentabelle","graph.reportTitle":"Grafikbericht","graph.unassigned":"Nicht zugewiesen","graph.column.reportHours":"Melde-Stunden","graph.column.billableHours":"Abrechenbare Stunden","detail.searchAi.placeholder":"Felder suchen, oder bei keinem Treffer die KI fragen...","detail.searchAi.matches":"{count} Treffer gefunden","detail.searchAi.noMatch":"Kein passendes Feld gefunden.","detail.searchAi.autoAiFallback":"Keine direkte \xDCbereinstimmung. KI-Analyse wird gestartet...","detail.searchAi.aiResultTitle":"KI-Ergebnis","detail.table.title":"Verkn\xFCpfte Eintr\xE4ge","kanban.empty":"Karten hier ablegen","kanban.bucket.limit":"Limit","kanban.bucket.dropHere":"Loslassen, um in diese Spalte zu verschieben","kanban.card.progress":"Fortschritt","kanban.card.openDetail":"Detail \xF6ffnen","kanban.priority.critical":"Kritisch","kanban.priority.high":"Hoch","kanban.priority.medium":"Mittel","kanban.priority.low":"Niedrig","quickCreate.newItem":"Neuer Eintrag","quickCreate.createWithTitle":"{title} erstellen","quickEdit.editWithTitle":"{title} bearbeiten","quickDelete.confirmTitle":"L\xF6schen best\xE4tigen","quickDelete.confirmMessageSingle":"M\xF6chten Sie den ausgew\xE4hlten Datensatz wirklich l\xF6schen?","quickDelete.confirmMessageMultiple":"M\xF6chten Sie die {count} ausgew\xE4hlten Datens\xE4tze wirklich l\xF6schen?","messageBox.confirm":"OK","messageBox.cancel":"Abbrechen"},_m={"common.cancel":"\u30AD\u30E3\u30F3\u30BB\u30EB","common.save":"\u4FDD\u5B58","common.ok":"OK","common.done":"\u5B8C\u4E86","common.search":"\u691C\u7D22","common.none":"\u306A\u3057","common.all":"\u3059\u3079\u3066","common.noData":"\u30C7\u30FC\u30BF\u306A\u3057","common.copy":"\u30B3\u30D4\u30FC","common.delete":"\u524A\u9664","common.loading":"\u8AAD\u307F\u8FBC\u307F\u4E2D...","header.searchPlaceholder":"\u4F55\u304B\u805E\u3044\u3066\u304F\u3060\u3055\u3044...","header.theme.system":"\u30C6\u30FC\u30DE\uFF1A\u30B7\u30B9\u30C6\u30E0","header.theme.dark":"\u30C6\u30FC\u30DE\uFF1A\u30C0\u30FC\u30AF","header.theme.light":"\u30C6\u30FC\u30DE\uFF1A\u30E9\u30A4\u30C8","header.menu.setting":"\u8A2D\u5B9A","header.menu.logout":"\u30ED\u30B0\u30A2\u30A6\u30C8","navigation.expand":"\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u3092\u5C55\u958B","navigation.collapse":"\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u3092\u6298\u308A\u305F\u305F\u3080","navigation.searchPlaceholder":"\u30E1\u30CB\u30E5\u30FC\u3092\u691C\u7D22...","navigation.noMatch":"\u4E00\u81F4\u3059\u308B\u30E1\u30CB\u30E5\u30FC\u304C\u3042\u308A\u307E\u305B\u3093","navigation.noAccessibleApp":"\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30D7\u30EA\u304C\u3042\u308A\u307E\u305B\u3093","navigation.noItems":"\u8868\u793A\u3067\u304D\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093","navigation.expandView":"{title} \u3092\u5C55\u958B","table.toolbar.searchPlaceholder":"\u691C\u7D22...","table.title.default":"\u30C7\u30FC\u30BF\u30C6\u30FC\u30D6\u30EB","table.toolbar.groupBy":"\u30B0\u30EB\u30FC\u30D7\u5316","table.toolbar.summary":"\u96C6\u8A08","table.toolbar.columns":"\u5217","table.toolbar.export":"\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8","table.toolbar.itemsPerPage":"1\u30DA\u30FC\u30B8\u306E\u4EF6\u6570\uFF1A","table.toolbar.pageOf":"{current} / {total} \u30DA\u30FC\u30B8","table.toolbar.newItem":"\u65B0\u898F\u4F5C\u6210","table.toolbar.editItem":"\u7DE8\u96C6","table.toolbar.deleteItem":"\u524A\u9664","table.toolbar.graphicReport":"\u30B0\u30E9\u30D5\u30A3\u30C3\u30AF\u30EC\u30DD\u30FC\u30C8","table.toolbar.saveLayout":"\u30EC\u30A4\u30A2\u30A6\u30C8\u4FDD\u5B58","table.menu.groupBy":"\u30B0\u30EB\u30FC\u30D7\u5316","table.menu.clearAll":"\u3059\u3079\u3066\u30AF\u30EA\u30A2","table.menu.visibleColumns":"\u8868\u793A\u5217","table.menu.showSummaryRow":"\u96C6\u8A08\u884C\u3092\u8868\u793A","table.menu.noNumericColumns":"\u6570\u5024\u5217\u304C\u3042\u308A\u307E\u305B\u3093","table.group.expandAll":"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u5C55\u958B","table.group.collapseAll":"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u6298\u308A\u305F\u305F\u3080","table.mobile.notImplemented":"\u30E2\u30D0\u30A4\u30EB\u8868\u793A\u306F\u672A\u5B9F\u88C5\u3067\u3059","pivot.title.default":"\u30D4\u30DC\u30C3\u30C8\u30C6\u30FC\u30D6\u30EB","pivot.subtitle.default":"\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30D4\u30DC\u30C3\u30C8\u30C6\u30FC\u30D6\u30EB\u3092\u8A2D\u5B9A\u3057\u307E\u3059\u3002","pivot.empty":"\u7D50\u679C\u3092\u8868\u793A\u3059\u308B\u306B\u306F\u3001\u5024\u30A8\u30EA\u30A2\u306B\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002","pivot.records":"\u30EC\u30B3\u30FC\u30C9","pivot.afterFilter":"\u30D5\u30A3\u30EB\u30BF\u30FC\u5F8C","pivot.grandTotal":"\u7DCF\u8A08","pivot.resultLabel":"\u7D50\u679C","pivot.valueLabel":"\u5024","pivot.table.dimensions":"\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3","pivot.config.title":"\u8A2D\u5B9A","pivot.fieldList":"\u30D5\u30A3\u30FC\u30EB\u30C9\u4E00\u89A7","pivot.availableDimensions":"\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3","pivot.allFieldsInUse":"\u3059\u3079\u3066\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u4F7F\u7528\u4E2D\u3067\u3059\u3002","pivot.zone.rows":"\u884C","pivot.zone.columns":"\u5217","pivot.zone.filters":"\u30D5\u30A3\u30EB\u30BF\u30FC","pivot.zone.values":"\u5024","pivot.hint.rows":"\u3053\u3053\u306B\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u884C\u968E\u5C64\u3092\u4F5C\u6210","pivot.hint.columns":"\u3053\u3053\u306B\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u5217\u968E\u5C64\u3092\u4F5C\u6210","pivot.hint.filters":"\u3053\u3053\u306B\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30EC\u30DD\u30FC\u30C8\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u8A2D\u5B9A","pivot.hint.values":"\u3053\u3053\u306B\u6570\u5024\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u96C6\u8A08","pivot.clearArea":"\u30A8\u30EA\u30A2\u3092\u30AF\u30EA\u30A2","pivot.filter.na":"N/A","pivot.filter.noValues":"\u5024\u304C\u3042\u308A\u307E\u305B\u3093","pivot.filter.noneSelected":"\u672A\u9078\u629E","pivot.filter.allValues":"\u3059\u3079\u3066\u306E\u5024","pivot.filter.selectedCount":"{selected} / {total} \u3092\u9078\u629E","pivot.filter.selectAll":"\u3059\u3079\u3066\u9078\u629E","pivot.filter.deselectAll":"\u3059\u3079\u3066\u89E3\u9664","pivot.filter.noResults":"\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093","pivot.collapse.ariaExpand":"\u8A2D\u5B9A\u30A8\u30EA\u30A2\u3092\u5C55\u958B","pivot.collapse.ariaCollapse":"\u8A2D\u5B9A\u30A8\u30EA\u30A2\u3092\u6298\u308A\u305F\u305F\u3080","pivot.agg.sum":"\u5408\u8A08","pivot.agg.count":"\u4EF6\u6570","pivot.agg.avg":"\u5E73\u5747","pivot.agg.min":"\u6700\u5C0F","pivot.agg.max":"\u6700\u5927","pivot.preset.selectPlaceholder":"\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u9078\u629E","pivot.preset.save":"\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u4FDD\u5B58","pivot.preset.delete":"\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u524A\u9664","pivot.preset.saveDialogTitle":"\u73FE\u5728\u306E\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u4FDD\u5B58","pivot.preset.nameLabel":"\u30D7\u30EA\u30BB\u30C3\u30C8\u540D","pivot.preset.defaultName":"\u30D7\u30EA\u30BB\u30C3\u30C8 {index}","pivot.table.sectionTitle":"\u30D4\u30DC\u30C3\u30C8\u7D50\u679C","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"\u30D4\u30DC\u30C3\u30C8\u7D50\u679C\u3092\u5C55\u958B","pivot.table.collapse.ariaCollapse":"\u30D4\u30DC\u30C3\u30C8\u7D50\u679C\u3092\u6298\u308A\u305F\u305F\u3080","pivot.chart.title":"\u30D4\u30DC\u30C3\u30C8\u30C1\u30E3\u30FC\u30C8","pivot.chart.subtitle":"1\u3064\u306E\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u6700\u59272\u3064\u306E\u6307\u6A19\u3092\u30B3\u30F3\u30D1\u30AF\u30C8\u306A\u30C1\u30E3\u30FC\u30C8\u306B\u307E\u3068\u3081\u307E\u3059\u3002","pivot.chart.subtitleReady":"{dimension} \u3054\u3068\u306E {measure}","pivot.chart.emptyNoDimension":"\u30C1\u30E3\u30FC\u30C8\u3092\u8868\u793A\u3059\u308B\u306B\u306F\u3001\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u884C\u307E\u305F\u306F\u5217\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002","pivot.chart.emptyNoValue":"\u30C1\u30E3\u30FC\u30C8\u3092\u8868\u793A\u3059\u308B\u306B\u306F\u3001\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u5024\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002","pivot.chart.emptyNoData":"\u73FE\u5728\u306E\u30C1\u30E3\u30FC\u30C8\u9078\u629E\u3067\u306F\u8868\u793A\u3067\u304D\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093\u3002","pivot.chart.dimension":"\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3","pivot.chart.primaryMeasure":"\u6307\u6A19","pivot.chart.secondaryMeasure":"\u6BD4\u8F03\u6307\u6A19","pivot.chart.chartType":"\u30C1\u30E3\u30FC\u30C8\u7A2E\u5225","pivot.chart.style.barVertical":"\u7E26\u68D2\u30B0\u30E9\u30D5","pivot.chart.style.barHorizontal":"\u6A2A\u68D2\u30B0\u30E9\u30D5","pivot.chart.style.line":"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5","pivot.chart.style.scatter":"\u6563\u5E03\u56F3","pivot.chart.collapse.ariaExpand":"\u30C1\u30E3\u30FC\u30C8\u9818\u57DF\u3092\u5C55\u958B","pivot.chart.collapse.ariaCollapse":"\u30C1\u30E3\u30FC\u30C8\u9818\u57DF\u3092\u6298\u308A\u305F\u305F\u3080","smartFilter.adaptFilters":"\u30D5\u30A3\u30EB\u30BF\u30FC\u8ABF\u6574","smartFilter.addFilters":"\u30D5\u30A3\u30EB\u30BF\u30FC\u8FFD\u52A0","smartFilter.go":"\u5B9F\u884C","smartFilter.visibleFilters":"\u8868\u793A\u30D5\u30A3\u30EB\u30BF\u30FC","smartFilter.searchPlaceholder":"\u691C\u7D22...","smartFilter.noOptionsFound":"\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093","smartFilter.min":"\u6700\u5C0F","smartFilter.max":"\u6700\u5927","smartFilter.minMaxPlaceholder":"\u6700\u5C0F - \u6700\u5927","smartFilter.operator.equals":"\u7B49\u3057\u3044","smartFilter.operator.contains":"\u542B\u3080","smartFilter.operator.notContains":"\u542B\u307E\u306A\u3044","smartFilter.operator.wildcard":"\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u691C\u7D22","smartFilter.operator.notEquals":"\u7B49\u3057\u304F\u306A\u3044","smartFilter.operator.greaterThan":"\u3088\u308A\u5927\u304D\u3044","smartFilter.operator.lessThan":"\u3088\u308A\u5C0F\u3055\u3044","smartFilter.operator.greaterOrEqual":"\u4EE5\u4E0A","smartFilter.operator.lessOrEqual":"\u4EE5\u4E0B","smartFilter.operator.between":"\u7BC4\u56F2","variant.noOptions":"\u30AA\u30D7\u30B7\u30E7\u30F3\u306A\u3057","variant.defaultSuffix":"\u30C7\u30D5\u30A9\u30EB\u30C8","variant.selectVariant":"\u30D3\u30E5\u30FC\u3092\u9078\u629E","variant.saveView":"\u30D3\u30E5\u30FC\u4FDD\u5B58","variant.newVariant":"\u65B0\u3057\u3044\u30D3\u30E5\u30FC","variant.viewName":"\u30D3\u30E5\u30FC\u540D","variant.setDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u306B\u8A2D\u5B9A","variant.publicAllUsers":"\u516C\u958B\uFF08\u5168\u30E6\u30FC\u30B6\u30FC\uFF09","variant.toast.fetchFailed":"\u30D3\u30E5\u30FC\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.saveFailed":"\u30D3\u30E5\u30FC\u306E\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.saveSuccess":"\u30D3\u30E5\u30FC\u3092\u4FDD\u5B58\u3057\u307E\u3057\u305F","variant.toast.deleteFailed":"\u30D3\u30E5\u30FC\u306E\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.deleteSuccess":"\u30D3\u30E5\u30FC\u3092\u524A\u9664\u3057\u307E\u3057\u305F","variant.toast.defaultFailed":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30D3\u30E5\u30FC\u306E\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.defaultSuccess":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30D3\u30E5\u30FC\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F","layout.saveLayout":"\u30EC\u30A4\u30A2\u30A6\u30C8\u4FDD\u5B58","layout.layoutOptions":"\u30EC\u30A4\u30A2\u30A6\u30C8\u30AA\u30D7\u30B7\u30E7\u30F3","layout.selectLayout":"\u30EC\u30A4\u30A2\u30A6\u30C8\u9078\u629E","layout.saveCurrentLayout":"\u73FE\u5728\u306E\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u4FDD\u5B58...","layout.noSavedLayouts":"\u4FDD\u5B58\u6E08\u307F\u30EC\u30A4\u30A2\u30A6\u30C8\u306A\u3057","layout.removeDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u89E3\u9664","layout.setAsDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u306B\u8A2D\u5B9A","layout.layoutName":"\u30EC\u30A4\u30A2\u30A6\u30C8\u540D","layout.layoutDescription":"\u8AAC\u660E","layout.layoutNameHelper":"\u4F8B\uFF1A\u30B3\u30F3\u30D1\u30AF\u30C8\u8868\u793A","layout.warningOverwrite":"\u8B66\u544A\uFF1A\u65E2\u5B58\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u4E0A\u66F8\u304D\u3057\u307E\u3059","layout.useAsDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30EC\u30A4\u30A2\u30A6\u30C8\u3068\u3057\u3066\u4F7F\u7528","layout.publicAllUsers":"\u516C\u958B\uFF08\u5168\u30E6\u30FC\u30B6\u30FC\u306B\u8868\u793A\uFF09","layout.toast.loadFallback":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u304B\u3089\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u3001\u30ED\u30FC\u30AB\u30EB\u4FDD\u5B58\u306B\u5207\u308A\u66FF\u3048\u307E\u3057\u305F","layout.toast.saveSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u4FDD\u5B58\u3057\u307E\u3057\u305F","layout.toast.saveLocalSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u4FDD\u5B58\u3057\u307E\u3057\u305F","layout.toast.backendUnavailableSavedLocal":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u672A\u63A5\u7D9A\u306E\u305F\u3081\u30ED\u30FC\u30AB\u30EB\u306B\u4FDD\u5B58\u3057\u307E\u3057\u305F","layout.toast.deleteSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u524A\u9664\u3057\u307E\u3057\u305F","layout.toast.deleteLocalSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u304B\u3089\u524A\u9664\u3057\u307E\u3057\u305F","layout.toast.backendUnavailableDeletedLocal":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u672A\u63A5\u7D9A\u306E\u305F\u3081\u30ED\u30FC\u30AB\u30EB\u304B\u3089\u524A\u9664\u3057\u307E\u3057\u305F","layout.toast.defaultSuccess":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u8A2D\u5B9A\u3057\u307E\u3057\u305F","layout.toast.defaultLocalSuccess":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u306B\u8A2D\u5B9A\u3057\u307E\u3057\u305F","layout.toast.backendUnavailableDefaultLocal":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u672A\u63A5\u7D9A\u306E\u305F\u3081\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u4FDD\u5B58\u3057\u307E\u3057\u305F","dateRange.label":"\u65E5\u4ED8\u7BC4\u56F2","dateRange.startDate":"\u958B\u59CB\u65E5","dateRange.endDate":"\u7D42\u4E86\u65E5","dateRange.select":"\u9078\u629E...","dateRange.today":"\u4ECA\u65E5","dateRange.thisWeek":"\u4ECA\u9031","dateRange.thisMonth":"\u4ECA\u6708","graph.records":"{count} \u4EF6","graph.kpi.totalRecords":"\u7DCF\u30EC\u30B3\u30FC\u30C9","graph.kpi.totalReport":"\u7DCF\u5831\u544A\u6642\u9593","graph.kpi.totalBillable":"\u7DCF\u8ACB\u6C42\u53EF\u80FD\u6642\u9593","graph.kpi.efficiency":"\u52B9\u7387","graph.kpi.amount":"\u91D1\u984D","graph.kpi.flagged":"\u8981\u78BA\u8A8D","graph.chart.billable.title":"\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u5225\u8ACB\u6C42\u53EF\u80FD\u6642\u9593","graph.chart.billable.subtitle":"\u8ACB\u6C42\u53EF\u80FD\u6642\u9593\u306E\u4E0A\u4F4D","graph.chart.efficiency.title":"\u62C5\u5F53\u8005\u5225\u52B9\u7387","graph.chart.efficiency.subtitle":"\u52B9\u7387\u306E\u4F4E\u3044\u9806","graph.chart.status.title":"\u30B9\u30C6\u30FC\u30BF\u30B9\u5206\u5E03","graph.chart.status.subtitle":"\u30B9\u30C6\u30FC\u30BF\u30B9\u5225\u6BD4\u7387","graph.dataBody":"\u30C7\u30FC\u30BF\u672C\u4F53","graph.reportTitle":"\u30B0\u30E9\u30D5\u30A3\u30C3\u30AF\u30EC\u30DD\u30FC\u30C8","graph.unassigned":"\u672A\u5272\u308A\u5F53\u3066","graph.column.reportHours":"\u5831\u544A\u6642\u9593","graph.column.billableHours":"\u8ACB\u6C42\u53EF\u80FD\u6642\u9593","detail.searchAi.placeholder":"\u9805\u76EE\u3092\u691C\u7D22\u3002\u898B\u3064\u304B\u3089\u306A\u3044\u5834\u5408\u306FAI\u306B\u8CEA\u554F\u3057\u307E\u3059...","detail.searchAi.matches":"{count} \u4EF6\u306E\u4E00\u81F4","detail.searchAi.noMatch":"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002","detail.searchAi.autoAiFallback":"\u4E00\u81F4\u306A\u3057\u3002AI\u5206\u6790\u3092\u5B9F\u884C\u3057\u307E\u3059...","detail.searchAi.aiResultTitle":"AI\u5206\u6790\u7D50\u679C","detail.table.title":"\u95A2\u9023\u30EC\u30B3\u30FC\u30C9","kanban.empty":"\u3053\u3053\u306B\u30AB\u30FC\u30C9\u3092\u30C9\u30ED\u30C3\u30D7","kanban.bucket.limit":"\u4E0A\u9650","kanban.bucket.dropHere":"\u96E2\u3059\u3068\u3053\u306E bucket \u306B\u79FB\u52D5\u3057\u307E\u3059","kanban.card.progress":"\u9032\u6357","kanban.card.openDetail":"\u8A73\u7D30\u3092\u958B\u304F","kanban.priority.critical":"\u7DCA\u6025","kanban.priority.high":"\u9AD8","kanban.priority.medium":"\u4E2D","kanban.priority.low":"\u4F4E","quickCreate.newItem":"\u65B0\u898F\u4F5C\u6210","quickCreate.createWithTitle":"{title} \u3092\u4F5C\u6210","quickEdit.editWithTitle":"{title} \u3092\u7DE8\u96C6","quickDelete.confirmTitle":"\u524A\u9664\u306E\u78BA\u8A8D","quickDelete.confirmMessageSingle":"\u9078\u629E\u3057\u305F\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F","quickDelete.confirmMessageMultiple":"\u9078\u629E\u3057\u305F {count} \u4EF6\u306E\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F","messageBox.confirm":"OK","messageBox.cancel":"\u30AD\u30E3\u30F3\u30BB\u30EB"},Zm={"common.cancel":"\uCDE8\uC18C","common.save":"\uC800\uC7A5","common.ok":"\uD655\uC778","common.done":"\uC644\uB8CC","common.search":"\uAC80\uC0C9","common.none":"\uC5C6\uC74C","common.all":"\uC804\uCCB4","common.noData":"\uB370\uC774\uD130 \uC5C6\uC74C","common.copy":"\uBCF5\uC0AC","common.delete":"\uC0AD\uC81C","common.loading":"\uB85C\uB529 \uC911...","header.searchPlaceholder":"\uBB34\uC5C7\uC774\uB4E0 \uBB3C\uC5B4\uBCF4\uC138\uC694...","header.theme.system":"\uD14C\uB9C8: \uC2DC\uC2A4\uD15C","header.theme.dark":"\uD14C\uB9C8: \uB2E4\uD06C","header.theme.light":"\uD14C\uB9C8: \uB77C\uC774\uD2B8","header.menu.setting":"\uC124\uC815","header.menu.logout":"\uB85C\uADF8\uC544\uC6C3","navigation.expand":"\uD0D0\uC0C9 \uD3BC\uCE58\uAE30","navigation.collapse":"\uD0D0\uC0C9 \uC811\uAE30","navigation.searchPlaceholder":"\uBA54\uB274 \uAC80\uC0C9...","navigation.noMatch":"\uC77C\uCE58\uD558\uB294 \uBA54\uB274\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4","navigation.noAccessibleApp":"\uC811\uADFC \uAC00\uB2A5\uD55C \uC571\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","navigation.noItems":"\uD45C\uC2DC\uD560 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","navigation.expandView":"{title} \uD3BC\uCE58\uAE30","table.toolbar.searchPlaceholder":"\uAC80\uC0C9...","table.title.default":"\uB370\uC774\uD130 \uD14C\uC774\uBE14","table.toolbar.groupBy":"\uADF8\uB8F9","table.toolbar.summary":"\uC694\uC57D","table.toolbar.columns":"\uC5F4","table.toolbar.export":"\uB0B4\uBCF4\uB0B4\uAE30","table.toolbar.itemsPerPage":"\uD398\uC774\uC9C0\uB2F9 \uD589 \uC218:","table.toolbar.pageOf":"{current} / {total} \uD398\uC774\uC9C0","table.toolbar.newItem":"\uC2E0\uADDC \uD56D\uBAA9","table.toolbar.editItem":"\uD56D\uBAA9 \uC218\uC815","table.toolbar.deleteItem":"\uD56D\uBAA9 \uC0AD\uC81C","table.toolbar.graphicReport":"\uADF8\uB798\uD504 \uB9AC\uD3EC\uD2B8","table.toolbar.saveLayout":"\uB808\uC774\uC544\uC6C3 \uC800\uC7A5","table.menu.groupBy":"\uADF8\uB8F9","table.menu.clearAll":"\uBAA8\uB450 \uC9C0\uC6B0\uAE30","table.menu.visibleColumns":"\uD45C\uC2DC \uC5F4","table.menu.showSummaryRow":"\uC694\uC57D \uD589 \uD45C\uC2DC","table.menu.noNumericColumns":"\uC22B\uC790 \uC5F4 \uC5C6\uC74C","table.group.expandAll":"\uBAA8\uB4E0 \uADF8\uB8F9 \uD3BC\uCE58\uAE30","table.group.collapseAll":"\uBAA8\uB4E0 \uADF8\uB8F9 \uC811\uAE30","table.mobile.notImplemented":"\uBAA8\uBC14\uC77C \uBDF0\uB294 \uC544\uC9C1 \uAD6C\uD604\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4","pivot.title.default":"\uD53C\uBC97 \uD14C\uC774\uBE14","pivot.subtitle.default":"\uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uD53C\uBC97 \uD14C\uC774\uBE14\uC744 \uAD6C\uC131\uD558\uC138\uC694.","pivot.empty":"\uACB0\uACFC\uB97C \uBCF4\uB824\uBA74 \uAC12 \uC601\uC5ED\uC5D0 \uCD5C\uC18C \uD55C \uAC1C\uC758 \uD544\uB4DC\uB97C \uCD94\uAC00\uD558\uC138\uC694.","pivot.records":"\uB808\uCF54\uB4DC","pivot.afterFilter":"\uD544\uD130 \uD6C4","pivot.grandTotal":"\uCD1D\uD569","pivot.resultLabel":"\uACB0\uACFC","pivot.valueLabel":"\uAC12","pivot.table.dimensions":"\uCC28\uC6D0","pivot.config.title":"\uAD6C\uC131","pivot.fieldList":"\uD544\uB4DC \uBAA9\uB85D","pivot.availableDimensions":"\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uCC28\uC6D0","pivot.allFieldsInUse":"\uBAA8\uB4E0 \uD544\uB4DC\uAC00 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC785\uB2C8\uB2E4.","pivot.zone.rows":"\uD589","pivot.zone.columns":"\uC5F4","pivot.zone.filters":"\uD544\uD130","pivot.zone.values":"\uAC12","pivot.hint.rows":"\uC5EC\uAE30\uC5D0 \uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uD589 \uACC4\uCE35\uC744 \uAD6C\uC131","pivot.hint.columns":"\uC5EC\uAE30\uC5D0 \uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uC5F4 \uACC4\uCE35\uC744 \uAD6C\uC131","pivot.hint.filters":"\uC5EC\uAE30\uC5D0 \uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uBCF4\uACE0\uC11C \uD544\uD130\uB85C \uC0AC\uC6A9","pivot.hint.values":"\uC22B\uC790 \uD544\uB4DC\uB97C \uC5EC\uAE30\uC5D0 \uB4DC\uB798\uADF8\uD558\uC5EC \uC9D1\uACC4","pivot.clearArea":"\uC601\uC5ED \uBE44\uC6B0\uAE30","pivot.filter.na":"\uD574\uB2F9 \uC5C6\uC74C","pivot.filter.noValues":"\uAC12 \uC5C6\uC74C","pivot.filter.noneSelected":"\uC120\uD0DD \uC5C6\uC74C","pivot.filter.allValues":"\uBAA8\uB4E0 \uAC12","pivot.filter.selectedCount":"{selected} / {total} \uC120\uD0DD\uB428","pivot.filter.selectAll":"\uC804\uCCB4 \uC120\uD0DD","pivot.filter.deselectAll":"\uC804\uCCB4 \uD574\uC81C","pivot.filter.noResults":"\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C","pivot.collapse.ariaExpand":"\uAD6C\uC131 \uC601\uC5ED \uD3BC\uCE58\uAE30","pivot.collapse.ariaCollapse":"\uAD6C\uC131 \uC601\uC5ED \uC811\uAE30","pivot.agg.sum":"\uD569\uACC4","pivot.agg.count":"\uAC1C\uC218","pivot.agg.avg":"\uD3C9\uADE0","pivot.agg.min":"\uCD5C\uC18C","pivot.agg.max":"\uCD5C\uB300","pivot.preset.selectPlaceholder":"\uD504\uB9AC\uC14B \uC120\uD0DD","pivot.preset.save":"\uD504\uB9AC\uC14B \uC800\uC7A5","pivot.preset.delete":"\uD504\uB9AC\uC14B \uC0AD\uC81C","pivot.preset.saveDialogTitle":"\uD604\uC7AC \uD504\uB9AC\uC14B \uC800\uC7A5","pivot.preset.nameLabel":"\uD504\uB9AC\uC14B \uC774\uB984","pivot.preset.defaultName":"\uD504\uB9AC\uC14B {index}","pivot.table.sectionTitle":"\uD53C\uBC97 \uACB0\uACFC","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"\uD53C\uBC97 \uACB0\uACFC \uD3BC\uCE58\uAE30","pivot.table.collapse.ariaCollapse":"\uD53C\uBC97 \uACB0\uACFC \uC811\uAE30","pivot.chart.title":"\uD53C\uBC97 \uCC28\uD2B8","pivot.chart.subtitle":"\uD558\uB098\uC758 \uCC28\uC6D0\uACFC \uCD5C\uB300 \uB450 \uAC1C\uC758 \uCE21\uC815\uAC12\uC744 \uAC04\uACB0\uD55C \uCC28\uD2B8\uB85C \uD45C\uC2DC\uD569\uB2C8\uB2E4.","pivot.chart.subtitleReady":"{dimension}\uBCC4 {measure}","pivot.chart.emptyNoDimension":"\uCC28\uD2B8\uB97C \uBCF4\uB824\uBA74 \uCD5C\uC18C \uD55C \uAC1C\uC758 \uD589 \uB610\uB294 \uC5F4 \uD544\uB4DC\uB97C \uCD94\uAC00\uD558\uC138\uC694.","pivot.chart.emptyNoValue":"\uCC28\uD2B8\uB97C \uBCF4\uB824\uBA74 \uCD5C\uC18C \uD55C \uAC1C\uC758 \uAC12 \uD544\uB4DC\uB97C \uCD94\uAC00\uD558\uC138\uC694.","pivot.chart.emptyNoData":"\uD604\uC7AC \uCC28\uD2B8 \uC120\uD0DD\uC5D0 \uD45C\uC2DC\uD560 \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.","pivot.chart.dimension":"\uCC28\uD2B8 \uCC28\uC6D0","pivot.chart.primaryMeasure":"\uC8FC \uCE21\uC815\uAC12","pivot.chart.secondaryMeasure":"\uBE44\uAD50 \uCE21\uC815\uAC12","pivot.chart.chartType":"\uCC28\uD2B8 \uC720\uD615","pivot.chart.style.barVertical":"\uC138\uB85C \uB9C9\uB300","pivot.chart.style.barHorizontal":"\uAC00\uB85C \uB9C9\uB300","pivot.chart.style.line":"\uC120\uD615 \uCC28\uD2B8","pivot.chart.style.scatter":"\uC0B0\uC810\uB3C4","pivot.chart.collapse.ariaExpand":"\uCC28\uD2B8 \uC601\uC5ED \uD3BC\uCE58\uAE30","pivot.chart.collapse.ariaCollapse":"\uCC28\uD2B8 \uC601\uC5ED \uC811\uAE30","smartFilter.adaptFilters":"\uD544\uD130 \uC870\uC815","smartFilter.addFilters":"\uD544\uD130 \uCD94\uAC00","smartFilter.go":"\uC2E4\uD589","smartFilter.visibleFilters":"\uD45C\uC2DC \uD544\uD130","smartFilter.searchPlaceholder":"\uAC80\uC0C9...","smartFilter.noOptionsFound":"\uC635\uC158\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4","smartFilter.min":"\uCD5C\uC18C","smartFilter.max":"\uCD5C\uB300","smartFilter.minMaxPlaceholder":"\uCD5C\uC18C - \uCD5C\uB300","smartFilter.operator.equals":"\uAC19\uC74C","smartFilter.operator.contains":"\uD3EC\uD568","smartFilter.operator.notContains":"\uBBF8\uD3EC\uD568","smartFilter.operator.wildcard":"\uC640\uC77C\uB4DC\uCE74\uB4DC \uAC80\uC0C9","smartFilter.operator.notEquals":"\uAC19\uC9C0 \uC54A\uC74C","smartFilter.operator.greaterThan":"\uBCF4\uB2E4 \uD07C","smartFilter.operator.lessThan":"\uBCF4\uB2E4 \uC791\uC74C","smartFilter.operator.greaterOrEqual":"\uC774\uC0C1","smartFilter.operator.lessOrEqual":"\uC774\uD558","smartFilter.operator.between":"\uBC94\uC704","variant.noOptions":"\uC635\uC158 \uC5C6\uC74C","variant.defaultSuffix":"\uAE30\uBCF8","variant.selectVariant":"\uBDF0 \uC120\uD0DD","variant.saveView":"\uBDF0 \uC800\uC7A5","variant.newVariant":"\uC0C8 \uBDF0","variant.viewName":"\uBDF0 \uC774\uB984","variant.setDefault":"\uAE30\uBCF8\uC73C\uB85C \uC124\uC815","variant.publicAllUsers":"\uACF5\uAC1C(\uC804\uCCB4 \uC0AC\uC6A9\uC790)","variant.toast.fetchFailed":"\uBDF0\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.saveFailed":"\uBDF0\uB97C \uC800\uC7A5\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.saveSuccess":"\uBDF0\uAC00 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","variant.toast.deleteFailed":"\uBDF0\uB97C \uC0AD\uC81C\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.deleteSuccess":"\uBDF0\uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4","variant.toast.defaultFailed":"\uAE30\uBCF8 \uBDF0\uB97C \uC5C5\uB370\uC774\uD2B8\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.defaultSuccess":"\uAE30\uBCF8 \uBDF0\uAC00 \uC5C5\uB370\uC774\uD2B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.saveLayout":"\uB808\uC774\uC544\uC6C3 \uC800\uC7A5","layout.layoutOptions":"\uB808\uC774\uC544\uC6C3 \uC635\uC158","layout.selectLayout":"\uB808\uC774\uC544\uC6C3 \uC120\uD0DD","layout.saveCurrentLayout":"\uD604\uC7AC \uB808\uC774\uC544\uC6C3 \uC800\uC7A5...","layout.noSavedLayouts":"\uC800\uC7A5\uB41C \uB808\uC774\uC544\uC6C3 \uC5C6\uC74C","layout.removeDefault":"\uAE30\uBCF8 \uD574\uC81C","layout.setAsDefault":"\uAE30\uBCF8\uC73C\uB85C \uC124\uC815","layout.layoutName":"\uB808\uC774\uC544\uC6C3 \uC774\uB984","layout.layoutDescription":"\uC124\uBA85","layout.layoutNameHelper":"\uC608: \uCEF4\uD329\uD2B8 \uBDF0","layout.warningOverwrite":"\uACBD\uACE0: \uAE30\uC874 \uB808\uC774\uC544\uC6C3\uC774 \uB36E\uC5B4\uC4F0\uAE30 \uB429\uB2C8\uB2E4","layout.useAsDefault":"\uAE30\uBCF8 \uB808\uC774\uC544\uC6C3\uC73C\uB85C \uC0AC\uC6A9","layout.publicAllUsers":"\uACF5\uAC1C(\uBAA8\uB4E0 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uD45C\uC2DC)","layout.toast.loadFallback":"\uBC31\uC5D4\uB4DC\uC5D0\uC11C \uB808\uC774\uC544\uC6C3\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD574 \uB85C\uCEEC \uC800\uC7A5\uC18C\uB85C \uC804\uD658\uD588\uC2B5\uB2C8\uB2E4","layout.toast.saveSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.saveLocalSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uB85C\uCEEC \uC800\uC7A5\uC18C\uC5D0 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.backendUnavailableSavedLocal":"\uBC31\uC5D4\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC5B4 \uB85C\uCEEC\uC5D0 \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4","layout.toast.deleteSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.deleteLocalSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uB85C\uCEEC \uC800\uC7A5\uC18C\uC5D0\uC11C \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.backendUnavailableDeletedLocal":"\uBC31\uC5D4\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC5B4 \uB85C\uCEEC\uC5D0\uC11C \uC0AD\uC81C\uD588\uC2B5\uB2C8\uB2E4","layout.toast.defaultSuccess":"\uAE30\uBCF8 \uB808\uC774\uC544\uC6C3\uC774 \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.defaultLocalSuccess":"\uAE30\uBCF8 \uB808\uC774\uC544\uC6C3\uC774 \uB85C\uCEEC\uC5D0 \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.backendUnavailableDefaultLocal":"\uBC31\uC5D4\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC5B4 \uAE30\uBCF8\uAC12\uC744 \uB85C\uCEEC\uC5D0 \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4","dateRange.label":"\uB0A0\uC9DC \uBC94\uC704","dateRange.startDate":"\uC2DC\uC791\uC77C","dateRange.endDate":"\uC885\uB8CC\uC77C","dateRange.select":"\uC120\uD0DD...","dateRange.today":"\uC624\uB298","dateRange.thisWeek":"\uC774\uBC88 \uC8FC","dateRange.thisMonth":"\uC774\uBC88 \uB2EC","graph.records":"{count}\uAC74","graph.kpi.totalRecords":"\uCD1D \uB808\uCF54\uB4DC","graph.kpi.totalReport":"\uCD1D \uBCF4\uACE0 \uC2DC\uAC04","graph.kpi.totalBillable":"\uCD1D \uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04","graph.kpi.efficiency":"\uD6A8\uC728","graph.kpi.amount":"\uAE08\uC561","graph.kpi.flagged":"\uD50C\uB798\uADF8","graph.chart.billable.title":"\uCC28\uC6D0\uBCC4 \uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04","graph.chart.billable.subtitle":"\uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04 \uC0C1\uC704 \uAC12","graph.chart.efficiency.title":"\uB2F4\uB2F9\uC790\uBCC4 \uD6A8\uC728","graph.chart.efficiency.subtitle":"\uB0AE\uC740 \uD6A8\uC728 \uC6B0\uC120","graph.chart.status.title":"\uC0C1\uD0DC \uBD84\uD3EC","graph.chart.status.subtitle":"\uC0C1\uD0DC\uBCC4 \uBE44\uC728","graph.dataBody":"\uB370\uC774\uD130 \uBCF8\uBB38","graph.reportTitle":"\uADF8\uB798\uD504 \uB9AC\uD3EC\uD2B8","graph.unassigned":"\uBBF8\uC9C0\uC815","graph.column.reportHours":"\uBCF4\uACE0 \uC2DC\uAC04","graph.column.billableHours":"\uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04","detail.searchAi.placeholder":"\uD544\uB4DC\uB97C \uAC80\uC0C9\uD558\uACE0, \uACB0\uACFC\uAC00 \uC5C6\uC73C\uBA74 AI\uC5D0 \uC9C8\uBB38\uD558\uC138\uC694...","detail.searchAi.matches":"{count}\uAC1C \uC77C\uCE58 \uD56D\uBAA9","detail.searchAi.noMatch":"\uC77C\uCE58\uD558\uB294 \uD544\uB4DC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.","detail.searchAi.autoAiFallback":"\uC77C\uCE58 \uD56D\uBAA9\uC774 \uC5C6\uC5B4 AI \uBD84\uC11D\uC744 \uC2E4\uD589\uD569\uB2C8\uB2E4...","detail.searchAi.aiResultTitle":"AI \uBD84\uC11D \uACB0\uACFC","detail.table.title":"\uAD00\uB828 \uB808\uCF54\uB4DC","kanban.empty":"\uC5EC\uAE30\uC5D0 \uCE74\uB4DC\uB97C \uB193\uC73C\uC138\uC694","kanban.bucket.limit":"\uD55C\uB3C4","kanban.bucket.dropHere":"\uB193\uC73C\uBA74 \uC774 \uBC84\uD0B7\uC73C\uB85C \uC774\uB3D9\uD569\uB2C8\uB2E4","kanban.card.progress":"\uC9C4\uD589\uB960","kanban.card.openDetail":"\uC0C1\uC138 \uC5F4\uAE30","kanban.priority.critical":"\uAE34\uAE09","kanban.priority.high":"\uB192\uC74C","kanban.priority.medium":"\uBCF4\uD1B5","kanban.priority.low":"\uB0AE\uC74C","quickCreate.newItem":"\uC2E0\uADDC \uD56D\uBAA9","quickCreate.createWithTitle":"{title} \uC0DD\uC131","quickEdit.editWithTitle":"{title} \uC218\uC815","quickDelete.confirmTitle":"\uC0AD\uC81C \uD655\uC778","quickDelete.confirmMessageSingle":"\uC120\uD0DD\uD55C \uD56D\uBAA9\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?","quickDelete.confirmMessageMultiple":"\uC120\uD0DD\uD55C {count}\uAC1C \uD56D\uBAA9\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?","messageBox.confirm":"\uD655\uC778","messageBox.cancel":"\uCDE8\uC18C"},rn={en:Gm,zh:Um,fr:Km,de:qm,ja:_m,ko:Zm};var Ec=(e,t)=>t?e.replace(/\{(\w+)\}/g,(o,a)=>{let r=t[a];return r==null?"":String(r)}):e,Ym={locale:"en",t:(e,t)=>Ec(rn.en[e]||e,t)},Lc=createContext(Ym),Yn=({locale:e="en",messages:t,children:o})=>{let a=useMemo(()=>{let r=rn[e]||rn.en,n=t?.[e]||{},i={...rn.en,...r,...n};return {locale:e,t:(l,d)=>Ec(i[l]||l,d)}},[e,t]);return jsx(Lc.Provider,{value:a,children:o})},_=()=>useContext(Lc);function Ks({items:e,onItemClick:t,className:o="",level:a=0,expandedIds:r,onToggleExpand:n,colorMode:i="light"}){let{t:l}=_(),d=i==="dark",s=usePathname(),[c,g]=useState(false),[f,u]=useState(new Set),y=r!==void 0&&n!==void 0,I=y?r:f;useEffect(()=>{g(true);},[]);let p=m=>{if(y)n(m);else {let b=new Set(f);b.has(m)?b.delete(m):b.add(m),u(b);}},C=m=>{m.children&&m.children.length>0&&p(m.id),t&&t(m);};return !e||!Array.isArray(e)?jsx("div",{className:io("tree-menu",o),children:jsx("div",{className:"text-sm text-gray-500 p-2",children:l("navigation.noItems")})}):jsx("div",{className:io("tree-menu",o),children:e.map(m=>{let b=I.has(m.id)||m.isExpanded,x=m.children&&m.children.length>0,k=m.appurl||m.href,E=c&&k?s===k:false;return jsxs("div",{className:"tree-menu-item relative",children:[E&&jsx("div",{className:io("absolute left-0 top-2 bottom-2 w-[3px] rounded-r-full z-10",d?"bg-[#90caf9]":"bg-[#1976d2]")}),jsxs(Gs,{variant:"ghost",className:io("w-full justify-start gap-2 h-auto py-2 relative overflow-hidden group",`ml-${a*4}`,E?d?"bg-transparent text-[#90caf9] hover:bg-gray-800/35":"bg-transparent text-[#1976d2] hover:bg-gray-100/60":d?"hover:bg-gray-800/50 text-gray-300":"hover:bg-gray-100/50 text-gray-700"),onClick:()=>C(m),children:[x&&jsx("div",{className:io("flex-shrink-0 transition-transform duration-200",b&&"rotate-90",E?d?"text-[#90caf9]":"text-[#1976d2]":d?"text-gray-500 group-hover:text-gray-300":"text-gray-400 group-hover:text-gray-600"),children:jsx(ChevronRight,{className:"h-4 w-4"})}),!x&&jsx("div",{className:"w-4 h-4 flex-shrink-0"}),m.icon&&jsx("div",{className:io("flex-shrink-0 transition-colors duration-200",E?d?"text-[#90caf9]":"text-[#1976d2]":d?"text-gray-500 group-hover:text-gray-300":"text-gray-400 group-hover:text-gray-600"),children:m.icon}),jsxs("div",{className:"flex-1 text-left overflow-hidden z-10",children:[jsx("div",{className:io("text-sm truncate transition-colors duration-200",E?"font-semibold":"font-medium"),children:m.title||m.label}),m.description&&jsx("div",{className:io("text-xs truncate transition-colors duration-200",E?d?"text-[#90caf9]/70":"text-[#1976d2]/75":d?"text-gray-400":"text-gray-500"),title:m.description,children:m.description})]})]}),x&&jsx("div",{className:io("grid transition-[grid-template-rows] duration-300 ease-in-out",b?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx(Ks,{items:m.children,onItemClick:t,level:a+1,expandedIds:r,onToggleExpand:n,colorMode:i})})})]},m.id)})})}var Wc=({collapsed:e,onToggle:t,className:o="",maxHeight:a,menuData:r=[],colorMode:n="light"})=>{let{t:i}=_(),l=n==="dark",d=useRouter(),[s,c]=useState(""),[g,f]=useState(new Set);useEffect(()=>{e&&f(new Set);},[e]);let u=useCallback(C=>{let m=[],b=x=>{x.forEach(k=>{m.push(k.id),k.children&&b(k.children);});};return b(C),m},[]),y=useMemo(()=>{if(!s.trim())return r;let C=m=>m.reduce((b,x)=>{let k=x.title?.toLowerCase().includes(s.toLowerCase())||x.description?.toLowerCase().includes(s.toLowerCase()),E=x.children?C(x.children):[];return (k||E.length>0)&&b.push({...x,children:E.length>0?E:x.children}),b},[]);return C(r)},[s,r]),I=useMemo(()=>s.trim()?new Set(u(r)):g,[s,r,g,u]),p=useCallback(async C=>{if(console.log("\u{1F5B1}\uFE0F \u5BFC\u822A\u83DC\u5355\u9879\u70B9\u51FB:",C),C.id==="chat"||C.appurl==="/chat"){console.log("\u{1F4AC} \u68C0\u6D4B\u5230chat\u83DC\u5355\u70B9\u51FB\uFF0C\u8DF3\u8F6C\u5230\u65B0\u7684\u804A\u5929\u89C6\u56FE");try{d.push("/chat?new=true");}catch(b){console.error("\u274C \u65E0\u6CD5\u8DF3\u8F6C\u5230\u65B0\u804A\u5929\u89C6\u56FE:",b),d.push("/chat");}return}let m=C.appurl||C.href;m&&(m.startsWith("http://")||m.startsWith("https://")?window.open(m,"_blank"):d.push(m));},[d]);return jsxs("div",{className:`flex flex-col backdrop-blur-xl border shadow-[0_4px_8px_0_rgba(31,38,135,0.1)] ${e?"w-14 rounded-full":"w-[234px] rounded-2xl"} relative ${o} ${l?"bg-[#111111] border-white/10":"bg-white/70 border-white/30"}`,style:{backdropFilter:"blur(16px) saturate(180%)",WebkitBackdropFilter:"blur(16px) saturate(180%)",transition:"width 400ms cubic-bezier(0.4, 0.0, 0.2, 1), border-radius 0ms cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 400ms ease-out",maxHeight:a?`${a}px`:void 0},children:[jsx("div",{className:`pt-4 pb-2 transition-all duration-500 ease-in-out ${e?"px-1":"px-2"}`,children:e?jsx("div",{className:"flex justify-center",children:jsx("button",{onClick:t,className:`w-10 h-10 flex items-center justify-center rounded-lg transition-colors duration-200 ${l?"text-gray-300 hover:bg-gray-800":"text-gray-500 hover:bg-gray-50"}`,title:i("navigation.expand"),children:jsx(Search,{className:"h-5 w-5"})})}):jsxs("div",{className:`relative transition-opacity duration-300 ${e?"opacity-0":"opacity-100 delay-200"}`,children:[jsx("input",{type:"text",placeholder:i("navigation.searchPlaceholder"),value:s,onChange:C=>c(C.target.value),className:`w-full pl-10 pr-4 py-2 text-sm border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ${l?"border-gray-700 bg-[#1A1A1A] text-white placeholder-gray-400":"border-gray-300 bg-white text-gray-900 placeholder-gray-500"}`}),jsx("div",{className:"absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none",children:jsx(Search,{className:`h-4 w-4 ${l?"text-gray-500":"text-gray-400"}`})})]})}),jsx("nav",{className:`flex-1 pb-4 transition-all duration-500 ease-in-out overflow-y-auto min-h-0 ${e?"px-1":"px-2"}`,children:y.length===0?jsx("div",{className:"flex items-center justify-center py-8 text-gray-500 text-sm",children:e?"\u{1F4C2}":i(s?"navigation.noMatch":"navigation.noAccessibleApp")}):jsxs(Fragment,{children:[!e&&jsx("div",{className:`transition-opacity duration-300 ${e?"opacity-0":"opacity-100 delay-200"}`,children:jsx(Ks,{items:y,onItemClick:p,className:"space-y-1",expandedIds:I,colorMode:n,onToggleExpand:C=>{let m=new Set(g);y.some(x=>x.id===C)?m.has(C)?m.delete(C):(y.forEach(x=>{x.id!==C&&m.has(x.id)&&m.delete(x.id);}),m.add(C)):m.has(C)?m.delete(C):m.add(C),f(m);}})}),e&&jsx("div",{className:"space-y-2",children:r.map(C=>jsx("div",{className:"space-y-1",children:jsx("button",{onClick:()=>{t();let m=new Set([C.id]);f(m);},className:`w-full flex items-center justify-center p-2 rounded-lg cursor-pointer transition-colors duration-200 ${l?"text-gray-400 hover:bg-gray-800":"text-gray-600 hover:bg-gray-50"}`,title:i("navigation.expandView",{title:C.title||""}),children:C.icon||jsx("div",{className:`w-6 h-6 rounded text-xs flex items-center justify-center font-medium ${l?"bg-[#90caf9] text-[#0b0b0b]":"bg-[#1976d2] text-white"}`,children:C.title?.charAt(0)||"?"})})},C.id))})]})}),!e&&jsx("button",{onClick:t,className:`absolute -bottom-1 -right-1 w-6 h-6 bg-transparent rounded-full flex items-center justify-center transition-all duration-300 ease-in-out z-20 ${l?"hover:bg-gray-800/50":"hover:bg-white/20"}`,title:i("navigation.collapse"),children:jsx("div",{className:"absolute",style:{bottom:"0px",right:"0px",width:"16px",height:"16px",overflow:"hidden"},children:jsx("div",{className:l?"border-yellow-400":"",style:{width:"32px",height:"32px",borderRadius:"16px",border:"3px solid #21BCFF",backgroundColor:"transparent",position:"absolute",top:"-16px",left:"-16px"}})})})]})};var Gc=(e={})=>{let{initialCollapsed:t=false,content:o=[]}=e,[a,r]=useState(t),[n,i]=useState(o),l=useCallback(()=>{r(s=>!s);},[]),d=useMemo(()=>({collapsed:a,onToggle:l,menuData:n}),[a,l,n]);return {collapsed:a,setCollapsed:r,toggleCollapsed:l,menuData:n,setMenuData:i,navigationIslandProps:d}};var _s=e=>jsx(Button,{...e,variant:e.variant||"contained",size:e.size||"medium",sx:{textTransform:"none",...e.sx}});var Zs=class{constructor(){a(this,"listener",null);}register(t){this.listener=t;}unregister(){this.listener=null;}show(t,o,a){this.listener&&this.listener({type:t,content:o,options:a});}hide(){this.listener&&this.listener(null);}},Qo=new Zs,JS={success:(e,t)=>Qo.show("success",e,t),error:(e,t)=>Qo.show("error",e,t),warning:(e,t)=>Qo.show("warning",e,t),info:(e,t)=>Qo.show("info",e,t),show:(e,t,o)=>Qo.show(e,t,o),hide:()=>Qo.hide()};var vg={success:{icon:jsx(hg,{sx:{fontSize:40}}),color:"#e8f5e9",iconColor:"#66bb6a",borderColor:"#a5d6a7"},warning:{icon:jsx(yg,{sx:{fontSize:40}}),color:"#fff3e0",iconColor:"#ffa726",borderColor:"#ffcc80"},error:{icon:jsx(bg,{sx:{fontSize:40}}),color:"#ffebee",iconColor:"#ef5350",borderColor:"#ef9a9a"},info:{icon:jsx(xg,{sx:{fontSize:40}}),color:"#e3f2fd",iconColor:"#42a5f5",borderColor:"#90caf9"},default:{icon:null,color:"transparent",iconColor:"inherit",borderColor:"transparent"}},nn=({open:e,title:t,message:o,onClose:a,onConfirm:r,confirmText:n,cancelText:i,showCancel:l=true,maxWidth:d="xs",type:s="default"})=>{let{t:c}=_(),g=n||c("messageBox.confirm"),f=i||c("messageBox.cancel"),u=()=>{r?r():a();},y=vg[s],I=s!=="default";return jsxs(Jd,{open:e,onClose:a,maxWidth:d,fullWidth:true,PaperProps:{sx:{borderRadius:3,...I&&{borderTop:`6px solid ${y.iconColor}`}}},children:[I&&jsx(kn,{sx:{display:"flex",justifyContent:"center",pt:3,color:y.iconColor},children:y.icon}),t&&jsx(ep,{sx:{textAlign:I?"center":"left",pt:I?1:2},children:t}),jsx(tp,{sx:{textAlign:I?"center":"left"},children:typeof o=="string"?jsx(mg,{children:o}):o}),jsxs(op,{sx:{justifyContent:I?"center":"flex-end",pb:3,px:3},children:[l&&jsx(_s,{onClick:a,variant:"text",color:"inherit",children:f}),jsx(_s,{onClick:u,variant:"contained",sx:{bgcolor:I?y.iconColor:void 0,"&:hover":{bgcolor:I?y.iconColor:void 0,filter:"brightness(0.9)"}},autoFocus:true,children:g})]})]})},hw=()=>{let[e,t]=st__default.useState(null),[o,a]=st__default.useState(false);st__default.useEffect(()=>{let i=l=>{l?(t(l),a(true)):(a(false),t(null));};return Qo.register(i),()=>Qo.unregister()},[]);let r=()=>{a(false),e?.options?.onClose&&e.options.onClose(),t(null);},n=()=>{e?.options?.onConfirm&&e.options.onConfirm(),a(false),t(null);};return e?jsx(nn,{open:o,type:e.type,message:e.content,title:e.options?.title,onClose:r,onConfirm:n,confirmText:e.options?.confirmText,cancelText:e.options?.cancelText,showCancel:e.options?.showCancel,maxWidth:e.options?.maxWidth}):null};var Kc=({title:e,hideHeader:t,children:o})=>jsxs(Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[!t&&jsx(Box,{sx:{mb:2},children:jsx(Typography,{variant:"h4",children:e})}),jsx(Box,{sx:{flex:1,overflow:"hidden"},children:o})]});var Jn=e=>{let{t}=_(),o="0.85rem",a=Array.isArray(e.actions)?e.actions:e.actions?[e.actions]:[],r=Array.isArray(e.extraTools)?e.extraTools:e.extraTools?[e.extraTools]:[],n=[...a,...r],i=typeof e.rowsPerPage=="number"?e.rowsPerPage:20,l=Array.isArray(e.rowsPerPageOptions)&&e.rowsPerPageOptions.length>0?e.rowsPerPageOptions:[20,50,100,-1],d=typeof e.count=="number"?e.count:0,s=Math.max(0,typeof e.page=="number"?e.page:0),c=i===-1?1:Math.max(1,Math.ceil(d/i)),g=Math.min(s+1,c),f=s>0,u=s<c-1&&i!==-1;return jsxs(Toolbar,{sx:{pl:{sm:2},pr:{xs:1,sm:1},alignItems:"center",gap:1},children:[jsx(TextField,{size:"small",placeholder:t("table.toolbar.searchPlaceholder"),value:e.filterText,onChange:y=>e.setFilterText(y.target.value),InputProps:{sx:{fontSize:o,"& .MuiInputBase-input":{fontSize:o,color:"text.primary"},"& .MuiInputBase-input::placeholder":{fontSize:o,opacity:1}},startAdornment:jsx(InputAdornment,{position:"start",children:jsx($d,{fontSize:"small"})})},sx:{width:300}}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[jsx(Typography,{sx:{fontSize:o,color:"text.secondary",whiteSpace:"nowrap"},children:t("table.toolbar.itemsPerPage")}),jsx(Select,{size:"small",variant:"standard",value:i,disableUnderline:true,onChange:y=>e.onRowsPerPageChange?.(Number(y.target.value)),sx:{fontSize:o,fontWeight:600,color:"text.primary",minWidth:64,"& .MuiSelect-select":{py:.25,pr:"16px !important"},"& .MuiSvgIcon-root":{color:"text.primary"}},children:l.map(y=>jsx(MenuItem,{value:y,sx:{fontSize:o},children:y===-1?t("common.all"):y},`rows-per-page-${y}`))}),jsx(IconButton,{size:"small",onClick:()=>e.onPageChange?.(Math.max(s-1,0)),disabled:!f,sx:{p:.35,color:"text.primary"},children:jsx($g,{fontSize:"small"})}),jsx(Typography,{sx:{fontSize:o,fontWeight:600,minWidth:88,textAlign:"center",color:"text.primary"},children:t("table.toolbar.pageOf",{current:g,total:c})}),jsx(IconButton,{size:"small",onClick:()=>e.onPageChange?.(Math.min(s+1,c-1)),disabled:!u,sx:{p:.35,color:"text.primary"},children:jsx(Wg,{fontSize:"small"})})]}),jsx(Box,{sx:{flex:1}}),jsxs(Box,{sx:{display:"flex",gap:1,alignItems:"center"},children:[n.length>0&&jsx(Box,{sx:{display:"flex",gap:1,alignItems:"center"},children:n.map((y,I)=>jsx(st__default.Fragment,{children:y},`toolbar-custom-${I}`))}),jsx(Box,{sx:{width:"1px",height:20,bgcolor:"divider",mx:.5}}),jsx(Tooltip,{title:t("table.toolbar.groupBy"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:y=>e.setGroupAnchorEl(y.currentTarget),children:jsx(Badge,{badgeContent:e.grouping?.length,color:"primary",children:jsx(Eg,{})})})}),jsx(Tooltip,{title:t("table.toolbar.summary"),children:jsx(IconButton,{sx:{color:e.showSummary?"primary.main":"text.primary"},onClick:y=>e.setSummaryAnchorEl(y.currentTarget),children:jsx(Lg,{})})}),jsx(Tooltip,{title:t("table.toolbar.columns"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:y=>e.setAnchorEl(y.currentTarget),children:jsx(Ag,{})})}),jsx(Tooltip,{title:t("table.toolbar.export"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:e.handleExport,children:jsx(Fg,{})})}),e.showCreateButton&&jsx(Tooltip,{title:t("table.toolbar.newItem"),children:jsx(IconButton,{onClick:e.onOpenCreateDialog,color:"primary",children:jsx(zg,{})})}),e.showEditButton&&jsx(Tooltip,{title:t("table.toolbar.editItem"),children:jsx("span",{children:jsx(IconButton,{onClick:e.onOpenEditDialog,color:"primary",disabled:!!e.editDisabled,children:jsx(Vg,{})})})}),e.showDeleteButton&&jsx(Tooltip,{title:t("table.toolbar.deleteItem"),children:jsx("span",{children:jsx(IconButton,{onClick:e.onOpenDeleteConfirm,color:"error",disabled:!!e.deleteDisabled,children:jsx(Og,{})})})}),e.onOpenGraphReport&&jsx(Tooltip,{title:t("table.toolbar.graphicReport"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:e.onOpenGraphReport,children:jsx(Ng,{})})}),e.onLayoutSave&&!e.layoutManager&&jsx(Tooltip,{title:t("table.toolbar.saveLayout"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:y=>e.onLayoutSave(y),children:jsx(Zd,{})})}),e.layoutManager]})]})};var jc=e=>{let{t}=_(),{onSelectAllClick:o,order:a,orderBy:r,numSelected:n=0,rowCount:i=0,onRequestSort:l,columns:d,visibleColumns:s,selectionMode:c,grouping:g=[],isAllExpanded:f=false,handleToggleAll:u,onColumnResize:y,columnWidths:I}=e,[p,C]=useState(null),m=useRef(null),b=v=>D=>{p||l(v);},x=(v,D,S)=>{v.preventDefault(),v.stopPropagation(),C(D),m.current={startX:v.clientX,startWidth:S,colId:D},document.addEventListener("mousemove",k),document.addEventListener("mouseup",E),document.body.style.cursor="col-resize";},k=v=>{if(!m.current)return;let{startX:D,startWidth:S,colId:P}=m.current,F=v.clientX-D,W=Math.max(50,S+F);y&&y(P,W);},E=()=>{C(null),m.current=null,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",E),document.body.style.cursor="";};useEffect(()=>()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",E);},[]);let R=c==="multiple"||c==="single",w=g.length>0&&!!u,B=t(f?"table.group.collapseAll":"table.group.expandAll"),T=d.filter(v=>s.includes(v.id));return jsx(Kg,{children:jsxs(qg,{children:[R&&jsx(Js,{padding:"checkbox",sx:v=>({width:48,position:"sticky",top:0,zIndex:4,backgroundColor:v.palette.mode==="dark"?"#000000":"#f5f5f5",color:v.palette.mode==="dark"?"#ffffff":v.palette.text.primary}),children:jsx(_g,{color:"primary",indeterminate:n>0&&n<i,checked:i>0&&n===i,onChange:o,disabled:c==="single"})}),w&&jsx(Js,{align:"center",padding:"checkbox",sx:v=>({width:44,position:"sticky",top:0,zIndex:4,backgroundColor:v.palette.mode==="dark"?"#000000":"#f5f5f5",color:v.palette.mode==="dark"?"#ffffff":v.palette.text.primary}),children:jsx(Qg,{title:B,children:jsx(jg,{size:"small",onClick:v=>{v.stopPropagation(),u?.(!f);},sx:{p:.2},children:f?jsx(Yg,{fontSize:"small"}):jsx(Xg,{fontSize:"small"})})})}),T.map(v=>{let D=I?.[v.id]||v.minWidth||100;return jsxs(Js,{align:"left",padding:v.disablePadding?"none":"normal",sortDirection:r===v.id?a:false,style:{width:D,minWidth:D,maxWidth:D},sx:S=>({position:"sticky",top:0,zIndex:4,backgroundColor:S.palette.mode==="dark"?"#000000":"#f5f5f5",color:S.palette.mode==="dark"?"#ffffff":S.palette.text.primary,fontWeight:"bold",userSelect:"none"}),children:[jsx(Zg,{active:r===v.id,direction:r===v.id?a:"asc",onClick:b(v.id),sx:S=>({"&.MuiTableSortLabel-root":{width:"100%"},"& .MuiTableSortLabel-icon":{color:S.palette.mode==="dark"?"#ffffff":S.palette.text.primary,opacity:r===v.id?1:0,transition:"opacity 0.2s"},"&:hover .MuiTableSortLabel-icon":{opacity:.5},"&.Mui-active .MuiTableSortLabel-icon":{opacity:1,color:S.palette.mode==="dark"?"#ffffff":S.palette.text.primary},fontWeight:"bold",fontSize:"0.85rem",color:S.palette.mode==="dark"?"#ffffff":S.palette.text.primary}),children:jsx(kn,{component:"span",sx:{overflow:"visible",textOverflow:"clip",whiteSpace:"normal",lineHeight:1.2,wordBreak:"break-word",pr:1},children:v.label})}),jsx(kn,{onMouseDown:S=>x(S,v.id,typeof D=="number"?D:100),onClick:S=>S.stopPropagation(),sx:{position:"absolute",right:0,top:0,bottom:0,width:5,cursor:"col-resize","&:hover":{backgroundColor:"primary.main",opacity:.5},zIndex:1}})]},v.id)})]})})};var Yc=e=>{let{t}=_(),{visibleRows:o,visibleColumns:a,selected:r=[],handleClick:n,columns:i,toggleGroupExpand:l,expandedGroups:d=new Set,selectionMode:s,grouping:c=[],isGroupFullyExpanded:g,handleExpandGroupRecursively:f,handleCollapseGroupRecursively:u}=e,y=m=>r.indexOf(m)!==-1,I=s==="multiple"||s==="single",p=c.length>0,C=a.length+(I?1:0)+(p?1:0);return jsxs(TableBody,{children:[o.map((m,b)=>{if(m.type==="group"){let x=d.has(m.id),k=m.childIds||[],E=k.filter(T=>y(T)).length,R=k.length>0&&E===k.length,w=E>0&&E<k.length;return jsxs(TableRow,{sx:T=>({backgroundColor:T.palette.mode==="dark"?"#111111":"#f5f5f5","& .MuiTableCell-root":{color:T.palette.text.primary,borderBottomColor:T.palette.divider},"& .MuiIconButton-root":{color:T.palette.text.primary},"& .MuiCheckbox-root":{color:T.palette.text.secondary},"& .MuiCheckbox-root.Mui-checked, & .MuiCheckbox-root.MuiCheckbox-indeterminate":{color:T.palette.primary.main}}),children:[I&&jsx(TableCell,{padding:"checkbox",children:jsx(Checkbox,{size:"small",checked:R,indeterminate:w,onChange:T=>{if(T.stopPropagation(),!!e.onSelectionChange)if(R){let v=r.filter(D=>!k.includes(D));e.onSelectionChange(v);}else {let v=Array.from(new Set([...r,...k]));e.onSelectionChange(v);}},onClick:T=>T.stopPropagation(),sx:{p:.5}})}),p&&jsx(TableCell,{padding:"checkbox",sx:{width:44},children:jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.25},children:[c.length>1&&m.level<c.length-1&&jsx(Tooltip,{title:g?.(m.id)?t("table.group.collapseAll"):t("table.group.expandAll"),children:jsx(IconButton,{size:"small",onClick:()=>{g?.(m.id)?u?.(m.id):f?.(m.id);},sx:{p:.25},children:g?.(m.id)?jsx(Yg,{fontSize:"small"}):jsx(Xg,{fontSize:"small"})})}),jsx(IconButton,{size:"small",onClick:()=>l&&l(m.id),sx:{p:.25},children:x?jsx(rf,{}):jsx(Wg,{})})]})}),jsx(TableCell,{colSpan:a.length,sx:{py:1,pl:m.level*3+1},children:jsxs(Typography,{variant:"body2",fontWeight:"bold",color:"text.primary",sx:{fontSize:"0.85rem"},children:[m.field,": ",m.value," (",m.count,")"]})})]},m.id)}else {let x=m.data||m,k=m.id||x.id||b,E=y(k),R=`enhanced-table-checkbox-${b}`,B=(m.level!==void 0?m.level:0)*4;return jsxs(TableRow,{hover:true,onClick:T=>n&&n(T,x),role:"checkbox","aria-checked":E,tabIndex:-1,selected:E,sx:{cursor:"pointer"},children:[I&&jsx(TableCell,{padding:"checkbox",sx:{pl:B>0?B+1:void 0},children:jsx(Checkbox,{color:"primary",checked:E,inputProps:{"aria-labelledby":R}})}),p&&jsx(TableCell,{padding:"checkbox",sx:{width:44}}),i.filter(T=>a.includes(T.id)).map((T,v)=>{let S=!I&&v===0&&B>0?{pl:B+2}:{};return jsx(TableCell,{align:"left",sx:S,children:T.render?T.render(x[T.id],x):(function(){let F=x[T.id];if(T.numeric){if(typeof F=="number")return F.toLocaleString();if(typeof F=="string"&&F.trim()!==""&&!isNaN(Number(F)))return Number(F).toLocaleString()}return F})()},T.id)})]},k)}}),o.length===0&&jsx(TableRow,{children:jsx(TableCell,{colSpan:C,align:"center",children:t("common.noData")})})]})};var Jc=e=>{let{visibleColumns:t,summaryRow:o,selectionMode:a,grouping:r=[]}=e;if(!e.showSummary)return null;let n=a==="multiple"||a==="single",i=r.length>0;return jsx(TableFooter,{sx:{position:"sticky",bottom:0,zIndex:e.zIndex,bgcolor:"background.paper"},children:jsxs(TableRow,{children:[n&&jsx(TableCell,{padding:"checkbox",sx:{bgcolor:"background.paper"}}),i&&jsx(TableCell,{padding:"checkbox",sx:{bgcolor:"background.paper",width:44}}),t.map(l=>jsx(TableCell,{sx:{fontWeight:"bold",fontSize:"0.85rem",bgcolor:"background.paper",color:"text.primary"},children:(function(){let s=o[l];return s==null||s===""?"":typeof s=="number"?s.toLocaleString():typeof s=="string"&&s.trim()!==""&&!isNaN(Number(s))?Number(s).toLocaleString():s})()},l))]})})};var td=e=>{let{t}=_();return jsx(Box,{sx:{p:2},children:jsx(Typography,{children:t("table.mobile.notImplemented")})})};var ai=({groupAnchorEl:e,setGroupAnchorEl:t,grouping:o,setGrouping:a,columns:r,toggleGroupField:n})=>{let{t:i}=_();return jsxs(Menu,{anchorEl:e,open:!!e,onClose:()=>t(null),children:[jsxs(Box,{sx:{p:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx(Typography,{variant:"subtitle2",sx:{px:1},children:i("table.menu.groupBy")}),o.length>0&&jsx(Button,{size:"small",color:"error",onClick:()=>a([]),startIcon:jsx(vf,{}),children:i("table.menu.clearAll")})]}),jsx(Divider,{}),r.map(l=>{let d=o.includes(l.id),s=o.indexOf(l.id)+1;return jsx(MenuItem,{onClick:()=>n(l.id),children:jsxs(Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[jsx(Checkbox,{checked:d,size:"small"}),jsx(ListItemText,{primary:l.label}),d&&jsx(Badge,{badgeContent:s,color:"primary",sx:{mr:2}})]})},l.id)})]})},ri=({anchorEl:e,setAnchorEl:t,columns:o,visibleColumns:a,toggleColumnVisibility:r})=>{let{t:n}=_();return jsxs(Menu,{anchorEl:e,open:!!e,onClose:()=>t(null),children:[jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:n("table.menu.visibleColumns")})}),jsx(Divider,{}),o.map(i=>jsxs(MenuItem,{onClick:()=>r(i.id),children:[jsx(Checkbox,{checked:a.includes(i.id),size:"small"}),jsx(ListItemText,{primary:i.label})]},i.id))]})},ni=({anchorEl:e,setAnchorEl:t,showSummary:o,setShowSummary:a,columns:r,summaryColumns:n,toggleSummaryColumn:i})=>{let{t:l}=_();return jsxs(Menu,{anchorEl:e,open:!!e,onClose:()=>t(null),children:[jsx(MenuItem,{children:jsx(FormControlLabel,{control:jsx(Switch,{checked:o,onChange:d=>a(d.target.checked),size:"small"}),label:l("table.menu.showSummaryRow")})}),jsx(Divider,{}),r.filter(d=>d.numeric).map(d=>jsxs(MenuItem,{onClick:()=>i(d.id),disabled:!o,children:[jsx(Checkbox,{checked:n.includes(d.id),size:"small"}),jsx(ListItemText,{primary:d.label})]},d.id)),r.filter(d=>d.numeric).length===0&&jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:l("table.menu.noNumericColumns")})})]})},ii=({contextMenu:e,handleCloseContextMenu:t,columns:o,visibleColumns:a,toggleColumnVisibility:r})=>{let{t:n}=_();return jsxs(Menu,{open:e!==null,onClose:t,anchorReference:"anchorPosition",anchorPosition:e!==null?{top:e.mouseY,left:e.mouseX}:void 0,children:[jsx(MenuItem,{onClick:t,children:n("common.copy")}),jsx(Divider,{}),jsx(MenuItem,{disabled:true,children:n("table.menu.visibleColumns")}),o.map(i=>jsxs(MenuItem,{onClick:()=>r(i.id),children:[jsx(ListItemIcon,{children:a.includes(i.id)&&jsx(xf,{fontSize:"small"})}),jsx(ListItemText,{children:i.label})]},i.id))]})};var cn=(e,t=2)=>e.toLocaleString(void 0,{maximumFractionDigits:t}),rd=({kpis:e})=>{let{t}=_(),o=[{label:t("graph.kpi.totalRecords"),value:cn(e.totalRecords,0),color:"text.primary"},{label:t("graph.kpi.totalReport"),value:cn(e.totalReportHours),color:"text.primary"},{label:t("graph.kpi.totalBillable"),value:cn(e.totalBillableHours),color:"success.main"},{label:t("graph.kpi.efficiency"),value:`${e.efficiency.toFixed(2)}%`,color:"warning.main"},{label:t("graph.kpi.amount"),value:cn(e.totalAmount),color:"info.main"},{label:t("graph.kpi.flagged"),value:cn(e.flaggedCount,0),color:"error.main"}];return jsx(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:"repeat(6, minmax(0, 1fr))"},gap:1.5},children:o.map(a=>jsxs(Paper,{variant:"outlined",sx:{p:1.5,borderRadius:2,minHeight:96,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[jsx(Typography,{variant:"caption",color:"text.secondary",children:a.label}),jsx(Typography,{variant:"h4",fontWeight:800,sx:{color:a.color},children:a.value})]},a.label))})};var si=({title:e,subtitle:t,children:o})=>jsxs(Paper,{variant:"outlined",sx:{p:2,borderRadius:2},children:[jsx(Typography,{variant:"subtitle1",fontWeight:700,children:e}),t&&jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t}),o]});var pn=({data:e,orientation:t="horizontal",valueSuffix:o="",minHeight:a=210,activeName:r,onItemClick:n})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let i=Math.max(...e.map(l=>l.value),1);return t==="vertical"?jsx(Box,{sx:{display:"flex",gap:1,alignItems:"flex-end",minHeight:a},children:e.map(l=>jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsx(Box,{onClick:()=>n?.(l),sx:{height:`${Math.max(l.value/i*180,6)}px`,bgcolor:l.name===r?"primary.dark":"primary.main",borderRadius:"8px 8px 0 0",cursor:n?"pointer":"default",opacity:r&&l.name!==r?.45:1}}),jsx(Typography,{variant:"caption",noWrap:true,title:l.name,sx:{display:"block",mt:.5},children:l.name}),jsxs(Typography,{variant:"caption",color:"text.secondary",children:[l.value.toFixed(1),o]})]},l.name))}):jsx(Stack,{spacing:1,children:e.map(l=>jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"140px 1fr 64px",gap:1},children:[jsx(Typography,{variant:"caption",color:"text.secondary",noWrap:true,title:l.name,children:l.name}),jsx(Box,{onClick:()=>n?.(l),sx:{alignSelf:"center",bgcolor:"action.hover",height:10,borderRadius:999,overflow:"hidden",cursor:n?"pointer":"default",opacity:r&&l.name!==r?.45:1},children:jsx(Box,{sx:{width:`${l.value/i*100}%`,height:"100%",bgcolor:l.name===r?"primary.dark":"primary.main"}})}),jsxs(Typography,{variant:"caption",sx:{textAlign:"right",fontWeight:600},children:[l.value.toFixed(1),o]})]},l.name))})};var sd=({data:e,color:t="#42A5F5",valueSuffix:o="",height:a=220})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let r=640,n=28,i=e.map(f=>f.value),l=Math.min(...i,0),s=Math.max(...i,1)-l||1,c=e.map((f,u)=>{let y=n+u*(r-n*2)/Math.max(e.length-1,1),I=a-n-(f.value-l)/s*(a-n*2);return {x:y,y:I,...f}}),g=c.map(f=>`${f.x},${f.y}`).join(" ");return jsxs(Box,{children:[jsxs(Box,{component:"svg",viewBox:`0 0 ${r} ${a}`,sx:{width:"100%",height:a},children:[jsx("line",{x1:n,y1:a-n,x2:r-n,y2:a-n,stroke:"rgba(148,163,184,0.4)"}),jsx("polyline",{fill:"none",stroke:t,strokeWidth:3,points:g}),c.map(f=>jsx("circle",{cx:f.x,cy:f.y,r:4,fill:t},f.name))]}),jsx(Box,{sx:{mt:1,display:"grid",gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`,gap:1},children:e.map(f=>jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"caption",noWrap:true,title:f.name,sx:{display:"block"},children:f.name}),jsxs(Typography,{variant:"caption",color:"text.secondary",children:[f.value.toFixed(1),o]})]},f.name))})]})};var ld=({data:e,barColor:t="#64B5F6",lineColor:o="#FFB74D",height:a=220})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let r=640,n=28,i=Math.max(...e.map(c=>c.barValue),1),l=Math.max(...e.map(c=>c.lineValue),1),d=e.map((c,g)=>{let f=(r-n*2)/e.length,u=Math.max(f*.5,8),y=n+g*f+(f-u)/2,I=c.barValue/i*(a-n*2),p=a-n-I;return {x:y,y:p,barHeight:I,barWidth:u,item:c}}),s=e.map((c,g)=>{let f=(r-n*2)/e.length,u=n+g*f+f/2,y=a-n-c.lineValue/l*(a-n*2);return {x:u,y,item:c}});return jsxs(Stack,{spacing:1.25,children:[jsxs(Box,{component:"svg",viewBox:`0 0 ${r} ${a}`,sx:{width:"100%",height:a},children:[jsx("line",{x1:n,y1:a-n,x2:r-n,y2:a-n,stroke:"rgba(148,163,184,0.4)"}),d.map(c=>jsx("rect",{x:c.x,y:c.y,width:c.barWidth,height:Math.max(c.barHeight,4),rx:6,fill:t},c.item.name)),jsx("polyline",{fill:"none",stroke:o,strokeWidth:3,points:s.map(c=>`${c.x},${c.y}`).join(" ")}),s.map(c=>jsx("circle",{cx:c.x,cy:c.y,r:3.5,fill:o},`${c.item.name}-line`))]}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`,gap:1},children:e.map(c=>jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"caption",noWrap:true,title:c.name,sx:{display:"block"},children:c.name}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:["Bar: ",c.barValue.toFixed(1)]}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:["Line: ",c.lineValue.toFixed(1)]})]},c.name))})]})};var Rf=e=>`rgba(30, 136, 229, ${.2+Math.max(0,Math.min(1,e))*.8})`,dd=({data:e})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let t=Array.from(new Set(e.map(n=>n.x))),o=Array.from(new Set(e.map(n=>n.y))),a=Math.max(...e.map(n=>n.value),1),r=new Map(e.map(n=>[`${n.y}__${n.x}`,n.value]));return jsx(Box,{sx:{overflowX:"auto"},children:jsxs(Box,{sx:{display:"grid",gridTemplateColumns:`120px repeat(${t.length}, minmax(64px, 1fr))`,gap:1,minWidth:120+t.length*64},children:[jsx(Box,{}),t.map(n=>jsx(Typography,{variant:"caption",sx:{textAlign:"center",fontWeight:600},children:n},n)),o.map(n=>jsxs(Box,{sx:{display:"contents"},children:[jsx(Typography,{variant:"caption",sx:{alignSelf:"center"},children:n}),t.map(i=>{let l=r.get(`${n}__${i}`)||0,d=l/a;return jsx(Box,{sx:{height:36,borderRadius:1,bgcolor:Rf(d),border:"1px solid rgba(148,163,184,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsx(Typography,{variant:"caption",fontWeight:700,children:l.toFixed(1)})},`${n}-${i}`)})]},n))]})})};var Df=["#1E88E5","#1ABC9C","#FBC02D","#EF5350","#7E57C2","#78909C"],gi=({data:e,variant:t="donut",colors:o=Df,size:a=180,activeName:r,onItemClick:n})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let i=0,l=e.map((d,s)=>{let c=i;return i+=d.percent,`${o[s%o.length]} ${c}% ${i}%`});return jsxs(Stack,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:"center",children:[jsx(Box,{sx:{width:a,height:a,borderRadius:"50%",background:`conic-gradient(${l.join(", ")})`,position:"relative",flexShrink:0},children:t==="donut"&&jsx(Box,{sx:{position:"absolute",inset:Math.round(a*.18),bgcolor:"background.paper",borderRadius:"50%"}})}),jsx(Stack,{spacing:1,sx:{minWidth:180},children:e.map((d,s)=>jsxs(Box,{onClick:()=>n?.(d),sx:{display:"flex",alignItems:"center",gap:1,cursor:n?"pointer":"default",opacity:r&&d.name!==r?.45:1},children:[jsx(Box,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:o[s%o.length]}}),jsx(Typography,{variant:"caption",sx:{flex:1},children:d.name}),jsxs(Typography,{variant:"caption",sx:{fontWeight:700},children:[d.percent.toFixed(0),"%"]})]},d.name))})]})};var ud=({effect:e,branches:t})=>{if(t.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let o=t.filter((r,n)=>n%2===0),a=t.filter((r,n)=>n%2===1);return jsxs(Stack,{spacing:1.5,children:[jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${Math.max(o.length,1)}, minmax(0, 1fr))`,gap:1},children:o.map(r=>jsxs(Box,{sx:{borderLeft:"2px solid",borderColor:"divider",pl:1},children:[jsx(Typography,{variant:"caption",fontWeight:700,children:r.title}),r.causes.map(n=>jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:n},n))]},r.title))}),jsxs(Box,{sx:{position:"relative",height:32},children:[jsx(Box,{sx:{position:"absolute",inset:"50% 0 auto 0",borderTop:"2px solid",borderColor:"primary.main"}}),jsx(Box,{sx:{position:"absolute",right:0,top:"calc(50% - 12px)",px:1,py:.25,borderRadius:1,bgcolor:"primary.main",color:"primary.contrastText"},children:jsx(Typography,{variant:"caption",fontWeight:700,children:e})})]}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${Math.max(a.length,1)}, minmax(0, 1fr))`,gap:1},children:a.map(r=>jsxs(Box,{sx:{borderLeft:"2px solid",borderColor:"divider",pl:1},children:[jsx(Typography,{variant:"caption",fontWeight:700,children:r.title}),r.causes.map(n=>jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:n},n))]},r.title))})]})};var gd=({data:e,height:t=240})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let o=0,a=e.map(g=>{let f=g.type==="total"?0:o,u=g.type==="total"?g.value:o+g.value;return g.type!=="total"&&(o=u),{...g,start:f,end:u,delta:u-f}}),r=a.flatMap(g=>[g.start,g.end]),n=Math.min(...r,0),i=Math.max(...r,1),l=680,d=30,s=i-n||1,c=g=>t-d-(g-n)/s*(t-d*2);return jsxs(Box,{children:[jsxs(Box,{component:"svg",viewBox:`0 0 ${l} ${t}`,sx:{width:"100%",height:t},children:[jsx("line",{x1:d,y1:c(0),x2:l-d,y2:c(0),stroke:"rgba(148,163,184,0.4)"}),a.map((g,f)=>{let u=(l-d*2)/a.length,y=Math.max(u*.55,8),I=d+f*u+(u-y)/2,p=c(Math.max(g.start,g.end)),C=c(Math.min(g.start,g.end)),m=g.type==="total"?"#42A5F5":g.delta>=0?"#66BB6A":"#EF5350";return jsxs("g",{children:[jsx("rect",{x:I,y:p,width:y,height:Math.max(C-p,4),rx:6,fill:m}),jsx("text",{x:I+y/2,y:p-6,textAnchor:"middle",fill:"currentColor",fontSize:"11",children:g.end.toFixed(1)})]},g.name)})]}),jsx(Box,{sx:{mt:1,display:"grid",gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`,gap:1},children:a.map(g=>jsx(Typography,{variant:"caption",noWrap:true,title:g.name,children:g.name},g.name))})]})};var gn=({apiKey:e,query:t,zoom:o=14,mapType:a="roadmap"})=>{let r=encodeURIComponent(t);return `https://www.google.com/maps/embed/v1/place?key=${encodeURIComponent(e)}&q=${r}&zoom=${o}&maptype=${a}`},j1=(e,t=360)=>{let o=gn(e);return `<iframe width="100%" height="${t}" style="border:0" loading="lazy" allowfullscreen referrerpolicy="no-referrer-when-downgrade" src="${o}"></iframe>`};var yd=({apiKey:e,query:t,embedUrl:o,zoom:a=14,mapType:r="roadmap",height:n=320})=>{let i=o||(e&&t?gn({apiKey:e,query:t,zoom:a,mapType:r}):"");return i?jsxs(Box,{children:[jsx(Box,{component:"iframe",src:i,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",sx:{width:"100%",height:n,border:0,borderRadius:2}}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{mt:.75,display:"block"},children:["If iframe is blocked, open directly: ",jsx(Link,{href:i,target:"_blank",rel:"noreferrer",children:"Google Maps"})]})]}):jsx(Box,{children:jsx(Typography,{variant:"body2",color:"text.secondary",children:"Google Map requires `embedUrl` or (`apiKey` + `query`)."})})};var yi=({keyword:e,location:t,src:o="orbcafe-ui"})=>{if(t){let a=encodeURIComponent(t.name||e||"Location");return `https://uri.amap.com/marker?position=${t.lng},${t.lat}&name=${a}&src=${encodeURIComponent(o)}&coordinate=gaode&callnative=0`}return e?`https://uri.amap.com/search?keyword=${encodeURIComponent(e)}&src=${encodeURIComponent(o)}&callnative=0`:"https://uri.amap.com/search?keyword=%E5%8C%97%E4%BA%AC&src=orbcafe-ui&callnative=0"};var Cd=({keyword:e,location:t,embedUrl:o,height:a=320})=>{let r=o||yi({keyword:e,location:t?{lng:t.lng,lat:t.lat,name:t.name}:void 0});return jsxs(Box,{children:[jsx(Box,{component:"iframe",src:r,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",sx:{width:"100%",height:a,border:0,borderRadius:2}}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{mt:.75,display:"block"},children:["If iframe is blocked, open directly: ",jsx(Link,{href:r,target:"_blank",rel:"noreferrer",children:"AMap"})]})]})};var kd=({billableByPrimary:e,efficiencyBySecondary:t,statusDistribution:o,interaction:a})=>{let{t:r}=_();return jsxs(Box,{sx:{display:"grid",gap:1.5,gridTemplateColumns:{xs:"1fr",lg:"1.2fr 1.2fr 1fr"}},children:[jsx(si,{title:r("graph.chart.billable.title"),subtitle:r("graph.chart.billable.subtitle"),children:jsx(pn,{data:e,orientation:"horizontal",activeName:a?.filters?.primaryDimension,onItemClick:n=>a?.onPrimaryDimensionClick?.(n.name)})}),jsx(si,{title:r("graph.chart.efficiency.title"),subtitle:r("graph.chart.efficiency.subtitle"),children:jsx(pn,{data:t,orientation:"vertical",valueSuffix:"%",activeName:a?.filters?.secondaryDimension,onItemClick:n=>a?.onSecondaryDimensionClick?.(n.name)})}),jsx(si,{title:r("graph.chart.status.title"),subtitle:r("graph.chart.status.subtitle"),children:jsx(gi,{data:o,variant:"donut",activeName:a?.filters?.status,onItemClick:n=>a?.onStatusClick?.(n.name)})})]})};var Ka=e=>jsx(TextField,{...e,variant:e.variant||"outlined",size:e.size||"small",fullWidth:e.fullWidth!==void 0?e.fullWidth:true});var pl=e=>jsx(TextField,{...e,multiline:true,minRows:3,fullWidth:true,variant:"outlined"});var Zf=["doubao-lite","gpt-4o-mini","gpt-4.1-mini","claude-3.5-sonnet"],jf=["zh","en","de","fr","ja","ko"],Id=({open:e,onClose:t,value:o,onSaveAll:a,modelOptions:r=Zf,promptLangOptions:n=jf,analysisTemplateOptions:i=[],responseTemplateOptions:l=[],defaultAnalysisTemplateId:d,defaultResponseTemplateId:s})=>{let[c,g]=useState(o),[f,u]=useState(d||""),[y,I]=useState(s||""),[p,C]=useState(false);useEffect(()=>{e&&(g(o),u(d||""),I(s||""));},[e,o,d,s]);let m=(x,k)=>{g(E=>({...E,[x]:k}));},b=async()=>{if(a)try{C(!0),await a({settings:c,analysisTemplateId:f||void 0,responseTemplateId:y||void 0});}finally{C(false);}};return jsxs(Dialog,{open:e,onClose:t,fullWidth:true,maxWidth:"lg",children:[jsxs(DialogTitle,{sx:{pr:7,pb:2.2},children:[jsx(Typography,{variant:"h5",sx:{fontWeight:800},children:"AI Settings"}),jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:"Configure LLM settings and editable agent prompts by language."}),jsx(IconButton,{onClick:t,sx:{position:"absolute",right:12,top:12},children:jsx(_f,{})})]}),jsx(DialogContent,{sx:{pt:"18px !important"},children:jsxs(Stack,{spacing:2.2,children:[jsxs(Box,{sx:{mt:.8,display:"grid",gap:1.5,gridTemplateColumns:{xs:"1fr",md:"repeat(2, minmax(0, 1fr))"}},children:[jsx(Box,{children:jsx(Ka,{size:"small",value:c.baseUrl,onChange:x=>m("baseUrl",x.target.value),fullWidth:true,label:"Base URL"})}),jsx(Box,{children:jsx(Ka,{size:"small",type:"password",value:c.apiKey,onChange:x=>m("apiKey",x.target.value),fullWidth:true,label:"API Key"})}),jsx(Box,{children:jsx(Ka,{size:"small",value:c.model,onChange:x=>m("model",x.target.value),fullWidth:true,select:true,label:"Model",children:r.map(x=>jsx(MenuItem,{value:x,children:x},x))})}),jsx(Box,{children:jsx(Ka,{size:"small",value:c.promptLang,onChange:x=>m("promptLang",x.target.value),fullWidth:true,select:true,label:"Prompt Lang",children:n.map(x=>jsx(MenuItem,{value:x,children:x},x))})})]}),jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[jsxs(Ka,{size:"small",value:f,onChange:x=>u(x.target.value),fullWidth:true,select:true,label:"Analysis Template",children:[jsx(MenuItem,{value:"",children:"Default"}),i.map(x=>jsx(MenuItem,{value:x.id,children:x.label},x.id))]}),jsx(pl,{multiline:true,minRows:8,value:c.analysisPrompt,onChange:x=>m("analysisPrompt",x.target.value),fullWidth:true,label:"Analysis Prompt",sx:{"& .MuiInputBase-root":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"}}}),jsxs(Ka,{size:"small",value:y,onChange:x=>I(x.target.value),fullWidth:true,select:true,label:"Response Template",children:[jsx(MenuItem,{value:"",children:"Default"}),l.map(x=>jsx(MenuItem,{value:x.id,children:x.label},x.id))]}),jsx(pl,{multiline:true,minRows:8,value:c.responsePrompt,onChange:x=>m("responsePrompt",x.target.value),fullWidth:true,label:"Response Prompt",sx:{"& .MuiInputBase-root":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"}}})]})]})}),jsxs(DialogActions,{sx:{px:3,pb:2.5,pt:1.2,gap:1},children:[jsx(Button,{variant:"outlined",onClick:t,children:"Cancel"}),jsx(Button,{variant:"contained",onClick:b,disabled:!a||p,children:"Save"})]})]})};var ki=({open:e,onClose:t,model:o,tableContent:a,extraCharts:r,interaction:n,aiAssistant:i})=>{let{t:l}=_(),[d,s]=useState(i?.defaultPrompt||""),[c,g]=useState(false),[f,u]=useState(false),y=n?.enabled!==false&&!!n,I=i?.enabled!==false,p=n?.filters||{},C=!!(p.primaryDimension||p.secondaryDimension||p.status),m=i?.placeholder||"Ask AI to analyze data, create charts, or find insights...";useEffect(()=>{e&&s(i?.defaultPrompt||"");},[e,i?.defaultPrompt]);let b=i?.settings||{baseUrl:"/llm-api",apiKey:"",model:"doubao-lite",promptLang:"zh",analysisPrompt:"",responsePrompt:""},x=async()=>{let k=d.trim();if(!(!k||!i?.onSubmit))try{g(!0),await i.onSubmit(k,{filters:p,model:o});}finally{g(false);}};return jsx(Dialog,{open:e,onClose:t,fullScreen:true,children:jsxs(Box,{sx:{height:"100%",display:"flex",flexDirection:"column",bgcolor:"background.default"},children:[jsx(Box,{sx:{p:2,borderBottom:1,borderColor:"divider"},children:jsxs(Stack,{direction:{xs:"column",lg:"row"},alignItems:{xs:"stretch",lg:"center"},justifyContent:"space-between",spacing:1.5,children:[jsxs(Stack,{direction:"row",spacing:1.25,alignItems:"center",sx:{flexWrap:"wrap"},children:[jsx(Typography,{variant:"h5",fontWeight:800,children:o.title}),jsx(Chip,{size:"small",label:l("graph.records",{count:o.kpis.totalRecords})}),y&&p.primaryDimension&&jsx(Chip,{size:"small",variant:"outlined",label:`${n?.fieldMapping.primaryDimension}: ${p.primaryDimension}`,onDelete:()=>n?.onClearFilter("primaryDimension")}),y&&p.secondaryDimension&&jsx(Chip,{size:"small",variant:"outlined",label:`${n?.fieldMapping.secondaryDimension}: ${p.secondaryDimension}`,onDelete:()=>n?.onClearFilter("secondaryDimension")}),y&&p.status&&jsx(Chip,{size:"small",variant:"outlined",label:`${n?.fieldMapping.status}: ${p.status}`,onDelete:()=>n?.onClearFilter("status")}),y&&C&&jsx(Button,{size:"small",onClick:()=>n?.onClearAll(),children:"Clear"})]}),jsxs(Stack,{direction:"row",spacing:1.25,alignItems:"center",sx:{width:{xs:"100%",lg:"auto"}},children:[I&&jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.2,py:.4,borderRadius:999,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",minWidth:{xs:0,lg:520},flex:{xs:1,lg:"0 0 auto"}},children:[jsx(IconButton,{size:"small",onClick:i?.onVoiceInput,children:jsx(th,{sx:{fontSize:18,color:"text.secondary"}})}),jsx(InputBase,{fullWidth:true,value:d,onChange:k=>s(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),x());},placeholder:m,sx:{fontSize:"0.9rem"}}),jsx(IconButton,{size:"small",onClick:x,disabled:c||!d.trim(),children:jsx(ah,{sx:{fontSize:18}})}),jsx(IconButton,{size:"small",onClick:()=>u(true),children:jsx(oh,{sx:{fontSize:18}})})]}),jsx(IconButton,{onClick:t,children:jsx(_f,{})})]})]})}),jsxs(Box,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5,overflow:"auto",minHeight:0},children:[jsx(rd,{kpis:o.kpis}),jsx(kd,{billableByPrimary:o.charts.billableByPrimary,efficiencyBySecondary:o.charts.efficiencyBySecondary,statusDistribution:o.charts.statusDistribution,interaction:y?{filters:p,onPrimaryDimensionClick:k=>n?.onPrimaryDimensionClick(k),onSecondaryDimensionClick:k=>n?.onSecondaryDimensionClick(k),onStatusClick:k=>n?.onStatusClick(k)}:void 0}),r,a]}),jsx(Id,{open:f,onClose:()=>u(false),value:b,onSaveAll:i?.onSaveAll,modelOptions:i?.modelOptions,promptLangOptions:i?.promptLangOptions,analysisTemplateOptions:i?.analysisTemplateOptions,responseTemplateOptions:i?.responseTemplateOptions,defaultAnalysisTemplateId:i?.defaultAnalysisTemplateId,defaultResponseTemplateId:i?.defaultResponseTemplateId})]})})};var ya={primaryDimension:["Client","Customer","Category","Project"],secondaryDimension:["Person","Consultant","Owner","Name"],status:["Status","state"],date:["Date","WorkDate","CreatedAt"],description:["Description","Task","Title","Memo"],reportHours:["Report_Hour","Report Hours","Hours","ReportHours"],billableHours:["Billable_Hour","Billable Hours","BillableHours"],amount:["Amount","Billable_Amount","Total_Amount","Value"]},nh=5,Td=e=>e.toLowerCase().replace(/[\s_-]/g,""),ba=(e,t,o,a)=>{if(t)return t;if(e.length===0)return a;let r=Object.keys(e[0]),n=new Map(r.map(i=>[Td(i),i]));for(let i of o){let l=n.get(Td(i));if(l)return l}return r[0]||a},jt=e=>{if(typeof e=="number")return Number.isFinite(e)?e:0;if(typeof e=="string"){let t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}return 0},Rt=(e,t)=>e==null||e===""?t:String(e),ih=(e,t,o,a,r)=>{let n=new Map;return e.forEach(i=>{let l=Rt(i[t],r);n.set(l,(n.get(l)||0)+jt(i[o]));}),Array.from(n.entries()).map(([i,l])=>({name:i,value:l})).sort((i,l)=>l.value-i.value).slice(0,a)},sh=(e,t,o,a,r,n)=>{let i=new Map;return e.forEach(l=>{let d=Rt(l[t],n),s=i.get(d)||{report:0,billable:0};s.report+=jt(l[o]),s.billable+=jt(l[a]),i.set(d,s);}),Array.from(i.entries()).map(([l,d])=>({name:l,value:d.report>0?d.billable/d.report*100:0})).sort((l,d)=>l.value-d.value).slice(0,r)},lh=(e,t,o)=>{let a=e.length;if(a===0)return [];let r=new Map;return e.forEach(n=>{let i=Rt(n[t],o);r.set(i,(r.get(i)||0)+1);}),Array.from(r.entries()).map(([n,i])=>({name:n,value:i,percent:i/a*100}))},Pd=(e,t,o)=>{let a=new Map;return e.forEach(r=>{let n=Rt(r[t],"N/A");a.set(n,(a.get(n)||0)+jt(r[o]));}),Array.from(a.entries()).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>({name:r,value:n}))},ch=(e,t,o,a,r,n)=>{let i=new Map;return e.forEach(l=>{let d=Rt(l[t],n),s=i.get(d)||{report:0,billable:0};s.report+=jt(l[o]),s.billable+=jt(l[a]),i.set(d,s);}),Array.from(i.entries()).map(([l,d])=>({name:l,barValue:d.billable,lineValue:d.report>0?d.billable/d.report*100:0})).sort((l,d)=>d.barValue-l.barValue).slice(0,r)},dh=(e,t,o,a,r)=>{let n=new Map;return e.forEach(i=>{let l=Rt(i[t],r),d=Rt(i[o],r),s=`${l}__${d}`;n.set(s,(n.get(s)||0)+jt(i[a]));}),Array.from(n.entries()).map(([i,l])=>{let[d,s]=i.split("__");return {x:d,y:s,value:l}})},ph=(e,t,o)=>{let a=Pd(e,t,o),r=a.map(i=>({name:i.name,value:i.value,type:"delta"})),n=a.reduce((i,l)=>i+l.value,0);return [...r,{name:"Total",value:n,type:"total"}]},uh=(e,t,o,a,r,n)=>{let i=new Map;return e.forEach(l=>{let d=Rt(l[t],n),s=`${Rt(l[o],n)} / ${Rt(l[a],n)}`,c=i.get(d)||new Map;c.set(s,(c.get(s)||0)+1),i.set(d,c);}),Array.from(i.entries()).map(([l,d])=>({title:l,causes:Array.from(d.entries()).sort((s,c)=>c[1]-s[1]).slice(0,r).map(([s,c])=>`${s} (${c})`)})).slice(0,6)},Mr=({rows:e,config:t})=>{let{t:o}=_(),a=o("graph.unassigned"),r=useMemo(()=>{let c=t?.fieldMapping;return {primaryDimension:ba(e,c?.primaryDimension,ya.primaryDimension,"Category"),secondaryDimension:ba(e,c?.secondaryDimension,ya.secondaryDimension,"Owner"),status:ba(e,c?.status,ya.status,"Status"),date:ba(e,c?.date,ya.date,"Date"),description:ba(e,c?.description,ya.description,"Description"),reportHours:ba(e,c?.reportHours,ya.reportHours,"ReportHours"),billableHours:ba(e,c?.billableHours,ya.billableHours,"BillableHours"),amount:ba(e,c?.amount,ya.amount,"Amount")}},[e,t?.fieldMapping]),n=useMemo(()=>e.map((c,g)=>{let f=jt(c[r.reportHours]),u=jt(c[r.billableHours]),y=jt(c[r.amount]),I=f>0?u/f*100:0;return {id:`graph-row-${g}`,Date:Rt(c[r.date],""),Primary:Rt(c[r.primaryDimension],a),Secondary:Rt(c[r.secondaryDimension],a),Description:Rt(c[r.description],""),ReportHours:f,BillableHours:u,Amount:y,Efficiency:I,Status:Rt(c[r.status],a)}}),[e,r,a]),i=useMemo(()=>{let c=n.length,g=n.reduce((C,m)=>C+jt(m.ReportHours),0),f=n.reduce((C,m)=>C+jt(m.BillableHours),0),u=n.reduce((C,m)=>C+jt(m.Amount),0),y=g>0?f/g*100:0,I=t?.statusFlagValues||["flag","flagged","warning","risk"],p=n.filter(C=>I.includes(Rt(C.Status,"").toLowerCase())).length;return {totalRecords:c,totalReportHours:g,totalBillableHours:f,efficiency:y,totalAmount:u,flaggedCount:p}},[n,t?.statusFlagValues]),l=t?.topN||nh,d=useMemo(()=>({billableByPrimary:ih(n,"Primary","BillableHours",l,a),efficiencyBySecondary:sh(n,"Secondary","ReportHours","BillableHours",l,a),statusDistribution:lh(n,"Status",a),lineByDate:Pd(n,"Date","BillableHours"),comboByPrimary:ch(n,"Primary","ReportHours","BillableHours",l,a),heatmapPrimarySecondary:dh(n,"Primary","Secondary","BillableHours",a),waterfallBillable:ph(n,"Date","BillableHours"),fishboneStatusCauses:uh(n,"Status","Primary","Secondary",3,a)}),[n,l,a]),s=useMemo(()=>({title:t?.title||o("graph.reportTitle"),kpis:i,charts:d,table:{columns:[{id:"Date",label:r.date},{id:"Primary",label:r.primaryDimension},{id:"Secondary",label:r.secondaryDimension},{id:"Description",label:r.description},{id:"ReportHours",label:o("graph.column.reportHours"),align:"right"},{id:"BillableHours",label:o("graph.column.billableHours"),align:"right"},{id:"Amount",label:"Amount",align:"right"},{id:"Efficiency",label:"Efficiency",align:"right"},{id:"Status",label:r.status}],rows:n}}),[d,t?.title,r,i,n,o]);return {fieldMapping:r,model:s}};var Ar=e=>String(e??"").trim(),wi=(e={})=>{let[t,o]=useState(e),a=useCallback((d,s)=>{o(c=>{let g=s?.trim();if(!g){let f={...c};return delete f[d],f}if(c[d]===g){let f={...c};return delete f[d],f}return {...c,[d]:g}});},[]),r=useCallback(d=>{o(s=>{if(!s[d])return s;let c={...s};return delete c[d],c});},[]),n=useCallback(()=>{o({});},[]),i=useMemo(()=>!!(t.primaryDimension||t.secondaryDimension||t.status),[t]),l=useCallback((d,s)=>d.filter(c=>!(t.primaryDimension&&Ar(c[s.primaryDimension])!==Ar(t.primaryDimension)||t.secondaryDimension&&Ar(c[s.secondaryDimension])!==Ar(t.secondaryDimension)||t.status&&Ar(c[s.status])!==Ar(t.status))),[t]);return {filters:t,setFilter:a,clearFilter:r,clearAll:n,hasActiveFilters:i,applyRows:l}};var Ti=({variants:e,currentVariantId:t,onLoad:o,onSave:a,onDelete:r,onSetDefault:n})=>{let{t:i}=_(),d=useTheme().palette.mode==="dark",s="0.85rem",c={xs:"calc((100% - 1 * 16px) / 2)",sm:"calc((100% - 2 * 16px) / 3)",md:"calc((100% - 3 * 16px) / 4)",lg:"calc((100% - 5 * 16px) / 6)"},[g,f]=useState(false),[u,y]=useState(""),[I,p]=useState(false),[C,m]=useState(false),b=e.find(E=>E.id===t),x=()=>{y(b?.name||i("variant.newVariant")),p(b?.isDefault||false),m(b?.isPublic||false),f(true);},k=()=>{a({name:u,isDefault:I,isPublic:C,description:""}),f(false);};return jsxs(Box,{sx:{display:"flex",gap:1,alignItems:"center",width:"100%",maxWidth:"100%"},children:[jsx(Autocomplete,{size:"small",sx:{width:c,"& .MuiInputBase-root":{fontSize:s,bgcolor:d?"rgba(25, 118, 210, 0.2)":"#e7f1ff","& .MuiOutlinedInput-notchedOutline":{borderColor:d?"rgba(144,202,249,0.45)":"rgba(25,118,210,0.45)"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:d?"rgba(144,202,249,0.7)":"rgba(25,118,210,0.65)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:d?"rgba(144,202,249,0.9)":"rgba(25,118,210,0.85)"}},"& .MuiInputBase-input":{fontSize:s},"& .MuiAutocomplete-noOptions":{fontSize:s}},noOptionsText:jsx(Typography,{sx:{fontSize:s},children:i("variant.noOptions")}),options:e,getOptionLabel:E=>E.name+(E.isDefault?` (${i("variant.defaultSuffix")})`:""),value:b||null,onChange:(E,R)=>{R&&o(R);},renderInput:E=>jsx(TextField,{...E,variant:"outlined",size:"small",InputProps:{...E.InputProps,sx:{fontSize:s,color:d?"#E3F2FD":"#0D47A1"}},placeholder:i("variant.selectVariant")}),renderOption:(E,R)=>jsx("li",{...E,children:jsxs(Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[jsx(Typography,{sx:{flex:1,fontSize:s},children:R.name}),R.isDefault&&jsx(wh,{fontSize:"small",color:"action"})]})})}),jsx(Tooltip,{title:i("variant.saveView"),children:jsx(IconButton,{onClick:x,size:"small",color:"primary",children:jsx(Zd,{fontSize:"small"})})}),jsxs(Dialog,{open:g,onClose:()=>f(false),children:[jsx(DialogTitle,{children:i("variant.saveView")}),jsxs(DialogContent,{children:[jsx(TextField,{autoFocus:true,margin:"dense",label:i("variant.viewName"),fullWidth:true,variant:"outlined",value:u,onChange:E=>y(E.target.value)}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:I,onChange:E=>p(E.target.checked)}),label:i("variant.setDefault")}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:C,onChange:E=>m(E.target.checked)}),label:i("variant.publicAllUsers")})]}),jsxs(DialogActions,{children:[jsx(Button,{onClick:()=>f(false),children:i("common.cancel")}),jsx(Button,{onClick:k,variant:"contained",children:i("common.save")})]})]})]})};var Ld=({appId:e,tableKey:t="default",currentFilters:o,currentLayoutId:a,layoutRefs:r,onLoad:n,variantService:i,serviceUrl:l,onError:d,onSuccess:s,currentVariantId:c,onVariantChange:g})=>{let{t:f}=_(),[u,y]=useState([]),[I,p]=useState(""),C=`orbcafe.variants.${e}.${t}`,m=c!==void 0?c:I,b=D=>{c===void 0&&p(D),g&&g(D);},x=useCallback(()=>{try{let D=localStorage.getItem(C);if(!D)return [];let S=JSON.parse(D);return Array.isArray(S)?S:[]}catch{return []}},[C]),k=useCallback(D=>{try{localStorage.setItem(C,JSON.stringify(D));}catch{}},[C]),E=useCallback(D=>{y(D);let S=D.find(P=>P.isDefault);S&&!m&&(b(S.id),n(S));},[m,n,b]),R=useCallback(async()=>{if(!e)return [];try{let D=[];if(i)D=await i.getVariants(e,t);else if(l){let S=await fetch(`${l}/api/variants?appId=${encodeURIComponent(e)}&tableKey=${encodeURIComponent(t)}`);if(!S.ok)throw new Error(f("variant.toast.fetchFailed"));D=await S.json();}else D=x();return E(D),D}catch(D){console.error("Error fetching variants",D);let S=x();return E(S),d&&d(f("variant.toast.fetchFailed")),S}},[e,t,i,l,x,E,d,f]);return useEffect(()=>{R();},[e,t]),jsx(Ti,{variants:u,currentVariantId:m,onLoad:D=>{b(D.id),n(D);},onSave:async D=>{let S=Date.now().toString(),P;try{let F=D.scope||"Both",W=u.find(Y=>Y.name===D.name);S=W?W.id:Date.now().toString();let z=[];if(W&&(Array.isArray(W.filters)?z=[...W.filters]:W.filters&&(z=[{scope:"default",filters:W.filters}])),F==="Search"||F==="Both"){let Y=(Array.isArray(o),o);if(Y)if(Array.isArray(Y)&&Y.length>0&&Y[0].scope)Y.forEach(te=>{let Z=z.findIndex(Ze=>Ze.scope===te.scope);Z>=0?z[Z]=te:z.push(te);});else {let te={scope:t,filters:Y},Z=z.findIndex(Ze=>Ze.scope===t);Z>=0?z[Z]=te:z.push(te);}}let j=W?.layout||{},ie=[];if(W&&Array.isArray(W.layoutRefs)&&(ie=[...W.layoutRefs]),F==="Layout"||F==="Both")if(r&&r.length>0)r.forEach(Y=>{let te=ie.findIndex(Z=>Z.tableKey===Y.tableKey);te>=0?ie[te]=Y:ie.push(Y);});else {let Y={tableKey:t,layoutId:a||null},te=ie.findIndex(Z=>Z.tableKey===t);te>=0?ie[te]=Y:ie.push(Y);}if(P={appId:e,tableKey:t,...D,scope:F,id:S,createdAt:new Date().toISOString(),filters:z,layout:j,layoutRefs:ie},i)await i.saveVariant(P,e,t);else if(l){if(!(await fetch(`${l}/api/variants`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).ok)throw new Error(f("variant.toast.saveFailed"))}else {let te=u.some(Z=>Z.id===S)?u.map(Z=>Z.id===S?P:Z):[...u,P];y(te),k(te);}s&&s(f("variant.toast.saveSuccess")),(i||l)&&await R(),b(S),n(P);}catch(F){console.error("Error saving variant",F);let z=u.some(j=>j.id===S)?u.map(j=>j.id===S?P:j):[...u,P];y(z),k(z),b(S),n(P),d&&d(f("variant.toast.saveFailed"));}},onDelete:async D=>{try{if(i)await i.deleteVariant(D);else if(l){if(!(await fetch(`${l}/api/variants/${D}`,{method:"DELETE"})).ok)throw new Error(f("variant.toast.deleteFailed"))}else {let S=u.filter(P=>P.id!==D);y(S),k(S);}m===D&&b(""),(i||l)&&R(),s&&s(f("variant.toast.deleteSuccess"));}catch(S){console.error("Error deleting variant",S);let P=u.filter(F=>F.id!==D);y(P),k(P),m===D&&b(""),d&&d(f("variant.toast.deleteFailed"));}},onSetDefault:async D=>{try{let S=u.find(F=>F.id===D);if(!S)return;let P={appId:e,tableKey:t,...S,isDefault:!0};if(i)await i.setDefaultVariant(D,e,t);else if(l){if(!(await fetch(`${l}/api/variants`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).ok)throw new Error(f("variant.toast.defaultFailed"))}else {let F=u.map(W=>({...W,isDefault:W.id===D}));y(F),k(F);}(i||l)&&await R(),s&&s(f("variant.toast.defaultSuccess"));}catch(S){console.error("Error setting default variant",S);let P=u.map(F=>({...F,isDefault:F.id===D}));y(P),k(P),d&&d(f("variant.toast.defaultFailed"));}}})};_a.extend(Hh);_a.extend(Gh);var Uh=[null,null],hl="0.85rem",Kh={en:"en",zh:"zh-cn",fr:"fr",de:"de",ja:"ja",ko:"ko"},qh=styled(PickersDay,{shouldForwardProp:e=>e!=="isInRange"&&e!=="isStart"&&e!=="isEnd"&&e!=="isHovered"})(({theme:e,isInRange:t,isStart:o,isEnd:a,isHovered:r})=>({...t&&{borderRadius:0,backgroundColor:e.palette.primary.light,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.main}},...r&&!t&&!o&&!a&&{borderRadius:0,backgroundColor:e.palette.action.hover,border:`1px dashed ${e.palette.primary.main}`},...o&&{borderRadius:"50% 0 0 50%",backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}},...a&&{borderRadius:"0 50% 50% 0",backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}},...o&&a&&{borderRadius:"50%"}})),Vd=({label:e,value:t=Uh,onChange:o})=>{let{t:a,locale:r}=_(),n=Kh[r]||"en",i=e||a("dateRange.label"),[l,d]=useState(null),[s,c]=useState(t),[g,f]=useState("start"),[u,y]=useState(null),[I,p]=useState((t[0]||_a()).locale(n)),C=st__default.useRef(t);useEffect(()=>{let[S,P]=t,[F,W]=C.current,z=Y=>Y&&typeof Y.isSame=="function",j=!(S===null&&F===null||z(S)&&z(F)&&S.isSame(F,"day")),ie=!(P===null&&W===null||z(P)&&z(W)&&P.isSame(W,"day"));(j||ie)&&(c(t),t[0]&&z(t[0])&&p(t[0].locale(n))),C.current=t;},[t,n]);let m=S=>{d(S.currentTarget);},b=()=>{d(null),f("start"),y(null);},x=!!l,k=S=>{if(!S)return;let P=[...s];if(g==="start")P=[S,null],f("end");else {let F=P[0];F&&S.isBefore(F)?(P=[S,null],f("end")):(P=[F,S],f("start"));}c(P);},E=S=>{let P=_a().locale(n),F=[null,null];switch(S){case "today":F=[P,P];break;case "week":F=[P.startOf("week"),P.endOf("week")];break;case "month":F=[P.startOf("month"),P.endOf("month")];break}c(F),f("start"),p(P);},R=()=>{c([null,null]),f("start"),p(_a().locale(n));},w=()=>{o&&o(s),b();},B=()=>{c(t),f("start"),b();},T=useCallback(S=>{let{day:P,...F}=S,[W,z]=s,j=W?P.isSame(W,"day"):false,ie=z?P.isSame(z,"day"):false,Y=W&&z?P.isBetween(W,z,"day","()"):false,te=false;return g==="end"&&W&&!z&&u&&P.isAfter(W,"day")&&P.isBefore(u.add(1,"day"),"day")&&(te=true),jsx(qh,{...F,day:P,disableMargin:true,isStart:j,isEnd:ie,isInRange:Y||te,onMouseEnter:()=>y(P)})},[s,g,u]),v=S=>S?S.locale(n).format("YYYY-MM-DD"):"",D=S=>S?S.locale(n).format("ll"):"";return jsxs(Box,{children:[jsx(TextField,{label:i,value:s[0]?`${v(s[0])} - ${v(s[1])}`:"",onClick:m,fullWidth:true,size:"small",InputLabelProps:{sx:{fontSize:hl}},InputProps:{readOnly:true,sx:{fontSize:hl,"& .MuiOutlinedInput-input":{fontSize:hl},paddingRight:"4px"},endAdornment:jsxs(InputAdornment,{position:"end",sx:{ml:0},children:[(s[0]||s[1])&&jsx(IconButton,{size:"small",onClick:S=>{S.stopPropagation(),R();},edge:"end",sx:{mr:.5,padding:"2px"},children:jsx($h,{sx:{fontSize:"1rem"}})}),jsx(IconButton,{size:"small",edge:"end",onClick:m,sx:{padding:"2px"},children:jsx(Oh,{sx:{fontSize:"1rem"},color:"action"})})]})}}),jsxs(Popover,{open:x,anchorEl:l,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{display:"flex",flexDirection:"column",p:0,minWidth:320}}},children:[jsx(Box,{sx:{p:2,bgcolor:"background.default",borderBottom:1,borderColor:"divider"},children:jsxs(Stack,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",children:[jsxs(Box,{sx:{p:1,border:1,borderColor:g==="start"?"primary.main":"divider",borderRadius:1,bgcolor:g==="start"?"action.hover":"transparent",flex:1,cursor:"pointer"},onClick:()=>f("start"),children:[jsx(Typography,{variant:"caption",color:"text.secondary",display:"block",children:a("dateRange.startDate")}),jsx(Typography,{variant:"body2",fontWeight:500,children:s[0]?D(s[0]):a("dateRange.select")})]}),jsx(Wh,{color:"action",fontSize:"small"}),jsxs(Box,{sx:{p:1,border:1,borderColor:g==="end"?"primary.main":"divider",borderRadius:1,bgcolor:g==="end"?"action.hover":"transparent",flex:1,cursor:"pointer"},onClick:()=>{s[0]&&f("end");},children:[jsx(Typography,{variant:"caption",color:"text.secondary",display:"block",children:a("dateRange.endDate")}),jsx(Typography,{variant:"body2",fontWeight:500,children:s[1]?D(s[1]):a("dateRange.select")})]})]})}),jsx(Box,{sx:{p:2,pb:0},children:jsxs(Stack,{direction:"row",spacing:1,justifyContent:"center",children:[jsx(Chip,{label:a("dateRange.today"),onClick:()=>E("today"),clickable:true,size:"small",variant:"outlined"}),jsx(Chip,{label:a("dateRange.thisWeek"),onClick:()=>E("week"),clickable:true,size:"small",variant:"outlined"}),jsx(Chip,{label:a("dateRange.thisMonth"),onClick:()=>E("month"),clickable:true,size:"small",variant:"outlined"})]})}),jsx(LocalizationProvider,{dateAdapter:AdapterDayjs,adapterLocale:n,children:jsx(DateCalendar,{value:null,referenceDate:I,onMonthChange:p,onYearChange:p,onChange:k,slots:{day:T},views:["day"],showDaysOutsideCurrentMonth:true,sx:{m:0}})}),jsx(Divider,{}),jsxs(Stack,{direction:"row",justifyContent:"flex-end",spacing:1,sx:{p:2},children:[jsx(Button,{size:"small",onClick:B,color:"inherit",children:a("common.cancel")}),jsx(Button,{size:"small",variant:"contained",onClick:w,children:a("common.done")})]})]})]})};var Mi={equals:"=",contains:"\u2287",notContains:"\u2285",wildcard:"*","=":"=","!=":"!=",">":">","<":"<",">=":"\u2265","<=":"\u2264",between:"\u2194"},ay={equals:"smartFilter.operator.equals",contains:"smartFilter.operator.contains",notContains:"smartFilter.operator.notContains",wildcard:"smartFilter.operator.wildcard","=":"smartFilter.operator.equals","!=":"smartFilter.operator.notEquals",">":"smartFilter.operator.greaterThan","<":"smartFilter.operator.lessThan",">=":"smartFilter.operator.greaterOrEqual","<=":"smartFilter.operator.lessOrEqual",between:"smartFilter.operator.between"},ry=["equals","contains","notContains","wildcard"],Wd=["=","!=",">","<",">=","<=","between"],et="0.85rem",ny=({field:e,value:t,onChange:o})=>{let{t:a}=_(),[r,n]=useState(null),[i,l]=useState(null),[d,s]=useState(""),[c,g]=useState(""),[f,u]=useState(false),[y,I]=useState(""),[p,C]=useState("");useEffect(()=>{let v=setTimeout(()=>{C(y);},1e3);return ()=>clearTimeout(v)},[y]);let m=t?.operator||(e.type==="number"?"=":"equals"),b=t?.value,x=v=>{let D=ay[v];return D?a(D):v},k=v=>{n(v.currentTarget);},E=v=>{o({...t,operator:v,value:b}),n(null);},R={size:"small",fullWidth:true,variant:"outlined",InputLabelProps:{sx:{fontSize:et}},InputProps:{sx:{fontSize:et}},SelectProps:{MenuProps:{PaperProps:{sx:{"& .MuiMenuItem-root":{fontSize:et,paddingTop:"4px",paddingBottom:"4px",minHeight:"auto"}}}}}},w=e.type||"text";if(w==="date"){let D=(S=>{if(!S)return [null,null];if(Array.isArray(S)&&S.length===2){let P=S[0]?_a.isDayjs(S[0])?S[0]:_a(S[0]):null,F=S[1]?_a.isDayjs(S[1])?S[1]:_a(S[1]):null;return [P,F]}return _a.isDayjs(S)||typeof S=="string"?[_a.isDayjs(S)?S:_a(S),null]:[null,null]})(b);return jsx(Vd,{label:e.label,value:D,onChange:S=>o({value:S,operator:"between"})})}if(w==="number"&&m==="between"){let v=()=>{o({value:[d,c],operator:"between"}),l(null);},D=Array.isArray(b)?`${b[0]||""} - ${b[1]||""}`:"";return jsxs(Fragment,{children:[jsx(TextField,{...R,label:e.label,value:D,placeholder:a("smartFilter.minMaxPlaceholder"),InputProps:{...R.InputProps,startAdornment:jsx(InputAdornment,{position:"start",children:jsx(Tooltip,{title:x("between"),children:jsx(IconButton,{size:"small",onClick:k,sx:{width:24,height:24,fontSize:et},children:Mi.between})})}),readOnly:true},onClick:S=>l(S.currentTarget)}),jsx(Menu,{anchorEl:r,open:!!r,onClose:()=>n(null),PaperProps:{sx:{"& .MuiMenuItem-root":{fontSize:et,minHeight:"auto",py:.5}}},children:Wd.map(S=>jsxs(MenuItem,{selected:S===m,onClick:()=>E(S),children:[jsx(Box,{sx:{width:24,display:"inline-block",fontWeight:"bold"},children:Mi[S]}),jsx(ListItemText,{primary:x(S),primaryTypographyProps:{fontSize:et}})]},S))}),jsx(Popover,{open:!!i,anchorEl:i,onClose:()=>l(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:jsxs(Box,{sx:{p:2,display:"flex",gap:1,alignItems:"center"},children:[jsx(TextField,{size:"small",label:a("smartFilter.min"),type:"number",value:d,onChange:S=>s(S.target.value),sx:{width:100},InputLabelProps:{sx:{fontSize:et}},InputProps:{sx:{fontSize:et}}}),jsx(oy,{color:"action"}),jsx(TextField,{size:"small",label:a("smartFilter.max"),type:"number",value:c,onChange:S=>g(S.target.value),sx:{width:100},InputLabelProps:{sx:{fontSize:et}},InputProps:{sx:{fontSize:et}}}),jsx(Button,{variant:"contained",size:"small",onClick:v,children:a("common.ok")})]})})]})}if(w==="select")return jsxs(TextField,{...R,select:true,label:e.label,value:b||"",onChange:v=>o({...t,value:v.target.value,operator:"equals"}),children:[jsx(MenuItem,{value:"",children:jsx("em",{children:a("common.none")})}),e.options?.map(v=>jsx(MenuItem,{value:v.value,children:v.label},v.value))]});if(w==="multi-select"){let v=Array.isArray(b)?b:[],D=e.options?.filter(S=>S.label.toLowerCase().includes(p.toLowerCase()))||[];return jsxs(TextField,{...R,select:true,label:e.label,value:v,onChange:S=>o({...t,value:S.target.value,operator:"anyOf"}),SelectProps:{...R.SelectProps,multiple:true,onClose:()=>{I(""),C("");},renderValue:S=>{if(!Array.isArray(S)||S.length===0)return jsx("em",{children:a("common.none")});let P=W=>e.options?.find(z=>z.value===W)?.label||W,F=S.map(P);return F.length>2?`${F.slice(0,2).join(", ")} +${F.length-2}`:F.join(", ")}},children:[jsx(ListSubheader,{children:jsx(TextField,{size:"small",autoFocus:true,placeholder:a("smartFilter.searchPlaceholder"),fullWidth:true,InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx($d,{fontSize:"small"})}),sx:{fontSize:et}},value:y,onChange:S=>I(S.target.value),onKeyDown:S=>{S.key!=="Escape"&&S.stopPropagation();},onClick:S=>S.stopPropagation()})}),D.length>0?D.map(S=>jsxs(MenuItem,{value:S.value,children:[jsx(Checkbox,{checked:v.indexOf(S.value)>-1,size:"small"}),jsx(ListItemText,{primary:S.label,primaryTypographyProps:{fontSize:et}})]},S.value)):jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:a("smartFilter.noOptionsFound"),primaryTypographyProps:{fontSize:et}})})]})}let B=w==="number"?Wd:ry,T=f||b!==void 0&&b!==""&&b!==null||!!r;return jsxs(Fragment,{children:[jsx(TextField,{...R,label:e.label,sx:{minWidth:"120px"},value:b||"",type:w==="number"?"number":"text",onChange:v=>o({...t,value:v.target.value,operator:m}),onFocus:()=>u(true),onBlur:()=>u(false),InputProps:{...R.InputProps,startAdornment:T?jsx(InputAdornment,{position:"start",children:jsx(Tooltip,{title:x(m),children:jsx(IconButton,{size:"small",onClick:k,onMouseDown:v=>v.preventDefault(),sx:{width:24,height:24,fontSize:et,fontWeight:"bold",color:"primary.main",bgcolor:"action.hover"},children:Mi[m]})})}):null,endAdornment:e.hasSearchIcon?jsx(InputAdornment,{position:"end",children:jsx($d,{color:"action"})}):void 0}}),jsx(Menu,{anchorEl:r,open:!!r,onClose:()=>n(null),PaperProps:{sx:{"& .MuiMenuItem-root":{fontSize:et,minHeight:"auto",py:.5}}},children:B.map(v=>jsxs(MenuItem,{selected:v===m,onClick:()=>E(v),children:[jsx(Box,{sx:{width:24,display:"inline-block",fontWeight:"bold"},children:Mi[v]}),jsx(ListItemText,{primary:x(v),primaryTypographyProps:{fontSize:et}})]},v))})]})},ja=({fields:e,filters:t,onFilterChange:o,variants:a=[],currentVariantId:r,onVariantLoad:n,onVariantSave:i,onVariantDelete:l,onVariantSetDefault:d,onSearch:s,loading:c=false,appId:g,tableKey:f,currentLayout:u,currentLayoutId:y,layoutRefs:I,variantService:p,serviceUrl:C})=>{let{t:m}=_(),[b,x]=useState(true),[k,E]=useState(null),[R,w]=useState(e.filter(D=>!D.hidden).map(D=>D.id)),B=(D,S)=>{o({...t,[D]:S});},T=D=>{R.includes(D)?w(R.filter(S=>S!==D)):w([...R,D]);};return jsxs(Paper,{sx:{mb:0,display:"flex",flexDirection:"column",overflow:"visible",position:"relative"},children:[jsxs(Box,{sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[g?jsx(Ld,{appId:g,tableKey:f,currentFilters:{values:t,visibleFields:R},currentLayout:u,currentLayoutId:y,layoutRefs:I,onLoad:D=>{if(!D.filters)return;let S=null;if(Array.isArray(D.filters)){let P=f||"default",F=D.filters.find(W=>W.scope===P);S=F?F.filters:null;}else S=D.filters;S&&(S.values||S.visibleFields?(S.visibleFields&&Array.isArray(S.visibleFields)&&w(S.visibleFields),S.values&&o(S.values)):o(S)),n&&n(D);},variantService:p,serviceUrl:C,currentVariantId:r}):jsx(Ti,{variants:a,currentVariantId:r,onLoad:n,onSave:D=>{i&&i({...D,filters:{values:t,visibleFields:R}});},onDelete:l,onSetDefault:d}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[jsx(Tooltip,{title:m("smartFilter.addFilters"),children:jsx(Button,{onClick:D=>E(D.currentTarget),size:"small",color:"primary",startIcon:jsx(Jh,{fontSize:"small"}),sx:{textTransform:"none",fontSize:et,whiteSpace:"nowrap",minWidth:"fit-content"},children:m("smartFilter.adaptFilters")})}),jsx(Button,{variant:"contained",size:"small",onClick:s,disabled:c,sx:{minWidth:"52px",fontWeight:"bold",fontSize:et},children:m(c?"common.loading":"smartFilter.go")}),jsxs(Menu,{anchorEl:k,open:!!k,onClose:()=>E(null),slotProps:{paper:{style:{maxHeight:400,width:"25ch"},sx:{"& .MuiMenuItem-root":{fontSize:et,minHeight:32}}}},children:[jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:m("smartFilter.visibleFilters"),primaryTypographyProps:{fontSize:et}})}),jsx(Divider,{}),e.map(D=>jsxs(MenuItem,{onClick:()=>T(D.id),children:[jsx(Checkbox,{checked:R.includes(D.id),size:"small"}),jsx(ListItemText,{primary:D.label,primaryTypographyProps:{fontSize:et}})]},D.id))]})]})]}),jsx(Collapse,{in:b,children:jsx(Box,{sx:{px:2,pb:2},children:jsx(Grid,{container:true,spacing:2,columns:{xs:2,sm:3,md:4,lg:6},children:e.filter(D=>R.includes(D.id)).map(D=>jsx(Grid,{size:1,children:jsx(ny,{field:D,value:t[D.id]||{value:"",operator:D.type==="number"?"=":"equals"},onChange:S=>B(D.id,S)})},D.id))})})}),jsx(Box,{sx:{position:"absolute",bottom:0,left:"50%",transform:"translate(-50%, 50%)",zIndex:10},children:jsx(IconButton,{size:"small",onClick:()=>x(!b),sx:{bgcolor:"background.paper",boxShadow:2,border:"1px solid",borderColor:"divider",width:20,height:20,minHeight:0,p:0,"&:hover":{bgcolor:"background.paper"}},children:b?jsx(ey,{sx:{fontSize:16},color:"action"}):jsx(rf,{sx:{fontSize:16},color:"action"})})})]})};var jd=({layouts:e,currentLayoutId:t,onLoad:o,onSave:a,onDelete:r,onSetDefault:n})=>{let{t:i}=_(),[l,d]=useState(null),[s,c]=useState(false),[g,f]=useState(""),[u,y]=useState(""),[I,p]=useState({isDefault:false,isPublic:false}),C=e.find(R=>R.id===t),m=R=>{d(R.currentTarget);},b=()=>{d(null);},x=R=>{o(R),b();},k=()=>{f(""),y(""),p({isDefault:false,isPublic:false}),c(true),b();},E=()=>{g.trim()&&(a({name:g,description:u,...I}),c(false));};return jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[jsx(Tooltip,{title:i("layout.saveLayout"),children:jsx(IconButton,{onClick:k,color:"primary",size:"small",children:jsx(Zd,{})})}),jsx(Tooltip,{title:i("layout.layoutOptions"),children:jsx(IconButton,{onClick:m,color:C?"primary":"default",children:jsx(yy,{})})}),jsxs(Menu,{anchorEl:l,open:!!l,onClose:b,PaperProps:{sx:{width:320,maxHeight:400}},children:[jsx(MenuItem,{disabled:true,children:jsx(Typography,{variant:"caption",children:i("layout.selectLayout")})}),jsxs(MenuItem,{onClick:k,children:[jsx(ListItemIcon,{children:jsx(Zd,{fontSize:"small"})}),jsx(ListItemText,{children:i("layout.saveCurrentLayout")})]}),jsx(Divider,{}),e.length===0&&jsx(MenuItem,{disabled:true,children:jsx(Typography,{variant:"body2",color:"text.secondary",children:i("layout.noSavedLayouts")})}),e.map((R,w)=>jsx(MenuItem,{onClick:()=>x(R),selected:R.id===t,children:jsxs(Box,{sx:{display:"flex",alignItems:"center",width:"100%",justifyContent:"space-between"},children:[jsxs(Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden",mr:1},children:[jsx(Box,{sx:{display:"flex",alignItems:"center",gap:1},children:jsx(Typography,{variant:"body2",fontWeight:R.id===t?"bold":"normal",noWrap:true,children:R.name})}),R.description&&jsx(Typography,{variant:"caption",color:"text.secondary",noWrap:true,children:R.description})]}),jsxs(Box,{sx:{display:"flex",alignItems:"center"},onClick:B=>B.stopPropagation(),children:[jsx(Tooltip,{title:R.isDefault?i("layout.removeDefault"):i("layout.setAsDefault"),children:jsx(IconButton,{size:"small",onClick:B=>{B.stopPropagation(),n(R.id);},children:R.isDefault?jsx(wh,{fontSize:"small",color:"warning"}):jsx(hy,{fontSize:"small"})})}),jsx(Tooltip,{title:i("common.delete"),children:jsx(IconButton,{size:"small",color:"error",onClick:B=>{B.stopPropagation(),r(R.id);},children:jsx(Og,{fontSize:"small"})})})]})]})},R.id||w))]}),jsxs(Dialog,{open:s,onClose:()=>c(false),maxWidth:"xs",fullWidth:true,children:[jsx(DialogTitle,{children:i("layout.saveLayout")}),jsx(DialogContent,{children:jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:2,mt:1},children:[jsx(TextField,{label:i("layout.layoutName"),value:g,onChange:R=>f(R.target.value),fullWidth:true,autoFocus:true,size:"small",helperText:i("layout.layoutNameHelper")}),e.some(R=>R.name===g)&&jsx(Typography,{variant:"caption",color:"warning.main",sx:{ml:1},children:i("layout.warningOverwrite")}),jsx(TextField,{label:i("layout.layoutDescription"),value:u,onChange:R=>y(R.target.value),fullWidth:true,size:"small"}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:I.isDefault,onChange:R=>p({...I,isDefault:R.target.checked})}),label:i("layout.useAsDefault")}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:I.isPublic,onChange:R=>p({...I,isPublic:R.target.checked})}),label:i("layout.publicAllUsers")})]})}),jsxs(DialogActions,{children:[jsx(Button,{onClick:()=>c(false),children:i("common.cancel")}),jsx(Button,{onClick:E,variant:"contained",disabled:!g,children:i("common.save")})]})]})]})};var Ei=({appId:e,tableKey:t="default",currentLayoutData:o,onLayoutLoad:a,targetLayoutId:r,activeLayoutId:n,serviceUrl:i,onError:l,onSuccess:d})=>{let{t:s}=_(),[c,g]=useState([]),[f,u]=useState(""),y=`orbcafe.layouts.${e}.${t}`,I=w=>({id:w.layoutId,name:w.name,description:w.description??"",isDefault:!!w.isDefault,isPublic:!!w.isPublic,createdAt:w.createdAt??new Date().toISOString(),layoutData:w.layout??{}}),p=w=>({appId:e,tableKey:t,layoutId:w.id,name:w.name,description:w.description??"",isDefault:!!w.isDefault,isPublic:!!w.isPublic,createdAt:w.createdAt,layout:w.layoutData}),C=useCallback(()=>{try{let w=localStorage.getItem(y);if(!w)return [];let B=JSON.parse(w);return Array.isArray(B)?B:[]}catch{return []}},[y]),m=useCallback(w=>{try{localStorage.setItem(y,JSON.stringify(w));}catch{}},[y]);useEffect(()=>{n!==void 0&&u(n);},[n]),useEffect(()=>{if(r&&c.length>0){let w=c.find(B=>B.id===r);w&&(u(w.id),a(w));}},[r,c,a]);let b=useCallback(async()=>{if(e){if(!i){let w=C();g(w);let B=w.find(T=>T.isDefault);B&&!f&&!r&&(u(B.id),a(B));return}try{let w=await fetch(`${i}/api/layouts?appId=${encodeURIComponent(e)}&tableKey=${encodeURIComponent(t)}`);if(!w.ok)throw new Error("LAYOUT_FETCH_FAILED");let T=(await w.json()).map(I);g(T);let v=T.find(D=>D.isDefault);v&&!f&&!r&&(u(v.id),a(v));}catch(w){console.error("Error fetching layouts",w);let B=C();g(B);let T=B.find(v=>v.isDefault);T&&!f&&!r&&(u(T.id),a(T)),l&&l(s("layout.toast.loadFallback"));}}},[e,t,i,l,f,a,r,C,s]);return useEffect(()=>{b();},[e,t]),jsx(jd,{layouts:c,currentLayoutId:f,onLoad:w=>{u(w.id),a(w);},onSave:async w=>{let B=c.find(D=>D.name===w.name),T=B?B.id:Date.now().toString(),v={id:T,...w,createdAt:new Date().toISOString(),layoutData:o,isDefault:w.isDefault??false,isPublic:w.isPublic??false};if(!i){let S=c.some(P=>P.id===T)?c.map(P=>P.id===T?v:P):[...c,v];g(S),m(S),u(T),a(v),d&&d(s("layout.toast.saveLocalSuccess"));return}try{if(!(await fetch(`${i}/api/layouts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p(v))})).ok)throw new Error("LAYOUT_SAVE_FAILED");d&&d(s("layout.toast.saveSuccess")),await b(),u(T),a(v);}catch(D){console.error("Error saving layout",D);let P=c.some(F=>F.id===T)?c.map(F=>F.id===T?v:F):[...c,v];g(P),m(P),u(T),a(v),d&&d(s("layout.toast.saveLocalSuccess")),l&&l(s("layout.toast.backendUnavailableSavedLocal"));}},onDelete:async w=>{if(!i){let B=c.filter(T=>T.id!==w);g(B),m(B),f===w&&u(""),d&&d(s("layout.toast.deleteLocalSuccess"));return}try{if(!(await fetch(`${i}/api/layouts/${encodeURIComponent(w)}`,{method:"DELETE"})).ok)throw new Error("LAYOUT_DELETE_FAILED");f===w&&u(""),d&&d(s("layout.toast.deleteSuccess")),await b();}catch(B){console.error("Error deleting layout",B);let T=c.filter(v=>v.id!==w);g(T),m(T),f===w&&u(""),d&&d(s("layout.toast.deleteLocalSuccess")),l&&l(s("layout.toast.backendUnavailableDeletedLocal"));}},onSetDefault:async w=>{if(!i){let B=c.map(T=>({...T,isDefault:T.id===w}));g(B),m(B),d&&d(s("layout.toast.defaultLocalSuccess"));return}try{let B=c.find(v=>v.id===w);if(!B)return;if(!(await fetch(`${i}/api/layouts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p({...B,isDefault:!0}))})).ok)throw new Error("LAYOUT_DEFAULT_FAILED");d&&d(s("layout.toast.defaultSuccess")),await b();}catch(B){console.error("Error setting default",B);let T=c.map(v=>({...v,isDefault:v.id===w}));g(T),m(T),d&&d(s("layout.toast.defaultLocalSuccess")),l&&l(s("layout.toast.backendUnavailableDefaultLocal"));}}})};var Xd=(e,t)=>{if(!e||!e.filters)return null;if(Array.isArray(e.filters)){let o=e.filters.find(r=>r.scope===t);if(o)return o.filters;let a=e.filters.find(r=>r.scope==="default");return a?a.filters:null}return typeof e.filters=="object"?e.filters:null},Li=(e,t)=>{if(!e)return {layout:null,layoutId:null};let o=null,a=null;if(Array.isArray(e.layoutRefs)){let r=e.layoutRefs.find(n=>n.tableKey===t);r&&(o=r.layoutId);}return !o&&e.layoutId&&(o=e.layoutId),e.layout&&typeof e.layout=="object"&&!Array.isArray(e.layout)&&(a=e.layout),{layoutId:o,layout:a}};function Yd(e,t,o){return t[o]<e[o]?-1:t[o]>e[o]?1:0}function xy(e,t){return e==="desc"?(o,a)=>Yd(o,a,t):(o,a)=>-Yd(o,a,t)}function vy(e,t){let o=e.map((a,r)=>[a,r]);return o.sort((a,r)=>{let n=t(a[0],r[0]);return n!==0?n:a[1]-r[1]}),o.map(a=>a[0])}var zi=e=>{let t=useCallback(V=>{let U=String(V?.label??V?.id??"").length*9+64,me=typeof V?.minWidth=="number"?V.minWidth:0;return Math.max(100,me,U)},[]),o=useCallback(()=>(e.columns||[]).filter(V=>!!V?.numeric).map(V=>V.id),[e.columns]),[a,r]=useState(""),[n,i]=useState(e.order||"asc"),[l,d]=useState(e.orderBy||""),[s,c]=useState(e.page||0),[g,f]=useState(e.rowsPerPage||20),[u,y]=useState(e.selected||[]),[I,p]=useState(e.columns?e.columns.map(V=>V.id):[]),[C,m]=useState(e.showSummary||false),[b,x]=useState(()=>o()),[k,E]=useState([]),[R,w]=useState(new Set),[B,T]=useState(()=>{let V={};return (e.columns||[]).forEach(O=>{V[O.id]=t(O);}),V}),[v,D]=useState(null),[S,P]=useState(null),[F,W]=useState(null),[z,j]=useState(null),[ie,Y]=useState(false),[te,Z]=useState(""),[Ze,at]=useState("");useEffect(()=>{e.layout&&ke(e.layout);},[e.layout]),useEffect(()=>{e.order!==void 0&&i(e.order),e.orderBy!==void 0&&d(e.orderBy);},[e.order,e.orderBy]),useEffect(()=>{e.selected!==void 0&&y(e.selected);},[e.selected]),useEffect(()=>{e.page!==void 0&&c(e.page);},[e.page]),useEffect(()=>{e.rowsPerPage!==void 0&&f(e.rowsPerPage);},[e.rowsPerPage]),useEffect(()=>{let V=o();x(O=>O.filter(me=>V.includes(me)));},[o]),useEffect(()=>{T(V=>{let O={...V};return (e.columns||[]).forEach(U=>{O[U.id]===void 0&&(O[U.id]=t(U));}),O});},[e.columns,t]);let He=useMemo(()=>{let V=e.rows||[];return a&&(V=V.filter(O=>Object.keys(O).some(U=>String(O[U]).toLowerCase().includes(a.toLowerCase())))),V},[e.rows,a]),re=useMemo(()=>e.onSortChange||!l?He:vy(He,xy(n,l)),[He,n,l,e.onSortChange]),Ie=useCallback(V=>{if(k.length===0)return V.map(we=>({type:"row",data:we,id:we[e.rowKey||"id"]}));let O=[...V].sort((we,ce)=>{for(let Re of k){if(we[Re]<ce[Re])return -1;if(we[Re]>ce[Re])return 1}return 0}),U=(we,ce=0)=>{if(ce>=k.length)return we;let Re=k[ce],ye={},De=[];return we.forEach(Se=>{let he=Se[Re],Ce=`${Re}:${he}`;ye[Ce]||(ye[Ce]={key:Ce,field:Re,value:he,children:[],count:0,level:ce},De.push(ye[Ce])),ye[Ce].children.push(Se),ye[Ce].count++;}),De.forEach(Se=>{Se.children&&(Se.children=U(Se.children,ce+1));}),De},me=U(O),fe=(we,ce="")=>{let Re=[];return we.forEach(ye=>{if(ye.children){let De=ce?`${ce}>${ye.key}`:ye.key,Se=R.has(De);Re.push({type:"group",id:De,field:ye.field,value:ye.value,level:ye.level,count:ye.count,isExpanded:Se,childIds:(function he(Ce){let Ft=[];return Ce.children.forEach(bo=>{bo.children?Ft=Ft.concat(he(bo)):Ft.push(bo[e.rowKey||"id"]);}),Ft})(ye)}),Se&&(Re=Re.concat(fe(ye.children,De)));}else Re.push({type:"row",data:ye,id:ye[e.rowKey||"id"],level:k.length});}),Re};return fe(me)},[k,R,e.rowKey]),Te=useCallback(V=>{if(k.length===0)return [];let O=[...V].sort((fe,we)=>{for(let ce of k){if(fe[ce]<we[ce])return -1;if(fe[ce]>we[ce])return 1}return 0}),U=[],me=(fe,we,ce)=>{if(we>=k.length)return;let Re=k[we],ye=new Map;fe.forEach(De=>{let Se=De[Re],he=ye.get(Se);he?he.push(De):ye.set(Se,[De]);}),ye.forEach((De,Se)=>{let he=`${Re}:${Se}`,Ce=ce?`${ce}>${he}`:he;U.push(Ce),me(De,we+1,Ce);});};return me(O,0,""),U},[k]),je=useMemo(()=>Ie(re),[re,Ie]),rt=useMemo(()=>Te(re),[re,Te]),ze=useMemo(()=>{let V=(e.rows||[]).length;return typeof e.count=="number"&&e.count>V},[e.count,e.rows]),Ye=useMemo(()=>ze?je:g>0?je.slice(s*g,s*g+g):je,[je,s,g,ze]),uo=useMemo(()=>ze&&typeof e.count=="number"?e.count:je.length,[je.length,ze,e.count]),Gt=V=>{w(O=>{let U=new Set(O);return U.has(V)?U.delete(V):U.add(V),U});},Ue=V=>{let O=rt.filter(U=>U===V||U.startsWith(`${V}>`));w(U=>{let me=new Set(U);return O.forEach(fe=>me.add(fe)),me});},Tt=V=>{w(O=>{let U=new Set(O);return Array.from(U).forEach(me=>{(me===V||me.startsWith(`${V}>`))&&U.delete(me);}),U});},At=V=>{if(!V){w(new Set);return}w(new Set(rt));},ht=V=>{let O=rt.filter(U=>U.startsWith(`${V}>`));return O.length===0?R.has(V):R.has(V)&&O.every(U=>R.has(U))},H=V=>{let O=l===V&&n==="asc",U=l===V&&n==="desc";if(e.onSortChange){O?e.onSortChange(V,"desc"):U?e.onSortChange("","asc"):e.onSortChange(V,"asc");return}O?(i("desc"),d(V)):U?(i("asc"),d("")):(i("asc"),d(V));},pe=(V,O)=>{T(U=>({...U,[V]:O}));},se=V=>{if(V.target.checked){let O=He.map(U=>U[e.rowKey||"id"]);y(O),e.onSelectionChange&&e.onSelectionChange(O);return}y([]),e.onSelectionChange&&e.onSelectionChange([]);},ue=(V,O)=>{let U=O[e.rowKey||"id"],me=u.indexOf(U),fe=[];me===-1?fe=fe.concat(u,U):me===0?fe=fe.concat(u.slice(1)):me===u.length-1?fe=fe.concat(u.slice(0,-1)):me>0&&(fe=fe.concat(u.slice(0,me),u.slice(me+1))),y(fe),e.onSelectionChange&&e.onSelectionChange(fe);},Ge=V=>{c(V),e.onPageChange&&e.onPageChange(V);},Me=V=>{f(V),c(0),e.onPageChange&&e.onPageChange(0),e.onRowsPerPageChange&&e.onRowsPerPageChange(V);},ao=V=>{let O=I.indexOf(V),U=[...I];O===-1?U.push(V):U.splice(O,1),p(U);},mo=V=>{let O=k.indexOf(V),U=[...k];O===-1?U.push(V):U.splice(O,1),E(U);},go=V=>{o().includes(V)&&x(U=>U.includes(V)?U.filter(me=>me!==V):[...U,V]);},fo=V=>{e.onLayoutSave&&e.onLayoutSave({visibleColumns:I,order:n,orderBy:l,grouping:k,columnWidths:B,showSummary:C,summaryColumns:b});},ho=V=>{let{layout:O,layoutId:U}=Li(V,e.tableKey||"default");U?(at(U),Z(U)):(at(""),Z("")),O&&(O.visibleColumns&&p(O.visibleColumns),O.order&&i(O.order),O.orderBy&&d(O.orderBy),O.grouping&&E(O.grouping),O.columnWidths&&T(O.columnWidths),O.showSummary!==void 0&&m(!!O.showSummary),Array.isArray(O.summaryColumns)&&x(O.summaryColumns));},ke=V=>{let O=V?.layoutData||V?.layout||V||{};O.visibleColumns&&p(O.visibleColumns),O.order&&i(O.order),O.orderBy!==void 0&&d(O.orderBy),O.grouping&&E(O.grouping),O.columnWidths&&T(O.columnWidths),O.showSummary!==void 0&&m(!!O.showSummary),Array.isArray(O.summaryColumns)&&x(O.summaryColumns),w(new Set),c(0),V?.id&&Z(V.id),at("");};useEffect(()=>{e.layout&&ho({layout:e.layout});},[e.layout]);let de=V=>{V.preventDefault(),j(z===null?{mouseX:V.clientX+2,mouseY:V.clientY-6}:null);},yt=()=>{j(null);},Pe=useMemo(()=>{if(!C)return {};let V={};e.columns.forEach(U=>{if(U.numeric&&b.includes(U.id)){let me=He.reduce((fe,we)=>{let ce=parseFloat(we[U.id]);return fe+(isNaN(ce)?0:ce)},0);V[U.id]=me.toFixed(2);}else V[U.id]="";});let O=e.columns.find(U=>I.includes(U.id));return O&&!O.numeric&&(V[O.id]="Total"),V},[He,e.columns,C,b,I]),Bt=()=>{if(!e.columns||!He)return;let V=e.columns.map(we=>we.label).join(","),O=He.map(we=>e.columns.map(ce=>{let Re=we[ce.id];return `"${(Re==null?"":String(Re)).replace(/"/g,'""')}"`}).join(",")).join(`
2
- `),U=`data:text/csv;charset=utf-8,${V}
3
- ${O}`,me=encodeURI(U),fe=document.createElement("a");fe.setAttribute("href",me),fe.setAttribute("download",`${e.title||"export"}.csv`),document.body.appendChild(fe),fe.click(),document.body.removeChild(fe);},yo=()=>{Y(true);},Ba=()=>{Y(false);};return {isMobile:false,columns:e.columns,order:n,orderBy:l,filterText:a,setFilterText:r,visibleColumns:I,setVisibleColumns:p,showSummary:C,setShowSummary:m,summaryColumns:b,grouping:k,setGrouping:E,expandedGroups:R,setExpandedGroups:w,groupAnchorEl:S,setGroupAnchorEl:P,summaryAnchorEl:F,setSummaryAnchorEl:W,columnWidths:B,setColumnWidths:T,anchorEl:v,setAnchorEl:D,contextMenu:z,setContextMenu:j,sensors:void 0,sortedAndFilteredRows:re,visibleRows:Ye,summaryRow:Pe,page:s,setPage:Ge,rowsPerPage:g,setRowsPerPage:Me,totalDisplayCount:uo,selected:u,setSelected:y,isAllExpanded:rt.length>0&&rt.every(V=>R.has(V)),handleColumnResize:pe,handleRequestSort:H,handleSelectAllClick:se,handleClick:ue,toggleSummaryColumn:go,handleDragEnd:()=>{},handleExport:Bt,handleContextMenu:de,handleCloseContextMenu:yt,toggleColumnVisibility:ao,toggleGroupExpand:Gt,toggleGroupField:mo,handleToggleAll:At,handleExpandGroupRecursively:Ue,handleCollapseGroupRecursively:Tt,isGroupFullyExpanded:ht,handleLayoutLoad:ke,handleVariantLoad:ho,handleLayoutSave:fo,effectiveAppId:e.appId||"",currentLayoutData:{visibleColumns:I,order:n,orderBy:l,grouping:k,columnWidths:B,showSummary:C,summaryColumns:b},currentLayoutId:te,layoutIdToLoad:Ze,onPageChange:Ge,onRowsPerPageChange:Me,graphReportOpen:ie,handleOpenGraphReport:yo,handleCloseGraphReport:Ba}};var NP=e=>jsx(Sy,{...e}),zP=e=>jsx(Js,{...e}),VP=e=>jsx(np,{...e}),OP=e=>jsx(Kg,{...e}),$P=e=>jsx(qg,{...e}),Sa=e=>{let{t}=_(),o="0.85rem",{title:a,showToolbar:r=true,selectionMode:n,selected:i=[],onSelectionChange:l,actions:d,extraTools:s,fitContainer:c=false,fullWidth:g=false,maxHeight:f,loading:u=false,rowsPerPageOptions:y=[20,50,100,-1],onLayoutSave:I,filterConfig:p,rowKey:C,tableKey:m="default",graphReport:b,quickCreate:x,quickEdit:k,quickDelete:E,serviceUrl:R}=e,w=a||t("table.title.default"),{isMobile:B,columns:T,order:v,orderBy:D,filterText:S,setFilterText:P,visibleColumns:F,showSummary:W,setShowSummary:z,summaryColumns:j,grouping:ie,setGrouping:Y,expandedGroups:te,groupAnchorEl:Z,setGroupAnchorEl:Ze,summaryAnchorEl:at,setSummaryAnchorEl:He,columnWidths:re,anchorEl:Ie,setAnchorEl:Te,contextMenu:je,sensors:rt,sortedAndFilteredRows:ze,summaryRow:Ye,visibleRows:uo,isAllExpanded:Gt,page:Ue,setPage:Tt,rowsPerPage:At,setRowsPerPage:ht,totalDisplayCount:H,setSelected:pe,handleColumnResize:se,handleRequestSort:ue,handleSelectAllClick:Ge,handleClick:Me,toggleSummaryColumn:ao,handleDragEnd:mo,handleExport:go,handleContextMenu:fo,handleCloseContextMenu:ho,toggleColumnVisibility:ke,toggleGroupExpand:de,toggleGroupField:yt,handleToggleAll:Pe,handleExpandGroupRecursively:Bt,handleCollapseGroupRecursively:yo,isGroupFullyExpanded:Ba,handleLayoutLoad:V,handleVariantLoad:O,handleLayoutSave:U,effectiveAppId:me,currentLayoutData:fe,currentLayoutId:we,layoutIdToLoad:ce,graphReportOpen:Re,handleOpenGraphReport:ye,handleCloseGraphReport:De}=zi(e),Se=b?.enabled??false,he=Se&&(b?.interaction?.enabled??true),Ce=wi(),Ft=!!x?.enabled,bo=!!k?.enabled,ut=!!E?.enabled,bt=x?.fields,ro=x?.excludeFields||[],da=x?.initialValues||{},[ur,xo]=st__default.useState(false),[Ut,Fa]=st__default.useState(false),[Go,Et]=st__default.useState({}),[Kt,Pt]=st__default.useState(false),[Ae,Uo]=st__default.useState(false),[Bo,Ko]=st__default.useState({}),[Ea,Fo]=st__default.useState(false),[La,Na]=st__default.useState(false),Eo=u||Ut||Ae||La,qo=st__default.useMemo(()=>{let L=[...T];if(Array.isArray(bt)&&bt.length>0){let q=new Set(bt);L=L.filter(K=>q.has(K.id));}if(ro.length>0){let q=new Set(ro);L=L.filter(K=>!q.has(K.id));}return L.filter(q=>!!q?.id)},[T,ro,bt]),pa=C||"id",Lt=st__default.useMemo(()=>{let L=new Set(i);return ze.filter(q=>L.has(q?.[pa]))},[i,ze,pa]),vo=Lt.length===1?Lt[0]:null,_o=k?.fields,no=k?.excludeFields||[],Lo=k?.editableFields||[],za=k?.nonEditableFields||[],mr=k?.primaryKeys?.length?k.primaryKeys:[pa],ua=st__default.useMemo(()=>{let L=[...T];if(Array.isArray(_o)&&_o.length>0){let q=new Set(_o);L=L.filter(K=>q.has(K.id));}if(no.length>0){let q=new Set(no);L=L.filter(K=>!q.has(K.id));}return L.filter(q=>!!q?.id)},[T,no,_o]),Va=st__default.useMemo(()=>new Set(mr),[mr]),Zo=st__default.useMemo(()=>new Set(Lo),[Lo]),Ot=st__default.useMemo(()=>new Set(za),[za]),Co=st__default.useCallback(L=>Zo.size>0?Zo.has(L):!(Ot.has(L)||Va.has(L)),[Zo,Ot,Va]);st__default.useEffect(()=>{!Re&&Ce.hasActiveFilters&&Ce.clearAll();},[Re,Ce.hasActiveFilters,Ce.clearAll]);let gr=()=>{let L={};qo.forEach(q=>{L[q.id]=da[q.id]??"";}),Et(L),xo(true);},Oa=()=>{Ut||xo(false);},fr=(L,q)=>{Et(K=>({...K,[L]:q}));},hr=async()=>{if(!x?.onSubmit){xo(false);return}try{Fa(!0),await x.onSubmit(Go),xo(!1);}finally{Fa(false);}},yr=()=>{if(!vo)return;let L={};ua.forEach(K=>{L[K.id]=vo[K.id]??"";});let q=k?.getInitialValues?{...L,...k.getInitialValues(vo)}:L;Ko(q),Pt(true);},qt=()=>{Ae||Pt(false);},br=(L,q)=>{Ko(K=>({...K,[L]:q}));},xr=async()=>{if(vo){if(!k?.onSubmit){Pt(false);return}try{Uo(!0),await k.onSubmit(Bo,vo),Pt(!1);}finally{Uo(false);}}},$a=()=>{Lt.length!==0&&Fo(true);},jo=()=>{La||Fo(false);},ma=async()=>{if(Lt.length===0){Fo(false);return}if(!E?.onConfirm){Fo(false),pe([]),l?.([]);return}try{Na(!0),await E.onConfirm(Lt),Fo(!1),pe([]),l?.([]);}finally{Na(false);}},ga=ze,{fieldMapping:h}=Mr({rows:ga,config:{...b,title:b?.title||`${w} ${t("graph.reportTitle")}`}}),M=st__default.useMemo(()=>he?Ce.applyRows(ga,h):ga,[he,Ce.applyRows,ga,h]),{model:A}=Mr({rows:M,config:{...b,title:b?.title||`${w} ${t("graph.reportTitle")}`,fieldMapping:h}}),$=A.table.columns.map(L=>({id:L.id,label:L.label,align:L.align||"left",minWidth:120,numeric:L.align==="right"})),X=me?jsx(Ei,{appId:me,tableKey:m,currentLayoutData:fe,onLayoutLoad:V,targetLayoutId:ce,activeLayoutId:we,serviceUrl:R??p?.serviceUrl}):null,le=jsxs(Fragment,{children:[jsx(ai,{groupAnchorEl:Z,setGroupAnchorEl:Ze,grouping:ie,setGrouping:Y,columns:T,toggleGroupField:yt}),jsx(ri,{anchorEl:Ie,setAnchorEl:Te,columns:T,visibleColumns:F,toggleColumnVisibility:ke}),jsx(ni,{anchorEl:at,setAnchorEl:He,showSummary:W,setShowSummary:z,columns:T,summaryColumns:j,toggleSummaryColumn:ao}),jsx(ii,{contextMenu:je,handleCloseContextMenu:ho,columns:T,visibleColumns:F,toggleColumnVisibility:ke})]});return B?jsxs(kn,{sx:{display:"flex",flexDirection:"column",gap:2,height:"100%"},children:[p&&jsx(ja,{fields:p.fields,filters:p.filters,onFilterChange:p.onFilterChange,onSearch:p.onSearch,variants:p.variants||[],currentVariantId:p.currentVariantId,onVariantLoad:p.onVariantLoad,onVariantSave:p.onVariantSave,onVariantDelete:p.onVariantDelete,onVariantSetDefault:p.onVariantSetDefault,appId:p.appId,tableKey:m,currentLayout:[{tableKey:m,layoutData:fe}],variantService:p.variantService,serviceUrl:R??p.serviceUrl}),jsx(td,{title:w,loading:u,showSummary:W,setShowSummary:z,setAnchorEl:Te,setSummaryAnchorEl:He,filterText:S,setFilterText:P,sortedAndFilteredRows:ze,selected:i,columns:T,visibleColumns:F,summaryRow:Ye,handleClick:Me,selectionMode:n}),le]}):jsxs(kn,{sx:{width:g?"100%":"auto",mb:c?0:2,...c?{flex:1,display:"flex",flexDirection:"column",minHeight:0,height:"100%",overflow:"hidden"}:{}},children:[p&&jsx(kn,{sx:{mb:2},children:jsx(ja,{fields:p.fields,filters:p.filters,onFilterChange:p.onFilterChange,onSearch:p.onSearch,variants:p.variants||[],currentVariantId:p.currentVariantId,onVariantLoad:L=>{O(L),p.onVariantLoad&&p.onVariantLoad(L);},onVariantSave:p.onVariantSave,onVariantDelete:p.onVariantDelete,onVariantSetDefault:p.onVariantSetDefault,loading:u,appId:p.appId,tableKey:m,currentLayout:[{tableKey:m,layoutData:fe}],currentLayoutId:we,layoutRefs:[{tableKey:m,layoutId:we}],variantService:p.variantService,serviceUrl:R??p.serviceUrl})}),jsxs(Cy,{sx:{width:g?"100%":"auto",mb:c?0:2,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative","&::before":Eo?{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"3px",background:"linear-gradient(90deg, rgba(25, 118, 210, 0) 0%, rgba(25, 118, 210, 0.25) 25%, rgba(25, 118, 210, 1) 50%, rgba(25, 118, 210, 0.25) 75%, rgba(25, 118, 210, 0) 100%)",backgroundSize:"220% 100%",animation:"cTableTopMarquee 1.2s linear infinite",zIndex:6,pointerEvents:"none"}:{},"@keyframes cTableTopMarquee":{"0%":{backgroundPosition:"220% 0"},"100%":{backgroundPosition:"-120% 0"}},...f?{height:f}:c?{flex:1,minHeight:0,height:"100%"}:{}},children:[r&&jsx(Jn,{filterText:S,setFilterText:P,onRowsPerPageChange:ht,rowsPerPage:At,rowsPerPageOptions:y,page:Ue,count:H,onPageChange:Tt,actions:d,extraTools:s,grouping:ie,setGroupAnchorEl:Ze,showSummary:W,setShowSummary:z,setAnchorEl:Te,setSummaryAnchorEl:He,handleExport:go,showCreateButton:Ft,onOpenCreateDialog:gr,showEditButton:bo,onOpenEditDialog:yr,editDisabled:Lt.length!==1,showDeleteButton:ut,onOpenDeleteConfirm:$a,deleteDisabled:Lt.length===0,onLayoutSave:I||p?.variantService&&p?.appId?U:void 0,loading:u,layoutManager:X,onOpenGraphReport:Se?ye:void 0}),jsx(np,{sx:{flex:1,...f?{maxHeight:f,height:f}:c?{height:0,maxHeight:"none"}:{maxHeight:"calc(100vh - 320px)"},overflowY:"auto",overflowX:"auto",position:"relative",minHeight:0},children:jsx(DndContext,{sensors:rt,collisionDetection:closestCenter,onDragEnd:mo,modifiers:[restrictToHorizontalAxis],children:jsxs(ky,{sx:{minWidth:g?750:"auto",width:g?"100%":"auto",tableLayout:Object.keys(re).length>0?"fixed":"auto",borderCollapse:"separate",borderSpacing:0,"& .MuiTableCell-root":{fontSize:o}},"aria-labelledby":"tableTitle",size:"small",stickyHeader:true,children:[jsx(jc,{columns:T,visibleColumns:F,order:v,orderBy:D,onRequestSort:ue,onContextMenu:fo,selectionMode:n,grouping:ie,isAllExpanded:Gt,handleToggleAll:Pe,rowCount:ze.length,numSelected:i.length,onSelectAllClick:Ge,columnWidths:re,onColumnResize:se}),jsx(Yc,{visibleRows:uo,columns:T,visibleColumns:F,selectionMode:n,selected:i,orderBy:D,loading:u,expandedGroups:te,toggleGroupExpand:de,handleExpandGroupRecursively:Bt,handleCollapseGroupRecursively:yo,isGroupFullyExpanded:Ba,handleClick:Me,onSelectionChange:l,grouping:ie,rowKeyProp:C,page:Ue,rowsPerPage:At}),W&&jsx(Jc,{showSummary:W,columns:T,visibleColumns:F,summaryRow:Ye,selectionMode:n?.toString(),grouping:ie,orderBy:D,zIndex:3})]})})})]}),Ft&&jsxs(Jd,{open:ur,onClose:Oa,fullWidth:true,maxWidth:"sm",slotProps:{paper:{sx:{borderRadius:2,border:L=>`1px solid ${L.palette.divider}`,bgcolor:"background.paper"}}},children:[jsx(ep,{sx:{fontSize:"0.85rem",fontWeight:700,pb:1},children:x?.title||t("quickCreate.createWithTitle",{title:w})}),jsx(tp,{sx:{pt:"8px !important"},children:jsxs(kn,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[qo.map(L=>{let q=L.type==="number"||L.numeric?"number":L.type==="date"?"date":"text",K=L.label||L.id;return jsx(ap,{label:K,value:Go[L.id]??"",onChange:Oe=>fr(L.id,Oe.target.value),type:q,size:"small",fullWidth:true,InputLabelProps:{shrink:q==="date"?true:void 0,sx:{fontSize:"0.85rem"}},InputProps:{sx:{fontSize:"0.85rem"}}},`quick-create-${L.id}`)}),x?.description&&jsx(rp,{severity:"info",sx:{fontSize:"0.85rem","& .MuiAlert-message":{fontSize:"0.85rem"}},children:x.description})]})}),jsxs(op,{sx:{px:3,pb:2},children:[jsx(Vi,{onClick:Oa,sx:{fontSize:"0.85rem"},disabled:Ut,children:x?.cancelLabel||t("common.cancel")}),jsx(Vi,{onClick:hr,variant:"contained",sx:{fontSize:"0.85rem",fontWeight:700},disabled:Ut,children:x?.submitLabel||t("common.save")})]})]}),bo&&jsxs(Jd,{open:Kt,onClose:qt,fullWidth:true,maxWidth:"sm",slotProps:{paper:{sx:{borderRadius:2,border:L=>`1px solid ${L.palette.divider}`,bgcolor:"background.paper"}}},children:[jsx(ep,{sx:{fontSize:"0.85rem",fontWeight:700,pb:1},children:k?.title||t("quickEdit.editWithTitle",{title:w})}),jsx(tp,{sx:{pt:"8px !important"},children:jsxs(kn,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[ua.map(L=>{let q=L.type==="number"||L.numeric?"number":L.type==="date"?"date":"text",K=L.label||L.id,Oe=Co(L.id);return jsx(ap,{label:K,value:Bo[L.id]??"",onChange:N=>br(L.id,N.target.value),type:q,size:"small",fullWidth:true,disabled:!Oe,InputLabelProps:{shrink:q==="date"?true:void 0,sx:{fontSize:"0.85rem"}},InputProps:{sx:{fontSize:"0.85rem"}}},`quick-edit-${L.id}`)}),k?.description&&jsx(rp,{severity:"info",sx:{fontSize:"0.85rem","& .MuiAlert-message":{fontSize:"0.85rem"}},children:k.description})]})}),jsxs(op,{sx:{px:3,pb:2},children:[jsx(Vi,{onClick:qt,sx:{fontSize:"0.85rem"},disabled:Ae,children:k?.cancelLabel||t("common.cancel")}),jsx(Vi,{onClick:xr,variant:"contained",sx:{fontSize:"0.85rem",fontWeight:700},disabled:Ae||!vo,children:k?.submitLabel||t("common.save")})]})]}),ut&&jsx(nn,{open:Ea,type:"warning",title:E?.title||t("quickDelete.confirmTitle"),message:E?.message||(Lt.length>1?t("quickDelete.confirmMessageMultiple",{count:Lt.length}):t("quickDelete.confirmMessageSingle")),confirmText:E?.confirmText||t("common.delete"),cancelText:E?.cancelText||t("common.cancel"),onClose:jo,onConfirm:ma}),le,Se&&jsx(ki,{open:Re,onClose:De,model:A,aiAssistant:b?.aiAssistant,interaction:he?{enabled:true,filters:Ce.filters,fieldMapping:h,onPrimaryDimensionClick:L=>Ce.setFilter("primaryDimension",L),onSecondaryDimensionClick:L=>Ce.setFilter("secondaryDimension",L),onStatusClick:L=>Ce.setFilter("status",L),onClearFilter:Ce.clearFilter,onClearAll:Ce.clearAll}:void 0,tableContent:jsx(Sa,{appId:me||"graph-report-internal",title:t("graph.dataBody"),columns:$,rows:A.table.rows,rowKey:"id",fullWidth:true,maxHeight:"420px",rowsPerPage:20,rowsPerPageOptions:[20,50,100],graphReport:{enabled:false}})})]})},WP=Sa;var ZP=({id:e,title:t,hideHeader:o=true,filterConfig:a,tableProps:r,children:n,spacing:i=1,mode:l="separated"})=>{let d=a?{...a,appId:a.appId||e}:void 0,s={...r,appId:r.appId||e};return jsxs(Kc,{title:t,hideHeader:o,children:[jsxs(Stack,{spacing:i,sx:{height:"100%",overflow:"hidden"},children:[l==="separated"&&d&&jsx(Box,{sx:{flexShrink:0},children:jsx(ja,{...d})}),jsx(Box,{sx:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:jsx(Sa,{...s,fitContainer:true,filterConfig:l==="integrated"?d:void 0})})]}),n]})};var eR=({metadata:e,fetchData:t,initialRowsPerPage:o=20,rowsPerPageOptions:a=[20,50,100,-1],tableKey:r="default",mode:n="integrated",serviceUrl:i,variantService:l})=>{let{t:d}=_(),[s,c]=useState(false),[g,f]=useState([]),[u,y]=useState({}),[I,p]=useState(e.variants||[]),[C,m]=useState(e.layout||null),[b,x]=useState(""),[k,E]=useState(0),[R,w]=useState(0),[B,T]=useState(o),[v,D]=useState([]),[S,P]=useState("asc"),[F,W]=useState("");useEffect(()=>{let re={};e.filters.forEach(Ie=>{Ie.defaultValue!==void 0&&(re[Ie.id]=Ie.defaultValue);}),y(re);},[e.filters]);let z=useCallback(async(re,Ie,Te,je,rt)=>{c(true);try{let ze={...re,page:Ie+1,limit:Te,sort:rt,order:je},Ye;t?Ye=await t(ze):typeof e.api=="function"?Ye=await e.api(ze):e.api&&typeof e.api=="object"?(console.log("Fetching from URL:",e.api.url,ze),Ye={rows:[],total:0}):(console.warn("No API configured for report"),Ye={rows:[],total:0}),Ye&&(f(Ye.rows||[]),E(Ye.total||0));}catch(ze){console.error("Failed to fetch report data",ze);}finally{c(false);}},[e.api,t]);useEffect(()=>{z(u,R,B,S,F);},[z,R,B,S,F]);let j=()=>{w(0),z(u,0,B,S,F);},ie=re=>{w(0),T(re);},Y=(re,Ie)=>{P(Ie),W(re);},te=re=>{y(re);},Z=re=>{x(re?.id||"");let Ie=Xd(re,r);if(Ie){let je=Ie.values??Ie;y(je),z(je,0,B,S,F),w(0);}let{layout:Te}=Li(re,r);Te&&m(Te);},Ze=re=>{let Ie={...re,id:Date.now().toString(),createdAt:new Date().toISOString()};p(Te=>[...Te,Ie]);},at=re=>{m(re);};return {pageProps:{id:e.id,title:e.title,mode:n,filterConfig:{appId:e.id,tableKey:r,fields:e.filters,filters:u,onFilterChange:te,onSearch:j,onVariantLoad:Z,onVariantSave:Ze,onVariantDelete:re=>p(Ie=>Ie.filter(Te=>Te.id!==re)),onVariantSetDefault:re=>{p(Ie=>Ie.map(Te=>({...Te,isDefault:Te.id===re})));},variants:I,currentVariantId:b,variantService:l,serviceUrl:i},tableProps:{appId:e.id,tableKey:r,columns:e.columns,rows:g,loading:s,rowKey:"id",count:k,page:R,rowsPerPage:B,rowsPerPageOptions:a,onPageChange:w,onRowsPerPageChange:ie,selectionMode:"multiple",selected:v,onSelectionChange:D,onLayoutSave:at,layout:C,title:e.title,showSummary:true,order:S,orderBy:F,serviceUrl:i,onSortChange:Y,graphReport:e.graphReport||{enabled:true,title:`${e.title} ${d("graph.reportTitle")}`}}},filters:u,rows:g,loading:s,refresh:j}};var Fy=e=>[...e].sort((t,o)=>o.value-t.value),aR=({bars:e=[],lines:t=[],combos:o=[],heatmap:a=[],pies:r=[],waterfalls:n=[]})=>{let i=useMemo(()=>Fy(e),[e]),l=useMemo(()=>[...t],[t]),d=useMemo(()=>[...o],[o]),s=useMemo(()=>[...a],[a]),c=useMemo(()=>{let f=r.reduce((u,y)=>u+y.value,0);return r.map(u=>({...u,percent:f>0?u.value/f*100:u.percent}))},[r]),g=useMemo(()=>[...n],[n]);return {bars:i,lines:l,combos:d,heatmap:s,pies:c,waterfalls:g}};var lR=({apiKey:e,query:t,zoom:o=14,mapType:a="roadmap"})=>useMemo(()=>!e||!t?"":gn({apiKey:e,query:t,zoom:o,mapType:a}),[e,t,o,a]),cR=({keyword:e,location:t})=>useMemo(()=>yi({keyword:e,location:t?{lng:t.lng,lat:t.lat,name:t.name}:void 0}),[e,t]);var Sn=({code:e,language:t="text",copyable:o=true,showLineNumbers:a=false,wrapLongLines:r=false,maxHeight:n})=>{let[i,l]=useState(false),d=useMemo(()=>e.replace(/\n$/,"").split(`
4
- `),[e]);return jsxs(Box,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",bgcolor:"background.paper"},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1,py:.6,bgcolor:"action.hover",borderBottom:"1px solid",borderColor:"divider"},children:[jsx(Typography,{variant:"caption",sx:{textTransform:"uppercase",letterSpacing:.5,color:"text.secondary",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:t}),o&&jsx(Tooltip,{title:i?"Copied":"Copy",children:jsx(IconButton,{size:"small",onClick:async()=>{try{await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1400);}catch{l(false);}},children:i?jsx($y,{fontSize:"inherit"}):jsx(Oy,{fontSize:"inherit"})})})]}),jsx(Box,{component:"pre",sx:{m:0,p:1.25,fontSize:"0.82rem",lineHeight:1.55,overflow:"auto",maxHeight:n,bgcolor:"background.default",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:a?d.map((c,g)=>jsxs(Box,{sx:{display:"flex"},children:[jsx(Box,{component:"span",sx:{width:34,flexShrink:0,textAlign:"right",pr:1,color:"text.disabled",userSelect:"none"},children:g+1}),jsx(Box,{component:"span",sx:{whiteSpace:r?"pre-wrap":"pre",wordBreak:r?"break-word":"normal"},children:c})]},`${g}-${c}`)):jsx(Box,{component:"code",sx:{display:"block",whiteSpace:r?"pre-wrap":"pre",wordBreak:r?"break-word":"normal"},children:e})})]})};var Ky=e=>{let t=e.trim();return t.startsWith("$$")&&t.endsWith("$$")&&t.length>=4&&(t=t.slice(2,-2).trim()),t.startsWith("$")&&t.endsWith("$")&&t.length>=2&&(t=t.slice(1,-1).trim()),t},qy=async e=>new Function("m","return import(m)")(e),wn=({expression:e,inline:t=false,allowKatex:o=false})=>{let a=useMemo(()=>Ky(e),[e]),[r,n]=useState("");return useEffect(()=>{let i=true;return (async()=>{if(!o||!a){n("");return}try{let d=await qy("katex"),c=(d?.default||d)?.renderToString?.(a,{displayMode:!t,throwOnError:!1,strict:"warn"});i&&typeof c=="string"&&n(c);}catch{i&&n("");}})(),()=>{i=false;}},[o,a,t]),a?r?jsx(Box,{component:t?"span":"div",sx:{display:t?"inline-flex":"block",my:t?0:.5,overflowX:"auto"},dangerouslySetInnerHTML:{__html:r}}):t?jsx(Box,{component:"code",sx:{px:.4,py:.05,borderRadius:.8,bgcolor:"action.hover",fontSize:"0.82em",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:a}):jsx(Box,{sx:{my:1,p:1,borderRadius:1.2,border:"1px dashed",borderColor:"divider",bgcolor:"background.paper"},children:jsx(Typography,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",fontSize:"0.9rem",lineHeight:1.5,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:a})}):null};var Jy=async e=>new Function("m","return import(m)")(e),Pl=({code:e,title:t="Mermaid Diagram",height:o=320,enabled:a=true})=>{let[r,n]=useState(""),[i,l]=useState(""),[d,s]=useState(false),c=useMemo(()=>e.trim(),[e]);return useEffect(()=>{let g=true;return (async()=>{if(!a||!c){n(""),l("");return}s(true),l(""),n("");try{let u=await Jy("mermaid"),y=u?.default||u;if(!y||typeof y.render!="function")throw new Error("Mermaid runtime is not available");y.initialize?.({startOnLoad:!1,securityLevel:"loose",theme:"default"});let I=await y.render(`orbcafe-mermaid-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,c),p=typeof I=="string"?I:I?.svg;g&&typeof p=="string"&&n(p);}catch(u){if(g){let y=u instanceof Error?u.message:"Failed to render Mermaid diagram";l(y);}}finally{g&&s(false);}})(),()=>{g=false;}},[a,c]),jsxs(Paper,{variant:"outlined",sx:{borderRadius:1.5,overflow:"hidden",my:1},children:[jsx(Box,{sx:{px:1,py:.6,borderBottom:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsx(Typography,{variant:"caption",color:"text.secondary",sx:{letterSpacing:.4,textTransform:"uppercase"},children:t})}),jsxs(Box,{sx:{p:1},children:[d&&jsx(Box,{sx:{minHeight:120,display:"flex",alignItems:"center",justifyContent:"center"},children:jsx(CircularProgress,{size:20})}),!d&&r&&jsx(Box,{sx:{maxHeight:o,overflow:"auto","& svg":{display:"block",mx:"auto",maxWidth:"100%",height:"auto"}},dangerouslySetInnerHTML:{__html:r}}),!d&&!r&&jsxs(Box,{children:[i&&jsx(Alert,{severity:"info",sx:{mb:1},children:i}),jsx(Sn,{code:c,language:"mermaid",copyable:true,showLineNumbers:true,wrapLongLines:true})]})]})]})};var Rl=e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(o=>o.trim()),sb=e=>/^:?-{3,}:?$/.test(e.trim()),lb=e=>{let t=e.trim(),o=t.startsWith(":"),a=t.endsWith(":");return o&&a?"center":a?"right":"left"},Wi=e=>{let t=e.split(`
5
- `).map(i=>i.trim()).filter(Boolean);if(t.length<2)return null;let o=Rl(t[0]),a=Rl(t[1]);if(o.length===0||a.length!==o.length||!a.every(sb))return null;let r=a.map(lb),n=t.slice(2).filter(i=>i.includes("|")).map(i=>{let l=Rl(i);return l.length<o.length?[...l,...Array.from({length:o.length-l.length},()=>"")]:l.slice(0,o.length)});return {headers:o,aligns:r,rows:n}},Dl=({markdown:e,table:t,maxHeight:o=360})=>{let a=useMemo(()=>t||(e?Wi(e):null),[t,e]);return !a||a.headers.length===0?jsx(Paper,{variant:"outlined",sx:{p:1.2,borderRadius:1.5},children:jsx(Typography,{variant:"body2",color:"text.secondary",children:"Invalid table block"})}):jsx(Paper,{variant:"outlined",sx:{borderRadius:1.5,overflow:"hidden",my:1},children:jsx(TableContainer,{sx:{maxHeight:o},children:jsxs(Table,{size:"small",stickyHeader:true,children:[jsx(TableHead,{children:jsx(TableRow,{children:a.headers.map((r,n)=>jsx(TableCell,{align:a.aligns[n],sx:{fontWeight:700,bgcolor:"background.paper"},children:r},`${r}-${n}`))})}),jsx(TableBody,{children:a.rows.map((r,n)=>jsx(TableRow,{hover:true,children:r.map((i,l)=>jsx(TableCell,{align:a.aligns[l],sx:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i||jsx(Box,{component:"span",sx:{color:"text.disabled"},children:"-"})},`cell-${n}-${l}`))},`row-${n}`))})]})})})};var Gi=({content:e,title:t="Thinking",defaultExpanded:o=false,isStreaming:a=false})=>{let[r,n]=useState(o);return jsxs(Box,{sx:{borderLeft:"2px solid",borderColor:"divider",pl:1,my:.8},children:[jsxs(Stack,{direction:"row",alignItems:"center",spacing:.6,children:[jsx(IconButton,{size:"small",onClick:()=>n(i=>!i),sx:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform .15s ease"},children:jsx(fb,{fontSize:"inherit"})}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{fontStyle:"italic"},children:[t,a?" ...":""]})]}),jsx(Collapse,{in:r,children:jsx(Typography,{variant:"body2",sx:{pl:4,pt:.4,whiteSpace:"pre-wrap",color:"text.secondary",fontStyle:"italic",lineHeight:1.55},children:e})})]})};var Al=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\)|\*[^*]+\*|\$[^$\n]+\$)/g,Ui=e=>e.trim().startsWith("```"),fp=e=>/^#{1,6}\s+/.test(e.trim()),Bl=e=>/^[-*+]\s+/.test(e.trim()),Fl=e=>/^\d+\.\s+/.test(e.trim()),hp=e=>/^(?:-{3,}|\*{3,}|_{3,})$/.test(e.trim()),El=e=>e.trim().startsWith(">"),yp=(e,t)=>{if(t+1>=e.length)return false;let o=e[t],a=e[t+1];return !o.includes("|")||!a.includes("|")?false:/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(a.trim())},bp=e=>e.trim().startsWith("<think>")||e.trim()===":::think",Pn=(e,t,o)=>{let a=[],r=0,n=0;Al.lastIndex=0;let i=Al.exec(e);for(;i;){i.index>r&&a.push(e.slice(r,i.index));let l=i[0],d=`${o}-${n}`;if(l.startsWith("**")&&l.endsWith("**"))a.push(jsx("strong",{children:l.slice(2,-2)},d));else if(l.startsWith("*")&&l.endsWith("*"))a.push(jsx("em",{children:l.slice(1,-1)},d));else if(l.startsWith("`")&&l.endsWith("`"))a.push(jsx(Box,{component:"code",sx:{px:.45,py:.08,borderRadius:.8,bgcolor:"action.hover",fontSize:"0.82em",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:l.slice(1,-1)},d));else if(l.startsWith("[")&&l.includes("](")&&l.endsWith(")")){let s=l.match(/^\[([^\]]+)\]\(([^)]+)\)$/);s?a.push(jsx(Link,{href:s[2],target:"_blank",rel:"noreferrer",underline:"hover",children:s[1]},d)):a.push(l);}else l.startsWith("$")&&l.endsWith("$")&&t.enableMath?a.push(jsx(wn,{expression:l,inline:true,allowKatex:true},d)):a.push(l);r=i.index+l.length,n+=1,i=Al.exec(e);}return r<e.length&&a.push(e.slice(r)),a.length>0?a:[e]},Rn=({markdown:e,content:t,className:o,enableMath:a=true,enableMermaid:r=true,enableThinkBlock:n=true,codeCopyable:i=true,codeLineNumbers:l=false})=>{let d=e??t??"",s=useMemo(()=>{let c=[],g=d.replace(/\r\n/g,`
1
+ import {a}from'./chunk-74Z76O3S.mjs';export{b as COrbCanvas}from'./chunk-74Z76O3S.mjs';import*as ct from'react';import ct__default,{createContext,forwardRef,useMemo,useContext,useState,useEffect,useCallback,Fragment as Fragment$1,useRef}from'react';import {usePathname,useRouter}from'next/navigation';import {ChevronRight,Search,Plus,Mic,ThumbsDown,ThumbsUp,Volume2,RefreshCw,Copy,Terminal,Clock,X,ChevronDown,Box as Box$1,Lightbulb,AlertCircle,RotateCw,Check,Clipboard,CheckCircle,XCircle,Loader2,AlertTriangle,Info,BarChart,MapPin,Globe,TrendingDown,GitBranch,Grid as Grid$1,Activity,PieChart,LineChart}from'lucide-react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {Slot}from'@radix-ui/react-slot';import {cva}from'class-variance-authority';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Pp from'@mui/material/Dialog';import Rp from'@mui/material/DialogTitle';import Dp from'@mui/material/DialogContent';import rf from'@mui/material/DialogContentText';import Mp from'@mui/material/DialogActions';import Hn from'@mui/material/Box';import lf from'@mui/icons-material/CheckCircle';import cf from'@mui/icons-material/Warning';import df from'@mui/icons-material/Error';import pf from'@mui/icons-material/Info';import {styled,Paper,IconButton,Tooltip,Box,Typography,Stack,Link,Dialog,DialogTitle,DialogContent,MenuItem,DialogActions,Button,Chip,InputBase,useTheme,Autocomplete,TextField,FormControlLabel,Checkbox,Menu,ListItemText,Divider,Collapse,Grid,ListItemIcon,CircularProgress,Alert,TableContainer,Table,TableHead,TableRow,TableCell,TableBody,Tabs,Tab,LinearProgress,Avatar,AppBar,Toolbar,InputAdornment,createTheme,ThemeProvider,FormControl,Select,Switch,Portal,useMediaQuery,Drawer,Popover,ListSubheader,Badge,TableFooter,InputLabel}from'@mui/material';import ub from'@mui/material/Paper';import mb from'@mui/material/Table';import gb from'@mui/material/TableBody';import Cl from'@mui/material/TableCell';import Fp from'@mui/material/TableContainer';import Nf from'@mui/material/TableHead';import Vf from'@mui/material/TableRow';import Ap from'@mui/material/TextField';import rs from'@mui/material/Button';import Bp from'@mui/material/Alert';import {DndContext,closestCenter,useSensors,useSensor,PointerSensor,TouchSensor,closestCorners,DragOverlay,useDroppable,useDraggable}from'@dnd-kit/core';import {restrictToHorizontalAxis}from'@dnd-kit/modifiers';import gp from'@mui/icons-material/Search';import Sf from'@mui/icons-material/ViewColumn';import kp from'@mui/icons-material/Save';import Tf from'@mui/icons-material/Download';import If from'@mui/icons-material/AccountTree';import Pf from'@mui/icons-material/Functions';import Rf from'@mui/icons-material/Insights';import Df from'@mui/icons-material/Add';import Mf from'@mui/icons-material/Edit';import Af from'@mui/icons-material/Delete';import Bf from'@mui/icons-material/KeyboardArrowLeft';import Ff from'@mui/icons-material/KeyboardArrowRight';import Of from'@mui/material/Checkbox';import Wf from'@mui/material/TableSortLabel';import $f from'@mui/material/IconButton';import Hf from'@mui/material/Tooltip';import Gf from'@mui/icons-material/UnfoldMore';import Uf from'@mui/icons-material/UnfoldLess';import Xf from'@mui/icons-material/KeyboardArrowDown';import dh from'@mui/icons-material/Check';import ph from'@mui/icons-material/ClearAll';import Vh from'@mui/icons-material/Close';import qh from'@mui/icons-material/MicNoneOutlined';import _h from'@mui/icons-material/SettingsOutlined';import Zh from'@mui/icons-material/SendOutlined';import Uy from'@mui/icons-material/Settings';import Ky from'@mui/icons-material/KeyboardArrowUp';import _y from'@mui/icons-material/ArrowRightAlt';import fy from'@mui/icons-material/Star';import {DateCalendar}from'@mui/x-date-pickers/DateCalendar';import {PickersDay}from'@mui/x-date-pickers/PickersDay';import {LocalizationProvider}from'@mui/x-date-pickers/LocalizationProvider';import {AdapterDayjs}from'@mui/x-date-pickers/AdapterDayjs';import My from'@mui/icons-material/CalendarMonth';import Ay from'@mui/icons-material/Clear';import By from'@mui/icons-material/ArrowForward';import Ua from'dayjs';import Fy from'dayjs/plugin/isBetween';import Ey from'dayjs/plugin/localizedFormat';import'dayjs/locale/zh-cn';import'dayjs/locale/fr';import'dayjs/locale/de';import'dayjs/locale/ja';import'dayjs/locale/ko';import sb from'@mui/icons-material/StarBorder';import lb from'@mui/icons-material/ViewQuilt';import Mx from'@mui/icons-material/CloseOutlined';import Mb from'@mui/icons-material/ContentCopyOutlined';import Ab from'@mui/icons-material/CheckOutlined';import ix from'@mui/icons-material/ExpandMore';import {arrayMove,SortableContext,verticalListSortingStrategy,useSortable}from'@dnd-kit/sortable';import {alpha,useTheme as useTheme$1,createTheme as createTheme$1,ThemeProvider as ThemeProvider$1}from'@mui/material/styles';import pu from'@mui/icons-material/Language';import f0 from'@mui/icons-material/DesktopWindows';import h0 from'@mui/icons-material/DarkMode';import y0 from'@mui/icons-material/LightMode';import x0 from'@mui/icons-material/Logout';import Ev from'@mui/icons-material/DeleteOutline';import H0 from'@mui/icons-material/DragIndicator';import iv from'@mui/icons-material/FilterList';import sv from'@mui/icons-material/TableRows';import _0 from'@mui/icons-material/LayersClear';import nC from'@mui/icons-material/CameraAltRounded';import iC from'@mui/icons-material/QrCodeScannerRounded';import dC from'@mui/icons-material/DragIndicatorRounded';import gC from'@mui/icons-material/BackspaceRounded';import fC from'@mui/icons-material/CloseRounded';import hC from'@mui/icons-material/CheckRounded';import AC from'@mui/icons-material/SearchRounded';import BC from'@mui/icons-material/MenuOpenRounded';import FC from'@mui/icons-material/MenuRounded';import EC from'@mui/icons-material/ExpandMoreRounded';import LC from'@mui/icons-material/ChevronRightRounded';import tk from'next/dynamic';import {AnimatePresence,motion}from'framer-motion';import fS from'react-markdown';import hS from'remark-gfm';import yS from'remark-math';import bS from'rehype-katex';import xS from'rehype-raw';import {Prism}from'react-syntax-highlighter';import {oneDark,oneLight}from'react-syntax-highlighter/dist/esm/styles/prism';import {useTheme as useTheme$2}from'next-themes';import Nm from'mermaid';import MS from'@mui/icons-material/MicRounded';import AS from'@mui/icons-material/MicOffRounded';import {InsertDriveFile,Close,Stop}from'@mui/icons-material';import zS from'@mui/icons-material/SendRounded';import NS from'@mui/icons-material/AddRounded';import VS from'@mui/icons-material/HardwareRounded';import sw from'@mui/icons-material/LockOutlined';import ug from'@mui/icons-material/MailOutline';import mg from'@mui/icons-material/PersonOutline';import lw from'@mui/icons-material/VpnKeyOutlined';import Bw from'@mui/icons-material/CalendarMonthOutlined';import zw from'@mui/icons-material/KeyboardDoubleArrowLeftOutlined';import Nw from'@mui/icons-material/KeyboardDoubleArrowRightOutlined';import Vw from'@mui/icons-material/SplitscreenOutlined';import Ow from'@mui/icons-material/Sort';function mo(...e){return twMerge(clsx(e))}var pl={primary:"#000000",primaryHover:"#333333"},xi={primary:"bg-primary text-primary-foreground hover:bg-primary/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",ghost:"hover:bg-accent hover:text-accent-foreground"},wn={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},sd=()=>"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50";var Bg=cva(sd(),{variants:{variant:{default:`${xi.primary} shadow-sm`,destructive:"bg-red-500 text-white hover:bg-red-600 active:bg-red-700 dark:bg-red-600 dark:hover:bg-red-500 dark:active:bg-red-700 shadow-sm",outline:`${xi.outline} shadow-sm`,secondary:"bg-gray-200 text-gray-700 hover:bg-gray-300 active:bg-gray-400 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600 dark:active:bg-gray-500 shadow-sm",ghost:xi.ghost,link:"text-blue-600 dark:text-blue-400 underline-offset-4 hover:underline hover:text-blue-700 dark:hover:text-blue-300 active:text-blue-800 dark:active:text-blue-200","chat-tool":"bg-[var(--orbai-surface-2)] border border-[var(--orbai-border-soft)] text-[var(--orbai-text-2)] hover:bg-[var(--orbai-surface-3)] hover:border-[var(--orbai-border-strong)] hover:text-[var(--orbai-text-1)] active:scale-95 transition-all duration-200","chat-send":`bg-[${pl.primary}] hover:bg-[${pl.primaryHover}] text-white border border-[var(--orbai-border-strong)] shadow-[var(--orbai-shadow-soft-sm)] hover:shadow-[var(--orbai-shadow-soft-md)] active:scale-95 transition-all duration-200`,"chat-stop":"bg-red-500 hover:bg-red-600 border border-[var(--orbai-border-strong)] shadow-[var(--orbai-shadow-soft-sm)] hover:shadow-[var(--orbai-shadow-soft-md)] active:scale-95 text-white transition-all duration-200","chat-disabled":"cursor-not-allowed opacity-50 bg-[var(--orbai-surface-2)] border border-[var(--orbai-border-soft)] text-[var(--orbai-muted)]"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10","chat-sm":"h-8 w-8 rounded-full","chat-md":"h-10 w-10 rounded-full","chat-lg":"h-12 w-12 rounded-full"},rounded:{none:wn.none,sm:wn.sm,md:wn.md,full:wn.full}},defaultVariants:{variant:"default",size:"default",rounded:"md"}}),ul=ct.forwardRef(({className:e,variant:t,size:o,asChild:a=false,...r},n)=>jsx(a?Slot:"button",{className:mo(Bg({variant:t,size:o,className:e})),ref:n,...r}));ul.displayName="Button";var Eg={"common.cancel":"Cancel","common.save":"Save","common.ok":"OK","common.done":"Done","common.search":"Search","common.none":"None","common.all":"All","common.noData":"No data","common.copy":"Copy","common.delete":"Delete","common.loading":"Loading...","header.searchPlaceholder":"Ask me...","header.theme.system":"Theme: System","header.theme.dark":"Theme: Dark","header.theme.light":"Theme: Light","header.menu.setting":"Setting","header.menu.logout":"Logout","navigation.expand":"Expand navigation","navigation.collapse":"Collapse navigation","navigation.searchPlaceholder":"Search menu...","navigation.noMatch":"No matching menu items","navigation.noAccessibleApp":"No accessible applications","navigation.noItems":"No items to display","navigation.expandView":"Expand {title}","table.toolbar.searchPlaceholder":"Search...","table.title.default":"Data Table","table.toolbar.groupBy":"Group By","table.toolbar.summary":"Summary","table.toolbar.columns":"Columns","table.toolbar.export":"Export","table.toolbar.itemsPerPage":"Items per page:","table.toolbar.pageOf":"Page {current} of {total}","table.toolbar.newItem":"New Item","table.toolbar.editItem":"Edit Item","table.toolbar.deleteItem":"Delete Item","table.toolbar.graphicReport":"Graphic Report","table.toolbar.saveLayout":"Save Layout","table.menu.groupBy":"Group By","table.menu.clearAll":"Clear All","table.menu.visibleColumns":"Visible Columns","table.menu.showSummaryRow":"Show Summary Row","table.menu.noNumericColumns":"No numeric columns","table.group.expandAll":"Expand All Groups","table.group.collapseAll":"Collapse All Groups","table.mobile.notImplemented":"Mobile View Not Implemented","pivot.title.default":"Pivot Table Builder","pivot.subtitle.default":"Drag fields to configure the pivot table.","pivot.empty":"Drag at least one field into Values to render the pivot result.","pivot.records":"Records","pivot.afterFilter":"After filter","pivot.grandTotal":"Grand Total","pivot.resultLabel":"Result","pivot.valueLabel":"Value","pivot.table.dimensions":"Dimensions","pivot.config.title":"Configuration","pivot.fieldList":"Field List","pivot.availableDimensions":"Available dimensions","pivot.allFieldsInUse":"All fields are in use.","pivot.zone.rows":"Rows","pivot.zone.columns":"Columns","pivot.zone.filters":"Filters","pivot.zone.values":"Values","pivot.hint.rows":"Drag fields here to build row hierarchy","pivot.hint.columns":"Drag fields here to build column hierarchy","pivot.hint.filters":"Drag fields here for report filters","pivot.hint.values":"Drag numeric fields here for aggregation","pivot.clearArea":"Clear area","pivot.filter.na":"N/A","pivot.filter.noValues":"No values","pivot.filter.noneSelected":"None selected","pivot.filter.allValues":"All values","pivot.filter.selectedCount":"{selected} / {total} selected","pivot.filter.selectAll":"Select All","pivot.filter.deselectAll":"Deselect All","pivot.filter.noResults":"No results","pivot.collapse.ariaExpand":"Expand configuration area","pivot.collapse.ariaCollapse":"Collapse configuration area","pivot.agg.sum":"Sum","pivot.agg.count":"Count","pivot.agg.avg":"Average","pivot.agg.min":"Min","pivot.agg.max":"Max","pivot.preset.selectPlaceholder":"Select preset","pivot.preset.save":"Save preset","pivot.preset.delete":"Delete preset","pivot.preset.saveDialogTitle":"Save current preset","pivot.preset.nameLabel":"Preset name","pivot.preset.defaultName":"Preset {index}","pivot.table.sectionTitle":"Pivot Result","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"Expand pivot result","pivot.table.collapse.ariaCollapse":"Collapse pivot result","pivot.chart.title":"Pivot Chart","pivot.chart.subtitle":"Map one dimension and up to two measures into a compact chart.","pivot.chart.subtitleReady":"{dimension} by {measure}","pivot.chart.emptyNoDimension":"Add at least one row or column field to render the chart.","pivot.chart.emptyNoValue":"Add at least one value field to render the chart.","pivot.chart.emptyNoData":"No data available for the current chart selection.","pivot.chart.dimension":"Dimension","pivot.chart.primaryMeasure":"Measure","pivot.chart.secondaryMeasure":"Compare measure","pivot.chart.chartType":"Chart type","pivot.chart.style.barVertical":"Vertical bars","pivot.chart.style.barHorizontal":"Horizontal bars","pivot.chart.style.line":"Line","pivot.chart.style.scatter":"Scatter","pivot.chart.collapse.ariaExpand":"Expand chart area","pivot.chart.collapse.ariaCollapse":"Collapse chart area","smartFilter.adaptFilters":"Adapt Filters","smartFilter.addFilters":"Add Filters","smartFilter.go":"Go","smartFilter.visibleFilters":"Visible Filters","smartFilter.searchPlaceholder":"Search...","smartFilter.noOptionsFound":"No options found","smartFilter.min":"Min","smartFilter.max":"Max","smartFilter.minMaxPlaceholder":"Min - Max","smartFilter.operator.equals":"Equals","smartFilter.operator.contains":"Contains","smartFilter.operator.notContains":"Does Not Contain","smartFilter.operator.wildcard":"Wildcard Search","smartFilter.operator.notEquals":"Not Equals","smartFilter.operator.greaterThan":"Greater Than","smartFilter.operator.lessThan":"Less Than","smartFilter.operator.greaterOrEqual":"Greater Than or Equal","smartFilter.operator.lessOrEqual":"Less Than or Equal","smartFilter.operator.between":"Between","variant.noOptions":"No options","variant.defaultSuffix":"Default","variant.selectVariant":"Select Variant","variant.saveView":"Save View","variant.newVariant":"New Variant","variant.viewName":"View Name","variant.setDefault":"Set as Default","variant.publicAllUsers":"Public (All Users)","variant.toast.fetchFailed":"Failed to load variants","variant.toast.saveFailed":"Failed to save variant","variant.toast.saveSuccess":"Variant saved successfully","variant.toast.deleteFailed":"Failed to delete variant","variant.toast.deleteSuccess":"Variant deleted successfully","variant.toast.defaultFailed":"Failed to update default variant","variant.toast.defaultSuccess":"Default variant updated","layout.saveLayout":"Save Layout","layout.layoutOptions":"Layout Options","layout.selectLayout":"Select Layout","layout.saveCurrentLayout":"Save Current Layout...","layout.noSavedLayouts":"No saved layouts","layout.removeDefault":"Remove Default","layout.setAsDefault":"Set as Default","layout.layoutName":"Layout Name","layout.layoutDescription":"Description","layout.layoutNameHelper":"e.g., 'Compact View'","layout.warningOverwrite":"Warning: Existing layout will be overwritten","layout.useAsDefault":"Use as Default Layout","layout.publicAllUsers":"Public (Visible to all users)","layout.toast.loadFallback":"Failed to load layouts from backend, fallback to local storage","layout.toast.saveSuccess":"Layout saved successfully","layout.toast.saveLocalSuccess":"Layout saved to local storage","layout.toast.backendUnavailableSavedLocal":"Backend unavailable, saved to local storage","layout.toast.deleteSuccess":"Layout deleted successfully","layout.toast.deleteLocalSuccess":"Layout deleted from local storage","layout.toast.backendUnavailableDeletedLocal":"Backend unavailable, deleted from local storage","layout.toast.defaultSuccess":"Default layout set","layout.toast.defaultLocalSuccess":"Default layout set in local storage","layout.toast.backendUnavailableDefaultLocal":"Backend unavailable, default saved to local storage","dateRange.label":"Date Range","dateRange.startDate":"Start Date","dateRange.endDate":"End Date","dateRange.select":"Select...","dateRange.today":"Today","dateRange.thisWeek":"This Week","dateRange.thisMonth":"This Month","graph.records":"{count} records","graph.kpi.totalRecords":"Total Records","graph.kpi.totalReport":"Total Report","graph.kpi.totalBillable":"Total Billable","graph.kpi.efficiency":"Efficiency","graph.kpi.amount":"Amount","graph.kpi.flagged":"Flagged","graph.chart.billable.title":"Billable by Dimension","graph.chart.billable.subtitle":"Top values by billable hours","graph.chart.efficiency.title":"Efficiency by Person","graph.chart.efficiency.subtitle":"Lowest efficiency first","graph.chart.status.title":"Status Distribution","graph.chart.status.subtitle":"Record ratio by status","graph.dataBody":"Data Body","graph.reportTitle":"Graphic Report","graph.unassigned":"Unassigned","graph.column.reportHours":"Report Hours","graph.column.billableHours":"Billable Hours","detail.searchAi.placeholder":"Search fields, or ask AI if no match...","detail.searchAi.matches":"{count} matches found","detail.searchAi.noMatch":"No matching field found.","detail.searchAi.autoAiFallback":"No direct match. Triggering AI analysis...","detail.searchAi.aiResultTitle":"AI Insight","detail.table.title":"Related Records","kanban.empty":"Drop cards here","kanban.bucket.limit":"Limit","kanban.bucket.dropHere":"Release to move into this bucket","kanban.card.progress":"Progress","kanban.card.openDetail":"Open Detail","kanban.priority.critical":"Critical","kanban.priority.high":"High","kanban.priority.medium":"Medium","kanban.priority.low":"Low","quickCreate.newItem":"New Item","quickCreate.createWithTitle":"Create {title}","quickEdit.editWithTitle":"Edit {title}","quickDelete.confirmTitle":"Confirm Delete","quickDelete.confirmMessageSingle":"Are you sure you want to delete the selected record?","quickDelete.confirmMessageMultiple":"Are you sure you want to delete {count} selected records?","messageBox.confirm":"OK","messageBox.cancel":"Cancel"},Lg={"common.cancel":"\u53D6\u6D88","common.save":"\u4FDD\u5B58","common.ok":"\u786E\u5B9A","common.done":"\u5B8C\u6210","common.search":"\u641C\u7D22","common.none":"\u65E0","common.all":"\u5168\u90E8","common.noData":"\u6682\u65E0\u6570\u636E","common.copy":"\u590D\u5236","common.delete":"\u5220\u9664","common.loading":"\u52A0\u8F7D\u4E2D...","header.searchPlaceholder":"\u95EE\u6211\u70B9\u4EC0\u4E48...","header.theme.system":"\u4E3B\u9898\uFF1A\u8DDF\u968F\u7CFB\u7EDF","header.theme.dark":"\u4E3B\u9898\uFF1A\u6DF1\u8272","header.theme.light":"\u4E3B\u9898\uFF1A\u6D45\u8272","header.menu.setting":"\u8BBE\u7F6E","header.menu.logout":"\u6CE8\u9500","navigation.expand":"\u5C55\u5F00\u5BFC\u822A","navigation.collapse":"\u6298\u53E0\u5BFC\u822A","navigation.searchPlaceholder":"\u641C\u7D22\u83DC\u5355...","navigation.noMatch":"\u672A\u627E\u5230\u5339\u914D\u7684\u83DC\u5355\u9879","navigation.noAccessibleApp":"\u6682\u65E0\u53EF\u8BBF\u95EE\u7684\u5E94\u7528","navigation.noItems":"\u6682\u65E0\u53EF\u663E\u793A\u9879","navigation.expandView":"\u5C55\u5F00\u67E5\u770B {title}","table.toolbar.searchPlaceholder":"\u641C\u7D22...","table.title.default":"\u6570\u636E\u8868","table.toolbar.groupBy":"\u5206\u7EC4","table.toolbar.summary":"\u6C47\u603B","table.toolbar.columns":"\u5217","table.toolbar.export":"\u5BFC\u51FA","table.toolbar.itemsPerPage":"\u6BCF\u9875\u6761\u6570\uFF1A","table.toolbar.pageOf":"\u7B2C {current} / {total} \u9875","table.toolbar.newItem":"\u65B0\u5EFA\u6761\u76EE","table.toolbar.editItem":"\u7F16\u8F91\u6761\u76EE","table.toolbar.deleteItem":"\u5220\u9664\u6761\u76EE","table.toolbar.graphicReport":"\u56FE\u8868\u62A5\u8868","table.toolbar.saveLayout":"\u4FDD\u5B58\u5E03\u5C40","table.menu.groupBy":"\u5206\u7EC4","table.menu.clearAll":"\u6E05\u7A7A","table.menu.visibleColumns":"\u53EF\u89C1\u5217","table.menu.showSummaryRow":"\u663E\u793A\u6C47\u603B\u884C","table.menu.noNumericColumns":"\u6CA1\u6709\u6570\u503C\u5217","table.group.expandAll":"\u5C55\u5F00\u5168\u90E8\u5206\u7EC4","table.group.collapseAll":"\u6298\u53E0\u5168\u90E8\u5206\u7EC4","table.mobile.notImplemented":"\u79FB\u52A8\u7AEF\u89C6\u56FE\u6682\u672A\u5B9E\u73B0","pivot.title.default":"\u6570\u636E\u900F\u89C6\u8868","pivot.subtitle.default":"\u62D6\u62FD\u5B57\u6BB5\u4EE5\u914D\u7F6E\u900F\u89C6\u8868\u3002","pivot.empty":"\u8BF7\u81F3\u5C11\u62D6\u5165\u4E00\u4E2A\u503C\u5B57\u6BB5\u540E\u518D\u67E5\u770B\u900F\u89C6\u7ED3\u679C\u3002","pivot.records":"\u8BB0\u5F55\u6570","pivot.afterFilter":"\u7B5B\u9009\u540E","pivot.grandTotal":"\u603B\u8BA1","pivot.resultLabel":"\u7ED3\u679C","pivot.valueLabel":"\u503C","pivot.table.dimensions":"\u7EF4\u5EA6","pivot.config.title":"\u5E03\u5C40\u914D\u7F6E","pivot.fieldList":"\u5B57\u6BB5\u5217\u8868","pivot.availableDimensions":"\u53EF\u7528\u7EF4\u5EA6","pivot.allFieldsInUse":"\u6240\u6709\u5B57\u6BB5\u90FD\u5DF2\u4F7F\u7528\u3002","pivot.zone.rows":"\u884C","pivot.zone.columns":"\u5217","pivot.zone.filters":"\u7B5B\u9009","pivot.zone.values":"\u503C","pivot.hint.rows":"\u5C06\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u6784\u5EFA\u884C\u5C42\u7EA7","pivot.hint.columns":"\u5C06\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u6784\u5EFA\u5217\u5C42\u7EA7","pivot.hint.filters":"\u5C06\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u4F5C\u4E3A\u62A5\u8868\u7B5B\u9009","pivot.hint.values":"\u5C06\u6570\u503C\u5B57\u6BB5\u62D6\u5230\u8FD9\u91CC\u8FDB\u884C\u805A\u5408","pivot.clearArea":"\u6E05\u7A7A\u533A\u57DF","pivot.filter.na":"\u4E0D\u53EF\u7528","pivot.filter.noValues":"\u65E0\u53EF\u9009\u503C","pivot.filter.noneSelected":"\u672A\u9009\u62E9","pivot.filter.allValues":"\u5168\u90E8\u503C","pivot.filter.selectedCount":"\u5DF2\u9009 {selected} / {total}","pivot.filter.selectAll":"\u5168\u9009","pivot.filter.deselectAll":"\u53D6\u6D88\u5168\u9009","pivot.filter.noResults":"\u65E0\u5339\u914D\u7ED3\u679C","pivot.collapse.ariaExpand":"\u5C55\u5F00\u914D\u7F6E\u533A\u57DF","pivot.collapse.ariaCollapse":"\u6298\u53E0\u914D\u7F6E\u533A\u57DF","pivot.agg.sum":"\u6C42\u548C","pivot.agg.count":"\u8BA1\u6570","pivot.agg.avg":"\u5E73\u5747\u503C","pivot.agg.min":"\u6700\u5C0F\u503C","pivot.agg.max":"\u6700\u5927\u503C","pivot.preset.selectPlaceholder":"\u9009\u62E9\u65B9\u6848","pivot.preset.save":"\u4FDD\u5B58\u65B9\u6848","pivot.preset.delete":"\u5220\u9664\u65B9\u6848","pivot.preset.saveDialogTitle":"\u4FDD\u5B58\u5F53\u524D\u65B9\u6848","pivot.preset.nameLabel":"\u65B9\u6848\u540D\u79F0","pivot.preset.defaultName":"\u65B9\u6848 {index}","pivot.table.sectionTitle":"\u900F\u89C6\u7ED3\u679C","pivot.table.expandRowsAll":"\u884C\u5168\u90E8\u6253\u5F00","pivot.table.collapseRowsAll":"\u884C\u5168\u90E8\u6298\u53E0","pivot.table.expandColumnsAll":"\u5217\u5168\u90E8\u6253\u5F00","pivot.table.collapseColumnsAll":"\u5217\u5168\u90E8\u6298\u53E0","pivot.table.collapse.ariaExpand":"\u5C55\u5F00\u900F\u89C6\u7ED3\u679C","pivot.table.collapse.ariaCollapse":"\u6298\u53E0\u900F\u89C6\u7ED3\u679C","pivot.chart.title":"\u900F\u89C6\u56FE\u8868","pivot.chart.subtitle":"\u5C06\u4E00\u4E2A\u7EF4\u5EA6\u4E0E\u6700\u591A\u4E24\u4E2A\u5EA6\u91CF\u6620\u5C04\u4E3A\u7D27\u51D1\u56FE\u8868\u3002","pivot.chart.subtitleReady":"{dimension} \xB7 {measure}","pivot.chart.emptyNoDimension":"\u8BF7\u81F3\u5C11\u653E\u5165\u4E00\u4E2A\u884C\u6216\u5217\u5B57\u6BB5\u540E\u518D\u67E5\u770B\u56FE\u8868\u3002","pivot.chart.emptyNoValue":"\u8BF7\u81F3\u5C11\u653E\u5165\u4E00\u4E2A\u503C\u5B57\u6BB5\u540E\u518D\u67E5\u770B\u56FE\u8868\u3002","pivot.chart.emptyNoData":"\u5F53\u524D\u56FE\u8868\u9009\u62E9\u4E0B\u6682\u65E0\u53EF\u5C55\u793A\u6570\u636E\u3002","pivot.chart.dimension":"\u56FE\u8868\u7EF4\u5EA6","pivot.chart.primaryMeasure":"\u4E3B\u5EA6\u91CF","pivot.chart.secondaryMeasure":"\u5BF9\u6BD4\u5EA6\u91CF","pivot.chart.chartType":"\u56FE\u8868\u7C7B\u578B","pivot.chart.style.barVertical":"\u7EB5\u5411\u67F1\u72B6\u56FE","pivot.chart.style.barHorizontal":"\u6A2A\u5411\u67F1\u72B6\u56FE","pivot.chart.style.line":"\u6298\u7EBF\u56FE","pivot.chart.style.scatter":"\u6563\u70B9\u56FE","pivot.chart.collapse.ariaExpand":"\u5C55\u5F00\u56FE\u8868\u533A\u57DF","pivot.chart.collapse.ariaCollapse":"\u6298\u53E0\u56FE\u8868\u533A\u57DF","smartFilter.adaptFilters":"\u7B5B\u9009\u8BBE\u7F6E","smartFilter.addFilters":"\u6DFB\u52A0\u7B5B\u9009","smartFilter.go":"\u6267\u884C","smartFilter.visibleFilters":"\u53EF\u89C1\u7B5B\u9009\u9879","smartFilter.searchPlaceholder":"\u641C\u7D22...","smartFilter.noOptionsFound":"\u672A\u627E\u5230\u9009\u9879","smartFilter.min":"\u6700\u5C0F\u503C","smartFilter.max":"\u6700\u5927\u503C","smartFilter.minMaxPlaceholder":"\u6700\u5C0F\u503C - \u6700\u5927\u503C","smartFilter.operator.equals":"\u7B49\u4E8E","smartFilter.operator.contains":"\u5305\u542B","smartFilter.operator.notContains":"\u4E0D\u5305\u542B","smartFilter.operator.wildcard":"\u901A\u914D\u7B26\u641C\u7D22","smartFilter.operator.notEquals":"\u4E0D\u7B49\u4E8E","smartFilter.operator.greaterThan":"\u5927\u4E8E","smartFilter.operator.lessThan":"\u5C0F\u4E8E","smartFilter.operator.greaterOrEqual":"\u5927\u4E8E\u7B49\u4E8E","smartFilter.operator.lessOrEqual":"\u5C0F\u4E8E\u7B49\u4E8E","smartFilter.operator.between":"\u533A\u95F4","variant.noOptions":"\u65E0\u9009\u9879","variant.defaultSuffix":"\u9ED8\u8BA4","variant.selectVariant":"\u9009\u62E9\u89C6\u56FE","variant.saveView":"\u4FDD\u5B58\u89C6\u56FE","variant.newVariant":"\u65B0\u89C6\u56FE","variant.viewName":"\u89C6\u56FE\u540D\u79F0","variant.setDefault":"\u8BBE\u4E3A\u9ED8\u8BA4","variant.publicAllUsers":"\u516C\u5F00\uFF08\u6240\u6709\u7528\u6237\uFF09","variant.toast.fetchFailed":"\u52A0\u8F7D\u89C6\u56FE\u5931\u8D25","variant.toast.saveFailed":"\u4FDD\u5B58\u89C6\u56FE\u5931\u8D25","variant.toast.saveSuccess":"\u89C6\u56FE\u4FDD\u5B58\u6210\u529F","variant.toast.deleteFailed":"\u5220\u9664\u89C6\u56FE\u5931\u8D25","variant.toast.deleteSuccess":"\u89C6\u56FE\u5220\u9664\u6210\u529F","variant.toast.defaultFailed":"\u66F4\u65B0\u9ED8\u8BA4\u89C6\u56FE\u5931\u8D25","variant.toast.defaultSuccess":"\u9ED8\u8BA4\u89C6\u56FE\u5DF2\u66F4\u65B0","layout.saveLayout":"\u4FDD\u5B58\u5E03\u5C40","layout.layoutOptions":"\u5E03\u5C40\u9009\u9879","layout.selectLayout":"\u9009\u62E9\u5E03\u5C40","layout.saveCurrentLayout":"\u4FDD\u5B58\u5F53\u524D\u5E03\u5C40...","layout.noSavedLayouts":"\u6682\u65E0\u5DF2\u4FDD\u5B58\u5E03\u5C40","layout.removeDefault":"\u53D6\u6D88\u9ED8\u8BA4","layout.setAsDefault":"\u8BBE\u4E3A\u9ED8\u8BA4","layout.layoutName":"\u5E03\u5C40\u540D\u79F0","layout.layoutDescription":"\u63CF\u8FF0","layout.layoutNameHelper":"\u4F8B\u5982\uFF1A\u7D27\u51D1\u89C6\u56FE","layout.warningOverwrite":"\u8B66\u544A\uFF1A\u5C06\u8986\u76D6\u540C\u540D\u5E03\u5C40","layout.useAsDefault":"\u7528\u4F5C\u9ED8\u8BA4\u5E03\u5C40","layout.publicAllUsers":"\u516C\u5F00\uFF08\u6240\u6709\u7528\u6237\u53EF\u89C1\uFF09","layout.toast.loadFallback":"\u540E\u7AEF\u52A0\u8F7D\u5E03\u5C40\u5931\u8D25\uFF0C\u5DF2\u56DE\u9000\u5230\u672C\u5730\u5B58\u50A8","layout.toast.saveSuccess":"\u5E03\u5C40\u4FDD\u5B58\u6210\u529F","layout.toast.saveLocalSuccess":"\u5E03\u5C40\u5DF2\u4FDD\u5B58\u5230\u672C\u5730\u5B58\u50A8","layout.toast.backendUnavailableSavedLocal":"\u540E\u7AEF\u4E0D\u53EF\u7528\uFF0C\u5DF2\u4FDD\u5B58\u5230\u672C\u5730\u5B58\u50A8","layout.toast.deleteSuccess":"\u5E03\u5C40\u5220\u9664\u6210\u529F","layout.toast.deleteLocalSuccess":"\u5E03\u5C40\u5DF2\u4ECE\u672C\u5730\u5B58\u50A8\u5220\u9664","layout.toast.backendUnavailableDeletedLocal":"\u540E\u7AEF\u4E0D\u53EF\u7528\uFF0C\u5DF2\u4ECE\u672C\u5730\u5B58\u50A8\u5220\u9664","layout.toast.defaultSuccess":"\u9ED8\u8BA4\u5E03\u5C40\u5DF2\u8BBE\u7F6E","layout.toast.defaultLocalSuccess":"\u9ED8\u8BA4\u5E03\u5C40\u5DF2\u5728\u672C\u5730\u5B58\u50A8\u8BBE\u7F6E","layout.toast.backendUnavailableDefaultLocal":"\u540E\u7AEF\u4E0D\u53EF\u7528\uFF0C\u9ED8\u8BA4\u5E03\u5C40\u5DF2\u4FDD\u5B58\u5230\u672C\u5730\u5B58\u50A8","dateRange.label":"\u65E5\u671F\u8303\u56F4","dateRange.startDate":"\u5F00\u59CB\u65E5\u671F","dateRange.endDate":"\u7ED3\u675F\u65E5\u671F","dateRange.select":"\u8BF7\u9009\u62E9...","dateRange.today":"\u4ECA\u5929","dateRange.thisWeek":"\u672C\u5468","dateRange.thisMonth":"\u672C\u6708","graph.records":"{count} \u6761\u8BB0\u5F55","graph.kpi.totalRecords":"\u603B\u8BB0\u5F55\u6570","graph.kpi.totalReport":"\u603B\u7533\u62A5\u5DE5\u65F6","graph.kpi.totalBillable":"\u603B\u53EF\u8BA1\u8D39\u5DE5\u65F6","graph.kpi.efficiency":"\u6548\u7387","graph.kpi.amount":"\u91D1\u989D","graph.kpi.flagged":"\u6807\u8BB0","graph.chart.billable.title":"\u7EF4\u5EA6\u8BA1\u8D39\u5DE5\u65F6","graph.chart.billable.subtitle":"\u6309\u53EF\u8BA1\u8D39\u5DE5\u65F6\u6392\u5E8F\u524D\u5217","graph.chart.efficiency.title":"\u4EBA\u5458\u6548\u7387","graph.chart.efficiency.subtitle":"\u6309\u6700\u4F4E\u6548\u7387\u4F18\u5148","graph.chart.status.title":"\u72B6\u6001\u5206\u5E03","graph.chart.status.subtitle":"\u6309\u72B6\u6001\u8BB0\u5F55\u5360\u6BD4","graph.dataBody":"\u6570\u636E\u660E\u7EC6","graph.reportTitle":"\u56FE\u8868\u62A5\u8868","graph.unassigned":"\u672A\u5206\u914D","graph.column.reportHours":"\u7533\u62A5\u5DE5\u65F6","graph.column.billableHours":"\u53EF\u8BA1\u8D39\u5DE5\u65F6","detail.searchAi.placeholder":"\u641C\u7D22\u5B57\u6BB5\uFF1B\u5982\u65E0\u7ED3\u679C\u5219\u81EA\u52A8\u89E6\u53D1 AI...","detail.searchAi.matches":"{count} \u6761\u5339\u914D\u7ED3\u679C","detail.searchAi.noMatch":"\u672A\u627E\u5230\u5339\u914D\u5B57\u6BB5\u3002","detail.searchAi.autoAiFallback":"\u672A\u547D\u4E2D\u5B57\u6BB5\uFF0C\u6B63\u5728\u89E6\u53D1 AI \u5206\u6790...","detail.searchAi.aiResultTitle":"AI \u5206\u6790\u7ED3\u679C","detail.table.title":"\u5173\u8054\u8BB0\u5F55","kanban.empty":"\u5C06\u5361\u7247\u62D6\u5230\u8FD9\u91CC","kanban.bucket.limit":"\u4E0A\u9650","kanban.bucket.dropHere":"\u91CA\u653E\u540E\u79FB\u52A8\u5230\u8BE5 bucket","kanban.card.progress":"\u8FDB\u5EA6","kanban.card.openDetail":"\u6253\u5F00\u8BE6\u60C5","kanban.priority.critical":"\u7D27\u6025","kanban.priority.high":"\u9AD8","kanban.priority.medium":"\u4E2D","kanban.priority.low":"\u4F4E","quickCreate.newItem":"\u65B0\u5EFA\u6761\u76EE","quickCreate.createWithTitle":"\u521B\u5EFA{title}","quickEdit.editWithTitle":"\u7F16\u8F91{title}","quickDelete.confirmTitle":"\u786E\u8BA4\u5220\u9664","quickDelete.confirmMessageSingle":"\u786E\u8BA4\u5220\u9664\u5F53\u524D\u9009\u4E2D\u8BB0\u5F55\u5417\uFF1F","quickDelete.confirmMessageMultiple":"\u786E\u8BA4\u5220\u9664\u5DF2\u9009\u4E2D\u7684 {count} \u6761\u8BB0\u5F55\u5417\uFF1F","messageBox.confirm":"\u786E\u5B9A","messageBox.cancel":"\u53D6\u6D88"},zg={"common.cancel":"Annuler","common.save":"Enregistrer","common.ok":"OK","common.done":"Terminer","common.search":"Rechercher","common.none":"Aucun","common.all":"Tout","common.noData":"Aucune donn\xE9e","common.copy":"Copier","common.delete":"Supprimer","common.loading":"Chargement...","header.searchPlaceholder":"Demandez-moi...","header.theme.system":"Th\xE8me : Syst\xE8me","header.theme.dark":"Th\xE8me : Sombre","header.theme.light":"Th\xE8me : Clair","header.menu.setting":"Param\xE8tres","header.menu.logout":"Se d\xE9connecter","navigation.expand":"D\xE9velopper la navigation","navigation.collapse":"R\xE9duire la navigation","navigation.searchPlaceholder":"Rechercher dans le menu...","navigation.noMatch":"Aucun \xE9l\xE9ment correspondant","navigation.noAccessibleApp":"Aucune application accessible","navigation.noItems":"Aucun \xE9l\xE9ment \xE0 afficher","navigation.expandView":"D\xE9velopper {title}","table.toolbar.searchPlaceholder":"Rechercher...","table.title.default":"Tableau de donn\xE9es","table.toolbar.groupBy":"Grouper","table.toolbar.summary":"R\xE9sum\xE9","table.toolbar.columns":"Colonnes","table.toolbar.export":"Exporter","table.toolbar.itemsPerPage":"Lignes par page :","table.toolbar.pageOf":"Page {current} sur {total}","table.toolbar.newItem":"Nouvel \xE9l\xE9ment","table.toolbar.editItem":"Modifier l'\xE9l\xE9ment","table.toolbar.deleteItem":"Supprimer l'\xE9l\xE9ment","table.toolbar.graphicReport":"Rapport graphique","table.toolbar.saveLayout":"Enregistrer la vue","table.menu.groupBy":"Grouper","table.menu.clearAll":"Tout effacer","table.menu.visibleColumns":"Colonnes visibles","table.menu.showSummaryRow":"Afficher la ligne de r\xE9sum\xE9","table.menu.noNumericColumns":"Aucune colonne num\xE9rique","table.group.expandAll":"D\xE9velopper tous les groupes","table.group.collapseAll":"R\xE9duire tous les groupes","table.mobile.notImplemented":"Vue mobile non impl\xE9ment\xE9e","pivot.title.default":"Tableau crois\xE9 dynamique","pivot.subtitle.default":"Faites glisser les champs pour configurer le tableau crois\xE9.","pivot.empty":"Ajoutez au moins un champ de valeur pour afficher le r\xE9sultat.","pivot.records":"Enregistrements","pivot.afterFilter":"Apr\xE8s filtre","pivot.grandTotal":"Total g\xE9n\xE9ral","pivot.resultLabel":"R\xE9sultat","pivot.valueLabel":"Valeur","pivot.table.dimensions":"Dimensions","pivot.config.title":"Configuration","pivot.fieldList":"Liste des champs","pivot.availableDimensions":"Dimensions disponibles","pivot.allFieldsInUse":"Tous les champs sont d\xE9j\xE0 utilis\xE9s.","pivot.zone.rows":"Lignes","pivot.zone.columns":"Colonnes","pivot.zone.filters":"Filtres","pivot.zone.values":"Valeurs","pivot.hint.rows":"D\xE9posez les champs ici pour construire la hi\xE9rarchie des lignes","pivot.hint.columns":"D\xE9posez les champs ici pour construire la hi\xE9rarchie des colonnes","pivot.hint.filters":"D\xE9posez les champs ici pour les filtres du rapport","pivot.hint.values":"D\xE9posez les champs num\xE9riques ici pour les agr\xE9gations","pivot.clearArea":"Vider la zone","pivot.filter.na":"N/A","pivot.filter.noValues":"Aucune valeur","pivot.filter.noneSelected":"Aucune s\xE9lection","pivot.filter.allValues":"Toutes les valeurs","pivot.filter.selectedCount":"{selected} / {total} s\xE9lectionn\xE9es","pivot.filter.selectAll":"Tout s\xE9lectionner","pivot.filter.deselectAll":"Tout d\xE9s\xE9lectionner","pivot.filter.noResults":"Aucun r\xE9sultat","pivot.collapse.ariaExpand":"D\xE9velopper la zone de configuration","pivot.collapse.ariaCollapse":"R\xE9duire la zone de configuration","pivot.agg.sum":"Somme","pivot.agg.count":"Compte","pivot.agg.avg":"Moyenne","pivot.agg.min":"Min","pivot.agg.max":"Max","pivot.preset.selectPlaceholder":"S\xE9lectionner un preset","pivot.preset.save":"Enregistrer le preset","pivot.preset.delete":"Supprimer le preset","pivot.preset.saveDialogTitle":"Enregistrer le preset actuel","pivot.preset.nameLabel":"Nom du preset","pivot.preset.defaultName":"Preset {index}","pivot.table.sectionTitle":"R\xE9sultat du pivot","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"D\xE9velopper le r\xE9sultat du pivot","pivot.table.collapse.ariaCollapse":"R\xE9duire le r\xE9sultat du pivot","pivot.chart.title":"Graphique pivot","pivot.chart.subtitle":"Associez une dimension et jusqu\u2019\xE0 deux mesures dans un graphique compact.","pivot.chart.subtitleReady":"{dimension} par {measure}","pivot.chart.emptyNoDimension":"Ajoutez au moins un champ de ligne ou de colonne pour afficher le graphique.","pivot.chart.emptyNoValue":"Ajoutez au moins un champ de valeur pour afficher le graphique.","pivot.chart.emptyNoData":"Aucune donn\xE9e disponible pour la s\xE9lection actuelle du graphique.","pivot.chart.dimension":"Dimension","pivot.chart.primaryMeasure":"Mesure","pivot.chart.secondaryMeasure":"Mesure de comparaison","pivot.chart.chartType":"Type de graphique","pivot.chart.style.barVertical":"Barres verticales","pivot.chart.style.barHorizontal":"Barres horizontales","pivot.chart.style.line":"Ligne","pivot.chart.style.scatter":"Nuage de points","pivot.chart.collapse.ariaExpand":"D\xE9velopper la zone du graphique","pivot.chart.collapse.ariaCollapse":"R\xE9duire la zone du graphique","smartFilter.adaptFilters":"Adapter les filtres","smartFilter.addFilters":"Ajouter des filtres","smartFilter.go":"Ex\xE9cuter","smartFilter.visibleFilters":"Filtres visibles","smartFilter.searchPlaceholder":"Rechercher...","smartFilter.noOptionsFound":"Aucune option trouv\xE9e","smartFilter.min":"Min","smartFilter.max":"Max","smartFilter.minMaxPlaceholder":"Min - Max","smartFilter.operator.equals":"\xC9gal \xE0","smartFilter.operator.contains":"Contient","smartFilter.operator.notContains":"Ne contient pas","smartFilter.operator.wildcard":"Recherche g\xE9n\xE9rique","smartFilter.operator.notEquals":"Diff\xE9rent de","smartFilter.operator.greaterThan":"Sup\xE9rieur \xE0","smartFilter.operator.lessThan":"Inf\xE9rieur \xE0","smartFilter.operator.greaterOrEqual":"Sup\xE9rieur ou \xE9gal","smartFilter.operator.lessOrEqual":"Inf\xE9rieur ou \xE9gal","smartFilter.operator.between":"Entre","variant.noOptions":"Aucune option","variant.defaultSuffix":"Par d\xE9faut","variant.selectVariant":"S\xE9lectionner une vue","variant.saveView":"Enregistrer la vue","variant.newVariant":"Nouvelle vue","variant.viewName":"Nom de la vue","variant.setDefault":"D\xE9finir par d\xE9faut","variant.publicAllUsers":"Public (tous les utilisateurs)","variant.toast.fetchFailed":"\xC9chec du chargement des vues","variant.toast.saveFailed":"\xC9chec de l'enregistrement de la vue","variant.toast.saveSuccess":"Vue enregistr\xE9e avec succ\xE8s","variant.toast.deleteFailed":"\xC9chec de la suppression de la vue","variant.toast.deleteSuccess":"Vue supprim\xE9e avec succ\xE8s","variant.toast.defaultFailed":"\xC9chec de la mise \xE0 jour de la vue par d\xE9faut","variant.toast.defaultSuccess":"Vue par d\xE9faut mise \xE0 jour","layout.saveLayout":"Enregistrer la vue","layout.layoutOptions":"Options de vue","layout.selectLayout":"S\xE9lectionner une vue","layout.saveCurrentLayout":"Enregistrer la vue actuelle...","layout.noSavedLayouts":"Aucune vue enregistr\xE9e","layout.removeDefault":"Retirer le d\xE9faut","layout.setAsDefault":"D\xE9finir par d\xE9faut","layout.layoutName":"Nom de la vue","layout.layoutDescription":"Description","layout.layoutNameHelper":"ex. : Vue compacte","layout.warningOverwrite":"Attention : la vue existante sera \xE9cras\xE9e","layout.useAsDefault":"Utiliser comme vue par d\xE9faut","layout.publicAllUsers":"Public (visible par tous les utilisateurs)","layout.toast.loadFallback":"\xC9chec du chargement depuis le backend, bascule vers le stockage local","layout.toast.saveSuccess":"Vue enregistr\xE9e avec succ\xE8s","layout.toast.saveLocalSuccess":"Vue enregistr\xE9e dans le stockage local","layout.toast.backendUnavailableSavedLocal":"Backend indisponible, enregistr\xE9 en local","layout.toast.deleteSuccess":"Vue supprim\xE9e avec succ\xE8s","layout.toast.deleteLocalSuccess":"Vue supprim\xE9e du stockage local","layout.toast.backendUnavailableDeletedLocal":"Backend indisponible, supprim\xE9 en local","layout.toast.defaultSuccess":"Vue par d\xE9faut d\xE9finie","layout.toast.defaultLocalSuccess":"Vue par d\xE9faut d\xE9finie en local","layout.toast.backendUnavailableDefaultLocal":"Backend indisponible, d\xE9faut enregistr\xE9 en local","dateRange.label":"Plage de dates","dateRange.startDate":"Date de d\xE9but","dateRange.endDate":"Date de fin","dateRange.select":"S\xE9lectionner...","dateRange.today":"Aujourd'hui","dateRange.thisWeek":"Cette semaine","dateRange.thisMonth":"Ce mois-ci","graph.records":"{count} enregistrements","graph.kpi.totalRecords":"Total des enregistrements","graph.kpi.totalReport":"Total d\xE9clar\xE9","graph.kpi.totalBillable":"Total facturable","graph.kpi.efficiency":"Efficacit\xE9","graph.kpi.amount":"Montant","graph.kpi.flagged":"Signal\xE9","graph.chart.billable.title":"Facturable par dimension","graph.chart.billable.subtitle":"Top valeurs par heures facturables","graph.chart.efficiency.title":"Efficacit\xE9 par personne","graph.chart.efficiency.subtitle":"Efficacit\xE9 la plus faible en premier","graph.chart.status.title":"R\xE9partition des statuts","graph.chart.status.subtitle":"Ratio des enregistrements par statut","graph.dataBody":"Donn\xE9es","graph.reportTitle":"Rapport graphique","graph.unassigned":"Non attribu\xE9","graph.column.reportHours":"Heures d\xE9clar\xE9es","graph.column.billableHours":"Heures facturables","detail.searchAi.placeholder":"Rechercher des champs, ou interroger l\u2019IA en cas d\u2019absence de r\xE9sultat...","detail.searchAi.matches":"{count} correspondances trouv\xE9es","detail.searchAi.noMatch":"Aucun champ correspondant trouv\xE9.","detail.searchAi.autoAiFallback":"Aucune correspondance directe. Analyse IA en cours...","detail.searchAi.aiResultTitle":"Analyse IA","detail.table.title":"Enregistrements li\xE9s","kanban.empty":"D\xE9posez les cartes ici","kanban.bucket.limit":"Limite","kanban.bucket.dropHere":"Rel\xE2chez pour d\xE9placer dans cette colonne","kanban.card.progress":"Progression","kanban.card.openDetail":"Ouvrir le d\xE9tail","kanban.priority.critical":"Critique","kanban.priority.high":"\xC9lev\xE9e","kanban.priority.medium":"Moyenne","kanban.priority.low":"Faible","quickCreate.newItem":"Nouvel \xE9l\xE9ment","quickCreate.createWithTitle":"Cr\xE9er {title}","quickEdit.editWithTitle":"Modifier {title}","quickDelete.confirmTitle":"Confirmer la suppression","quickDelete.confirmMessageSingle":"Voulez-vous vraiment supprimer l\u2019enregistrement s\xE9lectionn\xE9 ?","quickDelete.confirmMessageMultiple":"Voulez-vous vraiment supprimer les {count} enregistrements s\xE9lectionn\xE9s ?","messageBox.confirm":"OK","messageBox.cancel":"Annuler"},Ng={"common.cancel":"Abbrechen","common.save":"Speichern","common.ok":"OK","common.done":"Fertig","common.search":"Suchen","common.none":"Keine","common.all":"Alle","common.noData":"Keine Daten","common.copy":"Kopieren","common.delete":"L\xF6schen","common.loading":"Wird geladen...","header.searchPlaceholder":"Frag mich...","header.theme.system":"Theme: System","header.theme.dark":"Theme: Dunkel","header.theme.light":"Theme: Hell","header.menu.setting":"Einstellungen","header.menu.logout":"Abmelden","navigation.expand":"Navigation erweitern","navigation.collapse":"Navigation einklappen","navigation.searchPlaceholder":"Men\xFC suchen...","navigation.noMatch":"Keine passenden Men\xFCeintr\xE4ge","navigation.noAccessibleApp":"Keine verf\xFCgbaren Anwendungen","navigation.noItems":"Keine Eintr\xE4ge vorhanden","navigation.expandView":"{title} aufklappen","table.toolbar.searchPlaceholder":"Suchen...","table.title.default":"Datentabelle","table.toolbar.groupBy":"Gruppieren","table.toolbar.summary":"Zusammenfassung","table.toolbar.columns":"Spalten","table.toolbar.export":"Export","table.toolbar.itemsPerPage":"Zeilen pro Seite:","table.toolbar.pageOf":"Seite {current} von {total}","table.toolbar.newItem":"Neuer Eintrag","table.toolbar.editItem":"Eintrag bearbeiten","table.toolbar.deleteItem":"Eintrag l\xF6schen","table.toolbar.graphicReport":"Grafikbericht","table.toolbar.saveLayout":"Layout speichern","table.menu.groupBy":"Gruppieren","table.menu.clearAll":"Alles l\xF6schen","table.menu.visibleColumns":"Sichtbare Spalten","table.menu.showSummaryRow":"Summenzeile anzeigen","table.menu.noNumericColumns":"Keine numerischen Spalten","table.group.expandAll":"Alle Gruppen aufklappen","table.group.collapseAll":"Alle Gruppen zuklappen","table.mobile.notImplemented":"Mobile Ansicht nicht implementiert","pivot.title.default":"Pivot-Tabelle","pivot.subtitle.default":"Ziehen Sie Felder, um die Pivot-Tabelle zu konfigurieren.","pivot.empty":"Ziehen Sie mindestens ein Wertefeld, um das Ergebnis anzuzeigen.","pivot.records":"Datens\xE4tze","pivot.afterFilter":"Nach Filter","pivot.grandTotal":"Gesamtsumme","pivot.resultLabel":"Ergebnis","pivot.valueLabel":"Wert","pivot.table.dimensions":"Dimensionen","pivot.config.title":"Konfiguration","pivot.fieldList":"Feldliste","pivot.availableDimensions":"Verf\xFCgbare Dimensionen","pivot.allFieldsInUse":"Alle Felder sind bereits verwendet.","pivot.zone.rows":"Zeilen","pivot.zone.columns":"Spalten","pivot.zone.filters":"Filter","pivot.zone.values":"Werte","pivot.hint.rows":"Felder hierhin ziehen, um die Zeilenhierarchie zu erstellen","pivot.hint.columns":"Felder hierhin ziehen, um die Spaltenhierarchie zu erstellen","pivot.hint.filters":"Felder hierhin ziehen f\xFCr Berichtsfilter","pivot.hint.values":"Numerische Felder hierhin ziehen f\xFCr Aggregation","pivot.clearArea":"Bereich leeren","pivot.filter.na":"N/V","pivot.filter.noValues":"Keine Werte","pivot.filter.noneSelected":"Nichts ausgew\xE4hlt","pivot.filter.allValues":"Alle Werte","pivot.filter.selectedCount":"{selected} / {total} ausgew\xE4hlt","pivot.filter.selectAll":"Alle ausw\xE4hlen","pivot.filter.deselectAll":"Alle abw\xE4hlen","pivot.filter.noResults":"Keine Ergebnisse","pivot.collapse.ariaExpand":"Konfigurationsbereich erweitern","pivot.collapse.ariaCollapse":"Konfigurationsbereich reduzieren","pivot.agg.sum":"Summe","pivot.agg.count":"Anzahl","pivot.agg.avg":"Durchschnitt","pivot.agg.min":"Min","pivot.agg.max":"Max","pivot.preset.selectPlaceholder":"Preset w\xE4hlen","pivot.preset.save":"Preset speichern","pivot.preset.delete":"Preset l\xF6schen","pivot.preset.saveDialogTitle":"Aktuelles Preset speichern","pivot.preset.nameLabel":"Preset-Name","pivot.preset.defaultName":"Preset {index}","pivot.table.sectionTitle":"Pivot-Ergebnis","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"Pivot-Ergebnis erweitern","pivot.table.collapse.ariaCollapse":"Pivot-Ergebnis reduzieren","pivot.chart.title":"Pivot-Diagramm","pivot.chart.subtitle":"Eine Dimension und bis zu zwei Kennzahlen in einem kompakten Diagramm abbilden.","pivot.chart.subtitleReady":"{dimension} nach {measure}","pivot.chart.emptyNoDimension":"F\xFCgen Sie mindestens ein Zeilen- oder Spaltenfeld hinzu, um das Diagramm anzuzeigen.","pivot.chart.emptyNoValue":"F\xFCgen Sie mindestens ein Wertefeld hinzu, um das Diagramm anzuzeigen.","pivot.chart.emptyNoData":"F\xFCr die aktuelle Diagrammauswahl sind keine Daten verf\xFCgbar.","pivot.chart.dimension":"Dimension","pivot.chart.primaryMeasure":"Kennzahl","pivot.chart.secondaryMeasure":"Vergleichskennzahl","pivot.chart.chartType":"Diagrammtyp","pivot.chart.style.barVertical":"Vertikale Balken","pivot.chart.style.barHorizontal":"Horizontale Balken","pivot.chart.style.line":"Linie","pivot.chart.style.scatter":"Streudiagramm","pivot.chart.collapse.ariaExpand":"Diagrammbereich erweitern","pivot.chart.collapse.ariaCollapse":"Diagrammbereich reduzieren","smartFilter.adaptFilters":"Filter anpassen","smartFilter.addFilters":"Filter hinzuf\xFCgen","smartFilter.go":"Los","smartFilter.visibleFilters":"Sichtbare Filter","smartFilter.searchPlaceholder":"Suchen...","smartFilter.noOptionsFound":"Keine Optionen gefunden","smartFilter.min":"Min","smartFilter.max":"Max","smartFilter.minMaxPlaceholder":"Min - Max","smartFilter.operator.equals":"Gleich","smartFilter.operator.contains":"Enth\xE4lt","smartFilter.operator.notContains":"Enth\xE4lt nicht","smartFilter.operator.wildcard":"Wildcard-Suche","smartFilter.operator.notEquals":"Ungleich","smartFilter.operator.greaterThan":"Gr\xF6\xDFer als","smartFilter.operator.lessThan":"Kleiner als","smartFilter.operator.greaterOrEqual":"Gr\xF6\xDFer gleich","smartFilter.operator.lessOrEqual":"Kleiner gleich","smartFilter.operator.between":"Zwischen","variant.noOptions":"Keine Optionen","variant.defaultSuffix":"Standard","variant.selectVariant":"Variante w\xE4hlen","variant.saveView":"Ansicht speichern","variant.newVariant":"Neue Variante","variant.viewName":"Ansichtsname","variant.setDefault":"Als Standard setzen","variant.publicAllUsers":"\xD6ffentlich (alle Benutzer)","variant.toast.fetchFailed":"Varianten konnten nicht geladen werden","variant.toast.saveFailed":"Variante konnte nicht gespeichert werden","variant.toast.saveSuccess":"Variante erfolgreich gespeichert","variant.toast.deleteFailed":"Variante konnte nicht gel\xF6scht werden","variant.toast.deleteSuccess":"Variante erfolgreich gel\xF6scht","variant.toast.defaultFailed":"Standardvariante konnte nicht aktualisiert werden","variant.toast.defaultSuccess":"Standardvariante aktualisiert","layout.saveLayout":"Layout speichern","layout.layoutOptions":"Layout-Optionen","layout.selectLayout":"Layout w\xE4hlen","layout.saveCurrentLayout":"Aktuelles Layout speichern...","layout.noSavedLayouts":"Keine gespeicherten Layouts","layout.removeDefault":"Standard entfernen","layout.setAsDefault":"Als Standard setzen","layout.layoutName":"Layoutname","layout.layoutDescription":"Beschreibung","layout.layoutNameHelper":"z. B. Kompaktansicht","layout.warningOverwrite":"Warnung: Vorhandenes Layout wird \xFCberschrieben","layout.useAsDefault":"Als Standardlayout verwenden","layout.publicAllUsers":"\xD6ffentlich (f\xFCr alle sichtbar)","layout.toast.loadFallback":"Layouts konnten nicht vom Backend geladen werden, Wechsel zu lokalem Speicher","layout.toast.saveSuccess":"Layout erfolgreich gespeichert","layout.toast.saveLocalSuccess":"Layout im lokalen Speicher gespeichert","layout.toast.backendUnavailableSavedLocal":"Backend nicht verf\xFCgbar, lokal gespeichert","layout.toast.deleteSuccess":"Layout erfolgreich gel\xF6scht","layout.toast.deleteLocalSuccess":"Layout aus lokalem Speicher gel\xF6scht","layout.toast.backendUnavailableDeletedLocal":"Backend nicht verf\xFCgbar, lokal gel\xF6scht","layout.toast.defaultSuccess":"Standardlayout gesetzt","layout.toast.defaultLocalSuccess":"Standardlayout lokal gesetzt","layout.toast.backendUnavailableDefaultLocal":"Backend nicht verf\xFCgbar, Standard lokal gespeichert","dateRange.label":"Datumsbereich","dateRange.startDate":"Startdatum","dateRange.endDate":"Enddatum","dateRange.select":"Ausw\xE4hlen...","dateRange.today":"Heute","dateRange.thisWeek":"Diese Woche","dateRange.thisMonth":"Diesen Monat","graph.records":"{count} Datens\xE4tze","graph.kpi.totalRecords":"Gesamt Datens\xE4tze","graph.kpi.totalReport":"Gesamt Report","graph.kpi.totalBillable":"Gesamt abrechenbar","graph.kpi.efficiency":"Effizienz","graph.kpi.amount":"Betrag","graph.kpi.flagged":"Markiert","graph.chart.billable.title":"Abrechenbar nach Dimension","graph.chart.billable.subtitle":"Top-Werte nach abrechenbaren Stunden","graph.chart.efficiency.title":"Effizienz pro Person","graph.chart.efficiency.subtitle":"Niedrigste Effizienz zuerst","graph.chart.status.title":"Statusverteilung","graph.chart.status.subtitle":"Anteil je Status","graph.dataBody":"Datentabelle","graph.reportTitle":"Grafikbericht","graph.unassigned":"Nicht zugewiesen","graph.column.reportHours":"Melde-Stunden","graph.column.billableHours":"Abrechenbare Stunden","detail.searchAi.placeholder":"Felder suchen, oder bei keinem Treffer die KI fragen...","detail.searchAi.matches":"{count} Treffer gefunden","detail.searchAi.noMatch":"Kein passendes Feld gefunden.","detail.searchAi.autoAiFallback":"Keine direkte \xDCbereinstimmung. KI-Analyse wird gestartet...","detail.searchAi.aiResultTitle":"KI-Ergebnis","detail.table.title":"Verkn\xFCpfte Eintr\xE4ge","kanban.empty":"Karten hier ablegen","kanban.bucket.limit":"Limit","kanban.bucket.dropHere":"Loslassen, um in diese Spalte zu verschieben","kanban.card.progress":"Fortschritt","kanban.card.openDetail":"Detail \xF6ffnen","kanban.priority.critical":"Kritisch","kanban.priority.high":"Hoch","kanban.priority.medium":"Mittel","kanban.priority.low":"Niedrig","quickCreate.newItem":"Neuer Eintrag","quickCreate.createWithTitle":"{title} erstellen","quickEdit.editWithTitle":"{title} bearbeiten","quickDelete.confirmTitle":"L\xF6schen best\xE4tigen","quickDelete.confirmMessageSingle":"M\xF6chten Sie den ausgew\xE4hlten Datensatz wirklich l\xF6schen?","quickDelete.confirmMessageMultiple":"M\xF6chten Sie die {count} ausgew\xE4hlten Datens\xE4tze wirklich l\xF6schen?","messageBox.confirm":"OK","messageBox.cancel":"Abbrechen"},Vg={"common.cancel":"\u30AD\u30E3\u30F3\u30BB\u30EB","common.save":"\u4FDD\u5B58","common.ok":"OK","common.done":"\u5B8C\u4E86","common.search":"\u691C\u7D22","common.none":"\u306A\u3057","common.all":"\u3059\u3079\u3066","common.noData":"\u30C7\u30FC\u30BF\u306A\u3057","common.copy":"\u30B3\u30D4\u30FC","common.delete":"\u524A\u9664","common.loading":"\u8AAD\u307F\u8FBC\u307F\u4E2D...","header.searchPlaceholder":"\u4F55\u304B\u805E\u3044\u3066\u304F\u3060\u3055\u3044...","header.theme.system":"\u30C6\u30FC\u30DE\uFF1A\u30B7\u30B9\u30C6\u30E0","header.theme.dark":"\u30C6\u30FC\u30DE\uFF1A\u30C0\u30FC\u30AF","header.theme.light":"\u30C6\u30FC\u30DE\uFF1A\u30E9\u30A4\u30C8","header.menu.setting":"\u8A2D\u5B9A","header.menu.logout":"\u30ED\u30B0\u30A2\u30A6\u30C8","navigation.expand":"\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u3092\u5C55\u958B","navigation.collapse":"\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3\u3092\u6298\u308A\u305F\u305F\u3080","navigation.searchPlaceholder":"\u30E1\u30CB\u30E5\u30FC\u3092\u691C\u7D22...","navigation.noMatch":"\u4E00\u81F4\u3059\u308B\u30E1\u30CB\u30E5\u30FC\u304C\u3042\u308A\u307E\u305B\u3093","navigation.noAccessibleApp":"\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30D7\u30EA\u304C\u3042\u308A\u307E\u305B\u3093","navigation.noItems":"\u8868\u793A\u3067\u304D\u308B\u9805\u76EE\u304C\u3042\u308A\u307E\u305B\u3093","navigation.expandView":"{title} \u3092\u5C55\u958B","table.toolbar.searchPlaceholder":"\u691C\u7D22...","table.title.default":"\u30C7\u30FC\u30BF\u30C6\u30FC\u30D6\u30EB","table.toolbar.groupBy":"\u30B0\u30EB\u30FC\u30D7\u5316","table.toolbar.summary":"\u96C6\u8A08","table.toolbar.columns":"\u5217","table.toolbar.export":"\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8","table.toolbar.itemsPerPage":"1\u30DA\u30FC\u30B8\u306E\u4EF6\u6570\uFF1A","table.toolbar.pageOf":"{current} / {total} \u30DA\u30FC\u30B8","table.toolbar.newItem":"\u65B0\u898F\u4F5C\u6210","table.toolbar.editItem":"\u7DE8\u96C6","table.toolbar.deleteItem":"\u524A\u9664","table.toolbar.graphicReport":"\u30B0\u30E9\u30D5\u30A3\u30C3\u30AF\u30EC\u30DD\u30FC\u30C8","table.toolbar.saveLayout":"\u30EC\u30A4\u30A2\u30A6\u30C8\u4FDD\u5B58","table.menu.groupBy":"\u30B0\u30EB\u30FC\u30D7\u5316","table.menu.clearAll":"\u3059\u3079\u3066\u30AF\u30EA\u30A2","table.menu.visibleColumns":"\u8868\u793A\u5217","table.menu.showSummaryRow":"\u96C6\u8A08\u884C\u3092\u8868\u793A","table.menu.noNumericColumns":"\u6570\u5024\u5217\u304C\u3042\u308A\u307E\u305B\u3093","table.group.expandAll":"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u5C55\u958B","table.group.collapseAll":"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u6298\u308A\u305F\u305F\u3080","table.mobile.notImplemented":"\u30E2\u30D0\u30A4\u30EB\u8868\u793A\u306F\u672A\u5B9F\u88C5\u3067\u3059","pivot.title.default":"\u30D4\u30DC\u30C3\u30C8\u30C6\u30FC\u30D6\u30EB","pivot.subtitle.default":"\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30D4\u30DC\u30C3\u30C8\u30C6\u30FC\u30D6\u30EB\u3092\u8A2D\u5B9A\u3057\u307E\u3059\u3002","pivot.empty":"\u7D50\u679C\u3092\u8868\u793A\u3059\u308B\u306B\u306F\u3001\u5024\u30A8\u30EA\u30A2\u306B\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002","pivot.records":"\u30EC\u30B3\u30FC\u30C9","pivot.afterFilter":"\u30D5\u30A3\u30EB\u30BF\u30FC\u5F8C","pivot.grandTotal":"\u7DCF\u8A08","pivot.resultLabel":"\u7D50\u679C","pivot.valueLabel":"\u5024","pivot.table.dimensions":"\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3","pivot.config.title":"\u8A2D\u5B9A","pivot.fieldList":"\u30D5\u30A3\u30FC\u30EB\u30C9\u4E00\u89A7","pivot.availableDimensions":"\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3","pivot.allFieldsInUse":"\u3059\u3079\u3066\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u304C\u4F7F\u7528\u4E2D\u3067\u3059\u3002","pivot.zone.rows":"\u884C","pivot.zone.columns":"\u5217","pivot.zone.filters":"\u30D5\u30A3\u30EB\u30BF\u30FC","pivot.zone.values":"\u5024","pivot.hint.rows":"\u3053\u3053\u306B\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u884C\u968E\u5C64\u3092\u4F5C\u6210","pivot.hint.columns":"\u3053\u3053\u306B\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u5217\u968E\u5C64\u3092\u4F5C\u6210","pivot.hint.filters":"\u3053\u3053\u306B\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30EC\u30DD\u30FC\u30C8\u30D5\u30A3\u30EB\u30BF\u30FC\u3092\u8A2D\u5B9A","pivot.hint.values":"\u3053\u3053\u306B\u6570\u5024\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u96C6\u8A08","pivot.clearArea":"\u30A8\u30EA\u30A2\u3092\u30AF\u30EA\u30A2","pivot.filter.na":"N/A","pivot.filter.noValues":"\u5024\u304C\u3042\u308A\u307E\u305B\u3093","pivot.filter.noneSelected":"\u672A\u9078\u629E","pivot.filter.allValues":"\u3059\u3079\u3066\u306E\u5024","pivot.filter.selectedCount":"{selected} / {total} \u3092\u9078\u629E","pivot.filter.selectAll":"\u3059\u3079\u3066\u9078\u629E","pivot.filter.deselectAll":"\u3059\u3079\u3066\u89E3\u9664","pivot.filter.noResults":"\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093","pivot.collapse.ariaExpand":"\u8A2D\u5B9A\u30A8\u30EA\u30A2\u3092\u5C55\u958B","pivot.collapse.ariaCollapse":"\u8A2D\u5B9A\u30A8\u30EA\u30A2\u3092\u6298\u308A\u305F\u305F\u3080","pivot.agg.sum":"\u5408\u8A08","pivot.agg.count":"\u4EF6\u6570","pivot.agg.avg":"\u5E73\u5747","pivot.agg.min":"\u6700\u5C0F","pivot.agg.max":"\u6700\u5927","pivot.preset.selectPlaceholder":"\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u9078\u629E","pivot.preset.save":"\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u4FDD\u5B58","pivot.preset.delete":"\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u524A\u9664","pivot.preset.saveDialogTitle":"\u73FE\u5728\u306E\u30D7\u30EA\u30BB\u30C3\u30C8\u3092\u4FDD\u5B58","pivot.preset.nameLabel":"\u30D7\u30EA\u30BB\u30C3\u30C8\u540D","pivot.preset.defaultName":"\u30D7\u30EA\u30BB\u30C3\u30C8 {index}","pivot.table.sectionTitle":"\u30D4\u30DC\u30C3\u30C8\u7D50\u679C","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"\u30D4\u30DC\u30C3\u30C8\u7D50\u679C\u3092\u5C55\u958B","pivot.table.collapse.ariaCollapse":"\u30D4\u30DC\u30C3\u30C8\u7D50\u679C\u3092\u6298\u308A\u305F\u305F\u3080","pivot.chart.title":"\u30D4\u30DC\u30C3\u30C8\u30C1\u30E3\u30FC\u30C8","pivot.chart.subtitle":"1\u3064\u306E\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u6700\u59272\u3064\u306E\u6307\u6A19\u3092\u30B3\u30F3\u30D1\u30AF\u30C8\u306A\u30C1\u30E3\u30FC\u30C8\u306B\u307E\u3068\u3081\u307E\u3059\u3002","pivot.chart.subtitleReady":"{dimension} \u3054\u3068\u306E {measure}","pivot.chart.emptyNoDimension":"\u30C1\u30E3\u30FC\u30C8\u3092\u8868\u793A\u3059\u308B\u306B\u306F\u3001\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u884C\u307E\u305F\u306F\u5217\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002","pivot.chart.emptyNoValue":"\u30C1\u30E3\u30FC\u30C8\u3092\u8868\u793A\u3059\u308B\u306B\u306F\u3001\u5C11\u306A\u304F\u3068\u30821\u3064\u306E\u5024\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002","pivot.chart.emptyNoData":"\u73FE\u5728\u306E\u30C1\u30E3\u30FC\u30C8\u9078\u629E\u3067\u306F\u8868\u793A\u3067\u304D\u308B\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093\u3002","pivot.chart.dimension":"\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3","pivot.chart.primaryMeasure":"\u6307\u6A19","pivot.chart.secondaryMeasure":"\u6BD4\u8F03\u6307\u6A19","pivot.chart.chartType":"\u30C1\u30E3\u30FC\u30C8\u7A2E\u5225","pivot.chart.style.barVertical":"\u7E26\u68D2\u30B0\u30E9\u30D5","pivot.chart.style.barHorizontal":"\u6A2A\u68D2\u30B0\u30E9\u30D5","pivot.chart.style.line":"\u6298\u308C\u7DDA\u30B0\u30E9\u30D5","pivot.chart.style.scatter":"\u6563\u5E03\u56F3","pivot.chart.collapse.ariaExpand":"\u30C1\u30E3\u30FC\u30C8\u9818\u57DF\u3092\u5C55\u958B","pivot.chart.collapse.ariaCollapse":"\u30C1\u30E3\u30FC\u30C8\u9818\u57DF\u3092\u6298\u308A\u305F\u305F\u3080","smartFilter.adaptFilters":"\u30D5\u30A3\u30EB\u30BF\u30FC\u8ABF\u6574","smartFilter.addFilters":"\u30D5\u30A3\u30EB\u30BF\u30FC\u8FFD\u52A0","smartFilter.go":"\u5B9F\u884C","smartFilter.visibleFilters":"\u8868\u793A\u30D5\u30A3\u30EB\u30BF\u30FC","smartFilter.searchPlaceholder":"\u691C\u7D22...","smartFilter.noOptionsFound":"\u30AA\u30D7\u30B7\u30E7\u30F3\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093","smartFilter.min":"\u6700\u5C0F","smartFilter.max":"\u6700\u5927","smartFilter.minMaxPlaceholder":"\u6700\u5C0F - \u6700\u5927","smartFilter.operator.equals":"\u7B49\u3057\u3044","smartFilter.operator.contains":"\u542B\u3080","smartFilter.operator.notContains":"\u542B\u307E\u306A\u3044","smartFilter.operator.wildcard":"\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u691C\u7D22","smartFilter.operator.notEquals":"\u7B49\u3057\u304F\u306A\u3044","smartFilter.operator.greaterThan":"\u3088\u308A\u5927\u304D\u3044","smartFilter.operator.lessThan":"\u3088\u308A\u5C0F\u3055\u3044","smartFilter.operator.greaterOrEqual":"\u4EE5\u4E0A","smartFilter.operator.lessOrEqual":"\u4EE5\u4E0B","smartFilter.operator.between":"\u7BC4\u56F2","variant.noOptions":"\u30AA\u30D7\u30B7\u30E7\u30F3\u306A\u3057","variant.defaultSuffix":"\u30C7\u30D5\u30A9\u30EB\u30C8","variant.selectVariant":"\u30D3\u30E5\u30FC\u3092\u9078\u629E","variant.saveView":"\u30D3\u30E5\u30FC\u4FDD\u5B58","variant.newVariant":"\u65B0\u3057\u3044\u30D3\u30E5\u30FC","variant.viewName":"\u30D3\u30E5\u30FC\u540D","variant.setDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u306B\u8A2D\u5B9A","variant.publicAllUsers":"\u516C\u958B\uFF08\u5168\u30E6\u30FC\u30B6\u30FC\uFF09","variant.toast.fetchFailed":"\u30D3\u30E5\u30FC\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.saveFailed":"\u30D3\u30E5\u30FC\u306E\u4FDD\u5B58\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.saveSuccess":"\u30D3\u30E5\u30FC\u3092\u4FDD\u5B58\u3057\u307E\u3057\u305F","variant.toast.deleteFailed":"\u30D3\u30E5\u30FC\u306E\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.deleteSuccess":"\u30D3\u30E5\u30FC\u3092\u524A\u9664\u3057\u307E\u3057\u305F","variant.toast.defaultFailed":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30D3\u30E5\u30FC\u306E\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F","variant.toast.defaultSuccess":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30D3\u30E5\u30FC\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F","layout.saveLayout":"\u30EC\u30A4\u30A2\u30A6\u30C8\u4FDD\u5B58","layout.layoutOptions":"\u30EC\u30A4\u30A2\u30A6\u30C8\u30AA\u30D7\u30B7\u30E7\u30F3","layout.selectLayout":"\u30EC\u30A4\u30A2\u30A6\u30C8\u9078\u629E","layout.saveCurrentLayout":"\u73FE\u5728\u306E\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u4FDD\u5B58...","layout.noSavedLayouts":"\u4FDD\u5B58\u6E08\u307F\u30EC\u30A4\u30A2\u30A6\u30C8\u306A\u3057","layout.removeDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u89E3\u9664","layout.setAsDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u306B\u8A2D\u5B9A","layout.layoutName":"\u30EC\u30A4\u30A2\u30A6\u30C8\u540D","layout.layoutDescription":"\u8AAC\u660E","layout.layoutNameHelper":"\u4F8B\uFF1A\u30B3\u30F3\u30D1\u30AF\u30C8\u8868\u793A","layout.warningOverwrite":"\u8B66\u544A\uFF1A\u65E2\u5B58\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u4E0A\u66F8\u304D\u3057\u307E\u3059","layout.useAsDefault":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30EC\u30A4\u30A2\u30A6\u30C8\u3068\u3057\u3066\u4F7F\u7528","layout.publicAllUsers":"\u516C\u958B\uFF08\u5168\u30E6\u30FC\u30B6\u30FC\u306B\u8868\u793A\uFF09","layout.toast.loadFallback":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u304B\u3089\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u3001\u30ED\u30FC\u30AB\u30EB\u4FDD\u5B58\u306B\u5207\u308A\u66FF\u3048\u307E\u3057\u305F","layout.toast.saveSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u4FDD\u5B58\u3057\u307E\u3057\u305F","layout.toast.saveLocalSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u4FDD\u5B58\u3057\u307E\u3057\u305F","layout.toast.backendUnavailableSavedLocal":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u672A\u63A5\u7D9A\u306E\u305F\u3081\u30ED\u30FC\u30AB\u30EB\u306B\u4FDD\u5B58\u3057\u307E\u3057\u305F","layout.toast.deleteSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u524A\u9664\u3057\u307E\u3057\u305F","layout.toast.deleteLocalSuccess":"\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u304B\u3089\u524A\u9664\u3057\u307E\u3057\u305F","layout.toast.backendUnavailableDeletedLocal":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u672A\u63A5\u7D9A\u306E\u305F\u3081\u30ED\u30FC\u30AB\u30EB\u304B\u3089\u524A\u9664\u3057\u307E\u3057\u305F","layout.toast.defaultSuccess":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u8A2D\u5B9A\u3057\u307E\u3057\u305F","layout.toast.defaultLocalSuccess":"\u30C7\u30D5\u30A9\u30EB\u30C8\u30EC\u30A4\u30A2\u30A6\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u306B\u8A2D\u5B9A\u3057\u307E\u3057\u305F","layout.toast.backendUnavailableDefaultLocal":"\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u672A\u63A5\u7D9A\u306E\u305F\u3081\u30C7\u30D5\u30A9\u30EB\u30C8\u3092\u30ED\u30FC\u30AB\u30EB\u4FDD\u5B58\u3057\u307E\u3057\u305F","dateRange.label":"\u65E5\u4ED8\u7BC4\u56F2","dateRange.startDate":"\u958B\u59CB\u65E5","dateRange.endDate":"\u7D42\u4E86\u65E5","dateRange.select":"\u9078\u629E...","dateRange.today":"\u4ECA\u65E5","dateRange.thisWeek":"\u4ECA\u9031","dateRange.thisMonth":"\u4ECA\u6708","graph.records":"{count} \u4EF6","graph.kpi.totalRecords":"\u7DCF\u30EC\u30B3\u30FC\u30C9","graph.kpi.totalReport":"\u7DCF\u5831\u544A\u6642\u9593","graph.kpi.totalBillable":"\u7DCF\u8ACB\u6C42\u53EF\u80FD\u6642\u9593","graph.kpi.efficiency":"\u52B9\u7387","graph.kpi.amount":"\u91D1\u984D","graph.kpi.flagged":"\u8981\u78BA\u8A8D","graph.chart.billable.title":"\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u5225\u8ACB\u6C42\u53EF\u80FD\u6642\u9593","graph.chart.billable.subtitle":"\u8ACB\u6C42\u53EF\u80FD\u6642\u9593\u306E\u4E0A\u4F4D","graph.chart.efficiency.title":"\u62C5\u5F53\u8005\u5225\u52B9\u7387","graph.chart.efficiency.subtitle":"\u52B9\u7387\u306E\u4F4E\u3044\u9806","graph.chart.status.title":"\u30B9\u30C6\u30FC\u30BF\u30B9\u5206\u5E03","graph.chart.status.subtitle":"\u30B9\u30C6\u30FC\u30BF\u30B9\u5225\u6BD4\u7387","graph.dataBody":"\u30C7\u30FC\u30BF\u672C\u4F53","graph.reportTitle":"\u30B0\u30E9\u30D5\u30A3\u30C3\u30AF\u30EC\u30DD\u30FC\u30C8","graph.unassigned":"\u672A\u5272\u308A\u5F53\u3066","graph.column.reportHours":"\u5831\u544A\u6642\u9593","graph.column.billableHours":"\u8ACB\u6C42\u53EF\u80FD\u6642\u9593","detail.searchAi.placeholder":"\u9805\u76EE\u3092\u691C\u7D22\u3002\u898B\u3064\u304B\u3089\u306A\u3044\u5834\u5408\u306FAI\u306B\u8CEA\u554F\u3057\u307E\u3059...","detail.searchAi.matches":"{count} \u4EF6\u306E\u4E00\u81F4","detail.searchAi.noMatch":"\u4E00\u81F4\u3059\u308B\u9805\u76EE\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002","detail.searchAi.autoAiFallback":"\u4E00\u81F4\u306A\u3057\u3002AI\u5206\u6790\u3092\u5B9F\u884C\u3057\u307E\u3059...","detail.searchAi.aiResultTitle":"AI\u5206\u6790\u7D50\u679C","detail.table.title":"\u95A2\u9023\u30EC\u30B3\u30FC\u30C9","kanban.empty":"\u3053\u3053\u306B\u30AB\u30FC\u30C9\u3092\u30C9\u30ED\u30C3\u30D7","kanban.bucket.limit":"\u4E0A\u9650","kanban.bucket.dropHere":"\u96E2\u3059\u3068\u3053\u306E bucket \u306B\u79FB\u52D5\u3057\u307E\u3059","kanban.card.progress":"\u9032\u6357","kanban.card.openDetail":"\u8A73\u7D30\u3092\u958B\u304F","kanban.priority.critical":"\u7DCA\u6025","kanban.priority.high":"\u9AD8","kanban.priority.medium":"\u4E2D","kanban.priority.low":"\u4F4E","quickCreate.newItem":"\u65B0\u898F\u4F5C\u6210","quickCreate.createWithTitle":"{title} \u3092\u4F5C\u6210","quickEdit.editWithTitle":"{title} \u3092\u7DE8\u96C6","quickDelete.confirmTitle":"\u524A\u9664\u306E\u78BA\u8A8D","quickDelete.confirmMessageSingle":"\u9078\u629E\u3057\u305F\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F","quickDelete.confirmMessageMultiple":"\u9078\u629E\u3057\u305F {count} \u4EF6\u306E\u30EC\u30B3\u30FC\u30C9\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F","messageBox.confirm":"OK","messageBox.cancel":"\u30AD\u30E3\u30F3\u30BB\u30EB"},Og={"common.cancel":"\uCDE8\uC18C","common.save":"\uC800\uC7A5","common.ok":"\uD655\uC778","common.done":"\uC644\uB8CC","common.search":"\uAC80\uC0C9","common.none":"\uC5C6\uC74C","common.all":"\uC804\uCCB4","common.noData":"\uB370\uC774\uD130 \uC5C6\uC74C","common.copy":"\uBCF5\uC0AC","common.delete":"\uC0AD\uC81C","common.loading":"\uB85C\uB529 \uC911...","header.searchPlaceholder":"\uBB34\uC5C7\uC774\uB4E0 \uBB3C\uC5B4\uBCF4\uC138\uC694...","header.theme.system":"\uD14C\uB9C8: \uC2DC\uC2A4\uD15C","header.theme.dark":"\uD14C\uB9C8: \uB2E4\uD06C","header.theme.light":"\uD14C\uB9C8: \uB77C\uC774\uD2B8","header.menu.setting":"\uC124\uC815","header.menu.logout":"\uB85C\uADF8\uC544\uC6C3","navigation.expand":"\uD0D0\uC0C9 \uD3BC\uCE58\uAE30","navigation.collapse":"\uD0D0\uC0C9 \uC811\uAE30","navigation.searchPlaceholder":"\uBA54\uB274 \uAC80\uC0C9...","navigation.noMatch":"\uC77C\uCE58\uD558\uB294 \uBA54\uB274\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4","navigation.noAccessibleApp":"\uC811\uADFC \uAC00\uB2A5\uD55C \uC571\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","navigation.noItems":"\uD45C\uC2DC\uD560 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4","navigation.expandView":"{title} \uD3BC\uCE58\uAE30","table.toolbar.searchPlaceholder":"\uAC80\uC0C9...","table.title.default":"\uB370\uC774\uD130 \uD14C\uC774\uBE14","table.toolbar.groupBy":"\uADF8\uB8F9","table.toolbar.summary":"\uC694\uC57D","table.toolbar.columns":"\uC5F4","table.toolbar.export":"\uB0B4\uBCF4\uB0B4\uAE30","table.toolbar.itemsPerPage":"\uD398\uC774\uC9C0\uB2F9 \uD589 \uC218:","table.toolbar.pageOf":"{current} / {total} \uD398\uC774\uC9C0","table.toolbar.newItem":"\uC2E0\uADDC \uD56D\uBAA9","table.toolbar.editItem":"\uD56D\uBAA9 \uC218\uC815","table.toolbar.deleteItem":"\uD56D\uBAA9 \uC0AD\uC81C","table.toolbar.graphicReport":"\uADF8\uB798\uD504 \uB9AC\uD3EC\uD2B8","table.toolbar.saveLayout":"\uB808\uC774\uC544\uC6C3 \uC800\uC7A5","table.menu.groupBy":"\uADF8\uB8F9","table.menu.clearAll":"\uBAA8\uB450 \uC9C0\uC6B0\uAE30","table.menu.visibleColumns":"\uD45C\uC2DC \uC5F4","table.menu.showSummaryRow":"\uC694\uC57D \uD589 \uD45C\uC2DC","table.menu.noNumericColumns":"\uC22B\uC790 \uC5F4 \uC5C6\uC74C","table.group.expandAll":"\uBAA8\uB4E0 \uADF8\uB8F9 \uD3BC\uCE58\uAE30","table.group.collapseAll":"\uBAA8\uB4E0 \uADF8\uB8F9 \uC811\uAE30","table.mobile.notImplemented":"\uBAA8\uBC14\uC77C \uBDF0\uB294 \uC544\uC9C1 \uAD6C\uD604\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4","pivot.title.default":"\uD53C\uBC97 \uD14C\uC774\uBE14","pivot.subtitle.default":"\uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uD53C\uBC97 \uD14C\uC774\uBE14\uC744 \uAD6C\uC131\uD558\uC138\uC694.","pivot.empty":"\uACB0\uACFC\uB97C \uBCF4\uB824\uBA74 \uAC12 \uC601\uC5ED\uC5D0 \uCD5C\uC18C \uD55C \uAC1C\uC758 \uD544\uB4DC\uB97C \uCD94\uAC00\uD558\uC138\uC694.","pivot.records":"\uB808\uCF54\uB4DC","pivot.afterFilter":"\uD544\uD130 \uD6C4","pivot.grandTotal":"\uCD1D\uD569","pivot.resultLabel":"\uACB0\uACFC","pivot.valueLabel":"\uAC12","pivot.table.dimensions":"\uCC28\uC6D0","pivot.config.title":"\uAD6C\uC131","pivot.fieldList":"\uD544\uB4DC \uBAA9\uB85D","pivot.availableDimensions":"\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uCC28\uC6D0","pivot.allFieldsInUse":"\uBAA8\uB4E0 \uD544\uB4DC\uAC00 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC785\uB2C8\uB2E4.","pivot.zone.rows":"\uD589","pivot.zone.columns":"\uC5F4","pivot.zone.filters":"\uD544\uD130","pivot.zone.values":"\uAC12","pivot.hint.rows":"\uC5EC\uAE30\uC5D0 \uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uD589 \uACC4\uCE35\uC744 \uAD6C\uC131","pivot.hint.columns":"\uC5EC\uAE30\uC5D0 \uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uC5F4 \uACC4\uCE35\uC744 \uAD6C\uC131","pivot.hint.filters":"\uC5EC\uAE30\uC5D0 \uD544\uB4DC\uB97C \uB4DC\uB798\uADF8\uD558\uC5EC \uBCF4\uACE0\uC11C \uD544\uD130\uB85C \uC0AC\uC6A9","pivot.hint.values":"\uC22B\uC790 \uD544\uB4DC\uB97C \uC5EC\uAE30\uC5D0 \uB4DC\uB798\uADF8\uD558\uC5EC \uC9D1\uACC4","pivot.clearArea":"\uC601\uC5ED \uBE44\uC6B0\uAE30","pivot.filter.na":"\uD574\uB2F9 \uC5C6\uC74C","pivot.filter.noValues":"\uAC12 \uC5C6\uC74C","pivot.filter.noneSelected":"\uC120\uD0DD \uC5C6\uC74C","pivot.filter.allValues":"\uBAA8\uB4E0 \uAC12","pivot.filter.selectedCount":"{selected} / {total} \uC120\uD0DD\uB428","pivot.filter.selectAll":"\uC804\uCCB4 \uC120\uD0DD","pivot.filter.deselectAll":"\uC804\uCCB4 \uD574\uC81C","pivot.filter.noResults":"\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C","pivot.collapse.ariaExpand":"\uAD6C\uC131 \uC601\uC5ED \uD3BC\uCE58\uAE30","pivot.collapse.ariaCollapse":"\uAD6C\uC131 \uC601\uC5ED \uC811\uAE30","pivot.agg.sum":"\uD569\uACC4","pivot.agg.count":"\uAC1C\uC218","pivot.agg.avg":"\uD3C9\uADE0","pivot.agg.min":"\uCD5C\uC18C","pivot.agg.max":"\uCD5C\uB300","pivot.preset.selectPlaceholder":"\uD504\uB9AC\uC14B \uC120\uD0DD","pivot.preset.save":"\uD504\uB9AC\uC14B \uC800\uC7A5","pivot.preset.delete":"\uD504\uB9AC\uC14B \uC0AD\uC81C","pivot.preset.saveDialogTitle":"\uD604\uC7AC \uD504\uB9AC\uC14B \uC800\uC7A5","pivot.preset.nameLabel":"\uD504\uB9AC\uC14B \uC774\uB984","pivot.preset.defaultName":"\uD504\uB9AC\uC14B {index}","pivot.table.sectionTitle":"\uD53C\uBC97 \uACB0\uACFC","pivot.table.expandRowsAll":"Expand rows","pivot.table.collapseRowsAll":"Collapse rows","pivot.table.expandColumnsAll":"Expand columns","pivot.table.collapseColumnsAll":"Collapse columns","pivot.table.collapse.ariaExpand":"\uD53C\uBC97 \uACB0\uACFC \uD3BC\uCE58\uAE30","pivot.table.collapse.ariaCollapse":"\uD53C\uBC97 \uACB0\uACFC \uC811\uAE30","pivot.chart.title":"\uD53C\uBC97 \uCC28\uD2B8","pivot.chart.subtitle":"\uD558\uB098\uC758 \uCC28\uC6D0\uACFC \uCD5C\uB300 \uB450 \uAC1C\uC758 \uCE21\uC815\uAC12\uC744 \uAC04\uACB0\uD55C \uCC28\uD2B8\uB85C \uD45C\uC2DC\uD569\uB2C8\uB2E4.","pivot.chart.subtitleReady":"{dimension}\uBCC4 {measure}","pivot.chart.emptyNoDimension":"\uCC28\uD2B8\uB97C \uBCF4\uB824\uBA74 \uCD5C\uC18C \uD55C \uAC1C\uC758 \uD589 \uB610\uB294 \uC5F4 \uD544\uB4DC\uB97C \uCD94\uAC00\uD558\uC138\uC694.","pivot.chart.emptyNoValue":"\uCC28\uD2B8\uB97C \uBCF4\uB824\uBA74 \uCD5C\uC18C \uD55C \uAC1C\uC758 \uAC12 \uD544\uB4DC\uB97C \uCD94\uAC00\uD558\uC138\uC694.","pivot.chart.emptyNoData":"\uD604\uC7AC \uCC28\uD2B8 \uC120\uD0DD\uC5D0 \uD45C\uC2DC\uD560 \uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.","pivot.chart.dimension":"\uCC28\uD2B8 \uCC28\uC6D0","pivot.chart.primaryMeasure":"\uC8FC \uCE21\uC815\uAC12","pivot.chart.secondaryMeasure":"\uBE44\uAD50 \uCE21\uC815\uAC12","pivot.chart.chartType":"\uCC28\uD2B8 \uC720\uD615","pivot.chart.style.barVertical":"\uC138\uB85C \uB9C9\uB300","pivot.chart.style.barHorizontal":"\uAC00\uB85C \uB9C9\uB300","pivot.chart.style.line":"\uC120\uD615 \uCC28\uD2B8","pivot.chart.style.scatter":"\uC0B0\uC810\uB3C4","pivot.chart.collapse.ariaExpand":"\uCC28\uD2B8 \uC601\uC5ED \uD3BC\uCE58\uAE30","pivot.chart.collapse.ariaCollapse":"\uCC28\uD2B8 \uC601\uC5ED \uC811\uAE30","smartFilter.adaptFilters":"\uD544\uD130 \uC870\uC815","smartFilter.addFilters":"\uD544\uD130 \uCD94\uAC00","smartFilter.go":"\uC2E4\uD589","smartFilter.visibleFilters":"\uD45C\uC2DC \uD544\uD130","smartFilter.searchPlaceholder":"\uAC80\uC0C9...","smartFilter.noOptionsFound":"\uC635\uC158\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4","smartFilter.min":"\uCD5C\uC18C","smartFilter.max":"\uCD5C\uB300","smartFilter.minMaxPlaceholder":"\uCD5C\uC18C - \uCD5C\uB300","smartFilter.operator.equals":"\uAC19\uC74C","smartFilter.operator.contains":"\uD3EC\uD568","smartFilter.operator.notContains":"\uBBF8\uD3EC\uD568","smartFilter.operator.wildcard":"\uC640\uC77C\uB4DC\uCE74\uB4DC \uAC80\uC0C9","smartFilter.operator.notEquals":"\uAC19\uC9C0 \uC54A\uC74C","smartFilter.operator.greaterThan":"\uBCF4\uB2E4 \uD07C","smartFilter.operator.lessThan":"\uBCF4\uB2E4 \uC791\uC74C","smartFilter.operator.greaterOrEqual":"\uC774\uC0C1","smartFilter.operator.lessOrEqual":"\uC774\uD558","smartFilter.operator.between":"\uBC94\uC704","variant.noOptions":"\uC635\uC158 \uC5C6\uC74C","variant.defaultSuffix":"\uAE30\uBCF8","variant.selectVariant":"\uBDF0 \uC120\uD0DD","variant.saveView":"\uBDF0 \uC800\uC7A5","variant.newVariant":"\uC0C8 \uBDF0","variant.viewName":"\uBDF0 \uC774\uB984","variant.setDefault":"\uAE30\uBCF8\uC73C\uB85C \uC124\uC815","variant.publicAllUsers":"\uACF5\uAC1C(\uC804\uCCB4 \uC0AC\uC6A9\uC790)","variant.toast.fetchFailed":"\uBDF0\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.saveFailed":"\uBDF0\uB97C \uC800\uC7A5\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.saveSuccess":"\uBDF0\uAC00 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","variant.toast.deleteFailed":"\uBDF0\uB97C \uC0AD\uC81C\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.deleteSuccess":"\uBDF0\uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4","variant.toast.defaultFailed":"\uAE30\uBCF8 \uBDF0\uB97C \uC5C5\uB370\uC774\uD2B8\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4","variant.toast.defaultSuccess":"\uAE30\uBCF8 \uBDF0\uAC00 \uC5C5\uB370\uC774\uD2B8\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.saveLayout":"\uB808\uC774\uC544\uC6C3 \uC800\uC7A5","layout.layoutOptions":"\uB808\uC774\uC544\uC6C3 \uC635\uC158","layout.selectLayout":"\uB808\uC774\uC544\uC6C3 \uC120\uD0DD","layout.saveCurrentLayout":"\uD604\uC7AC \uB808\uC774\uC544\uC6C3 \uC800\uC7A5...","layout.noSavedLayouts":"\uC800\uC7A5\uB41C \uB808\uC774\uC544\uC6C3 \uC5C6\uC74C","layout.removeDefault":"\uAE30\uBCF8 \uD574\uC81C","layout.setAsDefault":"\uAE30\uBCF8\uC73C\uB85C \uC124\uC815","layout.layoutName":"\uB808\uC774\uC544\uC6C3 \uC774\uB984","layout.layoutDescription":"\uC124\uBA85","layout.layoutNameHelper":"\uC608: \uCEF4\uD329\uD2B8 \uBDF0","layout.warningOverwrite":"\uACBD\uACE0: \uAE30\uC874 \uB808\uC774\uC544\uC6C3\uC774 \uB36E\uC5B4\uC4F0\uAE30 \uB429\uB2C8\uB2E4","layout.useAsDefault":"\uAE30\uBCF8 \uB808\uC774\uC544\uC6C3\uC73C\uB85C \uC0AC\uC6A9","layout.publicAllUsers":"\uACF5\uAC1C(\uBAA8\uB4E0 \uC0AC\uC6A9\uC790\uC5D0\uAC8C \uD45C\uC2DC)","layout.toast.loadFallback":"\uBC31\uC5D4\uB4DC\uC5D0\uC11C \uB808\uC774\uC544\uC6C3\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD574 \uB85C\uCEEC \uC800\uC7A5\uC18C\uB85C \uC804\uD658\uD588\uC2B5\uB2C8\uB2E4","layout.toast.saveSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.saveLocalSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uB85C\uCEEC \uC800\uC7A5\uC18C\uC5D0 \uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.backendUnavailableSavedLocal":"\uBC31\uC5D4\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC5B4 \uB85C\uCEEC\uC5D0 \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4","layout.toast.deleteSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.deleteLocalSuccess":"\uB808\uC774\uC544\uC6C3\uC774 \uB85C\uCEEC \uC800\uC7A5\uC18C\uC5D0\uC11C \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.backendUnavailableDeletedLocal":"\uBC31\uC5D4\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC5B4 \uB85C\uCEEC\uC5D0\uC11C \uC0AD\uC81C\uD588\uC2B5\uB2C8\uB2E4","layout.toast.defaultSuccess":"\uAE30\uBCF8 \uB808\uC774\uC544\uC6C3\uC774 \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.defaultLocalSuccess":"\uAE30\uBCF8 \uB808\uC774\uC544\uC6C3\uC774 \uB85C\uCEEC\uC5D0 \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4","layout.toast.backendUnavailableDefaultLocal":"\uBC31\uC5D4\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC5B4 \uAE30\uBCF8\uAC12\uC744 \uB85C\uCEEC\uC5D0 \uC800\uC7A5\uD588\uC2B5\uB2C8\uB2E4","dateRange.label":"\uB0A0\uC9DC \uBC94\uC704","dateRange.startDate":"\uC2DC\uC791\uC77C","dateRange.endDate":"\uC885\uB8CC\uC77C","dateRange.select":"\uC120\uD0DD...","dateRange.today":"\uC624\uB298","dateRange.thisWeek":"\uC774\uBC88 \uC8FC","dateRange.thisMonth":"\uC774\uBC88 \uB2EC","graph.records":"{count}\uAC74","graph.kpi.totalRecords":"\uCD1D \uB808\uCF54\uB4DC","graph.kpi.totalReport":"\uCD1D \uBCF4\uACE0 \uC2DC\uAC04","graph.kpi.totalBillable":"\uCD1D \uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04","graph.kpi.efficiency":"\uD6A8\uC728","graph.kpi.amount":"\uAE08\uC561","graph.kpi.flagged":"\uD50C\uB798\uADF8","graph.chart.billable.title":"\uCC28\uC6D0\uBCC4 \uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04","graph.chart.billable.subtitle":"\uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04 \uC0C1\uC704 \uAC12","graph.chart.efficiency.title":"\uB2F4\uB2F9\uC790\uBCC4 \uD6A8\uC728","graph.chart.efficiency.subtitle":"\uB0AE\uC740 \uD6A8\uC728 \uC6B0\uC120","graph.chart.status.title":"\uC0C1\uD0DC \uBD84\uD3EC","graph.chart.status.subtitle":"\uC0C1\uD0DC\uBCC4 \uBE44\uC728","graph.dataBody":"\uB370\uC774\uD130 \uBCF8\uBB38","graph.reportTitle":"\uADF8\uB798\uD504 \uB9AC\uD3EC\uD2B8","graph.unassigned":"\uBBF8\uC9C0\uC815","graph.column.reportHours":"\uBCF4\uACE0 \uC2DC\uAC04","graph.column.billableHours":"\uCCAD\uAD6C \uAC00\uB2A5 \uC2DC\uAC04","detail.searchAi.placeholder":"\uD544\uB4DC\uB97C \uAC80\uC0C9\uD558\uACE0, \uACB0\uACFC\uAC00 \uC5C6\uC73C\uBA74 AI\uC5D0 \uC9C8\uBB38\uD558\uC138\uC694...","detail.searchAi.matches":"{count}\uAC1C \uC77C\uCE58 \uD56D\uBAA9","detail.searchAi.noMatch":"\uC77C\uCE58\uD558\uB294 \uD544\uB4DC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.","detail.searchAi.autoAiFallback":"\uC77C\uCE58 \uD56D\uBAA9\uC774 \uC5C6\uC5B4 AI \uBD84\uC11D\uC744 \uC2E4\uD589\uD569\uB2C8\uB2E4...","detail.searchAi.aiResultTitle":"AI \uBD84\uC11D \uACB0\uACFC","detail.table.title":"\uAD00\uB828 \uB808\uCF54\uB4DC","kanban.empty":"\uC5EC\uAE30\uC5D0 \uCE74\uB4DC\uB97C \uB193\uC73C\uC138\uC694","kanban.bucket.limit":"\uD55C\uB3C4","kanban.bucket.dropHere":"\uB193\uC73C\uBA74 \uC774 \uBC84\uD0B7\uC73C\uB85C \uC774\uB3D9\uD569\uB2C8\uB2E4","kanban.card.progress":"\uC9C4\uD589\uB960","kanban.card.openDetail":"\uC0C1\uC138 \uC5F4\uAE30","kanban.priority.critical":"\uAE34\uAE09","kanban.priority.high":"\uB192\uC74C","kanban.priority.medium":"\uBCF4\uD1B5","kanban.priority.low":"\uB0AE\uC74C","quickCreate.newItem":"\uC2E0\uADDC \uD56D\uBAA9","quickCreate.createWithTitle":"{title} \uC0DD\uC131","quickEdit.editWithTitle":"{title} \uC218\uC815","quickDelete.confirmTitle":"\uC0AD\uC81C \uD655\uC778","quickDelete.confirmMessageSingle":"\uC120\uD0DD\uD55C \uD56D\uBAA9\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?","quickDelete.confirmMessageMultiple":"\uC120\uD0DD\uD55C {count}\uAC1C \uD56D\uBAA9\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?","messageBox.confirm":"\uD655\uC778","messageBox.cancel":"\uCDE8\uC18C"},Tn={en:Eg,zh:Lg,fr:zg,de:Ng,ja:Vg,ko:Og};var cd=(e,t)=>t?e.replace(/\{(\w+)\}/g,(o,a)=>{let r=t[a];return r==null?"":String(r)}):e,Gg={locale:"en",t:(e,t)=>cd(Tn.en[e]||e,t)},dd=createContext(Gg),vi=({locale:e="en",messages:t,children:o})=>{let a=useMemo(()=>{let r=Tn[e]||Tn.en,n=t?.[e]||{},i={...Tn.en,...r,...n};return {locale:e,t:(l,d)=>cd(i[l]||l,d)}},[e,t]);return jsx(dd.Provider,{value:a,children:o})},Z=()=>useContext(dd);function gl({items:e,onItemClick:t,className:o="",level:a=0,expandedIds:r,onToggleExpand:n,colorMode:i="light"}){let{t:l}=Z(),d=i==="dark",s=usePathname(),[c,g]=useState(false),[f,u]=useState(new Set),h=r!==void 0&&n!==void 0,w=h?r:f;useEffect(()=>{g(true);},[]);let p=m=>{if(h)n(m);else {let y=new Set(f);y.has(m)?y.delete(m):y.add(m),u(y);}},v=m=>{m.children&&m.children.length>0&&p(m.id),t&&t(m);};return !e||!Array.isArray(e)?jsx("div",{className:mo("tree-menu",o),children:jsx("div",{className:"text-sm text-gray-500 p-2",children:l("navigation.noItems")})}):jsx("div",{className:mo("tree-menu",o),children:e.map(m=>{let y=w.has(m.id)||m.isExpanded,x=m.children&&m.children.length>0,k=m.appurl||m.href,F=c&&k?s===k:false;return jsxs("div",{className:"tree-menu-item relative",children:[F&&jsx("div",{className:mo("absolute left-0 top-2 bottom-2 w-[3px] rounded-r-full z-10",d?"bg-[#90caf9]":"bg-[#1976d2]")}),jsxs(ul,{variant:"ghost",className:mo("w-full justify-start gap-2 h-auto py-2 relative overflow-hidden group",`ml-${a*4}`,F?d?"bg-transparent text-[#90caf9] hover:bg-gray-800/35":"bg-transparent text-[#1976d2] hover:bg-gray-100/60":d?"hover:bg-gray-800/50 text-gray-300":"hover:bg-gray-100/50 text-gray-700"),onClick:()=>v(m),children:[x&&jsx("div",{className:mo("flex-shrink-0 transition-transform duration-200",y&&"rotate-90",F?d?"text-[#90caf9]":"text-[#1976d2]":d?"text-gray-500 group-hover:text-gray-300":"text-gray-400 group-hover:text-gray-600"),children:jsx(ChevronRight,{className:"h-4 w-4"})}),!x&&jsx("div",{className:"w-4 h-4 flex-shrink-0"}),m.icon&&jsx("div",{className:mo("flex-shrink-0 transition-colors duration-200",F?d?"text-[#90caf9]":"text-[#1976d2]":d?"text-gray-500 group-hover:text-gray-300":"text-gray-400 group-hover:text-gray-600"),children:m.icon}),jsxs("div",{className:"flex-1 text-left overflow-hidden z-10",children:[jsx("div",{className:mo("text-sm truncate transition-colors duration-200",F?"font-semibold":"font-medium"),children:m.title||m.label}),m.description&&jsx("div",{className:mo("text-xs truncate transition-colors duration-200",F?d?"text-[#90caf9]/70":"text-[#1976d2]/75":d?"text-gray-400":"text-gray-500"),title:m.description,children:m.description})]})]}),x&&jsx("div",{className:mo("grid transition-[grid-template-rows] duration-300 ease-in-out",y?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:jsx("div",{className:"overflow-hidden",children:jsx(gl,{items:m.children,onItemClick:t,level:a+1,expandedIds:r,onToggleExpand:n,colorMode:i})})})]},m.id)})})}var hd=({collapsed:e,onToggle:t,className:o="",maxHeight:a,menuData:r=[],colorMode:n="light"})=>{let{t:i}=Z(),l=n==="dark",d=useRouter(),[s,c]=useState(""),[g,f]=useState(new Set);useEffect(()=>{e&&f(new Set);},[e]);let u=useCallback(v=>{let m=[],y=x=>{x.forEach(k=>{m.push(k.id),k.children&&y(k.children);});};return y(v),m},[]),h=useMemo(()=>{if(!s.trim())return r;let v=m=>m.reduce((y,x)=>{let k=x.title?.toLowerCase().includes(s.toLowerCase())||x.description?.toLowerCase().includes(s.toLowerCase()),F=x.children?v(x.children):[];return (k||F.length>0)&&y.push({...x,children:F.length>0?F:x.children}),y},[]);return v(r)},[s,r]),w=useMemo(()=>s.trim()?new Set(u(r)):g,[s,r,g,u]),p=useCallback(async v=>{if(console.log("\u{1F5B1}\uFE0F \u5BFC\u822A\u83DC\u5355\u9879\u70B9\u51FB:",v),v.id==="chat"||v.appurl==="/chat"){console.log("\u{1F4AC} \u68C0\u6D4B\u5230chat\u83DC\u5355\u70B9\u51FB\uFF0C\u8DF3\u8F6C\u5230\u65B0\u7684\u804A\u5929\u89C6\u56FE");try{d.push("/chat?new=true");}catch(y){console.error("\u274C \u65E0\u6CD5\u8DF3\u8F6C\u5230\u65B0\u804A\u5929\u89C6\u56FE:",y),d.push("/chat");}return}let m=v.appurl||v.href;m&&(m.startsWith("http://")||m.startsWith("https://")?window.open(m,"_blank"):d.push(m));},[d]);return jsxs("div",{className:`flex flex-col backdrop-blur-xl border shadow-[0_4px_8px_0_rgba(31,38,135,0.1)] ${e?"w-14 rounded-full":"w-[234px] rounded-2xl"} relative ${o} ${l?"bg-[#111111] border-white/10":"bg-white/70 border-white/30"}`,style:{backdropFilter:"blur(16px) saturate(180%)",WebkitBackdropFilter:"blur(16px) saturate(180%)",transition:"width 400ms cubic-bezier(0.4, 0.0, 0.2, 1), border-radius 0ms cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 400ms ease-out",maxHeight:a?`${a}px`:void 0},children:[jsx("div",{className:`pt-4 pb-2 transition-all duration-500 ease-in-out ${e?"px-1":"px-2"}`,children:e?jsx("div",{className:"flex justify-center",children:jsx("button",{onClick:t,className:`w-10 h-10 flex items-center justify-center rounded-lg transition-colors duration-200 ${l?"text-gray-300 hover:bg-gray-800":"text-gray-500 hover:bg-gray-50"}`,title:i("navigation.expand"),children:jsx(Search,{className:"h-5 w-5"})})}):jsxs("div",{className:`relative transition-opacity duration-300 ${e?"opacity-0":"opacity-100 delay-200"}`,children:[jsx("input",{type:"text",placeholder:i("navigation.searchPlaceholder"),value:s,onChange:v=>c(v.target.value),className:`w-full pl-10 pr-4 py-2 text-sm border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ${l?"border-gray-700 bg-[#1A1A1A] text-white placeholder-gray-400":"border-gray-300 bg-white text-gray-900 placeholder-gray-500"}`}),jsx("div",{className:"absolute left-3 top-1/2 transform -translate-y-1/2 pointer-events-none",children:jsx(Search,{className:`h-4 w-4 ${l?"text-gray-500":"text-gray-400"}`})})]})}),jsx("nav",{className:`flex-1 pb-4 transition-all duration-500 ease-in-out overflow-y-auto min-h-0 ${e?"px-1":"px-2"}`,children:h.length===0?jsx("div",{className:"flex items-center justify-center py-8 text-gray-500 text-sm",children:e?"\u{1F4C2}":i(s?"navigation.noMatch":"navigation.noAccessibleApp")}):jsxs(Fragment,{children:[!e&&jsx("div",{className:`transition-opacity duration-300 ${e?"opacity-0":"opacity-100 delay-200"}`,children:jsx(gl,{items:h,onItemClick:p,className:"space-y-1",expandedIds:w,colorMode:n,onToggleExpand:v=>{let m=new Set(g);h.some(x=>x.id===v)?m.has(v)?m.delete(v):(h.forEach(x=>{x.id!==v&&m.has(x.id)&&m.delete(x.id);}),m.add(v)):m.has(v)?m.delete(v):m.add(v),f(m);}})}),e&&jsx("div",{className:"space-y-2",children:r.map(v=>jsx("div",{className:"space-y-1",children:jsx("button",{onClick:()=>{t();let m=new Set([v.id]);f(m);},className:`w-full flex items-center justify-center p-2 rounded-lg cursor-pointer transition-colors duration-200 ${l?"text-gray-400 hover:bg-gray-800":"text-gray-600 hover:bg-gray-50"}`,title:i("navigation.expandView",{title:v.title||""}),children:v.icon||jsx("div",{className:`w-6 h-6 rounded text-xs flex items-center justify-center font-medium ${l?"bg-[#90caf9] text-[#0b0b0b]":"bg-[#1976d2] text-white"}`,children:v.title?.charAt(0)||"?"})})},v.id))})]})}),!e&&jsx("button",{onClick:t,className:`absolute -bottom-1 -right-1 w-6 h-6 bg-transparent rounded-full flex items-center justify-center transition-all duration-300 ease-in-out z-20 ${l?"hover:bg-gray-800/50":"hover:bg-white/20"}`,title:i("navigation.collapse"),children:jsx("div",{className:"absolute",style:{bottom:"0px",right:"0px",width:"16px",height:"16px",overflow:"hidden"},children:jsx("div",{className:l?"border-yellow-400":"",style:{width:"32px",height:"32px",borderRadius:"16px",border:"3px solid #21BCFF",backgroundColor:"transparent",position:"absolute",top:"-16px",left:"-16px"}})})})]})};var bd=(e={})=>{let{initialCollapsed:t=false,content:o=[]}=e,[a,r]=useState(t),[n,i]=useState(o),l=useCallback(()=>{r(s=>!s);},[]),d=useMemo(()=>({collapsed:a,onToggle:l,menuData:n}),[a,l,n]);return {collapsed:a,setCollapsed:r,toggleCollapsed:l,menuData:n,setMenuData:i,navigationIslandProps:d}};var Do=e=>jsx(Button,{...e,variant:e.variant||"contained",size:e.size||"medium",sx:{textTransform:"none",...e.sx}});var hl=class{constructor(){a(this,"listener",null);}register(t){this.listener=t;}unregister(){this.listener=null;}show(t,o,a){this.listener&&this.listener({type:t,content:o,options:a});}hide(){this.listener&&this.listener(null);}},ra=new hl,O1={success:(e,t)=>ra.show("success",e,t),error:(e,t)=>ra.show("error",e,t),warning:(e,t)=>ra.show("warning",e,t),info:(e,t)=>ra.show("info",e,t),show:(e,t,o)=>ra.show(e,t,o),hide:()=>ra.hide()};var uf={success:{icon:jsx(lf,{sx:{fontSize:40}}),color:"#e8f5e9",iconColor:"#66bb6a",borderColor:"#a5d6a7"},warning:{icon:jsx(cf,{sx:{fontSize:40}}),color:"#fff3e0",iconColor:"#ffa726",borderColor:"#ffcc80"},error:{icon:jsx(df,{sx:{fontSize:40}}),color:"#ffebee",iconColor:"#ef5350",borderColor:"#ef9a9a"},info:{icon:jsx(pf,{sx:{fontSize:40}}),color:"#e3f2fd",iconColor:"#42a5f5",borderColor:"#90caf9"},default:{icon:null,color:"transparent",iconColor:"inherit",borderColor:"transparent"}},In=({open:e,title:t,message:o,onClose:a,onConfirm:r,confirmText:n,cancelText:i,showCancel:l=true,maxWidth:d="xs",type:s="default"})=>{let{t:c}=Z(),g=n||c("messageBox.confirm"),f=i||c("messageBox.cancel"),u=()=>{r?r():a();},h=uf[s],w=s!=="default";return jsxs(Pp,{open:e,onClose:a,maxWidth:d,fullWidth:true,PaperProps:{sx:{borderRadius:3,...w&&{borderTop:`6px solid ${h.iconColor}`}}},children:[w&&jsx(Hn,{sx:{display:"flex",justifyContent:"center",pt:3,color:h.iconColor},children:h.icon}),t&&jsx(Rp,{sx:{textAlign:w?"center":"left",pt:w?1:2},children:t}),jsx(Dp,{sx:{textAlign:w?"center":"left"},children:typeof o=="string"?jsx(rf,{children:o}):o}),jsxs(Mp,{sx:{justifyContent:w?"center":"flex-end",pb:3,px:3},children:[l&&jsx(Do,{onClick:a,variant:"text",color:"inherit",children:f}),jsx(Do,{onClick:u,variant:"contained",sx:{bgcolor:w?h.iconColor:void 0,"&:hover":{bgcolor:w?h.iconColor:void 0,filter:"brightness(0.9)"}},autoFocus:true,children:g})]})]})},oT=()=>{let[e,t]=ct__default.useState(null),[o,a]=ct__default.useState(false);ct__default.useEffect(()=>{let i=l=>{l?(t(l),a(true)):(a(false),t(null));};return ra.register(i),()=>ra.unregister()},[]);let r=()=>{a(false),e?.options?.onClose&&e.options.onClose(),t(null);},n=()=>{e?.options?.onConfirm&&e.options.onConfirm(),a(false),t(null);};return e?jsx(In,{open:o,type:e.type,message:e.content,title:e.options?.title,onClose:r,onConfirm:n,confirmText:e.options?.confirmText,cancelText:e.options?.cancelText,showCancel:e.options?.showCancel,maxWidth:e.options?.maxWidth}):null};var vd=({title:e,hideHeader:t,children:o})=>jsxs(Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[!t&&jsx(Box,{sx:{mb:2},children:jsx(Typography,{variant:"h4",children:e})}),jsx(Box,{sx:{flex:1,overflow:"hidden"},children:o})]});var Ci=e=>{let{t}=Z(),o="0.85rem",a=Array.isArray(e.actions)?e.actions:e.actions?[e.actions]:[],r=Array.isArray(e.extraTools)?e.extraTools:e.extraTools?[e.extraTools]:[],n=[...a,...r],i=typeof e.rowsPerPage=="number"?e.rowsPerPage:20,l=Array.isArray(e.rowsPerPageOptions)&&e.rowsPerPageOptions.length>0?e.rowsPerPageOptions:[20,50,100,-1],d=typeof e.count=="number"?e.count:0,s=Math.max(0,typeof e.page=="number"?e.page:0),c=i===-1?1:Math.max(1,Math.ceil(d/i)),g=Math.min(s+1,c),f=s>0,u=s<c-1&&i!==-1;return jsxs(Toolbar,{sx:{pl:{sm:2},pr:{xs:1,sm:1},alignItems:"center",gap:1},children:[jsx(TextField,{size:"small",placeholder:t("table.toolbar.searchPlaceholder"),value:e.filterText,onChange:h=>e.setFilterText(h.target.value),InputProps:{sx:{fontSize:o,"& .MuiInputBase-input":{fontSize:o,color:"text.primary"},"& .MuiInputBase-input::placeholder":{fontSize:o,opacity:1}},startAdornment:jsx(InputAdornment,{position:"start",children:jsx(gp,{fontSize:"small"})})},sx:{width:300}}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[jsx(Typography,{sx:{fontSize:o,color:"text.secondary",whiteSpace:"nowrap"},children:t("table.toolbar.itemsPerPage")}),jsx(Select,{size:"small",variant:"standard",value:i,disableUnderline:true,onChange:h=>e.onRowsPerPageChange?.(Number(h.target.value)),sx:{fontSize:o,fontWeight:600,color:"text.primary",minWidth:64,"& .MuiSelect-select":{py:.25,pr:"16px !important"},"& .MuiSvgIcon-root":{color:"text.primary"}},children:l.map(h=>jsx(MenuItem,{value:h,sx:{fontSize:o},children:h===-1?t("common.all"):h},`rows-per-page-${h}`))}),jsx(IconButton,{size:"small",onClick:()=>e.onPageChange?.(Math.max(s-1,0)),disabled:!f,sx:{p:.35,color:"text.primary"},children:jsx(Bf,{fontSize:"small"})}),jsx(Typography,{sx:{fontSize:o,fontWeight:600,minWidth:88,textAlign:"center",color:"text.primary"},children:t("table.toolbar.pageOf",{current:g,total:c})}),jsx(IconButton,{size:"small",onClick:()=>e.onPageChange?.(Math.min(s+1,c-1)),disabled:!u,sx:{p:.35,color:"text.primary"},children:jsx(Ff,{fontSize:"small"})})]}),jsx(Box,{sx:{flex:1}}),jsxs(Box,{sx:{display:"flex",gap:1,alignItems:"center"},children:[n.length>0&&jsx(Box,{sx:{display:"flex",gap:1,alignItems:"center"},children:n.map((h,w)=>jsx(ct__default.Fragment,{children:h},`toolbar-custom-${w}`))}),jsx(Box,{sx:{width:"1px",height:20,bgcolor:"divider",mx:.5}}),jsx(Tooltip,{title:t("table.toolbar.groupBy"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:h=>e.setGroupAnchorEl(h.currentTarget),children:jsx(Badge,{badgeContent:e.grouping?.length,color:"primary",children:jsx(If,{})})})}),jsx(Tooltip,{title:t("table.toolbar.summary"),children:jsx(IconButton,{sx:{color:e.showSummary?"primary.main":"text.primary"},onClick:h=>e.setSummaryAnchorEl(h.currentTarget),children:jsx(Pf,{})})}),jsx(Tooltip,{title:t("table.toolbar.columns"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:h=>e.setAnchorEl(h.currentTarget),children:jsx(Sf,{})})}),jsx(Tooltip,{title:t("table.toolbar.export"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:e.handleExport,children:jsx(Tf,{})})}),e.showCreateButton&&jsx(Tooltip,{title:t("table.toolbar.newItem"),children:jsx(IconButton,{onClick:e.onOpenCreateDialog,color:"primary",children:jsx(Df,{})})}),e.showEditButton&&jsx(Tooltip,{title:t("table.toolbar.editItem"),children:jsx("span",{children:jsx(IconButton,{onClick:e.onOpenEditDialog,color:"primary",disabled:!!e.editDisabled,children:jsx(Mf,{})})})}),e.showDeleteButton&&jsx(Tooltip,{title:t("table.toolbar.deleteItem"),children:jsx("span",{children:jsx(IconButton,{onClick:e.onOpenDeleteConfirm,color:"error",disabled:!!e.deleteDisabled,children:jsx(Af,{})})})}),e.onOpenGraphReport&&jsx(Tooltip,{title:t("table.toolbar.graphicReport"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:e.onOpenGraphReport,children:jsx(Rf,{})})}),e.onLayoutSave&&!e.layoutManager&&jsx(Tooltip,{title:t("table.toolbar.saveLayout"),children:jsx(IconButton,{sx:{color:"text.primary"},onClick:h=>e.onLayoutSave(h),children:jsx(kp,{})})}),e.layoutManager]})]})};var ki=e=>{let{t}=Z(),{onSelectAllClick:o,order:a,orderBy:r,numSelected:n=0,rowCount:i=0,onRequestSort:l,columns:d,visibleColumns:s,selectionMode:c,grouping:g=[],isAllExpanded:f=false,handleToggleAll:u,onColumnResize:h,columnWidths:w}=e,[p,v]=useState(null),m=useRef(null),y=C=>D=>{p||l(C);},x=(C,D,I)=>{C.preventDefault(),C.stopPropagation(),v(D),m.current={startX:C.clientX,startWidth:I,colId:D},document.addEventListener("mousemove",k),document.addEventListener("mouseup",F),document.body.style.cursor="col-resize";},k=C=>{if(!m.current)return;let{startX:D,startWidth:I,colId:P}=m.current,M=C.clientX-D,$=Math.max(50,I+M);h&&h(P,$);},F=()=>{v(null),m.current=null,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",F),document.body.style.cursor="";};useEffect(()=>()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",F);},[]);let S=c==="multiple"||c==="single",T=g.length>0&&!!u,A=t(f?"table.group.collapseAll":"table.group.expandAll"),R=d.filter(C=>s.includes(C.id));return jsx(Nf,{children:jsxs(Vf,{children:[S&&jsx(Cl,{padding:"checkbox",sx:C=>({width:48,position:"sticky",top:0,zIndex:4,backgroundColor:C.palette.mode==="dark"?"#000000":"#f5f5f5",color:C.palette.mode==="dark"?"#ffffff":C.palette.text.primary}),children:jsx(Of,{color:"primary",indeterminate:n>0&&n<i,checked:i>0&&n===i,onChange:o,disabled:c==="single"})}),T&&jsx(Cl,{align:"center",padding:"checkbox",sx:C=>({width:44,position:"sticky",top:0,zIndex:4,backgroundColor:C.palette.mode==="dark"?"#000000":"#f5f5f5",color:C.palette.mode==="dark"?"#ffffff":C.palette.text.primary}),children:jsx(Hf,{title:A,children:jsx($f,{size:"small",onClick:C=>{C.stopPropagation(),u?.(!f);},sx:{p:.2},children:f?jsx(Uf,{fontSize:"small"}):jsx(Gf,{fontSize:"small"})})})}),R.map(C=>{let D=w?.[C.id]||C.minWidth||100;return jsxs(Cl,{align:"left",padding:C.disablePadding?"none":"normal",sortDirection:r===C.id?a:false,style:{width:D,minWidth:D,maxWidth:D},sx:I=>({position:"sticky",top:0,zIndex:4,backgroundColor:I.palette.mode==="dark"?"#000000":"#f5f5f5",color:I.palette.mode==="dark"?"#ffffff":I.palette.text.primary,fontWeight:"bold",userSelect:"none"}),children:[jsx(Wf,{active:r===C.id,direction:r===C.id?a:"asc",onClick:y(C.id),sx:I=>({"&.MuiTableSortLabel-root":{width:"100%"},"& .MuiTableSortLabel-icon":{color:I.palette.mode==="dark"?"#ffffff":I.palette.text.primary,opacity:r===C.id?1:0,transition:"opacity 0.2s"},"&:hover .MuiTableSortLabel-icon":{opacity:.5},"&.Mui-active .MuiTableSortLabel-icon":{opacity:1,color:I.palette.mode==="dark"?"#ffffff":I.palette.text.primary},fontWeight:"bold",fontSize:"0.85rem",color:I.palette.mode==="dark"?"#ffffff":I.palette.text.primary}),children:jsx(Hn,{component:"span",sx:{overflow:"visible",textOverflow:"clip",whiteSpace:"normal",lineHeight:1.2,wordBreak:"break-word",pr:1},children:C.label})}),jsx(Hn,{onMouseDown:I=>x(I,C.id,typeof D=="number"?D:100),onClick:I=>I.stopPropagation(),sx:{position:"absolute",right:0,top:0,bottom:0,width:5,cursor:"col-resize","&:hover":{backgroundColor:"primary.main",opacity:.5},zIndex:1}})]},C.id)})]})})};var Id=e=>{let{t}=Z(),{visibleRows:o,visibleColumns:a,selected:r=[],handleClick:n,columns:i,toggleGroupExpand:l,expandedGroups:d=new Set,selectionMode:s,grouping:c=[],isGroupFullyExpanded:g,handleExpandGroupRecursively:f,handleCollapseGroupRecursively:u}=e,h=m=>r.indexOf(m)!==-1,w=s==="multiple"||s==="single",p=c.length>0,v=a.length+(w?1:0)+(p?1:0);return jsxs(TableBody,{children:[o.map((m,y)=>{if(m.type==="group"){let x=d.has(m.id),k=m.childIds||[],F=k.filter(R=>h(R)).length,S=k.length>0&&F===k.length,T=F>0&&F<k.length;return jsxs(TableRow,{sx:R=>({backgroundColor:R.palette.mode==="dark"?"#111111":"#f5f5f5","& .MuiTableCell-root":{color:R.palette.text.primary,borderBottomColor:R.palette.divider},"& .MuiIconButton-root":{color:R.palette.text.primary},"& .MuiCheckbox-root":{color:R.palette.text.secondary},"& .MuiCheckbox-root.Mui-checked, & .MuiCheckbox-root.MuiCheckbox-indeterminate":{color:R.palette.primary.main}}),children:[w&&jsx(TableCell,{padding:"checkbox",children:jsx(Checkbox,{size:"small",checked:S,indeterminate:T,onChange:R=>{if(R.stopPropagation(),!!e.onSelectionChange)if(S){let C=r.filter(D=>!k.includes(D));e.onSelectionChange(C);}else {let C=Array.from(new Set([...r,...k]));e.onSelectionChange(C);}},onClick:R=>R.stopPropagation(),sx:{p:.5}})}),p&&jsx(TableCell,{padding:"checkbox",sx:{width:44},children:jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.25},children:[c.length>1&&m.level<c.length-1&&jsx(Tooltip,{title:g?.(m.id)?t("table.group.collapseAll"):t("table.group.expandAll"),children:jsx(IconButton,{size:"small",onClick:()=>{g?.(m.id)?u?.(m.id):f?.(m.id);},sx:{p:.25},children:g?.(m.id)?jsx(Uf,{fontSize:"small"}):jsx(Gf,{fontSize:"small"})})}),jsx(IconButton,{size:"small",onClick:()=>l&&l(m.id),sx:{p:.25},children:x?jsx(Xf,{}):jsx(Ff,{})})]})}),jsx(TableCell,{colSpan:a.length,sx:{py:1,pl:m.level*3+1},children:jsxs(Typography,{variant:"body2",fontWeight:"bold",color:"text.primary",sx:{fontSize:"0.85rem"},children:[m.field,": ",m.value," (",m.count,")"]})})]},m.id)}else {let x=m.data||m,k=m.id||x.id||y,F=h(k),S=`enhanced-table-checkbox-${y}`,A=(m.level!==void 0?m.level:0)*4;return jsxs(TableRow,{hover:true,onClick:R=>n&&n(R,x),role:"checkbox","aria-checked":F,tabIndex:-1,selected:F,sx:{cursor:"pointer"},children:[w&&jsx(TableCell,{padding:"checkbox",sx:{pl:A>0?A+1:void 0},children:jsx(Checkbox,{color:"primary",checked:F,inputProps:{"aria-labelledby":S}})}),p&&jsx(TableCell,{padding:"checkbox",sx:{width:44}}),i.filter(R=>a.includes(R.id)).map((R,C)=>{let I=!w&&C===0&&A>0?{pl:A+2}:{};return jsx(TableCell,{align:"left",sx:I,children:R.render?R.render(x[R.id],x):(function(){let M=x[R.id];if(R.numeric){if(typeof M=="number")return M.toLocaleString();if(typeof M=="string"&&M.trim()!==""&&!isNaN(Number(M)))return Number(M).toLocaleString()}return M})()},R.id)})]},k)}}),o.length===0&&jsx(TableRow,{children:jsx(TableCell,{colSpan:v,align:"center",children:t("common.noData")})})]})};var Pd=e=>{let{visibleColumns:t,summaryRow:o,selectionMode:a,grouping:r=[]}=e;if(!e.showSummary)return null;let n=a==="multiple"||a==="single",i=r.length>0;return jsx(TableFooter,{sx:{position:"sticky",bottom:0,zIndex:e.zIndex,bgcolor:"background.paper"},children:jsxs(TableRow,{children:[n&&jsx(TableCell,{padding:"checkbox",sx:{bgcolor:"background.paper"}}),i&&jsx(TableCell,{padding:"checkbox",sx:{bgcolor:"background.paper",width:44}}),t.map(l=>jsx(TableCell,{sx:{fontWeight:"bold",fontSize:"0.85rem",bgcolor:"background.paper",color:"text.primary"},children:(function(){let s=o[l];return s==null||s===""?"":typeof s=="number"?s.toLocaleString():typeof s=="string"&&s.trim()!==""&&!isNaN(Number(s))?Number(s).toLocaleString():s})()},l))]})})};var Dd=e=>{let{t}=Z();return jsx(Box,{sx:{p:2},children:jsx(Typography,{children:t("table.mobile.notImplemented")})})};var zr=({groupAnchorEl:e,setGroupAnchorEl:t,grouping:o,setGrouping:a,columns:r,toggleGroupField:n})=>{let{t:i}=Z();return jsxs(Menu,{anchorEl:e,open:!!e,onClose:()=>t(null),children:[jsxs(Box,{sx:{p:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx(Typography,{variant:"subtitle2",sx:{px:1},children:i("table.menu.groupBy")}),o.length>0&&jsx(Button,{size:"small",color:"error",onClick:()=>a([]),startIcon:jsx(ph,{}),children:i("table.menu.clearAll")})]}),jsx(Divider,{}),r.map(l=>{let d=o.includes(l.id),s=o.indexOf(l.id)+1;return jsx(MenuItem,{onClick:()=>n(l.id),children:jsxs(Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[jsx(Checkbox,{checked:d,size:"small"}),jsx(ListItemText,{primary:l.label}),d&&jsx(Badge,{badgeContent:s,color:"primary",sx:{mr:2}})]})},l.id)})]})},Nr=({anchorEl:e,setAnchorEl:t,columns:o,visibleColumns:a,toggleColumnVisibility:r})=>{let{t:n}=Z();return jsxs(Menu,{anchorEl:e,open:!!e,onClose:()=>t(null),children:[jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:n("table.menu.visibleColumns")})}),jsx(Divider,{}),o.map(i=>jsxs(MenuItem,{onClick:()=>r(i.id),children:[jsx(Checkbox,{checked:a.includes(i.id),size:"small"}),jsx(ListItemText,{primary:i.label})]},i.id))]})},Ii=({anchorEl:e,setAnchorEl:t,showSummary:o,setShowSummary:a,columns:r,summaryColumns:n,toggleSummaryColumn:i})=>{let{t:l}=Z();return jsxs(Menu,{anchorEl:e,open:!!e,onClose:()=>t(null),children:[jsx(MenuItem,{children:jsx(FormControlLabel,{control:jsx(Switch,{checked:o,onChange:d=>a(d.target.checked),size:"small"}),label:l("table.menu.showSummaryRow")})}),jsx(Divider,{}),r.filter(d=>d.numeric).map(d=>jsxs(MenuItem,{onClick:()=>i(d.id),disabled:!o,children:[jsx(Checkbox,{checked:n.includes(d.id),size:"small"}),jsx(ListItemText,{primary:d.label})]},d.id)),r.filter(d=>d.numeric).length===0&&jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:l("table.menu.noNumericColumns")})})]})},Pi=({contextMenu:e,handleCloseContextMenu:t,columns:o,visibleColumns:a,toggleColumnVisibility:r})=>{let{t:n}=Z();return jsxs(Menu,{open:e!==null,onClose:t,anchorReference:"anchorPosition",anchorPosition:e!==null?{top:e.mouseY,left:e.mouseX}:void 0,children:[jsx(MenuItem,{onClick:t,children:n("common.copy")}),jsx(Divider,{}),jsx(MenuItem,{disabled:true,children:n("table.menu.visibleColumns")}),o.map(i=>jsxs(MenuItem,{onClick:()=>r(i.id),children:[jsx(ListItemIcon,{children:a.includes(i.id)&&jsx(dh,{fontSize:"small"})}),jsx(ListItemText,{children:i.label})]},i.id))]})};var Dn=(e,t=2)=>e.toLocaleString(void 0,{maximumFractionDigits:t}),Bd=({kpis:e})=>{let{t}=Z(),o=[{label:t("graph.kpi.totalRecords"),value:Dn(e.totalRecords,0),color:"text.primary"},{label:t("graph.kpi.totalReport"),value:Dn(e.totalReportHours),color:"text.primary"},{label:t("graph.kpi.totalBillable"),value:Dn(e.totalBillableHours),color:"success.main"},{label:t("graph.kpi.efficiency"),value:`${e.efficiency.toFixed(2)}%`,color:"warning.main"},{label:t("graph.kpi.amount"),value:Dn(e.totalAmount),color:"info.main"},{label:t("graph.kpi.flagged"),value:Dn(e.flaggedCount,0),color:"error.main"}];return jsx(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:"repeat(6, minmax(0, 1fr))"},gap:1.5},children:o.map(a=>jsxs(Paper,{variant:"outlined",sx:{p:1.5,borderRadius:2,minHeight:96,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[jsx(Typography,{variant:"caption",color:"text.secondary",children:a.label}),jsx(Typography,{variant:"h4",fontWeight:800,sx:{color:a.color},children:a.value})]},a.label))})};var Ri=({title:e,subtitle:t,children:o})=>jsxs(Paper,{variant:"outlined",sx:{p:2,borderRadius:2},children:[jsx(Typography,{variant:"subtitle1",fontWeight:700,children:e}),t&&jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mb:2},children:t}),o]});var An=({data:e,orientation:t="horizontal",valueSuffix:o="",minHeight:a=210,activeName:r,onItemClick:n})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let i=Math.max(...e.map(l=>l.value),1);return t==="vertical"?jsx(Box,{sx:{display:"flex",gap:1,alignItems:"flex-end",minHeight:a},children:e.map(l=>jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsx(Box,{onClick:()=>n?.(l),sx:{height:`${Math.max(l.value/i*180,6)}px`,bgcolor:l.name===r?"primary.dark":"primary.main",borderRadius:"8px 8px 0 0",cursor:n?"pointer":"default",opacity:r&&l.name!==r?.45:1}}),jsx(Typography,{variant:"caption",noWrap:true,title:l.name,sx:{display:"block",mt:.5},children:l.name}),jsxs(Typography,{variant:"caption",color:"text.secondary",children:[l.value.toFixed(1),o]})]},l.name))}):jsx(Stack,{spacing:1,children:e.map(l=>jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"140px 1fr 64px",gap:1},children:[jsx(Typography,{variant:"caption",color:"text.secondary",noWrap:true,title:l.name,children:l.name}),jsx(Box,{onClick:()=>n?.(l),sx:{alignSelf:"center",bgcolor:"action.hover",height:10,borderRadius:999,overflow:"hidden",cursor:n?"pointer":"default",opacity:r&&l.name!==r?.45:1},children:jsx(Box,{sx:{width:`${l.value/i*100}%`,height:"100%",bgcolor:l.name===r?"primary.dark":"primary.main"}})}),jsxs(Typography,{variant:"caption",sx:{textAlign:"right",fontWeight:600},children:[l.value.toFixed(1),o]})]},l.name))})};var Ld=({data:e,color:t="#42A5F5",valueSuffix:o="",height:a=220})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let r=640,n=28,i=e.map(f=>f.value),l=Math.min(...i,0),s=Math.max(...i,1)-l||1,c=e.map((f,u)=>{let h=n+u*(r-n*2)/Math.max(e.length-1,1),w=a-n-(f.value-l)/s*(a-n*2);return {x:h,y:w,...f}}),g=c.map(f=>`${f.x},${f.y}`).join(" ");return jsxs(Box,{children:[jsxs(Box,{component:"svg",viewBox:`0 0 ${r} ${a}`,sx:{width:"100%",height:a},children:[jsx("line",{x1:n,y1:a-n,x2:r-n,y2:a-n,stroke:"rgba(148,163,184,0.4)"}),jsx("polyline",{fill:"none",stroke:t,strokeWidth:3,points:g}),c.map(f=>jsx("circle",{cx:f.x,cy:f.y,r:4,fill:t},f.name))]}),jsx(Box,{sx:{mt:1,display:"grid",gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`,gap:1},children:e.map(f=>jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"caption",noWrap:true,title:f.name,sx:{display:"block"},children:f.name}),jsxs(Typography,{variant:"caption",color:"text.secondary",children:[f.value.toFixed(1),o]})]},f.name))})]})};var zd=({data:e,barColor:t="#64B5F6",lineColor:o="#FFB74D",height:a=220})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let r=640,n=28,i=Math.max(...e.map(c=>c.barValue),1),l=Math.max(...e.map(c=>c.lineValue),1),d=e.map((c,g)=>{let f=(r-n*2)/e.length,u=Math.max(f*.5,8),h=n+g*f+(f-u)/2,w=c.barValue/i*(a-n*2),p=a-n-w;return {x:h,y:p,barHeight:w,barWidth:u,item:c}}),s=e.map((c,g)=>{let f=(r-n*2)/e.length,u=n+g*f+f/2,h=a-n-c.lineValue/l*(a-n*2);return {x:u,y:h,item:c}});return jsxs(Stack,{spacing:1.25,children:[jsxs(Box,{component:"svg",viewBox:`0 0 ${r} ${a}`,sx:{width:"100%",height:a},children:[jsx("line",{x1:n,y1:a-n,x2:r-n,y2:a-n,stroke:"rgba(148,163,184,0.4)"}),d.map(c=>jsx("rect",{x:c.x,y:c.y,width:c.barWidth,height:Math.max(c.barHeight,4),rx:6,fill:t},c.item.name)),jsx("polyline",{fill:"none",stroke:o,strokeWidth:3,points:s.map(c=>`${c.x},${c.y}`).join(" ")}),s.map(c=>jsx("circle",{cx:c.x,cy:c.y,r:3.5,fill:o},`${c.item.name}-line`))]}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`,gap:1},children:e.map(c=>jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"caption",noWrap:true,title:c.name,sx:{display:"block"},children:c.name}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:["Bar: ",c.barValue.toFixed(1)]}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:["Line: ",c.lineValue.toFixed(1)]})]},c.name))})]})};var xh=e=>`rgba(30, 136, 229, ${.2+Math.max(0,Math.min(1,e))*.8})`,Vd=({data:e})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let t=Array.from(new Set(e.map(n=>n.x))),o=Array.from(new Set(e.map(n=>n.y))),a=Math.max(...e.map(n=>n.value),1),r=new Map(e.map(n=>[`${n.y}__${n.x}`,n.value]));return jsx(Box,{sx:{overflowX:"auto"},children:jsxs(Box,{sx:{display:"grid",gridTemplateColumns:`120px repeat(${t.length}, minmax(64px, 1fr))`,gap:1,minWidth:120+t.length*64},children:[jsx(Box,{}),t.map(n=>jsx(Typography,{variant:"caption",sx:{textAlign:"center",fontWeight:600},children:n},n)),o.map(n=>jsxs(Box,{sx:{display:"contents"},children:[jsx(Typography,{variant:"caption",sx:{alignSelf:"center"},children:n}),t.map(i=>{let l=r.get(`${n}__${i}`)||0,d=l/a;return jsx(Box,{sx:{height:36,borderRadius:1,bgcolor:xh(d),border:"1px solid rgba(148,163,184,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsx(Typography,{variant:"caption",fontWeight:700,children:l.toFixed(1)})},`${n}-${i}`)})]},n))]})})};var vh=["#1E88E5","#1ABC9C","#FBC02D","#EF5350","#7E57C2","#78909C"],Li=({data:e,variant:t="donut",colors:o=vh,size:a=180,activeName:r,onItemClick:n})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let i=0,l=e.map((d,s)=>{let c=i;return i+=d.percent,`${o[s%o.length]} ${c}% ${i}%`});return jsxs(Stack,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:"center",children:[jsx(Box,{sx:{width:a,height:a,borderRadius:"50%",background:`conic-gradient(${l.join(", ")})`,position:"relative",flexShrink:0},children:t==="donut"&&jsx(Box,{sx:{position:"absolute",inset:Math.round(a*.18),bgcolor:"background.paper",borderRadius:"50%"}})}),jsx(Stack,{spacing:1,sx:{minWidth:180},children:e.map((d,s)=>jsxs(Box,{onClick:()=>n?.(d),sx:{display:"flex",alignItems:"center",gap:1,cursor:n?"pointer":"default",opacity:r&&d.name!==r?.45:1},children:[jsx(Box,{sx:{width:10,height:10,borderRadius:"50%",bgcolor:o[s%o.length]}}),jsx(Typography,{variant:"caption",sx:{flex:1},children:d.name}),jsxs(Typography,{variant:"caption",sx:{fontWeight:700},children:[d.percent.toFixed(0),"%"]})]},d.name))})]})};var Wd=({effect:e,branches:t})=>{if(t.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let o=t.filter((r,n)=>n%2===0),a=t.filter((r,n)=>n%2===1);return jsxs(Stack,{spacing:1.5,children:[jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${Math.max(o.length,1)}, minmax(0, 1fr))`,gap:1},children:o.map(r=>jsxs(Box,{sx:{borderLeft:"2px solid",borderColor:"divider",pl:1},children:[jsx(Typography,{variant:"caption",fontWeight:700,children:r.title}),r.causes.map(n=>jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:n},n))]},r.title))}),jsxs(Box,{sx:{position:"relative",height:32},children:[jsx(Box,{sx:{position:"absolute",inset:"50% 0 auto 0",borderTop:"2px solid",borderColor:"primary.main"}}),jsx(Box,{sx:{position:"absolute",right:0,top:"calc(50% - 12px)",px:1,py:.25,borderRadius:1,bgcolor:"primary.main",color:"primary.contrastText"},children:jsx(Typography,{variant:"caption",fontWeight:700,children:e})})]}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${Math.max(a.length,1)}, minmax(0, 1fr))`,gap:1},children:a.map(r=>jsxs(Box,{sx:{borderLeft:"2px solid",borderColor:"divider",pl:1},children:[jsx(Typography,{variant:"caption",fontWeight:700,children:r.title}),r.causes.map(n=>jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:n},n))]},r.title))})]})};var Hd=({data:e,height:t=240})=>{if(e.length===0)return jsx(Typography,{variant:"body2",color:"text.secondary",children:"No data"});let o=0,a=e.map(g=>{let f=g.type==="total"?0:o,u=g.type==="total"?g.value:o+g.value;return g.type!=="total"&&(o=u),{...g,start:f,end:u,delta:u-f}}),r=a.flatMap(g=>[g.start,g.end]),n=Math.min(...r,0),i=Math.max(...r,1),l=680,d=30,s=i-n||1,c=g=>t-d-(g-n)/s*(t-d*2);return jsxs(Box,{children:[jsxs(Box,{component:"svg",viewBox:`0 0 ${l} ${t}`,sx:{width:"100%",height:t},children:[jsx("line",{x1:d,y1:c(0),x2:l-d,y2:c(0),stroke:"rgba(148,163,184,0.4)"}),a.map((g,f)=>{let u=(l-d*2)/a.length,h=Math.max(u*.55,8),w=d+f*u+(u-h)/2,p=c(Math.max(g.start,g.end)),v=c(Math.min(g.start,g.end)),m=g.type==="total"?"#42A5F5":g.delta>=0?"#66BB6A":"#EF5350";return jsxs("g",{children:[jsx("rect",{x:w,y:p,width:h,height:Math.max(v-p,4),rx:6,fill:m}),jsx("text",{x:w+h/2,y:p-6,textAnchor:"middle",fill:"currentColor",fontSize:"11",children:g.end.toFixed(1)})]},g.name)})]}),jsx(Box,{sx:{mt:1,display:"grid",gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`,gap:1},children:a.map(g=>jsx(Typography,{variant:"caption",noWrap:true,title:g.name,children:g.name},g.name))})]})};var En=({apiKey:e,query:t,zoom:o=14,mapType:a="roadmap"})=>{let r=encodeURIComponent(t);return `https://www.google.com/maps/embed/v1/place?key=${encodeURIComponent(e)}&q=${r}&zoom=${o}&maptype=${a}`},LI=(e,t=360)=>{let o=En(e);return `<iframe width="100%" height="${t}" style="border:0" loading="lazy" allowfullscreen referrerpolicy="no-referrer-when-downgrade" src="${o}"></iframe>`};var Kd=({apiKey:e,query:t,embedUrl:o,zoom:a=14,mapType:r="roadmap",height:n=320})=>{let i=o||(e&&t?En({apiKey:e,query:t,zoom:a,mapType:r}):"");return i?jsxs(Box,{children:[jsx(Box,{component:"iframe",src:i,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",sx:{width:"100%",height:n,border:0,borderRadius:2}}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{mt:.75,display:"block"},children:["If iframe is blocked, open directly: ",jsx(Link,{href:i,target:"_blank",rel:"noreferrer",children:"Google Maps"})]})]}):jsx(Box,{children:jsx(Typography,{variant:"body2",color:"text.secondary",children:"Google Map requires `embedUrl` or (`apiKey` + `query`)."})})};var Vi=({keyword:e,location:t,src:o="orbcafe-ui"})=>{if(t){let a=encodeURIComponent(t.name||e||"Location");return `https://uri.amap.com/marker?position=${t.lng},${t.lat}&name=${a}&src=${encodeURIComponent(o)}&coordinate=gaode&callnative=0`}return e?`https://uri.amap.com/search?keyword=${encodeURIComponent(e)}&src=${encodeURIComponent(o)}&callnative=0`:"https://uri.amap.com/search?keyword=%E5%8C%97%E4%BA%AC&src=orbcafe-ui&callnative=0"};var jd=({keyword:e,location:t,embedUrl:o,height:a=320})=>{let r=o||Vi({keyword:e,location:t?{lng:t.lng,lat:t.lat,name:t.name}:void 0});return jsxs(Box,{children:[jsx(Box,{component:"iframe",src:r,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",sx:{width:"100%",height:a,border:0,borderRadius:2}}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{mt:.75,display:"block"},children:["If iframe is blocked, open directly: ",jsx(Link,{href:r,target:"_blank",rel:"noreferrer",children:"AMap"})]})]})};var Xd=({billableByPrimary:e,efficiencyBySecondary:t,statusDistribution:o,interaction:a})=>{let{t:r}=Z();return jsxs(Box,{sx:{display:"grid",gap:1.5,gridTemplateColumns:{xs:"1fr",lg:"1.2fr 1.2fr 1fr"}},children:[jsx(Ri,{title:r("graph.chart.billable.title"),subtitle:r("graph.chart.billable.subtitle"),children:jsx(An,{data:e,orientation:"horizontal",activeName:a?.filters?.primaryDimension,onItemClick:n=>a?.onPrimaryDimensionClick?.(n.name)})}),jsx(Ri,{title:r("graph.chart.efficiency.title"),subtitle:r("graph.chart.efficiency.subtitle"),children:jsx(An,{data:t,orientation:"vertical",valueSuffix:"%",activeName:a?.filters?.secondaryDimension,onItemClick:n=>a?.onSecondaryDimensionClick?.(n.name)})}),jsx(Ri,{title:r("graph.chart.status.title"),subtitle:r("graph.chart.status.subtitle"),children:jsx(Li,{data:o,variant:"donut",activeName:a?.filters?.status,onItemClick:n=>a?.onStatusClick?.(n.name)})})]})};var Wt=e=>jsx(TextField,{...e,variant:e.variant||"outlined",size:e.size||"small",fullWidth:e.fullWidth!==void 0?e.fullWidth:true});var Fl=e=>jsx(TextField,{...e,multiline:true,minRows:3,fullWidth:true,variant:"outlined"});var Oh=["doubao-lite","gpt-4o-mini","gpt-4.1-mini","claude-3.5-sonnet"],Wh=["zh","en","de","fr","ja","ko"],Jd=({open:e,onClose:t,value:o,onSaveAll:a,modelOptions:r=Oh,promptLangOptions:n=Wh,analysisTemplateOptions:i=[],responseTemplateOptions:l=[],defaultAnalysisTemplateId:d,defaultResponseTemplateId:s})=>{let[c,g]=useState(o),[f,u]=useState(d||""),[h,w]=useState(s||""),[p,v]=useState(false);useEffect(()=>{e&&(g(o),u(d||""),w(s||""));},[e,o,d,s]);let m=(x,k)=>{g(F=>({...F,[x]:k}));},y=async()=>{if(a)try{v(!0),await a({settings:c,analysisTemplateId:f||void 0,responseTemplateId:h||void 0});}finally{v(false);}};return jsxs(Dialog,{open:e,onClose:t,fullWidth:true,maxWidth:"lg",children:[jsxs(DialogTitle,{sx:{pr:7,pb:2.2},children:[jsx(Typography,{variant:"h5",sx:{fontWeight:800},children:"AI Settings"}),jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:"Configure LLM settings and editable agent prompts by language."}),jsx(IconButton,{onClick:t,sx:{position:"absolute",right:12,top:12},children:jsx(Vh,{})})]}),jsx(DialogContent,{sx:{pt:"18px !important"},children:jsxs(Stack,{spacing:2.2,children:[jsxs(Box,{sx:{mt:.8,display:"grid",gap:1.5,gridTemplateColumns:{xs:"1fr",md:"repeat(2, minmax(0, 1fr))"}},children:[jsx(Box,{children:jsx(Wt,{size:"small",value:c.baseUrl,onChange:x=>m("baseUrl",x.target.value),fullWidth:true,label:"Base URL"})}),jsx(Box,{children:jsx(Wt,{size:"small",type:"password",value:c.apiKey,onChange:x=>m("apiKey",x.target.value),fullWidth:true,label:"API Key"})}),jsx(Box,{children:jsx(Wt,{size:"small",value:c.model,onChange:x=>m("model",x.target.value),fullWidth:true,select:true,label:"Model",children:r.map(x=>jsx(MenuItem,{value:x,children:x},x))})}),jsx(Box,{children:jsx(Wt,{size:"small",value:c.promptLang,onChange:x=>m("promptLang",x.target.value),fullWidth:true,select:true,label:"Prompt Lang",children:n.map(x=>jsx(MenuItem,{value:x,children:x},x))})})]}),jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[jsxs(Wt,{size:"small",value:f,onChange:x=>u(x.target.value),fullWidth:true,select:true,label:"Analysis Template",children:[jsx(MenuItem,{value:"",children:"Default"}),i.map(x=>jsx(MenuItem,{value:x.id,children:x.label},x.id))]}),jsx(Fl,{multiline:true,minRows:8,value:c.analysisPrompt,onChange:x=>m("analysisPrompt",x.target.value),fullWidth:true,label:"Analysis Prompt",sx:{"& .MuiInputBase-root":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"}}}),jsxs(Wt,{size:"small",value:h,onChange:x=>w(x.target.value),fullWidth:true,select:true,label:"Response Template",children:[jsx(MenuItem,{value:"",children:"Default"}),l.map(x=>jsx(MenuItem,{value:x.id,children:x.label},x.id))]}),jsx(Fl,{multiline:true,minRows:8,value:c.responsePrompt,onChange:x=>m("responsePrompt",x.target.value),fullWidth:true,label:"Response Prompt",sx:{"& .MuiInputBase-root":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"}}})]})]})}),jsxs(DialogActions,{sx:{px:3,pb:2.5,pt:1.2,gap:1},children:[jsx(Button,{variant:"outlined",onClick:t,children:"Cancel"}),jsx(Button,{variant:"contained",onClick:y,disabled:!a||p,children:"Save"})]})]})};var Gi=({open:e,onClose:t,model:o,tableContent:a,extraCharts:r,interaction:n,aiAssistant:i})=>{let{t:l}=Z(),[d,s]=useState(i?.defaultPrompt||""),[c,g]=useState(false),[f,u]=useState(false),h=n?.enabled!==false&&!!n,w=i?.enabled!==false,p=n?.filters||{},v=!!(p.primaryDimension||p.secondaryDimension||p.status),m=i?.placeholder||"Ask AI to analyze data, create charts, or find insights...";useEffect(()=>{e&&s(i?.defaultPrompt||"");},[e,i?.defaultPrompt]);let y=i?.settings||{baseUrl:"/llm-api",apiKey:"",model:"doubao-lite",promptLang:"zh",analysisPrompt:"",responsePrompt:""},x=async()=>{let k=d.trim();if(!(!k||!i?.onSubmit))try{g(!0),await i.onSubmit(k,{filters:p,model:o});}finally{g(false);}};return jsx(Dialog,{open:e,onClose:t,fullScreen:true,children:jsxs(Box,{sx:{height:"100%",display:"flex",flexDirection:"column",bgcolor:"background.default"},children:[jsx(Box,{sx:{p:2,borderBottom:1,borderColor:"divider"},children:jsxs(Stack,{direction:{xs:"column",lg:"row"},alignItems:{xs:"stretch",lg:"center"},justifyContent:"space-between",spacing:1.5,children:[jsxs(Stack,{direction:"row",spacing:1.25,alignItems:"center",sx:{flexWrap:"wrap"},children:[jsx(Typography,{variant:"h5",fontWeight:800,children:o.title}),jsx(Chip,{size:"small",label:l("graph.records",{count:o.kpis.totalRecords})}),h&&p.primaryDimension&&jsx(Chip,{size:"small",variant:"outlined",label:`${n?.fieldMapping.primaryDimension}: ${p.primaryDimension}`,onDelete:()=>n?.onClearFilter("primaryDimension")}),h&&p.secondaryDimension&&jsx(Chip,{size:"small",variant:"outlined",label:`${n?.fieldMapping.secondaryDimension}: ${p.secondaryDimension}`,onDelete:()=>n?.onClearFilter("secondaryDimension")}),h&&p.status&&jsx(Chip,{size:"small",variant:"outlined",label:`${n?.fieldMapping.status}: ${p.status}`,onDelete:()=>n?.onClearFilter("status")}),h&&v&&jsx(Button,{size:"small",onClick:()=>n?.onClearAll(),children:"Clear"})]}),jsxs(Stack,{direction:"row",spacing:1.25,alignItems:"center",sx:{width:{xs:"100%",lg:"auto"}},children:[w&&jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.2,py:.4,borderRadius:999,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",minWidth:{xs:0,lg:520},flex:{xs:1,lg:"0 0 auto"}},children:[jsx(IconButton,{size:"small",onClick:i?.onVoiceInput,children:jsx(qh,{sx:{fontSize:18,color:"text.secondary"}})}),jsx(InputBase,{fullWidth:true,value:d,onChange:k=>s(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),x());},placeholder:m,sx:{fontSize:"0.9rem"}}),jsx(IconButton,{size:"small",onClick:x,disabled:c||!d.trim(),children:jsx(Zh,{sx:{fontSize:18}})}),jsx(IconButton,{size:"small",onClick:()=>u(true),children:jsx(_h,{sx:{fontSize:18}})})]}),jsx(IconButton,{onClick:t,children:jsx(Vh,{})})]})]})}),jsxs(Box,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5,overflow:"auto",minHeight:0},children:[jsx(Bd,{kpis:o.kpis}),jsx(Xd,{billableByPrimary:o.charts.billableByPrimary,efficiencyBySecondary:o.charts.efficiencyBySecondary,statusDistribution:o.charts.statusDistribution,interaction:h?{filters:p,onPrimaryDimensionClick:k=>n?.onPrimaryDimensionClick(k),onSecondaryDimensionClick:k=>n?.onSecondaryDimensionClick(k),onStatusClick:k=>n?.onStatusClick(k)}:void 0}),r,a]}),jsx(Jd,{open:f,onClose:()=>u(false),value:y,onSaveAll:i?.onSaveAll,modelOptions:i?.modelOptions,promptLangOptions:i?.promptLangOptions,analysisTemplateOptions:i?.analysisTemplateOptions,responseTemplateOptions:i?.responseTemplateOptions,defaultAnalysisTemplateId:i?.defaultAnalysisTemplateId,defaultResponseTemplateId:i?.defaultResponseTemplateId})]})})};var Pa={primaryDimension:["Client","Customer","Category","Project"],secondaryDimension:["Person","Consultant","Owner","Name"],status:["Status","state"],date:["Date","WorkDate","CreatedAt"],description:["Description","Task","Title","Memo"],reportHours:["Report_Hour","Report Hours","Hours","ReportHours"],billableHours:["Billable_Hour","Billable Hours","BillableHours"],amount:["Amount","Billable_Amount","Total_Amount","Value"]},Xh=5,ep=e=>e.toLowerCase().replace(/[\s_-]/g,""),Ra=(e,t,o,a)=>{if(t)return t;if(e.length===0)return a;let r=Object.keys(e[0]),n=new Map(r.map(i=>[ep(i),i]));for(let i of o){let l=n.get(ep(i));if(l)return l}return r[0]||a},to=e=>{if(typeof e=="number")return Number.isFinite(e)?e:0;if(typeof e=="string"){let t=Number(e.replace(/,/g,"").trim());return Number.isFinite(t)?t:0}return 0},Bt=(e,t)=>e==null||e===""?t:String(e),Qh=(e,t,o,a,r)=>{let n=new Map;return e.forEach(i=>{let l=Bt(i[t],r);n.set(l,(n.get(l)||0)+to(i[o]));}),Array.from(n.entries()).map(([i,l])=>({name:i,value:l})).sort((i,l)=>l.value-i.value).slice(0,a)},Yh=(e,t,o,a,r,n)=>{let i=new Map;return e.forEach(l=>{let d=Bt(l[t],n),s=i.get(d)||{report:0,billable:0};s.report+=to(l[o]),s.billable+=to(l[a]),i.set(d,s);}),Array.from(i.entries()).map(([l,d])=>({name:l,value:d.report>0?d.billable/d.report*100:0})).sort((l,d)=>l.value-d.value).slice(0,r)},Jh=(e,t,o)=>{let a=e.length;if(a===0)return [];let r=new Map;return e.forEach(n=>{let i=Bt(n[t],o);r.set(i,(r.get(i)||0)+1);}),Array.from(r.entries()).map(([n,i])=>({name:n,value:i,percent:i/a*100}))},tp=(e,t,o)=>{let a=new Map;return e.forEach(r=>{let n=Bt(r[t],"N/A");a.set(n,(a.get(n)||0)+to(r[o]));}),Array.from(a.entries()).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>({name:r,value:n}))},ey=(e,t,o,a,r,n)=>{let i=new Map;return e.forEach(l=>{let d=Bt(l[t],n),s=i.get(d)||{report:0,billable:0};s.report+=to(l[o]),s.billable+=to(l[a]),i.set(d,s);}),Array.from(i.entries()).map(([l,d])=>({name:l,barValue:d.billable,lineValue:d.report>0?d.billable/d.report*100:0})).sort((l,d)=>d.barValue-l.barValue).slice(0,r)},ty=(e,t,o,a,r)=>{let n=new Map;return e.forEach(i=>{let l=Bt(i[t],r),d=Bt(i[o],r),s=`${l}__${d}`;n.set(s,(n.get(s)||0)+to(i[a]));}),Array.from(n.entries()).map(([i,l])=>{let[d,s]=i.split("__");return {x:d,y:s,value:l}})},oy=(e,t,o)=>{let a=tp(e,t,o),r=a.map(i=>({name:i.name,value:i.value,type:"delta"})),n=a.reduce((i,l)=>i+l.value,0);return [...r,{name:"Total",value:n,type:"total"}]},ay=(e,t,o,a,r,n)=>{let i=new Map;return e.forEach(l=>{let d=Bt(l[t],n),s=`${Bt(l[o],n)} / ${Bt(l[a],n)}`,c=i.get(d)||new Map;c.set(s,(c.get(s)||0)+1),i.set(d,c);}),Array.from(i.entries()).map(([l,d])=>({title:l,causes:Array.from(d.entries()).sort((s,c)=>c[1]-s[1]).slice(0,r).map(([s,c])=>`${s} (${c})`)})).slice(0,6)},_r=({rows:e,config:t})=>{let{t:o}=Z(),a=o("graph.unassigned"),r=useMemo(()=>{let c=t?.fieldMapping;return {primaryDimension:Ra(e,c?.primaryDimension,Pa.primaryDimension,"Category"),secondaryDimension:Ra(e,c?.secondaryDimension,Pa.secondaryDimension,"Owner"),status:Ra(e,c?.status,Pa.status,"Status"),date:Ra(e,c?.date,Pa.date,"Date"),description:Ra(e,c?.description,Pa.description,"Description"),reportHours:Ra(e,c?.reportHours,Pa.reportHours,"ReportHours"),billableHours:Ra(e,c?.billableHours,Pa.billableHours,"BillableHours"),amount:Ra(e,c?.amount,Pa.amount,"Amount")}},[e,t?.fieldMapping]),n=useMemo(()=>e.map((c,g)=>{let f=to(c[r.reportHours]),u=to(c[r.billableHours]),h=to(c[r.amount]),w=f>0?u/f*100:0;return {id:`graph-row-${g}`,Date:Bt(c[r.date],""),Primary:Bt(c[r.primaryDimension],a),Secondary:Bt(c[r.secondaryDimension],a),Description:Bt(c[r.description],""),ReportHours:f,BillableHours:u,Amount:h,Efficiency:w,Status:Bt(c[r.status],a)}}),[e,r,a]),i=useMemo(()=>{let c=n.length,g=n.reduce((v,m)=>v+to(m.ReportHours),0),f=n.reduce((v,m)=>v+to(m.BillableHours),0),u=n.reduce((v,m)=>v+to(m.Amount),0),h=g>0?f/g*100:0,w=t?.statusFlagValues||["flag","flagged","warning","risk"],p=n.filter(v=>w.includes(Bt(v.Status,"").toLowerCase())).length;return {totalRecords:c,totalReportHours:g,totalBillableHours:f,efficiency:h,totalAmount:u,flaggedCount:p}},[n,t?.statusFlagValues]),l=t?.topN||Xh,d=useMemo(()=>({billableByPrimary:Qh(n,"Primary","BillableHours",l,a),efficiencyBySecondary:Yh(n,"Secondary","ReportHours","BillableHours",l,a),statusDistribution:Jh(n,"Status",a),lineByDate:tp(n,"Date","BillableHours"),comboByPrimary:ey(n,"Primary","ReportHours","BillableHours",l,a),heatmapPrimarySecondary:ty(n,"Primary","Secondary","BillableHours",a),waterfallBillable:oy(n,"Date","BillableHours"),fishboneStatusCauses:ay(n,"Status","Primary","Secondary",3,a)}),[n,l,a]),s=useMemo(()=>({title:t?.title||o("graph.reportTitle"),kpis:i,charts:d,table:{columns:[{id:"Date",label:r.date},{id:"Primary",label:r.primaryDimension},{id:"Secondary",label:r.secondaryDimension},{id:"Description",label:r.description},{id:"ReportHours",label:o("graph.column.reportHours"),align:"right"},{id:"BillableHours",label:o("graph.column.billableHours"),align:"right"},{id:"Amount",label:"Amount",align:"right"},{id:"Efficiency",label:"Efficiency",align:"right"},{id:"Status",label:r.status}],rows:n}}),[d,t?.title,r,i,n,o]);return {fieldMapping:r,model:s}};var Zr=e=>String(e??"").trim(),Ki=(e={})=>{let[t,o]=useState(e),a=useCallback((d,s)=>{o(c=>{let g=s?.trim();if(!g){let f={...c};return delete f[d],f}if(c[d]===g){let f={...c};return delete f[d],f}return {...c,[d]:g}});},[]),r=useCallback(d=>{o(s=>{if(!s[d])return s;let c={...s};return delete c[d],c});},[]),n=useCallback(()=>{o({});},[]),i=useMemo(()=>!!(t.primaryDimension||t.secondaryDimension||t.status),[t]),l=useCallback((d,s)=>d.filter(c=>!(t.primaryDimension&&Zr(c[s.primaryDimension])!==Zr(t.primaryDimension)||t.secondaryDimension&&Zr(c[s.secondaryDimension])!==Zr(t.secondaryDimension)||t.status&&Zr(c[s.status])!==Zr(t.status))),[t]);return {filters:t,setFilter:a,clearFilter:r,clearAll:n,hasActiveFilters:i,applyRows:l}};var _i=({variants:e,currentVariantId:t,onLoad:o,onSave:a,onDelete:r,onSetDefault:n})=>{let{t:i}=Z(),d=useTheme().palette.mode==="dark",s="0.85rem",c={xs:"calc((100% - 1 * 16px) / 2)",sm:"calc((100% - 2 * 16px) / 3)",md:"calc((100% - 3 * 16px) / 4)",lg:"calc((100% - 5 * 16px) / 6)"},[g,f]=useState(false),[u,h]=useState(""),[w,p]=useState(false),[v,m]=useState(false),y=e.find(F=>F.id===t),x=()=>{h(y?.name||i("variant.newVariant")),p(y?.isDefault||false),m(y?.isPublic||false),f(true);},k=()=>{a({name:u,isDefault:w,isPublic:v,description:""}),f(false);};return jsxs(Box,{sx:{display:"flex",gap:1,alignItems:"center",width:"100%",maxWidth:"100%"},children:[jsx(Autocomplete,{size:"small",sx:{width:c,"& .MuiInputBase-root":{fontSize:s,bgcolor:d?"rgba(25, 118, 210, 0.2)":"#e7f1ff","& .MuiOutlinedInput-notchedOutline":{borderColor:d?"rgba(144,202,249,0.45)":"rgba(25,118,210,0.45)"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:d?"rgba(144,202,249,0.7)":"rgba(25,118,210,0.65)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:d?"rgba(144,202,249,0.9)":"rgba(25,118,210,0.85)"}},"& .MuiInputBase-input":{fontSize:s},"& .MuiAutocomplete-noOptions":{fontSize:s}},noOptionsText:jsx(Typography,{sx:{fontSize:s},children:i("variant.noOptions")}),options:e,getOptionLabel:F=>F.name+(F.isDefault?` (${i("variant.defaultSuffix")})`:""),value:y||null,onChange:(F,S)=>{S&&o(S);},renderInput:F=>jsx(TextField,{...F,variant:"outlined",size:"small",InputProps:{...F.InputProps,sx:{fontSize:s,color:d?"#E3F2FD":"#0D47A1"}},placeholder:i("variant.selectVariant")}),renderOption:(F,S)=>jsx("li",{...F,children:jsxs(Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[jsx(Typography,{sx:{flex:1,fontSize:s},children:S.name}),S.isDefault&&jsx(fy,{fontSize:"small",color:"action"})]})})}),jsx(Tooltip,{title:i("variant.saveView"),children:jsx(IconButton,{onClick:x,size:"small",color:"primary",children:jsx(kp,{fontSize:"small"})})}),jsxs(Dialog,{open:g,onClose:()=>f(false),children:[jsx(DialogTitle,{children:i("variant.saveView")}),jsxs(DialogContent,{children:[jsx(TextField,{autoFocus:true,margin:"dense",label:i("variant.viewName"),fullWidth:true,variant:"outlined",value:u,onChange:F=>h(F.target.value)}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:w,onChange:F=>p(F.target.checked)}),label:i("variant.setDefault")}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:v,onChange:F=>m(F.target.checked)}),label:i("variant.publicAllUsers")})]}),jsxs(DialogActions,{children:[jsx(Button,{onClick:()=>f(false),children:i("common.cancel")}),jsx(Button,{onClick:k,variant:"contained",children:i("common.save")})]})]})]})};var cp=({appId:e,tableKey:t="default",currentFilters:o,currentLayoutId:a,layoutRefs:r,onLoad:n,variantService:i,serviceUrl:l,onError:d,onSuccess:s,currentVariantId:c,onVariantChange:g})=>{let{t:f}=Z(),[u,h]=useState([]),[w,p]=useState(""),v=`orbcafe.variants.${e}.${t}`,m=c!==void 0?c:w,y=D=>{c===void 0&&p(D),g&&g(D);},x=useCallback(()=>{try{let D=localStorage.getItem(v);if(!D)return [];let I=JSON.parse(D);return Array.isArray(I)?I:[]}catch{return []}},[v]),k=useCallback(D=>{try{localStorage.setItem(v,JSON.stringify(D));}catch{}},[v]),F=useCallback(D=>{h(D);let I=D.find(P=>P.isDefault);I&&!m&&(y(I.id),n(I));},[m,n,y]),S=useCallback(async()=>{if(!e)return [];try{let D=[];if(i)D=await i.getVariants(e,t);else if(l){let I=await fetch(`${l}/api/variants?appId=${encodeURIComponent(e)}&tableKey=${encodeURIComponent(t)}`);if(!I.ok)throw new Error(f("variant.toast.fetchFailed"));D=await I.json();}else D=x();return F(D),D}catch(D){console.error("Error fetching variants",D);let I=x();return F(I),d&&d(f("variant.toast.fetchFailed")),I}},[e,t,i,l,x,F,d,f]);return useEffect(()=>{S();},[e,t]),jsx(_i,{variants:u,currentVariantId:m,onLoad:D=>{y(D.id),n(D);},onSave:async D=>{let I=Date.now().toString(),P;try{let M=D.scope||"Both",$=u.find(te=>te.name===D.name);I=$?$.id:Date.now().toString();let N=[];if($&&(Array.isArray($.filters)?N=[...$.filters]:$.filters&&(N=[{scope:"default",filters:$.filters}])),M==="Search"||M==="Both"){let te=(Array.isArray(o),o);if(te)if(Array.isArray(te)&&te.length>0&&te[0].scope)te.forEach(re=>{let Q=N.findIndex(U=>U.scope===re.scope);Q>=0?N[Q]=re:N.push(re);});else {let re={scope:t,filters:te},Q=N.findIndex(U=>U.scope===t);Q>=0?N[Q]=re:N.push(re);}}let X=$?.layout||{},oe=[];if($&&Array.isArray($.layoutRefs)&&(oe=[...$.layoutRefs]),M==="Layout"||M==="Both")if(r&&r.length>0)r.forEach(te=>{let re=oe.findIndex(Q=>Q.tableKey===te.tableKey);re>=0?oe[re]=te:oe.push(te);});else {let te={tableKey:t,layoutId:a||null},re=oe.findIndex(Q=>Q.tableKey===t);re>=0?oe[re]=te:oe.push(te);}if(P={appId:e,tableKey:t,...D,scope:M,id:I,createdAt:new Date().toISOString(),filters:N,layout:X,layoutRefs:oe},i)await i.saveVariant(P,e,t);else if(l){if(!(await fetch(`${l}/api/variants`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).ok)throw new Error(f("variant.toast.saveFailed"))}else {let re=u.some(Q=>Q.id===I)?u.map(Q=>Q.id===I?P:Q):[...u,P];h(re),k(re);}s&&s(f("variant.toast.saveSuccess")),(i||l)&&await S(),y(I),n(P);}catch(M){console.error("Error saving variant",M);let N=u.some(X=>X.id===I)?u.map(X=>X.id===I?P:X):[...u,P];h(N),k(N),y(I),n(P),d&&d(f("variant.toast.saveFailed"));}},onDelete:async D=>{try{if(i)await i.deleteVariant(D);else if(l){if(!(await fetch(`${l}/api/variants/${D}`,{method:"DELETE"})).ok)throw new Error(f("variant.toast.deleteFailed"))}else {let I=u.filter(P=>P.id!==D);h(I),k(I);}m===D&&y(""),(i||l)&&S(),s&&s(f("variant.toast.deleteSuccess"));}catch(I){console.error("Error deleting variant",I);let P=u.filter(M=>M.id!==D);h(P),k(P),m===D&&y(""),d&&d(f("variant.toast.deleteFailed"));}},onSetDefault:async D=>{try{let I=u.find(M=>M.id===D);if(!I)return;let P={appId:e,tableKey:t,...I,isDefault:!0};if(i)await i.setDefaultVariant(D,e,t);else if(l){if(!(await fetch(`${l}/api/variants`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).ok)throw new Error(f("variant.toast.defaultFailed"))}else {let M=u.map($=>({...$,isDefault:$.id===D}));h(M),k(M);}(i||l)&&await S(),s&&s(f("variant.toast.defaultSuccess"));}catch(I){console.error("Error setting default variant",I);let P=u.map(M=>({...M,isDefault:M.id===D}));h(P),k(P),d&&d(f("variant.toast.defaultFailed"));}}})};Ua.extend(Fy);Ua.extend(Ey);var Ly=[null,null],Vl="0.85rem",zy={en:"en",zh:"zh-cn",fr:"fr",de:"de",ja:"ja",ko:"ko"},Ny=styled(PickersDay,{shouldForwardProp:e=>e!=="isInRange"&&e!=="isStart"&&e!=="isEnd"&&e!=="isHovered"})(({theme:e,isInRange:t,isStart:o,isEnd:a,isHovered:r})=>({...t&&{borderRadius:0,backgroundColor:e.palette.primary.light,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.main}},...r&&!t&&!o&&!a&&{borderRadius:0,backgroundColor:e.palette.action.hover,border:`1px dashed ${e.palette.primary.main}`},...o&&{borderRadius:"50% 0 0 50%",backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}},...a&&{borderRadius:"0 50% 50% 0",backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText,"&:hover":{backgroundColor:e.palette.primary.dark}},...o&&a&&{borderRadius:"50%"}})),up=({label:e,value:t=Ly,onChange:o})=>{let{t:a,locale:r}=Z(),n=zy[r]||"en",i=e||a("dateRange.label"),[l,d]=useState(null),[s,c]=useState(t),[g,f]=useState("start"),[u,h]=useState(null),[w,p]=useState((t[0]||Ua()).locale(n)),v=ct__default.useRef(t);useEffect(()=>{let[I,P]=t,[M,$]=v.current,N=te=>te&&typeof te.isSame=="function",X=!(I===null&&M===null||N(I)&&N(M)&&I.isSame(M,"day")),oe=!(P===null&&$===null||N(P)&&N($)&&P.isSame($,"day"));(X||oe)&&(c(t),t[0]&&N(t[0])&&p(t[0].locale(n))),v.current=t;},[t,n]);let m=I=>{d(I.currentTarget);},y=()=>{d(null),f("start"),h(null);},x=!!l,k=I=>{if(!I)return;let P=[...s];if(g==="start")P=[I,null],f("end");else {let M=P[0];M&&I.isBefore(M)?(P=[I,null],f("end")):(P=[M,I],f("start"));}c(P);},F=I=>{let P=Ua().locale(n),M=[null,null];switch(I){case "today":M=[P,P];break;case "week":M=[P.startOf("week"),P.endOf("week")];break;case "month":M=[P.startOf("month"),P.endOf("month")];break}c(M),f("start"),p(P);},S=()=>{c([null,null]),f("start"),p(Ua().locale(n));},T=()=>{o&&o(s),y();},A=()=>{c(t),f("start"),y();},R=useCallback(I=>{let{day:P,...M}=I,[$,N]=s,X=$?P.isSame($,"day"):false,oe=N?P.isSame(N,"day"):false,te=$&&N?P.isBetween($,N,"day","()"):false,re=false;return g==="end"&&$&&!N&&u&&P.isAfter($,"day")&&P.isBefore(u.add(1,"day"),"day")&&(re=true),jsx(Ny,{...M,day:P,disableMargin:true,isStart:X,isEnd:oe,isInRange:te||re,onMouseEnter:()=>h(P)})},[s,g,u]),C=I=>I?I.locale(n).format("YYYY-MM-DD"):"",D=I=>I?I.locale(n).format("ll"):"";return jsxs(Box,{children:[jsx(TextField,{label:i,value:s[0]?`${C(s[0])} - ${C(s[1])}`:"",onClick:m,fullWidth:true,size:"small",InputLabelProps:{sx:{fontSize:Vl}},InputProps:{readOnly:true,sx:{fontSize:Vl,"& .MuiOutlinedInput-input":{fontSize:Vl},paddingRight:"4px"},endAdornment:jsxs(InputAdornment,{position:"end",sx:{ml:0},children:[(s[0]||s[1])&&jsx(IconButton,{size:"small",onClick:I=>{I.stopPropagation(),S();},edge:"end",sx:{mr:.5,padding:"2px"},children:jsx(Ay,{sx:{fontSize:"1rem"}})}),jsx(IconButton,{size:"small",edge:"end",onClick:m,sx:{padding:"2px"},children:jsx(My,{sx:{fontSize:"1rem"},color:"action"})})]})}}),jsxs(Popover,{open:x,anchorEl:l,onClose:y,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},slotProps:{paper:{sx:{display:"flex",flexDirection:"column",p:0,minWidth:320}}},children:[jsx(Box,{sx:{p:2,bgcolor:"background.default",borderBottom:1,borderColor:"divider"},children:jsxs(Stack,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",children:[jsxs(Box,{sx:{p:1,border:1,borderColor:g==="start"?"primary.main":"divider",borderRadius:1,bgcolor:g==="start"?"action.hover":"transparent",flex:1,cursor:"pointer"},onClick:()=>f("start"),children:[jsx(Typography,{variant:"caption",color:"text.secondary",display:"block",children:a("dateRange.startDate")}),jsx(Typography,{variant:"body2",fontWeight:500,children:s[0]?D(s[0]):a("dateRange.select")})]}),jsx(By,{color:"action",fontSize:"small"}),jsxs(Box,{sx:{p:1,border:1,borderColor:g==="end"?"primary.main":"divider",borderRadius:1,bgcolor:g==="end"?"action.hover":"transparent",flex:1,cursor:"pointer"},onClick:()=>{s[0]&&f("end");},children:[jsx(Typography,{variant:"caption",color:"text.secondary",display:"block",children:a("dateRange.endDate")}),jsx(Typography,{variant:"body2",fontWeight:500,children:s[1]?D(s[1]):a("dateRange.select")})]})]})}),jsx(Box,{sx:{p:2,pb:0},children:jsxs(Stack,{direction:"row",spacing:1,justifyContent:"center",children:[jsx(Chip,{label:a("dateRange.today"),onClick:()=>F("today"),clickable:true,size:"small",variant:"outlined"}),jsx(Chip,{label:a("dateRange.thisWeek"),onClick:()=>F("week"),clickable:true,size:"small",variant:"outlined"}),jsx(Chip,{label:a("dateRange.thisMonth"),onClick:()=>F("month"),clickable:true,size:"small",variant:"outlined"})]})}),jsx(LocalizationProvider,{dateAdapter:AdapterDayjs,adapterLocale:n,children:jsx(DateCalendar,{value:null,referenceDate:w,onMonthChange:p,onYearChange:p,onChange:k,slots:{day:R},views:["day"],showDaysOutsideCurrentMonth:true,sx:{m:0}})}),jsx(Divider,{}),jsxs(Stack,{direction:"row",justifyContent:"flex-end",spacing:1,sx:{p:2},children:[jsx(Button,{size:"small",onClick:A,color:"inherit",children:a("common.cancel")}),jsx(Button,{size:"small",variant:"contained",onClick:T,children:a("common.done")})]})]})]})};var Qi={equals:"=",contains:"\u2287",notContains:"\u2285",wildcard:"*","=":"=","!=":"!=",">":">","<":"<",">=":"\u2265","<=":"\u2264",between:"\u2194"},Zy={equals:"smartFilter.operator.equals",contains:"smartFilter.operator.contains",notContains:"smartFilter.operator.notContains",wildcard:"smartFilter.operator.wildcard","=":"smartFilter.operator.equals","!=":"smartFilter.operator.notEquals",">":"smartFilter.operator.greaterThan","<":"smartFilter.operator.lessThan",">=":"smartFilter.operator.greaterOrEqual","<=":"smartFilter.operator.lessOrEqual",between:"smartFilter.operator.between"},jy=["equals","contains","notContains","wildcard"],fp=["=","!=",">","<",">=","<=","between"],rt="0.85rem",Xy=({field:e,value:t,onChange:o})=>{let{t:a}=Z(),[r,n]=useState(null),[i,l]=useState(null),[d,s]=useState(""),[c,g]=useState(""),[f,u]=useState(false),[h,w]=useState(""),[p,v]=useState("");useEffect(()=>{let C=setTimeout(()=>{v(h);},1e3);return ()=>clearTimeout(C)},[h]);let m=t?.operator||(e.type==="number"?"=":"equals"),y=t?.value,x=C=>{let D=Zy[C];return D?a(D):C},k=C=>{n(C.currentTarget);},F=C=>{o({...t,operator:C,value:y}),n(null);},S={size:"small",fullWidth:true,variant:"outlined",InputLabelProps:{sx:{fontSize:rt}},InputProps:{sx:{fontSize:rt}},SelectProps:{MenuProps:{PaperProps:{sx:{"& .MuiMenuItem-root":{fontSize:rt,paddingTop:"4px",paddingBottom:"4px",minHeight:"auto"}}}}}},T=e.type||"text";if(T==="date"){let D=(I=>{if(!I)return [null,null];if(Array.isArray(I)&&I.length===2){let P=I[0]?Ua.isDayjs(I[0])?I[0]:Ua(I[0]):null,M=I[1]?Ua.isDayjs(I[1])?I[1]:Ua(I[1]):null;return [P,M]}return Ua.isDayjs(I)||typeof I=="string"?[Ua.isDayjs(I)?I:Ua(I),null]:[null,null]})(y);return jsx(up,{label:e.label,value:D,onChange:I=>o({value:I,operator:"between"})})}if(T==="number"&&m==="between"){let C=()=>{o({value:[d,c],operator:"between"}),l(null);},D=Array.isArray(y)?`${y[0]||""} - ${y[1]||""}`:"";return jsxs(Fragment,{children:[jsx(TextField,{...S,label:e.label,value:D,placeholder:a("smartFilter.minMaxPlaceholder"),InputProps:{...S.InputProps,startAdornment:jsx(InputAdornment,{position:"start",children:jsx(Tooltip,{title:x("between"),children:jsx(IconButton,{size:"small",onClick:k,sx:{width:24,height:24,fontSize:rt},children:Qi.between})})}),readOnly:true},onClick:I=>l(I.currentTarget)}),jsx(Menu,{anchorEl:r,open:!!r,onClose:()=>n(null),PaperProps:{sx:{"& .MuiMenuItem-root":{fontSize:rt,minHeight:"auto",py:.5}}},children:fp.map(I=>jsxs(MenuItem,{selected:I===m,onClick:()=>F(I),children:[jsx(Box,{sx:{width:24,display:"inline-block",fontWeight:"bold"},children:Qi[I]}),jsx(ListItemText,{primary:x(I),primaryTypographyProps:{fontSize:rt}})]},I))}),jsx(Popover,{open:!!i,anchorEl:i,onClose:()=>l(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},children:jsxs(Box,{sx:{p:2,display:"flex",gap:1,alignItems:"center"},children:[jsx(TextField,{size:"small",label:a("smartFilter.min"),type:"number",value:d,onChange:I=>s(I.target.value),sx:{width:100},InputLabelProps:{sx:{fontSize:rt}},InputProps:{sx:{fontSize:rt}}}),jsx(_y,{color:"action"}),jsx(TextField,{size:"small",label:a("smartFilter.max"),type:"number",value:c,onChange:I=>g(I.target.value),sx:{width:100},InputLabelProps:{sx:{fontSize:rt}},InputProps:{sx:{fontSize:rt}}}),jsx(Button,{variant:"contained",size:"small",onClick:C,children:a("common.ok")})]})})]})}if(T==="select")return jsxs(TextField,{...S,select:true,label:e.label,value:y||"",onChange:C=>o({...t,value:C.target.value,operator:"equals"}),children:[jsx(MenuItem,{value:"",children:jsx("em",{children:a("common.none")})}),e.options?.map(C=>jsx(MenuItem,{value:C.value,children:C.label},C.value))]});if(T==="multi-select"){let C=Array.isArray(y)?y:[],D=e.options?.filter(I=>I.label.toLowerCase().includes(p.toLowerCase()))||[];return jsxs(TextField,{...S,select:true,label:e.label,value:C,onChange:I=>o({...t,value:I.target.value,operator:"anyOf"}),SelectProps:{...S.SelectProps,multiple:true,onClose:()=>{w(""),v("");},renderValue:I=>{if(!Array.isArray(I)||I.length===0)return jsx("em",{children:a("common.none")});let P=$=>e.options?.find(N=>N.value===$)?.label||$,M=I.map(P);return M.length>2?`${M.slice(0,2).join(", ")} +${M.length-2}`:M.join(", ")}},children:[jsx(ListSubheader,{children:jsx(TextField,{size:"small",autoFocus:true,placeholder:a("smartFilter.searchPlaceholder"),fullWidth:true,InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(gp,{fontSize:"small"})}),sx:{fontSize:rt}},value:h,onChange:I=>w(I.target.value),onKeyDown:I=>{I.key!=="Escape"&&I.stopPropagation();},onClick:I=>I.stopPropagation()})}),D.length>0?D.map(I=>jsxs(MenuItem,{value:I.value,children:[jsx(Checkbox,{checked:C.indexOf(I.value)>-1,size:"small"}),jsx(ListItemText,{primary:I.label,primaryTypographyProps:{fontSize:rt}})]},I.value)):jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:a("smartFilter.noOptionsFound"),primaryTypographyProps:{fontSize:rt}})})]})}let A=T==="number"?fp:jy,R=f||y!==void 0&&y!==""&&y!==null||!!r;return jsxs(Fragment,{children:[jsx(TextField,{...S,label:e.label,sx:{minWidth:"120px"},value:y||"",type:T==="number"?"number":"text",onChange:C=>o({...t,value:C.target.value,operator:m}),onFocus:()=>u(true),onBlur:()=>u(false),InputProps:{...S.InputProps,startAdornment:R?jsx(InputAdornment,{position:"start",children:jsx(Tooltip,{title:x(m),children:jsx(IconButton,{size:"small",onClick:k,onMouseDown:C=>C.preventDefault(),sx:{width:24,height:24,fontSize:rt,fontWeight:"bold",color:"primary.main",bgcolor:"action.hover"},children:Qi[m]})})}):null,endAdornment:e.hasSearchIcon?jsx(InputAdornment,{position:"end",children:jsx(gp,{color:"action"})}):void 0}}),jsx(Menu,{anchorEl:r,open:!!r,onClose:()=>n(null),PaperProps:{sx:{"& .MuiMenuItem-root":{fontSize:rt,minHeight:"auto",py:.5}}},children:A.map(C=>jsxs(MenuItem,{selected:C===m,onClick:()=>F(C),children:[jsx(Box,{sx:{width:24,display:"inline-block",fontWeight:"bold"},children:Qi[C]}),jsx(ListItemText,{primary:x(C),primaryTypographyProps:{fontSize:rt}})]},C))})]})},cr=({fields:e,filters:t,onFilterChange:o,variants:a=[],currentVariantId:r,onVariantLoad:n,onVariantSave:i,onVariantDelete:l,onVariantSetDefault:d,onSearch:s,loading:c=false,appId:g,tableKey:f,currentLayout:u,currentLayoutId:h,layoutRefs:w,variantService:p,serviceUrl:v})=>{let{t:m}=Z(),[y,x]=useState(true),[k,F]=useState(null),[S,T]=useState(e.filter(D=>!D.hidden).map(D=>D.id)),A=(D,I)=>{o({...t,[D]:I});},R=D=>{S.includes(D)?T(S.filter(I=>I!==D)):T([...S,D]);};return jsxs(Paper,{sx:{mb:0,display:"flex",flexDirection:"column",overflow:"visible",position:"relative"},children:[jsxs(Box,{sx:{p:2,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[g?jsx(cp,{appId:g,tableKey:f,currentFilters:{values:t,visibleFields:S},currentLayout:u,currentLayoutId:h,layoutRefs:w,onLoad:D=>{if(!D.filters)return;let I=null;if(Array.isArray(D.filters)){let P=f||"default",M=D.filters.find($=>$.scope===P);I=M?M.filters:null;}else I=D.filters;I&&(I.values||I.visibleFields?(I.visibleFields&&Array.isArray(I.visibleFields)&&T(I.visibleFields),I.values&&o(I.values)):o(I)),n&&n(D);},variantService:p,serviceUrl:v,currentVariantId:r}):jsx(_i,{variants:a,currentVariantId:r,onLoad:n,onSave:D=>{i&&i({...D,filters:{values:t,visibleFields:S}});},onDelete:l,onSetDefault:d}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[jsx(Tooltip,{title:m("smartFilter.addFilters"),children:jsx(Button,{onClick:D=>F(D.currentTarget),size:"small",color:"primary",startIcon:jsx(Uy,{fontSize:"small"}),sx:{textTransform:"none",fontSize:rt,whiteSpace:"nowrap",minWidth:"fit-content"},children:m("smartFilter.adaptFilters")})}),jsx(Button,{variant:"contained",size:"small",onClick:s,disabled:c,sx:{minWidth:"52px",fontWeight:"bold",fontSize:rt},children:m(c?"common.loading":"smartFilter.go")}),jsxs(Menu,{anchorEl:k,open:!!k,onClose:()=>F(null),slotProps:{paper:{style:{maxHeight:400,width:"25ch"},sx:{"& .MuiMenuItem-root":{fontSize:rt,minHeight:32}}}},children:[jsx(MenuItem,{disabled:true,children:jsx(ListItemText,{primary:m("smartFilter.visibleFilters"),primaryTypographyProps:{fontSize:rt}})}),jsx(Divider,{}),e.map(D=>jsxs(MenuItem,{onClick:()=>R(D.id),children:[jsx(Checkbox,{checked:S.includes(D.id),size:"small"}),jsx(ListItemText,{primary:D.label,primaryTypographyProps:{fontSize:rt}})]},D.id))]})]})]}),jsx(Collapse,{in:y,children:jsx(Box,{sx:{px:2,pb:2},children:jsx(Grid,{container:true,spacing:2,columns:{xs:2,sm:3,md:4,lg:6},children:e.filter(D=>S.includes(D.id)).map(D=>jsx(Grid,{size:1,children:jsx(Xy,{field:D,value:t[D.id]||{value:"",operator:D.type==="number"?"=":"equals"},onChange:I=>A(D.id,I)})},D.id))})})}),jsx(Box,{sx:{position:"absolute",bottom:0,left:"50%",transform:"translate(-50%, 50%)",zIndex:10},children:jsx(IconButton,{size:"small",onClick:()=>x(!y),sx:{bgcolor:"background.paper",boxShadow:2,border:"1px solid",borderColor:"divider",width:20,height:20,minHeight:0,p:0,"&:hover":{bgcolor:"background.paper"}},children:y?jsx(Ky,{sx:{fontSize:16},color:"action"}):jsx(Xf,{sx:{fontSize:16},color:"action"})})})]})};var Sp=({layouts:e,currentLayoutId:t,onLoad:o,onSave:a,onDelete:r,onSetDefault:n})=>{let{t:i}=Z(),[l,d]=useState(null),[s,c]=useState(false),[g,f]=useState(""),[u,h]=useState(""),[w,p]=useState({isDefault:false,isPublic:false}),v=e.find(S=>S.id===t),m=S=>{d(S.currentTarget);},y=()=>{d(null);},x=S=>{o(S),y();},k=()=>{f(""),h(""),p({isDefault:false,isPublic:false}),c(true),y();},F=()=>{g.trim()&&(a({name:g,description:u,...w}),c(false));};return jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[jsx(Tooltip,{title:i("layout.saveLayout"),children:jsx(IconButton,{onClick:k,color:"primary",size:"small",children:jsx(kp,{})})}),jsx(Tooltip,{title:i("layout.layoutOptions"),children:jsx(IconButton,{onClick:m,color:v?"primary":"default",children:jsx(lb,{})})}),jsxs(Menu,{anchorEl:l,open:!!l,onClose:y,PaperProps:{sx:{width:320,maxHeight:400}},children:[jsx(MenuItem,{disabled:true,children:jsx(Typography,{variant:"caption",children:i("layout.selectLayout")})}),jsxs(MenuItem,{onClick:k,children:[jsx(ListItemIcon,{children:jsx(kp,{fontSize:"small"})}),jsx(ListItemText,{children:i("layout.saveCurrentLayout")})]}),jsx(Divider,{}),e.length===0&&jsx(MenuItem,{disabled:true,children:jsx(Typography,{variant:"body2",color:"text.secondary",children:i("layout.noSavedLayouts")})}),e.map((S,T)=>jsx(MenuItem,{onClick:()=>x(S),selected:S.id===t,children:jsxs(Box,{sx:{display:"flex",alignItems:"center",width:"100%",justifyContent:"space-between"},children:[jsxs(Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden",mr:1},children:[jsx(Box,{sx:{display:"flex",alignItems:"center",gap:1},children:jsx(Typography,{variant:"body2",fontWeight:S.id===t?"bold":"normal",noWrap:true,children:S.name})}),S.description&&jsx(Typography,{variant:"caption",color:"text.secondary",noWrap:true,children:S.description})]}),jsxs(Box,{sx:{display:"flex",alignItems:"center"},onClick:A=>A.stopPropagation(),children:[jsx(Tooltip,{title:S.isDefault?i("layout.removeDefault"):i("layout.setAsDefault"),children:jsx(IconButton,{size:"small",onClick:A=>{A.stopPropagation(),n(S.id);},children:S.isDefault?jsx(fy,{fontSize:"small",color:"warning"}):jsx(sb,{fontSize:"small"})})}),jsx(Tooltip,{title:i("common.delete"),children:jsx(IconButton,{size:"small",color:"error",onClick:A=>{A.stopPropagation(),r(S.id);},children:jsx(Af,{fontSize:"small"})})})]})]})},S.id||T))]}),jsxs(Dialog,{open:s,onClose:()=>c(false),maxWidth:"xs",fullWidth:true,children:[jsx(DialogTitle,{children:i("layout.saveLayout")}),jsx(DialogContent,{children:jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:2,mt:1},children:[jsx(TextField,{label:i("layout.layoutName"),value:g,onChange:S=>f(S.target.value),fullWidth:true,autoFocus:true,size:"small",helperText:i("layout.layoutNameHelper")}),e.some(S=>S.name===g)&&jsx(Typography,{variant:"caption",color:"warning.main",sx:{ml:1},children:i("layout.warningOverwrite")}),jsx(TextField,{label:i("layout.layoutDescription"),value:u,onChange:S=>h(S.target.value),fullWidth:true,size:"small"}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:w.isDefault,onChange:S=>p({...w,isDefault:S.target.checked})}),label:i("layout.useAsDefault")}),jsx(FormControlLabel,{control:jsx(Checkbox,{checked:w.isPublic,onChange:S=>p({...w,isPublic:S.target.checked})}),label:i("layout.publicAllUsers")})]})}),jsxs(DialogActions,{children:[jsx(Button,{onClick:()=>c(false),children:i("common.cancel")}),jsx(Button,{onClick:F,variant:"contained",disabled:!g,children:i("common.save")})]})]})]})};var ts=({appId:e,tableKey:t="default",currentLayoutData:o,onLayoutLoad:a,targetLayoutId:r,activeLayoutId:n,serviceUrl:i,onError:l,onSuccess:d})=>{let{t:s}=Z(),[c,g]=useState([]),[f,u]=useState(""),h=`orbcafe.layouts.${e}.${t}`,w=T=>({id:T.layoutId,name:T.name,description:T.description??"",isDefault:!!T.isDefault,isPublic:!!T.isPublic,createdAt:T.createdAt??new Date().toISOString(),layoutData:T.layout??{}}),p=T=>({appId:e,tableKey:t,layoutId:T.id,name:T.name,description:T.description??"",isDefault:!!T.isDefault,isPublic:!!T.isPublic,createdAt:T.createdAt,layout:T.layoutData}),v=useCallback(()=>{try{let T=localStorage.getItem(h);if(!T)return [];let A=JSON.parse(T);return Array.isArray(A)?A:[]}catch{return []}},[h]),m=useCallback(T=>{try{localStorage.setItem(h,JSON.stringify(T));}catch{}},[h]);useEffect(()=>{n!==void 0&&u(n);},[n]),useEffect(()=>{if(r&&c.length>0){let T=c.find(A=>A.id===r);T&&(u(T.id),a(T));}},[r,c,a]);let y=useCallback(async()=>{if(e){if(!i){let T=v();g(T);let A=T.find(R=>R.isDefault);A&&!f&&!r&&(u(A.id),a(A));return}try{let T=await fetch(`${i}/api/layouts?appId=${encodeURIComponent(e)}&tableKey=${encodeURIComponent(t)}`);if(!T.ok)throw new Error("LAYOUT_FETCH_FAILED");let R=(await T.json()).map(w);g(R);let C=R.find(D=>D.isDefault);C&&!f&&!r&&(u(C.id),a(C));}catch(T){console.error("Error fetching layouts",T);let A=v();g(A);let R=A.find(C=>C.isDefault);R&&!f&&!r&&(u(R.id),a(R)),l&&l(s("layout.toast.loadFallback"));}}},[e,t,i,l,f,a,r,v,s]);return useEffect(()=>{y();},[e,t]),jsx(Sp,{layouts:c,currentLayoutId:f,onLoad:T=>{u(T.id),a(T);},onSave:async T=>{let A=c.find(D=>D.name===T.name),R=A?A.id:Date.now().toString(),C={id:R,...T,createdAt:new Date().toISOString(),layoutData:o,isDefault:T.isDefault??false,isPublic:T.isPublic??false};if(!i){let I=c.some(P=>P.id===R)?c.map(P=>P.id===R?C:P):[...c,C];g(I),m(I),u(R),a(C),d&&d(s("layout.toast.saveLocalSuccess"));return}try{if(!(await fetch(`${i}/api/layouts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p(C))})).ok)throw new Error("LAYOUT_SAVE_FAILED");d&&d(s("layout.toast.saveSuccess")),await y(),u(R),a(C);}catch(D){console.error("Error saving layout",D);let P=c.some(M=>M.id===R)?c.map(M=>M.id===R?C:M):[...c,C];g(P),m(P),u(R),a(C),d&&d(s("layout.toast.saveLocalSuccess")),l&&l(s("layout.toast.backendUnavailableSavedLocal"));}},onDelete:async T=>{if(!i){let A=c.filter(R=>R.id!==T);g(A),m(A),f===T&&u(""),d&&d(s("layout.toast.deleteLocalSuccess"));return}try{if(!(await fetch(`${i}/api/layouts/${encodeURIComponent(T)}`,{method:"DELETE"})).ok)throw new Error("LAYOUT_DELETE_FAILED");f===T&&u(""),d&&d(s("layout.toast.deleteSuccess")),await y();}catch(A){console.error("Error deleting layout",A);let R=c.filter(C=>C.id!==T);g(R),m(R),f===T&&u(""),d&&d(s("layout.toast.deleteLocalSuccess")),l&&l(s("layout.toast.backendUnavailableDeletedLocal"));}},onSetDefault:async T=>{if(!i){let A=c.map(R=>({...R,isDefault:R.id===T}));g(A),m(A),d&&d(s("layout.toast.defaultLocalSuccess"));return}try{let A=c.find(C=>C.id===T);if(!A)return;if(!(await fetch(`${i}/api/layouts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p({...A,isDefault:!0}))})).ok)throw new Error("LAYOUT_DEFAULT_FAILED");d&&d(s("layout.toast.defaultSuccess")),await y();}catch(A){console.error("Error setting default",A);let R=c.map(C=>({...C,isDefault:C.id===T}));g(R),m(R),d&&d(s("layout.toast.defaultLocalSuccess")),l&&l(s("layout.toast.backendUnavailableDefaultLocal"));}}})};var Tp=(e,t)=>{if(!e||!e.filters)return null;if(Array.isArray(e.filters)){let o=e.filters.find(r=>r.scope===t);if(o)return o.filters;let a=e.filters.find(r=>r.scope==="default");return a?a.filters:null}return typeof e.filters=="object"?e.filters:null},os=(e,t)=>{if(!e)return {layout:null,layoutId:null};let o=null,a=null;if(Array.isArray(e.layoutRefs)){let r=e.layoutRefs.find(n=>n.tableKey===t);r&&(o=r.layoutId);}return !o&&e.layoutId&&(o=e.layoutId),e.layout&&typeof e.layout=="object"&&!Array.isArray(e.layout)&&(a=e.layout),{layoutId:o,layout:a}};function Ip(e,t,o){return t[o]<e[o]?-1:t[o]>e[o]?1:0}function db(e,t){return e==="desc"?(o,a)=>Ip(o,a,t):(o,a)=>-Ip(o,a,t)}function pb(e,t){let o=e.map((a,r)=>[a,r]);return o.sort((a,r)=>{let n=t(a[0],r[0]);return n!==0?n:a[1]-r[1]}),o.map(a=>a[0])}var Qr=e=>{let t=useCallback(V=>{let K=String(V?.label??V?.id??"").length*9+64,be=typeof V?.minWidth=="number"?V.minWidth:0;return Math.max(100,be,K)},[]),o=useCallback(()=>(e.columns||[]).filter(V=>!!V?.numeric).map(V=>V.id),[e.columns]),[a,r]=useState(""),[n,i]=useState(e.order||"asc"),[l,d]=useState(e.orderBy||""),[s,c]=useState(e.page||0),[g,f]=useState(e.rowsPerPage||20),[u,h]=useState(e.selected||[]),[w,p]=useState(e.columns?e.columns.map(V=>V.id):[]),[v,m]=useState(e.showSummary||false),[y,x]=useState(()=>o()),[k,F]=useState([]),[S,T]=useState(new Set),[A,R]=useState(()=>{let V={};return (e.columns||[]).forEach(O=>{V[O.id]=t(O);}),V}),[C,D]=useState(null),[I,P]=useState(null),[M,$]=useState(null),[N,X]=useState(null),[oe,te]=useState(false),[re,Q]=useState(""),[U,Y]=useState("");useEffect(()=>{e.layout&&Me(e.layout);},[e.layout]),useEffect(()=>{e.order!==void 0&&i(e.order),e.orderBy!==void 0&&d(e.orderBy);},[e.order,e.orderBy]),useEffect(()=>{e.selected!==void 0&&h(e.selected);},[e.selected]),useEffect(()=>{e.page!==void 0&&c(e.page);},[e.page]),useEffect(()=>{e.rowsPerPage!==void 0&&f(e.rowsPerPage);},[e.rowsPerPage]),useEffect(()=>{let V=o();x(O=>O.filter(be=>V.includes(be)));},[o]),useEffect(()=>{R(V=>{let O={...V};return (e.columns||[]).forEach(K=>{O[K.id]===void 0&&(O[K.id]=t(K));}),O});},[e.columns,t]);let Re=useMemo(()=>{let V=e.rows||[];return a&&(V=V.filter(O=>Object.keys(O).some(K=>String(O[K]).toLowerCase().includes(a.toLowerCase())))),V},[e.rows,a]),j=useMemo(()=>e.onSortChange||!l?Re:pb(Re,db(n,l)),[Re,n,l,e.onSortChange]),fe=useCallback(V=>{if(k.length===0)return V.map(Be=>({type:"row",data:Be,id:Be[e.rowKey||"id"]}));let O=[...V].sort((Be,me)=>{for(let Le of k){if(Be[Le]<me[Le])return -1;if(Be[Le]>me[Le])return 1}return 0}),K=(Be,me=0)=>{if(me>=k.length)return Be;let Le=k[me],we={},ze=[];return Be.forEach(Ae=>{let ke=Ae[Le],De=`${Le}:${ke}`;we[De]||(we[De]={key:De,field:Le,value:ke,children:[],count:0,level:me},ze.push(we[De])),we[De].children.push(Ae),we[De].count++;}),ze.forEach(Ae=>{Ae.children&&(Ae.children=K(Ae.children,me+1));}),ze},be=K(O),Ce=(Be,me="")=>{let Le=[];return Be.forEach(we=>{if(we.children){let ze=me?`${me}>${we.key}`:we.key,Ae=S.has(ze);Le.push({type:"group",id:ze,field:we.field,value:we.value,level:we.level,count:we.count,isExpanded:Ae,childIds:(function ke(De){let Nt=[];return De.children.forEach(To=>{To.children?Nt=Nt.concat(ke(To)):Nt.push(To[e.rowKey||"id"]);}),Nt})(we)}),Ae&&(Le=Le.concat(Ce(we.children,ze)));}else Le.push({type:"row",data:we,id:we[e.rowKey||"id"],level:k.length});}),Le};return Ce(be)},[k,S,e.rowKey]),Se=useCallback(V=>{if(k.length===0)return [];let O=[...V].sort((Ce,Be)=>{for(let me of k){if(Ce[me]<Be[me])return -1;if(Ce[me]>Be[me])return 1}return 0}),K=[],be=(Ce,Be,me)=>{if(Be>=k.length)return;let Le=k[Be],we=new Map;Ce.forEach(ze=>{let Ae=ze[Le],ke=we.get(Ae);ke?ke.push(ze):we.set(Ae,[ze]);}),we.forEach((ze,Ae)=>{let ke=`${Le}:${Ae}`,De=me?`${me}>${ke}`:ke;K.push(De),be(ze,Be+1,De);});};return be(O,0,""),K},[k]),Ne=useMemo(()=>fe(j),[j,fe]),Ke=useMemo(()=>Se(j),[j,Se]),ve=useMemo(()=>{let V=(e.rows||[]).length;return typeof e.count=="number"&&e.count>V},[e.count,e.rows]),Fe=useMemo(()=>ve?Ne:g>0?Ne.slice(s*g,s*g+g):Ne,[Ne,s,g,ve]),xo=useMemo(()=>ve&&typeof e.count=="number"?e.count:Ne.length,[Ne.length,ve,e.count]),jt=V=>{T(O=>{let K=new Set(O);return K.has(V)?K.delete(V):K.add(V),K});},Qe=V=>{let O=Ke.filter(K=>K===V||K.startsWith(`${V}>`));T(K=>{let be=new Set(K);return O.forEach(Ce=>be.add(Ce)),be});},Mt=V=>{T(O=>{let K=new Set(O);return Array.from(K).forEach(be=>{(be===V||be.startsWith(`${V}>`))&&K.delete(be);}),K});},Lt=V=>{if(!V){T(new Set);return}T(new Set(Ke));},bt=V=>{let O=Ke.filter(K=>K.startsWith(`${V}>`));return O.length===0?S.has(V):S.has(V)&&O.every(K=>S.has(K))},H=V=>{let O=l===V&&n==="asc",K=l===V&&n==="desc";if(e.onSortChange){O?e.onSortChange(V,"desc"):K?e.onSortChange("","asc"):e.onSortChange(V,"asc");return}O?(i("desc"),d(V)):K?(i("asc"),d("")):(i("asc"),d(V));},he=(V,O)=>{R(K=>({...K,[V]:O}));},pe=V=>{if(V.target.checked){let O=Re.map(K=>K[e.rowKey||"id"]);h(O),e.onSelectionChange&&e.onSelectionChange(O);return}h([]),e.onSelectionChange&&e.onSelectionChange([]);},ye=(V,O)=>{let K=O[e.rowKey||"id"],be=u.indexOf(K),Ce=[];be===-1?Ce=Ce.concat(u,K):be===0?Ce=Ce.concat(u.slice(1)):be===u.length-1?Ce=Ce.concat(u.slice(0,-1)):be>0&&(Ce=Ce.concat(u.slice(0,be),u.slice(be+1))),h(Ce),e.onSelectionChange&&e.onSelectionChange(Ce);},Xe=V=>{c(V),e.onPageChange&&e.onPageChange(V);},Ve=V=>{f(V),c(0),e.onPageChange&&e.onPageChange(0),e.onRowsPerPageChange&&e.onRowsPerPageChange(V);},co=V=>{let O=w.indexOf(V),K=[...w];O===-1?K.push(V):K.splice(O,1),p(K);},vo=V=>{let O=k.indexOf(V),K=[...k];O===-1?K.push(V):K.splice(O,1),F(K);},Co=V=>{o().includes(V)&&x(K=>K.includes(V)?K.filter(be=>be!==V):[...K,V]);},ko=V=>{e.onLayoutSave&&e.onLayoutSave({visibleColumns:w,order:n,orderBy:l,grouping:k,columnWidths:A,showSummary:v,summaryColumns:y});},So=V=>{let{layout:O,layoutId:K}=os(V,e.tableKey||"default");K?(Y(K),Q(K)):(Y(""),Q("")),O&&(O.visibleColumns&&p(O.visibleColumns),O.order&&i(O.order),O.orderBy&&d(O.orderBy),O.grouping&&F(O.grouping),O.columnWidths&&R(O.columnWidths),O.showSummary!==void 0&&m(!!O.showSummary),Array.isArray(O.summaryColumns)&&x(O.summaryColumns));},Me=V=>{let O=V?.layoutData||V?.layout||V||{};O.visibleColumns&&p(O.visibleColumns),O.order&&i(O.order),O.orderBy!==void 0&&d(O.orderBy),O.grouping&&F(O.grouping),O.columnWidths&&R(O.columnWidths),O.showSummary!==void 0&&m(!!O.showSummary),Array.isArray(O.summaryColumns)&&x(O.summaryColumns),T(new Set),c(0),V?.id&&Q(V.id),Y("");};useEffect(()=>{e.layout&&So({layout:e.layout});},[e.layout]);let ge=V=>{V.preventDefault(),X(N===null?{mouseX:V.clientX+2,mouseY:V.clientY-6}:null);},xt=()=>{X(null);},Ee=useMemo(()=>{if(!v)return {};let V={};e.columns.forEach(K=>{if(K.numeric&&y.includes(K.id)){let be=Re.reduce((Ce,Be)=>{let me=parseFloat(Be[K.id]);return Ce+(isNaN(me)?0:me)},0);V[K.id]=be.toFixed(2);}else V[K.id]="";});let O=e.columns.find(K=>w.includes(K.id));return O&&!O.numeric&&(V[O.id]="Total"),V},[Re,e.columns,v,y,w]),zt=()=>{if(!e.columns||!Re)return;let V=e.columns.map(Be=>Be.label).join(","),O=Re.map(Be=>e.columns.map(me=>{let Le=Be[me.id];return `"${(Le==null?"":String(Le)).replace(/"/g,'""')}"`}).join(",")).join(`
2
+ `),K=`data:text/csv;charset=utf-8,${V}
3
+ ${O}`,be=encodeURI(K),Ce=document.createElement("a");Ce.setAttribute("href",be),Ce.setAttribute("download",`${e.title||"export"}.csv`),document.body.appendChild(Ce),Ce.click(),document.body.removeChild(Ce);},wo=()=>{te(true);},_a=()=>{te(false);};return {isMobile:false,columns:e.columns,order:n,orderBy:l,filterText:a,setFilterText:r,visibleColumns:w,setVisibleColumns:p,showSummary:v,setShowSummary:m,summaryColumns:y,grouping:k,setGrouping:F,expandedGroups:S,setExpandedGroups:T,groupAnchorEl:I,setGroupAnchorEl:P,summaryAnchorEl:M,setSummaryAnchorEl:$,columnWidths:A,setColumnWidths:R,anchorEl:C,setAnchorEl:D,contextMenu:N,setContextMenu:X,sensors:void 0,sortedAndFilteredRows:j,visibleRows:Fe,summaryRow:Ee,page:s,setPage:Xe,rowsPerPage:g,setRowsPerPage:Ve,totalDisplayCount:xo,selected:u,setSelected:h,isAllExpanded:Ke.length>0&&Ke.every(V=>S.has(V)),handleColumnResize:he,handleRequestSort:H,handleSelectAllClick:pe,handleClick:ye,toggleSummaryColumn:Co,handleDragEnd:()=>{},handleExport:zt,handleContextMenu:ge,handleCloseContextMenu:xt,toggleColumnVisibility:co,toggleGroupExpand:jt,toggleGroupField:vo,handleToggleAll:Lt,handleExpandGroupRecursively:Qe,handleCollapseGroupRecursively:Mt,isGroupFullyExpanded:bt,handleLayoutLoad:Me,handleVariantLoad:So,handleLayoutSave:ko,effectiveAppId:e.appId||"",currentLayoutData:{visibleColumns:w,order:n,orderBy:l,grouping:k,columnWidths:A,showSummary:v,summaryColumns:y},currentLayoutId:re,layoutIdToLoad:U,onPageChange:Xe,onRowsPerPageChange:Ve,graphReportOpen:oe,handleOpenGraphReport:wo,handleCloseGraphReport:_a}};var kD=e=>jsx(gb,{...e}),SD=e=>jsx(Cl,{...e}),wD=e=>jsx(Fp,{...e}),TD=e=>jsx(Nf,{...e}),ID=e=>jsx(Vf,{...e}),Fa=e=>{let{t}=Z(),o="0.85rem",{title:a,showToolbar:r=true,selectionMode:n,selected:i=[],onSelectionChange:l,actions:d,extraTools:s,fitContainer:c=false,fullWidth:g=false,maxHeight:f,loading:u=false,rowsPerPageOptions:h=[20,50,100,-1],onLayoutSave:w,filterConfig:p,rowKey:v,tableKey:m="default",graphReport:y,quickCreate:x,quickEdit:k,quickDelete:F,serviceUrl:S}=e,T=a||t("table.title.default"),{isMobile:A,columns:R,order:C,orderBy:D,filterText:I,setFilterText:P,visibleColumns:M,showSummary:$,setShowSummary:N,summaryColumns:X,grouping:oe,setGrouping:te,expandedGroups:re,groupAnchorEl:Q,setGroupAnchorEl:U,summaryAnchorEl:Y,setSummaryAnchorEl:Re,columnWidths:j,anchorEl:fe,setAnchorEl:Se,contextMenu:Ne,sensors:Ke,sortedAndFilteredRows:ve,summaryRow:Fe,visibleRows:xo,isAllExpanded:jt,page:Qe,setPage:Mt,rowsPerPage:Lt,setRowsPerPage:bt,totalDisplayCount:H,setSelected:he,handleColumnResize:pe,handleRequestSort:ye,handleSelectAllClick:Xe,handleClick:Ve,toggleSummaryColumn:co,handleDragEnd:vo,handleExport:Co,handleContextMenu:ko,handleCloseContextMenu:So,toggleColumnVisibility:Me,toggleGroupExpand:ge,toggleGroupField:xt,handleToggleAll:Ee,handleExpandGroupRecursively:zt,handleCollapseGroupRecursively:wo,isGroupFullyExpanded:_a,handleLayoutLoad:V,handleVariantLoad:O,handleLayoutSave:K,effectiveAppId:be,currentLayoutData:Ce,currentLayoutId:Be,layoutIdToLoad:me,graphReportOpen:Le,handleOpenGraphReport:we,handleCloseGraphReport:ze}=Qr(e),Ae=y?.enabled??false,ke=Ae&&(y?.interaction?.enabled??true),De=Ki(),Nt=!!x?.enabled,To=!!k?.enabled,gt=!!F?.enabled,vt=x?.fields,po=x?.excludeFields||[],va=x?.initialValues||{},[Pr,Io]=ct__default.useState(false),[Xt,Za]=ct__default.useState(false),[Qo,Vt]=ct__default.useState({}),[Qt,At]=ct__default.useState(false),[Oe,Yo]=ct__default.useState(false),[Wo,Jo]=ct__default.useState({}),[ja,$o]=ct__default.useState(false),[Xa,Qa]=ct__default.useState(false),Ho=u||Xt||Oe||Xa,ea=ct__default.useMemo(()=>{let L=[...R];if(Array.isArray(vt)&&vt.length>0){let _=new Set(vt);L=L.filter(q=>_.has(q.id));}if(po.length>0){let _=new Set(po);L=L.filter(q=>!_.has(q.id));}return L.filter(_=>!!_?.id)},[R,po,vt]),Ca=v||"id",Ot=ct__default.useMemo(()=>{let L=new Set(i);return ve.filter(_=>L.has(_?.[Ca]))},[i,ve,Ca]),Po=Ot.length===1?Ot[0]:null,ta=k?.fields,uo=k?.excludeFields||[],Go=k?.editableFields||[],Ya=k?.nonEditableFields||[],Rr=k?.primaryKeys?.length?k.primaryKeys:[Ca],ka=ct__default.useMemo(()=>{let L=[...R];if(Array.isArray(ta)&&ta.length>0){let _=new Set(ta);L=L.filter(q=>_.has(q.id));}if(uo.length>0){let _=new Set(uo);L=L.filter(q=>!_.has(q.id));}return L.filter(_=>!!_?.id)},[R,uo,ta]),Ja=ct__default.useMemo(()=>new Set(Rr),[Rr]),oa=ct__default.useMemo(()=>new Set(Go),[Go]),Ut=ct__default.useMemo(()=>new Set(Ya),[Ya]),Ro=ct__default.useCallback(L=>oa.size>0?oa.has(L):!(Ut.has(L)||Ja.has(L)),[oa,Ut,Ja]);ct__default.useEffect(()=>{!Le&&De.hasActiveFilters&&De.clearAll();},[Le,De.hasActiveFilters,De.clearAll]);let Dr=()=>{let L={};ea.forEach(_=>{L[_.id]=va[_.id]??"";}),Vt(L),Io(true);},er=()=>{Xt||Io(false);},Mr=(L,_)=>{Vt(q=>({...q,[L]:_}));},Ar=async()=>{if(!x?.onSubmit){Io(false);return}try{Za(!0),await x.onSubmit(Qo),Io(!1);}finally{Za(false);}},Br=()=>{if(!Po)return;let L={};ka.forEach(q=>{L[q.id]=Po[q.id]??"";});let _=k?.getInitialValues?{...L,...k.getInitialValues(Po)}:L;Jo(_),At(true);},Yt=()=>{Oe||At(false);},Fr=(L,_)=>{Jo(q=>({...q,[L]:_}));},Er=async()=>{if(Po){if(!k?.onSubmit){At(false);return}try{Yo(!0),await k.onSubmit(Wo,Po),At(!1);}finally{Yo(false);}}},tr=()=>{Ot.length!==0&&$o(true);},aa=()=>{Xa||$o(false);},Sa=async()=>{if(Ot.length===0){$o(false);return}if(!F?.onConfirm){$o(false),he([]),l?.([]);return}try{Qa(!0),await F.onConfirm(Ot),$o(!1),he([]),l?.([]);}finally{Qa(false);}},wa=ve,{fieldMapping:b}=_r({rows:wa,config:{...y,title:y?.title||`${T} ${t("graph.reportTitle")}`}}),B=ct__default.useMemo(()=>ke?De.applyRows(wa,b):wa,[ke,De.applyRows,wa,b]),{model:E}=_r({rows:B,config:{...y,title:y?.title||`${T} ${t("graph.reportTitle")}`,fieldMapping:b}}),W=E.table.columns.map(L=>({id:L.id,label:L.label,align:L.align||"left",minWidth:120,numeric:L.align==="right"})),ee=be?jsx(ts,{appId:be,tableKey:m,currentLayoutData:Ce,onLayoutLoad:V,targetLayoutId:me,activeLayoutId:Be,serviceUrl:S??p?.serviceUrl}):null,ue=jsxs(Fragment,{children:[jsx(zr,{groupAnchorEl:Q,setGroupAnchorEl:U,grouping:oe,setGrouping:te,columns:R,toggleGroupField:xt}),jsx(Nr,{anchorEl:fe,setAnchorEl:Se,columns:R,visibleColumns:M,toggleColumnVisibility:Me}),jsx(Ii,{anchorEl:Y,setAnchorEl:Re,showSummary:$,setShowSummary:N,columns:R,summaryColumns:X,toggleSummaryColumn:co}),jsx(Pi,{contextMenu:Ne,handleCloseContextMenu:So,columns:R,visibleColumns:M,toggleColumnVisibility:Me})]});return A?jsxs(Hn,{sx:{display:"flex",flexDirection:"column",gap:2,height:"100%"},children:[p&&jsx(cr,{fields:p.fields,filters:p.filters,onFilterChange:p.onFilterChange,onSearch:p.onSearch,variants:p.variants||[],currentVariantId:p.currentVariantId,onVariantLoad:p.onVariantLoad,onVariantSave:p.onVariantSave,onVariantDelete:p.onVariantDelete,onVariantSetDefault:p.onVariantSetDefault,appId:p.appId,tableKey:m,currentLayout:[{tableKey:m,layoutData:Ce}],variantService:p.variantService,serviceUrl:S??p.serviceUrl}),jsx(Dd,{title:T,loading:u,showSummary:$,setShowSummary:N,setAnchorEl:Se,setSummaryAnchorEl:Re,filterText:I,setFilterText:P,sortedAndFilteredRows:ve,selected:i,columns:R,visibleColumns:M,summaryRow:Fe,handleClick:Ve,selectionMode:n}),ue]}):jsxs(Hn,{sx:{width:g?"100%":"auto",mb:c?0:2,...c?{flex:1,display:"flex",flexDirection:"column",minHeight:0,height:"100%",overflow:"hidden"}:{}},children:[p&&jsx(Hn,{sx:{mb:2},children:jsx(cr,{fields:p.fields,filters:p.filters,onFilterChange:p.onFilterChange,onSearch:p.onSearch,variants:p.variants||[],currentVariantId:p.currentVariantId,onVariantLoad:L=>{O(L),p.onVariantLoad&&p.onVariantLoad(L);},onVariantSave:p.onVariantSave,onVariantDelete:p.onVariantDelete,onVariantSetDefault:p.onVariantSetDefault,loading:u,appId:p.appId,tableKey:m,currentLayout:[{tableKey:m,layoutData:Ce}],currentLayoutId:Be,layoutRefs:[{tableKey:m,layoutId:Be}],variantService:p.variantService,serviceUrl:S??p.serviceUrl})}),jsxs(ub,{sx:{width:g?"100%":"auto",mb:c?0:2,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative","&::before":Ho?{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"3px",background:"linear-gradient(90deg, rgba(25, 118, 210, 0) 0%, rgba(25, 118, 210, 0.25) 25%, rgba(25, 118, 210, 1) 50%, rgba(25, 118, 210, 0.25) 75%, rgba(25, 118, 210, 0) 100%)",backgroundSize:"220% 100%",animation:"cTableTopMarquee 1.2s linear infinite",zIndex:6,pointerEvents:"none"}:{},"@keyframes cTableTopMarquee":{"0%":{backgroundPosition:"220% 0"},"100%":{backgroundPosition:"-120% 0"}},...f?{height:f}:c?{flex:1,minHeight:0,height:"100%"}:{}},children:[r&&jsx(Ci,{filterText:I,setFilterText:P,onRowsPerPageChange:bt,rowsPerPage:Lt,rowsPerPageOptions:h,page:Qe,count:H,onPageChange:Mt,actions:d,extraTools:s,grouping:oe,setGroupAnchorEl:U,showSummary:$,setShowSummary:N,setAnchorEl:Se,setSummaryAnchorEl:Re,handleExport:Co,showCreateButton:Nt,onOpenCreateDialog:Dr,showEditButton:To,onOpenEditDialog:Br,editDisabled:Ot.length!==1,showDeleteButton:gt,onOpenDeleteConfirm:tr,deleteDisabled:Ot.length===0,onLayoutSave:w||p?.variantService&&p?.appId?K:void 0,loading:u,layoutManager:ee,onOpenGraphReport:Ae?we:void 0}),jsx(Fp,{sx:{flex:1,...f?{maxHeight:f,height:f}:c?{height:0,maxHeight:"none"}:{maxHeight:"calc(100vh - 320px)"},overflowY:"auto",overflowX:"auto",position:"relative",minHeight:0},children:jsx(DndContext,{sensors:Ke,collisionDetection:closestCenter,onDragEnd:vo,modifiers:[restrictToHorizontalAxis],children:jsxs(mb,{sx:{minWidth:g?750:"auto",width:g?"100%":"auto",tableLayout:Object.keys(j).length>0?"fixed":"auto",borderCollapse:"separate",borderSpacing:0,"& .MuiTableCell-root":{fontSize:o}},"aria-labelledby":"tableTitle",size:"small",stickyHeader:true,children:[jsx(ki,{columns:R,visibleColumns:M,order:C,orderBy:D,onRequestSort:ye,onContextMenu:ko,selectionMode:n,grouping:oe,isAllExpanded:jt,handleToggleAll:Ee,rowCount:ve.length,numSelected:i.length,onSelectAllClick:Xe,columnWidths:j,onColumnResize:pe}),jsx(Id,{visibleRows:xo,columns:R,visibleColumns:M,selectionMode:n,selected:i,orderBy:D,loading:u,expandedGroups:re,toggleGroupExpand:ge,handleExpandGroupRecursively:zt,handleCollapseGroupRecursively:wo,isGroupFullyExpanded:_a,handleClick:Ve,onSelectionChange:l,grouping:oe,rowKeyProp:v,page:Qe,rowsPerPage:Lt}),$&&jsx(Pd,{showSummary:$,columns:R,visibleColumns:M,summaryRow:Fe,selectionMode:n?.toString(),grouping:oe,orderBy:D,zIndex:3})]})})})]}),Nt&&jsxs(Pp,{open:Pr,onClose:er,fullWidth:true,maxWidth:"sm",slotProps:{paper:{sx:{borderRadius:2,border:L=>`1px solid ${L.palette.divider}`,bgcolor:"background.paper"}}},children:[jsx(Rp,{sx:{fontSize:"0.85rem",fontWeight:700,pb:1},children:x?.title||t("quickCreate.createWithTitle",{title:T})}),jsx(Dp,{sx:{pt:"8px !important"},children:jsxs(Hn,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[ea.map(L=>{let _=L.type==="number"||L.numeric?"number":L.type==="date"?"date":"text",q=L.label||L.id;return jsx(Ap,{label:q,value:Qo[L.id]??"",onChange:_e=>Mr(L.id,_e.target.value),type:_,size:"small",fullWidth:true,InputLabelProps:{shrink:_==="date"?true:void 0,sx:{fontSize:"0.85rem"}},InputProps:{sx:{fontSize:"0.85rem"}}},`quick-create-${L.id}`)}),x?.description&&jsx(Bp,{severity:"info",sx:{fontSize:"0.85rem","& .MuiAlert-message":{fontSize:"0.85rem"}},children:x.description})]})}),jsxs(Mp,{sx:{px:3,pb:2},children:[jsx(rs,{onClick:er,sx:{fontSize:"0.85rem"},disabled:Xt,children:x?.cancelLabel||t("common.cancel")}),jsx(rs,{onClick:Ar,variant:"contained",sx:{fontSize:"0.85rem",fontWeight:700},disabled:Xt,children:x?.submitLabel||t("common.save")})]})]}),To&&jsxs(Pp,{open:Qt,onClose:Yt,fullWidth:true,maxWidth:"sm",slotProps:{paper:{sx:{borderRadius:2,border:L=>`1px solid ${L.palette.divider}`,bgcolor:"background.paper"}}},children:[jsx(Rp,{sx:{fontSize:"0.85rem",fontWeight:700,pb:1},children:k?.title||t("quickEdit.editWithTitle",{title:T})}),jsx(Dp,{sx:{pt:"8px !important"},children:jsxs(Hn,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[ka.map(L=>{let _=L.type==="number"||L.numeric?"number":L.type==="date"?"date":"text",q=L.label||L.id,_e=Ro(L.id);return jsx(Ap,{label:q,value:Wo[L.id]??"",onChange:z=>Fr(L.id,z.target.value),type:_,size:"small",fullWidth:true,disabled:!_e,InputLabelProps:{shrink:_==="date"?true:void 0,sx:{fontSize:"0.85rem"}},InputProps:{sx:{fontSize:"0.85rem"}}},`quick-edit-${L.id}`)}),k?.description&&jsx(Bp,{severity:"info",sx:{fontSize:"0.85rem","& .MuiAlert-message":{fontSize:"0.85rem"}},children:k.description})]})}),jsxs(Mp,{sx:{px:3,pb:2},children:[jsx(rs,{onClick:Yt,sx:{fontSize:"0.85rem"},disabled:Oe,children:k?.cancelLabel||t("common.cancel")}),jsx(rs,{onClick:Er,variant:"contained",sx:{fontSize:"0.85rem",fontWeight:700},disabled:Oe||!Po,children:k?.submitLabel||t("common.save")})]})]}),gt&&jsx(In,{open:ja,type:"warning",title:F?.title||t("quickDelete.confirmTitle"),message:F?.message||(Ot.length>1?t("quickDelete.confirmMessageMultiple",{count:Ot.length}):t("quickDelete.confirmMessageSingle")),confirmText:F?.confirmText||t("common.delete"),cancelText:F?.cancelText||t("common.cancel"),onClose:aa,onConfirm:Sa}),ue,Ae&&jsx(Gi,{open:Le,onClose:ze,model:E,aiAssistant:y?.aiAssistant,interaction:ke?{enabled:true,filters:De.filters,fieldMapping:b,onPrimaryDimensionClick:L=>De.setFilter("primaryDimension",L),onSecondaryDimensionClick:L=>De.setFilter("secondaryDimension",L),onStatusClick:L=>De.setFilter("status",L),onClearFilter:De.clearFilter,onClearAll:De.clearAll}:void 0,tableContent:jsx(Fa,{appId:be||"graph-report-internal",title:t("graph.dataBody"),columns:W,rows:E.table.rows,rowKey:"id",fullWidth:true,maxHeight:"420px",rowsPerPage:20,rowsPerPageOptions:[20,50,100],graphReport:{enabled:false}})})]})},PD=Fa;var ED=({id:e,title:t,hideHeader:o=true,filterConfig:a,tableProps:r,children:n,spacing:i=1,mode:l="separated"})=>{let d=a?{...a,appId:a.appId||e}:void 0,s={...r,appId:r.appId||e};return jsxs(vd,{title:t,hideHeader:o,children:[jsxs(Stack,{spacing:i,sx:{height:"100%",overflow:"hidden"},children:[l==="separated"&&d&&jsx(Box,{sx:{flexShrink:0},children:jsx(cr,{...d})}),jsx(Box,{sx:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:jsx(Fa,{...s,fitContainer:true,filterConfig:l==="integrated"?d:void 0})})]}),n]})};var WD=({metadata:e,fetchData:t,initialRowsPerPage:o=20,rowsPerPageOptions:a=[20,50,100,-1],tableKey:r="default",mode:n="integrated",serviceUrl:i,variantService:l})=>{let{t:d}=Z(),[s,c]=useState(false),[g,f]=useState([]),[u,h]=useState({}),[w,p]=useState(e.variants||[]),[v,m]=useState(e.layout||null),[y,x]=useState(""),[k,F]=useState(0),[S,T]=useState(0),[A,R]=useState(o),[C,D]=useState([]),[I,P]=useState("asc"),[M,$]=useState("");useEffect(()=>{let j={};e.filters.forEach(fe=>{fe.defaultValue!==void 0&&(j[fe.id]=fe.defaultValue);}),h(j);},[e.filters]);let N=useCallback(async(j,fe,Se,Ne,Ke)=>{c(true);try{let ve={...j,page:fe+1,limit:Se,sort:Ke,order:Ne},Fe;t?Fe=await t(ve):typeof e.api=="function"?Fe=await e.api(ve):e.api&&typeof e.api=="object"?(console.log("Fetching from URL:",e.api.url,ve),Fe={rows:[],total:0}):(console.warn("No API configured for report"),Fe={rows:[],total:0}),Fe&&(f(Fe.rows||[]),F(Fe.total||0));}catch(ve){console.error("Failed to fetch report data",ve);}finally{c(false);}},[e.api,t]);useEffect(()=>{N(u,S,A,I,M);},[N,S,A,I,M]);let X=()=>{T(0),N(u,0,A,I,M);},oe=j=>{T(0),R(j);},te=(j,fe)=>{P(fe),$(j);},re=j=>{h(j);},Q=j=>{x(j?.id||"");let fe=Tp(j,r);if(fe){let Ne=fe.values??fe;h(Ne),N(Ne,0,A,I,M),T(0);}let{layout:Se}=os(j,r);Se&&m(Se);},U=j=>{let fe={...j,id:Date.now().toString(),createdAt:new Date().toISOString()};p(Se=>[...Se,fe]);},Y=j=>{m(j);};return {pageProps:{id:e.id,title:e.title,mode:n,filterConfig:{appId:e.id,tableKey:r,fields:e.filters,filters:u,onFilterChange:re,onSearch:X,onVariantLoad:Q,onVariantSave:U,onVariantDelete:j=>p(fe=>fe.filter(Se=>Se.id!==j)),onVariantSetDefault:j=>{p(fe=>fe.map(Se=>({...Se,isDefault:Se.id===j})));},variants:w,currentVariantId:y,variantService:l,serviceUrl:i},tableProps:{appId:e.id,tableKey:r,columns:e.columns,rows:g,loading:s,rowKey:"id",count:k,page:S,rowsPerPage:A,rowsPerPageOptions:a,onPageChange:T,onRowsPerPageChange:oe,selectionMode:"multiple",selected:C,onSelectionChange:D,onLayoutSave:Y,layout:v,title:e.title,showSummary:true,order:I,orderBy:M,serviceUrl:i,onSortChange:te,graphReport:e.graphReport||{enabled:true,title:`${e.title} ${d("graph.reportTitle")}`}}},filters:u,rows:g,loading:s,refresh:X}};var wb=e=>[...e].sort((t,o)=>o.value-t.value),GD=({bars:e=[],lines:t=[],combos:o=[],heatmap:a=[],pies:r=[],waterfalls:n=[]})=>{let i=useMemo(()=>wb(e),[e]),l=useMemo(()=>[...t],[t]),d=useMemo(()=>[...o],[o]),s=useMemo(()=>[...a],[a]),c=useMemo(()=>{let f=r.reduce((u,h)=>u+h.value,0);return r.map(u=>({...u,percent:f>0?u.value/f*100:u.percent}))},[r]),g=useMemo(()=>[...n],[n]);return {bars:i,lines:l,combos:d,heatmap:s,pies:c,waterfalls:g}};var ZD=({apiKey:e,query:t,zoom:o=14,mapType:a="roadmap"})=>useMemo(()=>!e||!t?"":En({apiKey:e,query:t,zoom:o,mapType:a}),[e,t,o,a]),jD=({keyword:e,location:t})=>useMemo(()=>Vi({keyword:e,location:t?{lng:t.lng,lat:t.lat,name:t.name}:void 0}),[e,t]);var Gn=({code:e,language:t="text",copyable:o=true,showLineNumbers:a=false,wrapLongLines:r=false,maxHeight:n})=>{let[i,l]=useState(false),d=useMemo(()=>e.replace(/\n$/,"").split(`
4
+ `),[e]);return jsxs(Box,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,overflow:"hidden",bgcolor:"background.paper"},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1,py:.6,bgcolor:"action.hover",borderBottom:"1px solid",borderColor:"divider"},children:[jsx(Typography,{variant:"caption",sx:{textTransform:"uppercase",letterSpacing:.5,color:"text.secondary",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:t}),o&&jsx(Tooltip,{title:i?"Copied":"Copy",children:jsx(IconButton,{size:"small",onClick:async()=>{try{await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1400);}catch{l(false);}},children:i?jsx(Ab,{fontSize:"inherit"}):jsx(Mb,{fontSize:"inherit"})})})]}),jsx(Box,{component:"pre",sx:{m:0,p:1.25,fontSize:"0.82rem",lineHeight:1.55,overflow:"auto",maxHeight:n,bgcolor:"background.default",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:a?d.map((c,g)=>jsxs(Box,{sx:{display:"flex"},children:[jsx(Box,{component:"span",sx:{width:34,flexShrink:0,textAlign:"right",pr:1,color:"text.disabled",userSelect:"none"},children:g+1}),jsx(Box,{component:"span",sx:{whiteSpace:r?"pre-wrap":"pre",wordBreak:r?"break-word":"normal"},children:c})]},`${g}-${c}`)):jsx(Box,{component:"code",sx:{display:"block",whiteSpace:r?"pre-wrap":"pre",wordBreak:r?"break-word":"normal"},children:e})})]})};var zb=e=>{let t=e.trim();return t.startsWith("$$")&&t.endsWith("$$")&&t.length>=4&&(t=t.slice(2,-2).trim()),t.startsWith("$")&&t.endsWith("$")&&t.length>=2&&(t=t.slice(1,-1).trim()),t},Nb=async e=>new Function("m","return import(m)")(e),Un=({expression:e,inline:t=false,allowKatex:o=false})=>{let a=useMemo(()=>zb(e),[e]),[r,n]=useState("");return useEffect(()=>{let i=true;return (async()=>{if(!o||!a){n("");return}try{let d=await Nb("katex"),c=(d?.default||d)?.renderToString?.(a,{displayMode:!t,throwOnError:!1,strict:"warn"});i&&typeof c=="string"&&n(c);}catch{i&&n("");}})(),()=>{i=false;}},[o,a,t]),a?r?jsx(Box,{component:t?"span":"div",sx:{display:t?"inline-flex":"block",my:t?0:.5,overflowX:"auto"},dangerouslySetInnerHTML:{__html:r}}):t?jsx(Box,{component:"code",sx:{px:.4,py:.05,borderRadius:.8,bgcolor:"action.hover",fontSize:"0.82em",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:a}):jsx(Box,{sx:{my:1,p:1,borderRadius:1.2,border:"1px dashed",borderColor:"divider",bgcolor:"background.paper"},children:jsx(Typography,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",fontSize:"0.9rem",lineHeight:1.5,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:a})}):null};var Ub=async e=>new Function("m","return import(m)")(e),jl=({code:e,title:t="Mermaid Diagram",height:o=320,enabled:a=true})=>{let[r,n]=useState(""),[i,l]=useState(""),[d,s]=useState(false),c=useMemo(()=>e.trim(),[e]);return useEffect(()=>{let g=true;return (async()=>{if(!a||!c){n(""),l("");return}s(true),l(""),n("");try{let u=await Ub("mermaid"),h=u?.default||u;if(!h||typeof h.render!="function")throw new Error("Mermaid runtime is not available");h.initialize?.({startOnLoad:!1,securityLevel:"loose",theme:"default"});let w=await h.render(`orbcafe-mermaid-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,c),p=typeof w=="string"?w:w?.svg;g&&typeof p=="string"&&n(p);}catch(u){if(g){let h=u instanceof Error?u.message:"Failed to render Mermaid diagram";l(h);}}finally{g&&s(false);}})(),()=>{g=false;}},[a,c]),jsxs(Paper,{variant:"outlined",sx:{borderRadius:1.5,overflow:"hidden",my:1},children:[jsx(Box,{sx:{px:1,py:.6,borderBottom:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsx(Typography,{variant:"caption",color:"text.secondary",sx:{letterSpacing:.4,textTransform:"uppercase"},children:t})}),jsxs(Box,{sx:{p:1},children:[d&&jsx(Box,{sx:{minHeight:120,display:"flex",alignItems:"center",justifyContent:"center"},children:jsx(CircularProgress,{size:20})}),!d&&r&&jsx(Box,{sx:{maxHeight:o,overflow:"auto","& svg":{display:"block",mx:"auto",maxWidth:"100%",height:"auto"}},dangerouslySetInnerHTML:{__html:r}}),!d&&!r&&jsxs(Box,{children:[i&&jsx(Alert,{severity:"info",sx:{mb:1},children:i}),jsx(Gn,{code:c,language:"mermaid",copyable:true,showLineNumbers:true,wrapLongLines:true})]})]})]})};var Xl=e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(o=>o.trim()),Yb=e=>/^:?-{3,}:?$/.test(e.trim()),Jb=e=>{let t=e.trim(),o=t.startsWith(":"),a=t.endsWith(":");return o&&a?"center":a?"right":"left"},ss=e=>{let t=e.split(`
5
+ `).map(i=>i.trim()).filter(Boolean);if(t.length<2)return null;let o=Xl(t[0]),a=Xl(t[1]);if(o.length===0||a.length!==o.length||!a.every(Yb))return null;let r=a.map(Jb),n=t.slice(2).filter(i=>i.includes("|")).map(i=>{let l=Xl(i);return l.length<o.length?[...l,...Array.from({length:o.length-l.length},()=>"")]:l.slice(0,o.length)});return {headers:o,aligns:r,rows:n}},Ql=({markdown:e,table:t,maxHeight:o=360})=>{let a=useMemo(()=>t||(e?ss(e):null),[t,e]);return !a||a.headers.length===0?jsx(Paper,{variant:"outlined",sx:{p:1.2,borderRadius:1.5},children:jsx(Typography,{variant:"body2",color:"text.secondary",children:"Invalid table block"})}):jsx(Paper,{variant:"outlined",sx:{borderRadius:1.5,overflow:"hidden",my:1},children:jsx(TableContainer,{sx:{maxHeight:o},children:jsxs(Table,{size:"small",stickyHeader:true,children:[jsx(TableHead,{children:jsx(TableRow,{children:a.headers.map((r,n)=>jsx(TableCell,{align:a.aligns[n],sx:{fontWeight:700,bgcolor:"background.paper"},children:r},`${r}-${n}`))})}),jsx(TableBody,{children:a.rows.map((r,n)=>jsx(TableRow,{hover:true,children:r.map((i,l)=>jsx(TableCell,{align:a.aligns[l],sx:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i||jsx(Box,{component:"span",sx:{color:"text.disabled"},children:"-"})},`cell-${n}-${l}`))},`row-${n}`))})]})})})};var cs=({content:e,title:t="Thinking",defaultExpanded:o=false,isStreaming:a=false})=>{let[r,n]=useState(o);return jsxs(Box,{sx:{borderLeft:"2px solid",borderColor:"divider",pl:1,my:.8},children:[jsxs(Stack,{direction:"row",alignItems:"center",spacing:.6,children:[jsx(IconButton,{size:"small",onClick:()=>n(i=>!i),sx:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform .15s ease"},children:jsx(ix,{fontSize:"inherit"})}),jsxs(Typography,{variant:"caption",color:"text.secondary",sx:{fontStyle:"italic"},children:[t,a?" ...":""]})]}),jsx(Collapse,{in:r,children:jsx(Typography,{variant:"body2",sx:{pl:4,pt:.4,whiteSpace:"pre-wrap",color:"text.secondary",fontStyle:"italic",lineHeight:1.55},children:e})})]})};var Jl=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\)|\*[^*]+\*|\$[^$\n]+\$)/g,ds=e=>e.trim().startsWith("```"),Gp=e=>/^#{1,6}\s+/.test(e.trim()),ec=e=>/^[-*+]\s+/.test(e.trim()),tc=e=>/^\d+\.\s+/.test(e.trim()),Up=e=>/^(?:-{3,}|\*{3,}|_{3,})$/.test(e.trim()),oc=e=>e.trim().startsWith(">"),Kp=(e,t)=>{if(t+1>=e.length)return false;let o=e[t],a=e[t+1];return !o.includes("|")||!a.includes("|")?false:/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(a.trim())},qp=e=>e.trim().startsWith("<think>")||e.trim()===":::think",_n=(e,t,o)=>{let a=[],r=0,n=0;Jl.lastIndex=0;let i=Jl.exec(e);for(;i;){i.index>r&&a.push(e.slice(r,i.index));let l=i[0],d=`${o}-${n}`;if(l.startsWith("**")&&l.endsWith("**"))a.push(jsx("strong",{children:l.slice(2,-2)},d));else if(l.startsWith("*")&&l.endsWith("*"))a.push(jsx("em",{children:l.slice(1,-1)},d));else if(l.startsWith("`")&&l.endsWith("`"))a.push(jsx(Box,{component:"code",sx:{px:.45,py:.08,borderRadius:.8,bgcolor:"action.hover",fontSize:"0.82em",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},children:l.slice(1,-1)},d));else if(l.startsWith("[")&&l.includes("](")&&l.endsWith(")")){let s=l.match(/^\[([^\]]+)\]\(([^)]+)\)$/);s?a.push(jsx(Link,{href:s[2],target:"_blank",rel:"noreferrer",underline:"hover",children:s[1]},d)):a.push(l);}else l.startsWith("$")&&l.endsWith("$")&&t.enableMath?a.push(jsx(Un,{expression:l,inline:true,allowKatex:true},d)):a.push(l);r=i.index+l.length,n+=1,i=Jl.exec(e);}return r<e.length&&a.push(e.slice(r)),a.length>0?a:[e]},Zn=({markdown:e,content:t,className:o,enableMath:a=true,enableMermaid:r=true,enableThinkBlock:n=true,codeCopyable:i=true,codeLineNumbers:l=false})=>{let d=e??t??"",s=useMemo(()=>{let c=[],g=d.replace(/\r\n/g,`
6
6
  `).split(`
7
- `),f={enableMath:a},u=0;for(;u<g.length;){let y=g[u],I=y.trim();if(!I){u+=1;continue}if(n&&bp(y)){if(I.startsWith("<think>")){let m=[],b=y;for(;;){let x=b.indexOf("<think>"),k=x>=0?b.slice(x+7):b,E=k.indexOf("</think>");if(E>=0){m.push(k.slice(0,E)),u+=1;break}if(m.push(k),u+=1,u>=g.length)break;b=g[u];}c.push(jsx(Gi,{content:m.join(`
8
- `).trim()},`think-tag-${u}`));continue}u+=1;let C=[];for(;u<g.length&&g[u].trim()!==":::";)C.push(g[u]),u+=1;u<g.length&&g[u].trim()===":::"&&(u+=1),c.push(jsx(Gi,{content:C.join(`
9
- `).trim()},`think-fence-${u}`));continue}if(Ui(y)){let C=I.slice(3).trim().toLowerCase(),m=[];for(u+=1;u<g.length&&!Ui(g[u]);)m.push(g[u]),u+=1;u<g.length&&Ui(g[u])&&(u+=1);let b=m.join(`
10
- `);if(r&&C==="mermaid"){c.push(jsx(Pl,{code:b},`mermaid-${u}`));continue}if(a&&["math","latex","katex"].includes(C)){c.push(jsx(wn,{expression:b,allowKatex:true},`math-fence-${u}`));continue}c.push(jsx(Sn,{code:b,language:C||"text",copyable:i,showLineNumbers:l,wrapLongLines:true},`code-${u}`));continue}if(a&&I.startsWith("$$")){let C=[];if(I.endsWith("$$")&&I!=="$$")C.push(I.slice(2,-2)),u+=1;else {let b=y.slice(y.indexOf("$$")+2);for(b.trim()&&C.push(b),u+=1;u<g.length;){let x=g[u],k=x.indexOf("$$");if(k>=0){C.push(x.slice(0,k)),u+=1;break}C.push(x),u+=1;}}c.push(jsx(wn,{expression:C.join(`
11
- `).trim(),allowKatex:true},`math-${u}`));continue}if(fp(y)){let C=Math.min(6,y.match(/^#{1,6}/)?.[0]?.length||1),m=y.replace(/^#{1,6}\s+/,""),b=C===1?"h5":C===2?"h6":"subtitle1";c.push(jsx(Typography,{variant:b,sx:{mt:C===1?1.2:.8,mb:.5,fontWeight:700},children:Pn(m,f,`h-${u}`)},`heading-${u}`)),u+=1;continue}if(hp(y)){c.push(jsx(Divider,{sx:{my:1.2}},`hr-${u}`)),u+=1;continue}if(yp(g,u)){let C=u+2;for(;C<g.length&&g[C].trim()&&g[C].includes("|");)C+=1;let m=g.slice(u,C).join(`
12
- `),b=Wi(m);if(b){c.push(jsx(Dl,{table:b},`table-${u}`)),u=C;continue}}if(El(y)){let C=[];for(;u<g.length&&El(g[u]);)C.push(g[u].replace(/^\s*>\s?/,"")),u+=1;c.push(jsx(Paper,{variant:"outlined",sx:{px:1,py:.8,my:.9,borderLeftWidth:3,borderLeftStyle:"solid",borderLeftColor:"primary.main",bgcolor:"action.hover"},children:jsx(Typography,{variant:"body2",sx:{whiteSpace:"pre-wrap"},children:C.map((m,b)=>jsxs(Fragment$1,{children:[b>0&&jsx("br",{}),Pn(m,f,`q-${u}-${b}`)]},`quote-line-${b}`))})},`quote-${u}`));continue}if(Bl(y)){let C=[];for(;u<g.length&&Bl(g[u]);)C.push(g[u].trim().replace(/^[-*+]\s+/,"")),u+=1;c.push(jsx(Box,{component:"ul",sx:{my:.8,pl:2.5},children:C.map((m,b)=>jsx(Box,{component:"li",sx:{mb:.45},children:jsx(Typography,{variant:"body2",children:Pn(m,f,`ul-${u}-${b}`)})},`ul-item-${b}`))},`ul-${u}`));continue}if(Fl(y)){let C=[];for(;u<g.length&&Fl(g[u]);)C.push(g[u].trim().replace(/^\d+\.\s+/,"")),u+=1;c.push(jsx(Box,{component:"ol",sx:{my:.8,pl:2.7},children:C.map((m,b)=>jsx(Box,{component:"li",sx:{mb:.45},children:jsx(Typography,{variant:"body2",children:Pn(m,f,`ol-${u}-${b}`)})},`ol-item-${b}`))},`ol-${u}`));continue}let p=[];for(;u<g.length;){let C=g[u],m=C.trim();if(!m||Ui(C)||fp(C)||hp(C)||Bl(C)||Fl(C)||El(C)||yp(g,u)||n&&bp(C)||a&&m.startsWith("$$"))break;p.push(C),u+=1;}p.length>0?c.push(jsx(Typography,{variant:"body2",sx:{my:.65,lineHeight:1.65},children:p.map((C,m)=>jsxs(Fragment$1,{children:[m>0&&jsx("br",{}),Pn(C,f,`p-${u}-${m}`)]},`p-line-${m}`))},`p-${u}`)):u+=1;}return c},[d,a,r,n,i,l]);return jsx(Box,{className:o,sx:{"& strong":{fontWeight:700},"& em":{fontStyle:"italic"},"& a":{wordBreak:"break-all"}},children:s})};var KR=(e,t)=>jsx(Rn,{markdown:e,...t});var Cp=({value:e,onChange:t,onSubmit:o,onVoiceInput:a,onClear:r,placeholder:n,statusText:i,loading:l=false,compact:d=false,showStatusText:s=true})=>jsxs(Stack,{spacing:.75,children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.2,py:d?.25:.4,borderRadius:999,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",minHeight:d?38:44},children:[jsx($d,{sx:{fontSize:d?16:18,color:"text.secondary"}}),jsx(InputBase,{fullWidth:true,value:e,onChange:c=>t(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),o());},placeholder:n,sx:{fontSize:d?"0.84rem":"0.9rem"}}),e&&r&&jsx(IconButton,{size:"small",onClick:r,children:jsx(_f,{sx:{fontSize:d?16:18}})}),a&&jsx(IconButton,{size:"small",onClick:a,children:jsx(th,{sx:{fontSize:d?16:18}})}),jsx(IconButton,{size:"small",onClick:o,disabled:l||!e.trim(),children:jsx(ah,{sx:{fontSize:d?16:18}})})]}),s&&i&&jsx(Typography,{variant:"caption",color:"text.secondary",children:i})]});var kp=(e,t)=>{let o=t.trim();if(!o)return e;let a=e.toLowerCase(),r=o.toLowerCase(),n=a.indexOf(r);return n<0?e:jsxs(Fragment,{children:[e.slice(0,n),jsx(Box,{component:"mark",sx:{bgcolor:"warning.light",color:"warning.contrastText",px:.15,borderRadius:.4},children:e.slice(n,n+o.length)}),e.slice(n+o.length)]})},Ki=({section:e,highlightQuery:t=""})=>{let o=e.columns||2;return jsxs(Paper,{variant:"outlined",sx:{p:1.8,borderRadius:2},children:[jsx(Typography,{variant:"subtitle1",sx:{fontWeight:700,mb:1.4},children:e.title}),jsx(Box,{sx:{display:"grid",gap:1.15,gridTemplateColumns:{xs:"1fr",md:o===3?"repeat(3, minmax(0, 1fr))":o===1?"1fr":"repeat(2, minmax(0, 1fr))"}},children:e.fields.map(a=>{let r=typeof a.value=="string"||typeof a.value=="number"?String(a.value):null;return jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:kp(a.label,t)}),jsx(Typography,{component:"div",variant:"body2",sx:{mt:.2,fontWeight:500,wordBreak:"break-word"},children:r?kp(r,t):a.value})]},a.id)})})]})};var Ol=e=>e==null?"":typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):"",_i=e=>e.trim().toLowerCase(),Fb=(e,t)=>{let o=[];return e.forEach(a=>{a.fields.forEach(r=>{let n=r.searchableText||Ol(r.value),i={source:"section",sourceId:a.id,sourceSectionId:a.id,sourceTitle:a.title,fieldId:r.id,fieldLabel:r.label,fieldValue:n};o.push({hit:i,text:_i(`${a.title} ${r.label} ${n}`)});});}),t.forEach(a=>{(a.fields||[]).forEach(r=>{let n=r.searchableText||Ol(r.value),i={source:"tab",sourceId:a.id,sourceTitle:a.label,fieldId:r.id,fieldLabel:r.label,fieldValue:n};o.push({hit:i,text:_i(`${a.label} ${r.label} ${n}`)});}),(a.sections||[]).forEach(r=>{r.fields.forEach(n=>{let i=n.searchableText||Ol(n.value),l={source:"tab",sourceId:a.id,sourceSectionId:r.id,sourceTitle:`${a.label} / ${r.title}`,fieldId:n.id,fieldLabel:n.label,fieldValue:i};o.push({hit:l,text:_i(`${a.label} ${r.title} ${n.label} ${i}`)});});});}),o},Sp=({sections:e,tabs:t=[],defaultTabId:o,ai:a})=>{let{t:r}=_(),[n,i]=useState(""),[l,d]=useState(o||t[0]?.id),[s,c]=useState("idle"),[g,f]=useState([]),[u,y]=useState(""),[I,p]=useState(""),[C,m]=useState(false),b=useMemo(()=>Fb(e,t),[e,t]);useEffect(()=>{if(t.length===0){d(void 0);return}t.some(B=>B.id===l)||d(o||t[0]?.id);},[t,l,o]);let x=useCallback(()=>{c("idle"),f([]),y(""),p("");},[]),k=useCallback(w=>{i(w),w.trim()||(c("idle"),f([]),y(""),p(""));},[]),E=useCallback(w=>{let B=_i(w);return B?b.filter(T=>T.text.includes(B)).map(T=>T.hit):[]},[b]),R=useCallback(async()=>{let w=n.trim();if(!w)return;m(true);let B=E(w);if(f(B),B.length>0){c("search"),p(""),y(r("detail.searchAi.matches",{count:B.length})),m(false);return}if(a?.enabled!==false&&a?.onSubmit){c("ai"),y(r("detail.searchAi.autoAiFallback"));try{let v=await a.onSubmit(w,{query:w,hits:B,activeTabId:l,sections:e,tabs:t});p(typeof v=="string"?v:"");}finally{m(false);}return}c("search"),p(""),y(r("detail.searchAi.noMatch")),m(false);},[n,E,r,a,l,e,t]);return {query:n,setQuery:k,activeTabId:l,setActiveTabId:d,searchMode:s,hits:g,statusText:u,aiResponse:I,searching:C,handleSubmit:R,clearResult:x}};var kD=({title:e,subtitle:t,sections:o,tabs:a=[],defaultTabId:r,table:n,ai:i,rightHeaderSlot:l,searchBarWidth:d=460,onClose:s,closeLabel:c="Close"})=>{let{t:g}=_(),{query:f,setQuery:u,activeTabId:y,setActiveTabId:I,searchMode:p,hits:C,statusText:m,aiResponse:b,searching:x,handleSubmit:k,clearResult:E}=Sp({sections:o,tabs:a,defaultTabId:r,ai:i}),R=useMemo(()=>a.find(T=>T.id===y)||a[0],[a,y]),w=useCallback(T=>{let v=D=>{let S=document.getElementById(T);if(S){S.scrollIntoView({behavior:"smooth",block:"center"});return}D<4&&setTimeout(()=>v(D+1),60);};requestAnimationFrame(()=>v(0));},[]),B=useCallback((T,v)=>{if(a.some(D=>D.id===T)){I(T),w(v?`detail-tab-${T}-section-${v}`:`detail-tab-${T}`);return}w(`detail-section-${T}`);},[a,I,w]);return jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.5,minHeight:"100%"},children:[jsxs(Stack,{direction:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",md:"center"},spacing:1,children:[jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"h5",sx:{fontWeight:800,color:"text.primary"},children:e}),t&&jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mt:.35},children:t})]}),jsxs(Stack,{direction:"row",spacing:.6,alignItems:"center",sx:{width:{xs:"100%",md:"auto"},ml:{xs:0,md:"auto"}},children:[jsx(Box,{sx:{width:{xs:"100%",md:d},maxWidth:"100%",minWidth:{md:320}},children:jsx(Cp,{value:f,onChange:u,onSubmit:k,onVoiceInput:i?.onVoiceInput,onClear:()=>{u(""),E();},placeholder:i?.placeholder||g("detail.searchAi.placeholder"),statusText:m,loading:x,compact:true,showStatusText:false})}),s&&jsx(Tooltip,{title:c,children:jsx(IconButton,{size:"small",onClick:s,children:jsx(Ob,{fontSize:"small"})})}),l]})]}),m&&jsx(Typography,{variant:"caption",color:"text.secondary",sx:{mt:-0.7},children:m}),p==="search"&&C.length>0&&jsxs(Paper,{variant:"outlined",sx:{p:1.5,borderRadius:2},children:[jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block",mb:.6},children:g("detail.searchAi.matches",{count:C.length})}),jsx(Stack,{spacing:.35,children:C.slice(0,8).map(T=>jsx(Box,{component:"button",type:"button",onClick:()=>B(T.sourceId,T.sourceSectionId),sx:{textAlign:"left",border:0,bgcolor:"transparent",p:.2,cursor:"pointer",color:"text.primary",borderRadius:1,"&:hover":{bgcolor:"action.hover"}},children:jsxs(Typography,{variant:"body2",sx:{fontSize:"0.84rem"},children:[jsx(Box,{component:"span",sx:{color:"text.secondary"},children:T.sourceTitle})," \xB7 ",jsx(Box,{component:"span",sx:{fontWeight:700},children:T.fieldLabel})," = ",jsx(Box,{component:"span",children:T.fieldValue||"-"})]})},`${T.source}|${T.sourceId}|${T.fieldId}`))})]}),p==="ai"&&b&&jsxs(Paper,{variant:"outlined",sx:{p:1.5,borderRadius:2},children:[jsx(Typography,{variant:"subtitle2",sx:{fontWeight:700,mb:.7},children:g("detail.searchAi.aiResultTitle")}),jsx(Box,{sx:{fontSize:"0.9rem",lineHeight:1.6,"& p":{m:0,mb:.8},"& h1, & h2, & h3, & h4":{mt:1.2,mb:.6,lineHeight:1.3},"& ul, & ol":{mt:.4,mb:.8,pl:2.6},"& code":{px:.5,py:.1,borderRadius:.8,bgcolor:"action.hover",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},"& pre":{m:0,mt:.8,mb:.8,p:1.1,borderRadius:1.2,bgcolor:"action.hover",overflowX:"auto"},"& pre code":{p:0,bgcolor:"transparent"}},children:jsx(Rn,{markdown:b})})]}),jsx(Box,{sx:{display:"grid",gap:1.5,gridTemplateColumns:{xs:"1fr",lg:"repeat(2, minmax(0, 1fr))"}},children:o.map(T=>jsx(Box,{id:`detail-section-${T.id}`,children:jsx(Ki,{section:T,highlightQuery:f})},T.id))}),a.length>0&&jsxs(Paper,{variant:"outlined",sx:{borderRadius:2,overflow:"hidden"},children:[jsx(Tabs,{value:R?.id||false,onChange:(T,v)=>I(v),variant:"scrollable",scrollButtons:"auto",sx:{borderBottom:"1px solid",borderColor:"divider"},children:a.map(T=>jsx(Tab,{value:T.id,label:T.label,sx:{textTransform:"none"}},T.id))}),jsxs(Box,{sx:{p:1.5},children:[jsx(Box,{id:`detail-tab-${R?.id||""}`}),R?.description&&jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mb:1.2},children:R.description}),R?.content?R.content:jsxs(Stack,{spacing:1.5,children:[(R?.sections||[]).map(T=>jsx(Box,{id:`detail-tab-${R?.id}-section-${T.id}`,children:jsx(Ki,{section:T,highlightQuery:f})},T.id)),R?.fields&&R.fields.length>0&&jsx(Ki,{section:{id:`${R.id}-fields`,title:R.label,fields:R.fields,columns:2},highlightQuery:f})]})]})]}),n&&jsx(Sa,{title:n.title||g("detail.table.title"),...n.tableProps,filterConfig:void 0,fitContainer:false})]})};var Pp=({bucket:e,cardCount:t,highlighted:o=false,children:a,emptyLabel:r,maxHeight:n,sx:i})=>{let{t:l}=_();return jsx(Paper,{sx:[d=>{let s=e.accentColor??d.palette.primary.main;return {position:"relative",minWidth:0,borderRadius:4,overflow:"hidden",border:`1px solid ${alpha(s,o?.58:d.palette.mode==="dark"?.28:.18)}`,bgcolor:alpha(d.palette.background.paper,d.palette.mode==="dark"?.92:.97),boxShadow:o?`0 18px 40px ${alpha(s,.22)}`:`0 10px 28px ${alpha(d.palette.common.black,d.palette.mode==="dark"?.18:.08)}`,transition:"border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease","&::before":{content:'""',display:"block",height:4,bgcolor:s}}},...Array.isArray(i)?i:i?[i]:[]],children:jsxs(Stack,{spacing:1.2,sx:{p:1.5},children:[jsxs(Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{minWidth:0},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[e.icon,jsx(Typography,{sx:{fontSize:"0.96rem",fontWeight:800},children:e.title})]}),e.description&&jsx(Typography,{sx:{mt:.45,fontSize:"0.76rem",color:"text.secondary",lineHeight:1.45},children:e.description})]}),jsxs(Stack,{direction:"row",spacing:.8,sx:{flexShrink:0},children:[jsx(Chip,{size:"small",label:t,sx:{fontWeight:700}}),typeof e.limit=="number"&&jsx(Chip,{size:"small",label:`${l("kanban.bucket.limit")} ${e.limit}`,color:t>e.limit?"warning":"default",variant:"outlined"})]})]}),o&&jsx(Typography,{sx:{fontSize:"0.72rem",color:"primary.main",fontWeight:700},children:l("kanban.bucket.dropHere")}),jsx(Box,{sx:{minHeight:220,maxHeight:n,overflowY:n?"auto":"visible",pr:n?.4:0},children:t>0?a:jsx(Box,{sx:d=>({minHeight:160,borderRadius:3,border:`1px dashed ${alpha(d.palette.divider,.9)}`,bgcolor:d.palette.mode==="dark"?alpha(d.palette.common.white,.02):alpha(d.palette.primary.main,.03),display:"grid",placeItems:"center",px:2,textAlign:"center"}),children:jsx(Typography,{sx:{fontSize:"0.78rem",color:"text.secondary"},children:r??e.emptyLabel??l("kanban.empty")})})})]})})};var Ub={success:"success",warning:"warning",info:"info",error:"error"},Kb={critical:"error",high:"warning",medium:"info",low:"success"},qb=(e,t)=>{switch(e){case "critical":return t("kanban.priority.critical");case "high":return t("kanban.priority.high");case "medium":return t("kanban.priority.medium");case "low":return t("kanban.priority.low");default:return e}},_b=e=>e?e.split(/\s+/).map(t=>t.charAt(0).toUpperCase()).slice(0,2).join(""):"NA",Wl=({card:e,bucket:t,dragging:o=false,overlay:a=false,onClick:r,sx:n})=>{let{t:i}=_(),l=!!(r&&t),d=e.tone??(e.priority?Kb[e.priority]:"default"),s=d==="default"?"primary":Ub[d],c=t?{card:e,bucket:t}:void 0;return jsx(Paper,{onClick:l?()=>c&&r?.(c):void 0,onKeyDown:l?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),c&&r?.(c));}:void 0,role:l?"button":void 0,tabIndex:l?0:void 0,sx:[g=>{let f=d==="default"?g.palette.primary.main:g.palette[s].main;return {position:"relative",overflow:"hidden",p:1.4,borderRadius:3,border:`1px solid ${alpha(f,g.palette.mode==="dark"?.42:.2)}`,bgcolor:alpha(g.palette.background.paper,g.palette.mode==="dark"?.96:.98),boxShadow:a?`0 20px 45px ${alpha(g.palette.common.black,.24)}`:o?"none":`0 8px 24px ${alpha(g.palette.common.black,g.palette.mode==="dark"?.18:.08)}`,transform:a?"rotate(1deg) scale(1.01)":"none",transition:"transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease",cursor:l?"pointer":"default",opacity:o?.5:1,"&::before":{content:'""',position:"absolute",inset:"0 auto 0 0",width:4,bgcolor:f},"&:hover":l?{transform:"translateY(-1px)",boxShadow:`0 14px 32px ${alpha(g.palette.common.black,g.palette.mode==="dark"?.28:.12)}`}:void 0}},...Array.isArray(n)?n:n?[n]:[]],children:jsxs(Stack,{spacing:1.1,children:[jsxs(Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{minWidth:0,flex:1},children:[(e.kicker||t?.title)&&jsx(Typography,{sx:{fontSize:"0.72rem",fontWeight:700,letterSpacing:.4,color:"text.secondary",textTransform:"uppercase"},children:e.kicker??t?.title}),jsx(Typography,{sx:{mt:.2,fontSize:"0.98rem",fontWeight:800,lineHeight:1.3},children:e.title})]}),e.priority&&jsx(Chip,{size:"small",color:s,label:qb(e.priority,i),variant:d==="default"?"outlined":"filled",sx:{height:22,fontWeight:700}})]}),e.summary&&jsx(Typography,{sx:{fontSize:"0.82rem",color:"text.secondary",lineHeight:1.5},children:e.summary}),e.metrics&&e.metrics.length>0&&jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${Math.min(e.metrics.length,3)}, minmax(0, 1fr))`,gap:.9},children:e.metrics.slice(0,3).map(g=>jsxs(Box,{sx:f=>({borderRadius:2,px:1,py:.8,bgcolor:f.palette.mode==="dark"?alpha(f.palette.common.white,.05):alpha(f.palette.primary.main,.05)}),children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",textTransform:"uppercase",letterSpacing:.35},children:g.label}),jsx(Typography,{sx:{fontSize:"0.86rem",fontWeight:700},children:g.value})]},g.id))}),typeof e.progress=="number"&&jsxs(Box,{children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.5},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:i("kanban.card.progress")}),jsxs(Typography,{sx:{fontSize:"0.72rem",fontWeight:700},children:[Math.round(e.progress),"%"]})]}),jsx(LinearProgress,{variant:"determinate",value:Math.max(0,Math.min(100,e.progress)),color:s,sx:{height:8,borderRadius:999}})]}),(e.tags?.length||e.assignee||e.dueDate||e.footer||l)&&jsxs(Stack,{spacing:.9,children:[e.tags&&e.tags.length>0&&jsx(Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:e.tags.map(g=>jsx(Chip,{size:"small",label:g.label,color:g.color??"default",variant:"outlined"},g.id))}),jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8,minWidth:0},children:[e.assignee&&jsxs(Fragment,{children:[jsx(Avatar,{src:e.assignee.avatarSrc,sx:{width:28,height:28,fontSize:"0.75rem"},children:e.assignee.initials??_b(e.assignee.name)}),jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.78rem",fontWeight:700,lineHeight:1.2},noWrap:true,children:e.assignee.name}),e.dueDate&&jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary",lineHeight:1.2},noWrap:true,children:e.dueDate})]})]}),!e.assignee&&e.dueDate&&jsx(Typography,{sx:{fontSize:"0.76rem",color:"text.secondary"},children:e.dueDate})]}),l&&jsx(Typography,{sx:{fontSize:"0.72rem",color:"primary.main",fontWeight:700,whiteSpace:"nowrap"},children:i("kanban.card.openDetail")})]}),e.footer]})]})})};var jb=(e,t)=>Number.isNaN(e)||e<0?0:e>t?t:e,Mp=({buckets:e,cards:t})=>{let o=new Map;return t.forEach((a,r)=>{let n=o.get(a.bucketId)??[];n.push({card:a,sourceIndex:r}),o.set(a.bucketId,n);}),{buckets:e.map(a=>{let r=[...o.get(a.id)??[]].sort((n,i)=>n.card.position===void 0&&i.card.position===void 0?n.sourceIndex-i.sourceIndex:n.card.position===void 0?1:i.card.position===void 0?-1:n.card.position-i.card.position||n.sourceIndex-i.sourceIndex).map(({card:n},i)=>({...n,bucketId:a.id,position:i}));return {...a,cards:r}})}},Ro=(e,t)=>{for(let o=0;o<e.buckets.length;o+=1){let a=e.buckets[o],r=a.cards.findIndex(n=>n.id===t);if(r>=0)return {card:a.cards[r],bucket:a,bucketIndex:o,cardIndex:r}}},Qi=(e,t)=>{let o=Ro(e,t.cardId);if(!o)return e;let a=e.buckets.findIndex(s=>s.id===t.toBucketId);if(a<0)return e;let r=e.buckets.map(s=>({...s,cards:s.cards.map(c=>({...c}))})),n=r[o.bucketIndex],[i]=n.cards.splice(o.cardIndex,1);if(!i)return e;let l=r[a],d=jb(t.targetIndex??l.cards.length,l.cards.length);return l.cards.splice(d,0,{...i,bucketId:t.toBucketId}),{buckets:r.map(s=>({...s,cards:s.cards.map((c,g)=>({...c,bucketId:s.id,position:g}))}))}};var Hl="kanban-card|",Gl="kanban-bucket|",Ep=e=>`${Hl}${e}`,lx=e=>`${Gl}${e}`,Xi=e=>e?.startsWith(Hl)?e.slice(Hl.length):void 0,Fp=e=>e?.startsWith(Gl)?e.slice(Gl.length):void 0,cx=({card:e,bucket:t,onCardClick:o})=>{let{setNodeRef:a,attributes:r,listeners:n,transform:i,transition:l,isDragging:d}=useSortable({id:Ep(e.id)}),s={transform:i?`translate3d(${i.x}px, ${i.y}px, 0)`:void 0,transition:l,zIndex:d?2:1,touchAction:"none",cursor:d?"grabbing":"grab"};return jsx(Box,{ref:a,style:s,...r,...n,children:jsx(Wl,{card:e,bucket:t,dragging:d,onClick:o})})},dx=({bucket:e,highlighted:t,bucketMaxHeight:o,emptyBucketLabel:a,onCardClick:r})=>{let{isOver:n,setNodeRef:i}=useDroppable({id:lx(e.id)});return jsx(Box,{ref:i,sx:{minWidth:0},children:jsx(Pp,{bucket:e,cardCount:e.cards.length,highlighted:t||n,emptyLabel:a,maxHeight:o,children:jsx(SortableContext,{items:e.cards.map(l=>Ep(l.id)),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:1,children:e.cards.map(l=>jsx(cx,{card:l,bucket:e,onCardClick:r},l.id))})})})})},GD=({model:e,onCardMove:t,onCardClick:o,minBucketWidth:a=320,bucketMaxHeight:r,emptyBucketLabel:n,sx:i})=>{let[l,d]=useState(null),[s,c]=useState(),g=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:6}}),useSensor(TouchSensor,{activationConstraint:{delay:120,tolerance:8}})),f=useMemo(()=>l?Ro(e,l):void 0,[l,e]),u=useCallback(()=>{d(null),c(void 0);},[]),y=useCallback(m=>{if(!m)return;let b=Xi(m);return b?Ro(e,b)?.bucket.id:Fp(m)},[e]),I=useCallback(m=>{d(Xi(String(m.active.id))??null);},[]),p=useCallback(m=>{c(y(m.over?String(m.over.id):void 0));},[y]),C=useCallback(m=>{let b=Xi(String(m.active.id)),x=m.over?String(m.over.id):void 0;if(!b||!x){u();return}let k=Ro(e,b);if(!k){u();return}let E=k.bucket.id,R=k.cardIndex,w=Xi(x);if(w){let v=Ro(e,w);if(!v){u();return}E=v.bucket.id,R=v.cardIndex;}else {let v=Fp(x),D=e.buckets.find(S=>S.id===v);if(!v||!D){u();return}E=v,R=D.cards.length;}if(k.bucket.id===E&&k.cardIndex===R){u();return}let B=Qi(e,{cardId:b,fromBucketId:k.bucket.id,toBucketId:E,targetIndex:R}),T=Ro(B,b);T&&!(T.bucket.id===k.bucket.id&&T.cardIndex===k.cardIndex)&&t?.({cardId:b,fromBucketId:k.bucket.id,toBucketId:T.bucket.id,targetIndex:T.cardIndex,card:T.card,model:B}),u();},[e,t,u]);return jsxs(DndContext,{sensors:g,collisionDetection:closestCorners,onDragStart:I,onDragOver:p,onDragEnd:C,onDragCancel:u,children:[jsx(Box,{sx:[{display:"grid",gridAutoFlow:"column",gridAutoColumns:`minmax(${a}px, 1fr)`,gap:2,alignItems:"start",overflowX:"auto",pb:.5},...Array.isArray(i)?i:i?[i]:[]],children:e.buckets.map(m=>jsx(dx,{bucket:m,highlighted:m.id===s,bucketMaxHeight:r,emptyBucketLabel:n,onCardClick:o},m.id))}),jsx(DragOverlay,{children:f?jsx(Box,{sx:{width:Math.max(a-24,260)},children:jsx(Wl,{card:f.card,bucket:f.bucket,overlay:true})}):null})]})};var gx=({initialModel:e,initialBuckets:t,initialCards:o})=>e||Mp({buckets:t??[],cards:o??[]}),ZD=e=>{let{onCardMove:t,onCardClick:o}=e,[a,r]=useState(()=>gx(e)),n=useCallback(c=>{r(g=>typeof c=="function"?c(g):c);},[]),i=useCallback(c=>Ro(a,c),[a]),l=useCallback((c,g,f)=>{let u=Ro(a,c);if(!u)return;let y=Qi(a,{cardId:c,fromBucketId:u.bucket.id,toBucketId:g,targetIndex:f}),I=Ro(y,c);if(!I||I.bucket.id===u.bucket.id&&I.cardIndex===u.cardIndex)return;r(y);let p={cardId:c,fromBucketId:u.bucket.id,toBucketId:I.bucket.id,targetIndex:I.cardIndex,card:I.card,model:y};return t?.(p),p},[a,t]),d=useCallback((c,g)=>{r(f=>({buckets:f.buckets.map(u=>({...u,cards:u.cards.map(y=>y.id!==c?y:typeof g=="function"?g(y):{...y,...g})}))}));},[]),s=useMemo(()=>({model:a,onCardMove:c=>{l(c.cardId,c.toBucketId,c.targetIndex);},onCardClick:o}),[a,l,o]);return {model:a,actions:{replaceModel:n,moveCard:l,updateCard:d,getCard:i},boardProps:s}};var Vp=64,Dx="#E9EDF2",Mx="linear-gradient(90deg, #F5F7FA 0%, #E9EDF2 50%, #F5F7FA 100%)",Ax=["en","zh","fr","de","ja","ko"],Op={en:"EN",zh:"\u4E2D\u6587",fr:"FR",de:"DE",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4"},ts=({appTitle:e,logo:t,mode:o="dark",onToggleMode:a,locale:r,localeLabel:n,localeOptions:i,onLocaleChange:l,searchPlaceholder:d,onSearch:s,user:c,onUserSetting:g,onUserLogout:f,userMenuItems:u,leftSlot:y,rightSlot:I})=>{let{t:p,locale:C}=_(),b=useTheme().palette.mode==="dark",[x,k]=useState(""),[E,R]=useState(null),[w,B]=useState(null),T=Z=>{Z.preventDefault(),s&&s(x.trim());},v=o==="system"?jsx(wx,{fontSize:"small"}):o==="dark"?jsx(Ix,{fontSize:"small"}):jsx(Tx,{fontSize:"small"}),D=p(o==="system"?"header.theme.system":o==="dark"?"header.theme.dark":"header.theme.light"),S=r||C,P=i&&i.length>0?i:Ax,F=n||Op[S]||S.toUpperCase(),W=!!E,z=d||p("header.searchPlaceholder"),j=!!w,ie=[{key:"setting",label:p("header.menu.setting"),icon:jsx(Jh,{sx:{fontSize:18}}),onClick:g},{key:"logout",label:p("header.menu.logout"),icon:jsx(Rx,{sx:{fontSize:18}}),onClick:f}],Y=u&&u.length>0?u:ie,te=Z=>{B(null),Z?.();};return jsxs(AppBar,{position:"sticky",elevation:0,sx:Z=>({top:0,zIndex:Z.zIndex.drawer+10,height:Vp,backgroundColor:Z.palette.mode==="dark"?"#0D0D0D":Dx,backgroundImage:Z.palette.mode==="dark"?["radial-gradient(circle at 18% 22%, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 45%)","radial-gradient(circle at 78% 32%, rgba(144,202,249,0.14) 0%, rgba(144,202,249,0) 42%)","linear-gradient(90deg, #0A0A0A 0%, #151515 50%, #0A0A0A 100%)","linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px)","linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px)"].join(","):["radial-gradient(circle at 22% 22%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 48%)","radial-gradient(circle at 76% 24%, rgba(203,213,225,0.45) 0%, rgba(203,213,225,0) 42%)",Mx,"linear-gradient(rgba(15,23,42,0.05) 1px, transparent 1px)","linear-gradient(90deg, rgba(15,23,42,0.04) 1px, transparent 1px)"].join(","),backgroundSize:"auto, auto, auto, 24px 24px, 24px 24px",borderBottom:"1px solid",borderColor:Z.palette.mode==="dark"?"rgba(255,255,255,0.12)":"rgba(15,23,42,0.12)"}),children:[jsxs(Toolbar,{sx:{minHeight:`${Vp}px !important`,px:2,gap:2},children:[jsxs(Stack,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:220},children:[y,t===null?null:t||jsx(Box,{component:"img",src:"/orbcafe.png",alt:"ORBCAFE Logo",sx:{width:44,height:44,display:"block",objectFit:"contain",flexShrink:0}}),e&&jsx(Typography,{variant:"h6",sx:{fontWeight:700,color:b?"common.white":"#111827"},children:e})]}),jsx(Box,{sx:{flex:1,display:"flex",justifyContent:"center",minWidth:0},children:jsx(Box,{component:"form",onSubmit:T,sx:{width:"100%",maxWidth:540},children:jsx(TextField,{size:"small",fullWidth:true,value:x,onChange:Z=>k(Z.target.value),placeholder:z,InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx($d,{sx:{color:b?"rgba(255,255,255,0.7)":"rgba(15,23,42,0.55)",fontSize:18}})}),sx:{color:b?"common.white":"rgba(17,24,39,0.9)",bgcolor:b?"rgba(255,255,255,0.08)":"#ffffff",borderRadius:999,"& .MuiOutlinedInput-notchedOutline":{borderColor:b?"rgba(255,255,255,0.15)":"rgba(15,23,42,0.2)"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:b?"rgba(255,255,255,0.35)":"rgba(15,23,42,0.35)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:b?"rgba(255,255,255,0.5)":"rgba(15,23,42,0.55)"}}},inputProps:{style:{color:b?"white":"#111827"}}})})}),jsxs(Stack,{direction:"row",alignItems:"center",spacing:1.5,children:[l?jsxs(Fragment,{children:[jsx(IconButton,{size:"small",onClick:Z=>R(Z.currentTarget),sx:{color:b?"common.white":"#111827",borderRadius:1,px:.5},children:jsxs(Stack,{direction:"row",alignItems:"center",spacing:.45,children:[jsx(zp,{sx:{fontSize:18}}),jsx(Typography,{variant:"caption",sx:{fontWeight:500},children:F})]})}),jsx(Menu,{anchorEl:E,open:W,onClose:()=>R(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:P.map(Z=>jsx(MenuItem,{selected:Z===S,onClick:()=>{l(Z),R(null);},sx:{fontSize:"0.82rem"},children:Op[Z]},Z))})]}):jsxs(Stack,{direction:"row",alignItems:"center",spacing:.5,children:[jsx(zp,{sx:{color:b?"common.white":"#111827",fontSize:18}}),jsx(Typography,{variant:"caption",sx:{color:b?"common.white":"#111827",fontWeight:500},children:F})]}),jsx(IconButton,{size:"small",sx:{color:b?"common.white":"#111827"},onClick:a,title:D,children:v}),c&&jsxs(Stack,{direction:"row",alignItems:"center",spacing:1,children:[jsxs(Box,{sx:{textAlign:"right",minWidth:0},children:[jsx(Typography,{variant:"body2",sx:{color:b?"common.white":"#111827",fontWeight:700,lineHeight:1.15},children:c.name}),c.subtitle&&jsx(Typography,{variant:"caption",sx:{display:"block",mt:.25,color:b?"rgba(255,255,255,0.72)":"rgba(17,24,39,0.62)",fontSize:"0.72rem",lineHeight:1.1,letterSpacing:"0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:220},title:c.subtitle,children:c.subtitle})]}),jsx(IconButton,{size:"small",onClick:Z=>B(Z.currentTarget),sx:{p:0},children:jsx(Avatar,{src:c.avatarSrc,imgProps:{style:{objectFit:"cover"}},sx:{width:34,height:34,bgcolor:"grey.100",color:"grey.700",fontSize:"0.85rem"},children:c.avatarText||c.name.slice(0,1).toUpperCase()})})]}),I]})]}),c&&jsx(Menu,{anchorEl:w,open:j,onClose:()=>B(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{minWidth:160,"& .MuiMenuItem-root":{minHeight:34,py:.5,px:1.25}}}},children:Y.map(Z=>jsxs(MenuItem,{disabled:Z.disabled,onClick:()=>te(Z.onClick),children:[Z.icon&&jsx(ListItemIcon,{children:Z.icon}),jsx(ListItemText,{primary:Z.label,slotProps:{primary:{sx:{fontSize:"0.86rem",fontWeight:500}}}})]},Z.key))})]})};var $p=({menuData:e=[],initialNavigationCollapsed:t=false}={})=>{let{navigationIslandProps:o}=Gc({initialCollapsed:t,content:e}),[a,r]=useState(900);useEffect(()=>{let i=()=>r(window.innerHeight);return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);let n=useMemo(()=>Math.max(280,a-100),[a]);return {navigationIslandProps:o,navigationMaxHeight:n}};var bM=({appTitle:e,menuData:t=[],children:o,showNavigation:a=true,locale:r="en",localeLabel:n,localeOptions:i,onLocaleChange:l,user:d,onUserSetting:s,onUserLogout:c,userMenuItems:g,logo:f,onSearch:u,rightHeaderSlot:y,leftHeaderSlot:I,contentSx:p})=>{let C="orbcafe:page-layout-mode",[m,b]=useState("system"),[x,k]=useState("light"),[E,R]=useState(false),w=m==="system"?E?x:"light":m;useEffect(()=>{try{let P=window.localStorage.getItem(C);(P==="light"||P==="dark"||P==="system")&&b(P);}catch{}R(true);let D=window.matchMedia("(prefers-color-scheme: dark)"),S=()=>{k(D.matches?"dark":"light");};return S(),D.addEventListener("change",S),()=>D.removeEventListener("change",S)},[]),useEffect(()=>{if(E)try{window.localStorage.setItem(C,m);}catch{}},[E,m]),useEffect(()=>{w==="dark"?(document.documentElement.classList.add("dark"),document.documentElement.style.colorScheme="dark"):(document.documentElement.classList.remove("dark"),document.documentElement.style.colorScheme="light");},[w]);let B=useMemo(()=>createTheme({palette:{mode:w}}),[w]),{navigationIslandProps:T,navigationMaxHeight:v}=$p({menuData:t,initialNavigationCollapsed:false});return jsx(ThemeProvider,{theme:B,children:jsx(Yn,{locale:r,children:jsxs(Box,{sx:D=>({minHeight:"100vh",display:"flex",flexDirection:"column",background:D.palette.mode==="dark"?"linear-gradient(180deg, #0A0A0A 0%, #141414 55%, #1A1A1A 100%)":D.palette.background.default}),children:[jsx(ts,{appTitle:e,logo:f,mode:m,onToggleMode:()=>b(D=>D==="system"?"dark":D==="dark"?"light":"system"),locale:r,localeLabel:n,localeOptions:i,onLocaleChange:l,user:d,onUserSetting:s,onUserLogout:c,userMenuItems:g,onSearch:u,leftSlot:I,rightSlot:y}),jsxs(Box,{sx:{flex:1,minHeight:0,display:"flex"},children:[a&&jsx(Box,{sx:{p:1.5,display:"flex",alignItems:"flex-start",flexShrink:0},children:jsx(Wc,{...T,maxHeight:v,colorMode:w})}),jsx(Box,{sx:{flex:1,minWidth:0,minHeight:0,overflow:"auto",p:1.5,...p},children:o})]})]})})})};var as="(blank)",Hp="Result",Gp="Grand Total",Up={sum:"Sum",count:"Count",avg:"Average",min:"Min",max:"Max"},Kp=["sum","count","avg","min","max"];var qp=["palette","rows","columns","filters","values"];var _p=e=>qp.includes(e),Zp=e=>e==="rows"||e==="columns"||e==="filters",rs=e=>{let t=e.split("|");return t.length===2&&t[0]==="container"&&_p(t[1])?{kind:"container",zone:t[1]}:t.length===3&&t[0]==="item"&&_p(t[1])&&t[2]?{kind:"item",zone:t[1],key:t[2]}:null},ra=e=>e==null||e===""?as:e instanceof Date?e.toISOString().slice(0,10):String(e),or=e=>JSON.stringify(e),jp=(e,t)=>{let o=e.join(""),a=t.join("");return o.localeCompare(a,void 0,{sensitivity:"base"})},Ox=e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},zr=(e,t,o)=>{if(o==="count")return e.length;let a=e.map(r=>Ox(r[t])).filter(r=>r!==null);return a.length===0?0:o==="sum"?a.reduce((r,n)=>r+n,0):o==="avg"?a.reduce((r,n)=>r+n,0)/a.length:o==="min"?Math.min(...a):Math.max(...a)},gt=(e,t)=>{if(!e||e.length===0)return [];let o=new Set,a=[];return e.forEach(r=>{!t.has(r)||o.has(r)||(o.add(r),a.push(r));}),a},na=(e,t)=>e.length!==t.length?false:e.every((o,a)=>o===t[a]),Qp=(e,t)=>{let o=Object.keys(e),a=Object.keys(t);return o.length!==a.length?false:o.every(r=>{let n=e[r]??[],i=t[r]??[];return na(n,i)})},ns=(e,t)=>e.length!==t.length?false:e.every((o,a)=>{let r=t[a];return o.tokenId===r.tokenId&&o.fieldId===r.fieldId&&o.aggregation===r.aggregation}),Zl=e=>!e?.aggregations||e.aggregations.length===0?Kp:e.aggregations,Nt=(e,t)=>{let o=Zl(t);return e&&o.includes(e)?e:t?.type==="number"&&o.includes("sum")?"sum":o.includes("count")?"count":o[0]},Ln=(e,t,o)=>{let a=o.get(t.fieldId);return a?.formatValue?a.formatValue(e):t.aggregation==="count"?Math.round(e).toLocaleString():e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})};var Jp=({options:e,selectedValues:t,onChange:o,minWidth:a=96})=>{let{t:r}=_(),[n,i]=useState(""),l=useMemo(()=>{let s=n.trim().toLowerCase();return s?e.filter(c=>c.toLowerCase().includes(s)):e},[e,n]),d=e.length>0&&t.length===e.length;return jsx(FormControl,{size:"small",sx:{minWidth:a},children:jsxs(Select,{multiple:true,value:t,onChange:s=>{let c=s.target.value,g=typeof c=="string"?c.split(","):c;o(g);},onClick:s=>s.stopPropagation(),onMouseDown:s=>s.stopPropagation(),renderValue:s=>{let c=s;return e.length===0?r("pivot.filter.na"):c.length===0?r("common.none"):c.length===e.length?r("common.all"):`${c.length}/${e.length}`},MenuProps:{PaperProps:{sx:{maxHeight:320,bgcolor:"background.paper"}}},sx:{fontSize:"0.72rem",height:26,"& .MuiSelect-select":{py:.35}},children:[jsx(ListSubheader,{disableSticky:true,sx:s=>({bgcolor:"background.paper",py:.8,lineHeight:"normal",borderBottom:`1px solid ${s.palette.divider}`}),children:jsx(TextField,{size:"small",placeholder:`${r("common.search")}...`,fullWidth:true,value:n,onChange:s=>i(s.target.value),onKeyDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),sx:{m:0,"& .MuiInputBase-input":{fontSize:"0.75rem",py:.7}}})}),jsx(Box,{sx:s=>({px:1.5,py:.5,borderBottom:`1px solid ${s.palette.divider}`,bgcolor:"background.paper"}),onMouseDown:s=>{s.preventDefault(),s.stopPropagation();},onClick:s=>{s.preventDefault(),s.stopPropagation();},children:jsx(Button,{variant:"text",size:"small",onClick:s=>{s.preventDefault(),s.stopPropagation(),o(d?[]:e);},sx:{minWidth:"auto",px:0,py:.2,fontSize:"0.76rem",fontWeight:700,textTransform:"none"},children:r(d?"pivot.filter.deselectAll":"pivot.filter.selectAll")})}),l.length===0&&jsx(MenuItem,{disabled:true,sx:{fontSize:"0.75rem"},children:r("pivot.filter.noResults")}),l.map(s=>{let c=t.includes(s);return jsxs(MenuItem,{value:s,sx:{fontSize:"0.75rem",py:.25},children:[jsx(Checkbox,{size:"small",checked:c,sx:{p:.5,mr:.5}}),jsx(ListItemText,{primary:s,primaryTypographyProps:{sx:{fontSize:"0.75rem",lineHeight:1.2}}})]},s)})]})})};var Ql=({label:e,subtitle:t,isDragging:o,dragRef:a,listeners:r,attributes:n,style:i})=>jsx(Paper,{ref:a,...r,...n,sx:l=>({p:1,borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:l.palette.mode==="dark"?"#111111":"background.paper",touchAction:"none"}),style:{...i,opacity:o?.3:1,cursor:o?"grabbing":"grab"},children:jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[jsx(Box,{sx:l=>({display:"inline-flex",alignItems:"center",justifyContent:"center",p:.3,borderRadius:1,bgcolor:l.palette.mode==="dark"?"rgba(255,255,255,0.12)":"rgba(17, 24, 39, 0.08)"}),children:jsx(Xx,{sx:{fontSize:16,color:"text.secondary"}})}),jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.82rem",fontWeight:700,lineHeight:1.2},children:e}),t&&jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary",lineHeight:1.2},children:t})]})]})}),ou=({id:e,label:t,subtitle:o})=>{let{setNodeRef:a,listeners:r,attributes:n,isDragging:i}=useDraggable({id:e});return jsx(Ql,{label:t,subtitle:o,isDragging:i,dragRef:a,listeners:r,attributes:n})};var $r=({zone:e,title:t,hint:o,icon:a,children:r,itemCount:n,onClear:i})=>{let l=`container|${e}`,{isOver:d,setNodeRef:s}=useDroppable({id:l}),{t:c}=_();return jsxs(Paper,{ref:s,sx:g=>({p:1.1,borderRadius:3,border:"1px dashed",borderColor:d?"primary.main":g.palette.divider,bgcolor:d?g.palette.mode==="dark"?"rgba(25, 118, 210, 0.16)":"rgba(47, 91, 255, 0.06)":g.palette.mode==="dark"?"rgba(255,255,255,0.02)":"rgba(245, 248, 255, 0.86)",transition:"all 120ms ease",minHeight:120,display:"flex",flexDirection:"column"}),children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[a,jsx(Typography,{sx:{fontSize:"0.79rem",fontWeight:800,letterSpacing:.2},children:t}),jsxs(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:["(",n,")"]})]}),n>0&&i&&jsx(Tooltip,{title:c("pivot.clearArea"),children:jsx(IconButton,{size:"small",onClick:i,sx:{p:.25},children:jsx(o0,{sx:{fontSize:16}})})})]}),jsx(Typography,{sx:{mt:.5,mb:.9,fontSize:"0.7rem",color:"text.secondary"},children:o}),jsx(Box,{sx:{flex:1},children:r})]})};var ru={xs:1.2,md:1.6},Hr=({title:e,subtitle:t,collapsed:o,onToggleCollapse:a,expandAriaLabel:r,collapseAriaLabel:n,children:i,bodySx:l,unmountOnExit:d=false,headerActions:s})=>jsxs(Paper,{sx:c=>({borderRadius:3,border:`1px solid ${c.palette.divider}`,overflow:"hidden",bgcolor:alpha(c.palette.background.paper,.95)}),children:[jsxs(Box,{sx:c=>({px:ru,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,borderBottom:o?"none":`1px solid ${c.palette.divider}`}),children:[jsxs(Box,{sx:{minWidth:0,flex:1},children:[jsx(Typography,{sx:{fontSize:"0.9rem",fontWeight:800},children:e}),jsx(Typography,{sx:{fontSize:"0.74rem",color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})]}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.75,flexShrink:0},children:[s,jsx(IconButton,{size:"small","aria-label":o?r:n,onClick:a,sx:c=>({border:`1px solid ${c.palette.divider}`,bgcolor:alpha(c.palette.background.paper,.88),width:28,height:28,borderRadius:999,flexShrink:0,"&:hover":{bgcolor:c.palette.mode==="dark"?alpha(c.palette.primary.main,.18):alpha(c.palette.primary.main,.08)}}),children:jsx(ey,{sx:{fontSize:16,transition:"transform 220ms cubic-bezier(0.2, 0, 0, 1)",transform:o?"rotate(180deg)":"rotate(0deg)"}})})]})]}),jsx(Collapse,{in:!o,timeout:260,easing:"cubic-bezier(0.2, 0, 0, 1)",unmountOnExit:d,children:jsx(Box,{sx:[{px:ru,py:{xs:1.2,md:1.6}},...Array.isArray(l)?l:l?[l]:[]],children:i})})]});var ds=({label:e,caption:t,onRemove:o,trailing:a,isDragging:r,dragRef:n,listeners:i,attributes:l,style:d})=>jsx(Paper,{ref:n,style:d,sx:s=>({p:1,borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:s.palette.mode==="dark"?"#111111":"background.paper",touchAction:"none",opacity:r?0:1}),children:jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[jsx(Box,{...l,...i,sx:s=>({display:"inline-flex",alignItems:"center",justifyContent:"center",p:.25,borderRadius:1,bgcolor:s.palette.mode==="dark"?"rgba(255,255,255,0.12)":"rgba(17, 24, 39, 0.08)",cursor:"grab"}),children:jsx(Xx,{sx:{fontSize:15,color:"text.secondary"}})}),jsxs(Box,{sx:{minWidth:0,flex:1},children:[jsx(Typography,{sx:{fontSize:"0.8rem",fontWeight:700,lineHeight:1.2},children:e}),t&&jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary",lineHeight:1.2},children:t})]}),a,o&&jsx(IconButton,{size:"small",onClick:s=>{s.stopPropagation(),o();},sx:{p:.2},children:jsx(_f,{sx:{fontSize:16}})})]})}),Nn=({id:e,label:t,caption:o,onRemove:a,trailing:r})=>{let{setNodeRef:n,attributes:i,listeners:l,transform:d,transition:s,isDragging:c}=useSortable({id:e}),g={transform:d?`translate3d(${d.x}px, ${d.y}px, 0)`:void 0,transition:s,zIndex:c?999:"auto"};return jsx(ds,{label:t,caption:o,onRemove:a,trailing:r,isDragging:c,dragRef:n,listeners:l,attributes:i,style:g})};var ms={rows:jsx(h0,{fontSize:"small"}),columns:jsx(Ag,{fontSize:"small"}),filters:jsx(f0,{fontSize:"small"}),values:jsx(Lg,{fontSize:"small"})},su=({isConfiguratorCollapsed:e,onToggleCollapse:t,availableFields:o,fieldMap:a,filterFields:r,columnFields:n,rowFields:i,valueFields:l,clearZone:d,removeFieldFromZone:s,getFilterSelectionSummary:c,renderDimensionFilterSelect:g,renderAggregationSelect:f,getAggregationLabel:u})=>{let{t:y}=_(),I=[`${y("pivot.zone.rows")} ${i.length}`,`${y("pivot.zone.columns")} ${n.length}`,`${y("pivot.zone.filters")} ${r.length}`,`${y("pivot.zone.values")} ${l.length}`].join(" \xB7 ");return jsx(Hr,{title:y("pivot.config.title"),subtitle:I,collapsed:e,onToggleCollapse:t,expandAriaLabel:y("pivot.collapse.ariaExpand"),collapseAriaLabel:y("pivot.collapse.ariaCollapse"),unmountOnExit:true,children:jsxs(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",lg:"260px 1fr"},gap:2},children:[jsx($r,{zone:"palette",title:y("pivot.fieldList"),hint:y("pivot.availableDimensions"),itemCount:o.length,icon:jsx(Xx,{sx:{fontSize:16,color:"text.secondary"}}),children:jsxs(Stack,{spacing:.8,sx:{maxHeight:400,overflowY:"auto",pr:.5},children:[o.length===0&&jsx(Typography,{sx:{fontSize:"0.74rem",color:"text.secondary",py:1},children:y("pivot.allFieldsInUse")}),o.map(p=>jsx(ou,{id:`item|palette|${p.id}`,label:p.label,subtitle:p.type??"string"},p.id))]})}),jsxs(Stack,{spacing:2,children:[jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2},children:[jsx($r,{zone:"filters",title:y("pivot.zone.filters"),hint:y("pivot.hint.filters"),icon:ms.filters,itemCount:r.length,onClear:()=>d("filters"),children:jsx(SortableContext,{items:r.map(p=>`item|filters|${p}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:r.map(p=>jsx(Nn,{id:`item|filters|${p}`,label:a.get(p)?.label??p,caption:c(p),trailing:g(p),onRemove:()=>s("filters",p)},p))})})}),jsx($r,{zone:"columns",title:y("pivot.zone.columns"),hint:y("pivot.hint.columns"),icon:ms.columns,itemCount:n.length,onClear:()=>d("columns"),children:jsx(SortableContext,{items:n.map(p=>`item|columns|${p}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:n.map(p=>jsx(Nn,{id:`item|columns|${p}`,label:a.get(p)?.label??p,caption:`${a.get(p)?.type??"dimension"} \u2022 ${c(p)}`,trailing:g(p),onRemove:()=>s("columns",p)},p))})})})]}),jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2},children:[jsx($r,{zone:"rows",title:y("pivot.zone.rows"),hint:y("pivot.hint.rows"),icon:ms.rows,itemCount:i.length,onClear:()=>d("rows"),children:jsx(SortableContext,{items:i.map(p=>`item|rows|${p}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:i.map(p=>jsx(Nn,{id:`item|rows|${p}`,label:a.get(p)?.label??p,caption:`${a.get(p)?.type??"dimension"} \u2022 ${c(p)}`,trailing:g(p),onRemove:()=>s("rows",p)},p))})})}),jsx($r,{zone:"values",title:y("pivot.zone.values"),hint:y("pivot.hint.values"),icon:ms.values,itemCount:l.length,onClear:()=>d("values"),children:jsx(SortableContext,{items:l.map(p=>`item|values|${p.tokenId}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:l.map(p=>{let C=a.get(p.fieldId)?.label??p.fieldId,m=`${u(p.aggregation)}(${C})`;return jsx(Nn,{id:`item|values|${p.tokenId}`,label:C,caption:m,trailing:f(p),onRemove:()=>s("values",p.tokenId)},p.tokenId)})})})})]})]})]})})};var lu=e=>e.toLocaleString(void 0,{maximumFractionDigits:1}),cu=({data:e,primaryLabel:t,secondaryLabel:o,formatPrimaryValue:a,formatSecondaryValue:r})=>{let n=useTheme$1();if(e.length===0)return null;let i=720,l=250,d={top:20,right:24,bottom:40,left:52},s=o?e.map(p=>p.primaryValue):e.map((p,C)=>C+1),c=o?e.map(p=>p.secondaryValue??0):e.map(p=>p.primaryValue),g=Math.max(...s,1),f=Math.max(...c,1),u=i-d.left-d.right,y=l-d.top-d.bottom,I=e.map((p,C)=>{let m=o?p.primaryValue:C+1,b=o?p.secondaryValue??0:p.primaryValue,x=d.left+m/g*u,k=l-d.bottom-b/f*y;return {...p,x,y:k,rawX:m,rawY:b}});return jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[jsx(Box,{sx:{overflowX:"auto"},children:jsxs(Box,{component:"svg",viewBox:`0 0 ${i} ${l}`,sx:{width:"100%",minWidth:i,height:l},children:[jsx("line",{x1:d.left,y1:l-d.bottom,x2:i-d.right,y2:l-d.bottom,stroke:alpha(n.palette.text.secondary,.35)}),jsx("line",{x1:d.left,y1:d.top,x2:d.left,y2:l-d.bottom,stroke:alpha(n.palette.text.secondary,.35)}),I.map(p=>jsxs("g",{children:[jsx("circle",{cx:p.x,cy:p.y,r:7,fill:alpha(n.palette.primary.main,.18)}),jsx("circle",{cx:p.x,cy:p.y,r:4.5,fill:n.palette.primary.main,children:jsxs("title",{children:[p.name,`
7
+ `),f={enableMath:a},u=0;for(;u<g.length;){let h=g[u],w=h.trim();if(!w){u+=1;continue}if(n&&qp(h)){if(w.startsWith("<think>")){let m=[],y=h;for(;;){let x=y.indexOf("<think>"),k=x>=0?y.slice(x+7):y,F=k.indexOf("</think>");if(F>=0){m.push(k.slice(0,F)),u+=1;break}if(m.push(k),u+=1,u>=g.length)break;y=g[u];}c.push(jsx(cs,{content:m.join(`
8
+ `).trim()},`think-tag-${u}`));continue}u+=1;let v=[];for(;u<g.length&&g[u].trim()!==":::";)v.push(g[u]),u+=1;u<g.length&&g[u].trim()===":::"&&(u+=1),c.push(jsx(cs,{content:v.join(`
9
+ `).trim()},`think-fence-${u}`));continue}if(ds(h)){let v=w.slice(3).trim().toLowerCase(),m=[];for(u+=1;u<g.length&&!ds(g[u]);)m.push(g[u]),u+=1;u<g.length&&ds(g[u])&&(u+=1);let y=m.join(`
10
+ `);if(r&&v==="mermaid"){c.push(jsx(jl,{code:y},`mermaid-${u}`));continue}if(a&&["math","latex","katex"].includes(v)){c.push(jsx(Un,{expression:y,allowKatex:true},`math-fence-${u}`));continue}c.push(jsx(Gn,{code:y,language:v||"text",copyable:i,showLineNumbers:l,wrapLongLines:true},`code-${u}`));continue}if(a&&w.startsWith("$$")){let v=[];if(w.endsWith("$$")&&w!=="$$")v.push(w.slice(2,-2)),u+=1;else {let y=h.slice(h.indexOf("$$")+2);for(y.trim()&&v.push(y),u+=1;u<g.length;){let x=g[u],k=x.indexOf("$$");if(k>=0){v.push(x.slice(0,k)),u+=1;break}v.push(x),u+=1;}}c.push(jsx(Un,{expression:v.join(`
11
+ `).trim(),allowKatex:true},`math-${u}`));continue}if(Gp(h)){let v=Math.min(6,h.match(/^#{1,6}/)?.[0]?.length||1),m=h.replace(/^#{1,6}\s+/,""),y=v===1?"h5":v===2?"h6":"subtitle1";c.push(jsx(Typography,{variant:y,sx:{mt:v===1?1.2:.8,mb:.5,fontWeight:700},children:_n(m,f,`h-${u}`)},`heading-${u}`)),u+=1;continue}if(Up(h)){c.push(jsx(Divider,{sx:{my:1.2}},`hr-${u}`)),u+=1;continue}if(Kp(g,u)){let v=u+2;for(;v<g.length&&g[v].trim()&&g[v].includes("|");)v+=1;let m=g.slice(u,v).join(`
12
+ `),y=ss(m);if(y){c.push(jsx(Ql,{table:y},`table-${u}`)),u=v;continue}}if(oc(h)){let v=[];for(;u<g.length&&oc(g[u]);)v.push(g[u].replace(/^\s*>\s?/,"")),u+=1;c.push(jsx(Paper,{variant:"outlined",sx:{px:1,py:.8,my:.9,borderLeftWidth:3,borderLeftStyle:"solid",borderLeftColor:"primary.main",bgcolor:"action.hover"},children:jsx(Typography,{variant:"body2",sx:{whiteSpace:"pre-wrap"},children:v.map((m,y)=>jsxs(Fragment$1,{children:[y>0&&jsx("br",{}),_n(m,f,`q-${u}-${y}`)]},`quote-line-${y}`))})},`quote-${u}`));continue}if(ec(h)){let v=[];for(;u<g.length&&ec(g[u]);)v.push(g[u].trim().replace(/^[-*+]\s+/,"")),u+=1;c.push(jsx(Box,{component:"ul",sx:{my:.8,pl:2.5},children:v.map((m,y)=>jsx(Box,{component:"li",sx:{mb:.45},children:jsx(Typography,{variant:"body2",children:_n(m,f,`ul-${u}-${y}`)})},`ul-item-${y}`))},`ul-${u}`));continue}if(tc(h)){let v=[];for(;u<g.length&&tc(g[u]);)v.push(g[u].trim().replace(/^\d+\.\s+/,"")),u+=1;c.push(jsx(Box,{component:"ol",sx:{my:.8,pl:2.7},children:v.map((m,y)=>jsx(Box,{component:"li",sx:{mb:.45},children:jsx(Typography,{variant:"body2",children:_n(m,f,`ol-${u}-${y}`)})},`ol-item-${y}`))},`ol-${u}`));continue}let p=[];for(;u<g.length;){let v=g[u],m=v.trim();if(!m||ds(v)||Gp(v)||Up(v)||ec(v)||tc(v)||oc(v)||Kp(g,u)||n&&qp(v)||a&&m.startsWith("$$"))break;p.push(v),u+=1;}p.length>0?c.push(jsx(Typography,{variant:"body2",sx:{my:.65,lineHeight:1.65},children:p.map((v,m)=>jsxs(Fragment$1,{children:[m>0&&jsx("br",{}),_n(v,f,`p-${u}-${m}`)]},`p-line-${m}`))},`p-${u}`)):u+=1;}return c},[d,a,r,n,i,l]);return jsx(Box,{className:o,sx:{"& strong":{fontWeight:700},"& em":{fontStyle:"italic"},"& a":{wordBreak:"break-all"}},children:s})};var AM=(e,t)=>jsx(Zn,{markdown:e,...t});var jp=({value:e,onChange:t,onSubmit:o,onVoiceInput:a,onClear:r,placeholder:n,statusText:i,loading:l=false,compact:d=false,showStatusText:s=true})=>jsxs(Stack,{spacing:.75,children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:1,px:1.2,py:d?.25:.4,borderRadius:999,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",minHeight:d?38:44},children:[jsx(gp,{sx:{fontSize:d?16:18,color:"text.secondary"}}),jsx(InputBase,{fullWidth:true,value:e,onChange:c=>t(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),o());},placeholder:n,sx:{fontSize:d?"0.84rem":"0.9rem"}}),e&&r&&jsx(IconButton,{size:"small",onClick:r,children:jsx(Vh,{sx:{fontSize:d?16:18}})}),a&&jsx(IconButton,{size:"small",onClick:a,children:jsx(qh,{sx:{fontSize:d?16:18}})}),jsx(IconButton,{size:"small",onClick:o,disabled:l||!e.trim(),children:jsx(Zh,{sx:{fontSize:d?16:18}})})]}),s&&i&&jsx(Typography,{variant:"caption",color:"text.secondary",children:i})]});var Xp=(e,t)=>{let o=t.trim();if(!o)return e;let a=e.toLowerCase(),r=o.toLowerCase(),n=a.indexOf(r);return n<0?e:jsxs(Fragment,{children:[e.slice(0,n),jsx(Box,{component:"mark",sx:{bgcolor:"warning.light",color:"warning.contrastText",px:.15,borderRadius:.4},children:e.slice(n,n+o.length)}),e.slice(n+o.length)]})},ps=({section:e,highlightQuery:t=""})=>{let o=e.columns||2;return jsxs(Paper,{variant:"outlined",sx:{p:1.8,borderRadius:2},children:[jsx(Typography,{variant:"subtitle1",sx:{fontWeight:700,mb:1.4},children:e.title}),jsx(Box,{sx:{display:"grid",gap:1.15,gridTemplateColumns:{xs:"1fr",md:o===3?"repeat(3, minmax(0, 1fr))":o===1?"1fr":"repeat(2, minmax(0, 1fr))"}},children:e.fields.map(a=>{let r=typeof a.value=="string"||typeof a.value=="number"?String(a.value):null;return jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block"},children:Xp(a.label,t)}),jsx(Typography,{component:"div",variant:"body2",sx:{mt:.2,fontWeight:500,wordBreak:"break-word"},children:r?Xp(r,t):a.value})]},a.id)})})]})};var sc=e=>e==null?"":typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):"",ms=e=>e.trim().toLowerCase(),wx=(e,t)=>{let o=[];return e.forEach(a=>{a.fields.forEach(r=>{let n=r.searchableText||sc(r.value),i={source:"section",sourceId:a.id,sourceSectionId:a.id,sourceTitle:a.title,fieldId:r.id,fieldLabel:r.label,fieldValue:n};o.push({hit:i,text:ms(`${a.title} ${r.label} ${n}`)});});}),t.forEach(a=>{(a.fields||[]).forEach(r=>{let n=r.searchableText||sc(r.value),i={source:"tab",sourceId:a.id,sourceTitle:a.label,fieldId:r.id,fieldLabel:r.label,fieldValue:n};o.push({hit:i,text:ms(`${a.label} ${r.label} ${n}`)});}),(a.sections||[]).forEach(r=>{r.fields.forEach(n=>{let i=n.searchableText||sc(n.value),l={source:"tab",sourceId:a.id,sourceSectionId:r.id,sourceTitle:`${a.label} / ${r.title}`,fieldId:n.id,fieldLabel:n.label,fieldValue:i};o.push({hit:l,text:ms(`${a.label} ${r.title} ${n.label} ${i}`)});});});}),o},Qp=({sections:e,tabs:t=[],defaultTabId:o,ai:a})=>{let{t:r}=Z(),[n,i]=useState(""),[l,d]=useState(o||t[0]?.id),[s,c]=useState("idle"),[g,f]=useState([]),[u,h]=useState(""),[w,p]=useState(""),[v,m]=useState(false),y=useMemo(()=>wx(e,t),[e,t]);useEffect(()=>{if(t.length===0){d(void 0);return}t.some(A=>A.id===l)||d(o||t[0]?.id);},[t,l,o]);let x=useCallback(()=>{c("idle"),f([]),h(""),p("");},[]),k=useCallback(T=>{i(T),T.trim()||(c("idle"),f([]),h(""),p(""));},[]),F=useCallback(T=>{let A=ms(T);return A?y.filter(R=>R.text.includes(A)).map(R=>R.hit):[]},[y]),S=useCallback(async()=>{let T=n.trim();if(!T)return;m(true);let A=F(T);if(f(A),A.length>0){c("search"),p(""),h(r("detail.searchAi.matches",{count:A.length})),m(false);return}if(a?.enabled!==false&&a?.onSubmit){c("ai"),h(r("detail.searchAi.autoAiFallback"));try{let C=await a.onSubmit(T,{query:T,hits:A,activeTabId:l,sections:e,tabs:t});p(typeof C=="string"?C:"");}finally{m(false);}return}c("search"),p(""),h(r("detail.searchAi.noMatch")),m(false);},[n,F,r,a,l,e,t]);return {query:n,setQuery:k,activeTabId:l,setActiveTabId:d,searchMode:s,hits:g,statusText:u,aiResponse:w,searching:v,handleSubmit:S,clearResult:x}};var lA=({title:e,subtitle:t,sections:o,tabs:a=[],defaultTabId:r,table:n,ai:i,rightHeaderSlot:l,searchBarWidth:d=460,onClose:s,closeLabel:c="Close"})=>{let{t:g}=Z(),{query:f,setQuery:u,activeTabId:h,setActiveTabId:w,searchMode:p,hits:v,statusText:m,aiResponse:y,searching:x,handleSubmit:k,clearResult:F}=Qp({sections:o,tabs:a,defaultTabId:r,ai:i}),S=useMemo(()=>a.find(R=>R.id===h)||a[0],[a,h]),T=useCallback(R=>{let C=D=>{let I=document.getElementById(R);if(I){I.scrollIntoView({behavior:"smooth",block:"center"});return}D<4&&setTimeout(()=>C(D+1),60);};requestAnimationFrame(()=>C(0));},[]),A=useCallback((R,C)=>{if(a.some(D=>D.id===R)){w(R),T(C?`detail-tab-${R}-section-${C}`:`detail-tab-${R}`);return}T(`detail-section-${R}`);},[a,w,T]);return jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.5,minHeight:"100%"},children:[jsxs(Stack,{direction:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",md:"center"},spacing:1,children:[jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{variant:"h5",sx:{fontWeight:800,color:"text.primary"},children:e}),t&&jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mt:.35},children:t})]}),jsxs(Stack,{direction:"row",spacing:.6,alignItems:"center",sx:{width:{xs:"100%",md:"auto"},ml:{xs:0,md:"auto"}},children:[jsx(Box,{sx:{width:{xs:"100%",md:d},maxWidth:"100%",minWidth:{md:320}},children:jsx(jp,{value:f,onChange:u,onSubmit:k,onVoiceInput:i?.onVoiceInput,onClear:()=>{u(""),F();},placeholder:i?.placeholder||g("detail.searchAi.placeholder"),statusText:m,loading:x,compact:true,showStatusText:false})}),s&&jsx(Tooltip,{title:c,children:jsx(IconButton,{size:"small",onClick:s,children:jsx(Mx,{fontSize:"small"})})}),l]})]}),m&&jsx(Typography,{variant:"caption",color:"text.secondary",sx:{mt:-0.7},children:m}),p==="search"&&v.length>0&&jsxs(Paper,{variant:"outlined",sx:{p:1.5,borderRadius:2},children:[jsx(Typography,{variant:"caption",color:"text.secondary",sx:{display:"block",mb:.6},children:g("detail.searchAi.matches",{count:v.length})}),jsx(Stack,{spacing:.35,children:v.slice(0,8).map(R=>jsx(Box,{component:"button",type:"button",onClick:()=>A(R.sourceId,R.sourceSectionId),sx:{textAlign:"left",border:0,bgcolor:"transparent",p:.2,cursor:"pointer",color:"text.primary",borderRadius:1,"&:hover":{bgcolor:"action.hover"}},children:jsxs(Typography,{variant:"body2",sx:{fontSize:"0.84rem"},children:[jsx(Box,{component:"span",sx:{color:"text.secondary"},children:R.sourceTitle})," \xB7 ",jsx(Box,{component:"span",sx:{fontWeight:700},children:R.fieldLabel})," = ",jsx(Box,{component:"span",children:R.fieldValue||"-"})]})},`${R.source}|${R.sourceId}|${R.fieldId}`))})]}),p==="ai"&&y&&jsxs(Paper,{variant:"outlined",sx:{p:1.5,borderRadius:2},children:[jsx(Typography,{variant:"subtitle2",sx:{fontWeight:700,mb:.7},children:g("detail.searchAi.aiResultTitle")}),jsx(Box,{sx:{fontSize:"0.9rem",lineHeight:1.6,"& p":{m:0,mb:.8},"& h1, & h2, & h3, & h4":{mt:1.2,mb:.6,lineHeight:1.3},"& ul, & ol":{mt:.4,mb:.8,pl:2.6},"& code":{px:.5,py:.1,borderRadius:.8,bgcolor:"action.hover",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},"& pre":{m:0,mt:.8,mb:.8,p:1.1,borderRadius:1.2,bgcolor:"action.hover",overflowX:"auto"},"& pre code":{p:0,bgcolor:"transparent"}},children:jsx(Zn,{markdown:y})})]}),jsx(Box,{sx:{display:"grid",gap:1.5,gridTemplateColumns:{xs:"1fr",lg:"repeat(2, minmax(0, 1fr))"}},children:o.map(R=>jsx(Box,{id:`detail-section-${R.id}`,children:jsx(ps,{section:R,highlightQuery:f})},R.id))}),a.length>0&&jsxs(Paper,{variant:"outlined",sx:{borderRadius:2,overflow:"hidden"},children:[jsx(Tabs,{value:S?.id||false,onChange:(R,C)=>w(C),variant:"scrollable",scrollButtons:"auto",sx:{borderBottom:"1px solid",borderColor:"divider"},children:a.map(R=>jsx(Tab,{value:R.id,label:R.label,sx:{textTransform:"none"}},R.id))}),jsxs(Box,{sx:{p:1.5},children:[jsx(Box,{id:`detail-tab-${S?.id||""}`}),S?.description&&jsx(Typography,{variant:"body2",color:"text.secondary",sx:{mb:1.2},children:S.description}),S?.content?S.content:jsxs(Stack,{spacing:1.5,children:[(S?.sections||[]).map(R=>jsx(Box,{id:`detail-tab-${S?.id}-section-${R.id}`,children:jsx(ps,{section:R,highlightQuery:f})},R.id)),S?.fields&&S.fields.length>0&&jsx(ps,{section:{id:`${S.id}-fields`,title:S.label,fields:S.fields,columns:2},highlightQuery:f})]})]})]}),n&&jsx(Fa,{title:n.title||g("detail.table.title"),...n.tableProps,filterConfig:void 0,fitContainer:false})]})};var tu=({bucket:e,cardCount:t,highlighted:o=false,children:a,emptyLabel:r,maxHeight:n,sx:i})=>{let{t:l}=Z();return jsx(Paper,{sx:[d=>{let s=e.accentColor??d.palette.primary.main;return {position:"relative",minWidth:0,borderRadius:4,overflow:"hidden",border:`1px solid ${alpha(s,o?.58:d.palette.mode==="dark"?.28:.18)}`,bgcolor:alpha(d.palette.background.paper,d.palette.mode==="dark"?.92:.97),boxShadow:o?`0 18px 40px ${alpha(s,.22)}`:`0 10px 28px ${alpha(d.palette.common.black,d.palette.mode==="dark"?.18:.08)}`,transition:"border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease","&::before":{content:'""',display:"block",height:4,bgcolor:s}}},...Array.isArray(i)?i:i?[i]:[]],children:jsxs(Stack,{spacing:1.2,sx:{p:1.5},children:[jsxs(Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{minWidth:0},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[e.icon,jsx(Typography,{sx:{fontSize:"0.96rem",fontWeight:800},children:e.title})]}),e.description&&jsx(Typography,{sx:{mt:.45,fontSize:"0.76rem",color:"text.secondary",lineHeight:1.45},children:e.description})]}),jsxs(Stack,{direction:"row",spacing:.8,sx:{flexShrink:0},children:[jsx(Chip,{size:"small",label:t,sx:{fontWeight:700}}),typeof e.limit=="number"&&jsx(Chip,{size:"small",label:`${l("kanban.bucket.limit")} ${e.limit}`,color:t>e.limit?"warning":"default",variant:"outlined"})]})]}),o&&jsx(Typography,{sx:{fontSize:"0.72rem",color:"primary.main",fontWeight:700},children:l("kanban.bucket.dropHere")}),jsx(Box,{sx:{minHeight:220,maxHeight:n,overflowY:n?"auto":"visible",pr:n?.4:0},children:t>0?a:jsx(Box,{sx:d=>({minHeight:160,borderRadius:3,border:`1px dashed ${alpha(d.palette.divider,.9)}`,bgcolor:d.palette.mode==="dark"?alpha(d.palette.common.white,.02):alpha(d.palette.primary.main,.03),display:"grid",placeItems:"center",px:2,textAlign:"center"}),children:jsx(Typography,{sx:{fontSize:"0.78rem",color:"text.secondary"},children:r??e.emptyLabel??l("kanban.empty")})})})]})})};var Lx={success:"success",warning:"warning",info:"info",error:"error"},zx={critical:"error",high:"warning",medium:"info",low:"success"},Nx=(e,t)=>{switch(e){case "critical":return t("kanban.priority.critical");case "high":return t("kanban.priority.high");case "medium":return t("kanban.priority.medium");case "low":return t("kanban.priority.low");default:return e}},Vx=e=>e?e.split(/\s+/).map(t=>t.charAt(0).toUpperCase()).slice(0,2).join(""):"NA",cc=({card:e,bucket:t,dragging:o=false,overlay:a=false,onClick:r,sx:n})=>{let{t:i}=Z(),l=!!(r&&t),d=e.tone??(e.priority?zx[e.priority]:"default"),s=d==="default"?"primary":Lx[d],c=t?{card:e,bucket:t}:void 0;return jsx(Paper,{onClick:l?()=>c&&r?.(c):void 0,onKeyDown:l?g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),c&&r?.(c));}:void 0,role:l?"button":void 0,tabIndex:l?0:void 0,sx:[g=>{let f=d==="default"?g.palette.primary.main:g.palette[s].main;return {position:"relative",overflow:"hidden",p:1.4,borderRadius:3,border:`1px solid ${alpha(f,g.palette.mode==="dark"?.42:.2)}`,bgcolor:alpha(g.palette.background.paper,g.palette.mode==="dark"?.96:.98),boxShadow:a?`0 20px 45px ${alpha(g.palette.common.black,.24)}`:o?"none":`0 8px 24px ${alpha(g.palette.common.black,g.palette.mode==="dark"?.18:.08)}`,transform:a?"rotate(1deg) scale(1.01)":"none",transition:"transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease",cursor:l?"pointer":"default",opacity:o?.5:1,"&::before":{content:'""',position:"absolute",inset:"0 auto 0 0",width:4,bgcolor:f},"&:hover":l?{transform:"translateY(-1px)",boxShadow:`0 14px 32px ${alpha(g.palette.common.black,g.palette.mode==="dark"?.28:.12)}`}:void 0}},...Array.isArray(n)?n:n?[n]:[]],children:jsxs(Stack,{spacing:1.1,children:[jsxs(Box,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{minWidth:0,flex:1},children:[(e.kicker||t?.title)&&jsx(Typography,{sx:{fontSize:"0.72rem",fontWeight:700,letterSpacing:.4,color:"text.secondary",textTransform:"uppercase"},children:e.kicker??t?.title}),jsx(Typography,{sx:{mt:.2,fontSize:"0.98rem",fontWeight:800,lineHeight:1.3},children:e.title})]}),e.priority&&jsx(Chip,{size:"small",color:s,label:Nx(e.priority,i),variant:d==="default"?"outlined":"filled",sx:{height:22,fontWeight:700}})]}),e.summary&&jsx(Typography,{sx:{fontSize:"0.82rem",color:"text.secondary",lineHeight:1.5},children:e.summary}),e.metrics&&e.metrics.length>0&&jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${Math.min(e.metrics.length,3)}, minmax(0, 1fr))`,gap:.9},children:e.metrics.slice(0,3).map(g=>jsxs(Box,{sx:f=>({borderRadius:2,px:1,py:.8,bgcolor:f.palette.mode==="dark"?alpha(f.palette.common.white,.05):alpha(f.palette.primary.main,.05)}),children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",textTransform:"uppercase",letterSpacing:.35},children:g.label}),jsx(Typography,{sx:{fontSize:"0.86rem",fontWeight:700},children:g.value})]},g.id))}),typeof e.progress=="number"&&jsxs(Box,{children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.5},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:i("kanban.card.progress")}),jsxs(Typography,{sx:{fontSize:"0.72rem",fontWeight:700},children:[Math.round(e.progress),"%"]})]}),jsx(LinearProgress,{variant:"determinate",value:Math.max(0,Math.min(100,e.progress)),color:s,sx:{height:8,borderRadius:999}})]}),(e.tags?.length||e.assignee||e.dueDate||e.footer||l)&&jsxs(Stack,{spacing:.9,children:[e.tags&&e.tags.length>0&&jsx(Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:e.tags.map(g=>jsx(Chip,{size:"small",label:g.label,color:g.color??"default",variant:"outlined"},g.id))}),jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8,minWidth:0},children:[e.assignee&&jsxs(Fragment,{children:[jsx(Avatar,{src:e.assignee.avatarSrc,sx:{width:28,height:28,fontSize:"0.75rem"},children:e.assignee.initials??Vx(e.assignee.name)}),jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.78rem",fontWeight:700,lineHeight:1.2},noWrap:true,children:e.assignee.name}),e.dueDate&&jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary",lineHeight:1.2},noWrap:true,children:e.dueDate})]})]}),!e.assignee&&e.dueDate&&jsx(Typography,{sx:{fontSize:"0.76rem",color:"text.secondary"},children:e.dueDate})]}),l&&jsx(Typography,{sx:{fontSize:"0.72rem",color:"primary.main",fontWeight:700,whiteSpace:"nowrap"},children:i("kanban.card.openDetail")})]}),e.footer]})]})})};var Wx=(e,t)=>Number.isNaN(e)||e<0?0:e>t?t:e,ru=({buckets:e,cards:t})=>{let o=new Map;return t.forEach((a,r)=>{let n=o.get(a.bucketId)??[];n.push({card:a,sourceIndex:r}),o.set(a.bucketId,n);}),{buckets:e.map(a=>{let r=[...o.get(a.id)??[]].sort((n,i)=>n.card.position===void 0&&i.card.position===void 0?n.sourceIndex-i.sourceIndex:n.card.position===void 0?1:i.card.position===void 0?-1:n.card.position-i.card.position||n.sourceIndex-i.sourceIndex).map(({card:n},i)=>({...n,bucketId:a.id,position:i}));return {...a,cards:r}})}},zo=(e,t)=>{for(let o=0;o<e.buckets.length;o+=1){let a=e.buckets[o],r=a.cards.findIndex(n=>n.id===t);if(r>=0)return {card:a.cards[r],bucket:a,bucketIndex:o,cardIndex:r}}},hs=(e,t)=>{let o=zo(e,t.cardId);if(!o)return e;let a=e.buckets.findIndex(s=>s.id===t.toBucketId);if(a<0)return e;let r=e.buckets.map(s=>({...s,cards:s.cards.map(c=>({...c}))})),n=r[o.bucketIndex],[i]=n.cards.splice(o.cardIndex,1);if(!i)return e;let l=r[a],d=Wx(t.targetIndex??l.cards.length,l.cards.length);return l.cards.splice(d,0,{...i,bucketId:t.toBucketId}),{buckets:r.map(s=>({...s,cards:s.cards.map((c,g)=>({...c,bucketId:s.id,position:g}))}))}};var dc="kanban-card|",pc="kanban-bucket|",lu=e=>`${dc}${e}`,Jx=e=>`${pc}${e}`,ys=e=>e?.startsWith(dc)?e.slice(dc.length):void 0,su=e=>e?.startsWith(pc)?e.slice(pc.length):void 0,e0=({card:e,bucket:t,onCardClick:o})=>{let{setNodeRef:a,attributes:r,listeners:n,transform:i,transition:l,isDragging:d}=useSortable({id:lu(e.id)}),s={transform:i?`translate3d(${i.x}px, ${i.y}px, 0)`:void 0,transition:l,zIndex:d?2:1,touchAction:"none",cursor:d?"grabbing":"grab"};return jsx(Box,{ref:a,style:s,...r,...n,children:jsx(cc,{card:e,bucket:t,dragging:d,onClick:o})})},t0=({bucket:e,highlighted:t,bucketMaxHeight:o,emptyBucketLabel:a,onCardClick:r})=>{let{isOver:n,setNodeRef:i}=useDroppable({id:Jx(e.id)});return jsx(Box,{ref:i,sx:{minWidth:0},children:jsx(tu,{bucket:e,cardCount:e.cards.length,highlighted:t||n,emptyLabel:a,maxHeight:o,children:jsx(SortableContext,{items:e.cards.map(l=>lu(l.id)),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:1,children:e.cards.map(l=>jsx(e0,{card:l,bucket:e,onCardClick:r},l.id))})})})})},DA=({model:e,onCardMove:t,onCardClick:o,minBucketWidth:a=320,bucketMaxHeight:r,emptyBucketLabel:n,sx:i})=>{let[l,d]=useState(null),[s,c]=useState(),g=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:6}}),useSensor(TouchSensor,{activationConstraint:{delay:120,tolerance:8}})),f=useMemo(()=>l?zo(e,l):void 0,[l,e]),u=useCallback(()=>{d(null),c(void 0);},[]),h=useCallback(m=>{if(!m)return;let y=ys(m);return y?zo(e,y)?.bucket.id:su(m)},[e]),w=useCallback(m=>{d(ys(String(m.active.id))??null);},[]),p=useCallback(m=>{c(h(m.over?String(m.over.id):void 0));},[h]),v=useCallback(m=>{let y=ys(String(m.active.id)),x=m.over?String(m.over.id):void 0;if(!y||!x){u();return}let k=zo(e,y);if(!k){u();return}let F=k.bucket.id,S=k.cardIndex,T=ys(x);if(T){let C=zo(e,T);if(!C){u();return}F=C.bucket.id,S=C.cardIndex;}else {let C=su(x),D=e.buckets.find(I=>I.id===C);if(!C||!D){u();return}F=C,S=D.cards.length;}if(k.bucket.id===F&&k.cardIndex===S){u();return}let A=hs(e,{cardId:y,fromBucketId:k.bucket.id,toBucketId:F,targetIndex:S}),R=zo(A,y);R&&!(R.bucket.id===k.bucket.id&&R.cardIndex===k.cardIndex)&&t?.({cardId:y,fromBucketId:k.bucket.id,toBucketId:R.bucket.id,targetIndex:R.cardIndex,card:R.card,model:A}),u();},[e,t,u]);return jsxs(DndContext,{sensors:g,collisionDetection:closestCorners,onDragStart:w,onDragOver:p,onDragEnd:v,onDragCancel:u,children:[jsx(Box,{sx:[{display:"grid",gridAutoFlow:"column",gridAutoColumns:`minmax(${a}px, 1fr)`,gap:2,alignItems:"start",overflowX:"auto",pb:.5},...Array.isArray(i)?i:i?[i]:[]],children:e.buckets.map(m=>jsx(t0,{bucket:m,highlighted:m.id===s,bucketMaxHeight:r,emptyBucketLabel:n,onCardClick:o},m.id))}),jsx(DragOverlay,{children:f?jsx(Box,{sx:{width:Math.max(a-24,260)},children:jsx(cc,{card:f.card,bucket:f.bucket,overlay:true})}):null})]})};var n0=({initialModel:e,initialBuckets:t,initialCards:o})=>e||ru({buckets:t??[],cards:o??[]}),EA=e=>{let{onCardMove:t,onCardClick:o}=e,[a,r]=useState(()=>n0(e)),n=useCallback(c=>{r(g=>typeof c=="function"?c(g):c);},[]),i=useCallback(c=>zo(a,c),[a]),l=useCallback((c,g,f)=>{let u=zo(a,c);if(!u)return;let h=hs(a,{cardId:c,fromBucketId:u.bucket.id,toBucketId:g,targetIndex:f}),w=zo(h,c);if(!w||w.bucket.id===u.bucket.id&&w.cardIndex===u.cardIndex)return;r(h);let p={cardId:c,fromBucketId:u.bucket.id,toBucketId:w.bucket.id,targetIndex:w.cardIndex,card:w.card,model:h};return t?.(p),p},[a,t]),d=useCallback((c,g)=>{r(f=>({buckets:f.buckets.map(u=>({...u,cards:u.cards.map(h=>h.id!==c?h:typeof g=="function"?g(h):{...h,...g})}))}));},[]),s=useMemo(()=>({model:a,onCardMove:c=>{l(c.cardId,c.toBucketId,c.targetIndex);},onCardClick:o}),[a,l,o]);return {model:a,actions:{replaceModel:n,moveCard:l,updateCard:d,getCard:i},boardProps:s}};var uu=64,v0="#E9EDF2",C0="linear-gradient(90deg, #F5F7FA 0%, #E9EDF2 50%, #F5F7FA 100%)",k0=["en","zh","fr","de","ja","ko"],mu={en:"EN",zh:"\u4E2D\u6587",fr:"FR",de:"DE",ja:"\u65E5\u672C\u8A9E",ko:"\uD55C\uAD6D\uC5B4"},Cs=({appTitle:e,logo:t,mode:o="dark",onToggleMode:a,locale:r,localeLabel:n,localeOptions:i,onLocaleChange:l,searchPlaceholder:d,onSearch:s,user:c,onUserSetting:g,onUserLogout:f,userMenuItems:u,leftSlot:h,rightSlot:w})=>{let{t:p,locale:v}=Z(),y=useTheme().palette.mode==="dark",[x,k]=useState(""),[F,S]=useState(null),[T,A]=useState(null),R=Q=>{Q.preventDefault(),s&&s(x.trim());},C=o==="system"?jsx(f0,{fontSize:"small"}):o==="dark"?jsx(h0,{fontSize:"small"}):jsx(y0,{fontSize:"small"}),D=p(o==="system"?"header.theme.system":o==="dark"?"header.theme.dark":"header.theme.light"),I=r||v,P=i&&i.length>0?i:k0,M=n||mu[I]||I.toUpperCase(),$=!!F,N=d||p("header.searchPlaceholder"),X=!!T,oe=[{key:"setting",label:p("header.menu.setting"),icon:jsx(Uy,{sx:{fontSize:18}}),onClick:g},{key:"logout",label:p("header.menu.logout"),icon:jsx(x0,{sx:{fontSize:18}}),onClick:f}],te=u&&u.length>0?u:oe,re=Q=>{A(null),Q?.();};return jsxs(AppBar,{position:"sticky",elevation:0,sx:Q=>({top:0,zIndex:Q.zIndex.drawer+10,height:uu,backgroundColor:Q.palette.mode==="dark"?"#0D0D0D":v0,backgroundImage:Q.palette.mode==="dark"?["radial-gradient(circle at 18% 22%, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 45%)","radial-gradient(circle at 78% 32%, rgba(144,202,249,0.14) 0%, rgba(144,202,249,0) 42%)","linear-gradient(90deg, #0A0A0A 0%, #151515 50%, #0A0A0A 100%)","linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px)","linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px)"].join(","):["radial-gradient(circle at 22% 22%, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 48%)","radial-gradient(circle at 76% 24%, rgba(203,213,225,0.45) 0%, rgba(203,213,225,0) 42%)",C0,"linear-gradient(rgba(15,23,42,0.05) 1px, transparent 1px)","linear-gradient(90deg, rgba(15,23,42,0.04) 1px, transparent 1px)"].join(","),backgroundSize:"auto, auto, auto, 24px 24px, 24px 24px",borderBottom:"1px solid",borderColor:Q.palette.mode==="dark"?"rgba(255,255,255,0.12)":"rgba(15,23,42,0.12)"}),children:[jsxs(Toolbar,{sx:{minHeight:`${uu}px !important`,px:2,gap:2},children:[jsxs(Stack,{direction:"row",alignItems:"center",spacing:1.5,sx:{minWidth:220},children:[h,t===null?null:t||jsx(Box,{component:"img",src:"/orbcafe.png",alt:"ORBCAFE Logo",sx:{width:44,height:44,display:"block",objectFit:"contain",flexShrink:0}}),e&&jsx(Typography,{variant:"h6",sx:{fontWeight:700,color:y?"common.white":"#111827"},children:e})]}),jsx(Box,{sx:{flex:1,display:"flex",justifyContent:"center",minWidth:0},children:jsx(Box,{component:"form",onSubmit:R,sx:{width:"100%",maxWidth:540},children:jsx(TextField,{size:"small",fullWidth:true,value:x,onChange:Q=>k(Q.target.value),placeholder:N,InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(gp,{sx:{color:y?"rgba(255,255,255,0.7)":"rgba(15,23,42,0.55)",fontSize:18}})}),sx:{color:y?"common.white":"rgba(17,24,39,0.9)",bgcolor:y?"rgba(255,255,255,0.08)":"#ffffff",borderRadius:999,"& .MuiOutlinedInput-notchedOutline":{borderColor:y?"rgba(255,255,255,0.15)":"rgba(15,23,42,0.2)"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:y?"rgba(255,255,255,0.35)":"rgba(15,23,42,0.35)"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:y?"rgba(255,255,255,0.5)":"rgba(15,23,42,0.55)"}}},inputProps:{style:{color:y?"white":"#111827"}}})})}),jsxs(Stack,{direction:"row",alignItems:"center",spacing:1.5,children:[l?jsxs(Fragment,{children:[jsx(IconButton,{size:"small",onClick:Q=>S(Q.currentTarget),sx:{color:y?"common.white":"#111827",borderRadius:1,px:.5},children:jsxs(Stack,{direction:"row",alignItems:"center",spacing:.45,children:[jsx(pu,{sx:{fontSize:18}}),jsx(Typography,{variant:"caption",sx:{fontWeight:500},children:M})]})}),jsx(Menu,{anchorEl:F,open:$,onClose:()=>S(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:P.map(Q=>jsx(MenuItem,{selected:Q===I,onClick:()=>{l(Q),S(null);},sx:{fontSize:"0.82rem"},children:mu[Q]},Q))})]}):jsxs(Stack,{direction:"row",alignItems:"center",spacing:.5,children:[jsx(pu,{sx:{color:y?"common.white":"#111827",fontSize:18}}),jsx(Typography,{variant:"caption",sx:{color:y?"common.white":"#111827",fontWeight:500},children:M})]}),jsx(IconButton,{size:"small",sx:{color:y?"common.white":"#111827"},onClick:a,title:D,children:C}),c&&jsxs(Stack,{direction:"row",alignItems:"center",spacing:1,children:[jsxs(Box,{sx:{textAlign:"right",minWidth:0},children:[jsx(Typography,{variant:"body2",sx:{color:y?"common.white":"#111827",fontWeight:700,lineHeight:1.15},children:c.name}),c.subtitle&&jsx(Typography,{variant:"caption",sx:{display:"block",mt:.25,color:y?"rgba(255,255,255,0.72)":"rgba(17,24,39,0.62)",fontSize:"0.72rem",lineHeight:1.1,letterSpacing:"0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:220},title:c.subtitle,children:c.subtitle})]}),jsx(IconButton,{size:"small",onClick:Q=>A(Q.currentTarget),sx:{p:0},children:jsx(Avatar,{src:c.avatarSrc,imgProps:{style:{objectFit:"cover"}},sx:{width:34,height:34,bgcolor:"grey.100",color:"grey.700",fontSize:"0.85rem"},children:c.avatarText||c.name.slice(0,1).toUpperCase()})})]}),w]})]}),c&&jsx(Menu,{anchorEl:T,open:X,onClose:()=>A(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{minWidth:160,"& .MuiMenuItem-root":{minHeight:34,py:.5,px:1.25}}}},children:te.map(Q=>jsxs(MenuItem,{disabled:Q.disabled,onClick:()=>re(Q.onClick),children:[Q.icon&&jsx(ListItemIcon,{children:Q.icon}),jsx(ListItemText,{primary:Q.label,slotProps:{primary:{sx:{fontSize:"0.86rem",fontWeight:500}}}})]},Q.key))})]})};var gu=({menuData:e=[],initialNavigationCollapsed:t=false}={})=>{let{navigationIslandProps:o}=bd({initialCollapsed:t,content:e}),[a,r]=useState(900);useEffect(()=>{let i=()=>r(window.innerHeight);return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]);let n=useMemo(()=>Math.max(280,a-100),[a]);return {navigationIslandProps:o,navigationMaxHeight:n}};var r2=({appTitle:e,menuData:t=[],children:o,showNavigation:a=true,locale:r="en",localeLabel:n,localeOptions:i,onLocaleChange:l,user:d,onUserSetting:s,onUserLogout:c,userMenuItems:g,logo:f,onSearch:u,rightHeaderSlot:h,leftHeaderSlot:w,contentSx:p})=>{let v="orbcafe:page-layout-mode",[m,y]=useState("system"),[x,k]=useState("light"),[F,S]=useState(false),T=m==="system"?F?x:"light":m;useEffect(()=>{try{let P=window.localStorage.getItem(v);(P==="light"||P==="dark"||P==="system")&&y(P);}catch{}S(true);let D=window.matchMedia("(prefers-color-scheme: dark)"),I=()=>{k(D.matches?"dark":"light");};return I(),D.addEventListener("change",I),()=>D.removeEventListener("change",I)},[]),useEffect(()=>{if(F)try{window.localStorage.setItem(v,m);}catch{}},[F,m]),useEffect(()=>{T==="dark"?(document.documentElement.classList.add("dark"),document.documentElement.style.colorScheme="dark"):(document.documentElement.classList.remove("dark"),document.documentElement.style.colorScheme="light");},[T]);let A=useMemo(()=>createTheme({palette:{mode:T}}),[T]),{navigationIslandProps:R,navigationMaxHeight:C}=gu({menuData:t,initialNavigationCollapsed:false});return jsx(ThemeProvider,{theme:A,children:jsx(vi,{locale:r,children:jsxs(Box,{sx:D=>({minHeight:"100vh",display:"flex",flexDirection:"column",background:D.palette.mode==="dark"?"linear-gradient(180deg, #0A0A0A 0%, #141414 55%, #1A1A1A 100%)":D.palette.background.default}),children:[jsx(Cs,{appTitle:e,logo:f,mode:m,onToggleMode:()=>y(D=>D==="system"?"dark":D==="dark"?"light":"system"),locale:r,localeLabel:n,localeOptions:i,onLocaleChange:l,user:d,onUserSetting:s,onUserLogout:c,userMenuItems:g,onSearch:u,leftSlot:w,rightSlot:h}),jsxs(Box,{sx:{flex:1,minHeight:0,display:"flex"},children:[a&&jsx(Box,{sx:{p:1.5,display:"flex",alignItems:"flex-start",flexShrink:0},children:jsx(hd,{...R,maxHeight:C,colorMode:T})}),jsx(Box,{sx:{flex:1,minWidth:0,minHeight:0,overflow:"auto",p:1.5,...p},children:o})]})]})})})};var Ss="(blank)",hu="Result",yu="Grand Total",bu={sum:"Sum",count:"Count",avg:"Average",min:"Min",max:"Max"},xu=["sum","count","avg","min","max"];var vu=["palette","rows","columns","filters","values"];var Cu=e=>vu.includes(e),ku=e=>e==="rows"||e==="columns"||e==="filters",ws=e=>{let t=e.split("|");return t.length===2&&t[0]==="container"&&Cu(t[1])?{kind:"container",zone:t[1]}:t.length===3&&t[0]==="item"&&Cu(t[1])&&t[2]?{kind:"item",zone:t[1],key:t[2]}:null},ua=e=>e==null||e===""?Ss:e instanceof Date?e.toISOString().slice(0,10):String(e),hr=e=>JSON.stringify(e),Su=(e,t)=>{let o=e.join(""),a=t.join("");return o.localeCompare(a,void 0,{sensitivity:"base"})},M0=e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},tn=(e,t,o)=>{if(o==="count")return e.length;let a=e.map(r=>M0(r[t])).filter(r=>r!==null);return a.length===0?0:o==="sum"?a.reduce((r,n)=>r+n,0):o==="avg"?a.reduce((r,n)=>r+n,0)/a.length:o==="min"?Math.min(...a):Math.max(...a)},ht=(e,t)=>{if(!e||e.length===0)return [];let o=new Set,a=[];return e.forEach(r=>{!t.has(r)||o.has(r)||(o.add(r),a.push(r));}),a},ma=(e,t)=>e.length!==t.length?false:e.every((o,a)=>o===t[a]),wu=(e,t)=>{let o=Object.keys(e),a=Object.keys(t);return o.length!==a.length?false:o.every(r=>{let n=e[r]??[],i=t[r]??[];return ma(n,i)})},Ts=(e,t)=>e.length!==t.length?false:e.every((o,a)=>{let r=t[a];return o.tokenId===r.tokenId&&o.fieldId===r.fieldId&&o.aggregation===r.aggregation}),hc=e=>!e?.aggregations||e.aggregations.length===0?xu:e.aggregations,$t=(e,t)=>{let o=hc(t);return e&&o.includes(e)?e:t?.type==="number"&&o.includes("sum")?"sum":o.includes("count")?"count":o[0]},ti=(e,t,o)=>{let a=o.get(t.fieldId);return a?.formatValue?a.formatValue(e):t.aggregation==="count"?Math.round(e).toLocaleString():e.toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:2})};var Pu=({options:e,selectedValues:t,onChange:o,minWidth:a=96})=>{let{t:r}=Z(),[n,i]=useState(""),l=useMemo(()=>{let s=n.trim().toLowerCase();return s?e.filter(c=>c.toLowerCase().includes(s)):e},[e,n]),d=e.length>0&&t.length===e.length;return jsx(FormControl,{size:"small",sx:{minWidth:a},children:jsxs(Select,{multiple:true,value:t,onChange:s=>{let c=s.target.value,g=typeof c=="string"?c.split(","):c;o(g);},onClick:s=>s.stopPropagation(),onMouseDown:s=>s.stopPropagation(),renderValue:s=>{let c=s;return e.length===0?r("pivot.filter.na"):c.length===0?r("common.none"):c.length===e.length?r("common.all"):`${c.length}/${e.length}`},MenuProps:{PaperProps:{sx:{maxHeight:320,bgcolor:"background.paper"}}},sx:{fontSize:"0.72rem",height:26,"& .MuiSelect-select":{py:.35}},children:[jsx(ListSubheader,{disableSticky:true,sx:s=>({bgcolor:"background.paper",py:.8,lineHeight:"normal",borderBottom:`1px solid ${s.palette.divider}`}),children:jsx(TextField,{size:"small",placeholder:`${r("common.search")}...`,fullWidth:true,value:n,onChange:s=>i(s.target.value),onKeyDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),sx:{m:0,"& .MuiInputBase-input":{fontSize:"0.75rem",py:.7}}})}),jsx(Box,{sx:s=>({px:1.5,py:.5,borderBottom:`1px solid ${s.palette.divider}`,bgcolor:"background.paper"}),onMouseDown:s=>{s.preventDefault(),s.stopPropagation();},onClick:s=>{s.preventDefault(),s.stopPropagation();},children:jsx(Button,{variant:"text",size:"small",onClick:s=>{s.preventDefault(),s.stopPropagation(),o(d?[]:e);},sx:{minWidth:"auto",px:0,py:.2,fontSize:"0.76rem",fontWeight:700,textTransform:"none"},children:r(d?"pivot.filter.deselectAll":"pivot.filter.selectAll")})}),l.length===0&&jsx(MenuItem,{disabled:true,sx:{fontSize:"0.75rem"},children:r("pivot.filter.noResults")}),l.map(s=>{let c=t.includes(s);return jsxs(MenuItem,{value:s,sx:{fontSize:"0.75rem",py:.25},children:[jsx(Checkbox,{size:"small",checked:c,sx:{p:.5,mr:.5}}),jsx(ListItemText,{primary:s,primaryTypographyProps:{sx:{fontSize:"0.75rem",lineHeight:1.2}}})]},s)})]})})};var bc=({label:e,subtitle:t,isDragging:o,dragRef:a,listeners:r,attributes:n,style:i})=>jsx(Paper,{ref:a,...r,...n,sx:l=>({p:1,borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:l.palette.mode==="dark"?"#111111":"background.paper",touchAction:"none"}),style:{...i,opacity:o?.3:1,cursor:o?"grabbing":"grab"},children:jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[jsx(Box,{sx:l=>({display:"inline-flex",alignItems:"center",justifyContent:"center",p:.3,borderRadius:1,bgcolor:l.palette.mode==="dark"?"rgba(255,255,255,0.12)":"rgba(17, 24, 39, 0.08)"}),children:jsx(H0,{sx:{fontSize:16,color:"text.secondary"}})}),jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.82rem",fontWeight:700,lineHeight:1.2},children:e}),t&&jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary",lineHeight:1.2},children:t})]})]})}),Mu=({id:e,label:t,subtitle:o})=>{let{setNodeRef:a,listeners:r,attributes:n,isDragging:i}=useDraggable({id:e});return jsx(bc,{label:t,subtitle:o,isDragging:i,dragRef:a,listeners:r,attributes:n})};var rn=({zone:e,title:t,hint:o,icon:a,children:r,itemCount:n,onClear:i})=>{let l=`container|${e}`,{isOver:d,setNodeRef:s}=useDroppable({id:l}),{t:c}=Z();return jsxs(Paper,{ref:s,sx:g=>({p:1.1,borderRadius:3,border:"1px dashed",borderColor:d?"primary.main":g.palette.divider,bgcolor:d?g.palette.mode==="dark"?"rgba(25, 118, 210, 0.16)":"rgba(47, 91, 255, 0.06)":g.palette.mode==="dark"?"rgba(255,255,255,0.02)":"rgba(245, 248, 255, 0.86)",transition:"all 120ms ease",minHeight:120,display:"flex",flexDirection:"column"}),children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1},children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[a,jsx(Typography,{sx:{fontSize:"0.79rem",fontWeight:800,letterSpacing:.2},children:t}),jsxs(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:["(",n,")"]})]}),n>0&&i&&jsx(Tooltip,{title:c("pivot.clearArea"),children:jsx(IconButton,{size:"small",onClick:i,sx:{p:.25},children:jsx(_0,{sx:{fontSize:16}})})})]}),jsx(Typography,{sx:{mt:.5,mb:.9,fontSize:"0.7rem",color:"text.secondary"},children:o}),jsx(Box,{sx:{flex:1},children:r})]})};var Bu={xs:1.2,md:1.6},sn=({title:e,subtitle:t,collapsed:o,onToggleCollapse:a,expandAriaLabel:r,collapseAriaLabel:n,children:i,bodySx:l,unmountOnExit:d=false,headerActions:s})=>jsxs(Paper,{sx:c=>({borderRadius:3,border:`1px solid ${c.palette.divider}`,overflow:"hidden",bgcolor:alpha(c.palette.background.paper,.95)}),children:[jsxs(Box,{sx:c=>({px:Bu,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:1,borderBottom:o?"none":`1px solid ${c.palette.divider}`}),children:[jsxs(Box,{sx:{minWidth:0,flex:1},children:[jsx(Typography,{sx:{fontSize:"0.9rem",fontWeight:800},children:e}),jsx(Typography,{sx:{fontSize:"0.74rem",color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})]}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.75,flexShrink:0},children:[s,jsx(IconButton,{size:"small","aria-label":o?r:n,onClick:a,sx:c=>({border:`1px solid ${c.palette.divider}`,bgcolor:alpha(c.palette.background.paper,.88),width:28,height:28,borderRadius:999,flexShrink:0,"&:hover":{bgcolor:c.palette.mode==="dark"?alpha(c.palette.primary.main,.18):alpha(c.palette.primary.main,.08)}}),children:jsx(Ky,{sx:{fontSize:16,transition:"transform 220ms cubic-bezier(0.2, 0, 0, 1)",transform:o?"rotate(180deg)":"rotate(0deg)"}})})]})]}),jsx(Collapse,{in:!o,timeout:260,easing:"cubic-bezier(0.2, 0, 0, 1)",unmountOnExit:d,children:jsx(Box,{sx:[{px:Bu,py:{xs:1.2,md:1.6}},...Array.isArray(l)?l:l?[l]:[]],children:i})})]});var Ms=({label:e,caption:t,onRemove:o,trailing:a,isDragging:r,dragRef:n,listeners:i,attributes:l,style:d})=>jsx(Paper,{ref:n,style:d,sx:s=>({p:1,borderRadius:2,border:"1px solid",borderColor:"divider",bgcolor:s.palette.mode==="dark"?"#111111":"background.paper",touchAction:"none",opacity:r?0:1}),children:jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.8},children:[jsx(Box,{...l,...i,sx:s=>({display:"inline-flex",alignItems:"center",justifyContent:"center",p:.25,borderRadius:1,bgcolor:s.palette.mode==="dark"?"rgba(255,255,255,0.12)":"rgba(17, 24, 39, 0.08)",cursor:"grab"}),children:jsx(H0,{sx:{fontSize:15,color:"text.secondary"}})}),jsxs(Box,{sx:{minWidth:0,flex:1},children:[jsx(Typography,{sx:{fontSize:"0.8rem",fontWeight:700,lineHeight:1.2},children:e}),t&&jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary",lineHeight:1.2},children:t})]}),a,o&&jsx(IconButton,{size:"small",onClick:s=>{s.stopPropagation(),o();},sx:{p:.2},children:jsx(Vh,{sx:{fontSize:16}})})]})}),oi=({id:e,label:t,caption:o,onRemove:a,trailing:r})=>{let{setNodeRef:n,attributes:i,listeners:l,transform:d,transition:s,isDragging:c}=useSortable({id:e}),g={transform:d?`translate3d(${d.x}px, ${d.y}px, 0)`:void 0,transition:s,zIndex:c?999:"auto"};return jsx(Ms,{label:t,caption:o,onRemove:a,trailing:r,isDragging:c,dragRef:n,listeners:l,attributes:i,style:g})};var Fs={rows:jsx(sv,{fontSize:"small"}),columns:jsx(Sf,{fontSize:"small"}),filters:jsx(iv,{fontSize:"small"}),values:jsx(Pf,{fontSize:"small"})},Lu=({isConfiguratorCollapsed:e,onToggleCollapse:t,availableFields:o,fieldMap:a,filterFields:r,columnFields:n,rowFields:i,valueFields:l,clearZone:d,removeFieldFromZone:s,getFilterSelectionSummary:c,renderDimensionFilterSelect:g,renderAggregationSelect:f,getAggregationLabel:u})=>{let{t:h}=Z(),w=[`${h("pivot.zone.rows")} ${i.length}`,`${h("pivot.zone.columns")} ${n.length}`,`${h("pivot.zone.filters")} ${r.length}`,`${h("pivot.zone.values")} ${l.length}`].join(" \xB7 ");return jsx(sn,{title:h("pivot.config.title"),subtitle:w,collapsed:e,onToggleCollapse:t,expandAriaLabel:h("pivot.collapse.ariaExpand"),collapseAriaLabel:h("pivot.collapse.ariaCollapse"),unmountOnExit:true,children:jsxs(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",lg:"260px 1fr"},gap:2},children:[jsx(rn,{zone:"palette",title:h("pivot.fieldList"),hint:h("pivot.availableDimensions"),itemCount:o.length,icon:jsx(H0,{sx:{fontSize:16,color:"text.secondary"}}),children:jsxs(Stack,{spacing:.8,sx:{maxHeight:400,overflowY:"auto",pr:.5},children:[o.length===0&&jsx(Typography,{sx:{fontSize:"0.74rem",color:"text.secondary",py:1},children:h("pivot.allFieldsInUse")}),o.map(p=>jsx(Mu,{id:`item|palette|${p.id}`,label:p.label,subtitle:p.type??"string"},p.id))]})}),jsxs(Stack,{spacing:2,children:[jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2},children:[jsx(rn,{zone:"filters",title:h("pivot.zone.filters"),hint:h("pivot.hint.filters"),icon:Fs.filters,itemCount:r.length,onClear:()=>d("filters"),children:jsx(SortableContext,{items:r.map(p=>`item|filters|${p}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:r.map(p=>jsx(oi,{id:`item|filters|${p}`,label:a.get(p)?.label??p,caption:c(p),trailing:g(p),onRemove:()=>s("filters",p)},p))})})}),jsx(rn,{zone:"columns",title:h("pivot.zone.columns"),hint:h("pivot.hint.columns"),icon:Fs.columns,itemCount:n.length,onClear:()=>d("columns"),children:jsx(SortableContext,{items:n.map(p=>`item|columns|${p}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:n.map(p=>jsx(oi,{id:`item|columns|${p}`,label:a.get(p)?.label??p,caption:`${a.get(p)?.type??"dimension"} \u2022 ${c(p)}`,trailing:g(p),onRemove:()=>s("columns",p)},p))})})})]}),jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:2},children:[jsx(rn,{zone:"rows",title:h("pivot.zone.rows"),hint:h("pivot.hint.rows"),icon:Fs.rows,itemCount:i.length,onClear:()=>d("rows"),children:jsx(SortableContext,{items:i.map(p=>`item|rows|${p}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:i.map(p=>jsx(oi,{id:`item|rows|${p}`,label:a.get(p)?.label??p,caption:`${a.get(p)?.type??"dimension"} \u2022 ${c(p)}`,trailing:g(p),onRemove:()=>s("rows",p)},p))})})}),jsx(rn,{zone:"values",title:h("pivot.zone.values"),hint:h("pivot.hint.values"),icon:Fs.values,itemCount:l.length,onClear:()=>d("values"),children:jsx(SortableContext,{items:l.map(p=>`item|values|${p.tokenId}`),strategy:verticalListSortingStrategy,children:jsx(Stack,{spacing:.7,children:l.map(p=>{let v=a.get(p.fieldId)?.label??p.fieldId,m=`${u(p.aggregation)}(${v})`;return jsx(oi,{id:`item|values|${p.tokenId}`,label:v,caption:m,trailing:f(p),onRemove:()=>s("values",p.tokenId)},p.tokenId)})})})})]})]})]})})};var zu=e=>e.toLocaleString(void 0,{maximumFractionDigits:1}),Nu=({data:e,primaryLabel:t,secondaryLabel:o,formatPrimaryValue:a,formatSecondaryValue:r})=>{let n=useTheme$1();if(e.length===0)return null;let i=720,l=250,d={top:20,right:24,bottom:40,left:52},s=o?e.map(p=>p.primaryValue):e.map((p,v)=>v+1),c=o?e.map(p=>p.secondaryValue??0):e.map(p=>p.primaryValue),g=Math.max(...s,1),f=Math.max(...c,1),u=i-d.left-d.right,h=l-d.top-d.bottom,w=e.map((p,v)=>{let m=o?p.primaryValue:v+1,y=o?p.secondaryValue??0:p.primaryValue,x=d.left+m/g*u,k=l-d.bottom-y/f*h;return {...p,x,y:k,rawX:m,rawY:y}});return jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[jsx(Box,{sx:{overflowX:"auto"},children:jsxs(Box,{component:"svg",viewBox:`0 0 ${i} ${l}`,sx:{width:"100%",minWidth:i,height:l},children:[jsx("line",{x1:d.left,y1:l-d.bottom,x2:i-d.right,y2:l-d.bottom,stroke:alpha(n.palette.text.secondary,.35)}),jsx("line",{x1:d.left,y1:d.top,x2:d.left,y2:l-d.bottom,stroke:alpha(n.palette.text.secondary,.35)}),w.map(p=>jsxs("g",{children:[jsx("circle",{cx:p.x,cy:p.y,r:7,fill:alpha(n.palette.primary.main,.18)}),jsx("circle",{cx:p.x,cy:p.y,r:4.5,fill:n.palette.primary.main,children:jsxs("title",{children:[p.name,`
13
13
  `,o?`${t}: ${a(p.primaryValue)}`:`${t}: ${a(p.primaryValue)}`,o?`
14
- ${o}: ${(r??a)(p.secondaryValue??0)}`:""]})}),jsx("text",{x:p.x,y:Math.max(p.y-12,d.top+8),textAnchor:"middle",fontSize:"10",fill:n.palette.text.secondary,children:p.name})]},p.name)),jsx("text",{x:i/2,y:l-10,textAnchor:"middle",fontSize:"11",fill:n.palette.text.secondary,children:o?t:"Index"}),jsx("text",{x:16,y:l/2,textAnchor:"middle",transform:`rotate(-90 16 ${l/2})`,fontSize:"11",fill:n.palette.text.secondary,children:o??t}),jsx("text",{x:d.left,y:d.top-4,fontSize:"10",fill:n.palette.text.secondary,children:lu(f)}),jsx("text",{x:i-d.right,y:l-d.bottom+16,textAnchor:"end",fontSize:"10",fill:n.palette.text.secondary,children:lu(g)})]})}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:"repeat(3, minmax(0, 1fr))"},gap:1},children:e.map(p=>jsxs(Box,{sx:C=>({borderRadius:2,px:1.25,py:1,border:`1px solid ${alpha(C.palette.divider,.7)}`,bgcolor:alpha(C.palette.background.default,.35)}),children:[jsx(Typography,{sx:{fontSize:"0.78rem",fontWeight:700},noWrap:true,title:p.name,children:p.name}),jsxs(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:[t,": ",a(p.primaryValue)]}),o&&jsxs(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:[o,": ",(r??a)(p.secondaryValue??0)]})]},p.name))})]})};var oc=e=>Math.max(...e,1),pu=({data:e,chartType:t,primaryLabel:o,secondaryLabel:a,formatPrimaryValue:r,formatSecondaryValue:n})=>{let i=useTheme$1(),l=i.palette.primary.main,d=i.palette.warning.main;if(e.length===0)return null;if(t==="bar-horizontal"){let m=oc(e.flatMap(b=>[b.primaryValue,b.secondaryValue??0]));return jsx(Stack,{spacing:1.1,children:e.map(b=>jsxs(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"160px 1fr 128px"},gap:1.25,alignItems:"center"},children:[jsx(Typography,{sx:{fontSize:"0.78rem",fontWeight:700},noWrap:true,title:b.name,children:b.name}),jsxs(Stack,{spacing:.65,children:[jsx(Box,{sx:{height:10,borderRadius:999,overflow:"hidden",bgcolor:alpha(i.palette.action.active,.08)},children:jsx(Box,{sx:{width:`${b.primaryValue/m*100}%`,height:"100%",bgcolor:l}})}),a&&jsx(Box,{sx:{height:8,borderRadius:999,overflow:"hidden",bgcolor:alpha(i.palette.action.active,.08)},children:jsx(Box,{sx:{width:`${(b.secondaryValue??0)/m*100}%`,height:"100%",bgcolor:d}})})]}),jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.72rem",textAlign:{xs:"left",md:"right"},fontWeight:700},children:r(b.primaryValue)}),a&&jsx(Typography,{sx:{fontSize:"0.72rem",textAlign:{xs:"left",md:"right"},color:"text.secondary"},children:(n??r)(b.secondaryValue??0)})]})]},b.name))})}if(t==="bar-vertical"){let m=oc(e.flatMap(x=>[x.primaryValue,x.secondaryValue??0])),b=a?92:76;return jsx(Box,{sx:{overflowX:"auto",pb:.5},children:jsx(Box,{sx:{minWidth:Math.max(620,e.length*b),display:"grid",gridTemplateColumns:`repeat(${e.length}, minmax(56px, 1fr))`,gap:1,alignItems:"end"},children:e.map(x=>jsxs(Box,{sx:{minWidth:0},children:[jsxs(Box,{sx:{height:210,display:"flex",alignItems:"flex-end",justifyContent:"center",gap:.8},children:[jsx(Box,{sx:{width:a?16:26,minHeight:8,height:`${Math.max(x.primaryValue/m*188,8)}px`,borderRadius:"10px 10px 2px 2px",bgcolor:l},title:`${o}: ${r(x.primaryValue)}`}),a&&jsx(Box,{sx:{width:16,minHeight:8,height:`${Math.max((x.secondaryValue??0)/m*188,8)}px`,borderRadius:"10px 10px 2px 2px",bgcolor:d},title:`${a}: ${(n??r)(x.secondaryValue??0)}`})]}),jsx(Typography,{sx:{fontSize:"0.76rem",fontWeight:700},noWrap:true,title:x.name,children:x.name}),jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary"},noWrap:true,title:r(x.primaryValue),children:r(x.primaryValue)}),a&&jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary"},noWrap:true,title:(n??r)(x.secondaryValue??0),children:(n??r)(x.secondaryValue??0)})]},x.name))})})}let s=Math.max(680,e.length*74),c=240,g={top:20,right:18,bottom:36,left:18},f=oc(e.flatMap(m=>[m.primaryValue,m.secondaryValue??0])),u=s-g.left-g.right,y=c-g.top-g.bottom,I=m=>e.map((b,x)=>{let k=g.left+x*u/Math.max(e.length-1,1),E=c-g.bottom-m(b)/f*y;return {x:k,y:E,item:b}}),p=I(m=>m.primaryValue),C=a?I(m=>m.secondaryValue??0):[];return jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.1},children:[jsx(Box,{sx:{overflowX:"auto"},children:jsxs(Box,{component:"svg",viewBox:`0 0 ${s} ${c}`,sx:{width:"100%",minWidth:s,height:c},children:[jsx("line",{x1:g.left,y1:c-g.bottom,x2:s-g.right,y2:c-g.bottom,stroke:alpha(i.palette.text.secondary,.35)}),jsx("polyline",{fill:"none",stroke:l,strokeWidth:3,points:p.map(m=>`${m.x},${m.y}`).join(" ")}),p.map(m=>jsx("circle",{cx:m.x,cy:m.y,r:4,fill:l,children:jsxs("title",{children:[m.item.name,`
15
- `,o,": ",r(m.item.primaryValue)]})},`primary-${m.item.name}`)),a&&jsxs(Fragment,{children:[jsx("polyline",{fill:"none",stroke:d,strokeWidth:2.5,strokeDasharray:"5 5",points:C.map(m=>`${m.x},${m.y}`).join(" ")}),C.map(m=>jsx("circle",{cx:m.x,cy:m.y,r:3.5,fill:d,children:jsxs("title",{children:[m.item.name,`
16
- `,a,": ",(n??r)(m.item.secondaryValue??0)]})},`secondary-${m.item.name}`))]})]})}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",xl:"repeat(4, minmax(0, 1fr))"},gap:1},children:e.map(m=>jsxs(Box,{sx:b=>({borderRadius:2,px:1.1,py:.9,border:`1px solid ${alpha(b.palette.divider,.7)}`,bgcolor:alpha(b.palette.background.default,.35)}),children:[jsx(Typography,{sx:{fontSize:"0.76rem",fontWeight:700},noWrap:true,title:m.name,children:m.name}),jsx(Typography,{sx:{fontSize:"0.71rem",color:"text.secondary"},children:r(m.primaryValue)}),a&&jsx(Typography,{sx:{fontSize:"0.71rem",color:"text.secondary"},children:(n??r)(m.secondaryValue??0)})]},m.name))})]})};var uu=(e,t,o)=>{let a=new Set,r=[];return e.forEach(n=>{a.has(n)||(a.add(n),r.push({fieldId:n,label:o.get(n)?.label??n,zone:"rows"}));}),t.forEach(n=>{a.has(n)||(a.add(n),r.push({fieldId:n,label:o.get(n)?.label??n,zone:"columns"}));}),r},mu=(e,t,o)=>e.map(a=>{let r=t.get(a.fieldId),n=r?.label??a.fieldId;return {fieldId:a.fieldId,label:`${o(a.aggregation)} \xB7 ${n}`,item:a,field:r}}),gu=({rows:e,dimensionFieldId:t,primaryValue:o,secondaryValue:a})=>{if(!t)return [];let r=new Map;return e.forEach(n=>{let i=ra(n[t]),l=r.get(i);if(l){l.push(n);return}r.set(i,[n]);}),Array.from(r.entries()).sort((n,i)=>n[0].localeCompare(i[0],void 0,{sensitivity:"base"})).map(([n,i])=>({name:n,primaryValue:zr(i,o.fieldId,o.aggregation),secondaryValue:a?zr(i,a.fieldId,a.aggregation):void 0}))};var fu=({rows:e,fieldMap:t,rowFields:o,columnFields:a,valueFields:r,chartDimensionFieldId:n,chartPrimaryValueFieldId:i,chartSecondaryValueFieldId:l,chartType:d,isCollapsed:s,onChartDimensionFieldIdChange:c,onChartPrimaryValueFieldIdChange:g,onChartSecondaryValueFieldIdChange:f,onChartTypeChange:u,onToggleCollapse:y,getAggregationLabel:I})=>{let{t:p}=_(),C=useMemo(()=>uu(o,a,t),[a,t,o]),m=useMemo(()=>mu(r,t,I),[t,I,r]),b=m.find(v=>v.fieldId===i)??m[0],x=m.find(v=>v.fieldId===l&&v.fieldId!==b?.fieldId)??null,k=C.find(v=>v.fieldId===n)??C[0],E=k&&b?p("pivot.chart.subtitleReady",{dimension:k.label,measure:x?`${b.label} / ${x.label}`:b.label}):p("pivot.chart.subtitle"),R=useMemo(()=>!k||!b?[]:gu({rows:e,dimensionFieldId:k.fieldId,primaryValue:b.item,secondaryValue:x?.item}),[b,e,x,k]),w=v=>b?Ln(v,b.item,t):v.toLocaleString(),B=v=>x?Ln(v,x.item,t):v.toLocaleString(),T=C.length>1||m.length>1;return jsxs(Hr,{title:p("pivot.chart.title"),subtitle:E,collapsed:s,onToggleCollapse:y,expandAriaLabel:p("pivot.chart.collapse.ariaExpand"),collapseAriaLabel:p("pivot.chart.collapse.ariaCollapse"),bodySx:{display:"flex",flexDirection:"column",gap:1.1},children:[T&&jsxs(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",xl:"repeat(4, minmax(0, 1fr))"},gap:1,alignItems:"start"},children:[jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.dimension")}),jsx(Select,{value:k?.fieldId??"",onChange:v=>c(String(v.target.value)),sx:{fontSize:"0.75rem",height:32},children:C.map(v=>jsx(MenuItem,{value:v.fieldId,sx:{fontSize:"0.75rem"},children:v.label},v.fieldId))})]}),jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.primaryMeasure")}),jsx(Select,{value:b?.fieldId??"",onChange:v=>g(String(v.target.value)),sx:{fontSize:"0.75rem",height:32},children:m.map(v=>jsx(MenuItem,{value:v.fieldId,sx:{fontSize:"0.75rem"},children:v.label},v.fieldId))})]}),jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.secondaryMeasure")}),jsxs(Select,{value:x?.fieldId??"",onChange:v=>f(String(v.target.value)),sx:{fontSize:"0.75rem",height:32},children:[jsx(MenuItem,{value:"",sx:{fontSize:"0.75rem",color:"text.secondary"},children:p("common.none")}),m.filter(v=>v.fieldId!==b?.fieldId).map(v=>jsx(MenuItem,{value:v.fieldId,sx:{fontSize:"0.75rem"},children:v.label},v.fieldId))]})]}),jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.chartType")}),jsxs(Select,{value:d,onChange:v=>u(v.target.value),sx:{fontSize:"0.75rem",height:32},children:[jsx(MenuItem,{value:"bar-vertical",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.barVertical")}),jsx(MenuItem,{value:"bar-horizontal",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.barHorizontal")}),jsx(MenuItem,{value:"line",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.line")}),jsx(MenuItem,{value:"scatter",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.scatter")})]})]})]}),jsx(Box,{children:k?b?R.length===0?jsx(Box,{sx:{py:5,textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:p("pivot.chart.emptyNoData")})}):d==="scatter"?jsx(cu,{data:R,primaryLabel:b.label,secondaryLabel:x?.label,formatPrimaryValue:w,formatSecondaryValue:B}):jsx(pu,{data:R,chartType:d,primaryLabel:b.label,secondaryLabel:x?.label,formatPrimaryValue:w,formatSecondaryValue:B}):jsx(Box,{sx:{py:5,textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:p("pivot.chart.emptyNoValue")})}):jsx(Box,{sx:{py:5,textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:p("pivot.chart.emptyNoDimension")})})})]})};var hs=({node:e,dataColumns:t,fieldMap:o,level:a,expandedKeys:r,onToggle:n,getValue:i})=>{let l=r.has(e.key),d=e.children.length>0,s=e.isGrandTotal;return jsxs(Fragment,{children:[jsxs(TableRow,{sx:c=>({bgcolor:s?c.palette.mode==="dark"?"rgba(25, 118, 210, 0.22)":"rgba(47, 91, 255, 0.08)":c.palette.mode==="dark"?"#111111":"background.paper","&:hover":{bgcolor:s?c.palette.mode==="dark"?"rgba(25, 118, 210, 0.28)":"rgba(47, 91, 255, 0.12)":c.palette.mode==="dark"?"#181818":"rgba(0, 0, 0, 0.02)"}}),children:[jsxs(TableCell,{sx:c=>({fontSize:"0.76rem",fontWeight:s?800:600,borderBottom:`1px solid ${c.palette.divider}`,whiteSpace:"nowrap",pl:a*2+1,display:"flex",alignItems:"center",height:40}),children:[d&&!s&&jsx(IconButton,{size:"small",onClick:()=>n(e.key),sx:{p:.2,mr:.5,ml:-1},children:l?jsx(rf,{sx:{fontSize:16}}):jsx(Wg,{sx:{fontSize:16}})}),!d&&!s&&a>0&&jsx(Box,{sx:{width:20}}),e.value]}),t.map(c=>jsx(TableCell,{align:"right",sx:{fontSize:"0.76rem",fontWeight:s?800:500,borderBottom:g=>`1px solid ${g.palette.divider}`,whiteSpace:"nowrap"},children:Ln(i?i(e,c.id):e.aggregatedValues[c.id]??0,c.valueItem,o)},`${e.key}-${c.id}`))]}),l&&e.children.map(c=>jsx(hs,{node:c,dataColumns:t,fieldMap:o,level:a+1,expandedKeys:r,onToggle:n,getValue:i},c.key))]})};var sc=(e,t,o)=>{let a=[...e,...t];return o&&a.includes(o)?o:a[0]??""},xs=(e,t)=>t&&e.some(o=>o.fieldId===t)?t:e[0]?.fieldId??"",lc=(e,t,o)=>o===""?"":o&&o!==t&&e.some(a=>a.fieldId===o)?o:e.find(a=>a.fieldId!==t)?.fieldId??"",ku=e=>{let t=new Set,o=a=>{a.forEach(r=>{r.children.length>0&&(t.add(r.key),o(r.children));});};return o(e),t},wu=(e,t,o=0)=>e.length===0?o:e.reduce((a,r)=>r.children.length===0||!t.has(r.key)?Math.max(a,o+1):Math.max(a,wu(r.children,t,o+1)),o),Y0=(e,t)=>{let o=[],a=r=>{r.forEach(n=>{if(n.children.length>0&&t.has(n.key)){a(n.children);return}o.push(n);});};return a(e),o},i2=({title:e,rows:t,fields:o,initialLayout:a,initialChart:r,emptyText:n,maxPreviewHeight:i=520,initialChartCollapsed:l=false,initialTableCollapsed:d=false,model:s,enablePresetManagement:c=false,presets:g,defaultPresets:f,onPresetsChange:u,initialPresetId:y,onPresetApplied:I})=>{let{t:p}=_(),C=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}})),m=useRef(0),b=useRef(false),x=e??p("pivot.title.default"),k=n??p("pivot.empty"),E=useMemo(()=>({sum:p("pivot.agg.sum"),count:p("pivot.agg.count"),avg:p("pivot.agg.avg"),min:p("pivot.agg.min"),max:p("pivot.agg.max")}),[p]),R=useCallback(h=>E[h]??Up[h],[E]),w=useMemo(()=>new Set(o.map(h=>h.id)),[o]),B=useMemo(()=>new Map(o.map(h=>[h.id,h])),[o]),[T,v]=useState(()=>gt(a?.rows,w)),[D,S]=useState(()=>gt(a?.columns,w)),[P,F]=useState(()=>gt(a?.filters,w)),[W,z]=useState(()=>{let h=a?.values??[],M=new Set,A=[];return h.forEach($=>{if(!w.has($.fieldId)||M.has($.fieldId))return;M.add($.fieldId),m.current+=1;let X=B.get($.fieldId);A.push({tokenId:`v${m.current}`,fieldId:$.fieldId,aggregation:Nt($.aggregation,X)});}),A}),[j,ie]=useState({}),[Y,te]=useState(true),[Z,Ze]=useState(false),[at,He]=useState(()=>sc(gt(a?.rows,w),gt(a?.columns,w),r?.dimensionFieldId)),[re,Ie]=useState(()=>{let h=(a?.values??[]).filter((M,A,$)=>w.has(M.fieldId)&&$.findIndex(X=>X.fieldId===M.fieldId)===A).map(M=>({tokenId:M.fieldId,fieldId:M.fieldId,aggregation:Nt(M.aggregation,B.get(M.fieldId))}));return xs(h,r?.primaryValueFieldId)}),[Te,je]=useState(()=>{let h=(a?.values??[]).filter((A,$,X)=>w.has(A.fieldId)&&X.findIndex(le=>le.fieldId===A.fieldId)===$).map(A=>({tokenId:A.fieldId,fieldId:A.fieldId,aggregation:Nt(A.aggregation,B.get(A.fieldId))})),M=xs(h,r?.primaryValueFieldId);return lc(h,M,r?.secondaryValueFieldId)}),[rt,ze]=useState(r?.chartType??"bar-vertical"),[Ye,uo]=useState(l),[Gt,Ue]=useState(d),[Tt,At]=useState(()=>f??[]),[ht,H]=useState(""),[pe,se]=useState(false),[ue,Ge]=useState(""),[Me,ao]=useState(null),[mo,go]=useState(new Set(["__grand_total__"])),[fo,ho]=useState(new Set),ke=s?.rowFields??T,de=s?.columnFields??D,yt=s?.filterFields??P,Pe=s?.valueFields??W,Bt=s?.filterSelections??j,yo=s?.showGrandTotal??Y,Ba=s?.isConfiguratorCollapsed??Z,V=s?.chartDimensionFieldId??at,O=s?.chartPrimaryValueFieldId??re,U=s?.chartSecondaryValueFieldId??Te,me=s?.chartType??rt,fe=s?.isChartCollapsed??Ye,we=s?.isTableCollapsed??Gt,ce=g??Tt,Re=c||ce.length>0||!!u,ye=useCallback(h=>{if(s?.setRowFields){s.setRowFields(h);return}v(h);},[s]),De=useCallback(h=>{if(s?.setColumnFields){s.setColumnFields(h);return}S(h);},[s]),Se=useCallback(h=>{if(s?.setFilterFields){s.setFilterFields(h);return}F(h);},[s]),he=useCallback(h=>{if(s?.setValueFields){s.setValueFields(h);return}z(h);},[s]),Ce=useCallback(h=>{if(s?.setFilterSelections){s.setFilterSelections(h);return}ie(h);},[s]),Ft=useCallback(h=>{if(s?.setShowGrandTotal){s.setShowGrandTotal(h);return}te(h);},[s]),bo=useCallback(h=>{if(s?.setIsConfiguratorCollapsed){s.setIsConfiguratorCollapsed(h);return}Ze(h);},[s]),ut=useCallback(h=>{if(s?.setChartDimensionFieldId){s.setChartDimensionFieldId(h);return}He(h);},[s]),bt=useCallback(h=>{if(s?.setChartPrimaryValueFieldId){s.setChartPrimaryValueFieldId(h);return}Ie(h);},[s]),ro=useCallback(h=>{if(s?.setChartSecondaryValueFieldId){s.setChartSecondaryValueFieldId(h);return}je(h);},[s]),da=useCallback(h=>{if(s?.setChartType){s.setChartType(h);return}ze(h);},[s]),ur=useCallback(h=>{if(s?.setIsChartCollapsed){s.setIsChartCollapsed(h);return}uo(h);},[s]),xo=useCallback(h=>{if(s?.setIsTableCollapsed){s.setIsTableCollapsed(h);return}Ue(h);},[s]),Ut=useCallback(h=>{let M=typeof h=="function"?h(ce):h;g||At(M),u?.(M);},[u,ce,g]),Fa=useMemo(()=>new Set([...ke,...de,...yt]),[ke,de,yt]),Go=useMemo(()=>o.filter(h=>!Fa.has(h.id)),[o,Fa]),Et=useMemo(()=>{let h=[...ke,...de,...yt],M=new Set,A=[];return h.forEach($=>{M.has($)||(M.add($),A.push($));}),A},[de,yt,ke]);useEffect(()=>{ye(h=>{let M=h.filter(A=>w.has(A));return na(h,M)?h:M}),De(h=>{let M=h.filter(A=>w.has(A));return na(h,M)?h:M}),Se(h=>{let M=h.filter(A=>w.has(A));return na(h,M)?h:M}),he(h=>{let M=h.filter(A=>w.has(A.fieldId)).map(A=>({...A,aggregation:Nt(A.aggregation,B.get(A.fieldId))}));return ns(h,M)?h:M});},[B,w]);let Kt=useMemo(()=>{let h={};return Et.forEach(M=>{let A=new Set;t.forEach($=>{A.add(ra($[M]));}),h[M]=Array.from(A).sort(($,X)=>$.localeCompare(X));}),h},[Et,t]);useEffect(()=>{Ce(h=>{let M={};return Et.forEach(A=>{let $=Kt[A]??[],le=(h[A]??[]).filter(q=>$.includes(q)),L=Object.prototype.hasOwnProperty.call(h,A);M[A]=L?le:$;}),Qp(h,M)?h:M});},[Et,Kt]),useEffect(()=>{ut(h=>sc(ke,de,h));},[de,ke,ut]),useEffect(()=>{bt(h=>xs(Pe,h));},[bt,Pe]),useEffect(()=>{ro(h=>lc(Pe,O,h));},[O,ro,Pe]);let Pt=useMemo(()=>t.filter(h=>Et.every(M=>{let A=Bt[M]??[],$=Kt[M]??[];if(A.length===$.length)return true;if(A.length===0)return false;let X=ra(h[M]);return A.includes(X)})),[Et,Kt,Bt,t]),Ae=useMemo(()=>{if(Pe.length===0)return null;let h=new Map;if(Pt.forEach(L=>{let q=de.length>0?de.map(Oe=>ra(L[Oe])):[p("pivot.valueLabel")],K=or(q);h.set(K,q);}),h.size===0){let L=de.length>0?de.map(()=>as):[p("pivot.valueLabel")];h.set(or(L),L);}let M=Array.from(h.entries()).sort((L,q)=>jp(L[1],q[1])),A=M.flatMap(([L,q])=>Pe.map(K=>{let Oe=B.get(K.fieldId),N=`${R(K.aggregation)} ${Oe?.label??K.fieldId}`,Q=de.length===0||Pe.length>1?`${q.join(" / ")} \u2022 ${N}`:q.join(" / ");return {id:`${L}::${K.tokenId}`,colKey:L,valueItem:K,label:Q}})),$=[];de.length>0&&M.forEach(([L,q])=>{let K=A.filter(Q=>Q.colKey===L),Oe=$,N=[];q.forEach((Q,G)=>{N.push(`d${G}:${Q}`);let oe=`col::${or(N)}`,Be=Oe.find(No=>No.key===oe);Be||(Be={key:oe,label:Q,children:[],leafColumnIds:[],path:q.slice(0,G+1),depth:G},Oe.push(Be)),K.forEach(No=>{Be.leafColumnIds.includes(No.id)||Be.leafColumnIds.push(No.id);}),Oe=Be.children;});});let X=L=>{let q={};return A.forEach(K=>{let Oe=L.filter(N=>{let Q=de.length>0?de.map(G=>ra(N[G])):[p("pivot.valueLabel")];return or(Q)===K.colKey});q[K.id]=zr(Oe,K.valueItem.fieldId,K.valueItem.aggregation);}),q},le=[];if(ke.length===0)le.push({key:"root",value:p("pivot.resultLabel")||Hp,children:[],isLeaf:true,aggregatedValues:X(Pt),path:[],depth:0});else {let L=(q,K,Oe)=>{if(K>=ke.length)return [];let N=ke[K],Q=new Map;return q.forEach(G=>{let oe=ra(G[N]);Q.has(oe)||Q.set(oe,[]),Q.get(oe).push(G);}),Array.from(Q.keys()).sort().map(G=>{let oe=Q.get(G),Be=[...Oe,G];return {key:or(Be),value:G,fieldId:N,aggregatedValues:X(oe),children:L(oe,K+1,Be),isLeaf:K===ke.length-1,path:Be,depth:K}})};le.push(...L(Pt,0,[]));}return {dataColumns:A,columnTree:$,rowTree:le}},[de,B,Pt,R,ke,p,Pe]),Uo=useCallback((h,M)=>(m.current+=1,{tokenId:`v${m.current}`,fieldId:h,aggregation:Nt(M,B.get(h))}),[B]),Bo=useCallback(h=>{if(h==="rows")return ye([]);if(h==="columns")return De([]);if(h==="filters")return Se([]);he([]);},[]),Ko=useCallback((h,M)=>{if(h==="rows")return ye(A=>A.filter($=>$!==M));if(h==="columns")return De(A=>A.filter($=>$!==M));if(h==="filters")return Se(A=>A.filter($=>$!==M));he(A=>A.filter($=>$.tokenId!==M));},[]),Ea=useCallback((h,M)=>{he(A=>A.map($=>$.tokenId===h?{...$,aggregation:Nt(M,B.get($.fieldId))}:$));},[B]),Fo=useCallback(h=>{ao(String(h.active.id));},[]),La=useCallback(h=>{if(ao(null),!h.over)return;let M=rs(String(h.active.id)),A=rs(String(h.over.id));if(!M||!A||M.kind!=="item"||!M.key)return;if(M.zone===A.zone&&A.kind==="item"){if(M.zone==="rows"){let G=ke.indexOf(M.key),oe=ke.indexOf(A.key??"");G!==-1&&oe!==-1&&G!==oe&&ye(Be=>arrayMove(Be,G,oe));return}if(M.zone==="columns"){let G=de.indexOf(M.key),oe=de.indexOf(A.key??"");G!==-1&&oe!==-1&&G!==oe&&De(Be=>arrayMove(Be,G,oe));return}if(M.zone==="filters"){let G=yt.indexOf(M.key),oe=yt.indexOf(A.key??"");G!==-1&&oe!==-1&&G!==oe&&Se(Be=>arrayMove(Be,G,oe));return}if(M.zone==="values"){let G=Pe.findIndex(Be=>Be.tokenId===M.key),oe=Pe.findIndex(Be=>Be.tokenId===(A.key??""));G!==-1&&oe!==-1&&G!==oe&&he(Be=>arrayMove(Be,G,oe));}return}let $=A.zone,X=[...ke],le=[...de],L=[...yt],q=[...Pe],K="",Oe=null;if(M.zone==="palette")K=M.key;else if(M.zone==="values"){let G=q.find(oe=>oe.tokenId===M.key);if(!G)return;K=G.fieldId,Oe=G,q=q.filter(oe=>oe.tokenId!==M.key);}else M.zone==="rows"?(K=M.key,X=X.filter(G=>G!==K)):M.zone==="columns"?(K=M.key,le=le.filter(G=>G!==K)):M.zone==="filters"&&(K=M.key,L=L.filter(G=>G!==K));if(!K)return;let N=()=>{X=X.filter(G=>G!==K),le=le.filter(G=>G!==K),L=L.filter(G=>G!==K);},Q=G=>{if(A.kind!=="item"||!A.key)return G==="rows"?X.length:G==="columns"?le.length:G==="filters"?L.length:G==="values"?q.length:0;if(G==="rows"){let oe=X.indexOf(A.key);return oe>=0?oe:X.length}if(G==="columns"){let oe=le.indexOf(A.key);return oe>=0?oe:le.length}if(G==="filters"){let oe=L.indexOf(A.key);return oe>=0?oe:L.length}if(G==="values"){let oe=q.findIndex(Be=>Be.tokenId===A.key);return oe>=0?oe:q.length}return 0};if($==="palette"){ye(X),De(le),Se(L),he(q);return}if($==="values"){let G=Q("values"),oe=Oe??Uo(K);q.splice(G,0,oe),ye(X),De(le),Se(L),he(q);return}if(Zp($)){N();let G=Q($);$==="rows"?X.splice(G,0,K):$==="columns"?le.splice(G,0,K):L.splice(G,0,K),ye(X),De(le),Se(L),he(q);}},[de,Uo,yt,ke,Pe]),Na=useCallback((h,M)=>{Ce(A=>({...A,[h]:M}));},[]),Eo=useCallback(h=>{go(M=>{let A=new Set(M);return A.has(h)?A.delete(h):A.add(h),A});},[]),qo=useCallback(h=>{ho(M=>{let A=new Set(M);return A.has(h)?A.delete(h):A.add(h),A});},[]),pa=useCallback(h=>{let M=B.get(h.fieldId),A=Zl(M);return jsx(FormControl,{size:"small",sx:{minWidth:98},children:jsx(Select,{value:h.aggregation,onChange:$=>Ea(h.tokenId,$.target.value),onClick:$=>$.stopPropagation(),onMouseDown:$=>$.stopPropagation(),sx:{fontSize:"0.72rem",height:26,"& .MuiSelect-select":{py:.35}},children:A.map($=>jsx(MenuItem,{value:$,sx:{fontSize:"0.75rem"},children:R($)},$))})})},[B,R,Ea]),Lt=useCallback(h=>{let M=Kt[h]??[],A=Bt[h]??M;return M.length===0?p("pivot.filter.noValues"):A.length===0?p("pivot.filter.noneSelected"):A.length===M.length?p("pivot.filter.allValues"):p("pivot.filter.selectedCount",{selected:A.length,total:M.length})},[Kt,Bt,p]),vo=useCallback(h=>{let M=Kt[h]??[],A=Bt[h]??M;return jsx(Jp,{options:M,selectedValues:A,onChange:$=>Na(h,$)})},[Kt,Bt,Na]),_o=useCallback(()=>`pivot-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,[]),no=useCallback(()=>{let h={};return new Set([...Et,...Object.keys(Bt)]).forEach(A=>{if(!w.has(A))return;let $=Bt[A]??[];h[A]=[...$];}),{layout:{rows:[...ke],columns:[...de],filters:[...yt],values:Pe.map(A=>({fieldId:A.fieldId,aggregation:A.aggregation}))},filterSelections:h,showGrandTotal:yo,chart:{dimensionFieldId:V,primaryValueFieldId:O,secondaryValueFieldId:U,chartType:me}}},[Et,V,O,U,me,de,yt,Bt,ke,yo,w,Pe]),Lo=useCallback(h=>{let M=gt(h.layout.rows,w),A=gt(h.layout.columns,w),$=gt(h.layout.filters,w),X=new Set,le=(h.layout.values??[]).filter(K=>!w.has(K.fieldId)||X.has(K.fieldId)?false:(X.add(K.fieldId),true)).map(K=>Uo(K.fieldId,K.aggregation)),L={};Object.entries(h.filterSelections??{}).forEach(([K,Oe])=>{!w.has(K)||!Array.isArray(Oe)||(L[K]=Array.from(new Set(Oe.map(N=>String(N)))));}),ye(M),De(A),Se($),he(le),Ce(L),typeof h.showGrandTotal=="boolean"&&Ft(h.showGrandTotal),ut(sc(M,A,h.chart?.dimensionFieldId));let q=xs(le,h.chart?.primaryValueFieldId);bt(q),ro(lc(le,q,h.chart?.secondaryValueFieldId)),da(h.chart?.chartType??"bar-vertical"),H(h.id),I?.(h);},[Uo,I,ut,bt,ro,da,De,Se,Ce,ye,Ft,he,w]),za=useCallback(h=>{if(!h){H("");return}let M=ce.find(A=>A.id===h);if(!M){H("");return}Lo(M);},[Lo,ce]),mr=useCallback(()=>{let h=p("pivot.preset.defaultName",{index:ce.length+1});Ge(h),se(true);},[ce.length,p]),ua=useCallback(()=>{let h=ue.trim();if(!h)return;let M={id:_o(),name:h,...no()};Ut(A=>[...A,M]),H(M.id),se(false);},[no,_o,ue,Ut]),Va=useCallback(()=>{ht&&(Ut(h=>h.filter(M=>M.id!==ht)),H(""));},[ht,Ut]);useEffect(()=>{if(!y||b.current)return;let h=ce.find(M=>M.id===y);h&&(b.current=true,Lo(h));},[Lo,y,ce]),useEffect(()=>{ht&&(ce.some(h=>h.id===ht)||H(""));},[ht,ce]);let Zo=useMemo(()=>{if(!yo||!Ae||!ke.length)return null;let h={};return Ae.dataColumns.forEach(M=>{let A=Pt.filter($=>{let X=de.length>0?de.map(le=>ra($[le])):[p("pivot.valueLabel")];return or(X)===M.colKey});h[M.id]=zr(A,M.valueItem.fieldId,M.valueItem.aggregation);}),{key:"__grand_total__",value:p("pivot.grandTotal")||Gp,children:[],isLeaf:false,isGrandTotal:true,aggregatedValues:h,path:[],depth:-1}},[yo,Ae,Pt,de,ke.length,p]),Ot=useMemo(()=>ku(Ae?.rowTree??[]),[Ae]),Co=useMemo(()=>ku(Ae?.columnTree??[]),[Ae]);useEffect(()=>{go(h=>{let M=new Set;return h.has("__grand_total__")&&M.add("__grand_total__"),Ot.forEach(A=>{h.has(A)&&M.add(A);}),M});},[Ot]),useEffect(()=>{ho(h=>{let M=new Set;return Co.forEach(A=>{h.has(A)&&M.add(A);}),M});},[Co]);let gr=useCallback(()=>{go(h=>{let M=new Set(h);return Ot.forEach(A=>M.add(A)),M});},[Ot]),Oa=useCallback(()=>{go(h=>{let M=new Set;return h.has("__grand_total__")&&M.add("__grand_total__"),M});},[]),fr=useCallback(()=>{ho(new Set(Co));},[Co]),hr=useCallback(()=>{ho(new Set);},[]),yr=useMemo(()=>!Ae||de.length===0?[]:Y0(Ae.columnTree,fo),[de.length,fo,Ae]),qt=useMemo(()=>{if(!Ae)return [];if(de.length===0)return Ae.dataColumns.map(M=>({id:M.id,label:M.label,leafColumnIds:[M.id],valueItem:M.valueItem}));let h=new Map(Ae.dataColumns.map(M=>[M.id,M]));return yr.flatMap(M=>{let A=new Map;return M.leafColumnIds.forEach($=>{let X=h.get($);if(!X)return;let le=X.valueItem.tokenId,L=`${R(X.valueItem.aggregation)} ${B.get(X.valueItem.fieldId)?.label??X.valueItem.fieldId}`,q=A.get(le);if(q){q.leafColumnIds.push($);return}A.set(le,{id:`${M.key}::${le}`,label:Pe.length>1?L:M.label,leafColumnIds:[$],valueItem:X.valueItem});}),Array.from(A.values())})},[de.length,B,R,Ae,Pe.length,yr]),br=useMemo(()=>new Map(qt.map(h=>[h.id,h])),[qt]),xr=useMemo(()=>qt.map(h=>({id:h.id,colKey:h.id,valueItem:h.valueItem,label:h.label})),[qt]),$a=useMemo(()=>{if(!Ae||de.length===0)return [];let h=[],M=wu(Ae.columnTree,fo),A=M+(Pe.length>1?1:0),$=(X,le)=>{h[le]??(h[le]=[]),X.forEach(L=>{let q=L.children.length>0&&fo.has(L.key),K=qt.filter(N=>L.leafColumnIds.some(Q=>N.leafColumnIds.includes(Q))).length,Oe=q||Pe.length>1?1:A-le;h[le].push({key:L.key,label:L.label,colSpan:K,rowSpan:Oe,expandable:L.children.length>0,expanded:q}),q&&$(L.children,le+1);});};return $(Ae.columnTree,0),Pe.length>1&&(h[M]=qt.map(X=>({key:X.id,label:X.label,colSpan:1,rowSpan:1,expandable:false,expanded:false}))),h},[de.length,fo,Ae,Pe.length,qt]),jo=useCallback((h,M)=>M.leafColumnIds.reduce((A,$)=>A+(h.aggregatedValues[$]??0),0),[]),ma=useMemo(()=>jsxs(Fragment,{children:[jsx(Button,{size:"small",variant:"text",onClick:gr,disabled:Ot.size===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.expandRowsAll")}),jsx(Button,{size:"small",variant:"text",onClick:Oa,disabled:Ot.size===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.collapseRowsAll")}),jsx(Divider,{orientation:"vertical",flexItem:true}),jsx(Button,{size:"small",variant:"text",onClick:fr,disabled:Co.size===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.expandColumnsAll")}),jsx(Button,{size:"small",variant:"text",onClick:hr,disabled:de.length===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.collapseColumnsAll")})]}),[de.length,Co.size,Ot.size,hr,Oa,fr,gr,p]),ga=()=>{if(!Me)return null;let h=rs(Me);if(!h||h.kind!=="item"||!h.key)return null;if(h.zone==="palette"){let X=B.get(h.key);return X?jsx(Ql,{label:X.label,subtitle:X.type}):null}if(h.zone==="values"){let X=Pe.find(K=>K.tokenId===h.key);if(!X)return null;let L=B.get(X.fieldId)?.label??X.fieldId,q=`${R(X.aggregation)}(${L})`;return jsx(ds,{label:L,caption:q})}let A=B.get(h.key)?.label??h.key,$=Lt(h.key);return jsx(ds,{label:A,caption:$})};return jsxs(Paper,{sx:h=>({p:{xs:1.2,md:2},borderRadius:4,border:`1px solid ${h.palette.divider}`,bgcolor:"background.paper",boxShadow:h.palette.mode==="dark"?"none":"0 12px 28px rgba(15, 23, 42, 0.08)",display:"flex",flexDirection:"column",gap:2}),children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1.5,flexWrap:"wrap"},children:[jsxs(Box,{children:[jsx(Typography,{sx:{fontSize:"1.05rem",fontWeight:800},children:x}),jsx(Typography,{sx:{fontSize:"0.78rem",color:"text.secondary"},children:p("pivot.subtitle.default")})]}),jsxs(Stack,{direction:"row",spacing:1.5,alignItems:"center",children:[Re&&jsxs(Fragment,{children:[jsx(FormControl,{size:"small",sx:{minWidth:200},children:jsxs(Select,{value:ht,displayEmpty:true,onChange:h=>za(String(h.target.value)),sx:{fontSize:"0.75rem",height:32},children:[jsx(MenuItem,{value:"",sx:{fontSize:"0.75rem",color:"text.secondary"},children:p("pivot.preset.selectPlaceholder")}),ce.map(h=>jsx(MenuItem,{value:h.id,sx:{fontSize:"0.75rem"},children:h.name},h.id))]})}),jsx(Tooltip,{title:p("pivot.preset.save"),children:jsx(IconButton,{size:"small",onClick:mr,"aria-label":p("pivot.preset.save"),children:jsx(Zd,{sx:{fontSize:18}})})}),jsx(Tooltip,{title:p("pivot.preset.delete"),children:jsx("span",{children:jsx(IconButton,{size:"small",onClick:Va,disabled:!ht,"aria-label":p("pivot.preset.delete"),children:jsx(G0,{sx:{fontSize:18}})})})}),jsx(Divider,{flexItem:true,orientation:"vertical"})]}),jsxs(Typography,{sx:{fontSize:"0.74rem",color:"text.secondary"},children:[p("pivot.records"),": ",jsx("strong",{children:t.length.toLocaleString()})," / ",p("pivot.afterFilter"),":"," ",jsx("strong",{children:Pt.length.toLocaleString()})]}),jsx(Divider,{flexItem:true,orientation:"vertical"}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.6},children:[jsx(Typography,{sx:{fontSize:"0.74rem"},children:p("pivot.grandTotal")}),jsx(Switch,{size:"small",checked:yo,onChange:h=>Ft(h.target.checked)})]})]})]}),jsx(Divider,{}),jsxs(DndContext,{sensors:C,collisionDetection:closestCenter,onDragStart:Fo,onDragEnd:La,children:[jsx(su,{isConfiguratorCollapsed:Ba,onToggleCollapse:()=>bo(h=>!h),availableFields:Go,fieldMap:B,filterFields:yt,columnFields:de,rowFields:ke,valueFields:Pe,clearZone:Bo,removeFieldFromZone:Ko,getFilterSelectionSummary:Lt,renderDimensionFilterSelect:vo,renderAggregationSelect:pa,getAggregationLabel:R}),jsx(Portal,{children:jsx(DragOverlay,{dropAnimation:{duration:250,easing:"cubic-bezier(0.18, 0.67, 0.6, 1.22)"},children:ga()})})]}),jsx(fu,{rows:Pt,fieldMap:B,rowFields:ke,columnFields:de,valueFields:Pe,chartDimensionFieldId:V,chartPrimaryValueFieldId:O,chartSecondaryValueFieldId:U,chartType:me,isCollapsed:fe,onChartDimensionFieldIdChange:h=>ut(h),onChartPrimaryValueFieldIdChange:h=>bt(h),onChartSecondaryValueFieldIdChange:h=>ro(h),onChartTypeChange:h=>da(h),onToggleCollapse:()=>ur(h=>!h),getAggregationLabel:R}),jsx(Hr,{title:p("pivot.table.sectionTitle"),subtitle:ke.length>0?ke.map(h=>B.get(h)?.label??h).join(" > "):p("pivot.table.dimensions"),collapsed:we,onToggleCollapse:()=>xo(h=>!h),expandAriaLabel:p("pivot.table.collapse.ariaExpand"),collapseAriaLabel:p("pivot.table.collapse.ariaCollapse"),bodySx:{p:0},headerActions:ma,children:Ae===null?jsx(Box,{sx:{py:5,px:{xs:1.2,md:1.6},textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:k})}):jsx(TableContainer,{sx:{maxHeight:i},children:jsxs(Table,{size:"small",stickyHeader:true,children:[jsx(TableHead,{children:($a.length>0?$a:[[]]).map((h,M)=>jsxs(TableRow,{children:[M===0&&jsx(TableCell,{rowSpan:Math.max($a.length,1),sx:A=>({fontWeight:800,fontSize:"0.76rem",color:"text.primary",bgcolor:A.palette.mode==="dark"?"#000000":"#f5f5f5",borderBottom:`1px solid ${A.palette.divider}`,pl:2,minWidth:220,verticalAlign:"middle"}),children:ke.length>0?ke.map(A=>B.get(A)?.label).join(" > "):p("pivot.table.dimensions")}),(h.length>0?h:qt.map(A=>({key:A.id,label:A.label,colSpan:1,rowSpan:1,expandable:false,expanded:false}))).map(A=>jsx(TableCell,{align:"center",colSpan:A.colSpan,rowSpan:A.rowSpan,sx:$=>({fontWeight:800,fontSize:"0.75rem",color:"text.primary",bgcolor:$.palette.mode==="dark"?"#000000":"#f5f5f5",borderBottom:`1px solid ${$.palette.divider}`,minWidth:148,verticalAlign:"middle"}),children:jsxs(Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:.4},children:[A.expandable&&jsx(IconButton,{size:"small",onClick:()=>qo(A.key),sx:{p:.1,ml:-0.3},children:A.expanded?jsx(rf,{sx:{fontSize:16}}):jsx(Wg,{sx:{fontSize:16}})}),jsx(Box,{component:"span",children:A.label})]})},A.key))]},`pivot-header-row-${M}`))}),jsxs(TableBody,{children:[Ae.rowTree.map(h=>jsx(hs,{node:h,dataColumns:xr,fieldMap:B,level:0,expandedKeys:mo,onToggle:Eo,getValue:(M,A)=>{let $=br.get(A);return $?jo(M,$):0}},h.key)),Zo&&jsx(hs,{node:Zo,dataColumns:xr,fieldMap:B,level:0,expandedKeys:mo,onToggle:Eo,getValue:(h,M)=>{let A=br.get(M);return A?jo(h,A):0}})]})]})})}),jsxs(Dialog,{open:pe,onClose:()=>se(false),maxWidth:"xs",fullWidth:true,children:[jsx(DialogTitle,{children:p("pivot.preset.saveDialogTitle")}),jsx(DialogContent,{children:jsx(TextField,{autoFocus:true,fullWidth:true,margin:"dense",label:p("pivot.preset.nameLabel"),value:ue,onChange:h=>Ge(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),ua());}})}),jsxs(DialogActions,{children:[jsx(Button,{onClick:()=>se(false),children:p("common.cancel")}),jsx(Button,{variant:"contained",onClick:ua,disabled:!ue.trim(),children:p("common.save")})]})]})]})};var Iu=(e,t,o)=>{let a=[...e,...t];return o&&a.includes(o)?o:a[0]??""},dc=(e,t)=>t&&e.some(o=>o.fieldId===t)?t:e[0]?.fieldId??"",Tu=(e,t,o)=>o===""?"":o&&o!==t&&e.some(a=>a.fieldId===o)?o:e.find(a=>a.fieldId!==t)?.fieldId??"",p2=({fields:e,initialLayout:t,initialFilterSelections:o={},initialShowGrandTotal:a=true,initialConfiguratorCollapsed:r=false,initialChart:n,initialChartCollapsed:i=false,initialTableCollapsed:l=false})=>{let d=useRef(0),s=useMemo(()=>new Set(e.map(H=>H.id)),[e]),c=useMemo(()=>new Map(e.map(H=>[H.id,H])),[e]),[g,f]=useState(()=>gt(t?.rows,s)),[u,y]=useState(()=>gt(t?.columns,s)),[I,p]=useState(()=>gt(t?.filters,s)),[C,m]=useState(()=>{let H=t?.values??[],pe=new Set,se=[];return H.forEach(ue=>{!s.has(ue.fieldId)||pe.has(ue.fieldId)||(pe.add(ue.fieldId),d.current+=1,se.push({tokenId:`v${d.current}`,fieldId:ue.fieldId,aggregation:Nt(ue.aggregation,c.get(ue.fieldId))}));}),se}),[b,x]=useState(o),[k,E]=useState(a),[R,w]=useState(r),[B,T]=useState(()=>Iu(gt(t?.rows,s),gt(t?.columns,s),n?.dimensionFieldId)),[v,D]=useState(()=>{let H=(()=>{let pe=t?.values??[],se=new Set,ue=[];return pe.forEach(Ge=>{!s.has(Ge.fieldId)||se.has(Ge.fieldId)||(se.add(Ge.fieldId),ue.push({tokenId:Ge.fieldId,fieldId:Ge.fieldId,aggregation:Nt(Ge.aggregation,c.get(Ge.fieldId))}));}),ue})();return dc(H,n?.primaryValueFieldId)}),[S,P]=useState(()=>{let H=(()=>{let se=t?.values??[],ue=new Set,Ge=[];return se.forEach(Me=>{!s.has(Me.fieldId)||ue.has(Me.fieldId)||(ue.add(Me.fieldId),Ge.push({tokenId:Me.fieldId,fieldId:Me.fieldId,aggregation:Nt(Me.aggregation,c.get(Me.fieldId))}));}),Ge})(),pe=dc(H,n?.primaryValueFieldId);return Tu(H,pe,n?.secondaryValueFieldId)}),[F,W]=useState(n?.chartType??"bar-vertical"),[z,j]=useState(i),[ie,Y]=useState(l);useEffect(()=>{f(H=>{let pe=H.filter(se=>s.has(se));return na(H,pe)?H:pe}),y(H=>{let pe=H.filter(se=>s.has(se));return na(H,pe)?H:pe}),p(H=>{let pe=H.filter(se=>s.has(se));return na(H,pe)?H:pe}),m(H=>{let pe=H.filter(se=>s.has(se.fieldId)).map(se=>({...se,aggregation:Nt(se.aggregation,c.get(se.fieldId))}));return ns(H,pe)?H:pe});},[c,s]),useEffect(()=>{T(H=>Iu(g,u,H));},[u,g]),useEffect(()=>{D(H=>dc(C,H));},[C]),useEffect(()=>{P(H=>Tu(C,v,H));},[v,C]);let te=useCallback(H=>{f(gt(H,s));},[s]),Z=useCallback(H=>{y(gt(H,s));},[s]),Ze=useCallback(H=>{p(gt(H,s));},[s]),at=useCallback(H=>{m(pe=>{let se=H??[],ue=new Set,Ge=[];return se.forEach(Me=>{if(!s.has(Me.fieldId)||ue.has(Me.fieldId))return;ue.add(Me.fieldId);let ao=pe.find(mo=>mo.fieldId===Me.fieldId);if(ao){Ge.push({...ao,aggregation:Nt(Me.aggregation??ao.aggregation,c.get(Me.fieldId))});return}d.current+=1,Ge.push({tokenId:`v${d.current}`,fieldId:Me.fieldId,aggregation:Nt(Me.aggregation,c.get(Me.fieldId))});}),Ge});},[c,s]),He=useCallback(H=>{te(H.rows??[]),Z(H.columns??[]),Ze(H.filters??[]),at(H.values??[]);},[Z,Ze,te,at]),re=useCallback(H=>{if(H==="rows")return f([]);if(H==="columns")return y([]);if(H==="filters")return p([]);m([]);},[]),Ie=useCallback((H,pe)=>{if(H==="rows")return f(se=>se.filter(ue=>ue!==pe));if(H==="columns")return y(se=>se.filter(ue=>ue!==pe));if(H==="filters")return p(se=>se.filter(ue=>ue!==pe));m(se=>se.filter(ue=>ue.tokenId!==pe));},[]),Te=useCallback((H,pe)=>{m(se=>se.map(ue=>ue.tokenId===H?{...ue,aggregation:Nt(pe,c.get(ue.fieldId))}:ue));},[c]),je=useCallback((H,pe)=>{x(se=>({...se,[H]:pe}));},[]),rt=useCallback(()=>{x({});},[]),ze=useCallback(()=>{E(H=>!H);},[]),Ye=useCallback(()=>{w(H=>!H);},[]),uo=useCallback(H=>{T(H);},[]),Gt=useCallback(H=>{D(H);},[]),Ue=useCallback(H=>{P(H);},[]),Tt=useCallback(()=>{j(H=>!H);},[]),At=useCallback(()=>{Y(H=>!H);},[]);return {model:useMemo(()=>({rowFields:g,setRowFields:f,columnFields:u,setColumnFields:y,filterFields:I,setFilterFields:p,valueFields:C,setValueFields:m,filterSelections:b,setFilterSelections:x,showGrandTotal:k,setShowGrandTotal:E,isConfiguratorCollapsed:R,setIsConfiguratorCollapsed:w,chartDimensionFieldId:B,setChartDimensionFieldId:T,chartPrimaryValueFieldId:v,setChartPrimaryValueFieldId:D,chartSecondaryValueFieldId:S,setChartSecondaryValueFieldId:P,chartType:F,setChartType:W,isChartCollapsed:z,setIsChartCollapsed:j,isTableCollapsed:ie,setIsTableCollapsed:Y}),[B,v,S,F,u,I,b,z,R,ie,g,k,C]),actions:{setRows:te,setColumns:Z,setFilters:Ze,setValues:at,setLayout:He,clearZone:re,removeFieldFromZone:Ie,setAggregationForValue:Te,setFilterSelection:je,resetFilterSelections:rt,toggleGrandTotal:ze,toggleConfigurator:Ye,setChartDimension:uo,setChartPrimaryValue:Gt,setChartSecondaryValue:Ue,setChartType:W,toggleChart:Tt,toggleTable:At}}};var h2=({orientation:e="auto",defaultNavigationOpen:t,onNavOpenChange:o}={})=>{let a=useTheme$1(),r=useMediaQuery("(orientation: portrait)",{noSsr:true}),n=useMediaQuery(a.breakpoints.down("md"),{noSsr:true}),i=useMemo(()=>e==="auto"?r||n?"portrait":"landscape":e,[n,r,e]),[l,d]=useState(t??i==="landscape");useEffect(()=>{d(t??i==="landscape");},[t,i]);let s=g=>{d(g),o?.(g);};return {resolvedOrientation:i,isPortraitViewport:r,isCompactViewport:n,navigationOpen:l,setNavigationOpen:s,toggleNavigationOpen:()=>s(!l)}};var nv=e=>{let t=Number(e||0);return Number.isFinite(t)?t:0},x2=({rows:e,rowKey:t="id",numericField:o,defaultSelectedId:a})=>{let n=e[0]?.[t],[i,l]=useState(a??n),d=useMemo(()=>e.find(u=>u[t]===i)||e[0],[t,e,i]),[s,c]=useState(()=>{let u=d?.[o];return u==null?"0":String(u)});return {selectedId:i,selectedRecord:d,editorValue:s,setEditorValue:c,selectRecord:u=>{let y=u[t];l(y);let I=u[o];c(I==null?"0":String(I));},applyEditorValue:u=>{if(i===void 0)return;let y=nv(s),I=e.map(p=>p[t]===i?{...p,[o]:y}:p);u(I);}}};var hv=["code_128","ean_13","ean_8","qr_code","upc_a","upc_e"],Bu=(e,t,o,a)=>{t?.(e),a&&o?.();},I2=({open:e,onClose:t,title:o="Scan barcode",subtitle:a="Use the rear camera on the device. If scanning is unavailable, enter the code manually.",formats:r=hv,facingMode:n="environment",manualEntry:i=true,autoCloseOnDetect:l=true,scanIntervalMs:d=600,confirmLabel:s="Use code",cancelLabel:c="Close",manualPlaceholder:g="Enter barcode manually",onDetected:f,onError:u,sx:y})=>{let I=st__default.useRef(null),p=st__default.useRef(null),C=st__default.useRef(null),m=st__default.useRef(null),[b,x]=st__default.useState("idle"),[k,E]=st__default.useState(""),[R,w]=st__default.useState(null),[B,T]=st__default.useState(null),v=st__default.useCallback(()=>{C.current!==null&&(window.clearInterval(C.current),C.current=null),p.current&&(p.current.getTracks().forEach(P=>P.stop()),p.current=null),I.current&&(I.current.srcObject=null);},[]),D=st__default.useCallback(P=>{T(P),x("error"),u?.(P);},[u]);st__default.useEffect(()=>{if(!e){v(),x("idle"),T(null),E("");return}let P=false;return (async()=>{if(!(typeof window>"u"||typeof navigator>"u")){if(!navigator.mediaDevices?.getUserMedia){x("unsupported"),T("Camera access is not supported in this browser.");return}x("starting"),T(null);try{let W=await navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:{ideal:n}}});if(P){W.getTracks().forEach(z=>z.stop());return}if(p.current=W,I.current&&(I.current.srcObject=W,await I.current.play()),!window.BarcodeDetector){x("unsupported"),T("BarcodeDetector is not available. Camera preview is ready and manual entry is enabled.");return}m.current=new window.BarcodeDetector({formats:r}),x("ready"),C.current=window.setInterval(async()=>{if(!(!I.current||!m.current)&&!(I.current.readyState<HTMLMediaElement.HAVE_CURRENT_DATA))try{let j=(await m.current.detect(I.current)).find(Y=>Y.rawValue);if(!j?.rawValue)return;let ie={rawValue:j.rawValue,format:j.format};w(ie),v(),Bu(ie,f,t,l);}catch(z){D(z instanceof Error?z.message:"Failed to detect barcode.");}},d);}catch(W){D(W instanceof Error?W.message:"Unable to start camera.");}}})(),()=>{P=true,v();}},[l,n,r,t,f,e,D,d,v]);let S=()=>{let P=k.trim();if(!P)return;let F={rawValue:P,format:"manual"};w(F),Bu(F,f,t,l);};return jsxs(Dialog,{open:e,onClose:t,fullWidth:true,maxWidth:"sm",children:[jsx(DialogTitle,{sx:{fontSize:"1rem",fontWeight:900},children:o}),jsx(DialogContent,{sx:{pt:"8px !important"},children:jsxs(Stack,{spacing:2,sx:y,children:[jsx(Typography,{sx:{fontSize:"0.88rem",color:"text.secondary",lineHeight:1.55},children:a}),jsxs(Paper,{elevation:0,sx:P=>({position:"relative",overflow:"hidden",borderRadius:4,border:"1px solid",borderColor:"divider",minHeight:280,background:P.palette.mode==="dark"?"linear-gradient(180deg, rgba(15,23,42,0.92), rgba(2,6,23,0.96))":"linear-gradient(180deg, rgba(241,245,249,1), rgba(226,232,240,0.92))"}),children:[jsx("video",{ref:I,muted:true,playsInline:true,autoPlay:true,style:{width:"100%",height:280,objectFit:"cover",display:"block"}}),jsx(Box,{sx:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:jsx(Box,{sx:{width:"72%",maxWidth:320,aspectRatio:"1.7 / 1",borderRadius:3,border:"2px solid rgba(255,255,255,0.95)",boxShadow:"0 0 0 999px rgba(15,23,42,0.24)",position:"relative"},children:jsx(Box,{sx:{position:"absolute",top:"50%",left:0,right:0,height:2,bgcolor:"#38bdf8",boxShadow:"0 0 18px rgba(56,189,248,0.85)"}})})}),jsxs(Box,{sx:{position:"absolute",top:12,left:12,display:"flex",gap:1,flexWrap:"wrap"},children:[jsx(Chip,{icon:jsx(gv,{}),label:b==="ready"?"Camera ready":b==="starting"?"Starting camera":b==="unsupported"?"Preview only":b==="error"?"Scanner error":"Idle",size:"small",color:b==="error"?"error":"primary",variant:"filled"}),R?jsx(Chip,{icon:jsx(fv,{}),label:`${R.format||"barcode"}: ${R.rawValue}`,size:"small",color:"success",variant:"filled"}):null]})]}),B?jsx(Alert,{severity:b==="unsupported"?"info":"warning",children:B}):null,i?jsxs(Stack,{direction:{xs:"column",sm:"row"},spacing:1.25,children:[jsx(TextField,{fullWidth:true,label:"Barcode",placeholder:g,value:k,onChange:P=>E(P.target.value)}),jsx(Button,{variant:"contained",onClick:S,sx:{minHeight:56,px:2.5},children:s})]}):null]})}),jsx(DialogActions,{sx:{px:3,pb:2},children:jsx(Button,{onClick:t,children:c})})]})};var vv={default:"#475569",primary:"#1d4ed8",success:"#047857",warning:"#b45309",error:"#b91c1c",info:"#0369a1"},A2=({title:e,description:t,kicker:o,icon:a,badges:r=[],metrics:n=[],footer:i,children:l,selected:d=false,draggable:s=false,isDragging:c=false,swipeThreshold:g=88,startAction:f,endAction:u,dragHandleProps:y,onClick:I,onSwipe:p,sx:C})=>{let[m,b]=useState(0),[x,k]=useState(false),E=useRef(null),R=useRef(0),w=useRef(0),B=!!(f||u),T=132,v=()=>{b(0),k(false),E.current=null,R.current=0,w.current=0;},D=z=>{(z==="start"?f:u)?.onTrigger?.(),p?.(z),v();},S=z=>{!B||z.target.closest('button, a, input, textarea, [data-no-swipe="true"]')||(E.current=z.pointerId,R.current=z.clientX,w.current=z.clientX,k(true),z.currentTarget.setPointerCapture(z.pointerId));},P=z=>{if(!x||E.current!==z.pointerId)return;w.current=z.clientX;let j=w.current-R.current,ie=Math.max(-T,Math.min(T,j));b(ie);},F=z=>{if(!x||E.current!==z.pointerId)return;let j=w.current-R.current;if(j>=g&&f){D("start");return}if(j<=-g&&u){D("end");return}Math.abs(j)<12&&I?.(),v();},W=(z,j)=>{if(!z)return null;let ie=z.backgroundColor||vv[z.tone||"default"];return jsx(Box,{sx:{position:"absolute",top:0,bottom:0,[j]:0,width:T,px:2,display:"flex",alignItems:"center",justifyContent:j==="left"?"flex-start":"flex-end",color:"#fff",background:`linear-gradient(135deg, ${ie}, rgba(15,23,42,0.92))`},children:jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[z.icon,jsx(Typography,{sx:{fontWeight:700,fontSize:"0.95rem"},children:z.label})]})})};return jsxs(Box,{sx:{position:"relative",overflow:"hidden",borderRadius:4,...C},children:[W(f,"left"),W(u,"right"),jsx(Paper,{elevation:0,onPointerDown:S,onPointerMove:P,onPointerUp:F,onPointerCancel:v,sx:z=>({position:"relative",zIndex:1,p:2,borderRadius:4,border:"1px solid",borderColor:d?"primary.main":"divider",background:z.palette.mode==="dark"?"linear-gradient(180deg, rgba(30,41,59,0.96), rgba(15,23,42,0.92))":"linear-gradient(180deg, #ffffff, #f8fafc)",color:"text.primary",boxShadow:d?"0 18px 42px rgba(37, 99, 235, 0.18)":"0 12px 28px rgba(15, 23, 42, 0.08)",transform:`translate3d(${m}px, 0, 0) scale(${c?.985:1})`,transition:x?"none":"transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease",touchAction:"pan-y",cursor:I?"pointer":"default",opacity:c?.9:1}),children:jsxs(Stack,{spacing:1.5,children:[jsxs(Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",children:[a?jsx(Box,{sx:{mt:.25},children:a}):null,jsxs(Box,{sx:{flex:1,minWidth:0},children:[o?jsx(Typography,{sx:{fontSize:"0.72rem",fontWeight:700,letterSpacing:"0.08em",color:"text.secondary"},children:o}):null,jsx(Typography,{sx:{fontSize:"1.05rem",fontWeight:800,lineHeight:1.25},children:e}),t?jsx(Typography,{sx:{mt:.5,fontSize:"0.9rem",color:"text.secondary",lineHeight:1.45},children:t}):null]}),s?jsx(Box,{"data-no-swipe":"true",...y,sx:{alignSelf:"center",display:"inline-flex",touchAction:"none"},children:jsx(IconButton,{size:"small",children:jsx(xv,{})})}):null]}),r.length>0?jsx(Stack,{direction:"row",spacing:1,useFlexGap:true,flexWrap:"wrap",children:r.map((z,j)=>jsx(Chip,{label:z,size:"small",sx:{borderRadius:999,fontWeight:700,bgcolor:"action.hover",color:"text.primary"}},j))}):null,n.length>0?jsx(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(110px, 1fr))",gap:1},children:n.map(z=>jsxs(Paper,{elevation:0,sx:{p:1.25,borderRadius:3,bgcolor:"action.hover",border:"1px solid",borderColor:"divider",color:"text.primary"},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:z.label}),jsx(Typography,{sx:{fontSize:"1rem",fontWeight:800,lineHeight:1.2},children:z.value})]},z.id))}):null,l,i]})})]})};var Kn=({label:e,onPress:t,emphasis:o="default"})=>jsx(Box,{component:"button",type:"button",onClick:t,sx:a=>({minHeight:72,borderRadius:3,border:"1px solid",borderColor:o==="primary"?"primary.main":"divider",background:o==="primary"?a.palette.primary.main:o==="danger"?a.palette.mode==="dark"?"rgba(239,68,68,0.18)":"rgba(239,68,68,0.10)":a.palette.mode==="dark"?"rgba(255,255,255,0.04)":"#fff",color:o==="primary"?"#fff":"text.primary",fontSize:"1.25rem",fontWeight:800,transition:"transform 120ms ease, box-shadow 160ms ease, background-color 160ms ease",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent","&:active":{transform:"scale(0.98)"}}),children:e}),$2=({value:e,defaultValue:t="",title:o,subtitle:a,placeholder:r="0",allowDecimal:n=false,allowNegative:i=false,maxLength:l,confirmLabel:d,clearLabel:s,backspaceLabel:c,onChange:g,onSubmit:f,onClose:u,sx:y})=>{let{t:I}=_(),[p,C]=useState(t),m=e??p,b=v=>{e===void 0&&C(v),g?.(v);},x=v=>{l&&m.length>=l||b(`${m}${v}`);},k=v=>{if(v==="00"){if(!m){b("0");return}x("00");return}x(v);},E=()=>{!n||m.includes(".")||b(m?`${m}.`:"0.");},R=()=>{if(i){if(m.startsWith("-")){b(m.slice(1));return}b(m?`-${m}`:"-");}},w=()=>{b(m.slice(0,-1));},B=()=>{b("");},T=()=>{f?.(m);};return jsx(Paper,{elevation:0,sx:{p:2,borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",...y},children:jsxs(Stack,{spacing:2,children:[jsxs(Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[jsxs(Box,{sx:{minWidth:0},children:[o?jsx(Typography,{sx:{fontSize:"1rem",fontWeight:800},children:o}):null,a?jsx(Typography,{sx:{mt:.5,fontSize:"0.86rem",color:"text.secondary"},children:a}):null]}),u?jsx(IconButton,{onClick:u,size:"small",children:jsx(wv,{})}):null]}),jsx(Paper,{elevation:0,sx:{p:2,borderRadius:3,border:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsx(Typography,{sx:{minHeight:38,fontSize:m?"1.9rem":"1.25rem",fontWeight:900,letterSpacing:"0.06em",color:m?"text.primary":"text.disabled"},children:m||r})}),jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1.25},children:[["1","2","3","4","5","6","7","8","9"].map(v=>jsx(Kn,{label:v,onPress:()=>k(v)},v)),jsx(Kn,{label:i?"+/-":"00",onPress:i?R:()=>k("00")}),jsx(Kn,{label:"0",onPress:()=>k("0")}),jsx(Kn,{label:n?".":c?String(c):"DEL",onPress:n?E:w})]}),jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1.25},children:[jsx(Box,{component:"button",type:"button",onClick:w,sx:{minHeight:64,borderRadius:3,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent"},children:jsxs(Stack,{direction:"row",spacing:1,justifyContent:"center",alignItems:"center",children:[jsx(Sv,{}),jsx(Typography,{sx:{fontWeight:700},children:c||"DEL"})]})}),jsx(Kn,{label:String(s||"CLR"),onPress:B,emphasis:"danger"}),jsx(Box,{component:"button",type:"button",onClick:T,sx:v=>({minHeight:64,borderRadius:3,border:"1px solid",borderColor:"primary.main",background:v.palette.primary.main,color:"#fff",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent"}),children:jsxs(Stack,{direction:"row",spacing:1,justifyContent:"center",alignItems:"center",children:[jsx(Iv,{}),jsx(Typography,{sx:{fontWeight:800},children:d||I("common.ok")})]})})]})]})})};var zu=({touchMode:e="comfortable",sx:t,...o})=>{let a=e==="expanded";return jsx(Box,{sx:{"& .MuiPaper-root":{borderRadius:4},"& .MuiAutocomplete-root":{minWidth:{xs:"100%",md:260}},"& .MuiAutocomplete-root .MuiInputBase-root":{backgroundColor:"transparent !important"},"& .MuiInputBase-root":{minHeight:a?56:50,borderRadius:3,fontSize:a?"0.98rem":"0.92rem"},"& .MuiInputBase-input":{py:a?1.6:1.25,fontSize:a?"0.98rem":"0.92rem"},"& .MuiInputLabel-root":{fontSize:a?"0.95rem":"0.88rem"},"& .MuiButton-root":{minHeight:a?48:44,px:a?2.25:1.75,borderRadius:3,fontSize:a?"0.95rem":"0.88rem",fontWeight:700},"& .MuiIconButton-root":{width:a?40:36,height:a?40:36},"& .MuiMenuItem-root":{minHeight:a?44:38,fontSize:a?"0.95rem":"0.88rem"},"& .MuiListSubheader-root":{py:1},"& .MuiCheckbox-root":{p:a?1:.75},"& .MuiFormControlLabel-label":{fontSize:a?"0.95rem":"0.88rem"},"& .MuiDialog-paper":{borderRadius:4},"& .MuiDialogTitle-root":{fontSize:a?"1.05rem":"0.98rem",fontWeight:800},"& .MuiDialogContent-root .MuiInputBase-root":{minHeight:52},'& .MuiGrid-root > .MuiGrid-item, & .MuiGrid-root > .MuiGrid-sizeXs-1, & .MuiGrid-root > [class*="MuiGrid-grid-"]':{minWidth:0},...t},children:jsx(ja,{...o})})};var Bv=(e,t,o)=>{if(o?.(t),!!t.href){if(t.href.startsWith("http://")||t.href.startsWith("https://")){window.open(t.href,"_blank");return}e.push(t.href);}},$u=({items:e,selectedId:t,orientation:o="auto",onItemSelect:a,sx:r})=>{let n=useTheme$1(),[i,l]=useState(false);useEffect(()=>{l(true);},[]);let d=useMediaQuery("(orientation: portrait)",{noSsr:true}),s=useMediaQuery(n.breakpoints.down("md"),{noSsr:true}),c=o==="auto"?d||s?"portrait":"landscape":o,g=useRouter();return jsx(Box,{sx:{display:"grid",gridTemplateColumns:!i||c==="portrait"?"repeat(2, minmax(0, 1fr))":"repeat(auto-fit, minmax(180px, 1fr))",gap:1.5,...r},children:e.map(f=>{let u=f.id===t,y=f.color||(u?n.palette.primary.main:n.palette.divider);return jsx(Paper,{elevation:0,sx:{overflow:"hidden",borderRadius:4,border:"1px solid",borderColor:u?"primary.main":"divider",boxShadow:u?"0 18px 40px rgba(37, 99, 235, 0.16)":"none",bgcolor:n.palette.mode==="dark"?"rgba(30,41,59,0.6)":"background.paper"},children:jsx(Box,{component:"button",type:"button",disabled:f.disabled,onClick:()=>Bv(g,f,a),sx:{width:"100%",p:2,minHeight:c==="portrait"?156:148,display:"block",border:0,background:"transparent",textAlign:"left",cursor:f.disabled?"not-allowed":"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent",color:"text.primary"},children:jsxs(Stack,{spacing:1.5,sx:{height:"100%"},children:[jsxs(Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[jsx(Box,{sx:{width:44,height:44,borderRadius:3,display:"grid",placeItems:"center",color:u?"#fff":"text.primary",background:u?y:"action.hover"},children:f.icon||jsx(Typography,{sx:{fontSize:"1rem",fontWeight:900},children:f.title.slice(0,1).toUpperCase()})}),f.badge!==void 0?jsx(Box,{sx:{minWidth:34,px:1,py:.4,borderRadius:999,bgcolor:u?"primary.main":"action.hover",color:u?"#fff":"text.secondary",textAlign:"center",fontWeight:800,fontSize:"0.8rem"},children:f.badge}):null]}),jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsx(Typography,{sx:{fontSize:"1rem",fontWeight:800,lineHeight:1.25},children:f.title}),f.caption?jsx(Typography,{sx:{mt:.5,fontSize:"0.74rem",fontWeight:700,color:"text.secondary"},children:f.caption}):null,f.description?jsx(Typography,{sx:{mt:.75,fontSize:"0.84rem",lineHeight:1.45,color:"text.secondary"},children:f.description}):null]})]})})},f.id)})})};var Uu=(e,t)=>t.trim()?e.reduce((o,a)=>{let r=a.title?.toLowerCase().includes(t.toLowerCase())||a.label?.toLowerCase().includes(t.toLowerCase())||a.description?.toLowerCase().includes(t.toLowerCase()),n=a.children?Uu(a.children,t):[];return (r||n.length>0)&&o.push({...a,children:n.length>0?n:a.children}),o},[]):e,Kv=e=>{let t=new Set,o=a=>{a.forEach(r=>{r.children?.length&&(t.add(r.id),o(r.children));});};return o(e),t},Ku=({collapsed:e=false,onToggle:t,className:o="",maxHeight:a,menuData:r=[],colorMode:n="light",orientation:i="auto",headerSlot:l,footerSlot:d,activeHref:s,onItemSelect:c})=>{let{t:g}=_(),f=useTheme$1(),u=useMediaQuery("(orientation: portrait)"),y=useMediaQuery(f.breakpoints.down("md")),I=i==="auto"?u||y?"portrait":"landscape":i,p=n==="dark",C=useRouter(),m=usePathname(),[b,x]=useState(""),[k,E]=useState(new Set),R=useMemo(()=>Uu(r,b),[r,b]),w=useMemo(()=>b.trim()?Kv(R):k,[k,R,b]);useEffect(()=>{e&&E(new Set);},[e]);let B=P=>P.appurl||P.href||"",T=P=>{c?.(P);let F=B(P);if(F){if(F.startsWith("http://")||F.startsWith("https://")){window.open(F,"_blank");return}C.push(F);}},v=P=>{let F=!!P.children?.length;if(e&&F){t?.();return}if(F){E(W=>{let z=new Set(W);return z.has(P.id)?z.delete(P.id):z.add(P.id),z});return}T(P);},D=P=>{let F=s||m,W=B(P);return !!(W&&F===W)},S=(P,F=0)=>{let W=!!P.children?.length,z=w.has(P.id),j=D(P);return jsx(Box,{sx:{pl:F===0?0:1.5},children:jsxs(Paper,{elevation:0,sx:{mb:1,overflow:"hidden",borderRadius:3,border:"1px solid",borderColor:j?"primary.main":"divider",bgcolor:j?"action.selected":"background.paper"},children:[jsxs(Box,{component:"button",type:"button",onClick:()=>v(P),sx:{width:"100%",px:1.5,py:1.4,display:"flex",alignItems:"center",gap:1.25,border:0,background:"transparent",textAlign:"left",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent"},children:[jsx(Avatar,{variant:"rounded",sx:{width:40,height:40,bgcolor:j?"primary.main":"action.hover",color:j?"#fff":"text.primary"},children:P.icon||(P.title||P.label||"?").slice(0,1).toUpperCase()}),jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.95rem",fontWeight:800,lineHeight:1.2},children:P.title||P.label}),P.description?jsx(Typography,{sx:{mt:.4,fontSize:"0.78rem",color:"text.secondary",lineHeight:1.35},children:P.description}):null]}),W?jsx(Gv,{sx:{transform:z?"rotate(180deg)":"rotate(0deg)",transition:"transform 180ms ease"}}):jsx(Uv,{color:"action"})]}),W?jsx(Collapse,{in:z,children:jsx(Box,{sx:{px:1.25,pb:1.25},children:P.children?.map(ie=>S(ie,F+1))})}):null]})},P.id)};return e?jsx(Paper,{elevation:0,className:o,sx:{width:I==="portrait"?"100%":88,p:1,borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:p?"#101828":"rgba(255,255,255,0.88)",maxHeight:a?`${a}px`:void 0,overflowY:"auto"},children:jsxs(Stack,{spacing:1,children:[jsx(IconButton,{onClick:t,sx:{width:48,height:48,alignSelf:"center",bgcolor:"action.hover"},title:g("navigation.expand"),children:jsx(Hv,{})}),r.map(P=>jsx(IconButton,{onClick:()=>v(P),sx:{width:56,height:56,alignSelf:"center",borderRadius:3,bgcolor:D(P)?"primary.main":"action.hover",color:D(P)?"#fff":"text.primary"},children:P.icon||(P.title||P.label||"?").slice(0,1).toUpperCase()},P.id))]})}):jsx(Paper,{elevation:0,className:o,sx:{width:I==="portrait"?"100%":320,p:1.25,borderRadius:5,border:"1px solid",borderColor:"divider",bgcolor:p?"#101828":"rgba(255,255,255,0.88)",maxHeight:a?`${a}px`:void 0,overflow:"hidden",display:"flex",flexDirection:"column"},children:jsxs(Stack,{spacing:1.25,sx:{flex:1,minHeight:0},children:[jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsx(TextField,{value:b,onChange:P=>x(P.target.value),placeholder:g("navigation.searchPlaceholder"),size:"small",fullWidth:true,InputProps:{startAdornment:jsx($v,{fontSize:"small",color:"action"})}}),I==="landscape"&&!e?jsx(IconButton,{onClick:t,sx:{bgcolor:"action.hover"},children:jsx(Wv,{})}):null]}),l,jsx(Box,{sx:{flex:1,minHeight:0,overflowY:"auto",pr:.25},children:R.length>0?R.map(P=>S(P)):jsx(Typography,{sx:{p:2,fontSize:"0.88rem",color:"text.secondary",textAlign:"center"},children:g("navigation.noMatch")})}),d]})})};var Ju=(e,t)=>{let o=t[e.id];if(e.render)return e.render(o,t);if(o==null||o==="")return "--";if(e.numeric){if(typeof o=="number")return o.toLocaleString();if(typeof o=="string"&&o.trim()!==""&&!Number.isNaN(Number(o)))return Number(o).toLocaleString()}return String(o)},Xv=e=>st__default.isValidElement(e)?jsx(Box,{sx:{display:"inline-flex",alignItems:"center"},children:e}):jsx(Typography,{sx:{mt:.2,fontSize:"0.88rem",fontWeight:800},children:e}),Yv=(e,t)=>{let o=t[e.id];if(o==null||o==="")return "--";if(e.numeric){if(typeof o=="number")return o.toLocaleString();if(typeof o=="string"&&o.trim()!==""&&!Number.isNaN(Number(o)))return Number(o).toLocaleString()}return String(o)},Jv=({summaryRow:e,visibleColumns:t,columns:o})=>{let a=o.filter(r=>t.includes(r.id)&&e[r.id]!=="");return a.length===0?null:jsx(Paper,{elevation:0,sx:{p:1.5,borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsxs(Stack,{spacing:1,children:[jsx(Typography,{sx:{fontSize:"0.82rem",fontWeight:800,color:"text.secondary"},children:"Summary"}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(132px, 1fr))",gap:1},children:a.map(r=>jsxs(Paper,{elevation:0,sx:{p:1.1,borderRadius:3,border:"1px solid",borderColor:"divider"},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:r.label}),jsx(Typography,{sx:{mt:.25,fontSize:"0.96rem",fontWeight:800},children:e[r.id]})]},`summary-${r.id}`))})]})})},eC=e=>{let{t}=_(),o=useTheme$1(),{title:a,showToolbar:r=true,selectionMode:n,selected:i=[],onSelectionChange:l,actions:d,extraTools:s,fitContainer:c=false,fullWidth:g=false,maxHeight:f,loading:u=false,rowsPerPageOptions:y=[20,50,100,-1],onLayoutSave:I,filterConfig:p,rowKey:C,tableKey:m="default",graphReport:b,quickCreate:x,quickEdit:k,quickDelete:E,serviceUrl:R,orientation:w="auto",cardTitleField:B,cardSubtitleFields:T,toolbarSlot:v,emptyState:D,rowHeight:S="comfortable",cardActionSlot:P,renderCardFooter:F,onRowClick:W}=e,z=a||t("table.title.default"),j=useMediaQuery("(orientation: portrait)"),ie=useMediaQuery(o.breakpoints.down("md")),Y=w==="auto"?j||ie?"portrait":"landscape":w,{columns:te,filterText:Z,setFilterText:Ze,visibleColumns:at,showSummary:He,setShowSummary:re,summaryColumns:Ie,grouping:Te,setGrouping:je,expandedGroups:rt,groupAnchorEl:ze,setGroupAnchorEl:Ye,summaryAnchorEl:uo,setSummaryAnchorEl:Gt,anchorEl:Ue,setAnchorEl:Tt,contextMenu:At,sortedAndFilteredRows:ht,summaryRow:H,visibleRows:pe,page:se,setPage:ue,rowsPerPage:Ge,setRowsPerPage:Me,totalDisplayCount:ao,setSelected:mo,handleClick:go,toggleSummaryColumn:fo,handleExport:ho,handleCloseContextMenu:ke,toggleColumnVisibility:de,toggleGroupExpand:yt,toggleGroupField:Pe,handleExpandGroupRecursively:Bt,handleCollapseGroupRecursively:yo,handleLayoutLoad:Ba,handleVariantLoad:V,handleLayoutSave:O,effectiveAppId:U,currentLayoutData:me,currentLayoutId:fe,layoutIdToLoad:we,graphReportOpen:ce,handleOpenGraphReport:Re,handleCloseGraphReport:ye}=zi(e),De=b?.enabled??false,Se=De&&(b?.interaction?.enabled??true),he=wi(),Ce=C||"id",Ft=st__default.useMemo(()=>({borderRadius:999,fontWeight:700,borderColor:alpha(o.palette.divider,o.palette.mode==="dark"?.55:.3),bgcolor:o.palette.mode==="dark"?alpha(o.palette.common.white,.06):alpha(o.palette.background.paper,.92),color:o.palette.text.primary,"& .MuiChip-label":{px:1.05}}),[o]),bo=st__default.useMemo(()=>({...Ft,borderColor:alpha(o.palette.primary.main,o.palette.mode==="dark"?.42:.24),bgcolor:o.palette.mode==="dark"?alpha(o.palette.primary.main,.16):alpha(o.palette.primary.main,.08)}),[Ft,o]),ut=st__default.useMemo(()=>{let N=new Set(i);return ht.filter(Q=>N.has(Q?.[Ce]))},[Ce,i,ht]),bt=ut.length===1?ut[0]:null,ro=!!x?.enabled,da=!!k?.enabled,ur=!!E?.enabled,xo=x?.fields,Ut=x?.excludeFields||[],Fa=x?.initialValues||{},Go=k?.fields,Et=k?.excludeFields||[],Kt=k?.editableFields||[],Pt=k?.nonEditableFields||[],Ae=k?.primaryKeys?.length?k.primaryKeys:[Ce],[Uo,Bo]=st__default.useState(false),[Ko,Ea]=st__default.useState(false),[Fo,La]=st__default.useState({}),[Na,Eo]=st__default.useState(false),[qo,pa]=st__default.useState(false),[Lt,vo]=st__default.useState({}),[_o,no]=st__default.useState(false),[Lo,za]=st__default.useState(false),mr=u||Ko||qo||Lo,ua=st__default.useMemo(()=>{let N=[...te];if(Array.isArray(xo)&&xo.length>0){let Q=new Set(xo);N=N.filter(G=>Q.has(G.id));}if(Ut.length>0){let Q=new Set(Ut);N=N.filter(G=>!Q.has(G.id));}return N.filter(Q=>!!Q?.id)},[te,Ut,xo]),Va=st__default.useMemo(()=>{let N=[...te];if(Array.isArray(Go)&&Go.length>0){let Q=new Set(Go);N=N.filter(G=>Q.has(G.id));}if(Et.length>0){let Q=new Set(Et);N=N.filter(G=>!Q.has(G.id));}return N.filter(Q=>!!Q?.id)},[te,Et,Go]),Zo=st__default.useMemo(()=>new Set(Ae),[Ae]),Ot=st__default.useMemo(()=>new Set(Kt),[Kt]),Co=st__default.useMemo(()=>new Set(Pt),[Pt]),gr=st__default.useCallback(N=>Ot.size>0?Ot.has(N):!(Co.has(N)||Zo.has(N)),[Ot,Co,Zo]);st__default.useEffect(()=>{!ce&&he.hasActiveFilters&&he.clearAll();},[he,ce]);let Oa=()=>{let N={};ua.forEach(Q=>{N[Q.id]=Fa[Q.id]??"";}),La(N),Bo(true);},fr=(N,Q)=>{La(G=>({...G,[N]:Q}));},hr=async()=>{if(!x?.onSubmit){Bo(false);return}try{Ea(!0),await x.onSubmit(Fo),Bo(!1);}finally{Ea(false);}},yr=()=>{if(!bt)return;let N={};Va.forEach(G=>{N[G.id]=bt[G.id]??"";});let Q=k?.getInitialValues?{...N,...k.getInitialValues(bt)}:N;vo(Q),Eo(true);},qt=(N,Q)=>{vo(G=>({...G,[N]:Q}));},br=async()=>{if(bt){if(!k?.onSubmit){Eo(false);return}try{pa(!0),await k.onSubmit(Lt,bt),Eo(!1);}finally{pa(false);}}},xr=()=>{ut.length!==0&&no(true);},$a=async()=>{if(ut.length===0){no(false);return}if(!E?.onConfirm){no(false),mo([]),l?.([]);return}try{za(!0),await E.onConfirm(ut),no(!1),mo([]),l?.([]);}finally{za(false);}},jo=ht,{fieldMapping:ma}=Mr({rows:jo,config:{...b,title:b?.title||`${z} ${t("graph.reportTitle")}`}}),ga=st__default.useMemo(()=>Se?he.applyRows(jo,ma):jo,[ma,he,Se,jo]),{model:h}=Mr({rows:ga,config:{...b,title:b?.title||`${z} ${t("graph.reportTitle")}`,fieldMapping:ma}}),M=h.table.columns.map(N=>({id:N.id,label:N.label,align:N.align||"left",minWidth:120,numeric:N.align==="right"})),A=U?jsx(Ei,{appId:U,tableKey:m,currentLayoutData:me,onLayoutLoad:Ba,targetLayoutId:we,activeLayoutId:fe,serviceUrl:R??p?.serviceUrl}):null,$=te.filter(N=>at.includes(N.id)),X=$.find(N=>N.id===B)||$[0],le=T?.map(N=>$.find(Q=>Q.id===N)).filter(Boolean)||$.filter(N=>N.id!==X?.id).slice(0,Y==="portrait"?2:3),L=$.filter(N=>N.id!==X?.id&&!le.some(Q=>Q.id===N.id)),q=[v,s].filter(Boolean),K=jsxs(Fragment,{children:[jsx(ai,{groupAnchorEl:ze,setGroupAnchorEl:Ye,grouping:Te,setGrouping:je,columns:te,toggleGroupField:Pe}),jsx(ri,{anchorEl:Ue,setAnchorEl:Tt,columns:te,visibleColumns:at,toggleColumnVisibility:de}),jsx(ni,{anchorEl:uo,setAnchorEl:Gt,showSummary:He,setShowSummary:re,columns:te,summaryColumns:Ie,toggleSummaryColumn:fo}),jsx(ii,{contextMenu:At,handleCloseContextMenu:ke,columns:te,visibleColumns:at,toggleColumnVisibility:de})]}),Oe=(N,Q,G)=>{let oe=i.includes(Q),Be=Y==="portrait"?"repeat(2, minmax(0, 1fr))":"repeat(auto-fit, minmax(140px, 1fr))",No=G%2===0?alpha(o.palette.primary.main,o.palette.mode==="dark"?.09:.04):alpha(o.palette.primary.main,o.palette.mode==="dark"?.05:.022),Nm=alpha(o.palette.divider,.22);return jsx(Paper,{elevation:0,onClick:()=>{go({},N),W?.(N);},sx:{p:S==="compact"?1.25:1.5,borderRadius:4,border:"0.5px solid",borderColor:oe?alpha(o.palette.primary.main,.38):Nm,background:oe?`linear-gradient(135deg, ${alpha(o.palette.primary.main,.13)}, ${alpha(o.palette.primary.main,.06)})`:`linear-gradient(135deg, ${No}, ${alpha(o.palette.primary.main,.015)})`,boxShadow:oe?`0 12px 30px ${alpha(o.palette.primary.main,.2)}`:`0 3px 10px ${alpha(o.palette.common.black,.045)}`,cursor:"pointer",position:"relative",overflow:"hidden",transition:"border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease, background 160ms ease","&::before":{content:'""',position:"absolute",left:0,top:0,bottom:0,width:4,background:oe?o.palette.primary.main:G%2===0?alpha(o.palette.primary.main,.26):alpha(o.palette.text.primary,.16)},"&:hover":{boxShadow:`0 10px 20px ${alpha(o.palette.primary.main,.12)}`,transform:"translateY(-1px)"},"&:active":{transform:"scale(0.995)"}},children:jsxs(Stack,{spacing:1.25,children:[jsxs(Stack,{direction:"row",spacing:1.25,alignItems:"flex-start",children:[n?jsx(Checkbox,{checked:oe,onClick:_t=>_t.stopPropagation(),onChange:()=>go({},N),sx:{mt:-0.6,ml:-0.6}}):null,jsxs(Box,{sx:{flex:1,minWidth:0},children:[X?jsx(Typography,{sx:{fontSize:"1rem",fontWeight:900,lineHeight:1.25},children:Ju(X,N)}):null,le.length>0?jsx(Stack,{direction:"row",spacing:.75,useFlexGap:true,flexWrap:"wrap",sx:{mt:.75},children:le.map(_t=>jsx(Chip,{label:`${_t.label}: ${Yv(_t,N)}`,size:"small",variant:"outlined",sx:Ft},`${Q}-${_t.id}`))}):null]}),P?jsx(Box,{onClick:_t=>_t.stopPropagation(),children:P(N)}):null]}),L.length>0?jsx(Box,{sx:{display:"grid",gridTemplateColumns:Be,gap:1},children:L.map(_t=>jsxs(Paper,{elevation:0,sx:{p:1,borderRadius:3,bgcolor:o.palette.mode==="dark"?alpha(o.palette.background.default,.7):alpha(o.palette.background.paper,.92),border:"0.1px solid",borderColor:alpha(o.palette.divider,.24)},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:_t.label}),Xv(Ju(_t,N))]},`${Q}-${_t.id}-detail`))}):null,F?jsxs(Fragment,{children:[jsx(Divider,{}),jsx(Box,{onClick:_t=>_t.stopPropagation(),children:F(N)})]}):null]})},Q)};return jsxs(Box,{sx:{width:g?"100%":"auto",mb:c?0:2,...c?{flex:1,display:"flex",flexDirection:"column",minHeight:0,height:"100%",overflow:"hidden"}:{}},children:[p?jsx(Box,{sx:{mb:2},children:jsx(zu,{...p,onVariantLoad:N=>{V(N),p.onVariantLoad?.(N);},appId:p.appId,tableKey:m,currentLayout:[{tableKey:m,layoutData:me}],currentLayoutId:fe,layoutRefs:[{tableKey:m,layoutId:fe}],variantService:p.variantService,serviceUrl:R??p.serviceUrl,touchMode:Y==="portrait"?"expanded":"comfortable"})}):null,jsxs(Paper,{sx:{width:g?"100%":"auto",mb:c?0:2,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",bgcolor:"transparent",backgroundImage:"none",boxShadow:"none","&::before":mr?{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"3px",background:"linear-gradient(90deg, rgba(25, 118, 210, 0) 0%, rgba(25, 118, 210, 0.25) 25%, rgba(25, 118, 210, 1) 50%, rgba(25, 118, 210, 0.25) 75%, rgba(25, 118, 210, 0) 100%)",backgroundSize:"220% 100%",animation:"cTableTopMarquee 1.2s linear infinite",zIndex:6,pointerEvents:"none"}:{},"@keyframes cTableTopMarquee":{"0%":{backgroundPosition:"220% 0"},"100%":{backgroundPosition:"-120% 0"}},...f?{height:f}:c?{flex:1,minHeight:0,height:"100%"}:{}},children:[r?jsx(Box,{sx:{"& .MuiToolbar-root":{minHeight:60,alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",rowGap:1,columnGap:1},"& .MuiToolbar-root > :nth-of-type(1)":{width:{xs:"100%",md:"auto"},"& .MuiTextField-root":{width:{xs:"100%",md:300}}},"& .MuiToolbar-root > :nth-of-type(2)":{flexShrink:0},"& .MuiToolbar-root > :nth-of-type(3)":{display:{xs:"none",md:"block"}},"& .MuiToolbar-root > :nth-of-type(4)":{ml:"auto",justifyContent:"flex-end",flexWrap:"wrap"},"& .MuiInputBase-root":{minHeight:46},"& .MuiIconButton-root":{width:40,height:40},"& .MuiTypography-root":{fontSize:"0.9rem"},"& .MuiButtonBase-root":{borderRadius:2.5}},children:jsx(Jn,{filterText:Z,setFilterText:Ze,onRowsPerPageChange:Me,rowsPerPage:Ge,rowsPerPageOptions:y,page:se,count:ao,onPageChange:ue,actions:d,extraTools:q,grouping:Te,setGroupAnchorEl:Ye,showSummary:He,setShowSummary:re,setAnchorEl:Tt,setSummaryAnchorEl:Gt,handleExport:ho,showCreateButton:ro,onOpenCreateDialog:Oa,showEditButton:da,onOpenEditDialog:yr,editDisabled:ut.length!==1,showDeleteButton:ur,onOpenDeleteConfirm:xr,deleteDisabled:ut.length===0,onLayoutSave:I||p?.variantService&&p?.appId?O:void 0,loading:u,layoutManager:A,onOpenGraphReport:De?Re:void 0})}):null,jsx(Box,{sx:{flex:1,minHeight:0,overflow:"auto",p:1.5},children:jsxs(Stack,{spacing:1.25,children:[pe.length===0&&!u?D||jsx(Paper,{elevation:0,sx:{p:4,borderRadius:4,border:"1px dashed",borderColor:"divider",textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.92rem",color:"text.secondary"},children:t("common.noData")})}):null,pe.map((N,Q)=>{if(N.type==="group"){let Be=rt.has(N.id);return jsx(Paper,{elevation:0,sx:{borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsxs(Box,{component:"button",type:"button",onClick:()=>yt(N.id),sx:{width:"100%",px:1.5,py:1.3,border:0,background:"transparent",display:"flex",alignItems:"center",gap:1,textAlign:"left",cursor:"pointer",appearance:"none",WebkitAppearance:"none",color:"text.primary"},children:[Be?jsx(Gv,{}):jsx(Uv,{}),jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsxs(Typography,{sx:{fontSize:"0.94rem",fontWeight:800},children:[N.field,": ",N.value]}),jsxs(Typography,{sx:{mt:.2,fontSize:"0.76rem",color:"text.secondary"},children:[N.count," records"]})]}),Te.length>1&&N.level<Te.length-1?jsxs(Stack,{direction:"row",spacing:.5,children:[jsx(Chip,{size:"small",label:t("table.group.expandAll"),onClick:No=>{No.stopPropagation(),Bt(N.id);},sx:bo}),jsx(Chip,{size:"small",label:t("table.group.collapseAll"),onClick:No=>{No.stopPropagation(),yo(N.id);},sx:bo})]}):null]})},N.id)}let G=N.data||N,oe=N.id||G[Ce]||Q;return Oe(G,oe,Q)}),He?jsx(Jv,{summaryRow:H,visibleColumns:at,columns:te}):null,u?jsx(Typography,{sx:{py:1,fontSize:"0.84rem",color:"text.secondary",textAlign:"center"},children:t("common.loading")}):null]})})]}),ro?jsxs(Dialog,{open:Uo,onClose:()=>!Ko&&Bo(false),fullWidth:true,maxWidth:"sm",children:[jsx(DialogTitle,{sx:{fontSize:"1rem",fontWeight:800},children:x?.title||t("quickCreate.createWithTitle",{title:z})}),jsx(DialogContent,{sx:{pt:"8px !important"},children:jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[ua.map(N=>{let Q=N.type==="number"||N.numeric?"number":N.type==="date"?"date":"text";return jsx(TextField,{label:N.label||N.id,value:Fo[N.id]??"",onChange:G=>fr(N.id,G.target.value),type:Q,fullWidth:true,InputLabelProps:{shrink:Q==="date"?true:void 0}},`quick-create-${N.id}`)}),x?.description?jsx(Alert,{severity:"info",children:x.description}):null]})}),jsxs(DialogActions,{sx:{px:3,pb:2},children:[jsx(Button,{onClick:()=>Bo(false),disabled:Ko,children:x?.cancelLabel||t("common.cancel")}),jsx(Button,{onClick:hr,variant:"contained",disabled:Ko,children:x?.submitLabel||t("common.save")})]})]}):null,da?jsxs(Dialog,{open:Na,onClose:()=>!qo&&Eo(false),fullWidth:true,maxWidth:"sm",children:[jsx(DialogTitle,{sx:{fontSize:"1rem",fontWeight:800},children:k?.title||t("quickEdit.editWithTitle",{title:z})}),jsx(DialogContent,{sx:{pt:"8px !important"},children:jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[Va.map(N=>{let Q=N.type==="number"||N.numeric?"number":N.type==="date"?"date":"text";return jsx(TextField,{label:N.label||N.id,value:Lt[N.id]??"",onChange:G=>qt(N.id,G.target.value),type:Q,disabled:!gr(N.id),fullWidth:true,InputLabelProps:{shrink:Q==="date"?true:void 0}},`quick-edit-${N.id}`)}),k?.description?jsx(Alert,{severity:"info",children:k.description}):null]})}),jsxs(DialogActions,{sx:{px:3,pb:2},children:[jsx(Button,{onClick:()=>Eo(false),disabled:qo,children:k?.cancelLabel||t("common.cancel")}),jsx(Button,{onClick:br,variant:"contained",disabled:qo||!bt,children:k?.submitLabel||t("common.save")})]})]}):null,ur?jsx(nn,{open:_o,type:"warning",title:E?.title||t("quickDelete.confirmTitle"),message:E?.message||(ut.length>1?t("quickDelete.confirmMessageMultiple",{count:ut.length}):t("quickDelete.confirmMessageSingle")),confirmText:E?.confirmText||t("common.delete"),cancelText:E?.cancelText||t("common.cancel"),onClose:()=>!Lo&&no(false),onConfirm:$a}):null,K,De?jsx(ki,{open:ce,onClose:ye,model:h,aiAssistant:b?.aiAssistant,interaction:Se?{enabled:true,filters:he.filters,fieldMapping:ma,onPrimaryDimensionClick:N=>he.setFilter("primaryDimension",N),onSecondaryDimensionClick:N=>he.setFilter("secondaryDimension",N),onStatusClick:N=>he.setFilter("status",N),onClearFilter:he.clearFilter,onClearAll:he.clearAll}:void 0,tableContent:jsx(eC,{appId:U||"graph-report-internal",title:t("graph.dataBody"),columns:M,rows:h.table.rows,rowKey:"id",fullWidth:true,maxHeight:"420px",rowsPerPage:20,rowsPerPageOptions:[20,50,100],graphReport:{enabled:false},showSummary:false})}):null]})};var NB=({appTitle:e,children:t,menuData:o=[],workloadItems:a=[],workloadSelectedId:r,showNavigation:n=true,showWorkloadNav:i=true,orientation:l="auto",logo:d,headerSlot:s,actionSlot:c,portraitBottomSlot:g,contentSx:f,containerSx:u,user:y,onSearch:I,defaultNavigationOpen:p,navOpen:C,onNavOpenChange:m,onWorkloadSelect:b,locale:x="en",localeLabel:k,localeOptions:E,onLocaleChange:R,onUserSetting:w,onUserLogout:B,userMenuItems:T,leftHeaderSlot:v,rightHeaderSlot:D})=>{let S="orbcafe:page-layout-mode",[P,F]=useState("system"),[W,z]=useState("light"),[j,ie]=useState(false),[Y,te]=useState(false),Z=P==="system"?Y?W:"light":P;useEffect(()=>{ie(true);},[]),useEffect(()=>{try{let At=window.localStorage.getItem(S);(At==="light"||At==="dark"||At==="system")&&F(At);}catch{}te(true);let Ue=window.matchMedia("(prefers-color-scheme: dark)"),Tt=()=>{z(Ue.matches?"dark":"light");};return Tt(),Ue.addEventListener("change",Tt),()=>Ue.removeEventListener("change",Tt)},[]),useEffect(()=>{if(Y)try{window.localStorage.setItem(S,P);}catch{}},[Y,P]),useEffect(()=>{Z==="dark"?(document.documentElement.classList.add("dark"),document.documentElement.style.colorScheme="dark"):(document.documentElement.classList.remove("dark"),document.documentElement.style.colorScheme="light");},[Z]);let Ze=useMemo(()=>createTheme$1({palette:Z==="dark"?{mode:"dark",primary:{main:"#93c5fd"},background:{default:"#060913",paper:"#101826"},text:{primary:"#f8fafc",secondary:"rgba(226,232,240,0.74)"},divider:"rgba(148,163,184,0.18)",action:{hover:"rgba(148,163,184,0.10)",selected:"rgba(59,130,246,0.18)"}}:{mode:"light",background:{default:"#eef3f8",paper:"#ffffff"}},components:{MuiCssBaseline:{styleOverrides:{body:{backgroundColor:Z==="dark"?"#060913":"#eef3f8"}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}}}}),[Z]),at=useMediaQuery("(orientation: portrait)"),He=useMediaQuery(Ze.breakpoints.down("md")),re=l==="auto"?!j||at||He?"portrait":"landscape":l,[Ie,Te]=useState({landscape:p??true,portrait:false}),je=Ie[re],rt=C??je,ze=Ue=>{C===void 0&&Te(Tt=>({...Tt,[re]:Ue})),m?.(Ue);},Ye=jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[!j||n&&re==="portrait"?jsx(IconButton,{onClick:()=>ze(!rt),sx:{bgcolor:"action.hover"},children:jsx(Hv,{})}):null,v]}),uo=jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[c,D]}),Gt=jsx(Ku,{collapsed:re==="landscape"?!rt:false,onToggle:()=>ze(!rt),menuData:o,orientation:re,colorMode:Z,maxHeight:re==="landscape"?900:void 0});return jsx(ThemeProvider$1,{theme:Ze,children:jsx(Yn,{locale:x,children:jsxs(Box,{sx:[Ue=>({minHeight:"100vh",display:"flex",flexDirection:"column",background:Ue.palette.mode==="dark"?"linear-gradient(180deg, #0A0A0A 0%, #141414 55%, #1A1A1A 100%)":Ue.palette.background.default}),...Array.isArray(u)?u:[u]],children:[jsx(ts,{appTitle:e,logo:d===void 0?null:d,mode:P,onToggleMode:()=>F(Ue=>Ue==="system"?"dark":Ue==="dark"?"light":"system"),locale:x,localeLabel:k,localeOptions:E,onLocaleChange:R,user:y,onUserSetting:w,onUserLogout:B,userMenuItems:T,onSearch:I,leftSlot:Ye,rightSlot:uo}),s?jsx(Box,{sx:{px:{xs:2,md:3},py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:s}):null,jsxs(Box,{sx:{flex:1,minHeight:0,display:"flex",position:"relative"},children:[j&&n&&re==="landscape"?jsx(Box,{sx:{p:1.5,pr:0,flexShrink:0},children:Gt}):null,!j||n&&re==="portrait"?jsx(Drawer,{open:rt,onClose:()=>ze(false),PaperProps:{sx:{width:"min(88vw, 360px)",p:1.25,bgcolor:"transparent",boxShadow:"none"}},children:Gt}):null,jsx(Box,{sx:{flex:1,minWidth:0,minHeight:0,overflow:"auto",p:1.5,...f},children:jsxs(Stack,{spacing:1.5,children:[i&&a.length>0?jsx($u,{items:a,selectedId:r,orientation:re,onItemSelect:b}):null,jsx(Paper,{elevation:0,sx:{flex:1,minHeight:re==="portrait"?420:560,p:{xs:1.25,md:1.5},borderRadius:5,border:"1px solid",borderColor:"divider",bgcolor:Ze.palette.mode==="dark"?"rgba(15,23,42,0.72)":"rgba(255,255,255,0.72)",backdropFilter:"blur(12px)",color:"text.primary"},children:t})]})})]}),re==="portrait"&&g?jsxs(Fragment,{children:[jsx(Divider,{}),jsx(Box,{sx:{p:1.5},children:g})]}):null]})})})};var om=dC(()=>import('./COrbCanvas-EGX5NO3Y.mjs').then(e=>e.COrbCanvas),{ssr:false,loading:()=>jsx("div",{className:"h-full w-full bg-transparent"})});function xc({isRecording:e}){return jsx(AnimatePresence,{children:e&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"pointer-events-none absolute inset-0 z-0 overflow-hidden",children:jsxs("div",{className:"relative flex h-full w-full items-center justify-center",children:[jsx("div",{className:"absolute inset-0",children:jsx(om,{hue:0,hoverIntensity:.5,rotateOnHover:true,forceHoverState:true,backgroundColor:"transparent"})}),jsx("div",{className:"relative z-10 h-full w-1/3 mix-blend-overlay opacity-80",children:jsx(om,{hue:10,hoverIntensity:.8,rotateOnHover:true,forceHoverState:true,backgroundColor:"transparent"})})]})})})}var WB=xc;function Ps({onTextUpdate:e,onComplete:t,onError:o,wsUrl:a="ws://localhost:8765",silenceThresholdMs:r=2e3,minVolumeRms:n=.015}){let[i,l]=useState(false),d=useRef(null),s=useRef(null),c=useRef(null),g=useRef(null),f=useRef(null),u=useRef(0),y=useRef(false),I=useRef(false),p=useCallback(()=>{d.current&&(d.current.close(),d.current=null),g.current&&(g.current.disconnect(),g.current=null),f.current&&(f.current.disconnect(),f.current=null),s.current&&(s.current.getTracks().forEach(b=>b.stop()),s.current=null),c.current&&(c.current.close(),c.current=null),I.current=false,l(false);},[]),C=useCallback(()=>{y.current||(y.current=true,d.current?.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"stop"})),setTimeout(p,500));},[p]),m=useCallback(async()=>{if(!(i||I.current)){I.current=true,y.current=false,u.current=Date.now();try{let b=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:16e3,echoCancellation:!0,noiseSuppression:!0}});s.current=b;let x=new WebSocket(a);d.current=x,x.onopen=()=>{l(!0),I.current=!1;},x.onmessage=B=>{try{let T=JSON.parse(B.data);if(T.type==="recognition")T.is_final?t(T.text):e?.(T.text);else if(T.type==="error"){let v=T.message||"Voice recognition error";o?.(v),C();}}catch{o?.("Failed to parse voice message");}},x.onerror=()=>{o?.("Voice service connection failed"),p();},x.onclose=()=>{p();};let k=window.AudioContext||window.webkitAudioContext;if(!k)throw new Error("AudioContext is not supported in this browser");let E=new k({sampleRate:16e3});c.current=E;let R=E.createMediaStreamSource(b);f.current=R;let w=E.createScriptProcessor(4096,1,1);g.current=w,w.onaudioprocess=B=>{if(d.current?.readyState!==WebSocket.OPEN)return;let T=B.inputBuffer.getChannelData(0),v=0;for(let P=0;P<T.length;P+=1)v+=T[P]*T[P];if(Math.sqrt(v/T.length)>n)u.current=Date.now();else if(Date.now()-u.current>r&&!y.current){C();return}let S=new Int16Array(T.length);for(let P=0;P<T.length;P+=1){let F=Math.max(-1,Math.min(1,T[P]));S[P]=F<0?F*32768:F*32767;}d.current.send(S.buffer);},R.connect(w),w.connect(E.destination);}catch{o?.("Cannot access microphone"),p();}}},[p,i,n,t,o,e,r,C,a]);return useEffect(()=>p,[p]),{isRecording:i,startRecording:m,stopRecording:C}}var rm=createContext(null);function vC(e){if(!e||!(e instanceof HTMLElement))return false;let t=e.tagName;return !!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable||e.closest('[data-voice-hotkey-ignore="true"]'))}function CC({children:e,onVoiceSubmit:t,onVoicePartial:o,onVoiceError:a,longPressMs:r=200,disableSpaceTrigger:n=false,ignoreWhenFocusedInput:i=true,renderOverlay:l=true,wsUrl:d,silenceThresholdMs:s,minVolumeRms:c}){let[g,f]=useState(false),[u,y]=useState(false),I=useRef(null),p=useRef(false),C=useRef(false),m=useCallback(()=>{C.current=false,f(false);},[]),{isRecording:b,startRecording:x,stopRecording:k}=Ps({wsUrl:d,silenceThresholdMs:s,minVolumeRms:c,onTextUpdate:B=>{o?.(B);},onComplete:async B=>{try{B.trim()&&(y(!0),await t(B.trim()));}catch(T){let v=T instanceof Error?T.message:"Failed to process voice command";a?.(v);}finally{y(!1),m();}},onError:B=>{a?.(B),y(!1),p.current||m();}}),E=useCallback(async()=>{C.current=false,await x();},[x]),R=useCallback(()=>{k();},[k]);useEffect(()=>{if(n)return;let B=v=>{v.isComposing||(v.code==="Space"||v.key===" ")&&(p.current||v.repeat||i&&vC(document.activeElement)||(p.current=true,v.preventDefault(),I.current=setTimeout(()=>{C.current=true,f(true),x();},r)));},T=v=>{(v.code==="Space"||v.key===" ")&&(I.current&&(clearTimeout(I.current),I.current=null),p.current=false,C.current&&(v.preventDefault(),f(false),k()));};return window.addEventListener("keydown",B),window.addEventListener("keyup",T),()=>{window.removeEventListener("keydown",B),window.removeEventListener("keyup",T),I.current&&(clearTimeout(I.current),I.current=null);}},[n,i,r,x,k]);let w=useMemo(()=>({isRecording:b,isHotkeyRecording:g,isSubmitting:u,startRecording:E,stopRecording:R}),[g,b,u,E,R]);return jsxs(rm.Provider,{value:w,children:[l?jsx(xc,{isRecording:g}):null,e]})}function kC(){let e=useContext(rm);if(!e)throw new Error("useAINav must be used within CAINavProvider");return e}var jB=CC,QB=kC;function xe(...e){return twMerge(clsx(e))}var DC=({content:e,theme:t="light",size:o="base",defaultExpanded:a=false})=>{let[r,n]=useState(a),i=useMemo(()=>`${(o==="sm"?14:o==="lg"?18:16)-2}px`,[o]);return jsxs("div",{className:`my-6 rounded-lg overflow-hidden transition-all duration-200 ${t==="dark"?"bg-gray-800":"bg-white"}`,style:{border:`0.5px solid ${t==="dark"?"#4b5563":"#d1d5db"}`},children:[jsxs("div",{className:`px-4 py-3 cursor-pointer flex items-center justify-between transition-colors duration-200 ${t==="dark"?"bg-gray-700 hover:bg-gray-650":"bg-gray-50 hover:bg-gray-100"}`,style:{borderBottom:`0.5px solid ${t==="dark"?"#4b5563":"#e5e7eb"}`},onClick:()=>n(!r),children:[jsxs("span",{className:"flex items-center",children:[jsx("span",{className:"mr-2",children:"\u{1F914}"}),jsx("span",{className:`font-medium ${t==="dark"?"text-gray-300":"text-gray-700"}`,style:{fontSize:o==="sm"?"14px":o==="lg"?"18px":"16px"},children:"\u601D\u8003\u8FC7\u7A0B"})]}),jsx("svg",{className:`w-4 h-4 transition-transform duration-200 ${r?"rotate-180":""} ${t==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsx("div",{className:`p-4 whitespace-pre-wrap italic font-light ${t==="dark"?"text-gray-400":"text-gray-600"}`,style:{fontSize:i,lineHeight:"1.3 !important"},children:e})]})},nm=DC;var zC=({content:e,language:t="text",isStreaming:o=false,className:a=""})=>{let{theme:r}=useTheme$2(),[n,i]=useState(false),l=async()=>{try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),2e3);}catch(s){console.error("\u590D\u5236\u5931\u8D25:",s);}},d=r==="dark"?oneDark:oneLight;return jsxs("div",{className:xe("rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 my-4",a),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300 uppercase",children:t}),jsx("button",{onClick:l,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",disabled:o,title:n?"Copied":"Copy code",children:n?jsx(Check,{size:14,className:"text-green-500"}):jsx(Clipboard,{size:14,className:"text-gray-500 dark:text-gray-400"})})]}),jsx("div",{className:"text-sm",children:jsx(Prism,{language:t,style:d,customStyle:{margin:0,padding:"16px",fontSize:"14px",lineHeight:"1.5",backgroundColor:r==="dark"?"#1f2937":"#ffffff"},wrapLongLines:true,children:e})})]})},sm=zC;var WC=({content:e,isLoading:t,className:o="",style:a})=>{let r=useRef(null),[n,i]=useState(false),[l,d]=useState(null),{theme:s}=useTheme$2();return useEffect(()=>{let c=async()=>{if(!(!e.trim()||!r.current)){i(true),d(null);try{cm.initialize({startOnLoad:!1,theme:s==="dark"?"dark":"default",securityLevel:"loose",fontFamily:"inherit"});let f=`mermaid-${Math.random().toString(36).substr(2,9)}`,u=e.replace(/```mermaid\n?|\n?```/g,"").trim(),{svg:y}=await cm.render(f,u);r.current&&(r.current.innerHTML=y);}catch(f){console.error("Mermaid render failed:",f),d(f instanceof Error?f.message:"Render failed"),r.current&&(r.current.innerText=e);}finally{i(false);}}},g=setTimeout(()=>{c();},100);return ()=>clearTimeout(g)},[e,s]),t||n?jsx("div",{className:`mermaid-block loading ${o}`,style:a,children:jsxs("div",{className:"flex items-center justify-center p-4 bg-gray-50 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:[jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500 mr-2"}),jsx("span",{className:"text-sm text-gray-500",children:"Generating Diagram..."})]})}):l?jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded text-red-600 dark:text-red-400 text-sm overflow-auto",children:[jsx("p",{className:"font-semibold mb-2",children:"Mermaid Error:"}),jsx("pre",{children:l}),jsx("pre",{className:"mt-4 text-xs text-gray-500",children:e})]}):jsx("div",{className:`mermaid-block overflow-x-auto ${o}`,style:a,ref:r})},pm=WC;var _C=({title:e="\u53D1\u751F\u9519\u8BEF",content:t,errorCode:o,stack:a,icon:r,closable:n=true,onClose:i,onRetry:l,className:d="",...s})=>{let[c,g]=useState(false),[f,u]=useState(false),y=async()=>{if(l){u(true);try{await l();}catch(I){console.error("\u91CD\u8BD5\u5931\u8D25:",I);}finally{u(false);}}};return jsxs("div",{className:`relative w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${d}`,...s,children:[jsxs("div",{className:"flex p-4 border-l-4 border-l-red-500 bg-red-50 dark:bg-red-900/10",children:[jsx("div",{className:"flex-shrink-0 mr-3 text-red-500 mt-0.5",children:r||jsx(AlertCircle,{className:"w-5 h-5"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[jsx("h4",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e}),o&&jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300",children:o})]}),t&&jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3 leading-relaxed",children:typeof t=="string"?jsx("p",{className:"whitespace-pre-wrap",children:t}):t}),(l||a)&&jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[l&&jsxs("button",{onClick:y,disabled:f,className:"flex items-center text-xs font-medium text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors disabled:opacity-50",children:[jsx(RotateCw,{className:`w-3.5 h-3.5 mr-1.5 ${f?"animate-spin":""}`}),f?"\u91CD\u8BD5\u4E2D...":"\u91CD\u8BD5"]}),a&&jsxs("button",{onClick:()=>g(!c),className:"flex items-center text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 transition-colors",children:[c?jsx(ChevronDown,{className:"w-3.5 h-3.5 mr-1"}):jsx(ChevronRight,{className:"w-3.5 h-3.5 mr-1"}),c?"\u9690\u85CF\u8BE6\u60C5":"\u67E5\u770B\u8BE6\u60C5"]})]})]}),n&&i&&jsx("button",{onClick:i,className:"flex-shrink-0 ml-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors self-start",children:jsx(X,{className:"w-4 h-4"})})]}),a&&c&&jsx("div",{className:"bg-gray-50 dark:bg-gray-950 p-3 border-t border-gray-100 dark:border-gray-800",children:jsx("pre",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap p-2 bg-white dark:bg-gray-900 rounded border border-gray-200 dark:border-gray-800",children:a})})]})},Rs=_C;var JC=({title:e="\u8B66\u544A",content:t,warningType:o,severity:a="warning",warnings:r=[],icon:n,closable:i=true,onClose:l,onConfirm:d,actionText:s,className:c="",...g})=>{let f=()=>{switch(a){case "info":return {borderLeftColor:"border-l-blue-500",iconColor:"text-blue-500",bgColor:"bg-blue-50 dark:bg-blue-900/10"};case "error":return {borderLeftColor:"border-l-red-500",iconColor:"text-red-500",bgColor:"bg-red-50 dark:bg-red-900/10"};case "success":return {borderLeftColor:"border-l-green-500",iconColor:"text-green-500",bgColor:"bg-green-50 dark:bg-green-900/10"};default:return {borderLeftColor:"border-l-yellow-500",iconColor:"text-yellow-500",bgColor:"bg-yellow-50 dark:bg-yellow-900/10"}}},u=()=>{switch(a){case "info":return jsx(Info,{className:"w-5 h-5"});case "error":return jsx(XCircle,{className:"w-5 h-5"});case "success":return jsx(CheckCircle,{className:"w-5 h-5"});default:return jsx(AlertTriangle,{className:"w-5 h-5"})}},y=f();return jsxs("div",{className:`relative w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${c}`,...g,children:[jsxs("div",{className:`flex p-4 border-l-4 ${y.borderLeftColor} ${y.bgColor}`,children:[jsx("div",{className:`flex-shrink-0 mr-3 ${y.iconColor}`,children:n||u()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("h4",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e}),o&&jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:o})]}),t&&jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:t}),r&&r.length>0&&jsx("ul",{className:"mt-2 space-y-1",children:r.map((I,p)=>jsxs("li",{className:"flex items-start text-sm text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"mr-2 mt-1.5 w-1 h-1 rounded-full bg-gray-400 dark:bg-gray-500 flex-shrink-0"}),jsx("span",{children:I})]},p))})]}),i&&l&&jsx("button",{onClick:l,className:"flex-shrink-0 ml-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:jsx(X,{className:"w-4 h-4"})})]}),d&&jsx("div",{className:"bg-gray-50 dark:bg-gray-800/50 px-4 py-3 flex justify-end border-t border-gray-100 dark:border-gray-800",children:jsx("button",{onClick:d,className:"px-4 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",children:s||"\u786E\u8BA4"})})]})},Ds=JC;var ak=({title:e="\u76F8\u5173\u63A8\u8350",content:t,suggestions:o,onSuggestionClick:a,maxDisplay:r=5,icon:n,closable:i=false,onClose:l,className:d="",...s})=>{let[c,g]=useState(false),[f,u]=useState(""),[y,I]=useState(false),p=useMemo(()=>f.trim()?o.filter(b=>b.toLowerCase().includes(f.toLowerCase())):o,[o,f]),C=useMemo(()=>c?p:p.slice(0,r),[p,c,r]),m=b=>{a?.(b);};return !o||o.length===0?null:jsxs("div",{className:`w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${d}`,...s,children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-blue-50/30 dark:bg-blue-900/10",children:[jsxs("div",{className:"flex items-center space-x-2.5",children:[jsx("div",{className:"text-blue-500 flex-shrink-0",children:n||jsx(Lightbulb,{className:"w-5 h-5"})}),jsxs("div",{className:"flex flex-col",children:[jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 leading-tight",children:e}),t&&jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:t})]})]}),jsxs("div",{className:"flex items-center space-x-1",children:[o.length>3&&jsx("button",{onClick:()=>I(!y),className:`p-1.5 rounded-md transition-colors ${y?"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:y?"\u5173\u95ED\u641C\u7D22":"\u641C\u7D22\u95EE\u9898",children:jsx(Search,{className:"w-4 h-4"})}),i&&l&&jsx("button",{onClick:l,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:"\u5173\u95ED",children:jsx(X,{className:"w-4 h-4"})})]})]}),y&&jsx("div",{className:"px-4 py-2 border-b border-gray-100 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50",children:jsxs("div",{className:"relative",children:[jsx("input",{type:"text",placeholder:"\u641C\u7D22\u76F8\u5173\u95EE\u9898...",value:f,onChange:b=>u(b.target.value),className:"w-full text-sm px-3 py-1.5 pl-8 rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 outline-none transition-shadow",autoFocus:true}),jsx(Search,{className:"absolute left-2.5 top-2 w-3.5 h-3.5 text-gray-400"})]})}),jsxs("div",{className:"p-2",children:[jsx("ul",{className:"space-y-1",children:C.map((b,x)=>jsx("li",{children:jsxs("button",{onClick:()=>m(b),className:"w-full text-left px-3 py-2 rounded-md text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-blue-600 dark:hover:text-blue-400 transition-colors group flex items-start justify-between",children:[jsx("span",{children:b}),jsx(ChevronRight,{className:"w-4 h-4 text-gray-300 group-hover:text-blue-400 opacity-0 group-hover:opacity-100 transition-all transform group-hover:translate-x-0.5"})]})},x))}),p.length>r&&jsx("button",{onClick:()=>g(!c),className:"w-full text-center py-2 text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors border-t border-gray-50 dark:border-gray-800/50 mt-1",children:c?"\u6536\u8D77":`\u67E5\u770B\u5168\u90E8 (${p.length})`}),p.length===0&&f&&jsx("div",{className:"text-center py-4 text-sm text-gray-500 dark:text-gray-400",children:"\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u5EFA\u8BAE"})]})]})},Ms=ak;var dk=({title:e,content:t,toolName:o,parameters:a,result:r,status:n,duration:i,icon:l,closable:d=false,onClose:s,onAction:c,actionText:g,className:f="",...u})=>{let[y,I]=useState(false),[p,C]=useState(true),m=()=>{switch(n){case "pending":return {iconColor:"text-blue-500",badgeBg:"bg-blue-50 dark:bg-blue-900/30",badgeText:"text-blue-600 dark:text-blue-400",label:"\u6267\u884C\u4E2D"};case "error":return {iconColor:"text-red-500",badgeBg:"bg-red-50 dark:bg-red-900/30",badgeText:"text-red-600 dark:text-red-400",label:"\u5931\u8D25"};default:return {iconColor:"text-green-500",badgeBg:"bg-green-50 dark:bg-green-900/30",badgeText:"text-green-600 dark:text-green-400",label:"\u6210\u529F"}}},b=()=>{switch(n){case "pending":return jsx(Loader2,{className:"w-5 h-5 animate-spin"});case "error":return jsx(XCircle,{className:"w-5 h-5"});default:return jsx(CheckCircle,{className:"w-5 h-5"})}},x=R=>R?R<1e3?`${R}ms`:`${(R/1e3).toFixed(2)}s`:"",k=m(),E=e||o||"\u5DE5\u5177\u8C03\u7528";return jsxs("div",{className:`w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${f}`,...u,children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50",children:[jsxs("div",{className:"flex items-center space-x-3",children:[jsx("div",{className:`flex-shrink-0 ${k.iconColor}`,children:l||b()}),jsxs("div",{children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:E}),jsx("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${k.badgeBg} ${k.badgeText}`,children:k.label})]}),o&&e&&jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 flex items-center mt-0.5",children:[jsx(Terminal,{className:"w-3 h-3 mr-1"}),o]})]})]}),jsxs("div",{className:"flex items-center space-x-2 text-xs text-gray-500 dark:text-gray-400",children:[i&&jsxs("div",{className:"flex items-center bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:[jsx(Clock,{className:"w-3 h-3 mr-1"}),x(i)]}),d&&s&&jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors p-1 rounded",children:jsx(X,{className:"w-4 h-4"})})]})]}),jsxs("div",{className:"p-4",children:[t&&jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 mb-4 leading-relaxed",children:t}),a&&jsxs("div",{className:"mb-3",children:[jsxs("button",{onClick:()=>I(!y),className:"flex items-center text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 mb-2",children:[y?jsx(ChevronDown,{className:"w-3.5 h-3.5 mr-1"}):jsx(ChevronRight,{className:"w-3.5 h-3.5 mr-1"}),jsx(Box$1,{className:"w-3.5 h-3.5 mr-1.5"}),"\u8F93\u5165\u53C2\u6570"]}),y&&jsx("div",{className:"bg-gray-50 dark:bg-gray-950 rounded border border-gray-100 dark:border-gray-800 overflow-hidden",children:jsx("pre",{className:"p-3 text-xs font-mono text-gray-600 dark:text-gray-400 overflow-x-auto",children:JSON.stringify(a,null,2)})})]}),r&&jsxs("div",{children:[jsxs("button",{onClick:()=>C(!p),className:"flex items-center text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 mb-2",children:[p?jsx(ChevronDown,{className:"w-3.5 h-3.5 mr-1"}):jsx(ChevronRight,{className:"w-3.5 h-3.5 mr-1"}),jsx(Terminal,{className:"w-3.5 h-3.5 mr-1.5"}),"\u6267\u884C\u7ED3\u679C"]}),p&&jsx("div",{className:"bg-gray-50 dark:bg-gray-950 rounded border border-gray-100 dark:border-gray-800 overflow-hidden",children:jsx("pre",{className:"p-3 text-xs font-mono text-gray-600 dark:text-gray-400 overflow-x-auto",children:typeof r=="string"?r:JSON.stringify(r,null,2)})})]}),c&&jsx("div",{className:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-800 flex justify-end",children:jsx("button",{onClick:c,className:"px-4 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",children:g||"\u6267\u884C\u64CD\u4F5C"})})]})]})},As=dk;var uk=({data:e})=>{if(!e)return null;let t=useMemo(()=>{let o=[],a=[],r="\u6570\u636E\u8868\u683C";return Array.isArray(e)?(o=e,o.length>0&&(a=Object.keys(o[0]).map(n=>({id:n,label:n.charAt(0).toUpperCase()+n.slice(1),numeric:typeof o[0][n]=="number"})))):typeof e=="object"&&(r=e.title||r,o=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[],Array.isArray(e.columns)?a=e.columns.map(i=>({id:i.key||i.id,label:i.title||i.label,numeric:i.dataType==="number"||i.numeric})):o.length>0&&(a=Object.keys(o[0]).map(i=>({id:i,label:i,numeric:typeof o[0][i]=="number"})))),o=o.map((n,i)=>({...n,id:n.id||`row_${i}`})),{title:r,columns:a,rows:o}},[e]);return t.rows.length===0?jsx("div",{className:"w-full my-4 p-4 border border-dashed border-gray-300 rounded text-center text-gray-500",children:"\u6682\u65E0\u8868\u683C\u6570\u636E"}):jsx("div",{className:"w-full my-4",children:jsx(Sa,{appId:"agent-ui-table-card",title:t.title,columns:t.columns,rows:t.rows,count:t.rows.length,rowKey:"id",fitContainer:false,maxHeight:"500px",rowsPerPage:10,rowsPerPageOptions:[5,10,20,50]})})},Bs=uk;var Ck=({title:e,subtitle:t,data:o,type:a,config:r={}})=>{let n=()=>{switch(a){case "bar-chart-card":return jsx(BarChart,{className:"w-4 h-4 text-blue-500"});case "line-chart-card":return jsx(LineChart,{className:"w-4 h-4 text-green-500"});case "pie-chart-card":return jsx(PieChart,{className:"w-4 h-4 text-purple-500"});case "combo-chart-card":return jsx(Activity,{className:"w-4 h-4 text-orange-500"});case "heatmap-chart-card":return jsx(Grid$1,{className:"w-4 h-4 text-red-500"});case "fishbone-chart-card":return jsx(GitBranch,{className:"w-4 h-4 text-indigo-500"});case "waterfall-chart-card":return jsx(TrendingDown,{className:"w-4 h-4 text-teal-500"});case "google-map-card":return jsx(Globe,{className:"w-4 h-4 text-blue-600"});case "amap-card":return jsx(MapPin,{className:"w-4 h-4 text-blue-600"});default:return jsx(BarChart,{className:"w-4 h-4"})}},i=()=>{if(!o&&a!=="google-map-card"&&a!=="amap-card")return jsx("div",{className:"text-gray-500 text-sm p-4 text-center",children:"No data available"});try{switch(a){case "bar-chart-card":return jsx(pn,{data:o,orientation:r.orientation||"horizontal",valueSuffix:r.valueSuffix||"",minHeight:r.minHeight});case "line-chart-card":return jsx(sd,{data:o,color:r.color,valueSuffix:r.valueSuffix||"",height:r.height});case "pie-chart-card":let l=o.reduce((s,c)=>s+(Number(c.value)||0),0),d=o.map(s=>({name:s.name,value:Number(s.value)||0,percent:typeof s.percent=="number"?s.percent:l>0?(Number(s.value)||0)/l*100:0}));return jsx(gi,{data:d,variant:r.variant||"donut",size:r.size,colors:r.colors});case "combo-chart-card":return jsx(ld,{data:o,barColor:r.barColor,lineColor:r.lineColor});case "heatmap-chart-card":return jsx(dd,{data:o});case "fishbone-chart-card":return jsx(ud,{branches:o,effect:r.effect||e||"Problem"});case "waterfall-chart-card":return jsx(gd,{data:o,height:r.height});case "google-map-card":return jsx(yd,{embedUrl:r.embedUrl||o&&o[0]?.embedUrl,apiKey:r.apiKey,query:r.query||o&&o[0]?.query||e,height:r.height});case "amap-card":return jsx(Cd,{embedUrl:r.embedUrl||o&&o[0]?.embedUrl,keyword:r.keyword||o&&o[0]?.keyword||e,height:r.height});default:return jsxs("div",{className:"text-gray-500 text-sm p-4 text-center",children:["Unsupported chart type: ",a]})}}catch(l){return console.error("Error rendering chart:",l),jsx("div",{className:"text-red-500 text-sm p-4 text-center",children:"Error rendering chart"})}};return jsxs("div",{className:"w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md",children:[jsxs("div",{className:"flex items-center px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50",children:[jsx("div",{className:"mr-2 flex-shrink-0",children:n()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e}),t&&jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t})]})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:"overflow-x-auto",children:i()}),jsx("div",{className:"mt-3",children:jsxs("details",{className:"text-xs text-gray-500 dark:text-gray-400",children:[jsx("summary",{className:"cursor-pointer hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none font-medium opacity-60 hover:opacity-100",children:"View Raw Data"}),jsx("pre",{className:"mt-2 p-2 bg-gray-50 dark:bg-gray-950 rounded border border-gray-100 dark:border-gray-800 overflow-x-auto max-h-40",children:JSON.stringify(o,null,2)})]})})]})]})},Fs=Ck;var Sk=({type:e,manifest:t})=>jsxs("div",{className:"w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md",children:[jsxs("div",{className:"flex items-center px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-blue-50/50 dark:bg-blue-900/10",children:[jsx(Box$1,{className:"w-4 h-4 mr-2 text-blue-600 dark:text-blue-400"}),jsxs("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:["SAP Card: ",e]})]}),jsx("div",{className:"p-4",children:jsx("div",{className:"bg-gray-50 dark:bg-gray-950 p-3 rounded border border-gray-100 dark:border-gray-800 overflow-x-auto",children:jsx("pre",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 whitespace-pre-wrap",children:JSON.stringify(t,null,2)})})})]}),Ls=Sk;var Ns=e=>{let t;try{t=JSON.parse(e);}catch{return null}return t&&typeof t=="object"&&((t.type==="bar-chart-card"||t.type==="line-chart-card"||t.type==="pie-chart-card"||t.type==="combo-chart-card"||t.type==="heatmap-chart-card"||t.type==="fishbone-chart-card"||t.type==="waterfall-chart-card"||t.type==="google-map-card"||t.type==="amap-card")&&t.title||(t.type==="sap-analytical-card"||t.type==="sap-list-card"||t.type==="sap-object-card"||t.type==="sap-component-card")&&t.manifest||t.type==="error-card"||t.type==="warning-card"||t.type==="suggestions-card"||t.type==="tool-result-card"||t.type==="table"&&t.data)?t:null};var Dk=({content:e,theme:t,size:o="base",className:a,enableCodeHighlight:r=true,enableMermaid:n=true,messageId:i,cardHooks:l})=>{let d=useMemo(()=>e?e.replace(/<think>([\s\S]*?)<\/think>/g,(f,u)=>`<div data-component="thinkbox" data-think-content="${encodeURIComponent(u.trim())}"></div>`):"",[e]),s=(f,u,y,I,p)=>{l?.onCardEvent?.({messageId:i,cardType:f,action:u,title:y,payload:I,rawData:p});},c=(f,u,y,I,p,C)=>{if(!(!p&&!l?.onCardEvent))return (...m)=>{let b=p?.(...m),x=C?C(...m):void 0;return s(f,u,y,x,I),b}},g=useMemo(()=>({div(f){let{"data-component":u,"data-think-content":y,...I}=f;return u==="thinkbox"&&y?jsx(nm,{content:decodeURIComponent(y),theme:t,size:o,defaultExpanded:false}):jsx("div",{...I})},table({children:f}){return jsx("div",{className:"my-4 w-full overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:jsx("table",{className:"w-full min-w-[520px] border-collapse text-sm",children:f})})},thead({children:f}){return jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/60",children:f})},tbody({children:f}){return jsx("tbody",{className:"bg-white dark:bg-gray-950",children:f})},tr({children:f}){return jsx("tr",{className:"border-b border-gray-200 dark:border-gray-800 last:border-b-0",children:f})},th({children:f,align:u}){return jsx("th",{className:`px-3 py-2 font-semibold text-gray-800 dark:text-gray-100 ${u==="center"?"text-center":u==="right"?"text-right":"text-left"}`,children:f})},td({children:f,align:u}){return jsx("td",{className:`px-3 py-2 text-gray-700 dark:text-gray-200 align-top ${u==="center"?"text-center":u==="right"?"text-right":"text-left"}`,children:f})},code({inline:f,className:u,children:y,...I}){let p=/language-([\w-]+)/.exec(u||""),C=p?p[1]:"";if(f)return jsx("code",{className:"font-mono text-sm bg-gray-100 dark:bg-gray-800 px-1 py-0.5 rounded text-red-600 dark:text-red-400",...I,children:y});let m=String(y).replace(/\n$/,"");if(n&&C==="mermaid")return jsx(pm,{content:m});if(C==="json"){let b=Ns(m);if(b)switch(b.type){case "table":return jsx(Bs,{data:b.data});case "bar-chart-card":case "line-chart-card":case "pie-chart-card":case "combo-chart-card":case "heatmap-chart-card":case "fishbone-chart-card":case "waterfall-chart-card":case "google-map-card":case "amap-card":return jsx(Fs,{...b});case "sap-analytical-card":case "sap-list-card":case "sap-object-card":case "sap-component-card":return jsx(Ls,{...b});case "error-card":{let x=b;return jsx(Rs,{...x,onClose:c("error-card","close",x.title,x,x.onClose),onRetry:c("error-card","retry",x.title,x,x.onRetry)})}case "warning-card":{let x=b,k=x.onConfirm?c("warning-card","confirm",x.title,x,x.onConfirm):x.actionText&&l?.onCardEvent?c("warning-card","confirm",x.title,x):void 0;return jsx(Ds,{...x,onClose:c("warning-card","close",x.title,x,x.onClose),onConfirm:k})}case "suggestions-card":{let x=b;return jsx(Ms,{...x,onClose:c("suggestions-card","close",x.title,x,x.onClose),onSuggestionClick:c("suggestions-card","suggestion-click",x.title,x,x.onSuggestionClick,k=>({suggestion:k}))})}case "tool-result-card":{let x=b;return jsx(As,{...x,onClose:c("tool-result-card","close",x.title,x,x.onClose),onAction:c("tool-result-card","action",x.title,x,x.onAction)})}}}return r?jsx(sm,{content:m,language:C,className:"not-prose"}):jsx("code",{className:u,...I,children:y})}}),[t,o,n,r,l,i]);return jsx("div",{className:xe("markdown-body prose dark:prose-invert max-w-none",a),children:jsx(wk,{remarkPlugins:[Ik,Tk],rehypePlugins:[Pk,Rk],components:g,children:d})})},zs=Dk;var Mk=({content:e,messageId:t,cardHooks:o})=>{let a=(i,l,d,s,c)=>{o?.onCardEvent?.({messageId:t,cardType:i,action:l,title:d,payload:s,rawData:c});},r=(i,l,d,s,c,g)=>{if(!(!c&&!o?.onCardEvent))return (...f)=>{let u=c?.(...f),y=g?g(...f):void 0;return a(i,l,d,y,s),u}},n=Ns(e);if(n)switch(n.type){case "table":return jsx(Bs,{data:n.data});case "bar-chart-card":case "line-chart-card":case "pie-chart-card":case "combo-chart-card":case "heatmap-chart-card":case "fishbone-chart-card":case "waterfall-chart-card":case "google-map-card":case "amap-card":return jsx(Fs,{...n});case "sap-analytical-card":case "sap-list-card":case "sap-object-card":case "sap-component-card":return jsx(Ls,{...n});case "error-card":{let i=n;return jsx(Rs,{...i,onClose:r("error-card","close",i.title,i,i.onClose),onRetry:r("error-card","retry",i.title,i,i.onRetry)})}case "warning-card":{let i=n,l=i.onConfirm?r("warning-card","confirm",i.title,i,i.onConfirm):i.actionText&&o?.onCardEvent?r("warning-card","confirm",i.title,i):void 0;return jsx(Ds,{...i,onClose:r("warning-card","close",i.title,i,i.onClose),onConfirm:l})}case "suggestions-card":{let i=n;return jsx(Ms,{...i,onClose:r("suggestions-card","close",i.title,i,i.onClose),onSuggestionClick:r("suggestions-card","suggestion-click",i.title,i,i.onSuggestionClick,l=>({suggestion:l}))})}case "tool-result-card":{let i=n;return jsx(As,{...i,onClose:r("tool-result-card","close",i.title,i,i.onClose),onAction:r("tool-result-card","action",i.title,i,i.onAction)})}}return jsx("div",{className:"dynamic-card-fallback",children:jsx(zs,{content:e,enableCodeHighlight:true,enableMath:true,enableMermaid:true,messageId:t,cardHooks:o})})},Cm=Mk;var Rc=class{static analyze(t){if(!t.trim())return {blocks:[],hasComplexContent:false,overallType:"simple"};let a=/```json\s*\{\s*"type":\s*"[^"]+"/g.test(t),r=/<[^>]+>[\s\S]*?<\/[^>]+>/.test(t),n=t.includes("NQ#")||t.includes("data-component");return a||r||n?{blocks:[{type:"mixed",content:t,startIndex:0,endIndex:t.length}],hasComplexContent:true,overallType:"complex"}:{blocks:[{type:"markdown",content:t,startIndex:0,endIndex:t.length}],hasComplexContent:false,overallType:"simple"}}},Bk=({content:e,className:t="",messageId:o,cardHooks:a})=>{let r=st__default.useMemo(()=>Rc.analyze(e),[e]);return jsx("div",{className:`universal-content-renderer ${t}`,children:r.blocks.map((n,i)=>n.type==="mixed"||n.type==="json-card"?jsx(Cm,{content:n.content,messageId:o,cardHooks:a},`block-${i}`):jsx(zs,{content:n.content,enableCodeHighlight:true,enableMath:true,enableMermaid:true,messageId:o,cardHooks:a},`block-${i}`))})},km=Bk;var Fk=({content:e,isStreaming:t=true,onComplete:o,className:a="",streamIntervalMs:r=24,streamChunkSize:n=3,messageId:i,cardHooks:l})=>{let[d,s]=useState(t?0:e.length),[c,g]=useState(!t);useEffect(()=>{if(t){s(0),g(false);return}s(e.length),g(true);},[e,t]),useEffect(()=>{if(!t||c)return;if(d>=e.length){g(true),o?.();return}let p=window.setTimeout(()=>{s(C=>Math.min(C+n,e.length));},r);return ()=>{window.clearTimeout(p);}},[e.length,c,t,o,n,r,d]);let f=()=>{t&&!c&&(s(e.length),g(true),o?.());},u=t?e.slice(0,d):e,y=t&&!c,I=t&&!c;return jsxs("div",{className:`streaming-markdown ${a}`,onClick:f,style:{cursor:t?"pointer":"default"},children:[jsxs("div",{className:"relative",children:[jsx(km,{content:u,messageId:i,cardHooks:l}),y&&jsx("span",{className:"inline-block w-0.5 h-5 bg-blue-500 ml-1 animate-pulse",style:{verticalAlign:"text-bottom"}})]}),I&&jsx("div",{className:"streaming-hint",style:{fontSize:"9px",color:"#999",marginTop:"8px",fontStyle:"italic",opacity:.7},children:"\u70B9\u51FB\u6B64\u5904\u663E\u793A\u5B8C\u6574\u5185\u5BB9"})]})},Tm=Fk;var Pm=({buttons:e,className:t})=>{let o=a=>{switch(a){case "copy":return jsx(Copy,{size:14});case "refresh":return jsx(RefreshCw,{size:14});case "volume":return jsx(Volume2,{size:14});case "like":return jsx(ThumbsUp,{size:14});case "dislike":return jsx(ThumbsDown,{size:14});default:return null}};return jsx("div",{className:xe("flex items-center gap-1",t),children:e.map((a,r)=>jsx("button",{onClick:a.onClick,disabled:a.disabled,className:xe("p-1.5 rounded-md transition-colors","text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-800","disabled:opacity-50 disabled:cursor-not-allowed",a.active&&"text-blue-600 bg-blue-50 dark:text-blue-400 dark:bg-blue-900/20",a.type==="refresh"&&a.disabled&&"animate-spin"),title:a.type,type:"button",children:o(a.type)},`${a.type}-${r}`))})};var Vs=({message:e,onStreamingComplete:t,assistantActions:o,streamIntervalMs:a,streamChunkSize:r,cardHooks:n})=>e.type==="assistant"?jsx("div",{className:"flex justify-start mb-4",children:jsxs("div",{className:"w-full bg-transparent text-black dark:text-gray-100 rounded-2xl px-4 py-3 mr-auto",style:{lineHeight:"1.5",fontSize:"16px",fontWeight:"280",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[jsx(Tm,{content:e.content,isStreaming:e.isStreaming??false,onComplete:t,streamIntervalMs:a,streamChunkSize:r,messageId:e.id,cardHooks:n}),e.content&&o?.isLatestAssistant&&jsx("div",{className:"flex flex-row justify-start gap-2 mt-3 pt-2 border-t border-gray-100 dark:border-gray-700",children:jsx(Pm,{buttons:[{type:"refresh",onClick:()=>o?.onRegenerate?.(),disabled:!o?.onRegenerate},{type:"copy",onClick:()=>navigator.clipboard.writeText(e.content),disabled:false},{type:"volume",onClick:()=>console.log("\u8BED\u97F3\u64AD\u653E"),disabled:false},{type:"like",onClick:()=>console.log("\u70B9\u8D5E"),disabled:false},{type:"dislike",onClick:()=>console.log("\u70B9\u8E29"),disabled:false}],size:"sm",variant:"default"})}),jsx("div",{className:"text-xs mt-2 text-gray-500 dark:text-gray-400",children:e.timestamp.toLocaleTimeString()})]})}):jsx("div",{className:"flex justify-end",children:jsxs("div",{className:"max-w-[80%] bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-100 rounded-2xl px-4 py-3 ml-auto",style:{lineHeight:"1.5",fontSize:"16px",fontWeight:"280",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[jsx("div",{className:"whitespace-pre-wrap",style:{lineHeight:"1.5",fontSize:"16px",fontWeight:"280",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:e.content}),jsx("div",{className:"text-xs mt-2 text-gray-500 dark:text-gray-400",children:e.timestamp.toLocaleTimeString()})]})});var Dm=({onTextUpdate:e,onComplete:t,onCancel:o,disabled:a,className:r})=>{let{isRecording:n,startRecording:i,stopRecording:l}=Ps({onTextUpdate:e,onComplete:s=>{t?.(s);},onError:s=>{console.error("Voice input error:",s),o?.();}});return jsx("button",{onClick:async()=>{n?l():await i();},disabled:a,className:xe("transition-all duration-200 flex items-center justify-center rounded-full",n?"bg-red-100 text-red-600 hover:bg-red-200 animate-pulse":"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 active:scale-95",a&&"opacity-50 cursor-not-allowed",r),title:n?"Stop recording":"Start recording",type:"button",children:n?jsx($k,{sx:{fontSize:24}}):jsx(Ok,{sx:{fontSize:24}})})};var lt={container:"w-full max-w-4xl mx-auto",inputContainer:xe("w-full border backdrop-blur-xl transition-all duration-300 shadow-2xl flex flex-col","bg-white/80 dark:bg-gray-900/80","border-gray-200/60 dark:border-gray-600/40","shadow-gray-900/5","hover:border-blue-300/80 hover:shadow-blue-500/10 hover:shadow-2xl","focus-within:border-blue-400/90 focus-within:shadow-blue-500/20 focus-within:shadow-3xl focus-within:scale-[1.005] transform-gpu"),dragActive:"border-blue-500 bg-blue-50/50 dark:bg-blue-900/20",textareaWrapper:"flex-1 relative flex items-center",textarea:xe("w-full outline-none appearance-none resize-none bg-transparent border-none text-sm font-normal py-3 px-2","placeholder:text-gray-400/70 dark:placeholder:text-gray-500/60 placeholder:font-normal","text-gray-800 dark:text-gray-100 selection:bg-blue-200/50 dark:selection:bg-blue-500/30","focus:ring-0 focus:outline-none focus:border-none focus:shadow-none","min-h-[44px] max-h-[12em] overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600"),filePreviewArea:"px-6 pt-3 pb-1 flex flex-wrap gap-2",fileTag:xe("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs font-medium","bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300","border border-gray-200 dark:border-gray-700","transition-all hover:bg-gray-200 dark:hover:bg-gray-700"),buttonBase:"flex items-center justify-center transition-all duration-200 rounded-full",buttonSmall:"w-10 h-10",buttonNormal:xe("bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400","cursor-pointer active:scale-95"),sendButton:xe("cursor-pointer bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 shadow-none active:scale-95"),sendButtonDisabled:xe("cursor-not-allowed opacity-40 bg-transparent text-gray-400"),stopButton:xe("cursor-pointer bg-red-500 hover:bg-red-600 text-white shadow-sm active:scale-95")},Zk={padding:0,lineHeight:"1.5",border:"none !important",boxShadow:"none !important",backgroundColor:"transparent",height:"auto",fontFeatureSettings:'"liga" 1, "kern" 1',WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},jk=({enabled:e,onClick:t})=>jsx("button",{className:xe(lt.buttonBase,lt.buttonSmall,lt.buttonNormal),onClick:t,disabled:!e,"aria-label":"Upload file",type:"button",children:jsx(qk,{sx:{fontSize:24}})}),Qk=()=>jsxs("button",{className:xe(lt.buttonBase,"h-10 px-3 py-2 gap-1.5 rounded-full",lt.buttonNormal),"aria-label":"Tools",type:"button",children:[jsx(_k,{sx:{fontSize:20}}),jsx("span",{className:"text-sm font-medium",children:"Tools"})]}),Xk=({canSend:e,isResponding:t,onSend:o,onStop:a})=>t?jsx("button",{className:xe(lt.buttonBase,lt.buttonSmall,lt.stopButton),onClick:a,"aria-label":"Stop generating",type:"button",children:jsx(Stop,{sx:{fontSize:20}})}):jsx("button",{className:xe(lt.buttonBase,lt.buttonSmall,e?lt.sendButton:lt.sendButtonDisabled),onClick:o,disabled:!e,"aria-label":"Send message",type:"button",children:jsx(Kk,{sx:{fontSize:24},className:e?"text-gray-500 dark:text-gray-400":"text-gray-300 dark:text-gray-600"})}),Mm=({onSend:e,onStop:t,isResponding:o=false,placeholder:a,getText:r})=>{let[n,i]=useState(""),[l,d]=useState([]),[s,c]=useState(false),[g,f]=useState(false),u=useRef(null),y=a||(r?r("00019","Type a message..."):"Type a message..."),I=(n.trim().length>0||l.length>0)&&!o,p={enabled:true},C=useCallback(F=>{i(F.target.value),F.target.style.height="auto",F.target.style.height=`${Math.min(F.target.scrollHeight,200)}px`;},[]),m=useCallback(F=>{if(F.target.files&&F.target.files.length>0){let W=Array.from(F.target.files);d(z=>{let j=W.filter(Y=>z.some(te=>te.name===Y.name&&te.size===Y.size));j.length>0&&console.warn("Duplicate files ignored:",j.map(Y=>Y.name));let ie=W.filter(Y=>!z.some(te=>te.name===Y.name&&te.size===Y.size));return [...z,...ie]}),u.current&&(u.current.value="");}},[]),b=useCallback(F=>{d(W=>W.filter((z,j)=>j!==F));},[]),x=useCallback(()=>{u.current?.click();},[]),k=useCallback(async()=>{if(!I)return;let F=n,W=[...l];i(""),d([]),u.current&&(u.current.value="");try{await e(F,W);}catch(z){console.error("Failed to send message:",z),i(F),d(W);}},[n,I,e,l]),E=useCallback(F=>{F.key==="Enter"&&!F.shiftKey&&!s&&(F.preventDefault(),k());},[k,s]),R=useCallback(()=>{c(true);},[]),w=useCallback(()=>{c(false);},[]),B=useCallback(F=>{i(F);},[]),T=useCallback(F=>{i(F);},[]),v=useCallback(()=>{},[]),D=useCallback(F=>{F.preventDefault(),f(true);},[]),S=useCallback(F=>{F.preventDefault(),f(false);},[]),P=useCallback(F=>{if(F.preventDefault(),f(false),F.dataTransfer.files&&F.dataTransfer.files.length>0){let W=Array.from(F.dataTransfer.files);d(z=>[...z,...W]);}},[]);return jsx("div",{className:lt.container,children:jsxs("div",{className:"relative",children:[jsx("input",{type:"file",multiple:true,className:"hidden",ref:u,onChange:m}),jsxs("div",{className:xe(lt.inputContainer,g&&lt.dragActive),style:{borderRadius:"32px"},onDragOver:D,onDragLeave:S,onDrop:P,children:[l.length>0&&jsx("div",{className:lt.filePreviewArea,children:l.map((F,W)=>jsxs("div",{className:lt.fileTag,children:[jsx(InsertDriveFile,{sx:{fontSize:16},className:"text-blue-500"}),jsx("span",{className:"truncate max-w-[150px]",children:F.name}),jsx("button",{onClick:()=>b(W),className:"ml-1 hover:text-red-500 focus:outline-none",type:"button",children:jsx(Close,{sx:{fontSize:16}})})]},`${F.name}-${W}`))}),jsxs("div",{className:"flex flex-col w-full p-2",children:[jsx("div",{className:xe(lt.textareaWrapper,"px-3 pt-2 pb-3 min-h-[60px]"),children:jsx("textarea",{className:xe(lt.textarea,"min-h-[24px] py-0 px-0"),placeholder:y,value:n,onChange:C,onKeyDown:E,onCompositionStart:R,onCompositionEnd:w,style:Zk,"aria-label":"Message input",spellCheck:false,rows:1})}),jsxs("div",{className:"flex items-center justify-between px-1 pb-1",children:[jsxs("div",{className:"flex items-center gap-1",role:"toolbar","aria-label":"Input tools",children:[jsx(jk,{enabled:p.enabled,onClick:x}),jsx(Qk,{})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Dm,{onTextUpdate:B,onComplete:T,onCancel:v,disabled:o,className:lt.buttonSmall}),jsx(Xk,{canSend:I,isResponding:o,onSend:k,onStop:t})]})]})]})]})]})})};var Fm=({messages:e,onSend:t,onStop:o,onRegenerate:a,isResponding:r=false,className:n,placeholder:i,streamIntervalMs:l,streamChunkSize:d,onMessageStreamingComplete:s,cardHooks:c,showInput:g=true})=>{let f=useRef(null),u=useRef(e.length);return useEffect(()=>{e.length>u.current&&f.current?.scrollIntoView({behavior:"smooth"}),u.current=e.length;},[e]),jsxs("div",{className:xe("flex flex-col h-full w-full relative",n),children:[jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600",children:[e.map((y,I)=>{let p=y.type==="assistant"&&I===e.length-1,C=y.type==="assistant"?{isLatestAssistant:p,onRegenerate:a?()=>a(y.id):void 0}:void 0;return jsx(Vs,{message:y,assistantActions:C,onStreamingComplete:()=>s?.(y.id),streamIntervalMs:l,streamChunkSize:d,cardHooks:c},y.id)}),jsx("div",{ref:f})]}),g&&jsx("div",{className:"p-4 bg-gradient-to-t from-white via-white to-transparent dark:from-gray-900 dark:via-gray-900 pb-8 z-10",children:jsx(Mm,{onSend:t||(async()=>{}),onStop:o||(()=>{}),isResponding:r,placeholder:i})})]})};var to={};var eS={idle:"Idle",running:"Running",success:"Success",error:"Error",pending:"Pending"},CE=({title:e="AI Agent",description:t,headerActions:o,className:a,agentStatus:r,showInput:n=false,...i})=>{let l=r??(i.isResponding?"running":"idle");return jsxs("div",{className:xe("relative flex h-full w-full",to.agentPanel,a),"data-status":l,children:[jsx("div",{className:to.colorHalo,"data-status":l,"aria-hidden":"true"}),jsxs("div",{className:to.marqueeBorder,"data-status":l,"aria-hidden":"true",children:[jsx("span",{className:xe(to.edge,to.top)}),jsx("span",{className:xe(to.edge,to.right)}),jsx("span",{className:xe(to.edge,to.bottom)}),jsx("span",{className:xe(to.edge,to.left)})]}),jsxs("div",{className:"relative z-10 flex h-full w-full flex-col rounded-xl border border-slate-200/70 bg-white shadow-sm overflow-hidden dark:border-slate-800 dark:bg-gray-950",children:[jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 dark:border-gray-800 bg-white/50 dark:bg-gray-900/50 backdrop-blur-sm z-20",children:[jsxs("div",{children:[jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e}),t&&jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:t})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-gray-100/80 dark:bg-gray-800/70",children:[jsx("span",{className:to.statusDot,"data-status":l}),jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-600 dark:text-gray-300",children:eS[l]})]}),o]})]}),jsx("div",{className:"flex-1 min-h-0 relative z-10",children:jsx(Fm,{...i,showInput:n})})]})]})};var nS={"top-left":"bottom-right","top-right":"bottom-left","bottom-left":"top-right","bottom-right":"top-left"},DE=({messages:e,onSend:t,onRegenerate:o,isResponding:a=false,className:r,placeholder:n,title:i="Copilot",corner:l="bottom-right",onCollapse:d,onHeaderPointerDown:s,onPlusClick:c,onMicClick:g,streamIntervalMs:f,streamChunkSize:u,onMessageStreamingComplete:y,cardHooks:I})=>{let[p,C]=useState(""),[m,b]=useState(false),x=useRef(null),k=nS[l];useEffect(()=>{x.current?.scrollIntoView({behavior:"smooth"});},[e,a]);let E=useCallback(async()=>{let w=p.trim();!w||a||(C(""),await t(w));},[a,t,p]),R=useCallback(async w=>{w.key==="Enter"&&!m&&(w.preventDefault(),await E());},[E,m]);return jsxs("div",{className:xe("relative flex h-full w-full min-h-[460px] min-w-[340px] flex-col overflow-hidden rounded-3xl border border-gray-200 bg-white shadow-none dark:border-gray-800 dark:bg-gray-900",r),children:[d&&jsx("button",{onClick:d,className:xe("absolute z-20 flex h-10 w-10 items-center justify-center rounded-full transition-colors hover:bg-transparent dark:hover:bg-transparent",k==="top-left"&&"-left-2 -top-2",k==="top-right"&&"-right-2 -top-2",k==="bottom-left"&&"-bottom-2 -left-2",k==="bottom-right"&&"-bottom-2 -right-2"),type:"button","aria-label":"Collapse Copilot",children:jsx("span",{className:xe("block h-4 w-4 border-[#21BCFF]",k==="top-left"&&"rounded-tl-full border-l-[3px] border-t-[3px]",k==="top-right"&&"rounded-tr-full border-r-[3px] border-t-[3px]",k==="bottom-left"&&"rounded-bl-full border-b-[3px] border-l-[3px]",k==="bottom-right"&&"rounded-br-full border-b-[3px] border-r-[3px]")})}),jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 px-4 py-3 dark:border-gray-800",onPointerDown:s,children:[jsx("div",{className:"flex items-center",children:jsx("h3",{className:"text-base font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:i})}),jsx("div",{})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-5 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600",children:[e.map((w,B)=>{let T=w.type==="assistant"&&B===e.length-1,v=w.type==="assistant"?{isLatestAssistant:T,onRegenerate:o?()=>o(w.id):void 0}:void 0;return jsx(Vs,{message:w,assistantActions:v,onStreamingComplete:()=>y?.(w.id),streamIntervalMs:f,streamChunkSize:u,cardHooks:I},w.id)}),jsx("div",{ref:x})]}),jsx("div",{className:"border-t border-gray-100 px-3 py-3 dark:border-gray-800",children:jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-blue-300/80 bg-white px-2 py-1.5 dark:bg-gray-900",children:[jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",onClick:c,type:"button","aria-label":"Add",children:jsx(Plus,{className:"h-4 w-4"})}),jsx("input",{className:"h-7 flex-1 border-none bg-transparent text-sm text-gray-800 outline-none placeholder:text-gray-400 dark:text-gray-100 dark:placeholder:text-gray-500",placeholder:n||"Ask Copilot...",value:p,onChange:w=>C(w.target.value),onCompositionStart:()=>b(true),onCompositionEnd:()=>b(false),onKeyDown:R,"aria-label":"Copilot input",spellCheck:false}),jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",onClick:g,type:"button","aria-label":"Microphone",children:jsx(Mic,{className:"h-4 w-4"})})]})})]})};var pS={none:{from:{},to:{}},fade:{from:{opacity:0},to:{opacity:1}},"slide-up":{from:{opacity:0,transform:"translate3d(0, 12px, 0)"},to:{opacity:1,transform:"translate3d(0, 0, 0)"}},"slide-left":{from:{opacity:0,transform:"translate3d(12px, 0, 0)"},to:{opacity:1,transform:"translate3d(0, 0, 0)"}},scale:{from:{opacity:0,transform:"scale(0.985)"},to:{opacity:1,transform:"scale(1)"}}},EE=({children:e,transitionKey:t,variant:o="fade",durationMs:a=220,delayMs:r=0,easing:n="cubic-bezier(0.22, 1, 0.36, 1)",disabled:i=false,sx:l})=>{let d=useMediaQuery("(prefers-reduced-motion: reduce)"),[s,c]=useState("to"),g=!i&&!d&&o!=="none";useEffect(()=>{if(!g){c("to");return}c("from");let y=requestAnimationFrame(()=>{y=requestAnimationFrame(()=>{c("to");});});return ()=>cancelAnimationFrame(y)},[t,g]);let f=pS[o],u=useMemo(()=>g?s==="from"?f.from:f.to:{opacity:1,transform:"none"},[g,s,f.from,f.to]);return jsx(Box,{sx:{willChange:g?"opacity, transform":"auto",transition:g?`opacity ${a}ms ${n} ${r}ms, transform ${a}ms ${n} ${r}ms`:"none",backfaceVisibility:"hidden",...u,...l},children:e})},LE={subtle:{variant:"fade",durationMs:180},smooth:{variant:"slide-up",durationMs:220},snappy:{variant:"scale",durationMs:160}};
17
- export{CE as AgentPanel,Gs as Button,CC as CAINavProvider,Cd as CAmapChart,ts as CAppHeader,bM as CAppPageLayout,pn as CBarChart,si as CChartCard,ld as CComboChart,Id as CCustomizeAgent,kD as CDetailInfoPage,Cp as CDetailSearchAiBar,Ki as CDetailSectionCard,ud as CFishboneChart,yd as CGoogleMapChart,kd as CGraphCharts,rd as CGraphKpiCards,ki as CGraphReport,dd as CHeatmapChart,GD as CKanbanBoard,Pp as CKanbanBucket,Wl as CKanbanCard,jd as CLayoutManagement,Ei as CLayoutManager,sd as CLineChart,nn as CMessageBox,Kc as CPageLayout,EE as CPageTransition,gi as CPieChart,i2 as CPivotTable,ja as CSmartFilter,WP as CSmartTable,ZP as CStandardPage,Sa as CTable,NP as CTableBody,zP as CTableCell,VP as CTableContainer,OP as CTableHead,$P as CTableRow,Ti as CVariantManagement,Ld as CVariantManager,xc as CVoiceWaveOverlay,gd as CWaterfallChart,Sn as CodeBlock,DE as CopilotChat,hw as GlobalMessage,Rn as MarkdownRenderer,wn as MathBlock,Pl as MermaidBlock,Wc as NavigationIsland,rn as ORBCAFE_I18N_MESSAGES,Yn as OrbcafeI18nProvider,LE as PAGE_TRANSITION_PRESETS,NB as PAppPageLayout,I2 as PBarcodeScanner,Ku as PNavIsland,$2 as PNumericKeypad,zu as PSmartFilter,eC as PTable,A2 as PTouchCard,$u as PWorkloadNav,fu as PivotChartPanel,Fm as StdChat,Dl as TableBlock,Gi as ThinkBlock,Ks as TreeMenu,jB as VoiceNavigatorProvider,WB as VoiceWaveOverlay,yi as buildAmapEmbedUrl,gn as buildGoogleMapEmbedUrl,j1 as buildGoogleMapIframe,Wm as buttonVariants,Mp as createKanbanBoardModel,Ro as findKanbanCard,JS as message,Qo as messageManager,Qi as moveKanbanCard,Wi as parseMarkdownTable,KR as renderMarkdown,Xd as resolveVariantFilters,Li as resolveVariantLayout,kC as useAINav,cR as useAmapEmbedUrl,Sp as useDetailInfo,lR as useGoogleMapEmbedUrl,aR as useGraphChartData,wi as useGraphInteraction,Mr as useGraphReport,ZD as useKanbanBoard,Gc as useNavigationIsland,_ as useOrbcafeI18n,h2 as usePadLayout,x2 as usePadRecordEditor,$p as usePageLayout,p2 as usePivotTable,eR as useStandardReport,Ps as useVoiceInput,QB as useVoiceNavigator};
14
+ ${o}: ${(r??a)(p.secondaryValue??0)}`:""]})}),jsx("text",{x:p.x,y:Math.max(p.y-12,d.top+8),textAnchor:"middle",fontSize:"10",fill:n.palette.text.secondary,children:p.name})]},p.name)),jsx("text",{x:i/2,y:l-10,textAnchor:"middle",fontSize:"11",fill:n.palette.text.secondary,children:o?t:"Index"}),jsx("text",{x:16,y:l/2,textAnchor:"middle",transform:`rotate(-90 16 ${l/2})`,fontSize:"11",fill:n.palette.text.secondary,children:o??t}),jsx("text",{x:d.left,y:d.top-4,fontSize:"10",fill:n.palette.text.secondary,children:zu(f)}),jsx("text",{x:i-d.right,y:l-d.bottom+16,textAnchor:"end",fontSize:"10",fill:n.palette.text.secondary,children:zu(g)})]})}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:"repeat(3, minmax(0, 1fr))"},gap:1},children:e.map(p=>jsxs(Box,{sx:v=>({borderRadius:2,px:1.25,py:1,border:`1px solid ${alpha(v.palette.divider,.7)}`,bgcolor:alpha(v.palette.background.default,.35)}),children:[jsx(Typography,{sx:{fontSize:"0.78rem",fontWeight:700},noWrap:true,title:p.name,children:p.name}),jsxs(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:[t,": ",a(p.primaryValue)]}),o&&jsxs(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:[o,": ",(r??a)(p.secondaryValue??0)]})]},p.name))})]})};var wc=e=>Math.max(...e,1),Ou=({data:e,chartType:t,primaryLabel:o,secondaryLabel:a,formatPrimaryValue:r,formatSecondaryValue:n})=>{let i=useTheme$1(),l=i.palette.primary.main,d=i.palette.warning.main;if(e.length===0)return null;if(t==="bar-horizontal"){let m=wc(e.flatMap(y=>[y.primaryValue,y.secondaryValue??0]));return jsx(Stack,{spacing:1.1,children:e.map(y=>jsxs(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"160px 1fr 128px"},gap:1.25,alignItems:"center"},children:[jsx(Typography,{sx:{fontSize:"0.78rem",fontWeight:700},noWrap:true,title:y.name,children:y.name}),jsxs(Stack,{spacing:.65,children:[jsx(Box,{sx:{height:10,borderRadius:999,overflow:"hidden",bgcolor:alpha(i.palette.action.active,.08)},children:jsx(Box,{sx:{width:`${y.primaryValue/m*100}%`,height:"100%",bgcolor:l}})}),a&&jsx(Box,{sx:{height:8,borderRadius:999,overflow:"hidden",bgcolor:alpha(i.palette.action.active,.08)},children:jsx(Box,{sx:{width:`${(y.secondaryValue??0)/m*100}%`,height:"100%",bgcolor:d}})})]}),jsxs(Box,{sx:{minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.72rem",textAlign:{xs:"left",md:"right"},fontWeight:700},children:r(y.primaryValue)}),a&&jsx(Typography,{sx:{fontSize:"0.72rem",textAlign:{xs:"left",md:"right"},color:"text.secondary"},children:(n??r)(y.secondaryValue??0)})]})]},y.name))})}if(t==="bar-vertical"){let m=wc(e.flatMap(x=>[x.primaryValue,x.secondaryValue??0])),y=a?92:76;return jsx(Box,{sx:{overflowX:"auto",pb:.5},children:jsx(Box,{sx:{minWidth:Math.max(620,e.length*y),display:"grid",gridTemplateColumns:`repeat(${e.length}, minmax(56px, 1fr))`,gap:1,alignItems:"end"},children:e.map(x=>jsxs(Box,{sx:{minWidth:0},children:[jsxs(Box,{sx:{height:210,display:"flex",alignItems:"flex-end",justifyContent:"center",gap:.8},children:[jsx(Box,{sx:{width:a?16:26,minHeight:8,height:`${Math.max(x.primaryValue/m*188,8)}px`,borderRadius:"10px 10px 2px 2px",bgcolor:l},title:`${o}: ${r(x.primaryValue)}`}),a&&jsx(Box,{sx:{width:16,minHeight:8,height:`${Math.max((x.secondaryValue??0)/m*188,8)}px`,borderRadius:"10px 10px 2px 2px",bgcolor:d},title:`${a}: ${(n??r)(x.secondaryValue??0)}`})]}),jsx(Typography,{sx:{fontSize:"0.76rem",fontWeight:700},noWrap:true,title:x.name,children:x.name}),jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary"},noWrap:true,title:r(x.primaryValue),children:r(x.primaryValue)}),a&&jsx(Typography,{sx:{fontSize:"0.7rem",color:"text.secondary"},noWrap:true,title:(n??r)(x.secondaryValue??0),children:(n??r)(x.secondaryValue??0)})]},x.name))})})}let s=Math.max(680,e.length*74),c=240,g={top:20,right:18,bottom:36,left:18},f=wc(e.flatMap(m=>[m.primaryValue,m.secondaryValue??0])),u=s-g.left-g.right,h=c-g.top-g.bottom,w=m=>e.map((y,x)=>{let k=g.left+x*u/Math.max(e.length-1,1),F=c-g.bottom-m(y)/f*h;return {x:k,y:F,item:y}}),p=w(m=>m.primaryValue),v=a?w(m=>m.secondaryValue??0):[];return jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.1},children:[jsx(Box,{sx:{overflowX:"auto"},children:jsxs(Box,{component:"svg",viewBox:`0 0 ${s} ${c}`,sx:{width:"100%",minWidth:s,height:c},children:[jsx("line",{x1:g.left,y1:c-g.bottom,x2:s-g.right,y2:c-g.bottom,stroke:alpha(i.palette.text.secondary,.35)}),jsx("polyline",{fill:"none",stroke:l,strokeWidth:3,points:p.map(m=>`${m.x},${m.y}`).join(" ")}),p.map(m=>jsx("circle",{cx:m.x,cy:m.y,r:4,fill:l,children:jsxs("title",{children:[m.item.name,`
15
+ `,o,": ",r(m.item.primaryValue)]})},`primary-${m.item.name}`)),a&&jsxs(Fragment,{children:[jsx("polyline",{fill:"none",stroke:d,strokeWidth:2.5,strokeDasharray:"5 5",points:v.map(m=>`${m.x},${m.y}`).join(" ")}),v.map(m=>jsx("circle",{cx:m.x,cy:m.y,r:3.5,fill:d,children:jsxs("title",{children:[m.item.name,`
16
+ `,a,": ",(n??r)(m.item.secondaryValue??0)]})},`secondary-${m.item.name}`))]})]})}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",xl:"repeat(4, minmax(0, 1fr))"},gap:1},children:e.map(m=>jsxs(Box,{sx:y=>({borderRadius:2,px:1.1,py:.9,border:`1px solid ${alpha(y.palette.divider,.7)}`,bgcolor:alpha(y.palette.background.default,.35)}),children:[jsx(Typography,{sx:{fontSize:"0.76rem",fontWeight:700},noWrap:true,title:m.name,children:m.name}),jsx(Typography,{sx:{fontSize:"0.71rem",color:"text.secondary"},children:r(m.primaryValue)}),a&&jsx(Typography,{sx:{fontSize:"0.71rem",color:"text.secondary"},children:(n??r)(m.secondaryValue??0)})]},m.name))})]})};var Wu=(e,t,o)=>{let a=new Set,r=[];return e.forEach(n=>{a.has(n)||(a.add(n),r.push({fieldId:n,label:o.get(n)?.label??n,zone:"rows"}));}),t.forEach(n=>{a.has(n)||(a.add(n),r.push({fieldId:n,label:o.get(n)?.label??n,zone:"columns"}));}),r},$u=(e,t,o)=>e.map(a=>{let r=t.get(a.fieldId),n=r?.label??a.fieldId;return {fieldId:a.fieldId,label:`${o(a.aggregation)} \xB7 ${n}`,item:a,field:r}}),Hu=({rows:e,dimensionFieldId:t,primaryValue:o,secondaryValue:a})=>{if(!t)return [];let r=new Map;return e.forEach(n=>{let i=ua(n[t]),l=r.get(i);if(l){l.push(n);return}r.set(i,[n]);}),Array.from(r.entries()).sort((n,i)=>n[0].localeCompare(i[0],void 0,{sensitivity:"base"})).map(([n,i])=>({name:n,primaryValue:tn(i,o.fieldId,o.aggregation),secondaryValue:a?tn(i,a.fieldId,a.aggregation):void 0}))};var Gu=({rows:e,fieldMap:t,rowFields:o,columnFields:a,valueFields:r,chartDimensionFieldId:n,chartPrimaryValueFieldId:i,chartSecondaryValueFieldId:l,chartType:d,isCollapsed:s,onChartDimensionFieldIdChange:c,onChartPrimaryValueFieldIdChange:g,onChartSecondaryValueFieldIdChange:f,onChartTypeChange:u,onToggleCollapse:h,getAggregationLabel:w})=>{let{t:p}=Z(),v=useMemo(()=>Wu(o,a,t),[a,t,o]),m=useMemo(()=>$u(r,t,w),[t,w,r]),y=m.find(C=>C.fieldId===i)??m[0],x=m.find(C=>C.fieldId===l&&C.fieldId!==y?.fieldId)??null,k=v.find(C=>C.fieldId===n)??v[0],F=k&&y?p("pivot.chart.subtitleReady",{dimension:k.label,measure:x?`${y.label} / ${x.label}`:y.label}):p("pivot.chart.subtitle"),S=useMemo(()=>!k||!y?[]:Hu({rows:e,dimensionFieldId:k.fieldId,primaryValue:y.item,secondaryValue:x?.item}),[y,e,x,k]),T=C=>y?ti(C,y.item,t):C.toLocaleString(),A=C=>x?ti(C,x.item,t):C.toLocaleString(),R=v.length>1||m.length>1;return jsxs(sn,{title:p("pivot.chart.title"),subtitle:F,collapsed:s,onToggleCollapse:h,expandAriaLabel:p("pivot.chart.collapse.ariaExpand"),collapseAriaLabel:p("pivot.chart.collapse.ariaCollapse"),bodySx:{display:"flex",flexDirection:"column",gap:1.1},children:[R&&jsxs(Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",xl:"repeat(4, minmax(0, 1fr))"},gap:1,alignItems:"start"},children:[jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.dimension")}),jsx(Select,{value:k?.fieldId??"",onChange:C=>c(String(C.target.value)),sx:{fontSize:"0.75rem",height:32},children:v.map(C=>jsx(MenuItem,{value:C.fieldId,sx:{fontSize:"0.75rem"},children:C.label},C.fieldId))})]}),jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.primaryMeasure")}),jsx(Select,{value:y?.fieldId??"",onChange:C=>g(String(C.target.value)),sx:{fontSize:"0.75rem",height:32},children:m.map(C=>jsx(MenuItem,{value:C.fieldId,sx:{fontSize:"0.75rem"},children:C.label},C.fieldId))})]}),jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.secondaryMeasure")}),jsxs(Select,{value:x?.fieldId??"",onChange:C=>f(String(C.target.value)),sx:{fontSize:"0.75rem",height:32},children:[jsx(MenuItem,{value:"",sx:{fontSize:"0.75rem",color:"text.secondary"},children:p("common.none")}),m.filter(C=>C.fieldId!==y?.fieldId).map(C=>jsx(MenuItem,{value:C.fieldId,sx:{fontSize:"0.75rem"},children:C.label},C.fieldId))]})]}),jsxs(FormControl,{size:"small",sx:{minWidth:0,width:"100%"},children:[jsx(Typography,{sx:{fontSize:"0.68rem",color:"text.secondary",mb:.45},children:p("pivot.chart.chartType")}),jsxs(Select,{value:d,onChange:C=>u(C.target.value),sx:{fontSize:"0.75rem",height:32},children:[jsx(MenuItem,{value:"bar-vertical",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.barVertical")}),jsx(MenuItem,{value:"bar-horizontal",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.barHorizontal")}),jsx(MenuItem,{value:"line",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.line")}),jsx(MenuItem,{value:"scatter",sx:{fontSize:"0.75rem"},children:p("pivot.chart.style.scatter")})]})]})]}),jsx(Box,{children:k?y?S.length===0?jsx(Box,{sx:{py:5,textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:p("pivot.chart.emptyNoData")})}):d==="scatter"?jsx(Nu,{data:S,primaryLabel:y.label,secondaryLabel:x?.label,formatPrimaryValue:T,formatSecondaryValue:A}):jsx(Ou,{data:S,chartType:d,primaryLabel:y.label,secondaryLabel:x?.label,formatPrimaryValue:T,formatSecondaryValue:A}):jsx(Box,{sx:{py:5,textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:p("pivot.chart.emptyNoValue")})}):jsx(Box,{sx:{py:5,textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:p("pivot.chart.emptyNoDimension")})})})]})};var zs=({node:e,dataColumns:t,fieldMap:o,level:a,expandedKeys:r,onToggle:n,getValue:i})=>{let l=r.has(e.key),d=e.children.length>0,s=e.isGrandTotal;return jsxs(Fragment,{children:[jsxs(TableRow,{sx:c=>({bgcolor:s?c.palette.mode==="dark"?"rgba(25, 118, 210, 0.22)":"rgba(47, 91, 255, 0.08)":c.palette.mode==="dark"?"#111111":"background.paper","&:hover":{bgcolor:s?c.palette.mode==="dark"?"rgba(25, 118, 210, 0.28)":"rgba(47, 91, 255, 0.12)":c.palette.mode==="dark"?"#181818":"rgba(0, 0, 0, 0.02)"}}),children:[jsxs(TableCell,{sx:c=>({fontSize:"0.76rem",fontWeight:s?800:600,borderBottom:`1px solid ${c.palette.divider}`,whiteSpace:"nowrap",pl:a*2+1,display:"flex",alignItems:"center",height:40}),children:[d&&!s&&jsx(IconButton,{size:"small",onClick:()=>n(e.key),sx:{p:.2,mr:.5,ml:-1},children:l?jsx(Xf,{sx:{fontSize:16}}):jsx(Ff,{sx:{fontSize:16}})}),!d&&!s&&a>0&&jsx(Box,{sx:{width:20}}),e.value]}),t.map(c=>jsx(TableCell,{align:"right",sx:{fontSize:"0.76rem",fontWeight:s?800:500,borderBottom:g=>`1px solid ${g.palette.divider}`,whiteSpace:"nowrap"},children:ti(i?i(e,c.id):e.aggregatedValues[c.id]??0,c.valueItem,o)},`${e.key}-${c.id}`))]}),l&&e.children.map(c=>jsx(zs,{node:c,dataColumns:t,fieldMap:o,level:a+1,expandedKeys:r,onToggle:n,getValue:i},c.key))]})};var Dc=(e,t,o)=>{let a=[...e,...t];return o&&a.includes(o)?o:a[0]??""},Os=(e,t)=>t&&e.some(o=>o.fieldId===t)?t:e[0]?.fieldId??"",Mc=(e,t,o)=>o===""?"":o&&o!==t&&e.some(a=>a.fieldId===o)?o:e.find(a=>a.fieldId!==t)?.fieldId??"",Xu=e=>{let t=new Set,o=a=>{a.forEach(r=>{r.children.length>0&&(t.add(r.key),o(r.children));});};return o(e),t},Yu=(e,t,o=0)=>e.length===0?o:e.reduce((a,r)=>r.children.length===0||!t.has(r.key)?Math.max(a,o+1):Math.max(a,Yu(r.children,t,o+1)),o),Gv=(e,t)=>{let o=[],a=r=>{r.forEach(n=>{if(n.children.length>0&&t.has(n.key)){a(n.children);return}o.push(n);});};return a(e),o},qB=({title:e,rows:t,fields:o,initialLayout:a,initialChart:r,emptyText:n,maxPreviewHeight:i=520,initialChartCollapsed:l=false,initialTableCollapsed:d=false,model:s,enablePresetManagement:c=false,presets:g,defaultPresets:f,onPresetsChange:u,initialPresetId:h,onPresetApplied:w})=>{let{t:p}=Z(),v=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}})),m=useRef(0),y=useRef(false),x=e??p("pivot.title.default"),k=n??p("pivot.empty"),F=useMemo(()=>({sum:p("pivot.agg.sum"),count:p("pivot.agg.count"),avg:p("pivot.agg.avg"),min:p("pivot.agg.min"),max:p("pivot.agg.max")}),[p]),S=useCallback(b=>F[b]??bu[b],[F]),T=useMemo(()=>new Set(o.map(b=>b.id)),[o]),A=useMemo(()=>new Map(o.map(b=>[b.id,b])),[o]),[R,C]=useState(()=>ht(a?.rows,T)),[D,I]=useState(()=>ht(a?.columns,T)),[P,M]=useState(()=>ht(a?.filters,T)),[$,N]=useState(()=>{let b=a?.values??[],B=new Set,E=[];return b.forEach(W=>{if(!T.has(W.fieldId)||B.has(W.fieldId))return;B.add(W.fieldId),m.current+=1;let ee=A.get(W.fieldId);E.push({tokenId:`v${m.current}`,fieldId:W.fieldId,aggregation:$t(W.aggregation,ee)});}),E}),[X,oe]=useState({}),[te,re]=useState(true),[Q,U]=useState(false),[Y,Re]=useState(()=>Dc(ht(a?.rows,T),ht(a?.columns,T),r?.dimensionFieldId)),[j,fe]=useState(()=>{let b=(a?.values??[]).filter((B,E,W)=>T.has(B.fieldId)&&W.findIndex(ee=>ee.fieldId===B.fieldId)===E).map(B=>({tokenId:B.fieldId,fieldId:B.fieldId,aggregation:$t(B.aggregation,A.get(B.fieldId))}));return Os(b,r?.primaryValueFieldId)}),[Se,Ne]=useState(()=>{let b=(a?.values??[]).filter((E,W,ee)=>T.has(E.fieldId)&&ee.findIndex(ue=>ue.fieldId===E.fieldId)===W).map(E=>({tokenId:E.fieldId,fieldId:E.fieldId,aggregation:$t(E.aggregation,A.get(E.fieldId))})),B=Os(b,r?.primaryValueFieldId);return Mc(b,B,r?.secondaryValueFieldId)}),[Ke,ve]=useState(r?.chartType??"bar-vertical"),[Fe,xo]=useState(l),[jt,Qe]=useState(d),[Mt,Lt]=useState(()=>f??[]),[bt,H]=useState(""),[he,pe]=useState(false),[ye,Xe]=useState(""),[Ve,co]=useState(null),[vo,Co]=useState(new Set(["__grand_total__"])),[ko,So]=useState(new Set),Me=s?.rowFields??R,ge=s?.columnFields??D,xt=s?.filterFields??P,Ee=s?.valueFields??$,zt=s?.filterSelections??X,wo=s?.showGrandTotal??te,_a=s?.isConfiguratorCollapsed??Q,V=s?.chartDimensionFieldId??Y,O=s?.chartPrimaryValueFieldId??j,K=s?.chartSecondaryValueFieldId??Se,be=s?.chartType??Ke,Ce=s?.isChartCollapsed??Fe,Be=s?.isTableCollapsed??jt,me=g??Mt,Le=c||me.length>0||!!u,we=useCallback(b=>{if(s?.setRowFields){s.setRowFields(b);return}C(b);},[s]),ze=useCallback(b=>{if(s?.setColumnFields){s.setColumnFields(b);return}I(b);},[s]),Ae=useCallback(b=>{if(s?.setFilterFields){s.setFilterFields(b);return}M(b);},[s]),ke=useCallback(b=>{if(s?.setValueFields){s.setValueFields(b);return}N(b);},[s]),De=useCallback(b=>{if(s?.setFilterSelections){s.setFilterSelections(b);return}oe(b);},[s]),Nt=useCallback(b=>{if(s?.setShowGrandTotal){s.setShowGrandTotal(b);return}re(b);},[s]),To=useCallback(b=>{if(s?.setIsConfiguratorCollapsed){s.setIsConfiguratorCollapsed(b);return}U(b);},[s]),gt=useCallback(b=>{if(s?.setChartDimensionFieldId){s.setChartDimensionFieldId(b);return}Re(b);},[s]),vt=useCallback(b=>{if(s?.setChartPrimaryValueFieldId){s.setChartPrimaryValueFieldId(b);return}fe(b);},[s]),po=useCallback(b=>{if(s?.setChartSecondaryValueFieldId){s.setChartSecondaryValueFieldId(b);return}Ne(b);},[s]),va=useCallback(b=>{if(s?.setChartType){s.setChartType(b);return}ve(b);},[s]),Pr=useCallback(b=>{if(s?.setIsChartCollapsed){s.setIsChartCollapsed(b);return}xo(b);},[s]),Io=useCallback(b=>{if(s?.setIsTableCollapsed){s.setIsTableCollapsed(b);return}Qe(b);},[s]),Xt=useCallback(b=>{let B=typeof b=="function"?b(me):b;g||Lt(B),u?.(B);},[u,me,g]),Za=useMemo(()=>new Set([...Me,...ge,...xt]),[Me,ge,xt]),Qo=useMemo(()=>o.filter(b=>!Za.has(b.id)),[o,Za]),Vt=useMemo(()=>{let b=[...Me,...ge,...xt],B=new Set,E=[];return b.forEach(W=>{B.has(W)||(B.add(W),E.push(W));}),E},[ge,xt,Me]);useEffect(()=>{we(b=>{let B=b.filter(E=>T.has(E));return ma(b,B)?b:B}),ze(b=>{let B=b.filter(E=>T.has(E));return ma(b,B)?b:B}),Ae(b=>{let B=b.filter(E=>T.has(E));return ma(b,B)?b:B}),ke(b=>{let B=b.filter(E=>T.has(E.fieldId)).map(E=>({...E,aggregation:$t(E.aggregation,A.get(E.fieldId))}));return Ts(b,B)?b:B});},[A,T]);let Qt=useMemo(()=>{let b={};return Vt.forEach(B=>{let E=new Set;t.forEach(W=>{E.add(ua(W[B]));}),b[B]=Array.from(E).sort((W,ee)=>W.localeCompare(ee));}),b},[Vt,t]);useEffect(()=>{De(b=>{let B={};return Vt.forEach(E=>{let W=Qt[E]??[],ue=(b[E]??[]).filter(_=>W.includes(_)),L=Object.prototype.hasOwnProperty.call(b,E);B[E]=L?ue:W;}),wu(b,B)?b:B});},[Vt,Qt]),useEffect(()=>{gt(b=>Dc(Me,ge,b));},[ge,Me,gt]),useEffect(()=>{vt(b=>Os(Ee,b));},[vt,Ee]),useEffect(()=>{po(b=>Mc(Ee,O,b));},[O,po,Ee]);let At=useMemo(()=>t.filter(b=>Vt.every(B=>{let E=zt[B]??[],W=Qt[B]??[];if(E.length===W.length)return true;if(E.length===0)return false;let ee=ua(b[B]);return E.includes(ee)})),[Vt,Qt,zt,t]),Oe=useMemo(()=>{if(Ee.length===0)return null;let b=new Map;if(At.forEach(L=>{let _=ge.length>0?ge.map(_e=>ua(L[_e])):[p("pivot.valueLabel")],q=hr(_);b.set(q,_);}),b.size===0){let L=ge.length>0?ge.map(()=>Ss):[p("pivot.valueLabel")];b.set(hr(L),L);}let B=Array.from(b.entries()).sort((L,_)=>Su(L[1],_[1])),E=B.flatMap(([L,_])=>Ee.map(q=>{let _e=A.get(q.fieldId),z=`${S(q.aggregation)} ${_e?.label??q.fieldId}`,J=ge.length===0||Ee.length>1?`${_.join(" / ")} \u2022 ${z}`:_.join(" / ");return {id:`${L}::${q.tokenId}`,colKey:L,valueItem:q,label:J}})),W=[];ge.length>0&&B.forEach(([L,_])=>{let q=E.filter(J=>J.colKey===L),_e=W,z=[];_.forEach((J,G)=>{z.push(`d${G}:${J}`);let ie=`col::${hr(z)}`,We=_e.find(Uo=>Uo.key===ie);We||(We={key:ie,label:J,children:[],leafColumnIds:[],path:_.slice(0,G+1),depth:G},_e.push(We)),q.forEach(Uo=>{We.leafColumnIds.includes(Uo.id)||We.leafColumnIds.push(Uo.id);}),_e=We.children;});});let ee=L=>{let _={};return E.forEach(q=>{let _e=L.filter(z=>{let J=ge.length>0?ge.map(G=>ua(z[G])):[p("pivot.valueLabel")];return hr(J)===q.colKey});_[q.id]=tn(_e,q.valueItem.fieldId,q.valueItem.aggregation);}),_},ue=[];if(Me.length===0)ue.push({key:"root",value:p("pivot.resultLabel")||hu,children:[],isLeaf:true,aggregatedValues:ee(At),path:[],depth:0});else {let L=(_,q,_e)=>{if(q>=Me.length)return [];let z=Me[q],J=new Map;return _.forEach(G=>{let ie=ua(G[z]);J.has(ie)||J.set(ie,[]),J.get(ie).push(G);}),Array.from(J.keys()).sort().map(G=>{let ie=J.get(G),We=[..._e,G];return {key:hr(We),value:G,fieldId:z,aggregatedValues:ee(ie),children:L(ie,q+1,We),isLeaf:q===Me.length-1,path:We,depth:q}})};ue.push(...L(At,0,[]));}return {dataColumns:E,columnTree:W,rowTree:ue}},[ge,A,At,S,Me,p,Ee]),Yo=useCallback((b,B)=>(m.current+=1,{tokenId:`v${m.current}`,fieldId:b,aggregation:$t(B,A.get(b))}),[A]),Wo=useCallback(b=>{if(b==="rows")return we([]);if(b==="columns")return ze([]);if(b==="filters")return Ae([]);ke([]);},[]),Jo=useCallback((b,B)=>{if(b==="rows")return we(E=>E.filter(W=>W!==B));if(b==="columns")return ze(E=>E.filter(W=>W!==B));if(b==="filters")return Ae(E=>E.filter(W=>W!==B));ke(E=>E.filter(W=>W.tokenId!==B));},[]),ja=useCallback((b,B)=>{ke(E=>E.map(W=>W.tokenId===b?{...W,aggregation:$t(B,A.get(W.fieldId))}:W));},[A]),$o=useCallback(b=>{co(String(b.active.id));},[]),Xa=useCallback(b=>{if(co(null),!b.over)return;let B=ws(String(b.active.id)),E=ws(String(b.over.id));if(!B||!E||B.kind!=="item"||!B.key)return;if(B.zone===E.zone&&E.kind==="item"){if(B.zone==="rows"){let G=Me.indexOf(B.key),ie=Me.indexOf(E.key??"");G!==-1&&ie!==-1&&G!==ie&&we(We=>arrayMove(We,G,ie));return}if(B.zone==="columns"){let G=ge.indexOf(B.key),ie=ge.indexOf(E.key??"");G!==-1&&ie!==-1&&G!==ie&&ze(We=>arrayMove(We,G,ie));return}if(B.zone==="filters"){let G=xt.indexOf(B.key),ie=xt.indexOf(E.key??"");G!==-1&&ie!==-1&&G!==ie&&Ae(We=>arrayMove(We,G,ie));return}if(B.zone==="values"){let G=Ee.findIndex(We=>We.tokenId===B.key),ie=Ee.findIndex(We=>We.tokenId===(E.key??""));G!==-1&&ie!==-1&&G!==ie&&ke(We=>arrayMove(We,G,ie));}return}let W=E.zone,ee=[...Me],ue=[...ge],L=[...xt],_=[...Ee],q="",_e=null;if(B.zone==="palette")q=B.key;else if(B.zone==="values"){let G=_.find(ie=>ie.tokenId===B.key);if(!G)return;q=G.fieldId,_e=G,_=_.filter(ie=>ie.tokenId!==B.key);}else B.zone==="rows"?(q=B.key,ee=ee.filter(G=>G!==q)):B.zone==="columns"?(q=B.key,ue=ue.filter(G=>G!==q)):B.zone==="filters"&&(q=B.key,L=L.filter(G=>G!==q));if(!q)return;let z=()=>{ee=ee.filter(G=>G!==q),ue=ue.filter(G=>G!==q),L=L.filter(G=>G!==q);},J=G=>{if(E.kind!=="item"||!E.key)return G==="rows"?ee.length:G==="columns"?ue.length:G==="filters"?L.length:G==="values"?_.length:0;if(G==="rows"){let ie=ee.indexOf(E.key);return ie>=0?ie:ee.length}if(G==="columns"){let ie=ue.indexOf(E.key);return ie>=0?ie:ue.length}if(G==="filters"){let ie=L.indexOf(E.key);return ie>=0?ie:L.length}if(G==="values"){let ie=_.findIndex(We=>We.tokenId===E.key);return ie>=0?ie:_.length}return 0};if(W==="palette"){we(ee),ze(ue),Ae(L),ke(_);return}if(W==="values"){let G=J("values"),ie=_e??Yo(q);_.splice(G,0,ie),we(ee),ze(ue),Ae(L),ke(_);return}if(ku(W)){z();let G=J(W);W==="rows"?ee.splice(G,0,q):W==="columns"?ue.splice(G,0,q):L.splice(G,0,q),we(ee),ze(ue),Ae(L),ke(_);}},[ge,Yo,xt,Me,Ee]),Qa=useCallback((b,B)=>{De(E=>({...E,[b]:B}));},[]),Ho=useCallback(b=>{Co(B=>{let E=new Set(B);return E.has(b)?E.delete(b):E.add(b),E});},[]),ea=useCallback(b=>{So(B=>{let E=new Set(B);return E.has(b)?E.delete(b):E.add(b),E});},[]),Ca=useCallback(b=>{let B=A.get(b.fieldId),E=hc(B);return jsx(FormControl,{size:"small",sx:{minWidth:98},children:jsx(Select,{value:b.aggregation,onChange:W=>ja(b.tokenId,W.target.value),onClick:W=>W.stopPropagation(),onMouseDown:W=>W.stopPropagation(),sx:{fontSize:"0.72rem",height:26,"& .MuiSelect-select":{py:.35}},children:E.map(W=>jsx(MenuItem,{value:W,sx:{fontSize:"0.75rem"},children:S(W)},W))})})},[A,S,ja]),Ot=useCallback(b=>{let B=Qt[b]??[],E=zt[b]??B;return B.length===0?p("pivot.filter.noValues"):E.length===0?p("pivot.filter.noneSelected"):E.length===B.length?p("pivot.filter.allValues"):p("pivot.filter.selectedCount",{selected:E.length,total:B.length})},[Qt,zt,p]),Po=useCallback(b=>{let B=Qt[b]??[],E=zt[b]??B;return jsx(Pu,{options:B,selectedValues:E,onChange:W=>Qa(b,W)})},[Qt,zt,Qa]),ta=useCallback(()=>`pivot-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,[]),uo=useCallback(()=>{let b={};return new Set([...Vt,...Object.keys(zt)]).forEach(E=>{if(!T.has(E))return;let W=zt[E]??[];b[E]=[...W];}),{layout:{rows:[...Me],columns:[...ge],filters:[...xt],values:Ee.map(E=>({fieldId:E.fieldId,aggregation:E.aggregation}))},filterSelections:b,showGrandTotal:wo,chart:{dimensionFieldId:V,primaryValueFieldId:O,secondaryValueFieldId:K,chartType:be}}},[Vt,V,O,K,be,ge,xt,zt,Me,wo,T,Ee]),Go=useCallback(b=>{let B=ht(b.layout.rows,T),E=ht(b.layout.columns,T),W=ht(b.layout.filters,T),ee=new Set,ue=(b.layout.values??[]).filter(q=>!T.has(q.fieldId)||ee.has(q.fieldId)?false:(ee.add(q.fieldId),true)).map(q=>Yo(q.fieldId,q.aggregation)),L={};Object.entries(b.filterSelections??{}).forEach(([q,_e])=>{!T.has(q)||!Array.isArray(_e)||(L[q]=Array.from(new Set(_e.map(z=>String(z)))));}),we(B),ze(E),Ae(W),ke(ue),De(L),typeof b.showGrandTotal=="boolean"&&Nt(b.showGrandTotal),gt(Dc(B,E,b.chart?.dimensionFieldId));let _=Os(ue,b.chart?.primaryValueFieldId);vt(_),po(Mc(ue,_,b.chart?.secondaryValueFieldId)),va(b.chart?.chartType??"bar-vertical"),H(b.id),w?.(b);},[Yo,w,gt,vt,po,va,ze,Ae,De,we,Nt,ke,T]),Ya=useCallback(b=>{if(!b){H("");return}let B=me.find(E=>E.id===b);if(!B){H("");return}Go(B);},[Go,me]),Rr=useCallback(()=>{let b=p("pivot.preset.defaultName",{index:me.length+1});Xe(b),pe(true);},[me.length,p]),ka=useCallback(()=>{let b=ye.trim();if(!b)return;let B={id:ta(),name:b,...uo()};Xt(E=>[...E,B]),H(B.id),pe(false);},[uo,ta,ye,Xt]),Ja=useCallback(()=>{bt&&(Xt(b=>b.filter(B=>B.id!==bt)),H(""));},[bt,Xt]);useEffect(()=>{if(!h||y.current)return;let b=me.find(B=>B.id===h);b&&(y.current=true,Go(b));},[Go,h,me]),useEffect(()=>{bt&&(me.some(b=>b.id===bt)||H(""));},[bt,me]);let oa=useMemo(()=>{if(!wo||!Oe||!Me.length)return null;let b={};return Oe.dataColumns.forEach(B=>{let E=At.filter(W=>{let ee=ge.length>0?ge.map(ue=>ua(W[ue])):[p("pivot.valueLabel")];return hr(ee)===B.colKey});b[B.id]=tn(E,B.valueItem.fieldId,B.valueItem.aggregation);}),{key:"__grand_total__",value:p("pivot.grandTotal")||yu,children:[],isLeaf:false,isGrandTotal:true,aggregatedValues:b,path:[],depth:-1}},[wo,Oe,At,ge,Me.length,p]),Ut=useMemo(()=>Xu(Oe?.rowTree??[]),[Oe]),Ro=useMemo(()=>Xu(Oe?.columnTree??[]),[Oe]);useEffect(()=>{Co(b=>{let B=new Set;return b.has("__grand_total__")&&B.add("__grand_total__"),Ut.forEach(E=>{b.has(E)&&B.add(E);}),B});},[Ut]),useEffect(()=>{So(b=>{let B=new Set;return Ro.forEach(E=>{b.has(E)&&B.add(E);}),B});},[Ro]);let Dr=useCallback(()=>{Co(b=>{let B=new Set(b);return Ut.forEach(E=>B.add(E)),B});},[Ut]),er=useCallback(()=>{Co(b=>{let B=new Set;return b.has("__grand_total__")&&B.add("__grand_total__"),B});},[]),Mr=useCallback(()=>{So(new Set(Ro));},[Ro]),Ar=useCallback(()=>{So(new Set);},[]),Br=useMemo(()=>!Oe||ge.length===0?[]:Gv(Oe.columnTree,ko),[ge.length,ko,Oe]),Yt=useMemo(()=>{if(!Oe)return [];if(ge.length===0)return Oe.dataColumns.map(B=>({id:B.id,label:B.label,leafColumnIds:[B.id],valueItem:B.valueItem}));let b=new Map(Oe.dataColumns.map(B=>[B.id,B]));return Br.flatMap(B=>{let E=new Map;return B.leafColumnIds.forEach(W=>{let ee=b.get(W);if(!ee)return;let ue=ee.valueItem.tokenId,L=`${S(ee.valueItem.aggregation)} ${A.get(ee.valueItem.fieldId)?.label??ee.valueItem.fieldId}`,_=E.get(ue);if(_){_.leafColumnIds.push(W);return}E.set(ue,{id:`${B.key}::${ue}`,label:Ee.length>1?L:B.label,leafColumnIds:[W],valueItem:ee.valueItem});}),Array.from(E.values())})},[ge.length,A,S,Oe,Ee.length,Br]),Fr=useMemo(()=>new Map(Yt.map(b=>[b.id,b])),[Yt]),Er=useMemo(()=>Yt.map(b=>({id:b.id,colKey:b.id,valueItem:b.valueItem,label:b.label})),[Yt]),tr=useMemo(()=>{if(!Oe||ge.length===0)return [];let b=[],B=Yu(Oe.columnTree,ko),E=B+(Ee.length>1?1:0),W=(ee,ue)=>{b[ue]??(b[ue]=[]),ee.forEach(L=>{let _=L.children.length>0&&ko.has(L.key),q=Yt.filter(z=>L.leafColumnIds.some(J=>z.leafColumnIds.includes(J))).length,_e=_||Ee.length>1?1:E-ue;b[ue].push({key:L.key,label:L.label,colSpan:q,rowSpan:_e,expandable:L.children.length>0,expanded:_}),_&&W(L.children,ue+1);});};return W(Oe.columnTree,0),Ee.length>1&&(b[B]=Yt.map(ee=>({key:ee.id,label:ee.label,colSpan:1,rowSpan:1,expandable:false,expanded:false}))),b},[ge.length,ko,Oe,Ee.length,Yt]),aa=useCallback((b,B)=>B.leafColumnIds.reduce((E,W)=>E+(b.aggregatedValues[W]??0),0),[]),Sa=useMemo(()=>jsxs(Fragment,{children:[jsx(Button,{size:"small",variant:"text",onClick:Dr,disabled:Ut.size===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.expandRowsAll")}),jsx(Button,{size:"small",variant:"text",onClick:er,disabled:Ut.size===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.collapseRowsAll")}),jsx(Divider,{orientation:"vertical",flexItem:true}),jsx(Button,{size:"small",variant:"text",onClick:Mr,disabled:Ro.size===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.expandColumnsAll")}),jsx(Button,{size:"small",variant:"text",onClick:Ar,disabled:ge.length===0,sx:{minWidth:"auto",px:.8,fontSize:"0.72rem"},children:p("pivot.table.collapseColumnsAll")})]}),[ge.length,Ro.size,Ut.size,Ar,er,Mr,Dr,p]),wa=()=>{if(!Ve)return null;let b=ws(Ve);if(!b||b.kind!=="item"||!b.key)return null;if(b.zone==="palette"){let ee=A.get(b.key);return ee?jsx(bc,{label:ee.label,subtitle:ee.type}):null}if(b.zone==="values"){let ee=Ee.find(q=>q.tokenId===b.key);if(!ee)return null;let L=A.get(ee.fieldId)?.label??ee.fieldId,_=`${S(ee.aggregation)}(${L})`;return jsx(Ms,{label:L,caption:_})}let E=A.get(b.key)?.label??b.key,W=Ot(b.key);return jsx(Ms,{label:E,caption:W})};return jsxs(Paper,{sx:b=>({p:{xs:1.2,md:2},borderRadius:4,border:`1px solid ${b.palette.divider}`,bgcolor:"background.paper",boxShadow:b.palette.mode==="dark"?"none":"0 12px 28px rgba(15, 23, 42, 0.08)",display:"flex",flexDirection:"column",gap:2}),children:[jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:1.5,flexWrap:"wrap"},children:[jsxs(Box,{children:[jsx(Typography,{sx:{fontSize:"1.05rem",fontWeight:800},children:x}),jsx(Typography,{sx:{fontSize:"0.78rem",color:"text.secondary"},children:p("pivot.subtitle.default")})]}),jsxs(Stack,{direction:"row",spacing:1.5,alignItems:"center",children:[Le&&jsxs(Fragment,{children:[jsx(FormControl,{size:"small",sx:{minWidth:200},children:jsxs(Select,{value:bt,displayEmpty:true,onChange:b=>Ya(String(b.target.value)),sx:{fontSize:"0.75rem",height:32},children:[jsx(MenuItem,{value:"",sx:{fontSize:"0.75rem",color:"text.secondary"},children:p("pivot.preset.selectPlaceholder")}),me.map(b=>jsx(MenuItem,{value:b.id,sx:{fontSize:"0.75rem"},children:b.name},b.id))]})}),jsx(Tooltip,{title:p("pivot.preset.save"),children:jsx(IconButton,{size:"small",onClick:Rr,"aria-label":p("pivot.preset.save"),children:jsx(kp,{sx:{fontSize:18}})})}),jsx(Tooltip,{title:p("pivot.preset.delete"),children:jsx("span",{children:jsx(IconButton,{size:"small",onClick:Ja,disabled:!bt,"aria-label":p("pivot.preset.delete"),children:jsx(Ev,{sx:{fontSize:18}})})})}),jsx(Divider,{flexItem:true,orientation:"vertical"})]}),jsxs(Typography,{sx:{fontSize:"0.74rem",color:"text.secondary"},children:[p("pivot.records"),": ",jsx("strong",{children:t.length.toLocaleString()})," / ",p("pivot.afterFilter"),":"," ",jsx("strong",{children:At.length.toLocaleString()})]}),jsx(Divider,{flexItem:true,orientation:"vertical"}),jsxs(Box,{sx:{display:"flex",alignItems:"center",gap:.6},children:[jsx(Typography,{sx:{fontSize:"0.74rem"},children:p("pivot.grandTotal")}),jsx(Switch,{size:"small",checked:wo,onChange:b=>Nt(b.target.checked)})]})]})]}),jsx(Divider,{}),jsxs(DndContext,{sensors:v,collisionDetection:closestCenter,onDragStart:$o,onDragEnd:Xa,children:[jsx(Lu,{isConfiguratorCollapsed:_a,onToggleCollapse:()=>To(b=>!b),availableFields:Qo,fieldMap:A,filterFields:xt,columnFields:ge,rowFields:Me,valueFields:Ee,clearZone:Wo,removeFieldFromZone:Jo,getFilterSelectionSummary:Ot,renderDimensionFilterSelect:Po,renderAggregationSelect:Ca,getAggregationLabel:S}),jsx(Portal,{children:jsx(DragOverlay,{dropAnimation:{duration:250,easing:"cubic-bezier(0.18, 0.67, 0.6, 1.22)"},children:wa()})})]}),jsx(Gu,{rows:At,fieldMap:A,rowFields:Me,columnFields:ge,valueFields:Ee,chartDimensionFieldId:V,chartPrimaryValueFieldId:O,chartSecondaryValueFieldId:K,chartType:be,isCollapsed:Ce,onChartDimensionFieldIdChange:b=>gt(b),onChartPrimaryValueFieldIdChange:b=>vt(b),onChartSecondaryValueFieldIdChange:b=>po(b),onChartTypeChange:b=>va(b),onToggleCollapse:()=>Pr(b=>!b),getAggregationLabel:S}),jsx(sn,{title:p("pivot.table.sectionTitle"),subtitle:Me.length>0?Me.map(b=>A.get(b)?.label??b).join(" > "):p("pivot.table.dimensions"),collapsed:Be,onToggleCollapse:()=>Io(b=>!b),expandAriaLabel:p("pivot.table.collapse.ariaExpand"),collapseAriaLabel:p("pivot.table.collapse.ariaCollapse"),bodySx:{p:0},headerActions:Sa,children:Oe===null?jsx(Box,{sx:{py:5,px:{xs:1.2,md:1.6},textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.86rem",color:"text.secondary"},children:k})}):jsx(TableContainer,{sx:{maxHeight:i},children:jsxs(Table,{size:"small",stickyHeader:true,children:[jsx(TableHead,{children:(tr.length>0?tr:[[]]).map((b,B)=>jsxs(TableRow,{children:[B===0&&jsx(TableCell,{rowSpan:Math.max(tr.length,1),sx:E=>({fontWeight:800,fontSize:"0.76rem",color:"text.primary",bgcolor:E.palette.mode==="dark"?"#000000":"#f5f5f5",borderBottom:`1px solid ${E.palette.divider}`,pl:2,minWidth:220,verticalAlign:"middle"}),children:Me.length>0?Me.map(E=>A.get(E)?.label).join(" > "):p("pivot.table.dimensions")}),(b.length>0?b:Yt.map(E=>({key:E.id,label:E.label,colSpan:1,rowSpan:1,expandable:false,expanded:false}))).map(E=>jsx(TableCell,{align:"center",colSpan:E.colSpan,rowSpan:E.rowSpan,sx:W=>({fontWeight:800,fontSize:"0.75rem",color:"text.primary",bgcolor:W.palette.mode==="dark"?"#000000":"#f5f5f5",borderBottom:`1px solid ${W.palette.divider}`,minWidth:148,verticalAlign:"middle"}),children:jsxs(Box,{sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:.4},children:[E.expandable&&jsx(IconButton,{size:"small",onClick:()=>ea(E.key),sx:{p:.1,ml:-0.3},children:E.expanded?jsx(Xf,{sx:{fontSize:16}}):jsx(Ff,{sx:{fontSize:16}})}),jsx(Box,{component:"span",children:E.label})]})},E.key))]},`pivot-header-row-${B}`))}),jsxs(TableBody,{children:[Oe.rowTree.map(b=>jsx(zs,{node:b,dataColumns:Er,fieldMap:A,level:0,expandedKeys:vo,onToggle:Ho,getValue:(B,E)=>{let W=Fr.get(E);return W?aa(B,W):0}},b.key)),oa&&jsx(zs,{node:oa,dataColumns:Er,fieldMap:A,level:0,expandedKeys:vo,onToggle:Ho,getValue:(b,B)=>{let E=Fr.get(B);return E?aa(b,E):0}})]})]})})}),jsxs(Dialog,{open:he,onClose:()=>pe(false),maxWidth:"xs",fullWidth:true,children:[jsx(DialogTitle,{children:p("pivot.preset.saveDialogTitle")}),jsx(DialogContent,{children:jsx(TextField,{autoFocus:true,fullWidth:true,margin:"dense",label:p("pivot.preset.nameLabel"),value:ye,onChange:b=>Xe(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),ka());}})}),jsxs(DialogActions,{children:[jsx(Button,{onClick:()=>pe(false),children:p("common.cancel")}),jsx(Button,{variant:"contained",onClick:ka,disabled:!ye.trim(),children:p("common.save")})]})]})]})};var Ju=(e,t,o)=>{let a=[...e,...t];return o&&a.includes(o)?o:a[0]??""},Bc=(e,t)=>t&&e.some(o=>o.fieldId===t)?t:e[0]?.fieldId??"",em=(e,t,o)=>o===""?"":o&&o!==t&&e.some(a=>a.fieldId===o)?o:e.find(a=>a.fieldId!==t)?.fieldId??"",QB=({fields:e,initialLayout:t,initialFilterSelections:o={},initialShowGrandTotal:a=true,initialConfiguratorCollapsed:r=false,initialChart:n,initialChartCollapsed:i=false,initialTableCollapsed:l=false})=>{let d=useRef(0),s=useMemo(()=>new Set(e.map(H=>H.id)),[e]),c=useMemo(()=>new Map(e.map(H=>[H.id,H])),[e]),[g,f]=useState(()=>ht(t?.rows,s)),[u,h]=useState(()=>ht(t?.columns,s)),[w,p]=useState(()=>ht(t?.filters,s)),[v,m]=useState(()=>{let H=t?.values??[],he=new Set,pe=[];return H.forEach(ye=>{!s.has(ye.fieldId)||he.has(ye.fieldId)||(he.add(ye.fieldId),d.current+=1,pe.push({tokenId:`v${d.current}`,fieldId:ye.fieldId,aggregation:$t(ye.aggregation,c.get(ye.fieldId))}));}),pe}),[y,x]=useState(o),[k,F]=useState(a),[S,T]=useState(r),[A,R]=useState(()=>Ju(ht(t?.rows,s),ht(t?.columns,s),n?.dimensionFieldId)),[C,D]=useState(()=>{let H=(()=>{let he=t?.values??[],pe=new Set,ye=[];return he.forEach(Xe=>{!s.has(Xe.fieldId)||pe.has(Xe.fieldId)||(pe.add(Xe.fieldId),ye.push({tokenId:Xe.fieldId,fieldId:Xe.fieldId,aggregation:$t(Xe.aggregation,c.get(Xe.fieldId))}));}),ye})();return Bc(H,n?.primaryValueFieldId)}),[I,P]=useState(()=>{let H=(()=>{let pe=t?.values??[],ye=new Set,Xe=[];return pe.forEach(Ve=>{!s.has(Ve.fieldId)||ye.has(Ve.fieldId)||(ye.add(Ve.fieldId),Xe.push({tokenId:Ve.fieldId,fieldId:Ve.fieldId,aggregation:$t(Ve.aggregation,c.get(Ve.fieldId))}));}),Xe})(),he=Bc(H,n?.primaryValueFieldId);return em(H,he,n?.secondaryValueFieldId)}),[M,$]=useState(n?.chartType??"bar-vertical"),[N,X]=useState(i),[oe,te]=useState(l);useEffect(()=>{f(H=>{let he=H.filter(pe=>s.has(pe));return ma(H,he)?H:he}),h(H=>{let he=H.filter(pe=>s.has(pe));return ma(H,he)?H:he}),p(H=>{let he=H.filter(pe=>s.has(pe));return ma(H,he)?H:he}),m(H=>{let he=H.filter(pe=>s.has(pe.fieldId)).map(pe=>({...pe,aggregation:$t(pe.aggregation,c.get(pe.fieldId))}));return Ts(H,he)?H:he});},[c,s]),useEffect(()=>{R(H=>Ju(g,u,H));},[u,g]),useEffect(()=>{D(H=>Bc(v,H));},[v]),useEffect(()=>{P(H=>em(v,C,H));},[C,v]);let re=useCallback(H=>{f(ht(H,s));},[s]),Q=useCallback(H=>{h(ht(H,s));},[s]),U=useCallback(H=>{p(ht(H,s));},[s]),Y=useCallback(H=>{m(he=>{let pe=H??[],ye=new Set,Xe=[];return pe.forEach(Ve=>{if(!s.has(Ve.fieldId)||ye.has(Ve.fieldId))return;ye.add(Ve.fieldId);let co=he.find(vo=>vo.fieldId===Ve.fieldId);if(co){Xe.push({...co,aggregation:$t(Ve.aggregation??co.aggregation,c.get(Ve.fieldId))});return}d.current+=1,Xe.push({tokenId:`v${d.current}`,fieldId:Ve.fieldId,aggregation:$t(Ve.aggregation,c.get(Ve.fieldId))});}),Xe});},[c,s]),Re=useCallback(H=>{re(H.rows??[]),Q(H.columns??[]),U(H.filters??[]),Y(H.values??[]);},[Q,U,re,Y]),j=useCallback(H=>{if(H==="rows")return f([]);if(H==="columns")return h([]);if(H==="filters")return p([]);m([]);},[]),fe=useCallback((H,he)=>{if(H==="rows")return f(pe=>pe.filter(ye=>ye!==he));if(H==="columns")return h(pe=>pe.filter(ye=>ye!==he));if(H==="filters")return p(pe=>pe.filter(ye=>ye!==he));m(pe=>pe.filter(ye=>ye.tokenId!==he));},[]),Se=useCallback((H,he)=>{m(pe=>pe.map(ye=>ye.tokenId===H?{...ye,aggregation:$t(he,c.get(ye.fieldId))}:ye));},[c]),Ne=useCallback((H,he)=>{x(pe=>({...pe,[H]:he}));},[]),Ke=useCallback(()=>{x({});},[]),ve=useCallback(()=>{F(H=>!H);},[]),Fe=useCallback(()=>{T(H=>!H);},[]),xo=useCallback(H=>{R(H);},[]),jt=useCallback(H=>{D(H);},[]),Qe=useCallback(H=>{P(H);},[]),Mt=useCallback(()=>{X(H=>!H);},[]),Lt=useCallback(()=>{te(H=>!H);},[]);return {model:useMemo(()=>({rowFields:g,setRowFields:f,columnFields:u,setColumnFields:h,filterFields:w,setFilterFields:p,valueFields:v,setValueFields:m,filterSelections:y,setFilterSelections:x,showGrandTotal:k,setShowGrandTotal:F,isConfiguratorCollapsed:S,setIsConfiguratorCollapsed:T,chartDimensionFieldId:A,setChartDimensionFieldId:R,chartPrimaryValueFieldId:C,setChartPrimaryValueFieldId:D,chartSecondaryValueFieldId:I,setChartSecondaryValueFieldId:P,chartType:M,setChartType:$,isChartCollapsed:N,setIsChartCollapsed:X,isTableCollapsed:oe,setIsTableCollapsed:te}),[A,C,I,M,u,w,y,N,S,oe,g,k,v]),actions:{setRows:re,setColumns:Q,setFilters:U,setValues:Y,setLayout:Re,clearZone:j,removeFieldFromZone:fe,setAggregationForValue:Se,setFilterSelection:Ne,resetFilterSelections:Ke,toggleGrandTotal:ve,toggleConfigurator:Fe,setChartDimension:xo,setChartPrimaryValue:jt,setChartSecondaryValue:Qe,setChartType:$,toggleChart:Mt,toggleTable:Lt}}};var o5=({orientation:e="auto",defaultNavigationOpen:t,onNavOpenChange:o}={})=>{let a=useTheme$1(),r=useMediaQuery("(orientation: portrait)",{noSsr:true}),n=useMediaQuery(a.breakpoints.down("md"),{noSsr:true}),i=useMemo(()=>e==="auto"?r||n?"portrait":"landscape":e,[n,r,e]),[l,d]=useState(t??i==="landscape");useEffect(()=>{d(t??i==="landscape");},[t,i]);let s=g=>{d(g),o?.(g);};return {resolvedOrientation:i,isPortraitViewport:r,isCompactViewport:n,navigationOpen:l,setNavigationOpen:s,toggleNavigationOpen:()=>s(!l)}};var Xv=e=>{let t=Number(e||0);return Number.isFinite(t)?t:0},n5=({rows:e,rowKey:t="id",numericField:o,defaultSelectedId:a})=>{let n=e[0]?.[t],[i,l]=useState(a??n),d=useMemo(()=>e.find(u=>u[t]===i)||e[0],[t,e,i]),[s,c]=useState(()=>{let u=d?.[o];return u==null?"0":String(u)});return {selectedId:i,selectedRecord:d,editorValue:s,setEditorValue:c,selectRecord:u=>{let h=u[t];l(h);let w=u[o];c(w==null?"0":String(w));},applyEditorValue:u=>{if(i===void 0)return;let h=Xv(s),w=e.map(p=>p[t]===i?{...p,[o]:h}:p);u(w);}}};var sC=["code_128","ean_13","ean_8","qr_code","upc_a","upc_e"],im=(e,t,o,a)=>{t?.(e),a&&o?.();},p5=({open:e,onClose:t,title:o="Scan barcode",subtitle:a="Use the rear camera on the device. If scanning is unavailable, enter the code manually.",formats:r=sC,facingMode:n="environment",manualEntry:i=true,autoCloseOnDetect:l=true,scanIntervalMs:d=600,confirmLabel:s="Use code",cancelLabel:c="Close",manualPlaceholder:g="Enter barcode manually",onDetected:f,onError:u,sx:h})=>{let w=ct__default.useRef(null),p=ct__default.useRef(null),v=ct__default.useRef(null),m=ct__default.useRef(null),[y,x]=ct__default.useState("idle"),[k,F]=ct__default.useState(""),[S,T]=ct__default.useState(null),[A,R]=ct__default.useState(null),C=ct__default.useCallback(()=>{v.current!==null&&(window.clearInterval(v.current),v.current=null),p.current&&(p.current.getTracks().forEach(P=>P.stop()),p.current=null),w.current&&(w.current.srcObject=null);},[]),D=ct__default.useCallback(P=>{R(P),x("error"),u?.(P);},[u]);ct__default.useEffect(()=>{if(!e){C(),x("idle"),R(null),F("");return}let P=false;return (async()=>{if(!(typeof window>"u"||typeof navigator>"u")){if(!navigator.mediaDevices?.getUserMedia){x("unsupported"),R("Camera access is not supported in this browser.");return}x("starting"),R(null);try{let $=await navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:{ideal:n}}});if(P){$.getTracks().forEach(N=>N.stop());return}if(p.current=$,w.current&&(w.current.srcObject=$,await w.current.play()),!window.BarcodeDetector){x("unsupported"),R("BarcodeDetector is not available. Camera preview is ready and manual entry is enabled.");return}m.current=new window.BarcodeDetector({formats:r}),x("ready"),v.current=window.setInterval(async()=>{if(!(!w.current||!m.current)&&!(w.current.readyState<HTMLMediaElement.HAVE_CURRENT_DATA))try{let X=(await m.current.detect(w.current)).find(te=>te.rawValue);if(!X?.rawValue)return;let oe={rawValue:X.rawValue,format:X.format};T(oe),C(),im(oe,f,t,l);}catch(N){D(N instanceof Error?N.message:"Failed to detect barcode.");}},d);}catch($){D($ instanceof Error?$.message:"Unable to start camera.");}}})(),()=>{P=true,C();}},[l,n,r,t,f,e,D,d,C]);let I=()=>{let P=k.trim();if(!P)return;let M={rawValue:P,format:"manual"};T(M),im(M,f,t,l);};return jsxs(Dialog,{open:e,onClose:t,fullWidth:true,maxWidth:"sm",children:[jsx(DialogTitle,{sx:{fontSize:"1rem",fontWeight:900},children:o}),jsx(DialogContent,{sx:{pt:"8px !important"},children:jsxs(Stack,{spacing:2,sx:h,children:[jsx(Typography,{sx:{fontSize:"0.88rem",color:"text.secondary",lineHeight:1.55},children:a}),jsxs(Paper,{elevation:0,sx:P=>({position:"relative",overflow:"hidden",borderRadius:4,border:"1px solid",borderColor:"divider",minHeight:280,background:P.palette.mode==="dark"?"linear-gradient(180deg, rgba(15,23,42,0.92), rgba(2,6,23,0.96))":"linear-gradient(180deg, rgba(241,245,249,1), rgba(226,232,240,0.92))"}),children:[jsx("video",{ref:w,muted:true,playsInline:true,autoPlay:true,style:{width:"100%",height:280,objectFit:"cover",display:"block"}}),jsx(Box,{sx:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},children:jsx(Box,{sx:{width:"72%",maxWidth:320,aspectRatio:"1.7 / 1",borderRadius:3,border:"2px solid rgba(255,255,255,0.95)",boxShadow:"0 0 0 999px rgba(15,23,42,0.24)",position:"relative"},children:jsx(Box,{sx:{position:"absolute",top:"50%",left:0,right:0,height:2,bgcolor:"#38bdf8",boxShadow:"0 0 18px rgba(56,189,248,0.85)"}})})}),jsxs(Box,{sx:{position:"absolute",top:12,left:12,display:"flex",gap:1,flexWrap:"wrap"},children:[jsx(Chip,{icon:jsx(nC,{}),label:y==="ready"?"Camera ready":y==="starting"?"Starting camera":y==="unsupported"?"Preview only":y==="error"?"Scanner error":"Idle",size:"small",color:y==="error"?"error":"primary",variant:"filled"}),S?jsx(Chip,{icon:jsx(iC,{}),label:`${S.format||"barcode"}: ${S.rawValue}`,size:"small",color:"success",variant:"filled"}):null]})]}),A?jsx(Alert,{severity:y==="unsupported"?"info":"warning",children:A}):null,i?jsxs(Stack,{direction:{xs:"column",sm:"row"},spacing:1.25,children:[jsx(TextField,{fullWidth:true,label:"Barcode",placeholder:g,value:k,onChange:P=>F(P.target.value)}),jsx(Button,{variant:"contained",onClick:I,sx:{minHeight:56,px:2.5},children:s})]}):null]})}),jsx(DialogActions,{sx:{px:3,pb:2},children:jsx(Button,{onClick:t,children:c})})]})};var pC={default:"#475569",primary:"#1d4ed8",success:"#047857",warning:"#b45309",error:"#b91c1c",info:"#0369a1"},y5=({title:e,description:t,kicker:o,icon:a,badges:r=[],metrics:n=[],footer:i,children:l,selected:d=false,draggable:s=false,isDragging:c=false,swipeThreshold:g=88,startAction:f,endAction:u,dragHandleProps:h,onClick:w,onSwipe:p,sx:v})=>{let[m,y]=useState(0),[x,k]=useState(false),F=useRef(null),S=useRef(0),T=useRef(0),A=!!(f||u),R=132,C=()=>{y(0),k(false),F.current=null,S.current=0,T.current=0;},D=N=>{(N==="start"?f:u)?.onTrigger?.(),p?.(N),C();},I=N=>{!A||N.target.closest('button, a, input, textarea, [data-no-swipe="true"]')||(F.current=N.pointerId,S.current=N.clientX,T.current=N.clientX,k(true),N.currentTarget.setPointerCapture(N.pointerId));},P=N=>{if(!x||F.current!==N.pointerId)return;T.current=N.clientX;let X=T.current-S.current,oe=Math.max(-R,Math.min(R,X));y(oe);},M=N=>{if(!x||F.current!==N.pointerId)return;let X=T.current-S.current;if(X>=g&&f){D("start");return}if(X<=-g&&u){D("end");return}Math.abs(X)<12&&w?.(),C();},$=(N,X)=>{if(!N)return null;let oe=N.backgroundColor||pC[N.tone||"default"];return jsx(Box,{sx:{position:"absolute",top:0,bottom:0,[X]:0,width:R,px:2,display:"flex",alignItems:"center",justifyContent:X==="left"?"flex-start":"flex-end",color:"#fff",background:`linear-gradient(135deg, ${oe}, rgba(15,23,42,0.92))`},children:jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[N.icon,jsx(Typography,{sx:{fontWeight:700,fontSize:"0.95rem"},children:N.label})]})})};return jsxs(Box,{sx:{position:"relative",overflow:"hidden",borderRadius:4,...v},children:[$(f,"left"),$(u,"right"),jsx(Paper,{elevation:0,onPointerDown:I,onPointerMove:P,onPointerUp:M,onPointerCancel:C,sx:N=>({position:"relative",zIndex:1,p:2,borderRadius:4,border:"1px solid",borderColor:d?"primary.main":"divider",background:N.palette.mode==="dark"?"linear-gradient(180deg, rgba(30,41,59,0.96), rgba(15,23,42,0.92))":"linear-gradient(180deg, #ffffff, #f8fafc)",color:"text.primary",boxShadow:d?"0 18px 42px rgba(37, 99, 235, 0.18)":"0 12px 28px rgba(15, 23, 42, 0.08)",transform:`translate3d(${m}px, 0, 0) scale(${c?.985:1})`,transition:x?"none":"transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease",touchAction:"pan-y",cursor:w?"pointer":"default",opacity:c?.9:1}),children:jsxs(Stack,{spacing:1.5,children:[jsxs(Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",children:[a?jsx(Box,{sx:{mt:.25},children:a}):null,jsxs(Box,{sx:{flex:1,minWidth:0},children:[o?jsx(Typography,{sx:{fontSize:"0.72rem",fontWeight:700,letterSpacing:"0.08em",color:"text.secondary"},children:o}):null,jsx(Typography,{sx:{fontSize:"1.05rem",fontWeight:800,lineHeight:1.25},children:e}),t?jsx(Typography,{sx:{mt:.5,fontSize:"0.9rem",color:"text.secondary",lineHeight:1.45},children:t}):null]}),s?jsx(Box,{"data-no-swipe":"true",...h,sx:{alignSelf:"center",display:"inline-flex",touchAction:"none"},children:jsx(IconButton,{size:"small",children:jsx(dC,{})})}):null]}),r.length>0?jsx(Stack,{direction:"row",spacing:1,useFlexGap:true,flexWrap:"wrap",children:r.map((N,X)=>jsx(Chip,{label:N,size:"small",sx:{borderRadius:999,fontWeight:700,bgcolor:"action.hover",color:"text.primary"}},X))}):null,n.length>0?jsx(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(110px, 1fr))",gap:1},children:n.map(N=>jsxs(Paper,{elevation:0,sx:{p:1.25,borderRadius:3,bgcolor:"action.hover",border:"1px solid",borderColor:"divider",color:"text.primary"},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:N.label}),jsx(Typography,{sx:{fontSize:"1rem",fontWeight:800,lineHeight:1.2},children:N.value})]},N.id))}):null,l,i]})})]})};var pi=({label:e,onPress:t,emphasis:o="default"})=>jsx(Box,{component:"button",type:"button",onClick:t,sx:a=>({minHeight:72,borderRadius:3,border:"1px solid",borderColor:o==="primary"?"primary.main":"divider",background:o==="primary"?a.palette.primary.main:o==="danger"?a.palette.mode==="dark"?"rgba(239,68,68,0.18)":"rgba(239,68,68,0.10)":a.palette.mode==="dark"?"rgba(255,255,255,0.04)":"#fff",color:o==="primary"?"#fff":"text.primary",fontSize:"1.25rem",fontWeight:800,transition:"transform 120ms ease, box-shadow 160ms ease, background-color 160ms ease",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent","&:active":{transform:"scale(0.98)"}}),children:e}),I5=({value:e,defaultValue:t="",title:o,subtitle:a,placeholder:r="0",allowDecimal:n=false,allowNegative:i=false,maxLength:l,confirmLabel:d,clearLabel:s,backspaceLabel:c,onChange:g,onSubmit:f,onClose:u,sx:h})=>{let{t:w}=Z(),[p,v]=useState(t),m=e??p,y=C=>{e===void 0&&v(C),g?.(C);},x=C=>{l&&m.length>=l||y(`${m}${C}`);},k=C=>{if(C==="00"){if(!m){y("0");return}x("00");return}x(C);},F=()=>{!n||m.includes(".")||y(m?`${m}.`:"0.");},S=()=>{if(i){if(m.startsWith("-")){y(m.slice(1));return}y(m?`-${m}`:"-");}},T=()=>{y(m.slice(0,-1));},A=()=>{y("");},R=()=>{f?.(m);};return jsx(Paper,{elevation:0,sx:{p:2,borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",...h},children:jsxs(Stack,{spacing:2,children:[jsxs(Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[jsxs(Box,{sx:{minWidth:0},children:[o?jsx(Typography,{sx:{fontSize:"1rem",fontWeight:800},children:o}):null,a?jsx(Typography,{sx:{mt:.5,fontSize:"0.86rem",color:"text.secondary"},children:a}):null]}),u?jsx(IconButton,{onClick:u,size:"small",children:jsx(fC,{})}):null]}),jsx(Paper,{elevation:0,sx:{p:2,borderRadius:3,border:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsx(Typography,{sx:{minHeight:38,fontSize:m?"1.9rem":"1.25rem",fontWeight:900,letterSpacing:"0.06em",color:m?"text.primary":"text.disabled"},children:m||r})}),jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1.25},children:[["1","2","3","4","5","6","7","8","9"].map(C=>jsx(pi,{label:C,onPress:()=>k(C)},C)),jsx(pi,{label:i?"+/-":"00",onPress:i?S:()=>k("00")}),jsx(pi,{label:"0",onPress:()=>k("0")}),jsx(pi,{label:n?".":c?String(c):"DEL",onPress:n?F:T})]}),jsxs(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:1.25},children:[jsx(Box,{component:"button",type:"button",onClick:T,sx:{minHeight:64,borderRadius:3,border:"1px solid",borderColor:"divider",bgcolor:"background.paper",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent"},children:jsxs(Stack,{direction:"row",spacing:1,justifyContent:"center",alignItems:"center",children:[jsx(gC,{}),jsx(Typography,{sx:{fontWeight:700},children:c||"DEL"})]})}),jsx(pi,{label:String(s||"CLR"),onPress:A,emphasis:"danger"}),jsx(Box,{component:"button",type:"button",onClick:R,sx:C=>({minHeight:64,borderRadius:3,border:"1px solid",borderColor:"primary.main",background:C.palette.primary.main,color:"#fff",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent"}),children:jsxs(Stack,{direction:"row",spacing:1,justifyContent:"center",alignItems:"center",children:[jsx(hC,{}),jsx(Typography,{sx:{fontWeight:800},children:d||w("common.ok")})]})})]})]})})};var pm=({touchMode:e="comfortable",sx:t,...o})=>{let a=e==="expanded";return jsx(Box,{sx:{"& .MuiPaper-root":{borderRadius:4},"& .MuiAutocomplete-root":{minWidth:{xs:"100%",md:260}},"& .MuiAutocomplete-root .MuiInputBase-root":{backgroundColor:"transparent !important"},"& .MuiInputBase-root":{minHeight:a?56:50,borderRadius:3,fontSize:a?"0.98rem":"0.92rem"},"& .MuiInputBase-input":{py:a?1.6:1.25,fontSize:a?"0.98rem":"0.92rem"},"& .MuiInputLabel-root":{fontSize:a?"0.95rem":"0.88rem"},"& .MuiButton-root":{minHeight:a?48:44,px:a?2.25:1.75,borderRadius:3,fontSize:a?"0.95rem":"0.88rem",fontWeight:700},"& .MuiIconButton-root":{width:a?40:36,height:a?40:36},"& .MuiMenuItem-root":{minHeight:a?44:38,fontSize:a?"0.95rem":"0.88rem"},"& .MuiListSubheader-root":{py:1},"& .MuiCheckbox-root":{p:a?1:.75},"& .MuiFormControlLabel-label":{fontSize:a?"0.95rem":"0.88rem"},"& .MuiDialog-paper":{borderRadius:4},"& .MuiDialogTitle-root":{fontSize:a?"1.05rem":"0.98rem",fontWeight:800},"& .MuiDialogContent-root .MuiInputBase-root":{minHeight:52},'& .MuiGrid-root > .MuiGrid-item, & .MuiGrid-root > .MuiGrid-sizeXs-1, & .MuiGrid-root > [class*="MuiGrid-grid-"]':{minWidth:0},...t},children:jsx(cr,{...o})})};var SC=(e,t,o)=>{if(o?.(t),!!t.href){if(t.href.startsWith("http://")||t.href.startsWith("https://")){window.open(t.href,"_blank");return}e.push(t.href);}},gm=({items:e,selectedId:t,orientation:o="auto",onItemSelect:a,sx:r})=>{let n=useTheme$1(),[i,l]=useState(false);useEffect(()=>{l(true);},[]);let d=useMediaQuery("(orientation: portrait)",{noSsr:true}),s=useMediaQuery(n.breakpoints.down("md"),{noSsr:true}),c=o==="auto"?d||s?"portrait":"landscape":o,g=useRouter();return jsx(Box,{sx:{display:"grid",gridTemplateColumns:!i||c==="portrait"?"repeat(2, minmax(0, 1fr))":"repeat(auto-fit, minmax(180px, 1fr))",gap:1.5,...r},children:e.map(f=>{let u=f.id===t,h=f.color||(u?n.palette.primary.main:n.palette.divider);return jsx(Paper,{elevation:0,sx:{overflow:"hidden",borderRadius:4,border:"1px solid",borderColor:u?"primary.main":"divider",boxShadow:u?"0 18px 40px rgba(37, 99, 235, 0.16)":"none",bgcolor:n.palette.mode==="dark"?"rgba(30,41,59,0.6)":"background.paper"},children:jsx(Box,{component:"button",type:"button",disabled:f.disabled,onClick:()=>SC(g,f,a),sx:{width:"100%",p:2,minHeight:c==="portrait"?156:148,display:"block",border:0,background:"transparent",textAlign:"left",cursor:f.disabled?"not-allowed":"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent",color:"text.primary"},children:jsxs(Stack,{spacing:1.5,sx:{height:"100%"},children:[jsxs(Stack,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[jsx(Box,{sx:{width:44,height:44,borderRadius:3,display:"grid",placeItems:"center",color:u?"#fff":"text.primary",background:u?h:"action.hover"},children:f.icon||jsx(Typography,{sx:{fontSize:"1rem",fontWeight:900},children:f.title.slice(0,1).toUpperCase()})}),f.badge!==void 0?jsx(Box,{sx:{minWidth:34,px:1,py:.4,borderRadius:999,bgcolor:u?"primary.main":"action.hover",color:u?"#fff":"text.secondary",textAlign:"center",fontWeight:800,fontSize:"0.8rem"},children:f.badge}):null]}),jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsx(Typography,{sx:{fontSize:"1rem",fontWeight:800,lineHeight:1.25},children:f.title}),f.caption?jsx(Typography,{sx:{mt:.5,fontSize:"0.74rem",fontWeight:700,color:"text.secondary"},children:f.caption}):null,f.description?jsx(Typography,{sx:{mt:.75,fontSize:"0.84rem",lineHeight:1.45,color:"text.secondary"},children:f.description}):null]})]})})},f.id)})})};var bm=(e,t)=>t.trim()?e.reduce((o,a)=>{let r=a.title?.toLowerCase().includes(t.toLowerCase())||a.label?.toLowerCase().includes(t.toLowerCase())||a.description?.toLowerCase().includes(t.toLowerCase()),n=a.children?bm(a.children,t):[];return (r||n.length>0)&&o.push({...a,children:n.length>0?n:a.children}),o},[]):e,zC=e=>{let t=new Set,o=a=>{a.forEach(r=>{r.children?.length&&(t.add(r.id),o(r.children));});};return o(e),t},xm=({collapsed:e=false,onToggle:t,className:o="",maxHeight:a,menuData:r=[],colorMode:n="light",orientation:i="auto",headerSlot:l,footerSlot:d,activeHref:s,onItemSelect:c})=>{let{t:g}=Z(),f=useTheme$1(),u=useMediaQuery("(orientation: portrait)"),h=useMediaQuery(f.breakpoints.down("md")),w=i==="auto"?u||h?"portrait":"landscape":i,p=n==="dark",v=useRouter(),m=usePathname(),[y,x]=useState(""),[k,F]=useState(new Set),S=useMemo(()=>bm(r,y),[r,y]),T=useMemo(()=>y.trim()?zC(S):k,[k,S,y]);useEffect(()=>{e&&F(new Set);},[e]);let A=P=>P.appurl||P.href||"",R=P=>{c?.(P);let M=A(P);if(M){if(M.startsWith("http://")||M.startsWith("https://")){window.open(M,"_blank");return}v.push(M);}},C=P=>{let M=!!P.children?.length;if(e&&M){t?.();return}if(M){F($=>{let N=new Set($);return N.has(P.id)?N.delete(P.id):N.add(P.id),N});return}R(P);},D=P=>{let M=s||m,$=A(P);return !!($&&M===$)},I=(P,M=0)=>{let $=!!P.children?.length,N=T.has(P.id),X=D(P);return jsx(Box,{sx:{pl:M===0?0:1.5},children:jsxs(Paper,{elevation:0,sx:{mb:1,overflow:"hidden",borderRadius:3,border:"1px solid",borderColor:X?"primary.main":"divider",bgcolor:X?"action.selected":"background.paper"},children:[jsxs(Box,{component:"button",type:"button",onClick:()=>C(P),sx:{width:"100%",px:1.5,py:1.4,display:"flex",alignItems:"center",gap:1.25,border:0,background:"transparent",textAlign:"left",cursor:"pointer",appearance:"none",WebkitAppearance:"none",WebkitTapHighlightColor:"transparent"},children:[jsx(Avatar,{variant:"rounded",sx:{width:40,height:40,bgcolor:X?"primary.main":"action.hover",color:X?"#fff":"text.primary"},children:P.icon||(P.title||P.label||"?").slice(0,1).toUpperCase()}),jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsx(Typography,{sx:{fontSize:"0.95rem",fontWeight:800,lineHeight:1.2},children:P.title||P.label}),P.description?jsx(Typography,{sx:{mt:.4,fontSize:"0.78rem",color:"text.secondary",lineHeight:1.35},children:P.description}):null]}),$?jsx(EC,{sx:{transform:N?"rotate(180deg)":"rotate(0deg)",transition:"transform 180ms ease"}}):jsx(LC,{color:"action"})]}),$?jsx(Collapse,{in:N,children:jsx(Box,{sx:{px:1.25,pb:1.25},children:P.children?.map(oe=>I(oe,M+1))})}):null]})},P.id)};return e?jsx(Paper,{elevation:0,className:o,sx:{width:w==="portrait"?"100%":88,p:1,borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:p?"#101828":"rgba(255,255,255,0.88)",maxHeight:a?`${a}px`:void 0,overflowY:"auto"},children:jsxs(Stack,{spacing:1,children:[jsx(IconButton,{onClick:t,sx:{width:48,height:48,alignSelf:"center",bgcolor:"action.hover"},title:g("navigation.expand"),children:jsx(FC,{})}),r.map(P=>jsx(IconButton,{onClick:()=>C(P),sx:{width:56,height:56,alignSelf:"center",borderRadius:3,bgcolor:D(P)?"primary.main":"action.hover",color:D(P)?"#fff":"text.primary"},children:P.icon||(P.title||P.label||"?").slice(0,1).toUpperCase()},P.id))]})}):jsx(Paper,{elevation:0,className:o,sx:{width:w==="portrait"?"100%":320,p:1.25,borderRadius:5,border:"1px solid",borderColor:"divider",bgcolor:p?"#101828":"rgba(255,255,255,0.88)",maxHeight:a?`${a}px`:void 0,overflow:"hidden",display:"flex",flexDirection:"column"},children:jsxs(Stack,{spacing:1.25,sx:{flex:1,minHeight:0},children:[jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[jsx(TextField,{value:y,onChange:P=>x(P.target.value),placeholder:g("navigation.searchPlaceholder"),size:"small",fullWidth:true,InputProps:{startAdornment:jsx(AC,{fontSize:"small",color:"action"})}}),w==="landscape"&&!e?jsx(IconButton,{onClick:t,sx:{bgcolor:"action.hover"},children:jsx(BC,{})}):null]}),l,jsx(Box,{sx:{flex:1,minHeight:0,overflowY:"auto",pr:.25},children:S.length>0?S.map(P=>I(P)):jsx(Typography,{sx:{p:2,fontSize:"0.88rem",color:"text.secondary",textAlign:"center"},children:g("navigation.noMatch")})}),d]})})};var Pm=(e,t)=>{let o=t[e.id];if(e.render)return e.render(o,t);if(o==null||o==="")return "--";if(e.numeric){if(typeof o=="number")return o.toLocaleString();if(typeof o=="string"&&o.trim()!==""&&!Number.isNaN(Number(o)))return Number(o).toLocaleString()}return String(o)},HC=e=>ct__default.isValidElement(e)?jsx(Box,{sx:{display:"inline-flex",alignItems:"center"},children:e}):jsx(Typography,{sx:{mt:.2,fontSize:"0.88rem",fontWeight:800},children:e}),GC=(e,t)=>{let o=t[e.id];if(o==null||o==="")return "--";if(e.numeric){if(typeof o=="number")return o.toLocaleString();if(typeof o=="string"&&o.trim()!==""&&!Number.isNaN(Number(o)))return Number(o).toLocaleString()}return String(o)},UC=({summaryRow:e,visibleColumns:t,columns:o})=>{let a=o.filter(r=>t.includes(r.id)&&e[r.id]!=="");return a.length===0?null:jsx(Paper,{elevation:0,sx:{p:1.5,borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsxs(Stack,{spacing:1,children:[jsx(Typography,{sx:{fontSize:"0.82rem",fontWeight:800,color:"text.secondary"},children:"Summary"}),jsx(Box,{sx:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(132px, 1fr))",gap:1},children:a.map(r=>jsxs(Paper,{elevation:0,sx:{p:1.1,borderRadius:3,border:"1px solid",borderColor:"divider"},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:r.label}),jsx(Typography,{sx:{mt:.25,fontSize:"0.96rem",fontWeight:800},children:e[r.id]})]},`summary-${r.id}`))})]})})},KC=e=>{let{t}=Z(),o=useTheme$1(),{title:a,showToolbar:r=true,selectionMode:n,selected:i=[],onSelectionChange:l,actions:d,extraTools:s,fitContainer:c=false,fullWidth:g=false,maxHeight:f,loading:u=false,rowsPerPageOptions:h=[20,50,100,-1],onLayoutSave:w,filterConfig:p,rowKey:v,tableKey:m="default",graphReport:y,quickCreate:x,quickEdit:k,quickDelete:F,serviceUrl:S,orientation:T="auto",cardTitleField:A,cardSubtitleFields:R,toolbarSlot:C,emptyState:D,rowHeight:I="comfortable",cardActionSlot:P,renderCardFooter:M,onRowClick:$}=e,N=a||t("table.title.default"),X=useMediaQuery("(orientation: portrait)"),oe=useMediaQuery(o.breakpoints.down("md")),te=T==="auto"?X||oe?"portrait":"landscape":T,{columns:re,filterText:Q,setFilterText:U,visibleColumns:Y,showSummary:Re,setShowSummary:j,summaryColumns:fe,grouping:Se,setGrouping:Ne,expandedGroups:Ke,groupAnchorEl:ve,setGroupAnchorEl:Fe,summaryAnchorEl:xo,setSummaryAnchorEl:jt,anchorEl:Qe,setAnchorEl:Mt,contextMenu:Lt,sortedAndFilteredRows:bt,summaryRow:H,visibleRows:he,page:pe,setPage:ye,rowsPerPage:Xe,setRowsPerPage:Ve,totalDisplayCount:co,setSelected:vo,handleClick:Co,toggleSummaryColumn:ko,handleExport:So,handleCloseContextMenu:Me,toggleColumnVisibility:ge,toggleGroupExpand:xt,toggleGroupField:Ee,handleExpandGroupRecursively:zt,handleCollapseGroupRecursively:wo,handleLayoutLoad:_a,handleVariantLoad:V,handleLayoutSave:O,effectiveAppId:K,currentLayoutData:be,currentLayoutId:Ce,layoutIdToLoad:Be,graphReportOpen:me,handleOpenGraphReport:Le,handleCloseGraphReport:we}=Qr(e),ze=y?.enabled??false,Ae=ze&&(y?.interaction?.enabled??true),ke=Ki(),De=v||"id",Nt=ct__default.useMemo(()=>({borderRadius:999,fontWeight:700,borderColor:alpha(o.palette.divider,o.palette.mode==="dark"?.55:.3),bgcolor:o.palette.mode==="dark"?alpha(o.palette.common.white,.06):alpha(o.palette.background.paper,.92),color:o.palette.text.primary,"& .MuiChip-label":{px:1.05}}),[o]),To=ct__default.useMemo(()=>({...Nt,borderColor:alpha(o.palette.primary.main,o.palette.mode==="dark"?.42:.24),bgcolor:o.palette.mode==="dark"?alpha(o.palette.primary.main,.16):alpha(o.palette.primary.main,.08)}),[Nt,o]),gt=ct__default.useMemo(()=>{let z=new Set(i);return bt.filter(J=>z.has(J?.[De]))},[De,i,bt]),vt=gt.length===1?gt[0]:null,po=!!x?.enabled,va=!!k?.enabled,Pr=!!F?.enabled,Io=x?.fields,Xt=x?.excludeFields||[],Za=x?.initialValues||{},Qo=k?.fields,Vt=k?.excludeFields||[],Qt=k?.editableFields||[],At=k?.nonEditableFields||[],Oe=k?.primaryKeys?.length?k.primaryKeys:[De],[Yo,Wo]=ct__default.useState(false),[Jo,ja]=ct__default.useState(false),[$o,Xa]=ct__default.useState({}),[Qa,Ho]=ct__default.useState(false),[ea,Ca]=ct__default.useState(false),[Ot,Po]=ct__default.useState({}),[ta,uo]=ct__default.useState(false),[Go,Ya]=ct__default.useState(false),Rr=u||Jo||ea||Go,ka=ct__default.useMemo(()=>{let z=[...re];if(Array.isArray(Io)&&Io.length>0){let J=new Set(Io);z=z.filter(G=>J.has(G.id));}if(Xt.length>0){let J=new Set(Xt);z=z.filter(G=>!J.has(G.id));}return z.filter(J=>!!J?.id)},[re,Xt,Io]),Ja=ct__default.useMemo(()=>{let z=[...re];if(Array.isArray(Qo)&&Qo.length>0){let J=new Set(Qo);z=z.filter(G=>J.has(G.id));}if(Vt.length>0){let J=new Set(Vt);z=z.filter(G=>!J.has(G.id));}return z.filter(J=>!!J?.id)},[re,Vt,Qo]),oa=ct__default.useMemo(()=>new Set(Oe),[Oe]),Ut=ct__default.useMemo(()=>new Set(Qt),[Qt]),Ro=ct__default.useMemo(()=>new Set(At),[At]),Dr=ct__default.useCallback(z=>Ut.size>0?Ut.has(z):!(Ro.has(z)||oa.has(z)),[Ut,Ro,oa]);ct__default.useEffect(()=>{!me&&ke.hasActiveFilters&&ke.clearAll();},[ke,me]);let er=()=>{let z={};ka.forEach(J=>{z[J.id]=Za[J.id]??"";}),Xa(z),Wo(true);},Mr=(z,J)=>{Xa(G=>({...G,[z]:J}));},Ar=async()=>{if(!x?.onSubmit){Wo(false);return}try{ja(!0),await x.onSubmit($o),Wo(!1);}finally{ja(false);}},Br=()=>{if(!vt)return;let z={};Ja.forEach(G=>{z[G.id]=vt[G.id]??"";});let J=k?.getInitialValues?{...z,...k.getInitialValues(vt)}:z;Po(J),Ho(true);},Yt=(z,J)=>{Po(G=>({...G,[z]:J}));},Fr=async()=>{if(vt){if(!k?.onSubmit){Ho(false);return}try{Ca(!0),await k.onSubmit(Ot,vt),Ho(!1);}finally{Ca(false);}}},Er=()=>{gt.length!==0&&uo(true);},tr=async()=>{if(gt.length===0){uo(false);return}if(!F?.onConfirm){uo(false),vo([]),l?.([]);return}try{Ya(!0),await F.onConfirm(gt),uo(!1),vo([]),l?.([]);}finally{Ya(false);}},aa=bt,{fieldMapping:Sa}=_r({rows:aa,config:{...y,title:y?.title||`${N} ${t("graph.reportTitle")}`}}),wa=ct__default.useMemo(()=>Ae?ke.applyRows(aa,Sa):aa,[Sa,ke,Ae,aa]),{model:b}=_r({rows:wa,config:{...y,title:y?.title||`${N} ${t("graph.reportTitle")}`,fieldMapping:Sa}}),B=b.table.columns.map(z=>({id:z.id,label:z.label,align:z.align||"left",minWidth:120,numeric:z.align==="right"})),E=K?jsx(ts,{appId:K,tableKey:m,currentLayoutData:be,onLayoutLoad:_a,targetLayoutId:Be,activeLayoutId:Ce,serviceUrl:S??p?.serviceUrl}):null,W=re.filter(z=>Y.includes(z.id)),ee=W.find(z=>z.id===A)||W[0],ue=R?.map(z=>W.find(J=>J.id===z)).filter(Boolean)||W.filter(z=>z.id!==ee?.id).slice(0,te==="portrait"?2:3),L=W.filter(z=>z.id!==ee?.id&&!ue.some(J=>J.id===z.id)),_=[C,s].filter(Boolean),q=jsxs(Fragment,{children:[jsx(zr,{groupAnchorEl:ve,setGroupAnchorEl:Fe,grouping:Se,setGrouping:Ne,columns:re,toggleGroupField:Ee}),jsx(Nr,{anchorEl:Qe,setAnchorEl:Mt,columns:re,visibleColumns:Y,toggleColumnVisibility:ge}),jsx(Ii,{anchorEl:xo,setAnchorEl:jt,showSummary:Re,setShowSummary:j,columns:re,summaryColumns:fe,toggleSummaryColumn:ko}),jsx(Pi,{contextMenu:Lt,handleCloseContextMenu:Me,columns:re,visibleColumns:Y,toggleColumnVisibility:ge})]}),_e=(z,J,G)=>{let ie=i.includes(J),We=te==="portrait"?"repeat(2, minmax(0, 1fr))":"repeat(auto-fit, minmax(140px, 1fr))",Uo=G%2===0?alpha(o.palette.primary.main,o.palette.mode==="dark"?.09:.04):alpha(o.palette.primary.main,o.palette.mode==="dark"?.05:.022),Pg=alpha(o.palette.divider,.22);return jsx(Paper,{elevation:0,onClick:()=>{Co({},z),$?.(z);},sx:{p:I==="compact"?1.25:1.5,borderRadius:4,border:"0.5px solid",borderColor:ie?alpha(o.palette.primary.main,.38):Pg,background:ie?`linear-gradient(135deg, ${alpha(o.palette.primary.main,.13)}, ${alpha(o.palette.primary.main,.06)})`:`linear-gradient(135deg, ${Uo}, ${alpha(o.palette.primary.main,.015)})`,boxShadow:ie?`0 12px 30px ${alpha(o.palette.primary.main,.2)}`:`0 3px 10px ${alpha(o.palette.common.black,.045)}`,cursor:"pointer",position:"relative",overflow:"hidden",transition:"border-color 160ms ease, box-shadow 160ms ease, transform 120ms ease, background 160ms ease","&::before":{content:'""',position:"absolute",left:0,top:0,bottom:0,width:4,background:ie?o.palette.primary.main:G%2===0?alpha(o.palette.primary.main,.26):alpha(o.palette.text.primary,.16)},"&:hover":{boxShadow:`0 10px 20px ${alpha(o.palette.primary.main,.12)}`,transform:"translateY(-1px)"},"&:active":{transform:"scale(0.995)"}},children:jsxs(Stack,{spacing:1.25,children:[jsxs(Stack,{direction:"row",spacing:1.25,alignItems:"flex-start",children:[n?jsx(Checkbox,{checked:ie,onClick:Jt=>Jt.stopPropagation(),onChange:()=>Co({},z),sx:{mt:-0.6,ml:-0.6}}):null,jsxs(Box,{sx:{flex:1,minWidth:0},children:[ee?jsx(Typography,{sx:{fontSize:"1rem",fontWeight:900,lineHeight:1.25},children:Pm(ee,z)}):null,ue.length>0?jsx(Stack,{direction:"row",spacing:.75,useFlexGap:true,flexWrap:"wrap",sx:{mt:.75},children:ue.map(Jt=>jsx(Chip,{label:`${Jt.label}: ${GC(Jt,z)}`,size:"small",variant:"outlined",sx:Nt},`${J}-${Jt.id}`))}):null]}),P?jsx(Box,{onClick:Jt=>Jt.stopPropagation(),children:P(z)}):null]}),L.length>0?jsx(Box,{sx:{display:"grid",gridTemplateColumns:We,gap:1},children:L.map(Jt=>jsxs(Paper,{elevation:0,sx:{p:1,borderRadius:3,bgcolor:o.palette.mode==="dark"?alpha(o.palette.background.default,.7):alpha(o.palette.background.paper,.92),border:"0.1px solid",borderColor:alpha(o.palette.divider,.24)},children:[jsx(Typography,{sx:{fontSize:"0.72rem",color:"text.secondary"},children:Jt.label}),HC(Pm(Jt,z))]},`${J}-${Jt.id}-detail`))}):null,M?jsxs(Fragment,{children:[jsx(Divider,{}),jsx(Box,{onClick:Jt=>Jt.stopPropagation(),children:M(z)})]}):null]})},J)};return jsxs(Box,{sx:{width:g?"100%":"auto",mb:c?0:2,...c?{flex:1,display:"flex",flexDirection:"column",minHeight:0,height:"100%",overflow:"hidden"}:{}},children:[p?jsx(Box,{sx:{mb:2},children:jsx(pm,{...p,onVariantLoad:z=>{V(z),p.onVariantLoad?.(z);},appId:p.appId,tableKey:m,currentLayout:[{tableKey:m,layoutData:be}],currentLayoutId:Ce,layoutRefs:[{tableKey:m,layoutId:Ce}],variantService:p.variantService,serviceUrl:S??p.serviceUrl,touchMode:te==="portrait"?"expanded":"comfortable"})}):null,jsxs(Paper,{sx:{width:g?"100%":"auto",mb:c?0:2,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",bgcolor:"transparent",backgroundImage:"none",boxShadow:"none","&::before":Rr?{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"3px",background:"linear-gradient(90deg, rgba(25, 118, 210, 0) 0%, rgba(25, 118, 210, 0.25) 25%, rgba(25, 118, 210, 1) 50%, rgba(25, 118, 210, 0.25) 75%, rgba(25, 118, 210, 0) 100%)",backgroundSize:"220% 100%",animation:"cTableTopMarquee 1.2s linear infinite",zIndex:6,pointerEvents:"none"}:{},"@keyframes cTableTopMarquee":{"0%":{backgroundPosition:"220% 0"},"100%":{backgroundPosition:"-120% 0"}},...f?{height:f}:c?{flex:1,minHeight:0,height:"100%"}:{}},children:[r?jsx(Box,{sx:{"& .MuiToolbar-root":{minHeight:60,alignItems:{xs:"flex-start",md:"center"},flexWrap:"wrap",rowGap:1,columnGap:1},"& .MuiToolbar-root > :nth-of-type(1)":{width:{xs:"100%",md:"auto"},"& .MuiTextField-root":{width:{xs:"100%",md:300}}},"& .MuiToolbar-root > :nth-of-type(2)":{flexShrink:0},"& .MuiToolbar-root > :nth-of-type(3)":{display:{xs:"none",md:"block"}},"& .MuiToolbar-root > :nth-of-type(4)":{ml:"auto",justifyContent:"flex-end",flexWrap:"wrap"},"& .MuiInputBase-root":{minHeight:46},"& .MuiIconButton-root":{width:40,height:40},"& .MuiTypography-root":{fontSize:"0.9rem"},"& .MuiButtonBase-root":{borderRadius:2.5}},children:jsx(Ci,{filterText:Q,setFilterText:U,onRowsPerPageChange:Ve,rowsPerPage:Xe,rowsPerPageOptions:h,page:pe,count:co,onPageChange:ye,actions:d,extraTools:_,grouping:Se,setGroupAnchorEl:Fe,showSummary:Re,setShowSummary:j,setAnchorEl:Mt,setSummaryAnchorEl:jt,handleExport:So,showCreateButton:po,onOpenCreateDialog:er,showEditButton:va,onOpenEditDialog:Br,editDisabled:gt.length!==1,showDeleteButton:Pr,onOpenDeleteConfirm:Er,deleteDisabled:gt.length===0,onLayoutSave:w||p?.variantService&&p?.appId?O:void 0,loading:u,layoutManager:E,onOpenGraphReport:ze?Le:void 0})}):null,jsx(Box,{sx:{flex:1,minHeight:0,overflow:"auto",p:1.5},children:jsxs(Stack,{spacing:1.25,children:[he.length===0&&!u?D||jsx(Paper,{elevation:0,sx:{p:4,borderRadius:4,border:"1px dashed",borderColor:"divider",textAlign:"center"},children:jsx(Typography,{sx:{fontSize:"0.92rem",color:"text.secondary"},children:t("common.noData")})}):null,he.map((z,J)=>{if(z.type==="group"){let We=Ke.has(z.id);return jsx(Paper,{elevation:0,sx:{borderRadius:4,border:"1px solid",borderColor:"divider",bgcolor:"action.hover"},children:jsxs(Box,{component:"button",type:"button",onClick:()=>xt(z.id),sx:{width:"100%",px:1.5,py:1.3,border:0,background:"transparent",display:"flex",alignItems:"center",gap:1,textAlign:"left",cursor:"pointer",appearance:"none",WebkitAppearance:"none",color:"text.primary"},children:[We?jsx(EC,{}):jsx(LC,{}),jsxs(Box,{sx:{flex:1,minWidth:0},children:[jsxs(Typography,{sx:{fontSize:"0.94rem",fontWeight:800},children:[z.field,": ",z.value]}),jsxs(Typography,{sx:{mt:.2,fontSize:"0.76rem",color:"text.secondary"},children:[z.count," records"]})]}),Se.length>1&&z.level<Se.length-1?jsxs(Stack,{direction:"row",spacing:.5,children:[jsx(Chip,{size:"small",label:t("table.group.expandAll"),onClick:Uo=>{Uo.stopPropagation(),zt(z.id);},sx:To}),jsx(Chip,{size:"small",label:t("table.group.collapseAll"),onClick:Uo=>{Uo.stopPropagation(),wo(z.id);},sx:To})]}):null]})},z.id)}let G=z.data||z,ie=z.id||G[De]||J;return _e(G,ie,J)}),Re?jsx(UC,{summaryRow:H,visibleColumns:Y,columns:re}):null,u?jsx(Typography,{sx:{py:1,fontSize:"0.84rem",color:"text.secondary",textAlign:"center"},children:t("common.loading")}):null]})})]}),po?jsxs(Dialog,{open:Yo,onClose:()=>!Jo&&Wo(false),fullWidth:true,maxWidth:"sm",children:[jsx(DialogTitle,{sx:{fontSize:"1rem",fontWeight:800},children:x?.title||t("quickCreate.createWithTitle",{title:N})}),jsx(DialogContent,{sx:{pt:"8px !important"},children:jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[ka.map(z=>{let J=z.type==="number"||z.numeric?"number":z.type==="date"?"date":"text";return jsx(TextField,{label:z.label||z.id,value:$o[z.id]??"",onChange:G=>Mr(z.id,G.target.value),type:J,fullWidth:true,InputLabelProps:{shrink:J==="date"?true:void 0}},`quick-create-${z.id}`)}),x?.description?jsx(Alert,{severity:"info",children:x.description}):null]})}),jsxs(DialogActions,{sx:{px:3,pb:2},children:[jsx(Button,{onClick:()=>Wo(false),disabled:Jo,children:x?.cancelLabel||t("common.cancel")}),jsx(Button,{onClick:Ar,variant:"contained",disabled:Jo,children:x?.submitLabel||t("common.save")})]})]}):null,va?jsxs(Dialog,{open:Qa,onClose:()=>!ea&&Ho(false),fullWidth:true,maxWidth:"sm",children:[jsx(DialogTitle,{sx:{fontSize:"1rem",fontWeight:800},children:k?.title||t("quickEdit.editWithTitle",{title:N})}),jsx(DialogContent,{sx:{pt:"8px !important"},children:jsxs(Box,{sx:{display:"flex",flexDirection:"column",gap:1.25},children:[Ja.map(z=>{let J=z.type==="number"||z.numeric?"number":z.type==="date"?"date":"text";return jsx(TextField,{label:z.label||z.id,value:Ot[z.id]??"",onChange:G=>Yt(z.id,G.target.value),type:J,disabled:!Dr(z.id),fullWidth:true,InputLabelProps:{shrink:J==="date"?true:void 0}},`quick-edit-${z.id}`)}),k?.description?jsx(Alert,{severity:"info",children:k.description}):null]})}),jsxs(DialogActions,{sx:{px:3,pb:2},children:[jsx(Button,{onClick:()=>Ho(false),disabled:ea,children:k?.cancelLabel||t("common.cancel")}),jsx(Button,{onClick:Fr,variant:"contained",disabled:ea||!vt,children:k?.submitLabel||t("common.save")})]})]}):null,Pr?jsx(In,{open:ta,type:"warning",title:F?.title||t("quickDelete.confirmTitle"),message:F?.message||(gt.length>1?t("quickDelete.confirmMessageMultiple",{count:gt.length}):t("quickDelete.confirmMessageSingle")),confirmText:F?.confirmText||t("common.delete"),cancelText:F?.cancelText||t("common.cancel"),onClose:()=>!Go&&uo(false),onConfirm:tr}):null,q,ze?jsx(Gi,{open:me,onClose:we,model:b,aiAssistant:y?.aiAssistant,interaction:Ae?{enabled:true,filters:ke.filters,fieldMapping:Sa,onPrimaryDimensionClick:z=>ke.setFilter("primaryDimension",z),onSecondaryDimensionClick:z=>ke.setFilter("secondaryDimension",z),onStatusClick:z=>ke.setFilter("status",z),onClearFilter:ke.clearFilter,onClearAll:ke.clearAll}:void 0,tableContent:jsx(KC,{appId:K||"graph-report-internal",title:t("graph.dataBody"),columns:B,rows:b.table.rows,rowKey:"id",fullWidth:true,maxHeight:"420px",rowsPerPage:20,rowsPerPageOptions:[20,50,100],graphReport:{enabled:false},showSummary:false})}):null]})};var kF=({appTitle:e,children:t,menuData:o=[],workloadItems:a=[],workloadSelectedId:r,showNavigation:n=true,showWorkloadNav:i=true,orientation:l="auto",logo:d,headerSlot:s,actionSlot:c,portraitBottomSlot:g,contentSx:f,containerSx:u,user:h,onSearch:w,defaultNavigationOpen:p,navOpen:v,onNavOpenChange:m,onWorkloadSelect:y,locale:x="en",localeLabel:k,localeOptions:F,onLocaleChange:S,onUserSetting:T,onUserLogout:A,userMenuItems:R,leftHeaderSlot:C,rightHeaderSlot:D})=>{let I="orbcafe:page-layout-mode",[P,M]=useState("system"),[$,N]=useState("light"),[X,oe]=useState(false),[te,re]=useState(false),Q=P==="system"?te?$:"light":P;useEffect(()=>{oe(true);},[]),useEffect(()=>{try{let Lt=window.localStorage.getItem(I);(Lt==="light"||Lt==="dark"||Lt==="system")&&M(Lt);}catch{}re(true);let Qe=window.matchMedia("(prefers-color-scheme: dark)"),Mt=()=>{N(Qe.matches?"dark":"light");};return Mt(),Qe.addEventListener("change",Mt),()=>Qe.removeEventListener("change",Mt)},[]),useEffect(()=>{if(te)try{window.localStorage.setItem(I,P);}catch{}},[te,P]),useEffect(()=>{Q==="dark"?(document.documentElement.classList.add("dark"),document.documentElement.style.colorScheme="dark"):(document.documentElement.classList.remove("dark"),document.documentElement.style.colorScheme="light");},[Q]);let U=useMemo(()=>createTheme$1({palette:Q==="dark"?{mode:"dark",primary:{main:"#93c5fd"},background:{default:"#060913",paper:"#101826"},text:{primary:"#f8fafc",secondary:"rgba(226,232,240,0.74)"},divider:"rgba(148,163,184,0.18)",action:{hover:"rgba(148,163,184,0.10)",selected:"rgba(59,130,246,0.18)"}}:{mode:"light",background:{default:"#eef3f8",paper:"#ffffff"}},components:{MuiCssBaseline:{styleOverrides:{body:{backgroundColor:Q==="dark"?"#060913":"#eef3f8"}}},MuiPaper:{styleOverrides:{root:{backgroundImage:"none"}}}}}),[Q]),Y=useMediaQuery("(orientation: portrait)"),Re=useMediaQuery(U.breakpoints.down("md")),j=l==="auto"?!X||Y||Re?"portrait":"landscape":l,[fe,Se]=useState({landscape:p??true,portrait:false}),Ne=fe[j],Ke=v??Ne,ve=Qe=>{v===void 0&&Se(Mt=>({...Mt,[j]:Qe})),m?.(Qe);},Fe=jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[!X||n&&j==="portrait"?jsx(IconButton,{onClick:()=>ve(!Ke),sx:{bgcolor:"action.hover"},children:jsx(FC,{})}):null,C]}),xo=jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",children:[c,D]}),jt=jsx(xm,{collapsed:j==="landscape"?!Ke:false,onToggle:()=>ve(!Ke),menuData:o,orientation:j,colorMode:Q,maxHeight:j==="landscape"?900:void 0});return jsx(ThemeProvider$1,{theme:U,children:jsx(vi,{locale:x,children:jsxs(Box,{sx:[Qe=>({minHeight:"100vh",display:"flex",flexDirection:"column",background:Qe.palette.mode==="dark"?"linear-gradient(180deg, #0A0A0A 0%, #141414 55%, #1A1A1A 100%)":Qe.palette.background.default}),...Array.isArray(u)?u:[u]],children:[jsx(Cs,{appTitle:e,logo:d===void 0?null:d,mode:P,onToggleMode:()=>M(Qe=>Qe==="system"?"dark":Qe==="dark"?"light":"system"),locale:x,localeLabel:k,localeOptions:F,onLocaleChange:S,user:h,onUserSetting:T,onUserLogout:A,userMenuItems:R,onSearch:w,leftSlot:Fe,rightSlot:xo}),s?jsx(Box,{sx:{px:{xs:2,md:3},py:1.5,borderBottom:"1px solid",borderColor:"divider"},children:s}):null,jsxs(Box,{sx:{flex:1,minHeight:0,display:"flex",position:"relative"},children:[X&&n&&j==="landscape"?jsx(Box,{sx:{p:1.5,pr:0,flexShrink:0},children:jt}):null,!X||n&&j==="portrait"?jsx(Drawer,{open:Ke,onClose:()=>ve(false),PaperProps:{sx:{width:"min(88vw, 360px)",p:1.25,bgcolor:"transparent",boxShadow:"none"}},children:jt}):null,jsx(Box,{sx:{flex:1,minWidth:0,minHeight:0,overflow:"auto",p:1.5,...f},children:jsxs(Stack,{spacing:1.5,children:[i&&a.length>0?jsx(gm,{items:a,selectedId:r,orientation:j,onItemSelect:y}):null,jsx(Paper,{elevation:0,sx:{flex:1,minHeight:j==="portrait"?420:560,p:{xs:1.25,md:1.5},borderRadius:5,border:"1px solid",borderColor:"divider",bgcolor:U.palette.mode==="dark"?"rgba(15,23,42,0.72)":"rgba(255,255,255,0.72)",backdropFilter:"blur(12px)",color:"text.primary"},children:t})]})})]}),j==="portrait"&&g?jsxs(Fragment,{children:[jsx(Divider,{}),jsx(Box,{sx:{p:1.5},children:g})]}):null]})})})};var Mm=tk(()=>import('./COrbCanvas-EGX5NO3Y.mjs').then(e=>e.COrbCanvas),{ssr:false,loading:()=>jsx("div",{className:"h-full w-full bg-transparent"})});function $c({isRecording:e}){return jsx(AnimatePresence,{children:e&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"pointer-events-none absolute inset-0 z-0 overflow-hidden",children:jsxs("div",{className:"relative flex h-full w-full items-center justify-center",children:[jsx("div",{className:"absolute inset-0",children:jsx(Mm,{hue:0,hoverIntensity:.5,rotateOnHover:true,forceHoverState:true,backgroundColor:"transparent"})}),jsx("div",{className:"relative z-10 h-full w-1/3 mix-blend-overlay opacity-80",children:jsx(Mm,{hue:10,hoverIntensity:.8,rotateOnHover:true,forceHoverState:true,backgroundColor:"transparent"})})]})})})}var PF=$c;function _s({onTextUpdate:e,onComplete:t,onError:o,wsUrl:a="ws://localhost:8765",silenceThresholdMs:r=2e3,minVolumeRms:n=.015}){let[i,l]=useState(false),d=useRef(null),s=useRef(null),c=useRef(null),g=useRef(null),f=useRef(null),u=useRef(0),h=useRef(false),w=useRef(false),p=useCallback(()=>{d.current&&(d.current.close(),d.current=null),g.current&&(g.current.disconnect(),g.current=null),f.current&&(f.current.disconnect(),f.current=null),s.current&&(s.current.getTracks().forEach(y=>y.stop()),s.current=null),c.current&&(c.current.close(),c.current=null),w.current=false,l(false);},[]),v=useCallback(()=>{h.current||(h.current=true,d.current?.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"stop"})),setTimeout(p,500));},[p]),m=useCallback(async()=>{if(!(i||w.current)){w.current=true,h.current=false,u.current=Date.now();try{let y=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:16e3,echoCancellation:!0,noiseSuppression:!0}});s.current=y;let x=new WebSocket(a);d.current=x,x.onopen=()=>{l(!0),w.current=!1;},x.onmessage=A=>{try{let R=JSON.parse(A.data);if(R.type==="recognition")R.is_final?t(R.text):e?.(R.text);else if(R.type==="error"){let C=R.message||"Voice recognition error";o?.(C),v();}}catch{o?.("Failed to parse voice message");}},x.onerror=()=>{o?.("Voice service connection failed"),p();},x.onclose=()=>{p();};let k=window.AudioContext||window.webkitAudioContext;if(!k)throw new Error("AudioContext is not supported in this browser");let F=new k({sampleRate:16e3});c.current=F;let S=F.createMediaStreamSource(y);f.current=S;let T=F.createScriptProcessor(4096,1,1);g.current=T,T.onaudioprocess=A=>{if(d.current?.readyState!==WebSocket.OPEN)return;let R=A.inputBuffer.getChannelData(0),C=0;for(let P=0;P<R.length;P+=1)C+=R[P]*R[P];if(Math.sqrt(C/R.length)>n)u.current=Date.now();else if(Date.now()-u.current>r&&!h.current){v();return}let I=new Int16Array(R.length);for(let P=0;P<R.length;P+=1){let M=Math.max(-1,Math.min(1,R[P]));I[P]=M<0?M*32768:M*32767;}d.current.send(I.buffer);},S.connect(T),T.connect(F.destination);}catch{o?.("Cannot access microphone"),p();}}},[p,i,n,t,o,e,r,v,a]);return useEffect(()=>p,[p]),{isRecording:i,startRecording:m,stopRecording:v}}var Bm=createContext(null);function pk(e){if(!e||!(e instanceof HTMLElement))return false;let t=e.tagName;return !!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable||e.closest('[data-voice-hotkey-ignore="true"]'))}function uk({children:e,onVoiceSubmit:t,onVoicePartial:o,onVoiceError:a,longPressMs:r=200,disableSpaceTrigger:n=false,ignoreWhenFocusedInput:i=true,renderOverlay:l=true,wsUrl:d,silenceThresholdMs:s,minVolumeRms:c}){let[g,f]=useState(false),[u,h]=useState(false),w=useRef(null),p=useRef(false),v=useRef(false),m=useCallback(()=>{v.current=false,f(false);},[]),{isRecording:y,startRecording:x,stopRecording:k}=_s({wsUrl:d,silenceThresholdMs:s,minVolumeRms:c,onTextUpdate:A=>{o?.(A);},onComplete:async A=>{try{A.trim()&&(h(!0),await t(A.trim()));}catch(R){let C=R instanceof Error?R.message:"Failed to process voice command";a?.(C);}finally{h(!1),m();}},onError:A=>{a?.(A),h(!1),p.current||m();}}),F=useCallback(async()=>{v.current=false,await x();},[x]),S=useCallback(()=>{k();},[k]);useEffect(()=>{if(n)return;let A=C=>{C.isComposing||(C.code==="Space"||C.key===" ")&&(p.current||C.repeat||i&&pk(document.activeElement)||(p.current=true,C.preventDefault(),w.current=setTimeout(()=>{v.current=true,f(true),x();},r)));},R=C=>{(C.code==="Space"||C.key===" ")&&(w.current&&(clearTimeout(w.current),w.current=null),p.current=false,v.current&&(C.preventDefault(),f(false),k()));};return window.addEventListener("keydown",A),window.addEventListener("keyup",R),()=>{window.removeEventListener("keydown",A),window.removeEventListener("keyup",R),w.current&&(clearTimeout(w.current),w.current=null);}},[n,i,r,x,k]);let T=useMemo(()=>({isRecording:y,isHotkeyRecording:g,isSubmitting:u,startRecording:F,stopRecording:S}),[g,y,u,F,S]);return jsxs(Bm.Provider,{value:T,children:[l?jsx($c,{isRecording:g}):null,e]})}function mk(){let e=useContext(Bm);if(!e)throw new Error("useAINav must be used within CAINavProvider");return e}var LF=uk,zF=mk;function Ie(...e){return twMerge(clsx(e))}var vk=({content:e,theme:t="light",size:o="base",defaultExpanded:a=false})=>{let[r,n]=useState(a),i=useMemo(()=>`${(o==="sm"?14:o==="lg"?18:16)-2}px`,[o]);return jsxs("div",{className:`my-6 rounded-lg overflow-hidden transition-all duration-200 ${t==="dark"?"bg-gray-800":"bg-white"}`,style:{border:`0.5px solid ${t==="dark"?"#4b5563":"#d1d5db"}`},children:[jsxs("div",{className:`px-4 py-3 cursor-pointer flex items-center justify-between transition-colors duration-200 ${t==="dark"?"bg-gray-700 hover:bg-gray-650":"bg-gray-50 hover:bg-gray-100"}`,style:{borderBottom:`0.5px solid ${t==="dark"?"#4b5563":"#e5e7eb"}`},onClick:()=>n(!r),children:[jsxs("span",{className:"flex items-center",children:[jsx("span",{className:"mr-2",children:"\u{1F914}"}),jsx("span",{className:`font-medium ${t==="dark"?"text-gray-300":"text-gray-700"}`,style:{fontSize:o==="sm"?"14px":o==="lg"?"18px":"16px"},children:"\u601D\u8003\u8FC7\u7A0B"})]}),jsx("svg",{className:`w-4 h-4 transition-transform duration-200 ${r?"rotate-180":""} ${t==="dark"?"text-gray-400":"text-gray-500"}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsx("div",{className:`p-4 whitespace-pre-wrap italic font-light ${t==="dark"?"text-gray-400":"text-gray-600"}`,style:{fontSize:i,lineHeight:"1.3 !important"},children:e})]})},Fm=vk;var Rk=({content:e,language:t="text",isStreaming:o=false,className:a=""})=>{let{theme:r}=useTheme$2(),[n,i]=useState(false),l=async()=>{try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),2e3);}catch(s){console.error("\u590D\u5236\u5931\u8D25:",s);}},d=r==="dark"?oneDark:oneLight;return jsxs("div",{className:Ie("rounded-lg overflow-hidden border border-gray-200 dark:border-gray-700 my-4",a),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300 uppercase",children:t}),jsx("button",{onClick:l,className:"p-1 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors",disabled:o,title:n?"Copied":"Copy code",children:n?jsx(Check,{size:14,className:"text-green-500"}):jsx(Clipboard,{size:14,className:"text-gray-500 dark:text-gray-400"})})]}),jsx("div",{className:"text-sm",children:jsx(Prism,{language:t,style:d,customStyle:{margin:0,padding:"16px",fontSize:"14px",lineHeight:"1.5",backgroundColor:r==="dark"?"#1f2937":"#ffffff"},wrapLongLines:true,children:e})})]})},Lm=Rk;var Bk=({content:e,isLoading:t,className:o="",style:a})=>{let r=useRef(null),[n,i]=useState(false),[l,d]=useState(null),{theme:s}=useTheme$2();return useEffect(()=>{let c=async()=>{if(!(!e.trim()||!r.current)){i(true),d(null);try{Nm.initialize({startOnLoad:!1,theme:s==="dark"?"dark":"default",securityLevel:"loose",fontFamily:"inherit"});let f=`mermaid-${Math.random().toString(36).substr(2,9)}`,u=e.replace(/```mermaid\n?|\n?```/g,"").trim(),{svg:h}=await Nm.render(f,u);r.current&&(r.current.innerHTML=h);}catch(f){console.error("Mermaid render failed:",f),d(f instanceof Error?f.message:"Render failed"),r.current&&(r.current.innerText=e);}finally{i(false);}}},g=setTimeout(()=>{c();},100);return ()=>clearTimeout(g)},[e,s]),t||n?jsx("div",{className:`mermaid-block loading ${o}`,style:a,children:jsxs("div",{className:"flex items-center justify-center p-4 bg-gray-50 dark:bg-gray-800 rounded border border-gray-200 dark:border-gray-700",children:[jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-500 mr-2"}),jsx("span",{className:"text-sm text-gray-500",children:"Generating Diagram..."})]})}):l?jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded text-red-600 dark:text-red-400 text-sm overflow-auto",children:[jsx("p",{className:"font-semibold mb-2",children:"Mermaid Error:"}),jsx("pre",{children:l}),jsx("pre",{className:"mt-4 text-xs text-gray-500",children:e})]}):jsx("div",{className:`mermaid-block overflow-x-auto ${o}`,style:a,ref:r})},Om=Bk;var Vk=({title:e="\u53D1\u751F\u9519\u8BEF",content:t,errorCode:o,stack:a,icon:r,closable:n=true,onClose:i,onRetry:l,className:d="",...s})=>{let[c,g]=useState(false),[f,u]=useState(false),h=async()=>{if(l){u(true);try{await l();}catch(w){console.error("\u91CD\u8BD5\u5931\u8D25:",w);}finally{u(false);}}};return jsxs("div",{className:`relative w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${d}`,...s,children:[jsxs("div",{className:"flex p-4 border-l-4 border-l-red-500 bg-red-50 dark:bg-red-900/10",children:[jsx("div",{className:"flex-shrink-0 mr-3 text-red-500 mt-0.5",children:r||jsx(AlertCircle,{className:"w-5 h-5"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[jsx("h4",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e}),o&&jsx("span",{className:"text-xs font-mono px-1.5 py-0.5 rounded bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300",children:o})]}),t&&jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3 leading-relaxed",children:typeof t=="string"?jsx("p",{className:"whitespace-pre-wrap",children:t}):t}),(l||a)&&jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[l&&jsxs("button",{onClick:h,disabled:f,className:"flex items-center text-xs font-medium text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors disabled:opacity-50",children:[jsx(RotateCw,{className:`w-3.5 h-3.5 mr-1.5 ${f?"animate-spin":""}`}),f?"\u91CD\u8BD5\u4E2D...":"\u91CD\u8BD5"]}),a&&jsxs("button",{onClick:()=>g(!c),className:"flex items-center text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 transition-colors",children:[c?jsx(ChevronDown,{className:"w-3.5 h-3.5 mr-1"}):jsx(ChevronRight,{className:"w-3.5 h-3.5 mr-1"}),c?"\u9690\u85CF\u8BE6\u60C5":"\u67E5\u770B\u8BE6\u60C5"]})]})]}),n&&i&&jsx("button",{onClick:i,className:"flex-shrink-0 ml-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors self-start",children:jsx(X,{className:"w-4 h-4"})})]}),a&&c&&jsx("div",{className:"bg-gray-50 dark:bg-gray-950 p-3 border-t border-gray-100 dark:border-gray-800",children:jsx("pre",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap p-2 bg-white dark:bg-gray-900 rounded border border-gray-200 dark:border-gray-800",children:a})})]})},Zs=Vk;var Uk=({title:e="\u8B66\u544A",content:t,warningType:o,severity:a="warning",warnings:r=[],icon:n,closable:i=true,onClose:l,onConfirm:d,actionText:s,className:c="",...g})=>{let f=()=>{switch(a){case "info":return {borderLeftColor:"border-l-blue-500",iconColor:"text-blue-500",bgColor:"bg-blue-50 dark:bg-blue-900/10"};case "error":return {borderLeftColor:"border-l-red-500",iconColor:"text-red-500",bgColor:"bg-red-50 dark:bg-red-900/10"};case "success":return {borderLeftColor:"border-l-green-500",iconColor:"text-green-500",bgColor:"bg-green-50 dark:bg-green-900/10"};default:return {borderLeftColor:"border-l-yellow-500",iconColor:"text-yellow-500",bgColor:"bg-yellow-50 dark:bg-yellow-900/10"}}},u=()=>{switch(a){case "info":return jsx(Info,{className:"w-5 h-5"});case "error":return jsx(XCircle,{className:"w-5 h-5"});case "success":return jsx(CheckCircle,{className:"w-5 h-5"});default:return jsx(AlertTriangle,{className:"w-5 h-5"})}},h=f();return jsxs("div",{className:`relative w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${c}`,...g,children:[jsxs("div",{className:`flex p-4 border-l-4 ${h.borderLeftColor} ${h.bgColor}`,children:[jsx("div",{className:`flex-shrink-0 mr-3 ${h.iconColor}`,children:n||u()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("h4",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:e}),o&&jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",children:o})]}),t&&jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:t}),r&&r.length>0&&jsx("ul",{className:"mt-2 space-y-1",children:r.map((w,p)=>jsxs("li",{className:"flex items-start text-sm text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"mr-2 mt-1.5 w-1 h-1 rounded-full bg-gray-400 dark:bg-gray-500 flex-shrink-0"}),jsx("span",{children:w})]},p))})]}),i&&l&&jsx("button",{onClick:l,className:"flex-shrink-0 ml-3 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors",children:jsx(X,{className:"w-4 h-4"})})]}),d&&jsx("div",{className:"bg-gray-50 dark:bg-gray-800/50 px-4 py-3 flex justify-end border-t border-gray-100 dark:border-gray-800",children:jsx("button",{onClick:d,className:"px-4 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",children:s||"\u786E\u8BA4"})})]})},js=Uk;var Zk=({title:e="\u76F8\u5173\u63A8\u8350",content:t,suggestions:o,onSuggestionClick:a,maxDisplay:r=5,icon:n,closable:i=false,onClose:l,className:d="",...s})=>{let[c,g]=useState(false),[f,u]=useState(""),[h,w]=useState(false),p=useMemo(()=>f.trim()?o.filter(y=>y.toLowerCase().includes(f.toLowerCase())):o,[o,f]),v=useMemo(()=>c?p:p.slice(0,r),[p,c,r]),m=y=>{a?.(y);};return !o||o.length===0?null:jsxs("div",{className:`w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${d}`,...s,children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-blue-50/30 dark:bg-blue-900/10",children:[jsxs("div",{className:"flex items-center space-x-2.5",children:[jsx("div",{className:"text-blue-500 flex-shrink-0",children:n||jsx(Lightbulb,{className:"w-5 h-5"})}),jsxs("div",{className:"flex flex-col",children:[jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 leading-tight",children:e}),t&&jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:t})]})]}),jsxs("div",{className:"flex items-center space-x-1",children:[o.length>3&&jsx("button",{onClick:()=>w(!h),className:`p-1.5 rounded-md transition-colors ${h?"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800"}`,title:h?"\u5173\u95ED\u641C\u7D22":"\u641C\u7D22\u95EE\u9898",children:jsx(Search,{className:"w-4 h-4"})}),i&&l&&jsx("button",{onClick:l,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-1.5 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:"\u5173\u95ED",children:jsx(X,{className:"w-4 h-4"})})]})]}),h&&jsx("div",{className:"px-4 py-2 border-b border-gray-100 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/50",children:jsxs("div",{className:"relative",children:[jsx("input",{type:"text",placeholder:"\u641C\u7D22\u76F8\u5173\u95EE\u9898...",value:f,onChange:y=>u(y.target.value),className:"w-full text-sm px-3 py-1.5 pl-8 rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 outline-none transition-shadow",autoFocus:true}),jsx(Search,{className:"absolute left-2.5 top-2 w-3.5 h-3.5 text-gray-400"})]})}),jsxs("div",{className:"p-2",children:[jsx("ul",{className:"space-y-1",children:v.map((y,x)=>jsx("li",{children:jsxs("button",{onClick:()=>m(y),className:"w-full text-left px-3 py-2 rounded-md text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-blue-600 dark:hover:text-blue-400 transition-colors group flex items-start justify-between",children:[jsx("span",{children:y}),jsx(ChevronRight,{className:"w-4 h-4 text-gray-300 group-hover:text-blue-400 opacity-0 group-hover:opacity-100 transition-all transform group-hover:translate-x-0.5"})]})},x))}),p.length>r&&jsx("button",{onClick:()=>g(!c),className:"w-full text-center py-2 text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors border-t border-gray-50 dark:border-gray-800/50 mt-1",children:c?"\u6536\u8D77":`\u67E5\u770B\u5168\u90E8 (${p.length})`}),p.length===0&&f&&jsx("div",{className:"text-center py-4 text-sm text-gray-500 dark:text-gray-400",children:"\u6CA1\u6709\u627E\u5230\u5339\u914D\u7684\u5EFA\u8BAE"})]})]})},Xs=Zk;var tS=({title:e,content:t,toolName:o,parameters:a,result:r,status:n,duration:i,icon:l,closable:d=false,onClose:s,onAction:c,actionText:g,className:f="",...u})=>{let[h,w]=useState(false),[p,v]=useState(true),m=()=>{switch(n){case "pending":return {iconColor:"text-blue-500",badgeBg:"bg-blue-50 dark:bg-blue-900/30",badgeText:"text-blue-600 dark:text-blue-400",label:"\u6267\u884C\u4E2D"};case "error":return {iconColor:"text-red-500",badgeBg:"bg-red-50 dark:bg-red-900/30",badgeText:"text-red-600 dark:text-red-400",label:"\u5931\u8D25"};default:return {iconColor:"text-green-500",badgeBg:"bg-green-50 dark:bg-green-900/30",badgeText:"text-green-600 dark:text-green-400",label:"\u6210\u529F"}}},y=()=>{switch(n){case "pending":return jsx(Loader2,{className:"w-5 h-5 animate-spin"});case "error":return jsx(XCircle,{className:"w-5 h-5"});default:return jsx(CheckCircle,{className:"w-5 h-5"})}},x=S=>S?S<1e3?`${S}ms`:`${(S/1e3).toFixed(2)}s`:"",k=m(),F=e||o||"\u5DE5\u5177\u8C03\u7528";return jsxs("div",{className:`w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md ${f}`,...u,children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50",children:[jsxs("div",{className:"flex items-center space-x-3",children:[jsx("div",{className:`flex-shrink-0 ${k.iconColor}`,children:l||y()}),jsxs("div",{children:[jsxs("div",{className:"flex items-center space-x-2",children:[jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:F}),jsx("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${k.badgeBg} ${k.badgeText}`,children:k.label})]}),o&&e&&jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 flex items-center mt-0.5",children:[jsx(Terminal,{className:"w-3 h-3 mr-1"}),o]})]})]}),jsxs("div",{className:"flex items-center space-x-2 text-xs text-gray-500 dark:text-gray-400",children:[i&&jsxs("div",{className:"flex items-center bg-gray-100 dark:bg-gray-800 px-2 py-1 rounded",children:[jsx(Clock,{className:"w-3 h-3 mr-1"}),x(i)]}),d&&s&&jsx("button",{onClick:s,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors p-1 rounded",children:jsx(X,{className:"w-4 h-4"})})]})]}),jsxs("div",{className:"p-4",children:[t&&jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300 mb-4 leading-relaxed",children:t}),a&&jsxs("div",{className:"mb-3",children:[jsxs("button",{onClick:()=>w(!h),className:"flex items-center text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 mb-2",children:[h?jsx(ChevronDown,{className:"w-3.5 h-3.5 mr-1"}):jsx(ChevronRight,{className:"w-3.5 h-3.5 mr-1"}),jsx(Box$1,{className:"w-3.5 h-3.5 mr-1.5"}),"\u8F93\u5165\u53C2\u6570"]}),h&&jsx("div",{className:"bg-gray-50 dark:bg-gray-950 rounded border border-gray-100 dark:border-gray-800 overflow-hidden",children:jsx("pre",{className:"p-3 text-xs font-mono text-gray-600 dark:text-gray-400 overflow-x-auto",children:JSON.stringify(a,null,2)})})]}),r&&jsxs("div",{children:[jsxs("button",{onClick:()=>v(!p),className:"flex items-center text-xs font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 mb-2",children:[p?jsx(ChevronDown,{className:"w-3.5 h-3.5 mr-1"}):jsx(ChevronRight,{className:"w-3.5 h-3.5 mr-1"}),jsx(Terminal,{className:"w-3.5 h-3.5 mr-1.5"}),"\u6267\u884C\u7ED3\u679C"]}),p&&jsx("div",{className:"bg-gray-50 dark:bg-gray-950 rounded border border-gray-100 dark:border-gray-800 overflow-hidden",children:jsx("pre",{className:"p-3 text-xs font-mono text-gray-600 dark:text-gray-400 overflow-x-auto",children:typeof r=="string"?r:JSON.stringify(r,null,2)})})]}),c&&jsx("div",{className:"mt-3 pt-3 border-t border-gray-100 dark:border-gray-800 flex justify-end",children:jsx("button",{onClick:c,className:"px-4 py-1.5 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",children:g||"\u6267\u884C\u64CD\u4F5C"})})]})]})},Qs=tS;var aS=({data:e})=>{if(!e)return null;let t=useMemo(()=>{let o=[],a=[],r="\u6570\u636E\u8868\u683C";return Array.isArray(e)?(o=e,o.length>0&&(a=Object.keys(o[0]).map(n=>({id:n,label:n.charAt(0).toUpperCase()+n.slice(1),numeric:typeof o[0][n]=="number"})))):typeof e=="object"&&(r=e.title||r,o=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[],Array.isArray(e.columns)?a=e.columns.map(i=>({id:i.key||i.id,label:i.title||i.label,numeric:i.dataType==="number"||i.numeric})):o.length>0&&(a=Object.keys(o[0]).map(i=>({id:i,label:i,numeric:typeof o[0][i]=="number"})))),o=o.map((n,i)=>({...n,id:n.id||`row_${i}`})),{title:r,columns:a,rows:o}},[e]);return t.rows.length===0?jsx("div",{className:"w-full my-4 p-4 border border-dashed border-gray-300 rounded text-center text-gray-500",children:"\u6682\u65E0\u8868\u683C\u6570\u636E"}):jsx("div",{className:"w-full my-4",children:jsx(Fa,{appId:"agent-ui-table-card",title:t.title,columns:t.columns,rows:t.rows,count:t.rows.length,rowKey:"id",fitContainer:false,maxHeight:"500px",rowsPerPage:10,rowsPerPageOptions:[5,10,20,50]})})},Ys=aS;var uS=({title:e,subtitle:t,data:o,type:a,config:r={}})=>{let n=()=>{switch(a){case "bar-chart-card":return jsx(BarChart,{className:"w-4 h-4 text-blue-500"});case "line-chart-card":return jsx(LineChart,{className:"w-4 h-4 text-green-500"});case "pie-chart-card":return jsx(PieChart,{className:"w-4 h-4 text-purple-500"});case "combo-chart-card":return jsx(Activity,{className:"w-4 h-4 text-orange-500"});case "heatmap-chart-card":return jsx(Grid$1,{className:"w-4 h-4 text-red-500"});case "fishbone-chart-card":return jsx(GitBranch,{className:"w-4 h-4 text-indigo-500"});case "waterfall-chart-card":return jsx(TrendingDown,{className:"w-4 h-4 text-teal-500"});case "google-map-card":return jsx(Globe,{className:"w-4 h-4 text-blue-600"});case "amap-card":return jsx(MapPin,{className:"w-4 h-4 text-blue-600"});default:return jsx(BarChart,{className:"w-4 h-4"})}},i=()=>{if(!o&&a!=="google-map-card"&&a!=="amap-card")return jsx("div",{className:"text-gray-500 text-sm p-4 text-center",children:"No data available"});try{switch(a){case "bar-chart-card":return jsx(An,{data:o,orientation:r.orientation||"horizontal",valueSuffix:r.valueSuffix||"",minHeight:r.minHeight});case "line-chart-card":return jsx(Ld,{data:o,color:r.color,valueSuffix:r.valueSuffix||"",height:r.height});case "pie-chart-card":let l=o.reduce((s,c)=>s+(Number(c.value)||0),0),d=o.map(s=>({name:s.name,value:Number(s.value)||0,percent:typeof s.percent=="number"?s.percent:l>0?(Number(s.value)||0)/l*100:0}));return jsx(Li,{data:d,variant:r.variant||"donut",size:r.size,colors:r.colors});case "combo-chart-card":return jsx(zd,{data:o,barColor:r.barColor,lineColor:r.lineColor});case "heatmap-chart-card":return jsx(Vd,{data:o});case "fishbone-chart-card":return jsx(Wd,{branches:o,effect:r.effect||e||"Problem"});case "waterfall-chart-card":return jsx(Hd,{data:o,height:r.height});case "google-map-card":return jsx(Kd,{embedUrl:r.embedUrl||o&&o[0]?.embedUrl,apiKey:r.apiKey,query:r.query||o&&o[0]?.query||e,height:r.height});case "amap-card":return jsx(jd,{embedUrl:r.embedUrl||o&&o[0]?.embedUrl,keyword:r.keyword||o&&o[0]?.keyword||e,height:r.height});default:return jsxs("div",{className:"text-gray-500 text-sm p-4 text-center",children:["Unsupported chart type: ",a]})}}catch(l){return console.error("Error rendering chart:",l),jsx("div",{className:"text-red-500 text-sm p-4 text-center",children:"Error rendering chart"})}};return jsxs("div",{className:"w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md",children:[jsxs("div",{className:"flex items-center px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-gray-50/50 dark:bg-gray-800/50",children:[jsx("div",{className:"mr-2 flex-shrink-0",children:n()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e}),t&&jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 truncate",children:t})]})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:"overflow-x-auto",children:i()}),jsx("div",{className:"mt-3",children:jsxs("details",{className:"text-xs text-gray-500 dark:text-gray-400",children:[jsx("summary",{className:"cursor-pointer hover:text-gray-700 dark:hover:text-gray-300 transition-colors select-none font-medium opacity-60 hover:opacity-100",children:"View Raw Data"}),jsx("pre",{className:"mt-2 p-2 bg-gray-50 dark:bg-gray-950 rounded border border-gray-100 dark:border-gray-800 overflow-x-auto max-h-40",children:JSON.stringify(o,null,2)})]})})]})]})},Js=uS;var gS=({type:e,manifest:t})=>jsxs("div",{className:"w-full overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shadow-sm transition-all hover:shadow-md",children:[jsxs("div",{className:"flex items-center px-4 py-3 border-b border-gray-100 dark:border-gray-800 bg-blue-50/50 dark:bg-blue-900/10",children:[jsx(Box$1,{className:"w-4 h-4 mr-2 text-blue-600 dark:text-blue-400"}),jsxs("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:["SAP Card: ",e]})]}),jsx("div",{className:"p-4",children:jsx("div",{className:"bg-gray-50 dark:bg-gray-950 p-3 rounded border border-gray-100 dark:border-gray-800 overflow-x-auto",children:jsx("pre",{className:"text-xs font-mono text-gray-600 dark:text-gray-400 whitespace-pre-wrap",children:JSON.stringify(t,null,2)})})})]}),tl=gS;var ol=e=>{let t;try{t=JSON.parse(e);}catch{return null}return t&&typeof t=="object"&&((t.type==="bar-chart-card"||t.type==="line-chart-card"||t.type==="pie-chart-card"||t.type==="combo-chart-card"||t.type==="heatmap-chart-card"||t.type==="fishbone-chart-card"||t.type==="waterfall-chart-card"||t.type==="google-map-card"||t.type==="amap-card")&&t.title||(t.type==="sap-analytical-card"||t.type==="sap-list-card"||t.type==="sap-object-card"||t.type==="sap-component-card")&&t.manifest||t.type==="error-card"||t.type==="warning-card"||t.type==="suggestions-card"||t.type==="tool-result-card"||t.type==="table"&&t.data)?t:null};var vS=({content:e,theme:t,size:o="base",className:a,enableCodeHighlight:r=true,enableMermaid:n=true,messageId:i,cardHooks:l})=>{let d=useMemo(()=>e?e.replace(/<think>([\s\S]*?)<\/think>/g,(f,u)=>`<div data-component="thinkbox" data-think-content="${encodeURIComponent(u.trim())}"></div>`):"",[e]),s=(f,u,h,w,p)=>{l?.onCardEvent?.({messageId:i,cardType:f,action:u,title:h,payload:w,rawData:p});},c=(f,u,h,w,p,v)=>{if(!(!p&&!l?.onCardEvent))return (...m)=>{let y=p?.(...m),x=v?v(...m):void 0;return s(f,u,h,x,w),y}},g=useMemo(()=>({div(f){let{"data-component":u,"data-think-content":h,...w}=f;return u==="thinkbox"&&h?jsx(Fm,{content:decodeURIComponent(h),theme:t,size:o,defaultExpanded:false}):jsx("div",{...w})},table({children:f}){return jsx("div",{className:"my-4 w-full overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:jsx("table",{className:"w-full min-w-[520px] border-collapse text-sm",children:f})})},thead({children:f}){return jsx("thead",{className:"bg-gray-50 dark:bg-gray-900/60",children:f})},tbody({children:f}){return jsx("tbody",{className:"bg-white dark:bg-gray-950",children:f})},tr({children:f}){return jsx("tr",{className:"border-b border-gray-200 dark:border-gray-800 last:border-b-0",children:f})},th({children:f,align:u}){return jsx("th",{className:`px-3 py-2 font-semibold text-gray-800 dark:text-gray-100 ${u==="center"?"text-center":u==="right"?"text-right":"text-left"}`,children:f})},td({children:f,align:u}){return jsx("td",{className:`px-3 py-2 text-gray-700 dark:text-gray-200 align-top ${u==="center"?"text-center":u==="right"?"text-right":"text-left"}`,children:f})},code({inline:f,className:u,children:h,...w}){let p=/language-([\w-]+)/.exec(u||""),v=p?p[1]:"";if(f)return jsx("code",{className:"font-mono text-sm bg-gray-100 dark:bg-gray-800 px-1 py-0.5 rounded text-red-600 dark:text-red-400",...w,children:h});let m=String(h).replace(/\n$/,"");if(n&&v==="mermaid")return jsx(Om,{content:m});if(v==="json"){let y=ol(m);if(y)switch(y.type){case "table":return jsx(Ys,{data:y.data});case "bar-chart-card":case "line-chart-card":case "pie-chart-card":case "combo-chart-card":case "heatmap-chart-card":case "fishbone-chart-card":case "waterfall-chart-card":case "google-map-card":case "amap-card":return jsx(Js,{...y});case "sap-analytical-card":case "sap-list-card":case "sap-object-card":case "sap-component-card":return jsx(tl,{...y});case "error-card":{let x=y;return jsx(Zs,{...x,onClose:c("error-card","close",x.title,x,x.onClose),onRetry:c("error-card","retry",x.title,x,x.onRetry)})}case "warning-card":{let x=y,k=x.onConfirm?c("warning-card","confirm",x.title,x,x.onConfirm):x.actionText&&l?.onCardEvent?c("warning-card","confirm",x.title,x):void 0;return jsx(js,{...x,onClose:c("warning-card","close",x.title,x,x.onClose),onConfirm:k})}case "suggestions-card":{let x=y;return jsx(Xs,{...x,onClose:c("suggestions-card","close",x.title,x,x.onClose),onSuggestionClick:c("suggestions-card","suggestion-click",x.title,x,x.onSuggestionClick,k=>({suggestion:k}))})}case "tool-result-card":{let x=y;return jsx(Qs,{...x,onClose:c("tool-result-card","close",x.title,x,x.onClose),onAction:c("tool-result-card","action",x.title,x,x.onAction)})}}}return r?jsx(Lm,{content:m,language:v,className:"not-prose"}):jsx("code",{className:u,...w,children:h})}}),[t,o,n,r,l,i]);return jsx("div",{className:Ie("markdown-body prose dark:prose-invert max-w-none",a),children:jsx(fS,{remarkPlugins:[hS,yS],rehypePlugins:[bS,xS],components:g,children:d})})},al=vS;var CS=({content:e,messageId:t,cardHooks:o})=>{let a=(i,l,d,s,c)=>{o?.onCardEvent?.({messageId:t,cardType:i,action:l,title:d,payload:s,rawData:c});},r=(i,l,d,s,c,g)=>{if(!(!c&&!o?.onCardEvent))return (...f)=>{let u=c?.(...f),h=g?g(...f):void 0;return a(i,l,d,h,s),u}},n=ol(e);if(n)switch(n.type){case "table":return jsx(Ys,{data:n.data});case "bar-chart-card":case "line-chart-card":case "pie-chart-card":case "combo-chart-card":case "heatmap-chart-card":case "fishbone-chart-card":case "waterfall-chart-card":case "google-map-card":case "amap-card":return jsx(Js,{...n});case "sap-analytical-card":case "sap-list-card":case "sap-object-card":case "sap-component-card":return jsx(tl,{...n});case "error-card":{let i=n;return jsx(Zs,{...i,onClose:r("error-card","close",i.title,i,i.onClose),onRetry:r("error-card","retry",i.title,i,i.onRetry)})}case "warning-card":{let i=n,l=i.onConfirm?r("warning-card","confirm",i.title,i,i.onConfirm):i.actionText&&o?.onCardEvent?r("warning-card","confirm",i.title,i):void 0;return jsx(js,{...i,onClose:r("warning-card","close",i.title,i,i.onClose),onConfirm:l})}case "suggestions-card":{let i=n;return jsx(Xs,{...i,onClose:r("suggestions-card","close",i.title,i,i.onClose),onSuggestionClick:r("suggestions-card","suggestion-click",i.title,i,i.onSuggestionClick,l=>({suggestion:l}))})}case "tool-result-card":{let i=n;return jsx(Qs,{...i,onClose:r("tool-result-card","close",i.title,i,i.onClose),onAction:r("tool-result-card","action",i.title,i,i.onAction)})}}return jsx("div",{className:"dynamic-card-fallback",children:jsx(al,{content:e,enableCodeHighlight:true,enableMath:true,enableMermaid:true,messageId:t,cardHooks:o})})},jm=CS;var Xc=class{static analyze(t){if(!t.trim())return {blocks:[],hasComplexContent:false,overallType:"simple"};let a=/```json\s*\{\s*"type":\s*"[^"]+"/g.test(t),r=/<[^>]+>[\s\S]*?<\/[^>]+>/.test(t),n=t.includes("NQ#")||t.includes("data-component");return a||r||n?{blocks:[{type:"mixed",content:t,startIndex:0,endIndex:t.length}],hasComplexContent:true,overallType:"complex"}:{blocks:[{type:"markdown",content:t,startIndex:0,endIndex:t.length}],hasComplexContent:false,overallType:"simple"}}},SS=({content:e,className:t="",messageId:o,cardHooks:a})=>{let r=ct__default.useMemo(()=>Xc.analyze(e),[e]);return jsx("div",{className:`universal-content-renderer ${t}`,children:r.blocks.map((n,i)=>n.type==="mixed"||n.type==="json-card"?jsx(jm,{content:n.content,messageId:o,cardHooks:a},`block-${i}`):jsx(al,{content:n.content,enableCodeHighlight:true,enableMath:true,enableMermaid:true,messageId:o,cardHooks:a},`block-${i}`))})},Xm=SS;var wS=({content:e,isStreaming:t=true,onComplete:o,className:a="",streamIntervalMs:r=24,streamChunkSize:n=3,messageId:i,cardHooks:l})=>{let[d,s]=useState(t?0:e.length),[c,g]=useState(!t);useEffect(()=>{if(t){s(0),g(false);return}s(e.length),g(true);},[e,t]),useEffect(()=>{if(!t||c)return;if(d>=e.length){g(true),o?.();return}let p=window.setTimeout(()=>{s(v=>Math.min(v+n,e.length));},r);return ()=>{window.clearTimeout(p);}},[e.length,c,t,o,n,r,d]);let f=()=>{t&&!c&&(s(e.length),g(true),o?.());},u=t?e.slice(0,d):e,h=t&&!c,w=t&&!c;return jsxs("div",{className:`streaming-markdown ${a}`,onClick:f,style:{cursor:t?"pointer":"default"},children:[jsxs("div",{className:"relative",children:[jsx(Xm,{content:u,messageId:i,cardHooks:l}),h&&jsx("span",{className:"inline-block w-0.5 h-5 bg-blue-500 ml-1 animate-pulse",style:{verticalAlign:"text-bottom"}})]}),w&&jsx("div",{className:"streaming-hint",style:{fontSize:"9px",color:"#999",marginTop:"8px",fontStyle:"italic",opacity:.7},children:"\u70B9\u51FB\u6B64\u5904\u663E\u793A\u5B8C\u6574\u5185\u5BB9"})]})},eg=wS;var tg=({buttons:e,className:t})=>{let o=a=>{switch(a){case "copy":return jsx(Copy,{size:14});case "refresh":return jsx(RefreshCw,{size:14});case "volume":return jsx(Volume2,{size:14});case "like":return jsx(ThumbsUp,{size:14});case "dislike":return jsx(ThumbsDown,{size:14});default:return null}};return jsx("div",{className:Ie("flex items-center gap-1",t),children:e.map((a,r)=>jsx("button",{onClick:a.onClick,disabled:a.disabled,className:Ie("p-1.5 rounded-md transition-colors","text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-800","disabled:opacity-50 disabled:cursor-not-allowed",a.active&&"text-blue-600 bg-blue-50 dark:text-blue-400 dark:bg-blue-900/20",a.type==="refresh"&&a.disabled&&"animate-spin"),title:a.type,type:"button",children:o(a.type)},`${a.type}-${r}`))})};var rl=({message:e,onStreamingComplete:t,assistantActions:o,streamIntervalMs:a,streamChunkSize:r,cardHooks:n})=>e.type==="assistant"?jsx("div",{className:"flex justify-start mb-4",children:jsxs("div",{className:"w-full bg-transparent text-black dark:text-gray-100 rounded-2xl px-4 py-3 mr-auto",style:{lineHeight:"1.5",fontSize:"16px",fontWeight:"280",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[jsx(eg,{content:e.content,isStreaming:e.isStreaming??false,onComplete:t,streamIntervalMs:a,streamChunkSize:r,messageId:e.id,cardHooks:n}),e.content&&o?.isLatestAssistant&&jsx("div",{className:"flex flex-row justify-start gap-2 mt-3 pt-2 border-t border-gray-100 dark:border-gray-700",children:jsx(tg,{buttons:[{type:"refresh",onClick:()=>o?.onRegenerate?.(),disabled:!o?.onRegenerate},{type:"copy",onClick:()=>navigator.clipboard.writeText(e.content),disabled:false},{type:"volume",onClick:()=>console.log("\u8BED\u97F3\u64AD\u653E"),disabled:false},{type:"like",onClick:()=>console.log("\u70B9\u8D5E"),disabled:false},{type:"dislike",onClick:()=>console.log("\u70B9\u8E29"),disabled:false}],size:"sm",variant:"default"})}),jsx("div",{className:"text-xs mt-2 text-gray-500 dark:text-gray-400",children:e.timestamp.toLocaleTimeString()})]})}):jsx("div",{className:"flex justify-end",children:jsxs("div",{className:"max-w-[80%] bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-100 rounded-2xl px-4 py-3 ml-auto",style:{lineHeight:"1.5",fontSize:"16px",fontWeight:"280",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[jsx("div",{className:"whitespace-pre-wrap",style:{lineHeight:"1.5",fontSize:"16px",fontWeight:"280",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:e.content}),jsx("div",{className:"text-xs mt-2 text-gray-500 dark:text-gray-400",children:e.timestamp.toLocaleTimeString()})]})});var ag=({onTextUpdate:e,onComplete:t,onCancel:o,disabled:a,className:r})=>{let{isRecording:n,startRecording:i,stopRecording:l}=_s({onTextUpdate:e,onComplete:s=>{t?.(s);},onError:s=>{console.error("Voice input error:",s),o?.();}});return jsx("button",{onClick:async()=>{n?l():await i();},disabled:a,className:Ie("transition-all duration-200 flex items-center justify-center rounded-full",n?"bg-red-100 text-red-600 hover:bg-red-200 animate-pulse":"bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 active:scale-95",a&&"opacity-50 cursor-not-allowed",r),title:n?"Stop recording":"Start recording",type:"button",children:n?jsx(AS,{sx:{fontSize:24}}):jsx(MS,{sx:{fontSize:24}})})};var dt={container:"w-full max-w-4xl mx-auto",inputContainer:Ie("w-full border backdrop-blur-xl transition-all duration-300 shadow-2xl flex flex-col","bg-white/80 dark:bg-gray-900/80","border-gray-200/60 dark:border-gray-600/40","shadow-gray-900/5","hover:border-blue-300/80 hover:shadow-blue-500/10 hover:shadow-2xl","focus-within:border-blue-400/90 focus-within:shadow-blue-500/20 focus-within:shadow-3xl focus-within:scale-[1.005] transform-gpu"),dragActive:"border-blue-500 bg-blue-50/50 dark:bg-blue-900/20",textareaWrapper:"flex-1 relative flex items-center",textarea:Ie("w-full outline-none appearance-none resize-none bg-transparent border-none text-sm font-normal py-3 px-2","placeholder:text-gray-400/70 dark:placeholder:text-gray-500/60 placeholder:font-normal","text-gray-800 dark:text-gray-100 selection:bg-blue-200/50 dark:selection:bg-blue-500/30","focus:ring-0 focus:outline-none focus:border-none focus:shadow-none","min-h-[44px] max-h-[12em] overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600"),filePreviewArea:"px-6 pt-3 pb-1 flex flex-wrap gap-2",fileTag:Ie("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs font-medium","bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300","border border-gray-200 dark:border-gray-700","transition-all hover:bg-gray-200 dark:hover:bg-gray-700"),buttonBase:"flex items-center justify-center transition-all duration-200 rounded-full",buttonSmall:"w-10 h-10",buttonNormal:Ie("bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400","cursor-pointer active:scale-95"),sendButton:Ie("cursor-pointer bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 shadow-none active:scale-95"),sendButtonDisabled:Ie("cursor-not-allowed opacity-40 bg-transparent text-gray-400"),stopButton:Ie("cursor-pointer bg-red-500 hover:bg-red-600 text-white shadow-sm active:scale-95")},OS={padding:0,lineHeight:"1.5",border:"none !important",boxShadow:"none !important",backgroundColor:"transparent",height:"auto",fontFeatureSettings:'"liga" 1, "kern" 1',WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},WS=({enabled:e,onClick:t})=>jsx("button",{className:Ie(dt.buttonBase,dt.buttonSmall,dt.buttonNormal),onClick:t,disabled:!e,"aria-label":"Upload file",type:"button",children:jsx(NS,{sx:{fontSize:24}})}),$S=()=>jsxs("button",{className:Ie(dt.buttonBase,"h-10 px-3 py-2 gap-1.5 rounded-full",dt.buttonNormal),"aria-label":"Tools",type:"button",children:[jsx(VS,{sx:{fontSize:20}}),jsx("span",{className:"text-sm font-medium",children:"Tools"})]}),HS=({canSend:e,isResponding:t,onSend:o,onStop:a})=>t?jsx("button",{className:Ie(dt.buttonBase,dt.buttonSmall,dt.stopButton),onClick:a,"aria-label":"Stop generating",type:"button",children:jsx(Stop,{sx:{fontSize:20}})}):jsx("button",{className:Ie(dt.buttonBase,dt.buttonSmall,e?dt.sendButton:dt.sendButtonDisabled),onClick:o,disabled:!e,"aria-label":"Send message",type:"button",children:jsx(zS,{sx:{fontSize:24},className:e?"text-gray-500 dark:text-gray-400":"text-gray-300 dark:text-gray-600"})}),rg=({onSend:e,onStop:t,isResponding:o=false,placeholder:a,getText:r})=>{let[n,i]=useState(""),[l,d]=useState([]),[s,c]=useState(false),[g,f]=useState(false),u=useRef(null),h=a||(r?r("00019","Type a message..."):"Type a message..."),w=(n.trim().length>0||l.length>0)&&!o,p={enabled:true},v=useCallback(M=>{i(M.target.value),M.target.style.height="auto",M.target.style.height=`${Math.min(M.target.scrollHeight,200)}px`;},[]),m=useCallback(M=>{if(M.target.files&&M.target.files.length>0){let $=Array.from(M.target.files);d(N=>{let X=$.filter(te=>N.some(re=>re.name===te.name&&re.size===te.size));X.length>0&&console.warn("Duplicate files ignored:",X.map(te=>te.name));let oe=$.filter(te=>!N.some(re=>re.name===te.name&&re.size===te.size));return [...N,...oe]}),u.current&&(u.current.value="");}},[]),y=useCallback(M=>{d($=>$.filter((N,X)=>X!==M));},[]),x=useCallback(()=>{u.current?.click();},[]),k=useCallback(async()=>{if(!w)return;let M=n,$=[...l];i(""),d([]),u.current&&(u.current.value="");try{await e(M,$);}catch(N){console.error("Failed to send message:",N),i(M),d($);}},[n,w,e,l]),F=useCallback(M=>{M.key==="Enter"&&!M.shiftKey&&!s&&(M.preventDefault(),k());},[k,s]),S=useCallback(()=>{c(true);},[]),T=useCallback(()=>{c(false);},[]),A=useCallback(M=>{i(M);},[]),R=useCallback(M=>{i(M);},[]),C=useCallback(()=>{},[]),D=useCallback(M=>{M.preventDefault(),f(true);},[]),I=useCallback(M=>{M.preventDefault(),f(false);},[]),P=useCallback(M=>{if(M.preventDefault(),f(false),M.dataTransfer.files&&M.dataTransfer.files.length>0){let $=Array.from(M.dataTransfer.files);d(N=>[...N,...$]);}},[]);return jsx("div",{className:dt.container,children:jsxs("div",{className:"relative",children:[jsx("input",{type:"file",multiple:true,className:"hidden",ref:u,onChange:m}),jsxs("div",{className:Ie(dt.inputContainer,g&&dt.dragActive),style:{borderRadius:"32px"},onDragOver:D,onDragLeave:I,onDrop:P,children:[l.length>0&&jsx("div",{className:dt.filePreviewArea,children:l.map((M,$)=>jsxs("div",{className:dt.fileTag,children:[jsx(InsertDriveFile,{sx:{fontSize:16},className:"text-blue-500"}),jsx("span",{className:"truncate max-w-[150px]",children:M.name}),jsx("button",{onClick:()=>y($),className:"ml-1 hover:text-red-500 focus:outline-none",type:"button",children:jsx(Close,{sx:{fontSize:16}})})]},`${M.name}-${$}`))}),jsxs("div",{className:"flex flex-col w-full p-2",children:[jsx("div",{className:Ie(dt.textareaWrapper,"px-3 pt-2 pb-3 min-h-[60px]"),children:jsx("textarea",{className:Ie(dt.textarea,"min-h-[24px] py-0 px-0"),placeholder:h,value:n,onChange:v,onKeyDown:F,onCompositionStart:S,onCompositionEnd:T,style:OS,"aria-label":"Message input",spellCheck:false,rows:1})}),jsxs("div",{className:"flex items-center justify-between px-1 pb-1",children:[jsxs("div",{className:"flex items-center gap-1",role:"toolbar","aria-label":"Input tools",children:[jsx(WS,{enabled:p.enabled,onClick:x}),jsx($S,{})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(ag,{onTextUpdate:A,onComplete:R,onCancel:C,disabled:o,className:dt.buttonSmall}),jsx(HS,{canSend:w,isResponding:o,onSend:k,onStop:t})]})]})]})]})]})})};var sg=({messages:e,onSend:t,onStop:o,onRegenerate:a,isResponding:r=false,className:n,placeholder:i,streamIntervalMs:l,streamChunkSize:d,onMessageStreamingComplete:s,cardHooks:c,showInput:g=true})=>{let f=useRef(null),u=useRef(e.length);return useEffect(()=>{e.length>u.current&&f.current?.scrollIntoView({behavior:"smooth"}),u.current=e.length;},[e]),jsxs("div",{className:Ie("flex flex-col h-full w-full relative",n),children:[jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600",children:[e.map((h,w)=>{let p=h.type==="assistant"&&w===e.length-1,v=h.type==="assistant"?{isLatestAssistant:p,onRegenerate:a?()=>a(h.id):void 0}:void 0;return jsx(rl,{message:h,assistantActions:v,onStreamingComplete:()=>s?.(h.id),streamIntervalMs:l,streamChunkSize:d,cardHooks:c},h.id)}),jsx("div",{ref:f})]}),g&&jsx("div",{className:"p-4 bg-gradient-to-t from-white via-white to-transparent dark:from-gray-900 dark:via-gray-900 pb-8 z-10",children:jsx(rg,{onSend:t||(async()=>{}),onStop:o||(()=>{}),isResponding:r,placeholder:i})})]})};var so={};var KS={idle:"Idle",running:"Running",success:"Success",error:"Error",pending:"Pending"},sz=({title:e="AI Agent",description:t,headerActions:o,className:a,agentStatus:r,showInput:n=false,...i})=>{let l=r??(i.isResponding?"running":"idle");return jsxs("div",{className:Ie("relative flex h-full w-full",so.agentPanel,a),"data-status":l,children:[jsx("div",{className:so.colorHalo,"data-status":l,"aria-hidden":"true"}),jsxs("div",{className:so.marqueeBorder,"data-status":l,"aria-hidden":"true",children:[jsx("span",{className:Ie(so.edge,so.top)}),jsx("span",{className:Ie(so.edge,so.right)}),jsx("span",{className:Ie(so.edge,so.bottom)}),jsx("span",{className:Ie(so.edge,so.left)})]}),jsxs("div",{className:"relative z-10 flex h-full w-full flex-col rounded-xl border border-slate-200/70 bg-white shadow-sm overflow-hidden dark:border-slate-800 dark:bg-gray-950",children:[jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 dark:border-gray-800 bg-white/50 dark:bg-gray-900/50 backdrop-blur-sm z-20",children:[jsxs("div",{children:[jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:e}),t&&jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5",children:t})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-full bg-gray-100/80 dark:bg-gray-800/70",children:[jsx("span",{className:so.statusDot,"data-status":l}),jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-gray-600 dark:text-gray-300",children:KS[l]})]}),o]})]}),jsx("div",{className:"flex-1 min-h-0 relative z-10",children:jsx(sg,{...i,showInput:n})})]})]})};var XS={"top-left":"bottom-right","top-right":"bottom-left","bottom-left":"top-right","bottom-right":"top-left"},fz=({messages:e,onSend:t,onRegenerate:o,isResponding:a=false,className:r,placeholder:n,title:i="Copilot",corner:l="bottom-right",onCollapse:d,onHeaderPointerDown:s,onPlusClick:c,onMicClick:g,streamIntervalMs:f,streamChunkSize:u,onMessageStreamingComplete:h,cardHooks:w})=>{let[p,v]=useState(""),[m,y]=useState(false),x=useRef(null),k=XS[l];useEffect(()=>{x.current?.scrollIntoView({behavior:"smooth"});},[e,a]);let F=useCallback(async()=>{let T=p.trim();!T||a||(v(""),await t(T));},[a,t,p]),S=useCallback(async T=>{T.key==="Enter"&&!m&&(T.preventDefault(),await F());},[F,m]);return jsxs("div",{className:Ie("relative flex h-full w-full min-h-[460px] min-w-[340px] flex-col overflow-hidden rounded-3xl border border-gray-200 bg-white shadow-none dark:border-gray-800 dark:bg-gray-900",r),children:[d&&jsx("button",{onClick:d,className:Ie("absolute z-20 flex h-10 w-10 items-center justify-center rounded-full transition-colors hover:bg-transparent dark:hover:bg-transparent",k==="top-left"&&"-left-2 -top-2",k==="top-right"&&"-right-2 -top-2",k==="bottom-left"&&"-bottom-2 -left-2",k==="bottom-right"&&"-bottom-2 -right-2"),type:"button","aria-label":"Collapse Copilot",children:jsx("span",{className:Ie("block h-4 w-4 border-[#21BCFF]",k==="top-left"&&"rounded-tl-full border-l-[3px] border-t-[3px]",k==="top-right"&&"rounded-tr-full border-r-[3px] border-t-[3px]",k==="bottom-left"&&"rounded-bl-full border-b-[3px] border-l-[3px]",k==="bottom-right"&&"rounded-br-full border-b-[3px] border-r-[3px]")})}),jsxs("div",{className:"flex items-center justify-between border-b border-gray-100 px-4 py-3 dark:border-gray-800",onPointerDown:s,children:[jsx("div",{className:"flex items-center",children:jsx("h3",{className:"text-base font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:i})}),jsx("div",{})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-5 scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600",children:[e.map((T,A)=>{let R=T.type==="assistant"&&A===e.length-1,C=T.type==="assistant"?{isLatestAssistant:R,onRegenerate:o?()=>o(T.id):void 0}:void 0;return jsx(rl,{message:T,assistantActions:C,onStreamingComplete:()=>h?.(T.id),streamIntervalMs:f,streamChunkSize:u,cardHooks:w},T.id)}),jsx("div",{ref:x})]}),jsx("div",{className:"border-t border-gray-100 px-3 py-3 dark:border-gray-800",children:jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-blue-300/80 bg-white px-2 py-1.5 dark:bg-gray-900",children:[jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",onClick:c,type:"button","aria-label":"Add",children:jsx(Plus,{className:"h-4 w-4"})}),jsx("input",{className:"h-7 flex-1 border-none bg-transparent text-sm text-gray-800 outline-none placeholder:text-gray-400 dark:text-gray-100 dark:placeholder:text-gray-500",placeholder:n||"Ask Copilot...",value:p,onChange:T=>v(T.target.value),onCompositionStart:()=>y(true),onCompositionEnd:()=>y(false),onKeyDown:S,"aria-label":"Copilot input",spellCheck:false}),jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-full text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",onClick:g,type:"button","aria-label":"Microphone",children:jsx(Mic,{className:"h-4 w-4"})})]})})]})};var xz=({defaultMode:e="login",onLogin:t,onRegister:o,onForgotPassword:a}={})=>{let[r,n]=useState(e),[i,l]=useState(false),d=useCallback(async u=>{l(true);try{await u?.();}finally{l(false);}},[]),s=useCallback(u=>d(()=>t?.(u)),[t,d]),c=useCallback(u=>d(()=>o?.(u)),[o,d]),g=useCallback(u=>d(()=>a?.(u)),[a,d]),f=useMemo(()=>({mode:r,loading:i,onModeChange:n,onLogin:s,onRegister:c,onForgotPassword:g}),[g,s,c,i,r]);return {mode:r,loading:i,setMode:n,authPageProps:f}};var Jc=({label:e,...t})=>jsx(FormControlLabel,{control:jsx(Checkbox,{...t}),label:e});var yi=forwardRef((e,t)=>jsx(Paper,{ref:t,...e,elevation:e.elevation||1,sx:{p:2,mb:2,...e.sx}}));yi.displayName="CPaper";var cw={productName:"ORBCAFE",headline:"Operational workbench",subheadline:"A focused entry point for reports, planning, agent workflows, and enterprise operations.",loginTitle:"Sign in",loginSubtitle:"Use your workspace account to continue.",registerTitle:"Create account",registerSubtitle:"Request a demo workspace user for evaluation.",forgotTitle:"Reset password",forgotSubtitle:"Send a password reset request to your email address."},Oz=({mode:e,defaultMode:t="login",onModeChange:o,onLogin:a,onRegister:r,onForgotPassword:n,loading:i=false,logo:l,copy:d,sx:s})=>{let c=useTheme(),g=e!==void 0,[f,u]=useState(t),h=e??f,w=useMemo(()=>({...cw,...d}),[d]),[p,v]=useState({username:"demo@orbcafe.local",password:"orbcafe-demo",remember:true}),[m,y]=useState({name:"",email:"",password:"",confirmPassword:"",acceptedTerms:false}),[x,k]=useState({email:""}),[F,S]=useState(""),T=P=>{g||u(P),S(""),o?.(P);},A=async P=>{P.preventDefault(),await a?.(p),S("Demo login accepted. No real authentication request was sent.");},R=async P=>{P.preventDefault(),await r?.(m),S("Demo registration saved locally for this screen.");},C=async P=>{P.preventDefault(),await n?.(x),S("Demo reset link request created. No email was sent.");},D=h==="login"?w.loginTitle:h==="register"?w.registerTitle:w.forgotTitle,I=h==="login"?w.loginSubtitle:h==="register"?w.registerSubtitle:w.forgotSubtitle;return jsxs(Box,{sx:{minHeight:"100vh",display:"grid",gridTemplateColumns:{xs:"1fr",md:"minmax(320px, 0.9fr) minmax(420px, 1.1fr)"},background:c.palette.mode==="dark"?"linear-gradient(135deg, #071018 0%, #151515 48%, #101827 100%)":"linear-gradient(135deg, #eef3f8 0%, #ffffff 52%, #e8f2f0 100%)",...s},children:[jsxs(Box,{sx:{display:{xs:"none",md:"flex"},flexDirection:"column",justifyContent:"space-between",p:{md:6,lg:8},borderRight:`1px solid ${c.palette.divider}`},children:[jsxs(Stack,{spacing:4,children:[jsx(Box,{children:l}),jsxs(Stack,{spacing:2,children:[jsx(Typography,{sx:{fontSize:14,fontWeight:700,color:"primary.main",textTransform:"uppercase"},children:w.productName}),jsx(Typography,{sx:{fontSize:{md:34,lg:42},lineHeight:1.06,fontWeight:800},children:w.headline}),jsx(Typography,{sx:{maxWidth:460,color:"text.secondary",fontSize:16,lineHeight:1.7},children:w.subheadline})]})]}),jsxs(Stack,{direction:"row",spacing:2,sx:{color:"text.secondary",fontSize:13},children:[jsx(Typography,{variant:"caption",children:"Reports"}),jsx(Typography,{variant:"caption",children:"Planning"}),jsx(Typography,{variant:"caption",children:"Agent UI"})]})]}),jsx(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",p:{xs:2,sm:4,md:6}},children:jsx(yi,{elevation:0,sx:{width:"100%",maxWidth:460,m:0,p:{xs:2.5,sm:4},borderRadius:3,border:`1px solid ${c.palette.divider}`,backgroundColor:c.palette.mode==="dark"?"rgba(15, 23, 42, 0.86)":"rgba(255, 255, 255, 0.88)",backdropFilter:"blur(18px)",boxShadow:c.palette.mode==="dark"?"0 24px 80px rgba(0,0,0,0.34)":"0 24px 80px rgba(15,23,42,0.10)"},children:jsxs(Stack,{spacing:3,children:[jsxs(Stack,{spacing:1,children:[jsx(Box,{sx:{display:{xs:"block",md:"none"},mb:1},children:l}),jsx(Typography,{sx:{fontSize:28,fontWeight:800},children:D}),jsx(Typography,{sx:{color:"text.secondary"},children:I})]}),F&&jsx(Alert,{severity:"success",children:F}),h==="login"&&jsx(Box,{component:"form",onSubmit:A,children:jsxs(Stack,{spacing:2,children:[jsx(Wt,{label:"Email or user ID",value:p.username,onChange:P=>v(M=>({...M,username:P.target.value})),InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(mg,{fontSize:"small"})})}}),jsx(Wt,{label:"Password",type:"password",value:p.password,onChange:P=>v(M=>({...M,password:P.target.value})),InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(sw,{fontSize:"small"})})}}),jsxs(Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2},children:[jsx(Jc,{label:"Remember me",checked:p.remember,onChange:P=>v(M=>({...M,remember:P.target.checked}))}),jsx(Do,{type:"button",variant:"text",size:"small",onClick:()=>T("forgot"),children:"Forgot?"})]}),jsx(Do,{type:"submit",size:"large",disabled:i,children:"Sign in"}),jsxs(Typography,{variant:"body2",sx:{color:"text.secondary",textAlign:"center"},children:["New user?"," ",jsx(Do,{type:"button",variant:"text",size:"small",onClick:()=>T("register"),sx:{minWidth:0,p:0},children:"Register"})]})]})}),h==="register"&&jsx(Box,{component:"form",onSubmit:R,children:jsxs(Stack,{spacing:2,children:[jsx(Wt,{label:"Full name",value:m.name,onChange:P=>y(M=>({...M,name:P.target.value})),InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(mg,{fontSize:"small"})})}}),jsx(Wt,{label:"Work email",type:"email",value:m.email,onChange:P=>y(M=>({...M,email:P.target.value})),InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(ug,{fontSize:"small"})})}}),jsx(Wt,{label:"Password",type:"password",value:m.password,onChange:P=>y(M=>({...M,password:P.target.value})),InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(lw,{fontSize:"small"})})}}),jsx(Wt,{label:"Confirm password",type:"password",value:m.confirmPassword,onChange:P=>y(M=>({...M,confirmPassword:P.target.value}))}),jsx(Jc,{label:"I accept the demo workspace terms",checked:m.acceptedTerms,onChange:P=>y(M=>({...M,acceptedTerms:P.target.checked}))}),jsx(Do,{type:"submit",size:"large",disabled:i,children:"Create demo account"}),jsxs(Typography,{variant:"body2",sx:{color:"text.secondary",textAlign:"center"},children:["Already have an account?"," ",jsx(Do,{type:"button",variant:"text",size:"small",onClick:()=>T("login"),sx:{minWidth:0,p:0},children:"Sign in"})]})]})}),h==="forgot"&&jsx(Box,{component:"form",onSubmit:C,children:jsxs(Stack,{spacing:2,children:[jsx(Wt,{label:"Work email",type:"email",value:x.email,onChange:P=>k({email:P.target.value}),InputProps:{startAdornment:jsx(InputAdornment,{position:"start",children:jsx(ug,{fontSize:"small"})})}}),jsx(Do,{type:"submit",size:"large",disabled:i,children:"Send reset request"}),jsxs(Typography,{variant:"body2",sx:{color:"text.secondary",textAlign:"center"},children:["Remember your password?"," ",jsx(Do,{type:"button",variant:"text",size:"small",onClick:()=>T("login"),sx:{minWidth:0,p:0},children:"Back to sign in"})]})]})}),jsx(Divider,{}),jsx(Typography,{variant:"caption",sx:{color:"text.secondary"},children:"Demo credentials: demo@orbcafe.local / orbcafe-demo"})]})})})]})};var uw={keyword:{value:"",operator:"contains"},status:{value:"",operator:"equals"},owner:{value:"",operator:"contains"},workCenter:{value:"",operator:"contains"}},mw=[{id:"keyword",label:"Keyword",type:"text",placeholder:"Task/ID/Project",hasSearchIcon:true},{id:"status",label:"Status",type:"select",options:[{label:"In progress",value:"in-progress"},{label:"Blocked",value:"blocked"},{label:"Planned",value:"planned"},{label:"Not started",value:"not-started"}]},{id:"owner",label:"Owner",type:"text",placeholder:"Owner name"},{id:"workCenter",label:"Work Center",type:"text",placeholder:"CNC-02 / WH-A / ..."},{id:"dateRange",label:"Date Range",type:"date"}],Uz=({tasks:e,defaultScale:t="week",defaultSelectedTaskId:o,initialFilters:a})=>{let[r,n]=useState(t),[i,l]=useState(o??e[0]?.id??""),[d,s]=useState({...uw,...a}),c=useMemo(()=>{let h=String(d.keyword?.value??"").trim().toLowerCase(),w=String(d.status?.value??"").trim(),p=String(d.owner?.value??"").trim().toLowerCase(),v=String(d.workCenter?.value??"").trim().toLowerCase(),m=d.dateRange?.value,y=m?.[0]?Ua(m[0]):null,x=m?.[1]?Ua(m[1]):null;return e.filter(k=>{if(h&&![k.id,k.code,k.title,k.project,k.workCenter,k.owner?.name].join(" ").toLowerCase().includes(h)||w&&k.status!==w||p&&!String(k.owner?.name??"").toLowerCase().includes(p)||v&&!String(k.workCenter??"").toLowerCase().includes(v))return false;if(y||x){let F=Ua(k.startDate),S=Ua(k.endDate),T=y?S.isAfter(y)||S.isSame(y,"day"):true,A=x?F.isBefore(x)||F.isSame(x,"day"):true;if(!T||!A)return false}return true})},[d,e]);useEffect(()=>{c.length!==0&&(c.some(h=>h.id===i)||l(c[0].id));},[c,i]);let g=useCallback(h=>{l(h.id);},[]),f=useMemo(()=>({appId:"planning-gantt-filter",tableKey:"planning",fields:mw,filters:d,onFilterChange:s,onVariantLoad:()=>{},onSearch:()=>{}}),[d]),u=useMemo(()=>({tasks:c,scale:r,onScaleChange:n,selectedTaskId:i,onTaskSelect:g}),[c,g,r,i]);return {scale:r,setScale:n,selectedTaskId:i,setSelectedTaskId:l,filters:d,setFilters:s,filteredTasks:c,smartFilterProps:f,planningGanttProps:u}};var gg=e=>jsx(Chip,{...e,size:e.size||"small",variant:e.variant||"outlined"});var Ga=forwardRef(({tooltip:e,...t},o)=>{let a=jsx(IconButton,{ref:o,...t,size:t.size||"small"});return e?jsx(Tooltip,{title:e,children:a}):a});Ga.displayName="CIconButton";var hg=({label:e,options:t,minWidth:o=120,...a})=>jsxs(FormControl,{fullWidth:true,size:"small",sx:{minWidth:o},children:[e&&jsx(InputLabel,{children:e}),jsx(Select,{label:e,...a,children:t.map(r=>jsx(MenuItem,{value:r.value,children:r.label},r.value))})]});var ad=[{value:"hour",label:"Hour",width:56},{value:"day",label:"Day",width:46},{value:"week",label:"Week",width:78},{value:"month",label:"Month",width:104}],vg=56,Ka=58,rd=8,nd=260,$w=320,qa="220ms cubic-bezier(0.2, 0, 0, 1)",kg={"not-started":{label:"Not started",color:"default"},planned:{label:"Planned",color:"info"},"in-progress":{label:"In progress",color:"primary"},blocked:{label:"Blocked",color:"error"},done:{label:"Done",color:"success"}},Hw=e=>e?kg[e]?.label??e:"Planned",Gw=e=>e?kg[e]?.color??"default":"info",Sg=e=>Math.min(100,Math.max(0,e??0)),wg=(e,t=0)=>e.flatMap(o=>[{...o,level:t},...wg(o.children??[],t+1)]),Uw=e=>({id:e.id,code:e.code??e.id,title:e.title,titleSub:e.project??e.workCenter??"General",owner:e.owner?.name??"Unassigned",status:Hw(e.status),statusTone:e.status??"planned",progress:Sg(e.progress),startDate:e.startDate,endDate:e.endDate,color:e.color}),Tg=(e,t)=>t==="month"?e.startOf("month"):t==="week"?e.startOf("week"):t==="day"?e.startOf("day"):e.startOf("hour"),Ig=(e,t)=>t==="month"?e.endOf("month"):t==="week"?e.endOf("week"):t==="day"?e.endOf("day"):e.endOf("hour"),Kw=(e,t,o)=>{let a=[],r=Tg(e,o),n=Ig(t,o);for(;r.isBefore(n)||r.isSame(n);){let i=o==="month"?r.add(1,"month"):o==="week"?r.add(1,"week"):o==="day"?r.add(1,"day"):r.add(1,"hour");a.push({key:`${o}-${r.valueOf()}`,label:o==="month"?r.format("MMM YYYY"):o==="week"?r.format("MMM D"):o==="day"?r.format("D"):r.format("HH:mm"),start:r,end:i}),r=i;}return a},Cg=(e,t,o)=>{let a=0;for(let r of t){if(e.isBefore(r.start))return a;if(e.isBefore(r.end)){let n=Math.max(1,r.end.valueOf()-r.start.valueOf()),i=Math.max(0,e.valueOf()-r.start.valueOf());return a+i/n*o}a+=o;}return a},kN=({title:e="Project Plan",subtitle:t="Task table and timeline view",extraTools:o,tasks:a,scale:r="week",onScaleChange:n,timelineStart:i,timelineEnd:l,selectedTaskId:d,onTaskSelect:s,emptyLabel:c="No planning tasks available.",sx:g})=>{let f=useTheme(),u=useRef(null),[h,w]=useState(null),[p,v]=useState(null),m=useRef(null),y=useMemo(()=>wg(a),[a]),x=useMemo(()=>new Map(y.map(U=>[U.id,U])),[y]),k=useMemo(()=>y.map(U=>Uw(U)),[y]),F=useMemo(()=>[{id:"code",label:"ID",minWidth:90},{id:"title",label:"Task",minWidth:260,render:(U,Y)=>jsxs(Stack,{spacing:.2,children:[jsx(Typography,{sx:{fontSize:15,fontWeight:700,lineHeight:1.2},children:Y.title}),jsx(Typography,{sx:{fontSize:13,color:"text.secondary"},children:Y.titleSub})]})},{id:"owner",label:"Owner",minWidth:170},{id:"status",label:"Status",minWidth:130,render:(U,Y)=>jsx(gg,{label:Y.status,color:Gw(Y.statusTone),size:"small"})},{id:"progress",label:"Progress",minWidth:140,numeric:true,render:U=>jsxs(Stack,{spacing:.6,children:[jsxs(Typography,{variant:"caption",sx:{color:"text.secondary"},children:[U,"%"]}),jsx(LinearProgress,{variant:"determinate",value:U,sx:{height:6,borderRadius:999}})]})},{id:"startDate",label:"Start",minWidth:120},{id:"endDate",label:"End",minWidth:120}],[]),S=Qr({appId:"planning-gantt",title:e,columns:F,rows:k,rowKey:"id",rowsPerPage:-1,rowsPerPageOptions:[-1],count:k.length,showSummary:false}),T=S.visibleRows,A=useMemo(()=>{let U=k.map(ve=>Ua(ve.startDate)),Y=k.map(ve=>Ua(ve.endDate)),Re=i?Ua(i):U.reduce((ve,Fe)=>Fe.isBefore(ve)?Fe:ve,U[0]??Ua()),j=l?Ua(l):Y.reduce((ve,Fe)=>Fe.isAfter(ve)?Fe:ve,Y[0]??Ua().add(30,"day")),fe=r==="month"?"month":r==="week"?"week":r==="day"?"day":"hour",Se=r==="month"?"month":r==="week"?"week":r==="day"?"day":"hour",Ne=r==="hour"?12:1,Ke=r==="hour"?12:1;return {start:Tg(Re.subtract(Ne,fe),r),end:Ig(j.add(Ke,Se),r)}},[k,r,l,i]),R=ad.find(U=>U.value===r)??ad[1],C=Array.isArray(o)?o:o?[o]:[],D=useMemo(()=>Kw(A.start,A.end,r),[A.end,A.start,r]),I=D.length*R.width,P=(S.columns||[]).filter(U=>S.visibleColumns.includes(U.id)).reduce((U,Y)=>U+(S.columnWidths?.[Y.id]||Y.minWidth||100),0),M=h??P,$=p==="timeline"?0:M,N=p==="timeline",X=p==="table",oe=!N&&!X,te=X?"0px":"minmax(0, 1fr)";useEffect(()=>{w(U=>U===null?null:Math.min(Math.max(U,nd),P));},[P]);let re=U=>{U.preventDefault(),U.currentTarget.setPointerCapture(U.pointerId),v(null),m.current={startX:U.clientX,startWidth:M};let Y=j=>{let fe=m.current;if(!fe)return;let Se=u.current?.clientWidth??0,Ne=Se>0?Math.max(nd,Se-rd-$w):P,Ke=Math.min(Math.max(fe.startWidth+j.clientX-fe.startX,nd),Ne);w(Ke);},Re=()=>{m.current=null,window.removeEventListener("pointermove",Y),window.removeEventListener("pointerup",Re),document.body.style.cursor="",document.body.style.userSelect="";};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",Y),window.addEventListener("pointerup",Re);},Q=()=>{v(null),w(null);};return jsxs(yi,{elevation:0,sx:{m:0,p:0,overflow:"hidden",borderRadius:3,border:`1px solid ${f.palette.divider}`,backgroundColor:f.palette.background.paper,...g},children:[jsxs(Stack,{direction:{xs:"column",md:"row"},justifyContent:"space-between",alignItems:{xs:"stretch",md:"center"},spacing:2,sx:{px:2,py:1.75,borderBottom:`1px solid ${f.palette.divider}`},children:[jsxs(Stack,{direction:"row",spacing:1.5,alignItems:"center",children:[jsx(Box,{sx:{width:38,height:38,borderRadius:2,display:"grid",placeItems:"center",backgroundColor:"primary.main",color:"primary.contrastText"},children:jsx(Bw,{fontSize:"small"})}),jsxs(Box,{children:[jsx(Typography,{sx:{fontSize:18,fontWeight:800},children:e}),jsx(Typography,{variant:"body2",sx:{color:"text.secondary"},children:t})]})]}),jsxs(Stack,{direction:"row",spacing:1,alignItems:"center",sx:{flexWrap:"wrap"},children:[C.length>0&&jsx(Stack,{direction:"row",spacing:.75,alignItems:"center",children:C.map((U,Y)=>jsx(Box,{sx:{display:"flex",alignItems:"center"},children:U},`planning-extra-tool-${Y}`))}),jsxs(Stack,{direction:"row",spacing:.25,sx:{p:.5,borderRadius:2,backgroundColor:"action.hover"},children:[jsx(Ga,{tooltip:"Column visibility",onClick:U=>S.setAnchorEl(U.currentTarget),color:"default",children:jsx(Sf,{fontSize:"small"})}),jsx(Ga,{tooltip:"Group by",onClick:U=>S.setGroupAnchorEl(U.currentTarget),color:"default",children:jsx(If,{fontSize:"small"})}),jsx(Ga,{tooltip:"Sort by first visible column",onClick:()=>{let U=(S.columns||[]).find(Y=>S.visibleColumns.includes(Y.id));U&&S.handleRequestSort(U.id);},color:S.orderBy?"primary":"default",children:jsx(Ow,{fontSize:"small"})})]}),jsxs(Stack,{direction:"row",spacing:.25,sx:{p:.5,borderRadius:2,backgroundColor:"action.hover"},children:[jsx(Ga,{tooltip:"Expand task table",onClick:()=>v("table"),color:p==="table"?"primary":"default",children:jsx(Nw,{fontSize:"small"})}),jsx(Ga,{tooltip:"Reset split",onClick:Q,color:p===null?"primary":"default",children:jsx(Vw,{fontSize:"small"})}),jsx(Ga,{tooltip:"Expand timeline",onClick:()=>v("timeline"),color:p==="timeline"?"primary":"default",children:jsx(zw,{fontSize:"small"})})]}),jsx(Box,{sx:{minWidth:120},children:jsx(hg,{label:"",value:r,options:ad.map(U=>({value:U.value,label:U.label})),onChange:U=>n?.(U.target.value),sx:{"& .MuiSelect-select":{fontSize:"0.92rem",py:.65},"& .MuiSvgIcon-root":{fontSize:20}}})})]})]}),k.length===0?jsx(Box,{sx:{minHeight:240,display:"grid",placeItems:"center",color:"text.secondary"},children:c}):jsx(Box,{sx:{overflow:"hidden"},children:jsxs(Box,{ref:u,sx:{display:"grid",gridTemplateColumns:`${$}px ${oe?rd:0}px ${te}`,transition:`grid-template-columns ${qa}`},children:[jsx(TableContainer,{sx:{width:$,overflowX:"auto",overflowY:"hidden",opacity:N?0:1,transform:N?"translateX(-10px)":"translateX(0)",pointerEvents:N?"none":"auto",transition:`opacity ${qa}, transform ${qa}, width ${qa}`},children:jsxs(Table,{size:"small",stickyHeader:true,sx:{tableLayout:"fixed",width:P,"& thead .MuiTableCell-root":{height:vg,py:0,lineHeight:1.15,boxSizing:"border-box"}},children:[jsx(ki,{columns:S.columns,visibleColumns:S.visibleColumns,order:S.order,orderBy:S.orderBy,onRequestSort:S.handleRequestSort,grouping:S.grouping,isAllExpanded:S.isAllExpanded,handleToggleAll:S.handleToggleAll,columnWidths:S.columnWidths,onColumnResize:S.handleColumnResize}),jsx(TableBody,{children:T.map(U=>{if(U.type==="group")return jsxs(TableRow,{sx:{height:Ka,backgroundColor:f.palette.action.hover},children:[S.grouping.length>0&&jsx(TableCell,{sx:{width:44,height:Ka,py:0,borderBottom:`1px solid ${f.palette.divider}`},children:jsx(IconButton,{size:"small",onClick:()=>S.toggleGroupExpand(U.id),children:U.isExpanded?jsx(Xf,{fontSize:"small"}):jsx(Ff,{fontSize:"small"})})}),jsx(TableCell,{colSpan:S.visibleColumns.length,sx:{height:Ka,py:0,borderBottom:`1px solid ${f.palette.divider}`},children:jsxs(Typography,{sx:{fontSize:13,fontWeight:700},children:[U.field,": ",U.value," (",U.count,")"]})})]},U.id);let Y=U.data||U,Re=Y.id===d;return jsxs(TableRow,{hover:true,selected:Re,onClick:()=>s?.(x.get(Y.id)||Y),sx:{cursor:s?"pointer":"default",height:Ka},children:[S.grouping.length>0&&jsx(TableCell,{sx:{width:44,height:Ka,py:0,borderBottom:`1px solid ${f.palette.divider}`}}),(S.columns||[]).filter(j=>S.visibleColumns.includes(j.id)).map(j=>jsx(TableCell,{sx:{width:S.columnWidths?.[j.id]||j.minWidth||100,height:Ka,py:0,overflow:"hidden",borderBottom:`1px solid ${f.palette.divider}`},children:j.render?j.render(Y[j.id],Y):String(Y[j.id]??"-")},`${Y.id}-${j.id}`))]},Y.id)})})]})}),jsx(Box,{onPointerDown:oe?re:void 0,role:"separator","aria-orientation":"vertical",sx:{width:oe?rd:0,cursor:oe?"col-resize":"default",opacity:oe?1:0,pointerEvents:oe?"auto":"none",borderLeft:oe?`1px solid ${f.palette.divider}`:"0 solid transparent",borderRight:oe?`1px solid ${f.palette.divider}`:"0 solid transparent",backgroundColor:f.palette.mode==="dark"?"rgba(148,163,184,0.10)":"rgba(15,23,42,0.04)",transition:`width ${qa}, opacity ${qa}, background-color 120ms ease`,position:"relative","&:hover":{backgroundColor:f.palette.action.selected},"&::before":{content:'""',position:"absolute",top:0,bottom:0,left:-6,right:-6,cursor:oe?"col-resize":"default"}}}),jsx(Box,{sx:{minWidth:0,overflow:"hidden",opacity:X?0:1,transform:X?"translateX(10px)":"translateX(0)",pointerEvents:X?"none":"auto",transition:`opacity ${qa}, transform ${qa}`},children:jsx(Box,{sx:{width:"100%",overflowX:"auto",overflowY:"hidden"},children:jsxs(Box,{sx:{width:I},children:[jsx(Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${D.length}, ${R.width}px)`,height:vg,borderBottom:`1px solid ${f.palette.divider}`,position:"sticky",top:0,zIndex:2,backgroundColor:f.palette.background.paper},children:D.map(U=>jsx(Box,{sx:{px:.75,display:"flex",alignItems:"center",borderRight:`1px solid ${f.palette.divider}`,color:"text.secondary",fontSize:12,fontWeight:700},children:U.label},U.key))}),jsx(Stack,{sx:{position:"relative"},children:T.map(U=>{if(U.type==="group")return jsx(Box,{sx:{position:"relative",height:Ka,borderBottom:`1px solid ${f.palette.divider}`,backgroundColor:f.palette.action.hover}},U.id);let Y=U.data||U,Re=Ua(Y.startDate),j=Ua(Y.endDate),fe=Cg(Re,D,R.width),Se=Cg(j,D,R.width),Ne=Math.max(18,Se-fe),Ke=Sg(Y.progress),ve=Y.id===d,Fe=Y.color??(Y.statusTone==="blocked"?f.palette.error.main:f.palette.primary.main);return jsx(Box,{onClick:()=>s?.(x.get(Y.id)||Y),sx:{position:"relative",height:Ka,borderBottom:`1px solid ${f.palette.divider}`,backgroundImage:f.palette.mode==="dark"?"linear-gradient(90deg, rgba(148,163,184,0.08) 1px, transparent 1px)":"linear-gradient(90deg, rgba(15,23,42,0.06) 1px, transparent 1px)",backgroundSize:`${R.width}px 100%`,cursor:s?"pointer":"default"},children:jsx(Tooltip,{title:`${Y.title}: ${Re.format("MMM D HH:mm")} - ${j.format("MMM D HH:mm")}`,children:jsxs(Box,{sx:{position:"absolute",left:fe,top:16,width:Ne,height:24,borderRadius:999,overflow:"hidden",backgroundColor:f.palette.mode==="dark"?"rgba(148,163,184,0.18)":"rgba(15,23,42,0.10)",outline:ve?`2px solid ${f.palette.warning.main}`:"none",outlineOffset:2},children:[jsx(Box,{sx:{height:"100%",width:`${Ke}%`,backgroundColor:Fe}}),jsx(Typography,{sx:{position:"absolute",inset:0,px:1,display:"flex",alignItems:"center",color:"#fff",fontSize:11,fontWeight:800,textShadow:"0 1px 4px rgba(0,0,0,0.45)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Y.code})]})})},Y.id)})})]})})})]})}),jsx(zr,{groupAnchorEl:S.groupAnchorEl,setGroupAnchorEl:S.setGroupAnchorEl,grouping:S.grouping,setGrouping:S.setGrouping,columns:S.columns,toggleGroupField:S.toggleGroupField}),jsx(Nr,{anchorEl:S.anchorEl,setAnchorEl:S.setAnchorEl,columns:S.columns,visibleColumns:S.visibleColumns,toggleColumnVisibility:S.toggleColumnVisibility})]})};var Qw={none:{from:{},to:{}},fade:{from:{opacity:0},to:{opacity:1}},"slide-up":{from:{opacity:0,transform:"translate3d(0, 12px, 0)"},to:{opacity:1,transform:"translate3d(0, 0, 0)"}},"slide-left":{from:{opacity:0,transform:"translate3d(12px, 0, 0)"},to:{opacity:1,transform:"translate3d(0, 0, 0)"}},scale:{from:{opacity:0,transform:"scale(0.985)"},to:{opacity:1,transform:"scale(1)"}}},PN=({children:e,transitionKey:t,variant:o="fade",durationMs:a=220,delayMs:r=0,easing:n="cubic-bezier(0.22, 1, 0.36, 1)",disabled:i=false,sx:l})=>{let d=useMediaQuery("(prefers-reduced-motion: reduce)"),[s,c]=useState("to"),g=!i&&!d&&o!=="none";useEffect(()=>{if(!g){c("to");return}c("from");let h=requestAnimationFrame(()=>{h=requestAnimationFrame(()=>{c("to");});});return ()=>cancelAnimationFrame(h)},[t,g]);let f=Qw[o],u=useMemo(()=>g?s==="from"?f.from:f.to:{opacity:1,transform:"none"},[g,s,f.from,f.to]);return jsx(Box,{sx:{willChange:g?"opacity, transform":"auto",transition:g?`opacity ${a}ms ${n} ${r}ms, transform ${a}ms ${n} ${r}ms`:"none",backfaceVisibility:"hidden",...u,...l},children:e})},RN={subtle:{variant:"fade",durationMs:180},smooth:{variant:"slide-up",durationMs:220},snappy:{variant:"scale",durationMs:160}};
17
+ export{sz as AgentPanel,ul as Button,uk as CAINavProvider,jd as CAmapChart,Cs as CAppHeader,r2 as CAppPageLayout,Oz as CAuthPage,An as CBarChart,Ri as CChartCard,zd as CComboChart,Jd as CCustomizeAgent,lA as CDetailInfoPage,jp as CDetailSearchAiBar,ps as CDetailSectionCard,Wd as CFishboneChart,Kd as CGoogleMapChart,Xd as CGraphCharts,Bd as CGraphKpiCards,Gi as CGraphReport,Vd as CHeatmapChart,DA as CKanbanBoard,tu as CKanbanBucket,cc as CKanbanCard,Sp as CLayoutManagement,ts as CLayoutManager,Ld as CLineChart,In as CMessageBox,vd as CPageLayout,PN as CPageTransition,Li as CPieChart,qB as CPivotTable,kN as CPlanningGantt,cr as CSmartFilter,PD as CSmartTable,ED as CStandardPage,Fa as CTable,kD as CTableBody,SD as CTableCell,wD as CTableContainer,TD as CTableHead,ID as CTableRow,_i as CVariantManagement,cp as CVariantManager,$c as CVoiceWaveOverlay,Hd as CWaterfallChart,Gn as CodeBlock,fz as CopilotChat,oT as GlobalMessage,Zn as MarkdownRenderer,Un as MathBlock,jl as MermaidBlock,hd as NavigationIsland,Tn as ORBCAFE_I18N_MESSAGES,vi as OrbcafeI18nProvider,RN as PAGE_TRANSITION_PRESETS,kF as PAppPageLayout,p5 as PBarcodeScanner,xm as PNavIsland,I5 as PNumericKeypad,pm as PSmartFilter,KC as PTable,y5 as PTouchCard,gm as PWorkloadNav,Gu as PivotChartPanel,sg as StdChat,Ql as TableBlock,cs as ThinkBlock,gl as TreeMenu,LF as VoiceNavigatorProvider,PF as VoiceWaveOverlay,Vi as buildAmapEmbedUrl,En as buildGoogleMapEmbedUrl,LI as buildGoogleMapIframe,Bg as buttonVariants,ru as createKanbanBoardModel,zo as findKanbanCard,O1 as message,ra as messageManager,hs as moveKanbanCard,ss as parseMarkdownTable,AM as renderMarkdown,Tp as resolveVariantFilters,os as resolveVariantLayout,mk as useAINav,jD as useAmapEmbedUrl,xz as useAuthPage,Qp as useDetailInfo,ZD as useGoogleMapEmbedUrl,GD as useGraphChartData,Ki as useGraphInteraction,_r as useGraphReport,EA as useKanbanBoard,bd as useNavigationIsland,Z as useOrbcafeI18n,o5 as usePadLayout,n5 as usePadRecordEditor,gu as usePageLayout,QB as usePivotTable,Uz as usePlanningGantt,WD as useStandardReport,_s as useVoiceInput,zF as useVoiceNavigator};