@fluentui/react-charting 5.25.0 → 5.25.1

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.
@@ -10,41 +10,191 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
10
10
  var MIN_ARROW_SIZE = 6;
11
11
  var MAX_ARROW_SIZE = 24;
12
12
  var ARROW_SIZE_SCALE = 0.35;
13
+ var MAX_SIMPLE_MARKUP_DEPTH = 5;
14
+ var CHAR_CODE_LESS_THAN = '<'.codePointAt(0);
15
+ var CHAR_CODE_GREATER_THAN = '>'.codePointAt(0);
13
16
  var getAnnotationKey = function (annotation, index) {
14
17
  var _a, _b;
15
18
  return (_b = (_a = annotation.id) !== null && _a !== void 0 ? _a : (typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined)) !== null && _b !== void 0 ? _b : "annotation-".concat(index);
16
19
  };
17
- var decodeHtmlEntities = function (html, documentRef) {
18
- var _a, _b;
19
- if (!html || html.indexOf('&') === -1) {
20
- return html;
20
+ var decodeSimpleMarkupInput = function (input) {
21
+ var namedEntities = {
22
+ amp: '&',
23
+ quot: '"',
24
+ apos: "'",
25
+ nbsp: '\u00a0',
26
+ };
27
+ var withBasicEntitiesDecoded = input.replace(/&(#x?[0-9a-f]+|#\d+|[a-z][\w-]*);/gi, function (match, entity) {
28
+ var _a;
29
+ var lower = entity.toLowerCase();
30
+ if (lower === 'lt' || lower === 'gt') {
31
+ return "&".concat(lower, ";");
32
+ }
33
+ if (lower.startsWith('#')) {
34
+ var isHex = lower[1] === 'x';
35
+ var digits = lower.slice(isHex ? 2 : 1);
36
+ var codePoint = Number.parseInt(digits, isHex ? 16 : 10);
37
+ if (Number.isNaN(codePoint)) {
38
+ return match;
39
+ }
40
+ if (codePoint === CHAR_CODE_LESS_THAN) {
41
+ return '&lt;';
42
+ }
43
+ if (codePoint === CHAR_CODE_GREATER_THAN) {
44
+ return '&gt;';
45
+ }
46
+ return String.fromCodePoint(codePoint);
47
+ }
48
+ return (_a = namedEntities[lower]) !== null && _a !== void 0 ? _a : match;
49
+ });
50
+ return withBasicEntitiesDecoded.replace(/&lt;([^;]+)&gt;/gi, function (match, inner) {
51
+ var normalized = inner.trim().replace(/\s+/g, ' ');
52
+ var lower = normalized.toLowerCase();
53
+ switch (lower) {
54
+ case 'b':
55
+ return '<b>';
56
+ case '/b':
57
+ return '</b>';
58
+ case 'i':
59
+ return '<i>';
60
+ case '/i':
61
+ return '</i>';
62
+ case 'br':
63
+ case 'br/':
64
+ case 'br /':
65
+ return '<br />';
66
+ default:
67
+ return match;
68
+ }
69
+ });
70
+ };
71
+ var appendTextNode = function (nodes, text) {
72
+ if (text.length === 0) {
73
+ return;
74
+ }
75
+ var last = nodes[nodes.length - 1];
76
+ if (last && last.type === 'text') {
77
+ last.content += text;
21
78
  }
22
- if (!((_a = documentRef === null || documentRef === void 0 ? void 0 : documentRef.implementation) === null || _a === void 0 ? void 0 : _a.createHTMLDocument)) {
23
- return html;
79
+ else {
80
+ nodes.push({ type: 'text', content: text });
24
81
  }
25
- var workingDocument = documentRef.implementation.createHTMLDocument('');
26
- workingDocument.body.innerHTML = html;
27
- return (_b = workingDocument.body.textContent) !== null && _b !== void 0 ? _b : '';
28
82
  };
29
- var sanitizeAnnotationHtml = function (html) {
83
+ var serializeSimpleMarkup = function (nodes) {
84
+ return nodes
85
+ .map(function (node) {
86
+ if (node.type === 'text') {
87
+ return node.content;
88
+ }
89
+ if (node.type === 'br') {
90
+ return '<br />';
91
+ }
92
+ return "<".concat(node.tag, ">").concat(serializeSimpleMarkup(node.children), "</").concat(node.tag, ">");
93
+ })
94
+ .join('');
95
+ };
96
+ var parseSimpleMarkup = function (input) {
30
97
  var _a, _b;
31
- if (!html) {
32
- return '';
98
+ if (!input) {
99
+ return [];
33
100
  }
34
- if (typeof window === 'undefined' || !((_b = (_a = window.document) === null || _a === void 0 ? void 0 : _a.implementation) === null || _b === void 0 ? void 0 : _b.createHTMLDocument)) {
35
- return html;
101
+ var decodedInput = decodeSimpleMarkupInput(input);
102
+ var rootChildren = [];
103
+ var stack = [{ node: null }];
104
+ var currentChildren = function () { var _a, _b; return (_b = (_a = stack[stack.length - 1].node) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : rootChildren; };
105
+ var tagRegex = /<\/?([a-z]+)\s*\/?\s*>/gi;
106
+ var lastIndex = 0;
107
+ var match;
108
+ while ((match = tagRegex.exec(decodedInput)) !== null) {
109
+ var fullMatch = match[0], rawTagName = match[1];
110
+ var tagName = rawTagName.toLowerCase();
111
+ var isClosing = fullMatch.startsWith('</');
112
+ var isSelfClosing = /\/\s*>$/.test(fullMatch);
113
+ appendTextNode(currentChildren(), decodedInput.slice(lastIndex, match.index));
114
+ lastIndex = match.index + fullMatch.length;
115
+ if (tagName === 'br' && !isClosing) {
116
+ currentChildren().push({ type: 'br' });
117
+ continue;
118
+ }
119
+ if ((tagName === 'b' || tagName === 'i') && !isSelfClosing) {
120
+ if (isClosing) {
121
+ var top_1 = stack[stack.length - 1].node;
122
+ if (stack.length > 1 && (top_1 === null || top_1 === void 0 ? void 0 : top_1.tag) === tagName) {
123
+ stack.pop();
124
+ }
125
+ else {
126
+ appendTextNode(currentChildren(), fullMatch);
127
+ }
128
+ }
129
+ else {
130
+ if (stack.length - 1 >= MAX_SIMPLE_MARKUP_DEPTH) {
131
+ appendTextNode(currentChildren(), fullMatch);
132
+ continue;
133
+ }
134
+ var elementNode = {
135
+ type: 'element',
136
+ tag: tagName,
137
+ children: [],
138
+ };
139
+ currentChildren().push(elementNode);
140
+ stack.push({ node: elementNode });
141
+ }
142
+ continue;
143
+ }
144
+ appendTextNode(currentChildren(), fullMatch);
36
145
  }
37
- var workingDocument = window.document.implementation.createHTMLDocument('');
38
- workingDocument.body.innerHTML = decodeHtmlEntities(html, window.document);
39
- workingDocument.body.querySelectorAll('script, iframe, object, embed, link').forEach(function (node) { return node.remove(); });
40
- workingDocument.body.querySelectorAll('*').forEach(function (node) {
41
- Array.from(node.attributes).forEach(function (attr) {
42
- if (/^on/i.test(attr.name)) {
43
- node.removeAttribute(attr.name);
146
+ appendTextNode(currentChildren(), decodedInput.slice(lastIndex));
147
+ while (stack.length > 1) {
148
+ var unclosed = stack.pop();
149
+ var elementNode = unclosed.node;
150
+ if (!elementNode) {
151
+ continue;
152
+ }
153
+ var parentChildren = (_b = (_a = stack[stack.length - 1].node) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : rootChildren;
154
+ var lastChild = parentChildren[parentChildren.length - 1];
155
+ if (lastChild === elementNode) {
156
+ parentChildren.pop();
157
+ }
158
+ else {
159
+ var nodeIndex = parentChildren.indexOf(elementNode);
160
+ if (nodeIndex !== -1) {
161
+ parentChildren.splice(nodeIndex, 1);
44
162
  }
45
- });
163
+ }
164
+ appendTextNode(parentChildren, "<".concat(elementNode.tag, ">").concat(serializeSimpleMarkup(elementNode.children), "</").concat(elementNode.tag, ">"));
165
+ }
166
+ return rootChildren;
167
+ };
168
+ var simpleMarkupNodesToPlainText = function (nodes) {
169
+ return nodes
170
+ .map(function (node) {
171
+ if (node.type === 'text') {
172
+ return node.content;
173
+ }
174
+ if (node.type === 'br') {
175
+ return '\n';
176
+ }
177
+ return simpleMarkupNodesToPlainText(node.children);
178
+ })
179
+ .join('');
180
+ };
181
+ var renderSimpleMarkupNodeList = function (nodes, keyPrefix) {
182
+ return nodes.map(function (node, index) {
183
+ var key = "".concat(keyPrefix, "-").concat(index);
184
+ if (node.type === 'text') {
185
+ return React.createElement(React.Fragment, { key: key }, node.content);
186
+ }
187
+ if (node.type === 'br') {
188
+ return React.createElement("br", { key: key });
189
+ }
190
+ var Tag = node.tag === 'b' ? 'strong' : 'em';
191
+ return React.createElement.apply(React, tslib_1.__spreadArray([Tag, { key: key }], renderSimpleMarkupNodeList(node.children, key), false));
46
192
  });
47
- return workingDocument.body.innerHTML;
193
+ };
194
+ var renderSimpleMarkup = function (nodes, keyPrefix) {
195
+ var _a;
196
+ var rendered = renderSimpleMarkupNodeList(nodes, keyPrefix);
197
+ return rendered.length <= 1 ? (_a = rendered[0]) !== null && _a !== void 0 ? _a : null : rendered;
48
198
  };
49
199
  var normalizeBandOffset = function (scale, value) {
50
200
  var position = scale === null || scale === void 0 ? void 0 : scale(value);
@@ -57,9 +207,9 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
57
207
  return position;
58
208
  };
59
209
  var clamp = function (value, min, max) { return Math.max(min, Math.min(max, value)); };
60
- var createMeasurementSignature = function (annotationHtml, containerStyle, contentStyle, layoutClassName, styleClassName) {
210
+ var createMeasurementSignature = function (annotationContentSignature, containerStyle, contentStyle, layoutClassName, styleClassName) {
61
211
  return JSON.stringify({
62
- annotationHtml: annotationHtml,
212
+ annotationContentSignature: annotationContentSignature,
63
213
  containerStyle: containerStyle,
64
214
  contentStyle: contentStyle,
65
215
  layoutClassName: layoutClassName !== null && layoutClassName !== void 0 ? layoutClassName : '',
@@ -187,28 +337,31 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
187
337
  if (!resolved) {
188
338
  return;
189
339
  }
190
- var annotationHtml = sanitizeAnnotationHtml((_b = annotation.text) !== null && _b !== void 0 ? _b : '');
340
+ var rawAnnotationText = annotation.text === undefined || annotation.text === null ? '' : String(annotation.text);
341
+ var annotationMarkupNodes = parseSimpleMarkup(rawAnnotationText);
342
+ var annotationMarkupSignature = JSON.stringify(annotationMarkupNodes);
343
+ var annotationPlainText = simpleMarkupNodesToPlainText(annotationMarkupNodes);
191
344
  var layout = annotation.layout;
192
- var horizontalAlign = (_c = layout === null || layout === void 0 ? void 0 : layout.align) !== null && _c !== void 0 ? _c : DEFAULT_HORIZONTAL_ALIGN;
193
- var verticalAlign = (_d = layout === null || layout === void 0 ? void 0 : layout.verticalAlign) !== null && _d !== void 0 ? _d : DEFAULT_VERTICAL_ALIGN;
194
- var backgroundOpacity = (_f = (_e = annotation.style) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : ChartAnnotationLayer_styles_1.DEFAULT_ANNOTATION_BACKGROUND_OPACITY;
195
- var baseBackgroundColor = (_h = (_g = annotation.style) === null || _g === void 0 ? void 0 : _g.backgroundColor) !== null && _h !== void 0 ? _h : theme.semanticColors.bodyBackground;
196
- var hasCustomBackground = ((_j = annotation.style) === null || _j === void 0 ? void 0 : _j.backgroundColor) !== undefined || ((_k = annotation.style) === null || _k === void 0 ? void 0 : _k.opacity) !== undefined;
345
+ var horizontalAlign = (_b = layout === null || layout === void 0 ? void 0 : layout.align) !== null && _b !== void 0 ? _b : DEFAULT_HORIZONTAL_ALIGN;
346
+ var verticalAlign = (_c = layout === null || layout === void 0 ? void 0 : layout.verticalAlign) !== null && _c !== void 0 ? _c : DEFAULT_VERTICAL_ALIGN;
347
+ var backgroundOpacity = (_e = (_d = annotation.style) === null || _d === void 0 ? void 0 : _d.opacity) !== null && _e !== void 0 ? _e : ChartAnnotationLayer_styles_1.DEFAULT_ANNOTATION_BACKGROUND_OPACITY;
348
+ var baseBackgroundColor = (_g = (_f = annotation.style) === null || _f === void 0 ? void 0 : _f.backgroundColor) !== null && _g !== void 0 ? _g : theme.semanticColors.bodyBackground;
349
+ var hasCustomBackground = ((_h = annotation.style) === null || _h === void 0 ? void 0 : _h.backgroundColor) !== undefined || ((_j = annotation.style) === null || _j === void 0 ? void 0 : _j.opacity) !== undefined;
197
350
  var containerStyle = tslib_1.__assign(tslib_1.__assign({ maxWidth: layout === null || layout === void 0 ? void 0 : layout.maxWidth }, (hasCustomBackground && {
198
351
  backgroundColor: (0, ChartAnnotationLayer_styles_1.applyOpacityToColor)(baseBackgroundColor, backgroundOpacity),
199
- })), { borderColor: (_l = annotation.style) === null || _l === void 0 ? void 0 : _l.borderColor, borderWidth: (_m = annotation.style) === null || _m === void 0 ? void 0 : _m.borderWidth, borderStyle: (_p = (_o = annotation.style) === null || _o === void 0 ? void 0 : _o.borderStyle) !== null && _p !== void 0 ? _p : (((_q = annotation.style) === null || _q === void 0 ? void 0 : _q.borderColor) ? 'solid' : undefined), borderRadius: (_r = annotation.style) === null || _r === void 0 ? void 0 : _r.borderRadius, padding: (_s = annotation.style) === null || _s === void 0 ? void 0 : _s.padding, boxShadow: (_t = annotation.style) === null || _t === void 0 ? void 0 : _t.boxShadow });
352
+ })), { borderColor: (_k = annotation.style) === null || _k === void 0 ? void 0 : _k.borderColor, borderWidth: (_l = annotation.style) === null || _l === void 0 ? void 0 : _l.borderWidth, borderStyle: (_o = (_m = annotation.style) === null || _m === void 0 ? void 0 : _m.borderStyle) !== null && _o !== void 0 ? _o : (((_p = annotation.style) === null || _p === void 0 ? void 0 : _p.borderColor) ? 'solid' : undefined), borderRadius: (_q = annotation.style) === null || _q === void 0 ? void 0 : _q.borderRadius, padding: (_r = annotation.style) === null || _r === void 0 ? void 0 : _r.padding, boxShadow: (_s = annotation.style) === null || _s === void 0 ? void 0 : _s.boxShadow });
200
353
  var contentStyle = {
201
- color: (_u = annotation.style) === null || _u === void 0 ? void 0 : _u.textColor,
202
- fontSize: (_v = annotation.style) === null || _v === void 0 ? void 0 : _v.fontSize,
203
- fontWeight: (_w = annotation.style) === null || _w === void 0 ? void 0 : _w.fontWeight,
354
+ color: (_t = annotation.style) === null || _t === void 0 ? void 0 : _t.textColor,
355
+ fontSize: (_u = annotation.style) === null || _u === void 0 ? void 0 : _u.fontSize,
356
+ fontWeight: (_v = annotation.style) === null || _v === void 0 ? void 0 : _v.fontWeight,
204
357
  opacity: 1,
205
358
  };
206
- var measurementSignature = createMeasurementSignature(annotationHtml, containerStyle, contentStyle, layout === null || layout === void 0 ? void 0 : layout.className, (_x = annotation.style) === null || _x === void 0 ? void 0 : _x.className);
359
+ var measurementSignature = createMeasurementSignature(annotationMarkupSignature, containerStyle, contentStyle, layout === null || layout === void 0 ? void 0 : layout.className, (_w = annotation.style) === null || _w === void 0 ? void 0 : _w.className);
207
360
  var measurementEntry = measurements[key];
208
361
  var isMeasurementValid = (measurementEntry === null || measurementEntry === void 0 ? void 0 : measurementEntry.signature) === measurementSignature;
209
362
  var measuredSize = isMeasurementValid ? measurementEntry : undefined;
210
- var width = Math.max((_z = (_y = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.width) !== null && _y !== void 0 ? _y : layout === null || layout === void 0 ? void 0 : layout.maxWidth) !== null && _z !== void 0 ? _z : DEFAULT_FOREIGN_OBJECT_WIDTH, 1);
211
- var height = Math.max((_0 = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.height) !== null && _0 !== void 0 ? _0 : DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);
363
+ var width = Math.max((_y = (_x = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.width) !== null && _x !== void 0 ? _x : layout === null || layout === void 0 ? void 0 : layout.maxWidth) !== null && _y !== void 0 ? _y : DEFAULT_FOREIGN_OBJECT_WIDTH, 1);
364
+ var height = Math.max((_z = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.height) !== null && _z !== void 0 ? _z : DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);
212
365
  var offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;
213
366
  var offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;
214
367
  var baseTopLeftX = resolved.point.x + offsetX;
@@ -216,8 +369,8 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
216
369
  var usePlotBounds = (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) !== false;
217
370
  var viewportX = usePlotBounds ? context.plotRect.x : 0;
218
371
  var viewportY = usePlotBounds ? context.plotRect.y : 0;
219
- var viewportWidth = usePlotBounds ? context.plotRect.width : (_1 = context.svgRect.width) !== null && _1 !== void 0 ? _1 : 0;
220
- var viewportHeight = usePlotBounds ? context.plotRect.height : (_2 = context.svgRect.height) !== null && _2 !== void 0 ? _2 : 0;
372
+ var viewportWidth = usePlotBounds ? context.plotRect.width : (_0 = context.svgRect.width) !== null && _0 !== void 0 ? _0 : 0;
373
+ var viewportHeight = usePlotBounds ? context.plotRect.height : (_1 = context.svgRect.height) !== null && _1 !== void 0 ? _1 : 0;
221
374
  var maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;
222
375
  var maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;
223
376
  var topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;
@@ -227,8 +380,8 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
227
380
  y: topLeftY - offsetY,
228
381
  };
229
382
  if (annotation.connector) {
230
- var startPadding = (_3 = annotation.connector.startPadding) !== null && _3 !== void 0 ? _3 : 12;
231
- var endPadding = (_4 = annotation.connector.endPadding) !== null && _4 !== void 0 ? _4 : 0;
383
+ var startPadding = (_2 = annotation.connector.startPadding) !== null && _2 !== void 0 ? _2 : 12;
384
+ var endPadding = (_3 = annotation.connector.endPadding) !== null && _3 !== void 0 ? _3 : 0;
232
385
  var minArrowClearance = 6;
233
386
  var minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);
234
387
  var dx = displayPoint.x - resolved.anchor.x;
@@ -263,12 +416,12 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
263
416
  updateMeasurement(key, rect.width, rect.height, measurementSignature);
264
417
  }
265
418
  }
266
- }, className: (0, Utilities_1.css)(classNames.annotation, classNames.measurement, layout === null || layout === void 0 ? void 0 : layout.className, (_5 = annotation.style) === null || _5 === void 0 ? void 0 : _5.className), style: measurementStyle, "aria-hidden": true, "data-annotation-key": key, "data-chart-annotation-measurement": "true" },
267
- React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotationContent, layout === null || layout === void 0 ? void 0 : layout.className, (_6 = annotation.style) === null || _6 === void 0 ? void 0 : _6.className), style: contentStyle, dangerouslySetInnerHTML: { __html: annotationHtml } })));
419
+ }, className: (0, Utilities_1.css)(classNames.annotation, classNames.measurement, layout === null || layout === void 0 ? void 0 : layout.className, (_4 = annotation.style) === null || _4 === void 0 ? void 0 : _4.className), style: measurementStyle, "aria-hidden": true, "data-annotation-key": key, "data-chart-annotation-measurement": "true" },
420
+ React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotationContent, layout === null || layout === void 0 ? void 0 : layout.className, (_5 = annotation.style) === null || _5 === void 0 ? void 0 : _5.className), style: contentStyle }, renderSimpleMarkup(annotationMarkupNodes, "".concat(key, "-measurement")))));
268
421
  }
