@platox/pivot-table 0.0.72 → 0.0.73
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../packages/dashboard-workbench/components/module-content/chart-module/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { message, Spin } from 'antd'\nimport { useDebounceEffect, useMemoizedFn, useSize } from 'ahooks'\nimport { EChartsOption, LabelFormatterCallback } from 'echarts'\nimport { t } from 'i18next'\nimport { groupBy, isNumber } from 'lodash-es'\nimport {\n ChartCustomDataType,\n ChartCustomeStylesTypes,\n TimeGroupInterval,\n} from '@platox/pivot-table/components/add-module-modal/add-chart-modal/interface'\nimport { useAppContext } from '../../../context'\nimport { FieldItem, ModuleDataApi } from '../../../types'\nimport { getTransformValue } from '../../../utils'\nimport { ChartType } from '../../add-module-modal/add-chart-modal/interface'\nimport { ConditionBlock } from '../../add-module-modal/components/condition-modal/interface'\nimport { mapConditionsToPostgrest } from '../utils'\nimport BaseChart from './base-chart'\nimport Empty from './Empty'\nimport { getChartConfig, getGrid, getSerie } from './utils'\n\ninterface ChartModuleProps {\n customData?: ChartCustomDataType\n customeStyle?: ChartCustomeStylesTypes\n onChange?: (val: unknown) => void\n moduleDataApi?: ModuleDataApi\n width?: number\n height?: number\n}\n\nconst ChartModule: React.FC<ChartModuleProps> = ({\n moduleDataApi,\n customData,\n customeStyle,\n width = 2,\n height = 2,\n}) => {\n const { globalData, globalFilterCondition } = useAppContext()\n\n /* ============================== split =============================== */\n let matchGlobalFilterCondition = useMemo(() => {\n let matchGlobalFilterCondition = globalFilterCondition?.find(\n item => item?.dataSourceId === customData?.dataSourceId\n )\n return matchGlobalFilterCondition\n }, [globalFilterCondition, customData?.dataSourceId])\n\n const [chartData, setChartData] = useState<any>()\n const [loading, setloading] = useState<any>()\n\n const fetchChartData = useMemoizedFn(async () => {\n setChartData([])\n if (customData) {\n // 调用方法\n setloading(true)\n let queryString = ''\n const newXAxisField = customData?.xAxis === 'tags' ? 'tag' : customData?.xAxis\n const newGroupField = customData?.groupField === 'tags' ? 'tag' : customData?.groupField\n\n if (!customData.isGroup) {\n if (customData.yAxis === 'recordTotal') {\n queryString += `select=${newXAxisField},id.count()`\n }\n\n if (customData.yAxis === 'fieldValue' && customData?.yAxisField) {\n queryString += `select=${newXAxisField},${customData?.yAxisField}.${customData?.yAxisFieldType}()`\n }\n } else {\n if (customData.yAxis === 'recordTotal') {\n queryString += `select=${newXAxisField},${newGroupField},id.count()`\n }\n if (customData.yAxis === 'fieldValue' && customData?.yAxisField) {\n queryString += `select=${newXAxisField},${newGroupField},${customData?.yAxisField}.${customData?.yAxisFieldType}()`\n }\n }\n\n // 筛选\n let conditionBlockList = []\n if ((matchGlobalFilterCondition?.conditionList?.length ?? 0) > 0) {\n conditionBlockList.push(matchGlobalFilterCondition)\n }\n if ((customData?.conditionData?.conditionList?.length ?? 0) > 0) {\n conditionBlockList.push(customData?.conditionData)\n }\n if (conditionBlockList.length > 0) {\n let DSLStr = mapConditionsToPostgrest(conditionBlockList as ConditionBlock[])\n queryString += !!DSLStr ? `&${DSLStr}` : ''\n }\n\n if (customData?.dataSourceId) {\n moduleDataApi?.({\n id: customData?.dataSourceId,\n query: queryString,\n })\n .then((res: any) => {\n if (!res.success) {\n message.error(res.message)\n return\n }\n\n setChartData(res.data)\n })\n .finally(() => {\n setloading(false)\n })\n }\n } else {\n setChartData([])\n }\n })\n\n useDebounceEffect(\n () => {\n if (customData) {\n fetchChartData()\n }\n },\n [\n customData?.dataSourceId,\n customData?.conditionData,\n customData?.sortField,\n customData?.sortOrder,\n customData?.xAxis,\n customData?.yAxis,\n customData?.yAxisField,\n customData?.yAxisFieldType,\n customData?.isGroup,\n customData?.groupField,\n matchGlobalFilterCondition,\n ],\n { wait: 60 }\n )\n\n /* ============================== split =============================== */\n const fieldOptions = useMemo(() => {\n let ret = globalData?.sourceData?.find(item => item.value === customData?.dataSourceId)?.fields\n return ret\n }, [globalData, customData?.dataSourceId])\n\n const chartOptions = useMemo(() => {\n if (customData && chartData && customData.type && chartData.length > 0) {\n const getChartOptions = (_chartData: any) => {\n const getFieldVal = ({\n item,\n field,\n timeGroupInterval,\n }: {\n item: any\n field: any\n timeGroupInterval?: TimeGroupInterval\n }) => {\n return getTransformValue({\n fieldOptions,\n val: item[field],\n field: field,\n fieldMap: globalData?.fieldMap,\n timeGroupInterval,\n })\n }\n const getFieldLabel = (field: string) => {\n const fieldData = fieldOptions?.find(item => item.value === field)\n return fieldData?.label\n }\n\n const isTimeField = (fieldName: string) => {\n return fieldOptions?.find(item => item.value === fieldName)?.type === 'timestamp'\n }\n\n const mapping = {\n tags: 'tag', //后端数据名不一致\n }\n const newXAxisField =\n mapping[customData?.xAxis as keyof typeof mapping] ?? customData?.xAxis\n const newGroupField =\n mapping[customData?.groupField as keyof typeof mapping] ?? customData?.groupField\n\n //规避bug: 前端操作合并了id不同 name相同的数据 这边吧所有数据都按照name 合并下 让看上去是对比\n let groupData = groupBy(_chartData, item => {\n const category = getFieldVal({\n item: item,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n return category\n })\n let chartData = Object.keys(groupData).map(key => {\n let groupList = groupData[key]\n let mergeObj = groupList.reduce((acc, item) => {\n Object.keys(item).forEach(k => {\n let value = item[k]\n if (isNumber(value)) {\n acc[k] = acc?.[k] ? acc[k] + value : value\n } else {\n acc[k] = value\n }\n })\n return acc\n }, {})\n return mergeObj\n })\n\n const categories = new Set<string>() //x轴数据\n const stackCategories = new Set<string>() //分组类别\n const valueGroups: Record<string, Record<string, number>> = {} // 分组下的y轴数据\n const valueCounts: Record<string, number> = {} //没有分组下的y轴数据\n\n chartData.forEach((item: any) => {\n const category = getFieldVal({\n item: item,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n const val =\n customData.yAxis === 'recordTotal' ? item?.count : item[customData?.yAxisFieldType] || 0\n\n const key = category ?? t('unknown')\n valueCounts[key] = val\n\n if (customData?.isGroup && customData?.groupField) {\n const stackCategory = getFieldVal({\n item: item,\n field: newGroupField,\n })\n\n const key = category ?? t('unknown')\n\n stackCategories.add(stackCategory)\n\n if (!valueGroups[stackCategory]) {\n valueGroups[stackCategory] = {}\n }\n valueGroups[stackCategory][key] = val\n }\n })\n\n // 计算百分比\n const valuePercentages: Record<string, number> = {} //没有分组下的y轴数据百分比\n const valueGroupPercentages: Record<string, Record<string, number>> = {} //分组下的y轴数据百分比\n if (customData?.isGroup && customData?.groupField) {\n const totalPerCategory: Record<string, number> = {}\n\n Object.keys(valueGroups).forEach(stackCategory => {\n Object.entries(valueGroups[stackCategory]).forEach(([key, val]) => {\n totalPerCategory[key] = (totalPerCategory[key] || 0) + val\n })\n })\n\n Object.keys(valueGroups).forEach(stackCategory => {\n valueGroupPercentages[stackCategory] = {}\n Object.entries(valueGroups[stackCategory]).forEach(([key, val]) => {\n const total = totalPerCategory[key] || 1 // 防止除以 0\n valueGroupPercentages[stackCategory][key] = (val / total) * 100\n })\n })\n } else {\n Object.entries(valueCounts).forEach(([key, val]) => {\n const total = val || 1 // 防止除以 0\n valuePercentages[key] = (val / total) * 100\n })\n }\n\n // 排序\n let sortField = customData?.sortField ?? 'xAxis'\n let sortOrder = customData?.sortOrder ?? 'asc'\n\n const sortedChartData = [...chartData].sort((a, b) => {\n let valA, valB\n\n switch (sortField) {\n case 'xAxis':\n valA = getFieldVal({\n item: a,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n valB = getFieldVal({\n item: b,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n break\n\n case 'yAxisField':\n valA =\n customData.yAxis === 'recordTotal' ? a?.count : a[customData?.yAxisFieldType] || 0\n valB =\n customData.yAxis === 'recordTotal' ? b?.count : b[customData?.yAxisFieldType] || 0\n break\n case 'recordValue':\n default:\n break\n }\n\n const orderMultiplier = sortOrder === 'asc' ? 1 : -1\n if (valA > valB) return 1 * orderMultiplier\n if (valA < valB) return -1 * orderMultiplier\n return 0\n })\n\n const sortedCategories = sortedChartData.map(item =>\n getFieldVal({\n item,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n )\n categories.clear()\n sortedCategories.forEach(cat => categories.add(cat))\n\n // display range 实现\n if (\n !isTimeField(customData?.xAxis) &&\n customData.displayRange !== 'ALL' &&\n !!customData.displayRange //兼容旧版本 没有displayRange\n ) {\n // 按照个数排序 1>0\n let sortedByCountCategories = Array.from(categories).sort((a, b) => {\n return valueCounts[b] - valueCounts[a]\n })\n\n // 提取符合条件的categories\n let ableCategories: string[] = []\n let [pos, count] = customData.displayRange.split('_')\n if (pos === 'TOP') {\n ableCategories = sortedByCountCategories.slice(0, Number(count))\n } else {\n ableCategories = sortedByCountCategories.slice(-Number(count))\n }\n\n // 从 categories 过滤掉不符合条件的数据 保留categories的排序\n Array.from(categories).forEach(item => {\n if (!ableCategories.includes(item)) {\n categories.delete(item)\n }\n return item\n })\n }\n\n // 标签\n const formatter: LabelFormatterCallback = data => {\n if (customData?.isGroup && customData?.groupField) {\n return data?.value == 0 ? '' : `${data?.value}`\n } else {\n return `${data?.value}`\n }\n }\n const label = {\n show: customData?.chartOptions?.includes('label'),\n position: 'top',\n formatter,\n }\n const labels = Array.from(categories) //x轴label\n const stackLabels = Array.from(stackCategories) //分组数据\n\n // series\n const series = []\n const chartConfig = getChartConfig({\n type: customData?.type as ChartType,\n categories: labels,\n }) as any\n\n const formatValue = v => {\n if (isNumber(v)) {\n return Math.floor(v * 100) / 100\n } else {\n return v\n }\n }\n\n if (customData?.isGroup && customData?.groupField) {\n stackLabels.forEach(stackCategory => {\n const data = ['chart-bar-percentage', 'chart-strip-bar-percentage'].includes(\n customData.type\n )\n ? labels.map(label => formatValue(valueGroupPercentages[stackCategory][label] || 0))\n : labels.map(label => formatValue(valueGroups[stackCategory][label] || 0))\n // 组合图\n let type = customData.type\n let yAxisPos = 'left'\n if (type == ChartType['chartCombination']) {\n let matchCombinationChartConfig = (customData?.groupFieldConfig ?? []).find(\n item =>\n getFieldVal({\n item: {\n [newGroupField]: item?.value,\n },\n field: newGroupField,\n }) == stackCategory\n )\n type = matchCombinationChartConfig?.config?.chartType ?? ChartType['ChartBar']\n yAxisPos = matchCombinationChartConfig?.config?.yAxisPos ?? 'left'\n }\n\n let seriesItem = getSerie({\n type: type,\n data,\n label,\n name: stackCategory,\n isGroup: customData?.isGroup,\n groupField: customData?.groupField,\n labels,\n })\n\n seriesItem.yAxisIndex = yAxisPos == 'left' ? 0 : 1\n series.push(seriesItem)\n })\n } else {\n const data = ['chart-bar-percentage', 'chart-strip-bar-percentage'].includes(\n customData.type\n )\n ? labels.map(label => formatValue(valuePercentages[label]?.toFixed(2) || 0)) // 使用百分比数据\n : labels.map(label => formatValue(valueCounts[label] || 0))\n\n //组合图\n let type = customData.type\n let yAxisPos = 'left'\n if (type == ChartType['chartCombination']) {\n type = customData?.yAxisFieldConfig?.chartType ?? ChartType['ChartBar']\n } else {\n yAxisPos = customData?.yAxisFieldConfig?.yAxisPos ?? 'left'\n }\n\n let seriesItem = getSerie({\n type: customData.type,\n data,\n label,\n name:\n customData.yAxis === 'recordTotal'\n ? t('pb.statisticsText')\n : getFieldLabel(customData?.yAxisField),\n isGroup: customData?.isGroup,\n groupField: customData?.groupField,\n labels,\n })\n\n seriesItem.yAxisIndex = yAxisPos == 'left' ? 0 : 1\n series.push(seriesItem)\n }\n\n // misc\n const grids = getGrid({ series, chartConfig, width, customeStyle })\n const isShowLegend = customData?.chartOptions?.includes('legend')\n\n let isLeftYAxisShow = series.some(item => item?.yAxisIndex == 0)\n let isRightYAxisShow = series.some(item => item?.yAxisIndex == 1)\n let yAxisConfig = {\n ...chartConfig.yAxis,\n axisTick: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLine: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLabel: {\n show: customData?.chartOptions?.includes('label'),\n formatter: (value: string) => {\n return value.length > 15 ? `${value.slice(0, 15)}...` : value // 截断并添加 \"...\"\n },\n hideOverlap: true,\n ...chartConfig.yAxis?.axisLabel,\n },\n splitLine: {\n show: customData?.chartOptions?.includes('splitLine'), // 不显示x轴网格线\n },\n }\n\n const options: EChartsOption = {\n legend: {\n type: 'scroll',\n left: 'center',\n right: 'center',\n top: '0',\n show: isShowLegend,\n itemWidth: 12,\n itemHeight: 12,\n data: series?.map((item: any) => item?.name || '') || [],\n },\n grid: {\n top: grids.top,\n left: grids.left,\n right: grids.right,\n bottom: grids.bottom,\n },\n graphic: {\n elements: [\n {\n type: 'text',\n left: 'center',\n bottom: '10px',\n style: {\n text: customeStyle?.xtitle || '',\n fill: '#333', // 文本颜色\n fontSize: 12,\n fontWeight: 'bold',\n },\n },\n {\n type: 'text',\n left: '10px',\n top: 'center',\n style: {\n text: customeStyle?.ytitle || '',\n fill: '#333', // 文本颜色\n fontSize: 12,\n fontWeight: 'bold',\n },\n rotation: Math.PI / 2,\n },\n ],\n },\n xAxis: {\n ...chartConfig.xAxis,\n axisTick: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLine: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLabel: {\n show: customData?.chartOptions?.includes('label'),\n rotate: grids.axisLabelRotate, // 使标签倾斜,调整为合适的角度\n interval: 'auto', // 自动隐藏\n formatter: (value: string) => {\n return value.length > 15 ? `${value.slice(0, 15)}...` : value // 截断并添加 \"...\"\n },\n ...(chartConfig.xAxis?.axisLabel ?? {}),\n },\n splitLine: {\n show: customData?.chartOptions?.includes('splitLine'), // 不显示x轴网格线\n },\n },\n yAxis: [\n {\n show: isLeftYAxisShow,\n ...yAxisConfig,\n },\n {\n show: isRightYAxisShow,\n ...yAxisConfig,\n },\n ],\n series: series,\n tooltip: {\n trigger: 'item', // 触发方式:鼠标悬浮在坐标轴上\n axisPointer: {\n type: 'shadow', // 阴影指示器,鼠标悬停时显示柱状图的阴影\n },\n // className: 'tooltipcls',\n // textStyle: {\n // width: 100,\n // overflow: 'hidden',\n // // overflow: 'break',\n // // ov: 'breakAll',\n // },\n appendTo: 'body',\n },\n }\n\n return options\n }\n\n return getChartOptions(chartData)\n } else {\n return null\n }\n }, [\n customData?.sortField,\n customData?.sortOrder,\n customData?.type,\n customData?.chartOptions,\n customData?.timeGroupInterval,\n customData?.groupFieldConfig,\n customData?.yAxisFieldConfig,\n customData?.displayRange,\n // customData,\n customeStyle,\n chartData,\n width,\n height,\n fieldOptions,\n ])\n\n /* ============================== split =============================== */\n const echartRef = useRef<any>()\n const containerRef = useRef<HTMLDivElement>(null)\n const size = useSize(containerRef)\n\n useEffect(() => {\n if (!!size) {\n echartRef?.current?.resize()\n }\n }, [size])\n\n const isLoading = loading\n const isEmpyt = !loading && !chartOptions\n const isOk = !isLoading && !!chartOptions\n return (\n <div style={{ width: '100%', height: '100%' }} ref={containerRef}>\n {isLoading && (\n <Spin\n style={{\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n spinning={loading}\n />\n )}\n {isEmpyt && <Empty />}\n {isOk && <BaseChart echartRef={echartRef} options={chartOptions ?? {}} />}\n </div>\n )\n}\n\nexport default React.memo(ChartModule)\n"],"names":["matchGlobalFilterCondition","_a","chartData","key","label","_b","BaseChart"],"mappings":";;;;;;;;;;;;;AA+BA,MAAM,cAA0C,CAAC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,SAAS;AACX,MAAM;AACJ,QAAM,EAAE,YAAY,sBAAsB,IAAI,cAAc;AAGxD,MAAA,6BAA6B,QAAQ,MAAM;AAC7C,QAAIA,8BAA6B,+DAAuB;AAAA,MACtD,CAAA,UAAQ,6BAAM,mBAAiB,yCAAY;AAAA;AAEtCA,WAAAA;AAAAA,EACN,GAAA,CAAC,uBAAuB,yCAAY,YAAY,CAAC;AAEpD,QAAM,CAAC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SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,YAAY;AAAA,QACd;AAAA,QACA,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IAED,+BAAY,OAAM,EAAA;AAAA,IAClB,QAAS,oBAAAE,OAAA,EAAU,WAAsB,SAAS,gBAAgB,GAAI,CAAA;AAAA,EAAA,GACzE;AAEJ;AAEA,MAAA,gBAAe,MAAM,KAAK,WAAW;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../packages/dashboard-workbench/components/module-content/chart-module/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { message, Spin } from 'antd'\nimport { useDebounceEffect, useMemoizedFn, useSize } from 'ahooks'\nimport { EChartsOption, LabelFormatterCallback } from 'echarts'\nimport { t } from 'i18next'\nimport { groupBy, isNumber } from 'lodash-es'\nimport {\n ChartCustomDataType,\n ChartCustomeStylesTypes,\n TimeGroupInterval,\n} from '@platox/pivot-table/components/add-module-modal/add-chart-modal/interface'\nimport { useAppContext } from '../../../context'\nimport { FieldItem, ModuleDataApi } from '../../../types'\nimport { getTransformValue } from '../../../utils'\nimport { ChartType } from '../../add-module-modal/add-chart-modal/interface'\nimport { ConditionBlock } from '../../add-module-modal/components/condition-modal/interface'\nimport { mapConditionsToPostgrest } from '../utils'\nimport BaseChart from './base-chart'\nimport Empty from './Empty'\nimport { getChartConfig, getGrid, getSerie } from './utils'\n\ninterface ChartModuleProps {\n customData?: ChartCustomDataType\n customeStyle?: ChartCustomeStylesTypes\n onChange?: (val: unknown) => void\n moduleDataApi?: ModuleDataApi\n width?: number\n height?: number\n}\n\nconst ChartModule: React.FC<ChartModuleProps> = ({\n moduleDataApi,\n customData,\n customeStyle,\n width = 2,\n height = 2,\n}) => {\n const { globalData, globalFilterCondition } = useAppContext()\n\n /* ============================== split =============================== */\n let matchGlobalFilterCondition = useMemo(() => {\n let matchGlobalFilterCondition = globalFilterCondition?.find(\n item => item?.dataSourceId === customData?.dataSourceId\n )\n return matchGlobalFilterCondition\n }, [globalFilterCondition, customData?.dataSourceId])\n\n const [chartData, setChartData] = useState<any>()\n const [loading, setloading] = useState<any>()\n\n const fetchChartData = useMemoizedFn(async () => {\n setChartData([])\n if (customData) {\n // 调用方法\n setloading(true)\n let queryString = ''\n const newXAxisField = customData?.xAxis === 'tags' ? 'tag' : customData?.xAxis\n const newGroupField = customData?.groupField === 'tags' ? 'tag' : customData?.groupField\n\n if (!customData.isGroup) {\n if (customData.yAxis === 'recordTotal') {\n queryString += `select=${newXAxisField},id.count()`\n }\n\n if (customData.yAxis === 'fieldValue' && customData?.yAxisField) {\n queryString += `select=${newXAxisField},${customData?.yAxisField}.${customData?.yAxisFieldType}()`\n }\n } else {\n if (customData.yAxis === 'recordTotal') {\n queryString += `select=${newXAxisField},${newGroupField},id.count()`\n }\n if (customData.yAxis === 'fieldValue' && customData?.yAxisField) {\n queryString += `select=${newXAxisField},${newGroupField},${customData?.yAxisField}.${customData?.yAxisFieldType}()`\n }\n }\n\n // 筛选\n let conditionBlockList = []\n if ((matchGlobalFilterCondition?.conditionList?.length ?? 0) > 0) {\n conditionBlockList.push(matchGlobalFilterCondition)\n }\n if ((customData?.conditionData?.conditionList?.length ?? 0) > 0) {\n conditionBlockList.push(customData?.conditionData)\n }\n if (conditionBlockList.length > 0) {\n let DSLStr = mapConditionsToPostgrest(conditionBlockList as ConditionBlock[])\n queryString += !!DSLStr ? `&${DSLStr}` : ''\n }\n\n if (customData?.dataSourceId) {\n moduleDataApi?.({\n id: customData?.dataSourceId,\n query: queryString,\n })\n .then((res: any) => {\n if (!res.success) {\n message.error(res.message)\n return\n }\n\n setChartData(res.data)\n })\n .finally(() => {\n setloading(false)\n })\n }\n } else {\n setChartData([])\n }\n })\n\n useDebounceEffect(\n () => {\n if (customData) {\n fetchChartData()\n }\n },\n [\n customData?.dataSourceId,\n customData?.conditionData,\n customData?.sortField,\n customData?.sortOrder,\n customData?.xAxis,\n customData?.yAxis,\n customData?.yAxisField,\n customData?.yAxisFieldType,\n customData?.isGroup,\n customData?.groupField,\n matchGlobalFilterCondition,\n ],\n { wait: 60 }\n )\n\n /* ============================== split =============================== */\n const fieldOptions = useMemo(() => {\n let ret = globalData?.sourceData?.find(item => item.value === customData?.dataSourceId)?.fields\n return ret\n }, [globalData, customData?.dataSourceId])\n\n const chartOptions = useMemo(() => {\n if (customData && chartData && customData.type && chartData.length > 0) {\n const getChartOptions = (_chartData: any) => {\n const getFieldVal = ({\n item,\n field,\n timeGroupInterval,\n }: {\n item: any\n field: any\n timeGroupInterval?: TimeGroupInterval\n }) => {\n return getTransformValue({\n fieldOptions,\n val: item[field],\n field: field,\n fieldMap: globalData?.fieldMap,\n timeGroupInterval,\n })\n }\n const getFieldLabel = (field: string) => {\n const fieldData = fieldOptions?.find(item => item.value === field)\n return fieldData?.label\n }\n\n const isTimeField = (fieldName: string) => {\n return fieldOptions?.find(item => item.value === fieldName)?.type === 'timestamp'\n }\n\n const mapping = {\n tags: 'tag', //后端数据名不一致\n }\n const newXAxisField =\n mapping[customData?.xAxis as keyof typeof mapping] ?? customData?.xAxis\n const newGroupField =\n mapping[customData?.groupField as keyof typeof mapping] ?? customData?.groupField\n\n //规避bug: 前端操作合并了id不同 name相同的数据 这边吧所有数据都按照name 合并下 让看上去是对比\n let groupData = groupBy(_chartData, item => {\n const category = getFieldVal({\n item: item,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n return category\n })\n let chartData = Object.keys(groupData).map(key => {\n let groupList = groupData[key]\n let mergeObj = groupList.reduce((acc, item) => {\n Object.keys(item).forEach(k => {\n let value = item[k]\n if (isNumber(value)) {\n acc[k] = acc?.[k] ? acc[k] + value : value\n } else {\n acc[k] = value\n }\n })\n return acc\n }, {})\n return mergeObj\n })\n\n const categories = new Set<string>() //x轴数据\n const stackCategories = new Set<string>() //分组类别\n const valueGroups: Record<string, Record<string, number>> = {} // 分组下的y轴数据\n const valueCounts: Record<string, number> = {} //没有分组下的y轴数据\n\n chartData.forEach((item: any) => {\n const category = getFieldVal({\n item: item,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n const val =\n customData.yAxis === 'recordTotal' ? item?.count : item[customData?.yAxisFieldType] || 0\n\n const key = category ?? t('unknown')\n valueCounts[key] = val\n\n if (customData?.isGroup && customData?.groupField) {\n const stackCategory = getFieldVal({\n item: item,\n field: newGroupField,\n })\n\n const key = category ?? t('unknown')\n\n stackCategories.add(stackCategory)\n\n if (!valueGroups[stackCategory]) {\n valueGroups[stackCategory] = {}\n }\n valueGroups[stackCategory][key] = val\n }\n })\n\n // 计算百分比\n const valuePercentages: Record<string, number> = {} //没有分组下的y轴数据百分比\n const valueGroupPercentages: Record<string, Record<string, number>> = {} //分组下的y轴数据百分比\n if (customData?.isGroup && customData?.groupField) {\n const totalPerCategory: Record<string, number> = {}\n\n Object.keys(valueGroups).forEach(stackCategory => {\n Object.entries(valueGroups[stackCategory]).forEach(([key, val]) => {\n totalPerCategory[key] = (totalPerCategory[key] || 0) + val\n })\n })\n\n Object.keys(valueGroups).forEach(stackCategory => {\n valueGroupPercentages[stackCategory] = {}\n Object.entries(valueGroups[stackCategory]).forEach(([key, val]) => {\n const total = totalPerCategory[key] || 1 // 防止除以 0\n valueGroupPercentages[stackCategory][key] = (val / total) * 100\n })\n })\n } else {\n Object.entries(valueCounts).forEach(([key, val]) => {\n const total = val || 1 // 防止除以 0\n valuePercentages[key] = (val / total) * 100\n })\n }\n\n // 排序\n let sortField = customData?.sortField ?? 'xAxis'\n let sortOrder = customData?.sortOrder ?? 'asc'\n\n const sortedChartData = [...chartData].sort((a, b) => {\n let valA, valB\n\n switch (sortField) {\n case 'xAxis':\n valA = getFieldVal({\n item: a,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n valB = getFieldVal({\n item: b,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n break\n\n case 'yAxisField':\n valA =\n customData.yAxis === 'recordTotal' ? a?.count : a[customData?.yAxisFieldType] || 0\n valB =\n customData.yAxis === 'recordTotal' ? b?.count : b[customData?.yAxisFieldType] || 0\n break\n case 'recordValue':\n default:\n break\n }\n\n const orderMultiplier = sortOrder === 'asc' ? 1 : -1\n if (valA > valB) return 1 * orderMultiplier\n if (valA < valB) return -1 * orderMultiplier\n return 0\n })\n\n const sortedCategories = sortedChartData.map(item =>\n getFieldVal({\n item,\n field: newXAxisField,\n timeGroupInterval: customData?.timeGroupInterval,\n })\n )\n categories.clear()\n sortedCategories.forEach(cat => categories.add(cat))\n\n // display range 实现\n if (\n !isTimeField(customData?.xAxis) &&\n customData.displayRange !== 'ALL' &&\n !!customData.displayRange //兼容旧版本 没有displayRange\n ) {\n // 按照个数排序 1>0\n let sortedByCountCategories = Array.from(categories).sort((a, b) => {\n return valueCounts[b] - valueCounts[a]\n })\n\n // 提取符合条件的categories\n let ableCategories: string[] = []\n let [pos, count] = customData.displayRange.split('_')\n if (pos === 'TOP') {\n ableCategories = sortedByCountCategories.slice(0, Number(count))\n } else {\n ableCategories = sortedByCountCategories.slice(-Number(count))\n }\n\n // 从 categories 过滤掉不符合条件的数据 保留categories的排序\n Array.from(categories).forEach(item => {\n if (!ableCategories.includes(item)) {\n categories.delete(item)\n }\n return item\n })\n }\n\n // 标签\n const formatter: LabelFormatterCallback = data => {\n if (customData?.isGroup && customData?.groupField) {\n return data?.value == 0 ? '' : `${data?.value}`\n } else {\n return `${data?.value}`\n }\n }\n const label = {\n show: customData?.chartOptions?.includes('label'),\n position: 'top',\n formatter,\n }\n const labels = Array.from(categories) //x轴label\n const stackLabels = Array.from(stackCategories) //分组数据\n\n // series\n const series = []\n const chartConfig = getChartConfig({\n type: customData?.type as ChartType,\n categories: labels,\n }) as any\n\n const formatValue = v => {\n if (isNumber(v)) {\n return Math.floor(v * 100) / 100\n } else {\n return v\n }\n }\n\n if (customData?.isGroup && customData?.groupField) {\n stackLabels.forEach(stackCategory => {\n const data = ['chart-bar-percentage', 'chart-strip-bar-percentage'].includes(\n customData.type\n )\n ? labels.map(label => formatValue(valueGroupPercentages[stackCategory][label] || 0))\n : labels.map(label => formatValue(valueGroups[stackCategory][label] || 0))\n // 组合图\n let type = customData.type\n let yAxisPos = 'left'\n if (type == ChartType['chartCombination']) {\n let matchCombinationChartConfig = (customData?.groupFieldConfig ?? []).find(\n item =>\n getFieldVal({\n item: {\n [newGroupField]: item?.value,\n },\n field: newGroupField,\n }) == stackCategory\n )\n type = matchCombinationChartConfig?.config?.chartType ?? ChartType['ChartBar']\n yAxisPos = matchCombinationChartConfig?.config?.yAxisPos ?? 'left'\n }\n\n let seriesItem = getSerie({\n type: type,\n data,\n label,\n name: stackCategory,\n isGroup: customData?.isGroup,\n groupField: customData?.groupField,\n labels,\n })\n\n seriesItem.yAxisIndex = yAxisPos == 'left' ? 0 : 1\n series.push(seriesItem)\n })\n } else {\n const data = ['chart-bar-percentage', 'chart-strip-bar-percentage'].includes(\n customData.type\n )\n ? labels.map(label => formatValue(valuePercentages[label]?.toFixed(2) || 0)) // 使用百分比数据\n : labels.map(label => formatValue(valueCounts[label] || 0))\n\n //组合图\n let type = customData.type\n let yAxisPos = 'left'\n if (type == ChartType['chartCombination']) {\n type = customData?.yAxisFieldConfig?.chartType ?? ChartType['ChartBar']\n } else {\n yAxisPos = customData?.yAxisFieldConfig?.yAxisPos ?? 'left'\n }\n\n let seriesItem = getSerie({\n type: customData.type,\n data,\n label,\n name:\n customData.yAxis === 'recordTotal'\n ? t('pb.statisticsText')\n : getFieldLabel(customData?.yAxisField),\n isGroup: customData?.isGroup,\n groupField: customData?.groupField,\n labels,\n })\n\n seriesItem.yAxisIndex = yAxisPos == 'left' ? 0 : 1\n series.push(seriesItem)\n }\n\n // misc\n const grids = getGrid({ series, chartConfig, width, customeStyle })\n const isShowLegend = customData?.chartOptions?.includes('legend')\n\n let isLeftYAxisShow = series.some(item => item?.yAxisIndex == 0)\n let isRightYAxisShow = series.some(item => item?.yAxisIndex == 1)\n let yAxisConfig = {\n ...chartConfig.yAxis,\n axisTick: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLine: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLabel: {\n show: customData?.chartOptions?.includes('label'),\n formatter: (value: string) => {\n return value.length > 15 ? `${value.slice(0, 15)}...` : value // 截断并添加 \"...\"\n },\n hideOverlap: true,\n ...chartConfig.yAxis?.axisLabel,\n },\n splitLine: {\n show: customData?.chartOptions?.includes('splitLine'), // 不显示x轴网格线\n },\n }\n\n const options: EChartsOption = {\n legend: {\n type: 'scroll',\n left: 'center',\n right: 'center',\n top: '0',\n show: isShowLegend,\n itemWidth: 12,\n itemHeight: 12,\n data: series?.map((item: any) => item?.name || '') || [],\n },\n grid: {\n top: grids.top,\n left: grids.left,\n right: grids.right,\n bottom: grids.bottom,\n },\n graphic: {\n elements: [\n {\n type: 'text',\n left: 'center',\n bottom: '10px',\n style: {\n text: customeStyle?.xtitle || '',\n fill: '#333', // 文本颜色\n fontSize: 12,\n fontWeight: 'bold',\n },\n },\n {\n type: 'text',\n left: '10px',\n top: 'center',\n style: {\n text: customeStyle?.ytitle || '',\n fill: '#333', // 文本颜色\n fontSize: 12,\n fontWeight: 'bold',\n },\n rotation: Math.PI / 2,\n },\n ],\n },\n xAxis: {\n ...chartConfig.xAxis,\n axisTick: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLine: {\n show: customData?.chartOptions?.includes('axis'),\n },\n axisLabel: {\n show: customData?.chartOptions?.includes('label'),\n rotate: grids.axisLabelRotate, // 使标签倾斜,调整为合适的角度\n interval: 'auto', // 自动隐藏\n formatter: (value: string) => {\n return value.length > 15 ? `${value.slice(0, 15)}...` : value // 截断并添加 \"...\"\n },\n ...(chartConfig.xAxis?.axisLabel ?? {}),\n },\n splitLine: {\n show: customData?.chartOptions?.includes('splitLine'), // 不显示x轴网格线\n },\n },\n yAxis: [\n {\n show: isLeftYAxisShow,\n ...yAxisConfig,\n },\n {\n show: isRightYAxisShow,\n ...yAxisConfig,\n },\n ],\n series: series,\n tooltip: {\n trigger: 'item', // 触发方式:鼠标悬浮在坐标轴上\n axisPointer: {\n type: 'shadow', // 阴影指示器,鼠标悬停时显示柱状图的阴影\n },\n // className: 'tooltipcls',\n // textStyle: {\n // width: 100,\n // overflow: 'hidden',\n // // overflow: 'break',\n // // ov: 'breakAll',\n // },\n extraCssText: 'max-width:30vw; white-space:pre-wrap; word-break:break-all',\n appendTo: 'body',\n },\n }\n\n return options\n }\n\n return getChartOptions(chartData)\n } else {\n return null\n }\n }, [\n customData?.sortField,\n customData?.sortOrder,\n customData?.type,\n customData?.chartOptions,\n customData?.timeGroupInterval,\n customData?.groupFieldConfig,\n customData?.yAxisFieldConfig,\n customData?.displayRange,\n // customData,\n customeStyle,\n chartData,\n width,\n height,\n fieldOptions,\n ])\n\n /* ============================== split =============================== */\n const echartRef = useRef<any>()\n const containerRef = useRef<HTMLDivElement>(null)\n const size = useSize(containerRef)\n\n useEffect(() => {\n if (!!size) {\n echartRef?.current?.resize()\n }\n }, [size])\n\n const isLoading = loading\n const isEmpyt = !loading && !chartOptions\n const isOk = !isLoading && !!chartOptions\n return (\n <div style={{ width: '100%', height: '100%' }} ref={containerRef}>\n {isLoading && (\n <Spin\n style={{\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n spinning={loading}\n />\n )}\n {isEmpyt && <Empty />}\n {isOk && <BaseChart echartRef={echartRef} options={chartOptions ?? {}} />}\n </div>\n )\n}\n\nexport default React.memo(ChartModule)\n"],"names":["matchGlobalFilterCondition","_a","chartData","key","label","_b","BaseChart"],"mappings":";;;;;;;;;;;;;AA+BA,MAAM,cAA0C,CAAC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,SAAS;AACX,MAAM;AACJ,QAAM,EAAE,YAAY,sBAAsB,IAAI,cAAc;AAGxD,MAAA,6BAA6B,QAAQ,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B,SAAA,qBAAC,OAAI,EAAA,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAU,GAAA,KAAK,cACjD,UAAA;AAAA,IACC,aAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,YAAY;AAAA,QACd;AAAA,QACA,UAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IAED,+BAAY,OAAM,EAAA;AAAA,IAClB,QAAS,oBAAAE,OAAA,EAAU,WAAsB,SAAS,gBAAgB,GAAI,CAAA;AAAA,EAAA,GACzE;AAEJ;AAEA,MAAA,gBAAe,MAAM,KAAK,WAAW;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/dashboard-workbench/utils/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Layout } from 'react-grid-layout'\nimport dayjs from 'dayjs'\nimport { isNil } from 'lodash-es'\nimport { TimeGroupInterval } from '../components/add-module-modal/add-chart-modal/interface'\nimport { FieldItem } from '../types'\n\nexport const getTransformValue = ({\n val,\n field,\n fieldOptions,\n fieldMap,\n timeGroupInterval,\n showNill = true,\n}: {\n val: any\n field: any\n fieldOptions?: FieldItem[]\n fieldMap?: Record<string, string> //枚举的翻译\n timeGroupInterval?: TimeGroupInterval // 时间汇总 xAxis 是time的时候有效\n showNill?: boolean\n}) => {\n const fieldData = fieldOptions?.find(item => item.value === field)\n let newVal = val\n if (fieldData?.type === 'enum' && fieldData?.enum && fieldData?.enum?.length > 0) {\n const label = fieldData?.enum?.find(enumItem => enumItem.value === val)?.label\n newVal = label ? fieldMap?.[label] || label : val\n }\n if (fieldData?.type === 'timestamp') {\n let format = 'YYYY-MM-DD'\n switch (timeGroupInterval) {\n case 'day':\n format = 'YYYY-MM-DD'\n newVal = val ? dayjs(val).format(format) : ''\n break\n case 'week':\n const startDate = val ? dayjs(val).startOf('week').format('YYYY-MM-DD') : ''\n const endDate = val ? dayjs(val).endOf('week').format('YYYY-MM-DD') : ''\n newVal = val ? `${startDate}~${endDate}` : ''\n break\n case 'month':\n format = 'YYYY-MM'\n newVal = val ? dayjs(val).format(format) : ''\n break\n case 'year':\n format = 'YYYY'\n newVal = val ? dayjs(val).format(format) : ''\n break\n default:\n format = 'YYYY-MM-DD'\n newVal = val ? dayjs(val).format(format) : ''\n break\n }\n }\n\n //这玩意好像还会是数组\n newVal = Array.isArray(newVal) ? newVal.join(',') : newVal\n\n // https://applink.larksuite.com/client/todo/detail?guid=b5c44575-b66c-4c77-85eb-514a42a18330&suite_entity_num=t106725\n if (showNill && isNil(newVal)) {\n newVal = `Null`\n }\n\n return newVal\n // return `
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/dashboard-workbench/utils/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Layout } from 'react-grid-layout'\nimport dayjs from 'dayjs'\nimport { isNil } from 'lodash-es'\nimport { TimeGroupInterval } from '../components/add-module-modal/add-chart-modal/interface'\nimport { FieldItem } from '../types'\n\nexport const getTransformValue = ({\n val,\n field,\n fieldOptions,\n fieldMap,\n timeGroupInterval,\n showNill = true,\n}: {\n val: any\n field: any\n fieldOptions?: FieldItem[]\n fieldMap?: Record<string, string> //枚举的翻译\n timeGroupInterval?: TimeGroupInterval // 时间汇总 xAxis 是time的时候有效\n showNill?: boolean\n}) => {\n const fieldData = fieldOptions?.find(item => item.value === field)\n let newVal = val\n if (fieldData?.type === 'enum' && fieldData?.enum && fieldData?.enum?.length > 0) {\n const label = fieldData?.enum?.find(enumItem => enumItem.value === val)?.label\n newVal = label ? fieldMap?.[label] || label : val\n }\n if (fieldData?.type === 'timestamp') {\n let format = 'YYYY-MM-DD'\n switch (timeGroupInterval) {\n case 'day':\n format = 'YYYY-MM-DD'\n newVal = val ? dayjs(val).format(format) : ''\n break\n case 'week':\n const startDate = val ? dayjs(val).startOf('week').format('YYYY-MM-DD') : ''\n const endDate = val ? dayjs(val).endOf('week').format('YYYY-MM-DD') : ''\n newVal = val ? `${startDate}~${endDate}` : ''\n break\n case 'month':\n format = 'YYYY-MM'\n newVal = val ? dayjs(val).format(format) : ''\n break\n case 'year':\n format = 'YYYY'\n newVal = val ? dayjs(val).format(format) : ''\n break\n default:\n format = 'YYYY-MM-DD'\n newVal = val ? dayjs(val).format(format) : ''\n break\n }\n }\n\n //这玩意好像还会是数组\n newVal = Array.isArray(newVal) ? newVal.join(',') : newVal\n\n // https://applink.larksuite.com/client/todo/detail?guid=b5c44575-b66c-4c77-85eb-514a42a18330&suite_entity_num=t106725\n if (showNill && isNil(newVal)) {\n newVal = `Null`\n }\n\n return newVal\n // return `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`\n}\n\nexport const findChangedItems = (newLayout: Layout[], oldLayout: Layout[]) => {\n return newLayout.filter(newItem => {\n const oldItem = oldLayout.find(item => item.i === newItem.i)\n return (\n oldItem &&\n (oldItem.x !== newItem.x ||\n oldItem.y !== newItem.y ||\n oldItem.w !== newItem.w ||\n oldItem.h !== newItem.h)\n )\n })\n}\n"],"names":[],"mappings":";;AAOO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,MAOM;;AACJ,QAAM,YAAY,6CAAc,KAAK,CAAQ,SAAA,KAAK,UAAU;AAC5D,MAAI,SAAS;AACT,OAAA,uCAAW,UAAS,WAAU,uCAAW,WAAQ,4CAAW,SAAX,mBAAiB,UAAS,GAAG;AAC1E,UAAA,SAAQ,kDAAW,SAAX,mBAAiB,KAAK,cAAY,SAAS,UAAU,SAArD,mBAA2D;AACzE,aAAS,SAAQ,qCAAW,WAAU,QAAQ;A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b){proc
|
|
|
160
160
|
`,"Illegal config:",f,`.
|
|
161
161
|
`)),nt(n));var y=h?eR(h):null;h&&!y&&(process.env.NODE_ENV!=="production"&&(n=Kr("Invalid parser name "+h+`.
|
|
162
162
|
`,"Illegal config:",f,`.
|
|
163
|
-
`)),nt(n)),a.push({dimIdx:m.index,parser:y,comparator:new rR(d,v)})});var o=e.sourceFormat;o!==yr&&o!==mn&&(process.env.NODE_ENV!=="production"&&(n='sourceFormat "'+o+'" is not supported yet'),nt(n));for(var s=[],l=0,u=e.count();l<u;l++)s.push(e.getRawDataItem(l));return s.sort(function(f,c){for(var d=0;d<a.length;d++){var h=a[d],v=e.retrieveValueFromItem(f,h.dimIdx),g=e.retrieveValueFromItem(c,h.dimIdx);h.parser&&(v=h.parser(v),g=h.parser(g));var p=h.comparator.evaluate(v,g);if(p!==0)return p}return 0}),{data:s}}};function tue(t){t.registerTransform(Jle),t.registerTransform(eue)}var rue=function(t){he(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dataset",r}return e.prototype.init=function(r,n,i){t.prototype.init.call(this,r,n,i),this._sourceManager=new HR(this),VR(this)},e.prototype.mergeOption=function(r,n){t.prototype.mergeOption.call(this,r,n),VR(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:Kn},e}(ot),nue=function(t){he(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dataset",r}return e.type="dataset",e}(yn);function iue(t){t.registerComponentModel(rue),t.registerComponentView(nue)}function aue(t){if(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].slice());return e}}function oue(t,e){var r=t.label,n=e&&e.getTextGuideLine();return{dataIndex:t.dataIndex,dataType:t.dataType,seriesIndex:t.seriesModel.seriesIndex,text:t.label.style.text,rect:t.hostRect,labelRect:t.rect,align:r.style.align,verticalAlign:r.style.verticalAlign,labelLinePoints:aue(n&&n.shape.points)}}var D8=["align","verticalAlign","width","height","fontSize"],zr=new hf,s_=dt(),sue=dt();function Sp(t,e,r){for(var n=0;n<r.length;n++){var i=r[n];e[i]!=null&&(t[i]=e[i])}}var Ep=["x","y","rotation"],lue=function(){function t(){this._labelList=[],this._chartViewList=[]}return t.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},t.prototype._addLabel=function(e,r,n,i,a){var o=i.style,s=i.__hostTarget,l=s.textConfig||{},u=i.getComputedTransform(),f=i.getBoundingRect().plain();ke.applyTransform(f,f,u),u?zr.setLocalTransform(u):(zr.x=zr.y=zr.rotation=zr.originX=zr.originY=0,zr.scaleX=zr.scaleY=1),zr.rotation=ta(zr.rotation);var c=i.__hostTarget,d;if(c){d=c.getBoundingRect().plain();var h=c.getComputedTransform();ke.applyTransform(d,d,h)}var v=d&&c.getTextGuideLine();this._labelList.push({label:i,labelLine:v,seriesModel:n,dataIndex:e,dataType:r,layoutOptionOrCb:a,layoutOption:null,rect:f,hostRect:d,priority:d?d.width*d.height:0,defaultAttr:{ignore:i.ignore,labelGuideIgnore:v&&v.ignore,x:zr.x,y:zr.y,scaleX:zr.scaleX,scaleY:zr.scaleY,rotation:zr.rotation,style:{x:o.x,y:o.y,align:o.align,verticalAlign:o.verticalAlign,width:o.width,height:o.height,fontSize:o.fontSize},cursor:i.cursor,attachedPos:l.position,attachedRot:l.rotation}})},t.prototype.addLabelsOfSeries=function(e){var r=this;this._chartViewList.push(e);var n=e.__model,i=n.get("labelLayout");(Pe(i)||rt(i).length)&&e.group.traverse(function(a){if(a.ignore)return!0;var o=a.getTextContent(),s=Xe(a);o&&!o.disableLabelLayout&&r._addLabel(s.dataIndex,s.dataType,n,o,i)})},t.prototype.updateLayoutConfig=function(e){var r=e.getWidth(),n=e.getHeight();function i(b,C){return function(){VP(b,C)}}for(var a=0;a<this._labelList.length;a++){var o=this._labelList[a],s=o.label,l=s.__hostTarget,u=o.defaultAttr,f=void 0;Pe(o.layoutOptionOrCb)?f=o.layoutOptionOrCb(oue(o,l)):f=o.layoutOptionOrCb,f=f||{},o.layoutOption=f;var c=Math.PI/180;l&&l.setTextConfig({local:!1,position:f.x!=null||f.y!=null?null:u.attachedPos,rotation:f.rotate!=null?f.rotate*c:u.attachedRot,offset:[f.dx||0,f.dy||0]});var d=!1;if(f.x!=null?(s.x=Dt(f.x,r),s.setStyle("x",0),d=!0):(s.x=u.x,s.setStyle("x",u.style.x)),f.y!=null?(s.y=Dt(f.y,n),s.setStyle("y",0),d=!0):(s.y=u.y,s.setStyle("y",u.style.y)),f.labelLinePoints){var h=l.getTextGuideLine();h&&(h.setShape({points:f.labelLinePoints}),d=!1)}var v=s_(s);v.needsUpdateLabelLine=d,s.rotation=f.rotate!=null?f.rotate*c:u.rotation,s.scaleX=u.scaleX,s.scaleY=u.scaleY;for(var g=0;g<D8.length;g++){var p=D8[g];s.setStyle(p,f[p]!=null?f[p]:u.style[p])}if(f.draggable){if(s.draggable=!0,s.cursor="move",l){var m=o.seriesModel;if(o.dataIndex!=null){var y=o.seriesModel.getData(o.dataType);m=y.getItemModel(o.dataIndex)}s.on("drag",i(l,m.getModel("labelLine")))}}else s.off("drag"),s.cursor=u.cursor}},t.prototype.layout=function(e){var r=e.getWidth(),n=e.getHeight(),i=[];z(this._labelList,function(l){l.defaultAttr.ignore||i.push(I1({},l))});var a=Bt(i,function(l){return l.layoutOption.moveOverlap==="shiftX"}),o=Bt(i,function(l){return l.layoutOption.moveOverlap==="shiftY"});N1(a,0,0,r),N1(o,1,0,n);var s=Bt(i,function(l){return l.layoutOption.hideOverlap});cne(s),KP(s)},t.prototype.processLabelsOverall=function(){var e=this;z(this._chartViewList,function(r){var n=r.__model,i=r.ignoreLabelLineUpdate,a=n.isAnimationEnabled();r.group.traverse(function(o){if(o.ignore&&!o.forceLabelAnimation)return!0;var s=!i,l=o.getTextContent();!s&&l&&(s=s_(l).needsUpdateLabelLine),s&&e._updateLabelLine(o,n),a&&e._animateLabels(o,n)})})},t.prototype._updateLabelLine=function(e,r){var n=e.getTextContent(),i=Xe(e),a=i.dataIndex;if(n&&a!=null){var o=r.getData(i.dataType),s=o.getItemModel(a),l={},u=o.getItemVisual(a,"style");if(u){var f=o.getVisual("drawType");l.stroke=u[f]}var c=s.getModel("labelLine");$P(e,GP(s),l),VP(e,c)}},t.prototype._animateLabels=function(e,r){var n=e.getTextContent(),i=e.getTextGuideLine();if(n&&(e.forceLabelAnimation||!n.ignore&&!n.invisible&&!e.disableLabelAnimation&&!Ll(e))){var a=s_(n),o=a.oldLayout,s=Xe(e),l=s.dataIndex,u={x:n.x,y:n.y,rotation:n.rotation},f=r.getData(s.dataType);if(o){n.attr(o);var d=e.prevStates;d&&(Ke(d,"select")>=0&&n.attr(a.oldLayoutSelect),Ke(d,"emphasis")>=0&&n.attr(a.oldLayoutEmphasis)),sr(n,u,r,l)}else if(n.attr(u),!kl(n).valueAnimation){var c=Ae(n.style.opacity,1);n.style.opacity=0,Or(n,{style:{opacity:c}},r,l)}if(a.oldLayout=u,n.states.select){var h=a.oldLayoutSelect={};Sp(h,u,Ep),Sp(h,n.states.select,Ep)}if(n.states.emphasis){var v=a.oldLayoutEmphasis={};Sp(v,u,Ep),Sp(v,n.states.emphasis,Ep)}LJ(n,l,f,r,r)}if(i&&!i.ignore&&!i.invisible){var a=sue(i),o=a.oldLayout,g={points:i.shape.points};o?(i.attr({shape:o}),sr(i,{shape:g},r)):(i.setShape(g),i.style.strokePercent=0,Or(i,{style:{strokePercent:1}},r)),a.oldLayout=g}},t}(),l_=dt();function uue(t){t.registerUpdateLifecycle("series:beforeupdate",function(e,r,n){var i=l_(r).labelManager;i||(i=l_(r).labelManager=new lue),i.clearLabels()}),t.registerUpdateLifecycle("series:layoutlabels",function(e,r,n){var i=l_(r).labelManager;n.updatedSeries.forEach(function(a){i.addLabelsOfSeries(r.getViewOfSeriesModel(a))}),i.updateLayoutConfig(r),i.layout(r),i.processLabelsOverall()})}var Li=ea.CMD;function su(t,e){return Math.abs(t-e)<1e-5}function u_(t){var e=t.data,r=t.len(),n=[],i,a=0,o=0,s=0,l=0;function u(O,P){i&&i.length>2&&n.push(i),i=[O,P]}function f(O,P,N,k){su(O,N)&&su(P,k)||i.push(O,P,N,k,N,k)}function c(O,P,N,k,F,j){var W=Math.abs(P-O),B=Math.tan(W/4)*4/3,H=P<O?-1:1,Y=Math.cos(O),q=Math.sin(O),te=Math.cos(P),ee=Math.sin(P),V=Y*F+N,J=q*j+k,L=te*F+N,$=ee*j+k,Q=F*B*H,Z=j*B*H;i.push(V-Q*q,J+Z*Y,L+Q*ee,$-Z*te,L,$)}for(var d,h,v,g,p=0;p<r;){var m=e[p++],y=p===1;switch(y&&(a=e[p],o=e[p+1],s=a,l=o,(m===Li.L||m===Li.C||m===Li.Q)&&(i=[s,l])),m){case Li.M:a=s=e[p++],o=l=e[p++],u(s,l);break;case Li.L:d=e[p++],h=e[p++],f(a,o,d,h),a=d,o=h;break;case Li.C:i.push(e[p++],e[p++],e[p++],e[p++],a=e[p++],o=e[p++]);break;case Li.Q:d=e[p++],h=e[p++],v=e[p++],g=e[p++],i.push(a+2/3*(d-a),o+2/3*(h-o),v+2/3*(d-v),g+2/3*(h-g),v,g),a=v,o=g;break;case Li.A:var b=e[p++],C=e[p++],_=e[p++],w=e[p++],x=e[p++],S=e[p++]+x;p+=1;var E=!e[p++];d=Math.cos(x)*_+b,h=Math.sin(x)*w+C,y?(s=d,l=h,u(s,l)):f(a,o,d,h),a=Math.cos(S)*_+b,o=Math.sin(S)*w+C;for(var T=(E?-1:1)*Math.PI/2,A=x;E?A>S:A<S;A+=T){var M=E?Math.max(A+T,S):Math.min(A+T,S);c(A,M,b,C,_,w)}break;case Li.R:s=a=e[p++],l=o=e[p++],d=s+e[p++],h=l+e[p++],u(d,l),f(d,l,d,h),f(d,h,s,h),f(s,h,s,l),f(s,l,d,l);break;case Li.Z:i&&f(a,o,s,l),a=s,o=l;break}}return i&&i.length>2&&n.push(i),n}function f_(t,e,r,n,i,a,o,s,l,u){if(su(t,r)&&su(e,n)&&su(i,o)&&su(a,s)){l.push(o,s);return}var f=2/u,c=f*f,d=o-t,h=s-e,v=Math.sqrt(d*d+h*h);d/=v,h/=v;var g=r-t,p=n-e,m=i-o,y=a-s,b=g*g+p*p,C=m*m+y*y;if(b<c&&C<c){l.push(o,s);return}var _=d*g+h*p,w=-d*m-h*y,x=b-_*_,S=C-w*w;if(x<c&&_>=0&&S<c&&w>=0){l.push(o,s);return}var E=[],T=[];Na(t,r,i,o,.5,E),Na(e,n,a,s,.5,T),f_(E[0],T[0],E[1],T[1],E[2],T[2],E[3],T[3],l,u),f_(E[4],T[4],E[5],T[5],E[6],T[6],E[7],T[7],l,u)}function fue(t,e){var r=u_(t),n=[];e=e||1;for(var i=0;i<r.length;i++){var a=r[i],o=[],s=a[0],l=a[1];o.push(s,l);for(var u=2;u<a.length;){var f=a[u++],c=a[u++],d=a[u++],h=a[u++],v=a[u++],g=a[u++];f_(s,l,f,c,d,h,v,g,o,e),s=v,l=g}n.push(o)}return n}function S8(t,e,r){var n=t[e],i=t[1-e],a=Math.abs(n/i),o=Math.ceil(Math.sqrt(a*r)),s=Math.floor(r/o);s===0&&(s=1,o=r);for(var l=[],u=0;u<o;u++)l.push(s);var f=o*s,c=r-f;if(c>0)for(var u=0;u<c;u++)l[u%o]+=1;return l}function E8(t,e,r){for(var n=t.r0,i=t.r,a=t.startAngle,o=t.endAngle,s=Math.abs(o-a),l=s*i,u=i-n,f=l>Math.abs(u),c=S8([l,u],f?0:1,e),d=(f?s:u)/c.length,h=0;h<c.length;h++)for(var v=(f?u:s)/c[h],g=0;g<c[h];g++){var p={};f?(p.startAngle=a+d*h,p.endAngle=a+d*(h+1),p.r0=n+v*g,p.r=n+v*(g+1)):(p.startAngle=a+v*g,p.endAngle=a+v*(g+1),p.r0=n+d*h,p.r=n+d*(h+1)),p.clockwise=t.clockwise,p.cx=t.cx,p.cy=t.cy,r.push(p)}}function cue(t,e,r){for(var n=t.width,i=t.height,a=n>i,o=S8([n,i],a?0:1,e),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",f=a?"y":"x",c=t[s]/o.length,d=0;d<o.length;d++)for(var h=t[l]/o[d],v=0;v<o[d];v++){var g={};g[u]=d*c,g[f]=v*h,g[s]=c,g[l]=h,g.x+=t.x,g.y+=t.y,r.push(g)}}function A8(t,e,r,n){return t*n-r*e}function due(t,e,r,n,i,a,o,s){var l=r-t,u=n-e,f=o-i,c=s-a,d=A8(f,c,l,u);if(Math.abs(d)<1e-6)return null;var h=t-i,v=e-a,g=A8(h,v,f,c)/d;return g<0||g>1?null:new Re(g*l+t,g*u+e)}function hue(t,e,r){var n=new Re;Re.sub(n,r,e),n.normalize();var i=new Re;Re.sub(i,t,e);var a=i.dot(n);return a}function lu(t,e){var r=t[t.length-1];r&&r[0]===e[0]&&r[1]===e[1]||t.push(e)}function vue(t,e,r){for(var n=t.length,i=[],a=0;a<n;a++){var o=t[a],s=t[(a+1)%n],l=due(o[0],o[1],s[0],s[1],e.x,e.y,r.x,r.y);l&&i.push({projPt:hue(l,e,r),pt:l,idx:a})}if(i.length<2)return[{points:t},{points:t}];i.sort(function(p,m){return p.projPt-m.projPt});var u=i[0],f=i[i.length-1];if(f.idx<u.idx){var c=u;u=f,f=c}for(var d=[u.pt.x,u.pt.y],h=[f.pt.x,f.pt.y],v=[d],g=[h],a=u.idx+1;a<=f.idx;a++)lu(v,t[a].slice());lu(v,h),lu(v,d);for(var a=f.idx+1;a<=u.idx+n;a++)lu(g,t[a%n].slice());return lu(g,d),lu(g,h),[{points:v},{points:g}]}function T8(t){var e=t.points,r=[],n=[];K2(e,r,n);var i=new ke(r[0],r[1],n[0]-r[0],n[1]-r[1]),a=i.width,o=i.height,s=i.x,l=i.y,u=new Re,f=new Re;return a>o?(u.x=f.x=s+a/2,u.y=l,f.y=l+o):(u.y=f.y=l+o/2,u.x=s,f.x=s+a),vue(e,u,f)}function Ap(t,e,r,n){if(r===1)n.push(e);else{var i=Math.floor(r/2),a=t(e);Ap(t,a[0],i,n),Ap(t,a[1],r-i,n)}return n}function pue(t,e){for(var r=[],n=0;n<e;n++)r.push(hb(t));return r}function gue(t,e){e.setStyle(t.style),e.z=t.z,e.z2=t.z2,e.zlevel=t.zlevel}function mue(t){for(var e=[],r=0;r<t.length;)e.push([t[r++],t[r++]]);return e}function yue(t,e){var r=[],n=t.shape,i;switch(t.type){case"rect":cue(n,e,r),i=jt;break;case"sector":E8(n,e,r),i=Pi;break;case"circle":E8({r0:0,r:n.r,startAngle:0,endAngle:Math.PI*2,cx:n.cx,cy:n.cy},e,r),i=Pi;break;default:var a=t.getComputedTransform(),o=a?Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1],a[2]*a[2]+a[3]*a[3])):1,s=Ce(fue(t.getUpdatedPathProxy(),o),function(m){return mue(m)}),l=s.length;if(l===0)Ap(T8,{points:s[0]},e,r);else if(l===e)for(var u=0;u<l;u++)r.push({points:s[u]});else{var f=0,c=Ce(s,function(m){var y=[],b=[];K2(m,y,b);var C=(b[1]-y[1])*(b[0]-y[0]);return f+=C,{poly:m,area:C}});c.sort(function(m,y){return y.area-m.area});for(var d=e,u=0;u<l;u++){var h=c[u];if(d<=0)break;var v=u===l-1?d:Math.ceil(h.area/f*e);v<0||(Ap(T8,{points:h.poly},v,r),d-=v)}}i=rv;break}if(!i)return pue(t,e);for(var g=[],u=0;u<r.length;u++){var p=new i;p.setShape(r[u]),gue(t,p),g.push(p)}return g}function bue(t,e){var r=t.length,n=e.length;if(r===n)return[t,e];for(var i=[],a=[],o=r<n?t:e,s=Math.min(r,n),l=Math.abs(n-r)/6,u=(s-2)/6,f=Math.ceil(l/u)+1,c=[o[0],o[1]],d=l,h=2;h<s;){var v=o[h-2],g=o[h-1],p=o[h++],m=o[h++],y=o[h++],b=o[h++],C=o[h++],_=o[h++];if(d<=0){c.push(p,m,y,b,C,_);continue}for(var w=Math.min(d,f-1)+1,x=1;x<=w;x++){var S=x/w;Na(v,p,y,C,S,i),Na(g,m,b,_,S,a),v=i[3],g=a[3],c.push(i[1],a[1],i[2],a[2],v,g),p=i[5],m=a[5],y=i[6],b=a[6]}d-=w-1}return o===t?[c,e]:[t,c]}function O8(t,e){for(var r=t.length,n=t[r-2],i=t[r-1],a=[],o=0;o<e.length;)a[o++]=n,a[o++]=i;return a}function Cue(t,e){for(var r,n,i,a=[],o=[],s=0;s<Math.max(t.length,e.length);s++){var l=t[s],u=e[s],f=void 0,c=void 0;l?u?(r=bue(l,u),f=r[0],c=r[1],n=f,i=c):(c=O8(i||l,l),f=l):(f=O8(n||u,u),c=u),a.push(f),o.push(c)}return[a,o]}function M8(t){for(var e=0,r=0,n=0,i=t.length,a=0,o=i-2;a<i;o=a,a+=2){var s=t[o],l=t[o+1],u=t[a],f=t[a+1],c=s*f-u*l;e+=c,r+=(s+u)*c,n+=(l+f)*c}return e===0?[t[0]||0,t[1]||0]:[r/e/3,n/e/3,e]}function _ue(t,e,r,n){for(var i=(t.length-2)/6,a=1/0,o=0,s=t.length,l=s-2,u=0;u<i;u++){for(var f=u*6,c=0,d=0;d<s;d+=2){var h=d===0?f:(f+d-2)%l+2,v=t[h]-r[0],g=t[h+1]-r[1],p=e[d]-n[0],m=e[d+1]-n[1],y=p-v,b=m-g;c+=y*y+b*b}c<a&&(a=c,o=u)}return o}function wue(t){for(var e=[],r=t.length,n=0;n<r;n+=2)e[n]=t[r-n-2],e[n+1]=t[r-n-1];return e}function xue(t,e,r,n){for(var i=[],a,o=0;o<t.length;o++){var s=t[o],l=e[o],u=M8(s),f=M8(l);a==null&&(a=u[2]<0!=f[2]<0);var c=[],d=[],h=0,v=1/0,g=[],p=s.length;a&&(s=wue(s));for(var m=_ue(s,l,u,f)*6,y=p-2,b=0;b<y;b+=2){var C=(m+b)%y+2;c[b+2]=s[C]-u[0],c[b+3]=s[C+1]-u[1]}c[0]=s[m]-u[0],c[1]=s[m+1]-u[1];for(var _=n/r,w=-n/2;w<=n/2;w+=_){for(var x=Math.sin(w),S=Math.cos(w),E=0,b=0;b<s.length;b+=2){var T=c[b],A=c[b+1],M=l[b]-f[0],O=l[b+1]-f[1],P=M*S-O*x,N=M*x+O*S;g[b]=P,g[b+1]=N;var k=P-T,F=N-A;E+=k*k+F*F}if(E<v){v=E,h=w;for(var j=0;j<g.length;j++)d[j]=g[j]}}i.push({from:c,to:d,fromCp:u,toCp:f,rotation:-h})}return i}function Tp(t){return t.__isCombineMorphing}var R8="__mOriginal_";function Op(t,e,r){var n=R8+e,i=t[n]||t[e];t[n]||(t[n]=t[e]);var a=r.replace,o=r.after,s=r.before;t[e]=function(){var l=arguments,u;return s&&s.apply(this,l),a?u=a.apply(this,l):u=i.apply(this,l),o&&o.apply(this,l),u}}function _c(t,e){var r=R8+e;t[r]&&(t[e]=t[r],t[r]=null)}function P8(t,e){for(var r=0;r<t.length;r++)for(var n=t[r],i=0;i<n.length;){var a=n[i],o=n[i+1];n[i++]=e[0]*a+e[2]*o+e[4],n[i++]=e[1]*a+e[3]*o+e[5]}}function B8(t,e){var r=t.getUpdatedPathProxy(),n=e.getUpdatedPathProxy(),i=Cue(u_(r),u_(n)),a=i[0],o=i[1],s=t.getComputedTransform(),l=e.getComputedTransform();function u(){this.transform=null}s&&P8(a,s),l&&P8(o,l),Op(e,"updateTransform",{replace:u}),e.transform=null;var f=xue(a,o,10,Math.PI),c=[];Op(e,"buildPath",{replace:function(d){for(var h=e.__morphT,v=1-h,g=[],p=0;p<f.length;p++){var m=f[p],y=m.from,b=m.to,C=m.rotation*h,_=m.fromCp,w=m.toCp,x=Math.sin(C),S=Math.cos(C);mh(g,_,w,h);for(var E=0;E<y.length;E+=2){var T=y[E],A=y[E+1],M=b[E],O=b[E+1],P=T*v+M*h,N=A*v+O*h;c[E]=P*S-N*x+g[0],c[E+1]=P*x+N*S+g[1]}var k=c[0],F=c[1];d.moveTo(k,F);for(var E=2;E<y.length;){var M=c[E++],O=c[E++],j=c[E++],W=c[E++],B=c[E++],H=c[E++];k===M&&F===O&&j===B&&W===H?d.lineTo(B,H):d.bezierCurveTo(M,O,j,W,B,H),k=B,F=H}}}})}function c_(t,e,r){if(!t||!e)return e;var n=r.done,i=r.during;B8(t,e),e.__morphT=0;function a(){_c(e,"buildPath"),_c(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Ze({during:function(o){e.dirtyShape(),i&&i(o)},done:function(){a(),n&&n()}},r)),e}function Due(t,e,r,n,i,a){var o=16;t=i===r?0:Math.round(32767*(t-r)/(i-r)),e=a===n?0:Math.round(32767*(e-n)/(a-n));for(var s=0,l,u=(1<<o)/2;u>0;u/=2){var f=0,c=0;(t&u)>0&&(f=1),(e&u)>0&&(c=1),s+=u*u*(3*f^c),c===0&&(f===1&&(t=u-1-t,e=u-1-e),l=t,t=e,e=l)}return s}function Mp(t){var e=1/0,r=1/0,n=-1/0,i=-1/0,a=Ce(t,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),f=l.x+l.width/2+(u?u[4]:0),c=l.y+l.height/2+(u?u[5]:0);return e=Math.min(f,e),r=Math.min(c,r),n=Math.max(f,n),i=Math.max(c,i),[f,c]}),o=Ce(a,function(s,l){return{cp:s,z:Due(s[0],s[1],e,r,n,i),path:t[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function I8(t){return yue(t.path,t.count)}function d_(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Sue(t,e,r){var n=[];function i(_){for(var w=0;w<_.length;w++){var x=_[w];Tp(x)?i(x.childrenRef()):x instanceof Qe&&n.push(x)}}i(t);var a=n.length;if(!a)return d_();var o=r.dividePath||I8,s=o({path:e,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),d_();n=Mp(n),s=Mp(s);for(var l=r.done,u=r.during,f=r.individualDelay,c=new hf,d=0;d<a;d++){var h=n[d],v=s[d];v.parent=e,v.copyTransform(c),f||B8(h,v)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function g(_){for(var w=0;w<s.length;w++)s[w].addSelfToZr(_)}Op(e,"addSelfToZr",{after:function(_){g(_)}}),Op(e,"removeSelfFromZr",{after:function(_){for(var w=0;w<s.length;w++)s[w].removeSelfFromZr(_)}});function p(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,_c(e,"addSelfToZr"),_c(e,"removeSelfFromZr")}var m=s.length;if(f)for(var y=m,b=function(){y--,y===0&&(p(),l&&l())},d=0;d<m;d++){var C=f?Ze({delay:(r.delay||0)+f(d,m,n[d],s[d]),done:b},r):r;c_(n[d],s[d],C)}else e.__morphT=0,e.animateTo({__morphT:1},Ze({during:function(_){for(var w=0;w<m;w++){var x=s[w];x.__morphT=e.__morphT,x.dirtyShape()}u&&u(_)},done:function(){p();for(var _=0;_<t.length;_++)_c(t[_],"updateTransform");l&&l()}},r));return e.__zr&&g(e.__zr),{fromIndividuals:n,toIndividuals:s,count:m}}function Eue(t,e,r){var n=e.length,i=[],a=r.dividePath||I8;function o(h){for(var v=0;v<h.length;v++){var g=h[v];Tp(g)?o(g.childrenRef()):g instanceof Qe&&i.push(g)}}if(Tp(t)){o(t.childrenRef());var s=i.length;if(s<n)for(var l=0,u=s;u<n;u++)i.push(hb(i[l++%s]));i.length=n}else{i=a({path:t,count:n});for(var f=t.getComputedTransform(),u=0;u<i.length;u++)i[u].setLocalTransform(f);if(i.length!==n)return console.error("Invalid morphing: unmatched splitted path"),d_()}i=Mp(i),e=Mp(e);for(var c=r.individualDelay,u=0;u<n;u++){var d=c?Ze({delay:(r.delay||0)+c(u,n,i[u],e[u])},r):r;c_(i[u],e[u],d)}return{fromIndividuals:i,toIndividuals:e,count:e.length}}function N8(t){return ve(t[0])}function L8(t,e){for(var r=[],n=t.length,i=0;i<n;i++)r.push({one:t[i],many:[]});for(var i=0;i<e.length;i++){var a=e[i].length,o=void 0;for(o=0;o<a;o++)r[o%n].many.push(e[i][o])}for(var s=0,i=n-1;i>=0;i--)if(!r[i].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var a=l.length,u=Math.ceil(a/2);r[i].many=l.slice(u,a),r[s].many=l.slice(0,u),s++}return r}var Aue={clone:function(t){for(var e=[],r=1-Math.pow(1-t.path.style.opacity,1/t.count),n=0;n<t.count;n++){var i=hb(t.path);i.setStyle("opacity",r),e.push(i)}return e},split:null};function h_(t,e,r,n,i,a){if(!t.length||!e.length)return;var o=Nl("update",n,i);if(!(o&&o.duration>0))return;var s=n.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,f;N8(t)&&(u=t,f=e),N8(e)&&(u=e,f=t);function c(m,y,b,C,_){var w=m.many,x=m.one;if(w.length===1&&!_){var S=y?w[0]:x,E=y?x:w[0];if(Tp(S))c({many:[S],one:E},!0,b,C,!0);else{var T=s?Ze({delay:s(b,C)},l):l;c_(S,E,T),a(S,E,S,E,T)}}else for(var A=Ze({dividePath:Aue[r],individualDelay:s&&function(F,j,W,B){return s(F+b,C)}},l),M=y?Sue(w,x,A):Eue(x,w,A),O=M.fromIndividuals,P=M.toIndividuals,N=O.length,k=0;k<N;k++){var T=s?Ze({delay:s(k,N)},l):l;a(O[k],P[k],y?w[k]:m.one,y?m.one:w[k],T)}}for(var d=u?u===t:t.length>e.length,h=u?L8(f,u):L8(d?e:t,[d?t:e]),v=0,g=0;g<h.length;g++)v+=h[g].many.length;for(var p=0,g=0;g<h.length;g++)c(h[g],d,p,v),p+=h[g].many.length}function Os(t){if(!t)return[];if(ve(t)){for(var e=[],r=0;r<t.length;r++)e.push(Os(t[r]));return e}var n=[];return t.traverse(function(i){i instanceof Qe&&!i.disableMorphing&&!i.invisible&&!i.ignore&&n.push(i)}),n}var F8=1e4,Tue=0,k8=1,j8=2,Oue=dt();function Mue(t,e){for(var r=t.dimensions,n=0;n<r.length;n++){var i=t.getDimensionInfo(r[n]);if(i&&i.otherDims[e]===0)return r[n]}}function Rue(t,e,r){var n=t.getDimensionInfo(r),i=n&&n.ordinalMeta;if(n){var a=t.get(n.name,e);return i&&i.categories[a]||a+""}}function z8(t,e,r,n){var i=n?"itemChildGroupId":"itemGroupId",a=Mue(t,i);if(a){var o=Rue(t,e,a);return o}var s=t.getRawDataItem(e),l=n?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!n)return r||t.getId(e)}function H8(t){var e=[];return z(t,function(r){var n=r.data,i=r.dataGroupId;if(n.count()>F8){process.env.NODE_ENV!=="production"&&Qt("Universal transition is disabled on large data > 10k.");return}for(var a=n.getIndices(),o=0;o<a.length;o++)e.push({data:n,groupId:z8(n,o,i,!1),childGroupId:z8(n,o,i,!0),divide:r.divide,dataIndex:o})}),e}function v_(t,e,r){t.traverse(function(n){n instanceof Qe&&Or(n,{style:{opacity:0}},e,{dataIndex:r,isFrom:!0})})}function p_(t){if(t.parent){var e=t.getComputedTransform();t.setLocalTransform(e),t.parent.remove(t)}}function uu(t){t.stopAnimation(),t.isGroup&&t.traverse(function(e){e.stopAnimation()})}function Pue(t,e,r){var n=Nl("update",r,e);n&&t.traverse(function(i){if(i instanceof Fa){var a=gJ(i);a&&i.animateFrom({style:a},n)}})}function Bue(t,e){var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++){var i=t[n],a=e[n];if(i.data.getId(i.dataIndex)!==a.data.getId(a.dataIndex))return!1}return!0}function V8(t,e,r){var n=H8(t),i=H8(e);function a(b,C,_,w,x){(_||b)&&C.animateFrom({style:_&&_!==b?ue(ue({},_.style),b.style):b.style},x)}var o=!1,s=Tue,l=Be(),u=Be();n.forEach(function(b){b.groupId&&l.set(b.groupId,!0),b.childGroupId&&u.set(b.childGroupId,!0)});for(var f=0;f<i.length;f++){var c=i[f].groupId;if(u.get(c)){s=k8;break}var d=i[f].childGroupId;if(d&&l.get(d)){s=j8;break}}function h(b,C){return function(_){var w=_.data,x=_.dataIndex;return C?w.getId(x):b?s===k8?_.childGroupId:_.groupId:s===j8?_.childGroupId:_.groupId}}var v=Bue(n,i),g={};if(!v)for(var f=0;f<i.length;f++){var p=i[f],m=p.data.getItemGraphicEl(p.dataIndex);m&&(g[m.id]=!0)}function y(b,C){var _=n[C],w=i[b],x=w.data.hostModel,S=_.data.getItemGraphicEl(_.dataIndex),E=w.data.getItemGraphicEl(w.dataIndex);if(S===E){E&&Pue(E,w.dataIndex,x);return}S&&g[S.id]||E&&(uu(E),S?(uu(S),p_(S),o=!0,h_(Os(S),Os(E),w.divide,x,b,a)):v_(E,x,b))}new Pb(n,i,h(!0,v),h(!1,v),null,"multiple").update(y).updateManyToOne(function(b,C){var _=i[b],w=_.data,x=w.hostModel,S=w.getItemGraphicEl(_.dataIndex),E=Bt(Ce(C,function(T){return n[T].data.getItemGraphicEl(n[T].dataIndex)}),function(T){return T&&T!==S&&!g[T.id]});S&&(uu(S),E.length?(z(E,function(T){uu(T),p_(T)}),o=!0,h_(Os(E),Os(S),_.divide,x,b,a)):v_(S,x,_.dataIndex))}).updateOneToMany(function(b,C){var _=n[C],w=_.data.getItemGraphicEl(_.dataIndex);if(!(w&&g[w.id])){var x=Bt(Ce(b,function(E){return i[E].data.getItemGraphicEl(i[E].dataIndex)}),function(E){return E&&E!==w}),S=i[b[0]].data.hostModel;x.length&&(z(x,function(E){return uu(E)}),w?(uu(w),p_(w),o=!0,h_(Os(w),Os(x),_.divide,S,b[0],a)):z(x,function(E){return v_(E,S,b[0])}))}}).updateManyToMany(function(b,C){new Pb(C,b,function(_){return n[_].data.getId(n[_].dataIndex)},function(_){return i[_].data.getId(i[_].dataIndex)}).update(function(_,w){y(b[_],C[w])}).execute()}).execute(),o&&z(e,function(b){var C=b.data,_=C.hostModel,w=_&&r.getViewOfSeriesModel(_),x=Nl("update",_,0);w&&_.isAnimationEnabled()&&x&&x.duration>0&&w.group.traverse(function(S){S instanceof Qe&&!S.animators.length&&S.animateFrom({style:{opacity:0}},x)})})}function W8(t){var e=t.getModel("universalTransition").get("seriesKey");return e||t.id}function $8(t){return ve(t)?t.sort().join(","):t}function io(t){if(t.hostModel)return t.hostModel.getModel("universalTransition").get("divideShape")}function Iue(t,e){var r=Be(),n=Be(),i=Be();z(t.oldSeries,function(o,s){var l=t.oldDataGroupIds[s],u=t.oldData[s],f=W8(o),c=$8(f);n.set(c,{dataGroupId:l,data:u}),ve(f)&&z(f,function(d){i.set(d,{key:c,dataGroupId:l,data:u})})});function a(o){r.get(o)&&Qt("Duplicated seriesKey in universalTransition "+o)}return z(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),u=W8(o),f=$8(u),c=n.get(f);if(c)process.env.NODE_ENV!=="production"&&a(f),r.set(f,{oldSeries:[{dataGroupId:c.dataGroupId,divide:io(c.data),data:c.data}],newSeries:[{dataGroupId:s,divide:io(l),data:l}]});else if(ve(u)){process.env.NODE_ENV!=="production"&&a(f);var d=[];z(u,function(g){var p=n.get(g);p.data&&d.push({dataGroupId:p.dataGroupId,divide:io(p.data),data:p.data})}),d.length&&r.set(f,{oldSeries:d,newSeries:[{dataGroupId:s,data:l,divide:io(l)}]})}else{var h=i.get(u);if(h){var v=r.get(h.key);v||(v={oldSeries:[{dataGroupId:h.dataGroupId,data:h.data,divide:io(h.data)}],newSeries:[]},r.set(h.key,v)),v.newSeries.push({dataGroupId:s,data:l,divide:io(l)})}}}}),r}function G8(t,e){for(var r=0;r<t.length;r++){var n=e.seriesIndex!=null&&e.seriesIndex===t[r].seriesIndex||e.seriesId!=null&&e.seriesId===t[r].id;if(n)return r}}function Nue(t,e,r,n){var i=[],a=[];z(It(t.from),function(o){var s=G8(e.oldSeries,o);s>=0&&i.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:io(e.oldData[s]),groupIdDim:o.dimension})}),z(It(t.to),function(o){var s=G8(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:io(l),groupIdDim:o.dimension})}}),i.length>0&&a.length>0&&V8(i,a,n)}function Lue(t){t.registerUpdateLifecycle("series:beforeupdate",function(e,r,n){z(It(n.seriesTransition),function(i){z(It(i.to),function(a){for(var o=n.updatedSeries,s=0;s<o.length;s++)(a.seriesIndex!=null&&a.seriesIndex===o[s].seriesIndex||a.seriesId!=null&&a.seriesId===o[s].id)&&(o[s][Iv]=!0)})})}),t.registerUpdateLifecycle("series:transition",function(e,r,n){var i=Oue(r);if(i.oldSeries&&n.updatedSeries&&n.optionChanged){var a=n.seriesTransition;if(a)z(It(a),function(h){Nue(h,i,n,r)});else{var o=Iue(i,n);z(o.keys(),function(h){var v=o.get(h);V8(v.oldSeries,v.newSeries,r)})}z(n.updatedSeries,function(h){h[Iv]&&(h[Iv]=!1)})}for(var s=e.getSeries(),l=i.oldSeries=[],u=i.oldDataGroupIds=[],f=i.oldData=[],c=0;c<s.length;c++){var d=s[c].getData();d.count()<F8&&(l.push(s[c]),u.push(s[c].get("dataGroupId")),f.push(d))}})}function U8(t,e,r){var n=qi.createCanvas(),i=e.getWidth(),a=e.getHeight(),o=n.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=i+"px",o.height=a+"px",n.setAttribute("data-zr-dom-id",t)),n.width=i*r,n.height=a*r,n}var g_=function(t){he(e,t);function e(r,n,i){var a=t.call(this)||this;a.motionBlur=!1,a.lastFrameAlpha=.7,a.dpr=1,a.virtual=!1,a.config={},a.incremental=!1,a.zlevel=0,a.maxRepaintRectCount=5,a.__dirty=!0,a.__firstTimePaint=!0,a.__used=!1,a.__drawIndex=0,a.__startIndex=0,a.__endIndex=0,a.__prevStartIndex=null,a.__prevEndIndex=null;var o;i=i||Rh,typeof r=="string"?o=U8(r,n,i):Se(r)&&(o=r,r=o.id),a.id=r,a.dom=o;var s=o.style;return s&&(i2(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),a.painter=n,a.dpr=i,a}return e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var r=this.dpr;this.domBack=U8("back-"+this.id,this.painter,r),this.ctxBack=this.domBack.getContext("2d"),r!==1&&this.ctxBack.scale(r,r)},e.prototype.createRepaintRects=function(r,n,i,a){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,u=new ke(0,0,0,0);function f(y){if(!(!y.isFinite()||y.isZero()))if(o.length===0){var b=new ke(0,0,0,0);b.copy(y),o.push(b)}else{for(var C=!1,_=1/0,w=0,x=0;x<o.length;++x){var S=o[x];if(S.intersect(y)){var E=new ke(0,0,0,0);E.copy(S),E.union(y),o[x]=E,C=!0;break}else if(l){u.copy(y),u.union(S);var T=y.width*y.height,A=S.width*S.height,M=u.width*u.height,O=M-T-A;O<_&&(_=O,w=x)}}if(l&&(o[w].union(y),C=!0),!C){var b=new ke(0,0,0,0);b.copy(y),o.push(b)}l||(l=o.length>=s)}}for(var c=this.__startIndex;c<this.__endIndex;++c){var d=r[c];if(d){var h=d.shouldBePainted(i,a,!0,!0),v=d.__isRendered&&(d.__dirty&vn||!h)?d.getPrevPaintRect():null;v&&f(v);var g=h&&(d.__dirty&vn||!d.__isRendered)?d.getPaintRect():null;g&&f(g)}}for(var c=this.__prevStartIndex;c<this.__prevEndIndex;++c){var d=n[c],h=d&&d.shouldBePainted(i,a,!0,!0);if(d&&(!h||!d.__zr)&&d.__isRendered){var v=d.getPrevPaintRect();v&&f(v)}}var p;do{p=!1;for(var c=0;c<o.length;){if(o[c].isZero()){o.splice(c,1);continue}for(var m=c+1;m<o.length;)o[c].intersect(o[m])?(p=!0,o[c].union(o[m]),o.splice(m,1)):m++;c++}}while(p);return this._paintRects=o,o},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(r,n){var i=this.dpr,a=this.dom,o=a.style,s=this.domBack;o&&(o.width=r+"px",o.height=n+"px"),a.width=r*i,a.height=n*i,s&&(s.width=r*i,s.height=n*i,i!==1&&this.ctxBack.scale(i,i))},e.prototype.clear=function(r,n,i){var a=this.dom,o=this.ctx,s=a.width,l=a.height;n=n||this.clearColor;var u=this.motionBlur&&!r,f=this.lastFrameAlpha,c=this.dpr,d=this;u&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(a,0,0,s/c,l/c));var h=this.domBack;function v(g,p,m,y){if(o.clearRect(g,p,m,y),n&&n!=="transparent"){var b=void 0;if(uh(n)){var C=n.global||n.__width===m&&n.__height===y;b=C&&n.__canvasGradient||nC(o,n,{x:0,y:0,width:m,height:y}),n.__canvasGradient=b,n.__width=m,n.__height=y}else hZ(n)&&(n.scaleX=n.scaleX||c,n.scaleY=n.scaleY||c,b=iC(o,n,{dirty:function(){d.setUnpainted(),d.painter.refresh()}}));o.save(),o.fillStyle=b||n,o.fillRect(g,p,m,y),o.restore()}u&&(o.save(),o.globalAlpha=f,o.drawImage(h,g,p,m,y),o.restore())}!i||u?v(0,0,s,l):i.length&&z(i,function(g){v(g.x*c,g.y*c,g.width*c,g.height*c)})},e}(Si),Y8=1e5,Ms=314159,Rp=.01,Fue=.001;function kue(t){return t?t.__builtin__?!0:!(typeof t.resize!="function"||typeof t.refresh!="function"):!1}function jue(t,e){var r=document.createElement("div");return r.style.cssText=["position:relative","width:"+t+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",r}var zue=function(){function t(e,r,n,i){this.type="canvas",this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type="canvas";var a=!e.nodeName||e.nodeName.toUpperCase()==="CANVAS";this._opts=n=ue({},n||{}),this.dpr=n.devicePixelRatio||Rh,this._singleCanvas=a,this.root=e;var o=e.style;o&&(i2(e),e.innerHTML=""),this.storage=r;var s=this._zlevelList;this._prevDisplayList=[];var l=this._layers;if(a){var f=e,c=f.width,d=f.height;n.width!=null&&(c=n.width),n.height!=null&&(d=n.height),this.dpr=n.devicePixelRatio||1,f.width=c*this.dpr,f.height=d*this.dpr,this._width=c,this._height=d;var h=new g_(f,this,this.dpr);h.__builtin__=!0,h.initContext(),l[Ms]=h,h.zlevel=Ms,s.push(Ms),this._domRoot=e}else{this._width=Qv(e,0,n),this._height=Qv(e,1,n);var u=this._domRoot=jue(this._width,this._height);e.appendChild(u)}}return t.prototype.getType=function(){return"canvas"},t.prototype.isSingleCanvas=function(){return this._singleCanvas},t.prototype.getViewportRoot=function(){return this._domRoot},t.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},t.prototype.refresh=function(e){var r=this.storage.getDisplayList(!0),n=this._prevDisplayList,i=this._zlevelList;this._redrawId=Math.random(),this._paintList(r,n,e,this._redrawId);for(var a=0;a<i.length;a++){var o=i[a],s=this._layers[o];if(!s.__builtin__&&s.refresh){var l=a===0?this._backgroundColor:null;s.refresh(l)}}return this._opts.useDirtyRect&&(this._prevDisplayList=r.slice()),this},t.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},t.prototype._paintHoverList=function(e){var r=e.length,n=this._hoverlayer;if(n&&n.clear(),!!r){for(var i={inHover:!0,viewWidth:this._width,viewHeight:this._height},a,o=0;o<r;o++){var s=e[o];s.__inHover&&(n||(n=this._hoverlayer=this.getLayer(Y8)),a||(a=n.ctx,a.save()),Ds(a,s,i,o===r-1))}a&&a.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(Y8)},t.prototype.paintOne=function(e,r){oI(e,r)},t.prototype._paintList=function(e,r,n,i){if(this._redrawId===i){n=n||!1,this._updateLayerStatus(e);var a=this._doPaintList(e,r,n),o=a.finished,s=a.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),s&&this._paintHoverList(e),o)this.eachLayer(function(u){u.afterBrush&&u.afterBrush()});else{var l=this;Gv(function(){l._paintList(e,r,n,i)})}}},t.prototype._compositeManually=function(){var e=this.getLayer(Ms).ctx,r=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,r,n),this.eachBuiltinLayer(function(i){i.virtual&&e.drawImage(i.dom,0,0,r,n)})},t.prototype._doPaintList=function(e,r,n){for(var i=this,a=[],o=this._opts.useDirtyRect,s=0;s<this._zlevelList.length;s++){var l=this._zlevelList[s],u=this._layers[l];u.__builtin__&&u!==this._hoverlayer&&(u.__dirty||n)&&a.push(u)}for(var f=!0,c=!1,d=function(g){var p=a[g],m=p.ctx,y=o&&p.createRepaintRects(e,r,h._width,h._height),b=n?p.__startIndex:p.__drawIndex,C=!n&&p.incremental&&Date.now,_=C&&Date.now(),w=p.zlevel===h._zlevelList[0]?h._backgroundColor:null;if(p.__startIndex===p.__endIndex)p.clear(!1,w,y);else if(b===p.__startIndex){var x=e[b];(!x.incremental||!x.notClear||n)&&p.clear(!1,w,y)}b===-1&&(console.error("For some unknown reason. drawIndex is -1"),b=p.__startIndex);var S,E=function(O){var P={inHover:!1,allClipped:!1,prevEl:null,viewWidth:i._width,viewHeight:i._height};for(S=b;S<p.__endIndex;S++){var N=e[S];if(N.__inHover&&(c=!0),i._doPaintEl(N,p,o,O,P,S===p.__endIndex-1),C){var k=Date.now()-_;if(k>15)break}}P.prevElClipPaths&&m.restore()};if(y)if(y.length===0)S=p.__endIndex;else for(var T=h.dpr,A=0;A<y.length;++A){var M=y[A];m.save(),m.beginPath(),m.rect(M.x*T,M.y*T,M.width*T,M.height*T),m.clip(),E(M),m.restore()}else m.save(),E(),m.restore();p.__drawIndex=S,p.__drawIndex<p.__endIndex&&(f=!1)},h=this,v=0;v<a.length;v++)d(v);return Fe.wxa&&z(this._layers,function(g){g&&g.ctx&&g.ctx.draw&&g.ctx.draw()}),{finished:f,needsRefreshHover:c}},t.prototype._doPaintEl=function(e,r,n,i,a,o){var s=r.ctx;if(n){var l=e.getPaintRect();(!i||l&&l.intersect(i))&&(Ds(s,e,a,o),e.setPrevPaintRect(l))}else Ds(s,e,a,o)},t.prototype.getLayer=function(e,r){this._singleCanvas&&!this._needsManuallyCompositing&&(e=Ms);var n=this._layers[e];return n||(n=new g_("zr_"+e,this,this.dpr),n.zlevel=e,n.__builtin__=!0,this._layerConfig[e]?ct(n,this._layerConfig[e],!0):this._layerConfig[e-Rp]&&ct(n,this._layerConfig[e-Rp],!0),r&&(n.virtual=r),this.insertLayer(e,n),n.initContext()),n},t.prototype.insertLayer=function(e,r){var n=this._layers,i=this._zlevelList,a=i.length,o=this._domRoot,s=null,l=-1;if(n[e]){process.env.NODE_ENV!=="production"&&Ho("ZLevel "+e+" has been used already");return}if(!kue(r)){process.env.NODE_ENV!=="production"&&Ho("Layer of zlevel "+e+" is not valid");return}if(a>0&&e>i[0]){for(l=0;l<a-1&&!(i[l]<e&&i[l+1]>e);l++);s=n[i[l]]}if(i.splice(l+1,0,e),n[e]=r,!r.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(r.dom,u.nextSibling):o.appendChild(r.dom)}else o.firstChild?o.insertBefore(r.dom,o.firstChild):o.appendChild(r.dom);r.painter||(r.painter=this)},t.prototype.eachLayer=function(e,r){for(var n=this._zlevelList,i=0;i<n.length;i++){var a=n[i];e.call(r,this._layers[a],a)}},t.prototype.eachBuiltinLayer=function(e,r){for(var n=this._zlevelList,i=0;i<n.length;i++){var a=n[i],o=this._layers[a];o.__builtin__&&e.call(r,o,a)}},t.prototype.eachOtherLayer=function(e,r){for(var n=this._zlevelList,i=0;i<n.length;i++){var a=n[i],o=this._layers[a];o.__builtin__||e.call(r,o,a)}},t.prototype.getLayers=function(){return this._layers},t.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(c,d){c.__dirty=c.__used=!1});function r(c){a&&(a.__endIndex!==c&&(a.__dirty=!0),a.__endIndex=c)}if(this._singleCanvas)for(var n=1;n<e.length;n++){var i=e[n];if(i.zlevel!==e[n-1].zlevel||i.incremental){this._needsManuallyCompositing=!0;break}}var a=null,o=0,s,l;for(l=0;l<e.length;l++){var i=e[l],u=i.zlevel,f=void 0;s!==u&&(s=u,o=0),i.incremental?(f=this.getLayer(u+Fue,this._needsManuallyCompositing),f.incremental=!0,o=1):f=this.getLayer(u+(o>0?Rp:0),this._needsManuallyCompositing),f.__builtin__||Ho("ZLevel "+u+" has been used by unkown layer "+f.id),f!==a&&(f.__used=!0,f.__startIndex!==l&&(f.__dirty=!0),f.__startIndex=l,f.incremental?f.__drawIndex=-1:f.__drawIndex=l,r(l),a=f),i.__dirty&vn&&!i.__inHover&&(f.__dirty=!0,f.incremental&&f.__drawIndex<0&&(f.__drawIndex=l))}r(l),this.eachBuiltinLayer(function(c,d){!c.__used&&c.getElementCount()>0&&(c.__dirty=!0,c.__startIndex=c.__endIndex=c.__drawIndex=0),c.__dirty&&c.__drawIndex<0&&(c.__drawIndex=c.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(e){e.clear()},t.prototype.setBackgroundColor=function(e){this._backgroundColor=e,z(this._layers,function(r){r.setUnpainted()})},t.prototype.configLayer=function(e,r){if(r){var n=this._layerConfig;n[e]?ct(n[e],r,!0):n[e]=r;for(var i=0;i<this._zlevelList.length;i++){var a=this._zlevelList[i];if(a===e||a===e+Rp){var o=this._layers[a];ct(o,n[e],!0)}}}},t.prototype.delLayer=function(e){var r=this._layers,n=this._zlevelList,i=r[e];i&&(i.dom.parentNode.removeChild(i.dom),delete r[e],n.splice(Ke(n,e),1))},t.prototype.resize=function(e,r){if(this._domRoot.style){var n=this._domRoot;n.style.display="none";var i=this._opts,a=this.root;if(e!=null&&(i.width=e),r!=null&&(i.height=r),e=Qv(a,0,i),r=Qv(a,1,i),n.style.display="",this._width!==e||r!==this._height){n.style.width=e+"px",n.style.height=r+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(e,r);this.refresh(!0)}this._width=e,this._height=r}else{if(e==null||r==null)return;this._width=e,this._height=r,this.getLayer(Ms).resize(e,r)}return this},t.prototype.clearLayer=function(e){var r=this._layers[e];r&&r.clear()},t.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},t.prototype.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas&&!this._compositeManually)return this._layers[Ms].dom;var r=new g_("image",this,e.pixelRatio||this.dpr);r.initContext(),r.clear(!1,e.backgroundColor||this._backgroundColor);var n=r.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var i=r.dom.width,a=r.dom.height;this.eachLayer(function(c){c.__builtin__?n.drawImage(c.dom,0,0,i,a):c.renderToCanvas&&(n.save(),c.renderToCanvas(n),n.restore())})}else for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height},s=this.storage.getDisplayList(!0),l=0,u=s.length;l<u;l++){var f=s[l];Ds(n,f,o,l===u-1)}return r.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t}();function Hue(t){t.registerPainter("canvas",zue)}Qa([ule,Vle,Ple,Ole,ele,iue,tue,Zre,Tre,wne,uue,Lue,Hue]);const Vue=I.memo(({options:t,echartRef:e})=>{const r=I.useRef(null),n=I.useRef(null);return I.useEffect(()=>(r.current&&(n.current=Eae(r.current),window.__chartInstanceRef=n),()=>{n.current&&n.current.dispose()}),[]),I.useEffect(()=>{n.current&&(n.current.clear(),t&&Object.keys(t).length>0&&n.current.setOption({...t}))},[t]),I.useImperativeHandle(e,()=>({resize:()=>{n.current&&n.current.resize()},getWidth:()=>{n.current&&n.current.getWidth()}})),D.jsx("div",{ref:r,style:{width:"100%",height:"100%"}})}),Wue=()=>D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:139,height:118,fill:"none",children:[D.jsx("path",{fill:"#F4F4F5",d:"M124.987 58.727c0 13.227-4.202 25.657-11.204 35.463-3.879 5.36-8.511 10.035-13.898 13.684-8.618 6.044-19.068 9.465-30.164 9.465-30.488.114-55.266-26.113-55.266-58.612C14.455 26.34 39.125 0 69.721 0c11.096 0 21.438 3.421 30.164 9.465 5.387 3.649 10.019 8.324 13.898 13.683 7.002 9.921 11.204 22.237 11.204 35.579Z"}),D.jsx("path",{stroke:"#D0D0D4",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,strokeWidth:2,d:"M2 102.569h130.77"}),D.jsx("path",{fill:"#fff",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"M93.85 50.054v52.515H23.22c-2.786 0-4.875-2.36-4.875-5.163V50.054H93.85Z"}),D.jsx("path",{fill:"#DAE1ED",d:"M121.874 50.054v47.352c0 2.95-2.323 5.163-5.082 5.163h-22.94V50.054h28.022Z"}),D.jsx("path",{fill:"#F4F4F5",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"M121.874 50.054v47.352c0 2.95-2.323 5.163-5.082 5.163h-22.94V50.054h28.022Z"}),D.jsx("path",{fill:"#C5CDDB",d:"m45.59 50.054 14.852-24.617h76.22L121.39 50.055h-75.8Z"}),D.jsx("path",{fill:"#F4F4F5",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"m45.59 50.054 14.852-24.617h76.22L121.39 50.055h-75.8Z"}),D.jsx("path",{fill:"url(#a)",d:"M121.874 50.197v27.756h-20.433c-1.898 0-3.211-1.295-3.503-3.164l-4.086-24.735 28.022.143Z",opacity:.3}),D.jsx("path",{fill:"#fff",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"M121.287 50.054H93.852l13.93 22.258c.995 1.474 2.559 2.358 4.123 2.358h21.322c1.422 0 2.417-1.769 1.564-2.948l-13.504-21.668ZM93.85 50.054 78.895 25.437H2l15.52 24.617h76.33Z"}),D.jsx("path",{fill:"#D0D0D4",d:"M56.028 80.415H26.59a1.23 1.23 0 0 1-1.238-1.231c0-.684.55-1.23 1.238-1.23h29.438a1.23 1.23 0 0 1 1.238 1.23c-.138.684-.55 1.23-1.238 1.23ZM56.028 86.159H26.59c-.688 0-1.238-.365-1.238-.82 0-.457.55-.821 1.238-.821h29.438c.687 0 1.238.364 1.238.82-.138.456-.55.82-1.238.82ZM40.44 92.723H26.61c-.699 0-1.257-.365-1.257-.82 0-.456.558-.821 1.257-.821H40.44c.699 0 1.258.365 1.258.82-.14.456-.699.821-1.258.821Z"}),D.jsx("defs",{children:D.jsxs("linearGradient",{id:"a",x1:107.869,x2:107.869,y1:78.525,y2:53.113,gradientUnits:"userSpaceOnUse",children:[D.jsx("stop",{offset:.003,stopColor:"#606673",stopOpacity:0}),D.jsx("stop",{offset:1,stopColor:"#AAB2C5"})]})})]}),q8=t=>{const{t:e}=At();return D.jsxs("div",{style:{color:"#A1A1AA",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[D.jsx(Wue,{}),D.jsx("span",{children:e("empty")})]})};q8.displayName="Empty";const $ue=t=>{const{type:e,categories:r}=t;return{"chart-bar":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-bar-pile":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-bar-percentage":{xAxis:{type:"category",data:r},yAxis:{type:"value",max:100,axisLabel:{formatter:"{value} %"}}},"chart-line":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-line-smooth":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-pie":{xAxis:{show:!1},yAxis:{show:!1}},"chart-pie-circular":{xAxis:{show:!1},yAxis:{show:!1}},"chart-strip-bar":{xAxis:{type:"value"},yAxis:{type:"category",data:r}},"chart-strip-bar-pile":{xAxis:{type:"value"},yAxis:{type:"category",data:r}},"chart-strip-bar-percentage":{xAxis:{type:"value",max:100,axisLabel:{formatter:"{value} %"}},yAxis:{type:"category",data:r}},[Lr.chartCombination]:{xAxis:{type:"category",data:r},yAxis:{type:"value"}}}[e]},X8=({type:t,data:e,label:r,name:n,isGroup:i,groupField:a,labels:o})=>{let s;return t==="chart-pie"?s={data:e.map((l,u)=>({value:l,name:o[u]})),name:n,type:"pie",radius:"50%",label:{...r,position:"outside"},labelLine:{normal:{show:!0}}}:t==="chart-pie-circular"?s={data:e.map((l,u)=>({value:l,name:o[u]})),type:"pie",name:n,radius:["40%","70%"],label:{...r,position:"outside"},labelLine:{normal:{show:!0}}}:t==="chart-line"?s={data:e,name:n,type:"line",label:r}:t==="chart-line-smooth"?s={data:e,name:n,type:"line",smooth:!0,label:r}:s={data:e,name:n,type:"bar",label:r},(t==="chart-bar-percentage"||t==="chart-bar-pile"||t==="chart-strip-bar-pile"||t==="chart-strip-bar-percentage")&&i&&a&&(s.stack=a),s},Gue=({customeStyle:t,series:e,chartConfig:r,width:n})=>{var C,_,w,x;const{isLeftAxisShow:i,isRightAxisShow:a,maxLeftSeriesDataStrLen:o,maxRightSeriesDataStrLen:s,maxSeriesDataLen:l}=e.reduce((S,E)=>{var O;let T={...S},A=E.yAxisIndex==0?"left":"right",M=Math.max(...E.data.map(P=>String(P).length));return A=="left"?(T.maxLeftSeriesDataStrLen=Math.max(T.maxLeftSeriesDataStrLen,M),T.isLeftAxisShow=!0):(T.maxRightSeriesDataStrLen=Math.max(T.maxRightSeriesDataStrLen,M),T.isRightAxisShow=!0),T.maxSeriesDataLen=Math.max(T.maxSeriesDataLen,(O=E==null?void 0:E.data)==null?void 0:O.length),T},{isLeftAxisShow:!1,isRightAxisShow:!1,maxLeftSeriesDataStrLen:0,maxRightSeriesDataStrLen:0,maxSeriesDataLen:0});let u=((C=r==null?void 0:r.xAxis)==null?void 0:C.type)==="category"?"xAxis":"yAxis";const c=(x=(u==="xAxis"?(_=r==null?void 0:r.xAxis)==null?void 0:_.data:(w=r==null?void 0:r.yAxis)==null?void 0:w.data)??[])==null?void 0:x.reduce((S,E)=>{const T=String(E).length;return Math.max(S,T)},0),d=9,h=12;let v=45,g=0,p=0,m=0,y=0;if(u=="xAxis"){const S={45:d*.8,90:d,0:d};l>3&&(c>=15&&(y=90),c>5&&(y=45),n<3&&(y=90)),m=S[`${y}`]*(y==0?1:Math.min(c,18))+h,g=Math.min(o,18)*d+h,p=Math.min(s,18)*d+h}else m=Math.min(o,18)*d+h,g=Math.min(c,18)*d+h,p=h;g=Math.max(g,40),p=Math.max(p,40),i||(g=h),a||(p=h);let b=d;return t!=null&&t.xtitle&&(u=="xAxis"?m=m+b:p=p+b),t!=null&&t.ytitle&&(u=="xAxis"?g=g+b:v=v+b),{top:v+"px",left:g+"px",right:p+"px",bottom:Math.max(m,40)+"px",axisLabelRotate:y}},Uue=({moduleDataApi:t,customData:e,customeStyle:r,width:n=2,height:i=2})=>{const{globalData:a,globalFilterCondition:o}=dn();let s=I.useMemo(()=>o==null?void 0:o.find(w=>(w==null?void 0:w.dataSourceId)===(e==null?void 0:e.dataSourceId)),[o,e==null?void 0:e.dataSourceId]);const[l,u]=I.useState(),[f,c]=I.useState(),d=Tt(async()=>{var _,w,x;if(u([]),e){c(!0);let S="";const E=(e==null?void 0:e.xAxis)==="tags"?"tag":e==null?void 0:e.xAxis,T=(e==null?void 0:e.groupField)==="tags"?"tag":e==null?void 0:e.groupField;e.isGroup?(e.yAxis==="recordTotal"&&(S+=`select=${E},${T},id.count()`),e.yAxis==="fieldValue"&&(e!=null&&e.yAxisField)&&(S+=`select=${E},${T},${e==null?void 0:e.yAxisField}.${e==null?void 0:e.yAxisFieldType}()`)):(e.yAxis==="recordTotal"&&(S+=`select=${E},id.count()`),e.yAxis==="fieldValue"&&(e!=null&&e.yAxisField)&&(S+=`select=${E},${e==null?void 0:e.yAxisField}.${e==null?void 0:e.yAxisFieldType}()`));let A=[];if((((_=s==null?void 0:s.conditionList)==null?void 0:_.length)??0)>0&&A.push(s),(((x=(w=e==null?void 0:e.conditionData)==null?void 0:w.conditionList)==null?void 0:x.length)??0)>0&&A.push(e==null?void 0:e.conditionData),A.length>0){let M=Qd(A);S+=M?`&${M}`:""}e!=null&&e.dataSourceId&&(t==null||t({id:e==null?void 0:e.dataSourceId,query:S}).then(M=>{if(!M.success){K.message.error(M.message);return}u(M.data)}).finally(()=>{c(!1)}))}else u([])});_9(()=>{e&&d()},[e==null?void 0:e.dataSourceId,e==null?void 0:e.conditionData,e==null?void 0:e.sortField,e==null?void 0:e.sortOrder,e==null?void 0:e.xAxis,e==null?void 0:e.yAxis,e==null?void 0:e.yAxisField,e==null?void 0:e.yAxisFieldType,e==null?void 0:e.isGroup,e==null?void 0:e.groupField,s],{wait:60});const h=I.useMemo(()=>{var w,x;return(x=(w=a==null?void 0:a.sourceData)==null?void 0:w.find(S=>S.value===(e==null?void 0:e.dataSourceId)))==null?void 0:x.fields},[a,e==null?void 0:e.dataSourceId]),v=I.useMemo(()=>e&&l&&e.type&&l.length>0?(w=>{var xe,Oe,st,qt,Ge,St,Rr,it,yt,Pr,lr,Br,_n,_r;const x=({item:de,field:Ne,timeGroupInterval:Ue})=>nf({fieldOptions:h,val:de[Ne],field:Ne,fieldMap:a==null?void 0:a.fieldMap,timeGroupInterval:Ue}),S=de=>{const Ne=h==null?void 0:h.find(Ue=>Ue.value===de);return Ne==null?void 0:Ne.label},E=de=>{var Ne;return((Ne=h==null?void 0:h.find(Ue=>Ue.value===de))==null?void 0:Ne.type)==="timestamp"},T={tags:"tag"},A=T[e==null?void 0:e.xAxis]??(e==null?void 0:e.xAxis),M=T[e==null?void 0:e.groupField]??(e==null?void 0:e.groupField);let O=HW(w,de=>x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval})),P=Object.keys(O).map(de=>O[de].reduce((ht,xt)=>(Object.keys(xt).forEach(ur=>{let ai=xt[ur];US(ai)?ht[ur]=ht!=null&&ht[ur]?ht[ur]+ai:ai:ht[ur]=ai}),ht),{}));const N=new Set,k=new Set,F={},j={};P.forEach(de=>{const Ne=x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval}),Ue=e.yAxis==="recordTotal"?de==null?void 0:de.count:de[e==null?void 0:e.yAxisFieldType]||0,ht=Ne??U0("unknown");if(j[ht]=Ue,e!=null&&e.isGroup&&(e!=null&&e.groupField)){const xt=x({item:de,field:M}),ur=Ne??U0("unknown");k.add(xt),F[xt]||(F[xt]={}),F[xt][ur]=Ue}});const W={},B={};if(e!=null&&e.isGroup&&(e!=null&&e.groupField)){const de={};Object.keys(F).forEach(Ne=>{Object.entries(F[Ne]).forEach(([Ue,ht])=>{de[Ue]=(de[Ue]||0)+ht})}),Object.keys(F).forEach(Ne=>{B[Ne]={},Object.entries(F[Ne]).forEach(([Ue,ht])=>{const xt=de[Ue]||1;B[Ne][Ue]=ht/xt*100})})}else Object.entries(j).forEach(([de,Ne])=>{const Ue=Ne||1;W[de]=Ne/Ue*100});let H=(e==null?void 0:e.sortField)??"xAxis",Y=(e==null?void 0:e.sortOrder)??"asc";const te=[...P].sort((de,Ne)=>{let Ue,ht;switch(H){case"xAxis":Ue=x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval}),ht=x({item:Ne,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval});break;case"yAxisField":Ue=e.yAxis==="recordTotal"?de==null?void 0:de.count:de[e==null?void 0:e.yAxisFieldType]||0,ht=e.yAxis==="recordTotal"?Ne==null?void 0:Ne.count:Ne[e==null?void 0:e.yAxisFieldType]||0;break}const xt=Y==="asc"?1:-1;return Ue>ht?1*xt:Ue<ht?-1*xt:0}).map(de=>x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval}));if(N.clear(),te.forEach(de=>N.add(de)),!E(e==null?void 0:e.xAxis)&&e.displayRange!=="ALL"&&e.displayRange){let de=Array.from(N).sort((xt,ur)=>j[ur]-j[xt]),Ne=[],[Ue,ht]=e.displayRange.split("_");Ue==="TOP"?Ne=de.slice(0,Number(ht)):Ne=de.slice(-Number(ht)),Array.from(N).forEach(xt=>(Ne.includes(xt)||N.delete(xt),xt))}const ee=de=>e!=null&&e.isGroup&&(e!=null&&e.groupField)?(de==null?void 0:de.value)==0?"":`${de==null?void 0:de.value}`:`${de==null?void 0:de.value}`,V={show:(xe=e==null?void 0:e.chartOptions)==null?void 0:xe.includes("label"),position:"top",formatter:ee},J=Array.from(N),L=Array.from(k),$=[],Q=$ue({type:e==null?void 0:e.type,categories:J}),Z=de=>US(de)?Math.floor(de*100)/100:de;if(e!=null&&e.isGroup&&(e!=null&&e.groupField))L.forEach(de=>{var ur,ai;const Ne=["chart-bar-percentage","chart-strip-bar-percentage"].includes(e.type)?J.map(Ir=>Z(B[de][Ir]||0)):J.map(Ir=>Z(F[de][Ir]||0));let Ue=e.type,ht="left";if(Ue==Lr.chartCombination){let Ir=((e==null?void 0:e.groupFieldConfig)??[]).find(ho=>x({item:{[M]:ho==null?void 0:ho.value},field:M})==de);Ue=((ur=Ir==null?void 0:Ir.config)==null?void 0:ur.chartType)??Lr.ChartBar,ht=((ai=Ir==null?void 0:Ir.config)==null?void 0:ai.yAxisPos)??"left"}let xt=X8({type:Ue,data:Ne,label:V,name:de,isGroup:e==null?void 0:e.isGroup,groupField:e==null?void 0:e.groupField,labels:J});xt.yAxisIndex=ht=="left"?0:1,$.push(xt)});else{const de=["chart-bar-percentage","chart-strip-bar-percentage"].includes(e.type)?J.map(xt=>{var ur;return Z(((ur=W[xt])==null?void 0:ur.toFixed(2))||0)}):J.map(xt=>Z(j[xt]||0));let Ne=e.type,Ue="left";Ne==Lr.chartCombination?Ne=((Oe=e==null?void 0:e.yAxisFieldConfig)==null?void 0:Oe.chartType)??Lr.ChartBar:Ue=((st=e==null?void 0:e.yAxisFieldConfig)==null?void 0:st.yAxisPos)??"left";let ht=X8({type:e.type,data:de,label:V,name:e.yAxis==="recordTotal"?U0("pb.statisticsText"):S(e==null?void 0:e.yAxisField),isGroup:e==null?void 0:e.isGroup,groupField:e==null?void 0:e.groupField,labels:J});ht.yAxisIndex=Ue=="left"?0:1,$.push(ht)}const X=Gue({series:$,chartConfig:Q,width:n,customeStyle:r}),le=(qt=e==null?void 0:e.chartOptions)==null?void 0:qt.includes("legend");let fe=$.some(de=>(de==null?void 0:de.yAxisIndex)==0),De=$.some(de=>(de==null?void 0:de.yAxisIndex)==1),ye={...Q.yAxis,axisTick:{show:(Ge=e==null?void 0:e.chartOptions)==null?void 0:Ge.includes("axis")},axisLine:{show:(St=e==null?void 0:e.chartOptions)==null?void 0:St.includes("axis")},axisLabel:{show:(Rr=e==null?void 0:e.chartOptions)==null?void 0:Rr.includes("label"),formatter:de=>de.length>15?`${de.slice(0,15)}...`:de,hideOverlap:!0,...(it=Q.yAxis)==null?void 0:it.axisLabel},splitLine:{show:(yt=e==null?void 0:e.chartOptions)==null?void 0:yt.includes("splitLine")}};return{legend:{type:"scroll",left:"center",right:"center",top:"0",show:le,itemWidth:12,itemHeight:12,data:($==null?void 0:$.map(de=>(de==null?void 0:de.name)||""))||[]},grid:{top:X.top,left:X.left,right:X.right,bottom:X.bottom},graphic:{elements:[{type:"text",left:"center",bottom:"10px",style:{text:(r==null?void 0:r.xtitle)||"",fill:"#333",fontSize:12,fontWeight:"bold"}},{type:"text",left:"10px",top:"center",style:{text:(r==null?void 0:r.ytitle)||"",fill:"#333",fontSize:12,fontWeight:"bold"},rotation:Math.PI/2}]},xAxis:{...Q.xAxis,axisTick:{show:(Pr=e==null?void 0:e.chartOptions)==null?void 0:Pr.includes("axis")},axisLine:{show:(lr=e==null?void 0:e.chartOptions)==null?void 0:lr.includes("axis")},axisLabel:{show:(Br=e==null?void 0:e.chartOptions)==null?void 0:Br.includes("label"),rotate:X.axisLabelRotate,interval:"auto",formatter:de=>de.length>15?`${de.slice(0,15)}...`:de,...((_n=Q.xAxis)==null?void 0:_n.axisLabel)??{}},splitLine:{show:(_r=e==null?void 0:e.chartOptions)==null?void 0:_r.includes("splitLine")}},yAxis:[{show:fe,...ye},{show:De,...ye}],series:$,tooltip:{trigger:"item",axisPointer:{type:"shadow"},appendTo:"body"}}})(l):null,[e==null?void 0:e.sortField,e==null?void 0:e.sortOrder,e==null?void 0:e.type,e==null?void 0:e.chartOptions,e==null?void 0:e.timeGroupInterval,e==null?void 0:e.groupFieldConfig,e==null?void 0:e.yAxisFieldConfig,e==null?void 0:e.displayRange,r,l,n,i,h]),g=I.useRef(),p=I.useRef(null),m=Em(p);I.useEffect(()=>{var _;m&&((_=g==null?void 0:g.current)==null||_.resize())},[m]);const y=f,b=!f&&!v,C=!y&&!!v;return D.jsxs("div",{style:{width:"100%",height:"100%"},ref:p,children:[y&&D.jsx(K.Spin,{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},spinning:f}),b&&D.jsx(q8,{}),C&&D.jsx(Vue,{echartRef:g,options:v??{}})]})},Z8=I.memo(Uue),Pp={"combination-chart-option":"_combination-chart-option_1cwba_1","group-field-config-picker":"_group-field-config-picker_1cwba_11","group-field-config-picker__title":"_group-field-config-picker__title_1cwba_14","group-field-config-picker__item":"_group-field-config-picker__item_1cwba_18","group-field-config-picker__input":"_group-field-config-picker__input_1cwba_23"},K8="combination-chart-option",fu={chartType:Lr.ChartBar,yAxisPos:"left"},Q8=t=>{const{style:e,className:r,initTriggerChange:n=!1}=t,{t:i}=At(),[a,o]=Ao(t),s=[{label:i("chart.t2"),key:Lr.ChartBar,icon:D.jsx($w,{})},{label:i("chart.t8"),key:Lr.ChartLine,icon:D.jsx(Jw,{})}],l=[{label:i("chart.left"),key:"left",icon:D.jsx(Uw,{})},{label:i("chart.right"),key:"right",icon:D.jsx(Yw,{})}],u=(a==null?void 0:a.chartType)??(fu==null?void 0:fu.chartType),f=(a==null?void 0:a.yAxisPos)??(fu==null?void 0:fu.yAxisPos),c=I.useMemo(()=>s.find(h=>h.key===u),[u,s]),d=I.useMemo(()=>l.find(h=>h.key===f),[f,l]);return D.jsxs("div",{className:fn(Pp[`${K8}`],K8),style:e,children:[D.jsx(K.Dropdown,{trigger:["click"],placement:"bottom",menu:{items:s.map(h=>({...h,onClick:()=>{o({chartType:h.key,yAxisPos:f})}}))},children:D.jsx(K.Tooltip,{title:c==null?void 0:c.label,children:D.jsx(K.Button,{size:"small",type:"text",children:c==null?void 0:c.icon})})}),D.jsx(K.Divider,{type:"vertical",style:{margin:"0 2px"}}),D.jsx(K.Dropdown,{trigger:["click"],placement:"bottom",menu:{items:l.map(h=>({...h,onClick:()=>{o({chartType:u,yAxisPos:h.key})}}))},children:D.jsx(K.Tooltip,{title:d==null?void 0:d.label,children:D.jsx(K.Button,{size:"small",type:"text",children:d==null?void 0:d.icon})})})]})};Q8.displayName="CombinationChartOptionPicker";const m_="group-field-config-picker",J8=[],eN=t=>{const{style:e,className:r,options:n=J8}=t,[i=J8,a]=Ao(t),o=Tt(l=>{let u=(i??[]).find(f=>f.value===l);return u?u.config:void 0}),s=Tt((l,u)=>{let f=[...i??[]],c=f.find(d=>d.value===l);c?c.config=u:f.push({value:l,config:u}),a(f)});return I.useEffect(()=>{if((n==null?void 0:n.length)>0){let l=n.map(u=>({value:u,config:{chartType:Lr.ChartBar,yAxisPos:"left",...o(u)??{}}}));a(l)}},[n]),I.useMemo(()=>D.jsx("div",{className:fn(r,Pp[`${m_}`]),style:e,children:D.jsx("div",{children:((t==null?void 0:t.options)??[]).map(l=>{let u=`${l}`;const f=o(l);return D.jsxs("div",{className:fn(Pp[`${m_}__item`]),children:[D.jsx(K.Tooltip,{title:u,children:D.jsx("div",{className:fn(Pp[`${m_}__input`]),children:D.jsx(Yn,{value:u,disabled:!0,style:{width:200,pointerEvents:"none"}})})}),D.jsx(Q8,{value:f,onChange:c=>{s(l,c)}})]},u)})})}),[i,n])};eN.displayName="GroupFieldConfigPicker";const Yue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"17",y:"8",width:"6",height:"15.5",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"17",y:"24.5",width:"6",height:"15.5",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"28",y:"8",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"28",y:"18",width:"6",height:"22",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"39",y:"8",width:"6",height:"19",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"39",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"50",y:"8",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"50",y:"18",width:"6",height:"22",rx:"0.5",fill:"#5b65f5"})]}),que=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"17",y:"21",width:"6",height:"6",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"17",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"28",y:"24",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"28",y:"34",width:"6",height:"6",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"39",y:"8",width:"6",height:"19",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"39",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"50",y:"18",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"50",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"})]}),Xue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("path",{d:"M15.5 33.5C20.2023 32.3804 23.5007 28.5533 25.7095 24.6682C28.3082 20.0974 34.0857 17.3668 38.758 19.7783L39.8066 20.3195C42.9001 21.9162 46.671 21.329 49.1326 18.8674L58 10",stroke:"#959bee",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsx("path",{d:"M16.5 15L26.844 27.6427C28.7759 30.0039 31.8825 31.0607 34.8535 30.3675L42.3359 28.6216C44.0629 28.2187 45.8748 28.401 47.4869 29.1398L57 33.5",stroke:"#5b65f4",strokeWidth:"1.5",strokeLinecap:"round"})]}),Zue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("path",{d:"M20 24C20 32.8366 27.1634 40 36 40C44.8366 40 52 32.8366 52 24C52 15.1634 44.8366 8 36 8C27.1634 8 20 15.1634 20 24ZM46.3944 24C46.3944 29.7407 41.7407 34.3944 36 34.3944C30.2593 34.3944 25.6056 29.7407 25.6056 24C25.6056 18.2593 30.2593 13.6056 36 13.6056C41.7407 13.6056 46.3944 18.2593 46.3944 24Z",fill:"#5b65f4"}),D.jsx("path",{d:"M52 24C52 19.7565 50.3143 15.6869 47.3137 12.6863C44.3131 9.68571 40.2435 8 36 8V13.6056C38.7568 13.6056 41.4006 14.7007 43.35 16.65C45.2993 18.5994 46.3944 21.2432 46.3944 24H52Z",fill:"#959bee"}),D.jsx("path",{d:"M52 24C52 20.9896 51.1507 18.0403 49.5497 15.4909L44.8026 18.4721C45.8427 20.1283 46.3944 22.0443 46.3944 24H52Z",fill:"#cdcff9"})]}),Kue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"58",y:"11",width:"4",height:"15",rx:"0.5",transform:"rotate(90 58 11)",fill:"#959bee"}),D.jsx("rect",{x:"42",y:"11",width:"4",height:"28",rx:"0.5",transform:"rotate(90 42 11)",fill:"#5b65f5"}),D.jsx("rect",{x:"58",y:"18",width:"4",height:"21.5",rx:"0.5",transform:"rotate(90 58 18)",fill:"#959bee"}),D.jsx("rect",{x:"35.5",y:"18",width:"4",height:"21.5",rx:"0.5",transform:"rotate(90 35.5 18)",fill:"#5b65f5"}),D.jsx("rect",{x:"58",y:"25",width:"4",height:"34",rx:"0.5",transform:"rotate(90 58 25)",fill:"#959bee"}),D.jsx("rect",{x:"23",y:"25",width:"4",height:"9",rx:"0.5",transform:"rotate(90 23 25)",fill:"#5b65f5"}),D.jsx("rect",{x:"58",y:"32",width:"4",height:"17",rx:"0.5",transform:"rotate(90 58 32)",fill:"#959bee"}),D.jsx("rect",{x:"40",y:"32",width:"4",height:"26",rx:"0.5",transform:"rotate(90 40 32)",fill:"#5b65f5"})]}),Que=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"40",y:"11",width:"4",height:"15",rx:"0.5",transform:"rotate(90 40 11)",fill:"#959bee"}),D.jsx("rect",{x:"24",y:"11",width:"4",height:"8",rx:"0.5",transform:"rotate(90 24 11)",fill:"#5b65f5"}),D.jsx("rect",{x:"48",y:"18",width:"4",height:"15.5",rx:"0.5",transform:"rotate(90 48 18)",fill:"#959bee"}),D.jsx("rect",{x:"31.5",y:"18",width:"4",height:"15.5",rx:"0.5",transform:"rotate(90 31.5 18)",fill:"#5b65f5"}),D.jsx("rect",{x:"60",y:"25",width:"4",height:"34",rx:"0.5",transform:"rotate(90 60 25)",fill:"#959bee"}),D.jsx("rect",{x:"25",y:"25",width:"4",height:"9",rx:"0.5",transform:"rotate(90 25 25)",fill:"#5b65f5"}),D.jsx("rect",{x:"43",y:"32",width:"4",height:"13",rx:"0.5",transform:"rotate(90 43 32)",fill:"#959bee"}),D.jsx("rect",{x:"29",y:"32",width:"4",height:"13",rx:"0.5",transform:"rotate(90 29 32)",fill:"#5b65f5"})]}),Jue=()=>{const{t,i18n:e}=At();return I.useMemo(()=>[{label:t("chart.t2"),value:"chart-bar",icon:D.jsx(ZS,{})},{label:t("chart.t3"),value:"chart-bar-pile",icon:D.jsx(que,{})},{label:t("chart.t4"),value:"chart-bar-percentage",icon:D.jsx(Yue,{})},{label:t("chart.t5"),value:"chart-strip-bar",icon:D.jsx(JS,{})},{label:t("chart.t6"),value:"chart-strip-bar-pile",icon:D.jsx(Que,{})},{label:t("chart.t7"),value:"chart-strip-bar-percentage",icon:D.jsx(Kue,{})},{label:t("chart.t8"),value:"chart-line",icon:D.jsx(KS,{})},{label:t("chart.t9"),value:"chart-line-smooth",icon:D.jsx(Xue,{})},{label:t("chart.t10"),value:"chart-pie",icon:D.jsx(QS,{})},{label:t("chart.t11"),value:"chart-pie-circular",icon:D.jsx(Zue,{})},{label:t("chart._t12"),value:Lr.chartCombination,icon:D.jsx(XS,{})}],[e.language])},efe=()=>{const{t,i18n:e}=At();return I.useMemo(()=>[{label:t("chart.t40"),value:"day"},{label:t("chart.t41"),value:"week"},{label:t("chart.t42"),value:"month"},{label:t("chart.t43"),value:"year"}],[e.language])},tfe=()=>{const{t,i18n:e}=At();return I.useMemo(()=>[{label:t("displayRange.all","ALL"),value:hi.ALL},{label:t("displayRange.top5","TOP5"),value:hi.TOP5},{label:t("displayRange.top10","TOP10"),value:hi.TOP10},{label:t("displayRange.top20","TOP20"),value:hi.TOP20},{label:t("displayRange.top30","TOP30"),value:hi.TOP30},{label:t("displayRange.bottom5","BOTTOM5"),value:hi.BOTTOM5},{label:t("displayRange.bottom10","BOTTOM10"),value:hi.BOTTOM10},{label:t("displayRange.bottom20","BOTTOM20"),value:hi.BOTTOM20},{label:t("displayRange.bottom30","BOTTOM30"),value:hi.BOTTOM30}],[e.language])},rfe={"chart-modal":"_chart-modal_10ivt_1"},nfe="chart-modal",ife=({selectModuleData:t,onAllValuesChange:e,enumDataApi:r})=>{const{globalData:n}=dn(),{t:i}=At(),a=I.useRef(null),o=Jue(),s=efe(),l=tfe(),u={dataSourceId:"",yAxis:"recordTotal",chartOptions:["legend","label","axis","splitLine"],sortField:"xAxis",sortOrder:"asc",timeGroupInterval:"day",displayRange:"ALL",yAxisFieldConfig:{chartType:Lr.ChartBar,yAxisPos:"left"}},[f]=K.Form.useForm(),c=K.Form.useWatch("type",f),d=K.Form.useWatch("dataSourceId",f),h=K.Form.useWatch("isGroup",f),v=K.Form.useWatch("xAxis",f),g=K.Form.useWatch("yAxisField",f),p=K.Form.useWatch("groupField",f),m=Tt(B=>{var Y,q;return((q=(Y=n==null?void 0:n.sourceData)==null?void 0:Y.find(te=>te.value===B))==null?void 0:q.fields)??[]}),{fieldOptions:y,xAxisFieldOption:b,yAxisFieldOption:C,groupFieldOption:_}=I.useMemo(()=>{const B=m(d),H=B.filter(te=>![g,p].includes(te.value)),Y=B.filter(te=>{let ee=te.type==="int"||te.type==="float",V=[v,p].includes(te.value);return ee&&!V}),q=B.filter(te=>![v,g].includes(te.value));return{fieldOptions:B,xAxisFieldOption:H,yAxisFieldOption:Y,groupFieldOption:q}},[d,v,g,p]),w=Tt(B=>{var H;return((H=y.find(Y=>Y.value===B))==null?void 0:H.type)==="timestamp"}),[x,S]=I.useState(!1),E=I.useRef(),[T,A]=I.useState({conditionList:[],conditionType:"all"}),[M,O]=I.useState(0),P=B=>{var H;A(B),E.current=B,O(((H=B==null?void 0:B.conditionList)==null?void 0:H.length)||0)},{service:N}=dn(),{data:k,loading:F}=y9(async()=>{var B,H,Y;if(h&&c===Lr.chartCombination&&p){const q=p==="tags"?"tag":p;let te=`select=${q}`;if(((B=T==null?void 0:T.conditionList)==null?void 0:B.length)>0){let J=Qd(T);te+=J?`&${J}`:""}let ee=await((H=N==null?void 0:N.moduleDataApi)==null?void 0:H.call(N,{id:d,query:te})),V=(Y=ee==null?void 0:ee.data)==null?void 0:Y.map(J=>nf({fieldOptions:y,val:J[q],field:q,fieldMap:n==null?void 0:n.fieldMap}));return[...new Set(V)]}else return[]},{refreshDeps:[c,h,p,T,d]}),{run:j}=Sm(Tt(()=>{e==null||e({...u,...f.getFieldsValue(),conditionData:E.current})}),{wait:100}),W=Tt((B,H)=>{var Y,q,te;if(B.dataSourceId){const ee=m(B.dataSourceId);f.setFieldsValue({xAxis:(Y=ee==null?void 0:ee[0])==null?void 0:Y.value,yAxis:"recordTotal",isGroup:!1}),P({conditionList:[],conditionType:"all"})}if(B.xAxis&&f.setFieldsValue(w(B.xAxis)?{timeGroupInterval:u==null?void 0:u.timeGroupInterval}:{displayRange:u==null?void 0:u.displayRange}),B.yAxis){let ee=B.yAxis;f.setFieldsValue({yAxisField:ee==="fieldValue"?(q=C==null?void 0:C[0])==null?void 0:q.value:"",yAxisFieldType:"sum"})}B.isGroup&&f.setFieldsValue({groupField:(te=_==null?void 0:_[0])==null?void 0:te.value}),j()});return I.useEffect(()=>{var B,H,Y;if(t!=null&&t.customData){const q=t.customData;f.setFieldsValue(q)}else{const q=(B=n==null?void 0:n.sourceData)==null?void 0:B[0],te=m(q==null?void 0:q.value)||[];f.setFieldsValue({...u,dataSourceId:q==null?void 0:q.value,type:t==null?void 0:t.type,xAxis:(H=te==null?void 0:te[0])==null?void 0:H.value})}P((Y=t==null?void 0:t.customData)==null?void 0:Y.conditionData),j()},[t,n]),D.jsxs("div",{style:{height:"50vh",overflowX:"auto"},className:fn(rfe[`${nfe}`]),ref:a,children:[D.jsxs(K.Form,{form:f,name:"customData",layout:"vertical",onValuesChange:W,initialValues:u,children:[D.jsx(K.Form.Item,{label:i("dataSource"),name:"dataSourceId",children:D.jsx(K.Select,{options:(n==null?void 0:n.sourceData)??[]})}),D.jsxs(K.Form.Item,{label:i("dataRange"),children:[D.jsx(K.Button,{style:{marginLeft:"-15px"},onClick:()=>{S(!0)},type:"link",children:i("filterData")}),M>0?`${i("selectNcondition",{n:M})}`:null]}),D.jsx(K.Form.Item,{label:i("chart.t1"),name:"type",children:D.jsx(K.Select,{options:o,optionRender:B=>D.jsxs(K.Flex,{align:"center",children:[D.jsx("span",{role:"img",style:{marginTop:"5px"},"aria-label":B.data.label,children:B.data.icon}),B.data.label]})})}),D.jsx(K.Form.Item,{name:"chartOptions",label:i("chart.t12"),children:D.jsxs(K.Checkbox.Group,{children:[D.jsx(K.Checkbox,{value:"legend",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t13")}),D.jsx(K.Checkbox,{value:"label",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t14")}),["chart-pie","chart-pie-circular"].includes(c)?null:D.jsxs(D.Fragment,{children:[D.jsx(K.Checkbox,{value:"axis",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t15")}),D.jsx(K.Checkbox,{value:"splitLine",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t16")})]})]})}),D.jsx(K.Divider,{style:{borderColor:"#e2e2e2",marginTop:0}}),D.jsx(K.Form.Item,{label:c!=null&&c.includes("pie")?i("chart.t17"):i("chart.t18"),name:"xAxis",children:D.jsx(K.Select,{options:b})}),D.jsx(K.Form.Item,{noStyle:!0,dependencies:["type","xAxis"],children:({getFieldValue:B})=>w(B("xAxis"))?D.jsx(D.Fragment,{children:D.jsx(K.Form.Item,{name:"timeGroupInterval",label:i("chart.t39"),children:D.jsx(K.Select,{options:s})})}):D.jsx(D.Fragment,{children:D.jsx(K.Form.Item,{name:"displayRange",label:i("displayRange.title"),children:D.jsx(K.Select,{options:l})})})}),D.jsx(K.Form.Item,{dependencies:["type"],noStyle:!0,children:({getFieldValue:B})=>{var H;return(H=B("type"))!=null&&H.includes("pie")?null:D.jsxs(D.Fragment,{children:[D.jsx(K.Form.Item,{name:"sortField",label:i("chart.t31"),children:D.jsxs(K.Radio.Group,{children:[D.jsx(K.Radio,{value:"xAxis",children:i("chart.t32")}),D.jsx(K.Radio,{value:"yAxisField",children:i("chart.t33")}),D.jsx(K.Radio,{value:"recordValue",children:i("chart.t34")})]})}),D.jsx(K.Form.Item,{name:"sortOrder",label:i("chart.t35"),children:D.jsxs(K.Radio.Group,{children:[D.jsx(K.Radio,{value:"asc",children:i("chart.t36")}),D.jsx(K.Radio,{value:"desc",children:i("chart.t37")})]})})]})}}),D.jsx(K.Form.Item,{label:c!=null&&c.includes("pie")?i("chart.t19"):i("chart.t20"),name:"yAxis",children:D.jsx(K.Select,{options:[{value:"recordTotal",label:i("statisticstRecordNum")},{value:"fieldValue",label:i("statisticstFieldVal")}]})}),D.jsx(K.Form.Item,{dependencies:["yAxis","type","isGroup"],noStyle:!0,children:({getFieldValue:B})=>B("yAxis")==="fieldValue"?D.jsx(K.Form.Item,{label:i("selectField"),children:D.jsx("div",{style:{display:"flex",justifyContent:"space-between"},children:D.jsxs(K.Space.Compact,{children:[D.jsx(K.Form.Item,{noStyle:!0,name:"yAxisField",children:D.jsx(K.Select,{style:{width:"100px"},options:C})}),D.jsx(K.Form.Item,{name:"yAxisFieldType",noStyle:!0,children:D.jsx(K.Select,{style:{width:"100px"},options:[{value:"sum",label:i("sumVal")},{value:"max",label:i("maxVal")},{value:"min",label:i("minVal")},{value:"avg",label:i("averageVal")}]})})]})})}):null}),D.jsx(K.Form.Item,{dependencies:["type","isGroup"],noStyle:!0,children:({getFieldValue:B})=>{var H;return(H=B("type"))!=null&&H.includes("pie")?null:D.jsxs(D.Fragment,{children:[D.jsx(K.Form.Item,{name:"isGroup",valuePropName:"checked",noStyle:!0,children:D.jsx(K.Checkbox,{style:{marginBottom:"5px"},children:i("chart.t38")})}),D.jsx(K.Form.Item,{dependencies:["isGroup"],noStyle:!0,children:({getFieldValue:Y})=>Y("isGroup")?D.jsx(K.Form.Item,{name:"groupField",children:D.jsx(K.Select,{options:_})}):null}),D.jsx(K.Spin,{spinning:F,children:D.jsx(K.Form.Item,{name:"groupFieldConfig",label:i("chart.groupFieldConfig"),hidden:!(B("type")===Lr.chartCombination&&B("isGroup")),children:D.jsx(eN,{options:k})})})]})}})]}),D.jsx(V0,{open:x,value:T,fieldOptions:y,enumDataApi:r,onClose:()=>{S(!1)},onOk:B=>{P(B),j()}})]})},afe=({customData:t,selectModuleData:e,onAllValuesChange:r})=>{var s,l,u;const[n]=K.Form.useForm(),{t:i}=At(),a={xtitle:"",ytitle:""},o=()=>{setTimeout(()=>{r==null||r(n.getFieldsValue())})};return I.useEffect(()=>{e!=null&&e.customeStyle?n.setFieldsValue(e.customeStyle):n.setFieldsValue(a)},[e]),(s=t==null?void 0:t.type)!=null&&s.includes("pie")?D.jsx("div",{style:{height:"50vh",overflowX:"auto"}}):D.jsx("div",{style:{height:"50vh",overflowX:"auto"},children:D.jsxs(K.Form,{form:n,name:"customeStyle",layout:"vertical",initialValues:a,children:[D.jsx(K.Divider,{orientation:"left",orientationMargin:"0",children:i("chart.t21")}),(l=t==null?void 0:t.type)!=null&&l.includes("pie")?null:D.jsx(K.Form.Item,{label:i("chart.t22"),name:"xtitle",children:D.jsx(Yn,{onChange:()=>{o()}})}),D.jsx(K.Divider,{orientation:"left",orientationMargin:"0",children:i("chart.t26")}),(u=t==null?void 0:t.type)!=null&&u.includes("pie")?null:D.jsx(K.Form.Item,{label:i("chart.t27"),name:"ytitle",children:D.jsx(Yn,{onChange:()=>{o()}})})]})})},ofe=({open:t,onClose:e,onOk:r,moduleDataApi:n,selectModuleData:i,enumDataApi:a})=>{var v;const{t:o}=At(),[s,l]=I.useState(),[u,f]=I.useState();I.useRef(null);const c=(v=s==null?void 0:s.type)==null?void 0:v.includes("pie");I.useEffect(()=>{i&&(l(i==null?void 0:i.customData),f(i==null?void 0:i.customeStyle))},[i]);const[d,h]=I.useState("");return I.useEffect(()=>{t&&h(i!=null&&i.title?i==null?void 0:i.title:o("chartText"))},[t]),D.jsx(D.Fragment,{children:D.jsx(K.Modal,{width:"65%",title:D.jsx(Dd,{value:d,onChange:h}),footer:null,open:t,onCancel:e,destroyOnClose:!0,closeIcon:D.jsx(zc,{}),className:"ow-modal ow-modal-2",children:D.jsxs("div",{className:"config-widget-dialog-container",children:[D.jsx("div",{className:"config-widget-dialog-content",children:D.jsx("div",{className:"config-widget-dialog-preview",children:D.jsx(Z8,{customData:s,customeStyle:u,moduleDataApi:n})})}),D.jsxs("div",{className:"config-widget-dialog-panel",children:[D.jsx("div",{className:"bitable-dashboard edit-panel-container",children:D.jsx(K.Tabs,{defaultActiveKey:"1",items:[{key:"1",label:o("typeData"),children:D.jsx(ife,{enumDataApi:a,selectModuleData:i,onAllValuesChange:g=>{l(g)}})},...c?[]:[{key:"2",label:o("customStyle"),children:D.jsx(afe,{customData:s,selectModuleData:i,onAllValuesChange:g=>{f(g)}})}]]})}),D.jsx("div",{className:"button-container",children:D.jsx(K.Button,{type:"primary",onClick:()=>{r==null||r({id:i==null?void 0:i.id,type:i==null?void 0:i.type,customData:s,customeStyle:u,title:d})},children:o("confirm")})})]})]})})})};function y_(t,e){const{ranges:r,step:n}=e;let i=null,a=null;for(let o=0;o<r.length-1;o++){const[s,l]=r[o],[u,f]=r[o+1];if(t>=s&&t<=u){i=[s,l],a=[u,f];break}}if(t<r[0][0]&&(i=r[0],a=r[1]),t>r[r.length-1][0]&&(i=r[r.length-2],a=r[r.length-1]),i&&a){let[o,s]=i,[l,u]=a;const f=(u-s)/(l-o),c=s-f*o,d=f*t+c;return Math.round(d/n)*n}if(i||a){let o=i||a,[s,l]=o;const u=l*t/s;return Math.round(u/n)*n}throw new Error("Unexpected error in range calculation")}function sfe(t,e=0){if(!Number.isFinite(t))throw new Error("Value must be a finite number.");return new Intl.NumberFormat(void 0,{style:"percent",minimumFractionDigits:e,maximumFractionDigits:e}).format(t)}function b_(t,e=0){if(!Number.isFinite(t))return"";const r=new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:e}).format(t),[n,i]=r.split("."),a=(i||"").padEnd(e,"0");return`${n}${e>0?".":""}${a}`}const lfe=({moduleDataApi:t,customData:e,customeStyle:r})=>{const[n,i]=I.useState(),[a,o]=I.useState(!1),{globalFilterCondition:s}=dn();let l=I.useMemo(()=>s==null?void 0:s.find(m=>(m==null?void 0:m.dataSourceId)===(e==null?void 0:e.dataSourceId)),[s,e==null?void 0:e.dataSourceId]);const u=Tt(async()=>{var p,m,y;if(e){let b="";o(!0),e.statisticalMethod==="fieldValue"&&e.field?b+=`select=${e.field}.${e==null?void 0:e.statisticalType}()`:e.statisticalMethod==="recordTotal"&&(b+="select=id.count()");let C=[];if((((p=l==null?void 0:l.conditionList)==null?void 0:p.length)??0)>0&&C.push(l),(((y=(m=e==null?void 0:e.conditionData)==null?void 0:m.conditionList)==null?void 0:y.length)??0)>0&&C.push(e==null?void 0:e.conditionData),C.length>0){let _=Qd(C);b+=_?`&${_}`:""}e!=null&&e.dataSourceId&&(t==null||t({id:e==null?void 0:e.dataSourceId,query:b}).then(_=>{if(!_.success){K.message.error(_.message);return}i(_.data)}).finally(()=>{o(!1)}))}else i([])});I.useEffect(()=>{e&&u()},[e==null?void 0:e.conditionData,e==null?void 0:e.statisticalMethod,e==null?void 0:e.statisticalType,e==null?void 0:e.field,e==null?void 0:e.dataSourceId,l]);const{formatCurrency:f}=dn(),c=Tt(f),d=I.useMemo(()=>{var _,w,x,S,E;if(!n)return"";const p=n,{statisticalMethod:m,statisticalType:y,field:b}=e||{};let C=0;if(p.length&&m==="fieldValue"&&b)switch(y){case"sum":C=((_=p==null?void 0:p[0])==null?void 0:_.sum)||0;break;case"max":C=((w=p==null?void 0:p[0])==null?void 0:w.max)||0;break;case"min":C=((x=p==null?void 0:p[0])==null?void 0:x.min)||0;break;case"avg":C=((S=p==null?void 0:p[0])==null?void 0:S.avg)||0;break;default:C=0}else m==="recordTotal"&&(C=((E=p==null?void 0:p[0])==null?void 0:E.count)||0);if(r!=null&&r.unit){const{unit:T,precision:A}=r;switch(`${T}`){case"4":case"5":case"6":case"7":case"8":case"9":C=(c==null?void 0:c(C,A))??C;break;case"1":C=b_(C,A);break;case"3":C=sfe(C,A);break;default:C=b_(C,A)}}else C=b_(C,r==null?void 0:r.precision);return C},[n,e,r]),h=I.useRef(),v=Em(h),g=I.useMemo(()=>{if(!v)return null;let p=0,m=32,y=0,b=0;p=y_(v.width,{ranges:[[116,16],[760,56]],step:4}),p=Math.max(16,Math.min(72,p));let C=v.width-p*2,_=v.height-m*2;{y=y_(C,{ranges:[[400,60],[500,64]],step:.1});const w=16,x=Math.min(72,_/2);y=Math.max(w,Math.min(x,y))}{b=y_(_,{ranges:[[140,12],[500,24],[860,36]],step:.1});const w=12,x=Math.min(36,_/2);b=Math.max(w,Math.min(x,b))}return{PX:p,PY:m,fontSize:y,subFontSize:b}},[v]);return D.jsxs("div",{ref:h,style:{display:"flex",height:"100%",width:"100%"},children:[a?D.jsx(K.Spin,{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",background:"rgba(255,255,255,0.6)",top:0,left:0,right:0,bottom:0,zIndex:1e3},spinning:a}):null,D.jsxs("div",{style:{overflow:"hidden",position:"relative",flex:1,display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",padding:`${g==null?void 0:g.PY}px ${g==null?void 0:g.PX}px`},children:[d!==""&&D.jsx("div",{style:{width:"100%",position:"relative",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"center"},children:D.jsx("span",{style:{fontWeight:"bold",lineHeight:`${g==null?void 0:g.fontSize}px`,fontSize:`${g==null?void 0:g.fontSize}px`,color:r==null?void 0:r.color},children:d})}),(r==null?void 0:r.desc)!==""&&D.jsx("div",{style:{width:"100%",position:"relative",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"center"},children:D.jsx("span",{style:{fontSize:`${g==null?void 0:g.subFontSize}px`,lineHeight:`${g==null?void 0:g.subFontSize}px`,color:r==null?void 0:r.color,textAlign:"center"},children:r==null?void 0:r.desc})})]})]})},tN=I.memo(lfe),ufe=({selectModuleData:t,onAllValuesChange:e,enumDataApi:r})=>{const{globalData:n}=dn(),{t:i}=At(),[a,o]=I.useState(),[s,l]=I.useState(),u=_=>{var x,S;const w=(S=(x=n==null?void 0:n.sourceData)==null?void 0:x.find(E=>E.value===_))==null?void 0:S.fields;o(w),l(w==null?void 0:w.filter(E=>E.type==="int"||E.type==="float"))},[f]=K.Form.useForm(),c={dataSourceId:"",statisticalMethod:"recordTotal",field:""},d=()=>{setTimeout(()=>{e==null||e({...f.getFieldsValue(),conditionData:g.current})})},[h,v]=I.useState(!1),g=I.useRef(),[p,m]=I.useState({conditionList:[],conditionType:"all"}),[y,b]=I.useState(0),C=_=>{var w;m(_),g.current=_,b(((w=_==null?void 0:_.conditionList)==null?void 0:w.length)||0)};return I.useEffect(()=>{var _,w;if(t!=null&&t.customData){const x=t.customData;f.setFieldsValue(x),u(x==null?void 0:x.dataSourceId)}else{const x=(_=n==null?void 0:n.sourceData)==null?void 0:_[0];f.setFieldsValue({...c,dataSourceId:x==null?void 0:x.value}),u(x==null?void 0:x.value),d()}C((w=t==null?void 0:t.customData)==null?void 0:w.conditionData)},[t,n]),D.jsxs(D.Fragment,{children:[D.jsxs(K.Form,{form:f,name:"customData",layout:"vertical",initialValues:c,children:[D.jsx(K.Form.Item,{label:i("dataSource"),name:"dataSourceId",children:D.jsx(K.Select,{options:n==null?void 0:n.sourceData,onChange:_=>{f.setFieldsValue({statisticalMethod:"recordTotal"}),u(_),d(),C({conditionList:[],conditionType:"all"})}})}),D.jsxs(K.Form.Item,{label:i("dataRange"),children:[D.jsx(K.Button,{style:{marginLeft:"-15px"},onClick:()=>{v(!0)},type:"link",children:i("filterData")}),y>0?`${i("selectNcondition",{n:y})}`:null]}),D.jsx(K.Divider,{style:{borderColor:"#e2e2e2",marginTop:0}}),D.jsx(K.Form.Item,{label:i("statisticstMethods"),name:"statisticalMethod",children:D.jsx(K.Select,{onChange:_=>{f.setFieldsValue({field:_==="fieldValue"?s==null?void 0:s[0].value:"",statisticalType:"sum"}),d()},options:[{value:"recordTotal",label:i("statisticstRecordNum")},{value:"fieldValue",label:i("statisticstFieldVal")}]})}),D.jsx(K.Form.Item,{dependencies:["statisticalMethod"],children:({getFieldValue:_})=>_("statisticalMethod")==="fieldValue"?D.jsx(K.Form.Item,{label:i("selectField"),children:D.jsxs(K.Space.Compact,{children:[D.jsx(K.Form.Item,{noStyle:!0,name:"field",children:D.jsx(K.Select,{style:{width:"100px"},dropdownStyle:{width:250},onChange:()=>{d()},options:s})}),D.jsx(K.Form.Item,{name:"statisticalType",noStyle:!0,children:D.jsx(K.Select,{style:{width:"100px"},dropdownStyle:{width:180},onChange:()=>{d()},options:[{value:"sum",label:i("sumVal")},{value:"max",label:i("maxVal")},{value:"min",label:i("minVal")},{value:"avg",label:i("averageVal")}]})})]})}):null})]}),D.jsx(V0,{open:h,value:p,fieldOptions:a,enumDataApi:r,onClose:()=>{v(!1)},onOk:_=>{C(_),d()}})]})},ffe=({value:t,onChange:e})=>{const[r,n]=I.useState(),i=["#373c43","#3370ff","#4954e6","#34c724","#14c0ff","#ffc60a","#f80","#f76964"];return I.useEffect(()=>{n(t)},[t]),D.jsx("div",{className:"pane-item-body item-body-column",children:D.jsx("div",{className:"panel-single-color-selector",children:i.map((a,o)=>D.jsxs("div",{className:"panel-single-color-selector-color-item",onClick:()=>{n(a),e==null||e(a)},children:[D.jsx("div",{className:"panel-single-color-selector-color-item-background",style:{background:a}}),r===a?D.jsx("span",{className:"panel-icon",children:D.jsx(qw,{})}):null]},o))})})},cfe=({selectModuleData:t,onAllValuesChange:e})=>{const[r]=K.Form.useForm(),{t:n,i18n:i}=At(),a=I.useMemo(()=>[{value:"1",label:n("statistics.t5")},{value:"2",label:n("statistics.t6")},{value:"3",label:n("statistics.t7")},{value:"9",label:n("statistics.currency")}],[i.language]),o={color:"#373c43",unit:"1",precision:"",desc:""},s=()=>{setTimeout(()=>{e==null||e(r.getFieldsValue())})};return I.useEffect(()=>{if(t!=null&&t.customeStyle){`${t.customeStyle.unit??o.unit}`;let l={...o,...t.customeStyle,unit:`${t.customeStyle.unit??o.unit}`};r.setFieldsValue(l)}else r.setFieldsValue(o)},[t]),D.jsxs(K.Form,{form:r,name:"customeStyle",layout:"vertical",initialValues:o,children:[D.jsx(K.Form.Item,{label:n("statistics.t1"),name:"color",children:D.jsx(ffe,{onChange:()=>{s()}})}),D.jsx(K.Form.Item,{label:n("statistics.t2"),extra:n("statistics.t3"),children:D.jsxs(K.Space.Compact,{children:[D.jsx(K.Form.Item,{name:"precision",noStyle:!0,children:D.jsx(K.InputNumber,{min:1,max:10,style:{width:"60%"},placeholder:n("statistics.t4"),onChange:()=>{s()}})}),D.jsx(K.Form.Item,{name:"unit",noStyle:!0,children:D.jsx(K.Select,{onChange:()=>{s()},children:a.map(l=>{const{value:u,label:f}=l;return D.jsx(K.Select.Option,{value:u,children:f},u)})})})]})}),D.jsx(K.Form.Item,{label:n("statistics.t10"),name:"desc",children:D.jsx(Yn,{onChange:()=>{s()}})})]})},dfe=({open:t,onClose:e,onOk:r,moduleDataApi:n,selectModuleData:i,enumDataApi:a})=>{const{t:o}=At(),[s,l]=I.useState(),[u,f]=I.useState();I.useEffect(()=>{i&&(l(i==null?void 0:i.customData),f(i==null?void 0:i.customeStyle))},[i]);const[c,d]=I.useState("");return I.useEffect(()=>{t&&d(i!=null&&i.title?i==null?void 0:i.title:o("statisticsText"))},[t]),D.jsx(D.Fragment,{children:D.jsx(K.Modal,{width:"65%",title:D.jsx(Dd,{value:c,onChange:d}),footer:null,open:t,onCancel:e,closeIcon:D.jsx(zc,{}),className:"ow-modal ow-modal-2",children:D.jsxs("div",{className:"config-widget-dialog-container",children:[D.jsx("div",{className:"config-widget-dialog-content",children:D.jsx("div",{className:"config-widget-dialog-preview",children:D.jsx(tN,{customData:s,customeStyle:u,moduleDataApi:n})})}),D.jsxs("div",{className:"config-widget-dialog-panel",children:[D.jsx("div",{className:"bitable-dashboard edit-panel-container",children:D.jsx(K.Tabs,{defaultActiveKey:"1",items:[{key:"1",label:o("typeData"),children:D.jsx(ufe,{selectModuleData:i,enumDataApi:a,onAllValuesChange:h=>{l(h)}})},{key:"2",label:o("customStyle"),children:D.jsx(cfe,{selectModuleData:i,onAllValuesChange:h=>{f(h)}})}]})}),D.jsx("div",{className:"button-container",children:D.jsx(K.Button,{type:"primary",onClick:()=>{r==null||r({id:i==null?void 0:i.id,customData:s,customeStyle:u,title:c})},children:o("confirm")})})]})]})})})},hfe=t=>D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",...t,children:[D.jsx("g",{clipPath:"url(#a)",children:D.jsx("path",{fill:"#000",fillRule:"evenodd",d:"M3 2.666a.167.167 0 0 0-.166.167v1.634c0 .057.03.11.077.14l3.05 1.94c.336.215.54.586.54.985v4.634a.5.5 0 1 1-1 0V7.532c0-.057-.03-.11-.078-.14L2.374 5.45a1.167 1.167 0 0 1-.54-.984V2.833c0-.645.522-1.167 1.167-1.167h10c.644 0 1.166.522 1.166 1.167v1.634c0 .399-.204.77-.54.984l-3.05 1.94a.167.167 0 0 0-.076.141v6.3a.5.5 0 0 1-1 0v-6.3c0-.399.203-.77.54-.984l3.05-1.94a.167.167 0 0 0 .076-.141V2.833a.167.167 0 0 0-.166-.167H3Z",clipRule:"evenodd"})}),D.jsx("defs",{children:D.jsx("clipPath",{id:"a",children:D.jsx("path",{fill:"#fff",d:"M0 0h16v16H0z"})})})]}),rN=I.createContext({}),C_=()=>I.useContext(rN),Bp=(t,e)=>`${t}-${e}`,vfe=t=>{var l,u;const{t:e}=At(),{fieldPickerDataSource:r,flattenFieldMap:n}=C_(),[i,a]=Ao(t),o=Tt(f=>{const[c,d]=f.keyPath;let h=c==null?void 0:c.replace(`${d}-`,"");h&&a({dataSourceId:d,field:h})}),s=I.useMemo(()=>{{let f=Bp(i==null?void 0:i.dataSourceId,i==null?void 0:i.field);return n==null?void 0:n.get(f)}},[i,n]);return D.jsx(K.Dropdown,{trigger:["click"],menu:{selectable:!0,selectedKeys:s?[(l=s==null?void 0:s.source)==null?void 0:l.value,s==null?void 0:s.mergeId]:[],items:r,onClick:o},children:D.jsx(K.Select,{open:!1,placeholder:e("selectGroupField"),style:{width:200},value:((u=s==null?void 0:s.field)==null?void 0:u.label)??void 0})})},__=t=>{const[e,r]=Ao(t),n=I.useMemo(()=>e!=null&&e.field?{dataSourceId:e==null?void 0:e.dataSourceId,field:e==null?void 0:e.field}:void 0,[e==null?void 0:e.field,e==null?void 0:e.dataSourceId]),i=u=>{var c;const f={condition:"=",val:"",val2:"",rdate:"exactdate"};if(u){let d=a==null?void 0:a.get(Bp(u.dataSourceId,u.field));r({...f,dataSourceId:u.dataSourceId,field:u.field,type:(c=d==null?void 0:d.field)==null?void 0:c.type})}else r({...f,dataSourceId:void 0,field:void 0,type:void 0})},{flattenFieldMap:a}=C_(),o=a==null?void 0:a.get(Bp(e==null?void 0:e.dataSourceId,e==null?void 0:e.field)),s=qS(e,["field"]),l=Tt(u=>r({...e,...u}));return D.jsxs("div",{style:{display:"flex",gap:"10px"},children:[D.jsx(vfe,{value:n,onChange:i}),D.jsx(IT,{value:s,onChange:l,field:o==null?void 0:o.field}),D.jsx(Cg,{style:{cursor:"pointer"},onClick:t.onDelete})]})};__.displayName="ConditionRowItem";const wc={"global-filter-condition__popover":"_global-filter-condition__popover_qw1om_1","global-filter-condition__block":"_global-filter-condition__block_qw1om_4","sub-popup":"_sub-popup_qw1om_10"},Ip="global-filter-condition",pfe=[],nN=t=>{const{className:e,style:r}=t,{t:n}=At(),{globalFilterCondition:i,setGlobalFilterCondition:a}=dn(),[o,s]=I.useState(!1),{globalData:l}=dn(),{fieldPickerDataSource:u,flattenFieldMap:f}=I.useMemo(()=>{let c=new Map;return{fieldPickerDataSource:((l==null?void 0:l.sourceData)||[]).map(h=>{let v=((h==null?void 0:h.fields)||[]).map(g=>{let p=Bp(h==null?void 0:h.value,g==null?void 0:g.value);return c.set(p,{field:g,source:h,mergeId:p}),{key:p,label:g==null?void 0:g.label,disabled:g.disabled??!1}});return{key:h==null?void 0:h.value,label:h==null?void 0:h.label,children:v,popupClassName:wc["sub-popup"]}}),flattenFieldMap:c}},[l==null?void 0:l.sourceData]);return D.jsx(rN.Provider,{value:{fieldPickerDataSource:u,flattenFieldMap:f},children:D.jsx("div",{className:fn(wc[`${Ip}`],e),style:r,children:D.jsx(K.Popover,{content:D.jsx(gfe,{defaultValue:i,onClose:(c,d)=>{c&&a(d),s(!1)}}),destroyTooltipOnHide:!0,placement:"bottomRight",trigger:"click",open:o,onOpenChange:s,children:D.jsx(K.Button,{className:`!px-1 ${((i==null?void 0:i.length)??0)>0?"!bg-primary/10":""}`,type:"text",icon:D.jsx(hfe,{}),children:n("globalfilter")})})})})};nN.displayName="GlobalFilterCondition";const gfe=t=>{const{defaultValue:e}=t,{t:r}=At(),n=C_().fieldPickerDataSource,i=RT(),[a=pfe,o]=I.useState([]);I.useEffect(()=>{e&&o(NV(e))},[e]);const[s,l]=I.useState([]),u=h=>{h!=null&&h.field&&o(v=>{let g=[...v],p=g.find(m=>m.dataSourceId===h.dataSourceId);if(p)return p.conditionList.push(h),[...g];{let m={dataSourceId:h.dataSourceId,conditionType:"all",conditionList:[h]};return[...g,m]}})},f=()=>{l([...s,{}])},c=I.useMemo(()=>!GS(a,e),[a,e]),d=Tt(()=>{var h;(h=t==null?void 0:t.onClose)==null||h.call(t,!0,a)});return D.jsxs("div",{className:fn(wc[`${Ip}__popover`]),children:[D.jsx("div",{style:{marginBottom:"10px"},children:r("setFilterCondition")}),a.map((h,v)=>{var m;let g=h==null?void 0:h.conditionList,p=(m=n==null?void 0:n.find(y=>y.key===(h==null?void 0:h.dataSourceId)))==null?void 0:m.label;return console.log("dataSourceName",p),D.jsxs("div",{className:fn(wc[`${Ip}__block`]),children:[D.jsxs("div",{style:{marginBottom:"10px",display:"flex",justifyContent:"space-between"},children:[D.jsx("div",{children:p}),D.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[r("conformTo"),D.jsx(K.Select,{style:{width:"80px"},options:i,value:h==null?void 0:h.conditionType,onChange:y=>{o(b=>{let C=[...b];return C[v].conditionType=y,C})}}),r("addCondition")]})]}),D.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:g.map((y,b)=>D.jsx(__,{value:y,onChange:C=>{o(_=>{let w=[..._],x=w[v].conditionList[b];if((x==null?void 0:x.dataSourceId)!==(C==null?void 0:C.dataSourceId)){w[v].conditionList.splice(b,1),w[v].conditionList.length===0&&w.splice(v,1);let S=C,E=w.find(T=>T.dataSourceId===S.dataSourceId);if(E)return E.conditionList.push(S),[...w];{let T={dataSourceId:S.dataSourceId,conditionType:"all",conditionList:[S]};return[...w,T]}}else w[v].conditionList[b]={...x,...C};return w})},onDelete:()=>{o(C=>{let _=[...C];return _[v].conditionList.splice(b,1),_[v].conditionList.length===0&&_.splice(v,1),_})}},b))})]},h==null?void 0:h.dataSourceId)}),s.map((h,v)=>D.jsx("div",{className:fn(wc[`${Ip}__block`]),children:D.jsx(__,{value:h,onChange:g=>{u(g)},onDelete:()=>{l(g=>{let p=[...g];return p.splice(v,1),p})}})},v)),D.jsx(K.Button,{type:"dashed",block:!0,style:{marginBottom:"10px"},icon:D.jsx(Hc,{}),onClick:()=>{f()},children:r("addCondition")}),D.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:D.jsx(K.Button,{type:"primary",disabled:!c,onClick:()=>{d()},children:r("confirm")})})]})};/*!
|
|
163
|
+
`)),nt(n)),a.push({dimIdx:m.index,parser:y,comparator:new rR(d,v)})});var o=e.sourceFormat;o!==yr&&o!==mn&&(process.env.NODE_ENV!=="production"&&(n='sourceFormat "'+o+'" is not supported yet'),nt(n));for(var s=[],l=0,u=e.count();l<u;l++)s.push(e.getRawDataItem(l));return s.sort(function(f,c){for(var d=0;d<a.length;d++){var h=a[d],v=e.retrieveValueFromItem(f,h.dimIdx),g=e.retrieveValueFromItem(c,h.dimIdx);h.parser&&(v=h.parser(v),g=h.parser(g));var p=h.comparator.evaluate(v,g);if(p!==0)return p}return 0}),{data:s}}};function tue(t){t.registerTransform(Jle),t.registerTransform(eue)}var rue=function(t){he(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dataset",r}return e.prototype.init=function(r,n,i){t.prototype.init.call(this,r,n,i),this._sourceManager=new HR(this),VR(this)},e.prototype.mergeOption=function(r,n){t.prototype.mergeOption.call(this,r,n),VR(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:Kn},e}(ot),nue=function(t){he(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dataset",r}return e.type="dataset",e}(yn);function iue(t){t.registerComponentModel(rue),t.registerComponentView(nue)}function aue(t){if(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].slice());return e}}function oue(t,e){var r=t.label,n=e&&e.getTextGuideLine();return{dataIndex:t.dataIndex,dataType:t.dataType,seriesIndex:t.seriesModel.seriesIndex,text:t.label.style.text,rect:t.hostRect,labelRect:t.rect,align:r.style.align,verticalAlign:r.style.verticalAlign,labelLinePoints:aue(n&&n.shape.points)}}var D8=["align","verticalAlign","width","height","fontSize"],zr=new hf,s_=dt(),sue=dt();function Sp(t,e,r){for(var n=0;n<r.length;n++){var i=r[n];e[i]!=null&&(t[i]=e[i])}}var Ep=["x","y","rotation"],lue=function(){function t(){this._labelList=[],this._chartViewList=[]}return t.prototype.clearLabels=function(){this._labelList=[],this._chartViewList=[]},t.prototype._addLabel=function(e,r,n,i,a){var o=i.style,s=i.__hostTarget,l=s.textConfig||{},u=i.getComputedTransform(),f=i.getBoundingRect().plain();ke.applyTransform(f,f,u),u?zr.setLocalTransform(u):(zr.x=zr.y=zr.rotation=zr.originX=zr.originY=0,zr.scaleX=zr.scaleY=1),zr.rotation=ta(zr.rotation);var c=i.__hostTarget,d;if(c){d=c.getBoundingRect().plain();var h=c.getComputedTransform();ke.applyTransform(d,d,h)}var v=d&&c.getTextGuideLine();this._labelList.push({label:i,labelLine:v,seriesModel:n,dataIndex:e,dataType:r,layoutOptionOrCb:a,layoutOption:null,rect:f,hostRect:d,priority:d?d.width*d.height:0,defaultAttr:{ignore:i.ignore,labelGuideIgnore:v&&v.ignore,x:zr.x,y:zr.y,scaleX:zr.scaleX,scaleY:zr.scaleY,rotation:zr.rotation,style:{x:o.x,y:o.y,align:o.align,verticalAlign:o.verticalAlign,width:o.width,height:o.height,fontSize:o.fontSize},cursor:i.cursor,attachedPos:l.position,attachedRot:l.rotation}})},t.prototype.addLabelsOfSeries=function(e){var r=this;this._chartViewList.push(e);var n=e.__model,i=n.get("labelLayout");(Pe(i)||rt(i).length)&&e.group.traverse(function(a){if(a.ignore)return!0;var o=a.getTextContent(),s=Xe(a);o&&!o.disableLabelLayout&&r._addLabel(s.dataIndex,s.dataType,n,o,i)})},t.prototype.updateLayoutConfig=function(e){var r=e.getWidth(),n=e.getHeight();function i(b,C){return function(){VP(b,C)}}for(var a=0;a<this._labelList.length;a++){var o=this._labelList[a],s=o.label,l=s.__hostTarget,u=o.defaultAttr,f=void 0;Pe(o.layoutOptionOrCb)?f=o.layoutOptionOrCb(oue(o,l)):f=o.layoutOptionOrCb,f=f||{},o.layoutOption=f;var c=Math.PI/180;l&&l.setTextConfig({local:!1,position:f.x!=null||f.y!=null?null:u.attachedPos,rotation:f.rotate!=null?f.rotate*c:u.attachedRot,offset:[f.dx||0,f.dy||0]});var d=!1;if(f.x!=null?(s.x=Dt(f.x,r),s.setStyle("x",0),d=!0):(s.x=u.x,s.setStyle("x",u.style.x)),f.y!=null?(s.y=Dt(f.y,n),s.setStyle("y",0),d=!0):(s.y=u.y,s.setStyle("y",u.style.y)),f.labelLinePoints){var h=l.getTextGuideLine();h&&(h.setShape({points:f.labelLinePoints}),d=!1)}var v=s_(s);v.needsUpdateLabelLine=d,s.rotation=f.rotate!=null?f.rotate*c:u.rotation,s.scaleX=u.scaleX,s.scaleY=u.scaleY;for(var g=0;g<D8.length;g++){var p=D8[g];s.setStyle(p,f[p]!=null?f[p]:u.style[p])}if(f.draggable){if(s.draggable=!0,s.cursor="move",l){var m=o.seriesModel;if(o.dataIndex!=null){var y=o.seriesModel.getData(o.dataType);m=y.getItemModel(o.dataIndex)}s.on("drag",i(l,m.getModel("labelLine")))}}else s.off("drag"),s.cursor=u.cursor}},t.prototype.layout=function(e){var r=e.getWidth(),n=e.getHeight(),i=[];z(this._labelList,function(l){l.defaultAttr.ignore||i.push(I1({},l))});var a=Bt(i,function(l){return l.layoutOption.moveOverlap==="shiftX"}),o=Bt(i,function(l){return l.layoutOption.moveOverlap==="shiftY"});N1(a,0,0,r),N1(o,1,0,n);var s=Bt(i,function(l){return l.layoutOption.hideOverlap});cne(s),KP(s)},t.prototype.processLabelsOverall=function(){var e=this;z(this._chartViewList,function(r){var n=r.__model,i=r.ignoreLabelLineUpdate,a=n.isAnimationEnabled();r.group.traverse(function(o){if(o.ignore&&!o.forceLabelAnimation)return!0;var s=!i,l=o.getTextContent();!s&&l&&(s=s_(l).needsUpdateLabelLine),s&&e._updateLabelLine(o,n),a&&e._animateLabels(o,n)})})},t.prototype._updateLabelLine=function(e,r){var n=e.getTextContent(),i=Xe(e),a=i.dataIndex;if(n&&a!=null){var o=r.getData(i.dataType),s=o.getItemModel(a),l={},u=o.getItemVisual(a,"style");if(u){var f=o.getVisual("drawType");l.stroke=u[f]}var c=s.getModel("labelLine");$P(e,GP(s),l),VP(e,c)}},t.prototype._animateLabels=function(e,r){var n=e.getTextContent(),i=e.getTextGuideLine();if(n&&(e.forceLabelAnimation||!n.ignore&&!n.invisible&&!e.disableLabelAnimation&&!Ll(e))){var a=s_(n),o=a.oldLayout,s=Xe(e),l=s.dataIndex,u={x:n.x,y:n.y,rotation:n.rotation},f=r.getData(s.dataType);if(o){n.attr(o);var d=e.prevStates;d&&(Ke(d,"select")>=0&&n.attr(a.oldLayoutSelect),Ke(d,"emphasis")>=0&&n.attr(a.oldLayoutEmphasis)),sr(n,u,r,l)}else if(n.attr(u),!kl(n).valueAnimation){var c=Ae(n.style.opacity,1);n.style.opacity=0,Or(n,{style:{opacity:c}},r,l)}if(a.oldLayout=u,n.states.select){var h=a.oldLayoutSelect={};Sp(h,u,Ep),Sp(h,n.states.select,Ep)}if(n.states.emphasis){var v=a.oldLayoutEmphasis={};Sp(v,u,Ep),Sp(v,n.states.emphasis,Ep)}LJ(n,l,f,r,r)}if(i&&!i.ignore&&!i.invisible){var a=sue(i),o=a.oldLayout,g={points:i.shape.points};o?(i.attr({shape:o}),sr(i,{shape:g},r)):(i.setShape(g),i.style.strokePercent=0,Or(i,{style:{strokePercent:1}},r)),a.oldLayout=g}},t}(),l_=dt();function uue(t){t.registerUpdateLifecycle("series:beforeupdate",function(e,r,n){var i=l_(r).labelManager;i||(i=l_(r).labelManager=new lue),i.clearLabels()}),t.registerUpdateLifecycle("series:layoutlabels",function(e,r,n){var i=l_(r).labelManager;n.updatedSeries.forEach(function(a){i.addLabelsOfSeries(r.getViewOfSeriesModel(a))}),i.updateLayoutConfig(r),i.layout(r),i.processLabelsOverall()})}var Li=ea.CMD;function su(t,e){return Math.abs(t-e)<1e-5}function u_(t){var e=t.data,r=t.len(),n=[],i,a=0,o=0,s=0,l=0;function u(O,P){i&&i.length>2&&n.push(i),i=[O,P]}function f(O,P,N,k){su(O,N)&&su(P,k)||i.push(O,P,N,k,N,k)}function c(O,P,N,k,F,j){var W=Math.abs(P-O),B=Math.tan(W/4)*4/3,H=P<O?-1:1,Y=Math.cos(O),q=Math.sin(O),te=Math.cos(P),ee=Math.sin(P),V=Y*F+N,J=q*j+k,L=te*F+N,$=ee*j+k,Q=F*B*H,Z=j*B*H;i.push(V-Q*q,J+Z*Y,L+Q*ee,$-Z*te,L,$)}for(var d,h,v,g,p=0;p<r;){var m=e[p++],y=p===1;switch(y&&(a=e[p],o=e[p+1],s=a,l=o,(m===Li.L||m===Li.C||m===Li.Q)&&(i=[s,l])),m){case Li.M:a=s=e[p++],o=l=e[p++],u(s,l);break;case Li.L:d=e[p++],h=e[p++],f(a,o,d,h),a=d,o=h;break;case Li.C:i.push(e[p++],e[p++],e[p++],e[p++],a=e[p++],o=e[p++]);break;case Li.Q:d=e[p++],h=e[p++],v=e[p++],g=e[p++],i.push(a+2/3*(d-a),o+2/3*(h-o),v+2/3*(d-v),g+2/3*(h-g),v,g),a=v,o=g;break;case Li.A:var b=e[p++],C=e[p++],_=e[p++],w=e[p++],x=e[p++],S=e[p++]+x;p+=1;var E=!e[p++];d=Math.cos(x)*_+b,h=Math.sin(x)*w+C,y?(s=d,l=h,u(s,l)):f(a,o,d,h),a=Math.cos(S)*_+b,o=Math.sin(S)*w+C;for(var T=(E?-1:1)*Math.PI/2,A=x;E?A>S:A<S;A+=T){var M=E?Math.max(A+T,S):Math.min(A+T,S);c(A,M,b,C,_,w)}break;case Li.R:s=a=e[p++],l=o=e[p++],d=s+e[p++],h=l+e[p++],u(d,l),f(d,l,d,h),f(d,h,s,h),f(s,h,s,l),f(s,l,d,l);break;case Li.Z:i&&f(a,o,s,l),a=s,o=l;break}}return i&&i.length>2&&n.push(i),n}function f_(t,e,r,n,i,a,o,s,l,u){if(su(t,r)&&su(e,n)&&su(i,o)&&su(a,s)){l.push(o,s);return}var f=2/u,c=f*f,d=o-t,h=s-e,v=Math.sqrt(d*d+h*h);d/=v,h/=v;var g=r-t,p=n-e,m=i-o,y=a-s,b=g*g+p*p,C=m*m+y*y;if(b<c&&C<c){l.push(o,s);return}var _=d*g+h*p,w=-d*m-h*y,x=b-_*_,S=C-w*w;if(x<c&&_>=0&&S<c&&w>=0){l.push(o,s);return}var E=[],T=[];Na(t,r,i,o,.5,E),Na(e,n,a,s,.5,T),f_(E[0],T[0],E[1],T[1],E[2],T[2],E[3],T[3],l,u),f_(E[4],T[4],E[5],T[5],E[6],T[6],E[7],T[7],l,u)}function fue(t,e){var r=u_(t),n=[];e=e||1;for(var i=0;i<r.length;i++){var a=r[i],o=[],s=a[0],l=a[1];o.push(s,l);for(var u=2;u<a.length;){var f=a[u++],c=a[u++],d=a[u++],h=a[u++],v=a[u++],g=a[u++];f_(s,l,f,c,d,h,v,g,o,e),s=v,l=g}n.push(o)}return n}function S8(t,e,r){var n=t[e],i=t[1-e],a=Math.abs(n/i),o=Math.ceil(Math.sqrt(a*r)),s=Math.floor(r/o);s===0&&(s=1,o=r);for(var l=[],u=0;u<o;u++)l.push(s);var f=o*s,c=r-f;if(c>0)for(var u=0;u<c;u++)l[u%o]+=1;return l}function E8(t,e,r){for(var n=t.r0,i=t.r,a=t.startAngle,o=t.endAngle,s=Math.abs(o-a),l=s*i,u=i-n,f=l>Math.abs(u),c=S8([l,u],f?0:1,e),d=(f?s:u)/c.length,h=0;h<c.length;h++)for(var v=(f?u:s)/c[h],g=0;g<c[h];g++){var p={};f?(p.startAngle=a+d*h,p.endAngle=a+d*(h+1),p.r0=n+v*g,p.r=n+v*(g+1)):(p.startAngle=a+v*g,p.endAngle=a+v*(g+1),p.r0=n+d*h,p.r=n+d*(h+1)),p.clockwise=t.clockwise,p.cx=t.cx,p.cy=t.cy,r.push(p)}}function cue(t,e,r){for(var n=t.width,i=t.height,a=n>i,o=S8([n,i],a?0:1,e),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",f=a?"y":"x",c=t[s]/o.length,d=0;d<o.length;d++)for(var h=t[l]/o[d],v=0;v<o[d];v++){var g={};g[u]=d*c,g[f]=v*h,g[s]=c,g[l]=h,g.x+=t.x,g.y+=t.y,r.push(g)}}function A8(t,e,r,n){return t*n-r*e}function due(t,e,r,n,i,a,o,s){var l=r-t,u=n-e,f=o-i,c=s-a,d=A8(f,c,l,u);if(Math.abs(d)<1e-6)return null;var h=t-i,v=e-a,g=A8(h,v,f,c)/d;return g<0||g>1?null:new Re(g*l+t,g*u+e)}function hue(t,e,r){var n=new Re;Re.sub(n,r,e),n.normalize();var i=new Re;Re.sub(i,t,e);var a=i.dot(n);return a}function lu(t,e){var r=t[t.length-1];r&&r[0]===e[0]&&r[1]===e[1]||t.push(e)}function vue(t,e,r){for(var n=t.length,i=[],a=0;a<n;a++){var o=t[a],s=t[(a+1)%n],l=due(o[0],o[1],s[0],s[1],e.x,e.y,r.x,r.y);l&&i.push({projPt:hue(l,e,r),pt:l,idx:a})}if(i.length<2)return[{points:t},{points:t}];i.sort(function(p,m){return p.projPt-m.projPt});var u=i[0],f=i[i.length-1];if(f.idx<u.idx){var c=u;u=f,f=c}for(var d=[u.pt.x,u.pt.y],h=[f.pt.x,f.pt.y],v=[d],g=[h],a=u.idx+1;a<=f.idx;a++)lu(v,t[a].slice());lu(v,h),lu(v,d);for(var a=f.idx+1;a<=u.idx+n;a++)lu(g,t[a%n].slice());return lu(g,d),lu(g,h),[{points:v},{points:g}]}function T8(t){var e=t.points,r=[],n=[];K2(e,r,n);var i=new ke(r[0],r[1],n[0]-r[0],n[1]-r[1]),a=i.width,o=i.height,s=i.x,l=i.y,u=new Re,f=new Re;return a>o?(u.x=f.x=s+a/2,u.y=l,f.y=l+o):(u.y=f.y=l+o/2,u.x=s,f.x=s+a),vue(e,u,f)}function Ap(t,e,r,n){if(r===1)n.push(e);else{var i=Math.floor(r/2),a=t(e);Ap(t,a[0],i,n),Ap(t,a[1],r-i,n)}return n}function pue(t,e){for(var r=[],n=0;n<e;n++)r.push(hb(t));return r}function gue(t,e){e.setStyle(t.style),e.z=t.z,e.z2=t.z2,e.zlevel=t.zlevel}function mue(t){for(var e=[],r=0;r<t.length;)e.push([t[r++],t[r++]]);return e}function yue(t,e){var r=[],n=t.shape,i;switch(t.type){case"rect":cue(n,e,r),i=jt;break;case"sector":E8(n,e,r),i=Pi;break;case"circle":E8({r0:0,r:n.r,startAngle:0,endAngle:Math.PI*2,cx:n.cx,cy:n.cy},e,r),i=Pi;break;default:var a=t.getComputedTransform(),o=a?Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1],a[2]*a[2]+a[3]*a[3])):1,s=Ce(fue(t.getUpdatedPathProxy(),o),function(m){return mue(m)}),l=s.length;if(l===0)Ap(T8,{points:s[0]},e,r);else if(l===e)for(var u=0;u<l;u++)r.push({points:s[u]});else{var f=0,c=Ce(s,function(m){var y=[],b=[];K2(m,y,b);var C=(b[1]-y[1])*(b[0]-y[0]);return f+=C,{poly:m,area:C}});c.sort(function(m,y){return y.area-m.area});for(var d=e,u=0;u<l;u++){var h=c[u];if(d<=0)break;var v=u===l-1?d:Math.ceil(h.area/f*e);v<0||(Ap(T8,{points:h.poly},v,r),d-=v)}}i=rv;break}if(!i)return pue(t,e);for(var g=[],u=0;u<r.length;u++){var p=new i;p.setShape(r[u]),gue(t,p),g.push(p)}return g}function bue(t,e){var r=t.length,n=e.length;if(r===n)return[t,e];for(var i=[],a=[],o=r<n?t:e,s=Math.min(r,n),l=Math.abs(n-r)/6,u=(s-2)/6,f=Math.ceil(l/u)+1,c=[o[0],o[1]],d=l,h=2;h<s;){var v=o[h-2],g=o[h-1],p=o[h++],m=o[h++],y=o[h++],b=o[h++],C=o[h++],_=o[h++];if(d<=0){c.push(p,m,y,b,C,_);continue}for(var w=Math.min(d,f-1)+1,x=1;x<=w;x++){var S=x/w;Na(v,p,y,C,S,i),Na(g,m,b,_,S,a),v=i[3],g=a[3],c.push(i[1],a[1],i[2],a[2],v,g),p=i[5],m=a[5],y=i[6],b=a[6]}d-=w-1}return o===t?[c,e]:[t,c]}function O8(t,e){for(var r=t.length,n=t[r-2],i=t[r-1],a=[],o=0;o<e.length;)a[o++]=n,a[o++]=i;return a}function Cue(t,e){for(var r,n,i,a=[],o=[],s=0;s<Math.max(t.length,e.length);s++){var l=t[s],u=e[s],f=void 0,c=void 0;l?u?(r=bue(l,u),f=r[0],c=r[1],n=f,i=c):(c=O8(i||l,l),f=l):(f=O8(n||u,u),c=u),a.push(f),o.push(c)}return[a,o]}function M8(t){for(var e=0,r=0,n=0,i=t.length,a=0,o=i-2;a<i;o=a,a+=2){var s=t[o],l=t[o+1],u=t[a],f=t[a+1],c=s*f-u*l;e+=c,r+=(s+u)*c,n+=(l+f)*c}return e===0?[t[0]||0,t[1]||0]:[r/e/3,n/e/3,e]}function _ue(t,e,r,n){for(var i=(t.length-2)/6,a=1/0,o=0,s=t.length,l=s-2,u=0;u<i;u++){for(var f=u*6,c=0,d=0;d<s;d+=2){var h=d===0?f:(f+d-2)%l+2,v=t[h]-r[0],g=t[h+1]-r[1],p=e[d]-n[0],m=e[d+1]-n[1],y=p-v,b=m-g;c+=y*y+b*b}c<a&&(a=c,o=u)}return o}function wue(t){for(var e=[],r=t.length,n=0;n<r;n+=2)e[n]=t[r-n-2],e[n+1]=t[r-n-1];return e}function xue(t,e,r,n){for(var i=[],a,o=0;o<t.length;o++){var s=t[o],l=e[o],u=M8(s),f=M8(l);a==null&&(a=u[2]<0!=f[2]<0);var c=[],d=[],h=0,v=1/0,g=[],p=s.length;a&&(s=wue(s));for(var m=_ue(s,l,u,f)*6,y=p-2,b=0;b<y;b+=2){var C=(m+b)%y+2;c[b+2]=s[C]-u[0],c[b+3]=s[C+1]-u[1]}c[0]=s[m]-u[0],c[1]=s[m+1]-u[1];for(var _=n/r,w=-n/2;w<=n/2;w+=_){for(var x=Math.sin(w),S=Math.cos(w),E=0,b=0;b<s.length;b+=2){var T=c[b],A=c[b+1],M=l[b]-f[0],O=l[b+1]-f[1],P=M*S-O*x,N=M*x+O*S;g[b]=P,g[b+1]=N;var k=P-T,F=N-A;E+=k*k+F*F}if(E<v){v=E,h=w;for(var j=0;j<g.length;j++)d[j]=g[j]}}i.push({from:c,to:d,fromCp:u,toCp:f,rotation:-h})}return i}function Tp(t){return t.__isCombineMorphing}var R8="__mOriginal_";function Op(t,e,r){var n=R8+e,i=t[n]||t[e];t[n]||(t[n]=t[e]);var a=r.replace,o=r.after,s=r.before;t[e]=function(){var l=arguments,u;return s&&s.apply(this,l),a?u=a.apply(this,l):u=i.apply(this,l),o&&o.apply(this,l),u}}function _c(t,e){var r=R8+e;t[r]&&(t[e]=t[r],t[r]=null)}function P8(t,e){for(var r=0;r<t.length;r++)for(var n=t[r],i=0;i<n.length;){var a=n[i],o=n[i+1];n[i++]=e[0]*a+e[2]*o+e[4],n[i++]=e[1]*a+e[3]*o+e[5]}}function B8(t,e){var r=t.getUpdatedPathProxy(),n=e.getUpdatedPathProxy(),i=Cue(u_(r),u_(n)),a=i[0],o=i[1],s=t.getComputedTransform(),l=e.getComputedTransform();function u(){this.transform=null}s&&P8(a,s),l&&P8(o,l),Op(e,"updateTransform",{replace:u}),e.transform=null;var f=xue(a,o,10,Math.PI),c=[];Op(e,"buildPath",{replace:function(d){for(var h=e.__morphT,v=1-h,g=[],p=0;p<f.length;p++){var m=f[p],y=m.from,b=m.to,C=m.rotation*h,_=m.fromCp,w=m.toCp,x=Math.sin(C),S=Math.cos(C);mh(g,_,w,h);for(var E=0;E<y.length;E+=2){var T=y[E],A=y[E+1],M=b[E],O=b[E+1],P=T*v+M*h,N=A*v+O*h;c[E]=P*S-N*x+g[0],c[E+1]=P*x+N*S+g[1]}var k=c[0],F=c[1];d.moveTo(k,F);for(var E=2;E<y.length;){var M=c[E++],O=c[E++],j=c[E++],W=c[E++],B=c[E++],H=c[E++];k===M&&F===O&&j===B&&W===H?d.lineTo(B,H):d.bezierCurveTo(M,O,j,W,B,H),k=B,F=H}}}})}function c_(t,e,r){if(!t||!e)return e;var n=r.done,i=r.during;B8(t,e),e.__morphT=0;function a(){_c(e,"buildPath"),_c(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Ze({during:function(o){e.dirtyShape(),i&&i(o)},done:function(){a(),n&&n()}},r)),e}function Due(t,e,r,n,i,a){var o=16;t=i===r?0:Math.round(32767*(t-r)/(i-r)),e=a===n?0:Math.round(32767*(e-n)/(a-n));for(var s=0,l,u=(1<<o)/2;u>0;u/=2){var f=0,c=0;(t&u)>0&&(f=1),(e&u)>0&&(c=1),s+=u*u*(3*f^c),c===0&&(f===1&&(t=u-1-t,e=u-1-e),l=t,t=e,e=l)}return s}function Mp(t){var e=1/0,r=1/0,n=-1/0,i=-1/0,a=Ce(t,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),f=l.x+l.width/2+(u?u[4]:0),c=l.y+l.height/2+(u?u[5]:0);return e=Math.min(f,e),r=Math.min(c,r),n=Math.max(f,n),i=Math.max(c,i),[f,c]}),o=Ce(a,function(s,l){return{cp:s,z:Due(s[0],s[1],e,r,n,i),path:t[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function I8(t){return yue(t.path,t.count)}function d_(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Sue(t,e,r){var n=[];function i(_){for(var w=0;w<_.length;w++){var x=_[w];Tp(x)?i(x.childrenRef()):x instanceof Qe&&n.push(x)}}i(t);var a=n.length;if(!a)return d_();var o=r.dividePath||I8,s=o({path:e,count:a});if(s.length!==a)return console.error("Invalid morphing: unmatched splitted path"),d_();n=Mp(n),s=Mp(s);for(var l=r.done,u=r.during,f=r.individualDelay,c=new hf,d=0;d<a;d++){var h=n[d],v=s[d];v.parent=e,v.copyTransform(c),f||B8(h,v)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function g(_){for(var w=0;w<s.length;w++)s[w].addSelfToZr(_)}Op(e,"addSelfToZr",{after:function(_){g(_)}}),Op(e,"removeSelfFromZr",{after:function(_){for(var w=0;w<s.length;w++)s[w].removeSelfFromZr(_)}});function p(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,_c(e,"addSelfToZr"),_c(e,"removeSelfFromZr")}var m=s.length;if(f)for(var y=m,b=function(){y--,y===0&&(p(),l&&l())},d=0;d<m;d++){var C=f?Ze({delay:(r.delay||0)+f(d,m,n[d],s[d]),done:b},r):r;c_(n[d],s[d],C)}else e.__morphT=0,e.animateTo({__morphT:1},Ze({during:function(_){for(var w=0;w<m;w++){var x=s[w];x.__morphT=e.__morphT,x.dirtyShape()}u&&u(_)},done:function(){p();for(var _=0;_<t.length;_++)_c(t[_],"updateTransform");l&&l()}},r));return e.__zr&&g(e.__zr),{fromIndividuals:n,toIndividuals:s,count:m}}function Eue(t,e,r){var n=e.length,i=[],a=r.dividePath||I8;function o(h){for(var v=0;v<h.length;v++){var g=h[v];Tp(g)?o(g.childrenRef()):g instanceof Qe&&i.push(g)}}if(Tp(t)){o(t.childrenRef());var s=i.length;if(s<n)for(var l=0,u=s;u<n;u++)i.push(hb(i[l++%s]));i.length=n}else{i=a({path:t,count:n});for(var f=t.getComputedTransform(),u=0;u<i.length;u++)i[u].setLocalTransform(f);if(i.length!==n)return console.error("Invalid morphing: unmatched splitted path"),d_()}i=Mp(i),e=Mp(e);for(var c=r.individualDelay,u=0;u<n;u++){var d=c?Ze({delay:(r.delay||0)+c(u,n,i[u],e[u])},r):r;c_(i[u],e[u],d)}return{fromIndividuals:i,toIndividuals:e,count:e.length}}function N8(t){return ve(t[0])}function L8(t,e){for(var r=[],n=t.length,i=0;i<n;i++)r.push({one:t[i],many:[]});for(var i=0;i<e.length;i++){var a=e[i].length,o=void 0;for(o=0;o<a;o++)r[o%n].many.push(e[i][o])}for(var s=0,i=n-1;i>=0;i--)if(!r[i].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var a=l.length,u=Math.ceil(a/2);r[i].many=l.slice(u,a),r[s].many=l.slice(0,u),s++}return r}var Aue={clone:function(t){for(var e=[],r=1-Math.pow(1-t.path.style.opacity,1/t.count),n=0;n<t.count;n++){var i=hb(t.path);i.setStyle("opacity",r),e.push(i)}return e},split:null};function h_(t,e,r,n,i,a){if(!t.length||!e.length)return;var o=Nl("update",n,i);if(!(o&&o.duration>0))return;var s=n.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,f;N8(t)&&(u=t,f=e),N8(e)&&(u=e,f=t);function c(m,y,b,C,_){var w=m.many,x=m.one;if(w.length===1&&!_){var S=y?w[0]:x,E=y?x:w[0];if(Tp(S))c({many:[S],one:E},!0,b,C,!0);else{var T=s?Ze({delay:s(b,C)},l):l;c_(S,E,T),a(S,E,S,E,T)}}else for(var A=Ze({dividePath:Aue[r],individualDelay:s&&function(F,j,W,B){return s(F+b,C)}},l),M=y?Sue(w,x,A):Eue(x,w,A),O=M.fromIndividuals,P=M.toIndividuals,N=O.length,k=0;k<N;k++){var T=s?Ze({delay:s(k,N)},l):l;a(O[k],P[k],y?w[k]:m.one,y?m.one:w[k],T)}}for(var d=u?u===t:t.length>e.length,h=u?L8(f,u):L8(d?e:t,[d?t:e]),v=0,g=0;g<h.length;g++)v+=h[g].many.length;for(var p=0,g=0;g<h.length;g++)c(h[g],d,p,v),p+=h[g].many.length}function Os(t){if(!t)return[];if(ve(t)){for(var e=[],r=0;r<t.length;r++)e.push(Os(t[r]));return e}var n=[];return t.traverse(function(i){i instanceof Qe&&!i.disableMorphing&&!i.invisible&&!i.ignore&&n.push(i)}),n}var F8=1e4,Tue=0,k8=1,j8=2,Oue=dt();function Mue(t,e){for(var r=t.dimensions,n=0;n<r.length;n++){var i=t.getDimensionInfo(r[n]);if(i&&i.otherDims[e]===0)return r[n]}}function Rue(t,e,r){var n=t.getDimensionInfo(r),i=n&&n.ordinalMeta;if(n){var a=t.get(n.name,e);return i&&i.categories[a]||a+""}}function z8(t,e,r,n){var i=n?"itemChildGroupId":"itemGroupId",a=Mue(t,i);if(a){var o=Rue(t,e,a);return o}var s=t.getRawDataItem(e),l=n?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!n)return r||t.getId(e)}function H8(t){var e=[];return z(t,function(r){var n=r.data,i=r.dataGroupId;if(n.count()>F8){process.env.NODE_ENV!=="production"&&Qt("Universal transition is disabled on large data > 10k.");return}for(var a=n.getIndices(),o=0;o<a.length;o++)e.push({data:n,groupId:z8(n,o,i,!1),childGroupId:z8(n,o,i,!0),divide:r.divide,dataIndex:o})}),e}function v_(t,e,r){t.traverse(function(n){n instanceof Qe&&Or(n,{style:{opacity:0}},e,{dataIndex:r,isFrom:!0})})}function p_(t){if(t.parent){var e=t.getComputedTransform();t.setLocalTransform(e),t.parent.remove(t)}}function uu(t){t.stopAnimation(),t.isGroup&&t.traverse(function(e){e.stopAnimation()})}function Pue(t,e,r){var n=Nl("update",r,e);n&&t.traverse(function(i){if(i instanceof Fa){var a=gJ(i);a&&i.animateFrom({style:a},n)}})}function Bue(t,e){var r=t.length;if(r!==e.length)return!1;for(var n=0;n<r;n++){var i=t[n],a=e[n];if(i.data.getId(i.dataIndex)!==a.data.getId(a.dataIndex))return!1}return!0}function V8(t,e,r){var n=H8(t),i=H8(e);function a(b,C,_,w,x){(_||b)&&C.animateFrom({style:_&&_!==b?ue(ue({},_.style),b.style):b.style},x)}var o=!1,s=Tue,l=Be(),u=Be();n.forEach(function(b){b.groupId&&l.set(b.groupId,!0),b.childGroupId&&u.set(b.childGroupId,!0)});for(var f=0;f<i.length;f++){var c=i[f].groupId;if(u.get(c)){s=k8;break}var d=i[f].childGroupId;if(d&&l.get(d)){s=j8;break}}function h(b,C){return function(_){var w=_.data,x=_.dataIndex;return C?w.getId(x):b?s===k8?_.childGroupId:_.groupId:s===j8?_.childGroupId:_.groupId}}var v=Bue(n,i),g={};if(!v)for(var f=0;f<i.length;f++){var p=i[f],m=p.data.getItemGraphicEl(p.dataIndex);m&&(g[m.id]=!0)}function y(b,C){var _=n[C],w=i[b],x=w.data.hostModel,S=_.data.getItemGraphicEl(_.dataIndex),E=w.data.getItemGraphicEl(w.dataIndex);if(S===E){E&&Pue(E,w.dataIndex,x);return}S&&g[S.id]||E&&(uu(E),S?(uu(S),p_(S),o=!0,h_(Os(S),Os(E),w.divide,x,b,a)):v_(E,x,b))}new Pb(n,i,h(!0,v),h(!1,v),null,"multiple").update(y).updateManyToOne(function(b,C){var _=i[b],w=_.data,x=w.hostModel,S=w.getItemGraphicEl(_.dataIndex),E=Bt(Ce(C,function(T){return n[T].data.getItemGraphicEl(n[T].dataIndex)}),function(T){return T&&T!==S&&!g[T.id]});S&&(uu(S),E.length?(z(E,function(T){uu(T),p_(T)}),o=!0,h_(Os(E),Os(S),_.divide,x,b,a)):v_(S,x,_.dataIndex))}).updateOneToMany(function(b,C){var _=n[C],w=_.data.getItemGraphicEl(_.dataIndex);if(!(w&&g[w.id])){var x=Bt(Ce(b,function(E){return i[E].data.getItemGraphicEl(i[E].dataIndex)}),function(E){return E&&E!==w}),S=i[b[0]].data.hostModel;x.length&&(z(x,function(E){return uu(E)}),w?(uu(w),p_(w),o=!0,h_(Os(w),Os(x),_.divide,S,b[0],a)):z(x,function(E){return v_(E,S,b[0])}))}}).updateManyToMany(function(b,C){new Pb(C,b,function(_){return n[_].data.getId(n[_].dataIndex)},function(_){return i[_].data.getId(i[_].dataIndex)}).update(function(_,w){y(b[_],C[w])}).execute()}).execute(),o&&z(e,function(b){var C=b.data,_=C.hostModel,w=_&&r.getViewOfSeriesModel(_),x=Nl("update",_,0);w&&_.isAnimationEnabled()&&x&&x.duration>0&&w.group.traverse(function(S){S instanceof Qe&&!S.animators.length&&S.animateFrom({style:{opacity:0}},x)})})}function W8(t){var e=t.getModel("universalTransition").get("seriesKey");return e||t.id}function $8(t){return ve(t)?t.sort().join(","):t}function io(t){if(t.hostModel)return t.hostModel.getModel("universalTransition").get("divideShape")}function Iue(t,e){var r=Be(),n=Be(),i=Be();z(t.oldSeries,function(o,s){var l=t.oldDataGroupIds[s],u=t.oldData[s],f=W8(o),c=$8(f);n.set(c,{dataGroupId:l,data:u}),ve(f)&&z(f,function(d){i.set(d,{key:c,dataGroupId:l,data:u})})});function a(o){r.get(o)&&Qt("Duplicated seriesKey in universalTransition "+o)}return z(e.updatedSeries,function(o){if(o.isUniversalTransitionEnabled()&&o.isAnimationEnabled()){var s=o.get("dataGroupId"),l=o.getData(),u=W8(o),f=$8(u),c=n.get(f);if(c)process.env.NODE_ENV!=="production"&&a(f),r.set(f,{oldSeries:[{dataGroupId:c.dataGroupId,divide:io(c.data),data:c.data}],newSeries:[{dataGroupId:s,divide:io(l),data:l}]});else if(ve(u)){process.env.NODE_ENV!=="production"&&a(f);var d=[];z(u,function(g){var p=n.get(g);p.data&&d.push({dataGroupId:p.dataGroupId,divide:io(p.data),data:p.data})}),d.length&&r.set(f,{oldSeries:d,newSeries:[{dataGroupId:s,data:l,divide:io(l)}]})}else{var h=i.get(u);if(h){var v=r.get(h.key);v||(v={oldSeries:[{dataGroupId:h.dataGroupId,data:h.data,divide:io(h.data)}],newSeries:[]},r.set(h.key,v)),v.newSeries.push({dataGroupId:s,data:l,divide:io(l)})}}}}),r}function G8(t,e){for(var r=0;r<t.length;r++){var n=e.seriesIndex!=null&&e.seriesIndex===t[r].seriesIndex||e.seriesId!=null&&e.seriesId===t[r].id;if(n)return r}}function Nue(t,e,r,n){var i=[],a=[];z(It(t.from),function(o){var s=G8(e.oldSeries,o);s>=0&&i.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:io(e.oldData[s]),groupIdDim:o.dimension})}),z(It(t.to),function(o){var s=G8(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();a.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:io(l),groupIdDim:o.dimension})}}),i.length>0&&a.length>0&&V8(i,a,n)}function Lue(t){t.registerUpdateLifecycle("series:beforeupdate",function(e,r,n){z(It(n.seriesTransition),function(i){z(It(i.to),function(a){for(var o=n.updatedSeries,s=0;s<o.length;s++)(a.seriesIndex!=null&&a.seriesIndex===o[s].seriesIndex||a.seriesId!=null&&a.seriesId===o[s].id)&&(o[s][Iv]=!0)})})}),t.registerUpdateLifecycle("series:transition",function(e,r,n){var i=Oue(r);if(i.oldSeries&&n.updatedSeries&&n.optionChanged){var a=n.seriesTransition;if(a)z(It(a),function(h){Nue(h,i,n,r)});else{var o=Iue(i,n);z(o.keys(),function(h){var v=o.get(h);V8(v.oldSeries,v.newSeries,r)})}z(n.updatedSeries,function(h){h[Iv]&&(h[Iv]=!1)})}for(var s=e.getSeries(),l=i.oldSeries=[],u=i.oldDataGroupIds=[],f=i.oldData=[],c=0;c<s.length;c++){var d=s[c].getData();d.count()<F8&&(l.push(s[c]),u.push(s[c].get("dataGroupId")),f.push(d))}})}function U8(t,e,r){var n=qi.createCanvas(),i=e.getWidth(),a=e.getHeight(),o=n.style;return o&&(o.position="absolute",o.left="0",o.top="0",o.width=i+"px",o.height=a+"px",n.setAttribute("data-zr-dom-id",t)),n.width=i*r,n.height=a*r,n}var g_=function(t){he(e,t);function e(r,n,i){var a=t.call(this)||this;a.motionBlur=!1,a.lastFrameAlpha=.7,a.dpr=1,a.virtual=!1,a.config={},a.incremental=!1,a.zlevel=0,a.maxRepaintRectCount=5,a.__dirty=!0,a.__firstTimePaint=!0,a.__used=!1,a.__drawIndex=0,a.__startIndex=0,a.__endIndex=0,a.__prevStartIndex=null,a.__prevEndIndex=null;var o;i=i||Rh,typeof r=="string"?o=U8(r,n,i):Se(r)&&(o=r,r=o.id),a.id=r,a.dom=o;var s=o.style;return s&&(i2(o),o.onselectstart=function(){return!1},s.padding="0",s.margin="0",s.borderWidth="0"),a.painter=n,a.dpr=i,a}return e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var r=this.dpr;this.domBack=U8("back-"+this.id,this.painter,r),this.ctxBack=this.domBack.getContext("2d"),r!==1&&this.ctxBack.scale(r,r)},e.prototype.createRepaintRects=function(r,n,i,a){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var o=[],s=this.maxRepaintRectCount,l=!1,u=new ke(0,0,0,0);function f(y){if(!(!y.isFinite()||y.isZero()))if(o.length===0){var b=new ke(0,0,0,0);b.copy(y),o.push(b)}else{for(var C=!1,_=1/0,w=0,x=0;x<o.length;++x){var S=o[x];if(S.intersect(y)){var E=new ke(0,0,0,0);E.copy(S),E.union(y),o[x]=E,C=!0;break}else if(l){u.copy(y),u.union(S);var T=y.width*y.height,A=S.width*S.height,M=u.width*u.height,O=M-T-A;O<_&&(_=O,w=x)}}if(l&&(o[w].union(y),C=!0),!C){var b=new ke(0,0,0,0);b.copy(y),o.push(b)}l||(l=o.length>=s)}}for(var c=this.__startIndex;c<this.__endIndex;++c){var d=r[c];if(d){var h=d.shouldBePainted(i,a,!0,!0),v=d.__isRendered&&(d.__dirty&vn||!h)?d.getPrevPaintRect():null;v&&f(v);var g=h&&(d.__dirty&vn||!d.__isRendered)?d.getPaintRect():null;g&&f(g)}}for(var c=this.__prevStartIndex;c<this.__prevEndIndex;++c){var d=n[c],h=d&&d.shouldBePainted(i,a,!0,!0);if(d&&(!h||!d.__zr)&&d.__isRendered){var v=d.getPrevPaintRect();v&&f(v)}}var p;do{p=!1;for(var c=0;c<o.length;){if(o[c].isZero()){o.splice(c,1);continue}for(var m=c+1;m<o.length;)o[c].intersect(o[m])?(p=!0,o[c].union(o[m]),o.splice(m,1)):m++;c++}}while(p);return this._paintRects=o,o},e.prototype.debugGetPaintRects=function(){return(this._paintRects||[]).slice()},e.prototype.resize=function(r,n){var i=this.dpr,a=this.dom,o=a.style,s=this.domBack;o&&(o.width=r+"px",o.height=n+"px"),a.width=r*i,a.height=n*i,s&&(s.width=r*i,s.height=n*i,i!==1&&this.ctxBack.scale(i,i))},e.prototype.clear=function(r,n,i){var a=this.dom,o=this.ctx,s=a.width,l=a.height;n=n||this.clearColor;var u=this.motionBlur&&!r,f=this.lastFrameAlpha,c=this.dpr,d=this;u&&(this.domBack||this.createBackBuffer(),this.ctxBack.globalCompositeOperation="copy",this.ctxBack.drawImage(a,0,0,s/c,l/c));var h=this.domBack;function v(g,p,m,y){if(o.clearRect(g,p,m,y),n&&n!=="transparent"){var b=void 0;if(uh(n)){var C=n.global||n.__width===m&&n.__height===y;b=C&&n.__canvasGradient||nC(o,n,{x:0,y:0,width:m,height:y}),n.__canvasGradient=b,n.__width=m,n.__height=y}else hZ(n)&&(n.scaleX=n.scaleX||c,n.scaleY=n.scaleY||c,b=iC(o,n,{dirty:function(){d.setUnpainted(),d.painter.refresh()}}));o.save(),o.fillStyle=b||n,o.fillRect(g,p,m,y),o.restore()}u&&(o.save(),o.globalAlpha=f,o.drawImage(h,g,p,m,y),o.restore())}!i||u?v(0,0,s,l):i.length&&z(i,function(g){v(g.x*c,g.y*c,g.width*c,g.height*c)})},e}(Si),Y8=1e5,Ms=314159,Rp=.01,Fue=.001;function kue(t){return t?t.__builtin__?!0:!(typeof t.resize!="function"||typeof t.refresh!="function"):!1}function jue(t,e){var r=document.createElement("div");return r.style.cssText=["position:relative","width:"+t+"px","height:"+e+"px","padding:0","margin:0","border-width:0"].join(";")+";",r}var zue=function(){function t(e,r,n,i){this.type="canvas",this._zlevelList=[],this._prevDisplayList=[],this._layers={},this._layerConfig={},this._needsManuallyCompositing=!1,this.type="canvas";var a=!e.nodeName||e.nodeName.toUpperCase()==="CANVAS";this._opts=n=ue({},n||{}),this.dpr=n.devicePixelRatio||Rh,this._singleCanvas=a,this.root=e;var o=e.style;o&&(i2(e),e.innerHTML=""),this.storage=r;var s=this._zlevelList;this._prevDisplayList=[];var l=this._layers;if(a){var f=e,c=f.width,d=f.height;n.width!=null&&(c=n.width),n.height!=null&&(d=n.height),this.dpr=n.devicePixelRatio||1,f.width=c*this.dpr,f.height=d*this.dpr,this._width=c,this._height=d;var h=new g_(f,this,this.dpr);h.__builtin__=!0,h.initContext(),l[Ms]=h,h.zlevel=Ms,s.push(Ms),this._domRoot=e}else{this._width=Qv(e,0,n),this._height=Qv(e,1,n);var u=this._domRoot=jue(this._width,this._height);e.appendChild(u)}}return t.prototype.getType=function(){return"canvas"},t.prototype.isSingleCanvas=function(){return this._singleCanvas},t.prototype.getViewportRoot=function(){return this._domRoot},t.prototype.getViewportRootOffset=function(){var e=this.getViewportRoot();if(e)return{offsetLeft:e.offsetLeft||0,offsetTop:e.offsetTop||0}},t.prototype.refresh=function(e){var r=this.storage.getDisplayList(!0),n=this._prevDisplayList,i=this._zlevelList;this._redrawId=Math.random(),this._paintList(r,n,e,this._redrawId);for(var a=0;a<i.length;a++){var o=i[a],s=this._layers[o];if(!s.__builtin__&&s.refresh){var l=a===0?this._backgroundColor:null;s.refresh(l)}}return this._opts.useDirtyRect&&(this._prevDisplayList=r.slice()),this},t.prototype.refreshHover=function(){this._paintHoverList(this.storage.getDisplayList(!1))},t.prototype._paintHoverList=function(e){var r=e.length,n=this._hoverlayer;if(n&&n.clear(),!!r){for(var i={inHover:!0,viewWidth:this._width,viewHeight:this._height},a,o=0;o<r;o++){var s=e[o];s.__inHover&&(n||(n=this._hoverlayer=this.getLayer(Y8)),a||(a=n.ctx,a.save()),Ds(a,s,i,o===r-1))}a&&a.restore()}},t.prototype.getHoverLayer=function(){return this.getLayer(Y8)},t.prototype.paintOne=function(e,r){oI(e,r)},t.prototype._paintList=function(e,r,n,i){if(this._redrawId===i){n=n||!1,this._updateLayerStatus(e);var a=this._doPaintList(e,r,n),o=a.finished,s=a.needsRefreshHover;if(this._needsManuallyCompositing&&this._compositeManually(),s&&this._paintHoverList(e),o)this.eachLayer(function(u){u.afterBrush&&u.afterBrush()});else{var l=this;Gv(function(){l._paintList(e,r,n,i)})}}},t.prototype._compositeManually=function(){var e=this.getLayer(Ms).ctx,r=this._domRoot.width,n=this._domRoot.height;e.clearRect(0,0,r,n),this.eachBuiltinLayer(function(i){i.virtual&&e.drawImage(i.dom,0,0,r,n)})},t.prototype._doPaintList=function(e,r,n){for(var i=this,a=[],o=this._opts.useDirtyRect,s=0;s<this._zlevelList.length;s++){var l=this._zlevelList[s],u=this._layers[l];u.__builtin__&&u!==this._hoverlayer&&(u.__dirty||n)&&a.push(u)}for(var f=!0,c=!1,d=function(g){var p=a[g],m=p.ctx,y=o&&p.createRepaintRects(e,r,h._width,h._height),b=n?p.__startIndex:p.__drawIndex,C=!n&&p.incremental&&Date.now,_=C&&Date.now(),w=p.zlevel===h._zlevelList[0]?h._backgroundColor:null;if(p.__startIndex===p.__endIndex)p.clear(!1,w,y);else if(b===p.__startIndex){var x=e[b];(!x.incremental||!x.notClear||n)&&p.clear(!1,w,y)}b===-1&&(console.error("For some unknown reason. drawIndex is -1"),b=p.__startIndex);var S,E=function(O){var P={inHover:!1,allClipped:!1,prevEl:null,viewWidth:i._width,viewHeight:i._height};for(S=b;S<p.__endIndex;S++){var N=e[S];if(N.__inHover&&(c=!0),i._doPaintEl(N,p,o,O,P,S===p.__endIndex-1),C){var k=Date.now()-_;if(k>15)break}}P.prevElClipPaths&&m.restore()};if(y)if(y.length===0)S=p.__endIndex;else for(var T=h.dpr,A=0;A<y.length;++A){var M=y[A];m.save(),m.beginPath(),m.rect(M.x*T,M.y*T,M.width*T,M.height*T),m.clip(),E(M),m.restore()}else m.save(),E(),m.restore();p.__drawIndex=S,p.__drawIndex<p.__endIndex&&(f=!1)},h=this,v=0;v<a.length;v++)d(v);return Fe.wxa&&z(this._layers,function(g){g&&g.ctx&&g.ctx.draw&&g.ctx.draw()}),{finished:f,needsRefreshHover:c}},t.prototype._doPaintEl=function(e,r,n,i,a,o){var s=r.ctx;if(n){var l=e.getPaintRect();(!i||l&&l.intersect(i))&&(Ds(s,e,a,o),e.setPrevPaintRect(l))}else Ds(s,e,a,o)},t.prototype.getLayer=function(e,r){this._singleCanvas&&!this._needsManuallyCompositing&&(e=Ms);var n=this._layers[e];return n||(n=new g_("zr_"+e,this,this.dpr),n.zlevel=e,n.__builtin__=!0,this._layerConfig[e]?ct(n,this._layerConfig[e],!0):this._layerConfig[e-Rp]&&ct(n,this._layerConfig[e-Rp],!0),r&&(n.virtual=r),this.insertLayer(e,n),n.initContext()),n},t.prototype.insertLayer=function(e,r){var n=this._layers,i=this._zlevelList,a=i.length,o=this._domRoot,s=null,l=-1;if(n[e]){process.env.NODE_ENV!=="production"&&Ho("ZLevel "+e+" has been used already");return}if(!kue(r)){process.env.NODE_ENV!=="production"&&Ho("Layer of zlevel "+e+" is not valid");return}if(a>0&&e>i[0]){for(l=0;l<a-1&&!(i[l]<e&&i[l+1]>e);l++);s=n[i[l]]}if(i.splice(l+1,0,e),n[e]=r,!r.virtual)if(s){var u=s.dom;u.nextSibling?o.insertBefore(r.dom,u.nextSibling):o.appendChild(r.dom)}else o.firstChild?o.insertBefore(r.dom,o.firstChild):o.appendChild(r.dom);r.painter||(r.painter=this)},t.prototype.eachLayer=function(e,r){for(var n=this._zlevelList,i=0;i<n.length;i++){var a=n[i];e.call(r,this._layers[a],a)}},t.prototype.eachBuiltinLayer=function(e,r){for(var n=this._zlevelList,i=0;i<n.length;i++){var a=n[i],o=this._layers[a];o.__builtin__&&e.call(r,o,a)}},t.prototype.eachOtherLayer=function(e,r){for(var n=this._zlevelList,i=0;i<n.length;i++){var a=n[i],o=this._layers[a];o.__builtin__||e.call(r,o,a)}},t.prototype.getLayers=function(){return this._layers},t.prototype._updateLayerStatus=function(e){this.eachBuiltinLayer(function(c,d){c.__dirty=c.__used=!1});function r(c){a&&(a.__endIndex!==c&&(a.__dirty=!0),a.__endIndex=c)}if(this._singleCanvas)for(var n=1;n<e.length;n++){var i=e[n];if(i.zlevel!==e[n-1].zlevel||i.incremental){this._needsManuallyCompositing=!0;break}}var a=null,o=0,s,l;for(l=0;l<e.length;l++){var i=e[l],u=i.zlevel,f=void 0;s!==u&&(s=u,o=0),i.incremental?(f=this.getLayer(u+Fue,this._needsManuallyCompositing),f.incremental=!0,o=1):f=this.getLayer(u+(o>0?Rp:0),this._needsManuallyCompositing),f.__builtin__||Ho("ZLevel "+u+" has been used by unkown layer "+f.id),f!==a&&(f.__used=!0,f.__startIndex!==l&&(f.__dirty=!0),f.__startIndex=l,f.incremental?f.__drawIndex=-1:f.__drawIndex=l,r(l),a=f),i.__dirty&vn&&!i.__inHover&&(f.__dirty=!0,f.incremental&&f.__drawIndex<0&&(f.__drawIndex=l))}r(l),this.eachBuiltinLayer(function(c,d){!c.__used&&c.getElementCount()>0&&(c.__dirty=!0,c.__startIndex=c.__endIndex=c.__drawIndex=0),c.__dirty&&c.__drawIndex<0&&(c.__drawIndex=c.__startIndex)})},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(e){e.clear()},t.prototype.setBackgroundColor=function(e){this._backgroundColor=e,z(this._layers,function(r){r.setUnpainted()})},t.prototype.configLayer=function(e,r){if(r){var n=this._layerConfig;n[e]?ct(n[e],r,!0):n[e]=r;for(var i=0;i<this._zlevelList.length;i++){var a=this._zlevelList[i];if(a===e||a===e+Rp){var o=this._layers[a];ct(o,n[e],!0)}}}},t.prototype.delLayer=function(e){var r=this._layers,n=this._zlevelList,i=r[e];i&&(i.dom.parentNode.removeChild(i.dom),delete r[e],n.splice(Ke(n,e),1))},t.prototype.resize=function(e,r){if(this._domRoot.style){var n=this._domRoot;n.style.display="none";var i=this._opts,a=this.root;if(e!=null&&(i.width=e),r!=null&&(i.height=r),e=Qv(a,0,i),r=Qv(a,1,i),n.style.display="",this._width!==e||r!==this._height){n.style.width=e+"px",n.style.height=r+"px";for(var o in this._layers)this._layers.hasOwnProperty(o)&&this._layers[o].resize(e,r);this.refresh(!0)}this._width=e,this._height=r}else{if(e==null||r==null)return;this._width=e,this._height=r,this.getLayer(Ms).resize(e,r)}return this},t.prototype.clearLayer=function(e){var r=this._layers[e];r&&r.clear()},t.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._layers=null},t.prototype.getRenderedCanvas=function(e){if(e=e||{},this._singleCanvas&&!this._compositeManually)return this._layers[Ms].dom;var r=new g_("image",this,e.pixelRatio||this.dpr);r.initContext(),r.clear(!1,e.backgroundColor||this._backgroundColor);var n=r.ctx;if(e.pixelRatio<=this.dpr){this.refresh();var i=r.dom.width,a=r.dom.height;this.eachLayer(function(c){c.__builtin__?n.drawImage(c.dom,0,0,i,a):c.renderToCanvas&&(n.save(),c.renderToCanvas(n),n.restore())})}else for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height},s=this.storage.getDisplayList(!0),l=0,u=s.length;l<u;l++){var f=s[l];Ds(n,f,o,l===u-1)}return r.dom},t.prototype.getWidth=function(){return this._width},t.prototype.getHeight=function(){return this._height},t}();function Hue(t){t.registerPainter("canvas",zue)}Qa([ule,Vle,Ple,Ole,ele,iue,tue,Zre,Tre,wne,uue,Lue,Hue]);const Vue=I.memo(({options:t,echartRef:e})=>{const r=I.useRef(null),n=I.useRef(null);return I.useEffect(()=>(r.current&&(n.current=Eae(r.current),window.__chartInstanceRef=n),()=>{n.current&&n.current.dispose()}),[]),I.useEffect(()=>{n.current&&(n.current.clear(),t&&Object.keys(t).length>0&&n.current.setOption({...t}))},[t]),I.useImperativeHandle(e,()=>({resize:()=>{n.current&&n.current.resize()},getWidth:()=>{n.current&&n.current.getWidth()}})),D.jsx("div",{ref:r,style:{width:"100%",height:"100%"}})}),Wue=()=>D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:139,height:118,fill:"none",children:[D.jsx("path",{fill:"#F4F4F5",d:"M124.987 58.727c0 13.227-4.202 25.657-11.204 35.463-3.879 5.36-8.511 10.035-13.898 13.684-8.618 6.044-19.068 9.465-30.164 9.465-30.488.114-55.266-26.113-55.266-58.612C14.455 26.34 39.125 0 69.721 0c11.096 0 21.438 3.421 30.164 9.465 5.387 3.649 10.019 8.324 13.898 13.683 7.002 9.921 11.204 22.237 11.204 35.579Z"}),D.jsx("path",{stroke:"#D0D0D4",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:10,strokeWidth:2,d:"M2 102.569h130.77"}),D.jsx("path",{fill:"#fff",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"M93.85 50.054v52.515H23.22c-2.786 0-4.875-2.36-4.875-5.163V50.054H93.85Z"}),D.jsx("path",{fill:"#DAE1ED",d:"M121.874 50.054v47.352c0 2.95-2.323 5.163-5.082 5.163h-22.94V50.054h28.022Z"}),D.jsx("path",{fill:"#F4F4F5",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"M121.874 50.054v47.352c0 2.95-2.323 5.163-5.082 5.163h-22.94V50.054h28.022Z"}),D.jsx("path",{fill:"#C5CDDB",d:"m45.59 50.054 14.852-24.617h76.22L121.39 50.055h-75.8Z"}),D.jsx("path",{fill:"#F4F4F5",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"m45.59 50.054 14.852-24.617h76.22L121.39 50.055h-75.8Z"}),D.jsx("path",{fill:"url(#a)",d:"M121.874 50.197v27.756h-20.433c-1.898 0-3.211-1.295-3.503-3.164l-4.086-24.735 28.022.143Z",opacity:.3}),D.jsx("path",{fill:"#fff",stroke:"#D0D0D4",strokeMiterlimit:10,strokeWidth:2,d:"M121.287 50.054H93.852l13.93 22.258c.995 1.474 2.559 2.358 4.123 2.358h21.322c1.422 0 2.417-1.769 1.564-2.948l-13.504-21.668ZM93.85 50.054 78.895 25.437H2l15.52 24.617h76.33Z"}),D.jsx("path",{fill:"#D0D0D4",d:"M56.028 80.415H26.59a1.23 1.23 0 0 1-1.238-1.231c0-.684.55-1.23 1.238-1.23h29.438a1.23 1.23 0 0 1 1.238 1.23c-.138.684-.55 1.23-1.238 1.23ZM56.028 86.159H26.59c-.688 0-1.238-.365-1.238-.82 0-.457.55-.821 1.238-.821h29.438c.687 0 1.238.364 1.238.82-.138.456-.55.82-1.238.82ZM40.44 92.723H26.61c-.699 0-1.257-.365-1.257-.82 0-.456.558-.821 1.257-.821H40.44c.699 0 1.258.365 1.258.82-.14.456-.699.821-1.258.821Z"}),D.jsx("defs",{children:D.jsxs("linearGradient",{id:"a",x1:107.869,x2:107.869,y1:78.525,y2:53.113,gradientUnits:"userSpaceOnUse",children:[D.jsx("stop",{offset:.003,stopColor:"#606673",stopOpacity:0}),D.jsx("stop",{offset:1,stopColor:"#AAB2C5"})]})})]}),q8=t=>{const{t:e}=At();return D.jsxs("div",{style:{color:"#A1A1AA",width:"100%",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[D.jsx(Wue,{}),D.jsx("span",{children:e("empty")})]})};q8.displayName="Empty";const $ue=t=>{const{type:e,categories:r}=t;return{"chart-bar":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-bar-pile":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-bar-percentage":{xAxis:{type:"category",data:r},yAxis:{type:"value",max:100,axisLabel:{formatter:"{value} %"}}},"chart-line":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-line-smooth":{xAxis:{type:"category",data:r},yAxis:{type:"value"}},"chart-pie":{xAxis:{show:!1},yAxis:{show:!1}},"chart-pie-circular":{xAxis:{show:!1},yAxis:{show:!1}},"chart-strip-bar":{xAxis:{type:"value"},yAxis:{type:"category",data:r}},"chart-strip-bar-pile":{xAxis:{type:"value"},yAxis:{type:"category",data:r}},"chart-strip-bar-percentage":{xAxis:{type:"value",max:100,axisLabel:{formatter:"{value} %"}},yAxis:{type:"category",data:r}},[Lr.chartCombination]:{xAxis:{type:"category",data:r},yAxis:{type:"value"}}}[e]},X8=({type:t,data:e,label:r,name:n,isGroup:i,groupField:a,labels:o})=>{let s;return t==="chart-pie"?s={data:e.map((l,u)=>({value:l,name:o[u]})),name:n,type:"pie",radius:"50%",label:{...r,position:"outside"},labelLine:{normal:{show:!0}}}:t==="chart-pie-circular"?s={data:e.map((l,u)=>({value:l,name:o[u]})),type:"pie",name:n,radius:["40%","70%"],label:{...r,position:"outside"},labelLine:{normal:{show:!0}}}:t==="chart-line"?s={data:e,name:n,type:"line",label:r}:t==="chart-line-smooth"?s={data:e,name:n,type:"line",smooth:!0,label:r}:s={data:e,name:n,type:"bar",label:r},(t==="chart-bar-percentage"||t==="chart-bar-pile"||t==="chart-strip-bar-pile"||t==="chart-strip-bar-percentage")&&i&&a&&(s.stack=a),s},Gue=({customeStyle:t,series:e,chartConfig:r,width:n})=>{var C,_,w,x;const{isLeftAxisShow:i,isRightAxisShow:a,maxLeftSeriesDataStrLen:o,maxRightSeriesDataStrLen:s,maxSeriesDataLen:l}=e.reduce((S,E)=>{var O;let T={...S},A=E.yAxisIndex==0?"left":"right",M=Math.max(...E.data.map(P=>String(P).length));return A=="left"?(T.maxLeftSeriesDataStrLen=Math.max(T.maxLeftSeriesDataStrLen,M),T.isLeftAxisShow=!0):(T.maxRightSeriesDataStrLen=Math.max(T.maxRightSeriesDataStrLen,M),T.isRightAxisShow=!0),T.maxSeriesDataLen=Math.max(T.maxSeriesDataLen,(O=E==null?void 0:E.data)==null?void 0:O.length),T},{isLeftAxisShow:!1,isRightAxisShow:!1,maxLeftSeriesDataStrLen:0,maxRightSeriesDataStrLen:0,maxSeriesDataLen:0});let u=((C=r==null?void 0:r.xAxis)==null?void 0:C.type)==="category"?"xAxis":"yAxis";const c=(x=(u==="xAxis"?(_=r==null?void 0:r.xAxis)==null?void 0:_.data:(w=r==null?void 0:r.yAxis)==null?void 0:w.data)??[])==null?void 0:x.reduce((S,E)=>{const T=String(E).length;return Math.max(S,T)},0),d=9,h=12;let v=45,g=0,p=0,m=0,y=0;if(u=="xAxis"){const S={45:d*.8,90:d,0:d};l>3&&(c>=15&&(y=90),c>5&&(y=45),n<3&&(y=90)),m=S[`${y}`]*(y==0?1:Math.min(c,18))+h,g=Math.min(o,18)*d+h,p=Math.min(s,18)*d+h}else m=Math.min(o,18)*d+h,g=Math.min(c,18)*d+h,p=h;g=Math.max(g,40),p=Math.max(p,40),i||(g=h),a||(p=h);let b=d;return t!=null&&t.xtitle&&(u=="xAxis"?m=m+b:p=p+b),t!=null&&t.ytitle&&(u=="xAxis"?g=g+b:v=v+b),{top:v+"px",left:g+"px",right:p+"px",bottom:Math.max(m,40)+"px",axisLabelRotate:y}},Uue=({moduleDataApi:t,customData:e,customeStyle:r,width:n=2,height:i=2})=>{const{globalData:a,globalFilterCondition:o}=dn();let s=I.useMemo(()=>o==null?void 0:o.find(w=>(w==null?void 0:w.dataSourceId)===(e==null?void 0:e.dataSourceId)),[o,e==null?void 0:e.dataSourceId]);const[l,u]=I.useState(),[f,c]=I.useState(),d=Tt(async()=>{var _,w,x;if(u([]),e){c(!0);let S="";const E=(e==null?void 0:e.xAxis)==="tags"?"tag":e==null?void 0:e.xAxis,T=(e==null?void 0:e.groupField)==="tags"?"tag":e==null?void 0:e.groupField;e.isGroup?(e.yAxis==="recordTotal"&&(S+=`select=${E},${T},id.count()`),e.yAxis==="fieldValue"&&(e!=null&&e.yAxisField)&&(S+=`select=${E},${T},${e==null?void 0:e.yAxisField}.${e==null?void 0:e.yAxisFieldType}()`)):(e.yAxis==="recordTotal"&&(S+=`select=${E},id.count()`),e.yAxis==="fieldValue"&&(e!=null&&e.yAxisField)&&(S+=`select=${E},${e==null?void 0:e.yAxisField}.${e==null?void 0:e.yAxisFieldType}()`));let A=[];if((((_=s==null?void 0:s.conditionList)==null?void 0:_.length)??0)>0&&A.push(s),(((x=(w=e==null?void 0:e.conditionData)==null?void 0:w.conditionList)==null?void 0:x.length)??0)>0&&A.push(e==null?void 0:e.conditionData),A.length>0){let M=Qd(A);S+=M?`&${M}`:""}e!=null&&e.dataSourceId&&(t==null||t({id:e==null?void 0:e.dataSourceId,query:S}).then(M=>{if(!M.success){K.message.error(M.message);return}u(M.data)}).finally(()=>{c(!1)}))}else u([])});_9(()=>{e&&d()},[e==null?void 0:e.dataSourceId,e==null?void 0:e.conditionData,e==null?void 0:e.sortField,e==null?void 0:e.sortOrder,e==null?void 0:e.xAxis,e==null?void 0:e.yAxis,e==null?void 0:e.yAxisField,e==null?void 0:e.yAxisFieldType,e==null?void 0:e.isGroup,e==null?void 0:e.groupField,s],{wait:60});const h=I.useMemo(()=>{var w,x;return(x=(w=a==null?void 0:a.sourceData)==null?void 0:w.find(S=>S.value===(e==null?void 0:e.dataSourceId)))==null?void 0:x.fields},[a,e==null?void 0:e.dataSourceId]),v=I.useMemo(()=>e&&l&&e.type&&l.length>0?(w=>{var xe,Oe,st,qt,Ge,St,Rr,it,yt,Pr,lr,Br,_n,_r;const x=({item:de,field:Ne,timeGroupInterval:Ue})=>nf({fieldOptions:h,val:de[Ne],field:Ne,fieldMap:a==null?void 0:a.fieldMap,timeGroupInterval:Ue}),S=de=>{const Ne=h==null?void 0:h.find(Ue=>Ue.value===de);return Ne==null?void 0:Ne.label},E=de=>{var Ne;return((Ne=h==null?void 0:h.find(Ue=>Ue.value===de))==null?void 0:Ne.type)==="timestamp"},T={tags:"tag"},A=T[e==null?void 0:e.xAxis]??(e==null?void 0:e.xAxis),M=T[e==null?void 0:e.groupField]??(e==null?void 0:e.groupField);let O=HW(w,de=>x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval})),P=Object.keys(O).map(de=>O[de].reduce((ht,xt)=>(Object.keys(xt).forEach(ur=>{let ai=xt[ur];US(ai)?ht[ur]=ht!=null&&ht[ur]?ht[ur]+ai:ai:ht[ur]=ai}),ht),{}));const N=new Set,k=new Set,F={},j={};P.forEach(de=>{const Ne=x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval}),Ue=e.yAxis==="recordTotal"?de==null?void 0:de.count:de[e==null?void 0:e.yAxisFieldType]||0,ht=Ne??U0("unknown");if(j[ht]=Ue,e!=null&&e.isGroup&&(e!=null&&e.groupField)){const xt=x({item:de,field:M}),ur=Ne??U0("unknown");k.add(xt),F[xt]||(F[xt]={}),F[xt][ur]=Ue}});const W={},B={};if(e!=null&&e.isGroup&&(e!=null&&e.groupField)){const de={};Object.keys(F).forEach(Ne=>{Object.entries(F[Ne]).forEach(([Ue,ht])=>{de[Ue]=(de[Ue]||0)+ht})}),Object.keys(F).forEach(Ne=>{B[Ne]={},Object.entries(F[Ne]).forEach(([Ue,ht])=>{const xt=de[Ue]||1;B[Ne][Ue]=ht/xt*100})})}else Object.entries(j).forEach(([de,Ne])=>{const Ue=Ne||1;W[de]=Ne/Ue*100});let H=(e==null?void 0:e.sortField)??"xAxis",Y=(e==null?void 0:e.sortOrder)??"asc";const te=[...P].sort((de,Ne)=>{let Ue,ht;switch(H){case"xAxis":Ue=x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval}),ht=x({item:Ne,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval});break;case"yAxisField":Ue=e.yAxis==="recordTotal"?de==null?void 0:de.count:de[e==null?void 0:e.yAxisFieldType]||0,ht=e.yAxis==="recordTotal"?Ne==null?void 0:Ne.count:Ne[e==null?void 0:e.yAxisFieldType]||0;break}const xt=Y==="asc"?1:-1;return Ue>ht?1*xt:Ue<ht?-1*xt:0}).map(de=>x({item:de,field:A,timeGroupInterval:e==null?void 0:e.timeGroupInterval}));if(N.clear(),te.forEach(de=>N.add(de)),!E(e==null?void 0:e.xAxis)&&e.displayRange!=="ALL"&&e.displayRange){let de=Array.from(N).sort((xt,ur)=>j[ur]-j[xt]),Ne=[],[Ue,ht]=e.displayRange.split("_");Ue==="TOP"?Ne=de.slice(0,Number(ht)):Ne=de.slice(-Number(ht)),Array.from(N).forEach(xt=>(Ne.includes(xt)||N.delete(xt),xt))}const ee=de=>e!=null&&e.isGroup&&(e!=null&&e.groupField)?(de==null?void 0:de.value)==0?"":`${de==null?void 0:de.value}`:`${de==null?void 0:de.value}`,V={show:(xe=e==null?void 0:e.chartOptions)==null?void 0:xe.includes("label"),position:"top",formatter:ee},J=Array.from(N),L=Array.from(k),$=[],Q=$ue({type:e==null?void 0:e.type,categories:J}),Z=de=>US(de)?Math.floor(de*100)/100:de;if(e!=null&&e.isGroup&&(e!=null&&e.groupField))L.forEach(de=>{var ur,ai;const Ne=["chart-bar-percentage","chart-strip-bar-percentage"].includes(e.type)?J.map(Ir=>Z(B[de][Ir]||0)):J.map(Ir=>Z(F[de][Ir]||0));let Ue=e.type,ht="left";if(Ue==Lr.chartCombination){let Ir=((e==null?void 0:e.groupFieldConfig)??[]).find(ho=>x({item:{[M]:ho==null?void 0:ho.value},field:M})==de);Ue=((ur=Ir==null?void 0:Ir.config)==null?void 0:ur.chartType)??Lr.ChartBar,ht=((ai=Ir==null?void 0:Ir.config)==null?void 0:ai.yAxisPos)??"left"}let xt=X8({type:Ue,data:Ne,label:V,name:de,isGroup:e==null?void 0:e.isGroup,groupField:e==null?void 0:e.groupField,labels:J});xt.yAxisIndex=ht=="left"?0:1,$.push(xt)});else{const de=["chart-bar-percentage","chart-strip-bar-percentage"].includes(e.type)?J.map(xt=>{var ur;return Z(((ur=W[xt])==null?void 0:ur.toFixed(2))||0)}):J.map(xt=>Z(j[xt]||0));let Ne=e.type,Ue="left";Ne==Lr.chartCombination?Ne=((Oe=e==null?void 0:e.yAxisFieldConfig)==null?void 0:Oe.chartType)??Lr.ChartBar:Ue=((st=e==null?void 0:e.yAxisFieldConfig)==null?void 0:st.yAxisPos)??"left";let ht=X8({type:e.type,data:de,label:V,name:e.yAxis==="recordTotal"?U0("pb.statisticsText"):S(e==null?void 0:e.yAxisField),isGroup:e==null?void 0:e.isGroup,groupField:e==null?void 0:e.groupField,labels:J});ht.yAxisIndex=Ue=="left"?0:1,$.push(ht)}const X=Gue({series:$,chartConfig:Q,width:n,customeStyle:r}),le=(qt=e==null?void 0:e.chartOptions)==null?void 0:qt.includes("legend");let fe=$.some(de=>(de==null?void 0:de.yAxisIndex)==0),De=$.some(de=>(de==null?void 0:de.yAxisIndex)==1),ye={...Q.yAxis,axisTick:{show:(Ge=e==null?void 0:e.chartOptions)==null?void 0:Ge.includes("axis")},axisLine:{show:(St=e==null?void 0:e.chartOptions)==null?void 0:St.includes("axis")},axisLabel:{show:(Rr=e==null?void 0:e.chartOptions)==null?void 0:Rr.includes("label"),formatter:de=>de.length>15?`${de.slice(0,15)}...`:de,hideOverlap:!0,...(it=Q.yAxis)==null?void 0:it.axisLabel},splitLine:{show:(yt=e==null?void 0:e.chartOptions)==null?void 0:yt.includes("splitLine")}};return{legend:{type:"scroll",left:"center",right:"center",top:"0",show:le,itemWidth:12,itemHeight:12,data:($==null?void 0:$.map(de=>(de==null?void 0:de.name)||""))||[]},grid:{top:X.top,left:X.left,right:X.right,bottom:X.bottom},graphic:{elements:[{type:"text",left:"center",bottom:"10px",style:{text:(r==null?void 0:r.xtitle)||"",fill:"#333",fontSize:12,fontWeight:"bold"}},{type:"text",left:"10px",top:"center",style:{text:(r==null?void 0:r.ytitle)||"",fill:"#333",fontSize:12,fontWeight:"bold"},rotation:Math.PI/2}]},xAxis:{...Q.xAxis,axisTick:{show:(Pr=e==null?void 0:e.chartOptions)==null?void 0:Pr.includes("axis")},axisLine:{show:(lr=e==null?void 0:e.chartOptions)==null?void 0:lr.includes("axis")},axisLabel:{show:(Br=e==null?void 0:e.chartOptions)==null?void 0:Br.includes("label"),rotate:X.axisLabelRotate,interval:"auto",formatter:de=>de.length>15?`${de.slice(0,15)}...`:de,...((_n=Q.xAxis)==null?void 0:_n.axisLabel)??{}},splitLine:{show:(_r=e==null?void 0:e.chartOptions)==null?void 0:_r.includes("splitLine")}},yAxis:[{show:fe,...ye},{show:De,...ye}],series:$,tooltip:{trigger:"item",axisPointer:{type:"shadow"},extraCssText:"max-width:30vw; white-space:pre-wrap; word-break:break-all",appendTo:"body"}}})(l):null,[e==null?void 0:e.sortField,e==null?void 0:e.sortOrder,e==null?void 0:e.type,e==null?void 0:e.chartOptions,e==null?void 0:e.timeGroupInterval,e==null?void 0:e.groupFieldConfig,e==null?void 0:e.yAxisFieldConfig,e==null?void 0:e.displayRange,r,l,n,i,h]),g=I.useRef(),p=I.useRef(null),m=Em(p);I.useEffect(()=>{var _;m&&((_=g==null?void 0:g.current)==null||_.resize())},[m]);const y=f,b=!f&&!v,C=!y&&!!v;return D.jsxs("div",{style:{width:"100%",height:"100%"},ref:p,children:[y&&D.jsx(K.Spin,{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},spinning:f}),b&&D.jsx(q8,{}),C&&D.jsx(Vue,{echartRef:g,options:v??{}})]})},Z8=I.memo(Uue),Pp={"combination-chart-option":"_combination-chart-option_1cwba_1","group-field-config-picker":"_group-field-config-picker_1cwba_11","group-field-config-picker__title":"_group-field-config-picker__title_1cwba_14","group-field-config-picker__item":"_group-field-config-picker__item_1cwba_18","group-field-config-picker__input":"_group-field-config-picker__input_1cwba_23"},K8="combination-chart-option",fu={chartType:Lr.ChartBar,yAxisPos:"left"},Q8=t=>{const{style:e,className:r,initTriggerChange:n=!1}=t,{t:i}=At(),[a,o]=Ao(t),s=[{label:i("chart.t2"),key:Lr.ChartBar,icon:D.jsx($w,{})},{label:i("chart.t8"),key:Lr.ChartLine,icon:D.jsx(Jw,{})}],l=[{label:i("chart.left"),key:"left",icon:D.jsx(Uw,{})},{label:i("chart.right"),key:"right",icon:D.jsx(Yw,{})}],u=(a==null?void 0:a.chartType)??(fu==null?void 0:fu.chartType),f=(a==null?void 0:a.yAxisPos)??(fu==null?void 0:fu.yAxisPos),c=I.useMemo(()=>s.find(h=>h.key===u),[u,s]),d=I.useMemo(()=>l.find(h=>h.key===f),[f,l]);return D.jsxs("div",{className:fn(Pp[`${K8}`],K8),style:e,children:[D.jsx(K.Dropdown,{trigger:["click"],placement:"bottom",menu:{items:s.map(h=>({...h,onClick:()=>{o({chartType:h.key,yAxisPos:f})}}))},children:D.jsx(K.Tooltip,{title:c==null?void 0:c.label,children:D.jsx(K.Button,{size:"small",type:"text",children:c==null?void 0:c.icon})})}),D.jsx(K.Divider,{type:"vertical",style:{margin:"0 2px"}}),D.jsx(K.Dropdown,{trigger:["click"],placement:"bottom",menu:{items:l.map(h=>({...h,onClick:()=>{o({chartType:u,yAxisPos:h.key})}}))},children:D.jsx(K.Tooltip,{title:d==null?void 0:d.label,children:D.jsx(K.Button,{size:"small",type:"text",children:d==null?void 0:d.icon})})})]})};Q8.displayName="CombinationChartOptionPicker";const m_="group-field-config-picker",J8=[],eN=t=>{const{style:e,className:r,options:n=J8}=t,[i=J8,a]=Ao(t),o=Tt(l=>{let u=(i??[]).find(f=>f.value===l);return u?u.config:void 0}),s=Tt((l,u)=>{let f=[...i??[]],c=f.find(d=>d.value===l);c?c.config=u:f.push({value:l,config:u}),a(f)});return I.useEffect(()=>{if((n==null?void 0:n.length)>0){let l=n.map(u=>({value:u,config:{chartType:Lr.ChartBar,yAxisPos:"left",...o(u)??{}}}));a(l)}},[n]),I.useMemo(()=>D.jsx("div",{className:fn(r,Pp[`${m_}`]),style:e,children:D.jsx("div",{children:((t==null?void 0:t.options)??[]).map(l=>{let u=`${l}`;const f=o(l);return D.jsxs("div",{className:fn(Pp[`${m_}__item`]),children:[D.jsx(K.Tooltip,{title:u,children:D.jsx("div",{className:fn(Pp[`${m_}__input`]),children:D.jsx(Yn,{value:u,disabled:!0,style:{width:200,pointerEvents:"none"}})})}),D.jsx(Q8,{value:f,onChange:c=>{s(l,c)}})]},u)})})}),[i,n])};eN.displayName="GroupFieldConfigPicker";const Yue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"17",y:"8",width:"6",height:"15.5",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"17",y:"24.5",width:"6",height:"15.5",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"28",y:"8",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"28",y:"18",width:"6",height:"22",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"39",y:"8",width:"6",height:"19",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"39",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"50",y:"8",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"50",y:"18",width:"6",height:"22",rx:"0.5",fill:"#5b65f5"})]}),que=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"17",y:"21",width:"6",height:"6",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"17",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"28",y:"24",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"28",y:"34",width:"6",height:"6",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"39",y:"8",width:"6",height:"19",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"39",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"}),D.jsx("rect",{x:"50",y:"18",width:"6",height:"9",rx:"0.5",fill:"#959bee"}),D.jsx("rect",{x:"50",y:"28",width:"6",height:"12",rx:"0.5",fill:"#5b65f5"})]}),Xue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("path",{d:"M15.5 33.5C20.2023 32.3804 23.5007 28.5533 25.7095 24.6682C28.3082 20.0974 34.0857 17.3668 38.758 19.7783L39.8066 20.3195C42.9001 21.9162 46.671 21.329 49.1326 18.8674L58 10",stroke:"#959bee",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),D.jsx("path",{d:"M16.5 15L26.844 27.6427C28.7759 30.0039 31.8825 31.0607 34.8535 30.3675L42.3359 28.6216C44.0629 28.2187 45.8748 28.401 47.4869 29.1398L57 33.5",stroke:"#5b65f4",strokeWidth:"1.5",strokeLinecap:"round"})]}),Zue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("path",{d:"M20 24C20 32.8366 27.1634 40 36 40C44.8366 40 52 32.8366 52 24C52 15.1634 44.8366 8 36 8C27.1634 8 20 15.1634 20 24ZM46.3944 24C46.3944 29.7407 41.7407 34.3944 36 34.3944C30.2593 34.3944 25.6056 29.7407 25.6056 24C25.6056 18.2593 30.2593 13.6056 36 13.6056C41.7407 13.6056 46.3944 18.2593 46.3944 24Z",fill:"#5b65f4"}),D.jsx("path",{d:"M52 24C52 19.7565 50.3143 15.6869 47.3137 12.6863C44.3131 9.68571 40.2435 8 36 8V13.6056C38.7568 13.6056 41.4006 14.7007 43.35 16.65C45.2993 18.5994 46.3944 21.2432 46.3944 24H52Z",fill:"#959bee"}),D.jsx("path",{d:"M52 24C52 20.9896 51.1507 18.0403 49.5497 15.4909L44.8026 18.4721C45.8427 20.1283 46.3944 22.0443 46.3944 24H52Z",fill:"#cdcff9"})]}),Kue=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"58",y:"11",width:"4",height:"15",rx:"0.5",transform:"rotate(90 58 11)",fill:"#959bee"}),D.jsx("rect",{x:"42",y:"11",width:"4",height:"28",rx:"0.5",transform:"rotate(90 42 11)",fill:"#5b65f5"}),D.jsx("rect",{x:"58",y:"18",width:"4",height:"21.5",rx:"0.5",transform:"rotate(90 58 18)",fill:"#959bee"}),D.jsx("rect",{x:"35.5",y:"18",width:"4",height:"21.5",rx:"0.5",transform:"rotate(90 35.5 18)",fill:"#5b65f5"}),D.jsx("rect",{x:"58",y:"25",width:"4",height:"34",rx:"0.5",transform:"rotate(90 58 25)",fill:"#959bee"}),D.jsx("rect",{x:"23",y:"25",width:"4",height:"9",rx:"0.5",transform:"rotate(90 23 25)",fill:"#5b65f5"}),D.jsx("rect",{x:"58",y:"32",width:"4",height:"17",rx:"0.5",transform:"rotate(90 58 32)",fill:"#959bee"}),D.jsx("rect",{x:"40",y:"32",width:"4",height:"26",rx:"0.5",transform:"rotate(90 40 32)",fill:"#5b65f5"})]}),Que=()=>D.jsxs("svg",{width:"72",height:"48",viewBox:"0 0 72 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[D.jsx("rect",{x:"40",y:"11",width:"4",height:"15",rx:"0.5",transform:"rotate(90 40 11)",fill:"#959bee"}),D.jsx("rect",{x:"24",y:"11",width:"4",height:"8",rx:"0.5",transform:"rotate(90 24 11)",fill:"#5b65f5"}),D.jsx("rect",{x:"48",y:"18",width:"4",height:"15.5",rx:"0.5",transform:"rotate(90 48 18)",fill:"#959bee"}),D.jsx("rect",{x:"31.5",y:"18",width:"4",height:"15.5",rx:"0.5",transform:"rotate(90 31.5 18)",fill:"#5b65f5"}),D.jsx("rect",{x:"60",y:"25",width:"4",height:"34",rx:"0.5",transform:"rotate(90 60 25)",fill:"#959bee"}),D.jsx("rect",{x:"25",y:"25",width:"4",height:"9",rx:"0.5",transform:"rotate(90 25 25)",fill:"#5b65f5"}),D.jsx("rect",{x:"43",y:"32",width:"4",height:"13",rx:"0.5",transform:"rotate(90 43 32)",fill:"#959bee"}),D.jsx("rect",{x:"29",y:"32",width:"4",height:"13",rx:"0.5",transform:"rotate(90 29 32)",fill:"#5b65f5"})]}),Jue=()=>{const{t,i18n:e}=At();return I.useMemo(()=>[{label:t("chart.t2"),value:"chart-bar",icon:D.jsx(ZS,{})},{label:t("chart.t3"),value:"chart-bar-pile",icon:D.jsx(que,{})},{label:t("chart.t4"),value:"chart-bar-percentage",icon:D.jsx(Yue,{})},{label:t("chart.t5"),value:"chart-strip-bar",icon:D.jsx(JS,{})},{label:t("chart.t6"),value:"chart-strip-bar-pile",icon:D.jsx(Que,{})},{label:t("chart.t7"),value:"chart-strip-bar-percentage",icon:D.jsx(Kue,{})},{label:t("chart.t8"),value:"chart-line",icon:D.jsx(KS,{})},{label:t("chart.t9"),value:"chart-line-smooth",icon:D.jsx(Xue,{})},{label:t("chart.t10"),value:"chart-pie",icon:D.jsx(QS,{})},{label:t("chart.t11"),value:"chart-pie-circular",icon:D.jsx(Zue,{})},{label:t("chart._t12"),value:Lr.chartCombination,icon:D.jsx(XS,{})}],[e.language])},efe=()=>{const{t,i18n:e}=At();return I.useMemo(()=>[{label:t("chart.t40"),value:"day"},{label:t("chart.t41"),value:"week"},{label:t("chart.t42"),value:"month"},{label:t("chart.t43"),value:"year"}],[e.language])},tfe=()=>{const{t,i18n:e}=At();return I.useMemo(()=>[{label:t("displayRange.all","ALL"),value:hi.ALL},{label:t("displayRange.top5","TOP5"),value:hi.TOP5},{label:t("displayRange.top10","TOP10"),value:hi.TOP10},{label:t("displayRange.top20","TOP20"),value:hi.TOP20},{label:t("displayRange.top30","TOP30"),value:hi.TOP30},{label:t("displayRange.bottom5","BOTTOM5"),value:hi.BOTTOM5},{label:t("displayRange.bottom10","BOTTOM10"),value:hi.BOTTOM10},{label:t("displayRange.bottom20","BOTTOM20"),value:hi.BOTTOM20},{label:t("displayRange.bottom30","BOTTOM30"),value:hi.BOTTOM30}],[e.language])},rfe={"chart-modal":"_chart-modal_10ivt_1"},nfe="chart-modal",ife=({selectModuleData:t,onAllValuesChange:e,enumDataApi:r})=>{const{globalData:n}=dn(),{t:i}=At(),a=I.useRef(null),o=Jue(),s=efe(),l=tfe(),u={dataSourceId:"",yAxis:"recordTotal",chartOptions:["legend","label","axis","splitLine"],sortField:"xAxis",sortOrder:"asc",timeGroupInterval:"day",displayRange:"ALL",yAxisFieldConfig:{chartType:Lr.ChartBar,yAxisPos:"left"}},[f]=K.Form.useForm(),c=K.Form.useWatch("type",f),d=K.Form.useWatch("dataSourceId",f),h=K.Form.useWatch("isGroup",f),v=K.Form.useWatch("xAxis",f),g=K.Form.useWatch("yAxisField",f),p=K.Form.useWatch("groupField",f),m=Tt(B=>{var Y,q;return((q=(Y=n==null?void 0:n.sourceData)==null?void 0:Y.find(te=>te.value===B))==null?void 0:q.fields)??[]}),{fieldOptions:y,xAxisFieldOption:b,yAxisFieldOption:C,groupFieldOption:_}=I.useMemo(()=>{const B=m(d),H=B.filter(te=>![g,p].includes(te.value)),Y=B.filter(te=>{let ee=te.type==="int"||te.type==="float",V=[v,p].includes(te.value);return ee&&!V}),q=B.filter(te=>![v,g].includes(te.value));return{fieldOptions:B,xAxisFieldOption:H,yAxisFieldOption:Y,groupFieldOption:q}},[d,v,g,p]),w=Tt(B=>{var H;return((H=y.find(Y=>Y.value===B))==null?void 0:H.type)==="timestamp"}),[x,S]=I.useState(!1),E=I.useRef(),[T,A]=I.useState({conditionList:[],conditionType:"all"}),[M,O]=I.useState(0),P=B=>{var H;A(B),E.current=B,O(((H=B==null?void 0:B.conditionList)==null?void 0:H.length)||0)},{service:N}=dn(),{data:k,loading:F}=y9(async()=>{var B,H,Y;if(h&&c===Lr.chartCombination&&p){const q=p==="tags"?"tag":p;let te=`select=${q}`;if(((B=T==null?void 0:T.conditionList)==null?void 0:B.length)>0){let J=Qd(T);te+=J?`&${J}`:""}let ee=await((H=N==null?void 0:N.moduleDataApi)==null?void 0:H.call(N,{id:d,query:te})),V=(Y=ee==null?void 0:ee.data)==null?void 0:Y.map(J=>nf({fieldOptions:y,val:J[q],field:q,fieldMap:n==null?void 0:n.fieldMap}));return[...new Set(V)]}else return[]},{refreshDeps:[c,h,p,T,d]}),{run:j}=Sm(Tt(()=>{e==null||e({...u,...f.getFieldsValue(),conditionData:E.current})}),{wait:100}),W=Tt((B,H)=>{var Y,q,te;if(B.dataSourceId){const ee=m(B.dataSourceId);f.setFieldsValue({xAxis:(Y=ee==null?void 0:ee[0])==null?void 0:Y.value,yAxis:"recordTotal",isGroup:!1}),P({conditionList:[],conditionType:"all"})}if(B.xAxis&&f.setFieldsValue(w(B.xAxis)?{timeGroupInterval:u==null?void 0:u.timeGroupInterval}:{displayRange:u==null?void 0:u.displayRange}),B.yAxis){let ee=B.yAxis;f.setFieldsValue({yAxisField:ee==="fieldValue"?(q=C==null?void 0:C[0])==null?void 0:q.value:"",yAxisFieldType:"sum"})}B.isGroup&&f.setFieldsValue({groupField:(te=_==null?void 0:_[0])==null?void 0:te.value}),j()});return I.useEffect(()=>{var B,H,Y;if(t!=null&&t.customData){const q=t.customData;f.setFieldsValue(q)}else{const q=(B=n==null?void 0:n.sourceData)==null?void 0:B[0],te=m(q==null?void 0:q.value)||[];f.setFieldsValue({...u,dataSourceId:q==null?void 0:q.value,type:t==null?void 0:t.type,xAxis:(H=te==null?void 0:te[0])==null?void 0:H.value})}P((Y=t==null?void 0:t.customData)==null?void 0:Y.conditionData),j()},[t,n]),D.jsxs("div",{style:{height:"50vh",overflowX:"auto"},className:fn(rfe[`${nfe}`]),ref:a,children:[D.jsxs(K.Form,{form:f,name:"customData",layout:"vertical",onValuesChange:W,initialValues:u,children:[D.jsx(K.Form.Item,{label:i("dataSource"),name:"dataSourceId",children:D.jsx(K.Select,{options:(n==null?void 0:n.sourceData)??[]})}),D.jsxs(K.Form.Item,{label:i("dataRange"),children:[D.jsx(K.Button,{style:{marginLeft:"-15px"},onClick:()=>{S(!0)},type:"link",children:i("filterData")}),M>0?`${i("selectNcondition",{n:M})}`:null]}),D.jsx(K.Form.Item,{label:i("chart.t1"),name:"type",children:D.jsx(K.Select,{options:o,optionRender:B=>D.jsxs(K.Flex,{align:"center",children:[D.jsx("span",{role:"img",style:{marginTop:"5px"},"aria-label":B.data.label,children:B.data.icon}),B.data.label]})})}),D.jsx(K.Form.Item,{name:"chartOptions",label:i("chart.t12"),children:D.jsxs(K.Checkbox.Group,{children:[D.jsx(K.Checkbox,{value:"legend",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t13")}),D.jsx(K.Checkbox,{value:"label",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t14")}),["chart-pie","chart-pie-circular"].includes(c)?null:D.jsxs(D.Fragment,{children:[D.jsx(K.Checkbox,{value:"axis",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t15")}),D.jsx(K.Checkbox,{value:"splitLine",className:"ow-checkbox",style:{lineHeight:"32px"},children:i("chart.t16")})]})]})}),D.jsx(K.Divider,{style:{borderColor:"#e2e2e2",marginTop:0}}),D.jsx(K.Form.Item,{label:c!=null&&c.includes("pie")?i("chart.t17"):i("chart.t18"),name:"xAxis",children:D.jsx(K.Select,{options:b})}),D.jsx(K.Form.Item,{noStyle:!0,dependencies:["type","xAxis"],children:({getFieldValue:B})=>w(B("xAxis"))?D.jsx(D.Fragment,{children:D.jsx(K.Form.Item,{name:"timeGroupInterval",label:i("chart.t39"),children:D.jsx(K.Select,{options:s})})}):D.jsx(D.Fragment,{children:D.jsx(K.Form.Item,{name:"displayRange",label:i("displayRange.title"),children:D.jsx(K.Select,{options:l})})})}),D.jsx(K.Form.Item,{dependencies:["type"],noStyle:!0,children:({getFieldValue:B})=>{var H;return(H=B("type"))!=null&&H.includes("pie")?null:D.jsxs(D.Fragment,{children:[D.jsx(K.Form.Item,{name:"sortField",label:i("chart.t31"),children:D.jsxs(K.Radio.Group,{children:[D.jsx(K.Radio,{value:"xAxis",children:i("chart.t32")}),D.jsx(K.Radio,{value:"yAxisField",children:i("chart.t33")}),D.jsx(K.Radio,{value:"recordValue",children:i("chart.t34")})]})}),D.jsx(K.Form.Item,{name:"sortOrder",label:i("chart.t35"),children:D.jsxs(K.Radio.Group,{children:[D.jsx(K.Radio,{value:"asc",children:i("chart.t36")}),D.jsx(K.Radio,{value:"desc",children:i("chart.t37")})]})})]})}}),D.jsx(K.Form.Item,{label:c!=null&&c.includes("pie")?i("chart.t19"):i("chart.t20"),name:"yAxis",children:D.jsx(K.Select,{options:[{value:"recordTotal",label:i("statisticstRecordNum")},{value:"fieldValue",label:i("statisticstFieldVal")}]})}),D.jsx(K.Form.Item,{dependencies:["yAxis","type","isGroup"],noStyle:!0,children:({getFieldValue:B})=>B("yAxis")==="fieldValue"?D.jsx(K.Form.Item,{label:i("selectField"),children:D.jsx("div",{style:{display:"flex",justifyContent:"space-between"},children:D.jsxs(K.Space.Compact,{children:[D.jsx(K.Form.Item,{noStyle:!0,name:"yAxisField",children:D.jsx(K.Select,{style:{width:"100px"},options:C})}),D.jsx(K.Form.Item,{name:"yAxisFieldType",noStyle:!0,children:D.jsx(K.Select,{style:{width:"100px"},options:[{value:"sum",label:i("sumVal")},{value:"max",label:i("maxVal")},{value:"min",label:i("minVal")},{value:"avg",label:i("averageVal")}]})})]})})}):null}),D.jsx(K.Form.Item,{dependencies:["type","isGroup"],noStyle:!0,children:({getFieldValue:B})=>{var H;return(H=B("type"))!=null&&H.includes("pie")?null:D.jsxs(D.Fragment,{children:[D.jsx(K.Form.Item,{name:"isGroup",valuePropName:"checked",noStyle:!0,children:D.jsx(K.Checkbox,{style:{marginBottom:"5px"},children:i("chart.t38")})}),D.jsx(K.Form.Item,{dependencies:["isGroup"],noStyle:!0,children:({getFieldValue:Y})=>Y("isGroup")?D.jsx(K.Form.Item,{name:"groupField",children:D.jsx(K.Select,{options:_})}):null}),D.jsx(K.Spin,{spinning:F,children:D.jsx(K.Form.Item,{name:"groupFieldConfig",label:i("chart.groupFieldConfig"),hidden:!(B("type")===Lr.chartCombination&&B("isGroup")),children:D.jsx(eN,{options:k})})})]})}})]}),D.jsx(V0,{open:x,value:T,fieldOptions:y,enumDataApi:r,onClose:()=>{S(!1)},onOk:B=>{P(B),j()}})]})},afe=({customData:t,selectModuleData:e,onAllValuesChange:r})=>{var s,l,u;const[n]=K.Form.useForm(),{t:i}=At(),a={xtitle:"",ytitle:""},o=()=>{setTimeout(()=>{r==null||r(n.getFieldsValue())})};return I.useEffect(()=>{e!=null&&e.customeStyle?n.setFieldsValue(e.customeStyle):n.setFieldsValue(a)},[e]),(s=t==null?void 0:t.type)!=null&&s.includes("pie")?D.jsx("div",{style:{height:"50vh",overflowX:"auto"}}):D.jsx("div",{style:{height:"50vh",overflowX:"auto"},children:D.jsxs(K.Form,{form:n,name:"customeStyle",layout:"vertical",initialValues:a,children:[D.jsx(K.Divider,{orientation:"left",orientationMargin:"0",children:i("chart.t21")}),(l=t==null?void 0:t.type)!=null&&l.includes("pie")?null:D.jsx(K.Form.Item,{label:i("chart.t22"),name:"xtitle",children:D.jsx(Yn,{onChange:()=>{o()}})}),D.jsx(K.Divider,{orientation:"left",orientationMargin:"0",children:i("chart.t26")}),(u=t==null?void 0:t.type)!=null&&u.includes("pie")?null:D.jsx(K.Form.Item,{label:i("chart.t27"),name:"ytitle",children:D.jsx(Yn,{onChange:()=>{o()}})})]})})},ofe=({open:t,onClose:e,onOk:r,moduleDataApi:n,selectModuleData:i,enumDataApi:a})=>{var v;const{t:o}=At(),[s,l]=I.useState(),[u,f]=I.useState();I.useRef(null);const c=(v=s==null?void 0:s.type)==null?void 0:v.includes("pie");I.useEffect(()=>{i&&(l(i==null?void 0:i.customData),f(i==null?void 0:i.customeStyle))},[i]);const[d,h]=I.useState("");return I.useEffect(()=>{t&&h(i!=null&&i.title?i==null?void 0:i.title:o("chartText"))},[t]),D.jsx(D.Fragment,{children:D.jsx(K.Modal,{width:"65%",title:D.jsx(Dd,{value:d,onChange:h}),footer:null,open:t,onCancel:e,destroyOnClose:!0,closeIcon:D.jsx(zc,{}),className:"ow-modal ow-modal-2",children:D.jsxs("div",{className:"config-widget-dialog-container",children:[D.jsx("div",{className:"config-widget-dialog-content",children:D.jsx("div",{className:"config-widget-dialog-preview",children:D.jsx(Z8,{customData:s,customeStyle:u,moduleDataApi:n})})}),D.jsxs("div",{className:"config-widget-dialog-panel",children:[D.jsx("div",{className:"bitable-dashboard edit-panel-container",children:D.jsx(K.Tabs,{defaultActiveKey:"1",items:[{key:"1",label:o("typeData"),children:D.jsx(ife,{enumDataApi:a,selectModuleData:i,onAllValuesChange:g=>{l(g)}})},...c?[]:[{key:"2",label:o("customStyle"),children:D.jsx(afe,{customData:s,selectModuleData:i,onAllValuesChange:g=>{f(g)}})}]]})}),D.jsx("div",{className:"button-container",children:D.jsx(K.Button,{type:"primary",onClick:()=>{r==null||r({id:i==null?void 0:i.id,type:i==null?void 0:i.type,customData:s,customeStyle:u,title:d})},children:o("confirm")})})]})]})})})};function y_(t,e){const{ranges:r,step:n}=e;let i=null,a=null;for(let o=0;o<r.length-1;o++){const[s,l]=r[o],[u,f]=r[o+1];if(t>=s&&t<=u){i=[s,l],a=[u,f];break}}if(t<r[0][0]&&(i=r[0],a=r[1]),t>r[r.length-1][0]&&(i=r[r.length-2],a=r[r.length-1]),i&&a){let[o,s]=i,[l,u]=a;const f=(u-s)/(l-o),c=s-f*o,d=f*t+c;return Math.round(d/n)*n}if(i||a){let o=i||a,[s,l]=o;const u=l*t/s;return Math.round(u/n)*n}throw new Error("Unexpected error in range calculation")}function sfe(t,e=0){if(!Number.isFinite(t))throw new Error("Value must be a finite number.");return new Intl.NumberFormat(void 0,{style:"percent",minimumFractionDigits:e,maximumFractionDigits:e}).format(t)}function b_(t,e=0){if(!Number.isFinite(t))return"";const r=new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:e}).format(t),[n,i]=r.split("."),a=(i||"").padEnd(e,"0");return`${n}${e>0?".":""}${a}`}const lfe=({moduleDataApi:t,customData:e,customeStyle:r})=>{const[n,i]=I.useState(),[a,o]=I.useState(!1),{globalFilterCondition:s}=dn();let l=I.useMemo(()=>s==null?void 0:s.find(m=>(m==null?void 0:m.dataSourceId)===(e==null?void 0:e.dataSourceId)),[s,e==null?void 0:e.dataSourceId]);const u=Tt(async()=>{var p,m,y;if(e){let b="";o(!0),e.statisticalMethod==="fieldValue"&&e.field?b+=`select=${e.field}.${e==null?void 0:e.statisticalType}()`:e.statisticalMethod==="recordTotal"&&(b+="select=id.count()");let C=[];if((((p=l==null?void 0:l.conditionList)==null?void 0:p.length)??0)>0&&C.push(l),(((y=(m=e==null?void 0:e.conditionData)==null?void 0:m.conditionList)==null?void 0:y.length)??0)>0&&C.push(e==null?void 0:e.conditionData),C.length>0){let _=Qd(C);b+=_?`&${_}`:""}e!=null&&e.dataSourceId&&(t==null||t({id:e==null?void 0:e.dataSourceId,query:b}).then(_=>{if(!_.success){K.message.error(_.message);return}i(_.data)}).finally(()=>{o(!1)}))}else i([])});I.useEffect(()=>{e&&u()},[e==null?void 0:e.conditionData,e==null?void 0:e.statisticalMethod,e==null?void 0:e.statisticalType,e==null?void 0:e.field,e==null?void 0:e.dataSourceId,l]);const{formatCurrency:f}=dn(),c=Tt(f),d=I.useMemo(()=>{var _,w,x,S,E;if(!n)return"";const p=n,{statisticalMethod:m,statisticalType:y,field:b}=e||{};let C=0;if(p.length&&m==="fieldValue"&&b)switch(y){case"sum":C=((_=p==null?void 0:p[0])==null?void 0:_.sum)||0;break;case"max":C=((w=p==null?void 0:p[0])==null?void 0:w.max)||0;break;case"min":C=((x=p==null?void 0:p[0])==null?void 0:x.min)||0;break;case"avg":C=((S=p==null?void 0:p[0])==null?void 0:S.avg)||0;break;default:C=0}else m==="recordTotal"&&(C=((E=p==null?void 0:p[0])==null?void 0:E.count)||0);if(r!=null&&r.unit){const{unit:T,precision:A}=r;switch(`${T}`){case"4":case"5":case"6":case"7":case"8":case"9":C=(c==null?void 0:c(C,A))??C;break;case"1":C=b_(C,A);break;case"3":C=sfe(C,A);break;default:C=b_(C,A)}}else C=b_(C,r==null?void 0:r.precision);return C},[n,e,r]),h=I.useRef(),v=Em(h),g=I.useMemo(()=>{if(!v)return null;let p=0,m=32,y=0,b=0;p=y_(v.width,{ranges:[[116,16],[760,56]],step:4}),p=Math.max(16,Math.min(72,p));let C=v.width-p*2,_=v.height-m*2;{y=y_(C,{ranges:[[400,60],[500,64]],step:.1});const w=16,x=Math.min(72,_/2);y=Math.max(w,Math.min(x,y))}{b=y_(_,{ranges:[[140,12],[500,24],[860,36]],step:.1});const w=12,x=Math.min(36,_/2);b=Math.max(w,Math.min(x,b))}return{PX:p,PY:m,fontSize:y,subFontSize:b}},[v]);return D.jsxs("div",{ref:h,style:{display:"flex",height:"100%",width:"100%"},children:[a?D.jsx(K.Spin,{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",background:"rgba(255,255,255,0.6)",top:0,left:0,right:0,bottom:0,zIndex:1e3},spinning:a}):null,D.jsxs("div",{style:{overflow:"hidden",position:"relative",flex:1,display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",padding:`${g==null?void 0:g.PY}px ${g==null?void 0:g.PX}px`},children:[d!==""&&D.jsx("div",{style:{width:"100%",position:"relative",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"center"},children:D.jsx("span",{style:{fontWeight:"bold",lineHeight:`${g==null?void 0:g.fontSize}px`,fontSize:`${g==null?void 0:g.fontSize}px`,color:r==null?void 0:r.color},children:d})}),(r==null?void 0:r.desc)!==""&&D.jsx("div",{style:{width:"100%",position:"relative",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"center"},children:D.jsx("span",{style:{fontSize:`${g==null?void 0:g.subFontSize}px`,lineHeight:`${g==null?void 0:g.subFontSize}px`,color:r==null?void 0:r.color,textAlign:"center"},children:r==null?void 0:r.desc})})]})]})},tN=I.memo(lfe),ufe=({selectModuleData:t,onAllValuesChange:e,enumDataApi:r})=>{const{globalData:n}=dn(),{t:i}=At(),[a,o]=I.useState(),[s,l]=I.useState(),u=_=>{var x,S;const w=(S=(x=n==null?void 0:n.sourceData)==null?void 0:x.find(E=>E.value===_))==null?void 0:S.fields;o(w),l(w==null?void 0:w.filter(E=>E.type==="int"||E.type==="float"))},[f]=K.Form.useForm(),c={dataSourceId:"",statisticalMethod:"recordTotal",field:""},d=()=>{setTimeout(()=>{e==null||e({...f.getFieldsValue(),conditionData:g.current})})},[h,v]=I.useState(!1),g=I.useRef(),[p,m]=I.useState({conditionList:[],conditionType:"all"}),[y,b]=I.useState(0),C=_=>{var w;m(_),g.current=_,b(((w=_==null?void 0:_.conditionList)==null?void 0:w.length)||0)};return I.useEffect(()=>{var _,w;if(t!=null&&t.customData){const x=t.customData;f.setFieldsValue(x),u(x==null?void 0:x.dataSourceId)}else{const x=(_=n==null?void 0:n.sourceData)==null?void 0:_[0];f.setFieldsValue({...c,dataSourceId:x==null?void 0:x.value}),u(x==null?void 0:x.value),d()}C((w=t==null?void 0:t.customData)==null?void 0:w.conditionData)},[t,n]),D.jsxs(D.Fragment,{children:[D.jsxs(K.Form,{form:f,name:"customData",layout:"vertical",initialValues:c,children:[D.jsx(K.Form.Item,{label:i("dataSource"),name:"dataSourceId",children:D.jsx(K.Select,{options:n==null?void 0:n.sourceData,onChange:_=>{f.setFieldsValue({statisticalMethod:"recordTotal"}),u(_),d(),C({conditionList:[],conditionType:"all"})}})}),D.jsxs(K.Form.Item,{label:i("dataRange"),children:[D.jsx(K.Button,{style:{marginLeft:"-15px"},onClick:()=>{v(!0)},type:"link",children:i("filterData")}),y>0?`${i("selectNcondition",{n:y})}`:null]}),D.jsx(K.Divider,{style:{borderColor:"#e2e2e2",marginTop:0}}),D.jsx(K.Form.Item,{label:i("statisticstMethods"),name:"statisticalMethod",children:D.jsx(K.Select,{onChange:_=>{f.setFieldsValue({field:_==="fieldValue"?s==null?void 0:s[0].value:"",statisticalType:"sum"}),d()},options:[{value:"recordTotal",label:i("statisticstRecordNum")},{value:"fieldValue",label:i("statisticstFieldVal")}]})}),D.jsx(K.Form.Item,{dependencies:["statisticalMethod"],children:({getFieldValue:_})=>_("statisticalMethod")==="fieldValue"?D.jsx(K.Form.Item,{label:i("selectField"),children:D.jsxs(K.Space.Compact,{children:[D.jsx(K.Form.Item,{noStyle:!0,name:"field",children:D.jsx(K.Select,{style:{width:"100px"},dropdownStyle:{width:250},onChange:()=>{d()},options:s})}),D.jsx(K.Form.Item,{name:"statisticalType",noStyle:!0,children:D.jsx(K.Select,{style:{width:"100px"},dropdownStyle:{width:180},onChange:()=>{d()},options:[{value:"sum",label:i("sumVal")},{value:"max",label:i("maxVal")},{value:"min",label:i("minVal")},{value:"avg",label:i("averageVal")}]})})]})}):null})]}),D.jsx(V0,{open:h,value:p,fieldOptions:a,enumDataApi:r,onClose:()=>{v(!1)},onOk:_=>{C(_),d()}})]})},ffe=({value:t,onChange:e})=>{const[r,n]=I.useState(),i=["#373c43","#3370ff","#4954e6","#34c724","#14c0ff","#ffc60a","#f80","#f76964"];return I.useEffect(()=>{n(t)},[t]),D.jsx("div",{className:"pane-item-body item-body-column",children:D.jsx("div",{className:"panel-single-color-selector",children:i.map((a,o)=>D.jsxs("div",{className:"panel-single-color-selector-color-item",onClick:()=>{n(a),e==null||e(a)},children:[D.jsx("div",{className:"panel-single-color-selector-color-item-background",style:{background:a}}),r===a?D.jsx("span",{className:"panel-icon",children:D.jsx(qw,{})}):null]},o))})})},cfe=({selectModuleData:t,onAllValuesChange:e})=>{const[r]=K.Form.useForm(),{t:n,i18n:i}=At(),a=I.useMemo(()=>[{value:"1",label:n("statistics.t5")},{value:"2",label:n("statistics.t6")},{value:"3",label:n("statistics.t7")},{value:"9",label:n("statistics.currency")}],[i.language]),o={color:"#373c43",unit:"1",precision:"",desc:""},s=()=>{setTimeout(()=>{e==null||e(r.getFieldsValue())})};return I.useEffect(()=>{if(t!=null&&t.customeStyle){`${t.customeStyle.unit??o.unit}`;let l={...o,...t.customeStyle,unit:`${t.customeStyle.unit??o.unit}`};r.setFieldsValue(l)}else r.setFieldsValue(o)},[t]),D.jsxs(K.Form,{form:r,name:"customeStyle",layout:"vertical",initialValues:o,children:[D.jsx(K.Form.Item,{label:n("statistics.t1"),name:"color",children:D.jsx(ffe,{onChange:()=>{s()}})}),D.jsx(K.Form.Item,{label:n("statistics.t2"),extra:n("statistics.t3"),children:D.jsxs(K.Space.Compact,{children:[D.jsx(K.Form.Item,{name:"precision",noStyle:!0,children:D.jsx(K.InputNumber,{min:1,max:10,style:{width:"60%"},placeholder:n("statistics.t4"),onChange:()=>{s()}})}),D.jsx(K.Form.Item,{name:"unit",noStyle:!0,children:D.jsx(K.Select,{onChange:()=>{s()},children:a.map(l=>{const{value:u,label:f}=l;return D.jsx(K.Select.Option,{value:u,children:f},u)})})})]})}),D.jsx(K.Form.Item,{label:n("statistics.t10"),name:"desc",children:D.jsx(Yn,{onChange:()=>{s()}})})]})},dfe=({open:t,onClose:e,onOk:r,moduleDataApi:n,selectModuleData:i,enumDataApi:a})=>{const{t:o}=At(),[s,l]=I.useState(),[u,f]=I.useState();I.useEffect(()=>{i&&(l(i==null?void 0:i.customData),f(i==null?void 0:i.customeStyle))},[i]);const[c,d]=I.useState("");return I.useEffect(()=>{t&&d(i!=null&&i.title?i==null?void 0:i.title:o("statisticsText"))},[t]),D.jsx(D.Fragment,{children:D.jsx(K.Modal,{width:"65%",title:D.jsx(Dd,{value:c,onChange:d}),footer:null,open:t,onCancel:e,closeIcon:D.jsx(zc,{}),className:"ow-modal ow-modal-2",children:D.jsxs("div",{className:"config-widget-dialog-container",children:[D.jsx("div",{className:"config-widget-dialog-content",children:D.jsx("div",{className:"config-widget-dialog-preview",children:D.jsx(tN,{customData:s,customeStyle:u,moduleDataApi:n})})}),D.jsxs("div",{className:"config-widget-dialog-panel",children:[D.jsx("div",{className:"bitable-dashboard edit-panel-container",children:D.jsx(K.Tabs,{defaultActiveKey:"1",items:[{key:"1",label:o("typeData"),children:D.jsx(ufe,{selectModuleData:i,enumDataApi:a,onAllValuesChange:h=>{l(h)}})},{key:"2",label:o("customStyle"),children:D.jsx(cfe,{selectModuleData:i,onAllValuesChange:h=>{f(h)}})}]})}),D.jsx("div",{className:"button-container",children:D.jsx(K.Button,{type:"primary",onClick:()=>{r==null||r({id:i==null?void 0:i.id,customData:s,customeStyle:u,title:c})},children:o("confirm")})})]})]})})})},hfe=t=>D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",...t,children:[D.jsx("g",{clipPath:"url(#a)",children:D.jsx("path",{fill:"#000",fillRule:"evenodd",d:"M3 2.666a.167.167 0 0 0-.166.167v1.634c0 .057.03.11.077.14l3.05 1.94c.336.215.54.586.54.985v4.634a.5.5 0 1 1-1 0V7.532c0-.057-.03-.11-.078-.14L2.374 5.45a1.167 1.167 0 0 1-.54-.984V2.833c0-.645.522-1.167 1.167-1.167h10c.644 0 1.166.522 1.166 1.167v1.634c0 .399-.204.77-.54.984l-3.05 1.94a.167.167 0 0 0-.076.141v6.3a.5.5 0 0 1-1 0v-6.3c0-.399.203-.77.54-.984l3.05-1.94a.167.167 0 0 0 .076-.141V2.833a.167.167 0 0 0-.166-.167H3Z",clipRule:"evenodd"})}),D.jsx("defs",{children:D.jsx("clipPath",{id:"a",children:D.jsx("path",{fill:"#fff",d:"M0 0h16v16H0z"})})})]}),rN=I.createContext({}),C_=()=>I.useContext(rN),Bp=(t,e)=>`${t}-${e}`,vfe=t=>{var l,u;const{t:e}=At(),{fieldPickerDataSource:r,flattenFieldMap:n}=C_(),[i,a]=Ao(t),o=Tt(f=>{const[c,d]=f.keyPath;let h=c==null?void 0:c.replace(`${d}-`,"");h&&a({dataSourceId:d,field:h})}),s=I.useMemo(()=>{{let f=Bp(i==null?void 0:i.dataSourceId,i==null?void 0:i.field);return n==null?void 0:n.get(f)}},[i,n]);return D.jsx(K.Dropdown,{trigger:["click"],menu:{selectable:!0,selectedKeys:s?[(l=s==null?void 0:s.source)==null?void 0:l.value,s==null?void 0:s.mergeId]:[],items:r,onClick:o},children:D.jsx(K.Select,{open:!1,placeholder:e("selectGroupField"),style:{width:200},value:((u=s==null?void 0:s.field)==null?void 0:u.label)??void 0})})},__=t=>{const[e,r]=Ao(t),n=I.useMemo(()=>e!=null&&e.field?{dataSourceId:e==null?void 0:e.dataSourceId,field:e==null?void 0:e.field}:void 0,[e==null?void 0:e.field,e==null?void 0:e.dataSourceId]),i=u=>{var c;const f={condition:"=",val:"",val2:"",rdate:"exactdate"};if(u){let d=a==null?void 0:a.get(Bp(u.dataSourceId,u.field));r({...f,dataSourceId:u.dataSourceId,field:u.field,type:(c=d==null?void 0:d.field)==null?void 0:c.type})}else r({...f,dataSourceId:void 0,field:void 0,type:void 0})},{flattenFieldMap:a}=C_(),o=a==null?void 0:a.get(Bp(e==null?void 0:e.dataSourceId,e==null?void 0:e.field)),s=qS(e,["field"]),l=Tt(u=>r({...e,...u}));return D.jsxs("div",{style:{display:"flex",gap:"10px"},children:[D.jsx(vfe,{value:n,onChange:i}),D.jsx(IT,{value:s,onChange:l,field:o==null?void 0:o.field}),D.jsx(Cg,{style:{cursor:"pointer"},onClick:t.onDelete})]})};__.displayName="ConditionRowItem";const wc={"global-filter-condition__popover":"_global-filter-condition__popover_qw1om_1","global-filter-condition__block":"_global-filter-condition__block_qw1om_4","sub-popup":"_sub-popup_qw1om_10"},Ip="global-filter-condition",pfe=[],nN=t=>{const{className:e,style:r}=t,{t:n}=At(),{globalFilterCondition:i,setGlobalFilterCondition:a}=dn(),[o,s]=I.useState(!1),{globalData:l}=dn(),{fieldPickerDataSource:u,flattenFieldMap:f}=I.useMemo(()=>{let c=new Map;return{fieldPickerDataSource:((l==null?void 0:l.sourceData)||[]).map(h=>{let v=((h==null?void 0:h.fields)||[]).map(g=>{let p=Bp(h==null?void 0:h.value,g==null?void 0:g.value);return c.set(p,{field:g,source:h,mergeId:p}),{key:p,label:g==null?void 0:g.label,disabled:g.disabled??!1}});return{key:h==null?void 0:h.value,label:h==null?void 0:h.label,children:v,popupClassName:wc["sub-popup"]}}),flattenFieldMap:c}},[l==null?void 0:l.sourceData]);return D.jsx(rN.Provider,{value:{fieldPickerDataSource:u,flattenFieldMap:f},children:D.jsx("div",{className:fn(wc[`${Ip}`],e),style:r,children:D.jsx(K.Popover,{content:D.jsx(gfe,{defaultValue:i,onClose:(c,d)=>{c&&a(d),s(!1)}}),destroyTooltipOnHide:!0,placement:"bottomRight",trigger:"click",open:o,onOpenChange:s,children:D.jsx(K.Button,{className:`!px-1 ${((i==null?void 0:i.length)??0)>0?"!bg-primary/10":""}`,type:"text",icon:D.jsx(hfe,{}),children:n("globalfilter")})})})})};nN.displayName="GlobalFilterCondition";const gfe=t=>{const{defaultValue:e}=t,{t:r}=At(),n=C_().fieldPickerDataSource,i=RT(),[a=pfe,o]=I.useState([]);I.useEffect(()=>{e&&o(NV(e))},[e]);const[s,l]=I.useState([]),u=h=>{h!=null&&h.field&&o(v=>{let g=[...v],p=g.find(m=>m.dataSourceId===h.dataSourceId);if(p)return p.conditionList.push(h),[...g];{let m={dataSourceId:h.dataSourceId,conditionType:"all",conditionList:[h]};return[...g,m]}})},f=()=>{l([...s,{}])},c=I.useMemo(()=>!GS(a,e),[a,e]),d=Tt(()=>{var h;(h=t==null?void 0:t.onClose)==null||h.call(t,!0,a)});return D.jsxs("div",{className:fn(wc[`${Ip}__popover`]),children:[D.jsx("div",{style:{marginBottom:"10px"},children:r("setFilterCondition")}),a.map((h,v)=>{var m;let g=h==null?void 0:h.conditionList,p=(m=n==null?void 0:n.find(y=>y.key===(h==null?void 0:h.dataSourceId)))==null?void 0:m.label;return console.log("dataSourceName",p),D.jsxs("div",{className:fn(wc[`${Ip}__block`]),children:[D.jsxs("div",{style:{marginBottom:"10px",display:"flex",justifyContent:"space-between"},children:[D.jsx("div",{children:p}),D.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[r("conformTo"),D.jsx(K.Select,{style:{width:"80px"},options:i,value:h==null?void 0:h.conditionType,onChange:y=>{o(b=>{let C=[...b];return C[v].conditionType=y,C})}}),r("addCondition")]})]}),D.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:g.map((y,b)=>D.jsx(__,{value:y,onChange:C=>{o(_=>{let w=[..._],x=w[v].conditionList[b];if((x==null?void 0:x.dataSourceId)!==(C==null?void 0:C.dataSourceId)){w[v].conditionList.splice(b,1),w[v].conditionList.length===0&&w.splice(v,1);let S=C,E=w.find(T=>T.dataSourceId===S.dataSourceId);if(E)return E.conditionList.push(S),[...w];{let T={dataSourceId:S.dataSourceId,conditionType:"all",conditionList:[S]};return[...w,T]}}else w[v].conditionList[b]={...x,...C};return w})},onDelete:()=>{o(C=>{let _=[...C];return _[v].conditionList.splice(b,1),_[v].conditionList.length===0&&_.splice(v,1),_})}},b))})]},h==null?void 0:h.dataSourceId)}),s.map((h,v)=>D.jsx("div",{className:fn(wc[`${Ip}__block`]),children:D.jsx(__,{value:h,onChange:g=>{u(g)},onDelete:()=>{l(g=>{let p=[...g];return p.splice(v,1),p})}})},v)),D.jsx(K.Button,{type:"dashed",block:!0,style:{marginBottom:"10px"},icon:D.jsx(Hc,{}),onClick:()=>{f()},children:r("addCondition")}),D.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:D.jsx(K.Button,{type:"primary",disabled:!c,onClick:()=>{d()},children:r("confirm")})})]})};/*!
|
|
164
164
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
165
165
|
*
|
|
166
166
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|