@circutor/charts 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/bundler/index.d.ts +35 -0
  2. package/dist/bundler/index.js +1 -0
  3. package/dist/bundler/itic-chart.d.ts +11 -0
  4. package/dist/bundler/itic-chart.js +1 -0
  5. package/dist/charts/charts.esm.js +1 -1
  6. package/dist/charts/p-7d11d611.entry.js +25 -0
  7. package/dist/charts/p-BPCJmLvQ.js +3 -0
  8. package/dist/cjs/charts.cjs.js +2 -2
  9. package/dist/cjs/{index-_N-tWlJj.js → index-dJHivNOd.js} +21 -0
  10. package/dist/cjs/itic-chart.cjs.entry.js +489 -77
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/components/itic-chart/index.js +133 -6
  13. package/dist/collection/components/itic-chart/itic-chart.css +5 -0
  14. package/dist/collection/components/itic-chart/itic-chart.i18n.js +26 -0
  15. package/dist/collection/components/itic-chart/itic-chart.options.js +115 -32
  16. package/dist/collection/components/itic-chart/itic-chart.phases.js +55 -0
  17. package/dist/components/index.js +1 -1
  18. package/dist/components/itic-chart.js +3 -3
  19. package/dist/esm/charts.js +3 -3
  20. package/dist/esm/{index--cwjvYaF.js → index-BPCJmLvQ.js} +20 -1
  21. package/dist/esm/itic-chart.entry.js +489 -77
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/types/components/itic-chart/index.d.ts +29 -2
  24. package/dist/types/components/itic-chart/itic-chart.i18n.d.ts +13 -0
  25. package/dist/types/components/itic-chart/itic-chart.options.d.ts +53 -4
  26. package/dist/types/components/itic-chart/itic-chart.phases.d.ts +17 -0
  27. package/dist/types/components.d.ts +43 -4
  28. package/dist/types/index.d.ts +1 -1
  29. package/package.json +11 -7
  30. package/readme.md +273 -37
  31. package/dist/charts/p--cwjvYaF.js +0 -3
  32. package/dist/charts/p-35caac53.entry.js +0 -25
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-_N-tWlJj.js');
3
+ var index = require('./index-dJHivNOd.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  const defineCustomElements = async (win, options) => {
7
7
  if (typeof window === 'undefined') return undefined;
8
8
  await appGlobals.globalScripts();
9
- return index.bootstrapLazy([["itic-chart.cjs",[[1,"itic-chart",{"groups":[1]},null,{"groups":[{"onGroupsChange":0}]}]]]], options);
9
+ return index.bootstrapLazy([["itic-chart.cjs",[[1,"itic-chart",{"groups":[1],"locale":[1],"timeZone":[1,"time-zone"]},null,{"groups":[{"onGroupsChange":0}],"locale":[{"onLocaleChange":0}],"timeZone":[{"onTimeZoneChange":0}]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -3,17 +3,42 @@ import * as echarts from "echarts/core";
3
3
  import { LineChart, ScatterChart } from "echarts/charts";
4
4
  import { GridComponent, LegendComponent, TooltipComponent } from "echarts/components";
5
5
  import { CanvasRenderer } from "echarts/renderers";
6
- import { buildChartOptions, parseGroups } from "./itic-chart.options";
6
+ import { getMessages, normalizeLocale } from "./itic-chart.i18n";
7
+ import { buildChartOptions, findClickedPoint, isValidTimeZone, parseGroups, } from "./itic-chart.options";
7
8
  // Register only what this chart uses, so bundles don't ship all of ECharts
8
9
  echarts.use([LineChart, ScatterChart, GridComponent, LegendComponent, TooltipComponent, CanvasRenderer]);
9
10
  export class IticChart {
11
+ constructor() {
12
+ /**
13
+ * Language of the texts, dates and numbers: `ca`, `de`, `en`, `es`, `fr` or `pt`. Only the language
14
+ * is used (`es-ES` → `es`); any other value falls back to `en`.
15
+ */
16
+ this.locale = 'en';
17
+ this.parsedGroups = [];
18
+ }
10
19
  onGroupsChange() {
11
20
  this.updateChart();
12
21
  }
22
+ onLocaleChange() {
23
+ this.updateAriaLabel();
24
+ this.updateChart();
25
+ }
26
+ onTimeZoneChange() {
27
+ this.validateTimeZone();
28
+ this.updateChart();
29
+ }
13
30
  connectedCallback() {
31
+ // The chart is a canvas: expose it as an image, labelled with `aria-label`, unless the consumer sets a role
32
+ if (!this.el.hasAttribute('role')) {
33
+ this.el.setAttribute('role', 'img');
34
+ }
35
+ this.updateAriaLabel();
14
36
  // componentDidLoad only fires once, so re-create the chart when the element is re-attached
15
37
  this.initChart();
16
38
  }
39
+ componentWillLoad() {
40
+ this.validateTimeZone();
41
+ }
17
42
  componentDidLoad() {
18
43
  this.initChart();
19
44
  }
@@ -24,11 +49,38 @@ export class IticChart {
24
49
  (_b = this.chart) === null || _b === void 0 ? void 0 : _b.dispose();
25
50
  this.chart = undefined;
26
51
  }
52
+ updateAriaLabel() {
53
+ const current = this.el.getAttribute('aria-label');
54
+ if (current !== null && current !== this.defaultAriaLabel) {
55
+ return;
56
+ }
57
+ this.defaultAriaLabel = getMessages(normalizeLocale(this.locale)).ariaLabel;
58
+ this.el.setAttribute('aria-label', this.defaultAriaLabel);
59
+ }
60
+ // Validated when it changes, not on every redraw, so an invalid value is only reported once
61
+ validateTimeZone() {
62
+ this.validTimeZone = undefined;
63
+ if (!this.timeZone) {
64
+ return;
65
+ }
66
+ if (isValidTimeZone(this.timeZone)) {
67
+ this.validTimeZone = this.timeZone;
68
+ }
69
+ else {
70
+ console.error(`[itic-chart] Invalid "timeZone" prop: "${this.timeZone}". Using the browser's time zone.`);
71
+ }
72
+ }
27
73
  initChart() {
28
74
  if (!this.container || this.chart) {
29
75
  return;
30
76
  }
31
77
  this.chart = echarts.init(this.container);
78
+ this.chart.on('click', params => {
79
+ const detail = findClickedPoint(this.parsedGroups, params);
80
+ if (detail) {
81
+ this.pointClick.emit(detail);
82
+ }
83
+ });
32
84
  if (typeof ResizeObserver !== 'undefined') {
33
85
  this.resizeObserver = new ResizeObserver(() => { var _a; return (_a = this.chart) === null || _a === void 0 ? void 0 : _a.resize(); });
34
86
  this.resizeObserver.observe(this.container);
@@ -39,17 +91,21 @@ export class IticChart {
39
91
  if (!this.chart) {
40
92
  return;
41
93
  }
42
- let groups = [];
94
+ this.parsedGroups = [];
43
95
  try {
44
- groups = parseGroups(this.groups);
96
+ this.parsedGroups = parseGroups(this.groups);
45
97
  }
46
98
  catch (error) {
47
99
  console.error('[itic-chart] Invalid "groups" prop:', error);
48
100
  }
49
- this.chart.setOption(buildChartOptions(groups), { notMerge: true });
101
+ const options = buildChartOptions(this.parsedGroups, {
102
+ locale: normalizeLocale(this.locale),
103
+ timeZone: this.validTimeZone,
104
+ });
105
+ this.chart.setOption(options, { notMerge: true });
50
106
  }
51
107
  render() {
52
- return h("div", { key: '98e14b7d6df922dc2a17dd09913bfad089ec4bf2', class: "chart", ref: el => (this.container = el) });
108
+ return h("div", { key: '2bb964d590a36c9c9501761c3f848ad364a29030', class: "chart", ref: el => (this.container = el) });
53
109
  }
54
110
  static get is() { return "itic-chart"; }
55
111
  static get encapsulation() { return "shadow"; }
@@ -84,19 +140,90 @@ export class IticChart {
84
140
  "optional": false,
85
141
  "docs": {
86
142
  "tags": [],
87
- "text": "point groups"
143
+ "text": "Point groups, as an array or a JSON string. Each group's `phase` code sets its name, color and order.\nExtra fields in groups and points are kept and passed back in `pointClick`."
88
144
  },
89
145
  "getter": false,
90
146
  "setter": false,
91
147
  "reflect": false,
92
148
  "attribute": "groups"
149
+ },
150
+ "locale": {
151
+ "type": "string",
152
+ "mutable": false,
153
+ "complexType": {
154
+ "original": "string",
155
+ "resolved": "string",
156
+ "references": {}
157
+ },
158
+ "required": false,
159
+ "optional": false,
160
+ "docs": {
161
+ "tags": [],
162
+ "text": "Language of the texts, dates and numbers: `ca`, `de`, `en`, `es`, `fr` or `pt`. Only the language\nis used (`es-ES` \u2192 `es`); any other value falls back to `en`."
163
+ },
164
+ "getter": false,
165
+ "setter": false,
166
+ "reflect": false,
167
+ "attribute": "locale",
168
+ "defaultValue": "'en'"
169
+ },
170
+ "timeZone": {
171
+ "type": "string",
172
+ "mutable": false,
173
+ "complexType": {
174
+ "original": "string",
175
+ "resolved": "string",
176
+ "references": {}
177
+ },
178
+ "required": false,
179
+ "optional": true,
180
+ "docs": {
181
+ "tags": [],
182
+ "text": "IANA time zone of the dates in the tooltip (e.g. `Europe/Madrid`). Defaults to the browser's,\nwhich is also used, with a console error, when the value isn't valid."
183
+ },
184
+ "getter": false,
185
+ "setter": false,
186
+ "reflect": false,
187
+ "attribute": "time-zone"
93
188
  }
94
189
  };
95
190
  }
191
+ static get events() {
192
+ return [{
193
+ "method": "pointClick",
194
+ "name": "pointClick",
195
+ "bubbles": true,
196
+ "cancelable": true,
197
+ "composed": true,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": "Emitted when a clickable point is clicked (`clickable` isn't `false`). `detail` holds the original\npoint and group objects."
201
+ },
202
+ "complexType": {
203
+ "original": "ITICPointClickDetail",
204
+ "resolved": "{ point: ITICPoint; group: ITICChartMarks; }",
205
+ "references": {
206
+ "ITICPointClickDetail": {
207
+ "location": "import",
208
+ "path": "./itic-chart.options",
209
+ "id": "src/components/itic-chart/itic-chart.options.ts::ITICPointClickDetail",
210
+ "referenceLocation": "ITICPointClickDetail"
211
+ }
212
+ }
213
+ }
214
+ }];
215
+ }
216
+ static get elementRef() { return "el"; }
96
217
  static get watchers() {
97
218
  return [{
98
219
  "propName": "groups",
99
220
  "methodName": "onGroupsChange"
221
+ }, {
222
+ "propName": "locale",
223
+ "methodName": "onLocaleChange"
224
+ }, {
225
+ "propName": "timeZone",
226
+ "methodName": "onTimeZoneChange"
100
227
  }];
101
228
  }
102
229
  }
@@ -1,6 +1,11 @@
1
+ /**
2
+ * @prop --itic-chart-background: Background behind the whole chart. Defaults to `transparent`.
3
+ */
1
4
  :host {
2
5
  display: block;
6
+ /* Default size; any rule on `itic-chart` in the page (height, min-height, flex) wins over `:host` */
3
7
  height: 400px;
8
+ background: var(--itic-chart-background, transparent);
4
9
  }
5
10
 
6
11
  .chart {
@@ -0,0 +1,26 @@
1
+ import ca from "./i18n/ca.json";
2
+ import de from "./i18n/de.json";
3
+ import en from "./i18n/en.json";
4
+ import es from "./i18n/es.json";
5
+ import fr from "./i18n/fr.json";
6
+ import pt from "./i18n/pt.json";
7
+ export const LOCALES = ['ca', 'de', 'en', 'es', 'fr', 'pt'];
8
+ export const DEFAULT_LOCALE = 'en';
9
+ const MESSAGES = { ca, de, en, es, fr, pt };
10
+ /** Keeps the language of a locale (`es-ES` → `es`), falling back to `en` when it isn't translated. */
11
+ export function normalizeLocale(locale) {
12
+ const language = String(locale !== null && locale !== void 0 ? locale : '')
13
+ .split(/[-_]/)[0]
14
+ .toLowerCase();
15
+ return LOCALES.includes(language) ? language : DEFAULT_LOCALE;
16
+ }
17
+ export const getMessages = (locale) => MESSAGES[locale];
18
+ const hasOwn = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
19
+ /** Translated event type, or the code as is when it isn't in the catalog. */
20
+ export function translateEventType(messages, code) {
21
+ return hasOwn(messages.eventTypes, code) ? messages.eventTypes[code] : code;
22
+ }
23
+ /** Translated name of a phase code that has one (`ALL`, `NONE`), or `undefined`. */
24
+ export function translatePhase(messages, code) {
25
+ return hasOwn(messages.phases, code) ? messages.phases[code] : undefined;
26
+ }
@@ -1,4 +1,6 @@
1
- import dayjs from "dayjs";
1
+ import { DEFAULT_LOCALE, getMessages, translateEventType } from "./itic-chart.i18n";
2
+ import { getPhase, sortGroups } from "./itic-chart.phases";
3
+ export const DEFAULT_SETTINGS = { locale: DEFAULT_LOCALE };
2
4
  /**
3
5
  * Normalizes the `groups` prop, which arrives as an array from JS/React
4
6
  * or as a JSON string when set as an HTML attribute.
@@ -13,6 +15,15 @@ export function parseGroups(groups) {
13
15
  }
14
16
  return parsed;
15
17
  }
18
+ export function isValidTimeZone(timeZone) {
19
+ try {
20
+ new Intl.DateTimeFormat('en', { timeZone });
21
+ return true;
22
+ }
23
+ catch (_a) {
24
+ return false;
25
+ }
26
+ }
16
27
  export function escapeHtml(value) {
17
28
  return value
18
29
  .replace(/&/g, '&')
@@ -21,36 +32,101 @@ export function escapeHtml(value) {
21
32
  .replace(/"/g, '"')
22
33
  .replace(/'/g, ''');
23
34
  }
24
- export function formatTooltip(groupName, [duration, voltage, ts]) {
25
- const rows = {
26
- phase: escapeHtml(groupName),
27
- duration: `${duration} ms`,
28
- voltage: `${Math.round(voltage * 10) / 10}%`,
29
- ts: dayjs(ts).locale('en').format('DD MMM, HH:mm:ss.SSS'),
35
+ const isBlank = (value) => value == null || value === '';
36
+ /**
37
+ * Returns the tooltip HTML of a point: one row per field, in the chart's language. Rows without a value
38
+ * are left out, and every value is escaped, since it comes from the consumer's data.
39
+ */
40
+ export function createTooltipFormatter({ locale, timeZone }) {
41
+ const messages = getMessages(locale);
42
+ const dateFormat = new Intl.DateTimeFormat(locale, {
43
+ day: '2-digit',
44
+ month: 'short',
45
+ hour: '2-digit',
46
+ minute: '2-digit',
47
+ second: '2-digit',
48
+ // Short events are milliseconds apart
49
+ fractionalSecondDigits: 3,
50
+ hourCycle: 'h23',
51
+ timeZone,
52
+ });
53
+ const durationFormat = new Intl.NumberFormat(locale, { style: 'unit', unit: 'millisecond', maximumFractionDigits: 3 });
54
+ const voltageFormat = new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 });
55
+ // `volt` isn't a unit supported by Intl
56
+ const voltsFormat = new Intl.NumberFormat(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
57
+ const formatDate = (ts) => {
58
+ const date = new Date(ts);
59
+ return Number.isNaN(date.getTime()) ? String(ts !== null && ts !== void 0 ? ts : '') : dateFormat.format(date);
60
+ };
61
+ const formatVolts = (value) => (Number(value) ? `${voltsFormat.format(Number(value))} V` : undefined);
62
+ return (point, group) => {
63
+ const rows = [
64
+ ['asset', isBlank(group.assetName) ? undefined : String(group.assetName)],
65
+ ['date', formatDate(point.ts)],
66
+ ['eventType', isBlank(point.eventType) ? undefined : translateEventType(messages, String(point.eventType))],
67
+ ['duration', durationFormat.format(Number(point.duration))],
68
+ // The value is already in %
69
+ ['voltage', voltageFormat.format(Number(point.voltage) / 100)],
70
+ ['status', isBlank(point.status) ? undefined : String(point.status)],
71
+ ['phase', getPhase(group.phase, messages).name || '-'],
72
+ ['min', formatVolts(point.min)],
73
+ ['max', formatVolts(point.max)],
74
+ ];
75
+ return rows
76
+ .filter((row) => row[1] !== undefined)
77
+ .map(([key, value]) => ` <strong>${messages.tooltip[key]}</strong>: ${escapeHtml(value)}`)
78
+ .join('<br/>');
30
79
  };
31
- return Object.entries(rows)
32
- .map(([label, value]) => ` <strong>${label}</strong>: ${value}`)
33
- .join('<br/>');
34
80
  }
35
- export function buildChartOptions(groups) {
36
- return Object.assign(Object.assign({}, BASE_OPTIONS), { series: [
81
+ /** Formats the axis labels in the chart's language; ECharts always uses English separators. */
82
+ export function createAxisLabelFormatter(locale) {
83
+ const numberFormat = new Intl.NumberFormat(locale);
84
+ return value => numberFormat.format(value);
85
+ }
86
+ export const isClickable = (point) => point.clickable !== false;
87
+ export function buildChartOptions(groups, settings = DEFAULT_SETTINGS) {
88
+ const messages = getMessages(settings.locale);
89
+ const formatTooltip = createTooltipFormatter(settings);
90
+ const axisLabel = { formatter: createAxisLabelFormatter(settings.locale) };
91
+ return Object.assign(Object.assign({}, BASE_OPTIONS), { xAxis: Object.assign(Object.assign({}, BASE_OPTIONS.xAxis), { name: messages.xAxisName, axisLabel }), yAxis: Object.assign(Object.assign({}, BASE_OPTIONS.yAxis), { name: messages.yAxisName, axisLabel }), series: [
37
92
  ...CURVE_SERIES,
38
- ...groups.map(({ groupName, points, color }) => ({
39
- type: 'scatter',
40
- name: groupName,
41
- data: points.map(point => [point.duration, point.voltage, point.ts]),
42
- symbolSize: 12,
43
- z: 4,
44
- itemStyle: {
45
- color,
46
- opacity: 1,
47
- },
48
- tooltip: {
49
- formatter: params => formatTooltip(groupName, params.value),
50
- },
51
- })),
93
+ ...sortGroups(groups).map((group) => {
94
+ const { name, color } = getPhase(group.phase, messages);
95
+ return {
96
+ type: 'scatter',
97
+ name,
98
+ // ECharts 6 reads `cursor` per data item, although its types only declare it per series
99
+ data: group.points.map(point => ({
100
+ value: [point.duration, point.voltage],
101
+ cursor: isClickable(point) ? 'pointer' : 'default',
102
+ })),
103
+ symbolSize: 12,
104
+ z: 4,
105
+ // Phases without a color take the next one of the ECharts palette
106
+ itemStyle: color ? { color, opacity: 1 } : { opacity: 1 },
107
+ tooltip: {
108
+ formatter: params => formatTooltip(group.points[params.dataIndex], group),
109
+ },
110
+ };
111
+ }),
52
112
  ] });
53
113
  }
114
+ /**
115
+ * Maps an ECharts click back to the original point and group. `buildChartOptions` draws the groups as
116
+ * scatter series after the ITIC curve series, sorted with `sortGroups`.
117
+ * Returns `undefined` for clicks outside the points and on points that aren't clickable.
118
+ */
119
+ export function findClickedPoint(groups, { componentType, seriesIndex, dataIndex }) {
120
+ if (componentType !== 'series' || seriesIndex == null || dataIndex == null) {
121
+ return undefined;
122
+ }
123
+ const group = sortGroups(groups)[seriesIndex - CURVE_SERIES.length];
124
+ const point = group === null || group === void 0 ? void 0 : group.points[dataIndex];
125
+ if (!point || !isClickable(point)) {
126
+ return undefined;
127
+ }
128
+ return { point, group };
129
+ }
54
130
  const ITIC_CURVE_PROHIBITED_REGION = [
55
131
  [0.167, 500],
56
132
  [1, 200],
@@ -69,23 +145,24 @@ const ITIC_CURVE_NODAMAGE_REGION = [
69
145
  [10000, 90],
70
146
  [100000, 90],
71
147
  ];
148
+ // Fixed ranges, as in Scout: ECharts clips points outside them (duration < 1 ms or voltage > 200%)
72
149
  const BASE_OPTIONS = {
73
150
  animation: false,
74
151
  grid: {
75
- right: '40px',
152
+ right: '20px',
76
153
  left: '60px',
77
154
  },
78
155
  // ECharts 6 moved the default legend to the bottom; keep it on top as in previous versions
79
156
  legend: { top: 0 },
80
- tooltip: {},
157
+ // Outside the shadow root, so containers with `overflow: hidden` don't clip it. Its styles are inline.
158
+ tooltip: { appendTo: 'body' },
81
159
  textStyle: {
82
160
  fontFamily: 'CDS-Regular, Arial',
83
161
  },
84
162
  xAxis: {
85
163
  type: 'log',
86
- min: 0.1,
164
+ min: 1,
87
165
  max: 100000,
88
- name: 'Duration (ms)',
89
166
  nameGap: 30,
90
167
  nameLocation: 'middle',
91
168
  nameTextStyle: {
@@ -96,17 +173,17 @@ const BASE_OPTIONS = {
96
173
  yAxis: {
97
174
  type: 'value',
98
175
  min: 0,
99
- max: 500,
176
+ max: 200,
100
177
  nameTextStyle: {
101
178
  fontSize: 16,
102
179
  fontWeight: 'bold',
103
180
  },
104
- name: 'Voltage (% of nominal voltage)',
105
181
  nameRotate: 90,
106
182
  nameGap: 40,
107
183
  nameLocation: 'middle',
108
184
  },
109
185
  };
186
+ // `silent`: the curve doesn't react to the mouse (no tooltip, cursor or click)
110
187
  const CURVE_SERIES = [
111
188
  {
112
189
  type: 'line',
@@ -118,6 +195,7 @@ const CURVE_SERIES = [
118
195
  lineStyle: {
119
196
  color: '#000',
120
197
  },
198
+ silent: true,
121
199
  showSymbol: false,
122
200
  emphasis: {
123
201
  disabled: true,
@@ -130,6 +208,7 @@ const CURVE_SERIES = [
130
208
  origin: 'start',
131
209
  color: '#FFF5DF',
132
210
  },
211
+ silent: true,
133
212
  showSymbol: false,
134
213
  lineStyle: {
135
214
  color: '#000',
@@ -145,6 +224,7 @@ const CURVE_SERIES = [
145
224
  origin: 100,
146
225
  color: '#DDFAF1',
147
226
  },
227
+ silent: true,
148
228
  showSymbol: false,
149
229
  lineStyle: {
150
230
  color: '#000',
@@ -160,6 +240,7 @@ const CURVE_SERIES = [
160
240
  origin: 100,
161
241
  color: '#DDFAF1',
162
242
  },
243
+ silent: true,
163
244
  showSymbol: false,
164
245
  lineStyle: {
165
246
  color: '#000',
@@ -178,6 +259,7 @@ const CURVE_SERIES = [
178
259
  origin: 100,
179
260
  color: '#DDFAF1',
180
261
  },
262
+ silent: true,
181
263
  showSymbol: false,
182
264
  lineStyle: {
183
265
  color: 'transparent',
@@ -196,6 +278,7 @@ const CURVE_SERIES = [
196
278
  origin: 100,
197
279
  color: '#DDFAF1',
198
280
  },
281
+ silent: true,
199
282
  showSymbol: false,
200
283
  lineStyle: {
201
284
  color: 'transparent',
@@ -0,0 +1,55 @@
1
+ import { translatePhase } from "./itic-chart.i18n";
2
+ const L1 = '#a67c52';
3
+ const L2 = '#20262C';
4
+ const L3 = '#B9BDC0';
5
+ const THREE_PHASE = '#00B388';
6
+ // Same catalog as Scout. Names that change with the language (`ALL`, `NONE`) are in the i18n JSON files.
7
+ const PHASES = {
8
+ AN: { name: 'L1', color: L1 },
9
+ BN: { name: 'L2', color: L2 },
10
+ CN: { name: 'L3', color: L3 },
11
+ AB: { name: 'L1', color: L1 },
12
+ BC: { name: 'L2', color: L2 },
13
+ CA: { name: 'L3', color: L3 },
14
+ 'AN,BN,CN': { name: 'L1,L2,L3', color: THREE_PHASE },
15
+ 'AB,BC,CA': { name: 'L1,L2,L3', color: THREE_PHASE },
16
+ ALL: { name: '', color: '#4C5CC5' },
17
+ A: { name: 'L1' },
18
+ B: { name: 'L2' },
19
+ C: { name: 'L3' },
20
+ 'AN,BN': { name: 'L1,L2' },
21
+ 'AN,CN': { name: 'L1,L3' },
22
+ 'BN,CN': { name: 'L2,L3' },
23
+ 'AB,BC': { name: 'L1,L2' },
24
+ 'AB,CA': { name: 'L1,L3' },
25
+ 'BC,CA': { name: 'L2,L3' },
26
+ NONE: { name: '' },
27
+ };
28
+ const phaseCode = (phase) => (phase == null ? '' : String(phase));
29
+ // Unknown codes keep the code as name and have no color
30
+ const catalogPhase = (code) => Object.prototype.hasOwnProperty.call(PHASES, code) ? PHASES[code] : { name: code };
31
+ /** Name, in the given language, and color of a phase code. */
32
+ export function getPhase(phase, messages) {
33
+ var _a;
34
+ const code = phaseCode(phase);
35
+ const known = catalogPhase(code);
36
+ return Object.assign(Object.assign({}, known), { name: (_a = translatePhase(messages, code)) !== null && _a !== void 0 ? _a : known.name });
37
+ }
38
+ // `NONE` (no name) goes after the named phases and `ALL` always last. Only these two names are translated,
39
+ // so ranking them by code keeps the order the same in every language.
40
+ const rank = (code) => (code === 'ALL' ? 2 : code === 'NONE' ? 1 : 0);
41
+ /**
42
+ * Sorts groups by phase name, then by code (e.g. `AN` and `AB` are both "L1"), with `NONE` and `ALL` last.
43
+ * Compares characters, not with a locale's rules, so the legend is the same in every language.
44
+ * Returns a new array with the same group objects; groups with the same code keep their order.
45
+ */
46
+ export function sortGroups(groups) {
47
+ const keyed = groups.map(group => {
48
+ const code = phaseCode(group.phase);
49
+ return { group, code, rank: rank(code), name: catalogPhase(code).name };
50
+ });
51
+ return keyed
52
+ .sort((a, b) => a.rank - b.rank || compare(a.name, b.name) || compare(a.code, b.code))
53
+ .map(({ group }) => group);
54
+ }
55
+ const compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
@@ -1 +1 @@
1
- function t(t,e,n){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,e);if(o&&(!n||o.get))return o;t=Object.getPrototypeOf(t)}}var e,n=(e,n)=>{var o;Object.entries(null!=(o=n.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=e[o],s=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);s&&Object.defineProperty(e,o,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),n.l.has(o)?e[o]=n.l.get(o):void 0!==l&&(e[o]=l)}}))},o=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>(0,console.error)(t,e),s=new Map,i="undefined"!=typeof window?window:{},r=i.HTMLElement||class{},c={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},f=(()=>{try{return!!i.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),u=!!f&&(()=>!!i.document&&Object.getOwnPropertyDescriptor(i.document.adoptedStyleSheets,"length").writable)(),a=!1,d=[],h=[],p=()=>{var t;return(null==(t=i.document)?void 0:t.hidden)?setTimeout($,16):c.raf($)},m=(t,e)=>n=>{t.push(n),a||(a=!0,e&&4&c.i?v($):p())},b=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){l(t)}t.length=0},$=()=>{b(d),b(h),(a=d.length>0)&&p()},v=t=>Promise.resolve(void 0).then(t),y=m(h,!0),w=t=>{const e=new URL(t,c.u);return e.origin!==i.location.origin?e.href:e.pathname},j=t=>c.u=t;function g(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(u?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}var O,S=new WeakMap,k=t=>"sc-"+t.h,M=t=>"object"==(t=typeof t)||"function"===t,E=(t,e,...n)=>{let o=null,s=null,i=!1,r=!1;const c=[],f=e=>{for(let n=0;n<e.length;n++)if(o=e[n],Array.isArray(o))f(o);else if(null!=o&&"boolean"!=typeof o){if(i="function"!=typeof t&&!M(o))o+="";else if("function"!=typeof t&&void 0===o.i){l("Invalid vNode child");continue}i&&r?c[c.length-1].p+=o:c.push(i?C(null,o):o),r=i}};if(f(n),e){e.key&&(s=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}const u=C(t,null);return u.m=e,c.length>0&&(u.$=c),u.v=s,u},C=(t,e)=>({i:0,j:t,p:null!=e?e:null,O:null,$:null,m:null,v:null}),L={},_=t=>{if(!t)return;const e=Object.keys(t);if(0===e.length)return;let n=!1;for(const o of e){if(n)break;for(const e of t[o])if("string"==typeof e){n=!0;break}}if(!n)return t;const o={};for(const n of e)o[n]=t[n].map((t=>"string"==typeof t?{[t]:0}:t));return o},x=(t,e)=>null==t||M(t)?t:1&e?t+"":t,A=(t,e,n,o)=>{if(n!==o)if(e.toLowerCase(),"class"===e){const e=t.classList,l=H(n);let s=H(o);{let t=l.filter((t=>t&&!s.includes(t)));e.remove(...t),e.add(...s.filter((t=>t&&!l.includes(t))))}}else"key"===e||"ref"===e&&o&&I(o,t)},D=/\s/,H=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(D):[]),N=(t,e)=>{const n=11===e.O.nodeType&&e.O.host?e.O.host:e.O,o=t&&t.m||{},l=e.m||{};for(const t of P(Object.keys(o)))t in l||A(n,t,o[t],void 0);for(const t of P(Object.keys(l)))A(n,t,o[t],l[t])};function P(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var U=[],W=[],R=(t,e,n)=>{const o=e.$[n];let l,s,r=0;if(!i.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.O=i.document.createElement(o.j),N(null,o),o.$){const e="template"===o.j?l.content:l;for(r=0;r<o.$.length;++r)s=R(t,o,r),s&&e.appendChild(s)}return l["s-hn"]=O,l},T=(t,e,n,o,l,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===O&&(r=r.shadowRoot),"template"===n.j&&(r=r.content);l<=s;++l)o[l]&&(i=R(null,n,l),i&&(o[l].O=i,Y(r,i,e)))},V=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.O;z(e),t&&t.remove()}}},q=(t,e,n=!1)=>t.j===e.j&&(n?(n&&!t.v&&e.v&&(t.v=e.v),!0):t.v===e.v),F=(t,e,n=!1)=>{const o=e.O=t.O,l=t.$,s=e.$;N(t,e),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,i,r=0,c=0,f=0,u=0,a=e.length-1,d=e[0],h=e[a],p=o.length-1,m=o[0],b=o[p];const $="template"===n.j?t.content:t;for(;r<=a&&c<=p;)if(null==d)d=e[++r];else if(null==h)h=e[--a];else if(null==m)m=o[++c];else if(null==b)b=o[--p];else if(q(d,m,l))F(d,m,l),d=e[++r],m=o[++c];else if(q(h,b,l))F(h,b,l),h=e[--a],b=o[--p];else if(q(d,b,l))F(d,b,l),Y($,d.O,h.O.nextSibling),d=e[++r],b=o[--p];else if(q(h,m,l))F(h,m,l),Y($,h.O,d.O),h=e[--a],m=o[++c];else{for(f=-1,u=r;u<=a;++u)if(e[u]&&null!==e[u].v&&e[u].v===m.v){f=u;break}f>=0?(i=e[f],i.j!==m.j?s=R(e&&e[c],n,c):(F(i,m,l),e[f]=void 0,s=i.O),m=o[++c]):(s=R(e&&e[c],n,c),m=o[++c]),s&&Y(d.O.parentNode,s,d.O)}r>a?T(t,null==o[p+1]?null:o[p+1].O,n,o,c,p):c>p&&V(e,r,a)})(o,l,e,s,n):null!==s?T(o,null,e,s,0,s.length-1):!n&&null!==l&&V(l,0,l.length-1)},z=t=>{t.m&&t.m.ref&&U.push((()=>t.m.ref(null))),t.$&&t.$.map(z)},I=(t,e)=>{W.push((()=>t(e)))},Y=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),B=(t,e,n=!1)=>{const o=t.$hostElement$,l=t.S||C(null,null),s=(t=>t&&t.j===L)(e)?e:E(null,null,e);if(O=o.tagName,n&&s.m)for(const t of Object.keys(s.m))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(s.m[t]=o[t]);s.j=null,s.i|=4,t.S=s,s.O=l.O=o.shadowRoot||o,F(l,s,n),U.forEach((t=>t())),U.length=0,W.forEach((t=>t())),W.length=0},G=(t,e)=>{if(e&&!t.k&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.k=()=>{e["s-p"].splice(n-1,1),o()})))}},J=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);G(t,t.M);const n=()=>K(t,e);if(!e)return y(n);queueMicrotask((()=>{n()}))},K=(t,e)=>{const n=t.$hostElement$,o=n;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return l=ot(o,e?"componentWillLoad":"componentWillUpdate",void 0,n),l=Q(l,(()=>ot(o,"componentWillRender",void 0,n))),Q(l,(()=>Z(t,o,e)))},Q=(t,e)=>X(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),X=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,Z=async(t,e,n)=>{var o;const l=t.$hostElement$,r=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.i,l=((t,e)=>{var n,o,l;const r=k(e),a=s.get(r);if(!i.document)return r;if(t=11===t.nodeType?t:i.document,a)if("string"==typeof a){let l,s=S.get(t=t.head||t);if(s||S.set(t,s=new Set),!s.has(r)){l=i.document.createElement("style"),l.textContent=a;const d=null!=(n=c.C)?n:function(){var t,e,n;return null!=(n=null==(e=null==(t=i.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?n:void 0}();if(null!=d&&l.setAttribute("nonce",d),!(1&e.i))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(f){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(a),u?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=a+e.textContent:t.prepend(l)}else t.append(l);1&e.i&&t.insertBefore(l,null),4&e.i&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),s&&s.add(r)}}else{let e=S.get(t);if(e||S.set(t,e=new Set),!e.has(r)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(a.constructor===n.CSSStyleSheet)o=a;else{o=new n.CSSStyleSheet;for(let t=0;t<a.cssRules.length;t++)o.insertRule(a.cssRules[t].cssText,t)}u?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(r)}}return r})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);tt(t,e,l,n),r&&(r.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>et(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.i|=4,e.length=0)}},tt=(t,e,n,o)=>{try{e=e.render(),t.i&=-17,t.i|=2,B(t,e,o)}catch(e){l(e,t.$hostElement$)}return null},et=t=>{const e=t.$hostElement$,n=e,o=t.M;ot(n,"componentDidRender",void 0,e),64&t.i?ot(n,"componentDidUpdate",void 0,e):(t.i|=64,lt(e),ot(n,"componentDidLoad",void 0,e),t.L(e),o||nt()),t.k&&(t.k(),t.k=void 0),512&t.i&&v((()=>J(t,!1))),t.i&=-517},nt=()=>{v((()=>(t=>{const e=c.ce("appload",{detail:{namespace:"charts"}});return t.dispatchEvent(e),e})(i)))},ot=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){l(t,o)}},lt=t=>t.classList.add("hydrated"),st=(t,e,n,s)=>{const i=o(t);if(!i)return;const r=t,c=i.l.get(e),f=i.i,u=r;if(!((n=x(n,s.t[e][0]))===c||Number.isNaN(c)&&Number.isNaN(n))){if(i.l.set(e,n),s._){const t=s._[e];t&&t.map((t=>{try{const[[o,l]]=Object.entries(t);(128&f||1&l)&&(u?u[o](n,c,e):i.A.push((()=>{i.D[o](n,c,e)})))}catch(t){l(t,r)}}))}if(2&f){if(u.componentShouldUpdate&&!1===u.componentShouldUpdate(n,c,e)&&!(16&f))return;16&f||J(i,!1)}}},it=(e,n)=>{var l,s;const i=e.prototype;{e.watchers&&!n._&&(n._=_(e.watchers)),e.deserializers&&!n.H&&(n.H=e.deserializers),e.serializers&&!n.N&&(n.N=e.serializers);const r=Object.entries(null!=(l=n.t)?l:{});r.map((([e,[l]])=>{if(31&l||32&l){const{get:s,set:r}=t(i,e)||{};s&&(n.t[e][0]|=2048),r&&(n.t[e][0]|=4096),Object.defineProperty(i,e,{get(){return s?s.apply(this):((t,e)=>o(this).l.get(e))(0,e)},configurable:!0,enumerable:!0}),Object.defineProperty(i,e,{set(t){const s=o(this);if(s){if(r)return void 0===(32&l?this[e]:s.$hostElement$[e])&&s.l.get(e)&&(t=s.l.get(e)),r.call(this,x(t,l)),void st(this,e,t=32&l?this[e]:s.$hostElement$[e],n);st(this,e,t,n)}}})}}));{const t=new Map;i.attributeChangedCallback=function(e,l,s){c.jmp((()=>{var c;const f=t.get(e),u=o(this);if(this.hasOwnProperty(f),i.hasOwnProperty(f)&&"number"==typeof this[f]&&this[f]==s)return;if(null==f){const t=null==u?void 0:u.i;if(u&&t&&!(8&t)&&s!==l){const o=this,i=null==(c=n._)?void 0:c[e];null==i||i.forEach((n=>{const[[i,r]]=Object.entries(n);null!=o[i]&&(128&t||1&r)&&o[i].call(o,s,l,e)}))}return}const a=r.find((([t])=>t===f)),d=4&(a?a[1][0]:0),h=d&&null===s&&void 0===this[f];d&&(s=null!==s&&"false"!==s);const p=Object.getOwnPropertyDescriptor(i,f);h||s==this[f]||p.get&&!p.set||(this[f]=s)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n._)?s:{}),...r.filter((([t,e])=>31&e[0])).map((([e,n])=>{const o=n[1]||e;return t.set(o,e),o}))]))}}return e},rt=async(t,e,n)=>{let o;try{if(!(32&e.i)&&(e.i|=32,e.i&=-1025,o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.i|=128)),o&&o.style)){let t;"string"==typeof o.style&&(t=o.style);const e=k(n);if(!s.has(e)){const o=()=>{};((t,e,n)=>{let o=s.get(t);f&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,s.set(t,o)})(e,t,!!(1&n.i)),o()}}const l=e.M,i=()=>J(e,!0);l&&l["s-rc"]?l["s-rc"].push(i):i()}catch(n){l(n,t),e.k&&(e.k(),e.k=void 0),!e.L||1024&e.i||e.L(t)}},ct=(t,e)=>{const s={i:e[0],h:e[1]};try{s.t=e[2],s._=_(t._),s.H=t.H,s.N=t.N;const l=t.prototype.connectedCallback,i=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const o={i:0,$hostElement$:t,o:e,l:new Map,P:new Map};o.U=new Promise((t=>o.L=t)),t["s-p"]=[],t["s-rc"]=[];const l=o;t.__stencil__getHostRef=()=>l,512&e.i&&n(t,o)})(this,s)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!o(this))return;this.__hasHostListenerAttached=!0}(t=>{if(!(1&c.i)){const e=o(t);if(!e)return;const n=e.o,l=()=>{};if(1&e.i)(null==e?void 0:e.D)||(1024&e.i?setTimeout((()=>rt(t,e,n)),1e3):(null==e?void 0:e.U)&&e.U.then((()=>{})));else{e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){G(e,e.M=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n}})),rt(t,e,n)}l()}})(this),l&&l.call(this)},disconnectedCallback(){(async t=>{S.has(t)&&S.delete(t),t.shadowRoot&&S.has(t.shadowRoot)&&S.delete(t.shadowRoot)})(this),i&&i.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${s.h}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else g.call(this,s)}}),Object.defineProperty(t,"is",{value:s.h,configurable:!0}),it(t,s)}catch(e){return l(e),t}},ft=t=>c.C=t,ut=t=>Object.assign(c,t),at=new WeakMap;function dt(t,e){let n=at.get(e);n||(n={i:0,o:{i:0,h:e.tagName},$hostElement$:e},at.set(e,n)),B(n,t)}function ht(t){return t}export{r as H,w as getAssetPath,E as h,ct as p,dt as render,j as setAssetPath,ft as setNonce,ut as setPlatformOptions,ht as t}
1
+ function t(t,e,n){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,e);if(o&&(!n||o.get))return o;t=Object.getPrototypeOf(t)}}var e,n=(e,n)=>{var o;Object.entries(null!=(o=n.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=e[o],s=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);s&&Object.defineProperty(e,o,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),n.l.has(o)?e[o]=n.l.get(o):void 0!==l&&(e[o]=l)}}))},o=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>(0,console.error)(t,e),s=new Map,i="undefined"!=typeof window?window:{},r=i.HTMLElement||class{},c={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},u=(()=>{try{return!!i.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),f=!!u&&(()=>!!i.document&&Object.getOwnPropertyDescriptor(i.document.adoptedStyleSheets,"length").writable)(),a=!1,d=[],h=[],p=()=>{var t;return(null==(t=i.document)?void 0:t.hidden)?setTimeout($,16):c.raf($)},m=(t,e)=>n=>{t.push(n),a||(a=!0,e&&4&c.i?v($):p())},b=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){l(t)}t.length=0},$=()=>{b(d),b(h),(a=d.length>0)&&p()},v=t=>Promise.resolve(void 0).then(t),y=m(h,!0),w=t=>{const e=new URL(t,c.u);return e.origin!==i.location.origin?e.href:e.pathname},j=t=>c.u=t;function g(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(f?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}var O,S=new WeakMap,k=t=>"sc-"+t.h,M=t=>"object"==(t=typeof t)||"function"===t,E=(t,e,...n)=>{let o=null,s=null,i=!1,r=!1;const c=[],u=e=>{for(let n=0;n<e.length;n++)if(o=e[n],Array.isArray(o))u(o);else if(null!=o&&"boolean"!=typeof o){if(i="function"!=typeof t&&!M(o))o+="";else if("function"!=typeof t&&void 0===o.i){l("Invalid vNode child");continue}i&&r?c[c.length-1].p+=o:c.push(i?C(null,o):o),r=i}};if(u(n),e){e.key&&(s=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}const f=C(t,null);return f.m=e,c.length>0&&(f.$=c),f.v=s,f},C=(t,e)=>({i:0,j:t,p:null!=e?e:null,O:null,$:null,m:null,v:null}),L={},_=t=>{if(!t)return;const e=Object.keys(t);if(0===e.length)return;let n=!1;for(const o of e){if(n)break;for(const e of t[o])if("string"==typeof e){n=!0;break}}if(!n)return t;const o={};for(const n of e)o[n]=t[n].map((t=>"string"==typeof t?{[t]:0}:t));return o},x=(t,e)=>null==t||M(t)?t:1&e?t+"":t,A=(t,e)=>{const n=t;return{emit:t=>D(n,e,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},D=(t,e,n)=>{const o=c.ce(e,n);return t.dispatchEvent(o),o},H=(t,e,n,o)=>{if(n!==o)if(e.toLowerCase(),"class"===e){const e=t.classList,l=P(n);let s=P(o);{let t=l.filter((t=>t&&!s.includes(t)));e.remove(...t),e.add(...s.filter((t=>t&&!l.includes(t))))}}else"key"===e||"ref"===e&&o&&B(o,t)},N=/\s/,P=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(N):[]),U=(t,e)=>{const n=11===e.O.nodeType&&e.O.host?e.O.host:e.O,o=t&&t.m||{},l=e.m||{};for(const t of W(Object.keys(o)))t in l||H(n,t,o[t],void 0);for(const t of W(Object.keys(l)))H(n,t,o[t],l[t])};function W(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var R=[],T=[],V=(t,e,n)=>{const o=e.$[n];let l,s,r=0;if(!i.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.O=i.document.createElement(o.j),U(null,o),o.$){const e="template"===o.j?l.content:l;for(r=0;r<o.$.length;++r)s=V(t,o,r),s&&e.appendChild(s)}return l["s-hn"]=O,l},q=(t,e,n,o,l,s)=>{let i,r=t;for(r.shadowRoot&&r.tagName===O&&(r=r.shadowRoot),"template"===n.j&&(r=r.content);l<=s;++l)o[l]&&(i=V(null,n,l),i&&(o[l].O=i,G(r,i,e)))},F=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.O;Y(e),t&&t.remove()}}},z=(t,e,n=!1)=>t.j===e.j&&(n?(n&&!t.v&&e.v&&(t.v=e.v),!0):t.v===e.v),I=(t,e,n=!1)=>{const o=e.O=t.O,l=t.$,s=e.$;U(t,e),null!==l&&null!==s?((t,e,n,o,l=!1)=>{let s,i,r=0,c=0,u=0,f=0,a=e.length-1,d=e[0],h=e[a],p=o.length-1,m=o[0],b=o[p];const $="template"===n.j?t.content:t;for(;r<=a&&c<=p;)if(null==d)d=e[++r];else if(null==h)h=e[--a];else if(null==m)m=o[++c];else if(null==b)b=o[--p];else if(z(d,m,l))I(d,m,l),d=e[++r],m=o[++c];else if(z(h,b,l))I(h,b,l),h=e[--a],b=o[--p];else if(z(d,b,l))I(d,b,l),G($,d.O,h.O.nextSibling),d=e[++r],b=o[--p];else if(z(h,m,l))I(h,m,l),G($,h.O,d.O),h=e[--a],m=o[++c];else{for(u=-1,f=r;f<=a;++f)if(e[f]&&null!==e[f].v&&e[f].v===m.v){u=f;break}u>=0?(i=e[u],i.j!==m.j?s=V(e&&e[c],n,c):(I(i,m,l),e[u]=void 0,s=i.O),m=o[++c]):(s=V(e&&e[c],n,c),m=o[++c]),s&&G(d.O.parentNode,s,d.O)}r>a?q(t,null==o[p+1]?null:o[p+1].O,n,o,c,p):c>p&&F(e,r,a)})(o,l,e,s,n):null!==s?q(o,null,e,s,0,s.length-1):!n&&null!==l&&F(l,0,l.length-1)},Y=t=>{t.m&&t.m.ref&&R.push((()=>t.m.ref(null))),t.$&&t.$.map(Y)},B=(t,e)=>{T.push((()=>t(e)))},G=(t,e,n)=>null==t?void 0:t.insertBefore(e,n),J=(t,e,n=!1)=>{const o=t.$hostElement$,l=t.S||C(null,null),s=(t=>t&&t.j===L)(e)?e:E(null,null,e);if(O=o.tagName,n&&s.m)for(const t of Object.keys(s.m))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(s.m[t]=o[t]);s.j=null,s.i|=4,t.S=s,s.O=l.O=o.shadowRoot||o,I(l,s,n),R.forEach((t=>t())),R.length=0,T.forEach((t=>t())),T.length=0},K=(t,e)=>{if(e&&!t.k&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.k=()=>{e["s-p"].splice(n-1,1),o()})))}},Q=(t,e)=>{if(t.i|=16,4&t.i)return void(t.i|=512);K(t,t.M);const n=()=>X(t,e);if(!e)return y(n);queueMicrotask((()=>{n()}))},X=(t,e)=>{const n=t.$hostElement$,o=n;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return l=st(o,e?"componentWillLoad":"componentWillUpdate",void 0,n),l=Z(l,(()=>st(o,"componentWillRender",void 0,n))),Z(l,(()=>et(t,o,e)))},Z=(t,e)=>tt(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),tt=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,et=async(t,e,n)=>{var o;const l=t.$hostElement$,r=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.i,l=((t,e)=>{var n,o,l;const r=k(e),a=s.get(r);if(!i.document)return r;if(t=11===t.nodeType?t:i.document,a)if("string"==typeof a){let l,s=S.get(t=t.head||t);if(s||S.set(t,s=new Set),!s.has(r)){l=i.document.createElement("style"),l.textContent=a;const d=null!=(n=c.C)?n:function(){var t,e,n;return null!=(n=null==(e=null==(t=i.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?n:void 0}();if(null!=d&&l.setAttribute("nonce",d),!(1&e.i))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(u){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(a),f?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=a+e.textContent:t.prepend(l)}else t.append(l);1&e.i&&t.insertBefore(l,null),4&e.i&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),s&&s.add(r)}}else{let e=S.get(t);if(e||S.set(t,e=new Set),!e.has(r)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(a.constructor===n.CSSStyleSheet)o=a;else{o=new n.CSSStyleSheet;for(let t=0;t<a.cssRules.length;t++)o.insertRule(a.cssRules[t].cssText,t)}f?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(r)}}return r})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);nt(t,e,l,n),r&&(r.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>ot(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.i|=4,e.length=0)}},nt=(t,e,n,o)=>{try{e=e.render(),t.i&=-17,t.i|=2,J(t,e,o)}catch(e){l(e,t.$hostElement$)}return null},ot=t=>{const e=t.$hostElement$,n=e,o=t.M;st(n,"componentDidRender",void 0,e),64&t.i?st(n,"componentDidUpdate",void 0,e):(t.i|=64,it(e),st(n,"componentDidLoad",void 0,e),t.L(e),o||lt()),t.k&&(t.k(),t.k=void 0),512&t.i&&v((()=>Q(t,!1))),t.i&=-517},lt=()=>{v((()=>D(i,"appload",{detail:{namespace:"charts"}})))},st=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){l(t,o)}},it=t=>t.classList.add("hydrated"),rt=(t,e,n,s)=>{const i=o(t);if(!i)return;const r=t,c=i.l.get(e),u=i.i,f=r;if(!((n=x(n,s.t[e][0]))===c||Number.isNaN(c)&&Number.isNaN(n))){if(i.l.set(e,n),s._){const t=s._[e];t&&t.map((t=>{try{const[[o,l]]=Object.entries(t);(128&u||1&l)&&(f?f[o](n,c,e):i.A.push((()=>{i.D[o](n,c,e)})))}catch(t){l(t,r)}}))}if(2&u){if(f.componentShouldUpdate&&!1===f.componentShouldUpdate(n,c,e)&&!(16&u))return;16&u||Q(i,!1)}}},ct=(e,n)=>{var l,s;const i=e.prototype;{e.watchers&&!n._&&(n._=_(e.watchers)),e.deserializers&&!n.H&&(n.H=e.deserializers),e.serializers&&!n.N&&(n.N=e.serializers);const r=Object.entries(null!=(l=n.t)?l:{});r.map((([e,[l]])=>{if(31&l||32&l){const{get:s,set:r}=t(i,e)||{};s&&(n.t[e][0]|=2048),r&&(n.t[e][0]|=4096),Object.defineProperty(i,e,{get(){return s?s.apply(this):((t,e)=>o(this).l.get(e))(0,e)},configurable:!0,enumerable:!0}),Object.defineProperty(i,e,{set(t){const s=o(this);if(s){if(r)return void 0===(32&l?this[e]:s.$hostElement$[e])&&s.l.get(e)&&(t=s.l.get(e)),r.call(this,x(t,l)),void rt(this,e,t=32&l?this[e]:s.$hostElement$[e],n);rt(this,e,t,n)}}})}}));{const t=new Map;i.attributeChangedCallback=function(e,l,s){c.jmp((()=>{var c;const u=t.get(e),f=o(this);if(this.hasOwnProperty(u),i.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==s)return;if(null==u){const t=null==f?void 0:f.i;if(f&&t&&!(8&t)&&s!==l){const o=this,i=null==(c=n._)?void 0:c[e];null==i||i.forEach((n=>{const[[i,r]]=Object.entries(n);null!=o[i]&&(128&t||1&r)&&o[i].call(o,s,l,e)}))}return}const a=r.find((([t])=>t===u)),d=4&(a?a[1][0]:0),h=d&&null===s&&void 0===this[u];d&&(s=null!==s&&"false"!==s);const p=Object.getOwnPropertyDescriptor(i,u);h||s==this[u]||p.get&&!p.set||(this[u]=s)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n._)?s:{}),...r.filter((([t,e])=>31&e[0])).map((([e,n])=>{const o=n[1]||e;return t.set(o,e),o}))]))}}return e},ut=async(t,e,n)=>{let o;try{if(!(32&e.i)&&(e.i|=32,e.i&=-1025,o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.i|=128)),o&&o.style)){let t;"string"==typeof o.style&&(t=o.style);const e=k(n);if(!s.has(e)){const o=()=>{};((t,e,n)=>{let o=s.get(t);u&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,s.set(t,o)})(e,t,!!(1&n.i)),o()}}const l=e.M,i=()=>Q(e,!0);l&&l["s-rc"]?l["s-rc"].push(i):i()}catch(n){l(n,t),e.k&&(e.k(),e.k=void 0),!e.L||1024&e.i||e.L(t)}},ft=(t,e)=>{const s={i:e[0],h:e[1]};try{s.t=e[2],s._=_(t._),s.H=t.H,s.N=t.N;const l=t.prototype.connectedCallback,i=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const o={i:0,$hostElement$:t,o:e,l:new Map,P:new Map};o.U=new Promise((t=>o.L=t)),t["s-p"]=[],t["s-rc"]=[];const l=o;t.__stencil__getHostRef=()=>l,512&e.i&&n(t,o)})(this,s)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!o(this))return;this.__hasHostListenerAttached=!0}(t=>{if(!(1&c.i)){const e=o(t);if(!e)return;const n=e.o,l=()=>{};if(1&e.i)(null==e?void 0:e.D)||(1024&e.i?setTimeout((()=>ut(t,e,n)),1e3):(null==e?void 0:e.U)&&e.U.then((()=>{})));else{e.i|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){K(e,e.M=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n}})),ut(t,e,n)}l()}})(this),l&&l.call(this)},disconnectedCallback(){(async t=>{S.has(t)&&S.delete(t),t.shadowRoot&&S.has(t.shadowRoot)&&S.delete(t.shadowRoot)})(this),i&&i.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${s.h}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else g.call(this,s)}}),Object.defineProperty(t,"is",{value:s.h,configurable:!0}),ct(t,s)}catch(e){return l(e),t}},at=t=>c.C=t,dt=t=>Object.assign(c,t),ht=new WeakMap;function pt(t,e){let n=ht.get(e);n||(n={i:0,o:{i:0,h:e.tagName},$hostElement$:e},ht.set(e,n)),J(n,t)}function mt(t){return t}export{r as H,A as c,w as getAssetPath,E as h,ft as p,pt as render,j as setAssetPath,at as setNonce,dt as setPlatformOptions,mt as t}