269
422
  annotationForeignObjects.push(React.createElement("foreignObject", { key: "".concat(key, "-annotation"), x: topLeftX, y: topLeftY, width: width, height: height, className: (0, Utilities_1.css)(classNames.annotationForeignObject), "data-annotation-key": key },
270
- React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotation, layout === null || layout === void 0 ? void 0 : layout.className, (_7 = annotation.style) === null || _7 === void 0 ? void 0 : _7.className), style: containerStyle, "data-annotation-key": key },
271
- React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotationContent, (_8 = annotation.style) === null || _8 === void 0 ? void 0 : _8.className), style: contentStyle, role: (_10 = (_9 = annotation.accessibility) === null || _9 === void 0 ? void 0 : _9.role) !== null && _10 !== void 0 ? _10 : 'note', "aria-label": (_11 = annotation.accessibility) === null || _11 === void 0 ? void 0 : _11.ariaLabel, "aria-describedby": (_12 = annotation.accessibility) === null || _12 === void 0 ? void 0 : _12.ariaDescribedBy, "data-chart-annotation": "true", "data-annotation-key": key, dangerouslySetInnerHTML: { __html: annotationHtml } }))));
423
+ React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotation, layout === null || layout === void 0 ? void 0 : layout.className, (_6 = annotation.style) === null || _6 === void 0 ? void 0 : _6.className), style: containerStyle, "data-annotation-key": key },
424
+ React.createElement("div", { className: (0, Utilities_1.css)(classNames.annotationContent, (_7 = annotation.style) === null || _7 === void 0 ? void 0 : _7.className), style: contentStyle, role: (_9 = (_8 = annotation.accessibility) === null || _8 === void 0 ? void 0 : _8.role) !== null && _9 !== void 0 ? _9 : 'note', "aria-label": (_11 = (_10 = annotation.accessibility) === null || _10 === void 0 ? void 0 : _10.ariaLabel) !== null && _11 !== void 0 ? _11 : (annotationPlainText ? annotationPlainText : undefined), "aria-describedby": (_12 = annotation.accessibility) === null || _12 === void 0 ? void 0 : _12.ariaDescribedBy, "data-chart-annotation": "true", "data-annotation-key": key }, renderSimpleMarkup(annotationMarkupNodes, "".concat(key, "-content"))))));
272
425
  if (annotation.connector) {
273
426
  var _13 = annotation.connector, _14 = _13.startPadding, startPadding = _14 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_START_PADDING : _14, _15 = _13.endPadding, endPadding = _15 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_END_PADDING : _15, _16 = _13.strokeColor, strokeColor = _16 === void 0 ? (0, ChartAnnotationLayer_styles_1.getDefaultConnectorStrokeColor)(theme) : _16, _17 = _13.strokeWidth, strokeWidth = _17 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_STROKE_WIDTH : _17, dashArray = _13.dashArray, _18 = _13.arrow, arrow = _18 === void 0 ? ChartAnnotationLayer_styles_1.DEFAULT_CONNECTOR_ARROW : _18;
274
427
  var dx = resolved.anchor.x - displayPoint.x;
@@ -1 +1 @@
1
- {"version":3,"file":"ChartAnnotationLayer.js","sourceRoot":"../src/","sources":["components/CommonComponents/Annotations/ChartAnnotationLayer.tsx"],"names":[],"mappings":";;;;IAuBA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAAgE,CAAC;IAEzG,IAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC1C,IAAM,sBAAsB,GAAG,QAAQ,CAAC;IACxC,IAAM,4BAA4B,GAAG,GAAG,CAAC;IACzC,IAAM,6BAA6B,GAAG,EAAE,CAAC;IACzC,IAAM,cAAc,GAAG,CAAC,CAAC;IACzB,IAAM,cAAc,GAAG,EAAE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IAEH,4BAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, css, getId } from '@fluentui/react/lib/Utilities';\nimport { IChartAnnotation } from '../../../types/IChartAnnotation';\nimport {\n IAnnotationPoint,\n IChartAnnotationContext,\n IChartAnnotationLayerProps,\n ConnectorRenderData,\n IResolvedAnnotationPosition,\n} from './ChartAnnotationLayer.types';\nimport {\n applyOpacityToColor,\n DEFAULT_ANNOTATION_BACKGROUND_OPACITY,\n DEFAULT_CONNECTOR_ARROW,\n DEFAULT_CONNECTOR_END_PADDING,\n DEFAULT_CONNECTOR_START_PADDING,\n DEFAULT_CONNECTOR_STROKE_WIDTH,\n getDefaultConnectorStrokeColor,\n getStyles,\n IChartAnnotationLayerStyleProps,\n IChartAnnotationLayerStyles,\n} from './ChartAnnotationLayer.styles';\n\nconst getClassNames = classNamesFunction<IChartAnnotationLayerStyleProps, IChartAnnotationLayerStyles>();\n\nconst DEFAULT_HORIZONTAL_ALIGN = 'center';\nconst DEFAULT_VERTICAL_ALIGN = 'middle';\nconst DEFAULT_FOREIGN_OBJECT_WIDTH = 180;\nconst DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;\nconst MIN_ARROW_SIZE = 6;\nconst MAX_ARROW_SIZE = 24;\nconst ARROW_SIZE_SCALE = 0.35;\nconst getAnnotationKey = (annotation: IChartAnnotation, index: number) =>\n annotation.id ??\n (typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined) ??\n `annotation-${index}`;\n\nconst decodeHtmlEntities = (html: string, documentRef: Document): string => {\n if (!html || html.indexOf('&') === -1) {\n return html;\n }\n\n if (!documentRef?.implementation?.createHTMLDocument) {\n return html;\n }\n\n const workingDocument = documentRef.implementation.createHTMLDocument('');\n workingDocument.body.innerHTML = html;\n return workingDocument.body.textContent ?? '';\n};\n\nconst sanitizeAnnotationHtml = (html: string): string => {\n if (!html) {\n return '';\n }\n\n if (typeof window === 'undefined' || !window.document?.implementation?.createHTMLDocument) {\n return html;\n }\n\n const workingDocument = window.document.implementation.createHTMLDocument('');\n workingDocument.body.innerHTML = decodeHtmlEntities(html, window.document);\n\n workingDocument.body.querySelectorAll('script, iframe, object, embed, link').forEach(node => node.remove());\n\n workingDocument.body.querySelectorAll('*').forEach(node => {\n Array.from(node.attributes).forEach(attr => {\n if (/^on/i.test(attr.name)) {\n node.removeAttribute(attr.name);\n }\n });\n });\n\n return workingDocument.body.innerHTML;\n};\n\nconst normalizeBandOffset = (\n scale: (((value: unknown) => number) & { bandwidth?: () => number }) | undefined,\n value: unknown,\n) => {\n const position = scale?.(value as never);\n if (typeof position !== 'number' || Number.isNaN(position)) {\n return undefined;\n }\n if (scale && typeof scale.bandwidth === 'function') {\n return position + scale.bandwidth() / 2;\n }\n return position;\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(max, value));\n\nconst createMeasurementSignature = (\n annotationHtml: string,\n containerStyle: React.CSSProperties,\n contentStyle: React.CSSProperties,\n layoutClassName?: string,\n styleClassName?: string,\n) =>\n JSON.stringify({\n annotationHtml,\n containerStyle,\n contentStyle,\n layoutClassName: layoutClassName ?? '',\n styleClassName: styleClassName ?? '',\n });\n\ntype MeasurementEntry = { width: number; height: number; signature: string };\n\nconst resolveCoordinates = (\n annotation: IChartAnnotation,\n context: IChartAnnotationContext,\n): IResolvedAnnotationPosition | undefined => {\n const { coordinates, layout } = annotation;\n\n if (!coordinates) {\n return undefined;\n }\n\n const offsetX = layout?.offsetX ?? 0;\n const offsetY = layout?.offsetY ?? 0;\n\n const anchor: IAnnotationPoint = { x: 0, y: 0 };\n\n switch (coordinates.type) {\n case 'data': {\n const { x, y, yAxis = 'primary' } = coordinates;\n const xScale = context.xScale;\n const yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;\n if (!xScale || !yScale) {\n return undefined;\n }\n const xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);\n const yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);\n if (typeof xValue !== 'number' || typeof yValue !== 'number') {\n return undefined;\n }\n anchor.x = xValue;\n anchor.y = yValue;\n break;\n }\n case 'relative': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;\n anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;\n break;\n }\n case 'pixel': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + coordinates.x;\n anchor.y = context.plotRect.y + coordinates.y;\n break;\n }\n default:\n return undefined;\n }\n\n let left = anchor.x + offsetX;\n let top = anchor.y + offsetY;\n\n if (layout?.clipToBounds) {\n left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);\n top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);\n }\n\n return {\n anchor,\n point: { x: left, y: top },\n };\n};\n\nexport const ChartAnnotationLayer: React.FC<IChartAnnotationLayerProps> = React.memo(props => {\n const { annotations: annotationsProp, theme, context, className } = props;\n\n const classNames = getClassNames(getStyles, { theme, className });\n const idPrefix = React.useMemo(() => getId('chart-annotation'), []);\n\n const [measurements, setMeasurements] = React.useState<Record<string, MeasurementEntry>>({});\n\n const resolvedAnnotations = React.useMemo(\n () =>\n (annotationsProp ?? []).map((annotation, index) => ({ annotation, key: getAnnotationKey(annotation, index) })),\n [annotationsProp],\n );\n\n React.useEffect(() => {\n setMeasurements(prev => {\n if (resolvedAnnotations.length === 0) {\n if (Object.keys(prev).length === 0) {\n return prev;\n }\n return {} as Record<string, MeasurementEntry>;\n }\n\n const next: Record<string, MeasurementEntry> = {};\n resolvedAnnotations.forEach(({ key }) => {\n if (prev[key]) {\n next[key] = prev[key];\n }\n });\n\n if (Object.keys(next).length === Object.keys(prev).length) {\n let identical = true;\n for (const key of Object.keys(next)) {\n if (next[key] !== prev[key]) {\n identical = false;\n break;\n }\n }\n if (identical) {\n return prev;\n }\n }\n\n return next;\n });\n }, [resolvedAnnotations]);\n\n const updateMeasurement = React.useCallback((key: string, width: number, height: number, signature: string) => {\n setMeasurements(prev => {\n const prevEntry = prev[key];\n if (\n prevEntry &&\n prevEntry.signature === signature &&\n Math.abs(prevEntry.width - width) < 0.5 &&\n Math.abs(prevEntry.height - height) < 0.5\n ) {\n return prev;\n }\n\n if (width === 0 && height === 0) {\n return prev;\n }\n\n return {\n ...prev,\n [key]: { width, height, signature },\n };\n });\n }, []);\n\n const annotationForeignObjects: React.ReactNode[] = [];\n const measurementElements: React.ReactNode[] = [];\n const connectors: ConnectorRenderData[] = [];\n\n resolvedAnnotations.forEach(({ annotation, key }) => {\n const resolved = resolveCoordinates(annotation, context);\n if (!resolved) {\n return;\n }\n\n const annotationHtml = sanitizeAnnotationHtml(annotation.text ?? '');\n\n const layout = annotation.layout;\n const horizontalAlign = layout?.align ?? DEFAULT_HORIZONTAL_ALIGN;\n const verticalAlign = layout?.verticalAlign ?? DEFAULT_VERTICAL_ALIGN;\n const backgroundOpacity = annotation.style?.opacity ?? DEFAULT_ANNOTATION_BACKGROUND_OPACITY;\n const baseBackgroundColor = annotation.style?.backgroundColor ?? theme.semanticColors.bodyBackground;\n const hasCustomBackground =\n annotation.style?.backgroundColor !== undefined || annotation.style?.opacity !== undefined;\n\n const containerStyle: React.CSSProperties = {\n maxWidth: layout?.maxWidth,\n ...(hasCustomBackground && {\n backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity),\n }),\n borderColor: annotation.style?.borderColor,\n borderWidth: annotation.style?.borderWidth,\n borderStyle: annotation.style?.borderStyle ?? (annotation.style?.borderColor ? 'solid' : undefined),\n borderRadius: annotation.style?.borderRadius,\n padding: annotation.style?.padding,\n boxShadow: annotation.style?.boxShadow,\n };\n\n const contentStyle: React.CSSProperties = {\n color: annotation.style?.textColor,\n fontSize: annotation.style?.fontSize,\n fontWeight: annotation.style?.fontWeight,\n opacity: 1,\n };\n\n const measurementSignature = createMeasurementSignature(\n annotationHtml,\n containerStyle,\n contentStyle,\n layout?.className,\n annotation.style?.className,\n );\n const measurementEntry = measurements[key];\n const isMeasurementValid = measurementEntry?.signature === measurementSignature;\n const measuredSize = isMeasurementValid ? measurementEntry : undefined;\n const width = Math.max(measuredSize?.width ?? layout?.maxWidth ?? DEFAULT_FOREIGN_OBJECT_WIDTH, 1);\n const height = Math.max(measuredSize?.height ?? DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);\n\n const offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;\n const offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;\n\n const baseTopLeftX = resolved.point.x + offsetX;\n const baseTopLeftY = resolved.point.y + offsetY;\n\n const usePlotBounds = layout?.clipToBounds !== false;\n const viewportX = usePlotBounds ? context.plotRect.x : 0;\n const viewportY = usePlotBounds ? context.plotRect.y : 0;\n const viewportWidth = usePlotBounds ? context.plotRect.width : context.svgRect.width ?? 0;\n const viewportHeight = usePlotBounds ? context.plotRect.height : context.svgRect.height ?? 0;\n\n const maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;\n const maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;\n\n let topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;\n let topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;\n\n let displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n\n if (annotation.connector) {\n const startPadding = annotation.connector.startPadding ?? 12;\n const endPadding = annotation.connector.endPadding ?? 0;\n const minArrowClearance = 6;\n const minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);\n\n const dx = displayPoint.x - resolved.anchor.x;\n const dy = displayPoint.y - resolved.anchor.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (distance < minDistance) {\n const fallbackDirection: IAnnotationPoint = { x: 0, y: -1 };\n const ux = distance === 0 ? fallbackDirection.x : dx / distance;\n const uy = distance === 0 ? fallbackDirection.y : dy / distance;\n\n const desiredDisplayX = resolved.anchor.x + ux * minDistance;\n const desiredDisplayY = resolved.anchor.y + uy * minDistance;\n\n let desiredTopLeftX = desiredDisplayX + offsetX;\n let desiredTopLeftY = desiredDisplayY + offsetY;\n\n desiredTopLeftX =\n viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;\n desiredTopLeftY =\n viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;\n\n topLeftX = desiredTopLeftX;\n topLeftY = desiredTopLeftY;\n displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n }\n }\n\n const measurementStyle: React.CSSProperties = {\n left: topLeftX,\n top: topLeftY,\n pointerEvents: 'none',\n ...containerStyle,\n };\n\n if (!isMeasurementValid) {\n measurementElements.push(\n <div\n key={`${key}-measurement`}\n ref={node => {\n if (node) {\n const rect = node.getBoundingClientRect();\n if (rect.width !== 0 || rect.height !== 0) {\n updateMeasurement(key, rect.width, rect.height, measurementSignature);\n }\n }\n }}\n className={css(classNames.annotation, classNames.measurement, layout?.className, annotation.style?.className)}\n style={measurementStyle}\n aria-hidden={true}\n data-annotation-key={key}\n data-chart-annotation-measurement=\"true\"\n >\n {/* eslint-disable-next-line react/no-danger -- content sanitized via sanitizeAnnotationHtml */}\n <div\n className={css(classNames.annotationContent, layout?.className, annotation.style?.className)}\n style={contentStyle}\n dangerouslySetInnerHTML={{ __html: annotationHtml }}\n />\n </div>,\n );\n }\n\n annotationForeignObjects.push(\n <foreignObject\n key={`${key}-annotation`}\n x={topLeftX}\n y={topLeftY}\n width={width}\n height={height}\n className={css(classNames.annotationForeignObject)}\n data-annotation-key={key}\n >\n <div\n className={css(classNames.annotation, layout?.className, annotation.style?.className)}\n style={containerStyle}\n data-annotation-key={key}\n >\n {/* eslint-disable-next-line react/no-danger -- content sanitized via sanitizeAnnotationHtml */}\n <div\n className={css(classNames.annotationContent, annotation.style?.className)}\n style={contentStyle}\n role={annotation.accessibility?.role ?? 'note'}\n aria-label={annotation.accessibility?.ariaLabel}\n aria-describedby={annotation.accessibility?.ariaDescribedBy}\n data-chart-annotation=\"true\"\n data-annotation-key={key}\n dangerouslySetInnerHTML={{ __html: annotationHtml }}\n />\n </div>\n </foreignObject>,\n );\n\n if (annotation.connector) {\n const {\n startPadding = DEFAULT_CONNECTOR_START_PADDING,\n endPadding = DEFAULT_CONNECTOR_END_PADDING,\n strokeColor = getDefaultConnectorStrokeColor(theme),\n strokeWidth = DEFAULT_CONNECTOR_STROKE_WIDTH,\n dashArray,\n arrow = DEFAULT_CONNECTOR_ARROW,\n } = annotation.connector;\n\n const dx = resolved.anchor.x - displayPoint.x;\n const dy = resolved.anchor.y - displayPoint.y;\n const distance = Math.sqrt(dx * dx + dy * dy) || 1;\n const ux = dx / distance;\n const uy = dy / distance;\n\n const sizeBasis = Math.max(1, Math.min(width, height));\n const proportionalSize = sizeBasis * ARROW_SIZE_SCALE;\n const maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;\n const maxByDistance = distance * 0.6;\n const markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));\n const markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);\n\n const start: IAnnotationPoint = {\n x: displayPoint.x + ux * startPadding,\n y: displayPoint.y + uy * startPadding,\n };\n\n const end: IAnnotationPoint = {\n x: resolved.anchor.x - ux * endPadding,\n y: resolved.anchor.y - uy * endPadding,\n };\n\n connectors.push({\n key: `${key}-connector`,\n start,\n end,\n strokeColor,\n strokeWidth,\n dashArray,\n arrow,\n markerSize,\n markerStrokeWidth,\n });\n }\n });\n\n if (annotationForeignObjects.length === 0 && connectors.length === 0) {\n return null;\n }\n\n const viewBoxWidth = context.svgRect.width || 1;\n const viewBoxHeight = context.svgRect.height || 1;\n\n const markerDefs: React.ReactNode[] = [];\n\n const createMarkerId = (color: string, position: 'start' | 'end', size: number, markerStrokeWidth: number) => {\n const id = `${idPrefix}-${position}-${markerDefs.length}`;\n const refY = size / 2;\n const refX = position === 'end' ? size : 0;\n const pathEnd = `M0 0 L ${size} ${refY} L0 ${size} Z`;\n const pathStart = `M ${size} 0 L0 ${refY} L ${size} ${size} Z`;\n const path = position === 'end' ? pathEnd : pathStart;\n\n markerDefs.push(\n <marker\n key={id}\n id={id}\n markerWidth={size}\n markerHeight={size}\n viewBox={`0 0 ${size} ${size}`}\n refX={refX}\n refY={refY}\n orient=\"auto\"\n markerUnits=\"userSpaceOnUse\"\n >\n <path\n d={path}\n fill={color}\n stroke={color}\n strokeWidth={markerStrokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </marker>,\n );\n\n return id;\n };\n\n const connectorElements = connectors.map(connector => {\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n\n if (connector.arrow === 'start' || connector.arrow === 'both') {\n markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);\n }\n if (connector.arrow === 'end' || connector.arrow === 'both') {\n markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);\n }\n\n return (\n <line\n key={connector.key}\n x1={connector.start.x}\n y1={connector.start.y}\n x2={connector.end.x}\n y2={connector.end.y}\n stroke={connector.strokeColor}\n strokeWidth={connector.strokeWidth}\n strokeDasharray={connector.dashArray}\n strokeLinecap=\"round\"\n markerStart={markerStart ? `url(#${markerStart})` : undefined}\n markerEnd={markerEnd ? `url(#${markerEnd})` : undefined}\n />\n );\n });\n\n const shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;\n return (\n <div className={classNames.root} role=\"presentation\" data-chart-annotation-layer=\"true\">\n {shouldRenderSvg && (\n <svg\n className={classNames.connectorLayer}\n width=\"100%\"\n height=\"100%\"\n viewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}\n preserveAspectRatio=\"none\"\n data-chart-annotation-svg=\"true\"\n >\n {markerDefs.length > 0 && <defs>{markerDefs}</defs>}\n {connectorElements.length > 0 && (\n <g aria-hidden=\"true\" className={classNames.connectorGroup}>\n {connectorElements}\n </g>\n )}\n {annotationForeignObjects}\n </svg>\n )}\n {measurementElements}\n </div>\n );\n});\n\nChartAnnotationLayer.displayName = 'ChartAnnotationLayer';\n"]}
1
+ {"version":3,"file":"ChartAnnotationLayer.js","sourceRoot":"../src/","sources":["components/CommonComponents/Annotations/ChartAnnotationLayer.tsx"],"names":[],"mappings":";;;;IAuBA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAAgE,CAAC;IAEzG,IAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC1C,IAAM,sBAAsB,GAAG,QAAQ,CAAC;IACxC,IAAM,4BAA4B,GAAG,GAAG,CAAC;IACzC,IAAM,6BAA6B,GAAG,EAAE,CAAC;IACzC,IAAM,cAAc,GAAG,CAAC,CAAC;IACzB,IAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,IAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAM,uBAAuB,GAAG,CAAC,CAAC;IAClC,IAAM,mBAAmB,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC;IAChD,IAAM,sBAAsB,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC;IACnD,IAAM,gBAAgB,GAAG,UAAC,UAA4B,EAAE,KAAa;;QACnE,OAAA,MAAA,MAAA,UAAU,CAAC,EAAE,mCACb,CAAC,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,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,CAAC,EACnB,MAAM,EAAE,SAAS,CAAC,WAAW,EAC7B,WAAW,EAAE,SAAS,CAAC,WAAW,EAClC,eAAe,EAAE,SAAS,CAAC,SAAS,EACpC,aAAa,EAAC,OAAO,EACrB,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,eAAQ,WAAW,MAAG,CAAC,CAAC,CAAC,SAAS,EAC7D,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,eAAQ,SAAS,MAAG,CAAC,CAAC,CAAC,SAAS,GACvD,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,IAAM,eAAe,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC;QACrF,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAC,cAAc,iCAA6B,MAAM;YACpF,eAAe,IAAI,CAClB,6BACE,SAAS,EAAE,UAAU,CAAC,cAAc,EACpC,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,OAAO,EAAE,cAAO,YAAY,cAAI,aAAa,CAAE,EAC/C,mBAAmB,EAAC,MAAM,+BACA,MAAM;gBAE/B,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,kCAAO,UAAU,CAAQ;gBAClD,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,0CAAe,MAAM,EAAC,SAAS,EAAE,UAAU,CAAC,cAAc,IACvD,iBAAiB,CAChB,CACL;gBACA,wBAAwB,CACrB,CACP;YACA,mBAAmB,CAChB,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,4BAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, css, getId } from '@fluentui/react/lib/Utilities';\nimport { IChartAnnotation } from '../../../types/IChartAnnotation';\nimport {\n IAnnotationPoint,\n IChartAnnotationContext,\n IChartAnnotationLayerProps,\n ConnectorRenderData,\n IResolvedAnnotationPosition,\n} from './ChartAnnotationLayer.types';\nimport {\n applyOpacityToColor,\n DEFAULT_ANNOTATION_BACKGROUND_OPACITY,\n DEFAULT_CONNECTOR_ARROW,\n DEFAULT_CONNECTOR_END_PADDING,\n DEFAULT_CONNECTOR_START_PADDING,\n DEFAULT_CONNECTOR_STROKE_WIDTH,\n getDefaultConnectorStrokeColor,\n getStyles,\n IChartAnnotationLayerStyleProps,\n IChartAnnotationLayerStyles,\n} from './ChartAnnotationLayer.styles';\n\nconst getClassNames = classNamesFunction<IChartAnnotationLayerStyleProps, IChartAnnotationLayerStyles>();\n\nconst DEFAULT_HORIZONTAL_ALIGN = 'center';\nconst DEFAULT_VERTICAL_ALIGN = 'middle';\nconst DEFAULT_FOREIGN_OBJECT_WIDTH = 180;\nconst DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;\nconst MIN_ARROW_SIZE = 6;\nconst MAX_ARROW_SIZE = 24;\nconst ARROW_SIZE_SCALE = 0.35;\nconst MAX_SIMPLE_MARKUP_DEPTH = 5;\nconst CHAR_CODE_LESS_THAN = '<'.codePointAt(0)!;\nconst CHAR_CODE_GREATER_THAN = '>'.codePointAt(0)!;\nconst getAnnotationKey = (annotation: IChartAnnotation, index: number) =>\n annotation.id ??\n (typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined) ??\n `annotation-${index}`;\n\ntype SimpleMarkupNode =\n | { type: 'text'; content: string }\n | { type: 'br' }\n | { type: 'element'; tag: 'b' | 'i'; children: SimpleMarkupNode[] };\n\ntype ElementMarkupNode = Extract<SimpleMarkupNode, { type: 'element' }>;\n\ntype StackFrame = {\n node: ElementMarkupNode | null;\n};\n\nconst decodeSimpleMarkupInput = (input: string): string => {\n const namedEntities: Record<string, string> = {\n amp: '&',\n quot: '\"',\n apos: \"'\",\n nbsp: '\\u00a0',\n };\n\n const withBasicEntitiesDecoded = input.replace(/&(#x?[0-9a-f]+|#\\d+|[a-z][\\w-]*);/gi, (match, entity) => {\n const lower = entity.toLowerCase();\n if (lower === 'lt' || lower === 'gt') {\n return `&${lower};`;\n }\n if (lower.startsWith('#')) {\n const isHex = lower[1] === 'x';\n const digits = lower.slice(isHex ? 2 : 1);\n const codePoint = Number.parseInt(digits, isHex ? 16 : 10);\n if (Number.isNaN(codePoint)) {\n return match;\n }\n if (codePoint === CHAR_CODE_LESS_THAN) {\n return '&lt;';\n }\n if (codePoint === CHAR_CODE_GREATER_THAN) {\n return '&gt;';\n }\n return String.fromCodePoint(codePoint);\n }\n return namedEntities[lower] ?? match;\n });\n\n return withBasicEntitiesDecoded.replace(/&lt;([^;]+)&gt;/gi, (match, inner) => {\n const normalized = inner.trim().replace(/\\s+/g, ' ');\n const lower = normalized.toLowerCase();\n\n switch (lower) {\n case 'b':\n return '<b>';\n case '/b':\n return '</b>';\n case 'i':\n return '<i>';\n case '/i':\n return '</i>';\n case 'br':\n case 'br/':\n case 'br /':\n return '<br />';\n default:\n return match;\n }\n });\n};\n\nconst appendTextNode = (nodes: SimpleMarkupNode[], text: string) => {\n if (text.length === 0) {\n return;\n }\n\n const last = nodes[nodes.length - 1];\n if (last && last.type === 'text') {\n last.content += text;\n } else {\n nodes.push({ type: 'text', content: text });\n }\n};\n\nconst serializeSimpleMarkup = (nodes: SimpleMarkupNode[]): string =>\n nodes\n .map(node => {\n if (node.type === 'text') {\n return node.content;\n }\n if (node.type === 'br') {\n return '<br />';\n }\n return `<${node.tag}>${serializeSimpleMarkup(node.children)}</${node.tag}>`;\n })\n .join('');\n\nconst parseSimpleMarkup = (input: string): SimpleMarkupNode[] => {\n if (!input) {\n return [];\n }\n\n const decodedInput = decodeSimpleMarkupInput(input);\n const rootChildren: SimpleMarkupNode[] = [];\n const stack: StackFrame[] = [{ node: null }];\n const currentChildren = () => stack[stack.length - 1].node?.children ?? rootChildren;\n const tagRegex = /<\\/?([a-z]+)\\s*\\/?\\s*>/gi;\n let lastIndex = 0;\n\n let match: RegExpExecArray | null;\n while ((match = tagRegex.exec(decodedInput)) !== null) {\n const [fullMatch, rawTagName] = match;\n const tagName = rawTagName.toLowerCase();\n const isClosing = fullMatch.startsWith('</');\n const isSelfClosing = /\\/\\s*>$/.test(fullMatch);\n\n appendTextNode(currentChildren(), decodedInput.slice(lastIndex, match.index));\n lastIndex = match.index + fullMatch.length;\n\n if (tagName === 'br' && !isClosing) {\n currentChildren().push({ type: 'br' });\n continue;\n }\n\n if ((tagName === 'b' || tagName === 'i') && !isSelfClosing) {\n if (isClosing) {\n const top = stack[stack.length - 1].node;\n if (stack.length > 1 && top?.tag === tagName) {\n stack.pop();\n } else {\n appendTextNode(currentChildren(), fullMatch);\n }\n } else {\n if (stack.length - 1 >= MAX_SIMPLE_MARKUP_DEPTH) {\n appendTextNode(currentChildren(), fullMatch);\n continue;\n }\n const elementNode: ElementMarkupNode = {\n type: 'element',\n tag: tagName as 'b' | 'i',\n children: [],\n };\n currentChildren().push(elementNode);\n stack.push({ node: elementNode });\n }\n continue;\n }\n\n appendTextNode(currentChildren(), fullMatch);\n }\n\n appendTextNode(currentChildren(), decodedInput.slice(lastIndex));\n\n while (stack.length > 1) {\n const unclosed = stack.pop()!;\n const elementNode = unclosed.node;\n if (!elementNode) {\n continue;\n }\n\n const parentChildren = stack[stack.length - 1].node?.children ?? rootChildren;\n const lastChild = parentChildren[parentChildren.length - 1];\n if (lastChild === elementNode) {\n parentChildren.pop();\n } else {\n const nodeIndex = parentChildren.indexOf(elementNode);\n if (nodeIndex !== -1) {\n parentChildren.splice(nodeIndex, 1);\n }\n }\n\n appendTextNode(\n parentChildren,\n `<${elementNode.tag}>${serializeSimpleMarkup(elementNode.children)}</${elementNode.tag}>`,\n );\n }\n\n return rootChildren;\n};\n\nconst simpleMarkupNodesToPlainText = (nodes: SimpleMarkupNode[]): string =>\n nodes\n .map(node => {\n if (node.type === 'text') {\n return node.content;\n }\n if (node.type === 'br') {\n return '\\n';\n }\n return simpleMarkupNodesToPlainText(node.children);\n })\n .join('');\n\nconst renderSimpleMarkupNodeList = (nodes: SimpleMarkupNode[], keyPrefix: string): React.ReactNode[] =>\n nodes.map((node, index) => {\n const key = `${keyPrefix}-${index}`;\n\n if (node.type === 'text') {\n return <React.Fragment key={key}>{node.content}</React.Fragment>;\n }\n\n if (node.type === 'br') {\n return <br key={key} />;\n }\n\n const Tag = node.tag === 'b' ? 'strong' : 'em';\n return React.createElement(Tag, { key }, ...renderSimpleMarkupNodeList(node.children, key));\n });\n\nconst renderSimpleMarkup = (nodes: SimpleMarkupNode[], keyPrefix: string): React.ReactNode => {\n const rendered = renderSimpleMarkupNodeList(nodes, keyPrefix);\n return rendered.length <= 1 ? rendered[0] ?? null : rendered;\n};\n\nconst normalizeBandOffset = (\n scale: (((value: unknown) => number) & { bandwidth?: () => number }) | undefined,\n value: unknown,\n) => {\n const position = scale?.(value as never);\n if (typeof position !== 'number' || Number.isNaN(position)) {\n return undefined;\n }\n if (scale && typeof scale.bandwidth === 'function') {\n return position + scale.bandwidth() / 2;\n }\n return position;\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(max, value));\n\nconst createMeasurementSignature = (\n annotationContentSignature: string,\n containerStyle: React.CSSProperties,\n contentStyle: React.CSSProperties,\n layoutClassName?: string,\n styleClassName?: string,\n) =>\n JSON.stringify({\n annotationContentSignature,\n containerStyle,\n contentStyle,\n layoutClassName: layoutClassName ?? '',\n styleClassName: styleClassName ?? '',\n });\n\ntype MeasurementEntry = { width: number; height: number; signature: string };\n\nconst resolveCoordinates = (\n annotation: IChartAnnotation,\n context: IChartAnnotationContext,\n): IResolvedAnnotationPosition | undefined => {\n const { coordinates, layout } = annotation;\n\n if (!coordinates) {\n return undefined;\n }\n\n const offsetX = layout?.offsetX ?? 0;\n const offsetY = layout?.offsetY ?? 0;\n\n const anchor: IAnnotationPoint = { x: 0, y: 0 };\n\n switch (coordinates.type) {\n case 'data': {\n const { x, y, yAxis = 'primary' } = coordinates;\n const xScale = context.xScale;\n const yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;\n if (!xScale || !yScale) {\n return undefined;\n }\n const xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);\n const yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);\n if (typeof xValue !== 'number' || typeof yValue !== 'number') {\n return undefined;\n }\n anchor.x = xValue;\n anchor.y = yValue;\n break;\n }\n case 'relative': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;\n anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;\n break;\n }\n case 'pixel': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + coordinates.x;\n anchor.y = context.plotRect.y + coordinates.y;\n break;\n }\n default:\n return undefined;\n }\n\n let left = anchor.x + offsetX;\n let top = anchor.y + offsetY;\n\n if (layout?.clipToBounds) {\n left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);\n top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);\n }\n\n return {\n anchor,\n point: { x: left, y: top },\n };\n};\n\nexport const ChartAnnotationLayer: React.FC<IChartAnnotationLayerProps> = React.memo(props => {\n const { annotations: annotationsProp, theme, context, className } = props;\n\n const classNames = getClassNames(getStyles, { theme, className });\n const idPrefix = React.useMemo(() => getId('chart-annotation'), []);\n\n const [measurements, setMeasurements] = React.useState<Record<string, MeasurementEntry>>({});\n\n const resolvedAnnotations = React.useMemo(\n () =>\n (annotationsProp ?? []).map((annotation, index) => ({ annotation, key: getAnnotationKey(annotation, index) })),\n [annotationsProp],\n );\n\n React.useEffect(() => {\n setMeasurements(prev => {\n if (resolvedAnnotations.length === 0) {\n if (Object.keys(prev).length === 0) {\n return prev;\n }\n return {} as Record<string, MeasurementEntry>;\n }\n\n const next: Record<string, MeasurementEntry> = {};\n resolvedAnnotations.forEach(({ key }) => {\n if (prev[key]) {\n next[key] = prev[key];\n }\n });\n\n if (Object.keys(next).length === Object.keys(prev).length) {\n let identical = true;\n for (const key of Object.keys(next)) {\n if (next[key] !== prev[key]) {\n identical = false;\n break;\n }\n }\n if (identical) {\n return prev;\n }\n }\n\n return next;\n });\n }, [resolvedAnnotations]);\n\n const updateMeasurement = React.useCallback((key: string, width: number, height: number, signature: string) => {\n setMeasurements(prev => {\n const prevEntry = prev[key];\n if (\n prevEntry &&\n prevEntry.signature === signature &&\n Math.abs(prevEntry.width - width) < 0.5 &&\n Math.abs(prevEntry.height - height) < 0.5\n ) {\n return prev;\n }\n\n if (width === 0 && height === 0) {\n return prev;\n }\n\n return {\n ...prev,\n [key]: { width, height, signature },\n };\n });\n }, []);\n\n const annotationForeignObjects: React.ReactNode[] = [];\n const measurementElements: React.ReactNode[] = [];\n const connectors: ConnectorRenderData[] = [];\n\n resolvedAnnotations.forEach(({ annotation, key }) => {\n const resolved = resolveCoordinates(annotation, context);\n if (!resolved) {\n return;\n }\n\n const rawAnnotationText = annotation.text === undefined || annotation.text === null ? '' : String(annotation.text);\n const annotationMarkupNodes = parseSimpleMarkup(rawAnnotationText);\n const annotationMarkupSignature = JSON.stringify(annotationMarkupNodes);\n const annotationPlainText = simpleMarkupNodesToPlainText(annotationMarkupNodes);\n\n const layout = annotation.layout;\n const horizontalAlign = layout?.align ?? DEFAULT_HORIZONTAL_ALIGN;\n const verticalAlign = layout?.verticalAlign ?? DEFAULT_VERTICAL_ALIGN;\n const backgroundOpacity = annotation.style?.opacity ?? DEFAULT_ANNOTATION_BACKGROUND_OPACITY;\n const baseBackgroundColor = annotation.style?.backgroundColor ?? theme.semanticColors.bodyBackground;\n const hasCustomBackground =\n annotation.style?.backgroundColor !== undefined || annotation.style?.opacity !== undefined;\n\n const containerStyle: React.CSSProperties = {\n maxWidth: layout?.maxWidth,\n ...(hasCustomBackground && {\n backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity),\n }),\n borderColor: annotation.style?.borderColor,\n borderWidth: annotation.style?.borderWidth,\n borderStyle: annotation.style?.borderStyle ?? (annotation.style?.borderColor ? 'solid' : undefined),\n borderRadius: annotation.style?.borderRadius,\n padding: annotation.style?.padding,\n boxShadow: annotation.style?.boxShadow,\n };\n\n const contentStyle: React.CSSProperties = {\n color: annotation.style?.textColor,\n fontSize: annotation.style?.fontSize,\n fontWeight: annotation.style?.fontWeight,\n opacity: 1,\n };\n\n const measurementSignature = createMeasurementSignature(\n annotationMarkupSignature,\n containerStyle,\n contentStyle,\n layout?.className,\n annotation.style?.className,\n );\n const measurementEntry = measurements[key];\n const isMeasurementValid = measurementEntry?.signature === measurementSignature;\n const measuredSize = isMeasurementValid ? measurementEntry : undefined;\n const width = Math.max(measuredSize?.width ?? layout?.maxWidth ?? DEFAULT_FOREIGN_OBJECT_WIDTH, 1);\n const height = Math.max(measuredSize?.height ?? DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);\n\n const offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;\n const offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;\n\n const baseTopLeftX = resolved.point.x + offsetX;\n const baseTopLeftY = resolved.point.y + offsetY;\n\n const usePlotBounds = layout?.clipToBounds !== false;\n const viewportX = usePlotBounds ? context.plotRect.x : 0;\n const viewportY = usePlotBounds ? context.plotRect.y : 0;\n const viewportWidth = usePlotBounds ? context.plotRect.width : context.svgRect.width ?? 0;\n const viewportHeight = usePlotBounds ? context.plotRect.height : context.svgRect.height ?? 0;\n\n const maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;\n const maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;\n\n let topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;\n let topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;\n\n let displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n\n if (annotation.connector) {\n const startPadding = annotation.connector.startPadding ?? 12;\n const endPadding = annotation.connector.endPadding ?? 0;\n const minArrowClearance = 6;\n const minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);\n\n const dx = displayPoint.x - resolved.anchor.x;\n const dy = displayPoint.y - resolved.anchor.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (distance < minDistance) {\n const fallbackDirection: IAnnotationPoint = { x: 0, y: -1 };\n const ux = distance === 0 ? fallbackDirection.x : dx / distance;\n const uy = distance === 0 ? fallbackDirection.y : dy / distance;\n\n const desiredDisplayX = resolved.anchor.x + ux * minDistance;\n const desiredDisplayY = resolved.anchor.y + uy * minDistance;\n\n let desiredTopLeftX = desiredDisplayX + offsetX;\n let desiredTopLeftY = desiredDisplayY + offsetY;\n\n desiredTopLeftX =\n viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;\n desiredTopLeftY =\n viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;\n\n topLeftX = desiredTopLeftX;\n topLeftY = desiredTopLeftY;\n displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n }\n }\n\n const measurementStyle: React.CSSProperties = {\n left: topLeftX,\n top: topLeftY,\n pointerEvents: 'none',\n ...containerStyle,\n };\n\n if (!isMeasurementValid) {\n measurementElements.push(\n <div\n key={`${key}-measurement`}\n ref={node => {\n if (node) {\n const rect = node.getBoundingClientRect();\n if (rect.width !== 0 || rect.height !== 0) {\n updateMeasurement(key, rect.width, rect.height, measurementSignature);\n }\n }\n }}\n className={css(classNames.annotation, classNames.measurement, layout?.className, annotation.style?.className)}\n style={measurementStyle}\n aria-hidden={true}\n data-annotation-key={key}\n data-chart-annotation-measurement=\"true\"\n >\n <div\n className={css(classNames.annotationContent, layout?.className, annotation.style?.className)}\n style={contentStyle}\n >\n {renderSimpleMarkup(annotationMarkupNodes, `${key}-measurement`)}\n </div>\n </div>,\n );\n }\n\n annotationForeignObjects.push(\n <foreignObject\n key={`${key}-annotation`}\n x={topLeftX}\n y={topLeftY}\n width={width}\n height={height}\n className={css(classNames.annotationForeignObject)}\n data-annotation-key={key}\n >\n <div\n className={css(classNames.annotation, layout?.className, annotation.style?.className)}\n style={containerStyle}\n data-annotation-key={key}\n >\n <div\n className={css(classNames.annotationContent, annotation.style?.className)}\n style={contentStyle}\n role={annotation.accessibility?.role ?? 'note'}\n aria-label={annotation.accessibility?.ariaLabel ?? (annotationPlainText ? annotationPlainText : undefined)}\n aria-describedby={annotation.accessibility?.ariaDescribedBy}\n data-chart-annotation=\"true\"\n data-annotation-key={key}\n >\n {renderSimpleMarkup(annotationMarkupNodes, `${key}-content`)}\n </div>\n </div>\n </foreignObject>,\n );\n\n if (annotation.connector) {\n const {\n startPadding = DEFAULT_CONNECTOR_START_PADDING,\n endPadding = DEFAULT_CONNECTOR_END_PADDING,\n strokeColor = getDefaultConnectorStrokeColor(theme),\n strokeWidth = DEFAULT_CONNECTOR_STROKE_WIDTH,\n dashArray,\n arrow = DEFAULT_CONNECTOR_ARROW,\n } = annotation.connector;\n\n const dx = resolved.anchor.x - displayPoint.x;\n const dy = resolved.anchor.y - displayPoint.y;\n const distance = Math.sqrt(dx * dx + dy * dy) || 1;\n const ux = dx / distance;\n const uy = dy / distance;\n\n const sizeBasis = Math.max(1, Math.min(width, height));\n const proportionalSize = sizeBasis * ARROW_SIZE_SCALE;\n const maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;\n const maxByDistance = distance * 0.6;\n const markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));\n const markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);\n\n const start: IAnnotationPoint = {\n x: displayPoint.x + ux * startPadding,\n y: displayPoint.y + uy * startPadding,\n };\n\n const end: IAnnotationPoint = {\n x: resolved.anchor.x - ux * endPadding,\n y: resolved.anchor.y - uy * endPadding,\n };\n\n connectors.push({\n key: `${key}-connector`,\n start,\n end,\n strokeColor,\n strokeWidth,\n dashArray,\n arrow,\n markerSize,\n markerStrokeWidth,\n });\n }\n });\n\n if (annotationForeignObjects.length === 0 && connectors.length === 0) {\n return null;\n }\n\n const viewBoxWidth = context.svgRect.width || 1;\n const viewBoxHeight = context.svgRect.height || 1;\n\n const markerDefs: React.ReactNode[] = [];\n\n const createMarkerId = (color: string, position: 'start' | 'end', size: number, markerStrokeWidth: number) => {\n const id = `${idPrefix}-${position}-${markerDefs.length}`;\n const refY = size / 2;\n const refX = position === 'end' ? size : 0;\n const pathEnd = `M0 0 L ${size} ${refY} L0 ${size} Z`;\n const pathStart = `M ${size} 0 L0 ${refY} L ${size} ${size} Z`;\n const path = position === 'end' ? pathEnd : pathStart;\n\n markerDefs.push(\n <marker\n key={id}\n id={id}\n markerWidth={size}\n markerHeight={size}\n viewBox={`0 0 ${size} ${size}`}\n refX={refX}\n refY={refY}\n orient=\"auto\"\n markerUnits=\"userSpaceOnUse\"\n >\n <path\n d={path}\n fill={color}\n stroke={color}\n strokeWidth={markerStrokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </marker>,\n );\n\n return id;\n };\n\n const connectorElements = connectors.map(connector => {\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n\n if (connector.arrow === 'start' || connector.arrow === 'both') {\n markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);\n }\n if (connector.arrow === 'end' || connector.arrow === 'both') {\n markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);\n }\n\n return (\n <line\n key={connector.key}\n x1={connector.start.x}\n y1={connector.start.y}\n x2={connector.end.x}\n y2={connector.end.y}\n stroke={connector.strokeColor}\n strokeWidth={connector.strokeWidth}\n strokeDasharray={connector.dashArray}\n strokeLinecap=\"round\"\n markerStart={markerStart ? `url(#${markerStart})` : undefined}\n markerEnd={markerEnd ? `url(#${markerEnd})` : undefined}\n />\n );\n });\n\n const shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;\n return (\n <div className={classNames.root} role=\"presentation\" data-chart-annotation-layer=\"true\">\n {shouldRenderSvg && (\n <svg\n className={classNames.connectorLayer}\n width=\"100%\"\n height=\"100%\"\n viewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}\n preserveAspectRatio=\"none\"\n data-chart-annotation-svg=\"true\"\n >\n {markerDefs.length > 0 && <defs>{markerDefs}</defs>}\n {connectorElements.length > 0 && (\n <g aria-hidden=\"true\" className={classNames.connectorGroup}>\n {connectorElements}\n </g>\n )}\n {annotationForeignObjects}\n </svg>\n )}\n {measurementElements}\n </div>\n );\n});\n\nChartAnnotationLayer.displayName = 'ChartAnnotationLayer';\n"]}
@@ -251,6 +251,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
251
251
  }
252
252
  return flattened;
253
253
  };
254
+ var encodeHtmlEntities = function (value) {
255
+ return value
256
+ .replace(/&/g, '&amp;')
257
+ .replace(/</g, '&lt;')
258
+ .replace(/>/g, '&gt;')
259
+ .replace(/"/g, '&quot;')
260
+ .replace(/'/g, '&#39;');
261
+ };
254
262
  var toFiniteNumber = function (value) {
255
263
  if (value === undefined || value === null) {
256
264
  return undefined;
@@ -616,10 +624,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
616
624
  return undefined;
617
625
  }
618
626
  var textValue = annotation.text;
619
- var text = textValue === undefined || textValue === null ? '' : String(textValue);
627
+ var rawText = textValue === undefined || textValue === null ? '' : String(textValue);
628
+ var encodedText = encodeHtmlEntities(rawText);
620
629
  var chartAnnotation = {
621
- id: createAnnotationId(text, index),
622
- text: text,
630
+ id: createAnnotationId(encodedText, index),
631
+ text: encodedText,
623
632
  coordinates: coordinates,
624
633
  };
625
634
  var layoutProps = {};