@nethru/kit 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +1879 -1873
- package/dist/index.js +1879 -1871
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,1001 +1,216 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { alpha, Box, keyframes, Stack, TextField, FormControl, Select, MenuItem, IconButton } from '@mui/material';
|
|
2
|
+
import React$1, { useMemo, createContext, useContext, useState, useEffect, useCallback, useRef } from 'react';
|
|
3
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
4
|
import Highcharts$1 from 'highcharts';
|
|
3
5
|
import HighchartsReact from 'highcharts-react-official';
|
|
4
6
|
import highchartsAccessibility from 'highcharts/modules/accessibility';
|
|
5
7
|
import highchartsAnnotations from 'highcharts/modules/annotations';
|
|
6
8
|
import { blue, purple, green, yellow, red, orange, lime, grey } from '@nethru/ui/base/colors';
|
|
7
|
-
import { alpha, Box, keyframes, Stack, TextField, FormControl, Select, MenuItem, IconButton } from '@mui/material';
|
|
8
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { Send } from '@mui/icons-material';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
let globalConfig = {
|
|
12
|
+
apiUrl: ''
|
|
13
|
+
};
|
|
14
|
+
function configure$1(config) {
|
|
15
|
+
globalConfig = {
|
|
16
|
+
...globalConfig,
|
|
17
|
+
...config
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function getConfig() {
|
|
21
|
+
return globalConfig;
|
|
13
22
|
}
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
function ok$1() {}
|
|
25
|
+
|
|
26
|
+
function unreachable() {}
|
|
16
27
|
|
|
17
28
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
29
|
+
* @typedef Options
|
|
30
|
+
* Configuration for `stringify`.
|
|
31
|
+
* @property {boolean} [padLeft=true]
|
|
32
|
+
* Whether to pad a space before a token.
|
|
33
|
+
* @property {boolean} [padRight=false]
|
|
34
|
+
* Whether to pad a space after a token.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Serialize an array of strings or numbers to comma-separated tokens.
|
|
21
40
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
41
|
+
* @param {Array<string|number>} values
|
|
42
|
+
* List of tokens.
|
|
43
|
+
* @param {Options} [options]
|
|
44
|
+
* Configuration for `stringify` (optional).
|
|
45
|
+
* @returns {string}
|
|
46
|
+
* Comma-separated tokens.
|
|
47
|
+
*/
|
|
48
|
+
function stringify$1(values, options) {
|
|
49
|
+
const settings = {};
|
|
50
|
+
|
|
51
|
+
// Ensure the last empty entry is seen.
|
|
52
|
+
const input = values[values.length - 1] === '' ? [...values, ''] : values;
|
|
53
|
+
|
|
54
|
+
return input
|
|
55
|
+
.join(
|
|
56
|
+
(settings.padRight ? ' ' : '') +
|
|
57
|
+
',' +
|
|
58
|
+
(settings.padLeft === false ? '' : ' ')
|
|
59
|
+
)
|
|
60
|
+
.trim()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @typedef Options
|
|
65
|
+
* Configuration.
|
|
66
|
+
* @property {boolean | null | undefined} [jsx=false]
|
|
67
|
+
* Support JSX identifiers (default: `false`).
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
const nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
71
|
+
const nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
72
|
+
|
|
73
|
+
/** @type {Options} */
|
|
74
|
+
const emptyOptions$2 = {};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Checks if the given value is a valid identifier name.
|
|
24
78
|
*
|
|
25
|
-
*
|
|
79
|
+
* @param {string} name
|
|
80
|
+
* Identifier to check.
|
|
81
|
+
* @param {Options | null | undefined} [options]
|
|
82
|
+
* Configuration (optional).
|
|
83
|
+
* @returns {boolean}
|
|
84
|
+
* Whether `name` can be an identifier.
|
|
26
85
|
*/
|
|
86
|
+
function name(name, options) {
|
|
87
|
+
const settings = emptyOptions$2;
|
|
88
|
+
const re = settings.jsx ? nameReJsx : nameRe;
|
|
89
|
+
return re.test(name)
|
|
90
|
+
}
|
|
27
91
|
|
|
28
|
-
|
|
92
|
+
/**
|
|
93
|
+
* @typedef {import('hast').Nodes} Nodes
|
|
94
|
+
*/
|
|
29
95
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
96
|
+
// HTML whitespace expression.
|
|
97
|
+
// See <https://infra.spec.whatwg.org/#ascii-whitespace>.
|
|
98
|
+
const re = /[ \t\n\f\r]/g;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Check if the given value is *inter-element whitespace*.
|
|
102
|
+
*
|
|
103
|
+
* @param {Nodes | string} thing
|
|
104
|
+
* Thing to check (`Node` or `string`).
|
|
105
|
+
* @returns {boolean}
|
|
106
|
+
* Whether the `value` is inter-element whitespace (`boolean`): consisting of
|
|
107
|
+
* zero or more of space, tab (`\t`), line feed (`\n`), carriage return
|
|
108
|
+
* (`\r`), or form feed (`\f`); if a node is passed it must be a `Text` node,
|
|
109
|
+
* whose `value` field is checked.
|
|
110
|
+
*/
|
|
111
|
+
function whitespace(thing) {
|
|
112
|
+
return typeof thing === 'object'
|
|
113
|
+
? thing.type === 'text'
|
|
114
|
+
? empty$1(thing.value)
|
|
115
|
+
: false
|
|
116
|
+
: empty$1(thing)
|
|
37
117
|
}
|
|
38
118
|
|
|
39
|
-
|
|
119
|
+
/**
|
|
120
|
+
* @param {string} value
|
|
121
|
+
* @returns {boolean}
|
|
122
|
+
*/
|
|
123
|
+
function empty$1(value) {
|
|
124
|
+
return value.replace(re, '') === ''
|
|
125
|
+
}
|
|
40
126
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
title: {
|
|
66
|
-
text: undefined
|
|
67
|
-
},
|
|
68
|
-
tooltip: {
|
|
69
|
-
pointFormat: '<span><b>{point.y}</b> ({point.percentage:.1f}%)</span>',
|
|
70
|
-
style: {
|
|
71
|
-
fontFamily: fontFamily$1,
|
|
72
|
-
fontSize: '13px'
|
|
73
|
-
},
|
|
74
|
-
useHTML: true
|
|
75
|
-
},
|
|
76
|
-
plotOptions: {
|
|
77
|
-
pie: {
|
|
78
|
-
size: size,
|
|
79
|
-
allowPointSelect: true,
|
|
80
|
-
cursor: 'pointer',
|
|
81
|
-
dataLabels: {
|
|
82
|
-
enabled: true,
|
|
83
|
-
format: '{point.name}<br><b>{point.y}</b> ({point.percentage:.1f}%)',
|
|
84
|
-
distance: 20,
|
|
85
|
-
style: {
|
|
86
|
-
fontSize: '13px',
|
|
87
|
-
fontWeight: '100',
|
|
88
|
-
textOutline: 'none',
|
|
89
|
-
fontFamily: fontFamily$1
|
|
90
|
-
},
|
|
91
|
-
connectorColor: '#666',
|
|
92
|
-
connectorWidth: 1,
|
|
93
|
-
overflow: 'allow',
|
|
94
|
-
crop: false
|
|
95
|
-
},
|
|
96
|
-
showInLegend: false
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
series: [{
|
|
100
|
-
type: 'pie',
|
|
101
|
-
name: '',
|
|
102
|
-
colorByPoint: true,
|
|
103
|
-
data: chartData
|
|
104
|
-
}],
|
|
105
|
-
credits: {
|
|
106
|
-
enabled: false
|
|
107
|
-
},
|
|
108
|
-
accessibility: {
|
|
109
|
-
enabled: false
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}, [data, width, height, size, colors]);
|
|
113
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
114
|
-
style: styles$7.chartWrapper
|
|
115
|
-
}, /*#__PURE__*/React$1.createElement("div", {
|
|
116
|
-
style: {
|
|
117
|
-
...styles$7.chartContainer,
|
|
118
|
-
width,
|
|
119
|
-
height,
|
|
120
|
-
position: 'relative'
|
|
121
|
-
}
|
|
122
|
-
}, noData && /*#__PURE__*/React$1.createElement(CheckerboardBackground, {
|
|
123
|
-
width: width,
|
|
124
|
-
height: height
|
|
125
|
-
}), /*#__PURE__*/React$1.createElement("div", {
|
|
126
|
-
style: {
|
|
127
|
-
position: 'relative',
|
|
128
|
-
zIndex: 1
|
|
127
|
+
/**
|
|
128
|
+
* @import {Schema as SchemaType, Space} from 'property-information'
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
/** @type {SchemaType} */
|
|
132
|
+
class Schema {
|
|
133
|
+
/**
|
|
134
|
+
* @param {SchemaType['property']} property
|
|
135
|
+
* Property.
|
|
136
|
+
* @param {SchemaType['normal']} normal
|
|
137
|
+
* Normal.
|
|
138
|
+
* @param {Space | undefined} [space]
|
|
139
|
+
* Space.
|
|
140
|
+
* @returns
|
|
141
|
+
* Schema.
|
|
142
|
+
*/
|
|
143
|
+
constructor(property, normal, space) {
|
|
144
|
+
this.normal = normal;
|
|
145
|
+
this.property = property;
|
|
146
|
+
|
|
147
|
+
if (space) {
|
|
148
|
+
this.space = space;
|
|
129
149
|
}
|
|
130
|
-
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
131
|
-
highcharts: Highcharts$1,
|
|
132
|
-
options: options
|
|
133
|
-
}))), /*#__PURE__*/React$1.createElement("div", {
|
|
134
|
-
style: styles$7.agentName
|
|
135
|
-
}, data.name));
|
|
136
|
-
};
|
|
137
|
-
const fontFamily$1 = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
138
|
-
const styles$7 = {
|
|
139
|
-
chartWrapper: {
|
|
140
|
-
background: 'transparent',
|
|
141
|
-
textAlign: 'center',
|
|
142
|
-
display: 'flex',
|
|
143
|
-
flexDirection: 'column',
|
|
144
|
-
justifyContent: 'center',
|
|
145
|
-
alignItems: 'center'
|
|
146
|
-
},
|
|
147
|
-
chartContainer: {
|
|
148
|
-
display: 'flex',
|
|
149
|
-
alignItems: 'center',
|
|
150
|
-
justifyContent: 'center'
|
|
151
|
-
},
|
|
152
|
-
agentName: {
|
|
153
|
-
fontSize: '12px',
|
|
154
|
-
fontWeight: '100',
|
|
155
|
-
marginTop: '-30px',
|
|
156
|
-
color: '#333'
|
|
157
150
|
}
|
|
158
|
-
}
|
|
159
|
-
const CheckerboardBackground = ({
|
|
160
|
-
width,
|
|
161
|
-
height
|
|
162
|
-
}) => {
|
|
163
|
-
const circleSize = Math.min(width, height) * 0.47;
|
|
164
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
165
|
-
style: {
|
|
166
|
-
position: 'absolute',
|
|
167
|
-
width: circleSize,
|
|
168
|
-
height: circleSize,
|
|
169
|
-
borderRadius: '50%',
|
|
170
|
-
backgroundImage: `
|
|
171
|
-
linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
|
|
172
|
-
linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
|
|
173
|
-
linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
|
|
174
|
-
linear-gradient(-45deg, transparent 75%, #e0e0e0 75%)
|
|
175
|
-
`,
|
|
176
|
-
backgroundSize: '10px 10px',
|
|
177
|
-
backgroundPosition: '0 0, 0 5px, 5px -5px, -5px 0px',
|
|
178
|
-
backgroundColor: '#ffffff',
|
|
179
|
-
zIndex: 0
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
const checkerboardPattern = () => ({
|
|
184
|
-
pattern: {
|
|
185
|
-
path: {
|
|
186
|
-
d: 'M 0 0 L 5 5 M 4.5 -0.5 L 5.5 0.5 M -0.5 4.5 L 0.5 5.5',
|
|
187
|
-
stroke: '#d0d0d0',
|
|
188
|
-
strokeWidth: 1
|
|
189
|
-
},
|
|
190
|
-
width: 5,
|
|
191
|
-
height: 5,
|
|
192
|
-
backgroundColor: '#ffffff',
|
|
193
|
-
opacity: 1
|
|
194
|
-
}
|
|
195
|
-
});
|
|
151
|
+
}
|
|
196
152
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
title: {
|
|
226
|
-
text: undefined
|
|
227
|
-
},
|
|
228
|
-
tooltip: {
|
|
229
|
-
pointFormat: '<span><b>{point.y}</b></span>',
|
|
230
|
-
style: {
|
|
231
|
-
fontFamily: fontFamily,
|
|
232
|
-
fontSize: '13px',
|
|
233
|
-
fontWeight: '100'
|
|
234
|
-
},
|
|
235
|
-
useHTML: true
|
|
236
|
-
},
|
|
237
|
-
plotOptions: {
|
|
238
|
-
column: {
|
|
239
|
-
//size: size
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
xAxis: {
|
|
243
|
-
categories: data.categories,
|
|
244
|
-
crosshair: true,
|
|
245
|
-
labels: {
|
|
246
|
-
style: {
|
|
247
|
-
color: '#777',
|
|
248
|
-
fontFamily: fontFamily,
|
|
249
|
-
fontWeight: '400'
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
lineColor: '#aaa'
|
|
253
|
-
},
|
|
254
|
-
yAxis: {
|
|
255
|
-
title: {
|
|
256
|
-
text: undefined
|
|
257
|
-
},
|
|
258
|
-
labels: {
|
|
259
|
-
style: {
|
|
260
|
-
fontFamily: fontFamily,
|
|
261
|
-
fontSize: '12px',
|
|
262
|
-
fontWeight: '100'
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
gridLineColor: '#f9f9f9'
|
|
266
|
-
},
|
|
267
|
-
legend: {
|
|
268
|
-
layout: 'vertical',
|
|
269
|
-
itemStyle: {
|
|
270
|
-
fontFamily: fontFamily,
|
|
271
|
-
fontSize: '12px',
|
|
272
|
-
fontWeight: '100'
|
|
273
|
-
},
|
|
274
|
-
useHTML: true
|
|
275
|
-
},
|
|
276
|
-
series: series,
|
|
277
|
-
colors: colors,
|
|
278
|
-
credits: {
|
|
279
|
-
enabled: false
|
|
280
|
-
},
|
|
281
|
-
accessibility: {
|
|
282
|
-
enabled: false
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
}, [data, width, height, series, colors]);
|
|
286
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
287
|
-
style: styles$6.chartWrapper
|
|
288
|
-
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
289
|
-
highcharts: Highcharts$1,
|
|
290
|
-
options: options
|
|
291
|
-
}));
|
|
292
|
-
};
|
|
293
|
-
const fontFamily = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
294
|
-
const styles$6 = {
|
|
295
|
-
chartWrapper: {
|
|
296
|
-
background: 'transparent',
|
|
297
|
-
textAlign: 'center',
|
|
298
|
-
display: 'flex',
|
|
299
|
-
flexDirection: 'column',
|
|
300
|
-
justifyContent: 'center',
|
|
301
|
-
alignItems: 'center'
|
|
153
|
+
Schema.prototype.normal = {};
|
|
154
|
+
Schema.prototype.property = {};
|
|
155
|
+
Schema.prototype.space = undefined;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @import {Info, Space} from 'property-information'
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @param {ReadonlyArray<Schema>} definitions
|
|
164
|
+
* Definitions.
|
|
165
|
+
* @param {Space | undefined} [space]
|
|
166
|
+
* Space.
|
|
167
|
+
* @returns {Schema}
|
|
168
|
+
* Schema.
|
|
169
|
+
*/
|
|
170
|
+
function merge(definitions, space) {
|
|
171
|
+
/** @type {Record<string, Info>} */
|
|
172
|
+
const property = {};
|
|
173
|
+
/** @type {Record<string, string>} */
|
|
174
|
+
const normal = {};
|
|
175
|
+
|
|
176
|
+
for (const definition of definitions) {
|
|
177
|
+
Object.assign(property, definition.property);
|
|
178
|
+
Object.assign(normal, definition.normal);
|
|
302
179
|
}
|
|
303
|
-
};
|
|
304
|
-
const alphas = ['ff', 'bb', '77', '33'];
|
|
305
180
|
|
|
306
|
-
|
|
307
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
308
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
309
|
-
var t = arguments[e];
|
|
310
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
311
|
-
}
|
|
312
|
-
return n;
|
|
313
|
-
}, _extends.apply(null, arguments);
|
|
181
|
+
return new Schema(property, normal, space)
|
|
314
182
|
}
|
|
315
183
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
function
|
|
326
|
-
return
|
|
327
|
-
}
|
|
328
|
-
function formatPercent(value) {
|
|
329
|
-
return value !== undefined ? `${value.toLocaleString()}%` : '-';
|
|
330
|
-
}
|
|
331
|
-
function formatDuration(value) {
|
|
332
|
-
value = toValue(value);
|
|
333
|
-
if (!value) return '-';
|
|
334
|
-
let day = Math.floor(value / (60 * 60 * 24));
|
|
335
|
-
let hour = Math.floor(value / (60 * 60)) - day * 24;
|
|
336
|
-
let minute = Math.floor(value / 60) - (day * 24 + hour) * 60;
|
|
337
|
-
let second = Math.round(value % 60);
|
|
338
|
-
day = day > 0 ? `${day.toLocaleString()}일 ` : '';
|
|
339
|
-
hour = hour > 0 ? `${hour >= 10 ? hour : '0' + hour}시간 ` : '';
|
|
340
|
-
minute = `${minute >= 10 ? minute : '0' + minute}분 `;
|
|
341
|
-
second = `${second >= 10 ? second : '0' + second}초`;
|
|
342
|
-
return `${day}${hour}${minute}${second}`;
|
|
343
|
-
}
|
|
344
|
-
function formatBytes(value) {
|
|
345
|
-
return value !== undefined ? `${value.toLocaleString()} bytes` : '-';
|
|
184
|
+
/**
|
|
185
|
+
* Get the cleaned case insensitive form of an attribute or property.
|
|
186
|
+
*
|
|
187
|
+
* @param {string} value
|
|
188
|
+
* An attribute-like or property-like name.
|
|
189
|
+
* @returns {string}
|
|
190
|
+
* Value that can be used to look up the properly cased property on a
|
|
191
|
+
* `Schema`.
|
|
192
|
+
*/
|
|
193
|
+
function normalize$1(value) {
|
|
194
|
+
return value.toLowerCase()
|
|
346
195
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
const preset = ['#003f5c', '#a05195', '#665191', '#2f4b7c', '#d45087', '#f95d6a', '#ff7c43', '#ffa600'];
|
|
366
|
-
all$1.map(color => color[0]);
|
|
367
|
-
|
|
368
|
-
highchartsAccessibility(Highcharts$1);
|
|
369
|
-
highchartsAnnotations(Highcharts$1);
|
|
370
|
-
function Chart(props) {
|
|
371
|
-
const [legendLimitEnabled, setLegendLimitEnabled] = useState(props.legendLimit > 0);
|
|
372
|
-
const [options, setOptions] = useState(toOptions(props, legendLimitEnabled));
|
|
373
|
-
useEffect(() => {
|
|
374
|
-
if (props.delay) setTimeout(() => setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick)), props.delay);else setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick));
|
|
375
|
-
// eslint-disable-next-line
|
|
376
|
-
}, [props]);
|
|
377
|
-
const handleLegendItemClick = useCallback(() => setLegendLimitEnabled(false), []);
|
|
378
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, options && /*#__PURE__*/React.createElement(HighchartsReact, {
|
|
379
|
-
highcharts: Highcharts$1,
|
|
380
|
-
options: options
|
|
381
|
-
}));
|
|
382
|
-
}
|
|
383
|
-
function toOptions(props, legendLimitEnabled, handleLegendItemClick) {
|
|
384
|
-
const {
|
|
385
|
-
title = '',
|
|
386
|
-
type,
|
|
387
|
-
categorize,
|
|
388
|
-
stacking,
|
|
389
|
-
showLegend = true,
|
|
390
|
-
showDataLabel,
|
|
391
|
-
xAxisType,
|
|
392
|
-
xAxisLabel = true,
|
|
393
|
-
xAxisLabelFormat,
|
|
394
|
-
xAxisTickInterval,
|
|
395
|
-
yAxisLabelEnabled = true,
|
|
396
|
-
yAxisLabelFormat,
|
|
397
|
-
yAxisTickInterval = null,
|
|
398
|
-
yAxisPlotLines = [],
|
|
399
|
-
opacity = 1,
|
|
400
|
-
innerSize = 0,
|
|
401
|
-
colors: customColors,
|
|
402
|
-
backgroundColor = undefined,
|
|
403
|
-
xPlotIndex,
|
|
404
|
-
dimension,
|
|
405
|
-
metrics,
|
|
406
|
-
records = [],
|
|
407
|
-
metas,
|
|
408
|
-
height = 200,
|
|
409
|
-
legendLimit,
|
|
410
|
-
legendAlign = 'center',
|
|
411
|
-
tooltip = {},
|
|
412
|
-
secondaryXAxis = []
|
|
413
|
-
} = props;
|
|
414
|
-
const {
|
|
415
|
-
outside
|
|
416
|
-
} = tooltip;
|
|
417
|
-
const pie = type === 'pie';
|
|
418
|
-
const centers = pieCenters(metrics.length);
|
|
419
|
-
const size = pieSize(metrics.length);
|
|
420
|
-
const colors = customColors ? customColors : preset;
|
|
421
|
-
const categories = records.map(record => record[dimension]);
|
|
422
|
-
const mainXAxis = records.map(r => r.time);
|
|
423
|
-
const chartColorHandlers = {
|
|
424
|
-
line: (colors, index) => ({
|
|
425
|
-
color: colors[index],
|
|
426
|
-
mainColor: colors[index]
|
|
427
|
-
}),
|
|
428
|
-
area: (colors, index) => ({
|
|
429
|
-
color: colors[index][0],
|
|
430
|
-
mainColor: colors[index][1]
|
|
431
|
-
}),
|
|
432
|
-
gradient: (colors, index) => ({
|
|
433
|
-
color: {
|
|
434
|
-
linearGradient: {
|
|
435
|
-
x1: 0,
|
|
436
|
-
y1: 0,
|
|
437
|
-
x2: 0,
|
|
438
|
-
y2: 1
|
|
439
|
-
},
|
|
440
|
-
stops: [[0, `${colors[index][0]}`], [0.95, `${colors[index][1]}`]]
|
|
441
|
-
},
|
|
442
|
-
mainColor: colors[index][2]
|
|
443
|
-
})
|
|
444
|
-
};
|
|
445
|
-
const series = metrics.map(({
|
|
446
|
-
chartType,
|
|
447
|
-
metric
|
|
448
|
-
}, index) => {
|
|
449
|
-
const type = chartType === 'gradient' ? 'area' : chartType;
|
|
450
|
-
const {
|
|
451
|
-
color,
|
|
452
|
-
mainColor
|
|
453
|
-
} = chartColorHandlers[chartType](colors, index);
|
|
454
|
-
const meta = metas[metric];
|
|
455
|
-
let option = {
|
|
456
|
-
type: type,
|
|
457
|
-
name: meta ? meta.name : '',
|
|
458
|
-
data: records.map(record => {
|
|
459
|
-
const data = record.metric[metric] ?? null;
|
|
460
|
-
return pie ? {
|
|
461
|
-
name: record[dimension],
|
|
462
|
-
y: data
|
|
463
|
-
} : data;
|
|
464
|
-
}),
|
|
465
|
-
custom: {
|
|
466
|
-
type: meta ? meta.type : '',
|
|
467
|
-
pointerNames: meta?.pointerNames ?? null
|
|
468
|
-
},
|
|
469
|
-
center: centers[index] || [null, null],
|
|
470
|
-
size: size,
|
|
471
|
-
point: {
|
|
472
|
-
events: {
|
|
473
|
-
render: function () {
|
|
474
|
-
this.graphic.attr({
|
|
475
|
-
zIndex: this.y === 0 ? -1 : ZIndex.COMPARE_CHART_BASE - index
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
|
-
showInLegend: pie && index > 0 ? false : true,
|
|
481
|
-
color: color,
|
|
482
|
-
lineColor: mainColor,
|
|
483
|
-
lineWidth: 2,
|
|
484
|
-
marker: {
|
|
485
|
-
fillColor: mainColor
|
|
486
|
-
},
|
|
487
|
-
metric: metric
|
|
488
|
-
};
|
|
489
|
-
if (legendLimitEnabled) option = {
|
|
490
|
-
...option,
|
|
491
|
-
visible: index < legendLimit
|
|
492
|
-
};
|
|
493
|
-
return option;
|
|
494
|
-
});
|
|
495
|
-
const yPlotLines = yAxisPlotLines.map((line, index) => {
|
|
496
|
-
return {
|
|
497
|
-
value: line.value,
|
|
498
|
-
width: 1,
|
|
499
|
-
color: line.color,
|
|
500
|
-
dashStyle: "Dash",
|
|
501
|
-
zIndex: ZIndex.AVERAGE_LINE_BASE + index,
|
|
502
|
-
label: {
|
|
503
|
-
text: line.label,
|
|
504
|
-
align: line.labelAlign,
|
|
505
|
-
style: {
|
|
506
|
-
color: line.labelColor,
|
|
507
|
-
opacity: 0.7,
|
|
508
|
-
fontSize: "12px",
|
|
509
|
-
padding: '1px 5px'
|
|
510
|
-
},
|
|
511
|
-
y: -8,
|
|
512
|
-
useHTML: true
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
});
|
|
516
|
-
const xPlotBands = [{
|
|
517
|
-
from: xPlotIndex,
|
|
518
|
-
to: categories.length - 1,
|
|
519
|
-
color: 'rgba(0, 0, 0, 0.03)',
|
|
520
|
-
zIndex: ZIndex.NOW_BAND
|
|
521
|
-
}];
|
|
522
|
-
const xPlotLines = [{
|
|
523
|
-
color: "#aaa",
|
|
524
|
-
width: 1,
|
|
525
|
-
value: xPlotIndex,
|
|
526
|
-
zIndex: ZIndex.NOW_BORDER,
|
|
527
|
-
label: {
|
|
528
|
-
text: "현재",
|
|
529
|
-
rotation: 0,
|
|
530
|
-
x: 5,
|
|
531
|
-
y: 13,
|
|
532
|
-
style: {
|
|
533
|
-
fontWeight: 500,
|
|
534
|
-
lineHeight: "16.8px",
|
|
535
|
-
color: "#333",
|
|
536
|
-
fontSize: "12px"
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}];
|
|
540
|
-
return {
|
|
541
|
-
chart: {
|
|
542
|
-
type: type.toLowerCase(),
|
|
543
|
-
height: height,
|
|
544
|
-
backgroundColor,
|
|
545
|
-
events: {
|
|
546
|
-
render: secondaryXAxis.length === 0 ? undefined : function () {
|
|
547
|
-
const chart = this;
|
|
548
|
-
const visibleSeries = chart.series.filter(s => s.visible);
|
|
549
|
-
let newCategories = null;
|
|
550
|
-
if (visibleSeries.length === 1 && visibleSeries[0].options.metric === 'prev') {
|
|
551
|
-
newCategories = secondaryXAxis;
|
|
552
|
-
} else {
|
|
553
|
-
newCategories = mainXAxis;
|
|
554
|
-
}
|
|
555
|
-
const isSame = JSON.stringify(chart.xAxis[0].categories) === JSON.stringify(newCategories);
|
|
556
|
-
if (!isSame) {
|
|
557
|
-
chart.xAxis[0].setCategories(newCategories);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
},
|
|
562
|
-
title: {
|
|
563
|
-
text: ''
|
|
564
|
-
},
|
|
565
|
-
subtitle: {
|
|
566
|
-
text: title
|
|
567
|
-
},
|
|
568
|
-
colors: colors,
|
|
569
|
-
xAxis: {
|
|
570
|
-
type: xAxisType,
|
|
571
|
-
labels: {
|
|
572
|
-
enabled: xAxisLabel,
|
|
573
|
-
autoRotation: false,
|
|
574
|
-
format: xAxisLabelFormat ? `{value:${xAxisLabelFormat}}` : undefined,
|
|
575
|
-
style: {
|
|
576
|
-
color: grey[600]
|
|
577
|
-
}
|
|
578
|
-
},
|
|
579
|
-
categories: categorize ? categories : undefined,
|
|
580
|
-
tickWidth: 1,
|
|
581
|
-
tickInterval: xAxisTickInterval ?? (xAxisType === 'datetime' ? records.length / 20 : 1),
|
|
582
|
-
lineColor: grey[900],
|
|
583
|
-
tickColor: grey[900],
|
|
584
|
-
crosshair: true,
|
|
585
|
-
startOnTick: true,
|
|
586
|
-
plotBands: xPlotIndex !== undefined ? xPlotBands : undefined,
|
|
587
|
-
plotLines: xPlotIndex !== undefined ? xPlotLines : undefined
|
|
588
|
-
},
|
|
589
|
-
yAxis: {
|
|
590
|
-
title: {
|
|
591
|
-
text: ''
|
|
592
|
-
},
|
|
593
|
-
labels: {
|
|
594
|
-
enabled: yAxisLabelEnabled,
|
|
595
|
-
formatter: yAxisLabelFormat,
|
|
596
|
-
style: {
|
|
597
|
-
color: grey[600]
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
|
-
tickInterval: yAxisTickInterval,
|
|
601
|
-
gridLineColor: '#f8f8f8',
|
|
602
|
-
plotLines: yPlotLines
|
|
603
|
-
},
|
|
604
|
-
plotOptions: {
|
|
605
|
-
series: {
|
|
606
|
-
opacity: opacity,
|
|
607
|
-
stacking: stackingType(stacking),
|
|
608
|
-
showInLegend: showLegend,
|
|
609
|
-
dataLabels: {
|
|
610
|
-
enabled: showDataLabel
|
|
611
|
-
},
|
|
612
|
-
colorByPoint: pie,
|
|
613
|
-
lineWidth: 2,
|
|
614
|
-
marker: {
|
|
615
|
-
enabled: false,
|
|
616
|
-
symbol: 'circle'
|
|
617
|
-
},
|
|
618
|
-
cursor: 'pointer',
|
|
619
|
-
point: {
|
|
620
|
-
events: {}
|
|
621
|
-
},
|
|
622
|
-
events: {
|
|
623
|
-
legendItemClick: handleLegendItemClick
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
pie: {
|
|
627
|
-
allowPointSelect: true,
|
|
628
|
-
innerSize: `${innerSize}%`
|
|
629
|
-
}
|
|
630
|
-
},
|
|
631
|
-
legend: {
|
|
632
|
-
align: legendAlign,
|
|
633
|
-
verticalAlign: 'top',
|
|
634
|
-
enabled: showLegend
|
|
635
|
-
},
|
|
636
|
-
tooltip: {
|
|
637
|
-
followPointer: false,
|
|
638
|
-
shared: true,
|
|
639
|
-
shadow: false,
|
|
640
|
-
useHTML: true,
|
|
641
|
-
formatter: function () {
|
|
642
|
-
return tooltipFormatter(this, tooltip);
|
|
643
|
-
},
|
|
644
|
-
outside: outside,
|
|
645
|
-
style: {
|
|
646
|
-
zIndex: 2000
|
|
647
|
-
}
|
|
648
|
-
},
|
|
649
|
-
series: series,
|
|
650
|
-
time: {
|
|
651
|
-
useUTC: false,
|
|
652
|
-
getTimezoneOffset: function () {
|
|
653
|
-
return new Date().getTimezoneOffset();
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
credits: {
|
|
657
|
-
enabled: false
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
const tooltipFormatter = (_this, props) => {
|
|
662
|
-
const {
|
|
663
|
-
headerVisible = true,
|
|
664
|
-
dateFormat,
|
|
665
|
-
headerTime,
|
|
666
|
-
legendColors = []
|
|
667
|
-
} = props;
|
|
668
|
-
let tooltip = '<div style="font-size: 14px;padding: 12px; min-width: 200px;">';
|
|
669
|
-
if (headerVisible) {
|
|
670
|
-
const xDate = new Date(_this.x);
|
|
671
|
-
const date = formatDate(xDate, dateFormat);
|
|
672
|
-
tooltip += `<div style="display: flex; justify-content: space-between; font-weight: bold; font-size: 12px;">
|
|
673
|
-
<span style="font-size: 12px; color: #333;">${date}</span>`;
|
|
674
|
-
if (headerTime) {
|
|
675
|
-
const time = formatDate(xDate, '%H:%M');
|
|
676
|
-
tooltip += `<span style="font-size: 12px; color: #333;">${time}</span>`;
|
|
677
|
-
}
|
|
678
|
-
tooltip += '</div>';
|
|
679
|
-
}
|
|
680
|
-
_this.points.forEach(point => {
|
|
681
|
-
const type = point.series.options.custom.type;
|
|
682
|
-
const value = type !== 'TO_PERCENT' ? format(point.y, type) : formatToPercent(_this.percentage / 100);
|
|
683
|
-
const name = point.series.name;
|
|
684
|
-
let color = type !== 'TO_PERCENT' ? point.series.color : point.color;
|
|
685
|
-
if (legendColors.length !== 0) {
|
|
686
|
-
color = legendColors[point.series.index];
|
|
687
|
-
}
|
|
688
|
-
tooltip += `<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
689
|
-
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 15px;">
|
|
690
|
-
<span style="width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; background-color: ${color}"></span>
|
|
691
|
-
<span style="flex-grow: 1; font-size: 14px; padding-right: 20px;">${name}</span>
|
|
692
|
-
<span style="font-weight: bold; font-size: 14px;">${value}</span>
|
|
693
|
-
</div>
|
|
694
|
-
</div>`;
|
|
695
|
-
});
|
|
696
|
-
tooltip += '</div>';
|
|
697
|
-
return tooltip;
|
|
698
|
-
};
|
|
699
|
-
function formatDate(data, format) {
|
|
700
|
-
return Highcharts$1.dateFormat(format, data.getTime() - data.getTimezoneOffset() * 60000);
|
|
701
|
-
}
|
|
702
|
-
const ZIndex = {
|
|
703
|
-
AVERAGE_LINE_BASE: 10,
|
|
704
|
-
COMPARE_CHART_BASE: 5,
|
|
705
|
-
NOW_BORDER: 2,
|
|
706
|
-
NOW_BAND: 1
|
|
707
|
-
};
|
|
708
|
-
function stackingType(stacking) {
|
|
709
|
-
return stacking ? stacking.toLowerCase() : '';
|
|
710
|
-
}
|
|
711
|
-
function pieCenters(count) {
|
|
712
|
-
switch (count) {
|
|
713
|
-
case 2:
|
|
714
|
-
return [['25%', '50%'], ['75%', '50%']];
|
|
715
|
-
case 3:
|
|
716
|
-
return [['25%', '25%'], ['75%', '25%'], ['50%', '75%']];
|
|
717
|
-
case 4:
|
|
718
|
-
return [['25%', '25%'], ['75%', '25%'], ['25%', '75%'], ['75%', '75%']];
|
|
719
|
-
default:
|
|
720
|
-
return [];
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
function pieSize(count) {
|
|
724
|
-
switch (count) {
|
|
725
|
-
case 3:
|
|
726
|
-
return '50%';
|
|
727
|
-
case 4:
|
|
728
|
-
return '25%';
|
|
729
|
-
default:
|
|
730
|
-
return null;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
function TrendChart({
|
|
735
|
-
colorIndex = 0,
|
|
736
|
-
legendColors,
|
|
737
|
-
isDaily,
|
|
738
|
-
isRealtime,
|
|
739
|
-
...props
|
|
740
|
-
}) {
|
|
741
|
-
const colors = useMemo(() => {
|
|
742
|
-
return all$1[colorIndex % all$1.length];
|
|
743
|
-
}, [colorIndex]);
|
|
744
|
-
const tooltip = useMemo(() => ({
|
|
745
|
-
dateFormat: isRealtime ? '%H:%M' : '%Y-%m-%d',
|
|
746
|
-
headerTime: !isDaily && !isRealtime,
|
|
747
|
-
outside: props.tooltipOutSide,
|
|
748
|
-
legendColors
|
|
749
|
-
}), [isRealtime, isDaily, props.tooltipOutSide, legendColors]);
|
|
750
|
-
return /*#__PURE__*/React.createElement(Chart, _extends({
|
|
751
|
-
type: "areaspline",
|
|
752
|
-
categorize: true,
|
|
753
|
-
xAxisType: "datetime",
|
|
754
|
-
xAxisLabelFormat: isDaily ? '%m-%d' : '%H:%M',
|
|
755
|
-
colors: colors,
|
|
756
|
-
tooltip: tooltip
|
|
757
|
-
}, props));
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
function StackedAreaTrendChart({
|
|
761
|
-
metrics,
|
|
762
|
-
records,
|
|
763
|
-
isDaily = false,
|
|
764
|
-
xPlotIndex,
|
|
765
|
-
xAxisTickInterval,
|
|
766
|
-
yAxisLabelEnabled = false,
|
|
767
|
-
legendLimit = 3,
|
|
768
|
-
colors = defaultColors,
|
|
769
|
-
...props
|
|
770
|
-
}) {
|
|
771
|
-
const _metrics = useMemo(() => {
|
|
772
|
-
return metrics.map(m => ({
|
|
773
|
-
metric: m.id,
|
|
774
|
-
chartType: 'area'
|
|
775
|
-
}));
|
|
776
|
-
}, [metrics]);
|
|
777
|
-
const metas = useMemo(() => {
|
|
778
|
-
const result = {
|
|
779
|
-
time: {
|
|
780
|
-
name: "일시",
|
|
781
|
-
type: "DATE"
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
|
-
metrics.forEach(m => {
|
|
785
|
-
result[m.id] = {
|
|
786
|
-
name: m.name,
|
|
787
|
-
type: "NUMBER"
|
|
788
|
-
};
|
|
789
|
-
});
|
|
790
|
-
return result;
|
|
791
|
-
}, [metrics]);
|
|
792
|
-
return /*#__PURE__*/React.createElement(TrendChart, _extends({
|
|
793
|
-
dimension: "time",
|
|
794
|
-
stacking: "normal",
|
|
795
|
-
metrics: _metrics,
|
|
796
|
-
metas: metas,
|
|
797
|
-
records: records,
|
|
798
|
-
isRealtime: xPlotIndex !== undefined,
|
|
799
|
-
isDaily: isDaily,
|
|
800
|
-
xPlotIndex: xPlotIndex,
|
|
801
|
-
xAxisTickInterval: xAxisTickInterval,
|
|
802
|
-
yAxisLabelEnabled: yAxisLabelEnabled,
|
|
803
|
-
legendLimit: legendLimit,
|
|
804
|
-
colors: colors
|
|
805
|
-
}, props));
|
|
806
|
-
}
|
|
807
|
-
const defaultColors = [["rgba(54,115,237,0.8)", "#3673ed"], ["rgba(149,77,241,0.8)", "#954df1"], ["#4dc391", "#20b476"], ["#fbba3d", "#faa90c"], ["#f2426d", "#ef1348"]];
|
|
808
|
-
|
|
809
|
-
function ok$1() {}
|
|
810
|
-
|
|
811
|
-
function unreachable() {}
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
* @typedef Options
|
|
815
|
-
* Configuration for `stringify`.
|
|
816
|
-
* @property {boolean} [padLeft=true]
|
|
817
|
-
* Whether to pad a space before a token.
|
|
818
|
-
* @property {boolean} [padRight=false]
|
|
819
|
-
* Whether to pad a space after a token.
|
|
820
|
-
*/
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Serialize an array of strings or numbers to comma-separated tokens.
|
|
825
|
-
*
|
|
826
|
-
* @param {Array<string|number>} values
|
|
827
|
-
* List of tokens.
|
|
828
|
-
* @param {Options} [options]
|
|
829
|
-
* Configuration for `stringify` (optional).
|
|
830
|
-
* @returns {string}
|
|
831
|
-
* Comma-separated tokens.
|
|
832
|
-
*/
|
|
833
|
-
function stringify$1(values, options) {
|
|
834
|
-
const settings = {};
|
|
835
|
-
|
|
836
|
-
// Ensure the last empty entry is seen.
|
|
837
|
-
const input = values[values.length - 1] === '' ? [...values, ''] : values;
|
|
838
|
-
|
|
839
|
-
return input
|
|
840
|
-
.join(
|
|
841
|
-
(settings.padRight ? ' ' : '') +
|
|
842
|
-
',' +
|
|
843
|
-
(settings.padLeft === false ? '' : ' ')
|
|
844
|
-
)
|
|
845
|
-
.trim()
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* @typedef Options
|
|
850
|
-
* Configuration.
|
|
851
|
-
* @property {boolean | null | undefined} [jsx=false]
|
|
852
|
-
* Support JSX identifiers (default: `false`).
|
|
853
|
-
*/
|
|
854
|
-
|
|
855
|
-
const nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
856
|
-
const nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
857
|
-
|
|
858
|
-
/** @type {Options} */
|
|
859
|
-
const emptyOptions$2 = {};
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* Checks if the given value is a valid identifier name.
|
|
863
|
-
*
|
|
864
|
-
* @param {string} name
|
|
865
|
-
* Identifier to check.
|
|
866
|
-
* @param {Options | null | undefined} [options]
|
|
867
|
-
* Configuration (optional).
|
|
868
|
-
* @returns {boolean}
|
|
869
|
-
* Whether `name` can be an identifier.
|
|
870
|
-
*/
|
|
871
|
-
function name(name, options) {
|
|
872
|
-
const settings = emptyOptions$2;
|
|
873
|
-
const re = settings.jsx ? nameReJsx : nameRe;
|
|
874
|
-
return re.test(name)
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* @typedef {import('hast').Nodes} Nodes
|
|
879
|
-
*/
|
|
880
|
-
|
|
881
|
-
// HTML whitespace expression.
|
|
882
|
-
// See <https://infra.spec.whatwg.org/#ascii-whitespace>.
|
|
883
|
-
const re = /[ \t\n\f\r]/g;
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
* Check if the given value is *inter-element whitespace*.
|
|
887
|
-
*
|
|
888
|
-
* @param {Nodes | string} thing
|
|
889
|
-
* Thing to check (`Node` or `string`).
|
|
890
|
-
* @returns {boolean}
|
|
891
|
-
* Whether the `value` is inter-element whitespace (`boolean`): consisting of
|
|
892
|
-
* zero or more of space, tab (`\t`), line feed (`\n`), carriage return
|
|
893
|
-
* (`\r`), or form feed (`\f`); if a node is passed it must be a `Text` node,
|
|
894
|
-
* whose `value` field is checked.
|
|
895
|
-
*/
|
|
896
|
-
function whitespace(thing) {
|
|
897
|
-
return typeof thing === 'object'
|
|
898
|
-
? thing.type === 'text'
|
|
899
|
-
? empty$1(thing.value)
|
|
900
|
-
: false
|
|
901
|
-
: empty$1(thing)
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
/**
|
|
905
|
-
* @param {string} value
|
|
906
|
-
* @returns {boolean}
|
|
907
|
-
*/
|
|
908
|
-
function empty$1(value) {
|
|
909
|
-
return value.replace(re, '') === ''
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
/**
|
|
913
|
-
* @import {Schema as SchemaType, Space} from 'property-information'
|
|
914
|
-
*/
|
|
915
|
-
|
|
916
|
-
/** @type {SchemaType} */
|
|
917
|
-
class Schema {
|
|
918
|
-
/**
|
|
919
|
-
* @param {SchemaType['property']} property
|
|
920
|
-
* Property.
|
|
921
|
-
* @param {SchemaType['normal']} normal
|
|
922
|
-
* Normal.
|
|
923
|
-
* @param {Space | undefined} [space]
|
|
924
|
-
* Space.
|
|
925
|
-
* @returns
|
|
926
|
-
* Schema.
|
|
927
|
-
*/
|
|
928
|
-
constructor(property, normal, space) {
|
|
929
|
-
this.normal = normal;
|
|
930
|
-
this.property = property;
|
|
931
|
-
|
|
932
|
-
if (space) {
|
|
933
|
-
this.space = space;
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
Schema.prototype.normal = {};
|
|
939
|
-
Schema.prototype.property = {};
|
|
940
|
-
Schema.prototype.space = undefined;
|
|
941
|
-
|
|
942
|
-
/**
|
|
943
|
-
* @import {Info, Space} from 'property-information'
|
|
944
|
-
*/
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
/**
|
|
948
|
-
* @param {ReadonlyArray<Schema>} definitions
|
|
949
|
-
* Definitions.
|
|
950
|
-
* @param {Space | undefined} [space]
|
|
951
|
-
* Space.
|
|
952
|
-
* @returns {Schema}
|
|
953
|
-
* Schema.
|
|
954
|
-
*/
|
|
955
|
-
function merge(definitions, space) {
|
|
956
|
-
/** @type {Record<string, Info>} */
|
|
957
|
-
const property = {};
|
|
958
|
-
/** @type {Record<string, string>} */
|
|
959
|
-
const normal = {};
|
|
960
|
-
|
|
961
|
-
for (const definition of definitions) {
|
|
962
|
-
Object.assign(property, definition.property);
|
|
963
|
-
Object.assign(normal, definition.normal);
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
return new Schema(property, normal, space)
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* Get the cleaned case insensitive form of an attribute or property.
|
|
971
|
-
*
|
|
972
|
-
* @param {string} value
|
|
973
|
-
* An attribute-like or property-like name.
|
|
974
|
-
* @returns {string}
|
|
975
|
-
* Value that can be used to look up the properly cased property on a
|
|
976
|
-
* `Schema`.
|
|
977
|
-
*/
|
|
978
|
-
function normalize$1(value) {
|
|
979
|
-
return value.toLowerCase()
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* @import {Info as InfoType} from 'property-information'
|
|
984
|
-
*/
|
|
985
|
-
|
|
986
|
-
/** @type {InfoType} */
|
|
987
|
-
class Info {
|
|
988
|
-
/**
|
|
989
|
-
* @param {string} property
|
|
990
|
-
* Property.
|
|
991
|
-
* @param {string} attribute
|
|
992
|
-
* Attribute.
|
|
993
|
-
* @returns
|
|
994
|
-
* Info.
|
|
995
|
-
*/
|
|
996
|
-
constructor(property, attribute) {
|
|
997
|
-
this.attribute = attribute;
|
|
998
|
-
this.property = property;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @import {Info as InfoType} from 'property-information'
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
/** @type {InfoType} */
|
|
202
|
+
class Info {
|
|
203
|
+
/**
|
|
204
|
+
* @param {string} property
|
|
205
|
+
* Property.
|
|
206
|
+
* @param {string} attribute
|
|
207
|
+
* Attribute.
|
|
208
|
+
* @returns
|
|
209
|
+
* Info.
|
|
210
|
+
*/
|
|
211
|
+
constructor(property, attribute) {
|
|
212
|
+
this.attribute = attribute;
|
|
213
|
+
this.property = property;
|
|
999
214
|
}
|
|
1000
215
|
}
|
|
1001
216
|
|
|
@@ -1027,14 +242,14 @@ function increment() {
|
|
|
1027
242
|
}
|
|
1028
243
|
|
|
1029
244
|
var types = /*#__PURE__*/Object.freeze({
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
245
|
+
__proto__: null,
|
|
246
|
+
boolean: boolean,
|
|
247
|
+
booleanish: booleanish,
|
|
248
|
+
commaOrSpaceSeparated: commaOrSpaceSeparated,
|
|
249
|
+
commaSeparated: commaSeparated,
|
|
250
|
+
number: number,
|
|
251
|
+
overloadedBoolean: overloadedBoolean,
|
|
252
|
+
spaceSeparated: spaceSeparated
|
|
1038
253
|
});
|
|
1039
254
|
|
|
1040
255
|
/**
|
|
@@ -2274,6 +1489,10 @@ function stringify(values) {
|
|
|
2274
1489
|
return values.join(' ').trim()
|
|
2275
1490
|
}
|
|
2276
1491
|
|
|
1492
|
+
function getDefaultExportFromCjs (x) {
|
|
1493
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
2277
1496
|
var cjs$2 = {};
|
|
2278
1497
|
|
|
2279
1498
|
var cjs$1;
|
|
@@ -4038,12 +3257,12 @@ function one(value, includeImageAlt, includeHtml) {
|
|
|
4038
3257
|
}
|
|
4039
3258
|
|
|
4040
3259
|
if ('children' in value) {
|
|
4041
|
-
return all(value.children, includeImageAlt, includeHtml)
|
|
3260
|
+
return all$1(value.children, includeImageAlt, includeHtml)
|
|
4042
3261
|
}
|
|
4043
3262
|
}
|
|
4044
3263
|
|
|
4045
3264
|
if (Array.isArray(value)) {
|
|
4046
|
-
return all(value, includeImageAlt, includeHtml)
|
|
3265
|
+
return all$1(value, includeImageAlt, includeHtml)
|
|
4047
3266
|
}
|
|
4048
3267
|
|
|
4049
3268
|
return ''
|
|
@@ -4061,7 +3280,7 @@ function one(value, includeImageAlt, includeHtml) {
|
|
|
4061
3280
|
* @returns {string}
|
|
4062
3281
|
* Serialized nodes.
|
|
4063
3282
|
*/
|
|
4064
|
-
function all(values, includeImageAlt, includeHtml) {
|
|
3283
|
+
function all$1(values, includeImageAlt, includeHtml) {
|
|
4065
3284
|
/** @type {Array<string>} */
|
|
4066
3285
|
const result = [];
|
|
4067
3286
|
let index = -1;
|
|
@@ -14013,16 +13232,16 @@ const disable = {
|
|
|
14013
13232
|
};
|
|
14014
13233
|
|
|
14015
13234
|
var defaultConstructs = /*#__PURE__*/Object.freeze({
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
13235
|
+
__proto__: null,
|
|
13236
|
+
attentionMarkers: attentionMarkers,
|
|
13237
|
+
contentInitial: contentInitial,
|
|
13238
|
+
disable: disable,
|
|
13239
|
+
document: document$1,
|
|
13240
|
+
flow: flow,
|
|
13241
|
+
flowInitial: flowInitial,
|
|
13242
|
+
insideSpan: insideSpan,
|
|
13243
|
+
string: string,
|
|
13244
|
+
text: text$1
|
|
14026
13245
|
});
|
|
14027
13246
|
|
|
14028
13247
|
/**
|
|
@@ -20725,985 +19944,1623 @@ class Processor extends CallableInstance {
|
|
|
20725
19944
|
assertNode(tree);
|
|
20726
19945
|
this.freeze();
|
|
20727
19946
|
|
|
20728
|
-
const transformers = this.transformers;
|
|
19947
|
+
const transformers = this.transformers;
|
|
19948
|
+
|
|
19949
|
+
if (!done && typeof file === 'function') {
|
|
19950
|
+
done = file;
|
|
19951
|
+
file = undefined;
|
|
19952
|
+
}
|
|
19953
|
+
|
|
19954
|
+
return done ? executor(undefined, done) : new Promise(executor)
|
|
19955
|
+
|
|
19956
|
+
// Note: `void`s needed for TS.
|
|
19957
|
+
/**
|
|
19958
|
+
* @param {(
|
|
19959
|
+
* ((tree: TailTree extends undefined ? Node : TailTree) => undefined | void) |
|
|
19960
|
+
* undefined
|
|
19961
|
+
* )} resolve
|
|
19962
|
+
* @param {(error: Error) => undefined | void} reject
|
|
19963
|
+
* @returns {undefined}
|
|
19964
|
+
*/
|
|
19965
|
+
function executor(resolve, reject) {
|
|
19966
|
+
const realFile = vfile(file);
|
|
19967
|
+
transformers.run(tree, realFile, realDone);
|
|
19968
|
+
|
|
19969
|
+
/**
|
|
19970
|
+
* @param {Error | undefined} error
|
|
19971
|
+
* @param {Node} outputTree
|
|
19972
|
+
* @param {VFile} file
|
|
19973
|
+
* @returns {undefined}
|
|
19974
|
+
*/
|
|
19975
|
+
function realDone(error, outputTree, file) {
|
|
19976
|
+
const resultingTree =
|
|
19977
|
+
/** @type {TailTree extends undefined ? Node : TailTree} */ (
|
|
19978
|
+
outputTree || tree
|
|
19979
|
+
);
|
|
19980
|
+
|
|
19981
|
+
if (error) {
|
|
19982
|
+
reject(error);
|
|
19983
|
+
} else if (resolve) {
|
|
19984
|
+
resolve(resultingTree);
|
|
19985
|
+
} else {
|
|
19986
|
+
done(undefined, resultingTree, file);
|
|
19987
|
+
}
|
|
19988
|
+
}
|
|
19989
|
+
}
|
|
19990
|
+
}
|
|
19991
|
+
|
|
19992
|
+
/**
|
|
19993
|
+
* Run *transformers* on a syntax tree.
|
|
19994
|
+
*
|
|
19995
|
+
* An error is thrown if asynchronous transforms are configured.
|
|
19996
|
+
*
|
|
19997
|
+
* > **Note**: `runSync` freezes the processor if not already *frozen*.
|
|
19998
|
+
*
|
|
19999
|
+
* > **Note**: `runSync` performs the run phase, not other phases.
|
|
20000
|
+
*
|
|
20001
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
20002
|
+
* Tree to transform and inspect.
|
|
20003
|
+
* @param {Compatible | undefined} [file]
|
|
20004
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
20005
|
+
* `new VFile(x)`.
|
|
20006
|
+
* @returns {TailTree extends undefined ? Node : TailTree}
|
|
20007
|
+
* Transformed tree.
|
|
20008
|
+
*/
|
|
20009
|
+
runSync(tree, file) {
|
|
20010
|
+
/** @type {boolean} */
|
|
20011
|
+
let complete = false;
|
|
20012
|
+
/** @type {(TailTree extends undefined ? Node : TailTree) | undefined} */
|
|
20013
|
+
let result;
|
|
20014
|
+
|
|
20015
|
+
this.run(tree, file, realDone);
|
|
20016
|
+
|
|
20017
|
+
assertDone('runSync', 'run', complete);
|
|
20018
|
+
return result
|
|
20019
|
+
|
|
20020
|
+
/**
|
|
20021
|
+
* @type {RunCallback<TailTree extends undefined ? Node : TailTree>}
|
|
20022
|
+
*/
|
|
20023
|
+
function realDone(error, tree) {
|
|
20024
|
+
bail(error);
|
|
20025
|
+
result = tree;
|
|
20026
|
+
complete = true;
|
|
20027
|
+
}
|
|
20028
|
+
}
|
|
20029
|
+
|
|
20030
|
+
/**
|
|
20031
|
+
* Compile a syntax tree.
|
|
20032
|
+
*
|
|
20033
|
+
* > **Note**: `stringify` freezes the processor if not already *frozen*.
|
|
20034
|
+
*
|
|
20035
|
+
* > **Note**: `stringify` performs the stringify phase, not the run phase
|
|
20036
|
+
* > or other phases.
|
|
20037
|
+
*
|
|
20038
|
+
* @param {CompileTree extends undefined ? Node : CompileTree} tree
|
|
20039
|
+
* Tree to compile.
|
|
20040
|
+
* @param {Compatible | undefined} [file]
|
|
20041
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
20042
|
+
* `new VFile(x)`.
|
|
20043
|
+
* @returns {CompileResult extends undefined ? Value : CompileResult}
|
|
20044
|
+
* Textual representation of the tree (see note).
|
|
20045
|
+
*
|
|
20046
|
+
* > **Note**: unified typically compiles by serializing: most compilers
|
|
20047
|
+
* > return `string` (or `Uint8Array`).
|
|
20048
|
+
* > Some compilers, such as the one configured with
|
|
20049
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
20050
|
+
* > React tree).
|
|
20051
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
20052
|
+
* > result values.
|
|
20053
|
+
* >
|
|
20054
|
+
* > To register custom results in TypeScript, add them to
|
|
20055
|
+
* > {@linkcode CompileResultMap}.
|
|
20056
|
+
*
|
|
20057
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
20058
|
+
*/
|
|
20059
|
+
stringify(tree, file) {
|
|
20060
|
+
this.freeze();
|
|
20061
|
+
const realFile = vfile(file);
|
|
20062
|
+
const compiler = this.compiler || this.Compiler;
|
|
20063
|
+
assertCompiler('stringify', compiler);
|
|
20064
|
+
assertNode(tree);
|
|
20065
|
+
|
|
20066
|
+
return compiler(tree, realFile)
|
|
20067
|
+
}
|
|
20068
|
+
|
|
20069
|
+
/**
|
|
20070
|
+
* Configure the processor to use a plugin, a list of usable values, or a
|
|
20071
|
+
* preset.
|
|
20072
|
+
*
|
|
20073
|
+
* If the processor is already using a plugin, the previous plugin
|
|
20074
|
+
* configuration is changed based on the options that are passed in.
|
|
20075
|
+
* In other words, the plugin is not added a second time.
|
|
20076
|
+
*
|
|
20077
|
+
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
20078
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
20079
|
+
*
|
|
20080
|
+
* @example
|
|
20081
|
+
* There are many ways to pass plugins to `.use()`.
|
|
20082
|
+
* This example gives an overview:
|
|
20083
|
+
*
|
|
20084
|
+
* ```js
|
|
20085
|
+
* import {unified} from 'unified'
|
|
20086
|
+
*
|
|
20087
|
+
* unified()
|
|
20088
|
+
* // Plugin with options:
|
|
20089
|
+
* .use(pluginA, {x: true, y: true})
|
|
20090
|
+
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
20091
|
+
* .use(pluginA, {y: false, z: true})
|
|
20092
|
+
* // Plugins:
|
|
20093
|
+
* .use([pluginB, pluginC])
|
|
20094
|
+
* // Two plugins, the second with options:
|
|
20095
|
+
* .use([pluginD, [pluginE, {}]])
|
|
20096
|
+
* // Preset with plugins and settings:
|
|
20097
|
+
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
20098
|
+
* // Settings only:
|
|
20099
|
+
* .use({settings: {position: false}})
|
|
20100
|
+
* ```
|
|
20101
|
+
*
|
|
20102
|
+
* @template {Array<unknown>} [Parameters=[]]
|
|
20103
|
+
* @template {Node | string | undefined} [Input=undefined]
|
|
20104
|
+
* @template [Output=Input]
|
|
20105
|
+
*
|
|
20106
|
+
* @overload
|
|
20107
|
+
* @param {Preset | null | undefined} [preset]
|
|
20108
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20109
|
+
*
|
|
20110
|
+
* @overload
|
|
20111
|
+
* @param {PluggableList} list
|
|
20112
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20113
|
+
*
|
|
20114
|
+
* @overload
|
|
20115
|
+
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
20116
|
+
* @param {...(Parameters | [boolean])} parameters
|
|
20117
|
+
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
20118
|
+
*
|
|
20119
|
+
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
20120
|
+
* Usable value.
|
|
20121
|
+
* @param {...unknown} parameters
|
|
20122
|
+
* Parameters, when a plugin is given as a usable value.
|
|
20123
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20124
|
+
* Current processor.
|
|
20125
|
+
*/
|
|
20126
|
+
use(value, ...parameters) {
|
|
20127
|
+
const attachers = this.attachers;
|
|
20128
|
+
const namespace = this.namespace;
|
|
20129
|
+
|
|
20130
|
+
assertUnfrozen('use', this.frozen);
|
|
20131
|
+
|
|
20132
|
+
if (value === null || value === undefined) ; else if (typeof value === 'function') {
|
|
20133
|
+
addPlugin(value, parameters);
|
|
20134
|
+
} else if (typeof value === 'object') {
|
|
20135
|
+
if (Array.isArray(value)) {
|
|
20136
|
+
addList(value);
|
|
20137
|
+
} else {
|
|
20138
|
+
addPreset(value);
|
|
20139
|
+
}
|
|
20140
|
+
} else {
|
|
20141
|
+
throw new TypeError('Expected usable value, not `' + value + '`')
|
|
20142
|
+
}
|
|
20143
|
+
|
|
20144
|
+
return this
|
|
20145
|
+
|
|
20146
|
+
/**
|
|
20147
|
+
* @param {Pluggable} value
|
|
20148
|
+
* @returns {undefined}
|
|
20149
|
+
*/
|
|
20150
|
+
function add(value) {
|
|
20151
|
+
if (typeof value === 'function') {
|
|
20152
|
+
addPlugin(value, []);
|
|
20153
|
+
} else if (typeof value === 'object') {
|
|
20154
|
+
if (Array.isArray(value)) {
|
|
20155
|
+
const [plugin, ...parameters] =
|
|
20156
|
+
/** @type {PluginTuple<Array<unknown>>} */ (value);
|
|
20157
|
+
addPlugin(plugin, parameters);
|
|
20158
|
+
} else {
|
|
20159
|
+
addPreset(value);
|
|
20160
|
+
}
|
|
20161
|
+
} else {
|
|
20162
|
+
throw new TypeError('Expected usable value, not `' + value + '`')
|
|
20163
|
+
}
|
|
20164
|
+
}
|
|
20165
|
+
|
|
20166
|
+
/**
|
|
20167
|
+
* @param {Preset} result
|
|
20168
|
+
* @returns {undefined}
|
|
20169
|
+
*/
|
|
20170
|
+
function addPreset(result) {
|
|
20171
|
+
if (!('plugins' in result) && !('settings' in result)) {
|
|
20172
|
+
throw new Error(
|
|
20173
|
+
'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'
|
|
20174
|
+
)
|
|
20175
|
+
}
|
|
20176
|
+
|
|
20177
|
+
addList(result.plugins);
|
|
20178
|
+
|
|
20179
|
+
if (result.settings) {
|
|
20180
|
+
namespace.settings = extend(true, namespace.settings, result.settings);
|
|
20181
|
+
}
|
|
20182
|
+
}
|
|
20183
|
+
|
|
20184
|
+
/**
|
|
20185
|
+
* @param {PluggableList | null | undefined} plugins
|
|
20186
|
+
* @returns {undefined}
|
|
20187
|
+
*/
|
|
20188
|
+
function addList(plugins) {
|
|
20189
|
+
let index = -1;
|
|
20729
20190
|
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20191
|
+
if (plugins === null || plugins === undefined) ; else if (Array.isArray(plugins)) {
|
|
20192
|
+
while (++index < plugins.length) {
|
|
20193
|
+
const thing = plugins[index];
|
|
20194
|
+
add(thing);
|
|
20195
|
+
}
|
|
20196
|
+
} else {
|
|
20197
|
+
throw new TypeError('Expected a list of plugins, not `' + plugins + '`')
|
|
20198
|
+
}
|
|
20733
20199
|
}
|
|
20734
20200
|
|
|
20735
|
-
return done ? executor(undefined, done) : new Promise(executor)
|
|
20736
|
-
|
|
20737
|
-
// Note: `void`s needed for TS.
|
|
20738
20201
|
/**
|
|
20739
|
-
* @param {
|
|
20740
|
-
*
|
|
20741
|
-
* undefined
|
|
20742
|
-
* )} resolve
|
|
20743
|
-
* @param {(error: Error) => undefined | void} reject
|
|
20202
|
+
* @param {Plugin} plugin
|
|
20203
|
+
* @param {Array<unknown>} parameters
|
|
20744
20204
|
* @returns {undefined}
|
|
20745
20205
|
*/
|
|
20746
|
-
function
|
|
20747
|
-
|
|
20748
|
-
|
|
20206
|
+
function addPlugin(plugin, parameters) {
|
|
20207
|
+
let index = -1;
|
|
20208
|
+
let entryIndex = -1;
|
|
20749
20209
|
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
function realDone(error, outputTree, file) {
|
|
20757
|
-
const resultingTree =
|
|
20758
|
-
/** @type {TailTree extends undefined ? Node : TailTree} */ (
|
|
20759
|
-
outputTree || tree
|
|
20760
|
-
);
|
|
20210
|
+
while (++index < attachers.length) {
|
|
20211
|
+
if (attachers[index][0] === plugin) {
|
|
20212
|
+
entryIndex = index;
|
|
20213
|
+
break
|
|
20214
|
+
}
|
|
20215
|
+
}
|
|
20761
20216
|
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20217
|
+
if (entryIndex === -1) {
|
|
20218
|
+
attachers.push([plugin, ...parameters]);
|
|
20219
|
+
}
|
|
20220
|
+
// Only set if there was at least a `primary` value, otherwise we’d change
|
|
20221
|
+
// `arguments.length`.
|
|
20222
|
+
else if (parameters.length > 0) {
|
|
20223
|
+
let [primary, ...rest] = parameters;
|
|
20224
|
+
const currentPrimary = attachers[entryIndex][1];
|
|
20225
|
+
if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
|
|
20226
|
+
primary = extend(true, currentPrimary, primary);
|
|
20768
20227
|
}
|
|
20228
|
+
|
|
20229
|
+
attachers[entryIndex] = [plugin, primary, ...rest];
|
|
20769
20230
|
}
|
|
20770
20231
|
}
|
|
20771
20232
|
}
|
|
20233
|
+
}
|
|
20772
20234
|
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
|
|
20776
|
-
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20235
|
+
// Note: this returns a *callable* instance.
|
|
20236
|
+
// That’s why it’s documented as a function.
|
|
20237
|
+
/**
|
|
20238
|
+
* Create a new processor.
|
|
20239
|
+
*
|
|
20240
|
+
* @example
|
|
20241
|
+
* This example shows how a new processor can be created (from `remark`) and linked
|
|
20242
|
+
* to **stdin**(4) and **stdout**(4).
|
|
20243
|
+
*
|
|
20244
|
+
* ```js
|
|
20245
|
+
* import process from 'node:process'
|
|
20246
|
+
* import concatStream from 'concat-stream'
|
|
20247
|
+
* import {remark} from 'remark'
|
|
20248
|
+
*
|
|
20249
|
+
* process.stdin.pipe(
|
|
20250
|
+
* concatStream(function (buf) {
|
|
20251
|
+
* process.stdout.write(String(remark().processSync(buf)))
|
|
20252
|
+
* })
|
|
20253
|
+
* )
|
|
20254
|
+
* ```
|
|
20255
|
+
*
|
|
20256
|
+
* @returns
|
|
20257
|
+
* New *unfrozen* processor (`processor`).
|
|
20258
|
+
*
|
|
20259
|
+
* This processor is configured to work the same as its ancestor.
|
|
20260
|
+
* When the descendant processor is configured in the future it does not
|
|
20261
|
+
* affect the ancestral processor.
|
|
20262
|
+
*/
|
|
20263
|
+
const unified = new Processor().freeze();
|
|
20264
|
+
|
|
20265
|
+
/**
|
|
20266
|
+
* Assert a parser is available.
|
|
20267
|
+
*
|
|
20268
|
+
* @param {string} name
|
|
20269
|
+
* @param {unknown} value
|
|
20270
|
+
* @returns {asserts value is Parser}
|
|
20271
|
+
*/
|
|
20272
|
+
function assertParser(name, value) {
|
|
20273
|
+
if (typeof value !== 'function') {
|
|
20274
|
+
throw new TypeError('Cannot `' + name + '` without `parser`')
|
|
20275
|
+
}
|
|
20276
|
+
}
|
|
20277
|
+
|
|
20278
|
+
/**
|
|
20279
|
+
* Assert a compiler is available.
|
|
20280
|
+
*
|
|
20281
|
+
* @param {string} name
|
|
20282
|
+
* @param {unknown} value
|
|
20283
|
+
* @returns {asserts value is Compiler}
|
|
20284
|
+
*/
|
|
20285
|
+
function assertCompiler(name, value) {
|
|
20286
|
+
if (typeof value !== 'function') {
|
|
20287
|
+
throw new TypeError('Cannot `' + name + '` without `compiler`')
|
|
20288
|
+
}
|
|
20289
|
+
}
|
|
20290
|
+
|
|
20291
|
+
/**
|
|
20292
|
+
* Assert the processor is not frozen.
|
|
20293
|
+
*
|
|
20294
|
+
* @param {string} name
|
|
20295
|
+
* @param {unknown} frozen
|
|
20296
|
+
* @returns {asserts frozen is false}
|
|
20297
|
+
*/
|
|
20298
|
+
function assertUnfrozen(name, frozen) {
|
|
20299
|
+
if (frozen) {
|
|
20300
|
+
throw new Error(
|
|
20301
|
+
'Cannot call `' +
|
|
20302
|
+
name +
|
|
20303
|
+
'` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'
|
|
20304
|
+
)
|
|
20305
|
+
}
|
|
20306
|
+
}
|
|
20307
|
+
|
|
20308
|
+
/**
|
|
20309
|
+
* Assert `node` is a unist node.
|
|
20310
|
+
*
|
|
20311
|
+
* @param {unknown} node
|
|
20312
|
+
* @returns {asserts node is Node}
|
|
20313
|
+
*/
|
|
20314
|
+
function assertNode(node) {
|
|
20315
|
+
// `isPlainObj` unfortunately uses `any` instead of `unknown`.
|
|
20316
|
+
// type-coverage:ignore-next-line
|
|
20317
|
+
if (!isPlainObject(node) || typeof node.type !== 'string') {
|
|
20318
|
+
throw new TypeError('Expected node, got `' + node + '`')
|
|
20319
|
+
// Fine.
|
|
20320
|
+
}
|
|
20321
|
+
}
|
|
20322
|
+
|
|
20323
|
+
/**
|
|
20324
|
+
* Assert that `complete` is `true`.
|
|
20325
|
+
*
|
|
20326
|
+
* @param {string} name
|
|
20327
|
+
* @param {string} asyncName
|
|
20328
|
+
* @param {unknown} complete
|
|
20329
|
+
* @returns {asserts complete is true}
|
|
20330
|
+
*/
|
|
20331
|
+
function assertDone(name, asyncName, complete) {
|
|
20332
|
+
if (!complete) {
|
|
20333
|
+
throw new Error(
|
|
20334
|
+
'`' + name + '` finished async. Use `' + asyncName + '` instead'
|
|
20335
|
+
)
|
|
20336
|
+
}
|
|
20337
|
+
}
|
|
20338
|
+
|
|
20339
|
+
/**
|
|
20340
|
+
* @param {Compatible | undefined} [value]
|
|
20341
|
+
* @returns {VFile}
|
|
20342
|
+
*/
|
|
20343
|
+
function vfile(value) {
|
|
20344
|
+
return looksLikeAVFile(value) ? value : new VFile(value)
|
|
20345
|
+
}
|
|
20346
|
+
|
|
20347
|
+
/**
|
|
20348
|
+
* @param {Compatible | undefined} [value]
|
|
20349
|
+
* @returns {value is VFile}
|
|
20350
|
+
*/
|
|
20351
|
+
function looksLikeAVFile(value) {
|
|
20352
|
+
return Boolean(
|
|
20353
|
+
value &&
|
|
20354
|
+
typeof value === 'object' &&
|
|
20355
|
+
'message' in value &&
|
|
20356
|
+
'messages' in value
|
|
20357
|
+
)
|
|
20358
|
+
}
|
|
20359
|
+
|
|
20360
|
+
/**
|
|
20361
|
+
* @param {unknown} [value]
|
|
20362
|
+
* @returns {value is Value}
|
|
20363
|
+
*/
|
|
20364
|
+
function looksLikeAValue(value) {
|
|
20365
|
+
return typeof value === 'string' || isUint8Array(value)
|
|
20366
|
+
}
|
|
20367
|
+
|
|
20368
|
+
/**
|
|
20369
|
+
* Assert `value` is an `Uint8Array`.
|
|
20370
|
+
*
|
|
20371
|
+
* @param {unknown} value
|
|
20372
|
+
* thing.
|
|
20373
|
+
* @returns {value is Uint8Array}
|
|
20374
|
+
* Whether `value` is an `Uint8Array`.
|
|
20375
|
+
*/
|
|
20376
|
+
function isUint8Array(value) {
|
|
20377
|
+
return Boolean(
|
|
20378
|
+
value &&
|
|
20379
|
+
typeof value === 'object' &&
|
|
20380
|
+
'byteLength' in value &&
|
|
20381
|
+
'byteOffset' in value
|
|
20382
|
+
)
|
|
20383
|
+
}
|
|
20384
|
+
|
|
20385
|
+
/**
|
|
20386
|
+
* @import {Element, Nodes, Parents, Root} from 'hast'
|
|
20387
|
+
* @import {Root as MdastRoot} from 'mdast'
|
|
20388
|
+
* @import {ComponentType, JSX, ReactElement, ReactNode} from 'react'
|
|
20389
|
+
* @import {Options as RemarkRehypeOptions} from 'remark-rehype'
|
|
20390
|
+
* @import {BuildVisitor} from 'unist-util-visit'
|
|
20391
|
+
* @import {PluggableList, Processor} from 'unified'
|
|
20392
|
+
*/
|
|
20393
|
+
|
|
20394
|
+
|
|
20395
|
+
const changelog =
|
|
20396
|
+
'https://github.com/remarkjs/react-markdown/blob/main/changelog.md';
|
|
20795
20397
|
|
|
20796
|
-
|
|
20398
|
+
/** @type {PluggableList} */
|
|
20399
|
+
const emptyPlugins = [];
|
|
20400
|
+
/** @type {Readonly<RemarkRehypeOptions>} */
|
|
20401
|
+
const emptyRemarkRehypeOptions = {allowDangerousHtml: true};
|
|
20402
|
+
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
|
|
20797
20403
|
|
|
20798
|
-
|
|
20799
|
-
|
|
20404
|
+
// Mutable because we `delete` any time it’s used and a message is sent.
|
|
20405
|
+
/** @type {ReadonlyArray<Readonly<Deprecation>>} */
|
|
20406
|
+
const deprecations = [
|
|
20407
|
+
{from: 'astPlugins', id: 'remove-buggy-html-in-markdown-parser'},
|
|
20408
|
+
{from: 'allowDangerousHtml', id: 'remove-buggy-html-in-markdown-parser'},
|
|
20409
|
+
{
|
|
20410
|
+
from: 'allowNode',
|
|
20411
|
+
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
|
|
20412
|
+
to: 'allowElement'
|
|
20413
|
+
},
|
|
20414
|
+
{
|
|
20415
|
+
from: 'allowedTypes',
|
|
20416
|
+
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
|
|
20417
|
+
to: 'allowedElements'
|
|
20418
|
+
},
|
|
20419
|
+
{from: 'className', id: 'remove-classname'},
|
|
20420
|
+
{
|
|
20421
|
+
from: 'disallowedTypes',
|
|
20422
|
+
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
|
|
20423
|
+
to: 'disallowedElements'
|
|
20424
|
+
},
|
|
20425
|
+
{from: 'escapeHtml', id: 'remove-buggy-html-in-markdown-parser'},
|
|
20426
|
+
{from: 'includeElementIndex', id: '#remove-includeelementindex'},
|
|
20427
|
+
{
|
|
20428
|
+
from: 'includeNodeIndex',
|
|
20429
|
+
id: 'change-includenodeindex-to-includeelementindex'
|
|
20430
|
+
},
|
|
20431
|
+
{from: 'linkTarget', id: 'remove-linktarget'},
|
|
20432
|
+
{from: 'plugins', id: 'change-plugins-to-remarkplugins', to: 'remarkPlugins'},
|
|
20433
|
+
{from: 'rawSourcePos', id: '#remove-rawsourcepos'},
|
|
20434
|
+
{from: 'renderers', id: 'change-renderers-to-components', to: 'components'},
|
|
20435
|
+
{from: 'source', id: 'change-source-to-children', to: 'children'},
|
|
20436
|
+
{from: 'sourcePos', id: '#remove-sourcepos'},
|
|
20437
|
+
{from: 'transformImageUri', id: '#add-urltransform', to: 'urlTransform'},
|
|
20438
|
+
{from: 'transformLinkUri', id: '#add-urltransform', to: 'urlTransform'}
|
|
20439
|
+
];
|
|
20800
20440
|
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20441
|
+
/**
|
|
20442
|
+
* Component to render markdown.
|
|
20443
|
+
*
|
|
20444
|
+
* This is a synchronous component.
|
|
20445
|
+
* When using async plugins,
|
|
20446
|
+
* see {@linkcode MarkdownAsync} or {@linkcode MarkdownHooks}.
|
|
20447
|
+
*
|
|
20448
|
+
* @param {Readonly<Options>} options
|
|
20449
|
+
* Props.
|
|
20450
|
+
* @returns {ReactElement}
|
|
20451
|
+
* React element.
|
|
20452
|
+
*/
|
|
20453
|
+
function Markdown(options) {
|
|
20454
|
+
const processor = createProcessor(options);
|
|
20455
|
+
const file = createFile(options);
|
|
20456
|
+
return post(processor.runSync(processor.parse(file), file), options)
|
|
20457
|
+
}
|
|
20810
20458
|
|
|
20811
|
-
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
* Textual representation of the tree (see note).
|
|
20826
|
-
*
|
|
20827
|
-
* > **Note**: unified typically compiles by serializing: most compilers
|
|
20828
|
-
* > return `string` (or `Uint8Array`).
|
|
20829
|
-
* > Some compilers, such as the one configured with
|
|
20830
|
-
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
20831
|
-
* > React tree).
|
|
20832
|
-
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
20833
|
-
* > result values.
|
|
20834
|
-
* >
|
|
20835
|
-
* > To register custom results in TypeScript, add them to
|
|
20836
|
-
* > {@linkcode CompileResultMap}.
|
|
20837
|
-
*
|
|
20838
|
-
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
20839
|
-
*/
|
|
20840
|
-
stringify(tree, file) {
|
|
20841
|
-
this.freeze();
|
|
20842
|
-
const realFile = vfile(file);
|
|
20843
|
-
const compiler = this.compiler || this.Compiler;
|
|
20844
|
-
assertCompiler('stringify', compiler);
|
|
20845
|
-
assertNode(tree);
|
|
20459
|
+
/**
|
|
20460
|
+
* Set up the `unified` processor.
|
|
20461
|
+
*
|
|
20462
|
+
* @param {Readonly<Options>} options
|
|
20463
|
+
* Props.
|
|
20464
|
+
* @returns {Processor<MdastRoot, MdastRoot, Root, undefined, undefined>}
|
|
20465
|
+
* Result.
|
|
20466
|
+
*/
|
|
20467
|
+
function createProcessor(options) {
|
|
20468
|
+
const rehypePlugins = options.rehypePlugins || emptyPlugins;
|
|
20469
|
+
const remarkPlugins = options.remarkPlugins || emptyPlugins;
|
|
20470
|
+
const remarkRehypeOptions = options.remarkRehypeOptions
|
|
20471
|
+
? {...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions}
|
|
20472
|
+
: emptyRemarkRehypeOptions;
|
|
20846
20473
|
|
|
20847
|
-
|
|
20848
|
-
|
|
20474
|
+
const processor = unified()
|
|
20475
|
+
.use(remarkParse)
|
|
20476
|
+
.use(remarkPlugins)
|
|
20477
|
+
.use(remarkRehype, remarkRehypeOptions)
|
|
20478
|
+
.use(rehypePlugins);
|
|
20849
20479
|
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
* preset.
|
|
20853
|
-
*
|
|
20854
|
-
* If the processor is already using a plugin, the previous plugin
|
|
20855
|
-
* configuration is changed based on the options that are passed in.
|
|
20856
|
-
* In other words, the plugin is not added a second time.
|
|
20857
|
-
*
|
|
20858
|
-
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
20859
|
-
* > Call the processor first to create a new unfrozen processor.
|
|
20860
|
-
*
|
|
20861
|
-
* @example
|
|
20862
|
-
* There are many ways to pass plugins to `.use()`.
|
|
20863
|
-
* This example gives an overview:
|
|
20864
|
-
*
|
|
20865
|
-
* ```js
|
|
20866
|
-
* import {unified} from 'unified'
|
|
20867
|
-
*
|
|
20868
|
-
* unified()
|
|
20869
|
-
* // Plugin with options:
|
|
20870
|
-
* .use(pluginA, {x: true, y: true})
|
|
20871
|
-
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
20872
|
-
* .use(pluginA, {y: false, z: true})
|
|
20873
|
-
* // Plugins:
|
|
20874
|
-
* .use([pluginB, pluginC])
|
|
20875
|
-
* // Two plugins, the second with options:
|
|
20876
|
-
* .use([pluginD, [pluginE, {}]])
|
|
20877
|
-
* // Preset with plugins and settings:
|
|
20878
|
-
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
20879
|
-
* // Settings only:
|
|
20880
|
-
* .use({settings: {position: false}})
|
|
20881
|
-
* ```
|
|
20882
|
-
*
|
|
20883
|
-
* @template {Array<unknown>} [Parameters=[]]
|
|
20884
|
-
* @template {Node | string | undefined} [Input=undefined]
|
|
20885
|
-
* @template [Output=Input]
|
|
20886
|
-
*
|
|
20887
|
-
* @overload
|
|
20888
|
-
* @param {Preset | null | undefined} [preset]
|
|
20889
|
-
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20890
|
-
*
|
|
20891
|
-
* @overload
|
|
20892
|
-
* @param {PluggableList} list
|
|
20893
|
-
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20894
|
-
*
|
|
20895
|
-
* @overload
|
|
20896
|
-
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
20897
|
-
* @param {...(Parameters | [boolean])} parameters
|
|
20898
|
-
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
20899
|
-
*
|
|
20900
|
-
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
20901
|
-
* Usable value.
|
|
20902
|
-
* @param {...unknown} parameters
|
|
20903
|
-
* Parameters, when a plugin is given as a usable value.
|
|
20904
|
-
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
20905
|
-
* Current processor.
|
|
20906
|
-
*/
|
|
20907
|
-
use(value, ...parameters) {
|
|
20908
|
-
const attachers = this.attachers;
|
|
20909
|
-
const namespace = this.namespace;
|
|
20480
|
+
return processor
|
|
20481
|
+
}
|
|
20910
20482
|
|
|
20911
|
-
|
|
20483
|
+
/**
|
|
20484
|
+
* Set up the virtual file.
|
|
20485
|
+
*
|
|
20486
|
+
* @param {Readonly<Options>} options
|
|
20487
|
+
* Props.
|
|
20488
|
+
* @returns {VFile}
|
|
20489
|
+
* Result.
|
|
20490
|
+
*/
|
|
20491
|
+
function createFile(options) {
|
|
20492
|
+
const children = options.children || '';
|
|
20493
|
+
const file = new VFile();
|
|
20912
20494
|
|
|
20913
|
-
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
if (Array.isArray(value)) {
|
|
20917
|
-
addList(value);
|
|
20918
|
-
} else {
|
|
20919
|
-
addPreset(value);
|
|
20920
|
-
}
|
|
20921
|
-
} else {
|
|
20922
|
-
throw new TypeError('Expected usable value, not `' + value + '`')
|
|
20923
|
-
}
|
|
20495
|
+
if (typeof children === 'string') {
|
|
20496
|
+
file.value = children;
|
|
20497
|
+
}
|
|
20924
20498
|
|
|
20925
|
-
|
|
20499
|
+
return file
|
|
20500
|
+
}
|
|
20926
20501
|
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20502
|
+
/**
|
|
20503
|
+
* Process the result from unified some more.
|
|
20504
|
+
*
|
|
20505
|
+
* @param {Nodes} tree
|
|
20506
|
+
* Tree.
|
|
20507
|
+
* @param {Readonly<Options>} options
|
|
20508
|
+
* Props.
|
|
20509
|
+
* @returns {ReactElement}
|
|
20510
|
+
* React element.
|
|
20511
|
+
*/
|
|
20512
|
+
function post(tree, options) {
|
|
20513
|
+
const allowedElements = options.allowedElements;
|
|
20514
|
+
const allowElement = options.allowElement;
|
|
20515
|
+
const components = options.components;
|
|
20516
|
+
const disallowedElements = options.disallowedElements;
|
|
20517
|
+
const skipHtml = options.skipHtml;
|
|
20518
|
+
const unwrapDisallowed = options.unwrapDisallowed;
|
|
20519
|
+
const urlTransform = options.urlTransform || defaultUrlTransform;
|
|
20520
|
+
|
|
20521
|
+
for (const deprecation of deprecations) {
|
|
20522
|
+
if (Object.hasOwn(options, deprecation.from)) {
|
|
20523
|
+
unreachable(
|
|
20524
|
+
'Unexpected `' +
|
|
20525
|
+
deprecation.from +
|
|
20526
|
+
'` prop, ' +
|
|
20527
|
+
(deprecation.to
|
|
20528
|
+
? 'use `' + deprecation.to + '` instead'
|
|
20529
|
+
: 'remove it') +
|
|
20530
|
+
' (see <' +
|
|
20531
|
+
changelog +
|
|
20532
|
+
'#' +
|
|
20533
|
+
deprecation.id +
|
|
20534
|
+
'> for more info)'
|
|
20535
|
+
);
|
|
20945
20536
|
}
|
|
20537
|
+
}
|
|
20946
20538
|
|
|
20947
|
-
|
|
20948
|
-
* @param {Preset} result
|
|
20949
|
-
* @returns {undefined}
|
|
20950
|
-
*/
|
|
20951
|
-
function addPreset(result) {
|
|
20952
|
-
if (!('plugins' in result) && !('settings' in result)) {
|
|
20953
|
-
throw new Error(
|
|
20954
|
-
'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither'
|
|
20955
|
-
)
|
|
20956
|
-
}
|
|
20539
|
+
visit(tree, transform);
|
|
20957
20540
|
|
|
20958
|
-
|
|
20541
|
+
return toJsxRuntime(tree, {
|
|
20542
|
+
Fragment,
|
|
20543
|
+
components,
|
|
20544
|
+
ignoreInvalidStyle: true,
|
|
20545
|
+
jsx,
|
|
20546
|
+
jsxs,
|
|
20547
|
+
passKeys: true,
|
|
20548
|
+
passNode: true
|
|
20549
|
+
})
|
|
20959
20550
|
|
|
20960
|
-
|
|
20961
|
-
|
|
20551
|
+
/** @type {BuildVisitor<Root>} */
|
|
20552
|
+
function transform(node, index, parent) {
|
|
20553
|
+
if (node.type === 'raw' && parent && typeof index === 'number') {
|
|
20554
|
+
if (skipHtml) {
|
|
20555
|
+
parent.children.splice(index, 1);
|
|
20556
|
+
} else {
|
|
20557
|
+
parent.children[index] = {type: 'text', value: node.value};
|
|
20962
20558
|
}
|
|
20559
|
+
|
|
20560
|
+
return index
|
|
20963
20561
|
}
|
|
20964
20562
|
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
*/
|
|
20969
|
-
function addList(plugins) {
|
|
20970
|
-
let index = -1;
|
|
20563
|
+
if (node.type === 'element') {
|
|
20564
|
+
/** @type {string} */
|
|
20565
|
+
let key;
|
|
20971
20566
|
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20567
|
+
for (key in urlAttributes) {
|
|
20568
|
+
if (
|
|
20569
|
+
Object.hasOwn(urlAttributes, key) &&
|
|
20570
|
+
Object.hasOwn(node.properties, key)
|
|
20571
|
+
) {
|
|
20572
|
+
const value = node.properties[key];
|
|
20573
|
+
const test = urlAttributes[key];
|
|
20574
|
+
if (test === null || test.includes(node.tagName)) {
|
|
20575
|
+
node.properties[key] = urlTransform(String(value || ''), key, node);
|
|
20576
|
+
}
|
|
20976
20577
|
}
|
|
20977
|
-
} else {
|
|
20978
|
-
throw new TypeError('Expected a list of plugins, not `' + plugins + '`')
|
|
20979
20578
|
}
|
|
20980
20579
|
}
|
|
20981
20580
|
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
let index = -1;
|
|
20989
|
-
let entryIndex = -1;
|
|
20581
|
+
if (node.type === 'element') {
|
|
20582
|
+
let remove = allowedElements
|
|
20583
|
+
? !allowedElements.includes(node.tagName)
|
|
20584
|
+
: disallowedElements
|
|
20585
|
+
? disallowedElements.includes(node.tagName)
|
|
20586
|
+
: false;
|
|
20990
20587
|
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
entryIndex = index;
|
|
20994
|
-
break
|
|
20995
|
-
}
|
|
20588
|
+
if (!remove && allowElement && typeof index === 'number') {
|
|
20589
|
+
remove = !allowElement(node, index, parent);
|
|
20996
20590
|
}
|
|
20997
20591
|
|
|
20998
|
-
if (
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
else if (parameters.length > 0) {
|
|
21004
|
-
let [primary, ...rest] = parameters;
|
|
21005
|
-
const currentPrimary = attachers[entryIndex][1];
|
|
21006
|
-
if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
|
|
21007
|
-
primary = extend(true, currentPrimary, primary);
|
|
20592
|
+
if (remove && parent && typeof index === 'number') {
|
|
20593
|
+
if (unwrapDisallowed && node.children) {
|
|
20594
|
+
parent.children.splice(index, 1, ...node.children);
|
|
20595
|
+
} else {
|
|
20596
|
+
parent.children.splice(index, 1);
|
|
21008
20597
|
}
|
|
21009
20598
|
|
|
21010
|
-
|
|
20599
|
+
return index
|
|
21011
20600
|
}
|
|
21012
20601
|
}
|
|
21013
20602
|
}
|
|
21014
20603
|
}
|
|
21015
20604
|
|
|
21016
|
-
// Note: this returns a *callable* instance.
|
|
21017
|
-
// That’s why it’s documented as a function.
|
|
21018
20605
|
/**
|
|
21019
|
-
*
|
|
21020
|
-
*
|
|
21021
|
-
* @example
|
|
21022
|
-
* This example shows how a new processor can be created (from `remark`) and linked
|
|
21023
|
-
* to **stdin**(4) and **stdout**(4).
|
|
21024
|
-
*
|
|
21025
|
-
* ```js
|
|
21026
|
-
* import process from 'node:process'
|
|
21027
|
-
* import concatStream from 'concat-stream'
|
|
21028
|
-
* import {remark} from 'remark'
|
|
21029
|
-
*
|
|
21030
|
-
* process.stdin.pipe(
|
|
21031
|
-
* concatStream(function (buf) {
|
|
21032
|
-
* process.stdout.write(String(remark().processSync(buf)))
|
|
21033
|
-
* })
|
|
21034
|
-
* )
|
|
21035
|
-
* ```
|
|
21036
|
-
*
|
|
21037
|
-
* @returns
|
|
21038
|
-
* New *unfrozen* processor (`processor`).
|
|
20606
|
+
* Make a URL safe.
|
|
21039
20607
|
*
|
|
21040
|
-
*
|
|
21041
|
-
*
|
|
21042
|
-
*
|
|
20608
|
+
* @satisfies {UrlTransform}
|
|
20609
|
+
* @param {string} value
|
|
20610
|
+
* URL.
|
|
20611
|
+
* @returns {string}
|
|
20612
|
+
* Safe URL.
|
|
21043
20613
|
*/
|
|
21044
|
-
|
|
20614
|
+
function defaultUrlTransform(value) {
|
|
20615
|
+
// Same as:
|
|
20616
|
+
// <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>
|
|
20617
|
+
// But without the `encode` part.
|
|
20618
|
+
const colon = value.indexOf(':');
|
|
20619
|
+
const questionMark = value.indexOf('?');
|
|
20620
|
+
const numberSign = value.indexOf('#');
|
|
20621
|
+
const slash = value.indexOf('/');
|
|
21045
20622
|
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
20623
|
+
if (
|
|
20624
|
+
// If there is no protocol, it’s relative.
|
|
20625
|
+
colon === -1 ||
|
|
20626
|
+
// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
20627
|
+
(slash !== -1 && colon > slash) ||
|
|
20628
|
+
(questionMark !== -1 && colon > questionMark) ||
|
|
20629
|
+
(numberSign !== -1 && colon > numberSign) ||
|
|
20630
|
+
// It is a protocol, it should be allowed.
|
|
20631
|
+
safeProtocol.test(value.slice(0, colon))
|
|
20632
|
+
) {
|
|
20633
|
+
return value
|
|
21056
20634
|
}
|
|
20635
|
+
|
|
20636
|
+
return ''
|
|
21057
20637
|
}
|
|
21058
20638
|
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
20639
|
+
function styleInject(css, ref) {
|
|
20640
|
+
if ( ref === void 0 ) ref = {};
|
|
20641
|
+
var insertAt = ref.insertAt;
|
|
20642
|
+
|
|
20643
|
+
if (typeof document === 'undefined') { return; }
|
|
20644
|
+
|
|
20645
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
20646
|
+
var style = document.createElement('style');
|
|
20647
|
+
style.type = 'text/css';
|
|
20648
|
+
|
|
20649
|
+
if (insertAt === 'top') {
|
|
20650
|
+
if (head.firstChild) {
|
|
20651
|
+
head.insertBefore(style, head.firstChild);
|
|
20652
|
+
} else {
|
|
20653
|
+
head.appendChild(style);
|
|
20654
|
+
}
|
|
20655
|
+
} else {
|
|
20656
|
+
head.appendChild(style);
|
|
21069
20657
|
}
|
|
21070
|
-
}
|
|
21071
20658
|
|
|
21072
|
-
|
|
21073
|
-
|
|
21074
|
-
|
|
21075
|
-
|
|
21076
|
-
* @param {unknown} frozen
|
|
21077
|
-
* @returns {asserts frozen is false}
|
|
21078
|
-
*/
|
|
21079
|
-
function assertUnfrozen(name, frozen) {
|
|
21080
|
-
if (frozen) {
|
|
21081
|
-
throw new Error(
|
|
21082
|
-
'Cannot call `' +
|
|
21083
|
-
name +
|
|
21084
|
-
'` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.'
|
|
21085
|
-
)
|
|
20659
|
+
if (style.styleSheet) {
|
|
20660
|
+
style.styleSheet.cssText = css;
|
|
20661
|
+
} else {
|
|
20662
|
+
style.appendChild(document.createTextNode(css));
|
|
21086
20663
|
}
|
|
21087
20664
|
}
|
|
21088
20665
|
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
|
|
20666
|
+
var css_248z = ".markdown-content{word-wrap:break-word;line-height:1.6;white-space:normal}.markdown-content p{margin:0 0 .75rem}.markdown-content p:last-child{margin-bottom:0}.markdown-content h1,.markdown-content h2,.markdown-content h3,.markdown-content h4,.markdown-content h5,.markdown-content h6{font-weight:600;line-height:1.3;margin:1rem 0 .5rem}.markdown-content h1:first-child,.markdown-content h2:first-child,.markdown-content h3:first-child{margin-top:0}.markdown-content h1{font-size:1.5em}.markdown-content h2{font-size:1.3em}.markdown-content h3{font-size:1.15em}.markdown-content h4{font-size:1.05em}.markdown-content ol,.markdown-content ul{margin:.5rem 0;padding-left:1.5rem}.markdown-content li{margin:.25rem 0}.markdown-content code{background:rgba(0,0,0,.05);border-radius:.25rem;font-family:Courier New,monospace;font-size:.9em;padding:.15rem .3rem}.message.user .markdown-content code{background:hsla(0,0%,100%,.2)}.markdown-content pre{background:rgba(0,0,0,.05);border-radius:.375rem;margin:.5rem 0;overflow-x:auto;padding:.75rem}.markdown-content pre code{background:transparent;padding:0}.message.user .markdown-content pre{background:hsla(0,0%,100%,.15)}.markdown-content strong{font-weight:700}.markdown-content em{font-style:italic}.markdown-content a{color:#667eea;text-decoration:underline}.message.user .markdown-content a{color:hsla(0,0%,100%,.95)}.markdown-content blockquote{border-left:3px solid #667eea;color:#666;margin:.75rem 0;padding-left:1rem}.message.user .markdown-content blockquote{border-left-color:hsla(0,0%,100%,.5);color:hsla(0,0%,100%,.9)}.markdown-content hr{border:none;border-top:1px solid #e5e7eb;margin:1rem 0}.message.user .markdown-content hr{border-top-color:hsla(0,0%,100%,.3)}.markdown-content table{border-collapse:collapse;margin:.75rem 0;width:100%}.markdown-content td,.markdown-content th{border:1px solid #e5e7eb;padding:.5rem;text-align:left}.markdown-content th{background:rgba(0,0,0,.05);font-weight:600}.message.user .markdown-content td,.message.user .markdown-content th{border-color:hsla(0,0%,100%,.3)}.message.user .markdown-content th{background:hsla(0,0%,100%,.15)}";
|
|
20667
|
+
styleInject(css_248z);
|
|
20668
|
+
|
|
20669
|
+
function MarkdownContent({
|
|
20670
|
+
content
|
|
20671
|
+
}) {
|
|
20672
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20673
|
+
className: "markdown-content"
|
|
20674
|
+
}, /*#__PURE__*/React.createElement(Markdown, null, content));
|
|
20675
|
+
}
|
|
20676
|
+
|
|
20677
|
+
const ToolContext = /*#__PURE__*/createContext();
|
|
20678
|
+
function ToolContextProvider({
|
|
20679
|
+
message,
|
|
20680
|
+
children
|
|
20681
|
+
}) {
|
|
20682
|
+
const kinds = useMemo(() => message.kinds ?? [], [message]);
|
|
20683
|
+
const tools = useMemo(() => message.content.filter(c => c.type === 'tool'), [message]);
|
|
20684
|
+
const configMap = useMemo(() => makeTaskConfigs(tools), [tools]);
|
|
20685
|
+
return /*#__PURE__*/React.createElement(ToolContext.Provider, {
|
|
20686
|
+
value: {
|
|
20687
|
+
kinds: kinds,
|
|
20688
|
+
tools,
|
|
20689
|
+
configMap
|
|
20690
|
+
}
|
|
20691
|
+
}, children);
|
|
20692
|
+
}
|
|
20693
|
+
function useToolContext() {
|
|
20694
|
+
return useContext(ToolContext);
|
|
20695
|
+
}
|
|
20696
|
+
function makeTaskConfigs(tools) {
|
|
20697
|
+
const map = new Map();
|
|
20698
|
+
tools.filter(t => t.name === 'search-task-by-keyword').forEach(tool => {
|
|
20699
|
+
tool.result?.result?.forEach(item => {
|
|
20700
|
+
map.set(item.taskId, item.name);
|
|
20701
|
+
});
|
|
20702
|
+
});
|
|
20703
|
+
return map;
|
|
20704
|
+
}
|
|
20705
|
+
|
|
20706
|
+
var dayjs_min$1 = {exports: {}};
|
|
21103
20707
|
|
|
21104
|
-
|
|
21105
|
-
* Assert that `complete` is `true`.
|
|
21106
|
-
*
|
|
21107
|
-
* @param {string} name
|
|
21108
|
-
* @param {string} asyncName
|
|
21109
|
-
* @param {unknown} complete
|
|
21110
|
-
* @returns {asserts complete is true}
|
|
21111
|
-
*/
|
|
21112
|
-
function assertDone(name, asyncName, complete) {
|
|
21113
|
-
if (!complete) {
|
|
21114
|
-
throw new Error(
|
|
21115
|
-
'`' + name + '` finished async. Use `' + asyncName + '` instead'
|
|
21116
|
-
)
|
|
21117
|
-
}
|
|
21118
|
-
}
|
|
20708
|
+
var dayjs_min = dayjs_min$1.exports;
|
|
21119
20709
|
|
|
21120
|
-
|
|
21121
|
-
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
20710
|
+
var hasRequiredDayjs_min;
|
|
20711
|
+
|
|
20712
|
+
function requireDayjs_min () {
|
|
20713
|
+
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
20714
|
+
hasRequiredDayjs_min = 1;
|
|
20715
|
+
(function (module, exports$1) {
|
|
20716
|
+
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
20717
|
+
} (dayjs_min$1));
|
|
20718
|
+
return dayjs_min$1.exports;
|
|
21126
20719
|
}
|
|
21127
20720
|
|
|
21128
|
-
|
|
21129
|
-
|
|
21130
|
-
|
|
21131
|
-
|
|
21132
|
-
|
|
21133
|
-
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
|
|
21137
|
-
|
|
21138
|
-
|
|
20721
|
+
var dayjs_minExports = requireDayjs_min();
|
|
20722
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
20723
|
+
|
|
20724
|
+
var isoWeek$2 = {exports: {}};
|
|
20725
|
+
|
|
20726
|
+
var isoWeek$1 = isoWeek$2.exports;
|
|
20727
|
+
|
|
20728
|
+
var hasRequiredIsoWeek;
|
|
20729
|
+
|
|
20730
|
+
function requireIsoWeek () {
|
|
20731
|
+
if (hasRequiredIsoWeek) return isoWeek$2.exports;
|
|
20732
|
+
hasRequiredIsoWeek = 1;
|
|
20733
|
+
(function (module, exports$1) {
|
|
20734
|
+
!function(e,t){module.exports=t();}(isoWeek$1,(function(){var e="day";return function(t,i,s){var a=function(t){return t.add(4-t.isoWeekday(),e)},d=i.prototype;d.isoWeekYear=function(){return a(this).year()},d.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var i,d,n,o,r=a(this),u=(i=this.isoWeekYear(),d=this.$u,n=(d?s.utc:s)().year(i).startOf("year"),o=4-n.isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,e));return r.diff(u,"week")+1},d.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var n=d.startOf;d.startOf=function(e,t){var i=this.$utils(),s=!!i.u(t)||t;return "isoweek"===i.p(e)?s?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(e,t)};}}));
|
|
20735
|
+
} (isoWeek$2));
|
|
20736
|
+
return isoWeek$2.exports;
|
|
21139
20737
|
}
|
|
21140
20738
|
|
|
21141
|
-
|
|
21142
|
-
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21146
|
-
|
|
20739
|
+
var isoWeekExports = requireIsoWeek();
|
|
20740
|
+
var isoWeek = /*@__PURE__*/getDefaultExportFromCjs(isoWeekExports);
|
|
20741
|
+
|
|
20742
|
+
var relativeTime$2 = {exports: {}};
|
|
20743
|
+
|
|
20744
|
+
var relativeTime$1 = relativeTime$2.exports;
|
|
20745
|
+
|
|
20746
|
+
var hasRequiredRelativeTime;
|
|
20747
|
+
|
|
20748
|
+
function requireRelativeTime () {
|
|
20749
|
+
if (hasRequiredRelativeTime) return relativeTime$2.exports;
|
|
20750
|
+
hasRequiredRelativeTime = 1;
|
|
20751
|
+
(function (module, exports$1) {
|
|
20752
|
+
!function(r,e){module.exports=e();}(relativeTime$1,(function(){return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o)}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,true):i.diff(e,y.d,true));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break}}if(n)return a;var M=s?l.future:l.past;return "function"==typeof M?M(a):M.replace("%s",a)},n.to=function(r,e){return i(r,e,this,true)},n.from=function(r,e){return i(r,e,this)};var d=function(r){return r.$u?t.utc():t()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)};}}));
|
|
20753
|
+
} (relativeTime$2));
|
|
20754
|
+
return relativeTime$2.exports;
|
|
21147
20755
|
}
|
|
21148
20756
|
|
|
21149
|
-
|
|
21150
|
-
|
|
21151
|
-
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
|
|
21155
|
-
|
|
21156
|
-
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
|
|
21160
|
-
|
|
21161
|
-
|
|
21162
|
-
|
|
21163
|
-
|
|
20757
|
+
var relativeTimeExports = requireRelativeTime();
|
|
20758
|
+
var relativeTime = /*@__PURE__*/getDefaultExportFromCjs(relativeTimeExports);
|
|
20759
|
+
|
|
20760
|
+
var isSameOrBefore$2 = {exports: {}};
|
|
20761
|
+
|
|
20762
|
+
var isSameOrBefore$1 = isSameOrBefore$2.exports;
|
|
20763
|
+
|
|
20764
|
+
var hasRequiredIsSameOrBefore;
|
|
20765
|
+
|
|
20766
|
+
function requireIsSameOrBefore () {
|
|
20767
|
+
if (hasRequiredIsSameOrBefore) return isSameOrBefore$2.exports;
|
|
20768
|
+
hasRequiredIsSameOrBefore = 1;
|
|
20769
|
+
(function (module, exports$1) {
|
|
20770
|
+
!function(e,i){module.exports=i();}(isSameOrBefore$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
20771
|
+
} (isSameOrBefore$2));
|
|
20772
|
+
return isSameOrBefore$2.exports;
|
|
21164
20773
|
}
|
|
21165
20774
|
|
|
21166
|
-
|
|
21167
|
-
|
|
21168
|
-
* @import {Root as MdastRoot} from 'mdast'
|
|
21169
|
-
* @import {ComponentType, JSX, ReactElement, ReactNode} from 'react'
|
|
21170
|
-
* @import {Options as RemarkRehypeOptions} from 'remark-rehype'
|
|
21171
|
-
* @import {BuildVisitor} from 'unist-util-visit'
|
|
21172
|
-
* @import {PluggableList, Processor} from 'unified'
|
|
21173
|
-
*/
|
|
20775
|
+
var isSameOrBeforeExports = requireIsSameOrBefore();
|
|
20776
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
21174
20777
|
|
|
20778
|
+
var isSameOrAfter$2 = {exports: {}};
|
|
21175
20779
|
|
|
21176
|
-
|
|
21177
|
-
'https://github.com/remarkjs/react-markdown/blob/main/changelog.md';
|
|
20780
|
+
var isSameOrAfter$1 = isSameOrAfter$2.exports;
|
|
21178
20781
|
|
|
21179
|
-
|
|
21180
|
-
const emptyPlugins = [];
|
|
21181
|
-
/** @type {Readonly<RemarkRehypeOptions>} */
|
|
21182
|
-
const emptyRemarkRehypeOptions = {allowDangerousHtml: true};
|
|
21183
|
-
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
|
|
20782
|
+
var hasRequiredIsSameOrAfter;
|
|
21184
20783
|
|
|
21185
|
-
|
|
21186
|
-
|
|
21187
|
-
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
|
|
21195
|
-
|
|
21196
|
-
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
|
|
21202
|
-
|
|
21203
|
-
|
|
21204
|
-
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
21214
|
-
|
|
21215
|
-
|
|
21216
|
-
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
|
|
21220
|
-
|
|
20784
|
+
function requireIsSameOrAfter () {
|
|
20785
|
+
if (hasRequiredIsSameOrAfter) return isSameOrAfter$2.exports;
|
|
20786
|
+
hasRequiredIsSameOrAfter = 1;
|
|
20787
|
+
(function (module, exports$1) {
|
|
20788
|
+
!function(e,t){module.exports=t();}(isSameOrAfter$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
20789
|
+
} (isSameOrAfter$2));
|
|
20790
|
+
return isSameOrAfter$2.exports;
|
|
20791
|
+
}
|
|
20792
|
+
|
|
20793
|
+
var isSameOrAfterExports = requireIsSameOrAfter();
|
|
20794
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
20795
|
+
|
|
20796
|
+
dayjs.extend(relativeTime);
|
|
20797
|
+
dayjs.extend(isoWeek);
|
|
20798
|
+
dayjs.extend(isSameOrBefore);
|
|
20799
|
+
dayjs.extend(isSameOrAfter);
|
|
20800
|
+
dayjs.locale('ko');
|
|
20801
|
+
const isToday = (from, to) => {
|
|
20802
|
+
const now = new Date();
|
|
20803
|
+
const date = new Date(now.toLocaleString('en-US', {
|
|
20804
|
+
timeZone: 'Asia/Seoul'
|
|
20805
|
+
}));
|
|
20806
|
+
const today = date.getFullYear() + String(date.getMonth() + 1).padStart(2, '0') + String(date.getDate()).padStart(2, '0');
|
|
20807
|
+
return from === today && to === today;
|
|
20808
|
+
};
|
|
20809
|
+
const isOneDay = (from, to) => {
|
|
20810
|
+
return from === to;
|
|
20811
|
+
};
|
|
20812
|
+
const formatDateRange = (from, to) => {
|
|
20813
|
+
const fromDate = dayjs(from, 'YYYYMMDD');
|
|
20814
|
+
const toDate = dayjs(to, 'YYYYMMDD');
|
|
20815
|
+
const today = dayjs().startOf('day');
|
|
20816
|
+
if (from === to) return formatSingleDate(fromDate, today);
|
|
20817
|
+
return formatRange(fromDate, toDate, today);
|
|
20818
|
+
};
|
|
20819
|
+
const formatSingleDate = (date, today) => {
|
|
20820
|
+
const diffDays = today.diff(date, 'day');
|
|
20821
|
+
if (diffDays === 0) return '오늘';
|
|
20822
|
+
if (diffDays === 1) return '어제';
|
|
20823
|
+
if (diffDays === 2) return '그제';
|
|
20824
|
+
return date.format('YYYY년 M월 D일');
|
|
20825
|
+
};
|
|
20826
|
+
const formatRange = (fromDate, toDate, today) => {
|
|
20827
|
+
const thisWeekStart = today.startOf('week'); // 일요일
|
|
20828
|
+
const thisWeekEnd = today.endOf('week'); // 토요일
|
|
20829
|
+
|
|
20830
|
+
if (fromDate.isSame(thisWeekStart, 'day') && (toDate.isSame(today, 'day') || toDate.isSame(thisWeekEnd, 'day'))) {
|
|
20831
|
+
return '이번주';
|
|
20832
|
+
}
|
|
20833
|
+
const lastWeekStart = today.subtract(1, 'week').startOf('week');
|
|
20834
|
+
const lastWeekEnd = today.subtract(1, 'week').endOf('week');
|
|
20835
|
+
if (fromDate.isSame(lastWeekStart, 'day') && toDate.isSame(lastWeekEnd, 'day')) {
|
|
20836
|
+
return '지난주';
|
|
20837
|
+
}
|
|
20838
|
+
const twoWeeksAgoStart = today.subtract(2, 'week').startOf('week');
|
|
20839
|
+
const twoWeeksAgoEnd = today.subtract(2, 'week').endOf('week');
|
|
20840
|
+
if (fromDate.isSame(twoWeeksAgoStart, 'day') && toDate.isSame(twoWeeksAgoEnd, 'day')) {
|
|
20841
|
+
return '지지난주';
|
|
20842
|
+
}
|
|
20843
|
+
const thisMonthStart = today.startOf('month');
|
|
20844
|
+
const thisMonthEnd = today.endOf('month');
|
|
20845
|
+
if (fromDate.isSame(thisMonthStart, 'day') && (toDate.isSame(today, 'day') || toDate.isSame(thisMonthEnd, 'day'))) {
|
|
20846
|
+
return '이번달';
|
|
20847
|
+
}
|
|
20848
|
+
const lastMonthStart = today.subtract(1, 'month').startOf('month');
|
|
20849
|
+
const lastMonthEnd = today.subtract(1, 'month').endOf('month');
|
|
20850
|
+
if (fromDate.isSame(lastMonthStart, 'day') && toDate.isSame(lastMonthEnd, 'day')) {
|
|
20851
|
+
return '지난달';
|
|
20852
|
+
}
|
|
20853
|
+
const twoMonthsAgoStart = today.subtract(2, 'month').startOf('month');
|
|
20854
|
+
const twoMonthsAgoEnd = today.subtract(2, 'month').endOf('month');
|
|
20855
|
+
if (fromDate.isSame(twoMonthsAgoStart, 'day') && toDate.isSame(twoMonthsAgoEnd, 'day')) {
|
|
20856
|
+
return '지지난달';
|
|
20857
|
+
}
|
|
20858
|
+
const fromFormatted = formatDateInRange(fromDate, today);
|
|
20859
|
+
const toFormatted = formatDateInRange(toDate, today);
|
|
20860
|
+
return `${fromFormatted} ~ ${toFormatted}`;
|
|
20861
|
+
};
|
|
20862
|
+
const formatDateInRange = (date, today) => {
|
|
20863
|
+
const diffDays = today.diff(date, 'day');
|
|
20864
|
+
if (diffDays === 0) return '오늘';
|
|
20865
|
+
if (diffDays === 1) return '어제';
|
|
20866
|
+
if (diffDays === 2) return '그제';
|
|
20867
|
+
return date.format('YYYY년 M월 D일');
|
|
20868
|
+
};
|
|
20869
|
+
|
|
20870
|
+
var patternFill = {exports: {}};
|
|
21221
20871
|
|
|
21222
20872
|
/**
|
|
21223
|
-
*
|
|
20873
|
+
* Highcharts JS v11.3.0 (2024-01-10)
|
|
21224
20874
|
*
|
|
21225
|
-
*
|
|
21226
|
-
* When using async plugins,
|
|
21227
|
-
* see {@linkcode MarkdownAsync} or {@linkcode MarkdownHooks}.
|
|
20875
|
+
* Module for adding patterns and images as point fills.
|
|
21228
20876
|
*
|
|
21229
|
-
*
|
|
21230
|
-
*
|
|
21231
|
-
* @returns {ReactElement}
|
|
21232
|
-
* React element.
|
|
21233
|
-
*/
|
|
21234
|
-
function Markdown(options) {
|
|
21235
|
-
const processor = createProcessor(options);
|
|
21236
|
-
const file = createFile(options);
|
|
21237
|
-
return post(processor.runSync(processor.parse(file), file), options)
|
|
21238
|
-
}
|
|
21239
|
-
|
|
21240
|
-
/**
|
|
21241
|
-
* Set up the `unified` processor.
|
|
20877
|
+
* (c) 2010-2024 Highsoft AS
|
|
20878
|
+
* Author: Torstein Hønsi, Øystein Moseng
|
|
21242
20879
|
*
|
|
21243
|
-
*
|
|
21244
|
-
* Props.
|
|
21245
|
-
* @returns {Processor<MdastRoot, MdastRoot, Root, undefined, undefined>}
|
|
21246
|
-
* Result.
|
|
20880
|
+
* License: www.highcharts.com/license
|
|
21247
20881
|
*/
|
|
21248
|
-
function createProcessor(options) {
|
|
21249
|
-
const rehypePlugins = options.rehypePlugins || emptyPlugins;
|
|
21250
|
-
const remarkPlugins = options.remarkPlugins || emptyPlugins;
|
|
21251
|
-
const remarkRehypeOptions = options.remarkRehypeOptions
|
|
21252
|
-
? {...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions}
|
|
21253
|
-
: emptyRemarkRehypeOptions;
|
|
21254
20882
|
|
|
21255
|
-
|
|
21256
|
-
.use(remarkParse)
|
|
21257
|
-
.use(remarkPlugins)
|
|
21258
|
-
.use(remarkRehype, remarkRehypeOptions)
|
|
21259
|
-
.use(rehypePlugins);
|
|
20883
|
+
var hasRequiredPatternFill;
|
|
21260
20884
|
|
|
21261
|
-
|
|
20885
|
+
function requirePatternFill () {
|
|
20886
|
+
if (hasRequiredPatternFill) return patternFill.exports;
|
|
20887
|
+
hasRequiredPatternFill = 1;
|
|
20888
|
+
(function (module) {
|
|
20889
|
+
!function(t){module.exports?(t.default=t,module.exports=t):t("undefined"!=typeof Highcharts?Highcharts:void 0);}(function(t){var e=t?t._modules:{};function r(t,e,r,i){t.hasOwnProperty(e)||(t[e]=i.apply(null,r),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})));}r(e,"Extensions/PatternFill.js",[e["Core/Animation/AnimationUtilities.js"],e["Core/Defaults.js"],e["Core/Globals.js"],e["Core/Utilities.js"]],function(t,e,r,i){let{animObject:a}=t,{getOptions:o}=e,{composed:n}=r,{addEvent:s,defined:h,erase:l,extend:p,merge:c,pick:d,pushUnique:f,removeEvent:u,wrap:g}=i,m=function(){let t=[],e=o().colors,r=0;for(let i of ["M 0 0 L 5 5 M 4.5 -0.5 L 5.5 0.5 M -0.5 4.5 L 0.5 5.5","M 0 5 L 5 0 M -0.5 0.5 L 0.5 -0.5 M 4.5 5.5 L 5.5 4.5","M 2 0 L 2 5 M 4 0 L 4 5","M 0 2 L 5 2 M 0 4 L 5 4","M 0 1.5 L 2.5 1.5 L 2.5 0 M 2.5 5 L 2.5 3.5 L 5 3.5"])t.push({path:i,color:e[r++],width:5,height:5,patternTransform:"scale(1.4 1.4)"});for(let i of(r=5,["M 0 0 L 5 10 L 10 0","M 3 3 L 8 3 L 8 8 L 3 8 Z","M 5 5 m -4 0 a 4 4 0 1 1 8 0 a 4 4 0 1 1 -8 0","M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11","M 0 10 L 10 0 M -1 1 L 1 -1 M 9 11 L 11 9"]))t.push({path:i,color:e[r],width:10,height:10}),r+=5;return t}();function y(t,e){let r=JSON.stringify(t),i=r.length||0,a=0,o=0,n;if(e){n=Math.max(Math.floor(i/500),1);for(let t=0;t<i;t+=n)a+=r.charCodeAt(t);a&=a;}for(;o<i;++o)a=(a<<5)-a+r.charCodeAt(o),a&=a;return a.toString(16).replace("-","1")}function x(){if(this.renderer&&(this.renderer.defIds||[]).filter(t=>t&&t.indexOf&&0===t.indexOf("highcharts-pattern-")).length){for(let t of this.series)if(t.visible)for(let e of t.points){let t=e.options&&e.options.color;t&&t.pattern&&(t.pattern._width="defer",t.pattern._height="defer");}this.redraw(false);}}function w(){let t={},e=this.renderer,r=(e.defIds||[]).filter(t=>t.indexOf&&0===t.indexOf("highcharts-pattern-"));if(r.length)for(let i of([].forEach.call(this.renderTo.querySelectorAll('[color^="url("], [fill^="url("], [stroke^="url("]'),r=>{let i=r.getAttribute("fill")||r.getAttribute("color")||r.getAttribute("stroke");if(i){let r=i.replace(e.url,"").replace("url(#","").replace(")","");t[r]=true;}}),r))!t[i]&&(l(e.defIds,i),e.patternElements[i]&&(e.patternElements[i].destroy(),delete e.patternElements[i]));}function M(){let t=this.options.color;t&&t.pattern&&("string"==typeof t.pattern.path&&(t.pattern.path={d:t.pattern.path}),this.color=this.options.color=c(this.series.options.color,t));}function L(t){let e=t.args[0],r=t.args[1],i=t.args[2],a=this.chartIndex||0,o=e.pattern,n="#333333";if(void 0!==e.patternIndex&&m&&(o=m[e.patternIndex]),!o)return true;if(o.image||"string"==typeof o.path||o.path&&o.path.d){let t=i.parentNode&&i.parentNode.getAttribute("class");t=t&&t.indexOf("highcharts-legend")>-1,("defer"===o._width||"defer"===o._height)&&_.call({graphic:{element:i}},o),(t||!o.id)&&((o=c({},o)).id="highcharts-pattern-"+a+"-"+y(o)+y(o,true)),this.addPattern(o,!this.forExport&&d(o.animation,this.globalAnimation,{duration:100})),n=`url(${this.url}#${o.id+(this.forExport?"-export":"")})`;}else n=o.color||n;return i.setAttribute(r,n),e.toString=function(){return n},false}function b(){let t=this.chart.isResizing;if(this.isDirtyData||t||!this.chart.hasRendered)for(let e of this.points){let r=e.options&&e.options.color;r&&r.pattern&&(t&&!(e.shapeArgs&&e.shapeArgs.width&&e.shapeArgs.height)?(r.pattern._width="defer",r.pattern._height="defer"):e.calculatePatternDimensions(r.pattern));}}function _(t){if(t.width&&t.height)return;let e=this.graphic&&(this.graphic.getBBox&&this.graphic.getBBox(true)||this.graphic.element&&this.graphic.element.getBBox())||{},r=this.shapeArgs;if(r&&(e.width=r.width||e.width,e.height=r.height||e.height,e.x=r.x||e.x,e.y=r.y||e.y),t.image){if(!e.width||!e.height){t._width="defer",t._height="defer";let e=this.series.chart.mapView&&this.series.chart.mapView.getSVGTransform().scaleY;h(e)&&e<0&&(t._inverted=true);return}t.aspectRatio&&(e.aspectRatio=e.width/e.height,t.aspectRatio>e.aspectRatio?e.aspectWidth=e.height*t.aspectRatio:e.aspectHeight=e.width/t.aspectRatio),t._width=t.width||Math.ceil(e.aspectWidth||e.width),t._height=t.height||Math.ceil(e.aspectHeight||e.height);}t.width||(t._x=t.x||0,t._x+=e.x-Math.round(e.aspectWidth?Math.abs(e.aspectWidth-e.width)/2:0)),t.height||(t._y=t.y||0,t._y+=e.y-Math.round(e.aspectHeight?Math.abs(e.aspectHeight-e.height)/2:0));}function A(t,e){let r=d(e,true),o=a(r),n=t.color||"#333333",s=t.height||("number"==typeof t._height?t._height:0)||32,h=t.width||("number"==typeof t._width?t._width:0)||32,l,p=t.id,c;if(!p&&(this.idCounter=this.idCounter||0,p="highcharts-pattern-"+this.idCounter+"-"+(this.chartIndex||0),++this.idCounter),this.forExport&&(p+="-export"),this.defIds=this.defIds||[],this.defIds.indexOf(p)>-1)return;this.defIds.push(p);let f={id:p,patternUnits:"userSpaceOnUse",patternContentUnits:t.patternContentUnits||"userSpaceOnUse",width:h,height:s,x:t._x||t.x||0,y:t._y||t.y||0};t._inverted&&(f.patternTransform="scale(1, -1)",t.patternTransform&&(t.patternTransform+=" scale(1, -1)")),t.patternTransform&&(f.patternTransform=t.patternTransform);let g=this.createElement("pattern").attr(f).add(this.defs);if(g.id=p,t.path){if(c=i.isObject(t.path)?t.path:{d:t.path},t.backgroundColor){var m;m=t.backgroundColor,this.rect(0,0,h,s).attr({fill:m}).add(g);}l={d:c.d},this.styledMode||(l.stroke=c.stroke||n,l["stroke-width"]=d(c.strokeWidth,2),l.fill=c.fill||"none"),c.transform&&(l.transform=c.transform),this.createElement("path").attr(l).add(g),g.color=n;}else t.image&&(r?this.image(t.image,0,0,h,s,function(){this.animate({opacity:d(t.opacity,1)},o),u(this.element,"load");}).attr({opacity:0}).add(g):this.image(t.image,0,0,h,s).add(g));return t.image&&r||void 0===t.opacity||[].forEach.call(g.element.childNodes,e=>{e.setAttribute("opacity",t.opacity);}),this.patternElements=this.patternElements||{},this.patternElements[p]=g,g}function C(t){let e=this.options.color;e&&e.pattern&&!e.pattern.color?(delete this.options.color,t.apply(this,[].slice.call(arguments,1)),e.pattern.color=this.color,this.color=this.options.color=e):t.apply(this,[].slice.call(arguments,1));}function E(){if(!this.chart?.mapView)return;let t=this.chart,e=t.renderer,r=e.patternElements;e.defIds?.length&&r&&this.points.filter(function(t){return !!t.graphic&&(t.graphic.element.hasAttribute("fill")||t.graphic.element.hasAttribute("color")||t.graphic.element.hasAttribute("stroke"))&&!t.options.color?.pattern?.image&&!!t.group?.scaleX&&!!t.group?.scaleY}).map(function(t){let r=(t.graphic?.element.getAttribute("fill")||t.graphic?.element.getAttribute("color")||t.graphic?.element.getAttribute("stroke")||"").replace(e.url,"").replace("url(#","").replace(")","");return [r,{x:t.group?.scaleX||1,y:t.group?.scaleY||1}]}).filter(function([t,e],r,i){return ""!==t&&-1!==t.indexOf("highcharts-pattern-")&&!i.some(function([e,i],a){return e===t&&a<r})}).forEach(function([t,e]){r[t].scaleX=1/e.x,r[t].scaleY=1/e.y,r[t].updateTransform("patternTransform");});}return {compose:function t(e,r,i){let a=r.prototype.pointClass;f(n,t)&&(s(e,"endResize",x),s(e,"redraw",w),p(a.prototype,{calculatePatternDimensions:_}),s(a,"afterInit",M),s(r,"render",b),g(r.prototype,"getColor",C),s(r,"afterRender",E),s(r,"mapZoomComplete",E),p(i.prototype,{addPattern:A}),s(i,"complexColor",L));},patterns:m}}),r(e,"masters/modules/pattern-fill.src.js",[e["Core/Globals.js"],e["Extensions/PatternFill.js"]],function(t,e){t.patterns=e.patterns,e.compose(t.Chart,t.Series,t.SVGRenderer);});});
|
|
20890
|
+
} (patternFill));
|
|
20891
|
+
return patternFill.exports;
|
|
21262
20892
|
}
|
|
21263
20893
|
|
|
21264
|
-
|
|
21265
|
-
* Set up the virtual file.
|
|
21266
|
-
*
|
|
21267
|
-
* @param {Readonly<Options>} options
|
|
21268
|
-
* Props.
|
|
21269
|
-
* @returns {VFile}
|
|
21270
|
-
* Result.
|
|
21271
|
-
*/
|
|
21272
|
-
function createFile(options) {
|
|
21273
|
-
const children = options.children || '';
|
|
21274
|
-
const file = new VFile();
|
|
20894
|
+
requirePatternFill();
|
|
21275
20895
|
|
|
21276
|
-
|
|
21277
|
-
|
|
20896
|
+
const ColumnChart = ({
|
|
20897
|
+
data,
|
|
20898
|
+
width,
|
|
20899
|
+
height = 230
|
|
20900
|
+
}) => {
|
|
20901
|
+
const series = useMemo(() => {
|
|
20902
|
+
return data.series.map((item, sindex) => ({
|
|
20903
|
+
...item,
|
|
20904
|
+
data: item.data.map((value, index) => ({
|
|
20905
|
+
y: value,
|
|
20906
|
+
color: data.colors[index % data.colors.length] + alphas[sindex % alphas.length]
|
|
20907
|
+
}))
|
|
20908
|
+
}));
|
|
20909
|
+
}, [data]);
|
|
20910
|
+
const colors = useMemo(() => {
|
|
20911
|
+
return data.series.map((_, index) => data.colors[0] + alphas[index % alphas.length]);
|
|
20912
|
+
}, [data]);
|
|
20913
|
+
const options = useMemo(() => {
|
|
20914
|
+
return {
|
|
20915
|
+
chart: {
|
|
20916
|
+
type: 'column',
|
|
20917
|
+
backgroundColor: 'transparent',
|
|
20918
|
+
width: width,
|
|
20919
|
+
height: height,
|
|
20920
|
+
style: {
|
|
20921
|
+
fontFamily: fontFamily$1
|
|
20922
|
+
}
|
|
20923
|
+
},
|
|
20924
|
+
title: {
|
|
20925
|
+
text: undefined
|
|
20926
|
+
},
|
|
20927
|
+
tooltip: {
|
|
20928
|
+
pointFormat: '<span><b>{point.y}</b></span>',
|
|
20929
|
+
style: {
|
|
20930
|
+
fontFamily: fontFamily$1,
|
|
20931
|
+
fontSize: '13px',
|
|
20932
|
+
fontWeight: '100'
|
|
20933
|
+
},
|
|
20934
|
+
useHTML: true
|
|
20935
|
+
},
|
|
20936
|
+
plotOptions: {
|
|
20937
|
+
column: {
|
|
20938
|
+
//size: size
|
|
20939
|
+
}
|
|
20940
|
+
},
|
|
20941
|
+
xAxis: {
|
|
20942
|
+
categories: data.categories,
|
|
20943
|
+
crosshair: true,
|
|
20944
|
+
labels: {
|
|
20945
|
+
style: {
|
|
20946
|
+
color: '#777',
|
|
20947
|
+
fontFamily: fontFamily$1,
|
|
20948
|
+
fontWeight: '400'
|
|
20949
|
+
}
|
|
20950
|
+
},
|
|
20951
|
+
lineColor: '#aaa'
|
|
20952
|
+
},
|
|
20953
|
+
yAxis: {
|
|
20954
|
+
title: {
|
|
20955
|
+
text: undefined
|
|
20956
|
+
},
|
|
20957
|
+
labels: {
|
|
20958
|
+
style: {
|
|
20959
|
+
fontFamily: fontFamily$1,
|
|
20960
|
+
fontSize: '12px',
|
|
20961
|
+
fontWeight: '100'
|
|
20962
|
+
}
|
|
20963
|
+
},
|
|
20964
|
+
gridLineColor: '#f9f9f9'
|
|
20965
|
+
},
|
|
20966
|
+
legend: {
|
|
20967
|
+
layout: 'vertical',
|
|
20968
|
+
itemStyle: {
|
|
20969
|
+
fontFamily: fontFamily$1,
|
|
20970
|
+
fontSize: '12px',
|
|
20971
|
+
fontWeight: '100'
|
|
20972
|
+
},
|
|
20973
|
+
useHTML: true
|
|
20974
|
+
},
|
|
20975
|
+
series: series,
|
|
20976
|
+
colors: colors,
|
|
20977
|
+
credits: {
|
|
20978
|
+
enabled: false
|
|
20979
|
+
},
|
|
20980
|
+
accessibility: {
|
|
20981
|
+
enabled: false
|
|
20982
|
+
}
|
|
20983
|
+
};
|
|
20984
|
+
}, [data, width, height, series, colors]);
|
|
20985
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
20986
|
+
style: styles$7.chartWrapper
|
|
20987
|
+
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
20988
|
+
highcharts: Highcharts$1,
|
|
20989
|
+
options: options
|
|
20990
|
+
}));
|
|
20991
|
+
};
|
|
20992
|
+
const fontFamily$1 = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
20993
|
+
const styles$7 = {
|
|
20994
|
+
chartWrapper: {
|
|
20995
|
+
background: 'transparent',
|
|
20996
|
+
textAlign: 'center',
|
|
20997
|
+
display: 'flex',
|
|
20998
|
+
flexDirection: 'column',
|
|
20999
|
+
justifyContent: 'center',
|
|
21000
|
+
alignItems: 'center'
|
|
21278
21001
|
}
|
|
21002
|
+
};
|
|
21003
|
+
const alphas = ['ff', 'bb', '77', '33'];
|
|
21279
21004
|
|
|
21280
|
-
|
|
21005
|
+
const ColumnChartContent = ({
|
|
21006
|
+
tools = []
|
|
21007
|
+
}) => {
|
|
21008
|
+
const {
|
|
21009
|
+
configMap
|
|
21010
|
+
} = useToolContext();
|
|
21011
|
+
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, tools.length > 0 && /*#__PURE__*/React$1.createElement("div", {
|
|
21012
|
+
style: {
|
|
21013
|
+
display: 'flex',
|
|
21014
|
+
justifyContent: 'center',
|
|
21015
|
+
marginBottom: '30px'
|
|
21016
|
+
}
|
|
21017
|
+
}, /*#__PURE__*/React$1.createElement(ColumnChart, {
|
|
21018
|
+
data: toData$1(tools, configMap)
|
|
21019
|
+
})));
|
|
21020
|
+
};
|
|
21021
|
+
function toData$1(tools, configMap) {
|
|
21022
|
+
const items = [];
|
|
21023
|
+
const hasConvert = tools.some(content => content.result?.result[0]?.metric?.filter !== undefined);
|
|
21024
|
+
tools.sort((a, b) => a.arguments.from.localeCompare(b.arguments.from)).forEach(content => {
|
|
21025
|
+
const {
|
|
21026
|
+
taskId,
|
|
21027
|
+
from,
|
|
21028
|
+
to
|
|
21029
|
+
} = content.arguments;
|
|
21030
|
+
const item = {
|
|
21031
|
+
name: `<b>${configMap.get(taskId)}</b> <span style="font-size:10px">(${formatDateRange(from, to)})</span>`,
|
|
21032
|
+
data: []
|
|
21033
|
+
};
|
|
21034
|
+
const result = reduce(content.result.result);
|
|
21035
|
+
item.data.push(result.input);
|
|
21036
|
+
item.data.push(result.output);
|
|
21037
|
+
if (hasConvert) item.data.push(result.filter);
|
|
21038
|
+
item.data.push(result.error);
|
|
21039
|
+
items.push(item);
|
|
21040
|
+
});
|
|
21041
|
+
return {
|
|
21042
|
+
colors: hasConvert ? ['#333333', '#2652a8', '#b47813', '#aa1a32'] : ['#333333', '#2652a8', '#aa1a32'],
|
|
21043
|
+
categories: hasConvert ? ['입력', '처리', '필터', '에러'] : ['입력', '처리', '에러'],
|
|
21044
|
+
series: items
|
|
21045
|
+
};
|
|
21046
|
+
}
|
|
21047
|
+
function reduce(data) {
|
|
21048
|
+
return data.reduce((acc, item) => {
|
|
21049
|
+
acc.input += item.metric.input;
|
|
21050
|
+
acc.output += item.metric.output;
|
|
21051
|
+
acc.filter += item.metric.filter;
|
|
21052
|
+
acc.error += item.metric.error;
|
|
21053
|
+
return acc;
|
|
21054
|
+
}, {
|
|
21055
|
+
input: 0,
|
|
21056
|
+
output: 0,
|
|
21057
|
+
filter: 0,
|
|
21058
|
+
error: 0
|
|
21059
|
+
});
|
|
21281
21060
|
}
|
|
21282
21061
|
|
|
21283
|
-
|
|
21284
|
-
|
|
21285
|
-
|
|
21286
|
-
|
|
21287
|
-
|
|
21288
|
-
* @param {Readonly<Options>} options
|
|
21289
|
-
* Props.
|
|
21290
|
-
* @returns {ReactElement}
|
|
21291
|
-
* React element.
|
|
21292
|
-
*/
|
|
21293
|
-
function post(tree, options) {
|
|
21294
|
-
const allowedElements = options.allowedElements;
|
|
21295
|
-
const allowElement = options.allowElement;
|
|
21296
|
-
const components = options.components;
|
|
21297
|
-
const disallowedElements = options.disallowedElements;
|
|
21298
|
-
const skipHtml = options.skipHtml;
|
|
21299
|
-
const unwrapDisallowed = options.unwrapDisallowed;
|
|
21300
|
-
const urlTransform = options.urlTransform || defaultUrlTransform;
|
|
21301
|
-
|
|
21302
|
-
for (const deprecation of deprecations) {
|
|
21303
|
-
if (Object.hasOwn(options, deprecation.from)) {
|
|
21304
|
-
unreachable(
|
|
21305
|
-
'Unexpected `' +
|
|
21306
|
-
deprecation.from +
|
|
21307
|
-
'` prop, ' +
|
|
21308
|
-
(deprecation.to
|
|
21309
|
-
? 'use `' + deprecation.to + '` instead'
|
|
21310
|
-
: 'remove it') +
|
|
21311
|
-
' (see <' +
|
|
21312
|
-
changelog +
|
|
21313
|
-
'#' +
|
|
21314
|
-
deprecation.id +
|
|
21315
|
-
'> for more info)'
|
|
21316
|
-
);
|
|
21062
|
+
function _extends() {
|
|
21063
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
21064
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
21065
|
+
var t = arguments[e];
|
|
21066
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
21317
21067
|
}
|
|
21318
|
-
|
|
21068
|
+
return n;
|
|
21069
|
+
}, _extends.apply(null, arguments);
|
|
21070
|
+
}
|
|
21319
21071
|
|
|
21320
|
-
|
|
21072
|
+
function toValue(value) {
|
|
21073
|
+
return value && typeof value === 'object' ? value.value : value;
|
|
21074
|
+
}
|
|
21075
|
+
function toPercent(value) {
|
|
21076
|
+
return Math.round(value * 100 * 100) / 100;
|
|
21077
|
+
}
|
|
21078
|
+
function formatNumber(value) {
|
|
21079
|
+
return value !== undefined ? value.toLocaleString() : '-';
|
|
21080
|
+
}
|
|
21081
|
+
function formatToPercent(value) {
|
|
21082
|
+
return formatPercent(toPercent(value));
|
|
21083
|
+
}
|
|
21084
|
+
function formatPercent(value) {
|
|
21085
|
+
return value !== undefined ? `${value.toLocaleString()}%` : '-';
|
|
21086
|
+
}
|
|
21087
|
+
function formatDuration(value) {
|
|
21088
|
+
value = toValue(value);
|
|
21089
|
+
if (!value) return '-';
|
|
21090
|
+
let day = Math.floor(value / (60 * 60 * 24));
|
|
21091
|
+
let hour = Math.floor(value / (60 * 60)) - day * 24;
|
|
21092
|
+
let minute = Math.floor(value / 60) - (day * 24 + hour) * 60;
|
|
21093
|
+
let second = Math.round(value % 60);
|
|
21094
|
+
day = day > 0 ? `${day.toLocaleString()}일 ` : '';
|
|
21095
|
+
hour = hour > 0 ? `${hour >= 10 ? hour : '0' + hour}시간 ` : '';
|
|
21096
|
+
minute = `${minute >= 10 ? minute : '0' + minute}분 `;
|
|
21097
|
+
second = `${second >= 10 ? second : '0' + second}초`;
|
|
21098
|
+
return `${day}${hour}${minute}${second}`;
|
|
21099
|
+
}
|
|
21100
|
+
function formatBytes(value) {
|
|
21101
|
+
return value !== undefined ? `${value.toLocaleString()} bytes` : '-';
|
|
21102
|
+
}
|
|
21103
|
+
function format(value, type) {
|
|
21104
|
+
switch (type) {
|
|
21105
|
+
case 'TO_PERCENT':
|
|
21106
|
+
return formatToPercent(value);
|
|
21107
|
+
case 'DURATION':
|
|
21108
|
+
return formatDuration(value);
|
|
21109
|
+
case 'BYTES':
|
|
21110
|
+
return formatBytes(value);
|
|
21111
|
+
case 'PERCENT':
|
|
21112
|
+
return formatPercent(value);
|
|
21113
|
+
default:
|
|
21114
|
+
return formatNumber(value);
|
|
21115
|
+
}
|
|
21116
|
+
}
|
|
21321
21117
|
|
|
21322
|
-
|
|
21323
|
-
|
|
21324
|
-
|
|
21325
|
-
|
|
21326
|
-
|
|
21327
|
-
jsxs,
|
|
21328
|
-
passKeys: true,
|
|
21329
|
-
passNode: true
|
|
21330
|
-
})
|
|
21118
|
+
const all = [[blue[500]], [purple[500], '#4168a6', '#81a7e1'], [green[500], '#debb7f', '#ecdbbe'], [yellow[500], '#1b8286', '#4ab3b6'], [red[500]], [orange[500]], [lime[500]], ['#54AAF9'], ['#BB4ECD'], ['#6DDBBA'], ['#FFE81C'], ['#FA7EBA'], ['#F55713'], ['#51B304'], ['#1559B2'], ['#733FAB'], ['#1C7B5F'], ['#D87500'], ['#C91E48'], ['#2F862F']];
|
|
21119
|
+
[[blue[400], blue[500]], [purple[400], purple[500]], [green[400], green[500]], [yellow[400], yellow[500]], [red[400], red[500]], [orange[400], orange[500]], [lime[400], lime[500]]];
|
|
21120
|
+
[[alpha(blue[500], 0.2), 'transparent', blue[300]], [alpha(purple[500], 0.2), 'transparent', purple[500]], [alpha(green[500], 0.2), 'transparent', green[500]], [alpha(yellow[500], 0.2), 'transparent', yellow[500]], [alpha(red[500], 0.2), 'transparent', red[500]], [alpha(orange[500], 0.2), 'transparent', orange[500]], [alpha(lime[500], 0.2), 'transparent', lime[500]]];
|
|
21121
|
+
const preset = ['#003f5c', '#a05195', '#665191', '#2f4b7c', '#d45087', '#f95d6a', '#ff7c43', '#ffa600'];
|
|
21122
|
+
all.map(color => color[0]);
|
|
21331
21123
|
|
|
21332
|
-
|
|
21333
|
-
|
|
21334
|
-
|
|
21335
|
-
|
|
21336
|
-
|
|
21337
|
-
|
|
21338
|
-
|
|
21124
|
+
highchartsAccessibility(Highcharts$1);
|
|
21125
|
+
highchartsAnnotations(Highcharts$1);
|
|
21126
|
+
function Chart(props) {
|
|
21127
|
+
const [legendLimitEnabled, setLegendLimitEnabled] = useState(props.legendLimit > 0);
|
|
21128
|
+
const [options, setOptions] = useState(toOptions(props, legendLimitEnabled));
|
|
21129
|
+
useEffect(() => {
|
|
21130
|
+
if (props.delay) setTimeout(() => setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick)), props.delay);else setOptions(toOptions(props, legendLimitEnabled, handleLegendItemClick));
|
|
21131
|
+
// eslint-disable-next-line
|
|
21132
|
+
}, [props]);
|
|
21133
|
+
const handleLegendItemClick = useCallback(() => setLegendLimitEnabled(false), []);
|
|
21134
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, options && /*#__PURE__*/React.createElement(HighchartsReact, {
|
|
21135
|
+
highcharts: Highcharts$1,
|
|
21136
|
+
options: options
|
|
21137
|
+
}));
|
|
21138
|
+
}
|
|
21139
|
+
function toOptions(props, legendLimitEnabled, handleLegendItemClick) {
|
|
21140
|
+
const {
|
|
21141
|
+
title = '',
|
|
21142
|
+
type,
|
|
21143
|
+
categorize,
|
|
21144
|
+
stacking,
|
|
21145
|
+
showLegend = true,
|
|
21146
|
+
showDataLabel,
|
|
21147
|
+
xAxisType,
|
|
21148
|
+
xAxisLabel = true,
|
|
21149
|
+
xAxisLabelFormat,
|
|
21150
|
+
xAxisTickInterval,
|
|
21151
|
+
yAxisLabelEnabled = true,
|
|
21152
|
+
yAxisLabelFormat,
|
|
21153
|
+
yAxisTickInterval = null,
|
|
21154
|
+
yAxisPlotLines = [],
|
|
21155
|
+
opacity = 1,
|
|
21156
|
+
innerSize = 0,
|
|
21157
|
+
colors: customColors,
|
|
21158
|
+
backgroundColor = undefined,
|
|
21159
|
+
xPlotIndex,
|
|
21160
|
+
dimension,
|
|
21161
|
+
metrics,
|
|
21162
|
+
records = [],
|
|
21163
|
+
metas,
|
|
21164
|
+
height = 200,
|
|
21165
|
+
legendLimit,
|
|
21166
|
+
legendAlign = 'center',
|
|
21167
|
+
tooltip = {},
|
|
21168
|
+
secondaryXAxis = []
|
|
21169
|
+
} = props;
|
|
21170
|
+
const {
|
|
21171
|
+
outside
|
|
21172
|
+
} = tooltip;
|
|
21173
|
+
const pie = type === 'pie';
|
|
21174
|
+
const centers = pieCenters(metrics.length);
|
|
21175
|
+
const size = pieSize(metrics.length);
|
|
21176
|
+
const colors = customColors ? customColors : preset;
|
|
21177
|
+
const categories = records.map(record => record[dimension]);
|
|
21178
|
+
const mainXAxis = records.map(r => r.time);
|
|
21179
|
+
const chartColorHandlers = {
|
|
21180
|
+
line: (colors, index) => ({
|
|
21181
|
+
color: colors[index],
|
|
21182
|
+
mainColor: colors[index]
|
|
21183
|
+
}),
|
|
21184
|
+
area: (colors, index) => ({
|
|
21185
|
+
color: colors[index][0],
|
|
21186
|
+
mainColor: colors[index][1]
|
|
21187
|
+
}),
|
|
21188
|
+
gradient: (colors, index) => ({
|
|
21189
|
+
color: {
|
|
21190
|
+
linearGradient: {
|
|
21191
|
+
x1: 0,
|
|
21192
|
+
y1: 0,
|
|
21193
|
+
x2: 0,
|
|
21194
|
+
y2: 1
|
|
21195
|
+
},
|
|
21196
|
+
stops: [[0, `${colors[index][0]}`], [0.95, `${colors[index][1]}`]]
|
|
21197
|
+
},
|
|
21198
|
+
mainColor: colors[index][2]
|
|
21199
|
+
})
|
|
21200
|
+
};
|
|
21201
|
+
const series = metrics.map(({
|
|
21202
|
+
chartType,
|
|
21203
|
+
metric
|
|
21204
|
+
}, index) => {
|
|
21205
|
+
const type = chartType === 'gradient' ? 'area' : chartType;
|
|
21206
|
+
const {
|
|
21207
|
+
color,
|
|
21208
|
+
mainColor
|
|
21209
|
+
} = chartColorHandlers[chartType](colors, index);
|
|
21210
|
+
const meta = metas[metric];
|
|
21211
|
+
let option = {
|
|
21212
|
+
type: type,
|
|
21213
|
+
name: meta ? meta.name : '',
|
|
21214
|
+
data: records.map(record => {
|
|
21215
|
+
const data = record.metric[metric] ?? null;
|
|
21216
|
+
return pie ? {
|
|
21217
|
+
name: record[dimension],
|
|
21218
|
+
y: data
|
|
21219
|
+
} : data;
|
|
21220
|
+
}),
|
|
21221
|
+
custom: {
|
|
21222
|
+
type: meta ? meta.type : '',
|
|
21223
|
+
pointerNames: meta?.pointerNames ?? null
|
|
21224
|
+
},
|
|
21225
|
+
center: centers[index] || [null, null],
|
|
21226
|
+
size: size,
|
|
21227
|
+
point: {
|
|
21228
|
+
events: {
|
|
21229
|
+
render: function () {
|
|
21230
|
+
this.graphic.attr({
|
|
21231
|
+
zIndex: this.y === 0 ? -1 : ZIndex.COMPARE_CHART_BASE - index
|
|
21232
|
+
});
|
|
21233
|
+
}
|
|
21234
|
+
}
|
|
21235
|
+
},
|
|
21236
|
+
showInLegend: pie && index > 0 ? false : true,
|
|
21237
|
+
color: color,
|
|
21238
|
+
lineColor: mainColor,
|
|
21239
|
+
lineWidth: 2,
|
|
21240
|
+
marker: {
|
|
21241
|
+
fillColor: mainColor
|
|
21242
|
+
},
|
|
21243
|
+
metric: metric
|
|
21244
|
+
};
|
|
21245
|
+
if (legendLimitEnabled) option = {
|
|
21246
|
+
...option,
|
|
21247
|
+
visible: index < legendLimit
|
|
21248
|
+
};
|
|
21249
|
+
return option;
|
|
21250
|
+
});
|
|
21251
|
+
const yPlotLines = yAxisPlotLines.map((line, index) => {
|
|
21252
|
+
return {
|
|
21253
|
+
value: line.value,
|
|
21254
|
+
width: 1,
|
|
21255
|
+
color: line.color,
|
|
21256
|
+
dashStyle: "Dash",
|
|
21257
|
+
zIndex: ZIndex.AVERAGE_LINE_BASE + index,
|
|
21258
|
+
label: {
|
|
21259
|
+
text: line.label,
|
|
21260
|
+
align: line.labelAlign,
|
|
21261
|
+
style: {
|
|
21262
|
+
color: line.labelColor,
|
|
21263
|
+
opacity: 0.7,
|
|
21264
|
+
fontSize: "12px",
|
|
21265
|
+
padding: '1px 5px'
|
|
21266
|
+
},
|
|
21267
|
+
y: -8,
|
|
21268
|
+
useHTML: true
|
|
21269
|
+
}
|
|
21270
|
+
};
|
|
21271
|
+
});
|
|
21272
|
+
const xPlotBands = [{
|
|
21273
|
+
from: xPlotIndex,
|
|
21274
|
+
to: categories.length - 1,
|
|
21275
|
+
color: 'rgba(0, 0, 0, 0.03)',
|
|
21276
|
+
zIndex: ZIndex.NOW_BAND
|
|
21277
|
+
}];
|
|
21278
|
+
const xPlotLines = [{
|
|
21279
|
+
color: "#aaa",
|
|
21280
|
+
width: 1,
|
|
21281
|
+
value: xPlotIndex,
|
|
21282
|
+
zIndex: ZIndex.NOW_BORDER,
|
|
21283
|
+
label: {
|
|
21284
|
+
text: "현재",
|
|
21285
|
+
rotation: 0,
|
|
21286
|
+
x: 5,
|
|
21287
|
+
y: 13,
|
|
21288
|
+
style: {
|
|
21289
|
+
fontWeight: 500,
|
|
21290
|
+
lineHeight: "16.8px",
|
|
21291
|
+
color: "#333",
|
|
21292
|
+
fontSize: "12px"
|
|
21339
21293
|
}
|
|
21340
|
-
|
|
21341
|
-
return index
|
|
21342
21294
|
}
|
|
21343
|
-
|
|
21344
|
-
|
|
21345
|
-
|
|
21346
|
-
|
|
21347
|
-
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
|
|
21352
|
-
|
|
21353
|
-
|
|
21354
|
-
|
|
21355
|
-
|
|
21356
|
-
|
|
21295
|
+
}];
|
|
21296
|
+
return {
|
|
21297
|
+
chart: {
|
|
21298
|
+
type: type.toLowerCase(),
|
|
21299
|
+
height: height,
|
|
21300
|
+
backgroundColor,
|
|
21301
|
+
events: {
|
|
21302
|
+
render: secondaryXAxis.length === 0 ? undefined : function () {
|
|
21303
|
+
const chart = this;
|
|
21304
|
+
const visibleSeries = chart.series.filter(s => s.visible);
|
|
21305
|
+
let newCategories = null;
|
|
21306
|
+
if (visibleSeries.length === 1 && visibleSeries[0].options.metric === 'prev') {
|
|
21307
|
+
newCategories = secondaryXAxis;
|
|
21308
|
+
} else {
|
|
21309
|
+
newCategories = mainXAxis;
|
|
21310
|
+
}
|
|
21311
|
+
const isSame = JSON.stringify(chart.xAxis[0].categories) === JSON.stringify(newCategories);
|
|
21312
|
+
if (!isSame) {
|
|
21313
|
+
chart.xAxis[0].setCategories(newCategories);
|
|
21357
21314
|
}
|
|
21358
21315
|
}
|
|
21359
21316
|
}
|
|
21360
|
-
}
|
|
21361
|
-
|
|
21362
|
-
|
|
21363
|
-
|
|
21364
|
-
|
|
21365
|
-
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
} else {
|
|
21377
|
-
parent.children.splice(index, 1);
|
|
21317
|
+
},
|
|
21318
|
+
title: {
|
|
21319
|
+
text: ''
|
|
21320
|
+
},
|
|
21321
|
+
subtitle: {
|
|
21322
|
+
text: title
|
|
21323
|
+
},
|
|
21324
|
+
colors: colors,
|
|
21325
|
+
xAxis: {
|
|
21326
|
+
type: xAxisType,
|
|
21327
|
+
labels: {
|
|
21328
|
+
enabled: xAxisLabel,
|
|
21329
|
+
autoRotation: false,
|
|
21330
|
+
format: xAxisLabelFormat ? `{value:${xAxisLabelFormat}}` : undefined,
|
|
21331
|
+
style: {
|
|
21332
|
+
color: grey[600]
|
|
21378
21333
|
}
|
|
21379
|
-
|
|
21380
|
-
|
|
21334
|
+
},
|
|
21335
|
+
categories: categorize ? categories : undefined,
|
|
21336
|
+
tickWidth: 1,
|
|
21337
|
+
tickInterval: xAxisTickInterval ?? (xAxisType === 'datetime' ? records.length / 20 : 1),
|
|
21338
|
+
lineColor: grey[900],
|
|
21339
|
+
tickColor: grey[900],
|
|
21340
|
+
crosshair: true,
|
|
21341
|
+
startOnTick: true,
|
|
21342
|
+
plotBands: xPlotIndex !== undefined ? xPlotBands : undefined,
|
|
21343
|
+
plotLines: xPlotIndex !== undefined ? xPlotLines : undefined
|
|
21344
|
+
},
|
|
21345
|
+
yAxis: {
|
|
21346
|
+
title: {
|
|
21347
|
+
text: ''
|
|
21348
|
+
},
|
|
21349
|
+
labels: {
|
|
21350
|
+
enabled: yAxisLabelEnabled,
|
|
21351
|
+
formatter: yAxisLabelFormat,
|
|
21352
|
+
style: {
|
|
21353
|
+
color: grey[600]
|
|
21354
|
+
}
|
|
21355
|
+
},
|
|
21356
|
+
tickInterval: yAxisTickInterval,
|
|
21357
|
+
gridLineColor: '#f8f8f8',
|
|
21358
|
+
plotLines: yPlotLines
|
|
21359
|
+
},
|
|
21360
|
+
plotOptions: {
|
|
21361
|
+
series: {
|
|
21362
|
+
opacity: opacity,
|
|
21363
|
+
stacking: stackingType(stacking),
|
|
21364
|
+
showInLegend: showLegend,
|
|
21365
|
+
dataLabels: {
|
|
21366
|
+
enabled: showDataLabel
|
|
21367
|
+
},
|
|
21368
|
+
colorByPoint: pie,
|
|
21369
|
+
lineWidth: 2,
|
|
21370
|
+
marker: {
|
|
21371
|
+
enabled: false,
|
|
21372
|
+
symbol: 'circle'
|
|
21373
|
+
},
|
|
21374
|
+
cursor: 'pointer',
|
|
21375
|
+
point: {
|
|
21376
|
+
events: {}
|
|
21377
|
+
},
|
|
21378
|
+
events: {
|
|
21379
|
+
legendItemClick: handleLegendItemClick
|
|
21380
|
+
}
|
|
21381
|
+
},
|
|
21382
|
+
pie: {
|
|
21383
|
+
allowPointSelect: true,
|
|
21384
|
+
innerSize: `${innerSize}%`
|
|
21381
21385
|
}
|
|
21386
|
+
},
|
|
21387
|
+
legend: {
|
|
21388
|
+
align: legendAlign,
|
|
21389
|
+
verticalAlign: 'top',
|
|
21390
|
+
enabled: showLegend
|
|
21391
|
+
},
|
|
21392
|
+
tooltip: {
|
|
21393
|
+
followPointer: false,
|
|
21394
|
+
shared: true,
|
|
21395
|
+
shadow: false,
|
|
21396
|
+
useHTML: true,
|
|
21397
|
+
formatter: function () {
|
|
21398
|
+
return tooltipFormatter(this, tooltip);
|
|
21399
|
+
},
|
|
21400
|
+
outside: outside,
|
|
21401
|
+
style: {
|
|
21402
|
+
zIndex: 2000
|
|
21403
|
+
}
|
|
21404
|
+
},
|
|
21405
|
+
series: series,
|
|
21406
|
+
time: {
|
|
21407
|
+
useUTC: false,
|
|
21408
|
+
getTimezoneOffset: function () {
|
|
21409
|
+
return new Date().getTimezoneOffset();
|
|
21410
|
+
}
|
|
21411
|
+
},
|
|
21412
|
+
credits: {
|
|
21413
|
+
enabled: false
|
|
21382
21414
|
}
|
|
21383
|
-
}
|
|
21384
|
-
}
|
|
21385
|
-
|
|
21386
|
-
/**
|
|
21387
|
-
* Make a URL safe.
|
|
21388
|
-
*
|
|
21389
|
-
* @satisfies {UrlTransform}
|
|
21390
|
-
* @param {string} value
|
|
21391
|
-
* URL.
|
|
21392
|
-
* @returns {string}
|
|
21393
|
-
* Safe URL.
|
|
21394
|
-
*/
|
|
21395
|
-
function defaultUrlTransform(value) {
|
|
21396
|
-
// Same as:
|
|
21397
|
-
// <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>
|
|
21398
|
-
// But without the `encode` part.
|
|
21399
|
-
const colon = value.indexOf(':');
|
|
21400
|
-
const questionMark = value.indexOf('?');
|
|
21401
|
-
const numberSign = value.indexOf('#');
|
|
21402
|
-
const slash = value.indexOf('/');
|
|
21403
|
-
|
|
21404
|
-
if (
|
|
21405
|
-
// If there is no protocol, it’s relative.
|
|
21406
|
-
colon === -1 ||
|
|
21407
|
-
// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
|
|
21408
|
-
(slash !== -1 && colon > slash) ||
|
|
21409
|
-
(questionMark !== -1 && colon > questionMark) ||
|
|
21410
|
-
(numberSign !== -1 && colon > numberSign) ||
|
|
21411
|
-
// It is a protocol, it should be allowed.
|
|
21412
|
-
safeProtocol.test(value.slice(0, colon))
|
|
21413
|
-
) {
|
|
21414
|
-
return value
|
|
21415
|
-
}
|
|
21416
|
-
|
|
21417
|
-
return ''
|
|
21418
|
-
}
|
|
21419
|
-
|
|
21420
|
-
function styleInject(css, ref) {
|
|
21421
|
-
if ( ref === void 0 ) ref = {};
|
|
21422
|
-
var insertAt = ref.insertAt;
|
|
21423
|
-
|
|
21424
|
-
if (typeof document === 'undefined') { return; }
|
|
21425
|
-
|
|
21426
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
21427
|
-
var style = document.createElement('style');
|
|
21428
|
-
style.type = 'text/css';
|
|
21429
|
-
|
|
21430
|
-
if (insertAt === 'top') {
|
|
21431
|
-
if (head.firstChild) {
|
|
21432
|
-
head.insertBefore(style, head.firstChild);
|
|
21433
|
-
} else {
|
|
21434
|
-
head.appendChild(style);
|
|
21435
|
-
}
|
|
21436
|
-
} else {
|
|
21437
|
-
head.appendChild(style);
|
|
21438
|
-
}
|
|
21439
|
-
|
|
21440
|
-
if (style.styleSheet) {
|
|
21441
|
-
style.styleSheet.cssText = css;
|
|
21442
|
-
} else {
|
|
21443
|
-
style.appendChild(document.createTextNode(css));
|
|
21444
|
-
}
|
|
21445
|
-
}
|
|
21446
|
-
|
|
21447
|
-
var css_248z = ".markdown-content{word-wrap:break-word;line-height:1.6;white-space:normal}.markdown-content p{margin:0 0 .75rem}.markdown-content p:last-child{margin-bottom:0}.markdown-content h1,.markdown-content h2,.markdown-content h3,.markdown-content h4,.markdown-content h5,.markdown-content h6{font-weight:600;line-height:1.3;margin:1rem 0 .5rem}.markdown-content h1:first-child,.markdown-content h2:first-child,.markdown-content h3:first-child{margin-top:0}.markdown-content h1{font-size:1.5em}.markdown-content h2{font-size:1.3em}.markdown-content h3{font-size:1.15em}.markdown-content h4{font-size:1.05em}.markdown-content ol,.markdown-content ul{margin:.5rem 0;padding-left:1.5rem}.markdown-content li{margin:.25rem 0}.markdown-content code{background:rgba(0,0,0,.05);border-radius:.25rem;font-family:Courier New,monospace;font-size:.9em;padding:.15rem .3rem}.message.user .markdown-content code{background:hsla(0,0%,100%,.2)}.markdown-content pre{background:rgba(0,0,0,.05);border-radius:.375rem;margin:.5rem 0;overflow-x:auto;padding:.75rem}.markdown-content pre code{background:transparent;padding:0}.message.user .markdown-content pre{background:hsla(0,0%,100%,.15)}.markdown-content strong{font-weight:700}.markdown-content em{font-style:italic}.markdown-content a{color:#667eea;text-decoration:underline}.message.user .markdown-content a{color:hsla(0,0%,100%,.95)}.markdown-content blockquote{border-left:3px solid #667eea;color:#666;margin:.75rem 0;padding-left:1rem}.message.user .markdown-content blockquote{border-left-color:hsla(0,0%,100%,.5);color:hsla(0,0%,100%,.9)}.markdown-content hr{border:none;border-top:1px solid #e5e7eb;margin:1rem 0}.message.user .markdown-content hr{border-top-color:hsla(0,0%,100%,.3)}.markdown-content table{border-collapse:collapse;margin:.75rem 0;width:100%}.markdown-content td,.markdown-content th{border:1px solid #e5e7eb;padding:.5rem;text-align:left}.markdown-content th{background:rgba(0,0,0,.05);font-weight:600}.message.user .markdown-content td,.message.user .markdown-content th{border-color:hsla(0,0%,100%,.3)}.message.user .markdown-content th{background:hsla(0,0%,100%,.15)}";
|
|
21448
|
-
styleInject(css_248z);
|
|
21449
|
-
|
|
21450
|
-
function MarkdownContent({
|
|
21451
|
-
content
|
|
21452
|
-
}) {
|
|
21453
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
21454
|
-
className: "markdown-content"
|
|
21455
|
-
}, /*#__PURE__*/React.createElement(Markdown, null, content));
|
|
21415
|
+
};
|
|
21456
21416
|
}
|
|
21457
|
-
|
|
21458
|
-
const
|
|
21459
|
-
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21417
|
+
const tooltipFormatter = (_this, props) => {
|
|
21418
|
+
const {
|
|
21419
|
+
headerVisible = true,
|
|
21420
|
+
dateFormat,
|
|
21421
|
+
headerTime,
|
|
21422
|
+
legendColors = []
|
|
21423
|
+
} = props;
|
|
21424
|
+
let tooltip = '<div style="font-size: 14px;padding: 12px; min-width: 200px;">';
|
|
21425
|
+
if (headerVisible) {
|
|
21426
|
+
const xDate = new Date(_this.x);
|
|
21427
|
+
const date = formatDate(xDate, dateFormat);
|
|
21428
|
+
tooltip += `<div style="display: flex; justify-content: space-between; font-weight: bold; font-size: 12px;">
|
|
21429
|
+
<span style="font-size: 12px; color: #333;">${date}</span>`;
|
|
21430
|
+
if (headerTime) {
|
|
21431
|
+
const time = formatDate(xDate, '%H:%M');
|
|
21432
|
+
tooltip += `<span style="font-size: 12px; color: #333;">${time}</span>`;
|
|
21471
21433
|
}
|
|
21472
|
-
|
|
21473
|
-
}
|
|
21474
|
-
|
|
21475
|
-
|
|
21476
|
-
|
|
21477
|
-
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
21482
|
-
|
|
21434
|
+
tooltip += '</div>';
|
|
21435
|
+
}
|
|
21436
|
+
_this.points.forEach(point => {
|
|
21437
|
+
const type = point.series.options.custom.type;
|
|
21438
|
+
const value = type !== 'TO_PERCENT' ? format(point.y, type) : formatToPercent(_this.percentage / 100);
|
|
21439
|
+
const name = point.series.name;
|
|
21440
|
+
let color = type !== 'TO_PERCENT' ? point.series.color : point.color;
|
|
21441
|
+
if (legendColors.length !== 0) {
|
|
21442
|
+
color = legendColors[point.series.index];
|
|
21443
|
+
}
|
|
21444
|
+
tooltip += `<div style="display: flex; flex-direction: column; gap: 8px;">
|
|
21445
|
+
<div style="display: flex; justify-content: space-between; align-items: center; margin-top: 15px;">
|
|
21446
|
+
<span style="width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; background-color: ${color}"></span>
|
|
21447
|
+
<span style="flex-grow: 1; font-size: 14px; padding-right: 20px;">${name}</span>
|
|
21448
|
+
<span style="font-weight: bold; font-size: 14px;">${value}</span>
|
|
21449
|
+
</div>
|
|
21450
|
+
</div>`;
|
|
21483
21451
|
});
|
|
21484
|
-
|
|
21485
|
-
|
|
21486
|
-
|
|
21487
|
-
var dayjs_min$1 = {exports: {}};
|
|
21488
|
-
|
|
21489
|
-
var dayjs_min = dayjs_min$1.exports;
|
|
21490
|
-
|
|
21491
|
-
var hasRequiredDayjs_min;
|
|
21492
|
-
|
|
21493
|
-
function requireDayjs_min () {
|
|
21494
|
-
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
21495
|
-
hasRequiredDayjs_min = 1;
|
|
21496
|
-
(function (module, exports$1) {
|
|
21497
|
-
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
21498
|
-
} (dayjs_min$1));
|
|
21499
|
-
return dayjs_min$1.exports;
|
|
21500
|
-
}
|
|
21501
|
-
|
|
21502
|
-
var dayjs_minExports = requireDayjs_min();
|
|
21503
|
-
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
21504
|
-
|
|
21505
|
-
var isoWeek$2 = {exports: {}};
|
|
21506
|
-
|
|
21507
|
-
var isoWeek$1 = isoWeek$2.exports;
|
|
21508
|
-
|
|
21509
|
-
var hasRequiredIsoWeek;
|
|
21510
|
-
|
|
21511
|
-
function requireIsoWeek () {
|
|
21512
|
-
if (hasRequiredIsoWeek) return isoWeek$2.exports;
|
|
21513
|
-
hasRequiredIsoWeek = 1;
|
|
21514
|
-
(function (module, exports$1) {
|
|
21515
|
-
!function(e,t){module.exports=t();}(isoWeek$1,(function(){var e="day";return function(t,i,s){var a=function(t){return t.add(4-t.isoWeekday(),e)},d=i.prototype;d.isoWeekYear=function(){return a(this).year()},d.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var i,d,n,o,r=a(this),u=(i=this.isoWeekYear(),d=this.$u,n=(d?s.utc:s)().year(i).startOf("year"),o=4-n.isoWeekday(),n.isoWeekday()>4&&(o+=7),n.add(o,e));return r.diff(u,"week")+1},d.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var n=d.startOf;d.startOf=function(e,t){var i=this.$utils(),s=!!i.u(t)||t;return "isoweek"===i.p(e)?s?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):n.bind(this)(e,t)};}}));
|
|
21516
|
-
} (isoWeek$2));
|
|
21517
|
-
return isoWeek$2.exports;
|
|
21518
|
-
}
|
|
21519
|
-
|
|
21520
|
-
var isoWeekExports = requireIsoWeek();
|
|
21521
|
-
var isoWeek = /*@__PURE__*/getDefaultExportFromCjs(isoWeekExports);
|
|
21522
|
-
|
|
21523
|
-
var relativeTime$2 = {exports: {}};
|
|
21524
|
-
|
|
21525
|
-
var relativeTime$1 = relativeTime$2.exports;
|
|
21526
|
-
|
|
21527
|
-
var hasRequiredRelativeTime;
|
|
21528
|
-
|
|
21529
|
-
function requireRelativeTime () {
|
|
21530
|
-
if (hasRequiredRelativeTime) return relativeTime$2.exports;
|
|
21531
|
-
hasRequiredRelativeTime = 1;
|
|
21532
|
-
(function (module, exports$1) {
|
|
21533
|
-
!function(r,e){module.exports=e();}(relativeTime$1,(function(){return function(r,e,t){r=r||{};var n=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function i(r,e,t,o){return n.fromToBase(r,e,t,o)}t.en.relativeTime=o,n.fromToBase=function(e,n,i,d,u){for(var f,a,s,l=i.$locale().relativeTime||o,h=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],m=h.length,c=0;c<m;c+=1){var y=h[c];y.d&&(f=d?t(e).diff(i,y.d,true):i.diff(e,y.d,true));var p=(r.rounding||Math.round)(Math.abs(f));if(s=f>0,p<=y.r||!y.r){p<=1&&c>0&&(y=h[c-1]);var v=l[y.l];u&&(p=u(""+p)),a="string"==typeof v?v.replace("%d",p):v(p,n,y.l,s);break}}if(n)return a;var M=s?l.future:l.past;return "function"==typeof M?M(a):M.replace("%s",a)},n.to=function(r,e){return i(r,e,this,true)},n.from=function(r,e){return i(r,e,this)};var d=function(r){return r.$u?t.utc():t()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)};}}));
|
|
21534
|
-
} (relativeTime$2));
|
|
21535
|
-
return relativeTime$2.exports;
|
|
21536
|
-
}
|
|
21537
|
-
|
|
21538
|
-
var relativeTimeExports = requireRelativeTime();
|
|
21539
|
-
var relativeTime = /*@__PURE__*/getDefaultExportFromCjs(relativeTimeExports);
|
|
21540
|
-
|
|
21541
|
-
var isSameOrBefore$2 = {exports: {}};
|
|
21542
|
-
|
|
21543
|
-
var isSameOrBefore$1 = isSameOrBefore$2.exports;
|
|
21544
|
-
|
|
21545
|
-
var hasRequiredIsSameOrBefore;
|
|
21546
|
-
|
|
21547
|
-
function requireIsSameOrBefore () {
|
|
21548
|
-
if (hasRequiredIsSameOrBefore) return isSameOrBefore$2.exports;
|
|
21549
|
-
hasRequiredIsSameOrBefore = 1;
|
|
21550
|
-
(function (module, exports$1) {
|
|
21551
|
-
!function(e,i){module.exports=i();}(isSameOrBefore$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
21552
|
-
} (isSameOrBefore$2));
|
|
21553
|
-
return isSameOrBefore$2.exports;
|
|
21554
|
-
}
|
|
21555
|
-
|
|
21556
|
-
var isSameOrBeforeExports = requireIsSameOrBefore();
|
|
21557
|
-
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
21558
|
-
|
|
21559
|
-
var isSameOrAfter$2 = {exports: {}};
|
|
21560
|
-
|
|
21561
|
-
var isSameOrAfter$1 = isSameOrAfter$2.exports;
|
|
21562
|
-
|
|
21563
|
-
var hasRequiredIsSameOrAfter;
|
|
21564
|
-
|
|
21565
|
-
function requireIsSameOrAfter () {
|
|
21566
|
-
if (hasRequiredIsSameOrAfter) return isSameOrAfter$2.exports;
|
|
21567
|
-
hasRequiredIsSameOrAfter = 1;
|
|
21568
|
-
(function (module, exports$1) {
|
|
21569
|
-
!function(e,t){module.exports=t();}(isSameOrAfter$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
21570
|
-
} (isSameOrAfter$2));
|
|
21571
|
-
return isSameOrAfter$2.exports;
|
|
21572
|
-
}
|
|
21573
|
-
|
|
21574
|
-
var isSameOrAfterExports = requireIsSameOrAfter();
|
|
21575
|
-
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
21576
|
-
|
|
21577
|
-
dayjs.extend(relativeTime);
|
|
21578
|
-
dayjs.extend(isoWeek);
|
|
21579
|
-
dayjs.extend(isSameOrBefore);
|
|
21580
|
-
dayjs.extend(isSameOrAfter);
|
|
21581
|
-
dayjs.locale('ko');
|
|
21582
|
-
const isToday = (from, to) => {
|
|
21583
|
-
const now = new Date();
|
|
21584
|
-
const date = new Date(now.toLocaleString('en-US', {
|
|
21585
|
-
timeZone: 'Asia/Seoul'
|
|
21586
|
-
}));
|
|
21587
|
-
const today = date.getFullYear() + String(date.getMonth() + 1).padStart(2, '0') + String(date.getDate()).padStart(2, '0');
|
|
21588
|
-
return from === today && to === today;
|
|
21589
|
-
};
|
|
21590
|
-
const isOneDay = (from, to) => {
|
|
21591
|
-
return from === to;
|
|
21592
|
-
};
|
|
21593
|
-
const formatDateRange = (from, to) => {
|
|
21594
|
-
const fromDate = dayjs(from, 'YYYYMMDD');
|
|
21595
|
-
const toDate = dayjs(to, 'YYYYMMDD');
|
|
21596
|
-
const today = dayjs().startOf('day');
|
|
21597
|
-
if (from === to) return formatSingleDate(fromDate, today);
|
|
21598
|
-
return formatRange(fromDate, toDate, today);
|
|
21452
|
+
tooltip += '</div>';
|
|
21453
|
+
return tooltip;
|
|
21599
21454
|
};
|
|
21600
|
-
|
|
21601
|
-
|
|
21602
|
-
|
|
21603
|
-
|
|
21604
|
-
|
|
21605
|
-
|
|
21455
|
+
function formatDate(data, format) {
|
|
21456
|
+
return Highcharts$1.dateFormat(format, data.getTime() - data.getTimezoneOffset() * 60000);
|
|
21457
|
+
}
|
|
21458
|
+
const ZIndex = {
|
|
21459
|
+
AVERAGE_LINE_BASE: 10,
|
|
21460
|
+
COMPARE_CHART_BASE: 5,
|
|
21461
|
+
NOW_BORDER: 2,
|
|
21462
|
+
NOW_BAND: 1
|
|
21606
21463
|
};
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
|
|
21610
|
-
|
|
21611
|
-
|
|
21612
|
-
|
|
21613
|
-
|
|
21614
|
-
|
|
21615
|
-
|
|
21616
|
-
|
|
21617
|
-
|
|
21618
|
-
|
|
21619
|
-
|
|
21620
|
-
const twoWeeksAgoEnd = today.subtract(2, 'week').endOf('week');
|
|
21621
|
-
if (fromDate.isSame(twoWeeksAgoStart, 'day') && toDate.isSame(twoWeeksAgoEnd, 'day')) {
|
|
21622
|
-
return '지지난주';
|
|
21623
|
-
}
|
|
21624
|
-
const thisMonthStart = today.startOf('month');
|
|
21625
|
-
const thisMonthEnd = today.endOf('month');
|
|
21626
|
-
if (fromDate.isSame(thisMonthStart, 'day') && (toDate.isSame(today, 'day') || toDate.isSame(thisMonthEnd, 'day'))) {
|
|
21627
|
-
return '이번달';
|
|
21628
|
-
}
|
|
21629
|
-
const lastMonthStart = today.subtract(1, 'month').startOf('month');
|
|
21630
|
-
const lastMonthEnd = today.subtract(1, 'month').endOf('month');
|
|
21631
|
-
if (fromDate.isSame(lastMonthStart, 'day') && toDate.isSame(lastMonthEnd, 'day')) {
|
|
21632
|
-
return '지난달';
|
|
21633
|
-
}
|
|
21634
|
-
const twoMonthsAgoStart = today.subtract(2, 'month').startOf('month');
|
|
21635
|
-
const twoMonthsAgoEnd = today.subtract(2, 'month').endOf('month');
|
|
21636
|
-
if (fromDate.isSame(twoMonthsAgoStart, 'day') && toDate.isSame(twoMonthsAgoEnd, 'day')) {
|
|
21637
|
-
return '지지난달';
|
|
21464
|
+
function stackingType(stacking) {
|
|
21465
|
+
return stacking ? stacking.toLowerCase() : '';
|
|
21466
|
+
}
|
|
21467
|
+
function pieCenters(count) {
|
|
21468
|
+
switch (count) {
|
|
21469
|
+
case 2:
|
|
21470
|
+
return [['25%', '50%'], ['75%', '50%']];
|
|
21471
|
+
case 3:
|
|
21472
|
+
return [['25%', '25%'], ['75%', '25%'], ['50%', '75%']];
|
|
21473
|
+
case 4:
|
|
21474
|
+
return [['25%', '25%'], ['75%', '25%'], ['25%', '75%'], ['75%', '75%']];
|
|
21475
|
+
default:
|
|
21476
|
+
return [];
|
|
21638
21477
|
}
|
|
21639
|
-
const fromFormatted = formatDateInRange(fromDate, today);
|
|
21640
|
-
const toFormatted = formatDateInRange(toDate, today);
|
|
21641
|
-
return `${fromFormatted} ~ ${toFormatted}`;
|
|
21642
|
-
};
|
|
21643
|
-
const formatDateInRange = (date, today) => {
|
|
21644
|
-
const diffDays = today.diff(date, 'day');
|
|
21645
|
-
if (diffDays === 0) return '오늘';
|
|
21646
|
-
if (diffDays === 1) return '어제';
|
|
21647
|
-
if (diffDays === 2) return '그제';
|
|
21648
|
-
return date.format('YYYY년 M월 D일');
|
|
21649
|
-
};
|
|
21650
|
-
|
|
21651
|
-
const ColumnChartContent = ({
|
|
21652
|
-
tools = []
|
|
21653
|
-
}) => {
|
|
21654
|
-
const {
|
|
21655
|
-
configMap
|
|
21656
|
-
} = useToolContext();
|
|
21657
|
-
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, tools.length > 0 && /*#__PURE__*/React$1.createElement("div", {
|
|
21658
|
-
style: {
|
|
21659
|
-
display: 'flex',
|
|
21660
|
-
justifyContent: 'center',
|
|
21661
|
-
marginBottom: '30px'
|
|
21662
|
-
}
|
|
21663
|
-
}, /*#__PURE__*/React$1.createElement(ColumnChart, {
|
|
21664
|
-
data: toData$1(tools, configMap)
|
|
21665
|
-
})));
|
|
21666
|
-
};
|
|
21667
|
-
function toData$1(tools, configMap) {
|
|
21668
|
-
const items = [];
|
|
21669
|
-
const hasConvert = tools.some(content => content.result?.result[0]?.metric?.filter !== undefined);
|
|
21670
|
-
tools.sort((a, b) => a.arguments.from.localeCompare(b.arguments.from)).forEach(content => {
|
|
21671
|
-
const {
|
|
21672
|
-
taskId,
|
|
21673
|
-
from,
|
|
21674
|
-
to
|
|
21675
|
-
} = content.arguments;
|
|
21676
|
-
const item = {
|
|
21677
|
-
name: `<b>${configMap.get(taskId)}</b> <span style="font-size:10px">(${formatDateRange(from, to)})</span>`,
|
|
21678
|
-
data: []
|
|
21679
|
-
};
|
|
21680
|
-
const result = reduce(content.result.result);
|
|
21681
|
-
item.data.push(result.input);
|
|
21682
|
-
item.data.push(result.output);
|
|
21683
|
-
if (hasConvert) item.data.push(result.filter);
|
|
21684
|
-
item.data.push(result.error);
|
|
21685
|
-
items.push(item);
|
|
21686
|
-
});
|
|
21687
|
-
return {
|
|
21688
|
-
colors: hasConvert ? ['#333333', '#2652a8', '#b47813', '#aa1a32'] : ['#333333', '#2652a8', '#aa1a32'],
|
|
21689
|
-
categories: hasConvert ? ['입력', '처리', '필터', '에러'] : ['입력', '처리', '에러'],
|
|
21690
|
-
series: items
|
|
21691
|
-
};
|
|
21692
21478
|
}
|
|
21693
|
-
function
|
|
21694
|
-
|
|
21695
|
-
|
|
21696
|
-
|
|
21697
|
-
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21479
|
+
function pieSize(count) {
|
|
21480
|
+
switch (count) {
|
|
21481
|
+
case 3:
|
|
21482
|
+
return '50%';
|
|
21483
|
+
case 4:
|
|
21484
|
+
return '25%';
|
|
21485
|
+
default:
|
|
21486
|
+
return null;
|
|
21487
|
+
}
|
|
21488
|
+
}
|
|
21489
|
+
|
|
21490
|
+
function TrendChart({
|
|
21491
|
+
colorIndex = 0,
|
|
21492
|
+
legendColors,
|
|
21493
|
+
isDaily,
|
|
21494
|
+
isRealtime,
|
|
21495
|
+
...props
|
|
21496
|
+
}) {
|
|
21497
|
+
const colors = useMemo(() => {
|
|
21498
|
+
return all[colorIndex % all.length];
|
|
21499
|
+
}, [colorIndex]);
|
|
21500
|
+
const tooltip = useMemo(() => ({
|
|
21501
|
+
dateFormat: isRealtime ? '%H:%M' : '%Y-%m-%d',
|
|
21502
|
+
headerTime: !isDaily && !isRealtime,
|
|
21503
|
+
outside: props.tooltipOutSide,
|
|
21504
|
+
legendColors
|
|
21505
|
+
}), [isRealtime, isDaily, props.tooltipOutSide, legendColors]);
|
|
21506
|
+
return /*#__PURE__*/React.createElement(Chart, _extends({
|
|
21507
|
+
type: "areaspline",
|
|
21508
|
+
categorize: true,
|
|
21509
|
+
xAxisType: "datetime",
|
|
21510
|
+
xAxisLabelFormat: isDaily ? '%m-%d' : '%H:%M',
|
|
21511
|
+
colors: colors,
|
|
21512
|
+
tooltip: tooltip
|
|
21513
|
+
}, props));
|
|
21514
|
+
}
|
|
21515
|
+
|
|
21516
|
+
function StackedAreaTrendChart({
|
|
21517
|
+
metrics,
|
|
21518
|
+
records,
|
|
21519
|
+
isDaily = false,
|
|
21520
|
+
xPlotIndex,
|
|
21521
|
+
xAxisTickInterval,
|
|
21522
|
+
yAxisLabelEnabled = false,
|
|
21523
|
+
legendLimit = 3,
|
|
21524
|
+
colors = defaultColors,
|
|
21525
|
+
...props
|
|
21526
|
+
}) {
|
|
21527
|
+
const _metrics = useMemo(() => {
|
|
21528
|
+
return metrics.map(m => ({
|
|
21529
|
+
metric: m.id,
|
|
21530
|
+
chartType: 'area'
|
|
21531
|
+
}));
|
|
21532
|
+
}, [metrics]);
|
|
21533
|
+
const metas = useMemo(() => {
|
|
21534
|
+
const result = {
|
|
21535
|
+
time: {
|
|
21536
|
+
name: "일시",
|
|
21537
|
+
type: "DATE"
|
|
21538
|
+
}
|
|
21539
|
+
};
|
|
21540
|
+
metrics.forEach(m => {
|
|
21541
|
+
result[m.id] = {
|
|
21542
|
+
name: m.name,
|
|
21543
|
+
type: "NUMBER"
|
|
21544
|
+
};
|
|
21545
|
+
});
|
|
21546
|
+
return result;
|
|
21547
|
+
}, [metrics]);
|
|
21548
|
+
return /*#__PURE__*/React.createElement(TrendChart, _extends({
|
|
21549
|
+
dimension: "time",
|
|
21550
|
+
stacking: "normal",
|
|
21551
|
+
metrics: _metrics,
|
|
21552
|
+
metas: metas,
|
|
21553
|
+
records: records,
|
|
21554
|
+
isRealtime: xPlotIndex !== undefined,
|
|
21555
|
+
isDaily: isDaily,
|
|
21556
|
+
xPlotIndex: xPlotIndex,
|
|
21557
|
+
xAxisTickInterval: xAxisTickInterval,
|
|
21558
|
+
yAxisLabelEnabled: yAxisLabelEnabled,
|
|
21559
|
+
legendLimit: legendLimit,
|
|
21560
|
+
colors: colors
|
|
21561
|
+
}, props));
|
|
21706
21562
|
}
|
|
21563
|
+
const defaultColors = [["rgba(54,115,237,0.8)", "#3673ed"], ["rgba(149,77,241,0.8)", "#954df1"], ["#4dc391", "#20b476"], ["#fbba3d", "#faa90c"], ["#f2426d", "#ef1348"]];
|
|
21707
21564
|
|
|
21708
21565
|
function StackedAreaChartContent({
|
|
21709
21566
|
tools
|
|
@@ -21797,6 +21654,162 @@ function xPlotIndex(tools) {
|
|
|
21797
21654
|
}
|
|
21798
21655
|
}
|
|
21799
21656
|
|
|
21657
|
+
const PieChart = ({
|
|
21658
|
+
data,
|
|
21659
|
+
width = 230,
|
|
21660
|
+
height = 180,
|
|
21661
|
+
size = '60%',
|
|
21662
|
+
colors = ['#2652a8', '#b47813', '#aa1a32']
|
|
21663
|
+
}) => {
|
|
21664
|
+
const noData = data.metrics.some(m => m.transparent);
|
|
21665
|
+
const options = useMemo(() => {
|
|
21666
|
+
const chartData = data.metrics.filter(metric => metric.transparent || metric.value > 0).map((metric, index) => ({
|
|
21667
|
+
name: metric.label,
|
|
21668
|
+
y: metric.value,
|
|
21669
|
+
color: metric.transparent ? checkerboardPattern() : colors[index % colors.length]
|
|
21670
|
+
}));
|
|
21671
|
+
return {
|
|
21672
|
+
chart: {
|
|
21673
|
+
type: 'pie',
|
|
21674
|
+
backgroundColor: 'transparent',
|
|
21675
|
+
width: width,
|
|
21676
|
+
height: height,
|
|
21677
|
+
style: {
|
|
21678
|
+
fontFamily: fontFamily
|
|
21679
|
+
}
|
|
21680
|
+
},
|
|
21681
|
+
title: {
|
|
21682
|
+
text: undefined
|
|
21683
|
+
},
|
|
21684
|
+
tooltip: {
|
|
21685
|
+
pointFormat: '<span><b>{point.y}</b> ({point.percentage:.1f}%)</span>',
|
|
21686
|
+
style: {
|
|
21687
|
+
fontFamily: fontFamily,
|
|
21688
|
+
fontSize: '13px'
|
|
21689
|
+
},
|
|
21690
|
+
useHTML: true
|
|
21691
|
+
},
|
|
21692
|
+
plotOptions: {
|
|
21693
|
+
pie: {
|
|
21694
|
+
size: size,
|
|
21695
|
+
allowPointSelect: true,
|
|
21696
|
+
cursor: 'pointer',
|
|
21697
|
+
dataLabels: {
|
|
21698
|
+
enabled: true,
|
|
21699
|
+
format: '{point.name}<br><b>{point.y}</b> ({point.percentage:.1f}%)',
|
|
21700
|
+
distance: 20,
|
|
21701
|
+
style: {
|
|
21702
|
+
fontSize: '13px',
|
|
21703
|
+
fontWeight: '100',
|
|
21704
|
+
textOutline: 'none',
|
|
21705
|
+
fontFamily: fontFamily
|
|
21706
|
+
},
|
|
21707
|
+
connectorColor: '#666',
|
|
21708
|
+
connectorWidth: 1,
|
|
21709
|
+
overflow: 'allow',
|
|
21710
|
+
crop: false
|
|
21711
|
+
},
|
|
21712
|
+
showInLegend: false
|
|
21713
|
+
}
|
|
21714
|
+
},
|
|
21715
|
+
series: [{
|
|
21716
|
+
type: 'pie',
|
|
21717
|
+
name: '',
|
|
21718
|
+
colorByPoint: true,
|
|
21719
|
+
data: chartData
|
|
21720
|
+
}],
|
|
21721
|
+
credits: {
|
|
21722
|
+
enabled: false
|
|
21723
|
+
},
|
|
21724
|
+
accessibility: {
|
|
21725
|
+
enabled: false
|
|
21726
|
+
}
|
|
21727
|
+
};
|
|
21728
|
+
}, [data, width, height, size, colors]);
|
|
21729
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
21730
|
+
style: styles$6.chartWrapper
|
|
21731
|
+
}, /*#__PURE__*/React$1.createElement("div", {
|
|
21732
|
+
style: {
|
|
21733
|
+
...styles$6.chartContainer,
|
|
21734
|
+
width,
|
|
21735
|
+
height,
|
|
21736
|
+
position: 'relative'
|
|
21737
|
+
}
|
|
21738
|
+
}, noData && /*#__PURE__*/React$1.createElement(CheckerboardBackground, {
|
|
21739
|
+
width: width,
|
|
21740
|
+
height: height
|
|
21741
|
+
}), /*#__PURE__*/React$1.createElement("div", {
|
|
21742
|
+
style: {
|
|
21743
|
+
position: 'relative',
|
|
21744
|
+
zIndex: 1
|
|
21745
|
+
}
|
|
21746
|
+
}, /*#__PURE__*/React$1.createElement(HighchartsReact, {
|
|
21747
|
+
highcharts: Highcharts$1,
|
|
21748
|
+
options: options
|
|
21749
|
+
}))), /*#__PURE__*/React$1.createElement("div", {
|
|
21750
|
+
style: styles$6.agentName
|
|
21751
|
+
}, data.name));
|
|
21752
|
+
};
|
|
21753
|
+
const fontFamily = 'Pretendard, -apple-system, BlinkMacSystemFont, sans-serif';
|
|
21754
|
+
const styles$6 = {
|
|
21755
|
+
chartWrapper: {
|
|
21756
|
+
background: 'transparent',
|
|
21757
|
+
textAlign: 'center',
|
|
21758
|
+
display: 'flex',
|
|
21759
|
+
flexDirection: 'column',
|
|
21760
|
+
justifyContent: 'center',
|
|
21761
|
+
alignItems: 'center'
|
|
21762
|
+
},
|
|
21763
|
+
chartContainer: {
|
|
21764
|
+
display: 'flex',
|
|
21765
|
+
alignItems: 'center',
|
|
21766
|
+
justifyContent: 'center'
|
|
21767
|
+
},
|
|
21768
|
+
agentName: {
|
|
21769
|
+
fontSize: '12px',
|
|
21770
|
+
fontWeight: '100',
|
|
21771
|
+
marginTop: '-30px',
|
|
21772
|
+
color: '#333'
|
|
21773
|
+
}
|
|
21774
|
+
};
|
|
21775
|
+
const CheckerboardBackground = ({
|
|
21776
|
+
width,
|
|
21777
|
+
height
|
|
21778
|
+
}) => {
|
|
21779
|
+
const circleSize = Math.min(width, height) * 0.47;
|
|
21780
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
21781
|
+
style: {
|
|
21782
|
+
position: 'absolute',
|
|
21783
|
+
width: circleSize,
|
|
21784
|
+
height: circleSize,
|
|
21785
|
+
borderRadius: '50%',
|
|
21786
|
+
backgroundImage: `
|
|
21787
|
+
linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
|
|
21788
|
+
linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
|
|
21789
|
+
linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
|
|
21790
|
+
linear-gradient(-45deg, transparent 75%, #e0e0e0 75%)
|
|
21791
|
+
`,
|
|
21792
|
+
backgroundSize: '10px 10px',
|
|
21793
|
+
backgroundPosition: '0 0, 0 5px, 5px -5px, -5px 0px',
|
|
21794
|
+
backgroundColor: '#ffffff',
|
|
21795
|
+
zIndex: 0
|
|
21796
|
+
}
|
|
21797
|
+
});
|
|
21798
|
+
};
|
|
21799
|
+
const checkerboardPattern = () => ({
|
|
21800
|
+
pattern: {
|
|
21801
|
+
path: {
|
|
21802
|
+
d: 'M 0 0 L 5 5 M 4.5 -0.5 L 5.5 0.5 M -0.5 4.5 L 0.5 5.5',
|
|
21803
|
+
stroke: '#d0d0d0',
|
|
21804
|
+
strokeWidth: 1
|
|
21805
|
+
},
|
|
21806
|
+
width: 5,
|
|
21807
|
+
height: 5,
|
|
21808
|
+
backgroundColor: '#ffffff',
|
|
21809
|
+
opacity: 1
|
|
21810
|
+
}
|
|
21811
|
+
});
|
|
21812
|
+
|
|
21800
21813
|
const PieChartContent = ({
|
|
21801
21814
|
tool
|
|
21802
21815
|
}) => {
|
|
@@ -22196,13 +22209,6 @@ const styles$1 = {
|
|
|
22196
22209
|
}
|
|
22197
22210
|
};
|
|
22198
22211
|
|
|
22199
|
-
let globalConfig = {
|
|
22200
|
-
apiUrl: ''
|
|
22201
|
-
};
|
|
22202
|
-
function getConfig() {
|
|
22203
|
-
return globalConfig;
|
|
22204
|
-
}
|
|
22205
|
-
|
|
22206
22212
|
const {
|
|
22207
22213
|
apiUrl
|
|
22208
22214
|
} = getConfig();
|
|
@@ -22327,4 +22333,4 @@ const styles = {
|
|
|
22327
22333
|
}
|
|
22328
22334
|
};
|
|
22329
22335
|
|
|
22330
|
-
export { AiChat, ColumnChart, PieChart, StackedAreaTrendChart };
|
|
22336
|
+
export { AiChat, ColumnChart, PieChart, StackedAreaTrendChart, configure$1 as configure, getConfig };
|