import { inject as bl, ref as fe, provide as xl, readonly as Nd, computed as re, defineComponent as Me, shallowRef as lc, reactive as wl, toRef as Vd, onBeforeMount as oc, onMounted as An, watchEffect as ka, onBeforeUnmount as no, watch as Fe, openBlock as E, createElementBlock as B, normalizeStyle as He, normalizeClass as Ae, renderSlot as Ti, createCommentVNode as ye, unref as f, getCurrentScope as Fd, onScopeDispose as Bd, nextTick as zn, toRefs as ar, Fragment as $e, renderList as Xe, createBlock as Ce, mergeProps as Hd, withCtx as R, withDirectives as ac, createVNode as k, vShow as sc, getCurrentInstance as Wd, onUnmounted as Xi, useSlots as jd, createElementVNode as y, resolveComponent as ot, toDisplayString as I, createTextVNode as ce, resolveDynamicComponent as rc, withModifiers as En, Teleport as Gd, toRaw as ts, h as Tn, toValue as Yd } from "vue";
import { merge as sr } from "lodash-es";
import { defineStore as Bs } from "pinia";
import { Input as Ze, InputNumber as on, Slider as xn, Select as Qe, Button as tt, Radio as ns, Space as jl, Collapse as Ca, Tooltip as $n, Dropdown as Vo, Menu as li, Spin as Zn, DatePicker as Ud, Checkbox as Ui, Form as Kd, Modal as Ul, Tag as Kl, Switch as Ci, Divider as Xd, Popover as Qd, Drawer as Jd, Row as Zd, Col as ef, Card as tf, App as uc, theme as rr, ConfigProvider as nf, Layout as ur } from "ant-design-vue";
import cr from "dayjs";
const lf = {
  "common.auto": "Auto",
  "app.tab.dashboard": "Dashboard",
  "app.tab.scene": "Scene View",
  "app.tab.topology": "Topology",
  "app.tab.logs": "Logs",
  "app.tab.traces": "Traces",
  "app.tab.querybuilder": "Query Builder",
  "app.tab.grafana": "Grafana Data",
  "app.tab.zabbix": "Zabbix",
  "app.theme.toDark": "Switch to Dark",
  "app.theme.toLight": "Switch to Light",
  "time.last1h": "Last 1 hour",
  "time.last3h": "Last 3 hours",
  "time.last6h": "Last 6 hours",
  "time.last24h": "Last 24 hours",
  "time.last7d": "Last 7 days",
  "time.last30d": "Last 30 days",
  "panel.menu.edit": "Edit",
  "panel.menu.clone": "Clone",
  "panel.menu.fullscreen": "Fullscreen",
  "panel.menu.refresh": "Refresh",
  "panel.menu.remove": "Remove",
  "panel.remove.title": 'Remove "{title}"?',
  "panel.remove.content": "This action cannot be undone.",
  "panel.remove.ok": "Remove",
  "dashboard.edit": "Edit",
  "dashboard.save": "Save",
  "dashboard.cancel": "Cancel",
  "dashboard.cancelConfirmTitle": "Discard unsaved changes?",
  "dashboard.cancelConfirmOk": "Discard changes",
  "dashboard.cancelConfirmCancel": "Keep editing",
  "dashboard.addPanel": "Add Panel",
  "dashboard.clearPanels": "Clear Panels",
  "dashboard.clearConfirmTitle": "Clear all panels?",
  "dashboard.clearConfirmOk": "Clear all",
  "dashboard.export": "Export",
  "dashboard.import": "Import",
  "dashboard.exportSuccess": "Dashboard exported",
  "dashboard.importSuccess": "Dashboard imported",
  "dashboard.importError": "Invalid dashboard JSON",
  "config.section.general": "General",
  "config.section.value": "Stat Style",
  "config.section.style": "Style",
  "config.section.tooltip": "Tooltip",
  "config.section.format": "Formatting",
  "config.section.thresholds": "Thresholds ({n})",
  "config.section.axes": "Axes",
  "config.section.links": "Links ({n})",
  "config.section.gaugeStyle": "Gauge Style",
  "config.section.pieStyle": "Pie Style",
  "config.section.histStyle": "Histogram Style",
  "config.section.tableStyle": "Table Style",
  "config.section.overrides": "Field Overrides",
  "config.type.timeseries": "Time Series",
  "config.type.bar": "Bar Chart",
  "config.type.histogram": "Histogram",
  "config.type.stat": "Stat / Value",
  "config.type.gauge": "Gauge",
  "config.type.table": "Table",
  "config.type.pie": "Pie Chart",
  "panel.type.desc.timeseries": "Line/area chart with time axis",
  "panel.type.desc.bar": "Grouped or stacked bars",
  "panel.type.desc.histogram": "Distribution buckets",
  "panel.type.desc.stat": "Single value with sparkline",
  "panel.type.desc.gauge": "Circular gauge meter",
  "panel.type.desc.table": "Sortable data table",
  "panel.type.desc.pie": "Pie or donut chart",
  "config.field.title": "Title",
  "config.field.description": "Description",
  "config.field.panelType": "Panel Type",
  "config.field.colorScheme": "Color Scheme",
  "config.field.lineWidth": "Line Width",
  "config.field.fillOpacity": "Fill Opacity",
  "config.field.drawStyle": "Style",
  "config.field.interpolation": "Interpolation",
  "config.field.lineStyle": "Line Style",
  "config.field.showPoints": "Show Points",
  "config.field.legendPosition": "Legend Position",
  "config.field.unit": "Unit",
  "config.field.decimals": "Decimals",
  "config.field.min": "Min",
  "config.field.max": "Max",
  "config.field.reducer": "Calculation",
  "config.field.tooltipMode": "Tooltip Mode",
  "config.field.softMin": "Soft Min",
  "config.field.softMax": "Soft Max",
  "config.field.logScale": "Log Scale",
  "config.field.axisPlacement": "Placement",
  "config.field.showGridLines": "Grid Lines",
  "config.field.scaleDistribution": "Scale",
  "config.field.centeredZero": "Centered Zero",
  "config.field.stacked": "Stacked",
  "config.interp.linear": "Linear",
  "config.interp.smooth": "Smooth",
  "config.interp.step": "Step",
  "config.linestyle.solid": "Solid",
  "config.linestyle.dashed": "Dashed",
  "config.linestyle.dotted": "Dotted",
  "config.legend.bottom": "Bottom",
  "config.legend.right": "Right",
  "config.legend.hidden": "Hidden",
  "config.unit.none": "None",
  "config.unit.ms": "Milliseconds (ms)",
  "config.unit.percent": "Percent (0-100)",
  "config.unit.reqps": "Requests/sec",
  "config.threshold.label": "Label",
  "config.threshold.base": "Base",
  "config.threshold.add": "Add Threshold",
  "config.threshold.mode": "Threshold Mode",
  "config.threshold.modeAbsolute": "Absolute",
  "config.threshold.modePercentage": "Percentage",
  "dashboard.refresh": "Refresh",
  "dashboard.empty": "No panels yet",
  "dashboard.emptyHint": 'Click "Edit" then "Add Panel" to get started',
  "variable.modal.placeholder": 'Click "Add Variable" on the left to start',
  "variable.custom.title": "Custom Options",
  "variable.custom.add": "Add Option",
  "variable.custom.allValue": "All Value",
  "config.scheme.grafana-classic": "Grafana Classic",
  "config.scheme.green-yellow-red": "Green-Yellow-Red",
  "config.scheme.red-yellow-green": "Red-Yellow-Green",
  "config.scheme.blue-yellow-red": "Blue-Yellow-Red",
  "config.scheme.blue-purple": "Blue-Purple",
  "config.scheme.yellow-blue": "Yellow-Blue",
  "config.scheme.blues": "Blues",
  "config.scheme.reds": "Reds",
  "config.scheme.GrYlRd": "GrYlRd",
  "config.scheme.purple-orange": "Purple-Orange",
  "variable.modal.title": "Variable Config",
  "variable.modal.save": "Save",
  "variable.modal.cancel": "Cancel",
  "variable.modal.delete": "Delete Variable",
  "variable.modal.add": "Add Variable",
  "variable.modal.empty": 'Click "Add Variable" on the left to start',
  "variable.nav.count": "Variables ({n})",
  "variable.nav.unnamed": "(unnamed)",
  "variable.general.title": "General",
  "variable.general.type": "Type",
  "variable.general.name": "Name",
  "variable.general.label": "Label",
  "variable.general.description": "Description",
  "variable.type.custom": "Custom",
  "variable.type.query": "Query",
  "variable.type.textbox": "Text box",
  "variable.type.datasource": "Data source",
  "variable.type.constant": "Constant",
  "variable.query.title": "Query options",
  "variable.query.multi": "Multi-value",
  "variable.query.includeAll": "Include All option",
  "variable.query.refresh": "Refresh",
  "variable.query.refresh.onLoad": "On dashboard load",
  "variable.query.refresh.onTimeChange": "On time range change",
  "qb.datasource": "Data Source",
  "qb.addQuery": "Add Query",
  "qb.queryOptions": "Query options",
  "qb.pattern": "Pattern",
  "qb.pattern.sine": "Sine wave",
  "qb.pattern.spike": "Spike",
  "qb.pattern.step": "Step",
  "qb.pattern.sawtooth": "Sawtooth",
  "qb.pattern.noise": "Random noise",
  "qb.pattern.trendUp": "Trend up",
  "qb.pattern.trendDown": "Trend down",
  "qb.pattern.plateau": "Plateau",
  "qb.pattern.randomWalk": "Random walk",
  "qb.pattern.live": "Live",
  "qb.seriesCount": "Series Count",
  "qb.liveAmplitude": "Amplitude",
  "qb.functions": "Functions",
  "qb.functions.add": "Add",
  "qb.options": "Options",
  "qb.queryOptions.maxDataPoints": "Max data points",
  "qb.queryOptions.minInterval": "Min interval",
  "qb.queryOptions.minIntervalPlaceholder": "No limit",
  "qb.queryOptions.interval": "Interval",
  "qb.queryOptions.intervalHint": "time range / max data points",
  "qb.queryOptions.relativeTime": "Relative time",
  "qb.queryOptions.timeShift": "Time shift",
  "config.scheme.classic": "Classic",
  "config.scheme.tableau10": "Tableau 10",
  "config.scheme.fixed": "Single Color",
  "config.scheme.thresholds": "From Thresholds",
  "config.trend.up": "Up ↑",
  "config.trend.down": "Down ↓",
  "config.trend.flat": "Flat",
  "config.field.pieType": "Pie Type",
  "config.field.pieSliceSorting": "Slice Sorting",
  "config.pieType.pie": "Pie",
  "config.pieType.donut": "Donut",
  "config.sort.desc": "Descending",
  "config.sort.asc": "Ascending",
  "config.sort.none": "None",
  "config.field.pieLabels": "Slice Labels",
  "config.pieLabel.name": "Name",
  "config.pieLabel.percent": "Percent",
  "config.pieLabel.value": "Value",
  "config.field.pieShow": "Show",
  "config.pieShow.calculate": "Calculate (Reducer)",
  "config.pieShow.all": "All Values",
  "config.field.legendMode": "Legend Mode",
  "config.legendMode.list": "List",
  "config.legendMode.table": "Table",
  "config.field.legendValues": "Legend Values",
  "config.legendValue.min": "Min",
  "config.legendValue.max": "Max",
  "config.legendValue.mean": "Mean",
  "config.legendValue.sum": "Sum",
  "config.legendValue.last": "Last",
  "config.legendValue.first": "First",
  "tooltip.pinned": "Pinned",
  "tooltip.datetimeFormat": "MMM DD HH:mm:ss",
  "config.reducer.lastNotNull": "Last *",
  "config.reducer.last": "Last",
  "config.reducer.firstNotNull": "First *",
  "config.reducer.first": "First",
  "config.reducer.min": "Min",
  "config.reducer.max": "Max",
  "config.reducer.mean": "Mean",
  "config.reducer.sum": "Total",
  "config.reducer.count": "Count",
  "config.reducer.range": "Range",
  "config.reducer.median": "Median",
  "config.reducer.stdDev": "Std Dev",
  "config.reducer.variance": "Variance",
  "config.reducer.delta": "Delta",
  "config.reducer.diff": "Difference",
  "config.reducer.diffperc": "Difference %",
  "config.reducer.step": "Step",
  "config.reducer.logmin": "Min (above zero)",
  "config.reducer.countAll": "Count all",
  "config.reducer.changeCount": "Change Count",
  "config.reducer.distinctCount": "Distinct Count",
  "config.reducer.allIsZero": "All Zeros",
  "config.reducer.allIsNull": "All Nulls",
  "config.drawStyle.lines": "Lines",
  "config.drawStyle.bars": "Bars",
  "config.drawStyle.points": "Points",
  "config.tooltip.single": "Single",
  "config.tooltip.multi": "All",
  "config.tooltip.none": "Hidden",
  "config.tooltip.sortNone": "None",
  "config.tooltip.sortAsc": "Ascending",
  "config.tooltip.sortDesc": "Descending",
  "config.axis.placement.left": "Left",
  "config.axis.placement.right": "Right",
  "config.axis.placement.hidden": "Hidden",
  "config.axis.grid.all": "All",
  "config.axis.grid.hidden": "Hidden",
  "config.axis.scale.linear": "Linear",
  "config.axis.scale.logarithmic": "Logarithmic",
  "config.gauge.fillWidth": "Active Arc Width",
  "config.gauge.trackWidth": "Track Width",
  "config.gauge.trackColor": "Track Color",
  "config.gauge.capRound": "Round Caps",
  "config.gauge.valueVisible": "Show Value",
  "config.gauge.thresholdDisplay": "Show Thresholds",
  "config.gauge.thresholdDisplayNone": "Off",
  "config.gauge.thresholdDisplayMarker": "Threshold Markers",
  "config.gauge.thresholdDisplayTrack": "Track Bands",
  "config.gauge.orientation": "Layout",
  "config.gauge.orientationAuto": "Auto Grid",
  "config.gauge.orientationHorizontal": "Horizontal",
  "config.gauge.orientationVertical": "Vertical",
  "config.gauge.valueOffsetY": "Value Y Offset",
  // Style section - gradient, nulls, points, stacking
  "config.field.gradientMode": "Gradient Mode",
  "config.gradient.none": "None",
  "config.gradient.opacity": "Opacity",
  "config.gradient.hue": "Hue",
  "config.gradient.scheme": "Scheme",
  "config.field.spanNulls": "Connect Null Values",
  "config.field.insertNulls": "Disconnect Values",
  "config.nulls.never": "Never",
  "config.nulls.always": "Always",
  "config.nulls.threshold": "Threshold",
  "config.points.auto": "Auto",
  "config.points.always": "Always",
  "config.points.never": "Never",
  "config.field.stackSeries": "Stack Series",
  "config.stack.none": "None",
  "config.stack.normal": "Normal",
  "config.stack.percent": "100%",
  // General section
  "config.field.colorSingle": "Fixed Color",
  "config.field.colorDistribution": "Color Distribution",
  "config.colorDist.sequential": "Sequential",
  "config.colorDist.distributed": "Distributed",
  "config.link.newTab": "Open in new tab",
  "config.link.add": "Add link",
  // Bar style
  "config.field.barShowValues": "Show Values",
  "config.showValues.auto": "Auto",
  "config.showValues.always": "Always",
  "config.showValues.never": "Never",
  "config.field.barGroupWidth": "Group Width",
  "config.field.barWidth": "Bar Width",
  "config.field.xTickRotation": "Rotate X Labels",
  // Stat style
  "config.field.orientation": "Orientation",
  "config.orientation.vertical": "Auto (Vertical)",
  "config.orientation.horizontal": "Horizontal",
  "config.field.textMode": "Text Mode",
  "config.textMode.valueAndName": "Value and name",
  "config.textMode.value": "Value only",
  "config.textMode.name": "Name only",
  "config.textMode.none": "None",
  "config.field.colorMode": "Color mode",
  "config.colorMode.value": "Value",
  "config.colorMode.backgroundSolid": "Background Solid",
  "config.colorMode.background": "Background Gradient",
  "config.field.percentChange": "Percent Change",
  "config.field.value": "Value",
  "config.field.unitLabel": "Unit Label",
  "config.field.trend": "Trend",
  // Histogram style
  "config.field.histBucketCount": "Bucket Count",
  "config.field.histBucketSize": "Bucket Size",
  "config.field.histBucketOffset": "Bucket Offset",
  "config.field.histCombineSeries": "Combine Series",
  "config.hist.bucketSizePlaceholder": "Auto",
  // Table style
  "config.field.tableFooterEnabled": "Footer Row",
  "config.field.tableFooterReducers": "Footer Calculation",
  "config.field.tableFooterFields": "Fields",
  "config.field.tableFooterFieldsPlaceholder": "All Numeric Fields",
  "config.section.tableColumnOverrides": "Column Overrides",
  // Axes section
  "config.field.axisName": "Name",
  "config.field.axisLabel": "Label",
  "config.field.axisWidth": "Width",
  "config.field.gridColor": "Grid Color",
  "config.field.axisLine": "Tick Labels",
  "config.field.axisLineColor": "Tick Label Color",
  "config.field.axisTickShow": "Tick Marks",
  "config.field.axisBorder": "Border",
  "config.field.axisBorderColor": "Border Color",
  "config.axis.label.placeholder": "Axis label",
  "config.axis.name.placeholder": "Axis name",
  "config.axis.grid.x": "X",
  "config.axis.grid.y": "Y",
  "config.axis.scale.symlog": "Symlog",
  // Tooltip section
  "config.field.tooltipSort": "Tooltip Sort",
  "config.field.tooltipMaxHeight": "List Max Height",
  "config.field.axisPointer": "Axis Pointer",
  // Unit options
  "config.unit.s": "Seconds (s)",
  "config.unit.bytes": "Bytes",
  "config.unit.percentunit": "Percent (0-1)",
  "config.unit.ops": "Ops/sec",
  "config.unit.bps": "Bits/sec",
  "config.unit.Bps": "Bytes/sec",
  // Gauge
  "config.gauge.arcSweep": "Arc Sweep",
  "config.gauge.paddingX": "Horizontal Padding",
  "config.gauge.paddingY": "Vertical Padding",
  "config.gauge.valueColor": "Value Color",
  "config.gauge.valueSize": "Value Size",
  "config.gauge.colorFromScheme": "Color from Scheme",
  "config.gauge.thresholdLabelDisplay": "Threshold Labels",
  "config.gauge.thresholdLabelNone": "Hidden",
  "config.gauge.thresholdLabelLabel": "Label",
  "config.gauge.thresholdLabelValue": "Value",
  "config.gauge.thresholdLabelBoth": "Label + Value",
  // Panel no data
  "panel.noData": "No data",
  // Override editor
  "config.override.addRule": "Add field override",
  "config.override.addProp": "Add override property",
  "config.override.matcher.byName": "Fields with name",
  "config.override.matcher.byType": "Fields with type",
  "config.override.matcher.byRegexp": "Fields matching regex",
  "config.override.matcher.byFrameRefID": "Fields returned by query",
  "config.override.prop.unit": "Unit",
  "config.override.prop.decimals": "Decimals",
  "config.override.prop.displayName": "Display name",
  "config.override.prop.min": "Min",
  "config.override.prop.max": "Max",
  "config.override.prop.noValue": "No value",
  "config.override.prop.filterable": "Filterable",
  "config.override.prop.thresholds": "Thresholds",
  "config.override.prop.displayMode": "Display mode",
  "config.override.prop.width": "Column width",
  "config.override.prop.align": "Alignment",
  "config.override.prop.hidden": "Hide column",
  "config.override.prop.wrapText": "Wrap text",
  "config.override.group.basic": "Standard options",
  "config.override.group.thresholds": "Thresholds",
  "config.override.group.table": "Table",
  "config.override.type.time": "Time",
  "config.override.type.number": "Number",
  "config.override.type.string": "String",
  "config.override.type.boolean": "Boolean",
  // Table column overrides
  "config.field.tableColHidden": "Hide",
  "config.field.tableColLabel": "Label",
  "config.field.tableColWidth": "Width",
  "config.field.tableColAlign": "Alignment",
  "config.field.tableColDisplayMode": "Display Mode",
  "config.field.tableColWrapText": "Wrap text",
  "config.field.tableColAddName": "Column name",
  "config.tableAlign.auto": "Auto",
  "config.tableAlign.left": "Left",
  "config.tableAlign.center": "Center",
  "config.tableAlign.right": "Right",
  "config.tableDisplayMode.auto": "Auto",
  "config.tableDisplayMode.colored-text": "Colored Text",
  "config.tableDisplayMode.colored-background": "Colored Background",
  "config.tableDisplayMode.gauge": "Gauge",
  "config.tableDisplayMode.data-links": "Data Links",
  "config.tableDisplayMode.json-view": "JSON View",
  "config.tableDisplayMode.pill": "Pill",
  // StatsPicker
  "config.reducer.group.standard": "Standard",
  "config.reducer.group.extended": "Extended",
  "config.reducer.group.boolean": "Boolean",
  "config.reducer.group.percentile": "Percentile",
  "config.reducer.choose": "Choose",
  // Pie limit
  "config.field.pieLimit": "Limit",
  // Variable datasource section
  "variable.ds.title": "Data source options",
  "variable.ds.type": "Data source type",
  "variable.ds.type.placeholder": "Select data source type",
  "variable.ds.filterRegex": "Instance filter regex",
  "variable.ds.multi": "Multi-value",
  "variable.ds.includeAll": "Include All option",
  // Editor - VizPicker
  "editor.vizPicker.title": "Visualization",
  // Editor - Overrides
  "editor.overrides.matcherValue": "Match value",
  "editor.overrides.propValue": "Property value",
  "editor.overrides.addProperty": "Add override property",
  "editor.overrides.addOverride": "Add field override",
  // Zabbix QueryEditor — query types
  "qb.queryType": "Query type",
  "qb.queryType.metrics": "Metrics",
  "qb.queryType.text": "Text",
  "qb.queryType.services": "IT Services",
  "qb.queryType.itemid": "Item ID",
  "qb.queryType.triggers": "Triggers",
  "qb.queryType.problems": "Problems",
  "qb.queryType.macros": "Macros",
  "qb.queryType.lld": "LLD",
  // Zabbix QueryEditor — host/group/item fields
  "panel.group": "Host group",
  "panel.group.placeholder": "Select host group",
  "panel.host": "Host",
  "panel.host.placeholder": "Select host",
  "panel.itemTag": "Item tag",
  "panel.itemTag.placeholder": "Filter by tag",
  "panel.items": "Items",
  "panel.items.placeholder": "Select item",
  // Zabbix QueryEditor — query fields
  "qb.textFilter": "Text filter",
  "qb.textFilter.placeholder": "Regex pattern",
  "qb.useCaptureGroups": "Use capture groups",
  "qb.itemIds": "Item IDs",
  "qb.itemIds.placeholder": "Comma-separated IDs",
  "qb.triggerFilter": "Trigger filter",
  "qb.triggerFilter.placeholder": "Trigger name",
  "qb.problemName": "Problem name",
  "qb.problemName.placeholder": "Filter by name",
  "qb.tags": "Tags",
  "qb.tags.placeholder": "tag:value",
  "qb.show": "Show",
  "qb.severity": "Severity",
  "qb.itService": "IT Service",
  "qb.itService.placeholder": "Select IT service",
  "qb.slaProperty": "SLA property",
  "qb.slaInterval": "SLA interval",
  "qb.macroFilter": "Macro filter",
  // Zabbix QueryEditor — LLD
  "qb.lld.rule": "Discovery rule",
  "qb.lld.rule.placeholder": "Select discovery rule",
  "qb.lld.itemKeys": "Item prototype keys",
  "qb.lld.itemKeys.placeholder": "Select prototype keys",
  // Zabbix QueryEditor — options
  "qb.ack.all": "All",
  "qb.ack.unack": "Unacknowledged",
  "qb.ack.ack": "Acknowledged",
  "qb.sort.default": "Default",
  "qb.sort.lastchange": "Last change",
  "qb.sort.severity": "Severity",
  "qb.trends.default": "Default",
  "qb.trends.true": "Use trends",
  "qb.trends.false": "No trends",
  "qb.options.trends": "Trends",
  "qb.options.showDisabled": "Show disabled",
  "qb.options.valueMapping": "Use value mapping",
  "qb.options.disableAlignment": "Disable alignment",
  "qb.options.acknowledged": "Acknowledged",
  "qb.options.sortBy": "Sort by",
  "qb.options.useTimeRange": "Use time range",
  "qb.options.hostsInMaintenance": "Hosts in maintenance",
  "qb.options.hostProxy": "Host proxy",
  "qb.options.limit": "Limit"
}, cc = {
  "panel.noData": "暂无数据",
  "common.auto": "自动",
  "app.tab.dashboard": "仪表盘",
  "app.tab.scene": "场景视图",
  "app.tab.topology": "拓扑",
  "app.tab.logs": "日志",
  "app.tab.traces": "链路追踪",
  "app.tab.querybuilder": "查询构建器",
  "app.tab.grafana": "Grafana 数据",
  "app.tab.zabbix": "Zabbix",
  "app.theme.toDark": "切换深色",
  "app.theme.toLight": "切换浅色",
  "time.last1h": "最近 1 小时",
  "time.last3h": "最近 3 小时",
  "time.last6h": "最近 6 小时",
  "time.last24h": "最近 24 小时",
  "time.last7d": "最近 7 天",
  "time.last30d": "最近 30 天",
  "panel.menu.edit": "编辑",
  "panel.menu.clone": "克隆",
  "panel.menu.fullscreen": "全屏",
  "panel.menu.refresh": "刷新",
  "panel.menu.remove": "删除",
  "panel.remove.title": '删除 "{title}"？',
  "panel.remove.content": "此操作不可撤销。",
  "panel.remove.ok": "删除",
  "dashboard.edit": "编辑",
  "dashboard.save": "保存",
  "dashboard.cancel": "取消",
  "dashboard.cancelConfirmTitle": "放弃未保存的更改？",
  "dashboard.cancelConfirmOk": "放弃更改",
  "dashboard.cancelConfirmCancel": "继续编辑",
  "dashboard.addPanel": "添加面板",
  "dashboard.clearPanels": "清空面板",
  "dashboard.clearConfirmTitle": "清空所有面板？",
  "dashboard.clearConfirmOk": "确认清空",
  "dashboard.export": "导出",
  "dashboard.import": "导入",
  "dashboard.exportSuccess": "仪表盘已导出",
  "dashboard.importSuccess": "仪表盘已导入",
  "dashboard.importError": "无效的仪表盘 JSON",
  "config.section.general": "基本信息",
  "config.section.value": "数据设置",
  "config.section.style": "图形样式",
  "config.section.tooltip": "悬浮提示窗",
  "config.section.format": "格式化",
  "config.section.thresholds": "阈值 ({n})",
  "config.section.axes": "坐标轴",
  "config.section.links": "链接 ({n})",
  "config.section.gaugeStyle": "图形样式",
  "config.section.pieStyle": "饼图样式",
  "config.section.histStyle": "直方图样式",
  "config.section.tableStyle": "表格样式",
  "config.section.overrides": "字段覆盖",
  "config.type.timeseries": "时序图",
  "config.type.bar": "柱状图",
  "config.type.histogram": "直方图",
  "config.type.stat": "统计值",
  "config.type.gauge": "仪表盘",
  "config.type.table": "表格",
  "config.type.pie": "饼图",
  "panel.type.desc.timeseries": "带时间轴的折线/面积图",
  "panel.type.desc.bar": "分组或堆叠柱状图",
  "panel.type.desc.histogram": "数值分布直方图",
  "panel.type.desc.stat": "单值统计 + 迷你图",
  "panel.type.desc.gauge": "圆弧仪表盘",
  "panel.type.desc.table": "可排序数据表格",
  "panel.type.desc.pie": "饼图 / 环形图",
  "config.field.title": "标题",
  "config.field.description": "描述",
  "config.field.panelType": "面板类型",
  "config.field.colorScheme": "配色方案",
  "config.field.lineWidth": "线宽",
  "config.field.fillOpacity": "填充透明度",
  "config.field.drawStyle": "图形样式",
  "config.field.interpolation": "插值方式",
  "config.field.lineStyle": "线条样式",
  "config.field.showPoints": "显示数据点",
  "config.field.legendPosition": "图例位置",
  "config.field.unit": "单位",
  "config.field.decimals": "小数位数",
  "config.field.min": "最小值",
  "config.field.max": "最大值",
  "config.field.reducer": "计算方式",
  "config.field.tooltipMode": "浮窗触发模式",
  "config.field.softMin": "软最小值",
  "config.field.softMax": "软最大值",
  "config.field.logScale": "对数刻度",
  "config.field.axisPlacement": "轴位置",
  "config.field.showGridLines": "网格线",
  "config.field.scaleDistribution": "刻度类型",
  "config.field.centeredZero": "零点居中",
  "config.field.stacked": "堆叠",
  "config.interp.linear": "线性",
  "config.interp.smooth": "平滑",
  "config.interp.step": "阶梯",
  "config.linestyle.solid": "实线",
  "config.linestyle.dashed": "虚线",
  "config.linestyle.dotted": "点线",
  "config.legend.bottom": "底部",
  "config.legend.right": "右侧",
  "config.legend.hidden": "隐藏",
  "config.unit.none": "无",
  "config.unit.ms": "毫秒 (ms)",
  "config.unit.percent": "百分比 (0-100)",
  "config.unit.reqps": "请求/秒",
  "config.threshold.label": "标签",
  "config.threshold.base": "基础色",
  "config.threshold.add": "添加阈值",
  "config.threshold.mode": "阈值模式",
  "config.threshold.modeAbsolute": "绝对值",
  "config.threshold.modePercentage": "百分比",
  "dashboard.refresh": "刷新",
  "dashboard.empty": "暂无面板",
  "dashboard.emptyHint": '点击"编辑"后选择"添加面板"开始',
  "variable.modal.placeholder": '点击左侧"新增变量"开始配置',
  "variable.custom.title": "自定义选项",
  "variable.custom.add": "添加选项",
  "variable.custom.allValue": "全部值",
  "config.scheme.grafana-classic": "Grafana 经典",
  "config.scheme.green-yellow-red": "绿黄红",
  "config.scheme.red-yellow-green": "红黄绿",
  "config.scheme.blue-yellow-red": "蓝黄红",
  "config.scheme.blue-purple": "蓝紫",
  "config.scheme.yellow-blue": "黄蓝",
  "config.scheme.blues": "蓝色系",
  "config.scheme.reds": "红色系",
  "config.scheme.GrYlRd": "GrYlRd",
  "config.scheme.purple-orange": "紫橙",
  "variable.modal.title": "变量配置",
  "variable.modal.save": "保存",
  "variable.modal.cancel": "取消",
  "variable.modal.delete": "删除变量",
  "variable.modal.add": "新增变量",
  "variable.modal.empty": '点击左侧"新增变量"开始配置',
  "variable.nav.count": "变量 ({n})",
  "variable.nav.unnamed": "(未命名)",
  "variable.general.title": "基本信息",
  "variable.general.type": "类型",
  "variable.general.name": "名称",
  "variable.general.label": "标签",
  "variable.general.description": "描述",
  "variable.type.custom": "自定义",
  "variable.type.query": "查询",
  "variable.type.textbox": "文本框",
  "variable.type.datasource": "数据源",
  "variable.type.constant": "常量",
  "variable.query.title": "查询选项",
  "variable.query.multi": "多选",
  "variable.query.includeAll": "包含全选项",
  "variable.query.refresh": "刷新时机",
  "variable.query.refresh.onLoad": "仪表盘加载时",
  "variable.query.refresh.onTimeChange": "时间范围变化时",
  "qb.datasource": "数据源",
  "qb.addQuery": "添加查询",
  "qb.queryOptions": "查询选项",
  "qb.pattern": "数据模式",
  "qb.pattern.sine": "正弦波",
  "qb.pattern.spike": "尖峰",
  "qb.pattern.step": "阶梯",
  "qb.pattern.sawtooth": "锯齿波",
  "qb.pattern.noise": "随机噪声",
  "qb.pattern.trendUp": "上升趋势",
  "qb.pattern.trendDown": "下降趋势",
  "qb.pattern.plateau": "平台",
  "qb.pattern.randomWalk": "随机游走",
  "qb.pattern.live": "实时",
  "qb.seriesCount": "序列数量",
  "qb.liveAmplitude": "振幅",
  "qb.functions": "函数",
  "qb.functions.add": "添加",
  "qb.options": "选项",
  "qb.queryOptions.maxDataPoints": "最大数据点数",
  "qb.queryOptions.minInterval": "最小间隔",
  "qb.queryOptions.minIntervalPlaceholder": "不限制",
  "qb.queryOptions.interval": "间隔",
  "qb.queryOptions.intervalHint": "时间范围 / 最大数据点数",
  "qb.queryOptions.relativeTime": "相对时间",
  "qb.queryOptions.timeShift": "时间偏移",
  "config.scheme.classic": "经典配色",
  "config.scheme.tableau10": "Tableau配色",
  "config.scheme.fixed": "单色",
  "config.scheme.thresholds": "来自阈值",
  "config.trend.up": "上升 ↑",
  "config.trend.down": "下降 ↓",
  "config.trend.flat": "持平",
  "config.field.pieType": "饼图类型",
  "config.field.pieSliceSorting": "扇区排序",
  "config.pieType.pie": "实心饼",
  "config.pieType.donut": "环形图",
  "config.sort.desc": "降序",
  "config.sort.asc": "升序",
  "config.sort.none": "不排序",
  "config.field.pieLabels": "扇区标签",
  "config.pieLabel.name": "名称",
  "config.pieLabel.percent": "百分比",
  "config.pieLabel.value": "数值",
  "config.field.pieShow": "数据聚合",
  "config.pieShow.calculate": "聚合（Reducer）",
  "config.pieShow.all": "全部值",
  "config.field.legendMode": "图例模式",
  "config.legendMode.list": "列表",
  "config.legendMode.table": "表格",
  "config.field.legendValues": "图例统计值",
  "config.legendValue.min": "最小值",
  "config.legendValue.max": "最大值",
  "config.legendValue.mean": "平均值",
  "config.legendValue.sum": "求和",
  "config.legendValue.last": "最后值",
  "config.legendValue.first": "第一个值",
  "tooltip.pinned": "已固定",
  "tooltip.datetimeFormat": "YYYY-MM-DD HH:mm:ss",
  "config.reducer.lastNotNull": "最后非空值",
  "config.reducer.last": "最后值",
  "config.reducer.firstNotNull": "第一个非空值",
  "config.reducer.first": "第一个值",
  "config.reducer.min": "最小值",
  "config.reducer.max": "最大值",
  "config.reducer.mean": "平均值",
  "config.reducer.sum": "求和",
  "config.reducer.count": "计数",
  "config.reducer.range": "范围",
  "config.reducer.median": "中位数",
  "config.reducer.stdDev": "标准差",
  "config.reducer.variance": "方差",
  "config.reducer.delta": "增量",
  "config.reducer.diff": "差值",
  "config.reducer.diffperc": "差值 %",
  "config.reducer.step": "步长",
  "config.reducer.logmin": "最小正值",
  "config.reducer.countAll": "总计数",
  "config.reducer.changeCount": "变化次数",
  "config.reducer.distinctCount": "唯一值数",
  "config.reducer.allIsZero": "全为零",
  "config.reducer.allIsNull": "全为空",
  "config.drawStyle.lines": "折线",
  "config.drawStyle.bars": "柱状",
  "config.drawStyle.points": "散点",
  "config.tooltip.single": "单系列",
  "config.tooltip.multi": "全部",
  "config.tooltip.none": "隐藏",
  "config.tooltip.sortNone": "默认",
  "config.tooltip.sortAsc": "升序",
  "config.tooltip.sortDesc": "降序",
  "config.axis.placement.left": "左侧",
  "config.axis.placement.right": "右侧",
  "config.axis.placement.hidden": "隐藏",
  "config.axis.grid.all": "开启",
  "config.axis.grid.hidden": "隐藏",
  "config.axis.scale.linear": "线性",
  "config.axis.scale.logarithmic": "对数",
  "config.gauge.fillWidth": "激活弧宽度",
  "config.gauge.trackWidth": "轨道宽度",
  "config.gauge.trackColor": "轨道背景色",
  "config.gauge.capRound": "圆角",
  "config.gauge.valueVisible": "显示数值",
  "config.gauge.thresholdDisplay": "显示阈值方式",
  "config.gauge.thresholdDisplayNone": "不显示",
  "config.gauge.thresholdDisplayMarker": "阈值标记条",
  "config.gauge.thresholdDisplayTrack": "轨道阈值条",
  "config.gauge.orientation": "排列方式",
  "config.gauge.orientationAuto": "自动网格",
  "config.gauge.orientationHorizontal": "水平排列",
  "config.gauge.orientationVertical": "垂直排列",
  "config.gauge.valueOffsetY": "数值 Y 偏移",
  // Style section - gradient, nulls, points, stacking
  "config.field.gradientMode": "渐变模式",
  "config.gradient.none": "无",
  "config.gradient.opacity": "透明度",
  "config.gradient.hue": "色相",
  "config.gradient.scheme": "配色",
  "config.field.spanNulls": "连接空值",
  "config.field.insertNulls": "断开空值",
  "config.nulls.never": "从不",
  "config.nulls.always": "始终",
  "config.nulls.threshold": "阈值",
  "config.points.auto": "自动",
  "config.points.always": "始终",
  "config.points.never": "从不",
  "config.field.stackSeries": "堆叠序列",
  "config.stack.none": "无",
  "config.stack.normal": "普通",
  "config.stack.percent": "100%",
  // General section
  "config.field.colorSingle": "固定颜色",
  "config.field.colorDistribution": "颜色分布",
  "config.colorDist.sequential": "顺序",
  "config.colorDist.distributed": "分散",
  "config.link.newTab": "新标签页打开",
  "config.link.add": "添加链接",
  // Bar style
  "config.field.barShowValues": "显示数值",
  "config.showValues.auto": "自动",
  "config.showValues.always": "始终",
  "config.showValues.never": "从不",
  "config.field.barGroupWidth": "组宽度",
  "config.field.barWidth": "柱宽",
  "config.field.xTickRotation": "旋转 X 标签",
  // Stat style
  "config.field.orientation": "方向",
  "config.orientation.vertical": "自动（垂直）",
  "config.orientation.horizontal": "水平",
  "config.field.textMode": "文本模式",
  "config.textMode.valueAndName": "数值和名称",
  "config.textMode.value": "仅数值",
  "config.textMode.name": "仅名称",
  "config.textMode.none": "无",
  "config.field.colorMode": "颜色模式",
  "config.colorMode.value": "数值",
  "config.colorMode.backgroundSolid": "纯色背景",
  "config.colorMode.background": "渐变背景",
  "config.field.percentChange": "百分比变化",
  "config.field.value": "数值",
  "config.field.unitLabel": "单位标签",
  "config.field.trend": "趋势",
  // Histogram style
  "config.field.histBucketCount": "分桶数",
  "config.field.histBucketSize": "桶大小",
  "config.field.histBucketOffset": "桶偏移",
  "config.field.histCombineSeries": "合并序列",
  "config.hist.bucketSizePlaceholder": "自动",
  // Table style
  "config.field.tableFooterEnabled": "底栏行",
  "config.field.tableFooterReducers": "底栏计算",
  "config.field.tableFooterFields": "字段",
  "config.field.tableFooterFieldsPlaceholder": "所有数值字段",
  "config.section.tableColumnOverrides": "列覆盖",
  // Axes section
  "config.field.axisName": "名称",
  "config.field.axisLabel": "标签",
  "config.field.axisWidth": "宽度",
  "config.field.gridColor": "网格颜色",
  "config.field.axisLine": "刻度标签",
  "config.field.axisLineColor": "刻度标签颜色",
  "config.field.axisTickShow": "刻度线",
  "config.field.axisBorder": "边框",
  "config.field.axisBorderColor": "边框颜色",
  "config.axis.label.placeholder": "坐标轴标签",
  "config.axis.name.placeholder": "坐标轴名称",
  "config.axis.grid.x": "X",
  "config.axis.grid.y": "Y",
  "config.axis.scale.symlog": "对称对数",
  // Tooltip section
  "config.field.tooltipSort": "浮窗排序",
  "config.field.tooltipMaxHeight": "列表最大高度",
  "config.field.axisPointer": "坐标轴指针",
  // Unit options
  "config.unit.s": "秒 (s)",
  "config.unit.bytes": "字节",
  "config.unit.percentunit": "百分比 (0-1)",
  "config.unit.ops": "操作/秒",
  "config.unit.bps": "比特/秒",
  "config.unit.Bps": "字节/秒",
  // Gauge
  "config.gauge.arcSweep": "弧度",
  "config.gauge.paddingX": "水平内边距",
  "config.gauge.paddingY": "垂直内边距",
  "config.gauge.valueColor": "数值颜色",
  "config.gauge.valueSize": "数值大小",
  "config.gauge.colorFromScheme": "来自配色方案",
  "config.gauge.thresholdLabelDisplay": "阈值标签",
  "config.gauge.thresholdLabelNone": "隐藏",
  "config.gauge.thresholdLabelLabel": "标签",
  "config.gauge.thresholdLabelValue": "数值",
  "config.gauge.thresholdLabelBoth": "标签 + 数值",
  // Override editor
  "config.override.addRule": "添加字段覆盖",
  "config.override.addProp": "添加覆盖属性",
  "config.override.matcher.byName": "按名称匹配字段",
  "config.override.matcher.byType": "按类型匹配字段",
  "config.override.matcher.byRegexp": "按正则匹配字段",
  "config.override.matcher.byFrameRefID": "按查询返回匹配",
  "config.override.prop.unit": "单位",
  "config.override.prop.decimals": "小数位",
  "config.override.prop.displayName": "显示名称",
  "config.override.prop.min": "最小值",
  "config.override.prop.max": "最大值",
  "config.override.prop.noValue": "无数据文本",
  "config.override.prop.filterable": "可筛选",
  "config.override.prop.thresholds": "阈值",
  "config.override.prop.displayMode": "显示模式",
  "config.override.prop.width": "列宽",
  "config.override.prop.align": "对齐",
  "config.override.prop.hidden": "隐藏列",
  "config.override.prop.wrapText": "自动换行",
  "config.override.group.basic": "标准选项",
  "config.override.group.thresholds": "阈值",
  "config.override.group.table": "表格",
  "config.override.type.time": "时间",
  "config.override.type.number": "数值",
  "config.override.type.string": "字符串",
  "config.override.type.boolean": "布尔",
  // Table column overrides
  "config.field.tableColHidden": "隐藏",
  "config.field.tableColLabel": "标签",
  "config.field.tableColWidth": "宽度",
  "config.field.tableColAlign": "对齐",
  "config.field.tableColDisplayMode": "显示模式",
  "config.field.tableColWrapText": "自动换行",
  "config.field.tableColAddName": "列名",
  "config.tableAlign.auto": "自动",
  "config.tableAlign.left": "左对齐",
  "config.tableAlign.center": "居中",
  "config.tableAlign.right": "右对齐",
  "config.tableDisplayMode.auto": "自动",
  "config.tableDisplayMode.colored-text": "彩色文字",
  "config.tableDisplayMode.colored-background": "彩色背景",
  "config.tableDisplayMode.gauge": "仪表盘",
  "config.tableDisplayMode.data-links": "数据链接",
  "config.tableDisplayMode.json-view": "JSON 视图",
  "config.tableDisplayMode.pill": "标签",
  // StatsPicker
  "config.reducer.group.standard": "标准",
  "config.reducer.group.extended": "扩展",
  "config.reducer.group.boolean": "布尔",
  "config.reducer.group.percentile": "百分位",
  "config.reducer.choose": "选择",
  // Pie limit
  "config.field.pieLimit": "数量限制",
  // Variable datasource section
  "variable.ds.title": "数据源选项",
  "variable.ds.type": "数据源类型",
  "variable.ds.type.placeholder": "选择数据源类型",
  "variable.ds.filterRegex": "实例过滤正则",
  "variable.ds.multi": "多选",
  "variable.ds.includeAll": "包含全选项",
  // Editor - VizPicker
  "editor.vizPicker.title": "可视化类型",
  // Editor - Overrides
  "editor.overrides.matcherValue": "匹配值",
  "editor.overrides.propValue": "属性值",
  "editor.overrides.addProperty": "添加属性覆盖",
  "editor.overrides.addOverride": "添加字段覆盖",
  // Zabbix QueryEditor — query types
  "qb.queryType": "查询类型",
  "qb.queryType.metrics": "指标",
  "qb.queryType.text": "文本",
  "qb.queryType.services": "IT服务",
  "qb.queryType.itemid": "监控项ID",
  "qb.queryType.triggers": "触发器",
  "qb.queryType.problems": "告警",
  "qb.queryType.macros": "宏变量",
  "qb.queryType.lld": "自动发现",
  // Zabbix QueryEditor — host/group/item fields
  "panel.group": "主机组",
  "panel.group.placeholder": "选择主机组",
  "panel.host": "主机",
  "panel.host.placeholder": "选择主机",
  "panel.itemTag": "监控项标签",
  "panel.itemTag.placeholder": "按标签过滤",
  "panel.items": "监控项",
  "panel.items.placeholder": "选择监控项",
  // Zabbix QueryEditor — query fields
  "qb.textFilter": "文本过滤",
  "qb.textFilter.placeholder": "正则表达式",
  "qb.useCaptureGroups": "使用捕获分组",
  "qb.itemIds": "监控项 ID",
  "qb.itemIds.placeholder": "多个 ID 用逗号分隔",
  "qb.triggerFilter": "触发器过滤",
  "qb.triggerFilter.placeholder": "触发器名称",
  "qb.problemName": "告警名称",
  "qb.problemName.placeholder": "告警名称过滤",
  "qb.tags": "标签",
  "qb.tags.placeholder": "tag:value",
  "qb.show": "显示",
  "qb.severity": "严重程度",
  "qb.itService": "IT服务",
  "qb.itService.placeholder": "选择IT服务",
  "qb.slaProperty": "SLA属性",
  "qb.slaInterval": "SLA时间间隔",
  "qb.macroFilter": "宏过滤",
  // Zabbix QueryEditor — LLD
  "qb.lld.rule": "发现规则",
  "qb.lld.rule.placeholder": "选择发现规则",
  "qb.lld.itemKeys": "监控项原型键",
  "qb.lld.itemKeys.placeholder": "选择原型键",
  // Zabbix QueryEditor — options
  "qb.ack.all": "所有",
  "qb.ack.unack": "未确认",
  "qb.ack.ack": "已确认",
  "qb.sort.default": "默认",
  "qb.sort.lastchange": "最后变更",
  "qb.sort.severity": "严重程度",
  "qb.trends.default": "默认",
  "qb.trends.true": "使用趋势",
  "qb.trends.false": "不使用趋势",
  "qb.options.trends": "趋势数据",
  "qb.options.showDisabled": "显示禁用项",
  "qb.options.valueMapping": "使用 Zabbix 值映射",
  "qb.options.disableAlignment": "禁用数据对齐",
  "qb.options.acknowledged": "确认状态",
  "qb.options.sortBy": "排序",
  "qb.options.useTimeRange": "使用时间范围",
  "qb.options.hostsInMaintenance": "维护中主机",
  "qb.options.hostProxy": "Host Proxy",
  "qb.options.limit": "数量限制"
}, of = { zh: cc, en: lf }, dc = Symbol("lang");
function af(e) {
  xl(dc, e);
}
function nt() {
  const e = bl(dc, fe("zh"));
  function t(n, i) {
    let s = of[e.value][n] ?? cc[n] ?? n;
    if (i)
      for (const [d, c] of Object.entries(i))
        s = s.replace(`{${d}}`, String(c));
    return s;
  }
  return { t, lang: e };
}
const sf = {
  hideHeader: !1,
  canEdit: !0,
  theme: null,
  lang: null,
  isEditing: null,
  initialEditingPanelId: null,
  datasourceConfig: null
}, fc = Symbol("argusBoardConfig");
function hc(e) {
  return { config: Nd(fe(e)) };
}
function rf(e) {
  const t = hc(e);
  return xl(fc, t), t;
}
function Fo() {
  const e = bl(fc);
  return e || hc(sf);
}
async function uf(e) {
  const t = await fetch(`${e.url}/v5/metrics`, {
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      ...e.token ? { Authorization: `Bearer ${e.token}` } : {}
    }
  });
  if (!t.ok)
    throw new Error(`Argus API HTTP error: ${t.status}`);
  return (await t.json()).data?.metrics ?? [];
}
async function cf(e, t) {
  const n = new URLSearchParams({ signal: t.signal });
  t.metricName && n.set("metricName", t.metricName), t.search && n.set("search", t.search);
  const i = await fetch(`${e.url}/v5/attribute_keys?${n.toString()}`, {
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      ...e.token ? { Authorization: `Bearer ${e.token}` } : {}
    }
  });
  if (!i.ok)
    throw new Error(`Argus API HTTP error: ${i.status}`);
  return (await i.json()).data?.attributeKeys ?? [];
}
var Ss = /* @__PURE__ */ ((e) => (e.time = "time", e.number = "number", e.string = "string", e.boolean = "boolean", e.trace = "trace", e.geo = "geo", e.enum = "enum", e.other = "other", e.frame = "frame", e.nestedFrames = "nestedFrames", e))(Ss || {});
function df(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
function _a(e) {
  "@babel/helpers - typeof";
  return _a = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
    return typeof t;
  } : function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, _a(e);
}
var ff = /^\s+/, hf = /\s+$/;
function Ne(e, t) {
  if (e = e || "", t = t || {}, e instanceof Ne)
    return e;
  if (!(this instanceof Ne))
    return new Ne(e, t);
  var n = gf(e);
  this._originalInput = e, this._r = n.r, this._g = n.g, this._b = n.b, this._a = n.a, this._roundA = Math.round(100 * this._a) / 100, this._format = t.format || n.format, this._gradientType = t.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = n.ok;
}
Ne.prototype = {
  isDark: function() {
    return this.getBrightness() < 128;
  },
  isLight: function() {
    return !this.isDark();
  },
  isValid: function() {
    return this._ok;
  },
  getOriginalInput: function() {
    return this._originalInput;
  },
  getFormat: function() {
    return this._format;
  },
  getAlpha: function() {
    return this._a;
  },
  getBrightness: function() {
    var t = this.toRgb();
    return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
  },
  getLuminance: function() {
    var t = this.toRgb(), n, i, l, s, d, c;
    return n = t.r / 255, i = t.g / 255, l = t.b / 255, n <= 0.03928 ? s = n / 12.92 : s = Math.pow((n + 0.055) / 1.055, 2.4), i <= 0.03928 ? d = i / 12.92 : d = Math.pow((i + 0.055) / 1.055, 2.4), l <= 0.03928 ? c = l / 12.92 : c = Math.pow((l + 0.055) / 1.055, 2.4), 0.2126 * s + 0.7152 * d + 0.0722 * c;
  },
  setAlpha: function(t) {
    return this._a = gc(t), this._roundA = Math.round(100 * this._a) / 100, this;
  },
  toHsv: function() {
    var t = fr(this._r, this._g, this._b);
    return {
      h: t.h * 360,
      s: t.s,
      v: t.v,
      a: this._a
    };
  },
  toHsvString: function() {
    var t = fr(this._r, this._g, this._b), n = Math.round(t.h * 360), i = Math.round(t.s * 100), l = Math.round(t.v * 100);
    return this._a == 1 ? "hsv(" + n + ", " + i + "%, " + l + "%)" : "hsva(" + n + ", " + i + "%, " + l + "%, " + this._roundA + ")";
  },
  toHsl: function() {
    var t = dr(this._r, this._g, this._b);
    return {
      h: t.h * 360,
      s: t.s,
      l: t.l,
      a: this._a
    };
  },
  toHslString: function() {
    var t = dr(this._r, this._g, this._b), n = Math.round(t.h * 360), i = Math.round(t.s * 100), l = Math.round(t.l * 100);
    return this._a == 1 ? "hsl(" + n + ", " + i + "%, " + l + "%)" : "hsla(" + n + ", " + i + "%, " + l + "%, " + this._roundA + ")";
  },
  toHex: function(t) {
    return hr(this._r, this._g, this._b, t);
  },
  toHexString: function(t) {
    return "#" + this.toHex(t);
  },
  toHex8: function(t) {
    return yf(this._r, this._g, this._b, this._a, t);
  },
  toHex8String: function(t) {
    return "#" + this.toHex8(t);
  },
  toRgb: function() {
    return {
      r: Math.round(this._r),
      g: Math.round(this._g),
      b: Math.round(this._b),
      a: this._a
    };
  },
  toRgbString: function() {
    return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
  },
  toPercentageRgb: function() {
    return {
      r: Math.round(Lt(this._r, 255) * 100) + "%",
      g: Math.round(Lt(this._g, 255) * 100) + "%",
      b: Math.round(Lt(this._b, 255) * 100) + "%",
      a: this._a
    };
  },
  toPercentageRgbString: function() {
    return this._a == 1 ? "rgb(" + Math.round(Lt(this._r, 255) * 100) + "%, " + Math.round(Lt(this._g, 255) * 100) + "%, " + Math.round(Lt(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(Lt(this._r, 255) * 100) + "%, " + Math.round(Lt(this._g, 255) * 100) + "%, " + Math.round(Lt(this._b, 255) * 100) + "%, " + this._roundA + ")";
  },
  toName: function() {
    return this._a === 0 ? "transparent" : this._a < 1 ? !1 : $f[hr(this._r, this._g, this._b, !0)] || !1;
  },
  toFilter: function(t) {
    var n = "#" + gr(this._r, this._g, this._b, this._a), i = n, l = this._gradientType ? "GradientType = 1, " : "";
    if (t) {
      var s = Ne(t);
      i = "#" + gr(s._r, s._g, s._b, s._a);
    }
    return "progid:DXImageTransform.Microsoft.gradient(" + l + "startColorstr=" + n + ",endColorstr=" + i + ")";
  },
  toString: function(t) {
    var n = !!t;
    t = t || this._format;
    var i = !1, l = this._a < 1 && this._a >= 0, s = !n && l && (t === "hex" || t === "hex6" || t === "hex3" || t === "hex4" || t === "hex8" || t === "name");
    return s ? t === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (i = this.toRgbString()), t === "prgb" && (i = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (i = this.toHexString()), t === "hex3" && (i = this.toHexString(!0)), t === "hex4" && (i = this.toHex8String(!0)), t === "hex8" && (i = this.toHex8String()), t === "name" && (i = this.toName()), t === "hsl" && (i = this.toHslString()), t === "hsv" && (i = this.toHsvString()), i || this.toHexString());
  },
  clone: function() {
    return Ne(this.toString());
  },
  _applyModification: function(t, n) {
    var i = t.apply(null, [this].concat([].slice.call(n)));
    return this._r = i._r, this._g = i._g, this._b = i._b, this.setAlpha(i._a), this;
  },
  lighten: function() {
    return this._applyModification(Sf, arguments);
  },
  brighten: function() {
    return this._applyModification(kf, arguments);
  },
  darken: function() {
    return this._applyModification(Cf, arguments);
  },
  desaturate: function() {
    return this._applyModification(bf, arguments);
  },
  saturate: function() {
    return this._applyModification(xf, arguments);
  },
  greyscale: function() {
    return this._applyModification(wf, arguments);
  },
  spin: function() {
    return this._applyModification(_f, arguments);
  },
  _applyCombination: function(t, n) {
    return t.apply(null, [this].concat([].slice.call(n)));
  },
  analogous: function() {
    return this._applyCombination(Tf, arguments);
  },
  complement: function() {
    return this._applyCombination(Mf, arguments);
  },
  monochromatic: function() {
    return this._applyCombination(Pf, arguments);
  },
  splitcomplement: function() {
    return this._applyCombination(zf, arguments);
  },
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
  // polyad: function (number) {
  //   return this._applyCombination(polyad, [number]);
  // },
  triad: function() {
    return this._applyCombination(pr, [3]);
  },
  tetrad: function() {
    return this._applyCombination(pr, [4]);
  }
};
Ne.fromRatio = function(e, t) {
  if (_a(e) == "object") {
    var n = {};
    for (var i in e)
      e.hasOwnProperty(i) && (i === "a" ? n[i] = e[i] : n[i] = _o(e[i]));
    e = n;
  }
  return Ne(e, t);
};
function gf(e) {
  var t = {
    r: 0,
    g: 0,
    b: 0
  }, n = 1, i = null, l = null, s = null, d = !1, c = !1;
  return typeof e == "string" && (e = Of(e)), _a(e) == "object" && (Si(e.r) && Si(e.g) && Si(e.b) ? (t = pf(e.r, e.g, e.b), d = !0, c = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : Si(e.h) && Si(e.s) && Si(e.v) ? (i = _o(e.s), l = _o(e.v), t = mf(e.h, i, l), d = !0, c = "hsv") : Si(e.h) && Si(e.s) && Si(e.l) && (i = _o(e.s), s = _o(e.l), t = vf(e.h, i, s), d = !0, c = "hsl"), e.hasOwnProperty("a") && (n = e.a)), n = gc(n), {
    ok: d,
    format: e.format || c,
    r: Math.min(255, Math.max(t.r, 0)),
    g: Math.min(255, Math.max(t.g, 0)),
    b: Math.min(255, Math.max(t.b, 0)),
    a: n
  };
}
function pf(e, t, n) {
  return {
    r: Lt(e, 255) * 255,
    g: Lt(t, 255) * 255,
    b: Lt(n, 255) * 255
  };
}
function dr(e, t, n) {
  e = Lt(e, 255), t = Lt(t, 255), n = Lt(n, 255);
  var i = Math.max(e, t, n), l = Math.min(e, t, n), s, d, c = (i + l) / 2;
  if (i == l)
    s = d = 0;
  else {
    var u = i - l;
    switch (d = c > 0.5 ? u / (2 - i - l) : u / (i + l), i) {
      case e:
        s = (t - n) / u + (t < n ? 6 : 0);
        break;
      case t:
        s = (n - e) / u + 2;
        break;
      case n:
        s = (e - t) / u + 4;
        break;
    }
    s /= 6;
  }
  return {
    h: s,
    s: d,
    l: c
  };
}
function vf(e, t, n) {
  var i, l, s;
  e = Lt(e, 360), t = Lt(t, 100), n = Lt(n, 100);
  function d(p, m, b) {
    return b < 0 && (b += 1), b > 1 && (b -= 1), b < 1 / 6 ? p + (m - p) * 6 * b : b < 1 / 2 ? m : b < 2 / 3 ? p + (m - p) * (2 / 3 - b) * 6 : p;
  }
  if (t === 0)
    i = l = s = n;
  else {
    var c = n < 0.5 ? n * (1 + t) : n + t - n * t, u = 2 * n - c;
    i = d(u, c, e + 1 / 3), l = d(u, c, e), s = d(u, c, e - 1 / 3);
  }
  return {
    r: i * 255,
    g: l * 255,
    b: s * 255
  };
}
function fr(e, t, n) {
  e = Lt(e, 255), t = Lt(t, 255), n = Lt(n, 255);
  var i = Math.max(e, t, n), l = Math.min(e, t, n), s, d, c = i, u = i - l;
  if (d = i === 0 ? 0 : u / i, i == l)
    s = 0;
  else {
    switch (i) {
      case e:
        s = (t - n) / u + (t < n ? 6 : 0);
        break;
      case t:
        s = (n - e) / u + 2;
        break;
      case n:
        s = (e - t) / u + 4;
        break;
    }
    s /= 6;
  }
  return {
    h: s,
    s: d,
    v: c
  };
}
function mf(e, t, n) {
  e = Lt(e, 360) * 6, t = Lt(t, 100), n = Lt(n, 100);
  var i = Math.floor(e), l = e - i, s = n * (1 - t), d = n * (1 - l * t), c = n * (1 - (1 - l) * t), u = i % 6, p = [n, d, s, s, c, n][u], m = [c, n, n, d, s, s][u], b = [s, s, c, n, n, d][u];
  return {
    r: p * 255,
    g: m * 255,
    b: b * 255
  };
}
function hr(e, t, n, i) {
  var l = [ii(Math.round(e).toString(16)), ii(Math.round(t).toString(16)), ii(Math.round(n).toString(16))];
  return i && l[0].charAt(0) == l[0].charAt(1) && l[1].charAt(0) == l[1].charAt(1) && l[2].charAt(0) == l[2].charAt(1) ? l[0].charAt(0) + l[1].charAt(0) + l[2].charAt(0) : l.join("");
}
function yf(e, t, n, i, l) {
  var s = [ii(Math.round(e).toString(16)), ii(Math.round(t).toString(16)), ii(Math.round(n).toString(16)), ii(pc(i))];
  return l && s[0].charAt(0) == s[0].charAt(1) && s[1].charAt(0) == s[1].charAt(1) && s[2].charAt(0) == s[2].charAt(1) && s[3].charAt(0) == s[3].charAt(1) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) + s[3].charAt(0) : s.join("");
}
function gr(e, t, n, i) {
  var l = [ii(pc(i)), ii(Math.round(e).toString(16)), ii(Math.round(t).toString(16)), ii(Math.round(n).toString(16))];
  return l.join("");
}
Ne.equals = function(e, t) {
  return !e || !t ? !1 : Ne(e).toRgbString() == Ne(t).toRgbString();
};
Ne.random = function() {
  return Ne.fromRatio({
    r: Math.random(),
    g: Math.random(),
    b: Math.random()
  });
};
function bf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.s -= t / 100, n.s = Ea(n.s), Ne(n);
}
function xf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.s += t / 100, n.s = Ea(n.s), Ne(n);
}
function wf(e) {
  return Ne(e).desaturate(100);
}
function Sf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.l += t / 100, n.l = Ea(n.l), Ne(n);
}
function kf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toRgb();
  return n.r = Math.max(0, Math.min(255, n.r - Math.round(255 * -(t / 100)))), n.g = Math.max(0, Math.min(255, n.g - Math.round(255 * -(t / 100)))), n.b = Math.max(0, Math.min(255, n.b - Math.round(255 * -(t / 100)))), Ne(n);
}
function Cf(e, t) {
  t = t === 0 ? 0 : t || 10;
  var n = Ne(e).toHsl();
  return n.l -= t / 100, n.l = Ea(n.l), Ne(n);
}
function _f(e, t) {
  var n = Ne(e).toHsl(), i = (n.h + t) % 360;
  return n.h = i < 0 ? 360 + i : i, Ne(n);
}
function Mf(e) {
  var t = Ne(e).toHsl();
  return t.h = (t.h + 180) % 360, Ne(t);
}
function pr(e, t) {
  if (isNaN(t) || t <= 0)
    throw new Error("Argument to polyad must be a positive number");
  for (var n = Ne(e).toHsl(), i = [Ne(e)], l = 360 / t, s = 1; s < t; s++)
    i.push(Ne({
      h: (n.h + s * l) % 360,
      s: n.s,
      l: n.l
    }));
  return i;
}
function zf(e) {
  var t = Ne(e).toHsl(), n = t.h;
  return [Ne(e), Ne({
    h: (n + 72) % 360,
    s: t.s,
    l: t.l
  }), Ne({
    h: (n + 216) % 360,
    s: t.s,
    l: t.l
  })];
}
function Tf(e, t, n) {
  t = t || 6, n = n || 30;
  var i = Ne(e).toHsl(), l = 360 / n, s = [Ne(e)];
  for (i.h = (i.h - (l * t >> 1) + 720) % 360; --t; )
    i.h = (i.h + l) % 360, s.push(Ne(i));
  return s;
}
function Pf(e, t) {
  t = t || 6;
  for (var n = Ne(e).toHsv(), i = n.h, l = n.s, s = n.v, d = [], c = 1 / t; t--; )
    d.push(Ne({
      h: i,
      s: l,
      v: s
    })), s = (s + c) % 1;
  return d;
}
Ne.mix = function(e, t, n) {
  n = n === 0 ? 0 : n || 50;
  var i = Ne(e).toRgb(), l = Ne(t).toRgb(), s = n / 100, d = {
    r: (l.r - i.r) * s + i.r,
    g: (l.g - i.g) * s + i.g,
    b: (l.b - i.b) * s + i.b,
    a: (l.a - i.a) * s + i.a
  };
  return Ne(d);
};
Ne.readability = function(e, t) {
  var n = Ne(e), i = Ne(t);
  return (Math.max(n.getLuminance(), i.getLuminance()) + 0.05) / (Math.min(n.getLuminance(), i.getLuminance()) + 0.05);
};
Ne.isReadable = function(e, t, n) {
  var i = Ne.readability(e, t), l, s;
  switch (s = !1, l = Df(n), l.level + l.size) {
    case "AAsmall":
    case "AAAlarge":
      s = i >= 4.5;
      break;
    case "AAlarge":
      s = i >= 3;
      break;
    case "AAAsmall":
      s = i >= 7;
      break;
  }
  return s;
};
Ne.mostReadable = function(e, t, n) {
  var i = null, l = 0, s, d, c, u;
  n = n || {}, d = n.includeFallbackColors, c = n.level, u = n.size;
  for (var p = 0; p < t.length; p++)
    s = Ne.readability(e, t[p]), s > l && (l = s, i = Ne(t[p]));
  return Ne.isReadable(e, i, {
    level: c,
    size: u
  }) || !d ? i : (n.includeFallbackColors = !1, Ne.mostReadable(e, ["#fff", "#000"], n));
};
var ks = Ne.names = {
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
}, $f = Ne.hexNames = Ef(ks);
function Ef(e) {
  var t = {};
  for (var n in e)
    e.hasOwnProperty(n) && (t[e[n]] = n);
  return t;
}
function gc(e) {
  return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
}
function Lt(e, t) {
  If(e) && (e = "100%");
  var n = Af(e);
  return e = Math.min(t, Math.max(0, parseFloat(e))), n && (e = parseInt(e * t, 10) / 100), Math.abs(e - t) < 1e-6 ? 1 : e % t / parseFloat(t);
}
function Ea(e) {
  return Math.min(1, Math.max(0, e));
}
function _n(e) {
  return parseInt(e, 16);
}
function If(e) {
  return typeof e == "string" && e.indexOf(".") != -1 && parseFloat(e) === 1;
}
function Af(e) {
  return typeof e == "string" && e.indexOf("%") != -1;
}
function ii(e) {
  return e.length == 1 ? "0" + e : "" + e;
}
function _o(e) {
  return e <= 1 && (e = e * 100 + "%"), e;
}
function pc(e) {
  return Math.round(parseFloat(e) * 255).toString(16);
}
function vr(e) {
  return _n(e) / 255;
}
var Qn = (function() {
  var e = "[-\\+]?\\d+%?", t = "[-\\+]?\\d*\\.\\d+%?", n = "(?:" + t + ")|(?:" + e + ")", i = "[\\s|\\(]+(" + n + ")[,|\\s]+(" + n + ")[,|\\s]+(" + n + ")\\s*\\)?", l = "[\\s|\\(]+(" + n + ")[,|\\s]+(" + n + ")[,|\\s]+(" + n + ")[,|\\s]+(" + n + ")\\s*\\)?";
  return {
    CSS_UNIT: new RegExp(n),
    rgb: new RegExp("rgb" + i),
    rgba: new RegExp("rgba" + l),
    hsl: new RegExp("hsl" + i),
    hsla: new RegExp("hsla" + l),
    hsv: new RegExp("hsv" + i),
    hsva: new RegExp("hsva" + l),
    hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
    hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  };
})();
function Si(e) {
  return !!Qn.CSS_UNIT.exec(e);
}
function Of(e) {
  e = e.replace(ff, "").replace(hf, "").toLowerCase();
  var t = !1;
  if (ks[e])
    e = ks[e], t = !0;
  else if (e == "transparent")
    return {
      r: 0,
      g: 0,
      b: 0,
      a: 0,
      format: "name"
    };
  var n;
  return (n = Qn.rgb.exec(e)) ? {
    r: n[1],
    g: n[2],
    b: n[3]
  } : (n = Qn.rgba.exec(e)) ? {
    r: n[1],
    g: n[2],
    b: n[3],
    a: n[4]
  } : (n = Qn.hsl.exec(e)) ? {
    h: n[1],
    s: n[2],
    l: n[3]
  } : (n = Qn.hsla.exec(e)) ? {
    h: n[1],
    s: n[2],
    l: n[3],
    a: n[4]
  } : (n = Qn.hsv.exec(e)) ? {
    h: n[1],
    s: n[2],
    v: n[3]
  } : (n = Qn.hsva.exec(e)) ? {
    h: n[1],
    s: n[2],
    v: n[3],
    a: n[4]
  } : (n = Qn.hex8.exec(e)) ? {
    r: _n(n[1]),
    g: _n(n[2]),
    b: _n(n[3]),
    a: vr(n[4]),
    format: t ? "name" : "hex8"
  } : (n = Qn.hex6.exec(e)) ? {
    r: _n(n[1]),
    g: _n(n[2]),
    b: _n(n[3]),
    format: t ? "name" : "hex"
  } : (n = Qn.hex4.exec(e)) ? {
    r: _n(n[1] + "" + n[1]),
    g: _n(n[2] + "" + n[2]),
    b: _n(n[3] + "" + n[3]),
    a: vr(n[4] + "" + n[4]),
    format: t ? "name" : "hex8"
  } : (n = Qn.hex3.exec(e)) ? {
    r: _n(n[1] + "" + n[1]),
    g: _n(n[2] + "" + n[2]),
    b: _n(n[3] + "" + n[3]),
    format: t ? "name" : "hex"
  } : !1;
}
function Df(e) {
  var t, n;
  return e = e || {
    level: "AA",
    size: "small"
  }, t = (e.level || "AA").toUpperCase(), n = (e.size || "small").toLowerCase(), t !== "AA" && t !== "AAA" && (t = "AA"), n !== "small" && n !== "large" && (n = "small"), {
    level: t,
    size: n
  };
}
function Lf(e) {
  return {
    name: e.name ?? "",
    refId: e.refId ?? "",
    fields: e.fields.map((t) => ({
      name: t.name,
      type: t.type,
      values: { toArray: () => t.values },
      config: t.config ?? {},
      state: {}
    }))
  };
}
const vc = /* @__PURE__ */ new Map();
function is(e) {
  vc.set(e.type, e);
}
function Cs(e) {
  return vc.get(e);
}
const mr = [
  "api-gateway",
  "auth-service",
  "payment-service",
  "user-service",
  "notification-service",
  "order-service",
  "inventory-service",
  "search-service"
];
function ls(e) {
  let t = e;
  return () => (t = (t * 16807 + 0) % 2147483647, t / 2147483647);
}
function qf(e, t, n, i, l) {
  const s = n ^ Math.floor(Date.now() / 5e3) * 2654435761, d = ls(n), c = ls(s);
  if (e === "random-walk") {
    const u = ls((n + Date.now()) % 2147483647), p = l + i * 0.5, m = l * 0.1, b = l + i * 1.8, v = [p];
    for (let C = 1; C < t; C++) {
      const P = v[C - 1], M = (p - P) * 0.05, q = (u() - 0.5) * i * 0.08 + M;
      v.push(Math.max(m, Math.min(b, P + q)));
    }
    return v;
  }
  return Array.from({ length: t }, (u, p) => {
    const m = p / t;
    let b;
    switch (e) {
      case "sine":
        b = l + Math.sin(m * Math.PI * 4 + n) * i + (d() - 0.5) * i * 0.2;
        break;
      case "spike": {
        const C = [0.2, 0.5, 0.8].reduce(
          (P, M) => P + Math.exp(-((m - M) ** 2) / 1e-3) * i * 2,
          0
        );
        b = l + C + (d() - 0.5) * i * 0.15;
        break;
      }
      case "step":
        b = l + Math.floor(m * 5) % 3 * i * 0.5 + (d() - 0.5) * i * 0.1;
        break;
      case "sawtooth":
        b = l + m * 3 % 1 * i + (d() - 0.5) * i * 0.15;
        break;
      case "noise":
        b = l + d() * i;
        break;
      case "trend-up":
        b = l + m * i * 1.5 + Math.sin(m * 10) * i * 0.2 + (d() - 0.5) * i * 0.1;
        break;
      case "trend-down":
        b = l + (1 - m) * i * 1.5 + Math.sin(m * 8) * i * 0.15 + (d() - 0.5) * i * 0.1;
        break;
      case "plateau": {
        const P = m < 0.3 ? m / 0.3 : m > 0.7 ? (1 - m) / 0.30000000000000004 : 1;
        b = l + P * i + (d() - 0.5) * i * 0.1;
        break;
      }
      case "live": {
        if (m < 0.9)
          b = l + Math.sin(m * Math.PI * 4 + n) * i * 0.6 + (d() - 0.5) * i * 0.1;
        else {
          const C = (m - 0.9) / 0.09999999999999998;
          b = l + Math.sin(0.9 * Math.PI * 4 + n) * i * 0.6 + (c() - 0.5) * i * 0.4 * C * 2;
        }
        break;
      }
      default:
        b = l;
    }
    return Math.max(0, b);
  });
}
function Bl(e, t = 15, n = 3, i = "sine", l) {
  const s = [];
  for (let c = e.from; c <= e.to; c += t)
    s.push(c);
  const d = Array.from({ length: n }, (c, u) => {
    const p = 20 + (u * 37 + 13) % 60, m = 10 + (u * 53 + 7) % 40, b = qf(i, s.length, u * 1e3 + 42, p, m);
    return {
      label: l?.[u] ?? mr[u % mr.length],
      values: b
    };
  });
  return { timestamps: s, series: d };
}
function Rf(e, t, n, i) {
  const s = ((n + i) / 2 - e) * 0.05, d = (Math.random() - 0.5) * t * 0.08 + s;
  return Math.max(n, Math.min(i, e + d));
}
class Nf {
  type = "mock";
  meta = {
    type: "mock",
    displayName: "Mock",
    icon: "🎲"
  };
  defaultQuery = () => ({
    type: "mock",
    metric: "",
    pattern: "sine",
    seriesCount: 3,
    liveAmplitude: 1
  });
  query(t) {
    const { range: n, targets: i } = t, l = i.filter((s) => s).map((s) => {
      const { timestamps: d, series: c } = Bl(
        { from: n.from / 1e3, to: n.to / 1e3 },
        15,
        s.seriesCount,
        s.pattern,
        s.labels
      ), u = d.map((m) => m * 1e3), p = [
        { name: "Time", type: Ss.time, values: u, config: {} },
        ...c.map((m) => ({
          name: m.label,
          type: Ss.number,
          values: m.values,
          config: { displayNameFromDS: m.label }
        }))
      ];
      return Lf({ name: s.metric, refId: "A", fields: p });
    });
    return Promise.resolve({ data: l, state: "Done" });
  }
}
const Yi = [
  "#4096ff",
  "#52c41a",
  "#faad14",
  "#ff4d4f",
  "#722ed1",
  "#13c2c2",
  "#eb2f96",
  "#fa8c16",
  "#a0d911",
  "#1677ff",
  "#2f54eb",
  "#f5222d",
  "#fadb14",
  "#7cb305",
  "#08979c",
  "#531dab",
  "#c41d7f",
  "#d4380d",
  "#d48806",
  "#389e0d"
];
function ki(e, t) {
  if (e.length < 2 || t < 2)
    return [...e];
  const n = (s) => [
    Number.parseInt(s.slice(1, 3), 16),
    Number.parseInt(s.slice(3, 5), 16),
    Number.parseInt(s.slice(5, 7), 16)
  ], i = (s) => Math.round(Math.max(0, Math.min(255, s))).toString(16).padStart(2, "0"), l = e.length - 1;
  return Array.from({ length: t }, (s, d) => {
    const c = d / (t - 1) * l, u = Math.min(Math.floor(c), l - 1), p = c - u, [m, b, v] = n(e[u]), [C, P, M] = n(e[u + 1]);
    return `#${i(m + (C - m) * p)}${i(b + (P - b) * p)}${i(v + (M - v) * p)}`;
  });
}
const Vn = {
  classic: Yi,
  tableau10: [
    "#4e79a7",
    "#f28e2b",
    "#e15759",
    "#76b7b2",
    "#59a14f",
    "#edc948",
    "#b07aa1",
    "#ff9da7",
    "#9c755f",
    "#bab0ac"
  ],
  "grafana-classic": [
    "#7EB26D",
    "#EAB839",
    "#6ED0E0",
    "#EF843C",
    "#E24D42",
    "#1F78C1",
    "#BA43A9",
    "#705DA0",
    "#508642",
    "#CCA300",
    "#447EBC",
    "#C15C17",
    "#890F02",
    "#0A437C",
    "#6D1F62",
    "#584477",
    "#B7DBAB",
    "#F4D598",
    "#70DBED",
    "#F9BA8F"
  ],
  blues: ki(["#cfe2f3", "#9fc5e8", "#3d85c8", "#0b5394", "#041d3a"], 16),
  reds: ki(["#fce5cd", "#f6b26b", "#e06666", "#cc0000", "#660000"], 16),
  GrYlRd: ki(
    ["#37872d", "#96d98d", "#fee520", "#ff780a", "#f2495c", "#8f3bb8"],
    16
  ),
  "purple-orange": ki(
    ["#7b2d8b", "#d45087", "#ff7c43", "#ffa600", "#f0e442", "#b3de69"],
    16
  ),
  "green-yellow-red": ki(
    ["#1a9850", "#a6d96a", "#fee08b", "#fdae61", "#d73027"],
    16
  ),
  "red-yellow-green": ki(
    ["#d73027", "#fdae61", "#fee08b", "#a6d96a", "#1a9850"],
    16
  ),
  "blue-yellow-red": ki(
    ["#2166ac", "#92c5de", "#d1e5f0", "#fddbc7", "#f4a582", "#b2182b"],
    16
  ),
  "blue-purple": ki(
    ["#045a8d", "#74a9cf", "#ccebc5", "#9ebcda", "#8856a7", "#810f7c"],
    16
  ),
  "yellow-blue": ki(["#ffffd9", "#c7e9b4", "#41b6c4", "#225ea8", "#0c2c84"], 16)
};
function Vf(e) {
  return !e || e === "classic" ? Yi : Vn[e] ?? Yi;
}
function Ff(e, t, n = "sequential", i) {
  if (t === 0)
    return [];
  if (e === "fixed") {
    const s = i ?? Yi[0];
    return Array.from({ length: t }, () => s);
  }
  if (e === "thresholds")
    return [];
  const l = Vf(e);
  return n === "distributed" && t > 1 ? Array.from({ length: t }, (s, d) => {
    const c = Math.round(d * (l.length - 1) / (t - 1));
    return l[c];
  }) : Array.from({ length: t }, (s, d) => l[d % l.length]);
}
const _t = {
  min: 0,
  max: 100,
  capRound: !0,
  trackWidth: 28,
  fillWidth: 30,
  trackColor: "#F4F5F5",
  sweepAngle: 270,
  valueColor: "#e6e6e6",
  valueSize: 28,
  valueVisible: !0,
  paddingX: 12,
  paddingY: 12,
  thresholdDisplay: "track",
  thresholdLabelDisplay: "none",
  orientation: "auto",
  colorFromScheme: !1,
  valueOffsetY: 18
};
let Bf = 0;
function _s() {
  return `panel-${Date.now()}-${++Bf}`;
}
function Bn(e) {
  return [{ id: "A", enabled: !0, dataSource: e }];
}
const Hf = {
  timeseries: {
    queries: Bn({
      type: "mock",
      metric: "http_request_duration_seconds",
      pattern: "sine",
      seriesCount: 3
    }),
    lineWidth: 1.5,
    fillOpacity: 1,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "bottom",
    tooltipMode: "multi",
    tooltipSort: "none",
    showAxisPointer: !0,
    unit: "",
    decimals: 1
  },
  bar: {
    queries: Bn({
      type: "mock",
      metric: "http_request_duration_seconds",
      pattern: "sine",
      seriesCount: 3,
      labels: ["p50", "p90", "p99"]
    }),
    lineWidth: 1,
    fillOpacity: 80,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "bottom",
    unit: "ms",
    decimals: 0,
    stacked: !1
  },
  histogram: {
    queries: Bn({ type: "mock", metric: "request_duration_ms", pattern: "sine", seriesCount: 1 }),
    lineWidth: 1,
    fillOpacity: 60,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "ms",
    decimals: 0
  },
  stat: {
    queries: Bn({
      type: "mock",
      metric: "http_requests_total",
      pattern: "trend-up",
      seriesCount: 1
    }),
    lineWidth: 1,
    fillOpacity: 0,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "",
    decimals: 1,
    statValue: 0,
    statUnit: "",
    statTrend: "flat"
  },
  gauge: {
    queries: Bn({ type: "mock", metric: "system_cpu_usage", pattern: "sine", seriesCount: 1 }),
    lineWidth: 1,
    fillOpacity: 0,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "%",
    decimals: 1,
    min: 0,
    max: 100
  },
  table: {
    queries: Bn({ type: "mock", metric: "http_requests", pattern: "noise", seriesCount: 1 }),
    lineWidth: 1,
    fillOpacity: 0,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "hidden",
    unit: "",
    decimals: 0
  },
  pie: {
    queries: Bn({
      type: "mock",
      metric: "http_requests_by_service",
      pattern: "noise",
      seriesCount: 5
    }),
    lineWidth: 1,
    fillOpacity: 80,
    lineInterpolation: "linear",
    lineStyle: "solid",
    showPoints: !1,
    legendPosition: "bottom",
    unit: "",
    decimals: 1,
    pieType: "pie",
    pieSliceSorting: "desc",
    pieLabels: ["name", "percent"],
    pieShow: "calculate",
    pieCalculation: "lastNotNull"
  }
};
function mc(e, t) {
  const n = t?.id ?? _s();
  return { ...{
    id: n,
    type: e,
    title: `New ${e} panel`,
    description: "",
    queries: [
      {
        id: "A",
        enabled: !0,
        dataSource: { type: "mock", metric: "", pattern: "sine", seriesCount: 3 }
      }
    ],
    drawStyle: "lines",
    lineWidth: 1.5,
    fillOpacity: 1,
    gradientMode: "none",
    lineInterpolation: "linear",
    lineStyle: "solid",
    spanNulls: !1,
    insertNulls: !1,
    showPoints: !1,
    showPointsMode: "auto",
    stackingMode: "none",
    legendPosition: "bottom",
    unit: "",
    decimals: 1,
    thresholds: [],
    thresholdBaseColor: "#73bf69",
    softMin: null,
    softMax: null,
    logScale: !1,
    stacked: !1,
    min: 0,
    max: 100,
    links: [],
    axisPlacement: "left",
    showGridLines: "all",
    gridColor: "#E8E9EA",
    axisLabel: "all",
    axisLabelColor: "#666666",
    axisTick: "hidden",
    axisBorder: "hidden",
    scaleDistribution: "linear",
    centeredZero: !1
  }, ...Hf[e], ...t, id: n };
}
function yc() {
  const e = {}, t = [], n = [
    {
      id: "s1",
      type: "stat",
      title: "Requests/sec",
      x: 0,
      y: 0,
      w: 2,
      h: 4,
      extra: { statValue: 1247, statUnit: "req/s", statTrend: "up", unit: "reqps" }
    },
    {
      id: "s2",
      type: "stat",
      title: "Error Rate",
      x: 2,
      y: 0,
      w: 2,
      h: 4,
      extra: {
        statValue: 0.32,
        statUnit: "%",
        statTrend: "down",
        thresholds: [
          { value: 0, color: "#52c41a", label: "OK" },
          { value: 1, color: "#faad14", label: "Warn" },
          { value: 5, color: "#ff4d4f", label: "Crit" }
        ]
      }
    },
    {
      id: "s3",
      type: "stat",
      title: "P99 Latency",
      x: 4,
      y: 0,
      w: 2,
      h: 4,
      extra: {
        statValue: 342,
        statUnit: "ms",
        statTrend: "up",
        thresholds: [
          { value: 0, color: "#52c41a", label: "OK" },
          { value: 200, color: "#faad14", label: "Warn" },
          { value: 500, color: "#ff4d4f", label: "Crit" }
        ]
      }
    },
    {
      id: "s4",
      type: "stat",
      title: "Uptime",
      x: 6,
      y: 0,
      w: 2,
      h: 4,
      extra: { statValue: 99.97, statUnit: "%", statTrend: "flat" }
    },
    { id: "g1", type: "gauge", title: "CPU", x: 8, y: 0, w: 2, h: 4, extra: { statValue: 67.3 } },
    {
      id: "g2",
      type: "gauge",
      title: "Memory",
      x: 10,
      y: 0,
      w: 2,
      h: 4,
      extra: {
        statValue: 82.1,
        thresholds: [
          { value: 0, color: "#52c41a", label: "OK" },
          { value: 70, color: "#faad14", label: "Warn" },
          { value: 90, color: "#ff4d4f", label: "Crit" }
        ]
      }
    },
    {
      id: "ts1",
      type: "timeseries",
      title: "CPU Usage",
      x: 0,
      y: 4,
      w: 6,
      h: 8,
      extra: {
        description: "by service",
        queries: Bn({
          type: "mock",
          metric: "system_cpu_usage",
          pattern: "sine",
          seriesCount: 4,
          labels: ["api-gateway", "auth-service", "payment-service", "user-service"]
        }),
        unit: "percent"
      }
    },
    {
      id: "ts2",
      type: "timeseries",
      title: "Request Latency",
      x: 6,
      y: 4,
      w: 6,
      h: 8,
      extra: {
        description: "percentiles",
        queries: Bn({
          type: "mock",
          metric: "http_request_duration_seconds",
          pattern: "spike",
          seriesCount: 3,
          labels: ["p50", "p90", "p99"]
        }),
        unit: "ms",
        thresholds: [
          { value: 100, color: "#faad14", label: "Warning 100ms" },
          { value: 300, color: "#ff4d4f", label: "Critical 300ms" }
        ]
      }
    },
    {
      id: "ts3",
      type: "timeseries",
      title: "Throughput",
      x: 0,
      y: 12,
      w: 4,
      h: 8,
      extra: {
        description: "req/s",
        queries: Bn({
          type: "mock",
          metric: "http_requests_total",
          pattern: "trend-up",
          seriesCount: 3,
          labels: ["api-gateway", "auth-service", "payment-service"]
        })
      }
    },
    {
      id: "b1",
      type: "bar",
      title: "Latency Percentiles",
      x: 4,
      y: 12,
      w: 4,
      h: 8,
      extra: { description: "by bucket" }
    },
    { id: "h1", type: "histogram", title: "Duration Distribution", x: 8, y: 12, w: 4, h: 8 },
    {
      id: "ts4",
      type: "timeseries",
      title: "Error Rate",
      x: 0,
      y: 20,
      w: 6,
      h: 8,
      extra: {
        description: "5xx vs 4xx",
        queries: Bn({
          type: "mock",
          metric: "http_errors",
          pattern: "noise",
          seriesCount: 2,
          labels: ["5xx", "4xx"]
        }),
        fillOpacity: 3
      }
    },
    {
      id: "ts5",
      type: "timeseries",
      title: "Network I/O",
      x: 6,
      y: 20,
      w: 6,
      h: 8,
      extra: {
        description: "KB/s",
        queries: Bn({
          type: "mock",
          metric: "network_io",
          pattern: "sawtooth",
          seriesCount: 4,
          labels: ["eth0-rx", "eth0-tx", "eth1-rx", "eth1-tx"]
        }),
        unit: "bytes"
      }
    },
    {
      id: "t1",
      type: "table",
      title: "Recent Requests",
      x: 0,
      y: 28,
      w: 12,
      h: 10,
      extra: { description: "last 80 requests" }
    }
  ];
  for (const i of n) {
    const l = mc(i.type, { id: i.id, title: i.title, ...i.extra });
    e[i.id] = l, t.push({
      i: i.id,
      x: i.x,
      y: i.y,
      w: i.w,
      h: i.h,
      minH: i.type === "stat" || i.type === "gauge" ? 3 : 6
    });
  }
  return { panels: e, layouts: t };
}
function Wf() {
  return JSON.stringify(yc(), null, 2);
}
const bc = /* @__PURE__ */ new Map();
function rl(e) {
  bc.set(e.meta.type, e);
}
function jf(e) {
  return bc.get(e);
}
const Gf = {
  meta: { type: "bar", displayNameKey: "config.type.bar", icon: "📊" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "bar-style", labelKey: "config.section.style", Component: null },
    { key: "axes", labelKey: "config.section.axes", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
}, Yf = {
  meta: { type: "gauge", displayNameKey: "config.type.gauge", icon: "🎯" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "gauge-style", labelKey: "config.section.gaugeStyle", Component: null }
  ]
}, Uf = {
  meta: {
    type: "histogram",
    displayNameKey: "config.type.histogram",
    icon: "📉"
  },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "histogram-style", labelKey: "config.section.histStyle", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
}, Kf = {
  meta: { type: "pie", displayNameKey: "config.type.pie", icon: "🥧" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "pie-style", labelKey: "config.section.pieStyle", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
}, Xf = {
  meta: { type: "stat", displayNameKey: "config.type.stat", icon: "#" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "stat-style", labelKey: "config.section.gaugeStyle", Component: null }
  ]
}, Qf = {
  meta: { type: "table", displayNameKey: "config.type.table", icon: "📋" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "table-style", labelKey: "config.section.tableStyle", Component: null }
  ]
}, Jf = {
  meta: { type: "timeseries", displayNameKey: "config.type.timeseries", icon: "📈" },
  optionCategories: [
    { key: "general", labelKey: "config.section.general", Component: null },
    { key: "value", labelKey: "config.section.value", Component: null },
    { key: "style", labelKey: "config.section.style", Component: null },
    { key: "axes", labelKey: "config.section.axes", Component: null },
    { key: "tooltip", labelKey: "config.section.tooltip", Component: null }
  ]
};
function Zf() {
  rl(Jf), rl(Gf), rl(Uf), rl(Xf), rl(Yf), rl(Qf), rl(Kf);
}
function Mo(e, t = "lastNotNull", n) {
  const i = e.filter((l) => l !== null);
  switch (t) {
    case "lastNotNull":
      return i.length > 0 ? i[i.length - 1] ?? 0 : 0;
    case "last":
      return e.length > 0 ? e[e.length - 1] ?? 0 : 0;
    case "firstNotNull":
      return i.length > 0 ? i[0] ?? 0 : 0;
    case "first":
      return e.length > 0 ? e[0] ?? 0 : 0;
    case "mean":
      return i.length > 0 ? i.reduce((l, s) => l + s, 0) / i.length : 0;
    case "min":
      return i.length > 0 ? Math.min(...i) : 0;
    case "max":
      return i.length > 0 ? Math.max(...i) : 0;
    case "sum":
      return i.reduce((l, s) => l + s, 0);
    case "count":
      return i.length;
    default:
      return i.length > 0 ? i[i.length - 1] ?? 0 : 0;
  }
}
function aa(e, t) {
  const n = e.filter((l) => l !== null);
  if (n.length < 2)
    return null;
  const i = n[0];
  return i === 0 ? null : (n[n.length - 1] - i) / i;
}
class Ia {
  constructor(t) {
    this.props = t;
  }
}
var Ms = /* @__PURE__ */ ((e) => (e.LOCAL_STORAGE = "LOCAL_STORAGE", e.IN_MEMORY = "IN_MEMORY", e))(Ms || {}), pl = /* @__PURE__ */ ((e) => (e.Linear = "linear", e.Logarithmic = "logarithmic", e.Symlog = "symlog", e))(pl || {}), _i = /* @__PURE__ */ ((e) => (e.Lines = "lines", e.Bars = "bars", e.Points = "points", e.Histogram = "histogram", e))(_i || {}), ya = /* @__PURE__ */ ((e) => (e.Linear = "linear", e.Smooth = "smooth", e.StepBefore = "stepBefore", e.StepAfter = "stepAfter", e))(ya || {}), zs = /* @__PURE__ */ ((e) => (e.Solid = "solid", e.Dashed = "dashed", e.Dotted = "dotted", e))(zs || {}), ba = /* @__PURE__ */ ((e) => (e.None = "none", e.Solid = "solid", e.Gradient = "gradient", e))(ba || {}), xc = /* @__PURE__ */ ((e) => (e[e.Before = -1] = "Before", e[e.Center = 0] = "Center", e[e.After = 1] = "After", e))(xc || {});
function eh(e, t, n) {
  if (!n || n.length === 0)
    return 0;
  const i = n.reduce((l, s) => s.length > l.length ? s : l, "");
  return i === "" || !t.font?.[0] ? 0 : (e.ctx.font = t.font[0], e.ctx.measureText(i).width / devicePixelRatio);
}
function th(e) {
  return (t, n, i, l) => {
    const s = t.axes[i];
    if (l > 1) {
      const c = s._size;
      if (c !== void 0)
        return c;
    }
    let d = (s.ticks?.size ?? 0) + e;
    return d += eh(t, s, n), Math.ceil(d);
  };
}
class nh extends Ia {
  buildGridConfig() {
    const { grid: t, isDarkMode: n, isLogScale: i } = this.props, l = n ? "#444" : "#E8E9EA", s = i ? 0.1 : 0.2;
    return t ? {
      stroke: t.stroke ?? l,
      width: t.width ?? s,
      show: t.show ?? !0
    } : { stroke: l, width: s, show: !0 };
  }
  buildTicksConfig() {
    const { ticks: t } = this.props;
    return t || { width: 0.3, show: !0 };
  }
  buildXAxisValuesFormatter() {
    if (this.props.isTimeAxis !== !1)
      return (t, n) => n.map((i) => {
        if (i == null || Number.isNaN(i))
          return "";
        const l = new Date(i * 1e3);
        return `${l.getHours().toString().padStart(2, "0")}:${l.getMinutes().toString().padStart(2, "0")}`;
      });
  }
  buildYAxisValuesFormatter() {
    const { yAxisUnit: t, decimalPrecision: n } = this.props;
    return (i, l) => l.map((s) => {
      if (s == null || Number.isNaN(s))
        return "";
      const d = s.toFixed(n ?? 1);
      return t ? `${d} ${t}` : d;
    });
  }
  buildValuesFormatter() {
    const { values: t, scaleKey: n } = this.props;
    if (t)
      return t;
    if (n === "x")
      return this.buildXAxisValuesFormatter();
    if (n === "y")
      return this.buildYAxisValuesFormatter();
  }
  buildSizeCalculator() {
    const { size: t, scaleKey: n } = this.props;
    if (t)
      return t;
    if (n === "y")
      return th(this.props.gap ?? 5);
  }
  buildStrokeColor() {
    const { stroke: t, isDarkMode: n } = this.props;
    if (t !== void 0)
      return t;
    if (n !== void 0)
      return n ? "white" : "black";
  }
  getConfig() {
    const {
      scaleKey: t,
      label: n,
      show: i = !0,
      side: l = 2,
      space: s,
      gap: d = 5
    } = this.props, c = this.buildGridConfig(), u = this.buildTicksConfig(), p = this.buildValuesFormatter(), m = this.buildSizeCalculator(), b = this.buildStrokeColor(), v = { scale: t, show: i, side: l };
    n && (v.label = n), b && (v.stroke = b), c && (v.grid = c), u && (v.ticks = u), p && (v.values = p), d !== void 0 && (v.gap = d), s !== void 0 && (v.space = s), m && (v.size = m);
    const { border: C } = this.props;
    return C?.show && (v.border = {
      stroke: C.stroke ?? b ?? "#666666",
      width: C.width ?? 1,
      show: !0
    }), v;
  }
  merge(t) {
    this.props = { ...this.props, ...t };
  }
}
const ih = "#FFFFFF", wc = 30, lh = 1e6, oh = 3, ah = {
  focus: { alpha: 0.3 },
  legend: { show: !1 },
  padding: [16, 16, 8, 8],
  series: [],
  hooks: {}
}, os = {
  drag: { setScale: !0 },
  points: {
    one: !0,
    size: (e, t) => (e.series[t]?.points?.size ?? 0) * 3,
    width: (e, t, n) => n / 4,
    stroke: (e, t) => {
      const n = e.series[t]?.points, i = typeof n?.stroke == "function" ? n.stroke : void 0;
      return `${i !== void 0 ? i(e, t) : typeof n?.stroke == "string" ? n.stroke : ""}90`;
    },
    fill: () => ih
  },
  focus: { prox: lh },
  hover: { prox: wc, bias: 0 }
};
function sh(e, t, n) {
  return e;
}
function rh(e) {
  const t = [10, 5];
  function n(s, d, c) {
    const u = s.ctx;
    u.save(), u.lineWidth = 2, u.setLineDash(t);
    const p = u.canvas.height * 0.9;
    for (const m of c) {
      const b = m.thresholdColor ?? "red", v = sh(
        m.thresholdValue,
        m.thresholdUnit,
        e.yAxisUnit
      ), C = s.valToPos(Number(v), d, !0), P = Math.round(s.bbox.left), M = Math.round(C), q = Math.round(s.bbox.left + s.bbox.width);
      if (u.strokeStyle = b, u.beginPath(), u.moveTo(P, M), u.lineTo(q, M), u.stroke(), m.thresholdLabel) {
        const Q = u.measureText(m.thresholdLabel).width, V = q - Q - 20, A = u.canvas.height - M > p ? M + 15 : M - 15;
        u.fillStyle = b, u.fillText(m.thresholdLabel, V, A);
      }
    }
  }
  const { scaleKey: i, thresholds: l } = e;
  return (s) => {
    const d = s.ctx;
    n(s, i, l), d.restore();
  };
}
function yr({
  seriesShow: e,
  seriesLabel: t,
  visibleStoredLabels: n,
  hiddenStoredLabels: i,
  hasActivePreference: l
}) {
  const s = !!n?.has(t), d = !!i?.has(t);
  return s ? !0 : d || l ? !1 : e ?? !0;
}
const Sc = "series_visibility_";
function uh(e) {
  try {
    const t = localStorage.getItem(Sc + e);
    return t ? JSON.parse(t) : null;
  } catch {
    return null;
  }
}
function ch(e, t) {
  try {
    localStorage.setItem(Sc + e, JSON.stringify(t));
  } catch {
  }
}
function kc({
  uPlotInstance: e,
  stepInterval: t
}) {
  const n = e.scales.x;
  if (n && typeof n.min == "number") {
    const i = n.min, l = i + t, s = e.valToPos(i, "x"), d = e.valToPos(l, "x");
    return Math.abs(d - s);
  }
  return 0;
}
const dh = !0, nn = "u-", fh = "uplot", hh = nn + "hz", gh = nn + "vt", ph = nn + "title", vh = nn + "wrap", mh = nn + "under", yh = nn + "over", bh = nn + "axis", gl = nn + "off", xh = nn + "select", wh = nn + "cursor-x", Sh = nn + "cursor-y", kh = nn + "cursor-pt", Ch = nn + "legend", _h = nn + "live", Mh = nn + "inline", zh = nn + "series", Th = nn + "marker", br = nn + "label", Ph = nn + "value", zo = "width", To = "height", So = "top", xr = "bottom", Nl = "left", as = "right", Hs = "#000", wr = Hs + "0", Sr = "mousemove", kr = "mousedown", ss = "mouseup", Cr = "mouseenter", _r = "mouseleave", Mr = "dblclick", $h = "resize", Eh = "scroll", zr = "change", Ma = "dppxchange", Ws = "--", io = typeof window < "u", Ts = io ? document : null, Gl = io ? window : null, Ih = io ? navigator : null;
let gt, sa;
function Ps() {
  let e = devicePixelRatio;
  gt != e && (gt = e, sa && Es(zr, sa, Ps), sa = matchMedia(`(min-resolution: ${gt - 1e-3}dppx) and (max-resolution: ${gt + 1e-3}dppx)`), vl(zr, sa, Ps), Gl.dispatchEvent(new CustomEvent(Ma)));
}
function Mn(e, t) {
  if (t != null) {
    let n = e.classList;
    !n.contains(t) && n.add(t);
  }
}
function $s(e, t) {
  let n = e.classList;
  n.contains(t) && n.remove(t);
}
function Et(e, t, n) {
  e.style[t] = n + "px";
}
function Jn(e, t, n, i) {
  let l = Ts.createElement(e);
  return t != null && Mn(l, t), n?.insertBefore(l, i), l;
}
function Fn(e, t) {
  return Jn("div", e, t);
}
const Tr = /* @__PURE__ */ new WeakMap();
function di(e, t, n, i, l) {
  let s = "translate(" + t + "px," + n + "px)", d = Tr.get(e);
  s != d && (e.style.transform = s, Tr.set(e, s), t < 0 || n < 0 || t > i || n > l ? Mn(e, gl) : $s(e, gl));
}
const Pr = /* @__PURE__ */ new WeakMap();
function $r(e, t, n) {
  let i = t + n, l = Pr.get(e);
  i != l && (Pr.set(e, i), e.style.background = t, e.style.borderColor = n);
}
const Er = /* @__PURE__ */ new WeakMap();
function Ir(e, t, n, i) {
  let l = t + "" + n, s = Er.get(e);
  l != s && (Er.set(e, l), e.style.height = n + "px", e.style.width = t + "px", e.style.marginLeft = i ? -t / 2 + "px" : 0, e.style.marginTop = i ? -n / 2 + "px" : 0);
}
const js = { passive: !0 }, Ah = { ...js, capture: !0 };
function vl(e, t, n, i) {
  t.addEventListener(e, n, i ? Ah : js);
}
function Es(e, t, n, i) {
  t.removeEventListener(e, n, js);
}
io && Ps();
function ti(e, t, n, i) {
  let l;
  n = n || 0, i = i || t.length - 1;
  let s = i <= 2147483647;
  for (; i - n > 1; )
    l = s ? n + i >> 1 : In((n + i) / 2), t[l] < e ? n = l : i = l;
  return e - t[n] <= t[i] - e ? n : i;
}
function Xl(e, t, n, i) {
  for (let l = i == 1 ? t : n; l >= t && l <= n; l += i)
    if (e[l] != null)
      return l;
  return -1;
}
function Oh(e, t, n, i) {
  let l = st, s = -st;
  if (i == 1)
    l = e[t], s = e[n];
  else if (i == -1)
    l = e[n], s = e[t];
  else
    for (let d = t; d <= n; d++) {
      let c = e[d];
      c != null && (c < l && (l = c), c > s && (s = c));
    }
  return [l, s];
}
function Dh(e, t, n) {
  let i = st, l = -st;
  for (let s = t; s <= n; s++) {
    let d = e[s];
    d != null && d > 0 && (d < i && (i = d), d > l && (l = d));
  }
  return [i, l];
}
function Aa(e, t, n, i) {
  let l = Dr(e), s = Dr(t);
  e == t && (l == -1 ? (e *= n, t /= n) : (e /= n, t *= n));
  let d = n == 10 ? Mi : Cc, c = l == 1 ? In : Hn, u = s == 1 ? Hn : In, p = c(d(tn(e))), m = u(d(tn(t))), b = Ql(n, p), v = Ql(n, m);
  return n == 10 && (p < 0 && (b = Mt(b, -p)), m < 0 && (v = Mt(v, -m))), i || n == 2 ? (e = b * l, t = v * s) : (e = zc(e, b), t = Oa(t, v)), [e, t];
}
function Gs(e, t, n, i) {
  let l = Aa(e, t, n, i);
  return e == 0 && (l[0] = 0), t == 0 && (l[1] = 0), l;
}
const Ys = 0.1, Ar = {
  mode: 3,
  pad: Ys
}, Io = {
  pad: 0,
  soft: null,
  mode: 0
}, Lh = {
  min: Io,
  max: Io
};
function za(e, t, n, i) {
  return Da(n) ? Or(e, t, n) : (Io.pad = n, Io.soft = i ? 0 : null, Io.mode = i ? 3 : 0, Or(e, t, Lh));
}
function dt(e, t) {
  return e ?? t;
}
function qh(e, t, n) {
  for (t = dt(t, 0), n = dt(n, e.length - 1); t <= n; ) {
    if (e[t] != null)
      return !0;
    t++;
  }
  return !1;
}
function Or(e, t, n) {
  let i = n.min, l = n.max, s = dt(i.pad, 0), d = dt(l.pad, 0), c = dt(i.hard, -st), u = dt(l.hard, st), p = dt(i.soft, st), m = dt(l.soft, -st), b = dt(i.mode, 0), v = dt(l.mode, 0), C = t - e, P = Mi(C), M = dn(tn(e), tn(t)), q = Mi(M), Q = tn(q - P);
  (C < 1e-24 || Q > 10) && (C = 0, (e == 0 || t == 0) && (C = 1e-24, b == 2 && p != st && (s = 0), v == 2 && m != -st && (d = 0)));
  let V = C || M || 1e3, Y = Mi(V), A = Ql(10, In(Y)), H = V * (C == 0 ? e == 0 ? 0.1 : 1 : s), ee = Mt(zc(e - H, A / 10), 24), z = e >= p && (b == 1 || b == 3 && ee <= p || b == 2 && ee >= p) ? p : st, j = dn(c, ee < z && e >= z ? z : Wn(z, ee)), J = V * (C == 0 ? t == 0 ? 0.1 : 1 : d), K = Mt(Oa(t + J, A / 10), 24), O = t <= m && (v == 1 || v == 3 && K >= m || v == 2 && K <= m) ? m : -st, Z = Wn(u, K > O && t <= O ? O : dn(O, K));
  return j == Z && j == 0 && (Z = 100), [j, Z];
}
const Rh = new Intl.NumberFormat(io ? Ih.language : "en-US"), Us = (e) => Rh.format(e), On = Math, xa = On.PI, tn = On.abs, In = On.floor, en = On.round, Hn = On.ceil, Wn = On.min, dn = On.max, Ql = On.pow, Dr = On.sign, Mi = On.log10, Cc = On.log2, Nh = (e, t = 1) => On.sinh(e) * t, rs = (e, t = 1) => On.asinh(e / t), st = 1 / 0;
function Lr(e) {
  return (Mi((e ^ e >> 31) - (e >> 31)) | 0) + 1;
}
function Is(e, t, n) {
  return Wn(dn(e, t), n);
}
function at(e) {
  return typeof e == "function" ? e : () => e;
}
const Vh = () => {
}, _c = (e) => e, Mc = (e, t) => t, Fh = (e) => null, qr = (e) => !0, Rr = (e, t) => e == t, Bh = /\.\d*?(?=9{6,}|0{6,})/gm, Sl = (e) => {
  if (Pc(e) || Ki.has(e))
    return e;
  const t = `${e}`, n = t.match(Bh);
  if (n == null)
    return e;
  let i = n[0].length - 1;
  if (t.indexOf("e-") != -1) {
    let [l, s] = t.split("e");
    return +`${Sl(l)}e${s}`;
  }
  return Mt(e, i);
};
function dl(e, t) {
  return Sl(Mt(Sl(e / t)) * t);
}
function Oa(e, t) {
  return Sl(Hn(Sl(e / t)) * t);
}
function zc(e, t) {
  return Sl(In(Sl(e / t)) * t);
}
function Mt(e, t = 0) {
  if (Pc(e))
    return e;
  let n = 10 ** t, i = e * n * (1 + Number.EPSILON);
  return en(i) / n;
}
const Ki = /* @__PURE__ */ new Map();
function Tc(e) {
  return (("" + e).split(".")[1] || "").length;
}
function Ro(e, t, n, i) {
  let l = [], s = i.map(Tc);
  for (let d = t; d < n; d++) {
    let c = tn(d), u = Mt(Ql(e, d), c);
    for (let p = 0; p < i.length; p++) {
      let m = e == 10 ? +`${i[p]}e${d}` : i[p] * u, b = (d >= 0 ? 0 : c) + (d >= s[p] ? 0 : s[p]), v = e == 10 ? m : Mt(m, b);
      l.push(v), Ki.set(v, b);
    }
  }
  return l;
}
const Ao = {}, Ks = [], Jl = [null, null], ji = Array.isArray, Pc = Number.isInteger, Hh = (e) => e === void 0;
function Nr(e) {
  return typeof e == "string";
}
function Da(e) {
  let t = !1;
  if (e != null) {
    let n = e.constructor;
    t = n == null || n == Object;
  }
  return t;
}
function Wh(e) {
  return e != null && typeof e == "object";
}
const jh = Object.getPrototypeOf(Uint8Array), $c = "__proto__";
function Zl(e, t = Da) {
  let n;
  if (ji(e)) {
    let i = e.find((l) => l != null);
    if (ji(i) || t(i)) {
      n = Array(e.length);
      for (let l = 0; l < e.length; l++)
        n[l] = Zl(e[l], t);
    } else
      n = e.slice();
  } else if (e instanceof jh)
    n = e.slice();
  else if (t(e)) {
    n = {};
    for (let i in e)
      i != $c && (n[i] = Zl(e[i], t));
  } else
    n = e;
  return n;
}
function Ut(e) {
  let t = arguments;
  for (let n = 1; n < t.length; n++) {
    let i = t[n];
    for (let l in i)
      l != $c && (Da(e[l]) ? Ut(e[l], Zl(i[l])) : e[l] = Zl(i[l]));
  }
  return e;
}
const Gh = 0, Yh = 1, Uh = 2;
function Kh(e, t, n) {
  for (let i = 0, l, s = -1; i < t.length; i++) {
    let d = t[i];
    if (d > s) {
      for (l = d - 1; l >= 0 && e[l] == null; )
        e[l--] = null;
      for (l = d + 1; l < n && e[l] == null; )
        e[s = l++] = null;
    }
  }
}
function Xh(e, t) {
  if (Zh(e)) {
    let d = e[0].slice();
    for (let c = 1; c < e.length; c++)
      d.push(...e[c].slice(1));
    return eg(d[0]) || (d = Jh(d)), d;
  }
  let n = /* @__PURE__ */ new Set();
  for (let d = 0; d < e.length; d++) {
    let u = e[d][0], p = u.length;
    for (let m = 0; m < p; m++)
      n.add(u[m]);
  }
  let i = [Array.from(n).sort((d, c) => d - c)], l = i[0].length, s = /* @__PURE__ */ new Map();
  for (let d = 0; d < l; d++)
    s.set(i[0][d], d);
  for (let d = 0; d < e.length; d++) {
    let c = e[d], u = c[0];
    for (let p = 1; p < c.length; p++) {
      let m = c[p], b = Array(l).fill(void 0), v = t ? t[d][p] : Yh, C = [];
      for (let P = 0; P < m.length; P++) {
        let M = m[P], q = s.get(u[P]);
        M === null ? v != Gh && (b[q] = M, v == Uh && C.push(q)) : b[q] = M;
      }
      Kh(b, C, l), i.push(b);
    }
  }
  return i;
}
const Qh = typeof queueMicrotask > "u" ? (e) => Promise.resolve().then(e) : queueMicrotask;
function Jh(e) {
  let t = e[0], n = t.length, i = Array(n);
  for (let s = 0; s < i.length; s++)
    i[s] = s;
  i.sort((s, d) => t[s] - t[d]);
  let l = [];
  for (let s = 0; s < e.length; s++) {
    let d = e[s], c = Array(n);
    for (let u = 0; u < n; u++)
      c[u] = d[i[u]];
    l.push(c);
  }
  return l;
}
function Zh(e) {
  let t = e[0][0], n = t.length;
  for (let i = 1; i < e.length; i++) {
    let l = e[i][0];
    if (l.length != n)
      return !1;
    if (l != t) {
      for (let s = 0; s < n; s++)
        if (l[s] != t[s])
          return !1;
    }
  }
  return !0;
}
function eg(e, t = 100) {
  const n = e.length;
  if (n <= 1)
    return !0;
  let i = 0, l = n - 1;
  for (; i <= l && e[i] == null; )
    i++;
  for (; l >= i && e[l] == null; )
    l--;
  if (l <= i)
    return !0;
  const s = dn(1, In((l - i + 1) / t));
  for (let d = e[i], c = i + s; c <= l; c += s) {
    const u = e[c];
    if (u != null) {
      if (u <= d)
        return !1;
      d = u;
    }
  }
  return !0;
}
const Ec = [
  "January",
  "February",
  "March",
  "April",
  "May",
  "June",
  "July",
  "August",
  "September",
  "October",
  "November",
  "December"
], Ic = [
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
];
function Ac(e) {
  return e.slice(0, 3);
}
const tg = Ic.map(Ac), ng = Ec.map(Ac), ig = {
  MMMM: Ec,
  MMM: ng,
  WWWW: Ic,
  WWW: tg
};
function ko(e) {
  return (e < 10 ? "0" : "") + e;
}
function lg(e) {
  return (e < 10 ? "00" : e < 100 ? "0" : "") + e;
}
const og = {
  // 2019
  YYYY: (e) => e.getFullYear(),
  // 19
  YY: (e) => (e.getFullYear() + "").slice(2),
  // July
  MMMM: (e, t) => t.MMMM[e.getMonth()],
  // Jul
  MMM: (e, t) => t.MMM[e.getMonth()],
  // 07
  MM: (e) => ko(e.getMonth() + 1),
  // 7
  M: (e) => e.getMonth() + 1,
  // 09
  DD: (e) => ko(e.getDate()),
  // 9
  D: (e) => e.getDate(),
  // Monday
  WWWW: (e, t) => t.WWWW[e.getDay()],
  // Mon
  WWW: (e, t) => t.WWW[e.getDay()],
  // 03
  HH: (e) => ko(e.getHours()),
  // 3
  H: (e) => e.getHours(),
  // 9 (12hr, unpadded)
  h: (e) => {
    let t = e.getHours();
    return t == 0 ? 12 : t > 12 ? t - 12 : t;
  },
  // AM
  AA: (e) => e.getHours() >= 12 ? "PM" : "AM",
  // am
  aa: (e) => e.getHours() >= 12 ? "pm" : "am",
  // a
  a: (e) => e.getHours() >= 12 ? "p" : "a",
  // 09
  mm: (e) => ko(e.getMinutes()),
  // 9
  m: (e) => e.getMinutes(),
  // 09
  ss: (e) => ko(e.getSeconds()),
  // 9
  s: (e) => e.getSeconds(),
  // 374
  fff: (e) => lg(e.getMilliseconds())
};
function Xs(e, t) {
  t = t || ig;
  let n = [], i = /\{([a-z]+)\}|[^{]+/gi, l;
  for (; l = i.exec(e); )
    n.push(l[0][0] == "{" ? og[l[1]] : l[0]);
  return (s) => {
    let d = "";
    for (let c = 0; c < n.length; c++)
      d += typeof n[c] == "string" ? n[c] : n[c](s, t);
    return d;
  };
}
const ag = new Intl.DateTimeFormat().resolvedOptions().timeZone;
function sg(e, t) {
  let n;
  return t == "UTC" || t == "Etc/UTC" ? n = new Date(+e + e.getTimezoneOffset() * 6e4) : t == ag ? n = e : (n = new Date(e.toLocaleString("en-US", { timeZone: t })), n.setMilliseconds(e.getMilliseconds())), n;
}
const Oc = (e) => e % 1 == 0, Ta = [1, 2, 2.5, 5], rg = Ro(10, -32, 0, Ta), Dc = Ro(10, 0, 32, Ta), ug = Dc.filter(Oc), fl = rg.concat(Dc), Qs = `
`, Lc = "{YYYY}", Vr = Qs + Lc, qc = "{M}/{D}", Po = Qs + qc, ra = Po + "/{YY}", Rc = "{aa}", cg = "{h}:{mm}", Hl = cg + Rc, Fr = Qs + Hl, Br = ":{ss}", pt = null;
function Nc(e) {
  let t = e * 1e3, n = t * 60, i = n * 60, l = i * 24, s = l * 30, d = l * 365, u = (e == 1 ? Ro(10, 0, 3, Ta).filter(Oc) : Ro(10, -3, 0, Ta)).concat([
    // minute divisors (# of secs)
    t,
    t * 5,
    t * 10,
    t * 15,
    t * 30,
    // hour divisors (# of mins)
    n,
    n * 5,
    n * 10,
    n * 15,
    n * 30,
    // day divisors (# of hrs)
    i,
    i * 2,
    i * 3,
    i * 4,
    i * 6,
    i * 8,
    i * 12,
    // month divisors TODO: need more?
    l,
    l * 2,
    l * 3,
    l * 4,
    l * 5,
    l * 6,
    l * 7,
    l * 8,
    l * 9,
    l * 10,
    l * 15,
    // year divisors (# months, approx)
    s,
    s * 2,
    s * 3,
    s * 4,
    s * 6,
    // century divisors
    d,
    d * 2,
    d * 5,
    d * 10,
    d * 25,
    d * 50,
    d * 100
  ]);
  const p = [
    //   tick incr    default          year                    month   day                   hour    min       sec   mode
    [d, Lc, pt, pt, pt, pt, pt, pt, 1],
    [l * 28, "{MMM}", Vr, pt, pt, pt, pt, pt, 1],
    [l, qc, Vr, pt, pt, pt, pt, pt, 1],
    [i, "{h}" + Rc, ra, pt, Po, pt, pt, pt, 1],
    [n, Hl, ra, pt, Po, pt, pt, pt, 1],
    [t, Br, ra + " " + Hl, pt, Po + " " + Hl, pt, Fr, pt, 1],
    [e, Br + ".{fff}", ra + " " + Hl, pt, Po + " " + Hl, pt, Fr, pt, 1]
  ];
  function m(b) {
    return (v, C, P, M, q, Q) => {
      let V = [], Y = q >= d, A = q >= s && q < d, H = b(P), ee = Mt(H * e, 3), z = us(H.getFullYear(), Y ? 0 : H.getMonth(), A || Y ? 1 : H.getDate()), j = Mt(z * e, 3);
      if (A || Y) {
        let J = A ? q / s : 0, K = Y ? q / d : 0, O = ee == j ? ee : Mt(us(z.getFullYear() + K, z.getMonth() + J, 1) * e, 3), Z = new Date(en(O / e)), U = Z.getFullYear(), $ = Z.getMonth();
        for (let G = 0; O <= M; G++) {
          let ue = us(U + K * G, $ + J * G, 1), ie = ue - b(Mt(ue * e, 3));
          O = Mt((+ue + ie) * e, 3), O <= M && V.push(O);
        }
      } else {
        let J = q >= l ? l : q, K = In(P) - In(ee), O = j + K + Oa(ee - j, J);
        V.push(O);
        let Z = b(O), U = Z.getHours() + Z.getMinutes() / n + Z.getSeconds() / i, $ = q / i, G = v.axes[C]._space, ue = Q / G;
        for (; O = Mt(O + q, e == 1 ? 0 : 3), !(O > M); )
          if ($ > 1) {
            let ie = In(Mt(U + $, 6)) % 24, ge = b(O).getHours() - ie;
            ge > 1 && (ge = -1), O -= ge * i, U = (U + $) % 24;
            let le = V[V.length - 1];
            Mt((O - le) / q, 3) * ue >= 0.7 && V.push(O);
          } else
            V.push(O);
      }
      return V;
    };
  }
  return [
    u,
    p,
    m
  ];
}
const [dg, fg, hg] = Nc(1), [gg, pg, vg] = Nc(1e-3);
Ro(2, -53, 53, [1]);
function Hr(e, t) {
  return e.map((n) => n.map(
    (i, l) => l == 0 || l == 8 || i == null ? i : t(l == 1 || n[8] == 0 ? i : n[1] + i)
  ));
}
function Wr(e, t) {
  return (n, i, l, s, d) => {
    let c = t.find((P) => d >= P[0]) || t[t.length - 1], u, p, m, b, v, C;
    return i.map((P) => {
      let M = e(P), q = M.getFullYear(), Q = M.getMonth(), V = M.getDate(), Y = M.getHours(), A = M.getMinutes(), H = M.getSeconds(), ee = q != u && c[2] || Q != p && c[3] || V != m && c[4] || Y != b && c[5] || A != v && c[6] || H != C && c[7] || c[1];
      return u = q, p = Q, m = V, b = Y, v = A, C = H, ee(M);
    });
  };
}
function mg(e, t) {
  let n = Xs(t);
  return (i, l, s, d, c) => l.map((u) => n(e(u)));
}
function us(e, t, n) {
  return new Date(e, t, n);
}
function jr(e, t) {
  return t(e);
}
const yg = "{YYYY}-{MM}-{DD} {h}:{mm}{aa}";
function Gr(e, t) {
  return (n, i, l, s) => s == null ? Ws : t(e(i));
}
function bg(e, t) {
  let n = e.series[t];
  return n.width ? n.stroke(e, t) : n.points.width ? n.points.stroke(e, t) : null;
}
function xg(e, t) {
  return e.series[t].fill(e, t);
}
const wg = {
  show: !0,
  live: !0,
  isolate: !1,
  mount: Vh,
  markers: {
    show: !0,
    width: 2,
    stroke: bg,
    fill: xg,
    dash: "solid"
  },
  idx: null,
  idxs: null,
  values: []
};
function Sg(e, t) {
  let n = e.cursor.points, i = Fn(), l = n.size(e, t);
  Et(i, zo, l), Et(i, To, l);
  let s = l / -2;
  Et(i, "marginLeft", s), Et(i, "marginTop", s);
  let d = n.width(e, t, l);
  return d && Et(i, "borderWidth", d), i;
}
function kg(e, t) {
  let n = e.series[t].points;
  return n._fill || n._stroke;
}
function Cg(e, t) {
  let n = e.series[t].points;
  return n._stroke || n._fill;
}
function _g(e, t) {
  return e.series[t].points.size;
}
const cs = [0, 0];
function Mg(e, t, n) {
  return cs[0] = t, cs[1] = n, cs;
}
function ua(e, t, n, i = !0) {
  return (l) => {
    l.button == 0 && (!i || l.target == t) && n(l);
  };
}
function ds(e, t, n, i = !0) {
  return (l) => {
    (!i || l.target == t) && n(l);
  };
}
const zg = {
  show: !0,
  x: !0,
  y: !0,
  lock: !1,
  move: Mg,
  points: {
    one: !1,
    show: Sg,
    size: _g,
    width: 0,
    stroke: Cg,
    fill: kg
  },
  bind: {
    mousedown: ua,
    mouseup: ua,
    click: ua,
    // legend clicks, not .u-over clicks
    dblclick: ua,
    mousemove: ds,
    mouseleave: ds,
    mouseenter: ds
  },
  drag: {
    setScale: !0,
    x: !0,
    y: !1,
    dist: 0,
    uni: null,
    click: (e, t) => {
      t.stopPropagation(), t.stopImmediatePropagation();
    },
    _x: !1,
    _y: !1
  },
  focus: {
    dist: (e, t, n, i, l) => i - l,
    prox: -1,
    bias: 0
  },
  hover: {
    skip: [void 0],
    prox: null,
    bias: 0
  },
  left: -10,
  top: -10,
  idx: null,
  dataIdx: null,
  idxs: null,
  event: null
}, Vc = {
  show: !0,
  stroke: "rgba(0,0,0,0.07)",
  width: 2
  //	dash: [],
}, Js = Ut({}, Vc, {
  filter: Mc
}), Fc = Ut({}, Js, {
  size: 10
}), Bc = Ut({}, Vc, {
  show: !1
}), Zs = '12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"', Hc = "bold " + Zs, Wc = 1.5, Yr = {
  show: !0,
  scale: "x",
  stroke: Hs,
  space: 50,
  gap: 5,
  size: 50,
  labelGap: 0,
  labelSize: 30,
  labelFont: Hc,
  side: 2,
  //	class: "x-vals",
  //	incrs: timeIncrs,
  //	values: timeVals,
  //	filter: retArg1,
  grid: Js,
  ticks: Fc,
  border: Bc,
  font: Zs,
  lineGap: Wc,
  rotate: 0
}, Tg = "Value", Pg = "Time", Ur = {
  show: !0,
  scale: "x",
  auto: !1,
  sorted: 1,
  //	label: "Time",
  //	value: v => stamp(new Date(v * 1e3)),
  // internal caches
  min: st,
  max: -st,
  idxs: []
};
function $g(e, t, n, i, l) {
  return t.map((s) => s == null ? "" : Us(s));
}
function Eg(e, t, n, i, l, s, d) {
  let c = [], u = Ki.get(l) || 0;
  n = d ? n : Mt(Oa(n, l), u);
  for (let p = n; p <= i; p = Mt(p + l, u))
    c.push(Object.is(p, -0) ? 0 : p);
  return c;
}
function As(e, t, n, i, l, s, d) {
  const c = [], u = e.scales[e.axes[t].scale].log, p = u == 10 ? Mi : Cc, m = In(p(n));
  l = Ql(u, m), u == 10 && (l = fl[ti(l, fl)]);
  let b = n, v = l * u;
  u == 10 && (v = fl[ti(v, fl)]);
  do
    c.push(b), b = b + l, u == 10 && !Ki.has(b) && (b = Mt(b, Ki.get(l))), b >= v && (l = b, v = l * u, u == 10 && (v = fl[ti(v, fl)]));
  while (b <= i);
  return c;
}
function Ig(e, t, n, i, l, s, d) {
  let u = e.scales[e.axes[t].scale].asinh, p = i > u ? As(e, t, dn(u, n), i, l) : [u], m = i >= 0 && n <= 0 ? [0] : [];
  return (n < -u ? As(e, t, dn(u, -i), -n, l) : [u]).reverse().map((v) => -v).concat(m, p);
}
const jc = /./, Ag = /[12357]/, Og = /[125]/, Kr = /1/, Os = (e, t, n, i) => e.map((l, s) => t == 4 && l == 0 || s % i == 0 && n.test(l.toExponential()[l < 0 ? 1 : 0]) ? l : null);
function Dg(e, t, n, i, l) {
  let s = e.axes[n], d = s.scale, c = e.scales[d], u = e.valToPos, p = s._space, m = u(10, d), b = u(9, d) - m >= p ? jc : u(7, d) - m >= p ? Ag : u(5, d) - m >= p ? Og : Kr;
  if (b == Kr) {
    let v = tn(u(1, d) - m);
    if (v < p)
      return Os(t.slice().reverse(), c.distr, b, Hn(p / v)).reverse();
  }
  return Os(t, c.distr, b, 1);
}
function Lg(e, t, n, i, l) {
  let s = e.axes[n], d = s.scale, c = s._space, u = e.valToPos, p = tn(u(1, d) - u(2, d));
  return p < c ? Os(t.slice().reverse(), 3, jc, Hn(c / p)).reverse() : t;
}
function qg(e, t, n, i) {
  return i == null ? Ws : t == null ? "" : Us(t);
}
const Xr = {
  show: !0,
  scale: "y",
  stroke: Hs,
  space: 30,
  gap: 5,
  size: 50,
  labelGap: 0,
  labelSize: 30,
  labelFont: Hc,
  side: 3,
  //	class: "y-vals",
  //	incrs: numIncrs,
  //	values: (vals, space) => vals,
  //	filter: retArg1,
  grid: Js,
  ticks: Fc,
  border: Bc,
  font: Zs,
  lineGap: Wc,
  rotate: 0
};
function Rg(e, t) {
  let n = 3 + (e || 1) * 2;
  return Mt(n * t, 3);
}
function Ng(e, t) {
  let { scale: n, idxs: i } = e.series[0], l = e._data[0], s = e.valToPos(l[i[0]], n, !0), d = e.valToPos(l[i[1]], n, !0), c = tn(d - s), u = e.series[t], p = c / (u.points.space * gt);
  return i[1] - i[0] <= p;
}
const Qr = {
  scale: null,
  auto: !0,
  sorted: 0,
  // internal caches
  min: st,
  max: -st
}, Gc = (e, t, n, i, l) => l, Jr = {
  show: !0,
  auto: !0,
  sorted: 0,
  gaps: Gc,
  alpha: 1,
  facets: [
    Ut({}, Qr, { scale: "x" }),
    Ut({}, Qr, { scale: "y" })
  ]
}, Zr = {
  scale: "y",
  auto: !0,
  sorted: 0,
  show: !0,
  spanGaps: !1,
  gaps: Gc,
  alpha: 1,
  points: {
    show: Ng,
    filter: null
    //  paths:
    //	stroke: "#000",
    //	fill: "#fff",
    //	width: 1,
    //	size: 10,
  },
  //	label: "Value",
  //	value: v => v,
  values: null,
  // internal caches
  min: st,
  max: -st,
  idxs: [],
  path: null,
  clip: null
};
function Vg(e, t, n, i, l) {
  return n / 10;
}
const Yc = {
  time: dh,
  auto: !0,
  distr: 1,
  log: 10,
  asinh: 1,
  min: null,
  max: null,
  dir: 1,
  ori: 0
}, Fg = Ut({}, Yc, {
  time: !1,
  ori: 1
}), eu = {};
function Uc(e, t) {
  let n = eu[e];
  return n || (n = {
    key: e,
    plots: [],
    sub(i) {
      n.plots.push(i);
    },
    unsub(i) {
      n.plots = n.plots.filter((l) => l != i);
    },
    pub(i, l, s, d, c, u, p) {
      for (let m = 0; m < n.plots.length; m++)
        n.plots[m] != l && n.plots[m].pub(i, l, s, d, c, u, p);
    }
  }, e != null && (eu[e] = n)), n;
}
const eo = 1, Ds = 2;
function kl(e, t, n) {
  const i = e.mode, l = e.series[t], s = i == 2 ? e._data[t] : e._data, d = e.scales, c = e.bbox;
  let u = s[0], p = i == 2 ? s[1] : s[t], m = i == 2 ? d[l.facets[0].scale] : d[e.series[0].scale], b = i == 2 ? d[l.facets[1].scale] : d[l.scale], v = c.left, C = c.top, P = c.width, M = c.height, q = e.valToPosH, Q = e.valToPosV;
  return m.ori == 0 ? n(
    l,
    u,
    p,
    m,
    b,
    q,
    Q,
    v,
    C,
    P,
    M,
    qa,
    lo,
    Na,
    Xc,
    Jc
  ) : n(
    l,
    u,
    p,
    m,
    b,
    Q,
    q,
    C,
    v,
    M,
    P,
    Ra,
    oo,
    nr,
    Qc,
    Zc
  );
}
function er(e, t) {
  let n = 0, i = 0, l = dt(e.bands, Ks);
  for (let s = 0; s < l.length; s++) {
    let d = l[s];
    d.series[0] == t ? n = d.dir : d.series[1] == t && (d.dir == 1 ? i |= 1 : i |= 2);
  }
  return [
    n,
    i == 1 ? -1 : (
      // neg only
      i == 2 ? 1 : (
        // pos only
        i == 3 ? 2 : (
          // both
          0
        )
      )
    )
  ];
}
function Bg(e, t, n, i, l) {
  let s = e.mode, d = e.series[t], c = s == 2 ? d.facets[1].scale : d.scale, u = e.scales[c];
  return l == -1 ? u.min : l == 1 ? u.max : u.distr == 3 ? u.dir == 1 ? u.min : u.max : 0;
}
function zi(e, t, n, i, l, s) {
  return kl(e, t, (d, c, u, p, m, b, v, C, P, M, q) => {
    let Q = d.pxRound;
    const V = p.dir * (p.ori == 0 ? 1 : -1), Y = p.ori == 0 ? lo : oo;
    let A, H;
    V == 1 ? (A = n, H = i) : (A = i, H = n);
    let ee = Q(b(c[A], p, M, C)), z = Q(v(u[A], m, q, P)), j = Q(b(c[H], p, M, C)), J = Q(v(s == 1 ? m.max : m.min, m, q, P)), K = new Path2D(l);
    return Y(K, j, J), Y(K, ee, J), Y(K, ee, z), K;
  });
}
function La(e, t, n, i, l, s) {
  let d = null;
  if (e.length > 0) {
    d = new Path2D();
    const c = t == 0 ? Na : nr;
    let u = n;
    for (let b = 0; b < e.length; b++) {
      let v = e[b];
      if (v[1] > v[0]) {
        let C = v[0] - u;
        C > 0 && c(d, u, i, C, i + s), u = v[1];
      }
    }
    let p = n + l - u, m = 10;
    p > 0 && c(d, u, i - m / 2, p, i + s + m);
  }
  return d;
}
function Hg(e, t, n) {
  let i = e[e.length - 1];
  i && i[0] == t ? i[1] = n : e.push([t, n]);
}
function tr(e, t, n, i, l, s, d) {
  let c = [], u = e.length;
  for (let p = l == 1 ? n : i; p >= n && p <= i; p += l)
    if (t[p] === null) {
      let b = p, v = p;
      if (l == 1)
        for (; ++p <= i && t[p] === null; )
          v = p;
      else
        for (; --p >= n && t[p] === null; )
          v = p;
      let C = s(e[b]), P = v == b ? C : s(e[v]), M = b - l;
      C = d <= 0 && M >= 0 && M < u ? s(e[M]) : C;
      let Q = v + l;
      P = d >= 0 && Q >= 0 && Q < u ? s(e[Q]) : P, P >= C && c.push([C, P]);
    }
  return c;
}
function tu(e) {
  return e == 0 ? _c : e == 1 ? en : (t) => dl(t, e);
}
function Kc(e) {
  let t = e == 0 ? qa : Ra, n = e == 0 ? (l, s, d, c, u, p) => {
    l.arcTo(s, d, c, u, p);
  } : (l, s, d, c, u, p) => {
    l.arcTo(d, s, u, c, p);
  }, i = e == 0 ? (l, s, d, c, u) => {
    l.rect(s, d, c, u);
  } : (l, s, d, c, u) => {
    l.rect(d, s, u, c);
  };
  return (l, s, d, c, u, p = 0, m = 0) => {
    p == 0 && m == 0 ? i(l, s, d, c, u) : (p = Wn(p, c / 2, u / 2), m = Wn(m, c / 2, u / 2), t(l, s + p, d), n(l, s + c, d, s + c, d + u, p), n(l, s + c, d + u, s, d + u, m), n(l, s, d + u, s, d, m), n(l, s, d, s + c, d, p), l.closePath());
  };
}
const qa = (e, t, n) => {
  e.moveTo(t, n);
}, Ra = (e, t, n) => {
  e.moveTo(n, t);
}, lo = (e, t, n) => {
  e.lineTo(t, n);
}, oo = (e, t, n) => {
  e.lineTo(n, t);
}, Na = Kc(0), nr = Kc(1), Xc = (e, t, n, i, l, s) => {
  e.arc(t, n, i, l, s);
}, Qc = (e, t, n, i, l, s) => {
  e.arc(n, t, i, l, s);
}, Jc = (e, t, n, i, l, s, d) => {
  e.bezierCurveTo(t, n, i, l, s, d);
}, Zc = (e, t, n, i, l, s, d) => {
  e.bezierCurveTo(n, t, l, i, d, s);
};
function ed(e) {
  return (t, n, i, l, s) => kl(t, n, (d, c, u, p, m, b, v, C, P, M, q) => {
    let { pxRound: Q, points: V } = d, Y, A;
    p.ori == 0 ? (Y = qa, A = Xc) : (Y = Ra, A = Qc);
    const H = Mt(V.width * gt, 3);
    let ee = (V.size - V.width) / 2 * gt, z = Mt(ee * 2, 3), j = new Path2D(), J = new Path2D(), { left: K, top: O, width: Z, height: U } = t.bbox;
    Na(
      J,
      K - z,
      O - z,
      Z + z * 2,
      U + z * 2
    );
    const $ = (G) => {
      if (u[G] != null) {
        let ue = Q(b(c[G], p, M, C)), ie = Q(v(u[G], m, q, P));
        Y(j, ue + ee, ie), A(j, ue, ie, ee, 0, xa * 2);
      }
    };
    if (s)
      s.forEach($);
    else
      for (let G = i; G <= l; G++)
        $(G);
    return {
      stroke: H > 0 ? j : null,
      fill: j,
      clip: J,
      flags: eo | Ds
    };
  });
}
function td(e) {
  return (t, n, i, l, s, d) => {
    i != l && (s != i && d != i && e(t, n, i), s != l && d != l && e(t, n, l), e(t, n, d));
  };
}
const Wg = td(lo), jg = td(oo);
function nd(e) {
  const t = dt(e?.alignGaps, 0);
  return (n, i, l, s) => kl(n, i, (d, c, u, p, m, b, v, C, P, M, q) => {
    let Q = d.pxRound, V = (me) => Q(b(me, p, M, C)), Y = (me) => Q(v(me, m, q, P)), A, H;
    p.ori == 0 ? (A = lo, H = Wg) : (A = oo, H = jg);
    const ee = p.dir * (p.ori == 0 ? 1 : -1), z = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null, flags: eo }, j = z.stroke;
    let J = st, K = -st, O, Z, U, $ = V(c[ee == 1 ? l : s]), G = Xl(u, l, s, 1 * ee), ue = Xl(u, l, s, -1 * ee), ie = V(c[G]), Ee = V(c[ue]), ve = !1;
    for (let me = ee == 1 ? l : s; me >= l && me <= s; me += ee) {
      let Oe = V(c[me]), xe = u[me];
      Oe == $ ? xe != null ? (Z = Y(xe), J == st && (A(j, Oe, Z), O = Z), J = Wn(Z, J), K = dn(Z, K)) : xe === null && (ve = !0) : (J != st && (H(j, $, J, K, O, Z), U = $), xe != null ? (Z = Y(xe), A(j, Oe, Z), J = K = O = Z) : (J = st, K = -st, xe === null && (ve = !0)), $ = Oe);
    }
    J != st && J != K && U != $ && H(j, $, J, K, O, Z);
    let [ge, le] = er(n, i);
    if (d.fill != null || ge != 0) {
      let me = z.fill = new Path2D(j), Oe = d.fillTo(n, i, d.min, d.max, ge), xe = Y(Oe);
      A(me, Ee, xe), A(me, ie, xe);
    }
    if (!d.spanGaps) {
      let me = [];
      ve && me.push(...tr(c, u, l, s, ee, V, t)), z.gaps = me = d.gaps(n, i, l, s, me), z.clip = La(me, p.ori, C, P, M, q);
    }
    return le != 0 && (z.band = le == 2 ? [
      zi(n, i, l, s, j, -1),
      zi(n, i, l, s, j, 1)
    ] : zi(n, i, l, s, j, le)), z;
  });
}
function Gg(e) {
  const t = dt(e.align, 1), n = dt(e.ascDesc, !1), i = dt(e.alignGaps, 0), l = dt(e.extend, !1);
  return (s, d, c, u) => kl(s, d, (p, m, b, v, C, P, M, q, Q, V, Y) => {
    let A = p.pxRound, { left: H, width: ee } = s.bbox, z = (ge) => A(P(ge, v, V, q)), j = (ge) => A(M(ge, C, Y, Q)), J = v.ori == 0 ? lo : oo;
    const K = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null, flags: eo }, O = K.stroke, Z = v.dir * (v.ori == 0 ? 1 : -1);
    c = Xl(b, c, u, 1), u = Xl(b, c, u, -1);
    let U = j(b[Z == 1 ? c : u]), $ = z(m[Z == 1 ? c : u]), G = $, ue = $;
    l && t == -1 && (ue = H, J(O, ue, U)), J(O, $, U);
    for (let ge = Z == 1 ? c : u; ge >= c && ge <= u; ge += Z) {
      let le = b[ge];
      if (le == null)
        continue;
      let me = z(m[ge]), Oe = j(le);
      t == 1 ? J(O, me, U) : J(O, G, Oe), J(O, me, Oe), U = Oe, G = me;
    }
    let ie = G;
    l && t == 1 && (ie = H + ee, J(O, ie, U));
    let [Ee, ve] = er(s, d);
    if (p.fill != null || Ee != 0) {
      let ge = K.fill = new Path2D(O), le = p.fillTo(s, d, p.min, p.max, Ee), me = j(le);
      J(ge, ie, me), J(ge, ue, me);
    }
    if (!p.spanGaps) {
      let ge = [];
      ge.push(...tr(m, b, c, u, Z, z, i));
      let le = p.width * gt / 2, me = n || t == 1 ? le : -le, Oe = n || t == -1 ? -le : le;
      ge.forEach((xe) => {
        xe[0] += me, xe[1] += Oe;
      }), K.gaps = ge = p.gaps(s, d, c, u, ge), K.clip = La(ge, v.ori, q, Q, V, Y);
    }
    return ve != 0 && (K.band = ve == 2 ? [
      zi(s, d, c, u, O, -1),
      zi(s, d, c, u, O, 1)
    ] : zi(s, d, c, u, O, ve)), K;
  });
}
function nu(e, t, n, i, l, s, d = st) {
  if (e.length > 1) {
    let c = null;
    for (let u = 0, p = 1 / 0; u < e.length; u++)
      if (t[u] !== void 0) {
        if (c != null) {
          let m = tn(e[u] - e[c]);
          m < p && (p = m, d = tn(n(e[u], i, l, s) - n(e[c], i, l, s)));
        }
        c = u;
      }
  }
  return d;
}
function Yg(e) {
  e = e || Ao;
  const t = dt(e.size, [0.6, st, 1]), n = e.align || 0, i = e.gap || 0;
  let l = e.radius;
  l = // [valueRadius, baselineRadius]
  l == null ? [0, 0] : typeof l == "number" ? [l, 0] : l;
  const s = at(l), d = 1 - t[0], c = dt(t[1], st), u = dt(t[2], 1), p = dt(e.disp, Ao), m = dt(e.each, (C) => {
  }), { fill: b, stroke: v } = p;
  return (C, P, M, q) => kl(C, P, (Q, V, Y, A, H, ee, z, j, J, K, O) => {
    let Z = Q.pxRound, U = n, $ = i * gt, G = c * gt, ue = u * gt, ie, Ee;
    A.ori == 0 ? [ie, Ee] = s(C, P) : [Ee, ie] = s(C, P);
    const ve = A.dir * (A.ori == 0 ? 1 : -1);
    let ge = A.ori == 0 ? Na : nr, le = A.ori == 0 ? m : (_e, je, ct, Ye, qe, et, it) => {
      m(_e, je, ct, qe, Ye, it, et);
    }, me = dt(C.bands, Ks).find((_e) => _e.series[0] == P), Oe = me != null ? me.dir : 0, xe = Q.fillTo(C, P, Q.min, Q.max, Oe), ke = Z(z(xe, H, O, J)), se, oe, Te, be = K, Le = Z(Q.width * gt), Je = !1, Ge = null, vt = null, It = null, ft = null;
    b != null && (Le == 0 || v != null) && (Je = !0, Ge = b.values(C, P, M, q), vt = /* @__PURE__ */ new Map(), new Set(Ge).forEach((_e) => {
      _e != null && vt.set(_e, new Path2D());
    }), Le > 0 && (It = v.values(C, P, M, q), ft = /* @__PURE__ */ new Map(), new Set(It).forEach((_e) => {
      _e != null && ft.set(_e, new Path2D());
    })));
    let { x0: Tt, size: ut } = p;
    if (Tt != null && ut != null) {
      U = 1, V = Tt.values(C, P, M, q), Tt.unit == 2 && (V = V.map((ct) => C.posToVal(j + ct * K, A.key, !0)));
      let _e = ut.values(C, P, M, q);
      ut.unit == 2 ? oe = _e[0] * K : oe = ee(_e[0], A, K, j) - ee(0, A, K, j), be = nu(V, Y, ee, A, K, j, be), Te = be - oe + $;
    } else
      be = nu(V, Y, ee, A, K, j, be), Te = be * d + $, oe = be - Te;
    Te < 1 && (Te = 0), Le >= oe / 2 && (Le = 0), Te < 5 && (Z = _c);
    let At = Te > 0, jn = be - Te - (At ? Le : 0);
    oe = Z(Is(jn, ue, G)), se = (U == 0 ? oe / 2 : U == ve ? 0 : oe) - U * ve * ((U == 0 ? $ / 2 : 0) + (At ? Le / 2 : 0));
    const Wt = { stroke: null, fill: null, clip: null, band: null, gaps: null, flags: 0 }, ln = Je ? null : new Path2D();
    let Be = null;
    if (me != null)
      Be = C.data[me.series[1]];
    else {
      let { y0: _e, y1: je } = p;
      _e != null && je != null && (Y = je.values(C, P, M, q), Be = _e.values(C, P, M, q));
    }
    let ae = ie * oe, Ie = Ee * oe;
    for (let _e = ve == 1 ? M : q; _e >= M && _e <= q; _e += ve) {
      let je = Y[_e];
      if (je == null)
        continue;
      if (Be != null) {
        let qt = Be[_e] ?? 0;
        if (je - qt == 0)
          continue;
        ke = z(qt, H, O, J);
      }
      let ct = A.distr != 2 || p != null ? V[_e] : _e, Ye = ee(ct, A, K, j), qe = z(dt(je, xe), H, O, J), et = Z(Ye - se), it = Z(dn(qe, ke)), lt = Z(Wn(qe, ke)), St = it - lt;
      if (je != null) {
        let qt = je < 0 ? Ie : ae, Yt = je < 0 ? ae : Ie;
        Je ? (Le > 0 && It[_e] != null && ge(ft.get(It[_e]), et, lt + In(Le / 2), oe, dn(0, St - Le), qt, Yt), Ge[_e] != null && ge(vt.get(Ge[_e]), et, lt + In(Le / 2), oe, dn(0, St - Le), qt, Yt)) : ge(ln, et, lt + In(Le / 2), oe, dn(0, St - Le), qt, Yt), le(
          C,
          P,
          _e,
          et - Le / 2,
          lt,
          oe + Le,
          St
        );
      }
    }
    return Le > 0 ? Wt.stroke = Je ? ft : ln : Je || (Wt._fill = Q.width == 0 ? Q._fill : Q._stroke ?? Q._fill, Wt.width = 0), Wt.fill = Je ? vt : ln, Wt;
  });
}
function Ug(e, t) {
  const n = dt(t?.alignGaps, 0);
  return (i, l, s, d) => kl(i, l, (c, u, p, m, b, v, C, P, M, q, Q) => {
    let V = c.pxRound, Y = (ie) => V(v(ie, m, q, P)), A = (ie) => V(C(ie, b, Q, M)), H, ee, z;
    m.ori == 0 ? (H = qa, z = lo, ee = Jc) : (H = Ra, z = oo, ee = Zc);
    const j = m.dir * (m.ori == 0 ? 1 : -1);
    s = Xl(p, s, d, 1), d = Xl(p, s, d, -1);
    let J = Y(u[j == 1 ? s : d]), K = J, O = [], Z = [];
    for (let ie = j == 1 ? s : d; ie >= s && ie <= d; ie += j)
      if (p[ie] != null) {
        let ve = u[ie], ge = Y(ve);
        O.push(K = ge), Z.push(A(p[ie]));
      }
    const U = { stroke: e(O, Z, H, z, ee, V), fill: null, clip: null, band: null, gaps: null, flags: eo }, $ = U.stroke;
    let [G, ue] = er(i, l);
    if (c.fill != null || G != 0) {
      let ie = U.fill = new Path2D($), Ee = c.fillTo(i, l, c.min, c.max, G), ve = A(Ee);
      z(ie, K, ve), z(ie, J, ve);
    }
    if (!c.spanGaps) {
      let ie = [];
      ie.push(...tr(u, p, s, d, j, Y, n)), U.gaps = ie = c.gaps(i, l, s, d, ie), U.clip = La(ie, m.ori, P, M, q, Q);
    }
    return ue != 0 && (U.band = ue == 2 ? [
      zi(i, l, s, d, $, -1),
      zi(i, l, s, d, $, 1)
    ] : zi(i, l, s, d, $, ue)), U;
  });
}
function Kg(e) {
  return Ug(Xg, e);
}
function Xg(e, t, n, i, l, s) {
  const d = e.length;
  if (d < 2)
    return null;
  const c = new Path2D();
  if (n(c, e[0], t[0]), d == 2)
    i(c, e[1], t[1]);
  else {
    let u = Array(d), p = Array(d - 1), m = Array(d - 1), b = Array(d - 1);
    for (let v = 0; v < d - 1; v++)
      m[v] = t[v + 1] - t[v], b[v] = e[v + 1] - e[v], p[v] = m[v] / b[v];
    u[0] = p[0];
    for (let v = 1; v < d - 1; v++)
      p[v] === 0 || p[v - 1] === 0 || p[v - 1] > 0 != p[v] > 0 ? u[v] = 0 : (u[v] = 3 * (b[v - 1] + b[v]) / ((2 * b[v] + b[v - 1]) / p[v - 1] + (b[v] + 2 * b[v - 1]) / p[v]), isFinite(u[v]) || (u[v] = 0));
    u[d - 1] = p[d - 2];
    for (let v = 0; v < d - 1; v++)
      l(
        c,
        e[v] + b[v] / 3,
        t[v] + u[v] * b[v] / 3,
        e[v + 1] - b[v] / 3,
        t[v + 1] - u[v + 1] * b[v] / 3,
        e[v + 1],
        t[v + 1]
      );
  }
  return c;
}
const Ls = /* @__PURE__ */ new Set();
function iu() {
  for (let e of Ls)
    e.syncRect(!0);
}
io && (vl($h, Gl, iu), vl(Eh, Gl, iu, !0), vl(Ma, Gl, () => {
  Gt.pxRatio = gt;
}));
const Qg = nd(), Jg = ed();
function lu(e, t, n, i) {
  return (i ? [e[0], e[1]].concat(e.slice(2)) : [e[0]].concat(e.slice(1))).map((s, d) => qs(s, d, t, n));
}
function Zg(e, t) {
  return e.map((n, i) => i == 0 ? {} : Ut({}, t, n));
}
function qs(e, t, n, i) {
  return Ut({}, t == 0 ? n : i, e);
}
function id(e, t, n) {
  return t == null ? Jl : [t, n];
}
const ep = id;
function tp(e, t, n) {
  return t == null ? Jl : za(t, n, Ys, !0);
}
function ld(e, t, n, i) {
  return t == null ? Jl : Aa(t, n, e.scales[i].log, !1);
}
const np = ld;
function od(e, t, n, i) {
  return t == null ? Jl : Gs(t, n, e.scales[i].log, !1);
}
const ip = od;
function lp(e, t, n, i, l) {
  let s = dn(Lr(e), Lr(t)), d = t - e, c = ti(l / i * d, n);
  do {
    let u = n[c], p = i * u / d;
    if (p >= l && s + (u < 5 ? Ki.get(u) : 0) <= 17)
      return [u, p];
  } while (++c < n.length);
  return [0, 0];
}
function ou(e) {
  let t, n;
  return e = e.replace(/(\d+)px/, (i, l) => (t = en((n = +l) * gt)) + "px"), [e, t, n];
}
function op(e) {
  e.show && [e.font, e.labelFont].forEach((t) => {
    let n = Mt(t[2] * gt, 1);
    t[0] = t[0].replace(/[0-9.]+px/, n + "px"), t[1] = n;
  });
}
function Gt(e, t, n) {
  const i = {
    mode: dt(e.mode, 1)
  }, l = i.mode;
  function s(w, T) {
    return ((T.distr == 3 ? Mi(w > 0 ? w : T.clamp(i, w, T.min, T.max, T.key)) : T.distr == 4 ? rs(w, T.asinh) : T.distr == 100 ? T.fwd(w) : w) - T._min) / (T._max - T._min);
  }
  function d(w, T, N, F) {
    let te = s(w, T);
    return F + N * (T.dir == -1 ? 1 - te : te);
  }
  function c(w, T, N, F) {
    let te = s(w, T);
    return F + N * (T.dir == -1 ? te : 1 - te);
  }
  function u(w, T, N, F) {
    return T.ori == 0 ? d(w, T, N, F) : c(w, T, N, F);
  }
  i.valToPosH = d, i.valToPosV = c;
  let p = !1;
  i.status = 0;
  const m = i.root = Fn(fh);
  if (e.id != null && (m.id = e.id), Mn(m, e.class), e.title) {
    let w = Fn(ph, m);
    w.textContent = e.title;
  }
  const b = Jn("canvas"), v = i.ctx = b.getContext("2d"), C = Fn(vh, m);
  vl("click", C, (w) => {
    w.target === M && (kt != bi || xt != qi) && Zt.click(i, w);
  }, !0);
  const P = i.under = Fn(mh, C);
  C.appendChild(b);
  const M = i.over = Fn(yh, C);
  e = Zl(e);
  const q = +dt(e.pxAlign, 1), Q = tu(q);
  (e.plugins || []).forEach((w) => {
    w.opts && (e = w.opts(i, e) || e);
  });
  const V = e.ms || 1e-3, Y = i.series = l == 1 ? lu(e.series || [], Ur, Zr, !1) : Zg(e.series || [null], Jr), A = i.axes = lu(e.axes || [], Yr, Xr, !0), H = i.scales = {}, ee = i.bands = e.bands || [];
  ee.forEach((w) => {
    w.fill = at(w.fill || null), w.dir = dt(w.dir, -1);
  });
  const z = l == 2 ? Y[1].facets[0].scale : Y[0].scale, j = {
    axes: Ko,
    series: Tl
  }, J = (e.drawOrder || ["axes", "series"]).map((w) => j[w]);
  function K(w) {
    let T = H[w];
    if (T == null) {
      let N = (e.scales || Ao)[w] || Ao;
      if (N.from != null)
        K(N.from), H[w] = Ut({}, H[N.from], N, { key: w });
      else {
        T = H[w] = Ut({}, w == z ? Yc : Fg, N), T.key = w;
        let F = T.time, te = T.range, o = ji(te);
        if ((w != z || l == 2 && !F) && (o && (te[0] == null || te[1] == null) && (te = {
          min: te[0] == null ? Ar : {
            mode: 1,
            hard: te[0],
            soft: te[0]
          },
          max: te[1] == null ? Ar : {
            mode: 1,
            hard: te[1],
            soft: te[1]
          }
        }, o = !1), !o && Da(te))) {
          let a = te;
          te = (r, h, g) => h == null ? Jl : za(h, g, a);
        }
        T.range = at(te || (F ? ep : w == z ? T.distr == 3 ? np : T.distr == 4 ? ip : id : T.distr == 3 ? ld : T.distr == 4 ? od : tp)), T.auto = at(o ? !1 : T.auto), T.clamp = at(T.clamp || Vg), T._min = T._max = null;
      }
    }
  }
  K("x"), K("y"), l == 1 && Y.forEach((w) => {
    K(w.scale);
  }), A.forEach((w) => {
    K(w.scale);
  });
  for (let w in e.scales)
    K(w);
  const O = H[z], Z = O.distr;
  let U, $;
  O.ori == 0 ? (Mn(m, hh), U = d, $ = c) : (Mn(m, gh), U = c, $ = d);
  const G = {};
  for (let w in H) {
    let T = H[w];
    (T.min != null || T.max != null) && (G[w] = { min: T.min, max: T.max }, T.min = T.max = null);
  }
  const ue = e.tzDate || ((w) => new Date(en(w / V))), ie = e.fmtDate || Xs, Ee = V == 1 ? hg(ue) : vg(ue), ve = Wr(ue, Hr(V == 1 ? fg : pg, ie)), ge = Gr(ue, jr(yg, ie)), le = [], me = i.legend = Ut({}, wg, e.legend), Oe = me.show, xe = me.markers;
  me.idxs = le, xe.width = at(xe.width), xe.dash = at(xe.dash), xe.stroke = at(xe.stroke), xe.fill = at(xe.fill);
  let ke, se, oe, Te = [], be = [], Le, Je = !1, Ge = {};
  if (me.live) {
    const w = Y[1] ? Y[1].values : null;
    Je = w != null, Le = Je ? w(i, 1, 0) : { _: 0 };
    for (let T in Le)
      Ge[T] = Ws;
  }
  if (Oe)
    if (ke = Jn("table", Ch, m), oe = Jn("tbody", null, ke), me.mount(i, ke), Je) {
      se = Jn("thead", null, ke, oe);
      let w = Jn("tr", null, se);
      Jn("th", null, w);
      for (var vt in Le)
        Jn("th", br, w).textContent = vt;
    } else
      Mn(ke, Mh), me.live && Mn(ke, _h);
  const It = { show: !0 }, ft = { show: !1 };
  function Tt(w, T) {
    if (T == 0 && (Je || !me.live || l == 2))
      return Jl;
    let N = [], F = Jn("tr", zh, oe, oe.childNodes[T]);
    Mn(F, w.class), w.show || Mn(F, gl);
    let te = Jn("th", null, F);
    if (xe.show) {
      let r = Fn(Th, te);
      if (T > 0) {
        let h = xe.width(i, T);
        h && (r.style.border = h + "px " + xe.dash(i, T) + " " + xe.stroke(i, T)), r.style.background = xe.fill(i, T);
      }
    }
    let o = Fn(br, te);
    o.textContent = w.label, T > 0 && (xe.show || (o.style.color = w.width > 0 ? xe.stroke(i, T) : xe.fill(i, T)), At("click", te, (r) => {
      if (De._lock)
        return;
      rn(r);
      let h = Y.indexOf(w);
      if ((r.ctrlKey || r.metaKey) != me.isolate) {
        let g = Y.some((x, S) => S > 0 && S != h && x.show);
        Y.forEach((x, S) => {
          S > 0 && Ln(S, g ? S == h ? It : ft : It, !0, Nt.setSeries);
        });
      } else
        Ln(h, { show: !w.show }, !0, Nt.setSeries);
    }, !1), $i && At(Cr, te, (r) => {
      De._lock || (rn(r), Ln(Y.indexOf(w), Ni, !0, Nt.setSeries));
    }, !1));
    for (var a in Le) {
      let r = Jn("td", Ph, F);
      r.textContent = "--", N.push(r);
    }
    return [F, N];
  }
  const ut = /* @__PURE__ */ new Map();
  function At(w, T, N, F = !0) {
    const te = ut.get(T) || {}, o = De.bind[w](i, T, N, F);
    o && (vl(w, T, te[w] = o), ut.set(T, te));
  }
  function jn(w, T, N) {
    const F = ut.get(T) || {};
    for (let te in F)
      (w == null || te == w) && (Es(te, T, F[te]), delete F[te]);
    w == null && ut.delete(T);
  }
  let Wt = 0, ln = 0, Be = 0, ae = 0, Ie = 0, _e = 0, je = Ie, ct = _e, Ye = Be, qe = ae, et = 0, it = 0, lt = 0, St = 0;
  i.bbox = {};
  let qt = !1, Yt = !1, fn = !1, sn = !1, Kt = !1, zt = !1;
  function Xt(w, T, N) {
    (N || w != i.width || T != i.height) && mt(w, T), Oi(!1), fn = !0, Yt = !0, ai();
  }
  function mt(w, T) {
    i.width = Wt = Be = w, i.height = ln = ae = T, Ie = _e = 0, Qt(), Sn();
    let N = i.bbox;
    et = N.left = dl(Ie * gt, 0.5), it = N.top = dl(_e * gt, 0.5), lt = N.width = dl(Be * gt, 0.5), St = N.height = dl(ae * gt, 0.5);
  }
  const Ft = 3;
  function bt() {
    let w = !1, T = 0;
    for (; !w; ) {
      T++;
      let N = Ba(T), F = Ha(T);
      w = T == Ft || N && F, w || (mt(i.width, i.height), Yt = !0);
    }
  }
  function Pt({ width: w, height: T }) {
    Xt(w, T);
  }
  i.setSize = Pt;
  function Qt() {
    let w = !1, T = !1, N = !1, F = !1;
    A.forEach((te, o) => {
      if (te.show && te._show) {
        let { side: a, _size: r } = te, h = a % 2, g = te.label != null ? te.labelSize : 0, x = r + g;
        x > 0 && (h ? (Be -= x, a == 3 ? (Ie += x, F = !0) : N = !0) : (ae -= x, a == 0 ? (_e += x, w = !0) : T = !0));
      }
    }), cn[0] = w, cn[1] = N, cn[2] = T, cn[3] = F, Be -= oi[1] + oi[3], Ie += oi[3], ae -= oi[2] + oi[0], _e += oi[0];
  }
  function Sn() {
    let w = Ie + Be, T = _e + ae, N = Ie, F = _e;
    function te(o, a) {
      switch (o) {
        case 1:
          return w += a, w - a;
        case 2:
          return T += a, T - a;
        case 3:
          return N -= a, N + a;
        case 0:
          return F -= a, F + a;
      }
    }
    A.forEach((o, a) => {
      if (o.show && o._show) {
        let r = o.side;
        o._pos = te(r, o._size), o.label != null && (o._lpos = te(r, o.labelSize));
      }
    });
  }
  const De = i.cursor = Ut({}, zg, { drag: { y: l == 2 } }, e.cursor);
  if (De.dataIdx == null) {
    let w = De.hover, T = w.skip = new Set(w.skip ?? []);
    T.add(void 0);
    let N = w.prox = at(w.prox), F = w.bias ??= 0;
    De.dataIdx = (te, o, a, r) => {
      if (o == 0)
        return a;
      let h = a, g = N(te, o, a, r) ?? st, x = g >= 0 && g < st, S = O.ori == 0 ? Be : ae, _ = De.left, D = t[0], W = t[o];
      if (T.has(W[a])) {
        h = null;
        let L = null, X = null, ne;
        if (F == 0 || F == -1)
          for (ne = a; L == null && ne-- > 0; )
            T.has(W[ne]) || (L = ne);
        if (F == 0 || F == 1)
          for (ne = a; X == null && ne++ < W.length; )
            T.has(W[ne]) || (X = ne);
        if (L != null || X != null)
          if (x) {
            let de = L == null ? -1 / 0 : U(D[L], O, S, 0), he = X == null ? 1 / 0 : U(D[X], O, S, 0), pe = _ - de, we = he - _;
            pe <= we ? pe <= g && (h = L) : we <= g && (h = X);
          } else
            h = X == null ? L : L == null ? X : a - L <= X - a ? L : X;
      } else x && tn(_ - U(D[a], O, S, 0)) > g && (h = null);
      return h;
    };
  }
  const rn = (w) => {
    De.event = w;
  };
  De.idxs = le, De._lock = !1;
  let Rt = De.points;
  Rt.show = at(Rt.show), Rt.size = at(Rt.size), Rt.stroke = at(Rt.stroke), Rt.width = at(Rt.width), Rt.fill = at(Rt.fill);
  const hn = i.focus = Ut({}, e.focus || { alpha: 0.3 }, De.focus), $i = hn.prox >= 0, Ei = $i && Rt.one;
  let gn = [], un = [], yn = [];
  function Dn(w, T) {
    let N = Rt.show(i, T);
    if (N)
      return Mn(N, kh), Mn(N, w.class), di(N, -10, -10, Be, ae), M.insertBefore(N, gn[T]), N;
  }
  function Bo(w, T) {
    if (l == 1 || T > 0) {
      let N = l == 1 && H[w.scale].time, F = w.value;
      w.value = N ? Nr(F) ? Gr(ue, jr(F, ie)) : F || ge : F || qg, w.label = w.label || (N ? Pg : Tg);
    }
    if (Ei || T > 0) {
      w.width = w.width == null ? 1 : w.width, w.paths = w.paths || Qg || Fh, w.fillTo = at(w.fillTo || Bg), w.pxAlign = +dt(w.pxAlign, q), w.pxRound = tu(w.pxAlign), w.stroke = at(w.stroke || null), w.fill = at(w.fill || null), w._stroke = w._fill = w._paths = w._focus = null;
      let N = Rg(dn(1, w.width), 1), F = w.points = Ut({}, {
        size: N,
        width: dn(1, N * 0.2),
        stroke: w.stroke,
        space: N * 2,
        paths: Jg,
        _stroke: null,
        _fill: null
      }, w.points);
      F.show = at(F.show), F.filter = at(F.filter), F.fill = at(F.fill), F.stroke = at(F.stroke), F.paths = at(F.paths), F.pxAlign = w.pxAlign;
    }
    if (Oe) {
      let N = Tt(w, T);
      Te.splice(T, 0, N[0]), be.splice(T, 0, N[1]), me.values.push(null);
    }
    if (De.show) {
      le.splice(T, 0, null);
      let N = null;
      Ei ? T == 0 && (N = Dn(w, T)) : T > 0 && (N = Dn(w, T)), gn.splice(T, 0, N), un.splice(T, 0, 0), yn.splice(T, 0, 0);
    }
    Dt("addSeries", T);
  }
  function Va(w, T) {
    T = T ?? Y.length, w = l == 1 ? qs(w, T, Ur, Zr) : qs(w, T, {}, Jr), Y.splice(T, 0, w), Bo(Y[T], T);
  }
  i.addSeries = Va;
  function Ho(w) {
    if (Y.splice(w, 1), Oe) {
      me.values.splice(w, 1), be.splice(w, 1);
      let T = Te.splice(w, 1)[0];
      jn(null, T.firstChild), T.remove();
    }
    De.show && (le.splice(w, 1), gn.splice(w, 1)[0].remove(), un.splice(w, 1), yn.splice(w, 1)), Dt("delSeries", w);
  }
  i.delSeries = Ho;
  const cn = [!1, !1, !1, !1];
  function Ue(w, T) {
    if (w._show = w.show, w.show) {
      let N = w.side % 2, F = H[w.scale];
      F == null && (w.scale = N ? Y[1].scale : z, F = H[w.scale]);
      let te = F.time;
      w.size = at(w.size), w.space = at(w.space), w.rotate = at(w.rotate), ji(w.incrs) && w.incrs.forEach((a) => {
        !Ki.has(a) && Ki.set(a, Tc(a));
      }), w.incrs = at(w.incrs || (F.distr == 2 ? ug : te ? V == 1 ? dg : gg : fl)), w.splits = at(w.splits || (te && F.distr == 1 ? Ee : F.distr == 3 ? As : F.distr == 4 ? Ig : Eg)), w.stroke = at(w.stroke), w.grid.stroke = at(w.grid.stroke), w.ticks.stroke = at(w.ticks.stroke), w.border.stroke = at(w.border.stroke);
      let o = w.values;
      w.values = // static array of tick values
      ji(o) && !ji(o[0]) ? at(o) : (
        // temporal
        te ? (
          // config array of fmtDate string tpls
          ji(o) ? Wr(ue, Hr(o, ie)) : (
            // fmtDate string tpl
            Nr(o) ? mg(ue, o) : o || ve
          )
        ) : o || $g
      ), w.filter = at(w.filter || (F.distr >= 3 && F.log == 10 ? Dg : F.distr == 3 && F.log == 2 ? Lg : Mc)), w.font = ou(w.font), w.labelFont = ou(w.labelFont), w._size = w.size(i, null, T, 0), w._space = w._rotate = w._incrs = w._found = // foundIncrSpace
      w._splits = w._values = null, w._size > 0 && (cn[T] = !0, w._el = Fn(bh, C));
    }
  }
  function Ii(w, T, N, F) {
    let [te, o, a, r] = N, h = T % 2, g = 0;
    return h == 0 && (r || o) && (g = T == 0 && !te || T == 2 && !a ? en(Yr.size / 3) : 0), h == 1 && (te || a) && (g = T == 1 && !o || T == 3 && !r ? en(Xr.size / 2) : 0), g;
  }
  const so = i.padding = (e.padding || [Ii, Ii, Ii, Ii]).map((w) => at(dt(w, Ii))), oi = i._padding = so.map((w, T) => w(i, T, cn, 0));
  let Jt, Ot = null, Bt = null;
  const _l = l == 1 ? Y[0].idxs : null;
  let kn = null, Ji = !1;
  function ro(w, T) {
    if (t = w ?? [], i.data = i._data = t, l == 2) {
      Jt = 0;
      for (let N = 1; N < Y.length; N++)
        Jt += t[N][0].length;
    } else {
      t.length == 0 && (i.data = i._data = t = [[]]), kn = t[0], Jt = kn.length;
      let N = t;
      if (Z == 2) {
        N = t.slice();
        let F = N[0] = Array(Jt);
        for (let te = 0; te < Jt; te++)
          F[te] = te;
      }
      i._data = t = N;
    }
    if (Oi(!0), Dt("setData"), Z == 2 && (fn = !0), T !== !1) {
      let N = O;
      N.auto(i, Ji) ? uo() : an(z, N.min, N.max), sn = sn || De.left >= 0, zt = !0, ai();
    }
  }
  i.setData = ro;
  function uo() {
    Ji = !0;
    let w, T;
    l == 1 && (Jt > 0 ? (Ot = _l[0] = 0, Bt = _l[1] = Jt - 1, w = t[0][Ot], T = t[0][Bt], Z == 2 ? (w = Ot, T = Bt) : w == T && (Z == 3 ? [w, T] = Aa(w, w, O.log, !1) : Z == 4 ? [w, T] = Gs(w, w, O.log, !1) : O.time ? T = w + en(86400 / V) : [w, T] = za(w, T, Ys, !0))) : (Ot = _l[0] = w = null, Bt = _l[1] = T = null)), an(z, w, T);
  }
  let Zi, gi, Ai, Ml, el, zl, co, tl, fo, Cn;
  function Wo(w, T, N, F, te, o) {
    w ??= wr, N ??= Ks, F ??= "butt", te ??= wr, o ??= "round", w != Zi && (v.strokeStyle = Zi = w), te != gi && (v.fillStyle = gi = te), T != Ai && (v.lineWidth = Ai = T), o != el && (v.lineJoin = el = o), F != zl && (v.lineCap = zl = F), N != Ml && v.setLineDash(Ml = N);
  }
  function jo(w, T, N, F) {
    T != gi && (v.fillStyle = gi = T), w != co && (v.font = co = w), N != tl && (v.textAlign = tl = N), F != fo && (v.textBaseline = fo = F);
  }
  function ho(w, T, N, F, te = 0) {
    if (F.length > 0 && w.auto(i, Ji) && (T == null || T.min == null)) {
      let o = dt(Ot, 0), a = dt(Bt, F.length - 1), r = N.min == null ? w.distr == 3 ? Dh(F, o, a) : Oh(F, o, a, te) : [N.min, N.max];
      w.min = Wn(w.min, N.min = r[0]), w.max = dn(w.max, N.max = r[1]);
    }
  }
  const Go = { min: null, max: null };
  function Fa() {
    for (let F in H) {
      let te = H[F];
      G[F] == null && // scales that have never been set (on init)
      (te.min == null || // or auto scales when the x scale was explicitly set
      G[z] != null && te.auto(i, Ji)) && (G[F] = Go);
    }
    for (let F in H) {
      let te = H[F];
      G[F] == null && te.from != null && G[te.from] != null && (G[F] = Go);
    }
    G[z] != null && Oi(!0);
    let w = {};
    for (let F in G) {
      let te = G[F];
      if (te != null) {
        let o = w[F] = Zl(H[F], Wh);
        if (te.min != null)
          Ut(o, te);
        else if (F != z || l == 2)
          if (Jt == 0 && o.from == null) {
            let a = o.range(i, null, null, F);
            o.min = a[0], o.max = a[1];
          } else
            o.min = st, o.max = -st;
      }
    }
    if (Jt > 0) {
      Y.forEach((F, te) => {
        if (l == 1) {
          let o = F.scale, a = G[o];
          if (a == null)
            return;
          let r = w[o];
          if (te == 0) {
            let h = r.range(i, r.min, r.max, o);
            r.min = h[0], r.max = h[1], Ot = ti(r.min, t[0]), Bt = ti(r.max, t[0]), Bt - Ot > 1 && (t[0][Ot] < r.min && Ot++, t[0][Bt] > r.max && Bt--), F.min = kn[Ot], F.max = kn[Bt];
          } else F.show && F.auto && ho(r, a, F, t[te], F.sorted);
          F.idxs[0] = Ot, F.idxs[1] = Bt;
        } else if (te > 0 && F.show && F.auto) {
          let [o, a] = F.facets, r = o.scale, h = a.scale, [g, x] = t[te], S = w[r], _ = w[h];
          S != null && ho(S, G[r], o, g, o.sorted), _ != null && ho(_, G[h], a, x, a.sorted), F.min = a.min, F.max = a.max;
        }
      });
      for (let F in w) {
        let te = w[F], o = G[F];
        if (te.from == null && (o == null || o.min == null)) {
          let a = te.range(
            i,
            te.min == st ? null : te.min,
            te.max == -st ? null : te.max,
            F
          );
          te.min = a[0], te.max = a[1];
        }
      }
    }
    for (let F in w) {
      let te = w[F];
      if (te.from != null) {
        let o = w[te.from];
        if (o.min == null)
          te.min = te.max = null;
        else {
          let a = te.range(i, o.min, o.max, F);
          te.min = a[0], te.max = a[1];
        }
      }
    }
    let T = {}, N = !1;
    for (let F in w) {
      let te = w[F], o = H[F];
      if (o.min != te.min || o.max != te.max) {
        o.min = te.min, o.max = te.max;
        let a = o.distr;
        o._min = a == 3 ? Mi(o.min) : a == 4 ? rs(o.min, o.asinh) : a == 100 ? o.fwd(o.min) : o.min, o._max = a == 3 ? Mi(o.max) : a == 4 ? rs(o.max, o.asinh) : a == 100 ? o.fwd(o.max) : o.max, T[F] = N = !0;
      }
    }
    if (N) {
      Y.forEach((F, te) => {
        l == 2 ? te > 0 && T.y && (F._paths = null) : T[F.scale] && (F._paths = null);
      });
      for (let F in T)
        fn = !0, Dt("setScale", F);
      De.show && De.left >= 0 && (sn = zt = !0);
    }
    for (let F in G)
      G[F] = null;
  }
  function Yo(w) {
    let T = Is(Ot - 1, 0, Jt - 1), N = Is(Bt + 1, 0, Jt - 1);
    for (; w[T] == null && T > 0; )
      T--;
    for (; w[N] == null && N < Jt - 1; )
      N++;
    return [T, N];
  }
  function Tl() {
    Jt > 0 && (Y.forEach((w, T) => {
      if (T > 0 && w.show && (pi(T, !1), pi(T, !0), w._paths == null)) {
        Cn != w.alpha && (v.globalAlpha = Cn = w.alpha);
        let N = l == 2 ? [0, t[T][0].length - 1] : Yo(t[T]);
        w._paths = w.paths(i, T, N[0], N[1]), Cn != 1 && (v.globalAlpha = Cn = 1);
      }
    }), Y.forEach((w, T) => {
      if (T > 0 && w.show) {
        Cn != w.alpha && (v.globalAlpha = Cn = w.alpha), w._paths != null && Pl(T, !1);
        {
          let N = w._paths != null ? w._paths.gaps : null, F = w.points.show(i, T, Ot, Bt, N), te = w.points.filter(i, T, F, N);
          (F || te) && (w.points._paths = w.points.paths(i, T, Ot, Bt, te), Pl(T, !0));
        }
        Cn != 1 && (v.globalAlpha = Cn = 1), Dt("drawSeries", T);
      }
    }));
  }
  function pi(w, T) {
    let N = T ? Y[w].points : Y[w];
    N._stroke = N.stroke(i, w), N._fill = N.fill(i, w);
  }
  function Pl(w, T) {
    let N = T ? Y[w].points : Y[w], {
      stroke: F,
      fill: te,
      clip: o,
      flags: a,
      _stroke: r = N._stroke,
      _fill: h = N._fill,
      _width: g = N.width
    } = N._paths;
    g = Mt(g * gt, 3);
    let x = null, S = g % 2 / 2;
    T && h == null && (h = g > 0 ? "#fff" : r);
    let _ = N.pxAlign == 1 && S > 0;
    if (_ && v.translate(S, S), !T) {
      let D = et - g / 2, W = it - g / 2, L = lt + g, X = St + g;
      x = new Path2D(), x.rect(D, W, L, X);
    }
    T ? vi(r, g, N.dash, N.cap, h, F, te, a, o) : $l(w, r, g, N.dash, N.cap, h, F, te, a, x, o), _ && v.translate(-S, -S);
  }
  function $l(w, T, N, F, te, o, a, r, h, g, x) {
    let S = !1;
    h != 0 && ee.forEach((_, D) => {
      if (_.series[0] == w) {
        let W = Y[_.series[1]], L = t[_.series[1]], X = (W._paths || Ao).band;
        ji(X) && (X = _.dir == 1 ? X[0] : X[1]);
        let ne, de = null;
        W.show && X && qh(L, Ot, Bt) ? (de = _.fill(i, D) || o, ne = W._paths.clip) : X = null, vi(T, N, F, te, de, a, r, h, g, x, ne, X), S = !0;
      }
    }), S || vi(T, N, F, te, o, a, r, h, g, x);
  }
  const Gn = eo | Ds;
  function vi(w, T, N, F, te, o, a, r, h, g, x, S) {
    Wo(w, T, N, F, te), (h || g || S) && (v.save(), h && v.clip(h), g && v.clip(g)), S ? (r & Gn) == Gn ? (v.clip(S), x && v.clip(x), nl(te, a), El(w, o, T)) : r & Ds ? (nl(te, a), v.clip(S), El(w, o, T)) : r & eo && (v.save(), v.clip(S), x && v.clip(x), nl(te, a), v.restore(), El(w, o, T)) : (nl(te, a), El(w, o, T)), (h || g || S) && v.restore();
  }
  function El(w, T, N) {
    N > 0 && (T instanceof Map ? T.forEach((F, te) => {
      v.strokeStyle = Zi = te, v.stroke(F);
    }) : T != null && w && v.stroke(T));
  }
  function nl(w, T) {
    T instanceof Map ? T.forEach((N, F) => {
      v.fillStyle = gi = F, v.fill(N);
    }) : T != null && w && v.fill(T);
  }
  function Uo(w, T, N, F) {
    let te = A[w], o;
    if (F <= 0)
      o = [0, 0];
    else {
      let a = te._space = te.space(i, w, T, N, F), r = te._incrs = te.incrs(i, w, T, N, F, a);
      o = lp(T, N, r, F, a);
    }
    return te._found = o;
  }
  function il(w, T, N, F, te, o, a, r, h, g) {
    let x = a % 2 / 2;
    q == 1 && v.translate(x, x), Wo(r, a, h, g, r), v.beginPath();
    let S, _, D, W, L = te + (F == 0 || F == 3 ? -o : o);
    N == 0 ? (_ = te, W = L) : (S = te, D = L);
    for (let X = 0; X < w.length; X++)
      T[X] != null && (N == 0 ? S = D = w[X] : _ = W = w[X], v.moveTo(S, _), v.lineTo(D, W));
    v.stroke(), q == 1 && v.translate(-x, -x);
  }
  function Ba(w) {
    let T = !0;
    return A.forEach((N, F) => {
      if (!N.show)
        return;
      let te = H[N.scale];
      if (te.min == null) {
        N._show && (T = !1, N._show = !1, Oi(!1));
        return;
      } else
        N._show || (T = !1, N._show = !0, Oi(!1));
      let o = N.side, a = o % 2, { min: r, max: h } = te, [g, x] = Uo(F, r, h, a == 0 ? Be : ae);
      if (x == 0)
        return;
      let S = te.distr == 2, _ = N._splits = N.splits(i, F, r, h, g, x, S), D = te.distr == 2 ? _.map((ne) => kn[ne]) : _, W = te.distr == 2 ? kn[_[1]] - kn[_[0]] : g, L = N._values = N.values(i, N.filter(i, D, F, x, W), F, x, W);
      N._rotate = o == 2 ? N.rotate(i, L, F, x) : 0;
      let X = N._size;
      N._size = Hn(N.size(i, L, F, w)), X != null && N._size != X && (T = !1);
    }), T;
  }
  function Ha(w) {
    let T = !0;
    return so.forEach((N, F) => {
      let te = N(i, F, cn, w);
      te != oi[F] && (T = !1), oi[F] = te;
    }), T;
  }
  function Ko() {
    for (let w = 0; w < A.length; w++) {
      let T = A[w];
      if (!T.show || !T._show)
        continue;
      let N = T.side, F = N % 2, te, o, a = T.stroke(i, w), r = N == 0 || N == 3 ? -1 : 1;
      if (T.label) {
        let Ct = T.labelGap * r, Vt = en((T._lpos + Ct) * gt);
        jo(T.labelFont[0], a, "center", N == 2 ? So : xr), v.save(), F == 1 ? (te = o = 0, v.translate(
          Vt,
          en(it + St / 2)
        ), v.rotate((N == 3 ? -xa : xa) / 2)) : (te = en(et + lt / 2), o = Vt), v.fillText(T.label, te, o), v.restore();
      }
      let [h, g] = T._found;
      if (g == 0)
        continue;
      let x = H[T.scale], S = F == 0 ? lt : St, _ = F == 0 ? et : it, D = en(T.gap * gt), W = T._splits, L = x.distr == 2 ? W.map((Ct) => kn[Ct]) : W, X = x.distr == 2 ? kn[W[1]] - kn[W[0]] : h, ne = T.ticks, de = T.border, he = ne.show ? en(ne.size * gt) : 0, pe = T._rotate * -xa / 180, we = Q(T._pos * gt), Se = (he + D) * r, Pe = we + Se;
      o = F == 0 ? Pe : 0, te = F == 1 ? Pe : 0;
      let Ve = T.font[0], Ke = T.align == 1 ? Nl : T.align == 2 ? as : pe > 0 ? Nl : pe < 0 ? as : F == 0 ? "center" : N == 3 ? as : Nl, Re = pe || F == 1 ? "middle" : N == 2 ? So : xr;
      jo(Ve, a, Ke, Re);
      let We = T.font[1] * T.lineGap, ht = W.map((Ct) => Q(u(Ct, x, S, _))), rt = T._values;
      for (let Ct = 0; Ct < rt.length; Ct++) {
        let Vt = rt[Ct];
        if (Vt != null) {
          F == 0 ? te = ht[Ct] : o = ht[Ct], Vt = "" + Vt;
          let Xn = Vt.indexOf(`
`) == -1 ? [Vt] : Vt.split(/\n/gm);
          for (let bn = 0; bn < Xn.length; bn++) {
            let Rn = Xn[bn];
            pe ? (v.save(), v.translate(te, o + bn * We), v.rotate(pe), v.fillText(Rn, 0, 0), v.restore()) : v.fillText(Rn, te, o + bn * We);
          }
        }
      }
      ne.show && il(
        ht,
        ne.filter(i, L, w, g, X),
        F,
        N,
        we,
        he,
        Mt(ne.width * gt, 3),
        ne.stroke(i, w),
        ne.dash,
        ne.cap
      );
      let yt = T.grid;
      yt.show && il(
        ht,
        yt.filter(i, L, w, g, X),
        F,
        F == 0 ? 2 : 1,
        F == 0 ? it : et,
        F == 0 ? St : lt,
        Mt(yt.width * gt, 3),
        yt.stroke(i, w),
        yt.dash,
        yt.cap
      ), de.show && il(
        [we],
        [1],
        F == 0 ? 1 : 0,
        F == 0 ? 1 : 2,
        F == 1 ? it : et,
        F == 1 ? St : lt,
        Mt(de.width * gt, 3),
        de.stroke(i, w),
        de.dash,
        de.cap
      );
    }
    Dt("drawAxes");
  }
  function Oi(w) {
    Y.forEach((T, N) => {
      N > 0 && (T._paths = null, w && (l == 1 ? (T.min = null, T.max = null) : T.facets.forEach((F) => {
        F.min = null, F.max = null;
      })));
    });
  }
  let Il = !1, Al = !1, Di = [];
  function Wa() {
    Al = !1;
    for (let w = 0; w < Di.length; w++)
      Dt(...Di[w]);
    Di.length = 0;
  }
  function ai() {
    Il || (Qh(go), Il = !0);
  }
  function ja(w, T = !1) {
    Il = !0, Al = T, w(i), go(), T && Di.length > 0 && queueMicrotask(Wa);
  }
  i.batch = ja;
  function go() {
    if (qt && (Fa(), qt = !1), fn && (bt(), fn = !1), Yt) {
      if (Et(P, Nl, Ie), Et(P, So, _e), Et(P, zo, Be), Et(P, To, ae), Et(M, Nl, Ie), Et(M, So, _e), Et(M, zo, Be), Et(M, To, ae), Et(C, zo, Wt), Et(C, To, ln), b.width = en(Wt * gt), b.height = en(ln * gt), A.forEach(({ _el: w, _show: T, _size: N, _pos: F, side: te }) => {
        if (w != null)
          if (T) {
            let o = te === 3 || te === 0 ? N : 0, a = te % 2 == 1;
            Et(w, a ? "left" : "top", F - o), Et(w, a ? "width" : "height", N), Et(w, a ? "top" : "left", a ? _e : Ie), Et(w, a ? "height" : "width", a ? ae : Be), $s(w, gl);
          } else
            Mn(w, gl);
      }), Zi = gi = Ai = el = zl = co = tl = fo = Ml = null, Cn = 1, Bi(!0), Ie != je || _e != ct || Be != Ye || ae != qe) {
        Oi(!1);
        let w = Be / Ye, T = ae / qe;
        if (De.show && !sn && De.left >= 0) {
          De.left *= w, De.top *= T, mi && di(mi, en(De.left), 0, Be, ae), yi && di(yi, 0, en(De.top), Be, ae);
          for (let N = 0; N < gn.length; N++) {
            let F = gn[N];
            F != null && (un[N] *= w, yn[N] *= T, di(F, Hn(un[N]), Hn(yn[N]), Be, ae));
          }
        }
        if (wt.show && !Kt && wt.left >= 0 && wt.width > 0) {
          wt.left *= w, wt.width *= w, wt.top *= T, wt.height *= T;
          for (let N in bo)
            Et(si, N, wt[N]);
        }
        je = Ie, ct = _e, Ye = Be, qe = ae;
      }
      Dt("setSize"), Yt = !1;
    }
    Wt > 0 && ln > 0 && (v.clearRect(0, 0, b.width, b.height), Dt("drawClear"), J.forEach((w) => w()), Dt("draw")), wt.show && Kt && (Ol(wt), Kt = !1), De.show && sn && (ci(null, !0, !1), sn = !1), me.show && me.live && zt && (Fi(), zt = !1), p || (p = !0, i.status = 1, Dt("ready")), Ji = !1, Il = !1;
  }
  i.redraw = (w, T) => {
    fn = T || !1, w !== !1 ? an(z, O.min, O.max) : ai();
  };
  function po(w, T) {
    let N = H[w];
    if (N.from == null) {
      if (Jt == 0) {
        let F = N.range(i, T.min, T.max, w);
        T.min = F[0], T.max = F[1];
      }
      if (T.min > T.max) {
        let F = T.min;
        T.min = T.max, T.max = F;
      }
      if (Jt > 1 && T.min != null && T.max != null && T.max - T.min < 1e-16)
        return;
      w == z && N.distr == 2 && Jt > 0 && (T.min = ti(T.min, t[0]), T.max = ti(T.max, t[0]), T.min == T.max && T.max++), G[w] = T, qt = !0, ai();
    }
  }
  i.setScale = po;
  let Li, vo, mi, yi, Xo, mo, bi, qi, Ri, ll, kt, xt, Yn = !1;
  const Zt = De.drag;
  let Ht = Zt.x, jt = Zt.y;
  De.show && (De.x && (Li = Fn(wh, M)), De.y && (vo = Fn(Sh, M)), O.ori == 0 ? (mi = Li, yi = vo) : (mi = vo, yi = Li), kt = De.left, xt = De.top);
  const wt = i.select = Ut({
    show: !0,
    over: !0,
    left: 0,
    width: 0,
    top: 0,
    height: 0
  }, e.select), si = wt.show ? Fn(xh, wt.over ? M : P) : null;
  function Ol(w, T) {
    if (wt.show) {
      for (let N in w)
        wt[N] = w[N], N in bo && Et(si, N, w[N]);
      T !== !1 && Dt("setSelect");
    }
  }
  i.setSelect = Ol;
  function Ga(w, T) {
    let N = Y[w], F = Oe ? Te[w] : null;
    if (N.show)
      F && $s(F, gl);
    else {
      F && Mn(F, gl);
      let te = Ei ? gn[0] : gn[w];
      di(te, -10, -10, Be, ae);
    }
  }
  function an(w, T, N) {
    po(w, { min: T, max: N });
  }
  function Ln(w, T, N, F) {
    T.focus != null && Ka(w), T.show != null && Y.forEach((te, o) => {
      o > 0 && (w == o || w == null) && (te.show = T.show, Ga(o, T.show), l == 2 ? (an(te.facets[0].scale, null, null), an(te.facets[1].scale, null, null)) : an(te.scale, null, null), ai());
    }), N !== !1 && Dt("setSeries", w, T), F && sl("setSeries", i, w, T);
  }
  i.setSeries = Ln;
  function Ya(w, T) {
    Ut(ee[w], T);
  }
  function Ua(w, T) {
    w.fill = at(w.fill || null), w.dir = dt(w.dir, -1), T = T ?? ee.length, ee.splice(T, 0, w);
  }
  function Qo(w) {
    w == null ? ee.length = 0 : ee.splice(w, 1);
  }
  i.addBand = Ua, i.setBand = Ya, i.delBand = Qo;
  function Jo(w, T) {
    Y[w].alpha = T, De.show && gn[w] && (gn[w].style.opacity = T), Oe && Te[w] && (Te[w].style.opacity = T);
  }
  let $t, ri, xi;
  const Ni = { focus: !0 };
  function Ka(w) {
    if (w != xi) {
      let T = w == null, N = hn.alpha != 1;
      Y.forEach((F, te) => {
        if (l == 1 || te > 0) {
          let o = T || te == 0 || te == w;
          F._focus = T ? null : o, N && Jo(te, o ? 1 : hn.alpha);
        }
      }), xi = w, N && ai();
    }
  }
  Oe && $i && At(_r, ke, (w) => {
    De._lock || (rn(w), xi != null && Ln(null, Ni, !0, Nt.setSeries));
  });
  function qn(w, T, N) {
    let F = H[T];
    N && (w = w / gt - (F.ori == 1 ? _e : Ie));
    let te = Be;
    F.ori == 1 && (te = ae, w = te - w), F.dir == -1 && (w = te - w);
    let o = F._min, a = F._max, r = w / te, h = o + (a - o) * r, g = F.distr;
    return g == 3 ? Ql(10, h) : g == 4 ? Nh(h, F.asinh) : g == 100 ? F.bwd(h) : h;
  }
  function Xa(w, T) {
    let N = qn(w, z, T);
    return ti(N, t[0], Ot, Bt);
  }
  i.valToIdx = (w) => ti(w, t[0]), i.posToIdx = Xa, i.posToVal = qn, i.valToPos = (w, T, N) => H[T].ori == 0 ? d(
    w,
    H[T],
    N ? lt : Be,
    N ? et : 0
  ) : c(
    w,
    H[T],
    N ? St : ae,
    N ? it : 0
  ), i.setCursor = (w, T, N) => {
    kt = w.left, xt = w.top, ci(null, T, N);
  };
  function Zo(w, T) {
    Et(si, Nl, wt.left = w), Et(si, zo, wt.width = T);
  }
  function ea(w, T) {
    Et(si, So, wt.top = w), Et(si, To, wt.height = T);
  }
  let Vi = O.ori == 0 ? Zo : ea, ui = O.ori == 1 ? Zo : ea;
  function wi() {
    if (Oe && me.live)
      for (let w = l == 2 ? 1 : 0; w < Y.length; w++) {
        if (w == 0 && Je)
          continue;
        let T = me.values[w], N = 0;
        for (let F in T)
          be[w][N++].firstChild.nodeValue = T[F];
      }
  }
  function Fi(w, T) {
    if (w != null && (w.idxs ? w.idxs.forEach((N, F) => {
      le[F] = N;
    }) : Hh(w.idx) || le.fill(w.idx), me.idx = le[0]), Oe && me.live) {
      for (let N = 0; N < Y.length; N++)
        (N > 0 || l == 1 && !Je) && Qa(N, le[N]);
      wi();
    }
    zt = !1, T !== !1 && Dt("setLegend");
  }
  i.setLegend = Fi;
  function Qa(w, T) {
    let N = Y[w], F = w == 0 && Z == 2 ? kn : t[w], te;
    Je ? te = N.values(i, w, T) ?? Ge : (te = N.value(i, T == null ? null : F[T], w, T), te = te == null ? Ge : { _: te }), me.values[w] = te;
  }
  function ci(w, T, N) {
    Ri = kt, ll = xt, [kt, xt] = De.move(i, kt, xt), De.left = kt, De.top = xt, De.show && (mi && di(mi, en(kt), 0, Be, ae), yi && di(yi, 0, en(xt), Be, ae));
    let F, te = Ot > Bt;
    $t = st, ri = null;
    let o = O.ori == 0 ? Be : ae, a = O.ori == 1 ? Be : ae;
    if (kt < 0 || Jt == 0 || te) {
      F = De.idx = null;
      for (let r = 0; r < Y.length; r++) {
        let h = gn[r];
        h != null && di(h, -10, -10, Be, ae);
      }
      $i && Ln(null, Ni, !0, w == null && Nt.setSeries), me.live && (le.fill(F), zt = !0);
    } else {
      let r, h, g;
      l == 1 && (r = O.ori == 0 ? kt : xt, h = qn(r, z), F = De.idx = ti(h, t[0], Ot, Bt), g = U(t[0][F], O, o, 0));
      let x = -10, S = -10, _ = 0, D = 0, W = !0, L = "", X = "";
      for (let ne = l == 2 ? 1 : 0; ne < Y.length; ne++) {
        let de = Y[ne], he = le[ne], pe = he == null ? null : l == 1 ? t[ne][he] : t[ne][1][he], we = De.dataIdx(i, ne, F, h), Se = we == null ? null : l == 1 ? t[ne][we] : t[ne][1][we];
        zt = zt || Se != pe || we != he, le[ne] = we;
        let Pe = we == F ? g : U(l == 1 ? t[0][we] : t[ne][0][we], O, o, 0);
        if (ne > 0 && de.show) {
          let Ve = Se == null ? -10 : $(Se, l == 1 ? H[de.scale] : H[de.facets[1].scale], a, 0);
          if ($i && Se != null) {
            let Ke = O.ori == 1 ? kt : xt, Re = tn(hn.dist(i, ne, we, Ve, Ke));
            if (Re < $t) {
              let We = hn.bias;
              if (We != 0) {
                let ht = qn(Ke, de.scale), rt = Se >= 0 ? 1 : -1, yt = ht >= 0 ? 1 : -1;
                yt == rt && (yt == 1 ? We == 1 ? Se >= ht : Se <= ht : (
                  // >= 0
                  We == 1 ? Se <= ht : Se >= ht
                )) && ($t = Re, ri = ne);
              } else
                $t = Re, ri = ne;
            }
          }
          if (zt || Ei) {
            let Ke, Re;
            O.ori == 0 ? (Ke = Pe, Re = Ve) : (Ke = Ve, Re = Pe);
            let We, ht, rt, yt, Ct, Vt, Xn = !0, bn = Rt.bbox;
            if (bn != null) {
              Xn = !1;
              let Rn = bn(i, ne);
              rt = Rn.left, yt = Rn.top, We = Rn.width, ht = Rn.height;
            } else
              rt = Ke, yt = Re, We = ht = Rt.size(i, ne);
            if (Vt = Rt.fill(i, ne), Ct = Rt.stroke(i, ne), Ei)
              ne == ri && $t <= hn.prox && (x = rt, S = yt, _ = We, D = ht, W = Xn, L = Vt, X = Ct);
            else {
              let Rn = gn[ne];
              Rn != null && (un[ne] = rt, yn[ne] = yt, Ir(Rn, We, ht, Xn), $r(Rn, Vt, Ct), di(Rn, Hn(rt), Hn(yt), Be, ae));
            }
          }
        }
      }
      if (Ei) {
        let ne = hn.prox, de = xi == null ? $t <= ne : $t > ne || ri != xi;
        if (zt || de) {
          let he = gn[0];
          un[0] = x, yn[0] = S, Ir(he, _, D, W), $r(he, L, X), di(he, Hn(x), Hn(S), Be, ae);
        }
      }
    }
    if (wt.show && Yn)
      if (w != null) {
        let [r, h] = Nt.scales, [g, x] = Nt.match, [S, _] = w.cursor.sync.scales, D = w.cursor.drag;
        if (Ht = D._x, jt = D._y, Ht || jt) {
          let { left: W, top: L, width: X, height: ne } = w.select, de = w.scales[S].ori, he = w.posToVal, pe, we, Se, Pe, Ve, Ke = r != null && g(r, S), Re = h != null && x(h, _);
          Ke && Ht ? (de == 0 ? (pe = W, we = X) : (pe = L, we = ne), Se = H[r], Pe = U(he(pe, S), Se, o, 0), Ve = U(he(pe + we, S), Se, o, 0), Vi(Wn(Pe, Ve), tn(Ve - Pe))) : Vi(0, o), Re && jt ? (de == 1 ? (pe = W, we = X) : (pe = L, we = ne), Se = H[h], Pe = $(he(pe, _), Se, a, 0), Ve = $(he(pe + we, _), Se, a, 0), ui(Wn(Pe, Ve), tn(Ve - Pe))) : ui(0, a);
        } else
          Dl();
      } else {
        let r = tn(Ri - Xo), h = tn(ll - mo);
        if (O.ori == 1) {
          let _ = r;
          r = h, h = _;
        }
        Ht = Zt.x && r >= Zt.dist, jt = Zt.y && h >= Zt.dist;
        let g = Zt.uni;
        g != null ? Ht && jt && (Ht = r >= g, jt = h >= g, !Ht && !jt && (h > r ? jt = !0 : Ht = !0)) : Zt.x && Zt.y && (Ht || jt) && (Ht = jt = !0);
        let x, S;
        Ht && (O.ori == 0 ? (x = bi, S = kt) : (x = qi, S = xt), Vi(Wn(x, S), tn(S - x)), jt || ui(0, a)), jt && (O.ori == 1 ? (x = bi, S = kt) : (x = qi, S = xt), ui(Wn(x, S), tn(S - x)), Ht || Vi(0, o)), !Ht && !jt && (Vi(0, 0), ui(0, 0));
      }
    if (Zt._x = Ht, Zt._y = jt, w == null) {
      if (N) {
        if (Rl != null) {
          let [r, h] = Nt.scales;
          Nt.values[0] = r != null ? qn(O.ori == 0 ? kt : xt, r) : null, Nt.values[1] = h != null ? qn(O.ori == 1 ? kt : xt, h) : null;
        }
        sl(Sr, i, kt, xt, Be, ae, F);
      }
      if ($i) {
        let r = N && Nt.setSeries, h = hn.prox;
        xi == null ? $t <= h && Ln(ri, Ni, !0, r) : $t > h ? Ln(null, Ni, !0, r) : ri != xi && Ln(ri, Ni, !0, r);
      }
    }
    zt && (me.idx = F, Fi()), T !== !1 && Dt("setCursor");
  }
  let Un = null;
  Object.defineProperty(i, "rect", {
    get() {
      return Un == null && Bi(!1), Un;
    }
  });
  function Bi(w = !1) {
    w ? Un = null : (Un = M.getBoundingClientRect(), Dt("syncRect", Un));
  }
  function Hi(w, T, N, F, te, o, a) {
    De._lock || Yn && w != null && w.movementX == 0 && w.movementY == 0 || (yo(w, T, N, F, te, o, a, !1, w != null), w != null ? ci(null, !0, !0) : ci(T, !0, !1));
  }
  function yo(w, T, N, F, te, o, a, r, h) {
    if (Un == null && Bi(!1), rn(w), w != null)
      N = w.clientX - Un.left, F = w.clientY - Un.top;
    else {
      if (N < 0 || F < 0) {
        kt = -10, xt = -10;
        return;
      }
      let [g, x] = Nt.scales, S = T.cursor.sync, [_, D] = S.values, [W, L] = S.scales, [X, ne] = Nt.match, de = T.axes[0].side % 2 == 1, he = O.ori == 0 ? Be : ae, pe = O.ori == 1 ? Be : ae, we = de ? o : te, Se = de ? te : o, Pe = de ? F : N, Ve = de ? N : F;
      if (W != null ? N = X(g, W) ? u(_, H[g], he, 0) : -10 : N = he * (Pe / we), L != null ? F = ne(x, L) ? u(D, H[x], pe, 0) : -10 : F = pe * (Ve / Se), O.ori == 1) {
        let Ke = N;
        N = F, F = Ke;
      }
    }
    h && ((N <= 1 || N >= Be - 1) && (N = dl(N, Be)), (F <= 1 || F >= ae - 1) && (F = dl(F, ae))), r ? (Xo = N, mo = F, [bi, qi] = De.move(i, N, F)) : (kt = N, xt = F);
  }
  const bo = {
    width: 0,
    height: 0,
    left: 0,
    top: 0
  };
  function Dl() {
    Ol(bo, !1);
  }
  let ta, na, ia, Ll;
  function la(w, T, N, F, te, o, a) {
    Yn = !0, Ht = jt = Zt._x = Zt._y = !1, yo(w, T, N, F, te, o, a, !0, !1), w != null && (At(ss, Ts, ol, !1), sl(kr, i, bi, qi, Be, ae, null));
    let { left: r, top: h, width: g, height: x } = wt;
    ta = r, na = h, ia = g, Ll = x, Dl();
  }
  function ol(w, T, N, F, te, o, a) {
    Yn = Zt._x = Zt._y = !1, yo(w, T, N, F, te, o, a, !1, !0);
    let { left: r, top: h, width: g, height: x } = wt, S = g > 0 || x > 0, _ = ta != r || na != h || ia != g || Ll != x;
    if (S && _ && Ol(wt), Zt.setScale && S && _) {
      let D = r, W = g, L = h, X = x;
      if (O.ori == 1 && (D = h, W = x, L = r, X = g), Ht && an(
        z,
        qn(D, z),
        qn(D + W, z)
      ), jt)
        for (let ne in H) {
          let de = H[ne];
          ne != z && de.from == null && de.min != st && an(
            ne,
            qn(L + X, ne),
            qn(L, ne)
          );
        }
      Dl();
    } else De.lock && (De._lock = !De._lock, ci(null, !0, !1));
    w != null && (jn(ss, Ts), sl(ss, i, kt, xt, Be, ae, null));
  }
  function Ja(w, T, N, F, te, o, a) {
    if (De._lock)
      return;
    rn(w);
    let r = Yn;
    if (Yn) {
      let h = !0, g = !0, x = 10, S, _;
      O.ori == 0 ? (S = Ht, _ = jt) : (S = jt, _ = Ht), S && _ && (h = kt <= x || kt >= Be - x, g = xt <= x || xt >= ae - x), S && h && (kt = kt < bi ? 0 : Be), _ && g && (xt = xt < qi ? 0 : ae), ci(null, !0, !0), Yn = !1;
    }
    kt = -10, xt = -10, ci(null, !0, !0), r && (Yn = r);
  }
  function ql(w, T, N, F, te, o, a) {
    De._lock || (rn(w), uo(), Dl(), w != null && sl(Mr, i, kt, xt, Be, ae, null));
  }
  function oa() {
    A.forEach(op), Xt(i.width, i.height, !0);
  }
  vl(Ma, Gl, oa);
  const Wi = {};
  Wi.mousedown = la, Wi.mousemove = Hi, Wi.mouseup = ol, Wi.dblclick = ql, Wi.setSeries = (w, T, N, F) => {
    let te = Nt.match[2];
    N = te(i, T, N), N != -1 && Ln(N, F, !0, !1);
  }, De.show && (At(kr, M, la), At(Sr, M, Hi), At(Cr, M, (w) => {
    rn(w), Bi(!1);
  }), At(_r, M, Ja), At(Mr, M, ql), Ls.add(i), i.syncRect = Bi);
  const al = i.hooks = e.hooks || {};
  function Dt(w, T, N) {
    Al ? Di.push([w, T, N]) : w in al && al[w].forEach((F) => {
      F.call(null, i, T, N);
    });
  }
  (e.plugins || []).forEach((w) => {
    for (let T in w.hooks)
      al[T] = (al[T] || []).concat(w.hooks[T]);
  });
  const Kn = (w, T, N) => N, Nt = Ut({
    key: null,
    setSeries: !1,
    filters: {
      pub: qr,
      sub: qr
    },
    scales: [z, Y[1] ? Y[1].scale : null],
    match: [Rr, Rr, Kn],
    values: [null, null]
  }, De.sync);
  Nt.match.length == 2 && Nt.match.push(Kn), De.sync = Nt;
  const Rl = Nt.key, xo = Uc(Rl);
  function sl(w, T, N, F, te, o, a) {
    Nt.filters.pub(w, T, N, F, te, o, a) && xo.pub(w, T, N, F, te, o, a);
  }
  xo.sub(i);
  function Za(w, T, N, F, te, o, a) {
    Nt.filters.sub(w, T, N, F, te, o, a) && Wi[w](null, T, N, F, te, o, a);
  }
  i.pub = Za;
  function es() {
    xo.unsub(i), Ls.delete(i), ut.clear(), Es(Ma, Gl, oa), m.remove(), ke?.remove(), Dt("destroy");
  }
  i.destroy = es;
  function wo() {
    Dt("init", e, t), ro(t || e.data, !1), G[z] ? po(z, G[z]) : uo(), Kt = wt.show && (wt.width > 0 || wt.height > 0), sn = zt = !0, Xt(e.width, e.height);
  }
  return Y.forEach(Bo), A.forEach(Ue), n ? n instanceof HTMLElement ? (n.appendChild(m), wo()) : n(i, wo) : wo(), i;
}
Gt.assign = Ut;
Gt.fmtNum = Us;
Gt.rangeNum = za;
Gt.rangeLog = Aa;
Gt.rangeAsinh = Gs;
Gt.orient = kl;
Gt.pxRatio = gt;
Gt.join = Xh;
Gt.fmtDate = Xs, Gt.tzDate = sg;
Gt.sync = Uc;
{
  Gt.addGap = Hg, Gt.clipGaps = La;
  let e = Gt.paths = {
    points: ed
  };
  e.linear = nd, e.stepped = Gg, e.bars = Yg, e.spline = Kg;
}
function ap(e, t) {
  if (!e || e.length === 0)
    return [null, null];
  let n = null, i = null;
  for (const { thresholdValue: l } of e)
    l !== void 0 && ((n === null || l < n) && (n = l), (i === null || l > i) && (i = l));
  return [n, i];
}
function sp({
  distr: e,
  logBase: t,
  limits: n
}) {
  if (e !== pl.Logarithmic)
    return n;
  const i = t === 2 ? Math.log2 : Math.log10;
  return {
    min: ca(n.min, t, i, Math.floor),
    max: ca(n.max, t, i, Math.ceil),
    softMin: ca(n.softMin, t, i, Math.floor),
    softMax: ca(n.softMax, t, i, Math.ceil)
  };
}
function ca(e, t, n, i) {
  return e == null || e <= 0 ? e : t ** i(n(e));
}
function rp({
  time: e,
  distr: t,
  logBase: n
}) {
  if (e)
    return {};
  const i = (n ?? 10) === 2 ? 2 : 10;
  return {
    distr: t === pl.Logarithmic ? 3 : t === pl.Symlog ? 2 : 1,
    log: i
  };
}
function up(e, t, n, i, l, s) {
  const d = n == null ? 3 : 1, c = i == null ? 3 : 1, u = {
    min: {
      pad: l,
      hard: e ?? -1 / 0,
      soft: n !== null ? n : void 0,
      mode: d
    },
    max: {
      pad: s,
      hard: t ?? 1 / 0,
      soft: i !== null ? i : void 0,
      mode: c
    }
  }, p = n == null && e != null, m = i == null && t != null;
  return { rangeConfig: u, hardMinOnly: p, hardMaxOnly: m, hasFixedRange: p && m };
}
function cp(e, t, n) {
  return !n && e == null && t == null ? null : [e, t];
}
function dp(e, t, n, i) {
  const { rangeConfig: l, hardMinOnly: s, hardMaxOnly: d, min: c, max: u } = t, p = s ? c : n, m = d ? u : i;
  return p == null || m == null ? e : Gt.rangeNum(p, m, l);
}
function fp(e, t, n, i, l) {
  const s = t.min ?? n, d = t.max ?? i;
  return s == null || d == null ? e : Gt.rangeLog(s, d, l ?? 10, !0);
}
function hp(e, t, n) {
  let [i, l] = e;
  return i != null && (i = t ** Math.floor(n(i))), l != null && (l = t ** Math.ceil(n(l)), i === l && (l *= t)), [i, l];
}
function gp(e, t, n) {
  if (n !== 1)
    return e;
  let [i, l] = e;
  return t.hardMinOnly && t.min != null && (i = t.min), t.hardMaxOnly && t.max != null && (l = t.max), [i, l];
}
function pp(e, t) {
  const [n, i] = e;
  return n != null && i != null && n >= i ? [t === 3 ? 1 : 0, 100] : e;
}
function vp(e) {
  return (t, n, i, l) => {
    const s = t.scales[l], d = cp(n, i, e.hasFixedRange);
    if (!d)
      return [n, i];
    let c = d;
    const u = s.log;
    if (s.distr === 1)
      c = dp(c, e, n, i);
    else if (s.distr === 3) {
      c = fp(c, e, n, i, u);
      const p = s.log === 2 ? Math.log2 : Math.log10;
      c = hp(c, u ?? 10, p);
    }
    return c = gp(c, e, s.distr ?? 1), pp(c, s.distr ?? 1);
  };
}
function mp(e, t, n, i) {
  if (!n || n.length === 0)
    return { softMin: e, softMax: t };
  const [l, s] = ap(n);
  if (l === null && s === null)
    return { softMin: e, softMax: t };
  const d = l !== null ? e !== null ? Math.min(e, l) : l : e, c = s !== null ? t !== null ? Math.max(t, s) : s : t;
  return { softMin: d, softMax: c };
}
class yp extends Ia {
  softMin;
  softMax;
  min;
  max;
  constructor(t) {
    super(t);
    const n = t.softMin === 0 && t.softMax === 0;
    this.softMin = n ? null : t.softMin ?? null, this.softMax = n ? null : t.softMax ?? null, this.min = t.min ?? null, this.max = t.max ?? null;
  }
  getConfig() {
    const {
      scaleKey: t,
      time: n,
      range: i,
      thresholds: l,
      logBase: s = 10,
      padMinBy: d = 0,
      padMaxBy: c = 0.05
    } = this.props;
    if (n) {
      if (this.min != null && this.max != null) {
        const j = this.min;
        let J = this.max;
        const K = new Date(J * 1e3);
        return K.setSeconds(0), K.setMilliseconds(0), J = Math.floor(K.getTime() / 1e3) + 60, { [t]: { time: !0, auto: !1, range: [j, J] } };
      }
      return { [t]: { time: !0, auto: !0 } };
    }
    const u = this.props.distribution, p = l?.thresholds, { softMin: m, softMax: b } = mp(
      this.softMin,
      this.softMax,
      p,
      l?.yAxisUnit
    ), { min: v, max: C, softMin: P, softMax: M } = sp({
      distr: u,
      logBase: s,
      limits: {
        min: this.min,
        max: this.max,
        softMin: m,
        softMax: b
      }
    }), q = rp({ time: n, distr: u, logBase: s }), { rangeConfig: Q, hardMinOnly: V, hardMaxOnly: Y, hasFixedRange: A } = up(
      v,
      C,
      P,
      M,
      d,
      c
    ), H = vp({
      rangeConfig: Q,
      hardMinOnly: V,
      hardMaxOnly: Y,
      hasFixedRange: A,
      min: v,
      max: C
    });
    let ee = this.props.auto;
    return ee ??= !n && !A, {
      [t]: {
        time: n,
        auto: ee,
        range: i ?? H,
        ...q
      }
    };
  }
  merge(t) {
    this.props = { ...this.props, ...t }, t.softMin !== void 0 && (this.softMin = t.softMin ?? null), t.softMax !== void 0 && (this.softMax = t.softMax ?? null), t.min !== void 0 && (this.min = t.min ?? null), t.max !== void 0 && (this.max = t.max ?? null);
  }
}
const fs = {};
let au = 0;
const su = [
  "#4096ff",
  "#52c41a",
  "#faad14",
  "#ff4d4f",
  "#722ed1",
  "#13c2c2",
  "#eb2f96",
  "#fa8c16",
  "#a0d911",
  "#1677ff"
];
function bp(e) {
  if (fs[e])
    return fs[e];
  const t = su[au % su.length];
  return au++, fs[e] = t, t;
}
const ru = {
  white: "#ffffff",
  black: "#000000"
};
function xp(e, t, n, i = 100) {
  const l = e.ctx.createLinearGradient(0, 0, 0, e.bbox.height), s = Math.round(i / 100 * 112).toString(16).padStart(2, "0"), d = Math.round(i / 100 * 64).toString(16).padStart(2, "0");
  return l.addColorStop(0, `${t}${s}`), l.addColorStop(0.6, `${t}${d}`), l.addColorStop(1, n), l;
}
function wp(e, t) {
  for (let n = 1; n < 100; n++) {
    if (e[t + n] != null)
      return t + n;
    if (e[t - n] != null)
      return t - n;
  }
  return t;
}
function Sp(e, t, n) {
  const i = [];
  for (let l = 0; l < e.length; l++) {
    const s = e[l + 1];
    if (s && e[l][1] === s[0]) {
      const d = n.posToIdx(e[l][1], !0);
      i.push(t[d] == null ? wp(t, d) : d);
    }
  }
  return i;
}
function kp(e, t, n, i) {
  if (n || !i || i.length === 0)
    return null;
  const l = e.series[t].idxs;
  if (!l)
    return null;
  const [s, d] = l, c = e.data[0], u = e.data[t], p = Math.round(e.valToPos(c[s], "x", !0)), m = Math.round(e.valToPos(c[d], "x", !0)), b = [];
  return i[0][0] === p && b.push(s), b.push(...Sp(i, u, e)), i[i.length - 1][1] === m && b.push(d), b.length ? b : null;
}
const uu = 2, Cp = 2.5;
let mn = null;
class _p extends Ia {
  constructor(t) {
    if (super(t), !mn) {
      const n = Gt.paths, i = n.linear, l = n.spline, s = n.stepped;
      if (!i || !l || !s)
        throw new Error("Required uPlot path builders are not available");
      mn = {
        linear: i(),
        spline: l(),
        stepBefore: s({ align: -1 }),
        stepAfter: s({ align: 1 })
      };
    }
  }
  getLineColor() {
    const { colorMapping: t, lineColor: n, label: i, isDarkMode: l } = this.props;
    return i ? n ?? t?.[i] ?? bp(i) : n ?? (l ? ru.white : ru.black);
  }
  buildLineConfig({ resolvedLineColor: t }) {
    const { lineWidth: n, lineStyle: i, lineCap: l, fillColor: s, fillMode: d, fillOpacity: c } = this.props, u = {
      stroke: t,
      width: n ?? uu
    }, p = c != null && c > 0 ? Math.round(Math.min(c, 100) / 100 * 255).toString(16).padStart(2, "0") : null;
    i === zs.Dashed && (u.dash = [10, 10]), i === zs.Dotted && (u.dash = [2, 6]), l && (u.cap = l);
    const m = s ?? t;
    return this.props.drawStyle === _i.Bars ? u.fill = p ? `${m}${p}` : m : this.props.drawStyle === _i.Histogram ? u.fill = `${m}${p ?? "40"}` : d && d !== ba.None ? d === ba.Solid ? u.fill = p ? `${m}${p}` : m : d === ba.Gradient && (u.fill = (b) => xp(b, m, "rgba(0, 0, 0, 0)", c ?? 100)) : p && (u.fill = `${m}${p}`), u;
  }
  buildPathConfig() {
    const {
      pathBuilder: t,
      drawStyle: n,
      lineInterpolation: i,
      barAlignment: l,
      barMaxWidth: s,
      barWidthFactor: d,
      stepInterval: c
    } = this.props;
    return t ? { paths: t } : n === _i.Points ? { paths: () => null } : n != null ? {
      paths: (u, p, m, b) => Mp({
        drawStyle: n,
        lineInterpolation: i,
        barAlignment: l,
        barMaxWidth: s,
        barWidthFactor: d,
        stepInterval: c
      })(u, p, m, b)
    } : {};
  }
  resolvePointsShow() {
    const { pointsBuilder: t, drawStyle: n, showPoints: i } = this.props;
    return t || (n === _i.Points ? !0 : !!i);
  }
  shouldApplyIsolatedPointFilter(t) {
    const { drawStyle: n, pointsFilter: i } = this.props;
    return n === _i.Lines && !i && !t;
  }
  buildPointsConfig({ resolvedLineColor: t }) {
    const { lineWidth: n, pointSize: i, pointsFilter: l } = this.props, s = i ?? (n ?? uu) * Cp, d = {
      stroke: t,
      fill: t,
      size: s,
      filter: l || void 0,
      show: this.resolvePointsShow()
    };
    return this.shouldApplyIsolatedPointFilter(d.show) && (d.filter = kp), d;
  }
  getConfig() {
    const { scaleKey: t, label: n, spanGaps: i, show: l = !0, metric: s } = this.props, d = this.getLineColor(), c = this.buildLineConfig({ resolvedLineColor: d }), u = this.buildPathConfig(), p = this.buildPointsConfig({ resolvedLineColor: d });
    return {
      scale: t,
      label: n,
      spanGaps: typeof i == "number" ? !1 : i ?? !0,
      value: () => "",
      pxAlign: !0,
      show: l,
      metric: s,
      ...c,
      ...u,
      points: Object.keys(p).length > 0 ? p : void 0
    };
  }
  merge(t) {
    this.props = { ...this.props, ...t };
  }
}
function Mp({
  drawStyle: e,
  lineInterpolation: t,
  barAlignment: n = xc.Center,
  barWidthFactor: i = 0.6,
  barMaxWidth: l = 200,
  stepInterval: s
}) {
  if (!mn)
    throw new Error("Required uPlot path builders are not available");
  if (e === _i.Bars || e === _i.Histogram) {
    const d = Gt.paths;
    return zp({ pathBuilders: d, barAlignment: n, barWidthFactor: i, barMaxWidth: l, stepInterval: s });
  }
  if (e === _i.Lines) {
    if (t === ya.StepBefore)
      return mn.stepBefore;
    if (t === ya.StepAfter)
      return mn.stepAfter;
    if (t === ya.Linear)
      return mn.linear;
  }
  return mn.spline;
}
function zp({
  pathBuilders: e,
  barAlignment: t,
  barWidthFactor: n,
  barMaxWidth: i,
  stepInterval: l
}) {
  if (!mn)
    throw new Error("Required uPlot path builders are not available");
  const s = e.bars;
  if (typeof l == "number" && l > 0 && s)
    return (c, u, p, m) => {
      let b = i;
      const v = kc({
        uPlotInstance: c,
        stepInterval: l
      });
      v > 0 && (b = Math.min(b, v));
      const C = `bars|${t}|${n}|${b}`;
      return mn && !mn[C] && (mn[C] = s({
        size: [n, b],
        align: t
      })), mn?.[C]?.(c, u, p, m) ?? null;
    };
  const d = `bars|${t}|${n}|${i}`;
  return !mn[d] && s && (mn[d] = s({
    size: [n, i],
    align: t
  })), mn[d];
}
class Tp extends Ia {
  series = [];
  selectionPreferencesSource = Ms.IN_MEMORY;
  shouldSaveSelectionPreference = !1;
  axes = {};
  stepInterval;
  scales = [];
  bands = [];
  cursor;
  hooks = {};
  plugins = [];
  padding;
  legend;
  focus;
  select;
  thresholds = {};
  tzDate;
  id;
  onDragSelect;
  constructor(t) {
    super(t);
    const {
      id: n,
      onDragSelect: i,
      tzDate: l,
      selectionPreferencesSource: s,
      shouldSaveSelectionPreference: d,
      stepInterval: c
    } = t ?? {};
    this.id = n, l && (this.tzDate = l), s && (this.selectionPreferencesSource = s), d && (this.shouldSaveSelectionPreference = d), c && (this.stepInterval = c), this.onDragSelect = () => {
    }, i && (this.onDragSelect = i, this.addHook("setSelect", (u) => {
      const p = u.select;
      if (p && p.width > 0) {
        const m = u.posToVal(p.left, "x"), b = u.posToVal(p.left + p.width, "x");
        this.onDragSelect(m * 1e3, b * 1e3);
      }
    }));
  }
  getShouldSaveSelectionPreference() {
    return this.shouldSaveSelectionPreference;
  }
  getId() {
    return this.id;
  }
  addAxis(t) {
    const { scaleKey: n } = t;
    if (this.axes[n]) {
      this.axes[n].merge?.(t);
      return;
    }
    this.axes[n] = new nh(t);
  }
  addScale(t) {
    const n = this.scales.find((i) => i.props.scaleKey === t.scaleKey);
    if (n) {
      n.merge?.(t);
      return;
    }
    this.scales.push(new yp(t));
  }
  addSeries(t) {
    this.series.push(new _p(t));
  }
  getSeriesSpanGapsOptions() {
    return this.series.map((t) => {
      const { spanGaps: n } = t.props;
      return { spanGaps: n };
    });
  }
  addHook(t, n) {
    return this.hooks[t] || (this.hooks[t] = []), this.hooks[t].push(n), () => {
      const i = this.hooks[t].indexOf(n);
      i !== -1 && this.hooks[t].splice(i, 1);
    };
  }
  addPlugin(t) {
    this.plugins.push(t);
  }
  addThresholds(t) {
    this.thresholds[t.scaleKey] || (this.thresholds[t.scaleKey] = t, this.addHook("draw", rh(t)));
  }
  setBands(t) {
    this.bands = t;
  }
  setCursor(t) {
    this.cursor = sr({}, this.cursor, t);
  }
  setPadding(t) {
    this.padding = t;
  }
  setLegend(t) {
    this.legend = t;
  }
  setFocus(t) {
    this.focus = t;
  }
  setSelect(t) {
    this.select = t;
  }
  setTzDate(t) {
    this.tzDate = t;
  }
  getCursorConfig() {
    const t = {
      ...os,
      hover: {
        ...os.hover,
        prox: this.stepInterval ? (n) => kc({
          uPlotInstance: n,
          stepInterval: this.stepInterval ?? 0
        }) * oh : wc
      }
    };
    return sr({}, os, t, this.cursor);
  }
  getStoredVisibility() {
    return this.id && this.selectionPreferencesSource === Ms.LOCAL_STORAGE ? uh(this.id) : null;
  }
  getVisibilityResolutionState() {
    const t = this.getStoredVisibility();
    if (!t || t.length === 0)
      return {
        visibleStoredLabels: /* @__PURE__ */ new Set(),
        hiddenStoredLabels: /* @__PURE__ */ new Set(),
        hasActivePreference: !1
      };
    const n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
    let l = !1, s = !1;
    for (const { label: b, show: v } of t)
      v ? (l = !0, n.add(b), i.has(b) && i.delete(b)) : (s = !0, n.has(b) || i.add(b));
    const d = l && s, c = this.series.map(
      (b) => b.getConfig().label ?? ""
    ), u = n.size > 0 && c.some((b) => n.has(b)), p = d && u;
    return !d || p ? { visibleStoredLabels: n, hiddenStoredLabels: i, hasActivePreference: p } : {
      visibleStoredLabels: /* @__PURE__ */ new Set(),
      hiddenStoredLabels: /* @__PURE__ */ new Set(),
      hasActivePreference: p
    };
  }
  getLegendItems() {
    const { visibleStoredLabels: t, hiddenStoredLabels: n, hasActivePreference: i } = this.getVisibilityResolutionState();
    return this.series.reduce(
      (l, s, d) => {
        const c = s.getConfig(), u = c.label ?? "", p = d + 1, m = yr({
          seriesShow: c.show,
          seriesLabel: u,
          visibleStoredLabels: t,
          hiddenStoredLabels: n,
          hasActivePreference: i
        });
        return l[p] = {
          seriesIndex: p,
          color: c.stroke ?? "#ccc",
          label: u,
          show: m,
          yAxis: 1
        }, l;
      },
      {}
    );
  }
  getConfig() {
    const t = { ...ah }, { visibleStoredLabels: n, hiddenStoredLabels: i, hasActivePreference: l } = this.getVisibilityResolutionState();
    return t.series = [
      { value: () => "", label: "Timestamp" },
      ...this.series.map((s) => {
        const d = s.getConfig(), c = yr({
          seriesShow: d.show,
          seriesLabel: d.label ?? "",
          visibleStoredLabels: n,
          hiddenStoredLabels: i,
          hasActivePreference: l
        });
        return { ...d, show: c };
      })
    ], t.axes = Object.values(this.axes).map((s) => s.getConfig()), t.scales = this.scales.reduce(
      (s, d) => ({ ...s, ...d.getConfig() }),
      {}
    ), t.hooks = this.hooks, t.select = this.select, t.cursor = this.getCursorConfig(), t.tzDate = this.tzDate, t.plugins = this.plugins.length > 0 ? this.plugins : void 0, t.bands = this.bands.length > 0 ? this.bands : void 0, Array.isArray(this.padding) && (t.padding = this.padding), this.legend && (t.legend = this.legend), this.focus && (t.focus = this.focus), t;
  }
}
function cu(e, t) {
  return t.some(
    ({ spanGaps: n }) => typeof n == "number" && n > 0 && e > n
  );
}
function Pp(e, t) {
  const n = JSON.parse(JSON.stringify(e)), [i, ...l] = n;
  if (!Array.isArray(i) || i.length < 2 || l.length === 0)
    return n;
  const s = i, d = s.length;
  let c = 0;
  for (let v = 0; v < d - 1; v += 1)
    cu(s[v + 1] - s[v], t) && (c += 1);
  if (c === 0)
    return e;
  const u = d + c, p = Array.from({ length: u }), m = l.map(
    () => Array.from({ length: u })
  );
  let b = 0;
  for (let v = 0; v < d; v += 1) {
    p[b] = s[v];
    for (const [C, P] of l.entries())
      m[C][b] = P[v];
    if (b += 1, v < d - 1 && cu(s[v + 1] - s[v], t)) {
      p[b] = s[v] + Math.max(1, Math.floor((s[v + 1] - s[v]) / 2));
      for (let C = 0; C < l.length; C += 1)
        m[C][b] = null;
      b += 1;
    }
  }
  return [p, ...m];
}
function $p(e, t) {
  const n = JSON.parse(JSON.stringify(e)), [i, ...l] = n;
  if (!Array.isArray(i) || l.length === 0)
    return n;
  const d = t.some(({ spanGaps: b }) => typeof b == "number") ? Pp(n, t) : n;
  if (!t.some(({ spanGaps: b }) => b === !0))
    return d;
  const [u, ...p] = d, m = p.map((b, v) => {
    const { spanGaps: C } = t[v] ?? {};
    return C !== !0 ? b : b.map(
      (P) => P === null ? void 0 : P
    );
  });
  return [u, ...m];
}
const Ep = /\{\{(\w+)(?::(\w+))?\}\}/g;
function Ip(e) {
  const t = /* @__PURE__ */ new Set();
  let n;
  const i = new RegExp(Ep.source, "g");
  for (; (n = i.exec(e)) !== null; )
    t.add(n[1]);
  return Array.from(t);
}
class Ap {
  nodes = /* @__PURE__ */ new Map();
  ensureNode(t) {
    return this.nodes.has(t) || this.nodes.set(t, { name: t, dependsOn: [], dependents: [] }), this.nodes.get(t);
  }
  addVariable(t) {
    const n = t.name, i = this.ensureNode(n);
    for (const l of i.dependsOn) {
      const s = this.nodes.get(l);
      s && (s.dependents = s.dependents.filter((d) => d !== n));
    }
    i.dependsOn = [], t.query && (i.dependsOn = Ip(t.query));
    for (const l of i.dependsOn)
      this.ensureNode(l).dependents.push(n);
  }
  removeVariable(t) {
    const n = this.nodes.get(t);
    if (n) {
      for (const i of n.dependsOn) {
        const l = this.nodes.get(i);
        l && (l.dependents = l.dependents.filter((s) => s !== t));
      }
      for (const i of n.dependents) {
        const l = this.nodes.get(i);
        l && (l.dependsOn = l.dependsOn.filter((s) => s !== t));
      }
      this.nodes.delete(t);
    }
  }
  getDependents(t) {
    return this.nodes.get(t)?.dependents ?? [];
  }
  getAllDependents(t) {
    const n = /* @__PURE__ */ new Set(), i = [], l = (s) => {
      if (n.has(s))
        return;
      n.add(s);
      const d = this.getDependents(s);
      for (const c of d)
        i.push(c), l(c);
    };
    return l(t), i;
  }
  detectCycle() {
    const l = /* @__PURE__ */ new Map(), s = [];
    for (const c of this.nodes.keys())
      l.set(c, 0);
    const d = (c) => {
      l.set(c, 1);
      const u = this.nodes.get(c);
      if (u)
        for (const p of u.dependsOn) {
          const m = l.get(p);
          if (m === 1)
            return s.push(p, c), !0;
          if (m === 0 && d(p))
            return s.push(c), !0;
        }
      return l.set(c, 2), !1;
    };
    for (const c of this.nodes.keys())
      if (l.get(c) === 0 && d(c))
        return s.reverse();
    return null;
  }
  topologicalSort() {
    const t = /* @__PURE__ */ new Set(), n = [], i = (l) => {
      if (t.has(l))
        return;
      t.add(l);
      const s = this.nodes.get(l);
      if (s)
        for (const d of s.dependsOn)
          i(d);
      n.push(l);
    };
    for (const l of this.nodes.keys())
      i(l);
    return n;
  }
  clear() {
    this.nodes.clear();
  }
}
let Op = 1;
async function Qi(e, t, n) {
  const { url: i, token: l } = n, s = {
    jsonrpc: "2.0",
    method: e,
    params: t,
    auth: l,
    id: Op++
  }, d = await fetch(`${i}?_m=${e}`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(s)
  });
  if (!d.ok)
    throw new Error(`Zabbix API HTTP error: ${d.status}`);
  const c = await d.json();
  if (c.error)
    throw new Error(`Zabbix API error [${c.error.code}]: ${c.error.data}`);
  return c.result;
}
function Dp(e) {
  return Qi(
    "hostgroup.get",
    {
      output: ["groupid", "name"],
      sortfield: "name",
      limit: 200
    },
    e
  );
}
function Lp(e, t, n) {
  return Qi(
    "host.get",
    {
      output: ["hostid", "host", "name"],
      ...e?.length ? { groupids: e } : {},
      sortfield: "name",
      limit: 200
    },
    n
  );
}
function qp(e, t, n, i, l) {
  return Qi(
    "item.get",
    {
      output: ["itemid", "hostid", "name", "key_", "value_type", "units", "valuemapid"],
      selectTags: "extend",
      hostids: e,
      filter: { value_type: ["0", "3"] },
      sortfield: "name",
      limit: 500
    },
    i
  );
}
function Rp(e) {
  return e.value ? `${e.tag}: ${e.value}` : e.tag;
}
function Np(e, t, n) {
  return Qi(
    "item.get",
    {
      output: ["itemid", "hostid", "name", "key_", "value_type", "units", "valuemapid"],
      hostids: e,
      filter: { value_type: ["1", "2", "4"] },
      sortfield: "name",
      limit: 500
    },
    n
  );
}
function Vp(e, t) {
  return Qi(
    "usermacro.get",
    {
      output: ["hostmacroid", "macro", "value"],
      ...e?.length ? { hostids: e } : {},
      sortfield: "macro",
      limit: 200
    },
    t
  );
}
function Fp(e) {
  return Qi(
    "service.get",
    {
      output: ["serviceid", "name"],
      sortfield: "name",
      limit: 200
    },
    e
  );
}
function Bp(e, t) {
  return Qi(
    "discoveryrule.get",
    {
      output: ["itemid", "hostid", "name", "key_"],
      hostids: e,
      sortfield: "name",
      limit: 200
    },
    t
  );
}
function Hp(e, t) {
  return Qi(
    "itemprototype.get",
    {
      output: ["itemid", "name", "key_"],
      discoveryids: [e],
      sortfield: "name"
    },
    t
  );
}
const Wp = [
  "Transform",
  "Aggregate",
  "Filter",
  "Trends",
  "Time",
  "Alias",
  "Special"
], du = [
  // Transform
  { name: "groupBy", category: "Transform", params: [{ name: "interval", type: "string" }, { name: "function", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: ["1m", "avg"] },
  { name: "scale", category: "Transform", params: [{ name: "factor", type: "float", options: [100, 0.01, 10, -1] }], defaultParams: [100] },
  { name: "offset", category: "Transform", params: [{ name: "delta", type: "float", options: [-100, 100] }], defaultParams: [100] },
  { name: "delta", category: "Transform", params: [], defaultParams: [] },
  { name: "rate", category: "Transform", params: [], defaultParams: [] },
  { name: "movingAverage", category: "Transform", params: [{ name: "factor", type: "int", options: [6, 10, 60, 100, 600] }], defaultParams: [10] },
  { name: "exponentialMovingAverage", category: "Transform", params: [{ name: "smoothing", type: "float", options: [6, 10, 60, 100, 600] }], defaultParams: [0.2] },
  { name: "percentile", category: "Transform", params: [{ name: "interval", type: "string" }, { name: "percent", type: "float", options: [25, 50, 75, 90, 95, 99, 99.9] }], defaultParams: ["1m", 95] },
  { name: "removeAboveValue", category: "Transform", params: [{ name: "number", type: "float" }], defaultParams: [0] },
  { name: "removeBelowValue", category: "Transform", params: [{ name: "number", type: "float" }], defaultParams: [0] },
  { name: "transformNull", category: "Transform", params: [{ name: "number", type: "float" }], defaultParams: [0] },
  // Aggregate
  { name: "aggregateBy", category: "Aggregate", params: [{ name: "interval", type: "string" }, { name: "function", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: ["1m", "avg"] },
  { name: "sumSeries", category: "Aggregate", params: [], defaultParams: [] },
  { name: "percentileAgg", category: "Aggregate", params: [{ name: "interval", type: "string" }, { name: "percent", type: "float", options: [25, 50, 75, 90, 95, 99, 99.9] }], defaultParams: ["1m", 95] },
  // Filter
  { name: "top", category: "Filter", params: [{ name: "number", type: "int" }, { name: "value", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: [5, "avg"] },
  { name: "bottom", category: "Filter", params: [{ name: "number", type: "int" }, { name: "value", type: "string", options: ["avg", "min", "max", "sum", "count", "median", "first", "last"] }], defaultParams: [5, "avg"] },
  { name: "sortSeries", category: "Filter", params: [{ name: "direction", type: "string", options: ["asc", "desc"] }], defaultParams: ["asc"] },
  // Trends
  { name: "trendValue", category: "Trends", params: [{ name: "type", type: "string", options: ["avg", "min", "max", "sum", "count"] }], defaultParams: ["avg"] },
  // Time
  { name: "timeShift", category: "Time", params: [{ name: "interval", type: "string", options: ["24h", "7d", "1M", "+24h", "-24h"] }], defaultParams: ["24h"] },
  // Alias
  { name: "setAlias", category: "Alias", params: [{ name: "alias", type: "string" }], defaultParams: [] },
  { name: "setAliasByRegex", category: "Alias", params: [{ name: "aliasByRegex", type: "string" }], defaultParams: [] },
  { name: "replaceAlias", category: "Alias", params: [{ name: "regexp", type: "string" }, { name: "newAlias", type: "string" }], defaultParams: ["/(.*)/", "$1"] },
  // Special
  { name: "consolidateBy", category: "Special", params: [{ name: "type", type: "string", options: ["avg", "min", "max", "sum", "count"] }], defaultParams: ["avg"] }
], Vl = new Ap();
function jp(e) {
  return e.split(",").map((t) => t.trim()).filter(Boolean).map((t) => ({ value: t, label: t }));
}
function Gp(e, t, n) {
  if (t) {
    const i = e ?? n[0]?.value ?? "";
    return i ? [i] : [];
  }
  return e ?? n[0]?.value ?? "";
}
function Yp(e) {
  return [{ value: "$__all", label: "All" }, ...e];
}
function Up(e, t, n) {
  switch (e.type) {
    case "custom": {
      const i = e.customValues ?? "";
      return Promise.resolve(jp(i));
    }
    case "query": {
      if (!t || !e.query)
        return Promise.resolve([]);
      const i = Kp(e.query, n);
      return t(i);
    }
    case "textbox": {
      const i = e.defaultValue ?? "";
      return Promise.resolve(i ? [{ value: i, label: i }] : []);
    }
    case "constant": {
      const i = e.constantValue ?? "";
      return Promise.resolve(i ? [{ value: i, label: i }] : []);
    }
    default:
      return Promise.resolve([]);
  }
}
function Kp(e, t) {
  return e.replace(/\{\{(\w+)(?::(\w+))?\}\}/g, (n, i) => {
    const l = t[i];
    return l == null ? n : Array.isArray(l) ? l.join(",") : String(l);
  });
}
const to = Bs("variable", () => {
  const e = fe({}), t = fe(null);
  function n(C) {
    t.value = C;
  }
  function i(C) {
    e.value[C.id] || (Vl.addVariable(C), e.value[C.id] = {
      config: C,
      options: [],
      current: "",
      loading: !1,
      error: null
    });
  }
  function l(C) {
    const P = e.value[C];
    P && (Vl.removeVariable(P.config.name), delete e.value[C]);
  }
  function s(C, P) {
    const M = e.value[C];
    M && (M.config = { ...M.config, ...P }, ("name" in P || "query" in P) && Vl.addVariable(M.config));
  }
  function d(C, P) {
    const M = e.value[C];
    M && (M.current = P);
  }
  async function c(C) {
    const P = e.value[C];
    if (P) {
      P.loading = !0, P.error = null;
      try {
        const M = p(), q = await Up(P.config, t.value, M);
        P.options = P.config.includeAll ? Yp(q) : q;
        const Q = Array.isArray(P.current) ? P.current[0] : P.current;
        (!Q || !P.options.some((V) => V.value === Q)) && (P.current = Gp(P.config.defaultValue, P.config.multi, P.options));
      } catch (M) {
        P.error = M?.message ?? String(M);
      } finally {
        P.loading = !1;
      }
    }
  }
  async function u() {
    const C = Vl.topologicalSort();
    for (const P of C) {
      const M = Object.values(e.value).find((q) => q.config.name === P);
      M && await c(M.config.id);
    }
  }
  function p() {
    const C = {};
    for (const P of Object.values(e.value)) {
      const { name: M } = P.config;
      Array.isArray(P.current) ? C[M] = P.current.length === 1 ? P.current[0] : P.current : C[M] = P.current;
    }
    return C;
  }
  function m(C) {
    return Object.values(e.value).find((P) => P.config.name === C);
  }
  function b(C) {
    return Vl.getAllDependents(C);
  }
  function v() {
    return Vl.detectCycle();
  }
  return {
    variables: e,
    optionsResolver: t,
    setOptionsResolver: n,
    addVariable: i,
    removeVariable: l,
    updateVariable: s,
    setValue: d,
    refreshVariable: c,
    refreshAll: u,
    resolveAll: p,
    getVariable: m,
    getDependents: b,
    detectCycle: v
  };
});
function Xp() {
  const e = Date.now();
  return { from: e - 3600 * 1e3, to: e };
}
const hi = Bs("dashboard", () => {
  const e = yc(), t = fe(""), n = fe(e.panels), i = fe(e.layouts), l = fe(!1), s = fe(null), d = fe(!1), c = fe(Xp()), u = fe(0), p = fe(null), m = fe(!1), b = fe({});
  function v($) {
    const G = _s(), ue = mc($, { id: G }), ie = i.value.reduce((ve, ge) => Math.max(ve, ge.y + ge.h), 0), Ee = {
      i: G,
      x: 0,
      y: ie,
      w: $ === "stat" || $ === "gauge" ? 3 : $ === "table" ? 12 : 6,
      h: $ === "stat" || $ === "gauge" ? 4 : $ === "table" ? 10 : 8,
      minH: $ === "stat" || $ === "gauge" ? 3 : 6
    };
    n.value[G] = ue, i.value = [...i.value, Ee], s.value = G, d.value = !1, m.value = !0;
  }
  function C($) {
    const { [$]: G, ...ue } = n.value;
    n.value = ue, i.value = i.value.filter((ie) => ie.i !== $), s.value === $ && (s.value = null), m.value = !0;
  }
  function P($) {
    const G = n.value[$];
    if (!G)
      return;
    const ue = _s(), ie = { ...G, id: ue, title: `${G.title} (copy)` }, Ee = i.value.find((ge) => ge.i === $), ve = i.value.reduce((ge, le) => Math.max(ge, le.y + le.h), 0);
    n.value[ue] = ie, i.value = [
      ...i.value,
      {
        i: ue,
        x: Ee?.x ?? 0,
        y: ve,
        w: Ee?.w ?? 6,
        h: Ee?.h ?? 8,
        minH: Ee?.minH
      }
    ], m.value = !0;
  }
  function M($, G) {
    const ue = n.value[$];
    ue && (n.value[$] = { ...ue, ...G }, m.value = !0);
  }
  function q() {
    n.value = {}, i.value = [], s.value = null, m.value = !0;
  }
  function Q($) {
    i.value = $;
  }
  function V() {
    p.value = {
      title: t.value,
      panels: { ...n.value },
      layouts: [...i.value]
    }, l.value = !0, m.value = !1;
  }
  function Y($) {
    $ && $(Z()), l.value = !1, p.value = null, m.value = !1;
  }
  function A() {
    const $ = p.value;
    $ && (t.value = $.title, n.value = $.panels, i.value = $.layouts), l.value = !1, p.value = null, m.value = !1;
  }
  function H() {
    l.value ? A() : V();
  }
  function ee($) {
    l.value = $;
  }
  function z($) {
    s.value = $;
  }
  function j($) {
    c.value = $;
  }
  function J($) {
    u.value = $;
  }
  function K() {
    for (const $ of Object.keys(n.value))
      b.value[$] = (b.value[$] ?? 0) + 1;
  }
  function O($) {
    b.value[$] = (b.value[$] ?? 0) + 1;
  }
  function Z() {
    const $ = to(), G = Object.values($.variables).map((ie) => ie.config), ue = {
      title: t.value,
      panels: n.value,
      layouts: i.value,
      variables: G
    };
    return JSON.stringify(ue, null, 2);
  }
  function U($) {
    try {
      const G = JSON.parse($);
      if (G.panels && G.layouts && (t.value = G.title ?? "", n.value = G.panels, i.value = G.layouts, m.value = !0), G.variables && G.variables.length > 0) {
        const ue = to();
        for (const ie of Object.keys(ue.variables))
          ue.removeVariable(ie);
        for (const ie of G.variables) {
          const Ee = {
            ...ie,
            hide: ie.showOnDashboard === "nothing" || !!ie.hideFromVariableList
          };
          ue.addVariable(Ee);
        }
      }
      return !!(G.panels && G.layouts);
    } catch {
      return !1;
    }
  }
  return {
    title: t,
    panels: n,
    layouts: i,
    isEditing: l,
    editingPanelId: s,
    addPanelModalOpen: d,
    timeRange: c,
    autoRefresh: u,
    _editSnapshot: p,
    isDirty: m,
    panelRefreshKeys: b,
    addPanel: v,
    removePanel: C,
    clonePanel: P,
    updatePanel: M,
    clearPanels: q,
    setLayouts: Q,
    startEditing: V,
    confirmSave: Y,
    discardChanges: A,
    setEditingPanel: z,
    toggleEditing: H,
    setEditing: ee,
    setTimeRange: j,
    setAutoRefresh: J,
    refresh: K,
    refreshPanel: O,
    exportJSON: Z,
    importJSON: U
  };
}), Pi = Bs("theme", () => {
  const e = fe(
    (typeof localStorage < "u" ? localStorage.getItem("argus-theme") : null) || "dark"
  ), t = re(() => e.value === "dark");
  function n() {
    e.value = e.value === "dark" ? "light" : "dark", typeof document < "u" && (document.documentElement.dataset.theme = e.value), typeof localStorage < "u" && localStorage.setItem("argus-theme", e.value);
  }
  function i(l) {
    e.value = l, typeof document < "u" && (document.documentElement.dataset.theme = l), typeof localStorage < "u" && localStorage.setItem("argus-theme", l);
  }
  return { theme: e, isDark: t, toggle: n, setTheme: i };
}), Qp = typeof window < "u";
var fu;
Qp && ((fu = window?.navigator) != null && fu.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Pn(e) {
  return e == null;
}
function ad() {
}
const Jp = Object.freeze({
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
});
Object.freeze(new Set(Object.keys(Jp)));
function Zp() {
  const e = /* @__PURE__ */ new Map();
  return {
    on(t, n) {
      const i = e.get(t);
      i?.add(n) || e.set(t, /* @__PURE__ */ new Set([n]));
    },
    off(t, n) {
      const i = e.get(t);
      i && i.delete(n);
    },
    clear(t) {
      const n = e.get(t);
      n && n.clear();
    },
    clearAll() {
      e.clear();
    },
    emit(t, ...n) {
      const i = e.get(t);
      i && i.forEach((l) => {
        l(...n);
      });
    }
  };
}
function hu(e, t = 16) {
  if (typeof e != "function")
    return ad;
  const n = (...s) => {
    e(...s);
  };
  if (t <= 0)
    return sd(n);
  let i = 0, l;
  return function(...s) {
    const d = Date.now(), c = d - i;
    clearTimeout(l), c >= t ? (i = d, n(...s)) : l = setTimeout(
      () => {
        i = Date.now(), n(...s);
      },
      Math.max(0, t - c)
    );
  };
}
function ev(e, t = 100) {
  if (typeof e != "function")
    return ad;
  const n = (...l) => {
    e(...l);
  };
  if (t <= 0)
    return sd(n);
  let i;
  return function(...l) {
    clearTimeout(i), i = setTimeout(() => {
      n(...l);
    }, t);
  };
}
function sd(e) {
  if (typeof e != "function")
    return e;
  let t = !1, n, i;
  return function(...l) {
    return n = l, t || (t = !0, i = Promise.resolve().then(() => (t = !1, i = void 0, e(...n)))), i;
  };
}
const Oo = /* @__PURE__ */ new Set(), rd = /* @__PURE__ */ new WeakMap();
function tv() {
  Oo.forEach((e) => {
    e(...rd.get(e));
  }), Oo.clear();
}
function pn(e, ...t) {
  if (typeof e != "function")
    return e;
  rd.set(e, t), !Oo.has(e) && (Oo.add(e), Oo.size === 1 && Promise.resolve().then(tv));
}
const ud = Symbol("LAYOUT_KEY"), cd = Symbol("EMITTER_KEY");
function nv(e) {
  let t = 0, n;
  for (let i = 0, l = e.length; i < l; i++)
    n = e[i].y + e[i].h, n > t && (t = n);
  return t;
}
function Rs(e) {
  const t = Array(e.length);
  for (let n = 0, i = e.length; n < i; n++)
    t[n] = iv(e[n]);
  return t;
}
function iv(e) {
  return { ...e };
}
function dd(e, t) {
  return !(e === t || e.x + e.w <= t.x || e.x >= t.x + t.w || e.y + e.h <= t.y || e.y >= t.y + t.h);
}
function Wl(e, t, n) {
  const i = hd(e), l = gd(e), s = Array(e.length);
  for (let d = 0, c = l.length; d < c; d++) {
    let u = l[d];
    u.static || (u = lv(i, u, t, n), i.push(u)), s[e.findIndex((p) => p.i === u.i)] = u, u.moved = !1;
  }
  return s;
}
function lv(e, t, n, i) {
  if (n)
    for (; t.y > 0 && !Do(e, t); )
      t.y--;
  else if (i) {
    const s = i[t.i].y;
    for (; t.y > s && !Do(e, t); )
      t.y--;
  }
  let l;
  for (; l = Do(e, t); )
    t.y = l.y + l.h;
  return t;
}
function ov(e, t) {
  const n = hd(e);
  for (let i = 0, l = e.length; i < l; i++) {
    const s = e[i];
    if (s.x + s.w > t.cols && (s.x = t.cols - s.w), s.x < 0 && (s.x = 0, s.w = t.cols), !s.static) n.push(s);
    else
      for (; Do(n, s); )
        s.y++;
  }
  return e;
}
function gu(e, t) {
  for (let n = 0, i = e.length; n < i; n++)
    if (e[n].i === t) return e[n];
}
function Do(e, t) {
  for (let n = 0, i = e.length; n < i; n++)
    if (dd(e[n], t)) return e[n];
}
function fd(e, t) {
  return e.filter((n) => dd(n, t));
}
function hd(e) {
  return e.filter((t) => t.static);
}
function Ns(e, t, n, i, l = !1, s = !1) {
  if (t.static) return e;
  const d = t.x, c = t.y, u = i && t.y > i;
  typeof n == "number" && (t.x = n), typeof i == "number" && (t.y = i), t.moved = !0;
  let p = gd(e);
  u && (p = p.reverse());
  const m = fd(p, t);
  if (s && m.length)
    return t.x = d, t.y = c, t.moved = !1, e;
  for (let b = 0, v = m.length; b < v; b++) {
    const C = m[b];
    C.moved || t.y > C.y && t.y - C.y > C.h / 4 || (C.static ? e = pu(e, C, t, l) : e = pu(e, t, C, l));
  }
  return e;
}
function pu(e, t, n, i) {
  if (i) {
    const l = {
      x: n.x,
      y: n.y,
      w: n.w,
      h: n.h
    };
    if (l.y = Math.max(t.y - n.h, 0), !Do(e, l))
      return Ns(e, n, void 0, l.y, !1);
  }
  return Ns(e, n, void 0, n.y + 1, !1);
}
function av(e, t, n, i) {
  const l = "translate3d(" + t + "px," + e + "px, 0)";
  return {
    transform: l,
    WebkitTransform: l,
    MozTransform: l,
    msTransform: l,
    OTransform: l,
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function sv(e, t, n, i) {
  const l = "translate3d(" + t * -1 + "px," + e + "px, 0)";
  return {
    transform: l,
    WebkitTransform: l,
    MozTransform: l,
    msTransform: l,
    OTransform: l,
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function rv(e, t, n, i) {
  return {
    top: e + "px",
    left: t + "px",
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function uv(e, t, n, i) {
  return {
    top: e + "px",
    right: t + "px",
    width: n + "px",
    height: i + "px",
    position: "absolute"
  };
}
function gd(e) {
  return Array.from(e).sort(function(t, n) {
    return t.y === n.y && t.x === n.x ? 0 : t.y > n.y || t.y === n.y && t.x > n.x ? 1 : -1;
  });
}
function cv(e, t) {
  t = t || "Layout";
  const n = ["x", "y", "w", "h"], i = [];
  if (!Array.isArray(e)) throw new Error(t + " must be an array!");
  for (let l = 0, s = e.length; l < s; l++) {
    const d = e[l];
    for (let c = 0; c < n.length; c++)
      if (typeof d[n[c]] != "number")
        throw new Error(
          "VueGridLayout: " + t + "[" + l + "]." + n[c] + " must be a number!"
        );
    if (d.i === void 0 || d.i === null)
      throw new Error("VueGridLayout: " + t + "[" + l + "].i cannot be null!");
    if (typeof d.i != "number" && typeof d.i != "string")
      throw new Error("VueGridLayout: " + t + "[" + l + "].i must be a string or number!");
    if (i.indexOf(d.i) >= 0)
      throw new Error("VueGridLayout: " + t + "[" + l + "].i must be unique!");
    if (i.push(d.i), d.static !== void 0 && typeof d.static != "boolean")
      throw new Error("VueGridLayout: " + t + "[" + l + "].static must be a boolean!");
  }
}
function dv(e, t = "vgl") {
  const n = () => `${t}-${e}`;
  return {
    b: n,
    be: (i) => `${n()}__${i}`,
    bm: (i) => `${n()}--${i}`,
    bem: (i, l) => `${n()}__${i}--${l}`
  };
}
function vu(e) {
  return fv(e);
}
function fv(e) {
  var t;
  const n = ((t = e.target) == null ? void 0 : t.offsetParent) || document.body, i = e.offsetParent === document.body ? { left: 0, top: 0 } : n.getBoundingClientRect(), l = e.clientX + n.scrollLeft - i.left, s = e.clientY + n.scrollTop - i.top;
  return { x: l, y: s };
}
function mu(e, t, n, i) {
  return hv(e) ? {
    deltaX: n - e,
    deltaY: i - t,
    lastX: e,
    lastY: t,
    x: n,
    y: i
  } : {
    deltaX: 0,
    deltaY: 0,
    lastX: n,
    lastY: i,
    x: n,
    y: i
  };
}
function hv(e) {
  return typeof e == "number" && !Number.isNaN(e);
}
function gv(e, t) {
  const n = vd(e);
  let i = n[0];
  for (let l = 1, s = n.length; l < s; l++) {
    const d = n[l];
    t > e[d] && (i = d);
  }
  return i;
}
function pd(e, t) {
  if (!t[e])
    throw new Error(
      "ResponsiveGridLayout: `cols` entry for breakpoint " + e + " is missing!"
    );
  return t[e];
}
function pv(e, t, n, i, l, s, d) {
  if (t[i]) return Rs(t[i]);
  let c = e;
  const u = vd(n), p = u.slice(u.indexOf(i));
  for (let m = 0, b = p.length; m < b; m++) {
    const v = p[m];
    if (t[v]) {
      c = t[v];
      break;
    }
  }
  return c = Rs(c || []), Wl(ov(c, { cols: s }), d);
}
function vd(e) {
  return Object.keys(e).sort((t, n) => e[t] - e[n]);
}
let vv = "auto";
function mv() {
  return typeof document < "u";
}
function yu() {
  return mv() ? typeof document.dir < "u" ? document.dir : document.getElementsByTagName("html")[0].getAttribute("dir") : vv;
}
var $o = { exports: {} }, yv = $o.exports, bu;
function bv() {
  return bu || (bu = 1, (function(e, t) {
    (function(n, i) {
      e.exports = i();
    })(yv, (function() {
      function n(o, a) {
        var r = Object.keys(o);
        if (Object.getOwnPropertySymbols) {
          var h = Object.getOwnPropertySymbols(o);
          a && (h = h.filter((function(g) {
            return Object.getOwnPropertyDescriptor(o, g).enumerable;
          }))), r.push.apply(r, h);
        }
        return r;
      }
      function i(o) {
        for (var a = 1; a < arguments.length; a++) {
          var r = arguments[a] != null ? arguments[a] : {};
          a % 2 ? n(Object(r), !0).forEach((function(h) {
            u(o, h, r[h]);
          })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(o, Object.getOwnPropertyDescriptors(r)) : n(Object(r)).forEach((function(h) {
            Object.defineProperty(o, h, Object.getOwnPropertyDescriptor(r, h));
          }));
        }
        return o;
      }
      function l(o) {
        return l = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(a) {
          return typeof a;
        } : function(a) {
          return a && typeof Symbol == "function" && a.constructor === Symbol && a !== Symbol.prototype ? "symbol" : typeof a;
        }, l(o);
      }
      function s(o, a) {
        if (!(o instanceof a)) throw new TypeError("Cannot call a class as a function");
      }
      function d(o, a) {
        for (var r = 0; r < a.length; r++) {
          var h = a[r];
          h.enumerable = h.enumerable || !1, h.configurable = !0, "value" in h && (h.writable = !0), Object.defineProperty(o, M(h.key), h);
        }
      }
      function c(o, a, r) {
        return a && d(o.prototype, a), Object.defineProperty(o, "prototype", { writable: !1 }), o;
      }
      function u(o, a, r) {
        return (a = M(a)) in o ? Object.defineProperty(o, a, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : o[a] = r, o;
      }
      function p(o, a) {
        if (typeof a != "function" && a !== null) throw new TypeError("Super expression must either be null or a function");
        o.prototype = Object.create(a && a.prototype, { constructor: { value: o, writable: !0, configurable: !0 } }), Object.defineProperty(o, "prototype", { writable: !1 }), a && b(o, a);
      }
      function m(o) {
        return m = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(a) {
          return a.__proto__ || Object.getPrototypeOf(a);
        }, m(o);
      }
      function b(o, a) {
        return b = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, h) {
          return r.__proto__ = h, r;
        }, b(o, a);
      }
      function v(o) {
        if (o === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return o;
      }
      function C(o) {
        var a = (function() {
          if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
          if (typeof Proxy == "function") return !0;
          try {
            return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {
            }))), !0;
          } catch {
            return !1;
          }
        })();
        return function() {
          var r, h = m(o);
          if (a) {
            var g = m(this).constructor;
            r = Reflect.construct(h, arguments, g);
          } else r = h.apply(this, arguments);
          return (function(x, S) {
            if (S && (typeof S == "object" || typeof S == "function")) return S;
            if (S !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
            return v(x);
          })(this, r);
        };
      }
      function P() {
        return P = typeof Reflect < "u" && Reflect.get ? Reflect.get.bind() : function(o, a, r) {
          var h = (function(x, S) {
            for (; !Object.prototype.hasOwnProperty.call(x, S) && (x = m(x)) !== null; ) ;
            return x;
          })(o, a);
          if (h) {
            var g = Object.getOwnPropertyDescriptor(h, a);
            return g.get ? g.get.call(arguments.length < 3 ? o : r) : g.value;
          }
        }, P.apply(this, arguments);
      }
      function M(o) {
        var a = (function(r, h) {
          if (typeof r != "object" || r === null) return r;
          var g = r[Symbol.toPrimitive];
          if (g !== void 0) {
            var x = g.call(r, h);
            if (typeof x != "object") return x;
            throw new TypeError("@@toPrimitive must return a primitive value.");
          }
          return String(r);
        })(o, "string");
        return typeof a == "symbol" ? a : a + "";
      }
      var q = function(o) {
        return !(!o || !o.Window) && o instanceof o.Window;
      }, Q = void 0, V = void 0;
      function Y(o) {
        Q = o;
        var a = o.document.createTextNode("");
        a.ownerDocument !== o.document && typeof o.wrap == "function" && o.wrap(a) === a && (o = o.wrap(o)), V = o;
      }
      function A(o) {
        return q(o) ? o : (o.ownerDocument || o).defaultView || V.window;
      }
      typeof window < "u" && window && Y(window);
      var H = function(o) {
        return !!o && l(o) === "object";
      }, ee = function(o) {
        return typeof o == "function";
      }, z = { window: function(o) {
        return o === V || q(o);
      }, docFrag: function(o) {
        return H(o) && o.nodeType === 11;
      }, object: H, func: ee, number: function(o) {
        return typeof o == "number";
      }, bool: function(o) {
        return typeof o == "boolean";
      }, string: function(o) {
        return typeof o == "string";
      }, element: function(o) {
        if (!o || l(o) !== "object") return !1;
        var a = A(o) || V;
        return /object|function/.test(typeof Element > "u" ? "undefined" : l(Element)) ? o instanceof Element || o instanceof a.Element : o.nodeType === 1 && typeof o.nodeName == "string";
      }, plainObject: function(o) {
        return H(o) && !!o.constructor && /function Object\b/.test(o.constructor.toString());
      }, array: function(o) {
        return H(o) && o.length !== void 0 && ee(o.splice);
      } };
      function j(o) {
        var a = o.interaction;
        if (a.prepared.name === "drag") {
          var r = a.prepared.axis;
          r === "x" ? (a.coords.cur.page.y = a.coords.start.page.y, a.coords.cur.client.y = a.coords.start.client.y, a.coords.velocity.client.y = 0, a.coords.velocity.page.y = 0) : r === "y" && (a.coords.cur.page.x = a.coords.start.page.x, a.coords.cur.client.x = a.coords.start.client.x, a.coords.velocity.client.x = 0, a.coords.velocity.page.x = 0);
        }
      }
      function J(o) {
        var a = o.iEvent, r = o.interaction;
        if (r.prepared.name === "drag") {
          var h = r.prepared.axis;
          if (h === "x" || h === "y") {
            var g = h === "x" ? "y" : "x";
            a.page[g] = r.coords.start.page[g], a.client[g] = r.coords.start.client[g], a.delta[g] = 0;
          }
        }
      }
      var K = { id: "actions/drag", install: function(o) {
        var a = o.actions, r = o.Interactable, h = o.defaults;
        r.prototype.draggable = K.draggable, a.map.drag = K, a.methodDict.drag = "draggable", h.actions.drag = K.defaults;
      }, listeners: { "interactions:before-action-move": j, "interactions:action-resume": j, "interactions:action-move": J, "auto-start:check": function(o) {
        var a = o.interaction, r = o.interactable, h = o.buttons, g = r.options.drag;
        if (g && g.enabled && (!a.pointerIsDown || !/mouse|pointer/.test(a.pointerType) || (h & r.options.drag.mouseButtons) != 0)) return o.action = { name: "drag", axis: g.lockAxis === "start" ? g.startAxis : g.lockAxis }, !1;
      } }, draggable: function(o) {
        return z.object(o) ? (this.options.drag.enabled = o.enabled !== !1, this.setPerAction("drag", o), this.setOnEvents("drag", o), /^(xy|x|y|start)$/.test(o.lockAxis) && (this.options.drag.lockAxis = o.lockAxis), /^(xy|x|y)$/.test(o.startAxis) && (this.options.drag.startAxis = o.startAxis), this) : z.bool(o) ? (this.options.drag.enabled = o, this) : this.options.drag;
      }, beforeMove: j, move: J, defaults: { startAxis: "xy", lockAxis: "xy" }, getCursor: function() {
        return "move";
      }, filterEventType: function(o) {
        return o.search("drag") === 0;
      } }, O = K, Z = { init: function(o) {
        var a = o;
        Z.document = a.document, Z.DocumentFragment = a.DocumentFragment || U, Z.SVGElement = a.SVGElement || U, Z.SVGSVGElement = a.SVGSVGElement || U, Z.SVGElementInstance = a.SVGElementInstance || U, Z.Element = a.Element || U, Z.HTMLElement = a.HTMLElement || Z.Element, Z.Event = a.Event, Z.Touch = a.Touch || U, Z.PointerEvent = a.PointerEvent || a.MSPointerEvent;
      }, document: null, DocumentFragment: null, SVGElement: null, SVGSVGElement: null, SVGElementInstance: null, Element: null, HTMLElement: null, Event: null, Touch: null, PointerEvent: null };
      function U() {
      }
      var $ = Z, G = { init: function(o) {
        var a = $.Element, r = o.navigator || {};
        G.supportsTouch = "ontouchstart" in o || z.func(o.DocumentTouch) && $.document instanceof o.DocumentTouch, G.supportsPointerEvent = r.pointerEnabled !== !1 && !!$.PointerEvent, G.isIOS = /iP(hone|od|ad)/.test(r.platform), G.isIOS7 = /iP(hone|od|ad)/.test(r.platform) && /OS 7[^\d]/.test(r.appVersion), G.isIe9 = /MSIE 9/.test(r.userAgent), G.isOperaMobile = r.appName === "Opera" && G.supportsTouch && /Presto/.test(r.userAgent), G.prefixedMatchesSelector = "matches" in a.prototype ? "matches" : "webkitMatchesSelector" in a.prototype ? "webkitMatchesSelector" : "mozMatchesSelector" in a.prototype ? "mozMatchesSelector" : "oMatchesSelector" in a.prototype ? "oMatchesSelector" : "msMatchesSelector", G.pEventTypes = G.supportsPointerEvent ? $.PointerEvent === o.MSPointerEvent ? { up: "MSPointerUp", down: "MSPointerDown", over: "mouseover", out: "mouseout", move: "MSPointerMove", cancel: "MSPointerCancel" } : { up: "pointerup", down: "pointerdown", over: "pointerover", out: "pointerout", move: "pointermove", cancel: "pointercancel" } : null, G.wheelEvent = $.document && "onmousewheel" in $.document ? "mousewheel" : "wheel";
      }, supportsTouch: null, supportsPointerEvent: null, isIOS7: null, isIOS: null, isIe9: null, isOperaMobile: null, prefixedMatchesSelector: null, pEventTypes: null, wheelEvent: null }, ue = G;
      function ie(o, a) {
        if (o.contains) return o.contains(a);
        for (; a; ) {
          if (a === o) return !0;
          a = a.parentNode;
        }
        return !1;
      }
      function Ee(o, a) {
        for (; z.element(o); ) {
          if (ge(o, a)) return o;
          o = ve(o);
        }
        return null;
      }
      function ve(o) {
        var a = o.parentNode;
        if (z.docFrag(a)) {
          for (; (a = a.host) && z.docFrag(a); ) ;
          return a;
        }
        return a;
      }
      function ge(o, a) {
        return V !== Q && (a = a.replace(/\/deep\//g, " ")), o[ue.prefixedMatchesSelector](a);
      }
      var le = function(o) {
        return o.parentNode || o.host;
      };
      function me(o, a) {
        for (var r, h = [], g = o; (r = le(g)) && g !== a && r !== g.ownerDocument; ) h.unshift(g), g = r;
        return h;
      }
      function Oe(o, a, r) {
        for (; z.element(o); ) {
          if (ge(o, a)) return !0;
          if ((o = ve(o)) === r) return ge(o, a);
        }
        return !1;
      }
      function xe(o) {
        return o.correspondingUseElement || o;
      }
      function ke(o) {
        var a = o instanceof $.SVGElement ? o.getBoundingClientRect() : o.getClientRects()[0];
        return a && { left: a.left, right: a.right, top: a.top, bottom: a.bottom, width: a.width || a.right - a.left, height: a.height || a.bottom - a.top };
      }
      function se(o) {
        var a, r = ke(o);
        if (!ue.isIOS7 && r) {
          var h = { x: (a = (a = A(o)) || V).scrollX || a.document.documentElement.scrollLeft, y: a.scrollY || a.document.documentElement.scrollTop };
          r.left += h.x, r.right += h.x, r.top += h.y, r.bottom += h.y;
        }
        return r;
      }
      function oe(o) {
        for (var a = []; o; ) a.push(o), o = ve(o);
        return a;
      }
      function Te(o) {
        return !!z.string(o) && ($.document.querySelector(o), !0);
      }
      function be(o, a) {
        for (var r in a) o[r] = a[r];
        return o;
      }
      function Le(o, a, r) {
        return o === "parent" ? ve(r) : o === "self" ? a.getRect(r) : Ee(r, o);
      }
      function Je(o, a, r, h) {
        var g = o;
        return z.string(g) ? g = Le(g, a, r) : z.func(g) && (g = g.apply(void 0, h)), z.element(g) && (g = se(g)), g;
      }
      function Ge(o) {
        return o && { x: "x" in o ? o.x : o.left, y: "y" in o ? o.y : o.top };
      }
      function vt(o) {
        return !o || "x" in o && "y" in o || ((o = be({}, o)).x = o.left || 0, o.y = o.top || 0, o.width = o.width || (o.right || 0) - o.x, o.height = o.height || (o.bottom || 0) - o.y), o;
      }
      function It(o, a, r) {
        o.left && (a.left += r.x), o.right && (a.right += r.x), o.top && (a.top += r.y), o.bottom && (a.bottom += r.y), a.width = a.right - a.left, a.height = a.bottom - a.top;
      }
      function ft(o, a, r) {
        var h = r && o.options[r];
        return Ge(Je(h && h.origin || o.options.origin, o, a, [o && a])) || { x: 0, y: 0 };
      }
      function Tt(o, a) {
        var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function(D) {
          return !0;
        }, h = arguments.length > 3 ? arguments[3] : void 0;
        if (h = h || {}, z.string(o) && o.search(" ") !== -1 && (o = ut(o)), z.array(o)) return o.forEach((function(D) {
          return Tt(D, a, r, h);
        })), h;
        if (z.object(o) && (a = o, o = ""), z.func(a) && r(o)) h[o] = h[o] || [], h[o].push(a);
        else if (z.array(a)) for (var g = 0, x = a; g < x.length; g++) {
          var S = x[g];
          Tt(o, S, r, h);
        }
        else if (z.object(a)) for (var _ in a)
          Tt(ut(_).map((function(D) {
            return "".concat(o).concat(D);
          })), a[_], r, h);
        return h;
      }
      function ut(o) {
        return o.trim().split(/ +/);
      }
      var At = function(o, a) {
        return Math.sqrt(o * o + a * a);
      }, jn = ["webkit", "moz"];
      function Wt(o, a) {
        o.__set || (o.__set = {});
        var r = function(g) {
          if (jn.some((function(x) {
            return g.indexOf(x) === 0;
          }))) return 1;
          typeof o[g] != "function" && g !== "__set" && Object.defineProperty(o, g, { get: function() {
            return g in o.__set ? o.__set[g] : o.__set[g] = a[g];
          }, set: function(x) {
            o.__set[g] = x;
          }, configurable: !0 });
        };
        for (var h in a) r(h);
        return o;
      }
      function ln(o, a) {
        o.page = o.page || {}, o.page.x = a.page.x, o.page.y = a.page.y, o.client = o.client || {}, o.client.x = a.client.x, o.client.y = a.client.y, o.timeStamp = a.timeStamp;
      }
      function Be(o) {
        o.page.x = 0, o.page.y = 0, o.client.x = 0, o.client.y = 0;
      }
      function ae(o) {
        return o instanceof $.Event || o instanceof $.Touch;
      }
      function Ie(o, a, r) {
        return o = o || "page", (r = r || {}).x = a[o + "X"], r.y = a[o + "Y"], r;
      }
      function _e(o, a) {
        return a = a || { x: 0, y: 0 }, ue.isOperaMobile && ae(o) ? (Ie("screen", o, a), a.x += window.scrollX, a.y += window.scrollY) : Ie("page", o, a), a;
      }
      function je(o) {
        return z.number(o.pointerId) ? o.pointerId : o.identifier;
      }
      function ct(o, a, r) {
        var h = a.length > 1 ? qe(a) : a[0];
        _e(h, o.page), (function(g, x) {
          x = x || {}, ue.isOperaMobile && ae(g) ? Ie("screen", g, x) : Ie("client", g, x);
        })(h, o.client), o.timeStamp = r;
      }
      function Ye(o) {
        var a = [];
        return z.array(o) ? (a[0] = o[0], a[1] = o[1]) : o.type === "touchend" ? o.touches.length === 1 ? (a[0] = o.touches[0], a[1] = o.changedTouches[0]) : o.touches.length === 0 && (a[0] = o.changedTouches[0], a[1] = o.changedTouches[1]) : (a[0] = o.touches[0], a[1] = o.touches[1]), a;
      }
      function qe(o) {
        for (var a = { pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0 }, r = 0; r < o.length; r++) {
          var h = o[r];
          for (var g in a) a[g] += h[g];
        }
        for (var x in a) a[x] /= o.length;
        return a;
      }
      function et(o) {
        if (!o.length) return null;
        var a = Ye(o), r = Math.min(a[0].pageX, a[1].pageX), h = Math.min(a[0].pageY, a[1].pageY), g = Math.max(a[0].pageX, a[1].pageX), x = Math.max(a[0].pageY, a[1].pageY);
        return { x: r, y: h, left: r, top: h, right: g, bottom: x, width: g - r, height: x - h };
      }
      function it(o, a) {
        var r = a + "X", h = a + "Y", g = Ye(o), x = g[0][r] - g[1][r], S = g[0][h] - g[1][h];
        return At(x, S);
      }
      function lt(o, a) {
        var r = a + "X", h = a + "Y", g = Ye(o), x = g[1][r] - g[0][r], S = g[1][h] - g[0][h];
        return 180 * Math.atan2(S, x) / Math.PI;
      }
      function St(o) {
        return z.string(o.pointerType) ? o.pointerType : z.number(o.pointerType) ? [void 0, void 0, "touch", "pen", "mouse"][o.pointerType] : /touch/.test(o.type || "") || o instanceof $.Touch ? "touch" : "mouse";
      }
      function qt(o) {
        var a = z.func(o.composedPath) ? o.composedPath() : o.path;
        return [xe(a ? a[0] : o.target), xe(o.currentTarget)];
      }
      var Yt = (function() {
        function o(a) {
          s(this, o), this.immediatePropagationStopped = !1, this.propagationStopped = !1, this._interaction = a;
        }
        return c(o, [{ key: "preventDefault", value: function() {
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }]), o;
      })();
      Object.defineProperty(Yt.prototype, "interaction", { get: function() {
        return this._interaction._proxy;
      }, set: function() {
      } });
      var fn = function(o, a) {
        for (var r = 0; r < a.length; r++) {
          var h = a[r];
          o.push(h);
        }
        return o;
      }, sn = function(o) {
        return fn([], o);
      }, Kt = function(o, a) {
        for (var r = 0; r < o.length; r++) if (a(o[r], r, o)) return r;
        return -1;
      }, zt = function(o, a) {
        return o[Kt(o, a)];
      }, Xt = (function(o) {
        p(r, o);
        var a = C(r);
        function r(h, g, x) {
          var S;
          s(this, r), (S = a.call(this, g._interaction)).dropzone = void 0, S.dragEvent = void 0, S.relatedTarget = void 0, S.draggable = void 0, S.propagationStopped = !1, S.immediatePropagationStopped = !1;
          var _ = x === "dragleave" ? h.prev : h.cur, D = _.element, W = _.dropzone;
          return S.type = x, S.target = D, S.currentTarget = D, S.dropzone = W, S.dragEvent = g, S.relatedTarget = g.target, S.draggable = g.interactable, S.timeStamp = g.timeStamp, S;
        }
        return c(r, [{ key: "reject", value: function() {
          var h = this, g = this._interaction.dropState;
          if (this.type === "dropactivate" || this.dropzone && g.cur.dropzone === this.dropzone && g.cur.element === this.target) if (g.prev.dropzone = this.dropzone, g.prev.element = this.target, g.rejected = !0, g.events.enter = null, this.stopImmediatePropagation(), this.type === "dropactivate") {
            var x = g.activeDrops, S = Kt(x, (function(D) {
              var W = D.dropzone, L = D.element;
              return W === h.dropzone && L === h.target;
            }));
            g.activeDrops.splice(S, 1);
            var _ = new r(g, this.dragEvent, "dropdeactivate");
            _.dropzone = this.dropzone, _.target = this.target, this.dropzone.fire(_);
          } else this.dropzone.fire(new r(g, this.dragEvent, "dragleave"));
        } }, { key: "preventDefault", value: function() {
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }]), r;
      })(Yt);
      function mt(o, a) {
        for (var r = 0, h = o.slice(); r < h.length; r++) {
          var g = h[r], x = g.dropzone, S = g.element;
          a.dropzone = x, a.target = S, x.fire(a), a.propagationStopped = a.immediatePropagationStopped = !1;
        }
      }
      function Ft(o, a) {
        for (var r = (function(x, S) {
          for (var _ = [], D = 0, W = x.interactables.list; D < W.length; D++) {
            var L = W[D];
            if (L.options.drop.enabled) {
              var X = L.options.drop.accept;
              if (!(z.element(X) && X !== S || z.string(X) && !ge(S, X) || z.func(X) && !X({ dropzone: L, draggableElement: S }))) for (var ne = 0, de = L.getAllElements(); ne < de.length; ne++) {
                var he = de[ne];
                he !== S && _.push({ dropzone: L, element: he, rect: L.getRect(he) });
              }
            }
          }
          return _;
        })(o, a), h = 0; h < r.length; h++) {
          var g = r[h];
          g.rect = g.dropzone.getRect(g.element);
        }
        return r;
      }
      function bt(o, a, r) {
        for (var h = o.dropState, g = o.interactable, x = o.element, S = [], _ = 0, D = h.activeDrops; _ < D.length; _++) {
          var W = D[_], L = W.dropzone, X = W.element, ne = W.rect, de = L.dropCheck(a, r, g, x, X, ne);
          S.push(de ? X : null);
        }
        var he = (function(pe) {
          for (var we, Se, Pe, Ve = [], Ke = 0; Ke < pe.length; Ke++) {
            var Re = pe[Ke], We = pe[we];
            if (Re && Ke !== we) if (We) {
              var ht = le(Re), rt = le(We);
              if (ht !== Re.ownerDocument) if (rt !== Re.ownerDocument) if (ht !== rt) {
                Ve = Ve.length ? Ve : me(We);
                var yt = void 0;
                if (We instanceof $.HTMLElement && Re instanceof $.SVGElement && !(Re instanceof $.SVGSVGElement)) {
                  if (Re === rt) continue;
                  yt = Re.ownerSVGElement;
                } else yt = Re;
                for (var Ct = me(yt, We.ownerDocument), Vt = 0; Ct[Vt] && Ct[Vt] === Ve[Vt]; ) Vt++;
                var Xn = [Ct[Vt - 1], Ct[Vt], Ve[Vt]];
                if (Xn[0]) for (var bn = Xn[0].lastChild; bn; ) {
                  if (bn === Xn[1]) {
                    we = Ke, Ve = Ct;
                    break;
                  }
                  if (bn === Xn[2]) break;
                  bn = bn.previousSibling;
                }
              } else Pe = We, (parseInt(A(Se = Re).getComputedStyle(Se).zIndex, 10) || 0) >= (parseInt(A(Pe).getComputedStyle(Pe).zIndex, 10) || 0) && (we = Ke);
              else we = Ke;
            } else we = Ke;
          }
          return we;
        })(S);
        return h.activeDrops[he] || null;
      }
      function Pt(o, a, r) {
        var h = o.dropState, g = { enter: null, leave: null, activate: null, deactivate: null, move: null, drop: null };
        return r.type === "dragstart" && (g.activate = new Xt(h, r, "dropactivate"), g.activate.target = null, g.activate.dropzone = null), r.type === "dragend" && (g.deactivate = new Xt(h, r, "dropdeactivate"), g.deactivate.target = null, g.deactivate.dropzone = null), h.rejected || (h.cur.element !== h.prev.element && (h.prev.dropzone && (g.leave = new Xt(h, r, "dragleave"), r.dragLeave = g.leave.target = h.prev.element, r.prevDropzone = g.leave.dropzone = h.prev.dropzone), h.cur.dropzone && (g.enter = new Xt(h, r, "dragenter"), r.dragEnter = h.cur.element, r.dropzone = h.cur.dropzone)), r.type === "dragend" && h.cur.dropzone && (g.drop = new Xt(h, r, "drop"), r.dropzone = h.cur.dropzone, r.relatedTarget = h.cur.element), r.type === "dragmove" && h.cur.dropzone && (g.move = new Xt(h, r, "dropmove"), r.dropzone = h.cur.dropzone)), g;
      }
      function Qt(o, a) {
        var r = o.dropState, h = r.activeDrops, g = r.cur, x = r.prev;
        a.leave && x.dropzone.fire(a.leave), a.enter && g.dropzone.fire(a.enter), a.move && g.dropzone.fire(a.move), a.drop && g.dropzone.fire(a.drop), a.deactivate && mt(h, a.deactivate), r.prev.dropzone = g.dropzone, r.prev.element = g.element;
      }
      function Sn(o, a) {
        var r = o.interaction, h = o.iEvent, g = o.event;
        if (h.type === "dragmove" || h.type === "dragend") {
          var x = r.dropState;
          a.dynamicDrop && (x.activeDrops = Ft(a, r.element));
          var S = h, _ = bt(r, S, g);
          x.rejected = x.rejected && !!_ && _.dropzone === x.cur.dropzone && _.element === x.cur.element, x.cur.dropzone = _ && _.dropzone, x.cur.element = _ && _.element, x.events = Pt(r, 0, S);
        }
      }
      var De = { id: "actions/drop", install: function(o) {
        var a = o.actions, r = o.interactStatic, h = o.Interactable, g = o.defaults;
        o.usePlugin(O), h.prototype.dropzone = function(x) {
          return (function(S, _) {
            if (z.object(_)) {
              if (S.options.drop.enabled = _.enabled !== !1, _.listeners) {
                var D = Tt(_.listeners), W = Object.keys(D).reduce((function(X, ne) {
                  return X[/^(enter|leave)/.test(ne) ? "drag".concat(ne) : /^(activate|deactivate|move)/.test(ne) ? "drop".concat(ne) : ne] = D[ne], X;
                }), {}), L = S.options.drop.listeners;
                L && S.off(L), S.on(W), S.options.drop.listeners = W;
              }
              return z.func(_.ondrop) && S.on("drop", _.ondrop), z.func(_.ondropactivate) && S.on("dropactivate", _.ondropactivate), z.func(_.ondropdeactivate) && S.on("dropdeactivate", _.ondropdeactivate), z.func(_.ondragenter) && S.on("dragenter", _.ondragenter), z.func(_.ondragleave) && S.on("dragleave", _.ondragleave), z.func(_.ondropmove) && S.on("dropmove", _.ondropmove), /^(pointer|center)$/.test(_.overlap) ? S.options.drop.overlap = _.overlap : z.number(_.overlap) && (S.options.drop.overlap = Math.max(Math.min(1, _.overlap), 0)), "accept" in _ && (S.options.drop.accept = _.accept), "checker" in _ && (S.options.drop.checker = _.checker), S;
            }
            return z.bool(_) ? (S.options.drop.enabled = _, S) : S.options.drop;
          })(this, x);
        }, h.prototype.dropCheck = function(x, S, _, D, W, L) {
          return (function(X, ne, de, he, pe, we, Se) {
            var Pe = !1;
            if (!(Se = Se || X.getRect(we))) return !!X.options.drop.checker && X.options.drop.checker(ne, de, Pe, X, we, he, pe);
            var Ve = X.options.drop.overlap;
            if (Ve === "pointer") {
              var Ke = ft(he, pe, "drag"), Re = _e(ne);
              Re.x += Ke.x, Re.y += Ke.y;
              var We = Re.x > Se.left && Re.x < Se.right, ht = Re.y > Se.top && Re.y < Se.bottom;
              Pe = We && ht;
            }
            var rt = he.getRect(pe);
            if (rt && Ve === "center") {
              var yt = rt.left + rt.width / 2, Ct = rt.top + rt.height / 2;
              Pe = yt >= Se.left && yt <= Se.right && Ct >= Se.top && Ct <= Se.bottom;
            }
            return rt && z.number(Ve) && (Pe = Math.max(0, Math.min(Se.right, rt.right) - Math.max(Se.left, rt.left)) * Math.max(0, Math.min(Se.bottom, rt.bottom) - Math.max(Se.top, rt.top)) / (rt.width * rt.height) >= Ve), X.options.drop.checker && (Pe = X.options.drop.checker(ne, de, Pe, X, we, he, pe)), Pe;
          })(this, x, S, _, D, W, L);
        }, r.dynamicDrop = function(x) {
          return z.bool(x) ? (o.dynamicDrop = x, r) : o.dynamicDrop;
        }, be(a.phaselessTypes, { dragenter: !0, dragleave: !0, dropactivate: !0, dropdeactivate: !0, dropmove: !0, drop: !0 }), a.methodDict.drop = "dropzone", o.dynamicDrop = !1, g.actions.drop = De.defaults;
      }, listeners: { "interactions:before-action-start": function(o) {
        var a = o.interaction;
        a.prepared.name === "drag" && (a.dropState = { cur: { dropzone: null, element: null }, prev: { dropzone: null, element: null }, rejected: null, events: null, activeDrops: [] });
      }, "interactions:after-action-start": function(o, a) {
        var r = o.interaction, h = (o.event, o.iEvent);
        if (r.prepared.name === "drag") {
          var g = r.dropState;
          g.activeDrops = [], g.events = {}, g.activeDrops = Ft(a, r.element), g.events = Pt(r, 0, h), g.events.activate && (mt(g.activeDrops, g.events.activate), a.fire("actions/drop:start", { interaction: r, dragEvent: h }));
        }
      }, "interactions:action-move": Sn, "interactions:after-action-move": function(o, a) {
        var r = o.interaction, h = o.iEvent;
        if (r.prepared.name === "drag") {
          var g = r.dropState;
          Qt(r, g.events), a.fire("actions/drop:move", { interaction: r, dragEvent: h }), g.events = {};
        }
      }, "interactions:action-end": function(o, a) {
        if (o.interaction.prepared.name === "drag") {
          var r = o.interaction, h = o.iEvent;
          Sn(o, a), Qt(r, r.dropState.events), a.fire("actions/drop:end", { interaction: r, dragEvent: h });
        }
      }, "interactions:stop": function(o) {
        var a = o.interaction;
        if (a.prepared.name === "drag") {
          var r = a.dropState;
          r && (r.activeDrops = null, r.events = null, r.cur.dropzone = null, r.cur.element = null, r.prev.dropzone = null, r.prev.element = null, r.rejected = !1);
        }
      } }, getActiveDrops: Ft, getDrop: bt, getDropEvents: Pt, fireDropEvents: Qt, filterEventType: function(o) {
        return o.search("drag") === 0 || o.search("drop") === 0;
      }, defaults: { enabled: !1, accept: null, overlap: "pointer" } }, rn = De;
      function Rt(o) {
        var a = o.interaction, r = o.iEvent, h = o.phase;
        if (a.prepared.name === "gesture") {
          var g = a.pointers.map((function(W) {
            return W.pointer;
          })), x = h === "start", S = h === "end", _ = a.interactable.options.deltaSource;
          if (r.touches = [g[0], g[1]], x) r.distance = it(g, _), r.box = et(g), r.scale = 1, r.ds = 0, r.angle = lt(g, _), r.da = 0, a.gesture.startDistance = r.distance, a.gesture.startAngle = r.angle;
          else if (S || a.pointers.length < 2) {
            var D = a.prevEvent;
            r.distance = D.distance, r.box = D.box, r.scale = D.scale, r.ds = 0, r.angle = D.angle, r.da = 0;
          } else r.distance = it(g, _), r.box = et(g), r.scale = r.distance / a.gesture.startDistance, r.angle = lt(g, _), r.ds = r.scale - a.gesture.scale, r.da = r.angle - a.gesture.angle;
          a.gesture.distance = r.distance, a.gesture.angle = r.angle, z.number(r.scale) && r.scale !== 1 / 0 && !isNaN(r.scale) && (a.gesture.scale = r.scale);
        }
      }
      var hn = { id: "actions/gesture", before: ["actions/drag", "actions/resize"], install: function(o) {
        var a = o.actions, r = o.Interactable, h = o.defaults;
        r.prototype.gesturable = function(g) {
          return z.object(g) ? (this.options.gesture.enabled = g.enabled !== !1, this.setPerAction("gesture", g), this.setOnEvents("gesture", g), this) : z.bool(g) ? (this.options.gesture.enabled = g, this) : this.options.gesture;
        }, a.map.gesture = hn, a.methodDict.gesture = "gesturable", h.actions.gesture = hn.defaults;
      }, listeners: { "interactions:action-start": Rt, "interactions:action-move": Rt, "interactions:action-end": Rt, "interactions:new": function(o) {
        o.interaction.gesture = { angle: 0, distance: 0, scale: 1, startAngle: 0, startDistance: 0 };
      }, "auto-start:check": function(o) {
        if (!(o.interaction.pointers.length < 2)) {
          var a = o.interactable.options.gesture;
          if (a && a.enabled) return o.action = { name: "gesture" }, !1;
        }
      } }, defaults: {}, getCursor: function() {
        return "";
      }, filterEventType: function(o) {
        return o.search("gesture") === 0;
      } }, $i = hn;
      function Ei(o, a, r, h, g, x, S) {
        if (!a) return !1;
        if (a === !0) {
          var _ = z.number(x.width) ? x.width : x.right - x.left, D = z.number(x.height) ? x.height : x.bottom - x.top;
          if (S = Math.min(S, Math.abs((o === "left" || o === "right" ? _ : D) / 2)), _ < 0 && (o === "left" ? o = "right" : o === "right" && (o = "left")), D < 0 && (o === "top" ? o = "bottom" : o === "bottom" && (o = "top")), o === "left") {
            var W = _ >= 0 ? x.left : x.right;
            return r.x < W + S;
          }
          if (o === "top") {
            var L = D >= 0 ? x.top : x.bottom;
            return r.y < L + S;
          }
          if (o === "right") return r.x > (_ >= 0 ? x.right : x.left) - S;
          if (o === "bottom") return r.y > (D >= 0 ? x.bottom : x.top) - S;
        }
        return !!z.element(h) && (z.element(a) ? a === h : Oe(h, a, g));
      }
      function gn(o) {
        var a = o.iEvent, r = o.interaction;
        if (r.prepared.name === "resize" && r.resizeAxes) {
          var h = a;
          r.interactable.options.resize.square ? (r.resizeAxes === "y" ? h.delta.x = h.delta.y : h.delta.y = h.delta.x, h.axes = "xy") : (h.axes = r.resizeAxes, r.resizeAxes === "x" ? h.delta.y = 0 : r.resizeAxes === "y" && (h.delta.x = 0));
        }
      }
      var un, yn, Dn = { id: "actions/resize", before: ["actions/drag"], install: function(o) {
        var a = o.actions, r = o.browser, h = o.Interactable, g = o.defaults;
        Dn.cursors = (function(x) {
          return x.isIe9 ? { x: "e-resize", y: "s-resize", xy: "se-resize", top: "n-resize", left: "w-resize", bottom: "s-resize", right: "e-resize", topleft: "se-resize", bottomright: "se-resize", topright: "ne-resize", bottomleft: "ne-resize" } : { x: "ew-resize", y: "ns-resize", xy: "nwse-resize", top: "ns-resize", left: "ew-resize", bottom: "ns-resize", right: "ew-resize", topleft: "nwse-resize", bottomright: "nwse-resize", topright: "nesw-resize", bottomleft: "nesw-resize" };
        })(r), Dn.defaultMargin = r.supportsTouch || r.supportsPointerEvent ? 20 : 10, h.prototype.resizable = function(x) {
          return (function(S, _, D) {
            return z.object(_) ? (S.options.resize.enabled = _.enabled !== !1, S.setPerAction("resize", _), S.setOnEvents("resize", _), z.string(_.axis) && /^x$|^y$|^xy$/.test(_.axis) ? S.options.resize.axis = _.axis : _.axis === null && (S.options.resize.axis = D.defaults.actions.resize.axis), z.bool(_.preserveAspectRatio) ? S.options.resize.preserveAspectRatio = _.preserveAspectRatio : z.bool(_.square) && (S.options.resize.square = _.square), S) : z.bool(_) ? (S.options.resize.enabled = _, S) : S.options.resize;
          })(this, x, o);
        }, a.map.resize = Dn, a.methodDict.resize = "resizable", g.actions.resize = Dn.defaults;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.resizeAxes = "xy";
      }, "interactions:action-start": function(o) {
        (function(a) {
          var r = a.iEvent, h = a.interaction;
          if (h.prepared.name === "resize" && h.prepared.edges) {
            var g = r, x = h.rect;
            h._rects = { start: be({}, x), corrected: be({}, x), previous: be({}, x), delta: { left: 0, right: 0, width: 0, top: 0, bottom: 0, height: 0 } }, g.edges = h.prepared.edges, g.rect = h._rects.corrected, g.deltaRect = h._rects.delta;
          }
        })(o), gn(o);
      }, "interactions:action-move": function(o) {
        (function(a) {
          var r = a.iEvent, h = a.interaction;
          if (h.prepared.name === "resize" && h.prepared.edges) {
            var g = r, x = h.interactable.options.resize.invert, S = x === "reposition" || x === "negate", _ = h.rect, D = h._rects, W = D.start, L = D.corrected, X = D.delta, ne = D.previous;
            if (be(ne, L), S) {
              if (be(L, _), x === "reposition") {
                if (L.top > L.bottom) {
                  var de = L.top;
                  L.top = L.bottom, L.bottom = de;
                }
                if (L.left > L.right) {
                  var he = L.left;
                  L.left = L.right, L.right = he;
                }
              }
            } else L.top = Math.min(_.top, W.bottom), L.bottom = Math.max(_.bottom, W.top), L.left = Math.min(_.left, W.right), L.right = Math.max(_.right, W.left);
            for (var pe in L.width = L.right - L.left, L.height = L.bottom - L.top, L) X[pe] = L[pe] - ne[pe];
            g.edges = h.prepared.edges, g.rect = L, g.deltaRect = X;
          }
        })(o), gn(o);
      }, "interactions:action-end": function(o) {
        var a = o.iEvent, r = o.interaction;
        if (r.prepared.name === "resize" && r.prepared.edges) {
          var h = a;
          h.edges = r.prepared.edges, h.rect = r._rects.corrected, h.deltaRect = r._rects.delta;
        }
      }, "auto-start:check": function(o) {
        var a = o.interaction, r = o.interactable, h = o.element, g = o.rect, x = o.buttons;
        if (g) {
          var S = be({}, a.coords.cur.page), _ = r.options.resize;
          if (_ && _.enabled && (!a.pointerIsDown || !/mouse|pointer/.test(a.pointerType) || (x & _.mouseButtons) != 0)) {
            if (z.object(_.edges)) {
              var D = { left: !1, right: !1, top: !1, bottom: !1 };
              for (var W in D) D[W] = Ei(W, _.edges[W], S, a._latestPointer.eventTarget, h, g, _.margin || Dn.defaultMargin);
              D.left = D.left && !D.right, D.top = D.top && !D.bottom, (D.left || D.right || D.top || D.bottom) && (o.action = { name: "resize", edges: D });
            } else {
              var L = _.axis !== "y" && S.x > g.right - Dn.defaultMargin, X = _.axis !== "x" && S.y > g.bottom - Dn.defaultMargin;
              (L || X) && (o.action = { name: "resize", axes: (L ? "x" : "") + (X ? "y" : "") });
            }
            return !o.action && void 0;
          }
        }
      } }, defaults: { square: !1, preserveAspectRatio: !1, axis: "xy", margin: NaN, edges: null, invert: "none" }, cursors: null, getCursor: function(o) {
        var a = o.edges, r = o.axis, h = o.name, g = Dn.cursors, x = null;
        if (r) x = g[h + r];
        else if (a) {
          for (var S = "", _ = 0, D = ["top", "bottom", "left", "right"]; _ < D.length; _++) {
            var W = D[_];
            a[W] && (S += W);
          }
          x = g[S];
        }
        return x;
      }, filterEventType: function(o) {
        return o.search("resize") === 0;
      }, defaultMargin: null }, Bo = Dn, Va = { id: "actions", install: function(o) {
        o.usePlugin($i), o.usePlugin(Bo), o.usePlugin(O), o.usePlugin(rn);
      } }, Ho = 0, cn = { request: function(o) {
        return un(o);
      }, cancel: function(o) {
        return yn(o);
      }, init: function(o) {
        if (un = o.requestAnimationFrame, yn = o.cancelAnimationFrame, !un) for (var a = ["ms", "moz", "webkit", "o"], r = 0; r < a.length; r++) {
          var h = a[r];
          un = o["".concat(h, "RequestAnimationFrame")], yn = o["".concat(h, "CancelAnimationFrame")] || o["".concat(h, "CancelRequestAnimationFrame")];
        }
        un = un && un.bind(o), yn = yn && yn.bind(o), un || (un = function(g) {
          var x = Date.now(), S = Math.max(0, 16 - (x - Ho)), _ = o.setTimeout((function() {
            g(x + S);
          }), S);
          return Ho = x + S, _;
        }, yn = function(g) {
          return clearTimeout(g);
        });
      } }, Ue = { defaults: { enabled: !1, margin: 60, container: null, speed: 300 }, now: Date.now, interaction: null, i: 0, x: 0, y: 0, isScrolling: !1, prevTime: 0, margin: 0, speed: 0, start: function(o) {
        Ue.isScrolling = !0, cn.cancel(Ue.i), o.autoScroll = Ue, Ue.interaction = o, Ue.prevTime = Ue.now(), Ue.i = cn.request(Ue.scroll);
      }, stop: function() {
        Ue.isScrolling = !1, Ue.interaction && (Ue.interaction.autoScroll = null), cn.cancel(Ue.i);
      }, scroll: function() {
        var o = Ue.interaction, a = o.interactable, r = o.element, h = o.prepared.name, g = a.options[h].autoScroll, x = Ii(g.container, a, r), S = Ue.now(), _ = (S - Ue.prevTime) / 1e3, D = g.speed * _;
        if (D >= 1) {
          var W = { x: Ue.x * D, y: Ue.y * D };
          if (W.x || W.y) {
            var L = so(x);
            z.window(x) ? x.scrollBy(W.x, W.y) : x && (x.scrollLeft += W.x, x.scrollTop += W.y);
            var X = so(x), ne = { x: X.x - L.x, y: X.y - L.y };
            (ne.x || ne.y) && a.fire({ type: "autoscroll", target: r, interactable: a, delta: ne, interaction: o, container: x });
          }
          Ue.prevTime = S;
        }
        Ue.isScrolling && (cn.cancel(Ue.i), Ue.i = cn.request(Ue.scroll));
      }, check: function(o, a) {
        var r;
        return (r = o.options[a].autoScroll) == null ? void 0 : r.enabled;
      }, onInteractionMove: function(o) {
        var a = o.interaction, r = o.pointer;
        if (a.interacting() && Ue.check(a.interactable, a.prepared.name)) if (a.simulation) Ue.x = Ue.y = 0;
        else {
          var h, g, x, S, _ = a.interactable, D = a.element, W = a.prepared.name, L = _.options[W].autoScroll, X = Ii(L.container, _, D);
          if (z.window(X)) S = r.clientX < Ue.margin, h = r.clientY < Ue.margin, g = r.clientX > X.innerWidth - Ue.margin, x = r.clientY > X.innerHeight - Ue.margin;
          else {
            var ne = ke(X);
            S = r.clientX < ne.left + Ue.margin, h = r.clientY < ne.top + Ue.margin, g = r.clientX > ne.right - Ue.margin, x = r.clientY > ne.bottom - Ue.margin;
          }
          Ue.x = g ? 1 : S ? -1 : 0, Ue.y = x ? 1 : h ? -1 : 0, Ue.isScrolling || (Ue.margin = L.margin, Ue.speed = L.speed, Ue.start(a));
        }
      } };
      function Ii(o, a, r) {
        return (z.string(o) ? Le(o, a, r) : o) || A(r);
      }
      function so(o) {
        return z.window(o) && (o = window.document.body), { x: o.scrollLeft, y: o.scrollTop };
      }
      var oi = { id: "auto-scroll", install: function(o) {
        var a = o.defaults, r = o.actions;
        o.autoScroll = Ue, Ue.now = function() {
          return o.now();
        }, r.phaselessTypes.autoscroll = !0, a.perAction.autoScroll = Ue.defaults;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.autoScroll = null;
      }, "interactions:destroy": function(o) {
        o.interaction.autoScroll = null, Ue.stop(), Ue.interaction && (Ue.interaction = null);
      }, "interactions:stop": Ue.stop, "interactions:action-move": function(o) {
        return Ue.onInteractionMove(o);
      } } }, Jt = oi;
      function Ot(o, a) {
        var r = !1;
        return function() {
          return r || (V.console.warn(a), r = !0), o.apply(this, arguments);
        };
      }
      function Bt(o, a) {
        return o.name = a.name, o.axis = a.axis, o.edges = a.edges, o;
      }
      function _l(o) {
        return z.bool(o) ? (this.options.styleCursor = o, this) : o === null ? (delete this.options.styleCursor, this) : this.options.styleCursor;
      }
      function kn(o) {
        return z.func(o) ? (this.options.actionChecker = o, this) : o === null ? (delete this.options.actionChecker, this) : this.options.actionChecker;
      }
      var Ji = { id: "auto-start/interactableMethods", install: function(o) {
        var a = o.Interactable;
        a.prototype.getAction = function(r, h, g, x) {
          var S = (function(_, D, W, L, X) {
            var ne = _.getRect(L), de = D.buttons || { 0: 1, 1: 4, 3: 8, 4: 16 }[D.button], he = { action: null, interactable: _, interaction: W, element: L, rect: ne, buttons: de };
            return X.fire("auto-start:check", he), he.action;
          })(this, h, g, x, o);
          return this.options.actionChecker ? this.options.actionChecker(r, h, S, this, x, g) : S;
        }, a.prototype.ignoreFrom = Ot((function(r) {
          return this._backCompatOption("ignoreFrom", r);
        }), "Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."), a.prototype.allowFrom = Ot((function(r) {
          return this._backCompatOption("allowFrom", r);
        }), "Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."), a.prototype.actionChecker = kn, a.prototype.styleCursor = _l;
      } };
      function ro(o, a, r, h, g) {
        return a.testIgnoreAllow(a.options[o.name], r, h) && a.options[o.name].enabled && Ai(a, r, o, g) ? o : null;
      }
      function uo(o, a, r, h, g, x, S) {
        for (var _ = 0, D = h.length; _ < D; _++) {
          var W = h[_], L = g[_], X = W.getAction(a, r, o, L);
          if (X) {
            var ne = ro(X, W, L, x, S);
            if (ne) return { action: ne, interactable: W, element: L };
          }
        }
        return { action: null, interactable: null, element: null };
      }
      function Zi(o, a, r, h, g) {
        var x = [], S = [], _ = h;
        function D(L) {
          x.push(L), S.push(_);
        }
        for (; z.element(_); ) {
          x = [], S = [], g.interactables.forEachMatch(_, D);
          var W = uo(o, a, r, x, S, h, g);
          if (W.action && !W.interactable.options[W.action.name].manualStart) return W;
          _ = ve(_);
        }
        return { action: null, interactable: null, element: null };
      }
      function gi(o, a, r) {
        var h = a.action, g = a.interactable, x = a.element;
        h = h || { name: null }, o.interactable = g, o.element = x, Bt(o.prepared, h), o.rect = g && h.name ? g.getRect(x) : null, zl(o, r), r.fire("autoStart:prepared", { interaction: o });
      }
      function Ai(o, a, r, h) {
        var g = o.options, x = g[r.name].max, S = g[r.name].maxPerElement, _ = h.autoStart.maxInteractions, D = 0, W = 0, L = 0;
        if (!(x && S && _)) return !1;
        for (var X = 0, ne = h.interactions.list; X < ne.length; X++) {
          var de = ne[X], he = de.prepared.name;
          if (de.interacting() && (++D >= _ || de.interactable === o && ((W += he === r.name ? 1 : 0) >= x || de.element === a && (L++, he === r.name && L >= S))))
            return !1;
        }
        return _ > 0;
      }
      function Ml(o, a) {
        return z.number(o) ? (a.autoStart.maxInteractions = o, this) : a.autoStart.maxInteractions;
      }
      function el(o, a, r) {
        var h = r.autoStart.cursorElement;
        h && h !== o && (h.style.cursor = ""), o.ownerDocument.documentElement.style.cursor = a, o.style.cursor = a, r.autoStart.cursorElement = a ? o : null;
      }
      function zl(o, a) {
        var r = o.interactable, h = o.element, g = o.prepared;
        if (o.pointerType === "mouse" && r && r.options.styleCursor) {
          var x = "";
          if (g.name) {
            var S = r.options[g.name].cursorChecker;
            x = z.func(S) ? S(g, r, h, o._interacting) : a.actions.map[g.name].getCursor(g);
          }
          el(o.element, x || "", a);
        } else a.autoStart.cursorElement && el(a.autoStart.cursorElement, "", a);
      }
      var co = { id: "auto-start/base", before: ["actions"], install: function(o) {
        var a = o.interactStatic, r = o.defaults;
        o.usePlugin(Ji), r.base.actionChecker = null, r.base.styleCursor = !0, be(r.perAction, { manualStart: !1, max: 1 / 0, maxPerElement: 1, allowFrom: null, ignoreFrom: null, mouseButtons: 1 }), a.maxInteractions = function(h) {
          return Ml(h, o);
        }, o.autoStart = { maxInteractions: 1 / 0, withinInteractionLimit: Ai, cursorElement: null };
      }, listeners: { "interactions:down": function(o, a) {
        var r = o.interaction, h = o.pointer, g = o.event, x = o.eventTarget;
        r.interacting() || gi(r, Zi(r, h, g, x, a), a);
      }, "interactions:move": function(o, a) {
        (function(r, h) {
          var g = r.interaction, x = r.pointer, S = r.event, _ = r.eventTarget;
          g.pointerType !== "mouse" || g.pointerIsDown || g.interacting() || gi(g, Zi(g, x, S, _, h), h);
        })(o, a), (function(r, h) {
          var g = r.interaction;
          if (g.pointerIsDown && !g.interacting() && g.pointerWasMoved && g.prepared.name) {
            h.fire("autoStart:before-start", r);
            var x = g.interactable, S = g.prepared.name;
            S && x && (x.options[S].manualStart || !Ai(x, g.element, g.prepared, h) ? g.stop() : (g.start(g.prepared, x, g.element), zl(g, h)));
          }
        })(o, a);
      }, "interactions:stop": function(o, a) {
        var r = o.interaction, h = r.interactable;
        h && h.options.styleCursor && el(r.element, "", a);
      } }, maxInteractions: Ml, withinInteractionLimit: Ai, validateAction: ro }, tl = co, fo = { id: "auto-start/dragAxis", listeners: { "autoStart:before-start": function(o, a) {
        var r = o.interaction, h = o.eventTarget, g = o.dx, x = o.dy;
        if (r.prepared.name === "drag") {
          var S = Math.abs(g), _ = Math.abs(x), D = r.interactable.options.drag, W = D.startAxis, L = S > _ ? "x" : S < _ ? "y" : "xy";
          if (r.prepared.axis = D.lockAxis === "start" ? L[0] : D.lockAxis, L !== "xy" && W !== "xy" && W !== L) {
            r.prepared.name = null;
            for (var X = h, ne = function(he) {
              if (he !== r.interactable) {
                var pe = r.interactable.options.drag;
                if (!pe.manualStart && he.testIgnoreAllow(pe, X, h)) {
                  var we = he.getAction(r.downPointer, r.downEvent, r, X);
                  if (we && we.name === "drag" && (function(Se, Pe) {
                    if (!Pe) return !1;
                    var Ve = Pe.options.drag.startAxis;
                    return Se === "xy" || Ve === "xy" || Ve === Se;
                  })(L, he) && tl.validateAction(we, he, X, h, a)) return he;
                }
              }
            }; z.element(X); ) {
              var de = a.interactables.forEachMatch(X, ne);
              if (de) {
                r.prepared.name = "drag", r.interactable = de, r.element = X;
                break;
              }
              X = ve(X);
            }
          }
        }
      } } };
      function Cn(o) {
        var a = o.prepared && o.prepared.name;
        if (!a) return null;
        var r = o.interactable.options;
        return r[a].hold || r[a].delay;
      }
      var Wo = { id: "auto-start/hold", install: function(o) {
        var a = o.defaults;
        o.usePlugin(tl), a.perAction.hold = 0, a.perAction.delay = 0;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.autoStartHoldTimer = null;
      }, "autoStart:prepared": function(o) {
        var a = o.interaction, r = Cn(a);
        r > 0 && (a.autoStartHoldTimer = setTimeout((function() {
          a.start(a.prepared, a.interactable, a.element);
        }), r));
      }, "interactions:move": function(o) {
        var a = o.interaction, r = o.duplicate;
        a.autoStartHoldTimer && a.pointerWasMoved && !r && (clearTimeout(a.autoStartHoldTimer), a.autoStartHoldTimer = null);
      }, "autoStart:before-start": function(o) {
        var a = o.interaction;
        Cn(a) > 0 && (a.prepared.name = null);
      } }, getHoldDuration: Cn }, jo = Wo, ho = { id: "auto-start", install: function(o) {
        o.usePlugin(tl), o.usePlugin(jo), o.usePlugin(fo);
      } }, Go = function(o) {
        return /^(always|never|auto)$/.test(o) ? (this.options.preventDefault = o, this) : z.bool(o) ? (this.options.preventDefault = o ? "always" : "never", this) : this.options.preventDefault;
      };
      function Fa(o) {
        var a = o.interaction, r = o.event;
        a.interactable && a.interactable.checkAndPreventDefault(r);
      }
      var Yo = { id: "core/interactablePreventDefault", install: function(o) {
        var a = o.Interactable;
        a.prototype.preventDefault = Go, a.prototype.checkAndPreventDefault = function(r) {
          return (function(h, g, x) {
            var S = h.options.preventDefault;
            if (S !== "never") if (S !== "always") {
              if (g.events.supportsPassive && /^touch(start|move)$/.test(x.type)) {
                var _ = A(x.target).document, D = g.getDocOptions(_);
                if (!D || !D.events || D.events.passive !== !1) return;
              }
              /^(mouse|pointer|touch)*(down|start)/i.test(x.type) || z.element(x.target) && ge(x.target, "input,select,textarea,[contenteditable=true],[contenteditable=true] *") || x.preventDefault();
            } else x.preventDefault();
          })(this, o, r);
        }, o.interactions.docEvents.push({ type: "dragstart", listener: function(r) {
          for (var h = 0, g = o.interactions.list; h < g.length; h++) {
            var x = g[h];
            if (x.element && (x.element === r.target || ie(x.element, r.target))) return void x.interactable.checkAndPreventDefault(r);
          }
        } });
      }, listeners: ["down", "move", "up", "cancel"].reduce((function(o, a) {
        return o["interactions:".concat(a)] = Fa, o;
      }), {}) };
      function Tl(o, a) {
        if (a.phaselessTypes[o]) return !0;
        for (var r in a.map) if (o.indexOf(r) === 0 && o.substr(r.length) in a.phases) return !0;
        return !1;
      }
      function pi(o) {
        var a = {};
        for (var r in o) {
          var h = o[r];
          z.plainObject(h) ? a[r] = pi(h) : z.array(h) ? a[r] = sn(h) : a[r] = h;
        }
        return a;
      }
      var Pl = (function() {
        function o(a) {
          s(this, o), this.states = [], this.startOffset = { left: 0, right: 0, top: 0, bottom: 0 }, this.startDelta = void 0, this.result = void 0, this.endResult = void 0, this.startEdges = void 0, this.edges = void 0, this.interaction = void 0, this.interaction = a, this.result = $l(), this.edges = { left: !1, right: !1, top: !1, bottom: !1 };
        }
        return c(o, [{ key: "start", value: function(a, r) {
          var h, g, x = a.phase, S = this.interaction, _ = (function(W) {
            var L = W.interactable.options[W.prepared.name], X = L.modifiers;
            return X && X.length ? X : ["snap", "snapSize", "snapEdges", "restrict", "restrictEdges", "restrictSize"].map((function(ne) {
              var de = L[ne];
              return de && de.enabled && { options: de, methods: de._methods };
            })).filter((function(ne) {
              return !!ne;
            }));
          })(S);
          this.prepareStates(_), this.startEdges = be({}, S.edges), this.edges = be({}, this.startEdges), this.startOffset = (h = S.rect, g = r, h ? { left: g.x - h.left, top: g.y - h.top, right: h.right - g.x, bottom: h.bottom - g.y } : { left: 0, top: 0, right: 0, bottom: 0 }), this.startDelta = { x: 0, y: 0 };
          var D = this.fillArg({ phase: x, pageCoords: r, preEnd: !1 });
          return this.result = $l(), this.startAll(D), this.result = this.setAll(D);
        } }, { key: "fillArg", value: function(a) {
          var r = this.interaction;
          return a.interaction = r, a.interactable = r.interactable, a.element = r.element, a.rect || (a.rect = r.rect), a.edges || (a.edges = this.startEdges), a.startOffset = this.startOffset, a;
        } }, { key: "startAll", value: function(a) {
          for (var r = 0, h = this.states; r < h.length; r++) {
            var g = h[r];
            g.methods.start && (a.state = g, g.methods.start(a));
          }
        } }, { key: "setAll", value: function(a) {
          var r = a.phase, h = a.preEnd, g = a.skipModifiers, x = a.rect, S = a.edges;
          a.coords = be({}, a.pageCoords), a.rect = be({}, x), a.edges = be({}, S);
          for (var _ = g ? this.states.slice(g) : this.states, D = $l(a.coords, a.rect), W = 0; W < _.length; W++) {
            var L, X = _[W], ne = X.options, de = be({}, a.coords), he = null;
            (L = X.methods) != null && L.set && this.shouldDo(ne, h, r) && (a.state = X, he = X.methods.set(a), It(a.edges, a.rect, { x: a.coords.x - de.x, y: a.coords.y - de.y })), D.eventProps.push(he);
          }
          be(this.edges, a.edges), D.delta.x = a.coords.x - a.pageCoords.x, D.delta.y = a.coords.y - a.pageCoords.y, D.rectDelta.left = a.rect.left - x.left, D.rectDelta.right = a.rect.right - x.right, D.rectDelta.top = a.rect.top - x.top, D.rectDelta.bottom = a.rect.bottom - x.bottom;
          var pe = this.result.coords, we = this.result.rect;
          if (pe && we) {
            var Se = D.rect.left !== we.left || D.rect.right !== we.right || D.rect.top !== we.top || D.rect.bottom !== we.bottom;
            D.changed = Se || pe.x !== D.coords.x || pe.y !== D.coords.y;
          }
          return D;
        } }, { key: "applyToInteraction", value: function(a) {
          var r = this.interaction, h = a.phase, g = r.coords.cur, x = r.coords.start, S = this.result, _ = this.startDelta, D = S.delta;
          h === "start" && be(this.startDelta, S.delta);
          for (var W = 0, L = [[x, _], [g, D]]; W < L.length; W++) {
            var X = L[W], ne = X[0], de = X[1];
            ne.page.x += de.x, ne.page.y += de.y, ne.client.x += de.x, ne.client.y += de.y;
          }
          var he = this.result.rectDelta, pe = a.rect || r.rect;
          pe.left += he.left, pe.right += he.right, pe.top += he.top, pe.bottom += he.bottom, pe.width = pe.right - pe.left, pe.height = pe.bottom - pe.top;
        } }, { key: "setAndApply", value: function(a) {
          var r = this.interaction, h = a.phase, g = a.preEnd, x = a.skipModifiers, S = this.setAll(this.fillArg({ preEnd: g, phase: h, pageCoords: a.modifiedCoords || r.coords.cur.page }));
          if (this.result = S, !S.changed && (!x || x < this.states.length) && r.interacting()) return !1;
          if (a.modifiedCoords) {
            var _ = r.coords.cur.page, D = { x: a.modifiedCoords.x - _.x, y: a.modifiedCoords.y - _.y };
            S.coords.x += D.x, S.coords.y += D.y, S.delta.x += D.x, S.delta.y += D.y;
          }
          this.applyToInteraction(a);
        } }, { key: "beforeEnd", value: function(a) {
          var r = a.interaction, h = a.event, g = this.states;
          if (g && g.length) {
            for (var x = !1, S = 0; S < g.length; S++) {
              var _ = g[S];
              a.state = _;
              var D = _.options, W = _.methods, L = W.beforeEnd && W.beforeEnd(a);
              if (L) return this.endResult = L, !1;
              x = x || !x && this.shouldDo(D, !0, a.phase, !0);
            }
            x && r.move({ event: h, preEnd: !0 });
          }
        } }, { key: "stop", value: function(a) {
          var r = a.interaction;
          if (this.states && this.states.length) {
            var h = be({ states: this.states, interactable: r.interactable, element: r.element, rect: null }, a);
            this.fillArg(h);
            for (var g = 0, x = this.states; g < x.length; g++) {
              var S = x[g];
              h.state = S, S.methods.stop && S.methods.stop(h);
            }
            this.states = null, this.endResult = null;
          }
        } }, { key: "prepareStates", value: function(a) {
          this.states = [];
          for (var r = 0; r < a.length; r++) {
            var h = a[r], g = h.options, x = h.methods, S = h.name;
            this.states.push({ options: g, methods: x, index: r, name: S });
          }
          return this.states;
        } }, { key: "restoreInteractionCoords", value: function(a) {
          var r = a.interaction, h = r.coords, g = r.rect, x = r.modification;
          if (x.result) {
            for (var S = x.startDelta, _ = x.result, D = _.delta, W = _.rectDelta, L = 0, X = [[h.start, S], [h.cur, D]]; L < X.length; L++) {
              var ne = X[L], de = ne[0], he = ne[1];
              de.page.x -= he.x, de.page.y -= he.y, de.client.x -= he.x, de.client.y -= he.y;
            }
            g.left -= W.left, g.right -= W.right, g.top -= W.top, g.bottom -= W.bottom;
          }
        } }, { key: "shouldDo", value: function(a, r, h, g) {
          return !(!a || a.enabled === !1 || g && !a.endOnly || a.endOnly && !r || h === "start" && !a.setStart);
        } }, { key: "copyFrom", value: function(a) {
          this.startOffset = a.startOffset, this.startDelta = a.startDelta, this.startEdges = a.startEdges, this.edges = a.edges, this.states = a.states.map((function(r) {
            return pi(r);
          })), this.result = $l(be({}, a.result.coords), be({}, a.result.rect));
        } }, { key: "destroy", value: function() {
          for (var a in this) this[a] = null;
        } }]), o;
      })();
      function $l(o, a) {
        return { rect: a, coords: o, delta: { x: 0, y: 0 }, rectDelta: { left: 0, right: 0, top: 0, bottom: 0 }, eventProps: [], changed: !0 };
      }
      function Gn(o, a) {
        var r = o.defaults, h = { start: o.start, set: o.set, beforeEnd: o.beforeEnd, stop: o.stop }, g = function(x) {
          var S = x || {};
          for (var _ in S.enabled = S.enabled !== !1, r) _ in S || (S[_] = r[_]);
          var D = { options: S, methods: h, name: a, enable: function() {
            return S.enabled = !0, D;
          }, disable: function() {
            return S.enabled = !1, D;
          } };
          return D;
        };
        return a && typeof a == "string" && (g._defaults = r, g._methods = h), g;
      }
      function vi(o) {
        var a = o.iEvent, r = o.interaction.modification.result;
        r && (a.modifiers = r.eventProps);
      }
      var El = { id: "modifiers/base", before: ["actions"], install: function(o) {
        o.defaults.perAction.modifiers = [];
      }, listeners: { "interactions:new": function(o) {
        var a = o.interaction;
        a.modification = new Pl(a);
      }, "interactions:before-action-start": function(o) {
        var a = o.interaction, r = o.interaction.modification;
        r.start(o, a.coords.start.page), a.edges = r.edges, r.applyToInteraction(o);
      }, "interactions:before-action-move": function(o) {
        var a = o.interaction, r = a.modification, h = r.setAndApply(o);
        return a.edges = r.edges, h;
      }, "interactions:before-action-end": function(o) {
        var a = o.interaction, r = a.modification, h = r.beforeEnd(o);
        return a.edges = r.startEdges, h;
      }, "interactions:action-start": vi, "interactions:action-move": vi, "interactions:action-end": vi, "interactions:after-action-start": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      }, "interactions:after-action-move": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      }, "interactions:stop": function(o) {
        return o.interaction.modification.stop(o);
      } } }, nl = El, Uo = { base: { preventDefault: "auto", deltaSource: "page" }, perAction: { enabled: !1, origin: { x: 0, y: 0 } }, actions: {} }, il = (function(o) {
        p(r, o);
        var a = C(r);
        function r(h, g, x, S, _, D, W) {
          var L;
          s(this, r), (L = a.call(this, h)).relatedTarget = null, L.screenX = void 0, L.screenY = void 0, L.button = void 0, L.buttons = void 0, L.ctrlKey = void 0, L.shiftKey = void 0, L.altKey = void 0, L.metaKey = void 0, L.page = void 0, L.client = void 0, L.delta = void 0, L.rect = void 0, L.x0 = void 0, L.y0 = void 0, L.t0 = void 0, L.dt = void 0, L.duration = void 0, L.clientX0 = void 0, L.clientY0 = void 0, L.velocity = void 0, L.speed = void 0, L.swipe = void 0, L.axes = void 0, L.preEnd = void 0, _ = _ || h.element;
          var X = h.interactable, ne = (X && X.options || Uo).deltaSource, de = ft(X, _, x), he = S === "start", pe = S === "end", we = he ? v(L) : h.prevEvent, Se = he ? h.coords.start : pe ? { page: we.page, client: we.client, timeStamp: h.coords.cur.timeStamp } : h.coords.cur;
          return L.page = be({}, Se.page), L.client = be({}, Se.client), L.rect = be({}, h.rect), L.timeStamp = Se.timeStamp, pe || (L.page.x -= de.x, L.page.y -= de.y, L.client.x -= de.x, L.client.y -= de.y), L.ctrlKey = g.ctrlKey, L.altKey = g.altKey, L.shiftKey = g.shiftKey, L.metaKey = g.metaKey, L.button = g.button, L.buttons = g.buttons, L.target = _, L.currentTarget = _, L.preEnd = D, L.type = W || x + (S || ""), L.interactable = X, L.t0 = he ? h.pointers[h.pointers.length - 1].downTime : we.t0, L.x0 = h.coords.start.page.x - de.x, L.y0 = h.coords.start.page.y - de.y, L.clientX0 = h.coords.start.client.x - de.x, L.clientY0 = h.coords.start.client.y - de.y, L.delta = he || pe ? { x: 0, y: 0 } : { x: L[ne].x - we[ne].x, y: L[ne].y - we[ne].y }, L.dt = h.coords.delta.timeStamp, L.duration = L.timeStamp - L.t0, L.velocity = be({}, h.coords.velocity[ne]), L.speed = At(L.velocity.x, L.velocity.y), L.swipe = pe || S === "inertiastart" ? L.getSwipe() : null, L;
        }
        return c(r, [{ key: "getSwipe", value: function() {
          var h = this._interaction;
          if (h.prevEvent.speed < 600 || this.timeStamp - h.prevEvent.timeStamp > 150) return null;
          var g = 180 * Math.atan2(h.prevEvent.velocityY, h.prevEvent.velocityX) / Math.PI;
          g < 0 && (g += 360);
          var x = 112.5 <= g && g < 247.5, S = 202.5 <= g && g < 337.5;
          return { up: S, down: !S && 22.5 <= g && g < 157.5, left: x, right: !x && (292.5 <= g || g < 67.5), angle: g, speed: h.prevEvent.speed, velocity: { x: h.prevEvent.velocityX, y: h.prevEvent.velocityY } };
        } }, { key: "preventDefault", value: function() {
        } }, { key: "stopImmediatePropagation", value: function() {
          this.immediatePropagationStopped = this.propagationStopped = !0;
        } }, { key: "stopPropagation", value: function() {
          this.propagationStopped = !0;
        } }]), r;
      })(Yt);
      Object.defineProperties(il.prototype, { pageX: { get: function() {
        return this.page.x;
      }, set: function(o) {
        this.page.x = o;
      } }, pageY: { get: function() {
        return this.page.y;
      }, set: function(o) {
        this.page.y = o;
      } }, clientX: { get: function() {
        return this.client.x;
      }, set: function(o) {
        this.client.x = o;
      } }, clientY: { get: function() {
        return this.client.y;
      }, set: function(o) {
        this.client.y = o;
      } }, dx: { get: function() {
        return this.delta.x;
      }, set: function(o) {
        this.delta.x = o;
      } }, dy: { get: function() {
        return this.delta.y;
      }, set: function(o) {
        this.delta.y = o;
      } }, velocityX: { get: function() {
        return this.velocity.x;
      }, set: function(o) {
        this.velocity.x = o;
      } }, velocityY: { get: function() {
        return this.velocity.y;
      }, set: function(o) {
        this.velocity.y = o;
      } } });
      var Ba = c((function o(a, r, h, g, x) {
        s(this, o), this.id = void 0, this.pointer = void 0, this.event = void 0, this.downTime = void 0, this.downTarget = void 0, this.id = a, this.pointer = r, this.event = h, this.downTime = g, this.downTarget = x;
      })), Ha = (function(o) {
        return o.interactable = "", o.element = "", o.prepared = "", o.pointerIsDown = "", o.pointerWasMoved = "", o._proxy = "", o;
      })({}), Ko = (function(o) {
        return o.start = "", o.move = "", o.end = "", o.stop = "", o.interacting = "", o;
      })({}), Oi = 0, Il = (function() {
        function o(a) {
          var r = this, h = a.pointerType, g = a.scopeFire;
          s(this, o), this.interactable = null, this.element = null, this.rect = null, this._rects = void 0, this.edges = null, this._scopeFire = void 0, this.prepared = { name: null, axis: null, edges: null }, this.pointerType = void 0, this.pointers = [], this.downEvent = null, this.downPointer = {}, this._latestPointer = { pointer: null, event: null, eventTarget: null }, this.prevEvent = null, this.pointerIsDown = !1, this.pointerWasMoved = !1, this._interacting = !1, this._ending = !1, this._stopped = !0, this._proxy = void 0, this.simulation = null, this.doMove = Ot((function(L) {
            this.move(L);
          }), "The interaction.doMove() method has been renamed to interaction.move()"), this.coords = { start: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, prev: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, cur: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, delta: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }, velocity: { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 } }, this._id = Oi++, this._scopeFire = g, this.pointerType = h;
          var x = this;
          this._proxy = {};
          var S = function(L) {
            Object.defineProperty(r._proxy, L, { get: function() {
              return x[L];
            } });
          };
          for (var _ in Ha) S(_);
          var D = function(L) {
            Object.defineProperty(r._proxy, L, { value: function() {
              return x[L].apply(x, arguments);
            } });
          };
          for (var W in Ko) D(W);
          this._scopeFire("interactions:new", { interaction: this });
        }
        return c(o, [{ key: "pointerMoveTolerance", get: function() {
          return 1;
        } }, { key: "pointerDown", value: function(a, r, h) {
          var g = this.updatePointer(a, r, h, !0), x = this.pointers[g];
          this._scopeFire("interactions:down", { pointer: a, event: r, eventTarget: h, pointerIndex: g, pointerInfo: x, type: "down", interaction: this });
        } }, { key: "start", value: function(a, r, h) {
          return !(this.interacting() || !this.pointerIsDown || this.pointers.length < (a.name === "gesture" ? 2 : 1) || !r.options[a.name].enabled) && (Bt(this.prepared, a), this.interactable = r, this.element = h, this.rect = r.getRect(h), this.edges = this.prepared.edges ? be({}, this.prepared.edges) : { left: !0, right: !0, top: !0, bottom: !0 }, this._stopped = !1, this._interacting = this._doPhase({ interaction: this, event: this.downEvent, phase: "start" }) && !this._stopped, this._interacting);
        } }, { key: "pointerMove", value: function(a, r, h) {
          this.simulation || this.modification && this.modification.endResult || this.updatePointer(a, r, h, !1);
          var g, x, S = this.coords.cur.page.x === this.coords.prev.page.x && this.coords.cur.page.y === this.coords.prev.page.y && this.coords.cur.client.x === this.coords.prev.client.x && this.coords.cur.client.y === this.coords.prev.client.y;
          this.pointerIsDown && !this.pointerWasMoved && (g = this.coords.cur.client.x - this.coords.start.client.x, x = this.coords.cur.client.y - this.coords.start.client.y, this.pointerWasMoved = At(g, x) > this.pointerMoveTolerance);
          var _, D, W, L = this.getPointerIndex(a), X = { pointer: a, pointerIndex: L, pointerInfo: this.pointers[L], event: r, type: "move", eventTarget: h, dx: g, dy: x, duplicate: S, interaction: this };
          S || (_ = this.coords.velocity, D = this.coords.delta, W = Math.max(D.timeStamp / 1e3, 1e-3), _.page.x = D.page.x / W, _.page.y = D.page.y / W, _.client.x = D.client.x / W, _.client.y = D.client.y / W, _.timeStamp = W), this._scopeFire("interactions:move", X), S || this.simulation || (this.interacting() && (X.type = null, this.move(X)), this.pointerWasMoved && ln(this.coords.prev, this.coords.cur));
        } }, { key: "move", value: function(a) {
          a && a.event || Be(this.coords.delta), (a = be({ pointer: this._latestPointer.pointer, event: this._latestPointer.event, eventTarget: this._latestPointer.eventTarget, interaction: this }, a || {})).phase = "move", this._doPhase(a);
        } }, { key: "pointerUp", value: function(a, r, h, g) {
          var x = this.getPointerIndex(a);
          x === -1 && (x = this.updatePointer(a, r, h, !1));
          var S = /cancel$/i.test(r.type) ? "cancel" : "up";
          this._scopeFire("interactions:".concat(S), { pointer: a, pointerIndex: x, pointerInfo: this.pointers[x], event: r, eventTarget: h, type: S, curEventTarget: g, interaction: this }), this.simulation || this.end(r), this.removePointer(a, r);
        } }, { key: "documentBlur", value: function(a) {
          this.end(a), this._scopeFire("interactions:blur", { event: a, type: "blur", interaction: this });
        } }, { key: "end", value: function(a) {
          var r;
          this._ending = !0, a = a || this._latestPointer.event, this.interacting() && (r = this._doPhase({ event: a, interaction: this, phase: "end" })), this._ending = !1, r === !0 && this.stop();
        } }, { key: "currentAction", value: function() {
          return this._interacting ? this.prepared.name : null;
        } }, { key: "interacting", value: function() {
          return this._interacting;
        } }, { key: "stop", value: function() {
          this._scopeFire("interactions:stop", { interaction: this }), this.interactable = this.element = null, this._interacting = !1, this._stopped = !0, this.prepared.name = this.prevEvent = null;
        } }, { key: "getPointerIndex", value: function(a) {
          var r = je(a);
          return this.pointerType === "mouse" || this.pointerType === "pen" ? this.pointers.length - 1 : Kt(this.pointers, (function(h) {
            return h.id === r;
          }));
        } }, { key: "getPointerInfo", value: function(a) {
          return this.pointers[this.getPointerIndex(a)];
        } }, { key: "updatePointer", value: function(a, r, h, g) {
          var x, S, _, D = je(a), W = this.getPointerIndex(a), L = this.pointers[W];
          return g = g !== !1 && (g || /(down|start)$/i.test(r.type)), L ? L.pointer = a : (L = new Ba(D, a, r, null, null), W = this.pointers.length, this.pointers.push(L)), ct(this.coords.cur, this.pointers.map((function(X) {
            return X.pointer;
          })), this._now()), x = this.coords.delta, S = this.coords.prev, _ = this.coords.cur, x.page.x = _.page.x - S.page.x, x.page.y = _.page.y - S.page.y, x.client.x = _.client.x - S.client.x, x.client.y = _.client.y - S.client.y, x.timeStamp = _.timeStamp - S.timeStamp, g && (this.pointerIsDown = !0, L.downTime = this.coords.cur.timeStamp, L.downTarget = h, Wt(this.downPointer, a), this.interacting() || (ln(this.coords.start, this.coords.cur), ln(this.coords.prev, this.coords.cur), this.downEvent = r, this.pointerWasMoved = !1)), this._updateLatestPointer(a, r, h), this._scopeFire("interactions:update-pointer", { pointer: a, event: r, eventTarget: h, down: g, pointerInfo: L, pointerIndex: W, interaction: this }), W;
        } }, { key: "removePointer", value: function(a, r) {
          var h = this.getPointerIndex(a);
          if (h !== -1) {
            var g = this.pointers[h];
            this._scopeFire("interactions:remove-pointer", { pointer: a, event: r, eventTarget: null, pointerIndex: h, pointerInfo: g, interaction: this }), this.pointers.splice(h, 1), this.pointerIsDown = !1;
          }
        } }, { key: "_updateLatestPointer", value: function(a, r, h) {
          this._latestPointer.pointer = a, this._latestPointer.event = r, this._latestPointer.eventTarget = h;
        } }, { key: "destroy", value: function() {
          this._latestPointer.pointer = null, this._latestPointer.event = null, this._latestPointer.eventTarget = null;
        } }, { key: "_createPreparedEvent", value: function(a, r, h, g) {
          return new il(this, a, this.prepared.name, r, this.element, h, g);
        } }, { key: "_fireEvent", value: function(a) {
          var r;
          (r = this.interactable) == null || r.fire(a), (!this.prevEvent || a.timeStamp >= this.prevEvent.timeStamp) && (this.prevEvent = a);
        } }, { key: "_doPhase", value: function(a) {
          var r = a.event, h = a.phase, g = a.preEnd, x = a.type, S = this.rect;
          if (S && h === "move" && (It(this.edges, S, this.coords.delta[this.interactable.options.deltaSource]), S.width = S.right - S.left, S.height = S.bottom - S.top), this._scopeFire("interactions:before-action-".concat(h), a) === !1) return !1;
          var _ = a.iEvent = this._createPreparedEvent(r, h, g, x);
          return this._scopeFire("interactions:action-".concat(h), a), h === "start" && (this.prevEvent = _), this._fireEvent(_), this._scopeFire("interactions:after-action-".concat(h), a), !0;
        } }, { key: "_now", value: function() {
          return Date.now();
        } }]), o;
      })();
      function Al(o) {
        Di(o.interaction);
      }
      function Di(o) {
        if (!(function(r) {
          return !(!r.offset.pending.x && !r.offset.pending.y);
        })(o)) return !1;
        var a = o.offset.pending;
        return ai(o.coords.cur, a), ai(o.coords.delta, a), It(o.edges, o.rect, a), a.x = 0, a.y = 0, !0;
      }
      function Wa(o) {
        var a = o.x, r = o.y;
        this.offset.pending.x += a, this.offset.pending.y += r, this.offset.total.x += a, this.offset.total.y += r;
      }
      function ai(o, a) {
        var r = o.page, h = o.client, g = a.x, x = a.y;
        r.x += g, r.y += x, h.x += g, h.y += x;
      }
      Ko.offsetBy = "";
      var ja = { id: "offset", before: ["modifiers", "pointer-events", "actions", "inertia"], install: function(o) {
        o.Interaction.prototype.offsetBy = Wa;
      }, listeners: { "interactions:new": function(o) {
        o.interaction.offset = { total: { x: 0, y: 0 }, pending: { x: 0, y: 0 } };
      }, "interactions:update-pointer": function(o) {
        return (function(a) {
          a.pointerIsDown && (ai(a.coords.cur, a.offset.total), a.offset.pending.x = 0, a.offset.pending.y = 0);
        })(o.interaction);
      }, "interactions:before-action-start": Al, "interactions:before-action-move": Al, "interactions:before-action-end": function(o) {
        var a = o.interaction;
        if (Di(a)) return a.move({ offset: !0 }), a.end(), !1;
      }, "interactions:stop": function(o) {
        var a = o.interaction;
        a.offset.total.x = 0, a.offset.total.y = 0, a.offset.pending.x = 0, a.offset.pending.y = 0;
      } } }, go = ja, po = (function() {
        function o(a) {
          s(this, o), this.active = !1, this.isModified = !1, this.smoothEnd = !1, this.allowResume = !1, this.modification = void 0, this.modifierCount = 0, this.modifierArg = void 0, this.startCoords = void 0, this.t0 = 0, this.v0 = 0, this.te = 0, this.targetOffset = void 0, this.modifiedOffset = void 0, this.currentOffset = void 0, this.lambda_v0 = 0, this.one_ve_v0 = 0, this.timeout = void 0, this.interaction = void 0, this.interaction = a;
        }
        return c(o, [{ key: "start", value: function(a) {
          var r = this.interaction, h = Li(r);
          if (!h || !h.enabled) return !1;
          var g = r.coords.velocity.client, x = At(g.x, g.y), S = this.modification || (this.modification = new Pl(r));
          if (S.copyFrom(r.modification), this.t0 = r._now(), this.allowResume = h.allowResume, this.v0 = x, this.currentOffset = { x: 0, y: 0 }, this.startCoords = r.coords.cur.page, this.modifierArg = S.fillArg({ pageCoords: this.startCoords, preEnd: !0, phase: "inertiastart" }), this.t0 - r.coords.cur.timeStamp < 50 && x > h.minSpeed && x > h.endSpeed) this.startInertia();
          else {
            if (S.result = S.setAll(this.modifierArg), !S.result.changed) return !1;
            this.startSmoothEnd();
          }
          return r.modification.result.rect = null, r.offsetBy(this.targetOffset), r._doPhase({ interaction: r, event: a, phase: "inertiastart" }), r.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y }), r.modification.result.rect = null, this.active = !0, r.simulation = this, !0;
        } }, { key: "startInertia", value: function() {
          var a = this, r = this.interaction.coords.velocity.client, h = Li(this.interaction), g = h.resistance, x = -Math.log(h.endSpeed / this.v0) / g;
          this.targetOffset = { x: (r.x - x) / g, y: (r.y - x) / g }, this.te = x, this.lambda_v0 = g / this.v0, this.one_ve_v0 = 1 - h.endSpeed / this.v0;
          var S = this.modification, _ = this.modifierArg;
          _.pageCoords = { x: this.startCoords.x + this.targetOffset.x, y: this.startCoords.y + this.targetOffset.y }, S.result = S.setAll(_), S.result.changed && (this.isModified = !0, this.modifiedOffset = { x: this.targetOffset.x + S.result.delta.x, y: this.targetOffset.y + S.result.delta.y }), this.onNextFrame((function() {
            return a.inertiaTick();
          }));
        } }, { key: "startSmoothEnd", value: function() {
          var a = this;
          this.smoothEnd = !0, this.isModified = !0, this.targetOffset = { x: this.modification.result.delta.x, y: this.modification.result.delta.y }, this.onNextFrame((function() {
            return a.smoothEndTick();
          }));
        } }, { key: "onNextFrame", value: function(a) {
          var r = this;
          this.timeout = cn.request((function() {
            r.active && a();
          }));
        } }, { key: "inertiaTick", value: function() {
          var a, r, h, g, x, S, _, D = this, W = this.interaction, L = Li(W).resistance, X = (W._now() - this.t0) / 1e3;
          if (X < this.te) {
            var ne, de = 1 - (Math.exp(-L * X) - this.lambda_v0) / this.one_ve_v0;
            this.isModified ? (a = 0, r = 0, h = this.targetOffset.x, g = this.targetOffset.y, x = this.modifiedOffset.x, S = this.modifiedOffset.y, ne = { x: mi(_ = de, a, h, x), y: mi(_, r, g, S) }) : ne = { x: this.targetOffset.x * de, y: this.targetOffset.y * de };
            var he = { x: ne.x - this.currentOffset.x, y: ne.y - this.currentOffset.y };
            this.currentOffset.x += he.x, this.currentOffset.y += he.y, W.offsetBy(he), W.move(), this.onNextFrame((function() {
              return D.inertiaTick();
            }));
          } else W.offsetBy({ x: this.modifiedOffset.x - this.currentOffset.x, y: this.modifiedOffset.y - this.currentOffset.y }), this.end();
        } }, { key: "smoothEndTick", value: function() {
          var a = this, r = this.interaction, h = r._now() - this.t0, g = Li(r).smoothEndDuration;
          if (h < g) {
            var x = { x: yi(h, 0, this.targetOffset.x, g), y: yi(h, 0, this.targetOffset.y, g) }, S = { x: x.x - this.currentOffset.x, y: x.y - this.currentOffset.y };
            this.currentOffset.x += S.x, this.currentOffset.y += S.y, r.offsetBy(S), r.move({ skipModifiers: this.modifierCount }), this.onNextFrame((function() {
              return a.smoothEndTick();
            }));
          } else r.offsetBy({ x: this.targetOffset.x - this.currentOffset.x, y: this.targetOffset.y - this.currentOffset.y }), this.end();
        } }, { key: "resume", value: function(a) {
          var r = a.pointer, h = a.event, g = a.eventTarget, x = this.interaction;
          x.offsetBy({ x: -this.currentOffset.x, y: -this.currentOffset.y }), x.updatePointer(r, h, g, !0), x._doPhase({ interaction: x, event: h, phase: "resume" }), ln(x.coords.prev, x.coords.cur), this.stop();
        } }, { key: "end", value: function() {
          this.interaction.move(), this.interaction.end(), this.stop();
        } }, { key: "stop", value: function() {
          this.active = this.smoothEnd = !1, this.interaction.simulation = null, cn.cancel(this.timeout);
        } }]), o;
      })();
      function Li(o) {
        var a = o.interactable, r = o.prepared;
        return a && a.options && r.name && a.options[r.name].inertia;
      }
      var vo = { id: "inertia", before: ["modifiers", "actions"], install: function(o) {
        var a = o.defaults;
        o.usePlugin(go), o.usePlugin(nl), o.actions.phases.inertiastart = !0, o.actions.phases.resume = !0, a.perAction.inertia = { enabled: !1, resistance: 10, minSpeed: 100, endSpeed: 10, allowResume: !0, smoothEndDuration: 300 };
      }, listeners: { "interactions:new": function(o) {
        var a = o.interaction;
        a.inertia = new po(a);
      }, "interactions:before-action-end": function(o) {
        var a = o.interaction, r = o.event;
        return (!a._interacting || a.simulation || !a.inertia.start(r)) && null;
      }, "interactions:down": function(o) {
        var a = o.interaction, r = o.eventTarget, h = a.inertia;
        if (h.active) for (var g = r; z.element(g); ) {
          if (g === a.element) {
            h.resume(o);
            break;
          }
          g = ve(g);
        }
      }, "interactions:stop": function(o) {
        var a = o.interaction.inertia;
        a.active && a.stop();
      }, "interactions:before-action-resume": function(o) {
        var a = o.interaction.modification;
        a.stop(o), a.start(o, o.interaction.coords.cur.page), a.applyToInteraction(o);
      }, "interactions:before-action-inertiastart": function(o) {
        return o.interaction.modification.setAndApply(o);
      }, "interactions:action-resume": vi, "interactions:action-inertiastart": vi, "interactions:after-action-inertiastart": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      }, "interactions:after-action-resume": function(o) {
        return o.interaction.modification.restoreInteractionCoords(o);
      } } };
      function mi(o, a, r, h) {
        var g = 1 - o;
        return g * g * a + 2 * g * o * r + o * o * h;
      }
      function yi(o, a, r, h) {
        return -r * (o /= h) * (o - 2) + a;
      }
      var Xo = vo;
      function mo(o, a) {
        for (var r = 0; r < a.length; r++) {
          var h = a[r];
          if (o.immediatePropagationStopped) break;
          h(o);
        }
      }
      var bi = (function() {
        function o(a) {
          s(this, o), this.options = void 0, this.types = {}, this.propagationStopped = !1, this.immediatePropagationStopped = !1, this.global = void 0, this.options = be({}, a || {});
        }
        return c(o, [{ key: "fire", value: function(a) {
          var r, h = this.global;
          (r = this.types[a.type]) && mo(a, r), !a.propagationStopped && h && (r = h[a.type]) && mo(a, r);
        } }, { key: "on", value: function(a, r) {
          var h = Tt(a, r);
          for (a in h) this.types[a] = fn(this.types[a] || [], h[a]);
        } }, { key: "off", value: function(a, r) {
          var h = Tt(a, r);
          for (a in h) {
            var g = this.types[a];
            if (g && g.length) for (var x = 0, S = h[a]; x < S.length; x++) {
              var _ = S[x], D = g.indexOf(_);
              D !== -1 && g.splice(D, 1);
            }
          }
        } }, { key: "getRect", value: function(a) {
          return null;
        } }]), o;
      })(), qi = (function() {
        function o(a) {
          s(this, o), this.currentTarget = void 0, this.originalEvent = void 0, this.type = void 0, this.originalEvent = a, Wt(this, a);
        }
        return c(o, [{ key: "preventOriginalDefault", value: function() {
          this.originalEvent.preventDefault();
        } }, { key: "stopPropagation", value: function() {
          this.originalEvent.stopPropagation();
        } }, { key: "stopImmediatePropagation", value: function() {
          this.originalEvent.stopImmediatePropagation();
        } }]), o;
      })();
      function Ri(o) {
        return z.object(o) ? { capture: !!o.capture, passive: !!o.passive } : { capture: !!o, passive: !1 };
      }
      function ll(o, a) {
        return o === a || (typeof o == "boolean" ? !!a.capture === o && !a.passive : !!o.capture == !!a.capture && !!o.passive == !!a.passive);
      }
      var kt = { id: "events", install: function(o) {
        var a, r = [], h = {}, g = [], x = { add: S, remove: _, addDelegate: function(L, X, ne, de, he) {
          var pe = Ri(he);
          if (!h[ne]) {
            h[ne] = [];
            for (var we = 0; we < g.length; we++) {
              var Se = g[we];
              S(Se, ne, D), S(Se, ne, W, !0);
            }
          }
          var Pe = h[ne], Ve = zt(Pe, (function(Ke) {
            return Ke.selector === L && Ke.context === X;
          }));
          Ve || (Ve = { selector: L, context: X, listeners: [] }, Pe.push(Ve)), Ve.listeners.push({ func: de, options: pe });
        }, removeDelegate: function(L, X, ne, de, he) {
          var pe, we = Ri(he), Se = h[ne], Pe = !1;
          if (Se)
            for (pe = Se.length - 1; pe >= 0; pe--) {
              var Ve = Se[pe];
              if (Ve.selector === L && Ve.context === X) {
                for (var Ke = Ve.listeners, Re = Ke.length - 1; Re >= 0; Re--) {
                  var We = Ke[Re];
                  if (We.func === de && ll(We.options, we)) {
                    Ke.splice(Re, 1), Ke.length || (Se.splice(pe, 1), _(X, ne, D), _(X, ne, W, !0)), Pe = !0;
                    break;
                  }
                }
                if (Pe) break;
              }
            }
        }, delegateListener: D, delegateUseCapture: W, delegatedEvents: h, documents: g, targets: r, supportsOptions: !1, supportsPassive: !1 };
        function S(L, X, ne, de) {
          if (L.addEventListener) {
            var he = Ri(de), pe = zt(r, (function(we) {
              return we.eventTarget === L;
            }));
            pe || (pe = { eventTarget: L, events: {} }, r.push(pe)), pe.events[X] || (pe.events[X] = []), zt(pe.events[X], (function(we) {
              return we.func === ne && ll(we.options, he);
            })) || (L.addEventListener(X, ne, x.supportsOptions ? he : he.capture), pe.events[X].push({ func: ne, options: he }));
          }
        }
        function _(L, X, ne, de) {
          if (L.addEventListener && L.removeEventListener) {
            var he = Kt(r, (function(ht) {
              return ht.eventTarget === L;
            })), pe = r[he];
            if (pe && pe.events) if (X !== "all") {
              var we = !1, Se = pe.events[X];
              if (Se) {
                if (ne === "all") {
                  for (var Pe = Se.length - 1; Pe >= 0; Pe--) {
                    var Ve = Se[Pe];
                    _(L, X, Ve.func, Ve.options);
                  }
                  return;
                }
                for (var Ke = Ri(de), Re = 0; Re < Se.length; Re++) {
                  var We = Se[Re];
                  if (We.func === ne && ll(We.options, Ke)) {
                    L.removeEventListener(X, ne, x.supportsOptions ? Ke : Ke.capture), Se.splice(Re, 1), Se.length === 0 && (delete pe.events[X], we = !0);
                    break;
                  }
                }
              }
              we && !Object.keys(pe.events).length && r.splice(he, 1);
            } else for (X in pe.events) pe.events.hasOwnProperty(X) && _(L, X, "all");
          }
        }
        function D(L, X) {
          for (var ne = Ri(X), de = new qi(L), he = h[L.type], pe = qt(L)[0], we = pe; z.element(we); ) {
            for (var Se = 0; Se < he.length; Se++) {
              var Pe = he[Se], Ve = Pe.selector, Ke = Pe.context;
              if (ge(we, Ve) && ie(Ke, pe) && ie(Ke, we)) {
                var Re = Pe.listeners;
                de.currentTarget = we;
                for (var We = 0; We < Re.length; We++) {
                  var ht = Re[We];
                  ll(ht.options, ne) && ht.func(de);
                }
              }
            }
            we = ve(we);
          }
        }
        function W(L) {
          return D(L, !0);
        }
        return (a = o.document) == null || a.createElement("div").addEventListener("test", null, { get capture() {
          return x.supportsOptions = !0;
        }, get passive() {
          return x.supportsPassive = !0;
        } }), o.events = x, x;
      } }, xt = { methodOrder: ["simulationResume", "mouseOrPen", "hasPointer", "idle"], search: function(o) {
        for (var a = 0, r = xt.methodOrder; a < r.length; a++) {
          var h = r[a], g = xt[h](o);
          if (g) return g;
        }
        return null;
      }, simulationResume: function(o) {
        var a = o.pointerType, r = o.eventType, h = o.eventTarget, g = o.scope;
        if (!/down|start/i.test(r)) return null;
        for (var x = 0, S = g.interactions.list; x < S.length; x++) {
          var _ = S[x], D = h;
          if (_.simulation && _.simulation.allowResume && _.pointerType === a) for (; D; ) {
            if (D === _.element) return _;
            D = ve(D);
          }
        }
        return null;
      }, mouseOrPen: function(o) {
        var a, r = o.pointerId, h = o.pointerType, g = o.eventType, x = o.scope;
        if (h !== "mouse" && h !== "pen") return null;
        for (var S = 0, _ = x.interactions.list; S < _.length; S++) {
          var D = _[S];
          if (D.pointerType === h) {
            if (D.simulation && !Yn(D, r)) continue;
            if (D.interacting()) return D;
            a || (a = D);
          }
        }
        if (a) return a;
        for (var W = 0, L = x.interactions.list; W < L.length; W++) {
          var X = L[W];
          if (!(X.pointerType !== h || /down/i.test(g) && X.simulation)) return X;
        }
        return null;
      }, hasPointer: function(o) {
        for (var a = o.pointerId, r = 0, h = o.scope.interactions.list; r < h.length; r++) {
          var g = h[r];
          if (Yn(g, a)) return g;
        }
        return null;
      }, idle: function(o) {
        for (var a = o.pointerType, r = 0, h = o.scope.interactions.list; r < h.length; r++) {
          var g = h[r];
          if (g.pointers.length === 1) {
            var x = g.interactable;
            if (x && (!x.options.gesture || !x.options.gesture.enabled)) continue;
          } else if (g.pointers.length >= 2) continue;
          if (!g.interacting() && a === g.pointerType) return g;
        }
        return null;
      } };
      function Yn(o, a) {
        return o.pointers.some((function(r) {
          return r.id === a;
        }));
      }
      var Zt = xt, Ht = ["pointerDown", "pointerMove", "pointerUp", "updatePointer", "removePointer", "windowBlur"];
      function jt(o, a) {
        return function(r) {
          var h = a.interactions.list, g = St(r), x = qt(r), S = x[0], _ = x[1], D = [];
          if (/^touch/.test(r.type)) {
            a.prevTouchTime = a.now();
            for (var W = 0, L = r.changedTouches; W < L.length; W++) {
              var X = L[W], ne = { pointer: X, pointerId: je(X), pointerType: g, eventType: r.type, eventTarget: S, curEventTarget: _, scope: a }, de = wt(ne);
              D.push([ne.pointer, ne.eventTarget, ne.curEventTarget, de]);
            }
          } else {
            var he = !1;
            if (!ue.supportsPointerEvent && /mouse/.test(r.type)) {
              for (var pe = 0; pe < h.length && !he; pe++) he = h[pe].pointerType !== "mouse" && h[pe].pointerIsDown;
              he = he || a.now() - a.prevTouchTime < 500 || r.timeStamp === 0;
            }
            if (!he) {
              var we = { pointer: r, pointerId: je(r), pointerType: g, eventType: r.type, curEventTarget: _, eventTarget: S, scope: a }, Se = wt(we);
              D.push([we.pointer, we.eventTarget, we.curEventTarget, Se]);
            }
          }
          for (var Pe = 0; Pe < D.length; Pe++) {
            var Ve = D[Pe], Ke = Ve[0], Re = Ve[1], We = Ve[2];
            Ve[3][o](Ke, r, Re, We);
          }
        };
      }
      function wt(o) {
        var a = o.pointerType, r = o.scope, h = { interaction: Zt.search(o), searchDetails: o };
        return r.fire("interactions:find", h), h.interaction || r.interactions.new({ pointerType: a });
      }
      function si(o, a) {
        var r = o.doc, h = o.scope, g = o.options, x = h.interactions.docEvents, S = h.events, _ = S[a];
        for (var D in h.browser.isIOS && !g.events && (g.events = { passive: !1 }), S.delegatedEvents) _(r, D, S.delegateListener), _(r, D, S.delegateUseCapture, !0);
        for (var W = g && g.events, L = 0; L < x.length; L++) {
          var X = x[L];
          _(r, X.type, X.listener, W);
        }
      }
      var Ol = { id: "core/interactions", install: function(o) {
        for (var a = {}, r = 0; r < Ht.length; r++) {
          var h = Ht[r];
          a[h] = jt(h, o);
        }
        var g, x = ue.pEventTypes;
        function S() {
          for (var _ = 0, D = o.interactions.list; _ < D.length; _++) {
            var W = D[_];
            if (W.pointerIsDown && W.pointerType === "touch" && !W._interacting) for (var L = function() {
              var de = ne[X];
              o.documents.some((function(he) {
                return ie(he.doc, de.downTarget);
              })) || W.removePointer(de.pointer, de.event);
            }, X = 0, ne = W.pointers; X < ne.length; X++) L();
          }
        }
        (g = $.PointerEvent ? [{ type: x.down, listener: S }, { type: x.down, listener: a.pointerDown }, { type: x.move, listener: a.pointerMove }, { type: x.up, listener: a.pointerUp }, { type: x.cancel, listener: a.pointerUp }] : [{ type: "mousedown", listener: a.pointerDown }, { type: "mousemove", listener: a.pointerMove }, { type: "mouseup", listener: a.pointerUp }, { type: "touchstart", listener: S }, { type: "touchstart", listener: a.pointerDown }, { type: "touchmove", listener: a.pointerMove }, { type: "touchend", listener: a.pointerUp }, { type: "touchcancel", listener: a.pointerUp }]).push({ type: "blur", listener: function(_) {
          for (var D = 0, W = o.interactions.list; D < W.length; D++)
            W[D].documentBlur(_);
        } }), o.prevTouchTime = 0, o.Interaction = (function(_) {
          p(W, _);
          var D = C(W);
          function W() {
            return s(this, W), D.apply(this, arguments);
          }
          return c(W, [{ key: "pointerMoveTolerance", get: function() {
            return o.interactions.pointerMoveTolerance;
          }, set: function(L) {
            o.interactions.pointerMoveTolerance = L;
          } }, { key: "_now", value: function() {
            return o.now();
          } }]), W;
        })(Il), o.interactions = { list: [], new: function(_) {
          _.scopeFire = function(W, L) {
            return o.fire(W, L);
          };
          var D = new o.Interaction(_);
          return o.interactions.list.push(D), D;
        }, listeners: a, docEvents: g, pointerMoveTolerance: 1 }, o.usePlugin(Yo);
      }, listeners: { "scope:add-document": function(o) {
        return si(o, "add");
      }, "scope:remove-document": function(o) {
        return si(o, "remove");
      }, "interactable:unset": function(o, a) {
        for (var r = o.interactable, h = a.interactions.list.length - 1; h >= 0; h--) {
          var g = a.interactions.list[h];
          g.interactable === r && (g.stop(), a.fire("interactions:destroy", { interaction: g }), g.destroy(), a.interactions.list.length > 2 && a.interactions.list.splice(h, 1));
        }
      } }, onDocSignal: si, doOnInteractions: jt, methodNames: Ht }, Ga = Ol, an = (function(o) {
        return o[o.On = 0] = "On", o[o.Off = 1] = "Off", o;
      })(an || {}), Ln = (function() {
        function o(a, r, h, g) {
          s(this, o), this.target = void 0, this.options = void 0, this._actions = void 0, this.events = new bi(), this._context = void 0, this._win = void 0, this._doc = void 0, this._scopeEvents = void 0, this._actions = r.actions, this.target = a, this._context = r.context || h, this._win = A(Te(a) ? this._context : a), this._doc = this._win.document, this._scopeEvents = g, this.set(r);
        }
        return c(o, [{ key: "_defaults", get: function() {
          return { base: {}, perAction: {}, actions: {} };
        } }, { key: "setOnEvents", value: function(a, r) {
          return z.func(r.onstart) && this.on("".concat(a, "start"), r.onstart), z.func(r.onmove) && this.on("".concat(a, "move"), r.onmove), z.func(r.onend) && this.on("".concat(a, "end"), r.onend), z.func(r.oninertiastart) && this.on("".concat(a, "inertiastart"), r.oninertiastart), this;
        } }, { key: "updatePerActionListeners", value: function(a, r, h) {
          var g, x = this, S = (g = this._actions.map[a]) == null ? void 0 : g.filterEventType, _ = function(D) {
            return (S == null || S(D)) && Tl(D, x._actions);
          };
          (z.array(r) || z.object(r)) && this._onOff(an.Off, a, r, void 0, _), (z.array(h) || z.object(h)) && this._onOff(an.On, a, h, void 0, _);
        } }, { key: "setPerAction", value: function(a, r) {
          var h = this._defaults;
          for (var g in r) {
            var x = g, S = this.options[a], _ = r[x];
            x === "listeners" && this.updatePerActionListeners(a, S.listeners, _), z.array(_) ? S[x] = sn(_) : z.plainObject(_) ? (S[x] = be(S[x] || {}, pi(_)), z.object(h.perAction[x]) && "enabled" in h.perAction[x] && (S[x].enabled = _.enabled !== !1)) : z.bool(_) && z.object(h.perAction[x]) ? S[x].enabled = _ : S[x] = _;
          }
        } }, { key: "getRect", value: function(a) {
          return a = a || (z.element(this.target) ? this.target : null), z.string(this.target) && (a = a || this._context.querySelector(this.target)), se(a);
        } }, { key: "rectChecker", value: function(a) {
          var r = this;
          return z.func(a) ? (this.getRect = function(h) {
            var g = be({}, a.apply(r, h));
            return "width" in g || (g.width = g.right - g.left, g.height = g.bottom - g.top), g;
          }, this) : a === null ? (delete this.getRect, this) : this.getRect;
        } }, { key: "_backCompatOption", value: function(a, r) {
          if (Te(r) || z.object(r)) {
            for (var h in this.options[a] = r, this._actions.map) this.options[h][a] = r;
            return this;
          }
          return this.options[a];
        } }, { key: "origin", value: function(a) {
          return this._backCompatOption("origin", a);
        } }, { key: "deltaSource", value: function(a) {
          return a === "page" || a === "client" ? (this.options.deltaSource = a, this) : this.options.deltaSource;
        } }, { key: "getAllElements", value: function() {
          var a = this.target;
          return z.string(a) ? Array.from(this._context.querySelectorAll(a)) : z.func(a) && a.getAllElements ? a.getAllElements() : z.element(a) ? [a] : [];
        } }, { key: "context", value: function() {
          return this._context;
        } }, { key: "inContext", value: function(a) {
          return this._context === a.ownerDocument || ie(this._context, a);
        } }, { key: "testIgnoreAllow", value: function(a, r, h) {
          return !this.testIgnore(a.ignoreFrom, r, h) && this.testAllow(a.allowFrom, r, h);
        } }, { key: "testAllow", value: function(a, r, h) {
          return !a || !!z.element(h) && (z.string(a) ? Oe(h, a, r) : !!z.element(a) && ie(a, h));
        } }, { key: "testIgnore", value: function(a, r, h) {
          return !(!a || !z.element(h)) && (z.string(a) ? Oe(h, a, r) : !!z.element(a) && ie(a, h));
        } }, { key: "fire", value: function(a) {
          return this.events.fire(a), this;
        } }, { key: "_onOff", value: function(a, r, h, g, x) {
          z.object(r) && !z.array(r) && (g = h, h = null);
          var S = Tt(r, h, x);
          for (var _ in S) {
            _ === "wheel" && (_ = ue.wheelEvent);
            for (var D = 0, W = S[_]; D < W.length; D++) {
              var L = W[D];
              Tl(_, this._actions) ? this.events[a === an.On ? "on" : "off"](_, L) : z.string(this.target) ? this._scopeEvents[a === an.On ? "addDelegate" : "removeDelegate"](this.target, this._context, _, L, g) : this._scopeEvents[a === an.On ? "add" : "remove"](this.target, _, L, g);
            }
          }
          return this;
        } }, { key: "on", value: function(a, r, h) {
          return this._onOff(an.On, a, r, h);
        } }, { key: "off", value: function(a, r, h) {
          return this._onOff(an.Off, a, r, h);
        } }, { key: "set", value: function(a) {
          var r = this._defaults;
          for (var h in z.object(a) || (a = {}), this.options = pi(r.base), this._actions.methodDict) {
            var g = h, x = this._actions.methodDict[g];
            this.options[g] = {}, this.setPerAction(g, be(be({}, r.perAction), r.actions[g])), this[x](a[g]);
          }
          for (var S in a) S !== "getRect" ? z.func(this[S]) && this[S](a[S]) : this.rectChecker(a.getRect);
          return this;
        } }, { key: "unset", value: function() {
          if (z.string(this.target)) for (var a in this._scopeEvents.delegatedEvents) for (var r = this._scopeEvents.delegatedEvents[a], h = r.length - 1; h >= 0; h--) {
            var g = r[h], x = g.selector, S = g.context, _ = g.listeners;
            x === this.target && S === this._context && r.splice(h, 1);
            for (var D = _.length - 1; D >= 0; D--) this._scopeEvents.removeDelegate(this.target, this._context, a, _[D][0], _[D][1]);
          }
          else this._scopeEvents.remove(this.target, "all");
        } }]), o;
      })(), Ya = (function() {
        function o(a) {
          var r = this;
          s(this, o), this.list = [], this.selectorMap = {}, this.scope = void 0, this.scope = a, a.addListeners({ "interactable:unset": function(h) {
            var g = h.interactable, x = g.target, S = z.string(x) ? r.selectorMap[x] : x[r.scope.id], _ = Kt(S, (function(D) {
              return D === g;
            }));
            S.splice(_, 1);
          } });
        }
        return c(o, [{ key: "new", value: function(a, r) {
          r = be(r || {}, { actions: this.scope.actions });
          var h = new this.scope.Interactable(a, r, this.scope.document, this.scope.events);
          return this.scope.addDocument(h._doc), this.list.push(h), z.string(a) ? (this.selectorMap[a] || (this.selectorMap[a] = []), this.selectorMap[a].push(h)) : (h.target[this.scope.id] || Object.defineProperty(a, this.scope.id, { value: [], configurable: !0 }), a[this.scope.id].push(h)), this.scope.fire("interactable:new", { target: a, options: r, interactable: h, win: this.scope._win }), h;
        } }, { key: "getExisting", value: function(a, r) {
          var h = r && r.context || this.scope.document, g = z.string(a), x = g ? this.selectorMap[a] : a[this.scope.id];
          if (x) return zt(x, (function(S) {
            return S._context === h && (g || S.inContext(a));
          }));
        } }, { key: "forEachMatch", value: function(a, r) {
          for (var h = 0, g = this.list; h < g.length; h++) {
            var x = g[h], S = void 0;
            if ((z.string(x.target) ? z.element(a) && ge(a, x.target) : a === x.target) && x.inContext(a) && (S = r(x)), S !== void 0) return S;
          }
        } }]), o;
      })(), Ua = (function() {
        function o() {
          var a = this;
          s(this, o), this.id = "__interact_scope_".concat(Math.floor(100 * Math.random())), this.isInitialized = !1, this.listenerMaps = [], this.browser = ue, this.defaults = pi(Uo), this.Eventable = bi, this.actions = { map: {}, phases: { start: !0, move: !0, end: !0 }, methodDict: {}, phaselessTypes: {} }, this.interactStatic = (function(h) {
            var g = function x(S, _) {
              var D = h.interactables.getExisting(S, _);
              return D || ((D = h.interactables.new(S, _)).events.global = x.globalEvents), D;
            };
            return g.getPointerAverage = qe, g.getTouchBBox = et, g.getTouchDistance = it, g.getTouchAngle = lt, g.getElementRect = se, g.getElementClientRect = ke, g.matchesSelector = ge, g.closest = Ee, g.globalEvents = {}, g.version = "1.10.27", g.scope = h, g.use = function(x, S) {
              return this.scope.usePlugin(x, S), this;
            }, g.isSet = function(x, S) {
              return !!this.scope.interactables.get(x, S && S.context);
            }, g.on = Ot((function(x, S, _) {
              if (z.string(x) && x.search(" ") !== -1 && (x = x.trim().split(/ +/)), z.array(x)) {
                for (var D = 0, W = x; D < W.length; D++) {
                  var L = W[D];
                  this.on(L, S, _);
                }
                return this;
              }
              if (z.object(x)) {
                for (var X in x) this.on(X, x[X], S);
                return this;
              }
              return Tl(x, this.scope.actions) ? this.globalEvents[x] ? this.globalEvents[x].push(S) : this.globalEvents[x] = [S] : this.scope.events.add(this.scope.document, x, S, { options: _ }), this;
            }), "The interact.on() method is being deprecated"), g.off = Ot((function(x, S, _) {
              if (z.string(x) && x.search(" ") !== -1 && (x = x.trim().split(/ +/)), z.array(x)) {
                for (var D = 0, W = x; D < W.length; D++) {
                  var L = W[D];
                  this.off(L, S, _);
                }
                return this;
              }
              if (z.object(x)) {
                for (var X in x) this.off(X, x[X], S);
                return this;
              }
              var ne;
              return Tl(x, this.scope.actions) ? x in this.globalEvents && (ne = this.globalEvents[x].indexOf(S)) !== -1 && this.globalEvents[x].splice(ne, 1) : this.scope.events.remove(this.scope.document, x, S, _), this;
            }), "The interact.off() method is being deprecated"), g.debug = function() {
              return this.scope;
            }, g.supportsTouch = function() {
              return ue.supportsTouch;
            }, g.supportsPointerEvent = function() {
              return ue.supportsPointerEvent;
            }, g.stop = function() {
              for (var x = 0, S = this.scope.interactions.list; x < S.length; x++) S[x].stop();
              return this;
            }, g.pointerMoveTolerance = function(x) {
              return z.number(x) ? (this.scope.interactions.pointerMoveTolerance = x, this) : this.scope.interactions.pointerMoveTolerance;
            }, g.addDocument = function(x, S) {
              this.scope.addDocument(x, S);
            }, g.removeDocument = function(x) {
              this.scope.removeDocument(x);
            }, g;
          })(this), this.InteractEvent = il, this.Interactable = void 0, this.interactables = new Ya(this), this._win = void 0, this.document = void 0, this.window = void 0, this.documents = [], this._plugins = { list: [], map: {} }, this.onWindowUnload = function(h) {
            return a.removeDocument(h.target);
          };
          var r = this;
          this.Interactable = (function(h) {
            p(x, h);
            var g = C(x);
            function x() {
              return s(this, x), g.apply(this, arguments);
            }
            return c(x, [{ key: "_defaults", get: function() {
              return r.defaults;
            } }, { key: "set", value: function(S) {
              return P(m(x.prototype), "set", this).call(this, S), r.fire("interactable:set", { options: S, interactable: this }), this;
            } }, { key: "unset", value: function() {
              P(m(x.prototype), "unset", this).call(this);
              var S = r.interactables.list.indexOf(this);
              S < 0 || (r.interactables.list.splice(S, 1), r.fire("interactable:unset", { interactable: this }));
            } }]), x;
          })(Ln);
        }
        return c(o, [{ key: "addListeners", value: function(a, r) {
          this.listenerMaps.push({ id: r, map: a });
        } }, { key: "fire", value: function(a, r) {
          for (var h = 0, g = this.listenerMaps; h < g.length; h++) {
            var x = g[h].map[a];
            if (x && x(r, this, a) === !1) return !1;
          }
        } }, { key: "init", value: function(a) {
          return this.isInitialized ? this : (function(r, h) {
            return r.isInitialized = !0, z.window(h) && Y(h), $.init(h), ue.init(h), cn.init(h), r.window = h, r.document = h.document, r.usePlugin(Ga), r.usePlugin(kt), r;
          })(this, a);
        } }, { key: "pluginIsInstalled", value: function(a) {
          var r = a.id;
          return r ? !!this._plugins.map[r] : this._plugins.list.indexOf(a) !== -1;
        } }, { key: "usePlugin", value: function(a, r) {
          if (!this.isInitialized) return this;
          if (this.pluginIsInstalled(a)) return this;
          if (a.id && (this._plugins.map[a.id] = a), this._plugins.list.push(a), a.install && a.install(this, r), a.listeners && a.before) {
            for (var h = 0, g = this.listenerMaps.length, x = a.before.reduce((function(_, D) {
              return _[D] = !0, _[Qo(D)] = !0, _;
            }), {}); h < g; h++) {
              var S = this.listenerMaps[h].id;
              if (S && (x[S] || x[Qo(S)])) break;
            }
            this.listenerMaps.splice(h, 0, { id: a.id, map: a.listeners });
          } else a.listeners && this.listenerMaps.push({ id: a.id, map: a.listeners });
          return this;
        } }, { key: "addDocument", value: function(a, r) {
          if (this.getDocIndex(a) !== -1) return !1;
          var h = A(a);
          r = r ? be({}, r) : {}, this.documents.push({ doc: a, options: r }), this.events.documents.push(a), a !== this.document && this.events.add(h, "unload", this.onWindowUnload), this.fire("scope:add-document", { doc: a, window: h, scope: this, options: r });
        } }, { key: "removeDocument", value: function(a) {
          var r = this.getDocIndex(a), h = A(a), g = this.documents[r].options;
          this.events.remove(h, "unload", this.onWindowUnload), this.documents.splice(r, 1), this.events.documents.splice(r, 1), this.fire("scope:remove-document", { doc: a, window: h, scope: this, options: g });
        } }, { key: "getDocIndex", value: function(a) {
          for (var r = 0; r < this.documents.length; r++) if (this.documents[r].doc === a) return r;
          return -1;
        } }, { key: "getDocOptions", value: function(a) {
          var r = this.getDocIndex(a);
          return r === -1 ? null : this.documents[r].options;
        } }, { key: "now", value: function() {
          return (this.window.Date || Date).now();
        } }]), o;
      })();
      function Qo(o) {
        return o && o.replace(/\/.*$/, "");
      }
      var Jo = new Ua(), $t = Jo.interactStatic, ri = typeof globalThis < "u" ? globalThis : window;
      Jo.init(ri);
      var xi = Object.freeze({ __proto__: null, edgeTarget: function() {
      }, elements: function() {
      }, grid: function(o) {
        var a = [["x", "y"], ["left", "top"], ["right", "bottom"], ["width", "height"]].filter((function(h) {
          var g = h[0], x = h[1];
          return g in o || x in o;
        })), r = function(h, g) {
          for (var x = o.range, S = o.limits, _ = S === void 0 ? { left: -1 / 0, right: 1 / 0, top: -1 / 0, bottom: 1 / 0 } : S, D = o.offset, W = D === void 0 ? { x: 0, y: 0 } : D, L = { range: x, grid: o, x: null, y: null }, X = 0; X < a.length; X++) {
            var ne = a[X], de = ne[0], he = ne[1], pe = Math.round((h - W.x) / o[de]), we = Math.round((g - W.y) / o[he]);
            L[de] = Math.max(_.left, Math.min(_.right, pe * o[de] + W.x)), L[he] = Math.max(_.top, Math.min(_.bottom, we * o[he] + W.y));
          }
          return L;
        };
        return r.grid = o, r.coordFields = a, r;
      } }), Ni = { id: "snappers", install: function(o) {
        var a = o.interactStatic;
        a.snappers = be(a.snappers || {}, xi), a.createSnapGrid = a.snappers.grid;
      } }, Ka = Ni, qn = { start: function(o) {
        var a = o.state, r = o.rect, h = o.edges, g = o.pageCoords, x = a.options, S = x.ratio, _ = x.enabled, D = a.options, W = D.equalDelta, L = D.modifiers;
        S === "preserve" && (S = r.width / r.height), a.startCoords = be({}, g), a.startRect = be({}, r), a.ratio = S, a.equalDelta = W;
        var X = a.linkedEdges = { top: h.top || h.left && !h.bottom, left: h.left || h.top && !h.right, bottom: h.bottom || h.right && !h.top, right: h.right || h.bottom && !h.left };
        if (a.xIsPrimaryAxis = !(!h.left && !h.right), a.equalDelta) {
          var ne = (X.left ? 1 : -1) * (X.top ? 1 : -1);
          a.edgeSign = { x: ne, y: ne };
        } else a.edgeSign = { x: X.left ? -1 : 1, y: X.top ? -1 : 1 };
        if (_ !== !1 && be(h, X), L != null && L.length) {
          var de = new Pl(o.interaction);
          de.copyFrom(o.interaction.modification), de.prepareStates(L), a.subModification = de, de.startAll(i({}, o));
        }
      }, set: function(o) {
        var a = o.state, r = o.rect, h = o.coords, g = a.linkedEdges, x = be({}, h), S = a.equalDelta ? Xa : Zo;
        if (be(o.edges, g), S(a, a.xIsPrimaryAxis, h, r), !a.subModification) return null;
        var _ = be({}, r);
        It(g, _, { x: h.x - x.x, y: h.y - x.y });
        var D = a.subModification.setAll(i(i({}, o), {}, { rect: _, edges: g, pageCoords: h, prevCoords: h, prevRect: _ })), W = D.delta;
        return D.changed && (S(a, Math.abs(W.x) > Math.abs(W.y), D.coords, D.rect), be(h, D.coords)), D.eventProps;
      }, defaults: { ratio: "preserve", equalDelta: !1, modifiers: [], enabled: !1 } };
      function Xa(o, a, r) {
        var h = o.startCoords, g = o.edgeSign;
        a ? r.y = h.y + (r.x - h.x) * g.y : r.x = h.x + (r.y - h.y) * g.x;
      }
      function Zo(o, a, r, h) {
        var g = o.startRect, x = o.startCoords, S = o.ratio, _ = o.edgeSign;
        if (a) {
          var D = h.width / S;
          r.y = x.y + (D - g.height) * _.y;
        } else {
          var W = h.height * S;
          r.x = x.x + (W - g.width) * _.x;
        }
      }
      var ea = Gn(qn, "aspectRatio"), Vi = function() {
      };
      Vi._defaults = {};
      var ui = Vi;
      function wi(o, a, r) {
        return z.func(o) ? Je(o, a.interactable, a.element, [r.x, r.y, a]) : Je(o, a.interactable, a.element);
      }
      var Fi = { start: function(o) {
        var a = o.rect, r = o.startOffset, h = o.state, g = o.interaction, x = o.pageCoords, S = h.options, _ = S.elementRect, D = be({ left: 0, top: 0, right: 0, bottom: 0 }, S.offset || {});
        if (a && _) {
          var W = wi(S.restriction, g, x);
          if (W) {
            var L = W.right - W.left - a.width, X = W.bottom - W.top - a.height;
            L < 0 && (D.left += L, D.right += L), X < 0 && (D.top += X, D.bottom += X);
          }
          D.left += r.left - a.width * _.left, D.top += r.top - a.height * _.top, D.right += r.right - a.width * (1 - _.right), D.bottom += r.bottom - a.height * (1 - _.bottom);
        }
        h.offset = D;
      }, set: function(o) {
        var a = o.coords, r = o.interaction, h = o.state, g = h.options, x = h.offset, S = wi(g.restriction, r, a);
        if (S) {
          var _ = (function(D) {
            return !D || "left" in D && "top" in D || ((D = be({}, D)).left = D.x || 0, D.top = D.y || 0, D.right = D.right || D.left + D.width, D.bottom = D.bottom || D.top + D.height), D;
          })(S);
          a.x = Math.max(Math.min(_.right - x.right, a.x), _.left + x.left), a.y = Math.max(Math.min(_.bottom - x.bottom, a.y), _.top + x.top);
        }
      }, defaults: { restriction: null, elementRect: null, offset: null, endOnly: !1, enabled: !1 } }, Qa = Gn(Fi, "restrict"), ci = { top: 1 / 0, left: 1 / 0, bottom: -1 / 0, right: -1 / 0 }, Un = { top: -1 / 0, left: -1 / 0, bottom: 1 / 0, right: 1 / 0 };
      function Bi(o, a) {
        for (var r = 0, h = ["top", "left", "bottom", "right"]; r < h.length; r++) {
          var g = h[r];
          g in o || (o[g] = a[g]);
        }
        return o;
      }
      var Hi = { noInner: ci, noOuter: Un, start: function(o) {
        var a, r = o.interaction, h = o.startOffset, g = o.state, x = g.options;
        x && (a = Ge(wi(x.offset, r, r.coords.start.page))), a = a || { x: 0, y: 0 }, g.offset = { top: a.y + h.top, left: a.x + h.left, bottom: a.y - h.bottom, right: a.x - h.right };
      }, set: function(o) {
        var a = o.coords, r = o.edges, h = o.interaction, g = o.state, x = g.offset, S = g.options;
        if (r) {
          var _ = be({}, a), D = wi(S.inner, h, _) || {}, W = wi(S.outer, h, _) || {};
          Bi(D, ci), Bi(W, Un), r.top ? a.y = Math.min(Math.max(W.top + x.top, _.y), D.top + x.top) : r.bottom && (a.y = Math.max(Math.min(W.bottom + x.bottom, _.y), D.bottom + x.bottom)), r.left ? a.x = Math.min(Math.max(W.left + x.left, _.x), D.left + x.left) : r.right && (a.x = Math.max(Math.min(W.right + x.right, _.x), D.right + x.right));
        }
      }, defaults: { inner: null, outer: null, offset: null, endOnly: !1, enabled: !1 } }, yo = Gn(Hi, "restrictEdges"), bo = be({ get elementRect() {
        return { top: 0, left: 0, bottom: 1, right: 1 };
      }, set elementRect(o) {
      } }, Fi.defaults), Dl = Gn({ start: Fi.start, set: Fi.set, defaults: bo }, "restrictRect"), ta = { width: -1 / 0, height: -1 / 0 }, na = { width: 1 / 0, height: 1 / 0 }, ia = Gn({ start: function(o) {
        return Hi.start(o);
      }, set: function(o) {
        var a = o.interaction, r = o.state, h = o.rect, g = o.edges, x = r.options;
        if (g) {
          var S = vt(wi(x.min, a, o.coords)) || ta, _ = vt(wi(x.max, a, o.coords)) || na;
          r.options = { endOnly: x.endOnly, inner: be({}, Hi.noInner), outer: be({}, Hi.noOuter) }, g.top ? (r.options.inner.top = h.bottom - S.height, r.options.outer.top = h.bottom - _.height) : g.bottom && (r.options.inner.bottom = h.top + S.height, r.options.outer.bottom = h.top + _.height), g.left ? (r.options.inner.left = h.right - S.width, r.options.outer.left = h.right - _.width) : g.right && (r.options.inner.right = h.left + S.width, r.options.outer.right = h.left + _.width), Hi.set(o), r.options = x;
        }
      }, defaults: { min: null, max: null, endOnly: !1, enabled: !1 } }, "restrictSize"), Ll = { start: function(o) {
        var a, r = o.interaction, h = o.interactable, g = o.element, x = o.rect, S = o.state, _ = o.startOffset, D = S.options, W = D.offsetWithOrigin ? (function(ne) {
          var de = ne.interaction.element, he = Ge(Je(ne.state.options.origin, null, null, [de])), pe = he || ft(ne.interactable, de, ne.interaction.prepared.name);
          return pe;
        })(o) : { x: 0, y: 0 };
        if (D.offset === "startCoords") a = { x: r.coords.start.page.x, y: r.coords.start.page.y };
        else {
          var L = Je(D.offset, h, g, [r]);
          (a = Ge(L) || { x: 0, y: 0 }).x += W.x, a.y += W.y;
        }
        var X = D.relativePoints;
        S.offsets = x && X && X.length ? X.map((function(ne, de) {
          return { index: de, relativePoint: ne, x: _.left - x.width * ne.x + a.x, y: _.top - x.height * ne.y + a.y };
        })) : [{ index: 0, relativePoint: null, x: a.x, y: a.y }];
      }, set: function(o) {
        var a = o.interaction, r = o.coords, h = o.state, g = h.options, x = h.offsets, S = ft(a.interactable, a.element, a.prepared.name), _ = be({}, r), D = [];
        g.offsetWithOrigin || (_.x -= S.x, _.y -= S.y);
        for (var W = 0, L = x; W < L.length; W++) for (var X = L[W], ne = _.x - X.x, de = _.y - X.y, he = 0, pe = g.targets.length; he < pe; he++) {
          var we = g.targets[he], Se = void 0;
          (Se = z.func(we) ? we(ne, de, a._proxy, X, he) : we) && D.push({ x: (z.number(Se.x) ? Se.x : ne) + X.x, y: (z.number(Se.y) ? Se.y : de) + X.y, range: z.number(Se.range) ? Se.range : g.range, source: we, index: he, offset: X });
        }
        for (var Pe = { target: null, inRange: !1, distance: 0, range: 0, delta: { x: 0, y: 0 } }, Ve = 0; Ve < D.length; Ve++) {
          var Ke = D[Ve], Re = Ke.range, We = Ke.x - _.x, ht = Ke.y - _.y, rt = At(We, ht), yt = rt <= Re;
          Re === 1 / 0 && Pe.inRange && Pe.range !== 1 / 0 && (yt = !1), Pe.target && !(yt ? Pe.inRange && Re !== 1 / 0 ? rt / Re < Pe.distance / Pe.range : Re === 1 / 0 && Pe.range !== 1 / 0 || rt < Pe.distance : !Pe.inRange && rt < Pe.distance) || (Pe.target = Ke, Pe.distance = rt, Pe.range = Re, Pe.inRange = yt, Pe.delta.x = We, Pe.delta.y = ht);
        }
        return Pe.inRange && (r.x = Pe.target.x, r.y = Pe.target.y), h.closest = Pe, Pe;
      }, defaults: { range: 1 / 0, targets: null, offset: null, offsetWithOrigin: !0, origin: null, relativePoints: null, endOnly: !1, enabled: !1 } }, la = Gn(Ll, "snap"), ol = { start: function(o) {
        var a = o.state, r = o.edges, h = a.options;
        if (!r) return null;
        o.state = { options: { targets: null, relativePoints: [{ x: r.left ? 0 : 1, y: r.top ? 0 : 1 }], offset: h.offset || "self", origin: { x: 0, y: 0 }, range: h.range } }, a.targetFields = a.targetFields || [["width", "height"], ["x", "y"]], Ll.start(o), a.offsets = o.state.offsets, o.state = a;
      }, set: function(o) {
        var a = o.interaction, r = o.state, h = o.coords, g = r.options, x = r.offsets, S = { x: h.x - x[0].x, y: h.y - x[0].y };
        r.options = be({}, g), r.options.targets = [];
        for (var _ = 0, D = g.targets || []; _ < D.length; _++) {
          var W = D[_], L = void 0;
          if (L = z.func(W) ? W(S.x, S.y, a) : W) {
            for (var X = 0, ne = r.targetFields; X < ne.length; X++) {
              var de = ne[X], he = de[0], pe = de[1];
              if (he in L || pe in L) {
                L.x = L[he], L.y = L[pe];
                break;
              }
            }
            r.options.targets.push(L);
          }
        }
        var we = Ll.set(o);
        return r.options = g, we;
      }, defaults: { range: 1 / 0, targets: null, offset: null, endOnly: !1, enabled: !1 } }, Ja = Gn(ol, "snapSize"), ql = { aspectRatio: ea, restrictEdges: yo, restrict: Qa, restrictRect: Dl, restrictSize: ia, snapEdges: Gn({ start: function(o) {
        var a = o.edges;
        return a ? (o.state.targetFields = o.state.targetFields || [[a.left ? "left" : "right", a.top ? "top" : "bottom"]], ol.start(o)) : null;
      }, set: ol.set, defaults: be(pi(ol.defaults), { targets: void 0, range: void 0, offset: { x: 0, y: 0 } }) }, "snapEdges"), snap: la, snapSize: Ja, spring: ui, avoid: ui, transform: ui, rubberband: ui }, oa = { id: "modifiers", install: function(o) {
        var a = o.interactStatic;
        for (var r in o.usePlugin(nl), o.usePlugin(Ka), a.modifiers = ql, ql) {
          var h = ql[r], g = h._defaults, x = h._methods;
          g._methods = x, o.defaults.perAction[r] = g;
        }
      } }, Wi = oa, al = (function(o) {
        p(r, o);
        var a = C(r);
        function r(h, g, x, S, _, D) {
          var W;
          if (s(this, r), Wt(v(W = a.call(this, _)), x), x !== g && Wt(v(W), g), W.timeStamp = D, W.originalEvent = x, W.type = h, W.pointerId = je(g), W.pointerType = St(g), W.target = S, W.currentTarget = null, h === "tap") {
            var L = _.getPointerIndex(g);
            W.dt = W.timeStamp - _.pointers[L].downTime;
            var X = W.timeStamp - _.tapTime;
            W.double = !!_.prevTap && _.prevTap.type !== "doubletap" && _.prevTap.target === W.target && X < 500;
          } else h === "doubletap" && (W.dt = g.timeStamp - _.tapTime, W.double = !0);
          return W;
        }
        return c(r, [{ key: "_subtractOrigin", value: function(h) {
          var g = h.x, x = h.y;
          return this.pageX -= g, this.pageY -= x, this.clientX -= g, this.clientY -= x, this;
        } }, { key: "_addOrigin", value: function(h) {
          var g = h.x, x = h.y;
          return this.pageX += g, this.pageY += x, this.clientX += g, this.clientY += x, this;
        } }, { key: "preventDefault", value: function() {
          this.originalEvent.preventDefault();
        } }]), r;
      })(Yt), Dt = { id: "pointer-events/base", before: ["inertia", "modifiers", "auto-start", "actions"], install: function(o) {
        o.pointerEvents = Dt, o.defaults.actions.pointerEvents = Dt.defaults, be(o.actions.phaselessTypes, Dt.types);
      }, listeners: { "interactions:new": function(o) {
        var a = o.interaction;
        a.prevTap = null, a.tapTime = 0;
      }, "interactions:update-pointer": function(o) {
        var a = o.down, r = o.pointerInfo;
        !a && r.hold || (r.hold = { duration: 1 / 0, timeout: null });
      }, "interactions:move": function(o, a) {
        var r = o.interaction, h = o.pointer, g = o.event, x = o.eventTarget;
        o.duplicate || r.pointerIsDown && !r.pointerWasMoved || (r.pointerIsDown && Rl(o), Kn({ interaction: r, pointer: h, event: g, eventTarget: x, type: "move" }, a));
      }, "interactions:down": function(o, a) {
        (function(r, h) {
          for (var g = r.interaction, x = r.pointer, S = r.event, _ = r.eventTarget, D = r.pointerIndex, W = g.pointers[D].hold, L = oe(_), X = { interaction: g, pointer: x, event: S, eventTarget: _, type: "hold", targets: [], path: L, node: null }, ne = 0; ne < L.length; ne++) {
            var de = L[ne];
            X.node = de, h.fire("pointerEvents:collect-targets", X);
          }
          if (X.targets.length) {
            for (var he = 1 / 0, pe = 0, we = X.targets; pe < we.length; pe++) {
              var Se = we[pe].eventable.options.holdDuration;
              Se < he && (he = Se);
            }
            W.duration = he, W.timeout = setTimeout((function() {
              Kn({ interaction: g, eventTarget: _, pointer: x, event: S, type: "hold" }, h);
            }), he);
          }
        })(o, a), Kn(o, a);
      }, "interactions:up": function(o, a) {
        Rl(o), Kn(o, a), (function(r, h) {
          var g = r.interaction, x = r.pointer, S = r.event, _ = r.eventTarget;
          g.pointerWasMoved || Kn({ interaction: g, eventTarget: _, pointer: x, event: S, type: "tap" }, h);
        })(o, a);
      }, "interactions:cancel": function(o, a) {
        Rl(o), Kn(o, a);
      } }, PointerEvent: al, fire: Kn, collectEventTargets: Nt, defaults: { holdDuration: 600, ignoreFrom: null, allowFrom: null, origin: { x: 0, y: 0 } }, types: { down: !0, move: !0, up: !0, cancel: !0, tap: !0, doubletap: !0, hold: !0 } };
      function Kn(o, a) {
        var r = o.interaction, h = o.pointer, g = o.event, x = o.eventTarget, S = o.type, _ = o.targets, D = _ === void 0 ? Nt(o, a) : _, W = new al(S, h, g, x, r, a.now());
        a.fire("pointerEvents:new", { pointerEvent: W });
        for (var L = { interaction: r, pointer: h, event: g, eventTarget: x, targets: D, type: S, pointerEvent: W }, X = 0; X < D.length; X++) {
          var ne = D[X];
          for (var de in ne.props || {}) W[de] = ne.props[de];
          var he = ft(ne.eventable, ne.node);
          if (W._subtractOrigin(he), W.eventable = ne.eventable, W.currentTarget = ne.node, ne.eventable.fire(W), W._addOrigin(he), W.immediatePropagationStopped || W.propagationStopped && X + 1 < D.length && D[X + 1].node !== W.currentTarget) break;
        }
        if (a.fire("pointerEvents:fired", L), S === "tap") {
          var pe = W.double ? Kn({ interaction: r, pointer: h, event: g, eventTarget: x, type: "doubletap" }, a) : W;
          r.prevTap = pe, r.tapTime = pe.timeStamp;
        }
        return W;
      }
      function Nt(o, a) {
        var r = o.interaction, h = o.pointer, g = o.event, x = o.eventTarget, S = o.type, _ = r.getPointerIndex(h), D = r.pointers[_];
        if (S === "tap" && (r.pointerWasMoved || !D || D.downTarget !== x)) return [];
        for (var W = oe(x), L = { interaction: r, pointer: h, event: g, eventTarget: x, type: S, path: W, targets: [], node: null }, X = 0; X < W.length; X++) {
          var ne = W[X];
          L.node = ne, a.fire("pointerEvents:collect-targets", L);
        }
        return S === "hold" && (L.targets = L.targets.filter((function(de) {
          var he, pe;
          return de.eventable.options.holdDuration === ((he = r.pointers[_]) == null || (pe = he.hold) == null ? void 0 : pe.duration);
        }))), L.targets;
      }
      function Rl(o) {
        var a = o.interaction, r = o.pointerIndex, h = a.pointers[r].hold;
        h && h.timeout && (clearTimeout(h.timeout), h.timeout = null);
      }
      var xo = Object.freeze({ __proto__: null, default: Dt });
      function sl(o) {
        var a = o.interaction;
        a.holdIntervalHandle && (clearInterval(a.holdIntervalHandle), a.holdIntervalHandle = null);
      }
      var Za = { id: "pointer-events/holdRepeat", install: function(o) {
        o.usePlugin(Dt);
        var a = o.pointerEvents;
        a.defaults.holdRepeatInterval = 0, a.types.holdrepeat = o.actions.phaselessTypes.holdrepeat = !0;
      }, listeners: ["move", "up", "cancel", "endall"].reduce((function(o, a) {
        return o["pointerEvents:".concat(a)] = sl, o;
      }), { "pointerEvents:new": function(o) {
        var a = o.pointerEvent;
        a.type === "hold" && (a.count = (a.count || 0) + 1);
      }, "pointerEvents:fired": function(o, a) {
        var r = o.interaction, h = o.pointerEvent, g = o.eventTarget, x = o.targets;
        if (h.type === "hold" && x.length) {
          var S = x[0].eventable.options.holdRepeatInterval;
          S <= 0 || (r.holdIntervalHandle = setTimeout((function() {
            a.pointerEvents.fire({ interaction: r, eventTarget: g, type: "hold", pointer: h, event: h }, a);
          }), S));
        }
      } }) }, es = Za, wo = { id: "pointer-events/interactableTargets", install: function(o) {
        var a = o.Interactable;
        a.prototype.pointerEvents = function(h) {
          return be(this.events.options, h), this;
        };
        var r = a.prototype._backCompatOption;
        a.prototype._backCompatOption = function(h, g) {
          var x = r.call(this, h, g);
          return x === this && (this.events.options[h] = g), x;
        };
      }, listeners: { "pointerEvents:collect-targets": function(o, a) {
        var r = o.targets, h = o.node, g = o.type, x = o.eventTarget;
        a.interactables.forEachMatch(h, (function(S) {
          var _ = S.events, D = _.options;
          _.types[g] && _.types[g].length && S.testIgnoreAllow(D, h, x) && r.push({ node: h, eventable: _, props: { interactable: S } });
        }));
      }, "interactable:new": function(o) {
        var a = o.interactable;
        a.events.getRect = function(r) {
          return a.getRect(r);
        };
      }, "interactable:set": function(o, a) {
        var r = o.interactable, h = o.options;
        be(r.events.options, a.pointerEvents.defaults), be(r.events.options, h.pointerEvents || {});
      } } }, w = wo, T = { id: "pointer-events", install: function(o) {
        o.usePlugin(xo), o.usePlugin(es), o.usePlugin(w);
      } }, N = T, F = { id: "reflow", install: function(o) {
        var a = o.Interactable;
        o.actions.phases.reflow = !0, a.prototype.reflow = function(r) {
          return (function(h, g, x) {
            for (var S = h.getAllElements(), _ = x.window.Promise, D = _ ? [] : null, W = function() {
              var X = S[L], ne = h.getRect(X);
              if (!ne) return 1;
              var de, he = zt(x.interactions.list, (function(Se) {
                return Se.interacting() && Se.interactable === h && Se.element === X && Se.prepared.name === g.name;
              }));
              if (he) he.move(), D && (de = he._reflowPromise || new _((function(Se) {
                he._reflowResolve = Se;
              })));
              else {
                var pe = vt(ne), we = /* @__PURE__ */ (function(Se) {
                  return { coords: Se, get page() {
                    return this.coords.page;
                  }, get client() {
                    return this.coords.client;
                  }, get timeStamp() {
                    return this.coords.timeStamp;
                  }, get pageX() {
                    return this.coords.page.x;
                  }, get pageY() {
                    return this.coords.page.y;
                  }, get clientX() {
                    return this.coords.client.x;
                  }, get clientY() {
                    return this.coords.client.y;
                  }, get pointerId() {
                    return this.coords.pointerId;
                  }, get target() {
                    return this.coords.target;
                  }, get type() {
                    return this.coords.type;
                  }, get pointerType() {
                    return this.coords.pointerType;
                  }, get buttons() {
                    return this.coords.buttons;
                  }, preventDefault: function() {
                  } };
                })({ page: { x: pe.x, y: pe.y }, client: { x: pe.x, y: pe.y }, timeStamp: x.now() });
                de = (function(Se, Pe, Ve, Ke, Re) {
                  var We = Se.interactions.new({ pointerType: "reflow" }), ht = { interaction: We, event: Re, pointer: Re, eventTarget: Ve, phase: "reflow" };
                  We.interactable = Pe, We.element = Ve, We.prevEvent = Re, We.updatePointer(Re, Re, Ve, !0), Be(We.coords.delta), Bt(We.prepared, Ke), We._doPhase(ht);
                  var rt = Se.window, yt = rt.Promise, Ct = yt ? new yt((function(Vt) {
                    We._reflowResolve = Vt;
                  })) : void 0;
                  return We._reflowPromise = Ct, We.start(Ke, Pe, Ve), We._interacting ? (We.move(ht), We.end(Re)) : (We.stop(), We._reflowResolve()), We.removePointer(Re, Re), Ct;
                })(x, h, X, g, we);
              }
              D && D.push(de);
            }, L = 0; L < S.length && !W(); L++) ;
            return D && _.all(D).then((function() {
              return h;
            }));
          })(this, r, o);
        };
      }, listeners: { "interactions:stop": function(o, a) {
        var r = o.interaction;
        r.pointerType === "reflow" && (r._reflowResolve && r._reflowResolve(), (function(h, g) {
          h.splice(h.indexOf(g), 1);
        })(a.interactions.list, r));
      } } }, te = F;
      if ($t.use(Yo), $t.use(go), $t.use(N), $t.use(Xo), $t.use(Wi), $t.use(ho), $t.use(Va), $t.use(Jt), $t.use(te), $t.default = $t, l(e) === "object" && e) try {
        e.exports = $t;
      } catch {
      }
      return $t.default = $t, $t;
    }));
  })($o, $o.exports)), $o.exports;
}
var xv = /* @__PURE__ */ bv();
const xu = /* @__PURE__ */ df(xv), wu = /* @__PURE__ */ Me({
  __name: "grid-item",
  props: {
    isDraggable: { type: Boolean, default: void 0 },
    isResizable: { type: Boolean, default: void 0 },
    isBounded: { type: Boolean, default: void 0 },
    static: { type: Boolean, default: !1 },
    minH: { default: 1 },
    minW: { default: 1 },
    maxH: { default: 1 / 0 },
    maxW: { default: 1 / 0 },
    x: {},
    y: {},
    w: {},
    h: {},
    i: {},
    dragIgnoreFrom: { default: "a, button" },
    dragAllowFrom: { default: void 0 },
    resizeIgnoreFrom: { default: "a, button" },
    preserveAspectRatio: { type: Boolean, default: !1 },
    dragOption: { default: () => ({}) },
    resizeOption: { default: () => ({}) }
  },
  emits: ["container-resized", "resize", "resized", "move", "moved"],
  setup(e, { expose: t, emit: n }) {
    const i = e, l = n, s = bl(ud), d = bl(cd);
    if (!s)
      throw new Error("[grid-layout-plus]: missing layout store, GridItem must under a GridLayout.");
    const c = lc(null), u = wl({
      cols: 1,
      containerWidth: 100,
      rowHeight: 30,
      margin: [10, 10],
      maxRows: 1 / 0,
      draggable: void 0,
      resizable: void 0,
      bounded: void 0,
      transformScale: 1,
      useCssTransforms: !0,
      useStyleCursor: !0,
      isDragging: !1,
      dragging: {
        top: -1,
        left: -1
      },
      isResizing: !1,
      resizing: {
        width: -1,
        height: -1
      },
      style: {},
      rtl: !1
    });
    let p = !1, m = !1, b = NaN, v = NaN, C = NaN, P = NaN, M = -1, q = -1, Q = -1, V = -1, Y = i.x, A = i.y, H = i.w, ee = i.h;
    const z = fe(), j = wl({
      i: Vd(i, "i"),
      state: u,
      wrapper: z,
      calcXY: Je
    });
    function J(ae) {
      Tt(ae);
    }
    function K() {
      ut();
    }
    function O(ae) {
      Pn(i.isDraggable) && (u.draggable = ae);
    }
    function Z(ae) {
      Pn(i.isResizable) && (u.resizable = ae);
    }
    function U(ae) {
      Pn(i.isBounded) && (u.bounded = ae);
    }
    function $(ae) {
      u.transformScale = ae;
    }
    function G(ae) {
      u.rowHeight = ae;
    }
    function ue(ae) {
      u.maxRows = ae;
    }
    function ie() {
      u.rtl = yu() === "rtl", ut();
    }
    function Ee(ae) {
      u.cols = Math.floor(ae);
    }
    s.increaseItem(j), oc(() => {
      u.rtl = yu() === "rtl";
    }), An(() => {
      s.responsive && s.lastBreakpoint ? u.cols = pd(s.lastBreakpoint, s.cols) : u.cols = s.colNum, u.rowHeight = s.rowHeight, u.containerWidth = s.width !== null ? s.width : 100, u.margin = s.margin !== void 0 ? s.margin.map(Number) : [10, 10], u.maxRows = s.maxRows, Pn(i.isDraggable) ? u.draggable = s.isDraggable : u.draggable = i.isDraggable, Pn(i.isResizable) ? u.resizable = s.isResizable : u.resizable = i.isResizable, Pn(i.isBounded) ? u.bounded = s.isBounded : u.bounded = i.isBounded, u.transformScale = s.transformScale, u.useCssTransforms = s.useCssTransforms, u.useStyleCursor = s.useStyleCursor, ka(() => {
        Y = i.x, A = i.y, ee = i.h, H = i.w, pn(se);
      }), d.on("updateWidth", J), d.on("compact", K), d.on("setDraggable", O), d.on("setResizable", Z), d.on("setBounded", U), d.on("setTransformScale", $), d.on("setRowHeight", G), d.on("setMaxRows", ue), d.on("directionchange", ie), d.on("setColNum", Ee);
    }), no(() => {
      d.off("updateWidth", J), d.off("compact", K), d.off("setDraggable", O), d.off("setResizable", Z), d.off("setBounded", U), d.off("setTransformScale", $), d.off("setRowHeight", G), d.off("setMaxRows", ue), d.off("directionchange", ie), d.off("setColNum", Ee), c.value && (c.value.unset(), c.value = null), s.decreaseItem(j);
    }), t({ state: u, wrapper: z });
    const ve = typeof navigator < "u" ? navigator.userAgent.toLowerCase().includes("android") : !1, ge = re(() => u.resizable && !i.static), le = re(() => s.isMirrored ? !u.rtl : u.rtl), me = re(() => (u.draggable || u.resizable) && !i.static), Oe = dv("item"), xe = re(() => ({
      [Oe.b()]: !0,
      [Oe.bm("resizable")]: ge.value,
      [Oe.bm("static")]: i.static,
      [Oe.bm("resizing")]: u.isResizing,
      [Oe.bm("dragging")]: u.isDragging,
      [Oe.bm("transform")]: u.useCssTransforms,
      [Oe.bm("rtl")]: le.value,
      [Oe.bm("no-touch")]: ve && me.value
    })), ke = re(() => [Oe.be("resizer"), le.value && Oe.bem("resizer", "rtl")].filter(Boolean));
    Fe(
      () => i.isDraggable,
      (ae) => {
        u.draggable = ae;
      }
    ), Fe(
      () => i.static,
      () => {
        pn(Wt), pn(Be);
      }
    ), Fe(
      () => u.draggable,
      () => {
        pn(Wt);
      }
    ), Fe(
      () => i.isResizable,
      (ae) => {
        u.resizable = ae;
      }
    ), Fe(
      () => i.isBounded,
      (ae) => {
        u.bounded = ae;
      }
    ), Fe(
      () => u.resizable,
      () => {
        pn(Be);
      }
    ), Fe(
      () => u.rowHeight,
      () => {
        pn(se), pn(oe);
      }
    ), Fe([() => u.cols, () => u.containerWidth], () => {
      pn(Be), pn(se), pn(oe);
    }), Fe([() => i.minH, () => i.maxH, () => i.minW, () => i.maxW], () => {
      pn(Be);
    }), Fe(le, () => {
      pn(Be), pn(se);
    }), Fe([() => s.margin, () => s.margin[0], () => s.margin[1]], () => {
      const ae = s.margin;
      !ae || ae[0] === u.margin[0] && ae[1] === u.margin[1] || (u.margin = ae.map(Number), pn(se), pn(oe));
    });
    function se() {
      i.x + i.w > u.cols ? (Y = 0, H = i.w > u.cols ? u.cols : i.w) : (Y = i.x, H = i.w);
      const ae = Le(Y, A, H, ee);
      u.isDragging && (ae.top = u.dragging.top, le.value ? ae.right = u.dragging.left : ae.left = u.dragging.left), u.isResizing && (ae.width = u.resizing.width, ae.height = u.resizing.height);
      let Ie;
      u.useCssTransforms ? le.value ? Ie = sv(ae.top, ae.right, ae.width, ae.height) : Ie = av(ae.top, ae.left, ae.width, ae.height) : le.value ? Ie = uv(ae.top, ae.right, ae.width, ae.height) : Ie = rv(ae.top, ae.left, ae.width, ae.height), u.style = Ie;
    }
    function oe() {
      const ae = {};
      for (const Ie of ["width", "height"]) {
        const _e = u.style[Ie].match(/^(\d+)px$/);
        if (!_e)
          return;
        ae[Ie] = _e[1];
      }
      l("container-resized", i.i, i.h, i.w, ae.height, ae.width);
    }
    function Te(ae) {
      if (i.static) return;
      const Ie = ae.type;
      if (Ie === "resizestart" && u.isResizing || Ie !== "resizestart" && !u.isResizing)
        return;
      const _e = vu(ae);
      if (Pn(_e)) return;
      const { x: je, y: ct } = _e, Ye = { width: 0, height: 0 };
      let qe;
      switch (Ie) {
        case "resizestart": {
          Be(), M = H, q = ee, qe = Le(Y, A, H, ee), Ye.width = qe.width, Ye.height = qe.height, u.resizing = Ye, u.isResizing = !0;
          break;
        }
        case "resizemove": {
          !ae.edges.right && !ae.edges.left && (C = je), !ae.edges.top && !ae.edges.bottom && (P = ct);
          const et = mu(C, P, je, ct);
          le.value ? Ye.width = u.resizing.width - et.deltaX / u.transformScale : Ye.width = u.resizing.width + et.deltaX / u.transformScale, Ye.height = u.resizing.height + et.deltaY / u.transformScale, u.resizing = Ye;
          break;
        }
        case "resizeend": {
          qe = Le(Y, A, H, ee), Ye.width = qe.width, Ye.height = qe.height, u.resizing = { width: -1, height: -1 }, u.isResizing = !1;
          break;
        }
      }
      qe = ft(Ye.height, Ye.width), qe.w < i.minW && (qe.w = i.minW), qe.w > i.maxW && (qe.w = i.maxW), qe.h < i.minH && (qe.h = i.minH), qe.h > i.maxH && (qe.h = i.maxH), qe.h < 1 && (qe.h = 1), qe.w < 1 && (qe.w = 1), C = je, P = ct, (H !== qe.w || ee !== qe.h) && l("resize", i.i, qe.h, qe.w, Ye.height, Ye.width), ae.type === "resizeend" && (M !== H || q !== ee) && l("resized", i.i, qe.h, qe.w, Ye.height, Ye.width), d.emit("resizeEvent", ae.type, i.i, Y, A, qe.h, qe.w);
    }
    function be(ae) {
      if (i.static || u.isResizing) return;
      const Ie = ae.type;
      if (Ie === "dragstart" && u.isDragging || Ie !== "dragstart" && !u.isDragging)
        return;
      const _e = vu(ae);
      if (Pn(_e)) return;
      const { x: je, y: ct } = _e, Ye = ae.target;
      if (!Ye.offsetParent) return;
      const qe = { top: 0, left: 0 };
      switch (Ie) {
        case "dragstart": {
          Q = Y, V = A;
          const it = Ye.offsetParent.getBoundingClientRect(), lt = Ye.getBoundingClientRect(), St = lt.left / u.transformScale, qt = it.left / u.transformScale, Yt = lt.right / u.transformScale, fn = it.right / u.transformScale, sn = lt.top / u.transformScale, Kt = it.top / u.transformScale;
          le.value ? qe.left = (Yt - fn) * -1 : qe.left = St - qt, qe.top = sn - Kt, u.dragging = qe, u.isDragging = !0;
          break;
        }
        case "dragmove": {
          const it = mu(b, v, je, ct);
          if (le.value ? qe.left = u.dragging.left - it.deltaX / u.transformScale : qe.left = u.dragging.left + it.deltaX / u.transformScale, qe.top = u.dragging.top + it.deltaY / u.transformScale, u.bounded) {
            const lt = Ye.offsetParent.clientHeight - vt(i.h, u.rowHeight, u.margin[1]);
            qe.top = It(qe.top, 0, lt);
            const St = Ge(), qt = u.containerWidth - vt(i.w, St, u.margin[0]);
            qe.left = It(qe.left, 0, qt);
          }
          u.dragging = qe;
          break;
        }
        case "dragend": {
          const it = Ye.offsetParent.getBoundingClientRect(), lt = Ye.getBoundingClientRect(), St = lt.left / u.transformScale, qt = it.left / u.transformScale, Yt = lt.right / u.transformScale, fn = it.right / u.transformScale, sn = lt.top / u.transformScale, Kt = it.top / u.transformScale;
          le.value ? qe.left = (Yt - fn) * -1 : qe.left = St - qt, qe.top = sn - Kt, u.dragging = { top: -1, left: -1 }, u.isDragging = !1;
          break;
        }
      }
      let et;
      le.value, et = Je(qe.top, qe.left), b = je, v = ct, (Y !== et.x || A !== et.y) && l("move", i.i, et.x, et.y), ae.type === "dragend" && (Q !== Y || V !== A) && l("moved", i.i, et.x, et.y), d.emit("dragEvent", ae.type, i.i, et.x, et.y, ee, H);
    }
    function Le(ae, Ie, _e, je) {
      const ct = Ge();
      let Ye;
      return le.value ? Ye = {
        right: Math.round(ct * ae + (ae + 1) * u.margin[0]),
        top: Math.round(u.rowHeight * Ie + (Ie + 1) * u.margin[1]),
        // 0 * Infinity === NaN, which causes problems with resize constraints;
        // Fix this if it occurs.
        // Note we do it here rather than later because Math.round(Infinity) causes depot
        width: _e === 1 / 0 ? _e : Math.round(ct * _e + Math.max(0, _e - 1) * u.margin[0]),
        height: je === 1 / 0 ? je : Math.round(u.rowHeight * je + Math.max(0, je - 1) * u.margin[1])
      } : Ye = {
        left: Math.round(ct * ae + (ae + 1) * u.margin[0]),
        top: Math.round(u.rowHeight * Ie + (Ie + 1) * u.margin[1]),
        // 0 * Infinity === NaN, which causes problems with resize constraints;
        // Fix this if it occurs.
        // Note we do it here rather than later because Math.round(Infinity) causes depot
        width: _e === 1 / 0 ? _e : Math.round(ct * _e + Math.max(0, _e - 1) * u.margin[0]),
        height: je === 1 / 0 ? je : Math.round(u.rowHeight * je + Math.max(0, je - 1) * u.margin[1])
      }, Ye;
    }
    function Je(ae, Ie) {
      const _e = Ge();
      let je = Math.round((Ie - u.margin[0]) / (_e + u.margin[0])), ct = Math.round((ae - u.margin[1]) / (u.rowHeight + u.margin[1]));
      return je = Math.max(Math.min(je, u.cols - H), 0), ct = Math.max(Math.min(ct, u.maxRows - ee), 0), { x: je, y: ct };
    }
    function Ge() {
      return (u.containerWidth - u.margin[0] * (u.cols + 1)) / u.cols;
    }
    function vt(ae, Ie, _e) {
      return Number.isFinite(ae) ? Math.round(Ie * ae + Math.max(0, ae - 1) * _e) : ae;
    }
    function It(ae, Ie, _e) {
      return Math.max(Math.min(ae, _e), Ie);
    }
    function ft(ae, Ie, _e = !1) {
      const je = Ge();
      let ct = Math.round((Ie + u.margin[0]) / (je + u.margin[0])), Ye = 0;
      return _e ? Ye = Math.ceil((ae + u.margin[1]) / (u.rowHeight + u.margin[1])) : Ye = Math.round((ae + u.margin[1]) / (u.rowHeight + u.margin[1])), ct = Math.max(Math.min(ct, u.cols - Y), 0), Ye = Math.max(Math.min(Ye, u.maxRows - A), 0), { w: ct, h: Ye };
    }
    function Tt(ae, Ie) {
      u.containerWidth = ae;
    }
    function ut() {
      se();
    }
    function At() {
      !c.value && z.value && (c.value = xu(z.value), u.useStyleCursor || c.value.styleCursor(!1));
    }
    const jn = hu(be);
    function Wt() {
      if (At(), !!c.value)
        if (u.draggable && !i.static) {
          const ae = {
            ignoreFrom: i.dragIgnoreFrom,
            allowFrom: i.dragAllowFrom,
            ...i.dragOption
          };
          c.value.draggable(ae), p || (p = !0, c.value.on("dragstart dragmove dragend", (Ie) => {
            Ie.type === "dragmove" ? jn(Ie) : be(Ie);
          }));
        } else
          c.value.draggable({ enabled: !1 });
    }
    const ln = hu(Te);
    function Be() {
      if (At(), !!c.value)
        if (u.resizable && !i.static) {
          const ae = Le(0, 0, i.maxW, i.maxH), Ie = Le(0, 0, i.minW, i.minH), _e = {
            edges: {
              left: le.value ? `.${ke.value[0]}` : !1,
              right: le.value ? !1 : `.${ke.value[0]}`,
              bottom: `.${ke.value[0]}`,
              top: !1
            },
            ignoreFrom: i.resizeIgnoreFrom,
            restrictSize: {
              min: {
                height: Ie.height * u.transformScale,
                width: Ie.width * u.transformScale
              },
              max: {
                height: ae.height * u.transformScale,
                width: ae.width * u.transformScale
              }
            },
            ...i.resizeOption
          };
          i.preserveAspectRatio && (_e.modifiers = [xu.modifiers.aspectRatio({ ratio: "preserve" })]), c.value.resizable(_e), m || (m = !0, c.value.on("resizestart resizemove resizeend", (je) => {
            je.type === "resizemove" ? ln(je) : Te(je);
          }));
        } else
          c.value.resizable({ enabled: !1 });
    }
    return (ae, Ie) => (E(), B("section", {
      ref_key: "wrapper",
      ref: z,
      class: Ae(xe.value),
      style: He(u.style)
    }, [
      Ti(ae.$slots, "default"),
      ge.value ? (E(), B("span", {
        key: 0,
        class: Ae(ke.value)
      }, null, 2)) : ye("", !0)
    ], 6));
  }
}), Cl = typeof window < "u";
var Su;
Cl && (Su = window?.navigator) != null && Su.userAgent && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function ku(e) {
  return e != null;
}
function Cu() {
}
const wv = Object.freeze({
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
});
Object.freeze(new Set(Object.keys(wv)));
const Sv = Cl && ("ontouchstart" in window || kv() > 0), _u = Sv ? "pointerdown" : "click";
function kv() {
  return typeof navigator < "u" && (navigator.maxTouchPoints || navigator.msMaxTouchPoints) || 0;
}
function Cv(e, t, n = window.Event) {
  const { type: i, bubbles: l = !1, cancelable: s = !1, ...d } = t;
  if (!ku(i) || i === "") return !1;
  let c;
  return ku(n) ? c = new n(i, { bubbles: l, cancelable: s }) : (c = document.createEvent("HTMLEvents"), c.initEvent(i, l, s)), Object.assign(c, d), e.dispatchEvent(c);
}
const _v = "clickoutside", Mv = /* @__PURE__ */ new Set();
let hs = null;
function zv(e, t) {
  return e instanceof Node ? t === e || t.contains(e) || !!t.__transferElement && (t.__transferElement === e || t.__transferElement.contains(e)) : !1;
}
Cl && (_u === "click" && document.addEventListener(
  "pointerdown",
  (e) => {
    hs = e.target;
  },
  !0
), document.addEventListener(
  _u,
  (e) => {
    const t = hs;
    hs = null, Mv.forEach((n) => {
      if (t && zv(t, n))
        return;
      const i = e.target, l = e.composedPath && e.composedPath();
      n !== i && (l ? !l.includes(n) : !n.contains(i)) && (!n.__transferElement || n.__transferElement !== i && !n.__transferElement.contains(i)) && Cv(n, { type: _v });
    });
  },
  !0
));
const Tv = [
  [
    "requestFullscreen",
    "exitFullscreen",
    "fullscreenElement",
    "fullscreenEnabled",
    "fullscreenchange",
    "fullscreenerror"
  ],
  // New WebKit
  [
    "webkitRequestFullscreen",
    "webkitExitFullscreen",
    "webkitFullscreenElement",
    "webkitFullscreenEnabled",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  // Old WebKit
  [
    "webkitRequestFullScreen",
    "webkitCancelFullScreen",
    "webkitCurrentFullScreenElement",
    "webkitCancelFullScreen",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  [
    "mozRequestFullScreen",
    "mozCancelFullScreen",
    "mozFullScreenElement",
    "mozFullScreenEnabled",
    "mozfullscreenchange",
    "mozfullscreenerror"
  ],
  [
    "msRequestFullscreen",
    "msExitFullscreen",
    "msFullscreenElement",
    "msFullscreenEnabled",
    "MSFullscreenChange",
    "MSFullscreenError"
  ]
];
let wa;
if (Cl) {
  for (const e of Tv)
    if (e[1] in document) {
      wa = e;
      break;
    }
}
re(() => !1);
const Pv = /* @__PURE__ */ new Set(), $v = /* @__PURE__ */ new WeakMap();
if (Cl && wa) {
  const e = wa[2], t = wa[4];
  document.addEventListener(
    t,
    () => {
      if (Pv.forEach((n) => {
        n.value = !1;
      }), document[e]) {
        const n = $v.get(document[e]);
        n && (n.value = !0);
      }
    },
    !1
  );
}
const md = /* @__PURE__ */ new Map();
md.set("x", 0);
md.set("y", 0);
var ml = [], Ev = function() {
  return ml.some(function(e) {
    return e.activeTargets.length > 0;
  });
}, Iv = function() {
  return ml.some(function(e) {
    return e.skippedTargets.length > 0;
  });
}, Mu = "ResizeObserver loop completed with undelivered notifications.", Av = function() {
  var e;
  typeof ErrorEvent == "function" ? e = new ErrorEvent("error", {
    message: Mu
  }) : (e = document.createEvent("Event"), e.initEvent("error", !1, !1), e.message = Mu), window.dispatchEvent(e);
}, No;
(function(e) {
  e.BORDER_BOX = "border-box", e.CONTENT_BOX = "content-box", e.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
})(No || (No = {}));
var yl = function(e) {
  return Object.freeze(e);
}, Ov = /* @__PURE__ */ (function() {
  function e(t, n) {
    this.inlineSize = t, this.blockSize = n, yl(this);
  }
  return e;
})(), yd = (function() {
  function e(t, n, i, l) {
    return this.x = t, this.y = n, this.width = i, this.height = l, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, yl(this);
  }
  return e.prototype.toJSON = function() {
    var t = this, n = t.x, i = t.y, l = t.top, s = t.right, d = t.bottom, c = t.left, u = t.width, p = t.height;
    return { x: n, y: i, top: l, right: s, bottom: d, left: c, width: u, height: p };
  }, e.fromRect = function(t) {
    return new e(t.x, t.y, t.width, t.height);
  }, e;
})(), ir = function(e) {
  return e instanceof SVGElement && "getBBox" in e;
}, bd = function(e) {
  if (ir(e)) {
    var t = e.getBBox(), n = t.width, i = t.height;
    return !n && !i;
  }
  var l = e, s = l.offsetWidth, d = l.offsetHeight;
  return !(s || d || e.getClientRects().length);
}, zu = function(e) {
  var t;
  if (e instanceof Element)
    return !0;
  var n = (t = e?.ownerDocument) === null || t === void 0 ? void 0 : t.defaultView;
  return !!(n && e instanceof n.Element);
}, Dv = function(e) {
  switch (e.tagName) {
    case "INPUT":
      if (e.type !== "image")
        break;
    case "VIDEO":
    case "AUDIO":
    case "EMBED":
    case "OBJECT":
    case "CANVAS":
    case "IFRAME":
    case "IMG":
      return !0;
  }
  return !1;
}, Lo = typeof window < "u" ? window : {}, da = /* @__PURE__ */ new WeakMap(), Tu = /auto|scroll/, Lv = /^tb|vertical/, qv = /msie|trident/i.test(Lo.navigator && Lo.navigator.userAgent), fi = function(e) {
  return parseFloat(e || "0");
}, Yl = function(e, t, n) {
  return e === void 0 && (e = 0), t === void 0 && (t = 0), n === void 0 && (n = !1), new Ov((n ? t : e) || 0, (n ? e : t) || 0);
}, Pu = yl({
  devicePixelContentBoxSize: Yl(),
  borderBoxSize: Yl(),
  contentBoxSize: Yl(),
  contentRect: new yd(0, 0, 0, 0)
}), xd = function(e, t) {
  if (t === void 0 && (t = !1), da.has(e) && !t)
    return da.get(e);
  if (bd(e))
    return da.set(e, Pu), Pu;
  var n = getComputedStyle(e), i = ir(e) && e.ownerSVGElement && e.getBBox(), l = !qv && n.boxSizing === "border-box", s = Lv.test(n.writingMode || ""), d = !i && Tu.test(n.overflowY || ""), c = !i && Tu.test(n.overflowX || ""), u = i ? 0 : fi(n.paddingTop), p = i ? 0 : fi(n.paddingRight), m = i ? 0 : fi(n.paddingBottom), b = i ? 0 : fi(n.paddingLeft), v = i ? 0 : fi(n.borderTopWidth), C = i ? 0 : fi(n.borderRightWidth), P = i ? 0 : fi(n.borderBottomWidth), M = i ? 0 : fi(n.borderLeftWidth), q = b + p, Q = u + m, V = M + C, Y = v + P, A = c ? e.offsetHeight - Y - e.clientHeight : 0, H = d ? e.offsetWidth - V - e.clientWidth : 0, ee = l ? q + V : 0, z = l ? Q + Y : 0, j = i ? i.width : fi(n.width) - ee - H, J = i ? i.height : fi(n.height) - z - A, K = j + q + H + V, O = J + Q + A + Y, Z = yl({
    devicePixelContentBoxSize: Yl(Math.round(j * devicePixelRatio), Math.round(J * devicePixelRatio), s),
    borderBoxSize: Yl(K, O, s),
    contentBoxSize: Yl(j, J, s),
    contentRect: new yd(b, u, j, J)
  });
  return da.set(e, Z), Z;
}, wd = function(e, t, n) {
  var i = xd(e, n), l = i.borderBoxSize, s = i.contentBoxSize, d = i.devicePixelContentBoxSize;
  switch (t) {
    case No.DEVICE_PIXEL_CONTENT_BOX:
      return d;
    case No.BORDER_BOX:
      return l;
    default:
      return s;
  }
}, Rv = /* @__PURE__ */ (function() {
  function e(t) {
    var n = xd(t);
    this.target = t, this.contentRect = n.contentRect, this.borderBoxSize = yl([n.borderBoxSize]), this.contentBoxSize = yl([n.contentBoxSize]), this.devicePixelContentBoxSize = yl([n.devicePixelContentBoxSize]);
  }
  return e;
})(), Sd = function(e) {
  if (bd(e))
    return 1 / 0;
  for (var t = 0, n = e.parentNode; n; )
    t += 1, n = n.parentNode;
  return t;
}, Nv = function() {
  var e = 1 / 0, t = [];
  ml.forEach(function(s) {
    if (s.activeTargets.length !== 0) {
      var d = [];
      s.activeTargets.forEach(function(c) {
        var u = new Rv(c.target), p = Sd(c.target);
        d.push(u), c.lastReportedSize = wd(c.target, c.observedBox), p < e && (e = p);
      }), t.push(function() {
        s.callback.call(s.observer, d, s.observer);
      }), s.activeTargets.splice(0, s.activeTargets.length);
    }
  });
  for (var n = 0, i = t; n < i.length; n++) {
    var l = i[n];
    l();
  }
  return e;
}, $u = function(e) {
  ml.forEach(function(t) {
    t.activeTargets.splice(0, t.activeTargets.length), t.skippedTargets.splice(0, t.skippedTargets.length), t.observationTargets.forEach(function(n) {
      n.isActive() && (Sd(n.target) > e ? t.activeTargets.push(n) : t.skippedTargets.push(n));
    });
  });
}, Vv = function() {
  var e = 0;
  for ($u(e); Ev(); )
    e = Nv(), $u(e);
  return Iv() && Av(), e > 0;
}, gs, kd = [], Fv = function() {
  return kd.splice(0).forEach(function(e) {
    return e();
  });
}, Bv = function(e) {
  if (!gs) {
    var t = 0, n = document.createTextNode(""), i = { characterData: !0 };
    new MutationObserver(function() {
      return Fv();
    }).observe(n, i), gs = function() {
      n.textContent = "".concat(t ? t-- : t++);
    };
  }
  kd.push(e), gs();
}, Hv = function(e) {
  Bv(function() {
    requestAnimationFrame(e);
  });
}, Sa = 0, Wv = function() {
  return !!Sa;
}, jv = 250, Gv = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, Eu = [
  "resize",
  "load",
  "transitionend",
  "animationend",
  "animationstart",
  "animationiteration",
  "keyup",
  "keydown",
  "mouseup",
  "mousedown",
  "mouseover",
  "mouseout",
  "blur",
  "focus"
], Iu = function(e) {
  return e === void 0 && (e = 0), Date.now() + e;
}, ps = !1, Yv = (function() {
  function e() {
    var t = this;
    this.stopped = !0, this.listener = function() {
      return t.schedule();
    };
  }
  return e.prototype.run = function(t) {
    var n = this;
    if (t === void 0 && (t = jv), !ps) {
      ps = !0;
      var i = Iu(t);
      Hv(function() {
        var l = !1;
        try {
          l = Vv();
        } finally {
          if (ps = !1, t = i - Iu(), !Wv())
            return;
          l ? n.run(1e3) : t > 0 ? n.run(t) : n.start();
        }
      });
    }
  }, e.prototype.schedule = function() {
    this.stop(), this.run();
  }, e.prototype.observe = function() {
    var t = this, n = function() {
      return t.observer && t.observer.observe(document.body, Gv);
    };
    document.body ? n() : Lo.addEventListener("DOMContentLoaded", n);
  }, e.prototype.start = function() {
    var t = this;
    this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), Eu.forEach(function(n) {
      return Lo.addEventListener(n, t.listener, !0);
    }));
  }, e.prototype.stop = function() {
    var t = this;
    this.stopped || (this.observer && this.observer.disconnect(), Eu.forEach(function(n) {
      return Lo.removeEventListener(n, t.listener, !0);
    }), this.stopped = !0);
  }, e;
})(), Vs = new Yv(), Au = function(e) {
  !Sa && e > 0 && Vs.start(), Sa += e, !Sa && Vs.stop();
}, Uv = function(e) {
  return !ir(e) && !Dv(e) && getComputedStyle(e).display === "inline";
}, Kv = (function() {
  function e(t, n) {
    this.target = t, this.observedBox = n || No.CONTENT_BOX, this.lastReportedSize = {
      inlineSize: 0,
      blockSize: 0
    };
  }
  return e.prototype.isActive = function() {
    var t = wd(this.target, this.observedBox, !0);
    return Uv(this.target) && (this.lastReportedSize = t), this.lastReportedSize.inlineSize !== t.inlineSize || this.lastReportedSize.blockSize !== t.blockSize;
  }, e;
})(), Xv = /* @__PURE__ */ (function() {
  function e(t, n) {
    this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = t, this.callback = n;
  }
  return e;
})(), fa = /* @__PURE__ */ new WeakMap(), Ou = function(e, t) {
  for (var n = 0; n < e.length; n += 1)
    if (e[n].target === t)
      return n;
  return -1;
}, ha = (function() {
  function e() {
  }
  return e.connect = function(t, n) {
    var i = new Xv(t, n);
    fa.set(t, i);
  }, e.observe = function(t, n, i) {
    var l = fa.get(t), s = l.observationTargets.length === 0;
    Ou(l.observationTargets, n) < 0 && (s && ml.push(l), l.observationTargets.push(new Kv(n, i && i.box)), Au(1), Vs.schedule());
  }, e.unobserve = function(t, n) {
    var i = fa.get(t), l = Ou(i.observationTargets, n), s = i.observationTargets.length === 1;
    l >= 0 && (s && ml.splice(ml.indexOf(i), 1), i.observationTargets.splice(l, 1), Au(-1));
  }, e.disconnect = function(t) {
    var n = this, i = fa.get(t);
    i.observationTargets.slice().forEach(function(l) {
      return n.unobserve(t, l.target);
    }), i.activeTargets.splice(0, i.activeTargets.length);
  }, e;
})(), Qv = (function() {
  function e(t) {
    if (arguments.length === 0)
      throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
    if (typeof t != "function")
      throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
    ha.connect(this, t);
  }
  return e.prototype.observe = function(t, n) {
    if (arguments.length === 0)
      throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
    if (!zu(t))
      throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
    ha.observe(this, t, n);
  }, e.prototype.unobserve = function(t) {
    if (arguments.length === 0)
      throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
    if (!zu(t))
      throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
    ha.unobserve(this, t);
  }, e.prototype.disconnect = function() {
    ha.disconnect(this);
  }, e.toString = function() {
    return "function ResizeObserver () { [polyfill code] }";
  }, e;
})();
const Pa = /* @__PURE__ */ new WeakMap();
function Jv(e) {
  var t;
  for (let n = 0, i = e.length; n < i; ++n) {
    const l = e[n], s = Pa.get(l.target);
    if (typeof s == "function") {
      const { inlineSize: d, blockSize: c } = ((t = l.borderBoxSize) == null ? void 0 : t[0]) ?? {}, { offsetWidth: u, offsetHeight: p } = l.target;
      s(
        Object.assign(l, {
          offsetWidth: u,
          offsetHeight: p,
          width: d ?? u,
          height: c ?? p
        })
      );
    }
  }
}
const Cd = new (Cl && window.ResizeObserver || Qv)(
  Jv
);
function Du(e, t) {
  Pa.set(e, t), Cd.observe(e);
}
function Lu(e) {
  Pa.has(e) && (Cd.unobserve(e), Pa.delete(e));
}
function Zv(e = {}) {
  let t = Cu;
  const n = Fe(
    () => f(e.target),
    (l) => {
      t(), !(!l || typeof e.onResize != "function") && (Du(l, e.onResize), t = () => {
        Lu(l), t = Cu;
      });
    },
    { immediate: !0 }
  ), i = () => {
    n(), t();
  };
  return Fd() && Bd(i), {
    /**
     * @deprecated Will be removed in next major version, please directly use `observeResize` from imports.
     */
    observeResize: Du,
    /**
     * @deprecated Will be removed in next major version, please directly use `unobserveResize` from imports.
     */
    unobserveResize: Lu,
    unobserve: i
  };
}
const em = fe(!1);
re(() => em.value);
const qu = "__theme_style__", vs = "__theme_observer__", Ru = wl(/* @__PURE__ */ new Map()), Nu = /* @__PURE__ */ new Map();
Fe(Ru, () => {
  if (!Cl) return;
  Nu.clear();
  const e = document.head.querySelector(`#${qu}`);
  e && document.head.removeChild(e);
  const t = document.createElement("style");
  let n = `.${vs} { width: 1px }`, i = 1;
  for (const [l, [s, d]] of Ru.entries())
    n += ` html.${s} .${vs}, .${d} .${vs} { width: ${++i}px }`, Nu.set(i, l);
  t.textContent = n, t.id = qu, document.head.appendChild(t);
});
const tm = /* @__PURE__ */ Me({
  __name: "grid-layout",
  props: {
    autoSize: { type: Boolean, default: !0 },
    colNum: { default: 12 },
    rowHeight: { default: 150 },
    maxRows: { default: 1 / 0 },
    margin: { default: () => [10, 10] },
    isDraggable: { type: Boolean, default: !0 },
    isResizable: { type: Boolean, default: !0 },
    isMirrored: { type: Boolean, default: !1 },
    isBounded: { type: Boolean, default: !1 },
    useCssTransforms: { type: Boolean, default: !0 },
    verticalCompact: { type: Boolean, default: !0 },
    restoreOnDrag: { type: Boolean, default: !1 },
    layout: {},
    responsive: { type: Boolean, default: !1 },
    responsiveLayouts: { default: () => ({}) },
    transformScale: { default: 1 },
    breakpoints: { default: () => ({ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }) },
    cols: { default: () => ({ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }) },
    preventCollision: { type: Boolean, default: !1 },
    useStyleCursor: { type: Boolean, default: !0 }
  },
  emits: [
    "layout-before-mount",
    "layout-mounted",
    "layout-updated",
    "breakpoint-changed",
    "update:layout",
    "layout-ready"
  ],
  setup(e, { expose: t, emit: n }) {
    const i = e, l = n, s = wl({
      width: -1,
      mergedStyle: {},
      lastLayoutLength: 0,
      isDragging: !1,
      placeholder: {
        x: 0,
        y: 0,
        w: 0,
        h: 0,
        i: ""
      },
      layouts: {},
      // array to store all layouts from different breakpoints
      lastBreakpoint: null,
      // store last active breakpoint
      originalLayout: null
      // store original Layout
    }), d = /* @__PURE__ */ new Map(), c = fe(i.layout), u = fe(), { observeResize: p, unobserveResize: m } = Zv(), b = Zp();
    b.on("resizeEvent", v), b.on("dragEvent", C), oc(() => {
      l("layout-before-mount", c.value);
    }), An(() => {
      l("layout-mounted", c.value), zn(() => {
        cv(c.value), s.originalLayout = c.value, zn(() => {
          J(), u.value && p(u.value, ev(Y, 16)), Wl(c.value, i.verticalCompact), l("layout-updated", c.value), V(), Y();
        });
      });
    }), no(() => {
      b.clearAll(), u.value && m(u.value);
    });
    function v(O, Z, U, $, G, ue) {
      z(O, Z, U, $, G, ue);
    }
    function C(O, Z, U, $, G, ue) {
      ee(O, Z, U, $, G, ue);
    }
    Fe(
      () => s.width,
      (O, Z) => {
        zn(() => {
          b.emit("updateWidth", O), Z === -1 && zn(() => {
            l("layout-ready", c.value);
          }), V();
        });
      }
    ), Fe(
      () => [i.layout, i.layout.length],
      () => {
        c.value = i.layout, Q();
      }
    ), Fe(
      () => i.colNum,
      (O) => {
        b.emit("setColNum", O);
      }
    ), Fe(
      () => i.rowHeight,
      (O) => {
        b.emit("setRowHeight", O);
      }
    ), Fe(
      () => i.isDraggable,
      (O) => {
        b.emit("setDraggable", O);
      }
    ), Fe(
      () => i.isResizable,
      (O) => {
        b.emit("setResizable", O);
      }
    ), Fe(
      () => i.isBounded,
      (O) => {
        b.emit("setBounded", O);
      }
    ), Fe(
      () => i.transformScale,
      (O) => {
        b.emit("setTransformScale", O);
      }
    ), Fe(
      () => i.responsive,
      (O) => {
        O || (l("update:layout", s.originalLayout), b.emit("setColNum", i.colNum)), Y();
      }
    ), Fe(
      () => i.maxRows,
      (O) => {
        b.emit("setMaxRows", O);
      }
    ), Fe([() => i.margin, () => i.margin[1]], V), xl(
      ud,
      wl({
        ...ar(i),
        ...ar(s),
        increaseItem: P,
        decreaseItem: M
      })
    ), xl(cd, b), t({ state: s, getItem: q, resizeEvent: z, dragEvent: ee, layoutUpdate: Q });
    function P(O) {
      d.set(O.i, O);
    }
    function M(O) {
      d.delete(O.i);
    }
    function q(O) {
      return d.get(O);
    }
    function Q() {
      if (!Pn(c.value) && !Pn(s.originalLayout)) {
        if (c.value.length !== s.originalLayout.length) {
          const O = K(c.value, s.originalLayout);
          if (O.length > 0)
            if (c.value.length > s.originalLayout.length)
              s.originalLayout = s.originalLayout.concat(O);
            else {
              const Z = new Set(O.map((U) => U.i));
              s.originalLayout = s.originalLayout.filter((U) => !Z.has(U.i));
            }
          s.lastLayoutLength = c.value.length, J();
        }
        Wl(c.value, i.verticalCompact), b.emit("updateWidth", s.width), V(), l("layout-updated", c.value);
      }
    }
    function V() {
      s.mergedStyle = {
        height: A()
      };
    }
    function Y() {
      u.value && (s.width = u.value.offsetWidth), b.emit("resizeEvent");
    }
    function A() {
      if (!i.autoSize) return;
      const O = parseFloat(i.margin[1]);
      return nv(c.value) * (i.rowHeight + O) + O + "px";
    }
    let H;
    function ee(O, Z, U, $, G, ue) {
      let ie = gu(c.value, Z);
      Pn(ie) && (ie = { h: 0, w: 0, x: 0, y: 0, i: "" }), O === "dragstart" && !i.verticalCompact && (H = c.value.reduce(
        (Ee, { i: ve, x: ge, y: le }) => ({
          ...Ee,
          [ve]: { x: ge, y: le }
        }),
        {}
      )), O === "dragmove" || O === "dragstart" ? (s.placeholder.i = Z, s.placeholder.x = ie.x, s.placeholder.y = ie.y, s.placeholder.w = ue, s.placeholder.h = G, zn(() => {
        s.isDragging = !0;
      }), b.emit("updateWidth", s.width)) : zn(() => {
        s.isDragging = !1;
      }), c.value = Ns(c.value, ie, U, $, !0, i.preventCollision), i.restoreOnDrag ? (ie.static = !0, Wl(c.value, i.verticalCompact, H), ie.static = !1) : Wl(c.value, i.verticalCompact), b.emit("compact"), V(), O === "dragend" && (H = void 0, l("layout-updated", c.value));
    }
    function z(O, Z, U, $, G, ue) {
      let ie = gu(c.value, Z);
      Pn(ie) && (ie = { h: 0, w: 0, x: 0, y: 0, i: "" });
      let Ee;
      if (i.preventCollision) {
        const ve = fd(c.value, { ...ie, w: ue, h: G }).filter(
          (ge) => ge.i !== ie.i
        );
        if (Ee = ve.length > 0, Ee) {
          let ge = 1 / 0, le = 1 / 0;
          ve.forEach((me) => {
            me.x > ie.x && (ge = Math.min(ge, me.x)), me.y > ie.y && (le = Math.min(le, me.y));
          }), Number.isFinite(ge) && (ie.w = ge - ie.x), Number.isFinite(le) && (ie.h = le - ie.y);
        }
      }
      Ee || (ie.w = ue, ie.h = G), O === "resizestart" || O === "resizemove" ? (s.placeholder.i = Z, s.placeholder.x = U, s.placeholder.y = $, s.placeholder.w = ie.w, s.placeholder.h = ie.h, zn(() => {
        s.isDragging = !0;
      }), b.emit("updateWidth", s.width)) : O && zn(() => {
        s.isDragging = !1;
      }), i.responsive && j(), Wl(c.value, i.verticalCompact), b.emit("compact"), V(), O === "resizeend" && l("layout-updated", c.value);
    }
    function j() {
      const O = gv(i.breakpoints, s.width);
      if (O === s.lastBreakpoint)
        return;
      const Z = pd(O, i.cols);
      !Pn(s.lastBreakpoint) && !s.layouts[s.lastBreakpoint] && (s.layouts[s.lastBreakpoint] = Rs(c.value));
      const U = pv(
        s.originalLayout,
        s.layouts,
        i.breakpoints,
        O,
        s.lastBreakpoint,
        Z,
        i.verticalCompact
      );
      s.layouts[O] = U, s.lastBreakpoint !== O && l("breakpoint-changed", O, U), c.value = U, l("update:layout", U), s.lastBreakpoint = O, b.emit("setColNum", Z);
    }
    function J() {
      s.layouts = Object.assign({}, i.responsiveLayouts);
    }
    function K(O, Z) {
      const U = new Set(Z.map((ie) => ie.i)), $ = new Set(O.map((ie) => ie.i)), G = O.filter((ie) => !U.has(ie.i)), ue = Z.filter((ie) => !$.has(ie.i));
      return G.concat(ue);
    }
    return (O, Z) => (E(), B("div", {
      ref_key: "wrapper",
      ref: u,
      class: "vgl-layout",
      style: He(s.mergedStyle)
    }, [
      O.$slots.default ? Ti(O.$slots, "default", { key: 0 }) : (E(!0), B($e, { key: 1 }, Xe(c.value, (U) => (E(), Ce(wu, Hd({
        key: U.i,
        ref_for: !0
      }, U), {
        default: R(() => [
          Ti(O.$slots, "item", { item: U })
        ]),
        _: 2
      }, 1040))), 128)),
      ac(k(wu, {
        class: "vgl-item--placeholder",
        x: s.placeholder.x,
        y: s.placeholder.y,
        w: s.placeholder.w,
        h: s.placeholder.h,
        i: s.placeholder.i
      }, null, 8, ["x", "y", "w", "h", "i"]), [
        [sc, s.isDragging]
      ])
    ], 4));
  }
});
(function() {
  try {
    if (typeof document < "u") {
      var e = document.createElement("style");
      e.appendChild(document.createTextNode('.vgl-layout{--vgl-placeholder-bg: red;--vgl-placeholder-opacity: 20%;--vgl-placeholder-z-index: 2;--vgl-item-resizing-z-index: 3;--vgl-item-resizing-opacity: 60%;--vgl-item-dragging-z-index: 3;--vgl-item-dragging-opacity: 100%;--vgl-resizer-size: 10px;--vgl-resizer-border-color: #444;--vgl-resizer-border-width: 2px;position:relative;box-sizing:border-box;transition:height .2s ease}.vgl-item{position:absolute;box-sizing:border-box;transition:.2s ease;transition-property:left,top,right}.vgl-item--placeholder{z-index:var(--vgl-placeholder-z-index, 2);-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:var(--vgl-placeholder-bg, red);opacity:var(--vgl-placeholder-opacity, 20%);transition-duration:.1s}.vgl-item--no-touch{touch-action:none}.vgl-item--transform{right:auto;left:0;transition-property:transform}.vgl-item--transform.vgl-item--rtl{right:0;left:auto}.vgl-item--resizing{z-index:var(--vgl-item-resizing-z-index, 3);-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--vgl-item-resizing-opacity, 60%)}.vgl-item--dragging{z-index:var(--vgl-item-dragging-z-index, 3);-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--vgl-item-dragging-opacity, 100%);transition:none}.vgl-item__resizer{position:absolute;right:0;bottom:0;box-sizing:border-box;width:var(--vgl-resizer-size);height:var(--vgl-resizer-size);cursor:se-resize}.vgl-item__resizer:before{position:absolute;top:0;right:3px;bottom:3px;left:0;content:"";border:0 solid var(--vgl-resizer-border-color);border-right-width:var(--vgl-resizer-border-width);border-bottom-width:var(--vgl-resizer-border-width)}.vgl-item__resizer--rtl{right:auto;left:0;cursor:sw-resize}.vgl-item__resizer--rtl:before{top:0;right:0;bottom:3px;left:3px;border-right-width:0;border-bottom-width:var(--vgl-resizer-border-width);border-left-width:var(--vgl-resizer-border-width)}')), document.head.appendChild(e);
    }
  } catch (t) {
    console.error("vite-plugin-css-injected-by-js", t);
  }
})();
const _d = Symbol("panelEditor");
function nm(e) {
  xl(_d, e);
}
function ao() {
  const e = bl(_d);
  if (!e)
    throw new Error("usePanelEditor must be used within a PanelEditorProvider");
  return e;
}
function im(e, t, { signal: n, edges: i } = {}) {
  let l, s = null;
  const d = i != null && i.includes("leading"), c = i == null || i.includes("trailing"), u = () => {
    s !== null && (e.apply(l, s), l = void 0, s = null);
  }, p = () => {
    c && u(), C();
  };
  let m = null;
  const b = () => {
    m != null && clearTimeout(m), m = setTimeout(() => {
      m = null, p();
    }, t);
  }, v = () => {
    m !== null && (clearTimeout(m), m = null);
  }, C = () => {
    v(), l = void 0, s = null;
  }, P = () => {
    u();
  }, M = function(...q) {
    if (n?.aborted)
      return;
    l = this, s = q;
    const Q = m == null;
    b(), d && Q && u();
  };
  return M.schedule = b, M.cancel = C, M.flush = P, n?.addEventListener("abort", C, { once: !0 }), M;
}
function lm() {
}
function ei(e, t, n) {
  return n == null ? Math.min(e, t) : Math.min(Math.max(e, t), n);
}
function Vu(e) {
  return Object.getOwnPropertySymbols(e).filter((t) => Object.prototype.propertyIsEnumerable.call(e, t));
}
function Fu(e) {
  return e == null ? e === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(e);
}
const om = "[object RegExp]", am = "[object String]", sm = "[object Number]", rm = "[object Boolean]", Bu = "[object Arguments]", um = "[object Symbol]", cm = "[object Date]", dm = "[object Map]", fm = "[object Set]", hm = "[object Array]", gm = "[object Function]", pm = "[object ArrayBuffer]", ms = "[object Object]", vm = "[object Error]", mm = "[object DataView]", ym = "[object Uint8Array]", bm = "[object Uint8ClampedArray]", xm = "[object Uint16Array]", wm = "[object Uint32Array]", Sm = "[object BigUint64Array]", km = "[object Int8Array]", Cm = "[object Int16Array]", _m = "[object Int32Array]", Mm = "[object BigInt64Array]", zm = "[object Float32Array]", Tm = "[object Float64Array]";
function Hu(e) {
  if (!e || typeof e != "object")
    return !1;
  const t = Object.getPrototypeOf(e);
  return t === null || t === Object.prototype || Object.getPrototypeOf(t) === null ? Object.prototype.toString.call(e) === "[object Object]" : !1;
}
function Pm(e, t) {
  return e === t || Number.isNaN(e) && Number.isNaN(t);
}
function $m(e, t, n) {
  return Eo(e, t, void 0, void 0, void 0, void 0, n);
}
function Eo(e, t, n, i, l, s, d) {
  const c = d(e, t, n, i, l, s);
  if (c !== void 0)
    return c;
  if (typeof e == typeof t)
    switch (typeof e) {
      case "bigint":
      case "string":
      case "boolean":
      case "symbol":
      case "undefined":
        return e === t;
      case "number":
        return e === t || Object.is(e, t);
      case "function":
        return e === t;
      case "object":
        return qo(e, t, s, d);
    }
  return qo(e, t, s, d);
}
function qo(e, t, n, i) {
  if (Object.is(e, t))
    return !0;
  let l = Fu(e), s = Fu(t);
  if (l === Bu && (l = ms), s === Bu && (s = ms), l !== s)
    return !1;
  switch (l) {
    case am:
      return e.toString() === t.toString();
    case sm: {
      const u = e.valueOf(), p = t.valueOf();
      return Pm(u, p);
    }
    case rm:
    case cm:
    case um:
      return Object.is(e.valueOf(), t.valueOf());
    case om:
      return e.source === t.source && e.flags === t.flags;
    case gm:
      return e === t;
  }
  n = n ?? /* @__PURE__ */ new Map();
  const d = n.get(e), c = n.get(t);
  if (d != null && c != null)
    return d === t;
  n.set(e, t), n.set(t, e);
  try {
    switch (l) {
      case dm: {
        if (e.size !== t.size)
          return !1;
        for (const [u, p] of e.entries())
          if (!t.has(u) || !Eo(p, t.get(u), u, e, t, n, i))
            return !1;
        return !0;
      }
      case fm: {
        if (e.size !== t.size)
          return !1;
        const u = Array.from(e.values()), p = Array.from(t.values());
        for (let m = 0; m < u.length; m++) {
          const b = u[m], v = p.findIndex((C) => Eo(b, C, void 0, e, t, n, i));
          if (v === -1)
            return !1;
          p.splice(v, 1);
        }
        return !0;
      }
      case hm:
      case ym:
      case bm:
      case xm:
      case wm:
      case Sm:
      case km:
      case Cm:
      case _m:
      case Mm:
      case zm:
      case Tm: {
        if (typeof Buffer < "u" && Buffer.isBuffer(e) !== Buffer.isBuffer(t) || e.length !== t.length)
          return !1;
        for (let u = 0; u < e.length; u++)
          if (!Eo(e[u], t[u], u, e, t, n, i))
            return !1;
        return !0;
      }
      case pm:
        return e.byteLength !== t.byteLength ? !1 : qo(new Uint8Array(e), new Uint8Array(t), n, i);
      case mm:
        return e.byteLength !== t.byteLength || e.byteOffset !== t.byteOffset ? !1 : qo(new Uint8Array(e), new Uint8Array(t), n, i);
      case vm:
        return e.name === t.name && e.message === t.message;
      case ms: {
        if (!(qo(e.constructor, t.constructor, n, i) || Hu(e) && Hu(t)))
          return !1;
        const u = [...Object.keys(e), ...Vu(e)], p = [...Object.keys(t), ...Vu(t)];
        if (u.length !== p.length)
          return !1;
        for (let m = 0; m < u.length; m++) {
          const b = u[m], v = e[b];
          if (!Object.hasOwn(t, b))
            return !1;
          const C = t[b];
          if (!Eo(v, C, b, e, t, n, i))
            return !1;
        }
        return !0;
      }
      default:
        return !1;
    }
  } finally {
    n.delete(e), n.delete(t);
  }
}
function Em(e, t) {
  return $m(e, t, lm);
}
const Im = "_splitView_pzp7c_6", Am = "_sashContainer_pzp7c_13", Om = "_sash_pzp7c_13", Dm = "_splitViewContainer_pzp7c_24", Lm = "_splitViewView_pzp7c_31", qm = "_vertical_pzp7c_37", Rm = "_horizontal_pzp7c_41", Nm = "_separatorBorder_pzp7c_45", Gi = {
  splitView: Im,
  sashContainer: Am,
  sash: Om,
  splitViewContainer: Dm,
  splitViewView: Lm,
  vertical: qm,
  horizontal: Rm,
  separatorBorder: Nm
};
let Md = !1, zd = !1, Co;
typeof navigator == "object" && (Co = navigator.userAgent, zd = Co.includes("Macintosh"), Md = (Co.includes("Macintosh") || Co.includes("iPad") || Co.includes("iPhone")) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
const Td = Md, Vm = zd;
class Fm {
  _size;
  getSize() {
    return this._size;
  }
  setSize(t) {
    this._size = t;
  }
}
function ga(e, t) {
  const n = e.length, i = n - t.length;
  return i >= 0 && e.slice(i, n) === t;
}
function Bm(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Wu = { exports: {} }, ju;
function Hm() {
  return ju || (ju = 1, (function(e) {
    var t = Object.prototype.hasOwnProperty, n = "~";
    function i() {
    }
    Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (n = !1));
    function l(u, p, m) {
      this.fn = u, this.context = p, this.once = m || !1;
    }
    function s(u, p, m, b, v) {
      if (typeof m != "function")
        throw new TypeError("The listener must be a function");
      var C = new l(m, b || u, v), P = n ? n + p : p;
      return u._events[P] ? u._events[P].fn ? u._events[P] = [u._events[P], C] : u._events[P].push(C) : (u._events[P] = C, u._eventsCount++), u;
    }
    function d(u, p) {
      --u._eventsCount === 0 ? u._events = new i() : delete u._events[p];
    }
    function c() {
      this._events = new i(), this._eventsCount = 0;
    }
    c.prototype.eventNames = function() {
      var u = [], p, m;
      if (this._eventsCount === 0) return u;
      for (m in p = this._events)
        t.call(p, m) && u.push(n ? m.slice(1) : m);
      return Object.getOwnPropertySymbols ? u.concat(Object.getOwnPropertySymbols(p)) : u;
    }, c.prototype.listeners = function(u) {
      var p = n ? n + u : u, m = this._events[p];
      if (!m) return [];
      if (m.fn) return [m.fn];
      for (var b = 0, v = m.length, C = new Array(v); b < v; b++)
        C[b] = m[b].fn;
      return C;
    }, c.prototype.listenerCount = function(u) {
      var p = n ? n + u : u, m = this._events[p];
      return m ? m.fn ? 1 : m.length : 0;
    }, c.prototype.emit = function(u, p, m, b, v, C) {
      var P = n ? n + u : u;
      if (!this._events[P]) return !1;
      var M = this._events[P], q = arguments.length, Q, V;
      if (M.fn) {
        switch (M.once && this.removeListener(u, M.fn, void 0, !0), q) {
          case 1:
            return M.fn.call(M.context), !0;
          case 2:
            return M.fn.call(M.context, p), !0;
          case 3:
            return M.fn.call(M.context, p, m), !0;
          case 4:
            return M.fn.call(M.context, p, m, b), !0;
          case 5:
            return M.fn.call(M.context, p, m, b, v), !0;
          case 6:
            return M.fn.call(M.context, p, m, b, v, C), !0;
        }
        for (V = 1, Q = new Array(q - 1); V < q; V++)
          Q[V - 1] = arguments[V];
        M.fn.apply(M.context, Q);
      } else {
        var Y = M.length, A;
        for (V = 0; V < Y; V++)
          switch (M[V].once && this.removeListener(u, M[V].fn, void 0, !0), q) {
            case 1:
              M[V].fn.call(M[V].context);
              break;
            case 2:
              M[V].fn.call(M[V].context, p);
              break;
            case 3:
              M[V].fn.call(M[V].context, p, m);
              break;
            case 4:
              M[V].fn.call(M[V].context, p, m, b);
              break;
            default:
              if (!Q) for (A = 1, Q = new Array(q - 1); A < q; A++)
                Q[A - 1] = arguments[A];
              M[V].fn.apply(M[V].context, Q);
          }
      }
      return !0;
    }, c.prototype.on = function(u, p, m) {
      return s(this, u, p, m, !1);
    }, c.prototype.once = function(u, p, m) {
      return s(this, u, p, m, !0);
    }, c.prototype.removeListener = function(u, p, m, b) {
      var v = n ? n + u : u;
      if (!this._events[v]) return this;
      if (!p)
        return d(this, v), this;
      var C = this._events[v];
      if (C.fn)
        C.fn === p && (!b || C.once) && (!m || C.context === m) && d(this, v);
      else {
        for (var P = 0, M = [], q = C.length; P < q; P++)
          (C[P].fn !== p || b && !C[P].once || m && C[P].context !== m) && M.push(C[P]);
        M.length ? this._events[v] = M.length === 1 ? M[0] : M : d(this, v);
      }
      return this;
    }, c.prototype.removeAllListeners = function(u) {
      var p;
      return u ? (p = n ? n + u : u, this._events[p] && d(this, p)) : (this._events = new i(), this._eventsCount = 0), this;
    }, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = n, c.EventEmitter = c, e.exports = c;
  })(Wu)), Wu.exports;
}
var Wm = Hm();
const lr = /* @__PURE__ */ Bm(Wm);
function Gu(e, t) {
  const n = e.indexOf(t);
  n !== -1 && (e.splice(n, 1), e.unshift(t));
}
function ys(e, t) {
  const n = e.indexOf(t);
  n !== -1 && (e.splice(n, 1), e.push(t));
}
function Nn(e, t, n = 1) {
  const i = Math.max(0, Math.ceil((t - e) / n)), l = Array.from({ length: i });
  let s = -1;
  for (; ++s < i; )
    l[s] = e + s * n;
  return l;
}
const jm = "_sash_j5cmb_7", Gm = "_disabled_j5cmb_15", Ym = "_mac_j5cmb_19", Um = "_vertical_j5cmb_19", Km = "_minimum_j5cmb_23", Xm = "_maximum_j5cmb_27", Qm = "_horizontal_j5cmb_31", Jm = "_hover_j5cmb_126", Zm = "_active_j5cmb_127", vn = {
  sash: jm,
  disabled: Gm,
  mac: Ym,
  vertical: Um,
  minimum: Km,
  maximum: Xm,
  horizontal: Qm,
  hover: Jm,
  active: Zm
};
var ni = /* @__PURE__ */ ((e) => (e[e.Vertical = 0] = "Vertical", e[e.Horizontal = 1] = "Horizontal", e))(ni || {}), hl = /* @__PURE__ */ ((e) => (e[e.Disabled = 0] = "Disabled", e[e.Minimum = 1] = "Minimum", e[e.Maximum = 2] = "Maximum", e[e.Enabled = 3] = "Enabled", e))(hl || {});
let Pd = Td ? 20 : 8;
const $d = new lr();
function ey(e) {
  Pd = e, $d.emit("onDidChangeGlobalSize", e);
}
class Yu extends lr {
  el;
  layoutProvider;
  orientation;
  size;
  hoverDelay = 300;
  hoverDelayerFunc = (t) => t.classList.add("sash-hover", vn.hover);
  hoverDelayer = im(
    this.hoverDelayerFunc,
    this.hoverDelay
  );
  _state = 3;
  get state() {
    return this._state;
  }
  /**
   * The state of a sash defines whether it can be interacted with by the user
   * as well as what mouse cursor to use, when hovered.
   */
  set state(t) {
    this._state !== t && (this.el.classList.toggle(
      vn.disabled,
      t === 0
      /* Disabled */
    ), this.el.classList.toggle(
      "sash-disabled",
      t === 0
      /* Disabled */
    ), this.el.classList.toggle(
      vn.minimum,
      t === 1
      /* Minimum */
    ), this.el.classList.toggle(
      "sash-minimum",
      t === 1
      /* Minimum */
    ), this.el.classList.toggle(
      vn.maximum,
      t === 2
      /* Maximum */
    ), this.el.classList.toggle(
      "sash-maximum",
      t === 2
      /* Maximum */
    ), this._state = t, this.emit("enablementChange", t));
  }
  constructor(t, n, i) {
    super(), this.el = document.createElement("div"), this.el.classList.add("sash", vn.sash), this.el.dataset.testid = "sash", t.append(this.el), Vm && this.el.classList.add("sash-mac", vn.mac), this.el.addEventListener("pointerdown", this.onPointerStart), this.el.addEventListener("dblclick", this.onPointerDoublePress), this.el.addEventListener("mouseenter", this.onMouseEnter), this.el.addEventListener("mouseleave", this.onMouseLeave), typeof i.size == "number" ? (this.size = i.size, i.orientation === 0 ? this.el.style.width = `${this.size}px` : this.el.style.height = `${this.size}px`) : (this.size = Pd, $d.on("onDidChangeGlobalSize", (l) => {
      this.size = l, this.layout();
    })), this.layoutProvider = n, this.orientation = i.orientation ?? 0, this.orientation === 1 ? (this.el.classList.add("sash-horizontal", vn.horizontal), this.el.classList.remove("sash-vertical", vn.vertical)) : (this.el.classList.remove("sash-horizontal", vn.horizontal), this.el.classList.add("sash-vertical", vn.vertical)), i.skipInitialLayout || this.layout();
  }
  onPointerStart = (t) => {
    const n = t.pageX, i = t.pageY, l = {
      startX: n,
      currentX: n,
      startY: i,
      currentY: i
    };
    this.el.classList.add("sash-active", vn.active), this.emit("start", l), this.el.setPointerCapture(t.pointerId);
    const s = (c) => {
      c.preventDefault();
      const u = {
        startX: n,
        currentX: c.pageX,
        startY: i,
        currentY: c.pageY
      };
      this.emit("change", u);
    }, d = (c) => {
      c.preventDefault(), this.el.classList.remove("sash-active", vn.active), this.hoverDelayer.cancel(), this.emit("end"), this.el.releasePointerCapture(c.pointerId), globalThis.removeEventListener("pointermove", s), globalThis.removeEventListener("pointerup", d);
    };
    globalThis.addEventListener("pointermove", s), globalThis.addEventListener("pointerup", d);
  };
  onPointerDoublePress = () => {
    this.emit("reset");
  };
  onMouseEnter = () => {
    this.el.classList.contains(vn.active) ? (this.hoverDelayer.cancel(), this.el.classList.add("sash-hover", vn.hover)) : this.hoverDelayer(this.el);
  };
  onMouseLeave = () => {
    this.hoverDelayer.cancel(), this.el.classList.remove("sash-hover", vn.hover);
  };
  /**
   * Layout the sash. The sash will size and position itself
   * based on its provided {@link SashLayoutProvider layout provider}.
   */
  layout() {
    if (this.orientation === 0) {
      const t = this.layoutProvider;
      this.el.style.left = `${t.getVerticalSashLeft(this) - this.size / 2}px`, t.getVerticalSashTop && (this.el.style.top = `${t.getVerticalSashTop(this)}px`), t.getVerticalSashHeight && (this.el.style.height = `${t.getVerticalSashHeight(this)}px`);
    } else {
      const t = this.layoutProvider;
      this.el.style.top = `${t.getHorizontalSashTop(this) - this.size / 2}px`, t.getHorizontalSashLeft && (this.el.style.left = `${t.getHorizontalSashLeft(this)}px`), t.getHorizontalSashWidth && (this.el.style.width = `${t.getHorizontalSashWidth(this)}px`);
    }
  }
  dispose() {
    this.el.removeEventListener("pointerdown", this.onPointerStart), this.el.removeEventListener("dblclick", this.onPointerDoublePress), this.el.removeEventListener("mouseenter", this.onMouseEnter), this.el.removeEventListener("mouseleave", this.onMouseLeave), this.el.remove();
  }
}
const Ed = {
  /**
   * When adding or removing views, distribute the delta space among
   * all other views.
   */
  Distribute: { type: "distribute" },
  /**
   * When adding or removing views, split the delta space with another
   * specific view, indexed by the provided `index`.
   */
  Split: (e) => ({ type: "split", index: e }),
  /**
   * When adding or removing views, assume the view is invisible.
   */
  Invisible: (e) => ({ type: "invisible", cachedVisibleSize: e })
};
var $a = /* @__PURE__ */ ((e) => (e[e.Normal = 0] = "Normal", e[e.Low = 1] = "Low", e[e.High = 2] = "High", e))($a || {});
class Id {
  container;
  view;
  _size;
  _cachedVisibleSize = void 0;
  constructor(t, n, i) {
    this.container = t, this.view = n, this.container.classList.add("split-view-view", Gi.splitViewView), this.container.dataset.testid = "split-view-view", typeof i == "number" ? (this._size = i, this._cachedVisibleSize = void 0, t.classList.add("split-view-view-visible")) : (this._size = 0, this._cachedVisibleSize = i.cachedVisibleSize);
  }
  set size(t) {
    this._size = t;
  }
  get size() {
    return this._size;
  }
  get priority() {
    return this.view.priority;
  }
  get snap() {
    return !!this.view.snap;
  }
  get visible() {
    return this._cachedVisibleSize === void 0;
  }
  setVisible(t, n) {
    t !== this.visible && (t ? (this.size = ei(
      this._cachedVisibleSize ?? 0,
      this.view.minimumSize,
      this.view.maximumSize
    ), this._cachedVisibleSize = void 0) : (this._cachedVisibleSize = typeof n == "number" ? n : this.size, this.size = 0), this.container.classList.toggle("split-view-view-visible", t), this.view.setVisible && this.view.setVisible(t));
  }
  get minimumSize() {
    return this.visible ? this.view.minimumSize : 0;
  }
  get maximumSize() {
    return this.visible ? this.view.maximumSize : 0;
  }
  get cachedVisibleSize() {
    return this._cachedVisibleSize;
  }
}
class ty extends Id {
  layout(t) {
    if (!this.visible) {
      this.container.style.height = "0px", this.container.style.top = `${t}px`, this.container.style.left = "0px", this.container.style.width = "100%";
      return;
    }
    this.container.style.top = `${t}px`, this.container.style.height = `${this.size}px`, this.container.style.left = "0px", this.container.style.width = "100%", this.view.layout(this.size, t);
  }
}
class ny extends Id {
  layout(t) {
    if (!this.visible) {
      this.container.style.width = "0px", this.container.style.left = `${t}px`, this.container.style.top = "0px", this.container.style.height = "100%";
      return;
    }
    this.container.style.left = `${t}px`, this.container.style.width = `${this.size}px`, this.container.style.top = "0px", this.container.style.height = "100%", this.view.layout(this.size, t);
  }
}
class iy extends lr {
  onDidChange;
  onDidDragStart;
  onDidDragEnd;
  _orientation;
  get orientation() {
    return this._orientation;
  }
  set orientation(t) {
    this._orientation = t;
  }
  sashContainer;
  size = 0;
  contentSize = 0;
  proportions = void 0;
  viewItems = [];
  sashItems = [];
  sashDragState;
  _proportionalLayout;
  get proportionalLayout() {
    return this._proportionalLayout;
  }
  set proportionalLayout(t) {
    this._proportionalLayout = t;
  }
  getSashOrthogonalSize;
  _startSnappingEnabled = !0;
  get startSnappingEnabled() {
    return this._startSnappingEnabled;
  }
  set startSnappingEnabled(t) {
    this._startSnappingEnabled !== t && (this._startSnappingEnabled = t, this.updateSashEnablement());
  }
  _endSnappingEnabled = !0;
  get endSnappingEnabled() {
    return this._endSnappingEnabled;
  }
  set endSnappingEnabled(t) {
    this._endSnappingEnabled !== t && (this._endSnappingEnabled = t, this.updateSashEnablement());
  }
  /** Create a new {@link SplitView} instance. */
  constructor(t, n = {}, i, l, s) {
    if (super(), this._orientation = n.orientation ?? ni.Vertical, this._proportionalLayout = n.proportionalLayout ?? !0, this.getSashOrthogonalSize = n.getSashOrthogonalSize, i && (this.onDidChange = i), l && (this.onDidDragStart = l), s && (this.onDidDragEnd = s), this.sashContainer = document.createElement("div"), this.sashContainer.classList.add("sash-container", Gi.sashContainer), t.prepend(this.sashContainer), n.descriptor) {
      this.size = n.descriptor.size;
      for (const [d, c] of n.descriptor.views.entries()) {
        const u = c.size, p = c.container, m = c.view;
        this.addView(p, m, u, d, !0);
      }
      this.contentSize = this.viewItems.reduce((d, c) => d + c.size, 0), this.saveProportions();
    }
  }
  addView(t, n, i, l = this.viewItems.length, s) {
    let d;
    typeof i == "number" ? d = i : i.type === "split" ? d = this.getViewSize(i.index) / 2 : i.type === "invisible" ? d = { cachedVisibleSize: i.cachedVisibleSize } : d = n.minimumSize;
    const c = this.orientation === ni.Vertical ? new ty(t, n, d) : new ny(t, n, d);
    if (this.viewItems.splice(l, 0, c), this.viewItems.length > 1) {
      const u = this.orientation === ni.Vertical ? new Yu(
        this.sashContainer,
        {
          getHorizontalSashTop: (b) => this.getSashPosition(b),
          getHorizontalSashWidth: this.getSashOrthogonalSize
        },
        { orientation: ni.Horizontal }
      ) : new Yu(
        this.sashContainer,
        {
          getVerticalSashLeft: (b) => this.getSashPosition(b),
          getVerticalSashHeight: this.getSashOrthogonalSize
        },
        { orientation: ni.Vertical }
      ), p = this.orientation === ni.Vertical ? (b) => ({
        sash: u,
        start: b.startY,
        current: b.currentY
      }) : (b) => ({
        sash: u,
        start: b.startX,
        current: b.currentX
      });
      u.on("start", (b) => {
        this.emit("sashDragStart"), this.onSashStart(p(b));
        const v = this.viewItems.map((C) => C.size);
        this.onDidDragStart?.(v);
      }), u.on("change", (b) => this.onSashChange(p(b))), u.on("end", () => {
        this.emit("sashDragEnd");
        let b = this.sashItems.findIndex((C) => C.sash === u);
        if (b === -1) {
          const C = u.el;
          C && (b = this.sashItems.findIndex((P) => P.sash.el === C));
        }
        this.onSashEnd(b);
        const v = this.viewItems.map((C) => C.size);
        this.onDidDragEnd?.(v);
      }), u.on("reset", () => {
        let b = this.sashItems.findIndex((q) => q.sash === u);
        if (b === -1) {
          const q = u.el;
          q && (b = this.sashItems.findIndex((Q) => Q.sash.el === q));
        }
        const v = Nn(b, -1, -1), C = Nn(b + 1, this.viewItems.length), P = this.findFirstSnapIndex(v), M = this.findFirstSnapIndex(C);
        typeof P == "number" && !this.viewItems[P].visible || typeof M == "number" && !this.viewItems[M].visible || this.emit("sashreset", b);
      });
      const m = { sash: u };
      this.sashItems.splice(l - 1, 0, m);
    }
    s || this.relayout(), !s && typeof i != "number" && i.type === "distribute" && this.distributeViewSizes();
  }
  removeView(t, n) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    const i = this.viewItems.splice(t, 1)[0].view;
    if (this.viewItems.length > 0) {
      const l = Math.max(t - 1, 0);
      this.sashItems.splice(l, 1)[0].sash.dispose();
    }
    return this.relayout(), n && n.type === "distribute" && this.distributeViewSizes(), i;
  }
  moveView(t, n, i) {
    const l = this.getViewCachedVisibleSize(n), s = l === void 0 ? this.getViewSize(n) : Ed.Invisible(l), d = this.removeView(n);
    this.addView(t, d, s, i);
  }
  getViewCachedVisibleSize(t) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    return this.viewItems[t].cachedVisibleSize;
  }
  layout(t = this.size) {
    if (this.viewItems.length === 0)
      return;
    const n = Math.max(this.size, this.contentSize);
    if (this.size = t, this.proportions)
      for (let i = 0; i < this.viewItems.length; i++) {
        const l = this.viewItems[i];
        l && this.proportions[i] !== void 0 && (l.size = ei(
          Math.round(this.proportions[i] * t),
          l.minimumSize,
          l.maximumSize
        ));
      }
    else {
      const i = Nn(0, this.viewItems.length), l = i.filter(
        (d) => this.viewItems[d] && this.viewItems[d].priority === 1
        /* Low */
      ), s = i.filter(
        (d) => this.viewItems[d] && this.viewItems[d].priority === 2
        /* High */
      );
      this.resize(
        this.viewItems.length - 1,
        t - n,
        void 0,
        l,
        s
      );
    }
    this.distributeEmptySpace(), this.layoutViews();
  }
  resizeView(t, n) {
    if (t < 0 || t >= this.viewItems.length)
      return;
    const i = Nn(0, this.viewItems.length).filter((c) => c !== t), l = [
      ...i.filter(
        (c) => this.viewItems[c].priority === 1
        /* Low */
      ),
      t
    ], s = i.filter(
      (c) => this.viewItems[c].priority === 2
      /* High */
    ), d = this.viewItems[t];
    n = Math.round(n), n = ei(n, d.minimumSize, Math.min(d.maximumSize, this.size)), d.size = n, this.relayout(l, s);
  }
  resizeViews(t) {
    for (let [n, i] of t.entries()) {
      const l = this.viewItems[n];
      i = Math.round(i), i = ei(
        i,
        l.minimumSize,
        Math.min(l.maximumSize, this.size)
      ), l.size = i;
    }
    this.contentSize = this.viewItems.reduce((n, i) => n + i.size, 0), this.saveProportions(), this.layout(this.size);
  }
  getViewSize(t) {
    return t < 0 || t >= this.viewItems.length ? -1 : this.viewItems[t].size;
  }
  isViewVisible(t) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    return this.viewItems[t].visible;
  }
  setViewVisible(t, n) {
    if (t < 0 || t >= this.viewItems.length)
      throw new Error("Index out of bounds");
    this.viewItems[t].setVisible(n), this.emit("sashchange", t), this.distributeEmptySpace(), this.layoutViews(), this.saveProportions();
  }
  distributeViewSizes() {
    const t = [];
    let n = 0;
    for (const c of this.viewItems)
      c.maximumSize - c.minimumSize > 0 && (t.push(c), n += c.size);
    const i = Math.floor(n / t.length);
    for (const c of t)
      c.size = ei(i, c.minimumSize, c.maximumSize);
    const l = Nn(0, this.viewItems.length), s = l.filter(
      (c) => this.viewItems[c].priority === 1
      /* Low */
    ), d = l.filter(
      (c) => this.viewItems[c].priority === 2
      /* High */
    );
    this.relayout(s, d);
  }
  dispose() {
    for (const t of this.sashItems) t.sash.dispose();
    this.sashItems = [], this.viewItems = [], this.sashContainer && this.sashContainer.parentElement && this.sashContainer.remove();
  }
  onSashStart({ sash: t, start: n, current: i }) {
    let l = this.sashItems.findIndex((P) => P.sash === t);
    if (l === -1) {
      const P = t.el;
      P && (l = this.sashItems.findIndex((M) => M.sash.el === P));
    }
    const s = this.viewItems.map((P) => P.size), d = Nn(l, -1, -1), c = Nn(l + 1, this.viewItems.length), u = this.getMinDelta(d, c, s), p = this.getMaxDelta(d, c, s);
    let m, b;
    const v = this.findFirstSnapIndex(d), C = this.findFirstSnapIndex(c);
    if (typeof v == "number") {
      const P = this.viewItems[v], M = Math.floor(P.minimumSize / 2);
      m = {
        index: v,
        limitDelta: P.visible ? u - M : u + M,
        size: P.size
      };
    }
    if (typeof C == "number") {
      const P = this.viewItems[C], M = Math.floor(P.minimumSize / 2);
      b = {
        index: C,
        limitDelta: P.visible ? p + M : p - M,
        size: P.size
      };
    }
    this.sashDragState = {
      index: l,
      start: n,
      current: i,
      sizes: s,
      minDelta: u,
      maxDelta: p,
      snapBefore: m,
      snapAfter: b
    };
  }
  onSashChange({ current: t }) {
    const { index: n, start: i, sizes: l, minDelta: s, maxDelta: d, snapBefore: c, snapAfter: u } = this.sashDragState, p = t - i;
    this.resize(n, p, l, void 0, void 0, s, d, c, u), this.distributeEmptySpace(), this.layoutViews();
  }
  onSashEnd(t) {
    this.emit("sashchange", t), this.sashDragState = void 0, this.saveProportions();
    const n = this.viewItems.map((i) => i.size);
    this.onDidChange?.(n);
  }
  getMinDelta(t, n, i) {
    const l = t.reduce(
      (d, c) => d + (this.viewItems[c].minimumSize - i[c]),
      0
    ), s = n.reduce(
      (d, c) => d + (i[c] - this.viewItems[c].maximumSize),
      0
    );
    return Math.max(l, s);
  }
  getMaxDelta(t, n, i) {
    const l = t.reduce(
      (d, c) => d + (this.viewItems[c].maximumSize - i[c]),
      0
    ), s = n.reduce(
      (d, c) => d + (i[c] - this.viewItems[c].minimumSize),
      0
    );
    return Math.min(s, l);
  }
  resize(t, n, i, l, s, d = Number.NEGATIVE_INFINITY, c = Number.POSITIVE_INFINITY, u, p) {
    if (t < 0 || t >= this.viewItems.length || this.viewItems.length === 0)
      return 0;
    const m = Nn(t, -1, -1), b = Nn(t + 1, this.viewItems.length);
    if (s)
      for (const j of s)
        Gu(m, j), Gu(b, j);
    if (l)
      for (const j of l)
        ys(m, j), ys(b, j);
    const v = i ?? this.viewItems.map((j) => j?.size || 0), C = m.map((j) => this.viewItems[j]), P = m.map((j) => v[j]), M = b.map((j) => this.viewItems[j]), q = b.map((j) => v[j]), Q = m.reduce(
      (j, J) => j + (this.viewItems[J].minimumSize - v[J]),
      0
    ), V = m.reduce(
      (j, J) => j + (this.viewItems[J].maximumSize - v[J]),
      0
    ), Y = b.length === 0 ? Number.POSITIVE_INFINITY : b.reduce(
      (j, J) => j + (v[J] - this.viewItems[J].minimumSize),
      0
    ), A = b.length === 0 ? Number.NEGATIVE_INFINITY : b.reduce(
      (j, J) => j + (v[J] - this.viewItems[J].maximumSize),
      0
    ), H = Math.max(Q, A, d), ee = Math.min(Y, V, c);
    let z = !1;
    if (u) {
      const j = this.viewItems[u.index], J = n >= u.limitDelta;
      z = J !== j.visible, j.setVisible(J, u.size);
    }
    if (!z && p) {
      const j = this.viewItems[p.index], J = n < p.limitDelta;
      z = J !== j.visible, j.setVisible(J, p.size);
    }
    if (z)
      return this.resize(
        t,
        n,
        i,
        l,
        s,
        d,
        c
      );
    n = ei(n, H, ee);
    for (let j = 0, J = n; j < C.length; j++) {
      const K = C[j];
      if (!K)
        continue;
      const O = ei(
        P[j] + J,
        K.minimumSize,
        K.maximumSize
      ), Z = O - P[j];
      J -= Z, K.size = O;
    }
    for (let j = 0, J = n; j < M.length; j++) {
      const K = M[j];
      if (!K)
        continue;
      const O = ei(
        q[j] - J,
        K.minimumSize,
        K.maximumSize
      ), Z = O - q[j];
      J += Z, K.size = O;
    }
    return n;
  }
  distributeEmptySpace(t) {
    if (this.viewItems.length === 0)
      return;
    const n = this.viewItems.reduce((p, m) => p + m.size, 0);
    let i = this.size - n;
    const l = Nn(0, this.viewItems.length), s = [], d = l.filter(
      (p) => this.viewItems[p].priority === 1
      /* Low */
    ), c = l.filter(
      (p) => this.viewItems[p].priority === 0
      /* Normal */
    ), u = l.filter(
      (p) => this.viewItems[p].priority === 2
      /* High */
    );
    s.push(
      ...u,
      ...c,
      ...d
    ), typeof t == "number" && ys(s, t);
    for (let p = 0; i !== 0 && p < s.length; p++) {
      const m = this.viewItems[s[p]];
      if (!m)
        continue;
      const b = ei(
        m.size + i,
        m.minimumSize,
        m.maximumSize
      ), v = b - m.size;
      i -= v, m.size = b;
    }
    this.contentSize = this.viewItems.reduce((p, m) => p + m.size, 0);
  }
  layoutViews() {
    this.contentSize = this.viewItems.reduce((n, i) => n + i.size, 0);
    let t = 0;
    for (const n of this.viewItems)
      n && (n.layout(t), t += n.size);
    for (const n of this.sashItems) n.sash.layout();
    this.updateSashEnablement();
  }
  saveProportions() {
    this.proportionalLayout && this.contentSize > 0 && (this.proportions = this.viewItems.map((t) => t.size / this.contentSize));
  }
  relayout(t, n) {
    const i = this.viewItems.reduce((l, s) => l + s.size, 0);
    this.resize(
      this.viewItems.length - 1,
      this.size - i,
      void 0,
      t,
      n,
      Number.NEGATIVE_INFINITY,
      Number.POSITIVE_INFINITY
    ), this.distributeEmptySpace(), this.layoutViews(), this.saveProportions();
  }
  getSashPosition(t) {
    let n = -1;
    for (let l = 0; l < this.sashItems.length; l++)
      if (this.sashItems[l].sash === t) {
        n = l;
        break;
      }
    if (n === -1) {
      const l = t.el || t;
      if (l) {
        for (let s = 0; s < this.sashItems.length; s++)
          if ((this.sashItems[s].sash.el || this.sashItems[s].sash) === l) {
            n = s;
            break;
          }
      }
    }
    if (n === -1)
      return 0;
    let i = 0;
    for (let l = 0; l <= n; l++)
      this.viewItems[l] && (i += this.viewItems[l].size);
    return i;
  }
  findFirstSnapIndex(t) {
    for (const n of t) {
      const i = this.viewItems[n];
      if (i.visible && i.snap)
        return n;
    }
    for (const n of t) {
      const i = this.viewItems[n];
      if (i.visible && i.maximumSize - i.minimumSize > 0)
        return;
      if (!i.visible && i.snap)
        return n;
    }
  }
  updateSashEnablement() {
    let t = !1;
    const n = this.viewItems.map(
      (u) => t = u.size - u.minimumSize > 0 || t
    );
    t = !1;
    const i = this.viewItems.map(
      (u) => t = u.maximumSize - u.size > 0 || t
    ), l = [...this.viewItems].toReversed();
    t = !1;
    const s = l.map((u) => t = u.size - u.minimumSize > 0 || t).toReversed();
    t = !1;
    const d = l.map((u) => t = u.maximumSize - u.size > 0 || t).toReversed();
    let c = 0;
    for (let u = 0; u < this.sashItems.length; u++) {
      const { sash: p } = this.sashItems[u], m = this.viewItems[u];
      c += m.size;
      const b = !(n[u] && d[u + 1]), v = !(i[u] && s[u + 1]);
      if (b && v) {
        const C = Nn(u, -1, -1), P = Nn(u + 1, this.viewItems.length), M = this.findFirstSnapIndex(C), q = this.findFirstSnapIndex(P), Q = typeof M == "number" && !this.viewItems[M].visible, V = typeof q == "number" && !this.viewItems[q].visible;
        Q && s[u] && (c > 0 || this.startSnappingEnabled) ? p.state = hl.Minimum : V && n[u] && (c < this.contentSize || this.endSnappingEnabled) ? p.state = hl.Maximum : p.state = hl.Disabled;
      } else b && !v ? p.state = hl.Minimum : !b && v ? p.state = hl.Maximum : p.state = hl.Enabled;
    }
  }
}
class Fl {
  size;
  constructor(t) {
    this.size = t;
  }
  getPreferredSize() {
    return this.size;
  }
}
class Uu {
  proportion;
  layoutService;
  constructor(t, n) {
    this.proportion = t, this.layoutService = n;
  }
  getPreferredSize() {
    return this.proportion * this.layoutService.getSize();
  }
}
class pa {
  getPreferredSize() {
  }
}
class Ku {
  minimumSize = 0;
  maximumSize = Number.POSITIVE_INFINITY;
  element;
  priority;
  snap;
  layoutService;
  layoutStrategy;
  get preferredSize() {
    return this.layoutStrategy.getPreferredSize();
  }
  set preferredSize(t) {
    if (typeof t == "number")
      this.layoutStrategy = new Fl(t);
    else if (typeof t == "string") {
      const n = t.trim();
      if (ga(n, "%")) {
        const i = Number(n.slice(0, -1)) / 100;
        this.layoutStrategy = new Uu(
          i,
          this.layoutService
        );
      } else if (ga(n, "px")) {
        const i = Number(n.slice(0, -2));
        this.layoutStrategy = new Fl(i);
      } else if (typeof Number.parseFloat(n) == "number") {
        const i = Number.parseFloat(n);
        this.layoutStrategy = new Fl(i);
      } else
        this.layoutStrategy = new pa();
    } else
      this.layoutStrategy = new pa();
  }
  constructor(t, n) {
    if (this.layoutService = t, this.element = n.element, this.snap = typeof n.snap == "boolean" ? n.snap : !1, this.minimumSize = this.snap ? 0 : typeof n.minimumSize == "number" ? n.minimumSize : 30, this.maximumSize = typeof n.maximumSize == "number" ? n.maximumSize : Number.POSITIVE_INFINITY, typeof n.preferredSize == "number")
      this.layoutStrategy = new Fl(n.preferredSize);
    else if (typeof n.preferredSize == "string") {
      const i = n.preferredSize.trim();
      if (ga(i, "%")) {
        const l = Number(i.slice(0, -1)) / 100;
        this.layoutStrategy = new Uu(
          l,
          this.layoutService
        );
      } else if (ga(i, "px")) {
        const l = Number(i.slice(0, -2));
        this.layoutStrategy = new Fl(l);
      } else if (typeof Number.parseFloat(i) == "number") {
        const l = Number.parseFloat(i);
        this.layoutStrategy = new Fl(l);
      } else
        this.layoutStrategy = new pa();
    } else
      this.layoutStrategy = new pa();
    this.priority = n.priority ?? $a.Normal;
  }
  layout(t) {
  }
}
function ly(e) {
  const t = ei(e, 4, 20), n = ei(e, 1, 8);
  document.documentElement.style.setProperty("--sash-size", `${t}px`), document.documentElement.style.setProperty(
    "--sash-hover-size",
    `${n}px`
  ), ey(t);
}
const oy = ["id"], ay = /* @__PURE__ */ Me({
  __name: "Allotment",
  props: {
    className: { default: "" },
    defaultSizes: {},
    id: {},
    maxSize: { default: 1 / 0 },
    minSize: { default: 30 },
    proportionalLayout: { type: Boolean, default: !0 },
    separator: { type: Boolean, default: !0 },
    snap: { type: Boolean, default: !1 },
    sizes: {},
    vertical: { type: Boolean, default: !1 }
  },
  emits: ["change", "reset", "visibleChange", "dragStart", "dragEnd"],
  setup(e, { expose: t, emit: n }) {
    const i = e, l = n, s = fe(), d = fe(), c = fe(!1), u = fe(null), p = wl(/* @__PURE__ */ new Map()), m = wl(/* @__PURE__ */ new Map()), b = fe(new Fm()), v = fe([]), C = fe([]), P = fe(null), M = jd();
    xl("allotment", {
      registerPane: (z, j, J) => {
        p.set(z, j), m.set(z, J), c.value && zn(() => {
          H();
        });
      },
      unregisterPane: (z) => {
        p.delete(z), m.delete(z);
      },
      registerNonPane: (z, j) => {
        p.set(z, j), m.set(z, {});
      }
    });
    const q = re(() => {
      const z = M.default?.({}) || [], j = (J) => {
        const K = [];
        for (const O of J)
          Array.isArray(O.children) ? K.push(...j(O.children)) : O.type && K.push(O);
        return K;
      };
      return j(z);
    });
    function Q(z) {
      const j = v.value?.[z];
      return typeof j?.preferredSize != "number" ? !1 : (u.value?.resizeView(z, Math.round(j.preferredSize)), !0);
    }
    function V() {
      if (l("reset"), !!u.value) {
        u.value.distributeViewSizes();
        for (let z = 0; z < v.value.length; z++)
          Q(z);
      }
    }
    function Y(z) {
      u.value?.resizeViews(z);
    }
    t({
      reset: V,
      resize: Y
    });
    function A() {
      if (!s.value)
        return;
      let z = !0;
      i.defaultSizes && p.size !== i.defaultSizes.length && (z = !1, console.warn(
        `Expected ${i.defaultSizes.length} children based on defaultSizes but found ${p.size}`
      ));
      const j = i.vertical ? s.value.clientHeight : s.value.clientWidth;
      b.value.setSize(j);
      let J = i.defaultSizes;
      if (!i.defaultSizes && p.size > 0) {
        const O = Math.floor(j / p.size);
        J = Array.from({ length: p.size }, () => O), J[J.length - 1] += j - O * p.size, z = !0, C.value = q.value.map(
          (Z) => Z.key
        );
      } else if (i.defaultSizes) {
        const O = i.defaultSizes.reduce((Z, U) => Z + U, 0);
        if (j > 0 && O > 0 && Math.abs(j - O) > 1) {
          const Z = j / O;
          J = i.defaultSizes.map((U) => Math.round(U * Z));
        }
        C.value = q.value.map(
          (Z) => Z.key
        );
      }
      v.value = [];
      const K = {
        orientation: i.vertical ? ni.Vertical : ni.Horizontal,
        proportionalLayout: i.proportionalLayout,
        ...z && J && {
          descriptor: {
            size: J.reduce((O, Z) => O + Z, 0),
            views: J.map((O, Z) => {
              const U = [...p.keys()][Z], $ = m.get(U), G = new Ku(b.value, {
                element: document.createElement("div"),
                minimumSize: $?.minSize ?? i.minSize,
                maximumSize: $?.maxSize ?? i.maxSize,
                priority: $?.priority ?? $a.Normal,
                ...$?.preferredSize && {
                  preferredSize: $?.preferredSize
                },
                snap: $?.snap ?? i.snap
              });
              return v.value.push(G), {
                container: [...p.values()][Z],
                size: O,
                view: G
              };
            })
          }
        }
      };
      if (u.value = new iy(
        s.value,
        K,
        (O) => l("change", O),
        (O) => l("dragStart", O),
        (O) => l("dragEnd", O)
      ), u.value.on("sashDragStart", () => {
        s.value?.classList.add("split-view-sash-dragging");
      }), u.value.on("sashDragEnd", () => {
        s.value?.classList.remove("split-view-sash-dragging");
      }), u.value.on("sashchange", (O) => {
        if (u.value) {
          const Z = q.value.map((U) => U.key);
          for (const [U, $] of Z.entries()) {
            const G = m.get($);
            G?.visible !== void 0 && G.visible !== u.value.isViewVisible(U) && l("visibleChange", U, u.value.isViewVisible(U));
          }
        }
      }), u.value?.on("sashreset", (O) => {
        l("reset"), !Q(O) && (Q(O + 1) || u.value?.distributeViewSizes());
      }), j > 0) {
        u.value.layout(j);
        for (let O = 0; O < v.value.length; O++)
          Q(O);
      }
    }
    function H() {
      if (!c.value || !u.value)
        return;
      const z = q.value.map((Z) => Z.key), j = [...C.value], J = z.filter((Z) => !C.value.includes(Z)), K = z.filter((Z) => C.value.includes(Z)), O = C.value.map((Z, U) => ({ key: Z, index: U, shouldExit: !z.includes(Z) }));
      for (let Z = O.length - 1; Z >= 0; Z--)
        O[Z].shouldExit && (u.value.removeView(O[Z].index), j.splice(O[Z].index, 1), v.value.splice(O[Z].index, 1));
      for (const Z of J) {
        const U = m.get(Z), $ = new Ku(b.value, {
          element: document.createElement("div"),
          minimumSize: U?.minSize ?? i.minSize,
          maximumSize: U?.maxSize ?? i.maxSize,
          priority: U?.priority ?? $a.Normal,
          ...U?.preferredSize && {
            preferredSize: U?.preferredSize
          },
          snap: U?.snap ?? i.snap
        }), G = z.indexOf(Z);
        u.value.addView(
          p.get(Z),
          $,
          Ed.Distribute,
          G
        ), j.splice(G, 0, Z), v.value.splice(G, 0, $);
      }
      for (; !Em(z, j); )
        for (const [Z, U] of z.entries()) {
          const $ = j.indexOf(U);
          if ($ !== Z) {
            u.value.moveView(
              p.get(U),
              $,
              Z
            );
            const G = j[$];
            j.splice($, 1), j.splice(Z, 0, G);
            const ue = v.value[$];
            v.value.splice($, 1), v.value.splice(Z, 0, ue);
            break;
          }
        }
      for (const Z of [...J, ...K]) {
        const U = m.get(Z), $ = z.indexOf(Z);
        if (U) {
          U.visible !== void 0 && u.value.isViewVisible($) !== U.visible && u.value.setViewVisible($, U.visible), U.preferredSize !== void 0 && v.value[$].preferredSize !== U.preferredSize && (v.value[$].preferredSize = U.preferredSize, Q($));
          let G = !1;
          U.minSize !== void 0 && v.value[$].minimumSize !== U.minSize && (v.value[$].minimumSize = U.minSize, G = !0), U.maxSize !== void 0 && v.value[$].maximumSize !== U.maxSize && (v.value[$].maximumSize = U.maxSize, G = !0), G && u.value.layout();
        }
      }
      (J.length > 0 || O.some((Z) => Z.shouldExit)) && (C.value = z);
    }
    function ee() {
      s.value && (P.value = new ResizeObserver(() => {
        if (s.value) {
          const z = i.vertical ? s.value.clientHeight : s.value.clientWidth;
          z > 0 && (u.value?.layout(z), b.value.setSize(z), c.value || (c.value = !0));
        }
      }), P.value.observe(s.value));
    }
    return An(() => {
      Td && ly(20), zn(() => {
        A(), ee(), setTimeout(() => {
          if (s.value && u.value) {
            const z = i.vertical ? s.value.clientHeight : s.value.clientWidth;
            z > 0 && u.value.layout(z);
          }
        }, 50);
      });
    }), Fe(q, () => {
      zn(() => {
        H();
      });
    }, { deep: !0 }), Fe(() => i.vertical, (z) => {
      u.value && (u.value.orientation = z ? ni.Vertical : ni.Horizontal, u.value.layout());
    }), Fe(() => i.proportionalLayout, (z) => {
      u.value && (u.value.proportionalLayout = z);
    }), Xi(() => {
      P.value?.disconnect(), u.value?.dispose();
    }), (z, j) => (E(), B("div", {
      id: z.id,
      ref_key: "containerRef",
      ref: s,
      class: Ae(["split-view", [
        z.vertical ? "split-view-vertical" : "split-view-horizontal",
        { "split-view-separator-border": z.separator },
        f(Gi).splitView,
        z.vertical ? f(Gi).vertical : f(Gi).horizontal,
        { [f(Gi).separatorBorder]: z.separator },
        z.className
      ]])
    }, [
      y("div", {
        ref_key: "splitViewContainerRef",
        ref: d,
        class: Ae(["split-view-container", [f(Gi).splitViewContainer]])
      }, [
        Ti(z.$slots, "default", {}, void 0, !0)
      ], 2)
    ], 10, oy));
  }
}), sy = (e, t) => {
  const n = e.__vccOpts || e;
  for (const [i, l] of t)
    n[i] = l;
  return n;
}, Xu = /* @__PURE__ */ sy(ay, [["__scopeId", "data-v-e77a1ca4"]]), va = /* @__PURE__ */ Me({
  __name: "Pane",
  props: {
    className: { default: "" },
    maxSize: {},
    minSize: {},
    snap: { type: Boolean, default: !1 },
    preferredSize: {},
    priority: {},
    visible: { type: Boolean, default: !0 }
  },
  setup(e, { expose: t }) {
    const n = e, i = fe(), l = Wd(), s = bl("allotment");
    function d() {
      return l?.vnode.key || `pane-${Math.random().toString(36).slice(2, 11)}`;
    }
    const c = d();
    return An(() => {
      s && i.value && s.registerPane(c, i.value, {
        minSize: n.minSize,
        maxSize: n.maxSize,
        preferredSize: n.preferredSize,
        priority: n.priority,
        snap: n.snap,
        visible: n.visible
      });
    }), Fe(() => n, (u) => {
      s && i.value && s.registerPane(c, i.value, {
        minSize: u.minSize,
        maxSize: u.maxSize,
        preferredSize: u.preferredSize,
        priority: u.priority,
        snap: u.snap,
        visible: u.visible
      });
    }, { deep: !0 }), Xi(() => {
      s && s.unregisterPane(c);
    }), t({
      element: i
    }), (u, p) => (E(), B("div", {
      ref_key: "paneRef",
      ref: i,
      class: Ae(["split-view-view", [
        u.visible && "split-view-view-visible",
        f(Gi).splitViewView,
        u.className
      ]])
    }, [
      Ti(u.$slots, "default")
    ], 2));
  }
}), ry = { class: "flex flex-col gap-3" }, uy = { class: "text-xs text-secondary mb-1" }, cy = { class: "text-xs text-secondary mb-1" }, dy = { class: "text-xs text-secondary mb-1" }, fy = { class: "text-xs text-secondary mb-1" }, hy = { class: "text-xs text-secondary mb-1" }, gy = { class: "text-xs text-secondary mb-1" }, py = ["value"], vy = { class: "text-xs text-secondary mb-1" }, my = { class: "text-xs text-secondary mb-1" }, yy = { class: "text-xs text-secondary mb-1" }, by = { class: "text-xs text-secondary mb-1" }, xy = { class: "text-xs text-secondary mb-1" }, wy = { class: "text-xs text-secondary mb-1" }, Sy = ["value"], ky = { class: "text-xs text-secondary mb-1" }, Cy = { class: "text-xs text-secondary mb-1" }, _y = { key: 0 }, My = { class: "text-xs text-secondary mb-1" }, zy = ["value"], Ty = { class: "text-xs text-secondary mb-1" }, Py = /* @__PURE__ */ Me({
  __name: "AxesSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = nt();
    return (n, i) => {
      const l = ot("a-radio-button"), s = ot("a-radio-group"), d = ot("a-switch");
      return E(), B("div", ry, [
        y("div", null, [
          y("div", uy, I(f(t)("config.field.axisPlacement")), 1),
          k(s, {
            size: "small",
            value: e.panel.axisPlacement ?? "left",
            onChange: i[0] || (i[0] = (c) => e.onChange({ axisPlacement: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "left" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.placement.left")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "right" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.placement.right")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "hidden" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.placement.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", cy, I(f(t)("config.field.axisLabel")), 1),
          k(f(Ze), {
            size: "small",
            value: e.panel.axisLabel ?? "",
            placeholder: f(t)("config.axis.label.placeholder"),
            onChange: i[1] || (i[1] = (c) => e.onChange({ axisLabel: c.target.value }))
          }, null, 8, ["value", "placeholder"])
        ]),
        y("div", null, [
          y("div", dy, I(f(t)("config.field.axisName")), 1),
          k(f(Ze), {
            size: "small",
            value: e.panel.axisName ?? "",
            placeholder: f(t)("config.axis.name.placeholder"),
            onChange: i[2] || (i[2] = (c) => e.onChange({ axisName: c.target.value }))
          }, null, 8, ["value", "placeholder"])
        ]),
        y("div", null, [
          y("div", fy, I(f(t)("config.field.axisWidth")), 1),
          k(f(on), {
            size: "small",
            value: e.panel.axisWidth ?? void 0,
            min: 20,
            max: 300,
            style: { width: "100%" },
            onChange: i[3] || (i[3] = (c) => e.onChange({ axisWidth: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", hy, I(f(t)("config.field.showGridLines")), 1),
          k(s, {
            size: "small",
            value: e.panel.showGridLines ?? "all",
            onChange: i[4] || (i[4] = (c) => e.onChange({ showGridLines: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "all" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "x" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.x")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "y" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.y")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "hidden" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", gy, I(f(t)("config.field.gridColor")), 1),
          y("input", {
            type: "color",
            value: e.panel.gridColor ?? "#e8e8e8",
            onInput: i[5] || (i[5] = (c) => e.onChange({ gridColor: c.target.value }))
          }, null, 40, py)
        ]),
        y("div", null, [
          y("div", vy, I(f(t)("config.field.scaleDistribution")), 1),
          k(s, {
            size: "small",
            value: e.panel.scaleDistribution ?? "linear",
            onChange: i[6] || (i[6] = (c) => e.onChange({ scaleDistribution: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "linear" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.scale.linear")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "logarithmic" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.scale.logarithmic")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", my, I(f(t)("config.field.softMin")), 1),
          k(f(on), {
            size: "small",
            value: e.panel.softMin ?? void 0,
            style: { width: "100%" },
            onChange: i[7] || (i[7] = (c) => e.onChange({ softMin: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", yy, I(f(t)("config.field.softMax")), 1),
          k(f(on), {
            size: "small",
            value: e.panel.softMax ?? void 0,
            style: { width: "100%" },
            onChange: i[8] || (i[8] = (c) => e.onChange({ softMax: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", by, I(f(t)("config.field.centeredZero")), 1),
          k(d, {
            size: "small",
            checked: e.panel.centeredZero,
            onChange: i[9] || (i[9] = (c) => e.onChange({ centeredZero: c }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", xy, I(f(t)("config.field.axisLine")), 1),
          k(s, {
            size: "small",
            value: e.panel.axisLabel ?? "all",
            onChange: i[10] || (i[10] = (c) => e.onChange({ axisLabel: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "all" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "x" }, {
                default: R(() => [...i[16] || (i[16] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              k(l, { value: "y" }, {
                default: R(() => [...i[17] || (i[17] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              k(l, { value: "hidden" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", wy, I(f(t)("config.field.axisLineColor")), 1),
          y("input", {
            type: "color",
            value: e.panel.axisLabelColor ?? "#666666",
            onInput: i[11] || (i[11] = (c) => e.onChange({ axisLabelColor: c.target.value }))
          }, null, 40, Sy)
        ]),
        y("div", null, [
          y("div", ky, I(f(t)("config.field.axisTickShow")), 1),
          k(s, {
            size: "small",
            value: e.panel.axisTick ?? "hidden",
            onChange: i[12] || (i[12] = (c) => e.onChange({ axisTick: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "all" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "x" }, {
                default: R(() => [...i[18] || (i[18] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              k(l, { value: "y" }, {
                default: R(() => [...i[19] || (i[19] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              k(l, { value: "hidden" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Cy, I(f(t)("config.field.axisBorder")), 1),
          k(s, {
            size: "small",
            value: e.panel.axisBorder ?? "hidden",
            onChange: i[13] || (i[13] = (c) => e.onChange({ axisBorder: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "all" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.all")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "x" }, {
                default: R(() => [...i[20] || (i[20] = [
                  ce(" X ", -1)
                ])]),
                _: 1
              }),
              k(l, { value: "y" }, {
                default: R(() => [...i[21] || (i[21] = [
                  ce(" Y ", -1)
                ])]),
                _: 1
              }),
              k(l, { value: "hidden" }, {
                default: R(() => [
                  ce(I(f(t)("config.axis.grid.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.axisBorder && e.panel.axisBorder !== "hidden" ? (E(), B("div", _y, [
          y("div", My, I(f(t)("config.field.axisBorderColor")), 1),
          y("input", {
            type: "color",
            value: e.panel.axisBorderColor ?? "#cccccc",
            onInput: i[14] || (i[14] = (c) => e.onChange({ axisBorderColor: c.target.value }))
          }, null, 40, zy)
        ])) : ye("", !0),
        y("div", null, [
          y("div", Ty, I(f(t)("config.field.logScale")), 1),
          k(d, {
            size: "small",
            checked: e.panel.scaleDistribution === "logarithmic",
            onChange: i[15] || (i[15] = (c) => e.onChange({ scaleDistribution: c ? "logarithmic" : "linear" }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), $y = { class: "flex flex-col gap-3" }, Ey = { class: "text-xs text-secondary mb-1" }, Iy = { class: "text-xs text-secondary mb-1" }, Ay = { class: "text-xs text-secondary mb-1" }, Oy = { class: "text-xs text-secondary mb-1" }, Dy = { class: "text-xs text-secondary mb-1" }, Ly = { class: "text-xs text-secondary mb-1" }, qy = { class: "text-xs text-secondary mb-1" }, Ry = /* @__PURE__ */ Me({
  __name: "BarStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = nt();
    return (n, i) => {
      const l = ot("a-radio-button"), s = ot("a-radio-group"), d = ot("a-switch"), c = ot("a-input-number");
      return E(), B("div", $y, [
        y("div", null, [
          y("div", Ey, I(f(t)("config.field.barShowValues")), 1),
          k(s, {
            size: "small",
            value: e.panel.barShowValues ?? "auto",
            onChange: i[0] || (i[0] = (u) => e.onChange({ barShowValues: u.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "auto" }, {
                default: R(() => [
                  ce(I(f(t)("config.showValues.auto")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "always" }, {
                default: R(() => [
                  ce(I(f(t)("config.showValues.always")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "never" }, {
                default: R(() => [
                  ce(I(f(t)("config.showValues.never")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Iy, I(f(t)("config.field.barGroupWidth")), 1),
          k(f(xn), {
            min: 0.1,
            max: 1,
            step: 0.05,
            value: e.panel.barGroupWidth ?? 0.7,
            onChange: i[1] || (i[1] = (u) => e.onChange({ barGroupWidth: u }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Ay, I(f(t)("config.field.barWidth")), 1),
          k(f(xn), {
            min: 0.1,
            max: 1,
            step: 0.05,
            value: e.panel.barWidth ?? 1,
            onChange: i[2] || (i[2] = (u) => e.onChange({ barWidth: u }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Oy, I(f(t)("config.field.stacked")), 1),
          k(d, {
            size: "small",
            checked: e.panel.stacked,
            onChange: i[3] || (i[3] = (u) => e.onChange({ stacked: u }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", Dy, I(f(t)("config.field.lineWidth")), 1),
          k(c, {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.lineWidth,
            style: { width: "100%" },
            onChange: i[4] || (i[4] = (u) => e.onChange({ lineWidth: u ?? 1 }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Ly, I(f(t)("config.field.fillOpacity")), 1),
          k(f(xn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: i[5] || (i[5] = (u) => e.onChange({ fillOpacity: u }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", qy, I(f(t)("config.field.xTickRotation")), 1),
          k(d, {
            size: "small",
            checked: e.panel.barXTickRotation ?? !1,
            onChange: i[6] || (i[6] = (u) => e.onChange({ barXTickRotation: u }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), Ny = { class: "flex flex-col gap-3" }, Vy = { class: "text-xs text-secondary mb-1" }, Fy = { class: "text-xs text-secondary mb-1" }, By = { class: "text-xs text-secondary mb-1" }, Hy = ["value"], Wy = { class: "text-xs text-secondary mb-1" }, jy = { class: "text-xs text-secondary mb-1" }, Gy = { class: "text-xs text-secondary mb-1" }, Yy = { class: "text-xs text-secondary mb-1" }, Uy = { class: "text-xs text-secondary mb-1" }, Ky = { key: 0 }, Xy = { class: "text-xs text-secondary mb-1" }, Qy = ["value"], Jy = { class: "text-xs text-secondary mb-1" }, Zy = { class: "text-xs text-secondary mb-1" }, eb = { class: "text-xs text-secondary mb-1" }, tb = { class: "text-xs text-secondary mb-1" }, nb = { class: "text-xs text-secondary mb-1" }, ib = { class: "text-xs text-secondary mb-1" }, lb = /* @__PURE__ */ Me({
  __name: "GaugeStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = nt();
    return (n, i) => {
      const l = ot("a-switch"), s = ot("a-radio-button"), d = ot("a-radio-group");
      return E(), B("div", Ny, [
        y("div", null, [
          y("div", Vy, I(f(t)("config.gauge.fillWidth")), 1),
          k(f(xn), {
            min: 1,
            max: 100,
            value: e.panel.gaugeFillWidth ?? f(_t).fillWidth,
            onChange: i[0] || (i[0] = (c) => e.onChange({ gaugeFillWidth: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Fy, I(f(t)("config.gauge.trackWidth")), 1),
          k(f(xn), {
            min: 1,
            max: 100,
            value: e.panel.gaugeTrackWidth ?? f(_t).trackWidth,
            onChange: i[1] || (i[1] = (c) => e.onChange({ gaugeTrackWidth: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", By, I(f(t)("config.gauge.trackColor")), 1),
          y("input", {
            type: "color",
            value: e.panel.gaugeTrackColor ?? "#222222",
            onInput: i[2] || (i[2] = (c) => e.onChange({ gaugeTrackColor: c.target.value }))
          }, null, 40, Hy)
        ]),
        y("div", null, [
          y("div", Wy, I(f(t)("config.gauge.arcSweep")), 1),
          k(f(xn), {
            min: 30,
            max: 360,
            value: e.panel.sweepAngle ?? f(_t).sweepAngle,
            onChange: i[3] || (i[3] = (c) => e.onChange({ sweepAngle: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", jy, I(f(t)("config.gauge.paddingX")), 1),
          k(f(xn), {
            min: 0,
            max: 0.5,
            step: 0.01,
            value: e.panel.gaugePaddingX ?? 0.05,
            onChange: i[4] || (i[4] = (c) => e.onChange({ gaugePaddingX: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Gy, I(f(t)("config.gauge.paddingY")), 1),
          k(f(xn), {
            min: 0,
            max: 0.5,
            step: 0.01,
            value: e.panel.gaugePaddingY ?? 0.1,
            onChange: i[5] || (i[5] = (c) => e.onChange({ gaugePaddingY: c }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Yy, I(f(t)("config.gauge.capRound")), 1),
          k(l, {
            size: "small",
            checked: e.panel.gaugeCapRound ?? f(_t).capRound,
            onChange: i[6] || (i[6] = (c) => e.onChange({ gaugeCapRound: c }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", Uy, I(f(t)("config.gauge.valueVisible")), 1),
          k(l, {
            size: "small",
            checked: e.panel.gaugeValueVisible ?? f(_t).valueVisible,
            onChange: i[7] || (i[7] = (c) => e.onChange({ gaugeValueVisible: c }))
          }, null, 8, ["checked"])
        ]),
        e.panel.gaugeValueVisible !== !1 ? (E(), B("div", Ky, [
          y("div", Xy, I(f(t)("config.gauge.valueColor")), 1),
          y("input", {
            type: "color",
            value: e.panel.gaugeValueColor ?? "#ffffff",
            onInput: i[8] || (i[8] = (c) => e.onChange({ gaugeValueColor: c.target.value }))
          }, null, 40, Qy)
        ])) : ye("", !0),
        y("div", null, [
          y("div", Jy, I(f(t)("config.gauge.valueSize")), 1),
          k(f(on), {
            size: "small",
            min: 8,
            max: 80,
            value: e.panel.gaugeValueSize ?? f(_t).valueSize,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[9] || (i[9] = (c) => e.onChange({ gaugeValueSize: c ?? f(_t).valueSize }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Zy, I(f(t)("config.gauge.valueOffsetY")), 1),
          k(f(on), {
            size: "small",
            min: -50,
            max: 50,
            value: e.panel.gaugeValueOffsetY ?? f(_t).valueOffsetY,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[10] || (i[10] = (c) => e.onChange({ gaugeValueOffsetY: c ?? f(_t).valueOffsetY }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", eb, I(f(t)("config.gauge.colorFromScheme")), 1),
          k(l, {
            size: "small",
            checked: e.panel.gaugeColorFromScheme ?? !1,
            onChange: i[11] || (i[11] = (c) => e.onChange({ gaugeColorFromScheme: c }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", tb, I(f(t)("config.gauge.thresholdDisplay")), 1),
          k(d, {
            size: "small",
            value: e.panel.gaugeThresholdDisplay ?? f(_t).thresholdDisplay,
            onChange: i[12] || (i[12] = (c) => e.onChange({ gaugeThresholdDisplay: c.target.value }))
          }, {
            default: R(() => [
              k(s, { value: "none" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.thresholdDisplayNone")), 1)
                ]),
                _: 1
              }),
              k(s, { value: "marker" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.thresholdDisplayMarker")), 1)
                ]),
                _: 1
              }),
              k(s, { value: "track" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.thresholdDisplayTrack")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", nb, I(f(t)("config.gauge.thresholdLabelDisplay")), 1),
          k(d, {
            size: "small",
            value: e.panel.gaugeThresholdLabelDisplay ?? "none",
            onChange: i[13] || (i[13] = (c) => e.onChange({ gaugeThresholdLabelDisplay: c.target.value }))
          }, {
            default: R(() => [
              k(s, { value: "none" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.thresholdLabelNone")), 1)
                ]),
                _: 1
              }),
              k(s, { value: "label" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.thresholdLabelLabel")), 1)
                ]),
                _: 1
              }),
              k(s, { value: "value" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.thresholdLabelValue")), 1)
                ]),
                _: 1
              }),
              k(s, { value: "both" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.thresholdLabelBoth")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", ib, I(f(t)("config.gauge.orientation")), 1),
          k(d, {
            size: "small",
            value: e.panel.gaugeOrientation ?? f(_t).orientation,
            onChange: i[14] || (i[14] = (c) => e.onChange({ gaugeOrientation: c.target.value }))
          }, {
            default: R(() => [
              k(s, { value: "auto" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.orientationAuto")), 1)
                ]),
                _: 1
              }),
              k(s, { value: "horizontal" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.orientationHorizontal")), 1)
                ]),
                _: 1
              }),
              k(s, { value: "vertical" }, {
                default: R(() => [
                  ce(I(f(t)("config.gauge.orientationVertical")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])
      ]);
    };
  }
}), ze = {
  // Actions
  edit: "i-carbon:edit",
  delete: "i-carbon:trash-can",
  clone: "i-carbon:stickies ",
  plus: "i-carbon:add-large",
  save: "i-mdi-content-save",
  cancel: "i-mdi-cancel",
  refresh: "i-carbon:renew",
  download: "i-carbon:download",
  upload: "i-carbon:upload",
  export: "i-carbon:export",
  import: "i-carbon:document-import",
  search: "i-mdi-magnify",
  settings: "i-carbon:settings",
  config: "i-carbon:settings-adjust",
  link: "i-mdi-link",
  // Navigation
  fullscreen: "i-carbon:center-to-fit",
  chevronDown: "i-carbon:chevron-down",
  chevronRight: "i-carbon:chevron-right",
  dotsVertical: "i-mdi-dots-vertical",
  dragVertical: "i-carbon:draggable",
  closeCircle: "i-mdi-close-circle",
  chevronLeft: "i-carbon:chevron-left",
  // Info
  info: "i-carbon:information",
  // view
  view: "i-carbon:view",
  viewOff: "i-carbon:view-off",
  // Theme
  sun: "i-mdi-white-balance-sunny",
  moon: "i-mdi-weather-night",
  // Panel types
  chartLine: "i-mdi-chart-line",
  chartBar: "i-mdi-chart-bar",
  chartArea: "i-mdi-chart-areaspline",
  chartPie: "i-mdi-chart-pie",
  stat: "i-mdi-format-list-numbered",
  gauge: "i-mdi-alarm-panel",
  table: "i-mdi-table",
  databaseOff: "i-mdi-database-off"
}, ob = { class: "inline-flex gap-0.5 items-center" }, ab = /* @__PURE__ */ Me({
  __name: "PaletteSwatches",
  props: {
    colors: {}
  },
  setup(e) {
    return (t, n) => (E(), B("span", ob, [
      (E(!0), B($e, null, Xe(e.colors, (i, l) => (E(), B("span", {
        key: `${i}-${l}`,
        class: "inline-block rounded-sm flex-shrink-0",
        style: He({ width: "12px", height: "12px", background: i })
      }, null, 4))), 128))
    ]));
  }
}), sb = [
  { value: "classic", colors: Yi.slice(0, 8) },
  { value: "tableau10", colors: Vn.tableau10.slice(0, 8) },
  { value: "grafana-classic", colors: Vn["grafana-classic"].slice(0, 8) },
  { value: "green-yellow-red", colors: Vn["green-yellow-red"] },
  { value: "red-yellow-green", colors: Vn["red-yellow-green"] },
  { value: "blue-yellow-red", colors: Vn["blue-yellow-red"] },
  { value: "blue-purple", colors: Vn["blue-purple"] },
  { value: "yellow-blue", colors: Vn["yellow-blue"] },
  { value: "blues", colors: Vn.blues },
  { value: "reds", colors: Vn.reds },
  { value: "GrYlRd", colors: Vn.GrYlRd },
  { value: "purple-orange", colors: Vn["purple-orange"] },
  { value: "fixed", colors: [] },
  { value: "thresholds", colors: [] }
], rb = { class: "flex flex-col gap-3" }, ub = { class: "text-xs text-secondary mb-1" }, cb = { class: "text-xs text-secondary mb-1" }, db = { class: "text-xs text-secondary mb-1" }, fb = { class: "inline-flex items-center gap-1.5" }, hb = { key: 0 }, gb = { class: "text-xs text-secondary mb-1" }, pb = ["value"], vb = { key: 1 }, mb = { class: "text-xs text-secondary mb-1" }, yb = { class: "text-xs text-secondary mb-1" }, bb = { class: "flex gap-1 items-center" }, xb = { class: "flex items-center gap-1" }, wb = { class: "text-xs text-secondary" }, Qu = /* @__PURE__ */ Me({
  __name: "GeneralSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = nt(), i = sb.map((c) => ({
      value: c.value,
      label: n(`config.scheme.${c.value}`),
      colors: c.colors
    }));
    function l() {
      const c = [...t.panel.links ?? [], { title: "", url: "", newTab: !0 }];
      t.onChange({ links: c });
    }
    function s(c) {
      const u = (t.panel.links ?? []).filter((p, m) => m !== c);
      t.onChange({ links: u });
    }
    function d(c, u) {
      const p = (t.panel.links ?? []).map((m, b) => b === c ? { ...m, ...u } : m);
      t.onChange({ links: p });
    }
    return (c, u) => {
      const p = ot("a-switch");
      return E(), B("div", rb, [
        y("div", null, [
          y("div", ub, I(f(n)("config.field.title")), 1),
          k(f(Ze), {
            size: "small",
            value: e.panel.title,
            onChange: u[0] || (u[0] = (m) => e.onChange({ title: m.target.value }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", cb, I(f(n)("config.field.description")), 1),
          k(f(Ze), {
            size: "small",
            value: e.panel.description,
            onChange: u[1] || (u[1] = (m) => e.onChange({ description: m.target.value }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", db, I(f(n)("config.field.colorScheme")), 1),
          k(f(Qe), {
            size: "small",
            value: e.panel.colorScheme ?? "classic",
            "option-label-prop": "children",
            style: { width: "100%" },
            onChange: u[2] || (u[2] = (m) => e.onChange({ colorScheme: m }))
          }, {
            default: R(() => [
              (E(!0), B($e, null, Xe(f(i), (m) => (E(), Ce(f(Qe).Option, {
                key: m.value,
                value: m.value
              }, {
                default: R(() => [
                  y("span", fb, [
                    m.colors.length ? (E(), Ce(ab, {
                      key: 0,
                      colors: m.colors
                    }, null, 8, ["colors"])) : ye("", !0),
                    y("span", null, I(m.label), 1)
                  ])
                ]),
                _: 2
              }, 1032, ["value"]))), 128))
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.colorScheme === "fixed" ? (E(), B("div", hb, [
          y("div", gb, I(f(n)("config.field.colorSingle")), 1),
          y("input", {
            type: "color",
            value: e.panel.colorSingleValue ?? "#4096ff",
            onInput: u[3] || (u[3] = (m) => e.onChange({ colorSingleValue: m.target.value }))
          }, null, 40, pb)
        ])) : ye("", !0),
        e.panel.colorScheme && e.panel.colorScheme !== "fixed" && e.panel.colorScheme !== "thresholds" ? (E(), B("div", vb, [
          y("div", mb, I(f(n)("config.field.colorDistribution")), 1),
          k(f(Qe), {
            size: "small",
            value: e.panel.colorDistribution ?? "sequential",
            options: [
              { value: "sequential", label: f(n)("config.colorDist.sequential") },
              { value: "distributed", label: f(n)("config.colorDist.distributed") }
            ],
            style: { width: "100%" },
            onChange: u[4] || (u[4] = (m) => e.onChange({ colorDistribution: m }))
          }, null, 8, ["value", "options"])
        ])) : ye("", !0),
        y("div", null, [
          y("div", yb, I(f(n)("config.section.links", { n: (e.panel.links ?? []).length })), 1),
          (E(!0), B($e, null, Xe(e.panel.links ?? [], (m, b) => (E(), B("div", {
            key: b,
            class: "mb-2 flex flex-col gap-1"
          }, [
            y("div", bb, [
              k(f(Ze), {
                size: "small",
                value: m.title,
                placeholder: "Title",
                style: { flex: "1" },
                onChange: (v) => d(b, { title: v.target.value })
              }, null, 8, ["value", "onChange"]),
              k(f(tt), {
                type: "text",
                danger: "",
                size: "small",
                onClick: (v) => s(b)
              }, {
                default: R(() => [
                  y("span", {
                    class: Ae(f(ze).delete)
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["onClick"])
            ]),
            k(f(Ze), {
              size: "small",
              value: m.url,
              placeholder: "https://",
              onChange: (v) => d(b, { url: v.target.value })
            }, null, 8, ["value", "onChange"]),
            y("div", xb, [
              k(p, {
                size: "small",
                checked: m.newTab,
                onChange: (v) => d(b, { newTab: v })
              }, null, 8, ["checked", "onChange"]),
              y("span", wb, I(f(n)("config.link.newTab")), 1)
            ])
          ]))), 128)),
          k(f(tt), {
            type: "dashed",
            size: "small",
            block: "",
            onClick: l
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).plus, "mr-1"])
              }, null, 2),
              ce(I(f(n)("config.link.add")), 1)
            ]),
            _: 1
          })
        ])
      ]);
    };
  }
}), Sb = { class: "flex flex-col gap-3" }, kb = { class: "text-xs text-secondary mb-1" }, Cb = { class: "text-xs text-secondary mb-1" }, _b = { class: "text-xs text-secondary mb-1" }, Mb = { class: "text-xs text-secondary mb-1" }, zb = { class: "text-xs text-secondary mb-1" }, Tb = { class: "text-xs text-secondary mb-1" }, Pb = /* @__PURE__ */ Me({
  __name: "HistogramStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = nt();
    return (n, i) => {
      const l = ot("a-input-number"), s = ot("a-switch");
      return E(), B("div", Sb, [
        y("div", null, [
          y("div", kb, I(f(t)("config.field.histBucketCount")), 1),
          k(l, {
            size: "small",
            min: 1,
            max: 500,
            value: e.panel.histBucketCount ?? 30,
            style: { width: "100%" },
            onChange: i[0] || (i[0] = (d) => e.onChange({ histBucketCount: d ?? 30 }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Cb, I(f(t)("config.field.histBucketSize")), 1),
          k(l, {
            size: "small",
            min: 0,
            value: e.panel.histBucketSize,
            placeholder: f(t)("config.hist.bucketSizePlaceholder"),
            style: { width: "100%" },
            onChange: i[1] || (i[1] = (d) => e.onChange({ histBucketSize: d }))
          }, null, 8, ["value", "placeholder"])
        ]),
        y("div", null, [
          y("div", _b, I(f(t)("config.field.histBucketOffset")), 1),
          k(l, {
            size: "small",
            min: 0,
            value: e.panel.histBucketOffset ?? 0,
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (d) => e.onChange({ histBucketOffset: d ?? 0 }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Mb, I(f(t)("config.field.histCombineSeries")), 1),
          k(s, {
            size: "small",
            checked: e.panel.histCombineSeries ?? !1,
            onChange: i[3] || (i[3] = (d) => e.onChange({ histCombineSeries: d }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", zb, I(f(t)("config.field.lineWidth")), 1),
          k(l, {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.lineWidth,
            style: { width: "100%" },
            onChange: i[4] || (i[4] = (d) => e.onChange({ lineWidth: d ?? 1 }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Tb, I(f(t)("config.field.fillOpacity")), 1),
          k(f(xn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: i[5] || (i[5] = (d) => e.onChange({ fillOpacity: d }))
          }, null, 8, ["value"])
        ])
      ]);
    };
  }
}), $b = { class: "flex flex-col gap-3" }, Eb = { class: "override-rule-header" }, Ib = { class: "override-props" }, Ab = /* @__PURE__ */ Me({
  __name: "OverridesSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = nt(), i = [
      { value: "byName", label: "Field name" },
      { value: "byType", label: "Field type" },
      { value: "byRegexp", label: "Field name by regex" }
    ], l = [
      { value: "displayName", label: "Display name" },
      { value: "unit", label: "Unit" },
      { value: "decimals", label: "Decimals" },
      { value: "color", label: "Color" },
      { value: "thresholds", label: "Thresholds" },
      { value: "min", label: "Min" },
      { value: "max", label: "Max" },
      { value: "noValue", label: "No value" }
    ], s = re(() => t.panel.fieldConfigOverrides ?? []);
    function d() {
      const v = {
        id: crypto.randomUUID(),
        matcher: { id: "byName", options: "" },
        properties: []
      };
      t.onChange({ fieldConfigOverrides: [...s.value, v] });
    }
    function c(v) {
      t.onChange({
        fieldConfigOverrides: s.value.filter((C) => C.id !== v)
      });
    }
    function u(v, C) {
      t.onChange({
        fieldConfigOverrides: s.value.map(
          (P) => P.id === v ? { ...P, matcher: { ...P.matcher, ...C } } : P
        )
      });
    }
    function p(v) {
      t.onChange({
        fieldConfigOverrides: s.value.map(
          (C) => C.id === v ? { ...C, properties: [...C.properties, { id: "displayName", value: "" }] } : C
        )
      });
    }
    function m(v, C, P) {
      t.onChange({
        fieldConfigOverrides: s.value.map(
          (M) => M.id === v ? {
            ...M,
            properties: M.properties.map(
              (q, Q) => Q === C ? { ...q, ...P } : q
            )
          } : M
        )
      });
    }
    function b(v, C) {
      t.onChange({
        fieldConfigOverrides: s.value.map(
          (P) => P.id === v ? { ...P, properties: P.properties.filter((M, q) => q !== C) } : P
        )
      });
    }
    return (v, C) => (E(), B("div", $b, [
      (E(!0), B($e, null, Xe(s.value, (P) => (E(), B("div", {
        key: P.id,
        class: "override-rule"
      }, [
        y("div", Eb, [
          k(f(Qe), {
            size: "small",
            value: P.matcher.id,
            options: i,
            style: { flex: "1" },
            onChange: (M) => u(P.id, { id: M })
          }, null, 8, ["value", "onChange"]),
          k(f(Ze), {
            size: "small",
            value: P.matcher.options ?? "",
            placeholder: f(n)("editor.overrides.matcherValue"),
            style: { flex: "1" },
            onChange: (M) => u(P.id, { options: M.target.value })
          }, null, 8, ["value", "placeholder", "onChange"]),
          k(f(tt), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (M) => c(P.id)
          }, {
            default: R(() => [
              y("span", {
                class: Ae(f(ze).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]),
        y("div", Ib, [
          (E(!0), B($e, null, Xe(P.properties, (M, q) => (E(), B("div", {
            key: q,
            class: "override-prop-row"
          }, [
            k(f(Qe), {
              size: "small",
              value: M.id,
              options: l,
              style: { width: "140px" },
              onChange: (Q) => m(P.id, q, { id: Q })
            }, null, 8, ["value", "onChange"]),
            k(f(Ze), {
              size: "small",
              value: String(M.value ?? ""),
              placeholder: f(n)("editor.overrides.propValue"),
              style: { flex: "1" },
              onChange: (Q) => m(P.id, q, { value: Q.target.value })
            }, null, 8, ["value", "placeholder", "onChange"]),
            k(f(tt), {
              type: "text",
              danger: "",
              size: "small",
              onClick: (Q) => b(P.id, q)
            }, {
              default: R(() => [
                y("span", {
                  class: Ae(f(ze).closeCircle)
                }, null, 2)
              ]),
              _: 1
            }, 8, ["onClick"])
          ]))), 128)),
          k(f(tt), {
            type: "dashed",
            size: "small",
            style: { width: "100%", "margin-top": "4px" },
            onClick: (M) => p(P.id)
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).plus, "mr-1"])
              }, null, 2),
              ce(" " + I(f(n)("editor.overrides.addProperty")), 1)
            ]),
            _: 1
          }, 8, ["onClick"])
        ])
      ]))), 128)),
      k(f(tt), {
        type: "dashed",
        size: "small",
        style: { width: "100%" },
        onClick: d
      }, {
        default: R(() => [
          y("span", {
            class: Ae([f(ze).plus, "mr-1"])
          }, null, 2),
          ce(" " + I(f(n)("editor.overrides.addOverride")), 1)
        ]),
        _: 1
      })
    ]));
  }
}), wn = (e, t) => {
  const n = e.__vccOpts || e;
  for (const [i, l] of t)
    n[i] = l;
  return n;
}, Ju = /* @__PURE__ */ wn(Ab, [["__scopeId", "data-v-2396374b"]]), Ob = { class: "flex flex-col gap-3" }, Db = { class: "text-xs text-secondary mb-1" }, Lb = { class: "text-xs text-secondary mb-1" }, qb = { class: "text-xs text-secondary mb-1" }, Rb = { class: "flex flex-col gap-1" }, Nb = { class: "text-xs" }, Vb = { class: "text-xs text-secondary mb-1" }, Fb = { key: 0 }, Bb = { class: "text-xs text-secondary mb-1" }, Hb = { class: "text-xs text-secondary mb-1" }, Wb = { class: "text-xs text-secondary mb-1" }, jb = { class: "flex flex-col gap-1" }, Gb = { class: "text-xs" }, Yb = /* @__PURE__ */ Me({
  __name: "PieStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = nt(), i = re(() => t.panel.pieLabels ?? []), l = re(() => t.panel.legendValues ?? []);
    function s(c, u) {
      const p = u ? [...i.value, c] : i.value.filter((m) => m !== c);
      t.onChange({ pieLabels: p });
    }
    function d(c, u) {
      const p = u ? [...l.value, c] : l.value.filter((m) => m !== c);
      t.onChange({ legendValues: p });
    }
    return (c, u) => {
      const p = ot("a-radio-button"), m = ot("a-radio-group"), b = ot("a-checkbox");
      return E(), B("div", Ob, [
        y("div", null, [
          y("div", Db, I(f(n)("config.field.pieType")), 1),
          k(m, {
            size: "small",
            value: e.panel.pieType ?? "pie",
            onChange: u[0] || (u[0] = (v) => e.onChange({ pieType: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "pie" }, {
                default: R(() => [
                  ce(I(f(n)("config.pieType.pie")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "donut" }, {
                default: R(() => [
                  ce(I(f(n)("config.pieType.donut")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Lb, I(f(n)("config.field.pieSliceSorting")), 1),
          k(m, {
            size: "small",
            value: e.panel.pieSliceSorting ?? "desc",
            onChange: u[1] || (u[1] = (v) => e.onChange({ pieSliceSorting: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "desc" }, {
                default: R(() => [
                  ce(I(f(n)("config.sort.desc")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "asc" }, {
                default: R(() => [
                  ce(I(f(n)("config.sort.asc")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "none" }, {
                default: R(() => [
                  ce(I(f(n)("config.sort.none")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", qb, I(f(n)("config.field.pieLabels")), 1),
          y("div", Rb, [
            (E(), B($e, null, Xe(["name", "percent", "value"], (v) => y("label", {
              key: v,
              class: "flex items-center gap-1"
            }, [
              k(b, {
                checked: i.value.includes(v),
                onChange: (C) => s(v, C.target.checked)
              }, null, 8, ["checked", "onChange"]),
              y("span", Nb, I(f(n)(`config.pieLabel.${v}`)), 1)
            ])), 64))
          ])
        ]),
        y("div", null, [
          y("div", Vb, I(f(n)("config.field.pieShow")), 1),
          k(m, {
            size: "small",
            value: e.panel.pieShow ?? "calculate",
            onChange: u[2] || (u[2] = (v) => e.onChange({ pieShow: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "calculate" }, {
                default: R(() => [
                  ce(I(f(n)("config.pieShow.calculate")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "all" }, {
                default: R(() => [
                  ce(I(f(n)("config.pieShow.all")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (e.panel.pieShow ?? "calculate") === "calculate" ? (E(), B("div", Fb, [
          y("div", Bb, I(f(n)("config.field.reducer")), 1),
          k(f(Qe), {
            size: "small",
            value: e.panel.pieCalculation ?? "lastNotNull",
            options: [
              { value: "lastNotNull", label: f(n)("config.reducer.lastNotNull") },
              { value: "last", label: f(n)("config.reducer.last") },
              { value: "mean", label: f(n)("config.reducer.mean") },
              { value: "min", label: f(n)("config.reducer.min") },
              { value: "max", label: f(n)("config.reducer.max") },
              { value: "sum", label: f(n)("config.reducer.sum") }
            ],
            style: { width: "100%" },
            onChange: u[3] || (u[3] = (v) => e.onChange({ pieCalculation: v }))
          }, null, 8, ["value", "options"])
        ])) : ye("", !0),
        y("div", null, [
          y("div", Hb, I(f(n)("config.field.legendMode")), 1),
          k(m, {
            size: "small",
            value: e.panel.legendMode ?? "list",
            onChange: u[4] || (u[4] = (v) => e.onChange({ legendMode: v.target.value }))
          }, {
            default: R(() => [
              k(p, { value: "list" }, {
                default: R(() => [
                  ce(I(f(n)("config.legendMode.list")), 1)
                ]),
                _: 1
              }),
              k(p, { value: "table" }, {
                default: R(() => [
                  ce(I(f(n)("config.legendMode.table")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", Wb, I(f(n)("config.field.legendValues")), 1),
          y("div", jb, [
            (E(), B($e, null, Xe(["min", "max", "mean", "sum", "last"], (v) => y("label", {
              key: v,
              class: "flex items-center gap-1"
            }, [
              k(b, {
                checked: l.value.includes(v),
                onChange: (C) => d(v, C.target.checked)
              }, null, 8, ["checked", "onChange"]),
              y("span", Gb, I(f(n)(`config.legendValue.${v}`)), 1)
            ])), 64))
          ])
        ])
      ]);
    };
  }
}), Ub = { class: "flex flex-col gap-3" }, Kb = { class: "text-xs text-secondary mb-1" }, Xb = { class: "text-xs text-secondary mb-1" }, Qb = { class: "text-xs text-secondary mb-1" }, Jb = { class: "text-xs text-secondary mb-1" }, Zb = /* @__PURE__ */ Me({
  __name: "StatStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = nt();
    return (n, i) => {
      const l = ot("a-switch");
      return E(), B("div", Ub, [
        y("div", null, [
          y("div", Kb, I(f(t)("config.field.orientation")), 1),
          k(f(Qe), {
            size: "small",
            value: e.panel.statOrientation ?? "vertical",
            options: [
              { value: "vertical", label: f(t)("config.orientation.vertical") },
              { value: "horizontal", label: f(t)("config.orientation.horizontal") }
            ],
            style: { width: "100%" },
            onChange: i[0] || (i[0] = (s) => e.onChange({ statOrientation: s }))
          }, null, 8, ["value", "options"])
        ]),
        y("div", null, [
          y("div", Xb, I(f(t)("config.field.textMode")), 1),
          k(f(Qe), {
            size: "small",
            value: e.panel.statTextMode ?? "value_and_name",
            options: [
              { value: "value_and_name", label: f(t)("config.textMode.valueAndName") },
              { value: "value", label: f(t)("config.textMode.value") },
              { value: "name", label: f(t)("config.textMode.name") },
              { value: "none", label: f(t)("config.textMode.none") }
            ],
            style: { width: "100%" },
            onChange: i[1] || (i[1] = (s) => e.onChange({ statTextMode: s }))
          }, null, 8, ["value", "options"])
        ]),
        y("div", null, [
          y("div", Qb, I(f(t)("config.field.colorMode")), 1),
          k(f(Qe), {
            size: "small",
            value: e.panel.statColorMode ?? "value",
            options: [
              { value: "value", label: f(t)("config.colorMode.value") },
              { value: "background_solid", label: f(t)("config.colorMode.backgroundSolid") },
              { value: "background", label: f(t)("config.colorMode.background") }
            ],
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (s) => e.onChange({ statColorMode: s }))
          }, null, 8, ["value", "options"])
        ]),
        y("div", null, [
          y("div", Jb, I(f(t)("config.field.percentChange")), 1),
          k(l, {
            size: "small",
            checked: e.panel.showPercentChange ?? !1,
            onChange: i[3] || (i[3] = (s) => e.onChange({ showPercentChange: s }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), e0 = { class: "flex flex-col gap-3" }, t0 = { key: 0 }, n0 = { class: "text-xs text-secondary mb-1" }, i0 = { key: 1 }, l0 = { class: "text-xs text-secondary mb-1" }, o0 = { key: 2 }, a0 = { class: "text-xs text-secondary mb-1" }, s0 = { key: 3 }, r0 = { class: "text-xs text-secondary mb-1" }, u0 = { class: "text-xs text-secondary mb-1" }, c0 = { class: "text-xs text-secondary mb-1" }, d0 = { class: "text-xs text-secondary mb-1" }, f0 = { class: "flex items-center gap-2" }, h0 = { class: "text-xs text-secondary mb-1" }, g0 = { class: "flex items-center gap-2" }, p0 = { key: 5 }, v0 = { class: "text-xs text-secondary mb-1" }, m0 = { key: 6 }, y0 = { class: "text-xs text-secondary mb-1" }, b0 = { class: "text-xs text-secondary mb-1" }, x0 = { key: 7 }, w0 = { class: "text-xs text-secondary mb-1" }, S0 = /* @__PURE__ */ Me({
  __name: "StyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = nt(), i = t.panel.type === "timeseries", l = t.panel.drawStyle ?? "lines", s = l === "lines", d = l === "points", c = t.panel.showPointsMode ?? "auto", u = t.panel.spanNulls ?? !1, p = t.panel.insertNulls ?? !1;
    return (m, b) => {
      const v = ot("a-radio-button"), C = ot("a-radio-group"), P = ot("a-input-number"), M = ot("a-switch");
      return E(), B("div", e0, [
        i ? (E(), B("div", t0, [
          y("div", n0, I(f(n)("config.field.drawStyle")), 1),
          k(C, {
            size: "small",
            value: e.panel.drawStyle ?? "lines",
            onChange: b[0] || (b[0] = (q) => e.onChange({ drawStyle: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "lines" }, {
                default: R(() => [
                  ce(I(f(n)("config.drawStyle.lines")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "bars" }, {
                default: R(() => [
                  ce(I(f(n)("config.drawStyle.bars")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "points" }, {
                default: R(() => [
                  ce(I(f(n)("config.drawStyle.points")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        d ? ye("", !0) : (E(), B("div", i0, [
          y("div", l0, I(f(n)("config.field.lineWidth")), 1),
          k(f(xn), {
            min: 0.5,
            max: 4,
            step: 0.5,
            value: e.panel.lineWidth,
            onChange: b[1] || (b[1] = (q) => e.onChange({ lineWidth: q }))
          }, null, 8, ["value"])
        ])),
        d ? ye("", !0) : (E(), B("div", o0, [
          y("div", a0, I(f(n)("config.field.fillOpacity")), 1),
          k(f(xn), {
            min: 0,
            max: 100,
            value: e.panel.fillOpacity,
            onChange: b[2] || (b[2] = (q) => e.onChange({ fillOpacity: q }))
          }, null, 8, ["value"])
        ])),
        d ? ye("", !0) : (E(), B("div", s0, [
          y("div", r0, I(f(n)("config.field.gradientMode")), 1),
          k(C, {
            size: "small",
            value: e.panel.gradientMode ?? "none",
            onChange: b[3] || (b[3] = (q) => e.onChange({ gradientMode: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "none" }, {
                default: R(() => [
                  ce(I(f(n)("config.gradient.none")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "opacity" }, {
                default: R(() => [
                  ce(I(f(n)("config.gradient.opacity")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "hue" }, {
                default: R(() => [
                  ce(I(f(n)("config.gradient.hue")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "scheme" }, {
                default: R(() => [
                  ce(I(f(n)("config.gradient.scheme")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])),
        i && s ? (E(), B($e, { key: 4 }, [
          y("div", null, [
            y("div", u0, I(f(n)("config.field.interpolation")), 1),
            k(C, {
              size: "small",
              value: e.panel.lineInterpolation,
              onChange: b[4] || (b[4] = (q) => e.onChange({ lineInterpolation: q.target.value }))
            }, {
              default: R(() => [
                k(v, { value: "linear" }, {
                  default: R(() => [
                    ce(I(f(n)("config.interp.linear")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "smooth" }, {
                  default: R(() => [
                    ce(I(f(n)("config.interp.smooth")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "step" }, {
                  default: R(() => [
                    ce(I(f(n)("config.interp.step")), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["value"])
          ]),
          y("div", null, [
            y("div", c0, I(f(n)("config.field.lineStyle")), 1),
            k(C, {
              size: "small",
              value: e.panel.lineStyle,
              onChange: b[5] || (b[5] = (q) => e.onChange({ lineStyle: q.target.value }))
            }, {
              default: R(() => [
                k(v, { value: "solid" }, {
                  default: R(() => [
                    ce(I(f(n)("config.linestyle.solid")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "dashed" }, {
                  default: R(() => [
                    ce(I(f(n)("config.linestyle.dashed")), 1)
                  ]),
                  _: 1
                }),
                k(v, { value: "dotted" }, {
                  default: R(() => [
                    ce(I(f(n)("config.linestyle.dotted")), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["value"])
          ]),
          y("div", null, [
            y("div", d0, I(f(n)("config.field.spanNulls")), 1),
            y("div", f0, [
              k(C, {
                size: "small",
                value: f(u) === !0 ? "always" : typeof f(u) == "number" ? "threshold" : "never",
                onChange: b[6] || (b[6] = (q) => {
                  q.target.value === "never" ? e.onChange({ spanNulls: !1 }) : q.target.value === "always" ? e.onChange({ spanNulls: !0 }) : e.onChange({ spanNulls: 3600 });
                })
              }, {
                default: R(() => [
                  k(v, { value: "never" }, {
                    default: R(() => [
                      ce(I(f(n)("config.nulls.never")), 1)
                    ]),
                    _: 1
                  }),
                  k(v, { value: "always" }, {
                    default: R(() => [
                      ce(I(f(n)("config.nulls.always")), 1)
                    ]),
                    _: 1
                  }),
                  k(v, { value: "threshold" }, {
                    default: R(() => [
                      ce(I(f(n)("config.nulls.threshold")), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["value"]),
              typeof f(u) == "number" ? (E(), Ce(P, {
                key: 0,
                size: "small",
                min: 1,
                value: f(u),
                suffix: "s",
                style: { width: "90px" },
                onChange: b[7] || (b[7] = (q) => e.onChange({ spanNulls: q ?? 3600 }))
              }, null, 8, ["value"])) : ye("", !0)
            ])
          ]),
          y("div", null, [
            y("div", h0, I(f(n)("config.field.insertNulls")), 1),
            y("div", g0, [
              k(C, {
                size: "small",
                value: typeof f(p) == "number" ? "threshold" : "never",
                onChange: b[8] || (b[8] = (q) => {
                  q.target.value === "never" ? e.onChange({ insertNulls: !1 }) : e.onChange({ insertNulls: 3600 });
                })
              }, {
                default: R(() => [
                  k(v, { value: "never" }, {
                    default: R(() => [
                      ce(I(f(n)("config.nulls.never")), 1)
                    ]),
                    _: 1
                  }),
                  k(v, { value: "threshold" }, {
                    default: R(() => [
                      ce(I(f(n)("config.nulls.threshold")), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["value"]),
              typeof f(p) == "number" ? (E(), Ce(P, {
                key: 0,
                size: "small",
                min: 1,
                value: f(p),
                suffix: "s",
                style: { width: "90px" },
                onChange: b[9] || (b[9] = (q) => e.onChange({ insertNulls: q ?? 3600 }))
              }, null, 8, ["value"])) : ye("", !0)
            ])
          ])
        ], 64)) : ye("", !0),
        i && !d ? (E(), B("div", p0, [
          y("div", v0, I(f(n)("config.field.showPoints")), 1),
          k(C, {
            size: "small",
            value: f(c),
            onChange: b[10] || (b[10] = (q) => e.onChange({ showPointsMode: q.target.value, showPoints: q.target.value === "always" }))
          }, {
            default: R(() => [
              k(v, { value: "auto" }, {
                default: R(() => [
                  ce(I(f(n)("config.points.auto")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "always" }, {
                default: R(() => [
                  ce(I(f(n)("config.points.always")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "never" }, {
                default: R(() => [
                  ce(I(f(n)("config.points.never")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        i ? (E(), B("div", m0, [
          y("div", y0, I(f(n)("config.field.stackSeries")), 1),
          k(C, {
            size: "small",
            value: e.panel.stackingMode ?? "none",
            onChange: b[11] || (b[11] = (q) => e.onChange({ stackingMode: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "none" }, {
                default: R(() => [
                  ce(I(f(n)("config.stack.none")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "normal" }, {
                default: R(() => [
                  ce(I(f(n)("config.stack.normal")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "percent" }, {
                default: R(() => [
                  ce(I(f(n)("config.stack.percent")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        y("div", null, [
          y("div", b0, I(f(n)("config.field.legendPosition")), 1),
          k(C, {
            size: "small",
            value: e.panel.legendPosition,
            onChange: b[12] || (b[12] = (q) => e.onChange({ legendPosition: q.target.value }))
          }, {
            default: R(() => [
              k(v, { value: "bottom" }, {
                default: R(() => [
                  ce(I(f(n)("config.legend.bottom")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "right" }, {
                default: R(() => [
                  ce(I(f(n)("config.legend.right")), 1)
                ]),
                _: 1
              }),
              k(v, { value: "hidden" }, {
                default: R(() => [
                  ce(I(f(n)("config.legend.hidden")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        e.panel.type === "bar" ? (E(), B("div", x0, [
          y("div", w0, I(f(n)("config.field.stacked")), 1),
          k(M, {
            size: "small",
            checked: e.panel.stacked,
            onChange: b[13] || (b[13] = (q) => e.onChange({ stacked: q }))
          }, null, 8, ["checked"])
        ])) : ye("", !0)
      ]);
    };
  }
}), k0 = { class: "flex flex-col gap-3" }, C0 = { class: "text-xs text-secondary mb-1" }, _0 = { class: "text-xs text-secondary mb-1" }, M0 = { class: "text-xs text-secondary mb-1" }, z0 = { class: "text-xs text-secondary mb-1" }, T0 = { class: "text-xs text-secondary mb-1" }, P0 = { class: "text-xs text-secondary mb-1" }, $0 = { key: 0 }, E0 = { class: "text-xs text-secondary mb-1" }, I0 = { class: "text-xs text-secondary mb-1" }, A0 = { key: 1 }, O0 = { class: "text-xs text-secondary mb-1" }, D0 = { key: 2 }, L0 = { class: "text-xs text-secondary mb-1" }, q0 = /* @__PURE__ */ Me({
  __name: "TableStyleSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = nt();
    function i(l) {
      t.onChange({ tableFooterReducers: l ? [l] : [] });
    }
    return (l, s) => {
      const d = ot("a-switch"), c = ot("a-radio-button"), u = ot("a-radio-group");
      return E(), B("div", k0, [
        y("div", null, [
          y("div", C0, I(f(n)("config.field.tableShowHeader")), 1),
          k(d, {
            size: "small",
            checked: e.panel.tableShowHeader ?? !0,
            onChange: s[0] || (s[0] = (p) => e.onChange({ tableShowHeader: p }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", _0, I(f(n)("config.field.tableCellHeight")), 1),
          k(u, {
            size: "small",
            value: e.panel.tableCellHeight ?? "medium",
            onChange: s[1] || (s[1] = (p) => e.onChange({ tableCellHeight: p.target.value }))
          }, {
            default: R(() => [
              k(c, { value: "small" }, {
                default: R(() => [
                  ce(I(f(n)("config.tableHeight.small")), 1)
                ]),
                _: 1
              }),
              k(c, { value: "medium" }, {
                default: R(() => [
                  ce(I(f(n)("config.tableHeight.medium")), 1)
                ]),
                _: 1
              }),
              k(c, { value: "large" }, {
                default: R(() => [
                  ce(I(f(n)("config.tableHeight.large")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        y("div", null, [
          y("div", M0, I(f(n)("config.field.tableFrozenColumns")), 1),
          k(f(on), {
            size: "small",
            min: 0,
            max: 10,
            value: e.panel.tableFrozenColumns ?? 0,
            style: { width: "100%" },
            onChange: s[2] || (s[2] = (p) => e.onChange({ tableFrozenColumns: p ?? 0 }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", z0, I(f(n)("config.field.tableColumnFilter")), 1),
          k(d, {
            size: "small",
            checked: e.panel.tableColumnFilter ?? !1,
            onChange: s[3] || (s[3] = (p) => e.onChange({ tableColumnFilter: p }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", T0, I(f(n)("config.field.tableWrapText")), 1),
          k(d, {
            size: "small",
            checked: e.panel.tableWrapText ?? !1,
            onChange: s[4] || (s[4] = (p) => e.onChange({ tableWrapText: p }))
          }, null, 8, ["checked"])
        ]),
        y("div", null, [
          y("div", P0, I(f(n)("config.field.tableEnablePagination")), 1),
          k(d, {
            size: "small",
            checked: e.panel.tableEnablePagination ?? !1,
            onChange: s[5] || (s[5] = (p) => e.onChange({ tableEnablePagination: p }))
          }, null, 8, ["checked"])
        ]),
        e.panel.tableEnablePagination ? (E(), B("div", $0, [
          y("div", E0, I(f(n)("config.field.tablePageSize")), 1),
          k(f(on), {
            size: "small",
            min: 5,
            max: 500,
            value: e.panel.tablePageSize ?? 20,
            style: { width: "100%" },
            onChange: s[6] || (s[6] = (p) => e.onChange({ tablePageSize: p ?? 20 }))
          }, null, 8, ["value"])
        ])) : ye("", !0),
        y("div", null, [
          y("div", I0, I(f(n)("config.field.tableFooterEnabled")), 1),
          k(d, {
            size: "small",
            checked: e.panel.tableFooterEnabled ?? !1,
            onChange: s[7] || (s[7] = (p) => e.onChange({ tableFooterEnabled: p }))
          }, null, 8, ["checked"])
        ]),
        e.panel.tableFooterEnabled ? (E(), B("div", A0, [
          y("div", O0, I(f(n)("config.field.tableFooterReducers")), 1),
          k(f(Qe), {
            size: "small",
            value: e.panel.tableFooterReducers?.[0],
            options: [
              { value: "min", label: f(n)("config.reducer.min") },
              { value: "max", label: f(n)("config.reducer.max") },
              { value: "mean", label: f(n)("config.reducer.mean") },
              { value: "sum", label: f(n)("config.reducer.sum") },
              { value: "count", label: f(n)("config.reducer.count") }
            ],
            "allow-clear": "",
            style: { width: "100%" },
            onChange: s[8] || (s[8] = (p) => i(p))
          }, null, 8, ["value", "options"])
        ])) : ye("", !0),
        e.panel.tableFooterEnabled && e.panel.tableFooterReducers?.[0] ? (E(), B("div", D0, [
          y("div", L0, I(f(n)("config.field.tableFooterFields")), 1),
          k(f(Qe), {
            size: "small",
            mode: "multiple",
            "allow-clear": "",
            placeholder: f(n)("config.field.tableFooterFieldsPlaceholder"),
            value: e.panel.tableFooterFields ?? [],
            options: (e.numericFieldNames ?? []).map((p) => ({ value: p, label: p })),
            style: { width: "100%" },
            onChange: s[9] || (s[9] = (p) => e.onChange({ tableFooterFields: p.length > 0 ? p : void 0 }))
          }, null, 8, ["placeholder", "value", "options"])
        ])) : ye("", !0)
      ]);
    };
  }
}), R0 = { class: "flex flex-col gap-1" }, N0 = { class: "mb-2" }, V0 = { class: "text-xs text-secondary mb-1" }, F0 = ["value", "onInput"], B0 = { class: "flex items-center gap-1.5 mb-1" }, H0 = ["value"], W0 = { class: "text-xs text-secondary flex-1" }, j0 = /* @__PURE__ */ Me({
  __name: "ThresholdsEditor",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = nt(), i = ["#52c41a", "#faad14", "#ff4d4f", "#1677ff", "#722ed1", "#13c2c2", "#fa8c16"], l = fe(t.panel.thresholdMode ?? "absolute"), s = re(() => l.value === "percentage"), d = re(() => [...t.panel.thresholds].sort((v, C) => C.value - v.value));
    function c() {
      const v = [t.panel.thresholdBaseColor, ...t.panel.thresholds.map((C) => C.color)];
      return i.find((C) => !v.includes(C)) ?? "#cccccc";
    }
    function u() {
      const v = t.panel.thresholds.length > 0 ? Math.max(...t.panel.thresholds.map((q) => q.value)) : 0, P = { value: s.value ? Math.min(100, v + 20) : v + 10, color: c(), label: "" }, M = [...t.panel.thresholds, P].sort((q, Q) => q.value - Q.value);
      t.onChange({ thresholds: M });
    }
    function p(v) {
      t.onChange({ thresholds: t.panel.thresholds.filter((C) => C.value !== v) });
    }
    function m(v, C) {
      const P = t.panel.thresholds.map((M) => M.value === v ? { ...M, ...C } : M).sort((M, q) => M.value - q.value);
      t.onChange({ thresholds: P });
    }
    function b(v) {
      l.value = v, t.onChange({ thresholdMode: v });
    }
    return (v, C) => {
      const P = ot("a-input");
      return E(), B("div", R0, [
        y("div", N0, [
          y("div", V0, I(f(n)("config.threshold.mode")), 1),
          k(f(ns).Group, {
            size: "small",
            value: l.value,
            onChange: C[0] || (C[0] = (M) => b(M.target.value))
          }, {
            default: R(() => [
              k(f(ns).Button, { value: "absolute" }, {
                default: R(() => [
                  ce(I(f(n)("config.threshold.modeAbsolute")), 1)
                ]),
                _: 1
              }),
              k(f(ns).Button, { value: "percentage" }, {
                default: R(() => [
                  ce(I(f(n)("config.threshold.modePercentage")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (E(!0), B($e, null, Xe(d.value, (M) => (E(), B("div", {
          key: M.value,
          class: "flex items-center gap-1.5 mb-1"
        }, [
          y("input", {
            type: "color",
            class: "w-7 h-7 border border-gray-300 rounded cursor-pointer",
            value: M.color,
            onInput: (q) => m(M.value, { color: q.target.value })
          }, null, 40, F0),
          k(f(on), {
            size: "small",
            value: M.value,
            min: s.value ? 0 : void 0,
            max: s.value ? 100 : void 0,
            style: { width: "80px" },
            onChange: (q) => m(M.value, { value: q ?? 0 })
          }, null, 8, ["value", "min", "max", "onChange"]),
          k(P, {
            size: "small",
            value: M.label,
            placeholder: "Label",
            style: { flex: "1" },
            onChange: (q) => m(M.value, { label: q.target.value })
          }, null, 8, ["value", "onChange"]),
          k(f(tt), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (q) => p(M.value)
          }, {
            default: R(() => [
              y("span", {
                class: Ae(f(ze).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]))), 128)),
        y("div", B0, [
          y("input", {
            type: "color",
            class: "w-7 h-7 border border-gray-300 rounded cursor-pointer",
            value: e.panel.thresholdBaseColor,
            onInput: C[1] || (C[1] = (M) => e.onChange({ thresholdBaseColor: M.target.value }))
          }, null, 40, H0),
          y("span", W0, I(f(n)("config.threshold.base")), 1)
        ]),
        k(f(tt), {
          type: "dashed",
          size: "small",
          block: "",
          onClick: u
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).plus, "mr-1"])
            }, null, 2),
            ce(" " + I(f(n)("config.threshold.add")), 1)
          ]),
          _: 1
        })
      ]);
    };
  }
}), G0 = { class: "flex flex-col gap-3" }, Y0 = { class: "text-xs text-secondary mb-1" }, U0 = { key: 0 }, K0 = { class: "text-xs text-secondary mb-1" }, X0 = { key: 1 }, Q0 = { class: "text-xs text-secondary mb-1" }, J0 = { class: "text-xs text-secondary mb-1" }, Z0 = /* @__PURE__ */ Me({
  __name: "TooltipSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const { t } = nt();
    return (n, i) => {
      const l = ot("a-radio-button"), s = ot("a-radio-group"), d = ot("a-switch");
      return E(), B("div", G0, [
        y("div", null, [
          y("div", Y0, I(f(t)("config.field.tooltipMode")), 1),
          k(s, {
            size: "small",
            value: e.panel.tooltipMode ?? "multi",
            onChange: i[0] || (i[0] = (c) => e.onChange({ tooltipMode: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "single" }, {
                default: R(() => [
                  ce(I(f(t)("config.tooltip.single")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "multi" }, {
                default: R(() => [
                  ce(I(f(t)("config.tooltip.multi")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "none" }, {
                default: R(() => [
                  ce(I(f(t)("config.tooltip.none")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ]),
        (e.panel.tooltipMode ?? "multi") === "multi" ? (E(), B("div", U0, [
          y("div", K0, I(f(t)("config.field.tooltipSort")), 1),
          k(s, {
            size: "small",
            value: e.panel.tooltipSort ?? "none",
            onChange: i[1] || (i[1] = (c) => e.onChange({ tooltipSort: c.target.value }))
          }, {
            default: R(() => [
              k(l, { value: "none" }, {
                default: R(() => [
                  ce(I(f(t)("config.tooltip.sortNone")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "asc" }, {
                default: R(() => [
                  ce(I(f(t)("config.tooltip.sortAsc")), 1)
                ]),
                _: 1
              }),
              k(l, { value: "desc" }, {
                default: R(() => [
                  ce(I(f(t)("config.tooltip.sortDesc")), 1)
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["value"])
        ])) : ye("", !0),
        (e.panel.tooltipMode ?? "multi") === "multi" ? (E(), B("div", X0, [
          y("div", Q0, I(f(t)("config.field.tooltipMaxHeight")), 1),
          k(f(on), {
            size: "small",
            min: 50,
            max: 800,
            value: e.panel.tooltipMaxHeight ?? 600,
            suffix: "px",
            style: { width: "100%" },
            onChange: i[2] || (i[2] = (c) => e.onChange({ tooltipMaxHeight: c ?? 600 }))
          }, null, 8, ["value"])
        ])) : ye("", !0),
        y("div", null, [
          y("div", J0, I(f(t)("config.field.axisPointer")), 1),
          k(d, {
            size: "small",
            checked: e.panel.showAxisPointer ?? !0,
            onChange: i[3] || (i[3] = (c) => e.onChange({ showAxisPointer: c }))
          }, null, 8, ["checked"])
        ])
      ]);
    };
  }
}), e1 = { class: "flex items-center gap-2" }, t1 = /* @__PURE__ */ Me({
  __name: "SliderInput",
  props: {
    value: {},
    min: {},
    max: {},
    step: { default: 1 },
    shiftMultiplier: { default: 10 },
    unit: {},
    placeholder: {},
    allowClear: { type: Boolean, default: !1 }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: l } = nt();
    function s(C) {
      return Math.min(n.max, Math.max(n.min, C));
    }
    const d = re(() => n.value ?? n.min), c = re(() => n.placeholder ?? l("common.auto")), u = re(() => {
      const C = n.value !== void 0 ? n.unit ? `${n.value}${n.unit}` : String(n.value) : c.value;
      try {
        const P = document.createElement("canvas").getContext("2d");
        return P ? (P.font = "14px system-ui, -apple-system, sans-serif", `${Math.ceil(P.measureText(C).width) + 24}px`) : "6ch";
      } catch {
        return "6ch";
      }
    });
    function p(C) {
      typeof C == "number" && i("change", s(C));
    }
    function m(C) {
      C != null && i("change", s(Number(C)));
    }
    function b() {
      i("change", void 0);
    }
    function v(C) {
      const P = C.shiftKey, M = n.step * (P ? n.shiftMultiplier : 1);
      C.key === "ArrowRight" || C.key === "ArrowUp" ? (C.preventDefault(), i("change", s(d.value + M))) : (C.key === "ArrowLeft" || C.key === "ArrowDown") && (C.preventDefault(), i("change", s(d.value - M)));
    }
    return (C, P) => (E(), B("div", e1, [
      k(f(xn), {
        min: e.min,
        max: e.max,
        step: e.step,
        value: d.value,
        style: { flex: "1" },
        "tooltip-formatter": e.unit ? ((M) => `${M}${e.unit}`) : void 0,
        onChange: p
      }, null, 8, ["min", "max", "step", "value", "tooltip-formatter"]),
      k(f(jl).Compact, { size: "small" }, {
        default: R(() => [
          k(f(on), {
            size: "small",
            controls: !1,
            min: e.min,
            max: e.max,
            step: e.step,
            value: e.value ?? void 0,
            placeholder: c.value,
            style: He({ width: u.value }),
            suffix: e.unit && e.value !== void 0 ? e.unit : void 0,
            onKeydown: v,
            onChange: m
          }, null, 8, ["min", "max", "step", "value", "placeholder", "style", "suffix"]),
          e.allowClear && e.value !== void 0 ? (E(), Ce(f(tt), {
            key: 0,
            onClick: b
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).closeCircle, "text-xs text-gray-400 cursor-pointer"])
              }, null, 2)
            ]),
            _: 1
          })) : ye("", !0)
        ]),
        _: 1
      })
    ]));
  }
}), n1 = { class: "flex flex-col gap-3" }, i1 = { key: 0 }, l1 = { class: "text-xs text-secondary mb-1" }, o1 = { class: "text-xs text-secondary mb-1" }, a1 = { class: "text-xs text-secondary mb-1" }, s1 = { key: 1 }, r1 = { class: "text-xs text-secondary mb-1" }, u1 = { key: 2 }, c1 = { class: "text-xs text-secondary mb-1" }, d1 = /* @__PURE__ */ Me({
  __name: "ValueSection",
  props: {
    panel: {},
    onChange: { type: Function },
    numericFieldNames: {},
    allFieldNames: {}
  },
  setup(e) {
    const t = e, { t: n } = nt(), l = ["", "ms", "s", "bytes", "percent", "percentunit", "reqps", "ops", "bps", "Bps"].map((u) => ({
      value: u,
      label: n(u ? `config.unit.${u}` : "config.unit.none")
    })), s = [
      { value: "lastNotNull", label: n("config.reducer.lastNotNull") },
      { value: "last", label: n("config.reducer.last") },
      { value: "firstNotNull", label: n("config.reducer.firstNotNull") },
      { value: "first", label: n("config.reducer.first") },
      { value: "mean", label: n("config.reducer.mean") },
      { value: "min", label: n("config.reducer.min") },
      { value: "max", label: n("config.reducer.max") },
      { value: "sum", label: n("config.reducer.sum") },
      { value: "count", label: n("config.reducer.count") }
    ], d = t.panel.type === "gauge", c = t.panel.type !== "timeseries";
    return (u, p) => (E(), B("div", n1, [
      c ? (E(), B("div", i1, [
        y("div", l1, I(f(n)("config.field.reducer")), 1),
        k(f(Qe), {
          size: "small",
          value: e.panel.statReducer ?? "lastNotNull",
          options: s,
          style: { width: "100%" },
          onChange: p[0] || (p[0] = (m) => e.onChange({ statReducer: m }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      y("div", null, [
        y("div", o1, I(f(n)("config.field.unit")), 1),
        k(f(Qe), {
          size: "small",
          value: e.panel.unit || "",
          options: f(l),
          style: { width: "100%" },
          onChange: p[1] || (p[1] = (m) => e.onChange({ unit: m }))
        }, null, 8, ["value", "options"])
      ]),
      y("div", null, [
        y("div", a1, I(f(n)("config.field.decimals")), 1),
        k(t1, {
          min: 0,
          max: 15,
          step: 1,
          value: e.panel.decimals,
          "allow-clear": !0,
          onChange: p[2] || (p[2] = (m) => e.onChange({ decimals: m }))
        }, null, 8, ["value"])
      ]),
      d ? (E(), B("div", s1, [
        y("div", r1, I(f(n)("config.field.min")), 1),
        k(f(on), {
          size: "small",
          value: e.panel.min,
          style: { width: "100%" },
          onChange: p[3] || (p[3] = (m) => e.onChange({ min: m ?? 0 }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      d ? (E(), B("div", u1, [
        y("div", c1, I(f(n)("config.field.max")), 1),
        k(f(on), {
          size: "small",
          value: e.panel.max,
          style: { width: "100%" },
          onChange: p[4] || (p[4] = (m) => e.onChange({ max: m ?? 100 }))
        }, null, 8, ["value"])
      ])) : ye("", !0)
    ]));
  }
}), f1 = { class: "h-full flex flex-col overflow-hidden" }, h1 = {
  class: "flex-shrink-0 px-2 bg-primary/10 py-1",
  style: { "border-bottom": "1px solid #eee" }
}, g1 = { class: "flex-1 overflow-y-auto" }, p1 = /* @__PURE__ */ Me({
  __name: "OptionsPane",
  setup(e) {
    const t = [
      "timeseries",
      "bar",
      "histogram",
      "stat",
      "gauge",
      "table",
      "pie"
    ], { t: n } = nt(), { panel: i, onChange: l, numericFieldNames: s, allFieldNames: d } = ao(), c = re(
      () => t.map((C) => ({
        value: C,
        label: n(`config.type.${C}`)
      }))
    ), u = fe(""), p = {
      general: Qu,
      style: S0,
      tooltip: Z0,
      axes: Py,
      value: d1,
      // timeseries / bar / histogram
      "bar-style": Ry,
      "histogram-style": Pb,
      // stat
      "stat-style": Zb,
      // gauge
      "gauge-style": lb,
      // pie
      "pie-style": Yb,
      // table
      "table-style": q0,
      // overrides
      overrides: Ju
    }, m = re(() => {
      const P = (jf(i.value.type)?.optionCategories ?? []).map((M) => ({
        key: M.key,
        label: n(M.labelKey),
        component: p[M.key] ?? Qu
      }));
      return P.push({
        key: "thresholds",
        label: n("config.section.thresholds", { n: i.value.thresholds.length }),
        component: j0
      }), P.push({
        key: "overrides",
        label: n("config.section.overrides"),
        component: Ju
      }), P;
    }), b = re(() => {
      if (!u.value.trim())
        return m.value;
      const C = u.value.toLowerCase();
      return m.value.filter(
        (P) => typeof P.label == "string" && P.label.toLowerCase().includes(C)
      );
    }), v = fe(["general"]);
    return (C, P) => (E(), B("div", f1, [
      y("div", h1, [
        k(f(Qe), {
          class: "text-primary",
          bordered: !1,
          value: f(i).type,
          size: "small",
          variant: "filled",
          options: c.value,
          "onUpdate:value": P[0] || (P[0] = (M) => f(l)({ type: M }))
        }, null, 8, ["value", "options"])
      ]),
      y("div", g1, [
        k(f(Ca), {
          "active-key": v.value,
          "onUpdate:activeKey": P[1] || (P[1] = (M) => v.value = M),
          bordered: !1,
          accordion: "",
          size: "small"
        }, {
          default: R(() => [
            (E(!0), B($e, null, Xe(b.value, (M) => (E(), Ce(f(Ca).Panel, {
              key: M.key,
              header: M.label
            }, {
              default: R(() => [
                (E(), Ce(rc(M.component), {
                  panel: f(i),
                  "on-change": f(l),
                  "numeric-field-names": f(s),
                  "all-field-names": f(d)
                }, null, 40, ["panel", "on-change", "numeric-field-names", "all-field-names"]))
              ]),
              _: 2
            }, 1032, ["header"]))), 128))
          ]),
          _: 1
        }, 8, ["active-key"])
      ])
    ]));
  }
}), Ad = /* @__PURE__ */ Me({
  __name: "PanelLinksIcon",
  props: {
    links: {},
    iconColor: {}
  },
  setup(e) {
    const t = e;
    function n(l) {
      l.url && window.open(l.url, l.newTab ? "_blank" : "_self", "noopener,noreferrer");
    }
    const i = re(() => t.links.filter((l) => l.url));
    return (l, s) => i.value.length === 0 ? (E(), B($e, { key: 0 }, [], 64)) : i.value.length === 1 ? (E(), Ce(f($n), {
      key: 1,
      title: i.value[0].title || i.value[0].url,
      placement: "bottom"
    }, {
      default: R(() => [
        y("span", {
          class: Ae([f(ze).link, "flex-shrink-0 cursor-pointer text-xs"]),
          style: He({ color: e.iconColor }),
          onClick: s[0] || (s[0] = En((d) => n(i.value[0]), ["stop"]))
        }, null, 6)
      ]),
      _: 1
    }, 8, ["title"])) : (E(), Ce(f(Vo), {
      key: 2,
      trigger: ["hover", "click"],
      placement: "bottomLeft"
    }, {
      overlay: R(() => [
        k(f(li), null, {
          default: R(() => [
            (E(!0), B($e, null, Xe(i.value, (d, c) => (E(), Ce(f(li).Item, {
              key: c,
              onClick: (u) => n(d)
            }, {
              default: R(() => [
                ce(I(d.title || d.url), 1)
              ]),
              _: 2
            }, 1032, ["onClick"]))), 128))
          ]),
          _: 1
        })
      ]),
      default: R(() => [
        y("span", {
          class: Ae([f(ze).link, "flex-shrink-0 cursor-pointer text-xs"]),
          style: He({ color: e.iconColor }),
          onClick: s[1] || (s[1] = En(() => {
          }, ["stop"]))
        }, null, 6)
      ]),
      _: 1
    }));
  }
}), v1 = {
  key: 0,
  class: "legend-search-container"
}, m1 = ["value"], y1 = { class: "legend-table-wrap" }, b1 = { class: "legend-table" }, x1 = ["data-legend-item-id"], w1 = { class: "legend-table-td legend-table-name-col" }, S1 = ["data-legend-tooltip"], k1 = { class: "legend-label" }, C1 = {
  key: 0,
  class: "legend-search-container"
}, _1 = ["value"], M1 = {
  key: 1,
  class: "legend-empty-state"
}, z1 = { class: "virtuoso-grid-list" }, T1 = ["data-legend-item-id"], P1 = ["data-legend-tooltip"], $1 = { class: "legend-label" }, E1 = {
  key: 0,
  class: "legend-item-values"
}, I1 = { class: "legend-item-value-key" }, A1 = { class: "legend-item-value-num" }, O1 = ["data-legend-tooltip", "onClick"], D1 = {
  key: 0,
  width: "12",
  height: "12",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2"
}, L1 = {
  key: 1,
  width: "12",
  height: "12",
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  "stroke-width": "2"
}, q1 = /* @__PURE__ */ Me({
  __name: "ChartLegend",
  props: {
    items: {},
    uPlotInstance: {},
    position: { default: "bottom" },
    mode: { default: "list" },
    unit: {},
    decimals: {},
    averageLegendWidth: { default: 40 },
    values: { default: () => [] },
    data: {}
  },
  setup(e) {
    const t = e, n = fe(null), i = fe(""), l = fe(null), s = fe(!1), d = fe(), c = fe({});
    function u(J) {
      const K = {};
      J.series.forEach((O, Z) => {
        Z !== 0 && (K[Z] = O.show ?? !0);
      }), c.value = { ...K };
    }
    function p(J, K, O) {
      !K || typeof O.show != "boolean" || (c.value = { ...c.value, [K]: O.show });
    }
    Fe(
      () => t.uPlotInstance,
      (J, K) => {
        if (K && (K.hooks.setSeries = (K.hooks.setSeries ?? []).filter(
          (O) => O.__legendSync !== !0
        )), J) {
          u(J);
          const O = (Z, U, $) => p(Z, U, $);
          O.__legendSync = !0, J.hooks.setSeries = [...J.hooks.setSeries ?? [], O];
        } else
          c.value = {};
      },
      { immediate: !0 }
    );
    const m = {
      last: "Last *",
      first: "First *",
      min: "Min",
      max: "Max",
      mean: "Avg",
      sum: "Sum"
    };
    function b(J) {
      const K = J.filter(
        (Z) => Z != null && !Number.isNaN(Z)
      );
      if (K.length === 0)
        return { last: null, first: null, min: null, max: null, mean: null, sum: null };
      const O = K.reduce((Z, U) => Z + U, 0);
      return {
        last: K[K.length - 1],
        first: K[0],
        min: Math.min(...K),
        max: Math.max(...K),
        mean: O / K.length,
        sum: O
      };
    }
    function v(J, K) {
      return J === null ? "—" : Math.abs(J) >= 1e6 ? K !== void 0 ? `${(J / 1e6).toFixed(K)}M` : `${J / 1e6}M` : Math.abs(J) >= 1e3 ? K !== void 0 ? `${(J / 1e3).toFixed(K)}K` : `${J / 1e3}K` : K !== void 0 ? J.toFixed(K) : String(J);
    }
    const C = re(
      () => Object.values(t.items).map((J) => ({
        ...J,
        show: c.value[J.seriesIndex] ?? J.show ?? !0
      }))
    ), P = re(() => {
      if (t.position !== "right" || !i.value.trim())
        return C.value;
      const J = i.value.trim().toLowerCase();
      return C.value.filter((K) => K.label?.toLowerCase().includes(J));
    }), M = re(() => t.position !== "right" || !i.value.trim() ? !1 : P.value.length === 0), q = re(() => {
      if (!t.data || t.values.length === 0)
        return {};
      const J = {};
      return C.value.forEach((K) => {
        const O = t.data[K.seriesIndex];
        J[K.seriesIndex] = b(O ?? []);
      }), J;
    }), { onToggleSeriesOnOff: Q, onToggleSeriesVisibility: V } = {
      onToggleSeriesOnOff(J) {
        const K = t.uPlotInstance;
        if (!K)
          return;
        const O = K.series[J];
        O && K.setSeries(J, { show: !O.show });
      },
      onToggleSeriesVisibility(J) {
        const K = t.uPlotInstance;
        if (!K)
          return;
        const O = n.value === J;
        K.series.forEach((Z, U) => {
          U !== 0 && K.setSeries(U, { show: O || U === J });
        }), n.value = O ? null : J;
      }
    };
    function Y(J) {
      const K = J.target.closest("[data-legend-item-id]");
      if (!K)
        return null;
      const O = Number(K.dataset.legendItemId);
      return Number.isNaN(O) ? null : O;
    }
    function A(J) {
      const K = Y(J);
      if (K === null)
        return;
      if (!!J.target.dataset.isLegendMarker) {
        Q(K);
        return;
      }
      V(K);
    }
    async function H(J, K) {
      try {
        await navigator.clipboard.writeText(K), l.value = J, setTimeout(() => {
          l.value = null;
        }, 2e3);
      } catch {
      }
    }
    function ee(J) {
      const K = J.target;
      i.value = K.value;
    }
    function z() {
      if (!d.value || t.position !== "bottom") {
        s.value = !1;
        return;
      }
      const K = d.value.clientWidth;
      if (K === 0)
        return;
      const O = C.value.length * (t.averageLegendWidth + 16);
      s.value = Math.ceil(O / K) <= 1;
    }
    let j = null;
    return An(() => {
      z(), d.value && t.position === "bottom" && (j = new ResizeObserver(z), j.observe(d.value));
    }), Xi(() => {
      j && j.disconnect();
    }), Fe([() => t.averageLegendWidth, () => C.value.length, () => t.position], () => {
      z();
    }), (J, K) => e.mode === "table" && e.values.length > 0 ? (E(), B("div", {
      key: 0,
      ref_key: "legendContainerRef",
      ref: d,
      class: "legend-container legend-table-mode",
      onClick: A
    }, [
      e.position === "right" ? (E(), B("div", v1, [
        y("input", {
          type: "text",
          placeholder: "Search...",
          value: i.value,
          class: "legend-search-input",
          onInput: ee
        }, null, 40, m1)
      ])) : ye("", !0),
      y("div", y1, [
        y("table", b1, [
          y("thead", null, [
            y("tr", null, [
              K[0] || (K[0] = y("th", { class: "legend-table-th legend-table-name-col" }, " Name ", -1)),
              (E(!0), B($e, null, Xe(e.values, (O) => (E(), B("th", {
                key: O,
                class: "legend-table-th legend-table-val-col"
              }, I(m[O]), 1))), 128))
            ])
          ]),
          y("tbody", null, [
            (E(!0), B($e, null, Xe(P.value, (O) => (E(), B("tr", {
              key: O.seriesIndex,
              "data-legend-item-id": O.seriesIndex,
              class: Ae(["legend-table-row", [
                O.show ? "" : "legend-item-off",
                n.value === O.seriesIndex ? "legend-item-focused" : ""
              ]])
            }, [
              y("td", w1, [
                y("div", {
                  class: "legend-item-label-trigger",
                  "data-legend-tooltip": O.label
                }, [
                  y("div", {
                    class: "legend-marker",
                    style: He({ borderColor: O.color }),
                    "data-is-legend-marker": !0
                  }, null, 4),
                  y("span", k1, I(O.label), 1)
                ], 8, S1)
              ]),
              (E(!0), B($e, null, Xe(e.values, (Z) => (E(), B("td", {
                key: Z,
                class: "legend-table-td legend-table-val-col"
              }, I(q.value[O.seriesIndex] ? v(q.value[O.seriesIndex][Z], e.decimals) : "—"), 1))), 128))
            ], 10, x1))), 128))
          ])
        ])
      ])
    ], 512)) : (E(), B("div", {
      key: 1,
      ref_key: "legendContainerRef",
      ref: d,
      class: Ae(["legend-container", [e.position === "bottom" ? "legend-container-bottom" : ""]]),
      style: He({ "--legend-average-width": `${e.averageLegendWidth + 16}px` }),
      onClick: A
    }, [
      e.position === "right" ? (E(), B("div", C1, [
        y("input", {
          type: "text",
          placeholder: "Search...",
          value: i.value,
          class: "legend-search-input",
          onInput: ee
        }, null, 40, _1)
      ])) : ye("", !0),
      M.value ? (E(), B("div", M1, ' No series found matching "' + I(i.value) + '" ', 1)) : (E(), B("div", {
        key: 2,
        class: Ae(["legend-virtuoso-container", [
          `legend-virtuoso-container-${e.position}`,
          s.value ? "legend-virtuoso-container-single-row" : ""
        ]])
      }, [
        y("div", z1, [
          (E(!0), B($e, null, Xe(P.value, (O) => (E(), B("div", {
            key: O.seriesIndex,
            class: "virtuoso-grid-item"
          }, [
            y("div", {
              "data-legend-item-id": O.seriesIndex,
              class: Ae(["legend-item", [
                `legend-item-${e.position}`,
                O.show ? "" : "legend-item-off",
                n.value === O.seriesIndex ? "legend-item-focused" : ""
              ]])
            }, [
              y("div", {
                class: "legend-item-label-trigger",
                "data-legend-tooltip": O.label
              }, [
                y("div", {
                  class: "legend-marker",
                  style: He({ borderColor: O.color }),
                  "data-is-legend-marker": !0
                }, null, 4),
                y("span", $1, I(O.label), 1)
              ], 8, P1),
              q.value[O.seriesIndex] && e.values.length > 0 ? (E(), B("span", E1, [
                (E(!0), B($e, null, Xe(e.values, (Z) => (E(), B("span", {
                  key: Z,
                  class: "legend-item-value-badge"
                }, [
                  y("span", I1, I(m[Z]) + ":", 1),
                  y("span", A1, I(v(q.value[O.seriesIndex][Z], e.decimals)), 1)
                ]))), 128))
              ])) : ye("", !0),
              y("button", {
                type: "button",
                class: "legend-copy-button",
                "data-legend-tooltip": l.value === O.seriesIndex ? "Copied" : "Copy",
                onClick: En((Z) => H(O.seriesIndex, O.label ?? ""), ["stop"])
              }, [
                l.value === O.seriesIndex ? (E(), B("svg", D1, [...K[1] || (K[1] = [
                  y("path", { d: "M20 6L9 17l-5-5" }, null, -1)
                ])])) : (E(), B("svg", L1, [...K[2] || (K[2] = [
                  y("rect", {
                    x: "9",
                    y: "9",
                    width: "13",
                    height: "13",
                    rx: "2",
                    ry: "2"
                  }, null, -1),
                  y("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" }, null, -1)
                ])]))
              ], 8, O1)
            ], 10, T1)
          ]))), 128))
        ])
      ], 2))
    ], 6));
  }
}), R1 = /* @__PURE__ */ wn(q1, [["__scopeId", "data-v-85a1707f"]]), N1 = { class: "footer" }, V1 = {
  key: 0,
  class: "hint"
}, F1 = { class: "kbd active" }, B1 = {
  key: 1,
  class: "hint-list"
}, H1 = {
  class: "hint",
  "data-active": "false"
}, W1 = { class: "kbd" }, j1 = /* @__PURE__ */ Me({
  __name: "TooltipFooter",
  props: {
    isPinned: { type: Boolean },
    pinKey: { default: "P" }
  },
  emits: ["dismiss"],
  setup(e, { emit: t }) {
    const n = t;
    return (i, l) => (E(), B("div", N1, [
      y("div", null, [
        e.isPinned ? (E(), B("div", V1, [
          l[1] || (l[1] = y("span", null, "按", -1)),
          y("kbd", F1, I(e.pinKey), 1),
          l[2] || (l[2] = y("span", null, "或", -1)),
          l[3] || (l[3] = y("kbd", { class: "kbd active" }, "Esc", -1)),
          l[4] || (l[4] = y("span", null, "取消固定", -1))
        ])) : (E(), B("div", B1, [
          y("div", H1, [
            l[5] || (l[5] = y("span", null, "按", -1)),
            y("kbd", W1, I(e.pinKey), 1),
            l[6] || (l[6] = y("span", null, "固定提示框", -1))
          ])
        ]))
      ]),
      e.isPinned ? (E(), B("button", {
        key: 0,
        class: "unpin-btn",
        onClick: l[0] || (l[0] = (s) => n("dismiss"))
      }, [...l[7] || (l[7] = [
        y("svg", {
          width: "10",
          height: "10",
          viewBox: "0 0 24 24",
          fill: "none",
          stroke: "currentColor",
          "stroke-width": "2"
        }, [
          y("path", { d: "M18 6L6 18" }),
          y("path", { d: "M6 6l12 12" })
        ], -1),
        y("span", null, "取消固定", -1)
      ])])) : ye("", !0)
    ]));
  }
}), G1 = /* @__PURE__ */ wn(j1, [["__scopeId", "data-v-75c52e2f"]]), Y1 = ["data-is-active"], U1 = { class: "tooltip-item-label" }, K1 = /* @__PURE__ */ Me({
  __name: "TooltipItem",
  props: {
    item: {},
    isItemActive: { type: Boolean }
  },
  setup(e) {
    return (t, n) => (E(), B("div", {
      class: "tooltip-item",
      "data-is-active": e.isItemActive
    }, [
      y("div", {
        class: "tooltip-item-marker",
        style: He({ borderColor: e.item.color })
      }, null, 4),
      y("div", {
        class: "tooltip-item-content",
        style: He({ color: e.item.color })
      }, [
        y("span", U1, I(e.item.label), 1),
        y("span", {
          class: "tooltip-item-separator",
          style: He({ borderColor: e.item.color })
        }, null, 4),
        y("span", null, I(e.item.tooltipValue), 1)
      ], 4)
    ], 8, Y1));
  }
}), Od = /* @__PURE__ */ wn(K1, [["__scopeId", "data-v-3b1d92d5"]]), X1 = { class: "header-container" }, Q1 = {
  key: 0,
  class: "header-row"
}, J1 = {
  key: 0,
  class: "header-status"
}, Z1 = {
  key: 1,
  class: "header-pinned-item"
}, ex = /* @__PURE__ */ Me({
  __name: "TooltipHeader",
  props: {
    uPlotInstance: {},
    showTooltipHeader: { type: Boolean },
    isPinned: { type: Boolean },
    activeItem: {},
    headerTitle: {}
  },
  setup(e) {
    return (t, n) => (E(), B("div", X1, [
      e.showTooltipHeader && e.headerTitle ? (E(), B("div", Q1, [
        y("span", null, I(e.headerTitle), 1),
        e.isPinned ? (E(), B("div", J1, [...n[0] || (n[0] = [
          y("svg", {
            width: "12",
            height: "12",
            viewBox: "0 0 24 24",
            fill: "none",
            stroke: "currentColor",
            "stroke-width": "2"
          }, [
            y("path", { d: "M12 2v4" }),
            y("path", { d: "M19 10h-7l-5 5v7h10v-7l-5-5z" })
          ], -1),
          y("span", null, "已固定", -1)
        ])])) : ye("", !0)
      ])) : ye("", !0),
      e.activeItem ? (E(), B("div", Z1, [
        k(Od, {
          item: e.activeItem,
          "is-item-active": !0
        }, null, 8, ["item"])
      ])) : ye("", !0)
    ]));
  }
}), tx = /* @__PURE__ */ wn(ex, [["__scopeId", "data-v-efb4cf97"]]), nx = /* @__PURE__ */ Me({
  __name: "TooltipList",
  props: {
    content: {},
    maxHeight: { default: 300 }
  },
  setup(e) {
    return (t, n) => (E(), B("div", {
      class: "tooltip-list",
      style: He({ maxHeight: `${e.maxHeight}px`, overflowY: "auto" })
    }, [
      (E(!0), B($e, null, Xe(e.content, (i) => (E(), Ce(Od, {
        key: i.label,
        item: i,
        "is-item-active": !1
      }, null, 8, ["item"]))), 128))
    ], 4));
  }
}), ix = /* @__PURE__ */ wn(nx, [["__scopeId", "data-v-fa17493a"]]), lx = {
  key: 1,
  class: "tooltip-divider"
}, ox = /* @__PURE__ */ Me({
  __name: "Tooltip",
  props: {
    uPlotInstance: {},
    content: {},
    headerTitle: {},
    isPinned: { type: Boolean },
    canPinTooltip: { type: Boolean, default: !0 },
    showTooltipHeader: { type: Boolean, default: !0 },
    tooltipMaxHeight: { default: 300 }
  },
  emits: ["dismiss"],
  setup(e, { emit: t }) {
    const n = e, i = t, l = re(() => n.content.find((u) => u.isActive) ?? null), s = re(() => n.showTooltipHeader || l.value != null), d = re(() => n.content.length > 1), c = re(() => d.value && s.value);
    return (u, p) => (E(), B("div", {
      class: Ae(["tooltip-container", { pinned: e.isPinned }])
    }, [
      s.value ? (E(), Ce(tx, {
        key: 0,
        "u-plot-instance": e.uPlotInstance,
        "show-tooltip-header": e.showTooltipHeader,
        "is-pinned": e.isPinned,
        "active-item": l.value,
        "header-title": e.headerTitle
      }, null, 8, ["u-plot-instance", "show-tooltip-header", "is-pinned", "active-item", "header-title"])) : ye("", !0),
      c.value ? (E(), B("span", lx)) : ye("", !0),
      d.value ? (E(), Ce(ix, {
        key: 2,
        content: e.content,
        "max-height": e.tooltipMaxHeight
      }, null, 8, ["content", "max-height"])) : ye("", !0),
      e.canPinTooltip ? (E(), Ce(G1, {
        key: 3,
        "is-pinned": e.isPinned,
        style: He({ pointerEvents: e.isPinned ? "auto" : "none" }),
        onDismiss: p[0] || (p[0] = (m) => i("dismiss"))
      }, null, 8, ["is-pinned", "style"])) : ye("", !0)
    ], 2));
  }
}), ax = /* @__PURE__ */ wn(ox, [["__scopeId", "data-v-4b92f289"]]), sx = /* @__PURE__ */ Me({
  __name: "ChartTooltip",
  props: {
    uPlotInstance: {},
    unit: { default: "" },
    decimals: {},
    canPinTooltip: { type: Boolean, default: !0 },
    tooltipMode: { default: "multi" },
    tooltipSort: { default: "none" },
    showTooltipHeader: { type: Boolean, default: !0 },
    tooltipMaxHeight: { default: 300 }
  },
  setup(e) {
    const t = e, n = fe(), i = fe(!1), l = fe(!1), s = fe(""), d = fe([]), c = {
      hoverActive: !1,
      pinned: !1,
      focusedSeriesIndex: null,
      seriesIndexes: [],
      mouseWithinPlot: !1,
      windowWidth: window.innerWidth - 16,
      windowHeight: window.innerHeight - 16,
      tooltipW: 0,
      tooltipH: 0
    };
    let u = null;
    function p() {
      u === null && (u = requestAnimationFrame(() => {
        u = null, M();
      }));
    }
    function m(U, $, G) {
      return typeof U == "function" ? String(U($, G)) : typeof U == "string" ? U : "#cccccc";
    }
    function b(U, $, G) {
      const ue = G !== void 0 ? U.toFixed(G) : String(Math.round(U * 1e3) / 1e3);
      return $ ? `${ue} ${$}` : ue;
    }
    function v(U) {
      if (t.tooltipMode === "none")
        return [];
      const $ = U.cursor.idx, G = [];
      for (let ue = 1; ue < U.series.length; ue++) {
        const ie = U.series[ue];
        if (!ie?.show)
          continue;
        let Ee = c.seriesIndexes[ue] ?? null;
        if (t.tooltipMode === "single") {
          if (ue !== c.focusedSeriesIndex)
            continue;
          Ee = $ ?? Ee;
        } else
          Ee = Ee ?? $ ?? null;
        if (Ee === null)
          continue;
        const ve = U.data[ue]?.[Ee];
        ve == null || !Number.isFinite(ve) || G.push({
          label: String(ie.label ?? `Series ${ue}`),
          value: ve,
          tooltipValue: b(ve, t.unit, t.decimals),
          color: m(ie.stroke, U, ue),
          isActive: ue === c.focusedSeriesIndex
        });
      }
      return t.tooltipSort === "asc" && G.sort((ue, ie) => ue.value - ie.value), t.tooltipSort === "desc" && G.sort((ue, ie) => ie.value - ue.value), G;
    }
    function C(U) {
      if (!t.showTooltipHeader)
        return "";
      const $ = U.cursor.idx;
      if ($ == null)
        return "";
      const G = U.data[0]?.[$];
      return G == null ? "" : U.scales.x?.time ? new Date(G * 1e3).toLocaleString() : String(G);
    }
    function P(U) {
      const $ = n.value;
      if (!$)
        return;
      const { left: G = -1, top: ue = -1 } = U.cursor;
      if (G < 0 || ue < 0)
        return;
      const ie = U.rect.left + G, Ee = U.rect.top + ue, ve = $.offsetWidth, ge = $.offsetHeight;
      c.tooltipW = ve, c.tooltipH = ge;
      const le = ie + 14 + ve > c.windowWidth ? -(ve + 14) : 14, me = Ee - 8 + ge > c.windowHeight ? -(ge - 8) : -8;
      $.style.transform = `translate(${ie + le}px, ${Ee + me}px)`;
    }
    function M() {
      const U = t.uPlotInstance;
      if (!U || !c.hoverActive && !c.pinned) {
        i.value = !1;
        return;
      }
      const $ = v(U);
      if ($.length === 0) {
        c.pinned || (i.value = !1);
        return;
      }
      d.value = $, s.value = C(U), l.value = c.pinned, c.pinned || P(U), i.value = !0;
    }
    function q(U) {
      if (c.pinned)
        return;
      const $ = U.cursor.idxs;
      $ && (c.seriesIndexes = [...$], c.hoverActive = c.seriesIndexes.some((G, ue) => ue > 0 && G != null) && c.focusedSeriesIndex != null, p());
    }
    function Q(U, $, G) {
      !("focus" in G) || c.pinned || (c.focusedSeriesIndex = $ ?? null, c.hoverActive = c.focusedSeriesIndex != null, p());
    }
    function V(U) {
      if (c.pinned || !c.hoverActive)
        return;
      const $ = n.value;
      if (!$)
        return;
      const { left: G = -1, top: ue = -1 } = U.cursor;
      if (G < 0 || ue < 0)
        return;
      const ie = U.rect.left + G, Ee = U.rect.top + ue, ve = $.offsetWidth, ge = $.offsetHeight;
      c.tooltipW = ve, c.tooltipH = ge;
      const le = ie + 14 + ve > c.windowWidth ? -(ve + 14) : 14, me = Ee - 8 + ge > c.windowHeight ? -(ge - 8) : -8;
      $.style.transform = `translate(${ie + le}px, ${Ee + me}px)`;
    }
    function Y() {
      const U = t.uPlotInstance;
      !U || !c.hoverActive || (c.pinned = !0, U.cursor._lock = !0, l.value = !0, document.addEventListener("mousedown", H, !0));
    }
    function A() {
      const U = t.uPlotInstance;
      c.pinned = !1, c.hoverActive = !1, U && (U.cursor._lock = !1), l.value = !1, i.value = !1, document.removeEventListener("mousedown", H, !0);
    }
    function H(U) {
      n.value && !n.value.contains(U.target) && A();
    }
    function ee(U) {
      if (U.key === "Escape") {
        c.pinned && A();
        return;
      }
      U.key.toLowerCase() === "p" && c.mouseWithinPlot && (c.pinned ? A() : Y());
    }
    function z() {
      c.mouseWithinPlot = !0;
    }
    function j() {
      c.mouseWithinPlot = !1;
    }
    function J() {
      c.windowWidth = window.innerWidth - 16, c.windowHeight = window.innerHeight - 16, c.pinned || (c.hoverActive = !1);
    }
    let K = [];
    function O(U) {
      const $ = (ie) => q(ie), G = (ie, Ee, ve) => Q(ie, Ee, ve), ue = (ie) => V(ie);
      U.hooks.setLegend = [...U.hooks.setLegend ?? [], $], U.hooks.setSeries = [...U.hooks.setSeries ?? [], G], U.hooks.setCursor = [...U.hooks.setCursor ?? [], ue], U.root.addEventListener("mouseenter", z), U.root.addEventListener("mouseleave", j), K = [
        () => {
          U.hooks.setLegend = (U.hooks.setLegend ?? []).filter(
            (ie) => ie !== $
          ), U.hooks.setSeries = (U.hooks.setSeries ?? []).filter(
            (ie) => ie !== G
          ), U.hooks.setCursor = (U.hooks.setCursor ?? []).filter(
            (ie) => ie !== ue
          ), U.root.removeEventListener("mouseenter", z), U.root.removeEventListener("mouseleave", j);
        }
      ];
    }
    function Z() {
      K.forEach((U) => U()), K = [], document.removeEventListener("mousedown", H, !0), c.hoverActive = !1, c.pinned = !1, c.focusedSeriesIndex = null, i.value = !1, l.value = !1, u !== null && (cancelAnimationFrame(u), u = null);
    }
    return Fe(
      () => t.uPlotInstance,
      (U, $) => {
        $ && Z(), U && O(U);
      },
      { immediate: !0 }
    ), An(() => {
      document.addEventListener("keydown", ee, !0), window.addEventListener("resize", J);
    }), Xi(() => {
      Z(), document.removeEventListener("keydown", ee, !0), window.removeEventListener("resize", J);
    }), (U, $) => (E(), Ce(Gd, { to: "body" }, [
      ac(y("div", {
        ref_key: "containerRef",
        ref: n,
        style: { position: "fixed", top: "0", left: "0", "z-index": "1070", "pointer-events": "none" }
      }, [
        e.uPlotInstance ? (E(), Ce(ax, {
          key: 0,
          "u-plot-instance": e.uPlotInstance,
          content: d.value,
          "header-title": s.value,
          "is-pinned": l.value,
          "can-pin-tooltip": e.canPinTooltip,
          "show-tooltip-header": e.showTooltipHeader,
          "tooltip-max-height": e.tooltipMaxHeight,
          onDismiss: A
        }, null, 8, ["u-plot-instance", "content", "header-title", "is-pinned", "can-pin-tooltip", "show-tooltip-header", "tooltip-max-height"])) : ye("", !0)
      ], 512), [
        [sc, i.value && e.tooltipMode !== "none"]
      ])
    ]));
  }
}), Dd = Symbol("plotContext");
function rx() {
  const e = fe(null), t = fe(""), n = fe(!1);
  let i;
  function l(m) {
    e.value = m.uPlotInstance, m.id !== void 0 && (t.value = m.id), m.shouldSaveSelectionPreference !== void 0 && (n.value = m.shouldSaveSelectionPreference), i = void 0;
  }
  function s() {
    const m = e.value;
    if (!m || !t.value)
      return;
    const b = m.series.map((v) => ({
      label: v.label ?? "",
      show: v.show ?? !0
    }));
    ch(t.value, b);
  }
  function d(m) {
    const b = e.value;
    if (!b)
      return;
    const v = i === m;
    i = v ? void 0 : m, b.batch(() => {
      b.series.forEach((C, P) => {
        P !== 0 && b.setSeries(P, {
          show: v || P === m
        });
      }), t.value && n.value && s();
    });
  }
  function c(m) {
    const b = e.value;
    if (!b)
      return;
    const v = b.series[m];
    v && (b.setSeries(m, { show: !v.show }), t.value && n.value && s());
  }
  function u(m) {
    const b = e.value;
    b && b.batch(() => {
      b.series.forEach((v, C) => {
        C !== 0 && b.setSeries(C, {
          show: m === null || C === m
        });
      });
    });
  }
  const p = {
    uPlotInstance: e,
    id: t,
    shouldSaveSelectionPreference: n,
    setPlotContextInitialState: l,
    onToggleSeriesVisibility: d,
    onToggleSeriesOnOff: c,
    onFocusSeries: u,
    syncSeriesVisibilityToLocalStorage: s
  };
  return xl(Dd, p), p;
}
function A2() {
  const e = bl(Dd);
  if (!e)
    throw new Error("usePlotContext must be used within a PlotContextProvider");
  return e;
}
const ux = { style: { position: "relative", overflow: "hidden" } }, cx = /* @__PURE__ */ Me({
  __name: "UPlotChart",
  props: {
    config: {},
    data: {},
    width: {},
    height: {},
    plotRef: {},
    onDestroy: {}
  },
  emits: ["plotReady"],
  setup(e, { expose: t, emit: n }) {
    const i = e, l = n, { setPlotContextInitialState: s } = rx(), d = fe(), c = fe(null), u = fe(""), p = fe(""), m = fe(0), b = fe(0);
    function v() {
      c.value && (i.onDestroy && i.onDestroy(c.value), c.value.destroy(), c.value = null, s({ uPlotInstance: null }), i.plotRef && i.plotRef(null));
    }
    function C(H) {
      if (H === null || typeof H != "object")
        return H;
      const ee = ts(H);
      if (ee instanceof Date)
        return new Date(ee.getTime());
      if (ee instanceof RegExp)
        return new RegExp(ee.source, ee.flags);
      if (typeof ee == "function")
        return ee;
      if (Array.isArray(ee)) {
        const j = [];
        for (let J = 0; J < ee.length; J++)
          j.push(C(ts(ee[J])));
        return j;
      }
      const z = {};
      for (const j in ee)
        Object.prototype.hasOwnProperty.call(ee, j) && (z[j] = C(ts(ee[j])));
      return z;
    }
    function P() {
      if (v(), !d.value || i.width === 0 || i.height === 0)
        return;
      const H = i.config.getConfig(), z = C({
        ...H,
        width: Math.floor(i.width),
        height: Math.floor(i.height),
        series: H.series ?? []
      }), j = q(i.data, i.config), J = new Gt(z, j, d.value);
      i.plotRef && i.plotRef(J), s({
        uPlotInstance: J,
        id: i.config.getId(),
        shouldSaveSelectionPreference: i.config.getShouldSaveSelectionPreference()
      }), c.value = J, l("plotReady", J), u.value = JSON.stringify(i.config.getConfig()), p.value = JSON.stringify(i.data), m.value = i.width, b.value = i.height;
    }
    function M(H) {
      return JSON.parse(JSON.stringify(H));
    }
    function q(H, ee) {
      const z = M(H), j = ee.getSeriesSpanGapsOptions();
      return j.length > 0 ? $p(z, j) : z;
    }
    function Q() {
      return i.width === m.value && i.height === b.value;
    }
    function V() {
      return JSON.stringify(i.data) === p.value;
    }
    function Y() {
      return JSON.stringify(i.config.getConfig()) === u.value;
    }
    const A = re(() => !!(i.data && i.data[0] && i.data[0].length === 0));
    return Fe(A, (H) => {
      H && v();
    }), ka((H) => {
      if (H(() => {
        v(), u.value = "", p.value = "", m.value = 0, b.value = 0;
      }), !d.value || i.width === 0 || i.height === 0)
        return;
      if (!u.value) {
        P();
        return;
      }
      const ee = !!c.value && (!d.value || c.value.root.parentElement !== d.value);
      if (!Q() && c.value && !ee && c.value.setSize({
        width: Math.floor(i.width),
        height: Math.floor(i.height)
      }), !Y() || ee)
        P();
      else if (!V() && c.value) {
        const z = q(i.data, i.config);
        c.value.setData(z);
      }
    }), no(() => {
      v();
    }), t({ plotInstance: c }), (H, ee) => (E(), B("div", ux, [
      A.value ? (E(), B("div", {
        key: 0,
        class: "flex flex-col items-center justify-center not-found",
        style: He({
          width: `${e.width}px`,
          height: `${e.height}px`
        })
      }, [
        y("div", {
          class: Ae([f(ze).chartLine, "mb-2"]),
          style: { "font-size": "48px" }
        }, null, 2),
        ee[0] || (ee[0] = y("div", { class: "text-gray-400 text-sm" }, " No Data ", -1))
      ], 4)) : (E(), B("div", {
        key: 1,
        ref_key: "containerRef",
        ref: d,
        class: "w-full h-full"
      }, null, 512)),
      Ti(H.$slots, "default")
    ]));
  }
}), dx = {
  key: 0,
  class: "flex items-center justify-center h-full text-gray-400 select-none"
}, or = /* @__PURE__ */ Me({
  __name: "AgChart",
  props: {
    data: {},
    unit: {},
    decimals: {},
    colorScheme: {},
    colorSingleValue: {},
    colorDistribution: {},
    thresholds: {},
    thresholdBaseColor: {},
    fillOpacity: { default: 10 },
    lineWidth: { default: 1.5 },
    lineInterpolation: { default: "linear" },
    lineStyle: { default: "solid" },
    drawStyle: { default: "lines" },
    gradientMode: { default: "none" },
    spanNulls: { type: [Boolean, Number], default: !1 },
    showPoints: { type: Boolean, default: !1 },
    showPointsMode: { default: "auto" },
    stackingMode: { default: "none" },
    legendPosition: { default: "bottom" },
    legendMode: { default: "list" },
    legendValues: { default: () => [] },
    syncKey: {},
    panelId: {},
    tooltipMode: { default: "multi" },
    tooltipSort: { default: "none" },
    tooltipMaxHeight: {},
    showAxisPointer: { type: Boolean, default: !0 },
    softMin: {},
    softMax: {},
    axisPlacement: { default: "left" },
    axisName: {},
    axisWidth: {},
    showGridLines: { default: "all" },
    gridColor: {},
    axisLabel: { default: "all" },
    axisLabelColor: {},
    axisTick: { default: "hidden" },
    axisTickColor: {},
    axisBorder: { default: "hidden" },
    axisBorderColor: {},
    scaleDistribution: { default: "linear" },
    centeredZero: { type: Boolean, default: !1 },
    xAxisTime: { type: Boolean, default: !0 },
    barGroupWidth: {},
    barWidth: {}
  },
  setup(e) {
    const t = e, n = fe(), i = fe({ width: 0, height: 0 });
    let l = null;
    function s(q) {
      l = new ResizeObserver((Q) => {
        const V = Q[0];
        if (V) {
          const { width: Y, height: A } = V.contentRect;
          setTimeout(() => {
            i.value = { width: Math.floor(Y), height: Math.floor(A) };
          }, 300);
        }
      }), l.observe(q), requestAnimationFrame(() => {
        const { width: Q, height: V } = q.getBoundingClientRect();
        i.value = { width: Math.floor(Q), height: Math.floor(V) };
      });
    }
    An(() => {
      n.value && s(n.value);
    }), Fe(n, (q) => {
      l?.disconnect(), q && s(q);
    }), no(() => {
      l?.disconnect();
    });
    const d = re(() => {
      const q = new Tp({ id: t.panelId ?? "chart" }), Q = t.scaleDistribution ?? "linear", V = t.stackingMode !== "none";
      q.addScale({ scaleKey: "x", time: t.xAxisTime }), q.addScale({
        scaleKey: "y",
        distribution: Q === "logarithmic" ? pl.Logarithmic : Q === "symlog" ? pl.Symlog : pl.Linear,
        softMin: V && t.stackingMode === "percent" ? 0 : t.softMin ?? void 0,
        softMax: V && t.stackingMode === "percent" ? 100 : t.softMax ?? void 0,
        ...t.centeredZero ? {
          range: (Le, Je, Ge) => {
            const vt = Math.max(Math.abs(Je), Math.abs(Ge));
            return [-vt, vt];
          }
        } : {}
      });
      const Y = t.gridColor ?? "#E8E9EA", A = t.showGridLines === "all" || t.showGridLines === "x", H = t.showGridLines === "all" || t.showGridLines === "y", ee = t.axisLabel === "all" || t.axisLabel === "x", z = t.axisLabel === "all" || t.axisLabel === "y", j = ee ? t.axisLabelColor ?? "#666666" : "transparent", J = z ? t.axisLabelColor ?? "#666666" : "transparent", K = t.axisTick === "all" || t.axisTick === "x", O = t.axisTick === "all" || t.axisTick === "y", Z = K ? t.axisTickColor ?? "#666666" : "transparent", U = O ? t.axisTickColor ?? "#666666" : "transparent", $ = t.axisBorder === "all" || t.axisBorder === "x", G = t.axisBorder === "all" || t.axisBorder === "y", ue = t.axisBorderColor ?? "#666666";
      q.addAxis({
        scaleKey: "x",
        side: 2,
        size: 28,
        stroke: j,
        grid: { show: A, stroke: Y },
        ticks: { show: K, stroke: Z, width: 0.5 },
        border: { show: $, stroke: ue }
      });
      const ie = t.axisPlacement === "right" ? 1 : 3, Ee = t.axisPlacement !== "hidden", ve = (() => {
        if (t.axisWidth !== void 0 && t.axisWidth !== null)
          return t.axisWidth;
        const Le = t.data.series.reduce((ft, Tt) => ft.concat(Tt.values.filter((ut) => ut !== null && Number.isFinite(ut))), []);
        if (Le.length === 0)
          return 56;
        const Je = Math.max(...Le.map(Math.abs)), Ge = t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15, It = ((ft) => {
          if (Math.abs(ft) >= 1e6) {
            const ut = Ge !== void 0 ? (ft / 1e6).toFixed(Ge) : String(ft / 1e6);
            return t.unit ? `${ut}M ${t.unit}` : `${ut}M`;
          }
          if (Math.abs(ft) >= 1e3) {
            const ut = Ge !== void 0 ? (ft / 1e3).toFixed(Ge) : String(ft / 1e3);
            return t.unit ? `${ut}K ${t.unit}` : `${ut}K`;
          }
          const Tt = Ge !== void 0 ? ft.toFixed(Ge) : String(Math.round(ft * 100) / 100);
          return t.unit ? `${Tt} ${t.unit}` : Tt;
        })(Je);
        try {
          const ft = document.createElement("canvas").getContext("2d");
          if (!ft)
            return 56;
          ft.font = "12px system-ui, sans-serif";
          const Tt = ft.measureText(It).width;
          return Math.ceil(Tt) + 14;
        } catch {
          return 56;
        }
      })(), ge = t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15;
      q.addAxis({
        scaleKey: "y",
        side: ie,
        show: Ee,
        label: t.axisName || void 0,
        size: ve,
        stroke: J,
        grid: { show: H, stroke: Y },
        ticks: { show: O, stroke: U, width: 0.5 },
        border: { show: G, stroke: ue },
        isDarkMode: !0,
        yAxisUnit: t.unit,
        decimalPrecision: ge,
        isLogScale: Q === "logarithmic" || Q === "symlog"
      });
      const le = Ff(
        t.colorScheme,
        t.data.series.length,
        t.colorDistribution ?? "sequential",
        t.colorSingleValue
      ), me = t.drawStyle === "bars", Oe = t.drawStyle === "points", xe = t.data.series.length, ke = t.barGroupWidth ?? 0.7, se = t.barWidth ?? (t.stackingMode !== "none" ? 1 : 1 / Math.max(xe, 1)), oe = me ? ke * se : void 0, Te = Oe || t.showPointsMode === "always" ? !0 : t.showPointsMode === "never" ? !1 : t.showPoints, be = V ? "none" : t.fillOpacity > 0 ? t.gradientMode !== "none" ? "gradient" : "solid" : "none";
      if (t.data.series.forEach((Le, Je) => {
        const Ge = le[Je] ?? Yi[Je % Yi.length];
        q.addSeries({
          scaleKey: "y",
          label: Le.label,
          drawStyle: me ? "bars" : Oe ? "points" : "lines",
          lineColor: Ge,
          lineWidth: t.lineWidth,
          lineInterpolation: t.lineInterpolation,
          lineStyle: t.lineStyle,
          fillColor: Ge,
          fillOpacity: t.fillOpacity,
          fillMode: be,
          showPoints: Te,
          pointSize: Te ? 4 : 0,
          spanGaps: t.spanNulls ?? !1,
          ...oe !== void 0 ? { barWidthFactor: oe } : {}
        });
      }), V && t.data.series.length > 0 && t.fillOpacity > 0) {
        const Le = le.length > 0 ? le : [...Yi], Je = Math.round(Math.min(t.fillOpacity, 100) / 100 * 255).toString(16).padStart?.(2, "0") || Math.round(Math.min(t.fillOpacity, 100) / 100 * 255).toString(16), Ge = t.data.series.map((vt, It) => ({
          series: [It + 1, It],
          fill: `${Le[It % Le.length]}${Je}`
        }));
        Ge.length > 0 && (Ge[0] = { series: [1, 0], fill: `${Le[0]}${Je}` }), q.setBands(Ge);
      }
      return t.syncKey && q.setCursor({ sync: { key: t.syncKey, setSeries: !0 } }), t.showAxisPointer || q.setCursor({ x: !1, y: !1 }), q.setCursor({
        drag: { setScale: !0 },
        points: {
          one: !0,
          size: (Le, Je) => (Le.series[Je]?.points?.size ?? 0) * 3,
          width: (Le, Je, Ge) => Ge / 4,
          stroke: (Le, Je) => {
            const Ge = Le.series[Je]?.points, vt = typeof Ge?.stroke == "function" ? Ge.stroke : void 0;
            return `${vt !== void 0 ? vt(Le, Je) : typeof Ge?.stroke == "string" ? Ge.stroke : ""}90`;
          },
          fill: "#fff"
        },
        focus: {
          prox: 30
        },
        hover: {
          prox: 30,
          bias: 0
        }
      }), q;
    }), c = re(() => {
      const q = t.data?.timestamps ?? [], Q = JSON.parse(JSON.stringify(q));
      if (Q.length === 0 || !t.data)
        return [[]];
      const V = t.data.series.map((Y) => JSON.parse(JSON.stringify(Y.values.map((A) => A ?? 0))));
      if (t.stackingMode !== "none" && t.data.series.length > 0) {
        const Y = Q.length, A = Array.from({ length: Y }, () => 0), H = [];
        for (const ee of t.data.series) {
          const z = Array.from({ length: Y });
          for (let j = 0; j < Y; j++) {
            if (t.stackingMode === "percent") {
              let J = 0;
              for (const K of t.data.series)
                J += K.values[j] ?? 0;
              A[j] = A[j] + (ee.values[j] ?? 0) / (J || 1) * 100;
            } else
              A[j] = A[j] + (ee.values[j] ?? 0);
            z[j] = A[j];
          }
          H.push(z);
        }
        return [Q, ...H];
      }
      return [Q, ...V];
    }), u = re(() => !t.data || t.data.timestamps.length === 0 || t.data.series.length === 0), p = fe(null);
    function m(q) {
      p.value = q;
    }
    const b = re(() => t.decimals === void 0 || t.decimals === null ? void 0 : t.decimals <= 15 ? t.decimals : 15), v = re(() => t.legendPosition === "right"), C = re(() => t.legendPosition !== "hidden" && t.data.series.length > 0), P = re(() => v.value && C.value ? Math.max(i.value.width - 160, 100) : i.value.width), M = re(() => Math.max(i.value.height, 50));
    return (q, Q) => (E(), B("div", {
      class: Ae(["w-full h-full flex overflow-hidden relative", v.value ? "flex-row" : "flex-col"])
    }, [
      u.value ? (E(), B("div", dx, [...Q[0] || (Q[0] = [
        y("span", { class: "text-xs" }, "No data", -1)
      ])])) : ye("", !0),
      y("div", {
        ref_key: "chartAreaRef",
        ref: n,
        class: "flex-1 min-h-0 min-w-0 relative overflow-hidden"
      }, [
        k(cx, {
          config: d.value,
          data: c.value,
          width: P.value,
          height: M.value,
          onPlotReady: m
        }, {
          default: R(() => [
            k(sx, {
              "u-plot-instance": p.value,
              unit: t.unit,
              decimals: b.value,
              "can-pin-tooltip": !0,
              "tooltip-mode": t.tooltipMode,
              "tooltip-sort": t.tooltipSort,
              "tooltip-max-height": t.tooltipMaxHeight
            }, null, 8, ["u-plot-instance", "unit", "decimals", "tooltip-mode", "tooltip-sort", "tooltip-max-height"])
          ]),
          _: 1
        }, 8, ["config", "data", "width", "height"])
      ], 512),
      C.value ? (E(), B("div", {
        key: 1,
        style: He(
          v.value ? { width: "160px", flexShrink: 0, height: "100%", padding: "4px 8px", overflow: "auto", zIndex: 10, position: "relative", pointerEvents: "auto" } : { flexShrink: 0, padding: "2px 4px", overflow: "auto", maxHeight: "140px", zIndex: 10, position: "relative", pointerEvents: "auto" }
        )
      }, [
        k(R1, {
          items: d.value.getLegendItems(),
          "u-plot-instance": p.value,
          position: v.value ? "right" : "bottom",
          mode: t.legendMode ?? "list",
          values: t.legendValues ?? [],
          data: c.value,
          decimals: b.value,
          unit: t.unit
        }, null, 8, ["items", "u-plot-instance", "position", "mode", "values", "data", "decimals", "unit"])
      ], 4)) : ye("", !0)
    ], 2));
  }
}), fx = /* @__PURE__ */ Me({
  __name: "BarPanel",
  props: {
    data: {},
    stacked: { type: Boolean, default: !1 },
    colorScheme: {},
    colorSingleValue: {},
    colorDistribution: {},
    barWidth: {},
    barGroupWidth: { default: 0.7 },
    showValues: { default: "auto" },
    unit: {},
    decimals: { default: 0 },
    legendPosition: { default: "bottom" },
    legendMode: { default: "list" },
    legendValues: { default: () => [] },
    tooltipMode: { default: "multi" },
    tooltipSort: { default: "none" }
  },
  setup(e) {
    return (t, n) => (E(), Ce(or, {
      data: e.data,
      "draw-style": "bars",
      "stacking-mode": e.stacked ? "normal" : "none",
      "color-scheme": e.colorScheme,
      "color-single-value": e.colorSingleValue,
      "color-distribution": e.colorDistribution,
      unit: e.unit,
      decimals: e.decimals,
      "fill-opacity": 80,
      "bar-group-width": e.barGroupWidth,
      "bar-width": e.barWidth,
      "legend-position": e.legendPosition,
      "legend-mode": e.legendMode,
      "legend-values": e.legendValues,
      "tooltip-mode": e.tooltipMode,
      "tooltip-sort": e.tooltipSort
    }, null, 8, ["data", "stacking-mode", "color-scheme", "color-single-value", "color-distribution", "unit", "decimals", "bar-group-width", "bar-width", "legend-position", "legend-mode", "legend-values", "tooltip-mode", "tooltip-sort"]));
  }
}), hx = {
  key: 0,
  style: { "text-align": "center", "font-size": "11px", color: "#888", padding: "2px 4px 4px", overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" }
}, bs = 2, gx = /* @__PURE__ */ Me({
  __name: "GaugePanel",
  props: {
    series: {},
    value: { default: 0 },
    title: {},
    min: { default: _t.min },
    max: { default: _t.max },
    unit: {},
    thresholds: {},
    thresholdBaseColor: {},
    capRound: { type: Boolean, default: _t.capRound },
    trackWidth: { default: _t.trackWidth },
    fillWidth: { default: _t.fillWidth },
    trackColor: { default: _t.trackColor },
    sweepAngle: { default: _t.sweepAngle },
    valueColor: { default: _t.valueColor },
    valueSize: { default: _t.valueSize },
    valueVisible: { type: Boolean, default: _t.valueVisible },
    paddingX: { default: _t.paddingX },
    paddingY: { default: _t.paddingY },
    activeColorOverride: {},
    thresholdDisplay: { default: _t.thresholdDisplay },
    thresholdLabelDisplay: { default: _t.thresholdLabelDisplay },
    valueOffsetY: { default: _t.valueOffsetY },
    orientation: { default: _t.orientation }
  },
  setup(e) {
    const t = e, n = fe(), i = fe({ w: 0, h: 0 });
    let l = null;
    function s(V, Y, A = 2) {
      const H = V.toFixed(A);
      return Y === "percent" ? `${H}%` : Y === "bytes" ? V >= 1024 * 1024 ? `${(V / 1024 / 1024).toFixed(1)} MB` : V >= 1024 ? `${(V / 1024).toFixed(1)} KB` : `${V} B` : Y ? `${H} ${Y}` : H;
    }
    function d(V, Y, A) {
      const H = [...A].sort((z, j) => z.value - j.value);
      let ee = Y;
      for (const z of H)
        V >= z.value && (ee = z.color);
      return ee;
    }
    function c(V, Y) {
      const A = V.match(/^#([0-9a-f]{6})([0-9a-f]{2})?$/i);
      if (A) {
        const ee = Number.parseInt(A[1].slice(0, 2), 16), z = Number.parseInt(A[1].slice(2, 4), 16), j = Number.parseInt(A[1].slice(4, 6), 16);
        return `rgba(${ee},${z},${j},${Y})`;
      }
      const H = V.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
      return H ? `rgba(${H[1]},${H[2]},${H[3]},${Y})` : V;
    }
    function u(V, Y, A, H, ee, z, j, J, K, O, Z, U, $, G, ue, ie, Ee, ve, ge, le, me, Oe) {
      const xe = V.getContext("2d");
      if (!xe)
        return;
      const ke = window.devicePixelRatio || 1, se = V.clientWidth, oe = V.clientHeight;
      if (se === 0 || oe === 0)
        return;
      V.width = se * ke, V.height = oe * ke, xe.scale(ke, ke), xe.clearRect(0, 0, se, oe);
      const Te = U * Math.PI / 180, be = (U + $) * Math.PI / 180;
      let Le, Je, Ge, vt;
      if ($ >= 360)
        Le = -1, Je = 1, Ge = -1, vt = 1;
      else {
        Le = Math.cos(Te), Je = Math.cos(Te), Ge = Math.sin(Te), vt = Math.sin(Te);
        const mt = (bt) => {
          Le = Math.min(Le, Math.cos(bt)), Je = Math.max(Je, Math.cos(bt)), Ge = Math.min(Ge, Math.sin(bt)), vt = Math.max(vt, Math.sin(bt));
        };
        mt(be);
        const Ft = [0, 90, 180, 270, 360, 450, 540].map((bt) => bt * Math.PI / 180);
        for (const bt of Ft) {
          const Pt = (rn) => (rn % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI), Qt = Pt(Te), Sn = Pt(be), De = Pt(bt);
          (Qt <= Sn ? De >= Qt && De <= Sn : De >= Qt || De <= Sn) && mt(bt);
        }
      }
      const It = Je - Le, ft = vt - Ge, Tt = Math.min(se, oe), ut = Tt / 300, At = Ee * ut, jn = ve * ut, Wt = Math.max(0, se - 2 * At), ln = Math.max(0, oe - 2 * jn), Be = At, ae = jn, Ie = K * ut, _e = O * ut, je = le === "marker", ct = le === "track", Ye = je ? Math.max(2, Tt * 0.04) : 0, qe = je ? Math.max(Ie, _e) / 2 + 2 + Ye : Math.max(Ie, _e) / 2, et = Math.min((Wt - qe * 2) / It, (ln - qe * 2) / ft);
      if (et < 10)
        return;
      const it = Be + Wt / 2 - (Le + Je) / 2 * et, lt = ae + ln / 2 - (Ge + vt) / 2 * et, St = H - A || 1, qt = Math.max(A, Math.min(H, Y)), Yt = (qt - A) / St, fn = Te + Yt * (be - Te), sn = ge ?? d(qt, j, z), Kt = J ? "round" : "butt";
      xe.beginPath(), xe.arc(it, lt, et, Te, be), xe.strokeStyle = Z, xe.lineWidth = Ie, xe.lineCap = Kt, xe.stroke();
      const zt = [...z].sort((mt, Ft) => mt.value - Ft.value), Xt = [];
      if (zt.length === 0)
        Xt.push({ from: A, to: H, color: j });
      else {
        Xt.push({ from: A, to: zt[0].value, color: j });
        for (let mt = 0; mt < zt.length; mt++)
          Xt.push({ from: zt[mt].value, to: mt + 1 < zt.length ? zt[mt + 1].value : H, color: zt[mt].color });
      }
      if (ct) {
        const mt = (be - Te) / (2 * Math.PI), Ft = xe.createConicGradient(Te, it, lt);
        for (const bt of Xt) {
          const Pt = Math.min(1, (Math.max(A, bt.from) - A) / St * mt), Qt = Math.min(1, (Math.min(H, bt.to) - A) / St * mt);
          Ft.addColorStop(Pt, c(bt.color, 0.25)), Ft.addColorStop(Qt, c(bt.color, 0.25));
        }
        Ft.addColorStop(1, c(Xt[0].color, 0.25)), xe.beginPath(), xe.arc(it, lt, et, Te, be), xe.strokeStyle = Ft, xe.lineWidth = Ie, xe.lineCap = Kt, xe.stroke();
      }
      if (Yt > 0 && (xe.beginPath(), xe.arc(it, lt, et, Te, fn), xe.strokeStyle = sn, xe.lineWidth = _e, xe.lineCap = Kt, xe.stroke()), je && Xt.length > 0) {
        const mt = et + Math.max(Ie, _e) / 2 + Ye / 2 + 2, Ft = (be - Te) / (2 * Math.PI), bt = xe.createConicGradient(Te, it, lt);
        for (const Pt of Xt) {
          const Qt = Math.min(1, (Math.max(A, Pt.from) - A) / St * Ft), Sn = Math.min(1, (Math.min(H, Pt.to) - A) / St * Ft);
          bt.addColorStop(Qt, Pt.color), bt.addColorStop(Sn, Pt.color);
        }
        bt.addColorStop(1, Xt[0].color), xe.beginPath(), xe.arc(it, lt, mt, Te, be), xe.strokeStyle = bt, xe.lineWidth = Ye, xe.lineCap = Kt, xe.stroke();
      }
      if (Oe !== "none" && z.length > 0) {
        const mt = Math.max(8, 11 * ut), Ft = et + Math.max(Ie, _e) / 2 + (je ? Ye + 4 : 4) + mt * 0.6, bt = H - A || 1;
        xe.font = `${mt}px system-ui, sans-serif`, xe.textBaseline = "middle";
        for (const Pt of z) {
          const Qt = (Pt.value - A) / bt;
          if (Qt < 0 || Qt > 1)
            continue;
          const Sn = Te + Qt * (be - Te), De = it + Math.cos(Sn) * Ft, rn = lt + Math.sin(Sn) * Ft, Rt = De - it;
          if (xe.textAlign = Rt > 1 ? "left" : Rt < -1 ? "right" : "center", xe.fillStyle = Pt.color, Oe === "label" || Oe === "both") {
            const hn = Pt.label || String(Pt.value);
            Oe === "both" ? (xe.fillText(hn, De, rn - mt * 0.6), xe.fillText(s(Pt.value, ee, 1), De, rn + mt * 0.6)) : xe.fillText(hn, De, rn);
          } else
            xe.fillText(s(Pt.value, ee, 1), De, rn);
        }
      }
      if (ie) {
        const mt = Math.max(4, ue * ut), Ft = s(qt, ee, 2), bt = lt + Ge * et - _e / 2, Pt = lt + vt * et + _e / 2, Qt = (bt + Pt) / 2;
        xe.textAlign = "center", xe.textBaseline = "middle", xe.fillStyle = G, xe.font = `600 ${mt}px system-ui, sans-serif`, xe.fillText(Ft, it, Qt + me * ut);
      }
    }
    function p(V, Y, A) {
      const H = Math.ceil(Math.sqrt(A * V / Y));
      return Math.floor(H * Y / V) * H < A ? Y / Math.ceil(H * Y / V) : V / H;
    }
    function m(V, Y, A, H) {
      const ee = Math.max(p(V, Y, H), p(Y, V, H));
      let z = Math.max(1, Math.floor(V / ee));
      const j = Math.ceil(H / z);
      return z = Math.ceil(H / j), { xCount: z, yCount: j, cellW: V / z - A + A / z, cellH: Y / j - A + A / j };
    }
    const b = re(
      () => t.series && t.series.length > 0 ? t.series : [{ label: t.title ?? "", value: t.value ?? 0, activeColorOverride: t.activeColorOverride }]
    ), v = re(() => b.value.length), C = re(() => t.thresholds && t.thresholds.length > 0 ? t.thresholds : []), P = re(() => t.thresholdBaseColor ?? "#52c41a"), M = re(() => {
      const V = i.value.w, Y = i.value.h;
      return V <= 0 || Y <= 0 ? { xCount: 1, yCount: 1, cellW: 0, cellH: 0 } : t.orientation === "horizontal" ? { xCount: v.value, yCount: 1, cellW: (V - bs * (v.value - 1)) / v.value, cellH: Y } : t.orientation === "vertical" ? { xCount: 1, yCount: v.value, cellW: V, cellH: (Y - bs * (v.value - 1)) / v.value } : m(V, Y, bs, v.value);
    });
    An(() => {
      n.value && (l = new ResizeObserver((V) => {
        const Y = V[0].contentRect;
        i.value = { w: Y.width, h: Y.height };
      }), l.observe(n.value));
    }), Xi(() => {
      l?.disconnect();
    });
    const q = fe({});
    function Q() {
      zn(() => {
        for (let V = 0; V < b.value.length; V++) {
          const Y = q.value[V];
          if (!Y)
            continue;
          const A = b.value[V];
          u(
            Y,
            A.value,
            t.min,
            t.max,
            t.unit,
            C.value,
            P.value,
            t.capRound,
            t.trackWidth,
            t.fillWidth,
            t.trackColor,
            270 - t.sweepAngle / 2,
            t.sweepAngle,
            t.valueColor,
            t.valueSize,
            t.valueVisible,
            t.paddingX,
            t.paddingY,
            A.activeColorOverride ?? t.activeColorOverride,
            t.thresholdDisplay,
            t.valueOffsetY,
            t.thresholdLabelDisplay
          );
        }
      });
    }
    return Fe(() => [
      b.value,
      t.min,
      t.max,
      t.unit,
      t.thresholds,
      t.thresholdBaseColor,
      t.capRound,
      t.trackWidth,
      t.fillWidth,
      t.trackColor,
      t.sweepAngle,
      t.valueColor,
      t.valueSize,
      t.valueVisible,
      t.paddingX,
      t.paddingY,
      t.thresholdDisplay,
      t.valueOffsetY,
      t.thresholdLabelDisplay,
      i.value
    ], Q, { deep: !0, immediate: !0 }), (V, Y) => (E(), B("div", {
      ref_key: "containerRef",
      ref: n,
      style: He([{ width: "100%", height: "100%", display: "grid", gap: "2px" }, {
        gridTemplateColumns: `repeat(${M.value.xCount}, 1fr)`,
        gridTemplateRows: `repeat(${M.value.yCount}, 1fr)`
      }])
    }, [
      (E(!0), B($e, null, Xe(b.value, (A, H) => (E(), B("div", {
        key: `${A.label}-${H}`,
        style: { width: "100%", height: "100%", display: "flex", "flex-direction": "column", overflow: "hidden" }
      }, [
        y("canvas", {
          ref_for: !0,
          ref: (ee) => {
            ee && (q.value[H] = ee);
          },
          style: { flex: "1", width: "100%", height: "0", display: "block", "min-height": "0" }
        }, null, 512),
        v.value > 1 && A.label ? (E(), B("div", hx, I(A.label), 1)) : ye("", !0)
      ]))), 128))
    ], 4));
  }
}), px = /* @__PURE__ */ Me({
  __name: "HistogramPanel",
  props: {
    seriesValues: {},
    seriesLabels: {},
    bucketSize: {},
    bucketCount: {},
    bucketOffset: {},
    combineSeries: { type: Boolean, default: !1 },
    colorScheme: {},
    colorSingleValue: {},
    colorDistribution: {},
    lineWidth: { default: 1 },
    fillOpacity: { default: 80 },
    unit: {}
  },
  setup(e) {
    const t = e;
    function n(d, c) {
      const u = d.filter((Y) => Number.isFinite(Y));
      if (u.length === 0)
        return { bucketStarts: [], counts: [] };
      const p = Math.min(...u), m = Math.max(...u), b = m - p || 1, v = c.bucketOffset ?? 0, C = c.bucketCount ?? 30, P = c.bucketSize ?? b / C, M = Math.floor((p - v) / P) * P + v, q = [], Q = [];
      let V = M;
      for (; V <= m; )
        q.push(V), Q.push(0), V += P;
      for (const Y of u) {
        const A = Math.floor((Y - M) / P), H = Math.min(A, Q.length - 1);
        H >= 0 && Q[H]++;
      }
      return { bucketStarts: q, counts: Q };
    }
    function i(d, c) {
      const u = d.flat();
      return n(u, c);
    }
    const l = re(() => {
      const d = { bucketSize: t.bucketSize, bucketCount: t.bucketCount, bucketOffset: t.bucketOffset };
      if (t.combineSeries || t.seriesValues.length === 0) {
        const { bucketStarts: b, counts: v } = i(t.seriesValues, d);
        return { bucketStarts: b, countSeries: [v], labels: ["combined"] };
      }
      const c = t.seriesValues.flat(), { bucketStarts: u } = n(c, d), p = u.length > 1 ? u[1] - u[0] : void 0, m = t.seriesValues.map((b) => {
        const { counts: v } = n(b, { ...d, bucketSize: p });
        return Array.from({ length: u.length }, (C, P) => v[P] ?? 0);
      });
      return { bucketStarts: u, countSeries: m, labels: t.seriesLabels };
    }), s = re(() => ({
      timestamps: l.value.bucketStarts,
      series: l.value.labels.map((d, c) => ({
        label: d,
        values: l.value.countSeries[c] ?? []
      }))
    }));
    return (d, c) => (E(), Ce(or, {
      data: s.value,
      "fill-opacity": e.fillOpacity,
      "line-width": e.lineWidth,
      "draw-style": "bars",
      unit: e.unit,
      "color-scheme": e.colorScheme,
      "color-single-value": e.colorSingleValue,
      "color-distribution": e.colorDistribution,
      "scale-distribution": "linear",
      "show-grid-lines": "y",
      "axis-label": "y",
      "axis-tick": "hidden",
      "axis-border": "hidden",
      "tooltip-mode": "multi",
      "legend-position": !e.combineSeries && l.value.countSeries.length > 1 ? "bottom" : "hidden",
      "legend-mode": "list",
      "stacking-mode": "none",
      "x-axis-time": !1
    }, null, 8, ["data", "fill-opacity", "line-width", "unit", "color-scheme", "color-single-value", "color-distribution", "legend-position"]));
  }
}), vx = ["width", "height"], mx = ["d", "fill", "stroke", "opacity", "onMousemove"], yx = ["x", "y"], bx = ["onClick"], xx = { style: { width: "100%", "border-collapse": "collapse" } }, wx = ["onClick"], Sx = { class: "flex items-center gap-1" }, kx = {
  class: "overflow-hidden text-ellipsis whitespace-nowrap",
  style: { "max-width": "80px" }
}, Cx = { class: "flex items-center gap-1.5" }, _x = /* @__PURE__ */ Me({
  __name: "PiePanel",
  props: {
    slices: {},
    pieType: { default: "pie" },
    pieLabels: { default: () => [] },
    unit: {},
    decimals: { default: 2 },
    legendPosition: { default: "bottom" },
    legendMode: { default: "list" },
    legendValues: { default: () => [] },
    tooltipMode: { default: "single" },
    tooltipSort: { default: "none" }
  },
  setup(e) {
    const t = e, n = Pi(), i = fe(), l = fe({ width: 0, height: 0 });
    let s = null;
    An(() => {
      if (!i.value)
        return;
      s = new ResizeObserver((le) => {
        const { width: me, height: Oe } = le[0].contentRect;
        l.value = { width: Math.floor(me), height: Math.floor(Oe) };
      }), s.observe(i.value);
      const { width: ve, height: ge } = i.value.getBoundingClientRect();
      l.value = { width: Math.floor(ve), height: Math.floor(ge) };
    }), no(() => {
      s?.disconnect();
    });
    const d = re(() => n.isDark), c = re(() => d.value ? "#d9d9d9" : "#141414"), u = re(() => d.value ? "#8c8c8c" : "#595959"), p = re(() => d.value ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)"), m = re(() => d.value ? "rgba(0,0,0,0.6)" : "rgba(255,255,255,0.8)"), b = re(() => {
      const ve = t.legendValues.length > 0;
      return t.legendMode === "table" ? ve ? 120 + t.legendValues.length * 64 : 160 : 140;
    }), v = re(
      () => t.legendPosition === "bottom" ? t.legendMode === "table" ? Math.min(t.slices.length * 24 + 28, 120) : 28 : 0
    ), C = re(() => t.legendPosition === "right" ? b.value : 0), P = re(() => Math.max(l.value.width - C.value, 10)), M = re(() => Math.max(l.value.height - v.value, 10)), q = re(() => P.value / 2), Q = re(() => M.value / 2), V = re(() => Math.min(q.value, Q.value) * 0.85), Y = re(() => t.pieType === "donut" ? V.value * 0.55 : 0), A = fe(null), H = fe({ x: 0, y: 0 }), ee = fe(/* @__PURE__ */ new Set()), z = re(() => t.slices.filter((ve) => !ee.value.has(ve.label))), j = re(() => z.value.reduce((ve, ge) => ve + ge.value, 0));
    function J(ve, ge, le, me) {
      const Oe = (me - 90) * Math.PI / 180;
      return { x: ve + le * Math.cos(Oe), y: ge + le * Math.sin(Oe) };
    }
    function K(ve, ge, le, me, Oe, xe) {
      const ke = Math.min(xe - Oe, 359.9999), se = ke > 180 ? 1 : 0, oe = J(ve, ge, le, Oe), Te = J(ve, ge, le, Oe + ke);
      if (me <= 0)
        return [
          `M ${ve} ${ge}`,
          `L ${oe.x} ${oe.y}`,
          `A ${le} ${le} 0 ${se} 1 ${Te.x} ${Te.y}`,
          "Z"
        ].join(" ");
      const be = J(ve, ge, me, Oe + ke), Le = J(ve, ge, me, Oe);
      return [
        `M ${oe.x} ${oe.y}`,
        `A ${le} ${le} 0 ${se} 1 ${Te.x} ${Te.y}`,
        `L ${be.x} ${be.y}`,
        `A ${me} ${me} 0 ${se} 0 ${Le.x} ${Le.y}`,
        "Z"
      ].join(" ");
    }
    const O = re(() => {
      const ve = j.value;
      if (ve === 0 || l.value.width === 0)
        return [];
      let ge = 0;
      return z.value.map((le) => {
        const me = le.value / ve * 360, Oe = le.value / ve * 100, xe = ge;
        ge += me;
        const ke = ge, se = xe + me / 2, oe = (V.value + Y.value) / 2 || V.value * 0.65, Te = J(q.value, Q.value, oe, se), be = K(q.value, Q.value, V.value, Y.value, xe, ke);
        return { ...le, angle: me, pct: Oe, startAngle: xe, endAngle: ke, midAngle: se, labelPos: Te, path: be };
      });
    });
    function Z(ve) {
      const ge = ve.toFixed(t.decimals);
      return t.unit ? `${ge} ${t.unit}` : ge;
    }
    function U(ve, ge) {
      return ve.rawValues && ve.rawValues.length > 0 ? Mo(ve.rawValues, ge) : ve.value;
    }
    function $(ve) {
      const ge = new Set(ee.value);
      if (ge.has(ve))
        ge.delete(ve);
      else {
        if (t.slices.filter((me) => !ge.has(me.label)).length <= 1)
          return;
        ge.add(ve);
      }
      ee.value = ge;
    }
    function G(ve, ge) {
      A.value = ge;
      const le = i.value?.getBoundingClientRect();
      le && (H.value = { x: ve.clientX - le.left, y: ve.clientY - le.top });
    }
    function ue() {
      A.value = null;
    }
    const ie = re(() => {
      if (!A.value || t.tooltipMode === "none")
        return [];
      const ve = j.value;
      if (t.tooltipMode === "single") {
        const le = z.value.find((me) => me.label === A.value);
        return le ? [{ ...le, percent: ve > 0 ? le.value / ve * 100 : 0 }] : [];
      }
      let ge = z.value.map((le) => ({ ...le, percent: ve > 0 ? le.value / ve * 100 : 0 }));
      return t.tooltipSort === "desc" && (ge = [...ge].sort((le, me) => me.value - le.value)), t.tooltipSort === "asc" && (ge = [...ge].sort((le, me) => le.value - me.value)), ge;
    }), Ee = re(() => {
      const ve = t.tooltipMode === "multi" ? 180 : 140, ge = t.tooltipMode === "multi" ? ie.value.length * 22 + 32 : 72, le = Math.min(H.value.x + 14, l.value.width - ve - 4), me = Math.min(H.value.y - 8, l.value.height - ge - 4);
      return { left: Math.max(4, le), top: Math.max(4, me) };
    });
    return (ve, ge) => (E(), B("div", {
      ref_key: "containerRef",
      ref: i,
      class: "w-full h-full relative overflow-hidden",
      style: He({
        display: "flex",
        flexDirection: e.legendPosition === "bottom" ? "column" : "row"
      })
    }, [
      l.value.width > 0 ? (E(), B("svg", {
        key: 0,
        width: P.value,
        height: M.value,
        style: { "flex-shrink": "0" }
      }, [
        (E(!0), B($e, null, Xe(O.value, (le) => (E(), B("g", {
          key: le.label
        }, [
          le.angle > 0.3 ? (E(), B("path", {
            key: 0,
            d: le.path,
            fill: le.color,
            stroke: m.value,
            "stroke-width": "1.5",
            opacity: A.value && A.value !== le.label ? 0.6 : 1,
            style: { cursor: "pointer", transition: "opacity 0.15s" },
            onMousemove: (me) => G(me, le.label),
            onMouseleave: ue
          }, null, 40, mx)) : ye("", !0),
          e.pieLabels.length > 0 && le.angle > 20 ? (E(), B("text", {
            key: 1,
            x: le.labelPos.x,
            y: le.labelPos.y,
            "text-anchor": "middle",
            "dominant-baseline": "middle",
            fill: "#fff",
            "font-size": "11",
            style: { "pointer-events": "none", "user-select": "none", "text-shadow": "0 1px 2px rgba(0,0,0,0.6)" }
          }, I([
            e.pieLabels.includes("name") ? le.label : null,
            e.pieLabels.includes("percent") ? `${le.pct.toFixed(1)}%` : null,
            e.pieLabels.includes("value") ? Z(le.value) : null
          ].filter(Boolean).join(" ")), 9, yx)) : ye("", !0)
        ]))), 128))
      ], 8, vx)) : ye("", !0),
      e.legendPosition !== "hidden" && e.legendMode === "list" ? (E(), B("div", {
        key: 1,
        style: He({
          display: "flex",
          flexDirection: e.legendPosition === "bottom" ? "row" : "column",
          flexWrap: "wrap",
          alignItems: e.legendPosition === "bottom" ? "center" : "flex-start",
          justifyContent: e.legendPosition === "bottom" ? "center" : "flex-start",
          gap: "4px 12px",
          padding: e.legendPosition === "right" ? "8px 4px" : "2px 8px",
          overflowY: e.legendPosition === "right" ? "auto" : "hidden",
          width: e.legendPosition === "right" ? `${C.value}px` : void 0,
          height: e.legendPosition === "bottom" ? `${v.value}px` : void 0
        })
      }, [
        (E(!0), B($e, null, Xe(e.slices, (le) => (E(), B("div", {
          key: le.label,
          class: "flex items-center gap-1 text-xs whitespace-nowrap cursor-pointer select-none",
          style: He({
            color: c.value,
            opacity: ee.value.has(le.label) ? 0.35 : 1,
            textDecoration: ee.value.has(le.label) ? "line-through" : "none"
          }),
          onClick: (me) => $(le.label)
        }, [
          y("span", {
            class: "inline-block w-2 h-2 rounded-sm flex-shrink-0",
            style: He({ background: le.color })
          }, null, 4),
          y("span", null, I(le.label), 1),
          e.legendValues.length > 0 ? (E(), B("span", {
            key: 0,
            class: "ml-1",
            style: He({ color: u.value })
          }, I(e.legendValues.map((me) => Z(U(le, me))).join(" / ")), 5)) : ye("", !0)
        ], 12, bx))), 128))
      ], 4)) : ye("", !0),
      e.legendPosition !== "hidden" && e.legendMode === "table" ? (E(), B("div", {
        key: 2,
        style: He({
          width: e.legendPosition === "right" ? `${C.value}px` : void 0,
          height: e.legendPosition === "bottom" ? `${v.value}px` : void 0,
          overflowY: "auto",
          flexShrink: 0,
          fontSize: "11px"
        })
      }, [
        y("table", xx, [
          y("thead", null, [
            y("tr", null, [
              y("th", {
                style: He({ textAlign: "left", padding: "2px 6px", color: u.value, fontWeight: 500, borderBottom: `1px solid ${p.value}` })
              }, " Name ", 4),
              y("th", {
                style: He({ textAlign: "right", padding: "2px 6px", color: u.value, fontWeight: 500, borderBottom: `1px solid ${p.value}` })
              }, " Value ", 4),
              (E(!0), B($e, null, Xe(e.legendValues, (le) => (E(), B("th", {
                key: le,
                style: He({ textAlign: "right", padding: "2px 6px", color: u.value, fontWeight: 500, borderBottom: `1px solid ${p.value}`, minWidth: "56px" })
              }, I(le.charAt(0).toUpperCase() + le.slice(1)), 5))), 128))
            ])
          ]),
          y("tbody", null, [
            (E(!0), B($e, null, Xe(e.slices, (le) => (E(), B("tr", {
              key: le.label,
              class: "cursor-pointer select-none",
              style: He({ opacity: ee.value.has(le.label) ? 0.35 : 1 }),
              onClick: (me) => $(le.label)
            }, [
              y("td", {
                style: He({ padding: "2px 6px", color: c.value })
              }, [
                y("div", Sx, [
                  y("span", {
                    class: "inline-block w-2 h-2 rounded-sm flex-shrink-0",
                    style: He({ background: le.color })
                  }, null, 4),
                  y("span", kx, I(le.label), 1)
                ])
              ], 4),
              y("td", {
                style: He({ textAlign: "right", padding: "2px 6px", color: c.value, fontVariantNumeric: "tabular-nums" })
              }, I(Z(le.value)), 5),
              (E(!0), B($e, null, Xe(e.legendValues, (me) => (E(), B("td", {
                key: me,
                style: He({ textAlign: "right", padding: "2px 6px", color: u.value, fontVariantNumeric: "tabular-nums" })
              }, I(Z(U(le, me))), 5))), 128))
            ], 12, wx))), 128))
          ])
        ])
      ], 4)) : ye("", !0),
      A.value && e.tooltipMode !== "none" && ie.value.length > 0 ? (E(), B("div", {
        key: 3,
        class: "absolute z-50 pointer-events-none rounded shadow-lg text-xs",
        style: He({
          left: `${Ee.value.left}px`,
          top: `${Ee.value.top}px`,
          background: d.value ? "#1f1f1f" : "#fff",
          border: d.value ? "1px solid #333" : "1px solid #e8e8e8",
          minWidth: "140px"
        })
      }, [
        y("div", {
          class: "px-2 pt-1.5 pb-0 text-xs font-medium",
          style: He({ color: d.value ? "#d9d9d9" : "#141414" })
        }, I(e.tooltipMode === "multi" ? `${Z(j.value)} total` : ie.value[0]?.label), 5),
        y("div", {
          class: "border-t my-1",
          style: He({ borderColor: d.value ? "#333" : "#e8e8e8" })
        }, null, 4),
        (E(!0), B($e, null, Xe(ie.value, (le) => (E(), B("div", {
          key: le.label,
          class: "px-2 py-0.5 flex items-center justify-between gap-2"
        }, [
          y("div", Cx, [
            y("span", {
              class: "inline-block w-2 h-2 rounded-sm",
              style: He({ background: le.color })
            }, null, 4),
            y("span", {
              style: He({ color: d.value ? "#d9d9d9" : "#141414" })
            }, I(e.tooltipMode === "multi" ? le.label : `${le.percent.toFixed(1)}%`), 5)
          ]),
          y("span", {
            class: "font-mono",
            style: He({ color: le.color })
          }, I(Z(le.value)), 5)
        ]))), 128))
      ], 4)) : ye("", !0)
    ], 4));
  }
}), ma = 36, ul = 1.2, Zu = 1, Mx = /* @__PURE__ */ Me({
  __name: "StatPanel",
  props: {
    title: {},
    unit: {},
    series: {},
    trend: {},
    thresholds: {},
    thresholdBaseColor: {},
    orientation: {},
    textMode: {},
    colorMode: {}
  },
  setup(e) {
    const t = e, n = Pi(), i = fe(), l = fe({ w: 0, h: 0 });
    let s = null;
    const d = ["#1677ff", "#52c41a", "#fa8c16", "#f5222d", "#722ed1", "#13c2c2", "#eb2f96", "#faad14"];
    function c(A) {
      return A >= 1e6 ? `${(A / 1e6).toFixed(1)}M` : A >= 1e3 ? `${(A / 1e3).toFixed(1)}K` : A % 1 === 0 ? String(A) : A.toFixed(1);
    }
    function u(A, H, ee, z) {
      const j = ee ?? z ?? d[0];
      if (H && H.length > 0) {
        let J = j;
        for (const K of H)
          A >= K.value && (J = K.color);
        return J;
      }
      return j;
    }
    function p(A, H) {
      if (A.startsWith("rgb("))
        return A.replace("rgb(", "rgba(").replace(")", `, ${H})`);
      if (A.startsWith("rgba("))
        return A.replace(/,\s*[\d.]+\)$/, `, ${H})`);
      const ee = A.replace("#", ""), z = ee.length === 3 ? ee.split("").map((O) => O + O).join("") : ee.slice(0, 6), j = Number.parseInt(z.slice(0, 2), 16), J = Number.parseInt(z.slice(2, 4), 16), K = Number.parseInt(z.slice(4, 6), 16);
      return `rgba(${j}, ${J}, ${K}, ${H})`;
    }
    function m(A, H, ee) {
      switch (H) {
        case "background_solid":
          return Ne(A).toString();
        case "background": {
          const z = ee ? 1 : -0.7, j = Ne(A).darken(15 * z).spin(8).toRgbString(), J = Ne(A).darken(5 * z).spin(-8).toRgbString();
          return `linear-gradient(120deg, ${j}, ${J})`;
        }
        default:
          return "transparent";
      }
    }
    function b(A) {
      return Ne(A).isLight() ? "#1a1a1a" : "#ffffff";
    }
    function v(A, H, ee) {
      if (A === 0 || H === 0)
        return { isWide: !1, showSparkline: !1, valueFontSize: 24, titleFontSize: 12, chartHeight: 0, padding: 8 };
      const z = H > 100 ? 12 : 8, j = A - z * 2, J = H - z * 2, K = A / H > 2.5, O = ee && (K ? H > 50 : H > 100), Z = Math.max(10, Math.min(13, J * (K ? 0.22 : 0.18)));
      let U, $ = 0;
      if (K)
        U = O ? Math.min(J * 0.62, j * 0.42, ma) : Math.min(J * 0.7, j * 0.38, ma), O && ($ = H * 0.5);
      else {
        const G = Z * ul;
        U = Math.min(O ? (J - G) * 0.65 : (J - G) * 0.85, j * 0.9, ma), O && ($ = Math.max(0, Math.min(H - Z * ul - U * ul - z, H * 0.5)));
      }
      return {
        isWide: K,
        showSparkline: O,
        valueFontSize: Math.max(11, U),
        titleFontSize: Z,
        chartHeight: $,
        padding: z
      };
    }
    function C(A, H, ee) {
      const z = Math.ceil(Math.sqrt(ee * A / H));
      return Math.floor(z * H / A) * z < ee ? H / Math.ceil(z * H / A) : A / z;
    }
    function P(A, H, ee, z) {
      const j = Math.max(C(A, H, z), C(H, A, z));
      let J = Math.max(1, Math.floor(A / j));
      const K = Math.ceil(z / J);
      return J = Math.ceil(z / K), {
        xCount: J,
        yCount: K,
        cellW: A / J - ee + ee / J,
        cellH: H / K - ee + ee / K
      };
    }
    function M(A, H, ee) {
      const z = A.getContext("2d");
      if (!z)
        return;
      const j = window.devicePixelRatio || 1, J = A.getBoundingClientRect();
      if (J.width === 0 || J.height === 0)
        return;
      A.width = J.width * j, A.height = J.height * j, z.scale(j, j);
      const K = J.width, O = J.height, Z = Math.min(...H), $ = Math.max(...H) - Z || 1;
      z.clearRect(0, 0, K, O);
      const G = z.createLinearGradient(0, 0, 0, O);
      G.addColorStop(0, p(ee, 0.25)), G.addColorStop(1, p(ee, 0));
      const ue = H.map((ie, Ee) => ({
        x: Ee / (H.length - 1) * K,
        y: O - 2 - (ie - Z) / $ * (O - 4)
      }));
      z.beginPath(), ue.forEach(({ x: ie, y: Ee }, ve) => ve === 0 ? z.moveTo(ie, Ee) : z.lineTo(ie, Ee)), z.lineTo(K, O), z.lineTo(0, O), z.fillStyle = G, z.fill(), z.beginPath(), ue.forEach(({ x: ie, y: Ee }, ve) => ve === 0 ? z.moveTo(ie, Ee) : z.lineTo(ie, Ee)), z.strokeStyle = ee, z.lineWidth = 1.5, z.stroke();
    }
    const q = re(() => Math.max(t.series.length, 1)), Q = re(() => {
      const A = l.value.w, H = l.value.h;
      return A <= 0 || H <= 0 ? { xCount: 1, yCount: 1, cellW: 0, cellH: 0 } : t.orientation === "horizontal" ? { xCount: 1, yCount: q.value, cellW: A, cellH: (H - Zu * (q.value - 1)) / q.value } : P(A, H, Zu, q.value);
    }), V = re(() => n.isDark ? "#303030" : "#fff");
    An(() => {
      i.value && (s = new ResizeObserver((A) => {
        const H = A[0].contentRect;
        (l.value.w !== H.width || l.value.h !== H.height) && (l.value = { w: H.width, h: H.height });
      }), s.observe(i.value));
    }), Xi(() => {
      s?.disconnect();
    });
    const Y = Me({
      props: {
        label: String,
        value: Number,
        unit: String,
        mappedLabel: String,
        sparkline: Array,
        percentChange: [Number, null],
        textMode: { type: String, default: "value_and_name" },
        colorMode: String,
        color: String,
        width: Number,
        height: Number
      },
      setup(A) {
        const H = fe(), ee = Pi();
        function z() {
          zn(() => {
            H.value && A.sparkline && A.sparkline.length > 1 && M(H.value, A.sparkline, A.color ?? "#1677ff");
          });
        }
        return Fe(() => [A.sparkline, A.color, A.width, A.height], z, { immediate: !0 }), () => {
          const j = A, J = ee.isDark, K = j.sparkline != null && j.sparkline.length > 1, O = v(j.width ?? 0, j.height ?? 0, K), Z = j.textMode === "value_and_name" || j.textMode === "name", U = j.textMode === "value_and_name" || j.textMode === "value", $ = Math.max(10, O.valueFontSize * 0.44), G = j.colorMode === "background_solid" || j.colorMode === "background", ue = G ? m(j.color ?? "#1677ff", j.colorMode ?? "value", J) : "transparent", ie = G ? b(j.color ?? "#1677ff") : j.color ?? "#d9d9d9", Ee = G ? ie : "#888", ve = G ? ie : "#666", ge = j.percentChange != null ? (j.percentChange > 0 ? "+" : "") + j.percentChange.toLocaleString(void 0, { style: "percent", minimumFractionDigits: 1, maximumFractionDigits: 2 }) : null, le = j.percentChange != null ? j.percentChange > 0 ? "#52c41a" : j.percentChange < 0 ? "#ff4d4f" : "#888" : "", me = j.percentChange != null ? j.percentChange > 0 ? "↑" : j.percentChange < 0 ? "↓" : "" : "", Oe = j.mappedLabel ?? c(j.value ?? 0), xe = [
            Tn("span", {
              style: {
                color: ie,
                fontSize: `${O.valueFontSize}px`,
                fontWeight: 500,
                fontFamily: "monospace",
                lineHeight: ul
              }
            }, Oe)
          ];
          j.mappedLabel || xe.push(Tn("span", {
            style: { color: ve, fontSize: `${$}px`, lineHeight: ul }
          }, j.unit)), ge && xe.push(Tn("span", {
            style: { color: le, fontSize: `${$}px`, marginLeft: "2px", lineHeight: ul }
          }, `${me}${ge}`));
          const ke = Z ? Tn("div", {
            style: {
              color: Ee,
              fontSize: `${O.titleFontSize}px`,
              lineHeight: ul,
              ...O.isWide ? { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } : { marginBottom: "2px" }
            }
          }, j.label) : null, se = U ? Tn("div", {
            style: {
              display: "flex",
              alignItems: "baseline",
              gap: O.isWide ? "3px" : "4px",
              flexWrap: "wrap"
            }
          }, xe) : null, oe = Tn("div", {
            style: O.isWide ? { flex: 1, minWidth: 0, position: "relative", zIndex: 1 } : { position: "relative", zIndex: 1 }
          }, [ke, se]), Te = O.showSparkline ? Tn("canvas", {
            ref: (Le) => {
              H.value = Le;
            },
            style: O.isWide ? { position: "absolute", right: 0, bottom: 0, left: 0, width: "100%", height: `${O.chartHeight}px`, opacity: 0.7 } : { position: "absolute", bottom: 0, left: 0, right: 0, width: "100%", height: `${O.chartHeight}px`, opacity: 0.6 }
          }) : null, be = O.isWide ? {
            width: "100%",
            height: "100%",
            display: "flex",
            alignItems: "center",
            padding: `0 ${O.padding}px`,
            gap: "8px",
            overflow: "hidden",
            position: "relative",
            background: ue
          } : {
            width: "100%",
            height: "100%",
            display: "flex",
            flexDirection: "column",
            justifyContent: "center",
            padding: `${O.padding}px`,
            overflow: "hidden",
            position: "relative",
            background: ue
          };
          return Tn("div", { style: be }, O.isWide ? [Te, oe] : [Te, oe]);
        };
      }
    });
    return (A, H) => (E(), B("div", {
      ref_key: "containerRef",
      ref: i,
      style: He([{ width: "100%", height: "100%", display: "grid", gap: "1px" }, {
        gridTemplateColumns: e.orientation === "horizontal" ? "1fr" : `repeat(${Q.value.xCount}, 1fr)`,
        gridTemplateRows: e.orientation === "horizontal" ? `repeat(${q.value}, 1fr)` : `repeat(${Q.value.yCount}, 1fr)`,
        background: V.value
      }])
    }, [
      (E(!0), B($e, null, Xe(e.series, (ee, z) => (E(), Ce(f(Y), {
        key: `${ee.label}-${z}`,
        label: q.value === 1 ? e.title : ee.label,
        value: ee.displayValue ?? (ee.values.length > 0 ? ee.values[ee.values.length - 1] ?? 0 : 0),
        unit: ee.units ?? e.unit,
        "mapped-label": ee.valueMap !== void 0 ? ee.valueMap[String(ee.displayValue ?? (ee.values.length > 0 ? ee.values[ee.values.length - 1] ?? 0 : 0))] : void 0,
        sparkline: ee.values.length > 1 ? ee.values : void 0,
        "percent-change": ee.percentChange,
        "text-mode": e.textMode,
        "color-mode": e.colorMode,
        color: u(
          ee.displayValue ?? ee.values[ee.values.length - 1] ?? 0,
          e.thresholds,
          e.thresholdBaseColor,
          d[z % d.length]
        ),
        width: Q.value.cellW,
        height: Q.value.cellH
      }, null, 8, ["label", "value", "unit", "mapped-label", "sparkline", "percent-change", "text-mode", "color-mode", "color", "width", "height"]))), 128))
    ], 4));
  }
}), zx = {
  key: 0,
  class: "flex-center h-full text-secondary"
}, Tx = {
  key: 1,
  class: "flex-center h-full"
}, Px = {
  key: 2,
  class: "flex-center h-full text-red-500 text-xs"
}, $x = {
  key: 3,
  class: "w-full h-full relative"
}, Ex = {
  key: 0,
  class: "absolute inset-0 z-10 flex items-center justify-center",
  style: { "backdrop-filter": "blur(1px)", "border-radius": "4px" }
}, Ix = {
  key: 0,
  class: "w-full h-full"
}, Ax = {
  key: 0,
  class: "w-full h-full overflow-auto"
}, Fs = /* @__PURE__ */ Me({
  __name: "PanelRenderer",
  props: {
    panelId: {},
    panelConfig: { default: void 0 }
  },
  setup(e) {
    const t = e, n = hi(), { t: i } = nt(), l = re(() => t.panelConfig ?? n.panels[t.panelId]), s = fe(!1), d = fe(null), c = fe(null), u = fe(null), p = fe(null), m = fe(null), b = fe(null), v = fe(null);
    let C = null;
    const P = fe(null), M = ["#1677ff", "#52c41a", "#fa8c16", "#f5222d", "#722ed1", "#13c2c2", "#eb2f96", "#faad14"];
    function q(A, H) {
      Q();
      const ee = A.seriesCount ?? 1, z = Bl(
        { from: H.from / 1e3, to: H.to / 1e3 },
        15,
        ee,
        A.pattern,
        A.labels
      ), j = Array.from({ length: ee }, (K, O) => 20 + (O * 37 + 13) % 60), J = Array.from({ length: ee }, (K, O) => 10 + (O * 53 + 7) % 40);
      P.value = {
        timestamps: [...z.timestamps],
        seriesValues: z.series.map((K) => [...K.values])
      }, C = setInterval(() => {
        const K = P.value;
        if (!K)
          return;
        const O = Math.floor(Date.now() / 1e3), Z = [...K.timestamps.slice(1), O], U = K.seriesValues.map(($, G) => {
          const ue = $[$.length - 1], ie = Rf(ue, j[G], J[G] * 0.1, J[G] + j[G] * 1.8);
          return [...$.slice(1), ie];
        });
        P.value = { timestamps: Z, seriesValues: U };
      }, 1e3);
    }
    function Q() {
      C && (clearInterval(C), C = null), P.value = null;
    }
    Xi(Q);
    async function V() {
      const A = l.value;
      if (A) {
        s.value = !0, d.value = null, Q();
        try {
          const H = A.queries.filter((K) => K.enabled !== !1).map((K) => K.dataSource).filter((K) => !!K && K.type === "mock");
          if (H.length === 0)
            return;
          const ee = n.timeRange, z = { from: ee.from / 1e3, to: ee.to / 1e3 }, j = H[0];
          if (j.pattern === "live") {
            q(j, ee);
            return;
          }
          if (A.type === "timeseries" || A.type === "bar") {
            const K = H.map(
              (Z) => Bl(z, 15, Z.seriesCount ?? 1, Z.pattern, Z.labels)
            ), O = {
              timestamps: K[0].timestamps,
              series: K.flatMap((Z) => Z.series)
            };
            A.type === "timeseries" ? c.value = O : u.value = O;
            return;
          }
          if (A.type === "histogram") {
            const K = H.map(
              (O) => Bl(z, 15, O.seriesCount ?? 1, O.pattern, O.labels)
            );
            v.value = {
              seriesValues: K.flatMap((O) => O.series.map((Z) => Z.values)),
              seriesLabels: K.flatMap((O) => O.series.map((Z) => Z.label))
            };
            return;
          }
          const J = await Promise.all(
            H.map(async (K) => Bl(z, 15, 1, K.pattern, K.labels).series[0] ?? { label: K.metric || "series", values: [] })
          );
          if (A.type === "stat" || A.type === "gauge")
            p.value = {
              value: J[0]?.values[J[0].values.length - 1] ?? 0,
              values: J.map((K) => K.values[K.values.length - 1] ?? 0),
              series: J.map((K) => ({
                label: K.label,
                values: K.values,
                displayValue: Mo(K.values, A.statReducer ?? "lastNotNull"),
                percentChange: A.showPercentChange ? aa(K.values) : void 0
              })),
              unit: A.unit ?? A.statUnit ?? "",
              trend: A.statTrend ?? "flat",
              percentChange: A.showPercentChange ? aa(J[0]?.values ?? []) : void 0
            };
          else if (A.type === "pie")
            b.value = J.map((K, O) => ({
              label: K.label,
              value: Mo(K.values, A.statReducer ?? "lastNotNull"),
              color: M[O % M.length],
              rawValues: K.values
            }));
          else if (A.type === "table") {
            const K = Bl(z, 15, j.seriesCount ?? 1, j.pattern, j.labels);
            m.value = {
              columns: [
                { key: "time", title: "Time", dataIndex: "time" },
                ...K.series.map((O) => ({ key: O.label, title: O.label, dataIndex: O.label }))
              ],
              dataSource: K.timestamps.map((O, Z) => {
                const U = { time: new Date(O * 1e3).toLocaleString(), key: Z };
                return K.series.forEach(($) => {
                  U[$.label] = $.values[Z];
                }), U;
              })
            };
          }
        } catch (H) {
          d.value = H?.message ?? String(H);
        } finally {
          s.value = !1;
        }
      }
    }
    Fe(P, (A) => {
      if (!A)
        return;
      const H = l.value;
      H && (H.type === "timeseries" ? c.value = {
        timestamps: A.timestamps,
        series: A.seriesValues.map((ee, z) => ({
          label: `series-${z}`,
          values: ee
        }))
      } : H.type === "stat" || H.type === "gauge" ? p.value = {
        value: A.seriesValues[0]?.[A.seriesValues[0].length - 1] ?? 0,
        values: A.seriesValues.map((ee) => ee[ee.length - 1] ?? 0),
        series: A.seriesValues.map((ee, z) => ({
          label: `series-${z}`,
          values: ee,
          displayValue: Mo(ee, H.statReducer ?? "lastNotNull"),
          percentChange: H.showPercentChange ? aa(ee) : void 0
        })),
        unit: H.statUnit ?? "",
        trend: H.statTrend ?? "flat",
        percentChange: H.showPercentChange ? aa(A.seriesValues[0] ?? []) : void 0
      } : H.type === "pie" ? b.value = A.seriesValues.map((ee, z) => ({
        label: `series-${z}`,
        value: Mo(ee, H.statReducer ?? "lastNotNull"),
        color: M[z % M.length],
        rawValues: ee
      })) : H.type === "histogram" && (v.value = {
        seriesValues: A.seriesValues,
        seriesLabels: A.seriesValues.map((ee, z) => `series-${z}`)
      }));
    }, { deep: !0 }), Fe(() => n.panelRefreshKeys[t.panelId], V, { immediate: !0 }), Fe(() => n.timeRange, V, { deep: !0 });
    const Y = Me({
      name: "NoDataPlaceholder",
      setup() {
        const { t: A } = nt();
        return () => Tn("div", { class: "flex flex-col items-center justify-center h-full gap-1.5 text-gray-400 select-none" }, [
          Tn("span", { class: [ze.databaseOff, "text-7", "opacity-50"] }),
          Tn("span", { class: "text-xs" }, A("panel.noData"))
        ]);
      }
    });
    return (A, H) => {
      const ee = ot("a-table");
      return l.value ? s.value && !P.value ? (E(), B("div", Tx, [
        k(f(Zn))
      ])) : d.value ? (E(), B("div", Px, I(d.value), 1)) : (E(), B("div", $x, [
        s.value && P.value ? (E(), B("div", Ex, [
          k(f(Zn))
        ])) : ye("", !0),
        l.value.type === "timeseries" ? (E(), B($e, { key: 1 }, [
          c.value && c.value.series.length > 0 ? (E(), B("div", Ix, [
            k(or, {
              data: c.value,
              unit: l.value.unit,
              decimals: l.value.decimals,
              "color-scheme": l.value.colorScheme,
              "color-single-value": l.value.colorSingleValue,
              "color-distribution": l.value.colorDistribution,
              thresholds: l.value.thresholds,
              "threshold-base-color": l.value.thresholdBaseColor,
              "fill-opacity": l.value.fillOpacity,
              "line-width": l.value.lineWidth,
              "line-interpolation": l.value.lineInterpolation,
              "line-style": l.value.lineStyle,
              "draw-style": l.value.drawStyle,
              "gradient-mode": l.value.gradientMode,
              "span-nulls": l.value.spanNulls,
              "show-points": l.value.showPoints,
              "show-points-mode": l.value.showPointsMode,
              "stacking-mode": l.value.stackingMode,
              "legend-position": l.value.legendPosition,
              "legend-mode": l.value.legendMode,
              "legend-values": l.value.legendValues,
              "panel-id": l.value.id,
              "tooltip-mode": l.value.tooltipMode,
              "tooltip-sort": l.value.tooltipSort,
              "tooltip-max-height": l.value.tooltipMaxHeight,
              "show-axis-pointer": l.value.showAxisPointer,
              "soft-min": l.value.softMin,
              "soft-max": l.value.softMax,
              "axis-placement": l.value.axisPlacement,
              "axis-name": l.value.axisName,
              "axis-width": l.value.axisWidth,
              "show-grid-lines": l.value.showGridLines,
              "grid-color": l.value.gridColor,
              "axis-label": l.value.axisLabel,
              "axis-label-color": l.value.axisLabelColor,
              "axis-tick": l.value.axisTick,
              "axis-tick-color": l.value.axisTickColor,
              "axis-border": l.value.axisBorder,
              "axis-border-color": l.value.axisBorderColor,
              "scale-distribution": l.value.scaleDistribution,
              "centered-zero": l.value.centeredZero
            }, null, 8, ["data", "unit", "decimals", "color-scheme", "color-single-value", "color-distribution", "thresholds", "threshold-base-color", "fill-opacity", "line-width", "line-interpolation", "line-style", "draw-style", "gradient-mode", "span-nulls", "show-points", "show-points-mode", "stacking-mode", "legend-position", "legend-mode", "legend-values", "panel-id", "tooltip-mode", "tooltip-sort", "tooltip-max-height", "show-axis-pointer", "soft-min", "soft-max", "axis-placement", "axis-name", "axis-width", "show-grid-lines", "grid-color", "axis-label", "axis-label-color", "axis-tick", "axis-tick-color", "axis-border", "axis-border-color", "scale-distribution", "centered-zero"])
          ])) : (E(), Ce(f(Y), { key: 1 }))
        ], 64)) : l.value.type === "bar" ? (E(), B($e, { key: 2 }, [
          u.value && u.value.series.length > 0 ? (E(), Ce(fx, {
            key: 0,
            data: u.value,
            stacked: l.value.stacked,
            "bar-width": l.value.barWidth,
            "bar-group-width": l.value.barGroupWidth,
            "show-values": l.value.barShowValues,
            unit: l.value.unit,
            decimals: l.value.decimals,
            "color-scheme": l.value.colorScheme,
            "color-single-value": l.value.colorSingleValue,
            "color-distribution": l.value.colorDistribution,
            "legend-position": l.value.legendPosition,
            "legend-mode": l.value.legendMode,
            "legend-values": l.value.legendValues,
            "tooltip-mode": l.value.tooltipMode,
            "tooltip-sort": l.value.tooltipSort
          }, null, 8, ["data", "stacked", "bar-width", "bar-group-width", "show-values", "unit", "decimals", "color-scheme", "color-single-value", "color-distribution", "legend-position", "legend-mode", "legend-values", "tooltip-mode", "tooltip-sort"])) : (E(), Ce(f(Y), { key: 1 }))
        ], 64)) : l.value.type === "stat" ? (E(), B($e, { key: 3 }, [
          p.value ? (E(), Ce(Mx, {
            key: 0,
            title: l.value.title,
            unit: p.value.unit,
            series: p.value.series,
            trend: p.value.trend,
            thresholds: l.value.thresholds,
            "threshold-base-color": l.value.thresholdBaseColor,
            orientation: l.value.statOrientation,
            "text-mode": l.value.statTextMode,
            "color-mode": l.value.statColorMode
          }, null, 8, ["title", "unit", "series", "trend", "thresholds", "threshold-base-color", "orientation", "text-mode", "color-mode"])) : (E(), Ce(f(Y), { key: 1 }))
        ], 64)) : l.value.type === "gauge" ? (E(), B($e, { key: 4 }, [
          p.value ? (E(), Ce(gx, {
            key: 0,
            series: p.value.series.map((z, j) => ({
              label: z.label,
              value: z.displayValue ?? z.values[z.values.length - 1] ?? 0,
              activeColorOverride: M[j % M.length]
            })),
            title: l.value.title,
            min: l.value.min ?? 0,
            max: l.value.max ?? 100,
            unit: l.value.unit,
            thresholds: l.value.thresholds,
            "threshold-base-color": l.value.thresholdBaseColor,
            "cap-round": l.value.gaugeCapRound,
            "track-width": l.value.gaugeTrackWidth,
            "fill-width": l.value.gaugeFillWidth,
            "track-color": l.value.gaugeTrackColor,
            "sweep-angle": l.value.sweepAngle,
            "value-color": l.value.gaugeValueColor,
            "value-size": l.value.gaugeValueSize,
            "value-visible": l.value.gaugeValueVisible,
            "padding-x": l.value.gaugePaddingX,
            "padding-y": l.value.gaugePaddingY,
            "threshold-display": l.value.gaugeThresholdDisplay,
            "threshold-label-display": l.value.gaugeThresholdLabelDisplay,
            "value-offset-y": l.value.gaugeValueOffsetY,
            orientation: l.value.gaugeOrientation
          }, null, 8, ["series", "title", "min", "max", "unit", "thresholds", "threshold-base-color", "cap-round", "track-width", "fill-width", "track-color", "sweep-angle", "value-color", "value-size", "value-visible", "padding-x", "padding-y", "threshold-display", "threshold-label-display", "value-offset-y", "orientation"])) : (E(), Ce(f(Y), { key: 1 }))
        ], 64)) : l.value.type === "table" ? (E(), B($e, { key: 5 }, [
          m.value ? (E(), B("div", Ax, [
            k(ee, {
              columns: m.value.columns,
              "data-source": m.value.dataSource,
              pagination: { pageSize: l.value.tablePageSize ?? 20 },
              size: "small",
              scroll: { y: "100%" },
              "show-header": l.value.tableShowHeader !== !1
            }, null, 8, ["columns", "data-source", "pagination", "show-header"])
          ])) : (E(), Ce(f(Y), { key: 1 }))
        ], 64)) : l.value.type === "pie" ? (E(), B($e, { key: 6 }, [
          b.value && b.value.length > 0 ? (E(), Ce(_x, {
            key: 0,
            slices: b.value,
            "pie-type": l.value.pieType,
            "pie-labels": l.value.pieLabels,
            unit: l.value.unit,
            decimals: l.value.decimals,
            "legend-position": l.value.legendPosition,
            "legend-mode": l.value.legendMode,
            "legend-values": l.value.legendValues,
            "tooltip-mode": l.value.tooltipMode,
            "tooltip-sort": l.value.tooltipSort
          }, null, 8, ["slices", "pie-type", "pie-labels", "unit", "decimals", "legend-position", "legend-mode", "legend-values", "tooltip-mode", "tooltip-sort"])) : (E(), Ce(f(Y), { key: 1 }))
        ], 64)) : l.value.type === "histogram" ? (E(), B($e, { key: 7 }, [
          v.value && v.value.seriesValues.length > 0 ? (E(), Ce(px, {
            key: 0,
            "series-values": v.value.seriesValues,
            "series-labels": v.value.seriesLabels,
            "bucket-size": l.value.histBucketSize,
            "bucket-count": l.value.histBucketCount,
            "bucket-offset": l.value.histBucketOffset,
            "combine-series": l.value.histCombineSeries,
            "line-width": l.value.lineWidth,
            "fill-opacity": l.value.fillOpacity,
            unit: l.value.unit
          }, null, 8, ["series-values", "series-labels", "bucket-size", "bucket-count", "bucket-offset", "combine-series", "line-width", "fill-opacity", "unit"])) : (E(), Ce(f(Y), { key: 1 }))
        ], 64)) : ye("", !0)
      ])) : (E(), B("div", zx, I(f(i)("panel.noData")), 1));
    };
  }
}), Ox = { class: "w-full h-full flex flex-col" }, Dx = { class: "flex-1 min-h-0" }, Lx = {
  key: 1,
  class: "flex-center h-full text-secondary text-sm"
}, qx = /* @__PURE__ */ Me({
  __name: "ChartPreview",
  setup(e) {
    const { panel: t } = ao(), n = re(() => {
      const i = t.value;
      return [
        i.type,
        JSON.stringify(i.queries),
        i.colorScheme,
        i.statReducer,
        i.unit,
        i.decimals,
        i.lineWidth,
        i.fillOpacity,
        i.stacked,
        i.thresholds?.length,
        i.sweepAngle
      ].join("|");
    });
    return (i, l) => (E(), B("div", Ox, [
      y("div", Dx, [
        f(t).id ? (E(), Ce(Fs, {
          key: n.value,
          "panel-id": f(t).id,
          "panel-config": f(t)
        }, null, 8, ["panel-id", "panel-config"])) : (E(), B("div", Lx, " No preview available "))
      ])
    ]));
  }
}), Rx = { class: "w-full h-full flex flex-col" }, Nx = { class: "flex-1 min-h-0" }, Vx = /* @__PURE__ */ Me({
  __name: "PanelChrome",
  setup(e) {
    const t = Pi(), { panel: n } = ao(), i = re(() => t.isDark), l = re(() => i.value ? "#303030" : "#e8e8e8"), s = re(() => i.value ? "#d9d9d9" : "#141414"), d = re(() => i.value ? "#666" : "#bbb");
    return (c, u) => (E(), B("div", Rx, [
      y("div", {
        class: "flex items-center px-2.5 py-1.5 flex-shrink-0 gap-1.5 h-32px",
        style: He({ borderBottom: `1px solid ${l.value}` })
      }, [
        y("span", {
          class: "text-xs font-medium truncate",
          style: He({ color: s.value })
        }, I(f(n).title || "—"), 5),
        f(n).description ? (E(), Ce(f($n), {
          key: 0,
          title: f(n).description,
          placement: "bottom"
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).info, "text-xs"]),
              style: He({ color: d.value })
            }, null, 6)
          ]),
          _: 1
        }, 8, ["title"])) : ye("", !0),
        k(Ad, {
          links: f(n).links ?? [],
          "icon-color": d.value
        }, null, 8, ["links", "icon-color"])
      ], 4),
      y("div", Nx, [
        k(qx)
      ])
    ]));
  }
}), Ld = /* @__PURE__ */ Me({
  __name: "TimeRangePicker",
  setup(e) {
    const { RangePicker: t } = Ud, n = hi(), i = [
      { label: "最近 5 分钟", minutes: 5 },
      { label: "最近 15 分钟", minutes: 15 },
      { label: "最近 30 分钟", minutes: 30 },
      { label: "最近 1 小时", minutes: 60 },
      { label: "最近 3 小时", minutes: 180 },
      { label: "最近 6 小时", minutes: 360 },
      { label: "最近 12 小时", minutes: 720 },
      { label: "最近 24 小时", minutes: 1440 },
      { label: "最近 7 天", minutes: 10080 },
      { label: "最近 30 天", minutes: 43200 },
      { label: "最近 90 天", minutes: 129600 }
    ], l = [
      { label: "关闭", value: 0 },
      { label: "5 秒", value: 5 },
      { label: "10 秒", value: 10 },
      { label: "30 秒", value: 30 },
      { label: "1 分钟", value: 60 },
      { label: "5 分钟", value: 300 }
    ], s = fe(!1), d = Math.round((n.timeRange.to - n.timeRange.from) / 6e4), c = i.find((m) => m.minutes === d);
    function u(m) {
      const b = Date.now();
      n.setTimeRange({ from: b - m * 60 * 1e3, to: b }), s.value = !1;
    }
    function p() {
      const m = Date.now(), b = n.timeRange.to - n.timeRange.from;
      n.setTimeRange({ from: m - b, to: m });
    }
    return (m, b) => (E(), Ce(f(jl), null, {
      default: R(() => [
        k(f(jl).Compact, null, {
          default: R(() => [
            s.value ? (E(), Ce(f(t), {
              key: 1,
              "show-time": "",
              "allow-clear": !1,
              style: { width: "320px" },
              value: [f(cr)(f(n).timeRange.from), f(cr)(f(n).timeRange.to)],
              onChange: b[1] || (b[1] = (v) => {
                v?.[0] && v?.[1] && f(n).setTimeRange({ from: v[0].valueOf(), to: v[1].valueOf() });
              })
            }, null, 8, ["value"])) : (E(), Ce(f(Qe), {
              key: 0,
              value: f(c)?.minutes,
              options: i.map((v) => ({ value: v.minutes, label: v.label })),
              "popup-match-select-width": "false",
              placeholder: "快速选择",
              onChange: b[0] || (b[0] = (v) => u(v))
            }, null, 8, ["value", "options"])),
            k(f(tt), {
              onClick: b[2] || (b[2] = (v) => s.value = !s.value)
            }, {
              default: R(() => [
                ce(I(s.value ? "收起" : "自定义"), 1)
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        k(f(jl).Compact, null, {
          default: R(() => [
            k(f(tt), { onClick: p }, {
              default: R(() => [
                y("span", {
                  class: Ae([f(ze).refresh, "mr-1"])
                }, null, 2),
                b[4] || (b[4] = ce(" 刷新 ", -1))
              ]),
              _: 1
            }),
            k(f(Qe), {
              value: f(n).autoRefresh,
              options: l,
              "popup-match-select-width": "false",
              onChange: b[3] || (b[3] = (v) => f(n).setAutoRefresh(v))
            }, null, 8, ["value"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
}), Fx = { class: "font-semibold mb-3" }, Bx = /* @__PURE__ */ Me({
  __name: "ConstantOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = nt();
    return (l, s) => {
      const d = ot("a-form-item");
      return E(), B("div", null, [
        y("div", Fx, I(f(i)("variable.constant.title")), 1),
        k(d, {
          label: f(i)("variable.constant.value"),
          required: ""
        }, {
          default: R(() => [
            k(f(Ze), {
              size: "small",
              value: e.config.constantValue,
              onChange: s[0] || (s[0] = (c) => n("change", { constantValue: c.target.value }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(f(Ui), {
          checked: e.config.hide,
          onChange: s[1] || (s[1] = (c) => n("change", { hide: c.target.checked }))
        }, {
          default: R(() => [
            ce(I(f(i)("variable.constant.hide")), 1)
          ]),
          _: 1
        }, 8, ["checked"])
      ]);
    };
  }
}), Hx = { class: "font-semibold mb-3" }, Wx = { class: "mt-3" }, jx = { class: "mt-2" }, Gx = /* @__PURE__ */ Me({
  __name: "CustomOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: l } = nt();
    function s() {
      const d = [...n.config.customOptions ?? []];
      i("change", { customOptions: d });
    }
    return (d, c) => {
      const u = ot("a-form-item");
      return E(), B("div", null, [
        y("div", Hx, I(f(l)("variable.custom.title")), 1),
        (E(!0), B($e, null, Xe(e.config.customOptions ?? [], (p, m) => (E(), B("div", {
          key: m,
          class: "flex gap-2 mb-2"
        }, [
          k(f(Ze), {
            size: "small",
            value: p.text,
            placeholder: "Text",
            onChange: (b) => {
              const v = [...e.config.customOptions ?? []];
              v[m] = { ...v[m], text: b.target.value }, i("change", { customOptions: v });
            }
          }, null, 8, ["value", "onChange"]),
          k(f(Ze), {
            size: "small",
            value: p.value,
            placeholder: "Value",
            onChange: (b) => {
              const v = [...e.config.customOptions ?? []];
              v[m] = { ...v[m], value: b.target.value }, i("change", { customOptions: v });
            }
          }, null, 8, ["value", "onChange"]),
          k(f(tt), {
            type: "text",
            danger: "",
            size: "small",
            onClick: (b) => i("change", { customOptions: (e.config.customOptions ?? []).filter((v, C) => C !== m) })
          }, {
            default: R(() => [
              y("span", {
                class: Ae(f(ze).delete)
              }, null, 2)
            ]),
            _: 1
          }, 8, ["onClick"])
        ]))), 128)),
        k(f(tt), {
          type: "dashed",
          size: "small",
          block: "",
          onClick: s
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).plus, "mr-1"])
            }, null, 2),
            ce(" " + I(f(l)("variable.custom.add")), 1)
          ]),
          _: 1
        }),
        y("div", Wx, [
          k(u, {
            label: f(l)("variable.custom.allValue")
          }, {
            default: R(() => [
              k(f(Ze), {
                size: "small",
                value: e.config.allValue,
                placeholder: "$_all",
                onChange: c[0] || (c[0] = (p) => i("change", { allValue: p.target.value }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        y("div", jx, [
          k(f(Ui), {
            checked: e.config.multi,
            onChange: c[1] || (c[1] = (p) => i("change", { multi: p.target.checked }))
          }, {
            default: R(() => [
              ce(I(f(l)("variable.query.multi")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        y("div", null, [
          k(f(Ui), {
            checked: e.config.includeAll,
            onChange: c[2] || (c[2] = (p) => i("change", { includeAll: p.target.checked }))
          }, {
            default: R(() => [
              ce(I(f(l)("variable.query.includeAll")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ])
      ]);
    };
  }
}), Yx = { class: "font-semibold mb-3" }, Ux = /* @__PURE__ */ Me({
  __name: "DataSourceOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = nt(), l = [
      { label: "Zabbix", value: "zabbix" },
      { label: "Prometheus", value: "prometheus" },
      { label: "MySQL", value: "mysql" }
    ];
    return (s, d) => {
      const c = ot("a-form-item");
      return E(), B("div", null, [
        y("div", Yx, I(f(i)("variable.ds.title")), 1),
        k(c, {
          label: f(i)("variable.ds.type")
        }, {
          default: R(() => [
            k(f(Qe), {
              value: e.config.dsType,
              options: l,
              placeholder: f(i)("variable.ds.type.placeholder"),
              onChange: d[0] || (d[0] = (u) => n("change", { dsType: u }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(c, {
          label: f(i)("variable.ds.filterRegex")
        }, {
          default: R(() => [
            k(f(Ze), {
              value: e.config.instanceFilterRegex ?? "",
              placeholder: "/regex/",
              onChange: d[1] || (d[1] = (u) => n("change", { instanceFilterRegex: u.target.value }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(c, null, {
          default: R(() => [
            k(f(Ui), {
              checked: e.config.multi,
              onChange: d[2] || (d[2] = (u) => n("change", { multi: u.target.checked }))
            }, {
              default: R(() => [
                ce(I(f(i)("variable.ds.multi")), 1)
              ]),
              _: 1
            }, 8, ["checked"])
          ]),
          _: 1
        }),
        k(c, null, {
          default: R(() => [
            k(f(Ui), {
              checked: e.config.includeAll,
              onChange: d[3] || (d[3] = (u) => n("change", { includeAll: u.target.checked }))
            }, {
              default: R(() => [
                ce(I(f(i)("variable.ds.includeAll")), 1)
              ]),
              _: 1
            }, 8, ["checked"])
          ]),
          _: 1
        })
      ]);
    };
  }
}), Kx = { class: "font-semibold mb-3" }, Xx = { class: "grid grid-cols-2 gap-x-4" }, Qx = /* @__PURE__ */ Me({
  __name: "GeneralSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = nt(), l = [
      { label: i("variable.type.custom"), value: "custom" },
      { label: i("variable.type.query"), value: "query" },
      { label: i("variable.type.textbox"), value: "textbox" },
      { label: i("variable.type.constant"), value: "constant" }
    ], s = [
      { label: i("variable.general.showOn.labelAndValue"), value: "label-and-value" },
      { label: i("variable.general.showOn.value"), value: "value" },
      { label: i("variable.general.showOn.nothing"), value: "nothing" }
    ];
    function d(c) {
      n("change", {
        type: c,
        queryType: void 0,
        extractRegex: void 0,
        sortMode: void 0,
        customOptions: void 0,
        allValue: void 0,
        constantValue: void 0
      });
    }
    return (c, u) => {
      const p = ot("a-form-item");
      return E(), B("div", null, [
        y("div", Kx, I(f(i)("variable.general.title")), 1),
        y("div", Xx, [
          k(p, {
            label: f(i)("variable.general.type"),
            required: ""
          }, {
            default: R(() => [
              k(f(Qe), {
                value: e.config.type,
                options: l,
                style: { width: "100%" },
                onChange: d
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"]),
          k(p, {
            label: f(i)("variable.general.name"),
            required: ""
          }, {
            default: R(() => [
              k(f(Ze), {
                value: e.config.name,
                placeholder: "variable_name",
                onChange: u[0] || (u[0] = (m) => n("change", { name: m.target.value }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"]),
          k(p, {
            label: f(i)("variable.general.label")
          }, {
            default: R(() => [
              k(f(Ze), {
                value: e.config.label,
                placeholder: f(i)("variable.general.label.placeholder"),
                onChange: u[1] || (u[1] = (m) => n("change", { label: m.target.value }))
              }, null, 8, ["value", "placeholder"])
            ]),
            _: 1
          }, 8, ["label"]),
          k(p, {
            label: f(i)("variable.general.showOn")
          }, {
            default: R(() => [
              k(f(Qe), {
                value: e.config.showOnDashboard ?? "label-and-value",
                options: s,
                style: { width: "100%" },
                onChange: u[2] || (u[2] = (m) => n("change", { showOnDashboard: m }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        k(p, {
          label: f(i)("variable.general.description")
        }, {
          default: R(() => [
            k(f(Ze), {
              value: e.config.description ?? "",
              placeholder: f(i)("variable.general.description.placeholder"),
              onChange: u[3] || (u[3] = (m) => n("change", { description: m.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), Jx = { class: "font-semibold mb-3" }, Zx = { class: "grid grid-cols-2 gap-x-4" }, ew = { class: "mb-2" }, tw = { class: "mb-2" }, nw = {
  class: "p-2 text-xs text-secondary rounded",
  style: { background: "var(--ant-color-fill-tertiary)", border: "1px solid var(--ant-color-border-secondary)", "min-height": "32px" }
}, iw = /* @__PURE__ */ Me({
  __name: "QueryOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = nt(), l = [
      { label: i("variable.query.queryType.group"), value: "group" },
      { label: i("variable.query.queryType.host"), value: "host" },
      { label: i("variable.query.queryType.item"), value: "item" },
      { label: i("variable.query.queryType.labelValues"), value: "label_values" }
    ], s = [
      { label: i("variable.query.sort.disabled"), value: "disabled" },
      { label: i("variable.query.sort.alphabetical"), value: "alphabetical" },
      { label: i("variable.query.sort.numeric"), value: "numeric" }
    ], d = [
      { label: i("variable.query.refresh.onLoad"), value: "onLoad" },
      { label: i("variable.query.refresh.onTimeChange"), value: "onTimeChange" }
    ];
    return (c, u) => {
      const p = ot("a-form-item");
      return E(), B("div", null, [
        y("div", Jx, I(f(i)("variable.query.title")), 1),
        k(p, {
          label: f(i)("variable.query.dsUid")
        }, {
          default: R(() => [
            k(f(Ze), {
              size: "small",
              value: e.config.targetDsUid ?? "",
              placeholder: f(i)("variable.query.dsUid.placeholder"),
              onChange: u[0] || (u[0] = (m) => n("change", { targetDsUid: m.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(p, {
          label: f(i)("variable.query.queryType")
        }, {
          default: R(() => [
            k(f(Qe), {
              size: "small",
              value: e.config.queryType,
              options: l,
              style: { width: "100%" },
              placeholder: f(i)("variable.query.queryType.placeholder"),
              onChange: u[1] || (u[1] = (m) => n("change", { queryType: m }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(p, {
          label: f(i)("variable.query.query")
        }, {
          default: R(() => [
            k(f(Ze), {
              size: "small",
              value: e.config.query ?? "",
              placeholder: f(i)("variable.query.query.placeholder"),
              onChange: u[2] || (u[2] = (m) => n("change", { query: m.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        k(p, {
          label: f(i)("variable.query.regex")
        }, {
          default: R(() => [
            k(f(Ze), {
              size: "small",
              value: e.config.extractRegex ?? "",
              placeholder: f(i)("variable.query.regex.placeholder"),
              onChange: u[3] || (u[3] = (m) => n("change", { extractRegex: m.target.value }))
            }, null, 8, ["value", "placeholder"])
          ]),
          _: 1
        }, 8, ["label"]),
        y("div", Zx, [
          k(p, {
            label: f(i)("variable.query.sort")
          }, {
            default: R(() => [
              k(f(Qe), {
                size: "small",
                value: e.config.sortMode ?? "disabled",
                options: s,
                style: { width: "100%" },
                onChange: u[4] || (u[4] = (m) => n("change", { sortMode: m }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"]),
          k(p, {
            label: f(i)("variable.query.refresh")
          }, {
            default: R(() => [
              k(f(Qe), {
                size: "small",
                value: e.config.refresh,
                options: d,
                style: { width: "100%" },
                onChange: u[5] || (u[5] = (m) => n("change", { refresh: m }))
              }, null, 8, ["value"])
            ]),
            _: 1
          }, 8, ["label"])
        ]),
        y("div", ew, [
          k(f(Ui), {
            checked: e.config.multi,
            onChange: u[6] || (u[6] = (m) => n("change", { multi: m.target.checked }))
          }, {
            default: R(() => [
              ce(I(f(i)("variable.query.multi")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        y("div", tw, [
          k(f(Ui), {
            checked: e.config.includeAll,
            onChange: u[7] || (u[7] = (m) => n("change", { includeAll: m.target.checked }))
          }, {
            default: R(() => [
              ce(I(f(i)("variable.query.includeAll")), 1)
            ]),
            _: 1
          }, 8, ["checked"])
        ]),
        k(p, {
          label: f(i)("variable.query.preview")
        }, {
          default: R(() => [
            y("div", nw, I(f(i)("variable.query.preview.placeholder")), 1)
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), lw = { class: "font-semibold mb-3" }, ow = /* @__PURE__ */ Me({
  __name: "TextBoxOptionsSection",
  props: {
    config: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = nt();
    return (l, s) => {
      const d = ot("a-form-item");
      return E(), B("div", null, [
        y("div", lw, I(f(i)("variable.textbox.title")), 1),
        k(d, {
          label: f(i)("variable.textbox.defaultValue")
        }, {
          default: R(() => [
            k(f(Ze), {
              size: "small",
              value: e.config.defaultValue,
              onChange: s[0] || (s[0] = (c) => n("change", { defaultValue: c.target.value }))
            }, null, 8, ["value"])
          ]),
          _: 1
        }, 8, ["label"])
      ]);
    };
  }
}), aw = /* @__PURE__ */ Me({
  __name: "VariableForm",
  props: {
    draft: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t;
    nt();
    function i(l) {
      n("change", l);
    }
    return (l, s) => (E(), Ce(f(Kd), {
      layout: "vertical",
      class: "px-5 py-4 overflow-y-auto flex-1"
    }, {
      default: R(() => [
        k(Qx, {
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"]),
        s[0] || (s[0] = y("div", {
          class: "my-4",
          style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
        }, null, -1)),
        e.draft.config.type === "query" ? (E(), Ce(iw, {
          key: 0,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "datasource" ? (E(), Ce(Ux, {
          key: 1,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "custom" ? (E(), Ce(Gx, {
          key: 2,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "textbox" ? (E(), Ce(ow, {
          key: 3,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0),
        e.draft.config.type === "constant" ? (E(), Ce(Bx, {
          key: 4,
          config: e.draft.config,
          onChange: i
        }, null, 8, ["config"])) : ye("", !0)
      ]),
      _: 1
    }));
  }
}), sw = {
  class: "w-45 flex flex-col h-full",
  style: { "border-right": "1px solid var(--ant-color-border-secondary)" }
}, rw = {
  class: "px-3 py-2 text-xs text-secondary",
  style: { "border-bottom": "1px solid var(--ant-color-border-secondary)" }
}, uw = { class: "flex-1 overflow-y-auto" }, cw = ["onClick"], dw = { key: 0 }, fw = {
  key: 1,
  class: "text-secondary"
}, hw = {
  class: "p-2",
  style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
}, gw = /* @__PURE__ */ Me({
  __name: "VariableNavList",
  props: {
    drafts: {},
    selectedId: {}
  },
  emits: ["select", "add"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = nt();
    return (l, s) => (E(), B("div", sw, [
      y("div", rw, I(f(i)("variable.nav.count", { n: e.drafts.length })), 1),
      y("div", uw, [
        (E(!0), B($e, null, Xe(e.drafts, (d) => (E(), B("div", {
          key: d.id,
          class: Ae(["px-3 py-2 cursor-pointer text-sm transition-colors", d.id === e.selectedId ? "bg-blue-50 dark:bg-blue-900/30 border-l-3 border-primary" : "border-l-3 border-transparent"]),
          onClick: (c) => n("select", d.id)
        }, [
          d.config.name ? (E(), B("span", dw, I(d.config.name), 1)) : (E(), B("span", fw, I(f(i)("variable.nav.unnamed")), 1))
        ], 10, cw))), 128))
      ]),
      y("div", hw, [
        k(f(tt), {
          type: "dashed",
          block: "",
          onClick: s[0] || (s[0] = (d) => n("add"))
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).plus, "mr-1"])
            }, null, 2),
            ce(" " + I(f(i)("variable.modal.add")), 1)
          ]),
          _: 1
        })
      ])
    ]));
  }
}), pw = { class: "flex flex-1 overflow-hidden" }, vw = { class: "flex-1 overflow-hidden flex flex-col" }, mw = {
  key: 1,
  class: "flex-1 flex-center text-secondary text-sm"
}, yw = {
  class: "flex items-center justify-between px-4 py-3",
  style: { "border-top": "1px solid var(--ant-color-border-secondary)" }
}, bw = { class: "flex gap-2" }, xw = /* @__PURE__ */ Me({
  __name: "VariableConfigModal",
  props: {
    open: { type: Boolean }
  },
  emits: ["close"],
  setup(e, { emit: t }) {
    const n = e, i = t, l = to(), { t: s } = nt(), d = fe([]), c = fe(""), u = () => `new-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
    function p(M) {
      return {
        id: "",
        name: M,
        label: "",
        type: "custom",
        hide: !1,
        refresh: "onLoad",
        multi: !1,
        includeAll: !1,
        showOnDashboard: "label-and-value"
      };
    }
    Fe(
      () => n.open,
      (M) => {
        if (M) {
          const q = Object.values(l.variables).map((Q) => ({
            id: Q.config.id,
            isNew: !1,
            config: JSON.parse(JSON.stringify(Q.config))
          }));
          d.value = q, c.value = q[0]?.id ?? "";
        }
      }
    );
    const m = re(
      () => d.value.find((M) => M.id === c.value) ?? null
    );
    function b() {
      const q = `variable_${d.value.length + 1}`, Q = u(), V = {
        id: Q,
        isNew: !0,
        config: p(q)
      };
      d.value = [...d.value, V], c.value = Q;
    }
    function v() {
      if (!m.value)
        return;
      const M = d.value.findIndex((q) => q.id === c.value);
      d.value = d.value.filter((q) => q.id !== c.value), d.value.length > 0 ? c.value = d.value[Math.min(M, d.value.length - 1)].id : c.value = "";
    }
    function C(M) {
      m.value && (d.value = d.value.map(
        (q) => q.id === c.value ? { ...q, config: { ...q.config, ...M } } : q
      ));
    }
    function P() {
      const M = l.variables, q = new Set(d.value.map((V) => V.id)), Q = new Set(Object.keys(M));
      for (const V of Q)
        q.has(V) || l.removeVariable(V);
      for (const V of d.value) {
        const Y = V.config;
        V.isNew || !Q.has(V.id) ? l.addVariable(Y) : l.updateVariable(V.id, Y);
      }
      i("close");
    }
    return (M, q) => (E(), Ce(f(Ul), {
      open: e.open,
      title: f(s)("variable.modal.title"),
      width: 780,
      footer: null,
      "body-style": { padding: 0, height: "480px", display: "flex", flexDirection: "column" },
      onCancel: q[2] || (q[2] = (Q) => i("close"))
    }, {
      default: R(() => [
        y("div", pw, [
          k(gw, {
            drafts: d.value,
            "selected-id": c.value,
            onSelect: q[0] || (q[0] = (Q) => c.value = Q),
            onAdd: b
          }, null, 8, ["drafts", "selected-id"]),
          y("div", vw, [
            m.value ? (E(), Ce(aw, {
              key: 0,
              draft: m.value,
              onChange: C
            }, null, 8, ["draft"])) : (E(), B("div", mw, I(f(s)("variable.modal.placeholder")), 1))
          ])
        ]),
        y("div", yw, [
          k(f(tt), {
            danger: "",
            disabled: !m.value,
            onClick: v
          }, {
            default: R(() => [
              ce(I(f(s)("variable.modal.delete")), 1)
            ]),
            _: 1
          }, 8, ["disabled"]),
          y("div", bw, [
            k(f(tt), {
              onClick: q[1] || (q[1] = (Q) => i("close"))
            }, {
              default: R(() => [
                ce(I(f(s)("variable.modal.cancel")), 1)
              ]),
              _: 1
            }),
            k(f(tt), {
              type: "primary",
              onClick: P
            }, {
              default: R(() => [
                ce(I(f(s)("variable.modal.save")), 1)
              ]),
              _: 1
            })
          ])
        ])
      ]),
      _: 1
    }, 8, ["open", "title"]));
  }
}), ww = {
  key: 0,
  class: "flex items-center gap-3 flex-wrap",
  style: { padding: "0 8px" }
}, Sw = {
  key: 0,
  class: "flex items-center gap-1"
}, kw = {
  key: 1,
  class: "flex items-center gap-1"
}, Cw = {
  key: 2,
  class: "flex items-center gap-1"
}, qd = /* @__PURE__ */ Me({
  __name: "VariableBar",
  setup(e) {
    const t = to(), n = hi(), i = Pi(), l = fe(!1), s = re(
      () => Object.entries(t.variables).filter(([, u]) => !u.config.hide).map(([u, p]) => ({ id: u, ...p })).sort((u, p) => u.config.name.localeCompare(p.config.name))
    ), d = re(() => i.isDark ? "#888" : "#555");
    function c(u, p) {
      t.setValue(u, p);
      const m = t.variables[u];
      if (m) {
        const b = t.getDependents(m.config.name);
        for (const v of b)
          for (const [C, P] of Object.entries(t.variables))
            if (P.config.name === v) {
              t.refreshVariable(C);
              break;
            }
      }
    }
    return (u, p) => s.value.length > 0 || f(n).isEditing ? (E(), B("div", ww, [
      (E(!0), B($e, null, Xe(s.value, (m) => (E(), B($e, {
        key: m.id
      }, [
        m.config.type === "textbox" ? (E(), B("div", Sw, [
          y("span", {
            class: "text-sm",
            style: He({ color: d.value, whiteSpace: "nowrap" })
          }, I(m.config.label), 5),
          k(f(Ze), {
            size: "small",
            style: { width: "160px" },
            value: Array.isArray(m.current) ? m.current[0] || "" : m.current,
            placeholder: "Enter value...",
            onChange: (b) => c(m.id, b.target.value)
          }, null, 8, ["value", "onChange"])
        ])) : m.config.type === "constant" ? (E(), B("div", kw, [
          m.config.label ? (E(), B("span", {
            key: 0,
            class: "text-sm",
            style: He({ color: d.value, whiteSpace: "nowrap" })
          }, I(m.config.label), 5)) : ye("", !0),
          k(f(Kl), { style: { margin: "0", "font-size": "12px" } }, {
            default: R(() => [
              ce(I(m.config.constantValue ?? ""), 1)
            ]),
            _: 2
          }, 1024)
        ])) : (E(), B("div", Cw, [
          y("span", {
            class: "text-sm",
            style: He({ color: d.value, whiteSpace: "nowrap" })
          }, I(m.config.label || m.config.name) + ": ", 5),
          k(f(Qe), {
            value: m.current,
            mode: m.config.multi ? "multiple" : void 0,
            options: m.options.map((b) => ({ label: b.label === "$__all" ? "All" : b.label, value: b.value })),
            loading: m.loading,
            style: { minWidth: "120px" },
            size: "small",
            "show-search": "",
            "allow-clear": !m.config.multi,
            "filter-option": (b, v) => (v?.label ?? "").toLowerCase().includes(b.toLowerCase()),
            placeholder: `Select ${m.config.label}`,
            onChange: (b) => c(m.id, b)
          }, null, 8, ["value", "mode", "options", "loading", "allow-clear", "filter-option", "placeholder", "onChange"]),
          m.error ? (E(), Ce(f(Kl), {
            key: 0,
            color: "red",
            style: { "font-size": "10px", margin: "0" }
          }, {
            default: R(() => [
              ce(I(m.error), 1)
            ]),
            _: 2
          }, 1024)) : ye("", !0)
        ]))
      ], 64))), 128)),
      f(n).isEditing ? (E(), Ce(f(tt), {
        key: 0,
        size: "small",
        type: "text",
        class: "ml-auto",
        onClick: p[0] || (p[0] = (m) => l.value = !0)
      }, {
        default: R(() => [
          y("span", {
            class: Ae([f(ze).settings, "text-base"])
          }, null, 2)
        ]),
        _: 1
      })) : ye("", !0),
      k(xw, {
        open: l.value,
        onClose: p[1] || (p[1] = (m) => l.value = !1)
      }, null, 8, ["open"])
    ])) : ye("", !0);
  }
}), _w = /* @__PURE__ */ Me({
  __name: "DatasourceSelect",
  props: {
    value: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { config: i } = Fo(), l = re(() => {
      const c = [{ value: "mock", label: "Mock", type: "mock", uid: "" }], u = i.value.datasourceConfig ?? [];
      return u.filter((p) => p.type === "zabbix").forEach((p, m) => {
        const b = p.uid || String(m);
        c.push({ value: `zabbix:${b}`, label: `${p.name}`, type: "zabbix", uid: b });
      }), u.filter((p) => p.type === "argus").forEach((p, m) => {
        const b = p.uid || String(m);
        c.push({ value: `argus:${b}`, label: `${p.name}`, type: "argus", uid: b });
      }), c;
    }), s = re(
      () => l.value.map((c) => ({ value: c.value, label: c.label }))
    );
    function d(c) {
      const u = l.value.find((p) => p.value === c);
      u && n("change", u);
    }
    return (c, u) => (E(), Ce(f(Qe), {
      size: "small",
      style: { "min-width": "140px" },
      value: e.value,
      options: s.value,
      onChange: d
    }, null, 8, ["value", "options"]));
  }
}), Mw = {
  key: 0,
  class: ""
}, zw = {
  key: 1,
  class: "pt-2 px-2 text-xs text-secondary"
}, Tw = /* @__PURE__ */ Me({
  __name: "QueryEditorRow",
  props: {
    entry: {},
    index: {},
    isChart: { type: Boolean },
    canDelete: { type: Boolean }
  },
  emits: ["update", "remove"],
  setup(e, { emit: t }) {
    const n = e, i = t, l = re(() => "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[n.index] ?? String(n.index + 1)), s = re(() => Cs(n.entry.dataSource.type)), d = re(() => s.value?.QueryEditor ?? null), c = re(() => {
      const m = n.entry.dataSource;
      if (m.type === "mock")
        return "mock";
      const b = "datasourceId" in m ? m.datasourceId : "";
      return b ? `${m.type}:${b}` : m.type;
    });
    function u(m) {
      const b = Cs(m.type);
      if (!b?.defaultQuery)
        return;
      const v = { ...b.defaultQuery(), ...m.uid ? { datasourceId: m.uid } : {} };
      i("update", { dataSource: v });
    }
    function p(m) {
      i("update", { dataSource: m });
    }
    return (m, b) => (E(), Ce(f(Ca), {
      size: "small",
      collapsible: "icon",
      bordered: !0,
      "default-active-key": [e.entry.id]
    }, {
      default: R(() => [
        (E(), Ce(f(Ca).Panel, {
          key: e.entry.id
        }, {
          header: R(() => [
            y("div", {
              class: "flex items-center gap-2",
              onClick: b[3] || (b[3] = En(() => {
              }, ["stop"]))
            }, [
              k(f(Kl), {
                color: "blue",
                style: { "font-size": "12px", "font-weight": "600", margin: "0", "min-width": "24px", "text-align": "center", "line-height": "20px" }
              }, {
                default: R(() => [
                  ce(I(l.value), 1)
                ]),
                _: 1
              }),
              k(f(Ci), {
                size: "small",
                checked: e.entry.enabled,
                onChange: b[0] || (b[0] = (v) => i("update", { enabled: v })),
                onClick: b[1] || (b[1] = En(() => {
                }, ["stop"]))
              }, null, 8, ["checked"]),
              b[5] || (b[5] = y("div", { class: "flex-1" }, null, -1)),
              b[6] || (b[6] = y("span", { style: { "font-size": "11px", color: "var(--ant-color-text-secondary)" } }, "数据源", -1)),
              k(_w, {
                value: c.value,
                onClick: b[2] || (b[2] = En(() => {
                }, ["stop"])),
                onChange: u
              }, null, 8, ["value"])
            ])
          ]),
          extra: R(() => [
            e.canDelete ? (E(), Ce(f(tt), {
              key: 0,
              type: "text",
              danger: "",
              size: "small",
              onClick: b[4] || (b[4] = En((v) => i("remove"), ["stop"]))
            }, {
              default: R(() => [
                y("span", {
                  class: Ae(f(ze).delete)
                }, null, 2)
              ]),
              _: 1
            })) : ye("", !0)
          ]),
          default: R(() => [
            e.entry.enabled && d.value ? (E(), B("div", Mw, [
              (E(), Ce(rc(d.value), {
                query: e.entry.dataSource,
                "datasource-id": "datasourceId" in e.entry.dataSource ? e.entry.dataSource.datasourceId : "",
                "is-chart": e.isChart,
                onChange: p
              }, null, 40, ["query", "datasource-id", "is-chart"]))
            ])) : e.entry.enabled && !d.value ? (E(), B("div", zw, " No query editor available for datasource type: " + I(e.entry.dataSource.type), 1)) : ye("", !0)
          ]),
          _: 1
        }))
      ]),
      _: 1
    }, 8, ["default-active-key"]));
  }
}), Pw = {
  class: "px-4 py-3 flex flex-col gap-2",
  style: { "min-width": "300px" }
}, $w = { class: "flex items-center gap-2" }, Ew = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Iw = { class: "flex items-center gap-2" }, Aw = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Ow = { class: "flex items-center gap-2" }, Dw = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Lw = {
  class: "text-xs",
  style: { color: "var(--ant-color-text-quaternary)" }
}, qw = { class: "flex items-center gap-2" }, Rw = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, Nw = { class: "flex items-center gap-2" }, Vw = {
  class: "text-xs text-secondary flex-shrink-0",
  style: { width: "120px" }
}, ec = 1e3, Fw = /* @__PURE__ */ Me({
  __name: "QueryOptionsPanel",
  setup(e) {
    const { t } = nt(), { panel: n, onChange: i } = ao(), l = hi();
    function s(p) {
      return p >= 36e5 ? `${Math.round(p / 36e5)}h` : p >= 6e4 ? `${Math.round(p / 6e4)}m` : p >= 1e3 ? `${Math.round(p / 1e3)}s` : `${p}ms`;
    }
    function d(p) {
      const m = p.trim().match(/^(\d+(?:\.\d+)?)(ms|[smh])?$/i);
      if (!m)
        return;
      const b = Number.parseFloat(m[1]), v = (m[2] ?? "s").toLowerCase();
      return v === "ms" ? b : v === "s" ? b * 1e3 : v === "m" ? b * 6e4 : b * 36e5;
    }
    const c = re(() => {
      const p = n.value.queryOptions?.maxDataPoints ?? ec, m = l.timeRange, b = m.to - m.from;
      return Math.max(Math.ceil(b / p), 1e3);
    }), u = re(() => {
      const p = n.value.queryOptions?.minIntervalMs;
      return p != null ? s(p) : "";
    });
    return (p, m) => (E(), B("div", Pw, [
      y("div", $w, [
        y("span", Ew, [
          k(f($n), {
            title: f(t)("qb.queryOptions.maxDataPoints")
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(f(t)("qb.queryOptions.maxDataPoints")), 1)
        ]),
        k(f(on), {
          size: "small",
          style: { width: "100px" },
          min: 1,
          value: f(n).queryOptions?.maxDataPoints,
          placeholder: String(ec),
          onChange: m[0] || (m[0] = (b) => f(i)({ queryOptions: { ...f(n).queryOptions, maxDataPoints: b ?? void 0 } }))
        }, null, 8, ["value", "placeholder"])
      ]),
      y("div", Iw, [
        y("span", Aw, [
          k(f($n), {
            title: f(t)("qb.queryOptions.minInterval")
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(f(t)("qb.queryOptions.minInterval")), 1)
        ]),
        k(f(Ze), {
          size: "small",
          style: { width: "100px" },
          value: u.value,
          placeholder: f(t)("qb.queryOptions.minIntervalPlaceholder"),
          onChange: m[1] || (m[1] = (b) => {
            const v = b.target.value.trim();
            if (!v) {
              f(i)({ queryOptions: { ...f(n).queryOptions, minIntervalMs: void 0 } });
              return;
            }
            const C = d(v);
            C !== void 0 && f(i)({ queryOptions: { ...f(n).queryOptions, minIntervalMs: C } });
          })
        }, null, 8, ["value", "placeholder"])
      ]),
      y("div", Ow, [
        y("span", Dw, [
          k(f($n), {
            title: f(t)("qb.queryOptions.interval")
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(f(t)("qb.queryOptions.interval")), 1)
        ]),
        k(f(Ze), {
          size: "small",
          style: { width: "100px" },
          value: s(c.value),
          readonly: ""
        }, null, 8, ["value"]),
        y("span", Lw, " = " + I(f(t)("qb.queryOptions.intervalHint")), 1)
      ]),
      y("div", qw, [
        y("span", Rw, [
          k(f($n), {
            title: f(t)("qb.queryOptions.relativeTime")
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(f(t)("qb.queryOptions.relativeTime")), 1)
        ]),
        k(f(Ze), {
          size: "small",
          style: { width: "100px" },
          placeholder: "1h",
          value: f(n).queryOptions?.relativeTime ?? "",
          onChange: m[2] || (m[2] = (b) => f(i)({ queryOptions: { ...f(n).queryOptions, relativeTime: b.target.value || void 0 } }))
        }, null, 8, ["value"])
      ]),
      y("div", Nw, [
        y("span", Vw, [
          k(f($n), {
            title: f(t)("qb.queryOptions.timeShift")
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).info, "mr-1 opacity-50 text-xs"])
              }, null, 2)
            ]),
            _: 1
          }, 8, ["title"]),
          ce(" " + I(f(t)("qb.queryOptions.timeShift")), 1)
        ]),
        k(f(Ze), {
          size: "small",
          style: { width: "100px" },
          placeholder: "1h",
          value: f(n).queryOptions?.timeShift ?? "",
          onChange: m[3] || (m[3] = (b) => f(i)({ queryOptions: { ...f(n).queryOptions, timeShift: b.target.value || void 0 } }))
        }, null, 8, ["value"])
      ])
    ]));
  }
}), Bw = { class: "flex flex-col h-full" }, Hw = {
  class: "flex items-center gap-2 px-3 py-1.5 flex-shrink-0 flex-wrap",
  style: { "border-bottom": "1px solid var(--ant-color-border-secondary)" }
}, Ww = { class: "flex-1 overflow-y-auto px-3 py-2 flex flex-col gap-2" }, jw = {
  key: 0,
  class: "text-center text-secondary text-sm py-8"
}, Gw = /* @__PURE__ */ Me({
  __name: "QueryEditorPane",
  setup(e) {
    const { t } = nt(), { panel: n, onChange: i } = ao(), l = re(() => ["timeseries", "bar", "histogram"].includes(n.value.type)), s = re(() => n.value.queries ?? []), d = fe(!1), c = fe("mock");
    function u(b, v) {
      i({ queries: s.value.map((C, P) => P === b ? { ...C, ...v } : C) });
    }
    function p(b) {
      i({ queries: s.value.filter((v, C) => C !== b) });
    }
    function m() {
      if (s.value.length >= 26)
        return;
      const b = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[s.value.length] ?? String(s.value.length + 1), [v, C = ""] = c.value.split(":"), P = Cs(v);
      if (!P?.defaultQuery)
        return;
      const M = {
        ...P.defaultQuery(),
        ...C ? { datasourceId: C } : {},
        // Non-chart types: each query = 1 series; seriesCount controlled by query count
        ...!l.value && "seriesCount" in P.defaultQuery() ? { seriesCount: 1 } : {}
      };
      i({
        queries: [...s.value, { id: b, enabled: !0, dataSource: M }]
      });
    }
    return (b, v) => (E(), B("div", Bw, [
      y("div", Hw, [
        k(qd),
        v[1] || (v[1] = y("div", { class: "flex-1" }, null, -1)),
        k(Ld),
        k(f(Xd), {
          type: "vertical",
          style: { margin: "0" }
        }),
        k(f(jl).Compact, null, {
          default: R(() => [
            k(f(tt), {
              type: "primary",
              disabled: s.value.length >= 26,
              onClick: m
            }, {
              default: R(() => [
                y("span", {
                  class: Ae([f(ze).plus, "mr-1"])
                }, null, 2),
                ce(" " + I(f(t)("qb.addQuery")), 1)
              ]),
              _: 1
            }, 8, ["disabled"]),
            k(f(Qd), {
              open: d.value,
              "onUpdate:open": v[0] || (v[0] = (C) => d.value = C),
              trigger: "click",
              placement: "bottomRight",
              "overlay-inner-style": { padding: 0, minWidth: "320px" }
            }, {
              content: R(() => [
                k(Fw)
              ]),
              default: R(() => [
                k(f(tt), { class: "text-12px cursor-pointer hover:op-90 active:op-80 underline" }, {
                  default: R(() => [
                    ce(I(f(t)("qb.queryOptions")) + " ", 1),
                    y("span", {
                      class: Ae([f(ze).chevronDown, ""])
                    }, null, 2)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["open"])
          ]),
          _: 1
        })
      ]),
      y("div", Ww, [
        (E(!0), B($e, null, Xe(s.value, (C, P) => (E(), Ce(Tw, {
          key: C.id,
          entry: C,
          index: P,
          "is-chart": l.value,
          "can-delete": s.value.length > 1,
          onUpdate: (M) => u(P, M),
          onRemove: () => p(P)
        }, null, 8, ["entry", "index", "is-chart", "can-delete", "onUpdate", "onRemove"]))), 128)),
        s.value.length === 0 ? (E(), B("div", jw, ' No queries. Click "' + I(f(t)("qb.addQuery")) + '" to start. ', 1)) : ye("", !0)
      ])
    ]));
  }
}), Yw = { class: "w-full h-full" }, Uw = { class: "w-full h-full" }, Kw = /* @__PURE__ */ Me({
  __name: "PanelEditorLayout",
  setup(e) {
    const n = Pi().isDark ? "#303030" : "#e8e8e8";
    return (i, l) => (E(), Ce(f(Xu), { style: { height: "100%" } }, {
      default: R(() => [
        k(f(va), { "min-size": 200 }, {
          default: R(() => [
            k(f(Xu), {
              vertical: "",
              "default-sizes": [100, 200]
            }, {
              default: R(() => [
                k(f(va), { "min-size": 100 }, {
                  default: R(() => [
                    y("div", Yw, [
                      k(Vx)
                    ])
                  ]),
                  _: 1
                }),
                k(f(va), { "min-size": 60 }, {
                  default: R(() => [
                    y("div", Uw, [
                      k(Gw)
                    ])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        k(f(va), {
          "preferred-size": "35%",
          "min-size": 200
        }, {
          default: R(() => [
            y("div", {
              class: "w-full h-full overflow-y-auto",
              style: He({ borderLeft: `1px solid ${f(n)}` })
            }, [
              k(p1)
            ], 4)
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
}), Xw = { class: "flex items-center gap-2" }, Qw = { class: "font-medium text-sm" }, Jw = { class: "flex justify-end gap-2 py-1" }, Zw = /* @__PURE__ */ Me({
  __name: "PanelEditorModal",
  setup(e) {
    const t = hi(), { t: n } = nt(), i = fe(null), l = fe(null), s = re(() => {
      const P = t.editingPanelId;
      return P ? t.panels[P] : null;
    }), d = re(() => i.value ?? s.value), c = re(() => {
      const P = l.value?.data?.[0];
      return P ? P.fields.filter((M) => M.type === "number").map((M) => M.name) : [];
    }), u = re(() => {
      const P = l.value?.data?.[0];
      return P ? P.fields.map((M) => M.config?.displayNameFromDS ?? M.name) : [];
    });
    function p(P) {
      d.value && (i.value = { ...d.value, ...P });
    }
    function m() {
      i.value && t.editingPanelId && t.updatePanel(t.editingPanelId, i.value), i.value = null, t.setEditingPanel(null);
    }
    function b() {
      i.value = null, t.setEditingPanel(null);
    }
    Fe(() => t.editingPanelId, (P) => {
      P || (i.value = null);
    });
    const v = re(() => !!t.editingPanelId && !!s.value), C = fe(!1);
    return Fe(v, (P) => {
      P && !C.value && setTimeout(() => {
        C.value = !0;
      }, 0);
    }), nm({
      panel: re(() => d.value),
      onChange: p,
      previewData: l,
      numericFieldNames: c,
      allFieldNames: u
    }), (P, M) => (E(), Ce(f(Jd), {
      open: v.value,
      closable: !0,
      mask: !1,
      placement: "right",
      width: "71vw",
      "body-style": { padding: 0 },
      "destroy-on-close": !1,
      onClose: b
    }, {
      title: R(() => [
        y("div", Xw, [
          y("span", Qw, "Edit: " + I(d.value?.title ?? ""), 1)
        ])
      ]),
      footer: R(() => [
        y("div", Jw, [
          k(f(tt), { onClick: b }, {
            default: R(() => [
              ce(I(f(n)("dashboard.cancel")), 1)
            ]),
            _: 1
          }),
          k(f(tt), {
            type: "primary",
            onClick: m
          }, {
            default: R(() => [
              ce(I(f(n)("dashboard.save")), 1)
            ]),
            _: 1
          })
        ])
      ]),
      default: R(() => [
        d.value && C.value ? (E(), Ce(Kw, { key: 0 })) : ye("", !0)
      ]),
      _: 1
    }, 8, ["open"]));
  }
}), eS = {
  key: 0,
  class: "panel-container w-full h-full flex flex-col rounded-lg overflow-hidden bg-white dark:bg-[#1f1f1f] border border-[#e8e8e8] dark:border-[#303030]"
}, tS = { class: "flex items-center gap-2 min-w-0 lh-1 flex-1 text-[#666] dark:text-[#666]" }, nS = {
  key: 0,
  class: "drag-handle flex-shrink-0 cursor-grab"
}, iS = { class: "text-sm truncate text-[#141414] dark:text-[#d9d9d9]" }, lS = { class: "panel-actions flex items-center gap-10px lh-1 flex-shrink-0 text-[#444] dark:text-[#666]" }, oS = { class: "panel-content flex-1 overflow-hidden" }, aS = { class: "w-full h-full flex flex-col rounded-lg overflow-hidden bg-white dark:bg-[#1f1f1f]" }, sS = { class: "panel-content flex-1 overflow-hidden" }, rS = /* @__PURE__ */ Me({
  __name: "PanelContainer",
  props: {
    panelId: {},
    menuMode: { default: "inline" }
  },
  setup(e) {
    const t = e, n = hi(), i = Pi(), { t: l } = nt(), s = fe(!1), d = fe(!1), c = re(() => n.panels[t.panelId]), u = re(() => i.isDark), p = re(() => u.value ? "#666" : "#bbb"), m = re(() => {
      const P = (M) => Tn("span", { class: M });
      return n.isEditing ? [
        { key: "edit", label: l("panel.menu.edit"), icon: () => P(ze.edit) },
        { key: "clone", label: l("panel.menu.clone"), icon: () => P(ze.clone) },
        { key: "fullscreen", label: l("panel.menu.fullscreen"), icon: () => P(ze.fullscreen) },
        { type: "divider" },
        { key: "remove", label: l("panel.menu.remove"), icon: () => P(ze.delete), danger: !0 }
      ] : [
        { key: "fullscreen", label: l("panel.menu.fullscreen"), icon: () => P(ze.fullscreen) }
      ];
    });
    function b(P) {
      switch (P) {
        case "edit":
          n.setEditingPanel(t.panelId);
          break;
        case "clone":
          n.clonePanel(t.panelId);
          break;
        case "remove":
          Ul.confirm({
            title: l("panel.remove.title", { title: c.value?.title ?? "" }),
            content: l("panel.remove.content"),
            okText: l("panel.remove.ok"),
            okButtonProps: { danger: !0 },
            onOk: () => n.removePanel(t.panelId)
          });
          break;
        case "fullscreen":
          s.value = !0;
          break;
      }
    }
    function v(P) {
      d.value = !1, b(String(P.key));
    }
    function C(P) {
      P.stopPropagation(), n.refreshPanel(t.panelId);
    }
    return (P, M) => (E(), B($e, null, [
      c.value && !s.value ? (E(), B("div", eS, [
        y("div", {
          class: "panel-header flex items-center px-3 py-2 flex-shrink-0 border-b border-[#e8e8e8] dark:border-[#303030]",
          onDblclick: M[6] || (M[6] = (q) => f(n).isEditing && f(n).setEditingPanel(t.panelId))
        }, [
          y("div", tS, [
            f(n).isEditing ? (E(), B("span", nS, [
              y("span", {
                class: Ae(f(ze).dragVertical)
              }, null, 2)
            ])) : ye("", !0),
            y("span", iS, I(c.value.title), 1),
            c.value.description ? (E(), Ce(f($n), {
              key: 1,
              title: c.value.description,
              placement: "bottom"
            }, {
              default: R(() => [
                y("span", {
                  class: Ae([f(ze).info, "flex-shrink-0"])
                }, null, 2)
              ]),
              _: 1
            }, 8, ["title"])) : ye("", !0),
            k(Ad, {
              links: c.value.links ?? [],
              "icon-color": p.value
            }, null, 8, ["links", "icon-color"])
          ]),
          y("div", lS, [
            k(f($n), {
              title: f(l)("panel.menu.refresh")
            }, {
              default: R(() => [
                y("span", {
                  class: Ae([f(ze).refresh, "panel-refresh-btn cursor-pointer"]),
                  onMousedown: M[0] || (M[0] = En(() => {
                  }, ["stop"])),
                  onClick: C
                }, null, 34)
              ]),
              _: 1
            }, 8, ["title"]),
            t.menuMode === "inline" ? (E(), B($e, { key: 0 }, [
              f(n).isEditing ? (E(), Ce(f($n), {
                key: 0,
                title: f(l)("panel.menu.edit")
              }, {
                default: R(() => [
                  y("span", {
                    class: Ae([f(ze).edit, "cursor-pointer"]),
                    onClick: M[1] || (M[1] = (q) => b("edit"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : ye("", !0),
              f(n).isEditing ? (E(), Ce(f($n), {
                key: 1,
                title: f(l)("panel.menu.clone")
              }, {
                default: R(() => [
                  y("span", {
                    class: Ae([f(ze).clone, "cursor-pointer"]),
                    onClick: M[2] || (M[2] = (q) => b("clone"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : ye("", !0),
              f(n).isEditing ? (E(), Ce(f($n), {
                key: 2,
                title: f(l)("panel.menu.remove")
              }, {
                default: R(() => [
                  y("span", {
                    class: Ae([f(ze).delete, "cursor-pointer text-red-500"]),
                    onClick: M[3] || (M[3] = (q) => b("remove"))
                  }, null, 2)
                ]),
                _: 1
              }, 8, ["title"])) : ye("", !0)
            ], 64)) : (E(), Ce(f(Vo), {
              key: 1,
              open: d.value,
              "onUpdate:open": M[5] || (M[5] = (q) => d.value = q),
              trigger: "click"
            }, {
              overlay: R(() => [
                k(f(li), {
                  items: m.value,
                  onClick: v
                }, null, 8, ["items"])
              ]),
              default: R(() => [
                y("span", {
                  class: "cursor-pointer p-[2px_4px]",
                  onClick: M[4] || (M[4] = En(() => {
                  }, ["prevent"]))
                }, [
                  y("span", {
                    class: Ae(f(ze).dotsVertical)
                  }, null, 2)
                ])
              ]),
              _: 1
            }, 8, ["open"]))
          ])
        ], 32),
        y("div", oS, [
          Ti(P.$slots, "default", {}, void 0, !0)
        ])
      ])) : ye("", !0),
      s.value ? (E(), Ce(f(Ul), {
        key: 1,
        open: !0,
        title: c.value?.title,
        footer: null,
        width: "92vw",
        "body-style": { height: "82vh", padding: 0 },
        closable: !1,
        onCancel: M[7] || (M[7] = (q) => s.value = !1)
      }, {
        default: R(() => [
          y("div", aS, [
            y("div", sS, [
              Ti(P.$slots, "default", {}, void 0, !0)
            ])
          ])
        ]),
        _: 3
      }, 8, ["title"])) : ye("", !0)
    ], 64));
  }
}), tc = /* @__PURE__ */ wn(rS, [["__scopeId", "data-v-2c616ca4"]]), uS = { class: "font-medium text-sm" }, cS = { class: "text-xs text-secondary mt-1" }, dS = /* @__PURE__ */ Me({
  __name: "AddPanelModal",
  setup(e) {
    const t = hi(), { t: n } = nt(), i = [
      { type: "timeseries", icon: ze.chartLine, descKey: "panel.type.desc.timeseries" },
      { type: "bar", icon: ze.chartBar, descKey: "panel.type.desc.bar" },
      { type: "histogram", icon: ze.chartArea, descKey: "panel.type.desc.histogram" },
      { type: "stat", icon: ze.stat, descKey: "panel.type.desc.stat" },
      { type: "gauge", icon: ze.gauge, descKey: "panel.type.desc.gauge" },
      { type: "table", icon: ze.table, descKey: "panel.type.desc.table" },
      { type: "pie", icon: ze.chartPie, descKey: "panel.type.desc.pie" }
    ];
    function l(s) {
      t.addPanel(s);
    }
    return (s, d) => (E(), Ce(f(Ul), {
      open: f(t).addPanelModalOpen,
      title: f(n)("dashboard.addPanel"),
      footer: null,
      onCancel: d[0] || (d[0] = (c) => f(t).addPanelModalOpen = !1)
    }, {
      default: R(() => [
        k(f(Zd), {
          gutter: [16, 16],
          class: "mt-4"
        }, {
          default: R(() => [
            (E(), B($e, null, Xe(i, (c) => k(f(ef), {
              key: c.type,
              span: 8
            }, {
              default: R(() => [
                k(f(tf), {
                  hoverable: "",
                  class: "text-center cursor-pointer",
                  onClick: (u) => l(c.type)
                }, {
                  default: R(() => [
                    y("div", {
                      class: Ae(["text-2xl mb-2", c.icon])
                    }, null, 2),
                    y("div", uS, I(f(n)(`config.type.${c.type}`)), 1),
                    y("div", cS, I(f(n)(c.descKey)), 1)
                  ]),
                  _: 2
                }, 1032, ["onClick"])
              ]),
              _: 2
            }, 1024)), 64))
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["open", "title"]));
  }
}), fS = { style: { display: "flex", "align-items": "center", "flex-wrap": "wrap", gap: "8px", padding: "0 4px" } }, hS = { class: "" }, gS = { style: { margin: "0" } }, pS = { style: { margin: "0" } }, vS = /* @__PURE__ */ Me({
  __name: "DashboardHeader",
  setup(e) {
    const t = hi(), { t: n } = nt(), { config: i } = Fo(), { message: l } = uc.useApp(), s = fe(!1), d = fe(!1), c = fe(null);
    function u() {
      t.confirmSave(i.value.onSave);
    }
    function p() {
      t.isDirty ? s.value = !0 : t.discardChanges();
    }
    function m() {
      s.value = !1, t.discardChanges();
    }
    function b() {
      const V = t.exportJSON(), Y = new Blob([V], { type: "application/json" }), A = URL.createObjectURL(Y), H = document.createElement("a");
      H.href = A, H.download = "dashboard.json", H.click(), URL.revokeObjectURL(A), l.success(n("dashboard.exportSuccess"));
    }
    function v() {
      c.value?.click();
    }
    function C(V) {
      const Y = V.target.files?.[0];
      Y && (Y.text().then((A) => {
        t.importJSON(A) ? l.success(n("dashboard.importSuccess")) : l.error(n("dashboard.importError"));
      }), V.target.value = "");
    }
    function P(V) {
      t.importJSON(V) ? l.success(n("dashboard.importSuccess")) : l.error(n("dashboard.importError"));
    }
    const M = re(() => {
      const V = Wf(), Y = (i.value.presets ?? []).map((A) => ({ label: A.label, value: A.config }));
      return [{ label: "内置模板", value: V }, ...Y];
    }), q = re(() => [
      { key: "export", label: n("dashboard.export"), icon: ze.export },
      { key: "import", label: n("dashboard.import"), icon: ze.import },
      { type: "divider" },
      { key: "clear", label: n("dashboard.clearPanels"), icon: ze.delete, danger: !0 }
    ]);
    function Q(V) {
      V === "export" ? b() : V === "import" ? v() : V === "clear" && (d.value = !0);
    }
    return (V, Y) => (E(), B("div", fS, [
      f(t).isEditing ? (E(), B($e, { key: 0 }, [
        k(f(jl).Compact, null, {
          default: R(() => [
            k(f(tt), {
              onClick: Y[0] || (Y[0] = (A) => f(t).addPanelModalOpen = !0)
            }, {
              default: R(() => [
                y("span", {
                  class: Ae([f(ze).plus, "mr-1"])
                }, null, 2),
                ce(" " + I(f(n)("dashboard.addPanel")), 1)
              ]),
              _: 1
            }),
            k(f(Qe), {
              placeholder: "预设",
              "popup-match-select-width": !1,
              options: M.value,
              style: { "min-width": "80px" },
              onSelect: Y[1] || (Y[1] = (A) => P(A))
            }, null, 8, ["options"]),
            y("input", {
              ref_key: "fileInputRef",
              ref: c,
              type: "file",
              accept: ".json",
              style: { display: "none" },
              onChange: C
            }, null, 544),
            k(f(Vo), { trigger: ["click"] }, {
              overlay: R(() => [
                k(f(li), {
                  onClick: Y[2] || (Y[2] = ({ key: A }) => Q(A))
                }, {
                  default: R(() => [
                    (E(!0), B($e, null, Xe(q.value, (A) => (E(), B($e, {
                      key: A.key ?? A.type
                    }, [
                      A.type === "divider" ? (E(), Ce(f(li).Divider, { key: 0 })) : (E(), Ce(f(li).Item, {
                        key: A.key,
                        danger: A.danger
                      }, {
                        default: R(() => [
                          y("span", {
                            class: Ae([A.icon, "mr-1"])
                          }, null, 2),
                          ce(I(A.label), 1)
                        ]),
                        _: 2
                      }, 1032, ["danger"]))
                    ], 64))), 128))
                  ]),
                  _: 1
                })
              ]),
              default: R(() => [
                k(f(tt), null, {
                  default: R(() => [
                    y("span", {
                      class: Ae(f(ze).dotsVertical)
                    }, null, 2)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }),
        k(f(tt), {
          type: "primary",
          ghost: "",
          onClick: u
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).save, "mr-1"])
            }, null, 2),
            ce(" " + I(f(n)("dashboard.save")), 1)
          ]),
          _: 1
        }),
        k(f(tt), {
          danger: f(t).isDirty,
          onClick: p
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).cancel, "mr-1"])
            }, null, 2),
            ce(" " + I(f(n)("dashboard.cancel")), 1)
          ]),
          _: 1
        }, 8, ["danger"])
      ], 64)) : (E(), Ce(f(tt), {
        key: 1,
        onClick: f(t).startEditing
      }, {
        default: R(() => [
          y("span", {
            class: Ae([f(ze).edit, "mr-1"])
          }, null, 2),
          y("span", hS, I(f(n)("dashboard.edit")), 1)
        ]),
        _: 1
      }, 8, ["onClick"])),
      k(f(Ul), {
        open: s.value,
        "onUpdate:open": Y[3] || (Y[3] = (A) => s.value = A),
        title: f(n)("dashboard.cancelConfirmTitle"),
        "ok-text": f(n)("dashboard.cancelConfirmOk"),
        "cancel-text": f(n)("dashboard.cancelConfirmCancel"),
        "ok-button-props": { danger: !0 },
        onOk: m,
        onCancel: Y[4] || (Y[4] = (A) => s.value = !1)
      }, {
        default: R(() => [
          y("p", gS, I(f(n)("dashboard.cancelConfirmTitle")), 1)
        ]),
        _: 1
      }, 8, ["open", "title", "ok-text", "cancel-text"]),
      k(f(Ul), {
        open: d.value,
        "onUpdate:open": Y[5] || (Y[5] = (A) => d.value = A),
        title: f(n)("dashboard.clearConfirmTitle"),
        "ok-text": f(n)("dashboard.clearConfirmOk"),
        "ok-button-props": { danger: !0 },
        onOk: Y[6] || (Y[6] = () => {
          f(t).clearPanels(), d.value = !1;
        }),
        onCancel: Y[7] || (Y[7] = (A) => d.value = !1)
      }, {
        default: R(() => [
          y("p", pS, I(f(n)("dashboard.clearConfirmTitle")), 1)
        ]),
        _: 1
      }, 8, ["open", "title", "ok-text"])
    ]));
  }
}), mS = { class: "w-full min-h-screen flex flex-col" }, yS = {
  key: 1,
  class: "p-2"
}, bS = {
  key: 1,
  class: "flex-center h-64"
}, xS = { class: "text-center text-secondary" }, wS = { class: "text-sm mt-2" }, SS = 30, xs = 8, kS = 768, CS = /* @__PURE__ */ Me({
  __name: "DashboardPage",
  setup(e) {
    const { t } = nt(), n = hi(), i = Pi(), { config: l } = Fo(), s = re(() => l.value.canEdit !== !1), d = lc([...n.layouts]);
    Fe(
      () => n.layouts,
      (M) => {
        const q = d.value;
        q.length === M.length && q.every(
          (Q, V) => Q.i === M[V].i && Q.x === M[V].x && Q.y === M[V].y && Q.w === M[V].w && Q.h === M[V].h
        ) || (d.value = [...M]);
      }
    );
    function c(M) {
      d.value = M, n.setLayouts(M);
    }
    const u = fe(), p = fe(0), m = re(() => p.value > 0 && p.value < kS);
    let b = null;
    An(() => {
      u.value && (b = new ResizeObserver((M) => {
        p.value = M[0].contentRect.width;
      }), b.observe(u.value), p.value = u.value.getBoundingClientRect().width);
    }), Xi(() => {
      b?.disconnect();
    });
    let v = null;
    function C() {
      P(), n.autoRefresh > 0 && (v = setInterval(() => {
        n.refresh();
      }, n.autoRefresh * 1e3));
    }
    function P() {
      v && (clearInterval(v), v = null);
    }
    return Fe(() => n.autoRefresh, C), (M, q) => (E(), B("div", mS, [
      y("div", {
        class: "flex items-center gap-2 flex-wrap px-2 sticky top-0 z-10",
        style: He({
          background: f(i).isDark ? "#1a1a1a" : "#f5f5f5",
          border: `1px solid ${f(i).isDark ? "#303030" : "#e8e8e8"}`,
          height: "42px"
        })
      }, [
        k(qd),
        q[0] || (q[0] = y("div", { class: "flex-1" }, null, -1)),
        k(Ld),
        s.value ? (E(), Ce(vS, { key: 0 })) : ye("", !0)
      ], 4),
      y("div", {
        ref_key: "containerRef",
        ref: u,
        class: "flex-1 overflow-auto"
      }, [
        m.value ? (E(), B("div", {
          key: 0,
          class: "flex flex-col",
          style: He({ gap: `${xs}px`, padding: "8px" })
        }, [
          (E(!0), B($e, null, Xe(Object.keys(f(n).panels), (Q) => (E(), B("div", { key: Q }, [
            k(tc, { "panel-id": Q }, {
              default: R(() => [
                k(Fs, { "panel-id": Q }, null, 8, ["panel-id"])
              ]),
              _: 2
            }, 1032, ["panel-id"])
          ]))), 128))
        ], 4)) : (E(), B("div", yS, [
          p.value > 0 ? (E(), Ce(f(tm), {
            key: 0,
            layout: d.value,
            "col-num": 12,
            "row-height": SS,
            margin: [xs, xs],
            "is-draggable": s.value && f(n).isEditing,
            "is-resizable": s.value && f(n).isEditing,
            "vertical-compact": !0,
            onLayoutUpdated: c
          }, {
            item: R(({ item: Q }) => [
              k(tc, {
                "panel-id": String(Q.i)
              }, {
                default: R(() => [
                  k(Fs, {
                    "panel-id": String(Q.i)
                  }, null, 8, ["panel-id"])
                ]),
                _: 2
              }, 1032, ["panel-id"])
            ]),
            _: 1
          }, 8, ["layout", "margin", "is-draggable", "is-resizable"])) : ye("", !0),
          Object.keys(f(n).panels).length === 0 ? (E(), B("div", bS, [
            y("div", xS, [
              q[1] || (q[1] = y("div", { class: "text-4xl mb-4" }, [
                y("div", { class: "i-carbon:chart-combo-stacked" })
              ], -1)),
              y("div", null, I(f(t)("dashboard.empty")), 1),
              y("div", wS, I(f(t)("dashboard.emptyHint")), 1)
            ])
          ])) : ye("", !0)
        ]))
      ], 512),
      k(dS),
      k(Zw)
    ]));
  }
}), _S = { class: "flex justify-between items-center gap-2" }, MS = { style: { "font-size": "12px" } }, zS = { style: { "font-size": "10px", color: "var(--ant-color-text-quaternary)" } }, ws = /* @__PURE__ */ Me({
  __name: "ArgusGroupBy",
  props: {
    groupBy: {},
    cfg: {},
    signal: {},
    metricName: {},
    disabled: { type: Boolean, default: !1 }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, l = fe(""), s = fe([]), d = fe(!1), c = fe(!1);
    let u = null;
    Fe(
      [l, c, () => n.cfg?.url, () => n.cfg?.token, () => n.signal, () => n.metricName],
      () => {
        !n.cfg || !c.value || (u && clearTimeout(u), u = setTimeout(async () => {
          d.value = !0;
          try {
            const v = new Set(n.groupBy.map((P) => P.name)), C = await cf(n.cfg, {
              signal: n.signal,
              metricName: n.metricName,
              search: l.value
            });
            s.value = C.filter((P) => !v.has(P.name));
          } catch {
            s.value = [];
          } finally {
            d.value = !1;
          }
        }, 300));
      }
    );
    const p = re(() => n.groupBy.map((v) => v.name));
    function m(v) {
      const P = (Array.isArray(v) ? v : [v]).map((M) => {
        const q = s.value.find((V) => V.name === M), Q = n.groupBy.find((V) => V.name === M);
        return q ?? Q ?? { name: M, fieldDataType: "string", fieldContext: "tag" };
      });
      i("change", P);
    }
    const b = re(() => d.value ? Tn(Zn, { size: "small" }) : null);
    return (v, C) => (E(), Ce(f(Qe), {
      mode: "tags",
      size: "small",
      style: { flex: "1", "min-width": "160px" },
      placeholder: "不分组（全量汇总）",
      value: p.value,
      disabled: e.disabled,
      "filter-option": !1,
      "not-found-content": b.value,
      onSearch: C[0] || (C[0] = (P) => l.value = P),
      onFocus: C[1] || (C[1] = () => c.value = !0),
      onBlur: C[2] || (C[2] = () => {
        c.value = !1, l.value = "";
      }),
      onChange: m
    }, {
      default: R(() => [
        (E(!0), B($e, null, Xe(s.value, (P) => (E(), Ce(f(Qe).Option, {
          key: P.name,
          value: P.name
        }, {
          default: R(() => [
            y("div", _S, [
              y("span", MS, I(P.name), 1),
              y("span", zS, I([P.fieldContext, P.fieldDataType].filter(Boolean).join(" · ")), 1)
            ])
          ]),
          _: 2
        }, 1032, ["value"]))), 128))
      ]),
      _: 1
    }, 8, ["value", "disabled", "not-found-content"]));
  }
}), TS = { class: "flex flex-wrap gap-1 items-center" }, PS = { class: "font-medium" }, nc = /* @__PURE__ */ Me({
  __name: "ArgusQueryFunctions",
  props: {
    functions: {},
    signal: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, l = [
      { value: "cutOffMin", label: "Cut Off Min" },
      { value: "cutOffMax", label: "Cut Off Max" },
      { value: "clampMin", label: "Clamp Min" },
      { value: "clampMax", label: "Clamp Max" },
      { value: "absolute", label: "Absolute" },
      { value: "runningDiff", label: "Running Diff" },
      { value: "log2", label: "Log2" },
      { value: "log10", label: "Log10" },
      { value: "cumulativeSum", label: "Cumulative Sum" },
      { value: "ewma3", label: "EWMA 3" },
      { value: "ewma5", label: "EWMA 5" },
      { value: "ewma7", label: "EWMA 7" },
      { value: "median3", label: "Median 3" },
      { value: "median5", label: "Median 5" },
      { value: "median7", label: "Median 7" },
      { value: "timeShift", label: "Time Shift" },
      { value: "fillZero", label: "Fill Zero" }
    ], s = [{ value: "timeShift", label: "Time Shift" }], d = {
      cutOffMin: { showInput: !0, placeholder: "阈值" },
      cutOffMax: { showInput: !0, placeholder: "阈值" },
      clampMin: { showInput: !0, placeholder: "阈值" },
      clampMax: { showInput: !0, placeholder: "阈值" },
      absolute: { showInput: !1 },
      runningDiff: { showInput: !1 },
      log2: { showInput: !1 },
      log10: { showInput: !1 },
      cumulativeSum: { showInput: !1 },
      ewma3: { showInput: !0, placeholder: "Alpha" },
      ewma5: { showInput: !0, placeholder: "Alpha" },
      ewma7: { showInput: !0, placeholder: "Alpha" },
      median3: { showInput: !1 },
      median5: { showInput: !1 },
      median7: { showInput: !1 },
      timeShift: { showInput: !0, placeholder: "如 -1h" },
      fillZero: { showInput: !1 }
    }, c = re(
      () => n.signal === "logs" || n.signal === "traces" ? s : l
    );
    function u(b) {
      const v = d[b];
      i("change", [...n.functions, { name: b, args: v?.showInput ? [{ value: "" }] : [] }]);
    }
    function p(b) {
      i("change", n.functions.filter((v, C) => C !== b));
    }
    function m(b, v) {
      i("change", n.functions.map((C, P) => P === b ? { ...C, args: [{ value: v }] } : C));
    }
    return (b, v) => (E(), B("div", TS, [
      (E(!0), B($e, null, Xe(e.functions, (C, P) => (E(), B("div", {
        key: P,
        class: "inline-flex items-center gap-1 rounded px-1.5",
        style: { background: "#eee", "font-size": "12px" }
      }, [
        y("span", PS, I(C.name) + "(", 1),
        d[C.name]?.showInput ? (E(), Ce(f(Ze), {
          key: 0,
          class: "text-center",
          size: "small",
          bordered: !1,
          variant: "borderless",
          style: { width: "40px", padding: "0 2px", height: "20px" },
          placeholder: d[C.name]?.placeholder ?? "value",
          value: C.args[0]?.value ?? "",
          onChange: (M) => m(P, M.target.value)
        }, null, 8, ["placeholder", "value", "onChange"])) : ye("", !0),
        v[1] || (v[1] = y("span", null, ")", -1)),
        k(f(tt), {
          class: "p-0!",
          type: "link",
          size: "small",
          danger: "",
          onClick: (M) => p(P)
        }, {
          default: R(() => [
            y("span", {
              class: Ae(f(ze).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["onClick"])
      ]))), 128)),
      k(f(Vo), { trigger: "click" }, {
        overlay: R(() => [
          k(f(li), {
            onClick: v[0] || (v[0] = ({ key: C }) => u(String(C)))
          }, {
            default: R(() => [
              (E(!0), B($e, null, Xe(c.value, (C) => (E(), Ce(f(li).Item, {
                key: C.value
              }, {
                default: R(() => [
                  ce(I(C.label), 1)
                ]),
                _: 2
              }, 1024))), 128))
            ]),
            _: 1
          })
        ]),
        default: R(() => [
          k(f(tt), {
            size: "small",
            type: "dashed"
          }, {
            default: R(() => [
              y("span", {
                class: Ae([f(ze).plus, "mr-0.5"])
              }, null, 2),
              v[2] || (v[2] = ce("函数 ", -1))
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]));
  }
}), $S = {
  class: "bg-white p-2",
  style: { border: "1px solid #eee", "border-radius": "6px", "margin-bottom": "6px" }
}, ES = { class: "flex items-center gap-1 select-none" }, IS = { class: "flex gap-2 ml-1" }, AS = {
  key: 0,
  style: { "border-top": "1px solid var(--ant-color-border)" }
}, OS = {
  key: 0,
  class: "flex flex-col gap-2 p-2"
}, DS = { class: "flex flex-col gap-0.5" }, LS = { class: "flex items-center gap-1.5" }, qS = { class: "flex flex-col gap-0.5" }, RS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, NS = { class: "flex flex-col gap-0.5" }, VS = { class: "flex flex-col gap-0.5" }, FS = { class: "flex flex-col gap-0.5" }, BS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, HS = { class: "flex flex-col gap-0.5" }, WS = { class: "flex items-center gap-1" }, jS = { class: "flex flex-col gap-0.5" }, GS = { class: "flex items-center gap-1" }, YS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, US = { class: "flex flex-col gap-0.5" }, KS = { class: "flex flex-col gap-0.5" }, XS = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr 1fr" }
}, QS = { class: "flex flex-col gap-0.5" }, JS = { class: "flex flex-col gap-0.5" }, ZS = {
  key: 1,
  class: "flex flex-col gap-2 p-2"
}, ek = { class: "flex flex-col gap-0.5" }, tk = { class: "flex flex-col gap-0.5" }, nk = { class: "flex flex-col gap-1" }, ik = { class: "flex flex-col gap-0.5" }, lk = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, ok = { class: "flex flex-col gap-0.5" }, ak = { class: "flex flex-col gap-0.5" }, sk = { class: "flex flex-col gap-0.5" }, rk = {
  key: 2,
  class: "flex flex-col gap-1.5 p-2"
}, uk = { class: "flex items-center gap-1.5" }, ck = {
  key: 3,
  class: "flex flex-col gap-2 p-2"
}, dk = { class: "flex flex-col gap-0.5" }, fk = {
  class: "grid gap-2",
  style: { "grid-template-columns": "1fr auto" }
}, hk = { class: "flex flex-col gap-0.5" }, gk = { class: "flex flex-col gap-0.5" }, pk = /* @__PURE__ */ Me({
  __name: "QueryItemRow",
  props: {
    item: {},
    cfg: {},
    collapsed: { type: Boolean },
    canDelete: { type: Boolean }
  },
  emits: ["toggleCollapse", "toggleDisabled", "delete", "change"],
  setup(e, { emit: t }) {
    const n = e, i = t, l = re(() => n.item.type === "builder_formula"), s = re(() => n.item.spec.disabled), d = re(() => n.item.spec.name), c = fe(
      n.item.type === "builder_query" ? n.item.queryType ?? "builder" : "builder"
    ), u = [
      { label: "查询构建器", value: "builder" },
      { label: "PromQL", value: "promql" },
      { label: "ClickHouse SQL", value: "clickhouse_sql" }
    ], p = [
      { value: "metrics", label: "指标" },
      { value: "logs", label: "日志" },
      { value: "traces", label: "链路" }
    ];
    function m(U) {
      i("change", U);
    }
    function b(U) {
      if (n.item.type !== "builder_query")
        return;
      const $ = U === "metrics" ? [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }] : [{ expression: "count()" }];
      m({ ...n.item, spec: { ...n.item.spec, signal: U, aggregations: $ } });
    }
    function v(U) {
      n.item.type === "builder_query" && (c.value = U, m({ ...n.item, queryType: U }));
    }
    const C = fe([]), P = fe(!1);
    Fe(
      [() => n.cfg?.url, () => n.cfg?.token],
      async ([U, $]) => {
        P.value = !0;
        try {
          C.value = await uf({ url: U ?? "", token: $ ?? "" });
        } catch {
          C.value = [];
        } finally {
          P.value = !1;
        }
      },
      { immediate: !0 }
    );
    const M = re(
      () => n.item.type === "builder_query" ? n.item.spec : null
    ), q = re(
      () => M.value?.aggregations?.[0] ?? { metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }
    ), Q = re(
      () => q.value.metricType === "histogram" || q.value.metricType === "exponential_histogram"
    ), V = re(
      () => Q.value ? [{ value: "p50", label: "P50" }, { value: "p75", label: "P75" }, { value: "p90", label: "P90" }, { value: "p95", label: "P95" }, { value: "p99", label: "P99" }] : [{ value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }]
    ), Y = re(() => Q.value ? [] : q.value.metricType === "gauge" ? [{ value: "latest", label: "Latest" }, { value: "sum", label: "Sum" }, { value: "avg", label: "Avg" }, { value: "min", label: "Min" }, { value: "max", label: "Max" }, { value: "count", label: "Count" }, { value: "count_distinct", label: "Count Distinct" }] : [{ value: "increase", label: "Increase" }, { value: "rate", label: "Rate" }]);
    function A(U, $) {
      M.value && m({ ...n.item, spec: { ...M.value, [U]: $ } });
    }
    function H(U) {
      M.value && A("aggregations", [{ ...q.value, ...U }]);
    }
    function ee(U) {
      const G = C.value.find((ue) => ue.metricName === U)?.type ?? "";
      H({
        metricName: U,
        metricType: G,
        timeAggregation: G === "" ? "" : G === "gauge" ? "latest" : "rate",
        spaceAggregation: G === "histogram" || G === "exponential_histogram" ? "p99" : "sum"
      });
    }
    const z = re(
      () => M.value?.aggregations ?? []
    );
    function j() {
      M.value && A("aggregations", [...z.value, { expression: "count()" }]);
    }
    function J(U) {
      M.value && A("aggregations", z.value.filter(($, G) => G !== U));
    }
    function K(U, $) {
      M.value && A("aggregations", z.value.map((G, ue) => ue === U ? { expression: $ } : G));
    }
    function O(U) {
      if (!U) {
        A("order", []);
        return;
      }
      const $ = U.split(" "), G = $[$.length - 1], ie = { key: { name: $.slice(0, -1).join(" ") }, direction: G };
      A("order", [ie]);
    }
    function Z(U) {
      n.item.type === "builder_formula" && i("change", { ...n.item, spec: { ...n.item.spec, ...U } });
    }
    return (U, $) => (E(), B("div", $S, [
      y("div", ES, [
        y("span", {
          class: "flex items-center gap-1.5 flex-1 cursor-pointer",
          onClick: $[2] || ($[2] = (G) => i("toggleCollapse"))
        }, [
          y("span", {
            class: Ae([e.collapsed ? f(ze).chevronRight : f(ze).chevronDown, "text-16px"])
          }, null, 2),
          k(f(Kl), {
            color: l.value ? "purple" : "cyan",
            style: { margin: "0", "font-weight": "600", "font-size": "12px", "line-height": "18px", padding: "0 6px" }
          }, {
            default: R(() => [
              ce(I(d.value), 1)
            ]),
            _: 1
          }, 8, ["color"]),
          l.value ? ye("", !0) : (E(), B($e, { key: 0 }, [
            y("div", IS, [
              (E(), B($e, null, Xe(u, (G) => k(f(tt), {
                key: G.value,
                size: "small",
                type: c.value === G.value ? "primary" : "default",
                style: { "font-size": "12px", height: "22px" },
                onClick: En((ue) => v(G.value), ["stop"])
              }, {
                default: R(() => [
                  ce(I(G.label), 1)
                ]),
                _: 2
              }, 1032, ["type", "onClick"])), 64))
            ]),
            c.value === "builder" ? (E(), Ce(f(Qe), {
              key: 0,
              size: "small",
              style: { width: "80px" },
              value: e.item.spec.signal,
              options: p,
              onClick: $[0] || ($[0] = En(() => {
              }, ["stop"])),
              onChange: $[1] || ($[1] = (G) => b(G))
            }, null, 8, ["value"])) : ye("", !0),
            $[32] || ($[32] = y("div", { class: "flex-1" }, null, -1))
          ], 64))
        ]),
        k(f(tt), {
          class: "p-0!",
          size: "small",
          type: "link",
          onClick: $[3] || ($[3] = En((G) => i("toggleDisabled"), ["stop"]))
        }, {
          default: R(() => [
            y("span", {
              class: Ae(s.value ? f(ze).viewOff : f(ze).view)
            }, null, 2)
          ]),
          _: 1
        }),
        k(f(tt), {
          class: "p-0!",
          size: "small",
          type: "link",
          danger: "",
          disabled: !e.canDelete,
          onClick: $[4] || ($[4] = (G) => i("delete"))
        }, {
          default: R(() => [
            y("span", {
              class: Ae(f(ze).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled"])
      ]),
      e.collapsed ? ye("", !0) : (E(), B("div", AS, [
        e.item.type === "builder_query" && c.value === "builder" && e.item.spec.signal === "metrics" && M.value ? (E(), B("div", OS, [
          y("div", DS, [
            $[33] || ($[33] = y("span", { class: "text-xs text-secondary" }, "指标名称", -1)),
            y("div", LS, [
              ce(I(P.value) + " ", 1),
              k(f(Qe), {
                "show-search": "",
                "allow-clear": "",
                loading: P.value,
                size: "small",
                style: { flex: "1" },
                placeholder: "指标名称",
                value: q.value.metricName || void 0,
                options: C.value.map((G) => ({
                  value: G.metricName,
                  label: G.metricName
                })),
                "filter-option": (G, ue) => String(ue?.value ?? "").toLowerCase().includes(G.toLowerCase()),
                onChange: $[5] || ($[5] = (G) => ee(G)),
                onClear: $[6] || ($[6] = () => H({
                  metricName: "",
                  metricType: "",
                  timeAggregation: "rate",
                  spaceAggregation: "sum"
                }))
              }, null, 8, ["loading", "value", "options", "filter-option"]),
              q.value.metricType ? (E(), Ce(f(Kl), {
                key: 0,
                style: { "font-size": "10px", margin: "0" }
              }, {
                default: R(() => [
                  ce(I(q.value.metricType), 1)
                ]),
                _: 1
              })) : ye("", !0)
            ])
          ]),
          y("div", qS, [
            $[34] || ($[34] = y("span", { class: "text-xs text-secondary" }, "源数据筛选", -1)),
            k(f(Ze), {
              size: "small",
              placeholder: "如 host.name = 'my-host'",
              value: M.value.filter.expression,
              onChange: $[7] || ($[7] = (G) => A("filter", { expression: G.target.value }))
            }, null, 8, ["value"])
          ]),
          Q.value ? (E(), B($e, { key: 0 }, [
            y("div", RS, [
              y("div", NS, [
                $[35] || ($[35] = y("span", { class: "text-xs text-secondary" }, "跨时序聚合", -1)),
                k(f(Qe), {
                  size: "small",
                  value: q.value.spaceAggregation || void 0,
                  options: V.value,
                  disabled: !q.value.metricType,
                  onChange: $[8] || ($[8] = (G) => H({ spaceAggregation: G }))
                }, null, 8, ["value", "options", "disabled"])
              ]),
              y("div", VS, [
                $[36] || ($[36] = y("span", { class: "text-xs text-secondary" }, "分组", -1)),
                k(ws, {
                  "group-by": M.value.groupBy,
                  cfg: e.cfg,
                  signal: "metrics",
                  "metric-name": q.value.metricName,
                  disabled: !q.value.metricName,
                  onChange: $[9] || ($[9] = (G) => A("groupBy", G))
                }, null, 8, ["group-by", "cfg", "metric-name", "disabled"])
              ])
            ]),
            y("div", FS, [
              $[37] || ($[37] = y("span", { class: "text-xs text-secondary" }, "步长（秒）", -1)),
              k(f(on), {
                size: "small",
                style: { width: "100%" },
                placeholder: "自动",
                value: M.value.stepInterval ?? void 0,
                min: 1,
                onChange: $[10] || ($[10] = (G) => A("stepInterval", G ?? null))
              }, null, 8, ["value"])
            ])
          ], 64)) : (E(), B($e, { key: 1 }, [
            y("div", BS, [
              y("div", HS, [
                $[40] || ($[40] = y("span", { class: "text-xs text-secondary" }, "时序内聚合", -1)),
                y("div", WS, [
                  k(f(Qe), {
                    size: "small",
                    style: { flex: "1" },
                    value: q.value.timeAggregation || void 0,
                    options: Y.value,
                    disabled: !q.value.metricType,
                    onChange: $[11] || ($[11] = (G) => H({ timeAggregation: G }))
                  }, null, 8, ["value", "options", "disabled"]),
                  $[38] || ($[38] = y("span", { class: "text-xs text-secondary whitespace-nowrap" }, "每隔", -1)),
                  k(f(on), {
                    size: "small",
                    style: { width: "60px" },
                    placeholder: "自动",
                    value: M.value.stepInterval ?? void 0,
                    min: 1,
                    onChange: $[12] || ($[12] = (G) => A("stepInterval", G ?? null))
                  }, null, 8, ["value"]),
                  $[39] || ($[39] = y("span", { class: "text-xs text-secondary" }, "秒", -1))
                ])
              ]),
              y("div", jS, [
                $[41] || ($[41] = y("span", { class: "text-xs text-secondary" }, "跨时序聚合", -1)),
                y("div", GS, [
                  k(f(Qe), {
                    size: "small",
                    style: { width: "80px" },
                    value: q.value.spaceAggregation || void 0,
                    options: V.value,
                    disabled: !q.value.metricType,
                    onChange: $[13] || ($[13] = (G) => H({ spaceAggregation: G }))
                  }, null, 8, ["value", "options", "disabled"]),
                  k(ws, {
                    "group-by": M.value.groupBy,
                    cfg: e.cfg,
                    signal: "metrics",
                    "metric-name": q.value.metricName,
                    disabled: !q.value.metricName,
                    onChange: $[14] || ($[14] = (G) => A("groupBy", G))
                  }, null, 8, ["group-by", "cfg", "metric-name", "disabled"])
                ])
              ])
            ]),
            y("div", YS, [
              y("div", US, [
                $[42] || ($[42] = y("span", { class: "text-xs text-secondary" }, "聚合结果筛选", -1)),
                k(f(Ze), {
                  size: "small",
                  placeholder: "如 sum > 100",
                  value: M.value.having?.expression ?? "",
                  onChange: $[15] || ($[15] = (G) => A("having", { expression: G.target.value }))
                }, null, 8, ["value"])
              ]),
              y("div", KS, [
                $[43] || ($[43] = y("span", { class: "text-xs text-secondary" }, "条数", -1)),
                k(f(on), {
                  size: "small",
                  style: { width: "80px" },
                  placeholder: "∞",
                  value: M.value.limit ?? void 0,
                  min: 1,
                  onChange: $[16] || ($[16] = (G) => A("limit", G ?? void 0))
                }, null, 8, ["value"])
              ])
            ]),
            y("div", XS, [
              y("div", QS, [
                $[44] || ($[44] = y("span", { class: "text-xs text-secondary" }, "排序", -1)),
                k(f(Qe), {
                  size: "small",
                  "allow-clear": "",
                  placeholder: "字段 升序/降序",
                  value: M.value.order[0] ? `${M.value.order[0].key.name} ${M.value.order[0].direction}` : void 0,
                  options: [
                    { value: "value asc", label: "值 升序" },
                    { value: "value desc", label: "值 降序" }
                  ],
                  onChange: $[17] || ($[17] = (G) => O(G)),
                  onClear: $[18] || ($[18] = () => A("order", []))
                }, null, 8, ["value"])
              ]),
              y("div", JS, [
                $[45] || ($[45] = y("span", { class: "text-xs text-secondary" }, "图例", -1)),
                k(f(Ze), {
                  size: "small",
                  placeholder: "{{label}}",
                  value: M.value.legend,
                  onChange: $[19] || ($[19] = (G) => A("legend", G.target.value))
                }, null, 8, ["value"])
              ])
            ])
          ], 64)),
          k(nc, {
            functions: M.value.functions,
            signal: M.value.signal,
            onChange: $[20] || ($[20] = (G) => A("functions", G))
          }, null, 8, ["functions", "signal"])
        ])) : e.item.type === "builder_query" && c.value === "builder" && M.value ? (E(), B("div", ZS, [
          y("div", ek, [
            $[46] || ($[46] = y("span", { class: "text-xs text-secondary" }, "过滤条件", -1)),
            k(f(Ze), {
              size: "small",
              placeholder: "过滤表达式",
              value: M.value.filter.expression,
              onChange: $[21] || ($[21] = (G) => A("filter", { expression: G.target.value }))
            }, null, 8, ["value"])
          ]),
          y("div", tk, [
            $[49] || ($[49] = y("span", { class: "text-xs text-secondary" }, "聚合表达式", -1)),
            y("div", nk, [
              (E(!0), B($e, null, Xe(z.value, (G, ue) => (E(), B("div", {
                key: ue,
                class: "flex items-center gap-1"
              }, [
                k(f(Ze), {
                  size: "small",
                  style: { flex: "1" },
                  placeholder: "如 count() / avg(body)",
                  value: G.expression,
                  onChange: (ie) => K(ue, ie.target.value)
                }, null, 8, ["value", "onChange"]),
                z.value.length > 1 ? (E(), Ce(f(tt), {
                  key: 0,
                  size: "small",
                  type: "text",
                  danger: "",
                  onClick: (ie) => J(ue)
                }, {
                  default: R(() => [...$[47] || ($[47] = [
                    ce(" × ", -1)
                  ])]),
                  _: 1
                }, 8, ["onClick"])) : ye("", !0)
              ]))), 128)),
              k(f(tt), {
                size: "small",
                type: "dashed",
                style: { "align-self": "flex-start" },
                onClick: j
              }, {
                default: R(() => [
                  y("span", {
                    class: Ae([f(ze).plus, "mr-0.5"])
                  }, null, 2),
                  $[48] || ($[48] = ce("添加聚合 ", -1))
                ]),
                _: 1
              })
            ])
          ]),
          y("div", ik, [
            $[50] || ($[50] = y("span", { class: "text-xs text-secondary" }, "分组", -1)),
            k(ws, {
              "group-by": M.value.groupBy,
              cfg: e.cfg,
              signal: M.value.signal,
              onChange: $[22] || ($[22] = (G) => A("groupBy", G))
            }, null, 8, ["group-by", "cfg", "signal"])
          ]),
          y("div", lk, [
            y("div", ok, [
              $[51] || ($[51] = y("span", { class: "text-xs text-secondary" }, "聚合结果筛选", -1)),
              k(f(Ze), {
                size: "small",
                placeholder: "如 count > 100",
                value: M.value.having?.expression ?? "",
                onChange: $[23] || ($[23] = (G) => A("having", { expression: G.target.value }))
              }, null, 8, ["value"])
            ]),
            y("div", ak, [
              $[52] || ($[52] = y("span", { class: "text-xs text-secondary" }, "条数", -1)),
              k(f(on), {
                size: "small",
                style: { width: "80px" },
                placeholder: "∞",
                value: M.value.limit ?? void 0,
                min: 1,
                onChange: $[24] || ($[24] = (G) => A("limit", G ?? void 0))
              }, null, 8, ["value"])
            ])
          ]),
          y("div", sk, [
            $[53] || ($[53] = y("span", { class: "text-xs text-secondary" }, "图例", -1)),
            k(f(Ze), {
              size: "small",
              placeholder: "{{label}}",
              value: M.value.legend,
              onChange: $[25] || ($[25] = (G) => A("legend", G.target.value))
            }, null, 8, ["value"])
          ]),
          k(nc, {
            functions: M.value.functions,
            signal: M.value.signal,
            onChange: $[26] || ($[26] = (G) => A("functions", G))
          }, null, 8, ["functions", "signal"])
        ])) : e.item.type === "builder_query" && c.value !== "builder" ? (E(), B("div", rk, [
          k(f(Ze).TextArea, {
            rows: 4,
            placeholder: c.value === "promql" ? "输入 PromQL 查询语句…" : "输入 ClickHouse SQL 查询语句…",
            value: e.item.rawQuery ?? "",
            style: { "font-family": "monospace", "font-size": "12px" },
            onChange: $[27] || ($[27] = (G) => i("change", { ...e.item, rawQuery: G.target.value }))
          }, null, 8, ["placeholder", "value"]),
          y("div", uk, [
            $[54] || ($[54] = y("span", { class: "text-xs text-secondary whitespace-nowrap" }, "图例格式", -1)),
            k(f(Ze), {
              size: "small",
              style: { flex: "1" },
              placeholder: "{{label}}",
              value: e.item.rawLegend ?? "",
              onChange: $[28] || ($[28] = (G) => i("change", { ...e.item, rawLegend: G.target.value }))
            }, null, 8, ["value"])
          ])
        ])) : e.item.type === "builder_formula" ? (E(), B("div", ck, [
          y("div", dk, [
            $[55] || ($[55] = y("span", { class: "text-xs text-secondary" }, "表达式", -1)),
            k(f(Ze), {
              size: "small",
              placeholder: "如 A + B",
              value: e.item.spec.expression,
              onChange: $[29] || ($[29] = (G) => i("change", {
                ...e.item,
                spec: { ...e.item.spec, expression: G.target.value }
              }))
            }, null, 8, ["value"])
          ]),
          y("div", fk, [
            y("div", hk, [
              $[56] || ($[56] = y("span", { class: "text-xs text-secondary" }, "图例", -1)),
              k(f(Ze), {
                size: "small",
                placeholder: "图例格式",
                value: e.item.spec.legend,
                onChange: $[30] || ($[30] = (G) => Z({ legend: G.target.value }))
              }, null, 8, ["value"])
            ]),
            y("div", gk, [
              $[57] || ($[57] = y("span", { class: "text-xs text-secondary" }, "条数", -1)),
              k(f(on), {
                size: "small",
                style: { width: "80px" },
                placeholder: "∞",
                value: e.item.spec.limit ?? void 0,
                min: 1,
                onChange: $[31] || ($[31] = (G) => Z({ limit: G ?? void 0 }))
              }, null, 8, ["value"])
            ])
          ])
        ])) : ye("", !0)
      ]))
    ]));
  }
}), vk = { class: "flex flex-col gap-2 p-1" }, mk = {
  key: 0,
  class: "flex items-center gap-2 mb-1"
}, yk = { class: "flex gap-1.5 mt-1" }, bk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", xk = /* @__PURE__ */ Me({
  __name: "ArgusQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { config: l } = Fo(), s = re(
      () => (l.value.datasourceConfig ?? []).filter((Q) => Q.type === "argus")
    ), d = fe(/* @__PURE__ */ new Set());
    function c(Q) {
      return {
        name: Q,
        signal: "metrics",
        stepInterval: null,
        disabled: !1,
        filter: { expression: "" },
        having: { expression: "" },
        groupBy: [],
        order: [],
        legend: "",
        functions: [],
        aggregations: [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }]
      };
    }
    function u(Q) {
      return { name: Q, expression: "", disabled: !1, legend: "", order: [] };
    }
    function p(Q, V) {
      i("change", { ...n.query, [Q]: V });
    }
    function m() {
      const Q = n.query.queries.filter((A) => A.type === "builder_query"), V = bk[Q.length] ?? `Q${Q.length}`, Y = { type: "builder_query", spec: c(V) };
      i("change", { ...n.query, queries: [...n.query.queries, Y] });
    }
    function b() {
      const V = `F${n.query.queries.filter((A) => A.type === "builder_formula").length + 1}`, Y = { type: "builder_formula", spec: u(V) };
      i("change", { ...n.query, queries: [...n.query.queries, Y] });
    }
    function v(Q) {
      i("change", { ...n.query, queries: n.query.queries.filter((V) => V.spec.name !== Q) });
    }
    function C(Q) {
      i("change", {
        ...n.query,
        queries: n.query.queries.map((V) => V.spec.name === Q.spec.name ? Q : V)
      });
    }
    function P(Q) {
      const V = new Set(d.value);
      V.has(Q) ? V.delete(Q) : V.add(Q), d.value = V;
    }
    function M(Q) {
      C({ ...Q, spec: { ...Q.spec, disabled: !Q.spec.disabled } });
    }
    const q = re(() => {
      const Q = (l.value.datasourceConfig ?? []).filter((Y) => Y.type === "argus");
      if (!Q.length)
        return null;
      const V = Q.find((Y) => Y.uid === n.datasourceId) ?? Q.find((Y) => Y.default) ?? Q[0];
      return { url: V.url, token: V.token };
    });
    return (Q, V) => (E(), B("div", vk, [
      s.value.length > 1 ? (E(), B("div", mk, [
        V[1] || (V[1] = y("span", { class: "text-xs text-secondary whitespace-nowrap" }, "数据源", -1)),
        k(f(Qe), {
          size: "small",
          style: { width: "180px" },
          value: e.query.datasourceId,
          options: s.value.map((Y) => ({ value: Y.uid, label: Y.name })),
          onChange: V[0] || (V[0] = (Y) => p("datasourceId", Y))
        }, null, 8, ["value", "options"])
      ])) : ye("", !0),
      (E(!0), B($e, null, Xe(e.query.queries, (Y) => (E(), Ce(pk, {
        key: Y.spec.name,
        item: Y,
        cfg: q.value,
        collapsed: d.value.has(Y.spec.name),
        "can-delete": e.query.queries.length > 1,
        onToggleCollapse: () => P(Y.spec.name),
        onToggleDisabled: () => M(Y),
        onDelete: () => v(Y.spec.name),
        onChange: C
      }, null, 8, ["item", "cfg", "collapsed", "can-delete", "onToggleCollapse", "onToggleDisabled", "onDelete"]))), 128)),
      y("div", yk, [
        k(f(tt), {
          size: "small",
          type: "dashed",
          onClick: m
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).plus, "mr-1"])
            }, null, 2),
            V[2] || (V[2] = ce("基础查询 ", -1))
          ]),
          _: 1
        }),
        k(f(tt), {
          size: "small",
          type: "dashed",
          onClick: b
        }, {
          default: R(() => [
            y("span", {
              class: Ae([f(ze).plus, "mr-1"])
            }, null, 2),
            V[3] || (V[3] = ce("衍生算式 ", -1))
          ]),
          _: 1
        })
      ])
    ]));
  }
}), wk = { style: { "padding-top": "6px" } }, Sk = { class: "inline-flex items-center gap-1.5 mb-2" }, kk = { class: "text-xs text-secondary" }, Ck = {
  key: 0,
  class: "inline-flex items-center gap-1.5 mb-0 ml-2"
}, _k = { class: "text-xs text-secondary" }, Mk = {
  key: 1,
  class: "inline-flex items-center gap-1.5 mb-0 ml-2"
}, zk = { class: "text-xs text-secondary" }, Tk = {
  class: "text-xs text-secondary",
  style: { "min-width": "28px" }
}, Pk = /* @__PURE__ */ Me({
  __name: "MockQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = t, { t: i } = nt(), l = re(() => [
      { value: "sine", label: i("qb.pattern.sine") },
      { value: "spike", label: i("qb.pattern.spike") },
      { value: "step", label: i("qb.pattern.step") },
      { value: "sawtooth", label: i("qb.pattern.sawtooth") },
      { value: "noise", label: i("qb.pattern.noise") },
      { value: "trend-up", label: i("qb.pattern.trendUp") },
      { value: "trend-down", label: i("qb.pattern.trendDown") },
      { value: "plateau", label: i("qb.pattern.plateau") },
      { value: "random-walk", label: i("qb.pattern.randomWalk") },
      { value: "live", label: i("qb.pattern.live") }
    ]);
    return (s, d) => (E(), B("div", wk, [
      y("div", Sk, [
        y("span", kk, I(f(i)("qb.pattern")), 1),
        k(f(Qe), {
          size: "small",
          style: { width: "140px" },
          value: e.query.pattern,
          options: l.value,
          onChange: d[0] || (d[0] = (c) => n("change", { ...e.query, pattern: c }))
        }, null, 8, ["value", "options"])
      ]),
      e.isChart ? (E(), B("div", Ck, [
        y("span", _k, I(f(i)("qb.seriesCount")), 1),
        k(f(xn), {
          min: 1,
          max: 8,
          value: e.query.seriesCount ?? 1,
          style: { width: "200px" },
          onChange: d[1] || (d[1] = (c) => n("change", { ...e.query, seriesCount: c }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      e.query.pattern === "live" ? (E(), B("div", Mk, [
        y("span", zk, I(f(i)("qb.liveAmplitude")), 1),
        k(f(xn), {
          min: 0.1,
          max: 5,
          step: 0.1,
          value: e.query.liveAmplitude ?? 1,
          style: { width: "160px" },
          onChange: d[2] || (d[2] = (c) => n("change", { ...e.query, liveAmplitude: c }))
        }, null, 8, ["value"]),
        y("span", Tk, I((e.query.liveAmplitude ?? 1).toFixed(1)) + "x ", 1)
      ])) : ye("", !0)
    ]));
  }
}), cl = /* @__PURE__ */ Me({
  __name: "ComboSelect",
  props: {
    value: {},
    displayValue: {},
    placeholder: {},
    groups: {},
    allowCustom: { type: Boolean, default: !0 },
    loading: { type: Boolean, default: !1 },
    disabled: { type: Boolean, default: !1 }
  },
  emits: ["change", "clear"],
  setup(e, { emit: t }) {
    const n = e, i = t, l = fe(n.displayValue ?? n.value ?? "");
    Fe(
      [() => n.value, () => n.displayValue],
      ([u, p]) => {
        l.value = p ?? u ?? "";
      }
    );
    function s(u, p) {
      return u.toLowerCase().includes(p.toLowerCase());
    }
    const d = re(() => {
      const u = l.value, p = n.groups.flatMap((v) => v.options), m = n.allowCustom && u && !p.some((v) => v.value === u || v.label === u) ? [{ label: "── 自定义 ──", options: [{ value: u, label: u }] }] : [], b = u ? n.groups.map((v) => ({ ...v, options: v.options.filter((C) => s(C.label, u)) })).filter((v) => v.options.length > 0) : n.groups;
      return [...m, ...b];
    }), c = re(
      () => d.value.map((u) => ({
        label: u.label,
        options: u.options
      }))
    );
    return (u, p) => (E(), Ce(f(Qe), {
      size: "small",
      style: { width: "100%" },
      "show-search": "",
      "allow-clear": "",
      "filter-option": !1,
      value: e.value || void 0,
      "search-value": l.value,
      placeholder: e.placeholder,
      loading: e.loading,
      disabled: e.disabled,
      options: c.value,
      onFocus: p[0] || (p[0] = () => {
        l.value = e.displayValue ?? e.value ?? "";
      }),
      onSearch: p[1] || (p[1] = (m) => {
        l.value = m;
      }),
      onChange: p[2] || (p[2] = (m) => {
        l.value = String(m ?? ""), i("change", String(m));
      }),
      onClear: p[3] || (p[3] = () => {
        l.value = "", i("clear");
      })
    }, null, 8, ["value", "search-value", "placeholder", "loading", "disabled", "options"]));
  }
}), $k = { class: "flex flex-wrap items-center gap-1.5 mt-1" }, Ek = { class: "text-xs text-secondary" }, Ik = { class: "font-medium text-blue lh-1" }, Ak = /* @__PURE__ */ Me({
  __name: "FunctionsEditor",
  props: {
    functions: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: l } = nt();
    function s(C, P) {
      return P.length === 0 ? `${C.name}()` : `${C.name}(${P.join(", ")})`;
    }
    function d(C) {
      return { def: C, params: [...C.defaultParams], text: s(C, C.defaultParams) };
    }
    function c(C) {
      const P = C.filter((q) => q.def.category === "Alias");
      return [...C.filter((q) => q.def.category !== "Alias"), ...P];
    }
    function u(C) {
      const P = du.find((q) => q.name === C);
      if (!P)
        return;
      const M = d(P);
      i("change", c([...n.functions, M]));
    }
    function p(C, P, M) {
      const q = n.functions.map((Q, V) => {
        if (V !== C)
          return Q;
        const Y = [...Q.params];
        return Y[P] = M, { ...Q, params: Y, text: s(Q.def, Y) };
      });
      i("change", q);
    }
    function m(C) {
      i("change", n.functions.filter((P, M) => M !== C));
    }
    function b(C, P) {
      const M = C + P;
      if (M < 0 || M >= n.functions.length)
        return;
      const q = [...n.functions];
      [q[C], q[M]] = [q[M], q[C]], i("change", q);
    }
    const v = re(
      () => Wp.map((C) => ({
        key: C,
        label: C,
        children: du.filter((P) => P.category === C).map((P) => ({ key: P.name, label: P.name }))
      }))
    );
    return (C, P) => (E(), B("div", $k, [
      y("span", Ek, I(f(l)("qb.functions")), 1),
      (E(!0), B($e, null, Xe(e.functions, (M, q) => (E(), B("div", {
        key: q,
        class: "inline-flex items-center gap-0.5 rounded px-1",
        style: { background: "#eee", "font-size": "12px" }
      }, [
        k(f(tt), {
          type: "text",
          size: "small",
          class: "p-0!",
          disabled: q === 0,
          onClick: (Q) => b(q, -1)
        }, {
          default: R(() => [
            y("span", {
              class: Ae(f(ze).chevronLeft)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled", "onClick"]),
        y("span", Ik, I(M.def.name), 1),
        P[1] || (P[1] = y("span", { class: "text-yellow" }, "(", -1)),
        (E(!0), B($e, null, Xe(M.def.params, (Q, V) => (E(), B($e, { key: V }, [
          Q.options ? (E(), Ce(f(Qe), {
            key: 0,
            size: "small",
            value: String(M.params[V] ?? Q.options[0]),
            options: Q.options.map((Y) => ({ value: String(Y), label: String(Y) })),
            "popup-match-select-width": "false",
            bordered: !1,
            variant: "borderless",
            style: { "min-width": "60px" },
            onChange: (Y) => p(q, V, Y)
          }, null, 8, ["value", "options", "onChange"])) : (E(), Ce(f(Ze), {
            key: 1,
            class: "text-green text-center",
            size: "small",
            bordered: !1,
            value: String(M.params[V] ?? ""),
            style: { width: "40px", padding: "0 4px", height: "20px" },
            variant: "borderless",
            onChange: (Y) => p(q, V, Y.target.value)
          }, null, 8, ["value", "onChange"]))
        ], 64))), 128)),
        P[2] || (P[2] = y("span", { class: "text-yellow font-medium" }, ")", -1)),
        k(f(tt), {
          type: "text",
          size: "small",
          class: "p-0!",
          disabled: q === e.functions.length - 1,
          onClick: (Q) => b(q, 1)
        }, {
          default: R(() => [
            y("span", {
              class: Ae(f(ze).chevronRight)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["disabled", "onClick"]),
        k(f(tt), {
          type: "text",
          size: "small",
          class: "p-0!",
          danger: "",
          onClick: (Q) => m(q)
        }, {
          default: R(() => [
            y("span", {
              class: Ae(f(ze).delete)
            }, null, 2)
          ]),
          _: 1
        }, 8, ["onClick"])
      ]))), 128)),
      k(f(Vo), { trigger: ["click"] }, {
        overlay: R(() => [
          k(f(li), {
            onClick: P[0] || (P[0] = ({ key: M }) => u(String(M)))
          }, {
            default: R(() => [
              (E(!0), B($e, null, Xe(v.value, (M) => (E(), Ce(f(li).SubMenu, {
                key: M.key,
                title: M.label
              }, {
                default: R(() => [
                  (E(!0), B($e, null, Xe(M.children, (q) => (E(), Ce(f(li).Item, {
                    key: q.key
                  }, {
                    default: R(() => [
                      ce(I(q.label), 1)
                    ]),
                    _: 2
                  }, 1024))), 128))
                ]),
                _: 2
              }, 1032, ["title"]))), 128))
            ]),
            _: 1
          })
        ]),
        default: R(() => [
          k(f(tt), {
            size: "small",
            type: "dashed"
          }, {
            default: R(() => [
              ce(" + " + I(f(l)("qb.functions.add")), 1)
            ]),
            _: 1
          })
        ]),
        _: 1
      })
    ]));
  }
}), Ok = { class: "flex flex-wrap items-center gap-0 mt-3" }, Dk = { class: "text-xs text-secondary font-medium" }, Lk = { class: "text-xs" }, qk = { class: "inline-flex items-center gap-1.5 mr-3" }, Rk = { class: "text-xs text-secondary whitespace-nowrap" }, Nk = { class: "inline-flex items-center gap-1.5 mr-3" }, Vk = { class: "text-xs text-secondary whitespace-nowrap" }, Fk = { class: "inline-flex items-center gap-1.5 mr-3" }, Bk = { class: "text-xs text-secondary whitespace-nowrap" }, Hk = { class: "inline-flex items-center gap-1.5 mr-3" }, Wk = { class: "text-xs text-secondary whitespace-nowrap" }, jk = {
  key: 1,
  class: "inline-flex items-center gap-1.5 mr-3"
}, Gk = { class: "text-xs text-secondary whitespace-nowrap" }, Yk = { class: "inline-flex items-center gap-1.5 mr-3" }, Uk = { class: "text-xs text-secondary whitespace-nowrap" }, Kk = { class: "inline-flex items-center gap-1.5 mr-3" }, Xk = { class: "text-xs text-secondary whitespace-nowrap" }, Qk = { class: "inline-flex items-center gap-1.5 mr-3" }, Jk = { class: "text-xs text-secondary whitespace-nowrap" }, Zk = { class: "inline-flex items-center gap-1.5 mr-3" }, eC = { class: "text-xs text-secondary whitespace-nowrap" }, tC = { class: "inline-flex items-center gap-1.5 mr-3" }, nC = { class: "text-xs text-secondary whitespace-nowrap" }, iC = { class: "inline-flex items-center gap-1.5 mr-3" }, lC = { class: "text-xs text-secondary whitespace-nowrap" }, oC = { class: "inline-flex items-center gap-1.5 mr-3" }, aC = { class: "text-xs text-secondary whitespace-nowrap" }, sC = { class: "inline-flex items-center gap-1.5 mr-3" }, rC = { class: "text-xs text-secondary whitespace-nowrap" }, uC = /* @__PURE__ */ Me({
  __name: "OptionsEditor",
  props: {
    queryType: {},
    options: {}
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: l } = nt(), s = fe(!0);
    function d(m) {
      i("change", { ...n.options, ...m });
    }
    const c = [
      { value: 2, label: l("qb.ack.all") },
      { value: 0, label: l("qb.ack.unack") },
      { value: 1, label: l("qb.ack.ack") }
    ], u = [
      { value: "default", label: l("qb.sort.default") },
      { value: "lastchange", label: l("qb.sort.lastchange") },
      { value: "severity", label: l("qb.sort.severity") }
    ], p = [
      { value: "default", label: l("qb.trends.default") },
      { value: "true", label: l("qb.trends.true") },
      { value: "false", label: l("qb.trends.false") }
    ];
    return (m, b) => (E(), B("div", Ok, [
      y("div", {
        class: "inline-flex items-center gap-1.5 cursor-pointer py-1 mr-2 select-none flex-shrink-0",
        onClick: b[0] || (b[0] = (v) => s.value = !s.value)
      }, [
        y("span", Dk, I(f(l)("qb.options")), 1),
        y("span", Lk, I(s.value ? "▸" : "▾"), 1)
      ]),
      y("div", {
        class: "flex flex-wrap items-center overflow-hidden transition-all",
        style: He({ maxHeight: s.value ? "200px" : "0" })
      }, [
        e.queryType === "metrics" || e.queryType === "itemid" || e.queryType === "services" ? (E(), B($e, { key: 0 }, [
          y("div", qk, [
            y("span", Rk, I(f(l)("qb.options.trends")), 1),
            k(f(Qe), {
              size: "small",
              style: { width: "100px" },
              value: e.options.useTrends ?? "default",
              options: p,
              onChange: b[1] || (b[1] = (v) => d({ useTrends: v }))
            }, null, 8, ["value"])
          ]),
          y("div", Nk, [
            y("span", Vk, I(f(l)("qb.options.showDisabled")), 1),
            k(f(Ci), {
              size: "small",
              checked: !!e.options.showDisabledItems,
              onChange: b[2] || (b[2] = (v) => d({ showDisabledItems: v }))
            }, null, 8, ["checked"])
          ]),
          y("div", Fk, [
            y("span", Bk, I(f(l)("qb.options.valueMapping")), 1),
            k(f(Ci), {
              size: "small",
              checked: !!e.options.useZabbixValueMapping,
              onChange: b[3] || (b[3] = (v) => d({ useZabbixValueMapping: v }))
            }, null, 8, ["checked"])
          ]),
          y("div", Hk, [
            y("span", Wk, I(f(l)("qb.options.disableAlignment")), 1),
            k(f(Ci), {
              size: "small",
              checked: !!e.options.disableDataAlignment,
              onChange: b[4] || (b[4] = (v) => d({ disableDataAlignment: v }))
            }, null, 8, ["checked"])
          ])
        ], 64)) : ye("", !0),
        e.queryType === "text" ? (E(), B("div", jk, [
          y("span", Gk, I(f(l)("qb.options.showDisabled")), 1),
          k(f(Ci), {
            size: "small",
            checked: !!e.options.showDisabledItems,
            onChange: b[5] || (b[5] = (v) => d({ showDisabledItems: v }))
          }, null, 8, ["checked"])
        ])) : ye("", !0),
        e.queryType === "problems" ? (E(), B($e, { key: 2 }, [
          y("div", Yk, [
            y("span", Uk, I(f(l)("qb.options.acknowledged")), 1),
            k(f(Qe), {
              size: "small",
              style: { width: "140px" },
              value: e.options.acknowledged ?? 2,
              options: c,
              onChange: b[6] || (b[6] = (v) => d({ acknowledged: v }))
            }, null, 8, ["value"])
          ]),
          y("div", Kk, [
            y("span", Xk, I(f(l)("qb.options.sortBy")), 1),
            k(f(Qe), {
              size: "small",
              style: { width: "120px" },
              value: e.options.sortProblems ?? "default",
              options: u,
              onChange: b[7] || (b[7] = (v) => d({ sortProblems: v }))
            }, null, 8, ["value"])
          ]),
          y("div", Qk, [
            y("span", Jk, I(f(l)("qb.options.useTimeRange")), 1),
            k(f(Ci), {
              size: "small",
              checked: !!e.options.useTimeRange,
              onChange: b[8] || (b[8] = (v) => d({ useTimeRange: v }))
            }, null, 8, ["checked"])
          ]),
          y("div", Zk, [
            y("span", eC, I(f(l)("qb.options.hostsInMaintenance")), 1),
            k(f(Ci), {
              size: "small",
              checked: !!e.options.hostsInMaintenance,
              onChange: b[9] || (b[9] = (v) => d({ hostsInMaintenance: v }))
            }, null, 8, ["checked"])
          ]),
          y("div", tC, [
            y("span", nC, I(f(l)("qb.options.hostProxy")), 1),
            k(f(Ci), {
              size: "small",
              checked: !!e.options.hostProxy,
              onChange: b[10] || (b[10] = (v) => d({ hostProxy: v }))
            }, null, 8, ["checked"])
          ]),
          y("div", iC, [
            y("span", lC, I(f(l)("qb.options.limit")), 1),
            k(f(Ze), {
              size: "small",
              type: "number",
              style: { width: "80px" },
              value: e.options.limit ?? 100,
              onChange: b[11] || (b[11] = (v) => d({ limit: Number(v.target.value) }))
            }, null, 8, ["value"])
          ])
        ], 64)) : ye("", !0),
        e.queryType === "triggers" ? (E(), B($e, { key: 3 }, [
          y("div", oC, [
            y("span", aC, I(f(l)("qb.options.acknowledged")), 1),
            k(f(Qe), {
              size: "small",
              style: { width: "140px" },
              value: e.options.acknowledged ?? 2,
              options: c,
              onChange: b[12] || (b[12] = (v) => d({ acknowledged: v }))
            }, null, 8, ["value"])
          ]),
          y("div", sC, [
            y("span", rC, I(f(l)("qb.options.useTimeRange")), 1),
            k(f(Ci), {
              size: "small",
              checked: !!e.options.useTimeRange,
              onChange: b[13] || (b[13] = (v) => d({ useTimeRange: v }))
            }, null, 8, ["checked"])
          ])
        ], 64)) : ye("", !0)
      ], 4)
    ]));
  }
});
function Rd(e) {
  const t = to();
  return re(() => {
    const n = e();
    if (!n)
      return [];
    if (!n.startsWith("$"))
      return [n];
    const i = n.slice(1), l = Object.values(t.variables).find(
      (c) => c.config.name === i
    );
    if (!l)
      return [];
    const s = l.current, d = Array.isArray(s) ? s : [s];
    return d.includes("$__all") ? l.options.map((c) => c.value).filter((c) => c !== "$__all") : d.filter(Boolean);
  });
}
function cC(e, t) {
  const n = fe([]), i = fe([]), l = fe(!1), s = fe(!1), d = Rd(() => e().groupId);
  return Fe(
    () => ({ url: t().url, token: t().token }),
    async ({ url: c, token: u }) => {
      if (c) {
        l.value = !0, n.value = [];
        try {
          n.value = await Dp({ url: c, token: u });
        } catch {
        } finally {
          l.value = !1;
        }
      }
    },
    { immediate: !0, deep: !0 }
  ), Fe(
    [d, () => t().url, () => t().token],
    async ([c, u, p]) => {
      if (!u || c.length === 0) {
        i.value = [];
        return;
      }
      s.value = !0, i.value = [];
      try {
        i.value = await Lp(c, void 0, { url: u, token: p });
      } catch {
      } finally {
        s.value = !1;
      }
    },
    { immediate: !0 }
  ), { groups: n, hosts: i, loadingGroups: l, loadingHosts: s, resolvedGroupIds: d };
}
function dC(e) {
  const { config: t } = Fo(), n = re(() => (t.value.datasourceConfig ?? []).filter((d) => d.type === "zabbix").map((d, c) => ({
    uid: d.uid || String(c),
    name: d.name,
    url: d.url,
    token: d.token,
    isDefault: !!d.default
  }))), i = re(() => {
    const s = Yd(e);
    return n.value.find((c) => c.uid === s) ?? n.value[0] ?? { url: "", token: "" };
  }), l = re(
    () => n.value.find((s) => s.isDefault)?.uid ?? n.value[0]?.uid ?? ""
  );
  return { sources: n, cfg: i, defaultUid: l };
}
const fC = {
  class: "flex flex-col gap-3 p-2",
  style: { "font-size": "12px" }
}, hC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, gC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, pC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, vC = { key: 0 }, mC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, yC = {
  key: 1,
  style: { "max-width": "400px" }
}, bC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, xC = {
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr" }
}, wC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, SC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, kC = { class: "flex items-center gap-2" }, CC = {
  class: "text-secondary",
  style: { "font-size": "11px" }
}, _C = { key: 3 }, MC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, zC = { key: 4 }, TC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, PC = {
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr 1fr" }
}, $C = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, EC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, IC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, AC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, OC = { class: "flex flex-wrap gap-1" }, DC = {
  key: 6,
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr 1fr" }
}, LC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, qC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, RC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, NC = { key: 7 }, VC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, FC = {
  key: 8,
  class: "grid gap-3",
  style: { "grid-template-columns": "1fr 1fr" }
}, BC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, HC = {
  class: "text-secondary mb-1",
  style: { "font-size": "11px" }
}, WC = /* @__PURE__ */ Me({
  __name: "ZabbixQueryEditor",
  props: {
    query: {},
    datasourceId: {},
    isChart: { type: Boolean }
  },
  emits: ["change"],
  setup(e, { emit: t }) {
    const n = e, i = t, { t: l } = nt(), { cfg: s } = dC(() => n.datasourceId), d = to();
    function c(ke) {
      i("change", { ...n.query, ...ke });
    }
    const u = re(
      () => Object.values(d.variables).map((ke) => ({
        value: `$${ke.config.name}`,
        label: `$${ke.config.name}`
      }))
    );
    function p(ke, se) {
      const oe = [];
      return u.value.length > 0 && oe.push({ label: "── 变量 ──", options: u.value }), oe.push({ label: ke, options: se }), oe;
    }
    function m(ke) {
      return typeof ke == "string" && ke.startsWith("$");
    }
    const { groups: b, hosts: v, loadingGroups: C, loadingHosts: P } = cC(
      () => n.query,
      () => s.value
    ), M = Rd(() => n.query.hostId), q = re(
      () => b.value.map((ke) => ({ value: ke.groupid, label: ke.name }))
    ), Q = re(
      () => v.value.map((ke) => ({ value: ke.hostid, label: ke.name || ke.host }))
    ), V = fe([]), Y = fe(!1);
    Fe(
      [
        M,
        () => s.value.url,
        () => s.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "metrics") {
          V.value = [];
          return;
        }
        if (!ke.length || !se) {
          V.value = [];
          return;
        }
        Y.value = !0;
        try {
          V.value = (await Promise.all(
            ke.map(
              (be) => qp([be], void 0, void 0, { url: se, token: oe })
            )
          )).flat();
        } catch {
          V.value = [];
        } finally {
          Y.value = !1;
        }
      },
      { immediate: !0 }
    );
    const A = re(() => {
      const ke = /* @__PURE__ */ new Set();
      return V.value.flatMap(
        (se) => (se.tags ?? []).map((oe) => Rp(oe))
      ).filter((se) => ke.has(se) ? !1 : (ke.add(se), !0)).map((se) => ({ value: se, label: se }));
    }), H = re(() => {
      if (!n.query.itemTagsFilter)
        return V.value;
      const [ke, se] = n.query.itemTagsFilter.split(":").map((oe) => oe.trim());
      return V.value.filter(
        (oe) => (oe.tags ?? []).some(
          (Te) => Te.tag === ke && (se ? Te.value === se : !0)
        )
      );
    }), ee = re(() => {
      const ke = /* @__PURE__ */ new Set();
      return H.value.map((se) => se.name).filter((se) => ke.has(se) ? !1 : (ke.add(se), !0)).map((se) => ({ value: se, label: se }));
    }), z = fe([]), j = fe(!1);
    Fe(
      [
        () => n.query.hostId,
        () => s.value.url,
        () => s.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "text" || !ke || !se) {
          z.value = [];
          return;
        }
        j.value = !0;
        try {
          z.value = await Np([ke], void 0, { url: se, token: oe });
        } catch {
          z.value = [];
        } finally {
          j.value = !1;
        }
      },
      { immediate: !0 }
    );
    const J = re(() => {
      const ke = /* @__PURE__ */ new Set();
      return z.value.map((se) => se.name).filter((se) => ke.has(se) ? !1 : (ke.add(se), !0)).map((se) => ({ value: se, label: se }));
    }), K = fe([]), O = fe(!1);
    Fe(
      [() => s.value.url, () => s.value.token, () => n.query.queryType],
      async ([ke, se, oe]) => {
        if (!(oe !== "services" || !ke)) {
          O.value = !0;
          try {
            K.value = await Fp({ url: ke, token: se });
          } catch {
            K.value = [];
          } finally {
            O.value = !1;
          }
        }
      },
      { immediate: !0 }
    );
    const Z = fe([]), U = fe(!1);
    Fe(
      [
        () => n.query.hostId,
        () => s.value.url,
        () => s.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "macros" || !ke || !se) {
          Z.value = [];
          return;
        }
        U.value = !0;
        try {
          Z.value = await Vp([ke], { url: se, token: oe });
        } catch {
          Z.value = [];
        } finally {
          U.value = !1;
        }
      },
      { immediate: !0 }
    );
    const $ = fe([]), G = fe(!1), ue = fe([]), ie = fe(!1);
    Fe(
      [
        () => n.query.hostId,
        () => s.value.url,
        () => s.value.token,
        () => n.query.queryType
      ],
      async ([ke, se, oe, Te]) => {
        if (Te !== "lld" || !ke || ke.startsWith("$") || !se) {
          $.value = [];
          return;
        }
        G.value = !0;
        try {
          $.value = await Bp([ke], { url: se, token: oe });
        } catch {
          $.value = [];
        } finally {
          G.value = !1;
        }
      },
      { immediate: !0 }
    ), Fe(
      [() => n.query.lldRuleId, () => s.value.url, () => s.value.token],
      async ([ke, se, oe]) => {
        if (!ke || !se) {
          ue.value = [];
          return;
        }
        ie.value = !0;
        try {
          const Te = /* @__PURE__ */ new Set();
          ue.value = (await Hp(ke, { url: se, token: oe })).map((be) => {
            const Le = be.key_.includes("[") ? be.key_.slice(0, be.key_.indexOf("[")) : be.key_;
            return { value: Le, label: `${be.name} (${Le})` };
          }).filter((be) => Te.has(be.value) ? !1 : (Te.add(be.value), !0));
        } catch {
          ue.value = [];
        } finally {
          ie.value = !1;
        }
      },
      { immediate: !0 }
    );
    const Ee = [
      "metrics",
      "text",
      "services",
      "itemid",
      "triggers",
      "problems",
      "macros",
      "lld"
    ], ve = [
      "problems",
      "recent",
      "history"
    ], ge = {
      problems: "Problems",
      recent: "Recent problems",
      history: "History"
    }, le = [
      { value: 0, label: "Not classified", color: "#97aab3" },
      { value: 1, label: "Information", color: "#7499ff" },
      { value: 2, label: "Warning", color: "#ffc859" },
      { value: 3, label: "Average", color: "#ffa059" },
      { value: 4, label: "High", color: "#e97659" },
      { value: 5, label: "Disaster", color: "#e45959" }
    ], me = [
      { value: "status", label: "Status" },
      { value: "sli", label: "SLI" },
      { value: "uptime", label: "Uptime" },
      { value: "downtime", label: "Downtime" },
      { value: "error_budget", label: "Error budget" }
    ], Oe = [
      { value: "none", label: "No interval" },
      { value: "auto", label: "Auto" },
      { value: "1h", label: "1 hour" },
      { value: "12h", label: "12 hours" },
      { value: "1d", label: "24 hours" },
      { value: "1w", label: "1 week" },
      { value: "1M", label: "1 month" }
    ], xe = re(
      () => ["metrics", "text", "triggers", "problems", "macros", "lld"].includes(
        n.query.queryType
      )
    );
    return (ke, se) => (E(), B("div", fC, [
      y("div", null, [
        y("div", hC, I(f(l)("qb.queryType")), 1),
        k(f(Qe), {
          size: "small",
          style: { width: "100%" },
          value: e.query.queryType,
          options: Ee.map((oe) => ({
            value: oe,
            label: f(l)(`qb.queryType.${oe}`)
          })),
          onChange: se[0] || (se[0] = (oe) => c({ queryType: oe, itemIds: [], itemNames: [], itemids: "" }))
        }, null, 8, ["value", "options"])
      ]),
      xe.value ? (E(), B("div", {
        key: 0,
        class: "grid gap-3",
        style: He({ gridTemplateColumns: e.query.queryType === "metrics" ? "repeat(3, 1fr)" : "repeat(2, 1fr)" })
      }, [
        y("div", null, [
          y("div", gC, I(f(l)("panel.group")), 1),
          k(f(Zn), {
            spinning: f(C),
            size: "small"
          }, {
            default: R(() => [
              k(cl, {
                value: e.query.groupId || void 0,
                "display-value": e.query.groupName || void 0,
                placeholder: f(l)("panel.group.placeholder"),
                groups: p("── 主机组 ──", q.value),
                onChange: se[1] || (se[1] = (oe) => c({ groupId: oe, groupName: m(oe) ? oe : f(b).find((Te) => Te.groupid === oe)?.name ?? oe, hostId: "", hostName: "", itemIds: [], itemNames: [] })),
                onClear: se[2] || (se[2] = () => c({ groupId: "", groupName: "", hostId: "", hostName: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "display-value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        y("div", null, [
          y("div", pC, I(f(l)("panel.host")), 1),
          k(f(Zn), {
            spinning: f(P),
            size: "small"
          }, {
            default: R(() => [
              k(cl, {
                value: e.query.hostId || void 0,
                "display-value": e.query.hostName || void 0,
                placeholder: f(l)("panel.host.placeholder"),
                groups: p("── 主机 ──", Q.value),
                onChange: se[3] || (se[3] = (oe) => c({ hostId: oe, hostName: m(oe) ? oe : f(v).find((Te) => Te.hostid === oe)?.name ?? oe, itemIds: [], itemNames: [] })),
                onClear: se[4] || (se[4] = () => c({ hostId: "", hostName: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "display-value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        e.query.queryType === "metrics" ? (E(), B("div", vC, [
          y("div", mC, I(f(l)("panel.itemTag")), 1),
          k(f(Zn), {
            spinning: Y.value,
            size: "small"
          }, {
            default: R(() => [
              k(cl, {
                value: e.query.itemTagsFilter || void 0,
                placeholder: f(l)("panel.itemTag.placeholder"),
                groups: p("── 标签 ──", A.value),
                onChange: se[5] || (se[5] = (oe) => c({ itemTagsFilter: oe ?? "", itemIds: [], itemNames: [] })),
                onClear: se[6] || (se[6] = () => c({ itemTagsFilter: "", itemIds: [], itemNames: [] }))
              }, null, 8, ["value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ])) : ye("", !0)
      ], 4)) : ye("", !0),
      e.query.queryType === "metrics" ? (E(), B("div", yC, [
        y("div", bC, I(f(l)("panel.items")), 1),
        k(cl, {
          value: e.query.itemNames[0] || void 0,
          placeholder: f(l)("panel.items.placeholder"),
          groups: p("── 监控项 ──", ee.value),
          onChange: se[7] || (se[7] = (oe) => c({ itemNames: [oe], itemIds: [] })),
          onClear: se[8] || (se[8] = () => c({ itemNames: [], itemIds: [] }))
        }, null, 8, ["value", "placeholder", "groups"])
      ])) : ye("", !0),
      e.query.queryType === "text" ? (E(), B($e, { key: 2 }, [
        y("div", xC, [
          y("div", null, [
            y("div", wC, I(f(l)("panel.items")), 1),
            k(f(Zn), {
              spinning: j.value,
              size: "small"
            }, {
              default: R(() => [
                k(cl, {
                  value: e.query.itemNames[0] || void 0,
                  placeholder: f(l)("panel.items.placeholder"),
                  disabled: !e.query.hostId,
                  groups: p("── 监控项 ──", J.value),
                  onChange: se[9] || (se[9] = (oe) => c({ itemNames: [oe], itemIds: [] })),
                  onClear: se[10] || (se[10] = () => c({ itemNames: [], itemIds: [] }))
                }, null, 8, ["value", "placeholder", "disabled", "groups"])
              ]),
              _: 1
            }, 8, ["spinning"])
          ]),
          y("div", null, [
            y("div", SC, I(f(l)("qb.textFilter")), 1),
            k(f(Ze), {
              size: "small",
              style: { width: "100%" },
              value: e.query.textFilter,
              onChange: se[11] || (se[11] = (oe) => c({ textFilter: oe.target.value }))
            }, null, 8, ["value"])
          ])
        ]),
        y("div", kC, [
          k(f(Ui), {
            checked: e.query.useCaptureGroups,
            onChange: se[12] || (se[12] = (oe) => c({ useCaptureGroups: oe.target.checked }))
          }, null, 8, ["checked"]),
          y("span", CC, I(f(l)("qb.useCaptureGroups")), 1)
        ])
      ], 64)) : ye("", !0),
      e.query.queryType === "itemid" ? (E(), B("div", _C, [
        y("div", MC, I(f(l)("qb.itemIds")), 1),
        k(f(Ze), {
          size: "small",
          style: { width: "100%" },
          value: e.query.itemids,
          placeholder: f(l)("qb.itemIds.placeholder"),
          onChange: se[13] || (se[13] = (oe) => c({ itemids: oe.target.value }))
        }, null, 8, ["value", "placeholder"])
      ])) : ye("", !0),
      e.query.queryType === "triggers" ? (E(), B("div", zC, [
        y("div", TC, I(f(l)("qb.triggerFilter")), 1),
        k(f(Ze), {
          size: "small",
          style: { width: "100%" },
          value: e.query.triggerFilter,
          onChange: se[14] || (se[14] = (oe) => c({ triggerFilter: oe.target.value }))
        }, null, 8, ["value"])
      ])) : ye("", !0),
      e.query.queryType === "problems" ? (E(), B($e, { key: 5 }, [
        y("div", PC, [
          y("div", null, [
            y("div", $C, I(f(l)("qb.problemName")), 1),
            k(f(Ze), {
              size: "small",
              style: { width: "100%" },
              value: e.query.triggerFilter,
              onChange: se[15] || (se[15] = (oe) => c({ triggerFilter: oe.target.value }))
            }, null, 8, ["value"])
          ]),
          y("div", null, [
            y("div", EC, I(f(l)("qb.tags")), 1),
            k(f(Ze), {
              size: "small",
              style: { width: "100%" },
              value: e.query.tagsFilter,
              onChange: se[16] || (se[16] = (oe) => c({ tagsFilter: oe.target.value }))
            }, null, 8, ["value"])
          ]),
          y("div", null, [
            y("div", IC, I(f(l)("qb.show")), 1),
            k(f(Qe), {
              size: "small",
              style: { width: "100%" },
              value: e.query.showProblems,
              options: ve.map((oe) => ({ value: oe, label: ge[oe] })),
              onChange: se[17] || (se[17] = (oe) => c({ showProblems: oe }))
            }, null, 8, ["value", "options"])
          ])
        ]),
        y("div", null, [
          y("div", AC, I(f(l)("qb.severity")), 1),
          y("div", OC, [
            (E(), B($e, null, Xe(le, (oe) => k(f(Kl), {
              key: oe.value,
              color: e.query.severities.includes(oe.value) ? oe.color : void 0,
              class: "cursor-pointer select-none",
              style: He({ opacity: e.query.severities.includes(oe.value) ? 1 : 0.4 }),
              onClick: () => c({ severities: e.query.severities.includes(oe.value) ? e.query.severities.filter((Te) => Te !== oe.value) : [...e.query.severities, oe.value] })
            }, {
              default: R(() => [
                ce(I(oe.label), 1)
              ]),
              _: 2
            }, 1032, ["color", "style", "onClick"])), 64))
          ])
        ])
      ], 64)) : ye("", !0),
      e.query.queryType === "services" ? (E(), B("div", DC, [
        y("div", null, [
          y("div", LC, I(f(l)("qb.itService")), 1),
          k(f(Zn), {
            spinning: O.value,
            size: "small"
          }, {
            default: R(() => [
              k(cl, {
                value: e.query.itServiceFilter || void 0,
                placeholder: f(l)("qb.itService.placeholder"),
                groups: p("── 服务 ──", K.value.map((oe) => ({ value: oe.name, label: oe.name }))),
                onChange: se[18] || (se[18] = (oe) => c({ itServiceFilter: oe })),
                onClear: se[19] || (se[19] = () => c({ itServiceFilter: "" }))
              }, null, 8, ["value", "placeholder", "groups"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        y("div", null, [
          y("div", qC, I(f(l)("qb.slaProperty")), 1),
          k(f(Qe), {
            size: "small",
            style: { width: "100%" },
            value: e.query.slaProperty,
            options: me,
            onChange: se[20] || (se[20] = (oe) => c({ slaProperty: oe }))
          }, null, 8, ["value"])
        ]),
        y("div", null, [
          y("div", RC, I(f(l)("qb.slaInterval")), 1),
          k(f(Qe), {
            size: "small",
            style: { width: "100%" },
            value: e.query.slaInterval,
            options: Oe,
            onChange: se[21] || (se[21] = (oe) => c({ slaInterval: oe }))
          }, null, 8, ["value"])
        ])
      ])) : ye("", !0),
      e.query.queryType === "macros" ? (E(), B("div", NC, [
        y("div", VC, I(f(l)("qb.macroFilter")), 1),
        k(f(Zn), {
          spinning: U.value,
          size: "small"
        }, {
          default: R(() => [
            k(cl, {
              value: e.query.macroFilter || void 0,
              placeholder: "{$MACRO_NAME}",
              disabled: !e.query.hostId,
              groups: [{ label: "── 宏 ──", options: Z.value.map((oe) => ({ value: oe.macro, label: `${oe.macro} = ${oe.value}` })) }],
              onChange: se[22] || (se[22] = (oe) => c({ macroFilter: oe })),
              onClear: se[23] || (se[23] = () => c({ macroFilter: "" }))
            }, null, 8, ["value", "disabled", "groups"])
          ]),
          _: 1
        }, 8, ["spinning"])
      ])) : ye("", !0),
      e.query.queryType === "lld" ? (E(), B("div", FC, [
        y("div", null, [
          y("div", BC, I(f(l)("qb.lld.rule")), 1),
          k(f(Zn), {
            spinning: G.value,
            size: "small"
          }, {
            default: R(() => [
              k(f(Qe), {
                size: "small",
                style: { width: "100%" },
                "allow-clear": "",
                "show-search": "",
                value: e.query.lldRuleId || void 0,
                placeholder: f(l)("qb.lld.rule.placeholder"),
                options: $.value.map((oe) => ({ value: oe.itemid, label: oe.name })),
                onChange: se[24] || (se[24] = (oe) => c({ lldRuleId: oe, lldRuleName: $.value.find((Te) => Te.itemid === oe)?.name ?? oe, lldItemKeys: [] })),
                onClear: se[25] || (se[25] = () => c({ lldRuleId: "", lldRuleName: "", lldItemKeys: [] }))
              }, null, 8, ["value", "placeholder", "options"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ]),
        y("div", null, [
          y("div", HC, I(f(l)("qb.lld.itemKeys")), 1),
          k(f(Zn), {
            spinning: ie.value,
            size: "small"
          }, {
            default: R(() => [
              k(f(Qe), {
                size: "small",
                style: { width: "100%" },
                mode: "multiple",
                "allow-clear": "",
                value: e.query.lldItemKeys ?? [],
                options: ue.value,
                onChange: se[26] || (se[26] = (oe) => c({ lldItemKeys: oe }))
              }, null, 8, ["value", "options"])
            ]),
            _: 1
          }, 8, ["spinning"])
        ])
      ])) : ye("", !0),
      ["metrics", "itemid", "services"].includes(e.query.queryType) ? (E(), Ce(Ak, {
        key: 9,
        functions: e.query.functions ?? [],
        onChange: se[27] || (se[27] = (oe) => c({ functions: oe }))
      }, null, 8, ["functions"])) : ye("", !0),
      ["macros", "lld"].includes(e.query.queryType) ? ye("", !0) : (E(), Ce(uC, {
        key: 10,
        "query-type": e.query.queryType,
        options: e.query.options ?? {},
        onChange: se[28] || (se[28] = (oe) => c({ options: oe }))
      }, null, 8, ["query-type", "options"]))
    ]));
  }
});
class jC {
  type = "argus";
  meta = { type: "argus", displayName: "Argus", icon: "📊" };
  QueryEditor = xk;
  defaultQuery = () => ({
    type: "argus",
    datasourceId: "",
    queries: [
      {
        type: "builder_query",
        spec: {
          name: "A",
          signal: "metrics",
          stepInterval: null,
          disabled: !1,
          filter: { expression: "" },
          having: { expression: "" },
          groupBy: [],
          order: [],
          legend: "",
          functions: [],
          aggregations: [{ metricName: "", metricType: "", timeAggregation: "rate", spaceAggregation: "sum" }]
        }
      }
    ]
  });
  async query() {
    return { data: [], state: "Done" };
  }
}
class GC {
  type = "zabbix";
  meta = { type: "zabbix", displayName: "Zabbix", icon: "" };
  QueryEditor = WC;
  defaultQuery = () => ({
    type: "zabbix",
    datasourceId: "",
    queryType: "metrics",
    groupId: "",
    groupName: "",
    hostId: "",
    hostName: "",
    appId: "",
    appName: "",
    itemIds: [],
    itemNames: [],
    textFilter: "",
    useCaptureGroups: !1,
    itemTagsFilter: "",
    itemids: "",
    triggerFilter: "",
    tagsFilter: "",
    showProblems: "problems",
    severities: [],
    itServiceFilter: "",
    slaFilter: "",
    slaProperty: "sli",
    slaInterval: "none",
    macroFilter: "",
    lldRuleId: "",
    lldRuleName: "",
    lldItemKeys: [],
    functions: [],
    options: {
      useTrends: "default",
      showDisabledItems: !1,
      useZabbixValueMapping: !1,
      disableDataAlignment: !1,
      acknowledged: 2,
      sortProblems: "default",
      useTimeRange: !1,
      hostsInMaintenance: !1,
      hostProxy: !1,
      limit: 100
    }
  });
  async query() {
    return { data: [], state: "Done" };
  }
}
let ic = !1;
function YC() {
  if (ic)
    return;
  ic = !0, Zf();
  const e = new Nf();
  e.QueryEditor = Pk, is(e), is(new jC()), is(new GC());
}
const O2 = /* @__PURE__ */ Me({
  __name: "ArgusBoard",
  props: {
    hideHeader: { type: Boolean, default: !1 },
    canEdit: { type: Boolean, default: !0 },
    theme: { default: null },
    lang: { default: null },
    isEditing: { type: [Boolean, null], default: null },
    initialEditingPanelId: { default: null },
    datasourceConfig: { default: null },
    initialConfig: {},
    renderDefaultDashboard: { type: Boolean },
    presets: {}
  },
  emits: ["save"],
  setup(e, { emit: t }) {
    const n = e, i = t;
    YC(), rf({
      hideHeader: n.hideHeader,
      canEdit: n.canEdit,
      theme: n.theme ?? null,
      lang: n.lang ?? null,
      isEditing: n.isEditing ?? null,
      initialEditingPanelId: n.initialEditingPanelId ?? null,
      datasourceConfig: n.datasourceConfig ?? null,
      initialConfig: n.initialConfig,
      renderDefaultDashboard: n.renderDefaultDashboard,
      presets: n.presets,
      onSave: (b) => i("save", b)
    });
    const l = Pi();
    n.theme && l.setTheme(n.theme);
    const s = re(() => n.theme ?? l.theme);
    Fe(s, (b) => {
      document.documentElement.dataset.theme = b, document.body.dataset.theme = b;
    }, { immediate: !0 });
    const d = fe(n.lang ?? "zh");
    af(d), Fe(() => n.lang, (b) => {
      b && (d.value = b);
    });
    const c = hi();
    An(() => {
      n.canEdit === !1 ? c.setEditing(!1) : n.isEditing !== null && c.setEditing(n.isEditing ?? !0), n.initialConfig ? c.importJSON(
        typeof n.initialConfig == "string" ? n.initialConfig : JSON.stringify(n.initialConfig)
      ) : n.renderDefaultDashboard === !1 && c.importJSON(JSON.stringify({ title: "", panels: {}, layouts: [] })), n.initialEditingPanelId && c.setEditingPanel(n.initialEditingPanelId);
    });
    const u = re(() => ({
      algorithm: s.value === "dark" ? rr.darkAlgorithm : rr.defaultAlgorithm,
      token: { colorPrimary: "#1677ff", borderRadius: 4 },
      getPopupContainer: () => document.body
    })), p = re(() => s.value === "dark"), m = re(() => p.value ? "#141414" : "#f0f2f5");
    return (b, v) => (E(), Ce(f(nf), { theme: u.value }, {
      default: R(() => [
        k(f(uc), null, {
          default: R(() => [
            k(f(ur), {
              style: He({ minHeight: "100%", background: m.value })
            }, {
              default: R(() => [
                k(f(ur).Content, { style: { padding: 0, flex: 1, minHeight: 0 } }, {
                  default: R(() => [
                    k(CS)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }, 8, ["style"])
          ]),
          _: 1
        })
      ]),
      _: 1
    }, 8, ["theme"]));
  }
}), UC = { class: "log-toolbar" }, KC = { class: "log-scroller" }, XC = { class: "log-time" }, QC = { class: "log-message" }, JC = {
  key: 0,
  class: "log-empty"
}, ZC = /* @__PURE__ */ Me({
  __name: "LogViewer",
  props: {
    logs: {},
    maxHeight: { default: 400 }
  },
  setup(e) {
    const t = e, n = fe(""), i = fe([]), l = re(() => t.logs.filter((d) => !(i.value.length > 0 && !i.value.includes(d.level) || n.value && !d.message.toLowerCase().includes(n.value.toLowerCase())))), s = {
      error: "#ff4d4f",
      warn: "#faad14",
      info: "#52c41a",
      debug: "#8c8c8c"
    };
    return (d, c) => {
      const u = ot("a-input"), p = ot("a-select");
      return E(), B("div", {
        class: "log-viewer",
        style: He({ maxHeight: `${e.maxHeight}px` })
      }, [
        y("div", UC, [
          k(u, {
            value: n.value,
            "onUpdate:value": c[0] || (c[0] = (m) => n.value = m),
            size: "small",
            placeholder: "Search logs...",
            "allow-clear": "",
            style: { flex: "1" }
          }, null, 8, ["value"]),
          k(p, {
            value: i.value,
            "onUpdate:value": c[1] || (c[1] = (m) => i.value = m),
            mode: "multiple",
            size: "small",
            placeholder: "Level",
            style: { "min-width": "160px" },
            options: [
              { value: "error", label: "Error" },
              { value: "warn", label: "Warn" },
              { value: "info", label: "Info" },
              { value: "debug", label: "Debug" }
            ]
          }, null, 8, ["value"])
        ]),
        y("div", KC, [
          (E(!0), B($e, null, Xe(l.value, (m) => (E(), B("div", {
            key: m.id,
            class: "log-entry"
          }, [
            y("span", XC, I(new Date(m.timestamp).toLocaleTimeString()), 1),
            y("span", {
              class: "log-level",
              style: He({ color: s[m.level] })
            }, I(m.level.toUpperCase()), 5),
            y("span", QC, I(m.message), 1)
          ]))), 128))
        ]),
        l.value.length === 0 ? (E(), B("div", JC, " No log entries ")) : ye("", !0)
      ], 4);
    };
  }
}), D2 = /* @__PURE__ */ wn(ZC, [["__scopeId", "data-v-22a0d40d"]]), e2 = {
  key: 0,
  class: "topology-empty"
}, t2 = ["width", "height"], n2 = { class: "edges" }, i2 = ["x1", "y1", "x2", "y2"], l2 = ["cx", "cy", "fill", "stroke"], o2 = ["x", "y"], a2 = ["x", "y"], s2 = /* @__PURE__ */ Me({
  __name: "ServiceTopology",
  props: {
    nodes: { default: () => [] },
    edges: { default: () => [] },
    width: { default: 800 },
    height: { default: 500 }
  },
  setup(e) {
    const t = e, n = fe(), i = fe({});
    function l() {
      if (t.nodes.length === 0)
        return;
      const d = Math.ceil(Math.sqrt(t.nodes.length)), c = t.width / d, u = t.height / Math.ceil(t.nodes.length / d), p = {};
      t.nodes.forEach((m, b) => {
        const v = b % d, C = Math.floor(b / d);
        p[m.id] = {
          x: v * c + c / 2,
          y: C * u + u / 2
        };
      }), i.value = p;
    }
    An(l);
    function s(d) {
      return d ? d > 0.05 ? "#ff4d4f" : d > 0.01 ? "#faad14" : "#52c41a" : "#52c41a";
    }
    return (d, c) => (E(), B("div", {
      class: "service-topology",
      style: He({ width: `${e.width}px`, height: `${e.height}px` })
    }, [
      e.nodes.length === 0 ? (E(), B("div", e2, " No topology data ")) : (E(), B("svg", {
        key: 1,
        ref_key: "svgRef",
        ref: n,
        width: e.width,
        height: e.height
      }, [
        y("g", n2, [
          (E(!0), B($e, null, Xe(e.edges, (u) => (E(), B("line", {
            key: `${u.source}-${u.target}`,
            x1: i.value[u.source]?.x ?? 0,
            y1: i.value[u.source]?.y ?? 0,
            x2: i.value[u.target]?.x ?? 0,
            y2: i.value[u.target]?.y ?? 0,
            stroke: "var(--ant-color-border)",
            "stroke-width": "1.5",
            "marker-end": "url(#arrowhead)"
          }, null, 8, i2))), 128))
        ]),
        c[0] || (c[0] = y("defs", null, [
          y("marker", {
            id: "arrowhead",
            markerWidth: "10",
            markerHeight: "7",
            refX: "10",
            refY: "3.5",
            orient: "auto"
          }, [
            y("polygon", {
              points: "0 0, 10 3.5, 0 7",
              fill: "var(--ant-color-border)"
            })
          ])
        ], -1)),
        (E(!0), B($e, null, Xe(e.nodes, (u) => (E(), B("g", {
          key: u.id,
          class: "topology-node"
        }, [
          y("circle", {
            cx: i.value[u.id]?.x ?? 0,
            cy: i.value[u.id]?.y ?? 0,
            r: "24",
            fill: s(u.errorRate),
            "fill-opacity": "0.15",
            stroke: s(u.errorRate),
            "stroke-width": "2"
          }, null, 8, l2),
          y("text", {
            x: i.value[u.id]?.x ?? 0,
            y: (i.value[u.id]?.y ?? 0) + 4,
            "text-anchor": "middle",
            "font-size": "10",
            fill: "var(--ant-color-text)"
          }, I(u.name), 9, o2),
          u.latency !== void 0 ? (E(), B("text", {
            key: 0,
            x: i.value[u.id]?.x ?? 0,
            y: (i.value[u.id]?.y ?? 0) + 36,
            "text-anchor": "middle",
            "font-size": "9",
            fill: "var(--ant-color-text-secondary)"
          }, I(u.latency) + "ms ", 9, a2)) : ye("", !0)
        ]))), 128))
      ], 8, t2))
    ], 4));
  }
}), L2 = /* @__PURE__ */ wn(s2, [["__scopeId", "data-v-da85d863"]]), r2 = { class: "trace-waterfall" }, u2 = {
  key: 0,
  class: "trace-empty"
}, c2 = { class: "trace-name-col" }, d2 = { class: "trace-service" }, f2 = { class: "trace-op" }, h2 = { class: "trace-bar-col" }, g2 = { class: "trace-dur-col" }, p2 = /* @__PURE__ */ Me({
  __name: "TraceWaterfall",
  props: {
    spans: { default: () => [] },
    startTime: {},
    endTime: {}
  },
  setup(e) {
    const t = e, n = re(() => t.startTime ?? Math.min(...t.spans.map((p) => p.startTime))), i = re(() => t.endTime ?? Math.max(...t.spans.map((p) => p.startTime + p.duration))), l = re(() => i.value - n.value);
    function s(p) {
      return (p.startTime - n.value) / l.value * 100;
    }
    function d(p) {
      return Math.max(p.duration / l.value * 100, 0.5);
    }
    function c(p) {
      return p >= 1e6 ? `${(p / 1e6).toFixed(2)}s` : p >= 1e3 ? `${(p / 1e3).toFixed(2)}ms` : `${p}μs`;
    }
    const u = {
      ok: "#52c41a",
      error: "#ff4d4f",
      unset: "#1677ff"
    };
    return (p, m) => (E(), B("div", r2, [
      e.spans.length === 0 ? (E(), B("div", u2, " No trace data ")) : (E(), B($e, { key: 1 }, [
        m[0] || (m[0] = y("div", { class: "trace-header" }, [
          y("div", { class: "trace-name-col" }, " Operation "),
          y("div", { class: "trace-bar-col" }, " Timeline "),
          y("div", { class: "trace-dur-col" }, " Duration ")
        ], -1)),
        (E(!0), B($e, null, Xe(e.spans, (b) => (E(), B("div", {
          key: b.spanId,
          class: "trace-row"
        }, [
          y("div", c2, [
            y("span", d2, I(b.serviceName), 1),
            y("span", f2, I(b.operationName), 1)
          ]),
          y("div", h2, [
            y("div", {
              class: "trace-bar",
              style: He({
                left: `${s(b)}%`,
                width: `${d(b)}%`,
                background: u[b.status ?? "unset"]
              })
            }, null, 4)
          ]),
          y("div", g2, I(c(b.duration)), 1)
        ]))), 128))
      ], 64))
    ]));
  }
}), q2 = /* @__PURE__ */ wn(p2, [["__scopeId", "data-v-0212681c"]]), R2 = /* @__PURE__ */ Me({
  __name: "SimpleChart",
  props: {
    options: {},
    data: {}
  },
  setup(e) {
    const t = e, n = fe(), i = fe(null), l = fe({ width: 0, height: 0 });
    let s = null;
    function d() {
      i.value && (i.value.destroy(), i.value = null);
    }
    return no(() => {
      s?.disconnect(), d();
    }), ka((c) => {
      n.value && (s = new ResizeObserver((u) => {
        const { width: p, height: m } = u[0].contentRect;
        p > 0 && m > 0 && (l.value = { width: Math.floor(p), height: Math.floor(m) });
      }), s.observe(n.value), l.value = {
        width: Math.floor(n.value.getBoundingClientRect().width),
        height: Math.floor(n.value.getBoundingClientRect().height)
      }, c(() => {
        s?.disconnect();
      }));
    }), ka((c) => {
      !n.value || l.value.width <= 0 || l.value.height <= 0 || (d(), i.value = new Gt(
        { ...t.options, width: l.value.width, height: l.value.height },
        t.data,
        n.value
      ), c(() => {
        d();
      }));
    }), (c, u) => (E(), B("div", {
      ref_key: "containerRef",
      ref: n,
      class: "w-full h-full"
    }, null, 512));
  }
}), v2 = { class: "kbd-key" }, m2 = /* @__PURE__ */ Me({
  __name: "Kbd",
  props: {
    char: {}
  },
  setup(e) {
    return (t, n) => (E(), B("kbd", v2, [
      Ti(t.$slots, "default", {}, () => [
        ce(I(e.char), 1)
      ], !0)
    ]));
  }
}), N2 = /* @__PURE__ */ wn(m2, [["__scopeId", "data-v-94fb4749"]]), y2 = ["href", "target"], b2 = {
  key: 1,
  class: "panel-links-icon",
  style: { cursor: "pointer" }
}, x2 = { style: { "font-size": "10px", "margin-left": "2px" } }, w2 = /* @__PURE__ */ Me({
  __name: "PanelLinksIcon",
  props: {
    panel: {}
  },
  setup(e) {
    return (t, n) => e.panel.links && e.panel.links.length > 0 ? (E(), Ce(f($n), {
      key: 0,
      title: e.panel.links.map((i) => i.title ?? i.url).join(", ")
    }, {
      default: R(() => [
        e.panel.links.length === 1 ? (E(), B("a", {
          key: 0,
          href: e.panel.links[0].url,
          target: e.panel.links[0].newTab ? "_blank" : "_self",
          class: "panel-links-icon",
          onClick: n[0] || (n[0] = En(() => {
          }, ["stop"]))
        }, [...n[1] || (n[1] = [
          y("span", {
            class: "i-mdi-link",
            style: { "font-size": "14px" }
          }, null, -1)
        ])], 8, y2)) : (E(), B("span", b2, [
          n[2] || (n[2] = y("span", {
            class: "i-mdi-link-variant",
            style: { "font-size": "14px" }
          }, null, -1)),
          y("span", x2, I(e.panel.links.length), 1)
        ]))
      ]),
      _: 1
    }, 8, ["title"])) : ye("", !0);
  }
}), V2 = /* @__PURE__ */ wn(w2, [["__scopeId", "data-v-6925a5a2"]]), S2 = { class: "viz-picker" }, k2 = { class: "viz-picker-title" }, C2 = { class: "viz-picker-grid" }, _2 = ["onClick"], M2 = { class: "viz-picker-label" }, z2 = /* @__PURE__ */ Me({
  __name: "VizPickerPane",
  setup(e) {
    const { t } = nt(), { panel: n, onChange: i } = ao(), l = [
      { type: "timeseries", icon: ze.chartLine, labelKey: "config.type.timeseries" },
      { type: "bar", icon: ze.chartBar, labelKey: "config.type.bar" },
      { type: "stat", icon: ze.stat, labelKey: "config.type.stat" },
      { type: "gauge", icon: ze.gauge, labelKey: "config.type.gauge" },
      { type: "pie", icon: ze.chartPie, labelKey: "config.type.pie" },
      { type: "table", icon: ze.table, labelKey: "config.type.table" },
      { type: "histogram", icon: ze.chartArea, labelKey: "config.type.histogram" }
    ];
    return (s, d) => (E(), B("div", S2, [
      y("div", k2, I(f(t)("editor.vizPicker.title")), 1),
      y("div", C2, [
        (E(), B($e, null, Xe(l, (c) => y("button", {
          key: c.type,
          class: Ae(["viz-picker-item", { "viz-picker-item--active": f(n).type === c.type }]),
          onClick: (u) => f(i)({ type: c.type })
        }, [
          y("span", {
            class: Ae(["viz-picker-icon", [c.icon]])
          }, null, 2),
          y("span", M2, I(f(t)(c.labelKey)), 1)
        ], 10, _2)), 64))
      ])
    ]));
  }
}), F2 = /* @__PURE__ */ wn(z2, [["__scopeId", "data-v-1d0d144f"]]);
export {
  dS as AddPanelModal,
  or as AgChart,
  O2 as ArgusBoard,
  xk as ArgusQueryEditor,
  vS as DashboardHeader,
  CS as DashboardPage,
  N2 as Kbd,
  D2 as LogViewer,
  Pk as MockQueryEditor,
  tc as PanelContainer,
  Kw as PanelEditorLayout,
  Zw as PanelEditorModal,
  V2 as PanelLinksIcon,
  Fs as PanelRenderer,
  L2 as ServiceTopology,
  R2 as SimpleChart,
  Ld as TimeRangePicker,
  q2 as TraceWaterfall,
  cx as UPlotChart,
  qd as VariableBar,
  xw as VariableConfigModal,
  F2 as VizPickerPane,
  rf as provideArgusBoardConfig,
  rx as providePlotContext,
  YC as registerAllPlugins,
  Fo as useArgusBoardConfig,
  A2 as usePlotContext
};
