{ "version": 3, "sources": ["../node_modules/@lottiefiles/lottie-player/node_modules/tslib/tslib.es6.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/css-tag.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/reactive-element.js", "../node_modules/@lottiefiles/lottie-player/node_modules/lit-html/lit-html.js", "../node_modules/@lottiefiles/lottie-player/node_modules/lit-element/lit-element.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/custom-element.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/property.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/state.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/base.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/event-options.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/query.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/query-all.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/query-async.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js", "../node_modules/@lottiefiles/lottie-player/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.js", "../node_modules/@lottiefiles/lottie-player/node_modules/lottie-web/build/player/lottie.js", "../node_modules/@lottiefiles/lottie-player/src/lottie-player.styles.ts", "../node_modules/@lottiefiles/lottie-player/src/versions.ts", "../node_modules/@lottiefiles/lottie-player/src/lottie-player.ts", "../node_modules/@lottiefiles/lottie-interactivity/src/lottie-interactivity.js", "../node_modules/css-has-pseudo/src/browser.js", "../modules/esg.superiorenergy.com/esg/site-header/index.js", "../modules/superiorenergy.com/superiorenergy/video-header/default/index.js", "../modules/superiorenergy.com/superiorenergy/tabs/default/index.js", "../modules/superiorenergy.com/core/lottie/index.js", "../modules/esg.superiorenergy.com/esg/accordion/default/index.js", "../node_modules/highcharts/es-modules/Core/Globals.js", "../node_modules/highcharts/es-modules/Core/Utilities.js", "../node_modules/highcharts/es-modules/Core/Chart/ChartDefaults.js", "../node_modules/highcharts/es-modules/Core/Color/Palettes.js", "../node_modules/highcharts/es-modules/Core/Time.js", "../node_modules/highcharts/es-modules/Core/Defaults.js", "../node_modules/highcharts/es-modules/Core/Color/Color.js", "../node_modules/highcharts/es-modules/Core/Animation/Fx.js", "../node_modules/highcharts/es-modules/Core/Animation/AnimationUtilities.js", "../node_modules/highcharts/es-modules/Core/Renderer/HTML/AST.js", "../node_modules/highcharts/es-modules/Core/Templating.js", "../node_modules/highcharts/es-modules/Core/Renderer/RendererRegistry.js", "../node_modules/highcharts/es-modules/Core/Renderer/RendererUtilities.js", "../node_modules/highcharts/es-modules/Core/Renderer/SVG/SVGElement.js", "../node_modules/highcharts/es-modules/Core/Renderer/SVG/SVGLabel.js", "../node_modules/highcharts/es-modules/Core/Renderer/SVG/Symbols.js", "../node_modules/highcharts/es-modules/Core/Renderer/SVG/TextBuilder.js", "../node_modules/highcharts/es-modules/Core/Renderer/SVG/SVGRenderer.js", "../node_modules/highcharts/es-modules/Core/Renderer/HTML/HTMLElement.js", "../node_modules/highcharts/es-modules/Core/Axis/AxisDefaults.js", "../node_modules/highcharts/es-modules/Core/Foundation.js", "../node_modules/highcharts/es-modules/Core/Axis/Tick.js", "../node_modules/highcharts/es-modules/Core/Axis/Axis.js", "../node_modules/highcharts/es-modules/Core/Axis/DateTimeAxis.js", "../node_modules/highcharts/es-modules/Core/Axis/LogarithmicAxis.js", "../node_modules/highcharts/es-modules/Core/Axis/PlotLineOrBand/PlotLineOrBandAxis.js", "../node_modules/highcharts/es-modules/Core/Axis/PlotLineOrBand/PlotLineOrBand.js", "../node_modules/highcharts/es-modules/Core/Tooltip.js", "../node_modules/highcharts/es-modules/Core/Series/Point.js", "../node_modules/highcharts/es-modules/Core/Pointer.js", "../node_modules/highcharts/es-modules/Core/Legend/Legend.js", "../node_modules/highcharts/es-modules/Core/Legend/LegendSymbol.js", "../node_modules/highcharts/es-modules/Core/Series/SeriesDefaults.js", "../node_modules/highcharts/es-modules/Core/Series/SeriesRegistry.js", "../node_modules/highcharts/es-modules/Core/Series/Series.js", "../node_modules/highcharts/es-modules/Core/Chart/Chart.js", "../node_modules/highcharts/es-modules/Extensions/ScrollablePlotArea.js", "../node_modules/highcharts/es-modules/Core/Axis/Stacking/StackItem.js", "../node_modules/highcharts/es-modules/Core/Axis/Stacking/StackingAxis.js", "../node_modules/highcharts/es-modules/Series/Line/LineSeries.js", "../node_modules/highcharts/es-modules/Series/Area/AreaSeries.js", "../node_modules/highcharts/es-modules/Series/Spline/SplineSeries.js", "../node_modules/highcharts/es-modules/Series/AreaSpline/AreaSplineSeries.js", "../node_modules/highcharts/es-modules/Series/Column/ColumnSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/Column/ColumnSeries.js", "../node_modules/highcharts/es-modules/Core/Series/DataLabel.js", "../node_modules/highcharts/es-modules/Series/Column/ColumnDataLabel.js", "../node_modules/highcharts/es-modules/Series/Bar/BarSeries.js", "../node_modules/highcharts/es-modules/Series/Scatter/ScatterSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/Scatter/ScatterSeries.js", "../node_modules/highcharts/es-modules/Series/CenteredUtilities.js", "../node_modules/highcharts/es-modules/Series/Pie/PiePoint.js", "../node_modules/highcharts/es-modules/Series/Pie/PieSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/Pie/PieSeries.js", "../node_modules/highcharts/es-modules/Series/Pie/PieDataLabel.js", "../node_modules/highcharts/es-modules/Extensions/OverlappingDataLabels.js", "../node_modules/highcharts/es-modules/Extensions/BorderRadius.js", "../node_modules/highcharts/es-modules/Core/Responsive.js", "../node_modules/highcharts/es-modules/masters/highcharts.src.js", "../node_modules/highcharts/es-modules/Extensions/Pane/PaneComposition.js", "../node_modules/highcharts/es-modules/Extensions/Pane/PaneDefaults.js", "../node_modules/highcharts/es-modules/Extensions/Pane/Pane.js", "../node_modules/highcharts/es-modules/Series/AreaRange/AreaRangePoint.js", "../node_modules/highcharts/es-modules/Series/AreaRange/AreaRangeSeries.js", "../node_modules/highcharts/es-modules/Series/AreaSplineRange/AreaSplineRangeSeries.js", "../node_modules/highcharts/es-modules/Series/BoxPlot/BoxPlotSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/BoxPlot/BoxPlotSeries.js", "../node_modules/highcharts/es-modules/Series/Bubble/BubbleLegendDefaults.js", "../node_modules/highcharts/es-modules/Series/Bubble/BubbleLegendItem.js", "../node_modules/highcharts/es-modules/Series/Bubble/BubbleLegendComposition.js", "../node_modules/highcharts/es-modules/Series/Bubble/BubblePoint.js", "../node_modules/highcharts/es-modules/Series/Bubble/BubbleSeries.js", "../node_modules/highcharts/es-modules/Series/ColumnRange/ColumnRangePoint.js", "../node_modules/highcharts/es-modules/Series/ColumnRange/ColumnRangeSeries.js", "../node_modules/highcharts/es-modules/Series/ColumnPyramid/ColumnPyramidSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/ColumnPyramid/ColumnPyramidSeries.js", "../node_modules/highcharts/es-modules/Series/ErrorBar/ErrorBarSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/ErrorBar/ErrorBarSeries.js", "../node_modules/highcharts/es-modules/Series/Gauge/GaugePoint.js", "../node_modules/highcharts/es-modules/Series/Gauge/GaugeSeries.js", "../node_modules/highcharts/es-modules/Series/DragNodesComposition.js", "../node_modules/highcharts/es-modules/Series/GraphLayoutComposition.js", "../node_modules/highcharts/es-modules/Series/PackedBubble/PackedBubblePoint.js", "../node_modules/highcharts/es-modules/Series/PackedBubble/PackedBubbleSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/Networkgraph/VerletIntegration.js", "../node_modules/highcharts/es-modules/Series/PackedBubble/PackedBubbleIntegration.js", "../node_modules/highcharts/es-modules/Series/Networkgraph/EulerIntegration.js", "../node_modules/highcharts/es-modules/Series/Networkgraph/QuadTreeNode.js", "../node_modules/highcharts/es-modules/Series/Networkgraph/QuadTree.js", "../node_modules/highcharts/es-modules/Series/Networkgraph/ReingoldFruchtermanLayout.js", "../node_modules/highcharts/es-modules/Series/PackedBubble/PackedBubbleLayout.js", "../node_modules/highcharts/es-modules/Series/SimulationSeriesUtilities.js", "../node_modules/highcharts/es-modules/Series/PackedBubble/PackedBubbleSeries.js", "../node_modules/highcharts/es-modules/Series/Polygon/PolygonSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/Polygon/PolygonSeries.js", "../node_modules/highcharts/es-modules/Core/Axis/RadialAxis.js", "../node_modules/highcharts/es-modules/Series/PolarComposition.js", "../node_modules/highcharts/es-modules/Core/Axis/WaterfallAxis.js", "../node_modules/highcharts/es-modules/Series/Waterfall/WaterfallPoint.js", "../node_modules/highcharts/es-modules/Series/Waterfall/WaterfallSeriesDefaults.js", "../node_modules/highcharts/es-modules/Series/Waterfall/WaterfallSeries.js", "../node_modules/highcharts/es-modules/masters/highcharts-more.src.js", "../node_modules/highcharts/es-modules/Core/HttpUtilities.js", "../node_modules/highcharts/es-modules/Extensions/Data.js", "../node_modules/highcharts/es-modules/masters/modules/data.src.js", "../node_modules/highcharts/es-modules/Core/Chart/ChartNavigationComposition.js", "../node_modules/highcharts/es-modules/Extensions/Exporting/ExportingDefaults.js", "../node_modules/highcharts/es-modules/Extensions/Exporting/ExportingSymbols.js", "../node_modules/highcharts/es-modules/Extensions/Exporting/Fullscreen.js", "../node_modules/highcharts/es-modules/Extensions/Exporting/Exporting.js", "../node_modules/highcharts/es-modules/masters/modules/exporting.src.js", "../node_modules/highcharts/es-modules/Extensions/DownloadURL.js", "../node_modules/highcharts/es-modules/Extensions/OfflineExporting/OfflineExportingDefaults.js", "../node_modules/highcharts/es-modules/Extensions/OfflineExporting/OfflineExporting.js", "../node_modules/highcharts/es-modules/masters/modules/offline-exporting.src.js", "../node_modules/highcharts/es-modules/Extensions/ExportData/ExportDataDefaults.js", "../node_modules/highcharts/es-modules/Extensions/ExportData/ExportData.js", "../node_modules/highcharts/es-modules/masters/modules/export-data.src.js", "../node_modules/highcharts/es-modules/Accessibility/Utils/HTMLUtilities.js", "../node_modules/highcharts/es-modules/Accessibility/A11yI18n.js", "../node_modules/highcharts/es-modules/Accessibility/Utils/ChartUtilities.js", "../node_modules/highcharts/es-modules/Accessibility/Utils/DOMElementProvider.js", "../node_modules/highcharts/es-modules/Accessibility/Utils/EventProvider.js", "../node_modules/highcharts/es-modules/Accessibility/AccessibilityComponent.js", "../node_modules/highcharts/es-modules/Accessibility/KeyboardNavigationHandler.js", "../node_modules/highcharts/es-modules/Accessibility/Components/ContainerComponent.js", "../node_modules/highcharts/es-modules/Accessibility/FocusBorder.js", "../node_modules/highcharts/es-modules/Accessibility/Utils/Announcer.js", "../node_modules/highcharts/es-modules/Accessibility/Components/AnnotationsA11y.js", "../node_modules/highcharts/es-modules/Accessibility/Components/InfoRegionsComponent.js", "../node_modules/highcharts/es-modules/Accessibility/Components/MenuComponent.js", "../node_modules/highcharts/es-modules/Accessibility/KeyboardNavigation.js", "../node_modules/highcharts/es-modules/Accessibility/Components/LegendComponent.js", "../node_modules/highcharts/es-modules/Stock/Navigator/ChartNavigatorComposition.js", "../node_modules/highcharts/es-modules/Core/Axis/NavigatorAxisComposition.js", "../node_modules/highcharts/es-modules/Stock/Navigator/NavigatorDefaults.js", "../node_modules/highcharts/es-modules/Stock/Navigator/NavigatorSymbols.js", "../node_modules/highcharts/es-modules/Stock/Utilities/StockUtilities.js", "../node_modules/highcharts/es-modules/Stock/Navigator/NavigatorComposition.js", "../node_modules/highcharts/es-modules/Core/Axis/ScrollbarAxis.js", "../node_modules/highcharts/es-modules/Stock/Scrollbar/ScrollbarDefaults.js", "../node_modules/highcharts/es-modules/Stock/Scrollbar/Scrollbar.js", "../node_modules/highcharts/es-modules/Stock/Navigator/Navigator.js", "../node_modules/highcharts/es-modules/Accessibility/Components/NavigatorComponent.js", "../node_modules/highcharts/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js", "../node_modules/highcharts/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js", "../node_modules/highcharts/es-modules/Accessibility/ProxyElement.js", "../node_modules/highcharts/es-modules/Accessibility/ProxyProvider.js", "../node_modules/highcharts/es-modules/Accessibility/Components/RangeSelectorComponent.js", "../node_modules/highcharts/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js", "../node_modules/highcharts/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js", "../node_modules/highcharts/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js", "../node_modules/highcharts/es-modules/Accessibility/Components/ZoomComponent.js", "../node_modules/highcharts/es-modules/Accessibility/HighContrastMode.js", "../node_modules/highcharts/es-modules/Accessibility/HighContrastTheme.js", "../node_modules/highcharts/es-modules/Accessibility/Options/A11yDefaults.js", "../node_modules/highcharts/es-modules/Accessibility/Options/LangDefaults.js", "../node_modules/highcharts/es-modules/Accessibility/Options/DeprecatedOptions.js", "../node_modules/highcharts/es-modules/Accessibility/Accessibility.js", "../node_modules/highcharts/es-modules/masters/modules/accessibility.src.js", "../modules/esg.superiorenergy.com/esg/chart/default/index.js", "superiorenergy.com/modals.js", "esg.superiorenergy.com/index.js"], "sourcesContent": ["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n", "/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,e=Symbol(),n=new Map;class s{constructor(t,n){if(this._$cssResult$=!0,n!==e)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t}get styleSheet(){let e=n.get(this.cssText);return t&&void 0===e&&(n.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const o=t=>new s(\"string\"==typeof t?t:t+\"\",e),r=(t,...n)=>{const o=1===t.length?t[0]:n.reduce(((e,n,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(n)+t[s+1]),t[0]);return new s(o,e)},i=(e,n)=>{t?e.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((t=>{const n=document.createElement(\"style\"),s=window.litNonce;void 0!==s&&n.setAttribute(\"nonce\",s),n.textContent=t.cssText,e.appendChild(n)}))},S=t?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const n of t.cssRules)e+=n.cssText;return o(e)})(t):t;export{s as CSSResult,i as adoptStyles,r as css,S as getCompatibleStyle,t as supportsAdoptingStyleSheets,o as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n", "import{getCompatibleStyle as t,adoptStyles as i}from\"./css-tag.js\";export{CSSResult,adoptStyles,css,getCompatibleStyle,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */var s;const e=window.trustedTypes,r=e?e.emptyScript:\"\",h=window.reactiveElementPolyfillSupport,o={toAttribute(t,i){switch(i){case Boolean:t=t?r:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},n=(t,i)=>i!==t&&(i==i||t==t),l={attribute:!0,type:String,converter:o,reflect:!1,hasChanged:n};class a extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var i;null!==(i=this.l)&&void 0!==i||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Eh(s,i);void 0!==e&&(this._$Eu.set(e,s),t.push(e))})),t}static createProperty(t,i=l){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s=\"symbol\"==typeof t?Symbol():\"__\"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l}static finalize(){if(this.hasOwnProperty(\"finalized\"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty(\"properties\")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(t(i))}else void 0!==i&&s.push(t(i));return s}static _$Eh(t,i){const s=i.attribute;return!1===s?void 0:\"string\"==typeof s?s:\"string\"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$Eg)&&void 0!==i?i:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$Eg)||void 0===i||i.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Et.set(i,this[i]),delete this[i])}))}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return i(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$ES(t,i,s=l){var e,r;const h=this.constructor._$Eh(t,s);if(void 0!==h&&!0===s.reflect){const n=(null!==(r=null===(e=s.converter)||void 0===e?void 0:e.toAttribute)&&void 0!==r?r:o.toAttribute)(i,s.type);this._$Ei=t,null==n?this.removeAttribute(h):this.setAttribute(h,n),this._$Ei=null}}_$AK(t,i){var s,e,r;const h=this.constructor,n=h._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=h.getPropertyOptions(n),l=t.converter,a=null!==(r=null!==(e=null===(s=l)||void 0===s?void 0:s.fromAttribute)&&void 0!==e?e:\"function\"==typeof l?l:null)&&void 0!==r?r:o.fromAttribute;this._$Ei=n,this[n]=a(i,t.type),this._$Ei=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||n)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$Ei!==t&&(void 0===this._$E_&&(this._$E_=new Map),this._$E_.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$Ep=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ep}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,i)=>this[i]=t)),this._$Et=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$EU()}catch(t){throw i=!1,this._$EU(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$Eg)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$E_&&(this._$E_.forEach(((t,i)=>this._$ES(i,this[i],t))),this._$E_=void 0),this._$EU()}updated(t){}firstUpdated(t){}}a.finalized=!0,a.elementProperties=new Map,a.elementStyles=[],a.shadowRootOptions={mode:\"open\"},null==h||h({ReactiveElement:a}),(null!==(s=globalThis.reactiveElementVersions)&&void 0!==s?s:globalThis.reactiveElementVersions=[]).push(\"1.2.1\");export{a as ReactiveElement,o as defaultConverter,n as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nvar t;const i=globalThis.trustedTypes,s=i?i.createPolicy(\"lit-html\",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+\"\").slice(9)}$`,o=\"?\"+e,n=`<${o}>`,l=document,h=(t=\"\")=>l.createComment(t),r=t=>null===t||\"object\"!=typeof t&&\"function\"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||\"function\"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \t\\n\f\\r](?:([^\\s\"'>=/]+)([ \t\\n\f\\r]*=[ \t\\n\f\\r]*(?:[^ \t\\n\f\\r\"'`<>=]|(\"|')|))|$)/g,_=/'/g,m=/\"/g,g=/^(?:script|style|textarea)$/i,p=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),$=p(1),y=p(2),b=Symbol.for(\"lit-noChange\"),w=Symbol.for(\"lit-nothing\"),T=new WeakMap,x=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l},A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?\"\":\"\",d=c;for(let i=0;i\"===u[0]?(d=null!=h?h:c,p=-1):void 0===u[1]?p=-2:(p=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'\"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith(\"/>\")?\" \":\"\";r+=d===c?s+n:p>=0?(l.push(o),s.slice(0,p)+\"$lit$\"+s.slice(p)+e+y):s+e+(-2===p?(l.push(void 0),i):y)}const u=r+(t[o]||\"\")+(2===i?\"\":\"\");if(!Array.isArray(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return[void 0!==s?s.createHTML(u):u,l]};class E{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=E.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(l=A.nextNode())&&c.length0){l.textContent=i?i.emptyScript:\"\";for(let i=0;i2||\"\"!==s[0]||\"\"!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=w}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push(\"3.1.2\");export{s as LitElement,r as UpdatingElement,h as _$LE};\n//# sourceMappingURL=lit-element.js.map\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst n=n=>e=>\"function\"==typeof e?((n,e)=>(window.customElements.define(n,e),e))(n,e):((n,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(e){window.customElements.define(n,e)}}})(n,e);export{n as customElement};\n//# sourceMappingURL=custom-element.js.map\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst i=(i,e)=>\"method\"===e.kind&&e.descriptor&&!(\"value\"in e.descriptor)?{...e,finisher(n){n.createProperty(e.key,i)}}:{kind:\"field\",key:Symbol(),placement:\"own\",descriptor:{},originalKey:e.key,initializer(){\"function\"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(n){n.createProperty(e.key,i)}};function e(e){return(n,t)=>void 0!==t?((i,e,n)=>{e.constructor.createProperty(n,i)})(e,n,t):i(e,n)}export{e as property};\n//# sourceMappingURL=property.js.map\n", "import{property as r}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function t(t){return r({...t,state:!0})}export{t as state};\n//# sourceMappingURL=state.js.map\n", "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst e=(e,t,o)=>{Object.defineProperty(t,o,e)},t=(e,t)=>({kind:\"method\",placement:\"prototype\",key:t.key,descriptor:e}),o=({finisher:e,descriptor:t})=>(o,n)=>{var r;if(void 0===n){const n=null!==(r=o.originalKey)&&void 0!==r?r:o.key,i=null!=t?{kind:\"method\",placement:\"prototype\",key:n,descriptor:t(o.key)}:{...o,key:n};return null!=e&&(i.finisher=function(t){e(t,n)}),i}{const r=o.constructor;void 0!==t&&Object.defineProperty(o,n,t(n)),null==e||e(r,n)}};export{o as decorateProperty,e as legacyPrototypeMethod,t as standardPrototypeMethod};\n//# sourceMappingURL=base.js.map\n", "import{decorateProperty as r}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function e(e){return r({finisher:(r,t)=>{Object.assign(r.prototype[t],e)}})}export{e as eventOptions};\n//# sourceMappingURL=event-options.js.map\n", "import{decorateProperty as o}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function i(i,n){return o({descriptor:o=>{const t={get(){var o,n;return null!==(n=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==n?n:null},enumerable:!0,configurable:!0};if(n){const n=\"symbol\"==typeof o?Symbol():\"__\"+o;t.get=function(){var o,t;return void 0===this[n]&&(this[n]=null!==(t=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==t?t:null),this[n]}}return t}})}export{i as query};\n//# sourceMappingURL=query.js.map\n", "import{decorateProperty as r}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function e(e){return r({descriptor:r=>({get(){var r,o;return null!==(o=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelectorAll(e))&&void 0!==o?o:[]},enumerable:!0,configurable:!0})})}export{e as queryAll};\n//# sourceMappingURL=query-all.js.map\n", "import{decorateProperty as r}from\"./base.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nfunction e(e){return r({descriptor:r=>({async get(){var r;return await this.updateComplete,null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(e)},enumerable:!0,configurable:!0})})}export{e as queryAsync};\n//# sourceMappingURL=query-async.js.map\n", "import{decorateProperty as o}from\"./base.js\";\n/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */var n;const e=null!=(null===(n=window.HTMLSlotElement)||void 0===n?void 0:n.prototype.assignedElements)?(o,n)=>o.assignedElements(n):(o,n)=>o.assignedNodes(n).filter((o=>o.nodeType===Node.ELEMENT_NODE));function l(n){const{slot:l,selector:t}=null!=n?n:{};return o({descriptor:o=>({get(){var o;const r=\"slot\"+(l?`[name=${l}]`:\":not([name])\"),i=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(r),s=null!=i?e(i,n):[];return t?s.filter((o=>o.matches(t))):s},enumerable:!0,configurable:!0})})}export{l as queryAssignedElements};\n//# sourceMappingURL=query-assigned-elements.js.map\n", "import{decorateProperty as e}from\"./base.js\";import{queryAssignedElements as t}from\"./query-assigned-elements.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function o(o,n,r){let l,s=o;return\"object\"==typeof o?(s=o.slot,l=o):l={flatten:n},r?t({slot:s,flatten:n,selector:r}):e({descriptor:e=>({get(){var e,t;const o=\"slot\"+(s?`[name=${s}]`:\":not([name])\"),n=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(o);return null!==(t=null==n?void 0:n.assignedNodes(l))&&void 0!==t?t:[]},enumerable:!0,configurable:!0})})}export{o as queryAssignedNodes};\n//# sourceMappingURL=query-assigned-nodes.js.map\n", "(typeof navigator !== \"undefined\") && (function (global, factory) {\r\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\r\n typeof define === 'function' && define.amd ? define(factory) :\r\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.lottie = factory());\r\n})(this, (function () { 'use strict';\r\n\r\n var svgNS = 'http://www.w3.org/2000/svg';\r\n var locationHref = '';\r\n var _useWebWorker = false;\r\n var initialDefaultFrame = -999999;\r\n\r\n var setWebWorker = function setWebWorker(flag) {\r\n _useWebWorker = !!flag;\r\n };\r\n\r\n var getWebWorker = function getWebWorker() {\r\n return _useWebWorker;\r\n };\r\n\r\n var setLocationHref = function setLocationHref(value) {\r\n locationHref = value;\r\n };\r\n\r\n var getLocationHref = function getLocationHref() {\r\n return locationHref;\r\n };\r\n\r\n function createTag(type) {\r\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\r\n return document.createElement(type);\r\n }\r\n\r\n function extendPrototype(sources, destination) {\r\n var i;\r\n var len = sources.length;\r\n var sourcePrototype;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n sourcePrototype = sources[i].prototype;\r\n\r\n for (var attr in sourcePrototype) {\r\n if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr)) destination.prototype[attr] = sourcePrototype[attr];\r\n }\r\n }\r\n }\r\n\r\n function getDescriptor(object, prop) {\r\n return Object.getOwnPropertyDescriptor(object, prop);\r\n }\r\n\r\n function createProxyFunction(prototype) {\r\n function ProxyFunction() {}\r\n\r\n ProxyFunction.prototype = prototype;\r\n return ProxyFunction;\r\n }\r\n\r\n // import Howl from '../../3rd_party/howler';\r\n var audioControllerFactory = function () {\r\n function AudioController(audioFactory) {\r\n this.audios = [];\r\n this.audioFactory = audioFactory;\r\n this._volume = 1;\r\n this._isMuted = false;\r\n }\r\n\r\n AudioController.prototype = {\r\n addAudio: function addAudio(audio) {\r\n this.audios.push(audio);\r\n },\r\n pause: function pause() {\r\n var i;\r\n var len = this.audios.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.audios[i].pause();\r\n }\r\n },\r\n resume: function resume() {\r\n var i;\r\n var len = this.audios.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.audios[i].resume();\r\n }\r\n },\r\n setRate: function setRate(rateValue) {\r\n var i;\r\n var len = this.audios.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.audios[i].setRate(rateValue);\r\n }\r\n },\r\n createAudio: function createAudio(assetPath) {\r\n if (this.audioFactory) {\r\n return this.audioFactory(assetPath);\r\n }\r\n\r\n if (window.Howl) {\r\n return new window.Howl({\r\n src: [assetPath]\r\n });\r\n }\r\n\r\n return {\r\n isPlaying: false,\r\n play: function play() {\r\n this.isPlaying = true;\r\n },\r\n seek: function seek() {\r\n this.isPlaying = false;\r\n },\r\n playing: function playing() {},\r\n rate: function rate() {},\r\n setVolume: function setVolume() {}\r\n };\r\n },\r\n setAudioFactory: function setAudioFactory(audioFactory) {\r\n this.audioFactory = audioFactory;\r\n },\r\n setVolume: function setVolume(value) {\r\n this._volume = value;\r\n\r\n this._updateVolume();\r\n },\r\n mute: function mute() {\r\n this._isMuted = true;\r\n\r\n this._updateVolume();\r\n },\r\n unmute: function unmute() {\r\n this._isMuted = false;\r\n\r\n this._updateVolume();\r\n },\r\n getVolume: function getVolume() {\r\n return this._volume;\r\n },\r\n _updateVolume: function _updateVolume() {\r\n var i;\r\n var len = this.audios.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1));\r\n }\r\n }\r\n };\r\n return function () {\r\n return new AudioController();\r\n };\r\n }();\r\n\r\n var createTypedArray = function () {\r\n function createRegularArray(type, len) {\r\n var i = 0;\r\n var arr = [];\r\n var value;\r\n\r\n switch (type) {\r\n case 'int16':\r\n case 'uint8c':\r\n value = 1;\r\n break;\r\n\r\n default:\r\n value = 1.1;\r\n break;\r\n }\r\n\r\n for (i = 0; i < len; i += 1) {\r\n arr.push(value);\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n function createTypedArrayFactory(type, len) {\r\n if (type === 'float32') {\r\n return new Float32Array(len);\r\n }\r\n\r\n if (type === 'int16') {\r\n return new Int16Array(len);\r\n }\r\n\r\n if (type === 'uint8c') {\r\n return new Uint8ClampedArray(len);\r\n }\r\n\r\n return createRegularArray(type, len);\r\n }\r\n\r\n if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {\r\n return createTypedArrayFactory;\r\n }\r\n\r\n return createRegularArray;\r\n }();\r\n\r\n function createSizedArray(len) {\r\n return Array.apply(null, {\r\n length: len\r\n });\r\n }\r\n\r\n function _typeof$6(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof$6 = function _typeof(obj) { return typeof obj; }; } else { _typeof$6 = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof$6(obj); }\r\n var subframeEnabled = true;\r\n var expressionsPlugin = null;\r\n var expressionsInterfaces = null;\r\n var idPrefix$1 = '';\r\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n var _shouldRoundValues = false;\r\n var bmPow = Math.pow;\r\n var bmSqrt = Math.sqrt;\r\n var bmFloor = Math.floor;\r\n var bmMax = Math.max;\r\n var bmMin = Math.min;\r\n var BMMath = {};\r\n\r\n (function () {\r\n var propertyNames = ['abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'atan2', 'ceil', 'cbrt', 'expm1', 'clz32', 'cos', 'cosh', 'exp', 'floor', 'fround', 'hypot', 'imul', 'log', 'log1p', 'log2', 'log10', 'max', 'min', 'pow', 'random', 'round', 'sign', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2'];\r\n var i;\r\n var len = propertyNames.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n BMMath[propertyNames[i]] = Math[propertyNames[i]];\r\n }\r\n })();\r\n\r\n function ProjectInterface$1() {\r\n return {};\r\n }\r\n\r\n BMMath.random = Math.random;\r\n\r\n BMMath.abs = function (val) {\r\n var tOfVal = _typeof$6(val);\r\n\r\n if (tOfVal === 'object' && val.length) {\r\n var absArr = createSizedArray(val.length);\r\n var i;\r\n var len = val.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n absArr[i] = Math.abs(val[i]);\r\n }\r\n\r\n return absArr;\r\n }\r\n\r\n return Math.abs(val);\r\n };\r\n\r\n var defaultCurveSegments = 150;\r\n var degToRads = Math.PI / 180;\r\n var roundCorner = 0.5519;\r\n\r\n function roundValues(flag) {\r\n _shouldRoundValues = !!flag;\r\n }\r\n\r\n function bmRnd(value) {\r\n if (_shouldRoundValues) {\r\n return Math.round(value);\r\n }\r\n\r\n return value;\r\n }\r\n\r\n function styleDiv(element) {\r\n element.style.position = 'absolute';\r\n element.style.top = 0;\r\n element.style.left = 0;\r\n element.style.display = 'block';\r\n element.style.transformOrigin = '0 0';\r\n element.style.webkitTransformOrigin = '0 0';\r\n element.style.backfaceVisibility = 'visible';\r\n element.style.webkitBackfaceVisibility = 'visible';\r\n element.style.transformStyle = 'preserve-3d';\r\n element.style.webkitTransformStyle = 'preserve-3d';\r\n element.style.mozTransformStyle = 'preserve-3d';\r\n }\r\n\r\n function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) {\r\n this.type = type;\r\n this.currentTime = currentTime;\r\n this.totalTime = totalTime;\r\n this.direction = frameMultiplier < 0 ? -1 : 1;\r\n }\r\n\r\n function BMCompleteEvent(type, frameMultiplier) {\r\n this.type = type;\r\n this.direction = frameMultiplier < 0 ? -1 : 1;\r\n }\r\n\r\n function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) {\r\n this.type = type;\r\n this.currentLoop = currentLoop;\r\n this.totalLoops = totalLoops;\r\n this.direction = frameMultiplier < 0 ? -1 : 1;\r\n }\r\n\r\n function BMSegmentStartEvent(type, firstFrame, totalFrames) {\r\n this.type = type;\r\n this.firstFrame = firstFrame;\r\n this.totalFrames = totalFrames;\r\n }\r\n\r\n function BMDestroyEvent(type, target) {\r\n this.type = type;\r\n this.target = target;\r\n }\r\n\r\n function BMRenderFrameErrorEvent(nativeError, currentTime) {\r\n this.type = 'renderFrameError';\r\n this.nativeError = nativeError;\r\n this.currentTime = currentTime;\r\n }\r\n\r\n function BMConfigErrorEvent(nativeError) {\r\n this.type = 'configError';\r\n this.nativeError = nativeError;\r\n }\r\n\r\n function BMAnimationConfigErrorEvent(type, nativeError) {\r\n this.type = type;\r\n this.nativeError = nativeError;\r\n }\r\n\r\n var createElementID = function () {\r\n var _count = 0;\r\n return function createID() {\r\n _count += 1;\r\n return idPrefix$1 + '__lottie_element_' + _count;\r\n };\r\n }();\r\n\r\n function HSVtoRGB(h, s, v) {\r\n var r;\r\n var g;\r\n var b;\r\n var i;\r\n var f;\r\n var p;\r\n var q;\r\n var t;\r\n i = Math.floor(h * 6);\r\n f = h * 6 - i;\r\n p = v * (1 - s);\r\n q = v * (1 - f * s);\r\n t = v * (1 - (1 - f) * s);\r\n\r\n switch (i % 6) {\r\n case 0:\r\n r = v;\r\n g = t;\r\n b = p;\r\n break;\r\n\r\n case 1:\r\n r = q;\r\n g = v;\r\n b = p;\r\n break;\r\n\r\n case 2:\r\n r = p;\r\n g = v;\r\n b = t;\r\n break;\r\n\r\n case 3:\r\n r = p;\r\n g = q;\r\n b = v;\r\n break;\r\n\r\n case 4:\r\n r = t;\r\n g = p;\r\n b = v;\r\n break;\r\n\r\n case 5:\r\n r = v;\r\n g = p;\r\n b = q;\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n\r\n return [r, g, b];\r\n }\r\n\r\n function RGBtoHSV(r, g, b) {\r\n var max = Math.max(r, g, b);\r\n var min = Math.min(r, g, b);\r\n var d = max - min;\r\n var h;\r\n var s = max === 0 ? 0 : d / max;\r\n var v = max / 255;\r\n\r\n switch (max) {\r\n case min:\r\n h = 0;\r\n break;\r\n\r\n case r:\r\n h = g - b + d * (g < b ? 6 : 0);\r\n h /= 6 * d;\r\n break;\r\n\r\n case g:\r\n h = b - r + d * 2;\r\n h /= 6 * d;\r\n break;\r\n\r\n case b:\r\n h = r - g + d * 4;\r\n h /= 6 * d;\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n\r\n return [h, s, v];\r\n }\r\n\r\n function addSaturationToRGB(color, offset) {\r\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\r\n hsv[1] += offset;\r\n\r\n if (hsv[1] > 1) {\r\n hsv[1] = 1;\r\n } else if (hsv[1] <= 0) {\r\n hsv[1] = 0;\r\n }\r\n\r\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\r\n }\r\n\r\n function addBrightnessToRGB(color, offset) {\r\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\r\n hsv[2] += offset;\r\n\r\n if (hsv[2] > 1) {\r\n hsv[2] = 1;\r\n } else if (hsv[2] < 0) {\r\n hsv[2] = 0;\r\n }\r\n\r\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\r\n }\r\n\r\n function addHueToRGB(color, offset) {\r\n var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255);\r\n hsv[0] += offset / 360;\r\n\r\n if (hsv[0] > 1) {\r\n hsv[0] -= 1;\r\n } else if (hsv[0] < 0) {\r\n hsv[0] += 1;\r\n }\r\n\r\n return HSVtoRGB(hsv[0], hsv[1], hsv[2]);\r\n }\r\n\r\n var rgbToHex = function () {\r\n var colorMap = [];\r\n var i;\r\n var hex;\r\n\r\n for (i = 0; i < 256; i += 1) {\r\n hex = i.toString(16);\r\n colorMap[i] = hex.length === 1 ? '0' + hex : hex;\r\n }\r\n\r\n return function (r, g, b) {\r\n if (r < 0) {\r\n r = 0;\r\n }\r\n\r\n if (g < 0) {\r\n g = 0;\r\n }\r\n\r\n if (b < 0) {\r\n b = 0;\r\n }\r\n\r\n return '#' + colorMap[r] + colorMap[g] + colorMap[b];\r\n };\r\n }();\r\n\r\n var setSubframeEnabled = function setSubframeEnabled(flag) {\r\n subframeEnabled = !!flag;\r\n };\r\n\r\n var getSubframeEnabled = function getSubframeEnabled() {\r\n return subframeEnabled;\r\n };\r\n\r\n var setExpressionsPlugin = function setExpressionsPlugin(value) {\r\n expressionsPlugin = value;\r\n };\r\n\r\n var getExpressionsPlugin = function getExpressionsPlugin() {\r\n return expressionsPlugin;\r\n };\r\n\r\n var setExpressionInterfaces = function setExpressionInterfaces(value) {\r\n expressionsInterfaces = value;\r\n };\r\n\r\n var getExpressionInterfaces = function getExpressionInterfaces() {\r\n return expressionsInterfaces;\r\n };\r\n\r\n var setDefaultCurveSegments = function setDefaultCurveSegments(value) {\r\n defaultCurveSegments = value;\r\n };\r\n\r\n var getDefaultCurveSegments = function getDefaultCurveSegments() {\r\n return defaultCurveSegments;\r\n };\r\n\r\n var setIdPrefix = function setIdPrefix(value) {\r\n idPrefix$1 = value;\r\n };\r\n\r\n var getIdPrefix = function getIdPrefix() {\r\n return idPrefix$1;\r\n };\r\n\r\n function createNS(type) {\r\n // return {appendChild:function(){},setAttribute:function(){},style:{}}\r\n return document.createElementNS(svgNS, type);\r\n }\r\n\r\n function _typeof$5(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof$5 = function _typeof(obj) { return typeof obj; }; } else { _typeof$5 = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof$5(obj); }\r\n\r\n var dataManager = function () {\r\n var _counterId = 1;\r\n var processes = [];\r\n var workerFn;\r\n var workerInstance;\r\n var workerProxy = {\r\n onmessage: function onmessage() {},\r\n postMessage: function postMessage(path) {\r\n workerFn({\r\n data: path\r\n });\r\n }\r\n };\r\n var _workerSelf = {\r\n postMessage: function postMessage(data) {\r\n workerProxy.onmessage({\r\n data: data\r\n });\r\n }\r\n };\r\n\r\n function createWorker(fn) {\r\n if (window.Worker && window.Blob && getWebWorker()) {\r\n var blob = new Blob(['var _workerSelf = self; self.onmessage = ', fn.toString()], {\r\n type: 'text/javascript'\r\n }); // var blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' });\r\n\r\n var url = URL.createObjectURL(blob);\r\n return new Worker(url);\r\n }\r\n\r\n workerFn = fn;\r\n return workerProxy;\r\n }\r\n\r\n function setupWorker() {\r\n if (!workerInstance) {\r\n workerInstance = createWorker(function workerStart(e) {\r\n function dataFunctionManager() {\r\n function completeLayers(layers, comps) {\r\n var layerData;\r\n var i;\r\n var len = layers.length;\r\n var j;\r\n var jLen;\r\n var k;\r\n var kLen;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n layerData = layers[i];\r\n\r\n if ('ks' in layerData && !layerData.completed) {\r\n layerData.completed = true;\r\n\r\n if (layerData.hasMask) {\r\n var maskProps = layerData.masksProperties;\r\n jLen = maskProps.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (maskProps[j].pt.k.i) {\r\n convertPathsToAbsoluteValues(maskProps[j].pt.k);\r\n } else {\r\n kLen = maskProps[j].pt.k.length;\r\n\r\n for (k = 0; k < kLen; k += 1) {\r\n if (maskProps[j].pt.k[k].s) {\r\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);\r\n }\r\n\r\n if (maskProps[j].pt.k[k].e) {\r\n convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (layerData.ty === 0) {\r\n layerData.layers = findCompLayers(layerData.refId, comps);\r\n completeLayers(layerData.layers, comps);\r\n } else if (layerData.ty === 4) {\r\n completeShapes(layerData.shapes);\r\n } else if (layerData.ty === 5) {\r\n completeText(layerData);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function completeChars(chars, assets) {\r\n if (chars) {\r\n var i = 0;\r\n var len = chars.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (chars[i].t === 1) {\r\n // var compData = findComp(chars[i].data.refId, assets);\r\n chars[i].data.layers = findCompLayers(chars[i].data.refId, assets); // chars[i].data.ip = 0;\r\n // chars[i].data.op = 99999;\r\n // chars[i].data.st = 0;\r\n // chars[i].data.sr = 1;\r\n // chars[i].w = compData.w;\r\n // chars[i].data.ks = {\r\n // a: { k: [0, 0, 0], a: 0 },\r\n // p: { k: [0, -compData.h, 0], a: 0 },\r\n // r: { k: 0, a: 0 },\r\n // s: { k: [100, 100], a: 0 },\r\n // o: { k: 100, a: 0 },\r\n // };\r\n\r\n completeLayers(chars[i].data.layers, assets);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function findComp(id, comps) {\r\n var i = 0;\r\n var len = comps.length;\r\n\r\n while (i < len) {\r\n if (comps[i].id === id) {\r\n return comps[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function findCompLayers(id, comps) {\r\n var comp = findComp(id, comps);\r\n\r\n if (comp) {\r\n if (!comp.layers.__used) {\r\n comp.layers.__used = true;\r\n return comp.layers;\r\n }\r\n\r\n return JSON.parse(JSON.stringify(comp.layers));\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function completeShapes(arr) {\r\n var i;\r\n var len = arr.length;\r\n var j;\r\n var jLen;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (arr[i].ty === 'sh') {\r\n if (arr[i].ks.k.i) {\r\n convertPathsToAbsoluteValues(arr[i].ks.k);\r\n } else {\r\n jLen = arr[i].ks.k.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (arr[i].ks.k[j].s) {\r\n convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);\r\n }\r\n\r\n if (arr[i].ks.k[j].e) {\r\n convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);\r\n }\r\n }\r\n }\r\n } else if (arr[i].ty === 'gr') {\r\n completeShapes(arr[i].it);\r\n }\r\n }\r\n }\r\n\r\n function convertPathsToAbsoluteValues(path) {\r\n var i;\r\n var len = path.i.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n path.i[i][0] += path.v[i][0];\r\n path.i[i][1] += path.v[i][1];\r\n path.o[i][0] += path.v[i][0];\r\n path.o[i][1] += path.v[i][1];\r\n }\r\n }\r\n\r\n function checkVersion(minimum, animVersionString) {\r\n var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100];\r\n\r\n if (minimum[0] > animVersion[0]) {\r\n return true;\r\n }\r\n\r\n if (animVersion[0] > minimum[0]) {\r\n return false;\r\n }\r\n\r\n if (minimum[1] > animVersion[1]) {\r\n return true;\r\n }\r\n\r\n if (animVersion[1] > minimum[1]) {\r\n return false;\r\n }\r\n\r\n if (minimum[2] > animVersion[2]) {\r\n return true;\r\n }\r\n\r\n if (animVersion[2] > minimum[2]) {\r\n return false;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var checkText = function () {\r\n var minimumVersion = [4, 4, 14];\r\n\r\n function updateTextLayer(textLayer) {\r\n var documentData = textLayer.t.d;\r\n textLayer.t.d = {\r\n k: [{\r\n s: documentData,\r\n t: 0\r\n }]\r\n };\r\n }\r\n\r\n function iterateLayers(layers) {\r\n var i;\r\n var len = layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (layers[i].ty === 5) {\r\n updateTextLayer(layers[i]);\r\n }\r\n }\r\n }\r\n\r\n return function (animationData) {\r\n if (checkVersion(minimumVersion, animationData.v)) {\r\n iterateLayers(animationData.layers);\r\n\r\n if (animationData.assets) {\r\n var i;\r\n var len = animationData.assets.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (animationData.assets[i].layers) {\r\n iterateLayers(animationData.assets[i].layers);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n }();\r\n\r\n var checkChars = function () {\r\n var minimumVersion = [4, 7, 99];\r\n return function (animationData) {\r\n if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) {\r\n var i;\r\n var len = animationData.chars.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n var charData = animationData.chars[i];\r\n\r\n if (charData.data && charData.data.shapes) {\r\n completeShapes(charData.data.shapes);\r\n charData.data.ip = 0;\r\n charData.data.op = 99999;\r\n charData.data.st = 0;\r\n charData.data.sr = 1;\r\n charData.data.ks = {\r\n p: {\r\n k: [0, 0],\r\n a: 0\r\n },\r\n s: {\r\n k: [100, 100],\r\n a: 0\r\n },\r\n a: {\r\n k: [0, 0],\r\n a: 0\r\n },\r\n r: {\r\n k: 0,\r\n a: 0\r\n },\r\n o: {\r\n k: 100,\r\n a: 0\r\n }\r\n };\r\n\r\n if (!animationData.chars[i].t) {\r\n charData.data.shapes.push({\r\n ty: 'no'\r\n });\r\n charData.data.shapes[0].it.push({\r\n p: {\r\n k: [0, 0],\r\n a: 0\r\n },\r\n s: {\r\n k: [100, 100],\r\n a: 0\r\n },\r\n a: {\r\n k: [0, 0],\r\n a: 0\r\n },\r\n r: {\r\n k: 0,\r\n a: 0\r\n },\r\n o: {\r\n k: 100,\r\n a: 0\r\n },\r\n sk: {\r\n k: 0,\r\n a: 0\r\n },\r\n sa: {\r\n k: 0,\r\n a: 0\r\n },\r\n ty: 'tr'\r\n });\r\n }\r\n }\r\n }\r\n }\r\n };\r\n }();\r\n\r\n var checkPathProperties = function () {\r\n var minimumVersion = [5, 7, 15];\r\n\r\n function updateTextLayer(textLayer) {\r\n var pathData = textLayer.t.p;\r\n\r\n if (typeof pathData.a === 'number') {\r\n pathData.a = {\r\n a: 0,\r\n k: pathData.a\r\n };\r\n }\r\n\r\n if (typeof pathData.p === 'number') {\r\n pathData.p = {\r\n a: 0,\r\n k: pathData.p\r\n };\r\n }\r\n\r\n if (typeof pathData.r === 'number') {\r\n pathData.r = {\r\n a: 0,\r\n k: pathData.r\r\n };\r\n }\r\n }\r\n\r\n function iterateLayers(layers) {\r\n var i;\r\n var len = layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (layers[i].ty === 5) {\r\n updateTextLayer(layers[i]);\r\n }\r\n }\r\n }\r\n\r\n return function (animationData) {\r\n if (checkVersion(minimumVersion, animationData.v)) {\r\n iterateLayers(animationData.layers);\r\n\r\n if (animationData.assets) {\r\n var i;\r\n var len = animationData.assets.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (animationData.assets[i].layers) {\r\n iterateLayers(animationData.assets[i].layers);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n }();\r\n\r\n var checkColors = function () {\r\n var minimumVersion = [4, 1, 9];\r\n\r\n function iterateShapes(shapes) {\r\n var i;\r\n var len = shapes.length;\r\n var j;\r\n var jLen;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (shapes[i].ty === 'gr') {\r\n iterateShapes(shapes[i].it);\r\n } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') {\r\n if (shapes[i].c.k && shapes[i].c.k[0].i) {\r\n jLen = shapes[i].c.k.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (shapes[i].c.k[j].s) {\r\n shapes[i].c.k[j].s[0] /= 255;\r\n shapes[i].c.k[j].s[1] /= 255;\r\n shapes[i].c.k[j].s[2] /= 255;\r\n shapes[i].c.k[j].s[3] /= 255;\r\n }\r\n\r\n if (shapes[i].c.k[j].e) {\r\n shapes[i].c.k[j].e[0] /= 255;\r\n shapes[i].c.k[j].e[1] /= 255;\r\n shapes[i].c.k[j].e[2] /= 255;\r\n shapes[i].c.k[j].e[3] /= 255;\r\n }\r\n }\r\n } else {\r\n shapes[i].c.k[0] /= 255;\r\n shapes[i].c.k[1] /= 255;\r\n shapes[i].c.k[2] /= 255;\r\n shapes[i].c.k[3] /= 255;\r\n }\r\n }\r\n }\r\n }\r\n\r\n function iterateLayers(layers) {\r\n var i;\r\n var len = layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (layers[i].ty === 4) {\r\n iterateShapes(layers[i].shapes);\r\n }\r\n }\r\n }\r\n\r\n return function (animationData) {\r\n if (checkVersion(minimumVersion, animationData.v)) {\r\n iterateLayers(animationData.layers);\r\n\r\n if (animationData.assets) {\r\n var i;\r\n var len = animationData.assets.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (animationData.assets[i].layers) {\r\n iterateLayers(animationData.assets[i].layers);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n }();\r\n\r\n var checkShapes = function () {\r\n var minimumVersion = [4, 4, 18];\r\n\r\n function completeClosingShapes(arr) {\r\n var i;\r\n var len = arr.length;\r\n var j;\r\n var jLen;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (arr[i].ty === 'sh') {\r\n if (arr[i].ks.k.i) {\r\n arr[i].ks.k.c = arr[i].closed;\r\n } else {\r\n jLen = arr[i].ks.k.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (arr[i].ks.k[j].s) {\r\n arr[i].ks.k[j].s[0].c = arr[i].closed;\r\n }\r\n\r\n if (arr[i].ks.k[j].e) {\r\n arr[i].ks.k[j].e[0].c = arr[i].closed;\r\n }\r\n }\r\n }\r\n } else if (arr[i].ty === 'gr') {\r\n completeClosingShapes(arr[i].it);\r\n }\r\n }\r\n }\r\n\r\n function iterateLayers(layers) {\r\n var layerData;\r\n var i;\r\n var len = layers.length;\r\n var j;\r\n var jLen;\r\n var k;\r\n var kLen;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n layerData = layers[i];\r\n\r\n if (layerData.hasMask) {\r\n var maskProps = layerData.masksProperties;\r\n jLen = maskProps.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (maskProps[j].pt.k.i) {\r\n maskProps[j].pt.k.c = maskProps[j].cl;\r\n } else {\r\n kLen = maskProps[j].pt.k.length;\r\n\r\n for (k = 0; k < kLen; k += 1) {\r\n if (maskProps[j].pt.k[k].s) {\r\n maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;\r\n }\r\n\r\n if (maskProps[j].pt.k[k].e) {\r\n maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (layerData.ty === 4) {\r\n completeClosingShapes(layerData.shapes);\r\n }\r\n }\r\n }\r\n\r\n return function (animationData) {\r\n if (checkVersion(minimumVersion, animationData.v)) {\r\n iterateLayers(animationData.layers);\r\n\r\n if (animationData.assets) {\r\n var i;\r\n var len = animationData.assets.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (animationData.assets[i].layers) {\r\n iterateLayers(animationData.assets[i].layers);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n }();\r\n\r\n function completeData(animationData) {\r\n if (animationData.__complete) {\r\n return;\r\n }\r\n\r\n checkColors(animationData);\r\n checkText(animationData);\r\n checkChars(animationData);\r\n checkPathProperties(animationData);\r\n checkShapes(animationData);\r\n completeLayers(animationData.layers, animationData.assets);\r\n completeChars(animationData.chars, animationData.assets);\r\n animationData.__complete = true;\r\n }\r\n\r\n function completeText(data) {\r\n if (data.t.a.length === 0 && !('m' in data.t.p)) {// data.singleShape = true;\r\n }\r\n }\r\n\r\n var moduleOb = {};\r\n moduleOb.completeData = completeData;\r\n moduleOb.checkColors = checkColors;\r\n moduleOb.checkChars = checkChars;\r\n moduleOb.checkPathProperties = checkPathProperties;\r\n moduleOb.checkShapes = checkShapes;\r\n moduleOb.completeLayers = completeLayers;\r\n return moduleOb;\r\n }\r\n\r\n if (!_workerSelf.dataManager) {\r\n _workerSelf.dataManager = dataFunctionManager();\r\n }\r\n\r\n if (!_workerSelf.assetLoader) {\r\n _workerSelf.assetLoader = function () {\r\n function formatResponse(xhr) {\r\n // using typeof doubles the time of execution of this method,\r\n // so if available, it's better to use the header to validate the type\r\n var contentTypeHeader = xhr.getResponseHeader('content-type');\r\n\r\n if (contentTypeHeader && xhr.responseType === 'json' && contentTypeHeader.indexOf('json') !== -1) {\r\n return xhr.response;\r\n }\r\n\r\n if (xhr.response && _typeof$5(xhr.response) === 'object') {\r\n return xhr.response;\r\n }\r\n\r\n if (xhr.response && typeof xhr.response === 'string') {\r\n return JSON.parse(xhr.response);\r\n }\r\n\r\n if (xhr.responseText) {\r\n return JSON.parse(xhr.responseText);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function loadAsset(path, fullPath, callback, errorCallback) {\r\n var response;\r\n var xhr = new XMLHttpRequest(); // set responseType after calling open or IE will break.\r\n\r\n try {\r\n // This crashes on Android WebView prior to KitKat\r\n xhr.responseType = 'json';\r\n } catch (err) {} // eslint-disable-line no-empty\r\n\r\n\r\n xhr.onreadystatechange = function () {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 200) {\r\n response = formatResponse(xhr);\r\n callback(response);\r\n } else {\r\n try {\r\n response = formatResponse(xhr);\r\n callback(response);\r\n } catch (err) {\r\n if (errorCallback) {\r\n errorCallback(err);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n try {\r\n // Hack to workaround banner validation\r\n xhr.open(['G', 'E', 'T'].join(''), path, true);\r\n } catch (error) {\r\n // Hack to workaround banner validation\r\n xhr.open(['G', 'E', 'T'].join(''), fullPath + '/' + path, true);\r\n }\r\n\r\n xhr.send();\r\n }\r\n\r\n return {\r\n load: loadAsset\r\n };\r\n }();\r\n }\r\n\r\n if (e.data.type === 'loadAnimation') {\r\n _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function (data) {\r\n _workerSelf.dataManager.completeData(data);\r\n\r\n _workerSelf.postMessage({\r\n id: e.data.id,\r\n payload: data,\r\n status: 'success'\r\n });\r\n }, function () {\r\n _workerSelf.postMessage({\r\n id: e.data.id,\r\n status: 'error'\r\n });\r\n });\r\n } else if (e.data.type === 'complete') {\r\n var animation = e.data.animation;\r\n\r\n _workerSelf.dataManager.completeData(animation);\r\n\r\n _workerSelf.postMessage({\r\n id: e.data.id,\r\n payload: animation,\r\n status: 'success'\r\n });\r\n } else if (e.data.type === 'loadData') {\r\n _workerSelf.assetLoader.load(e.data.path, e.data.fullPath, function (data) {\r\n _workerSelf.postMessage({\r\n id: e.data.id,\r\n payload: data,\r\n status: 'success'\r\n });\r\n }, function () {\r\n _workerSelf.postMessage({\r\n id: e.data.id,\r\n status: 'error'\r\n });\r\n });\r\n }\r\n });\r\n\r\n workerInstance.onmessage = function (event) {\r\n var data = event.data;\r\n var id = data.id;\r\n var process = processes[id];\r\n processes[id] = null;\r\n\r\n if (data.status === 'success') {\r\n process.onComplete(data.payload);\r\n } else if (process.onError) {\r\n process.onError();\r\n }\r\n };\r\n }\r\n }\r\n\r\n function createProcess(onComplete, onError) {\r\n _counterId += 1;\r\n var id = 'processId_' + _counterId;\r\n processes[id] = {\r\n onComplete: onComplete,\r\n onError: onError\r\n };\r\n return id;\r\n }\r\n\r\n function loadAnimation(path, onComplete, onError) {\r\n setupWorker();\r\n var processId = createProcess(onComplete, onError);\r\n workerInstance.postMessage({\r\n type: 'loadAnimation',\r\n path: path,\r\n fullPath: window.location.origin + window.location.pathname,\r\n id: processId\r\n });\r\n }\r\n\r\n function loadData(path, onComplete, onError) {\r\n setupWorker();\r\n var processId = createProcess(onComplete, onError);\r\n workerInstance.postMessage({\r\n type: 'loadData',\r\n path: path,\r\n fullPath: window.location.origin + window.location.pathname,\r\n id: processId\r\n });\r\n }\r\n\r\n function completeAnimation(anim, onComplete, onError) {\r\n setupWorker();\r\n var processId = createProcess(onComplete, onError);\r\n workerInstance.postMessage({\r\n type: 'complete',\r\n animation: anim,\r\n id: processId\r\n });\r\n }\r\n\r\n return {\r\n loadAnimation: loadAnimation,\r\n loadData: loadData,\r\n completeAnimation: completeAnimation\r\n };\r\n }();\r\n\r\n var ImagePreloader = function () {\r\n var proxyImage = function () {\r\n var canvas = createTag('canvas');\r\n canvas.width = 1;\r\n canvas.height = 1;\r\n var ctx = canvas.getContext('2d');\r\n ctx.fillStyle = 'rgba(0,0,0,0)';\r\n ctx.fillRect(0, 0, 1, 1);\r\n return canvas;\r\n }();\r\n\r\n function imageLoaded() {\r\n this.loadedAssets += 1;\r\n\r\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\r\n if (this.imagesLoadedCb) {\r\n this.imagesLoadedCb(null);\r\n }\r\n }\r\n }\r\n\r\n function footageLoaded() {\r\n this.loadedFootagesCount += 1;\r\n\r\n if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) {\r\n if (this.imagesLoadedCb) {\r\n this.imagesLoadedCb(null);\r\n }\r\n }\r\n }\r\n\r\n function getAssetsPath(assetData, assetsPath, originalPath) {\r\n var path = '';\r\n\r\n if (assetData.e) {\r\n path = assetData.p;\r\n } else if (assetsPath) {\r\n var imagePath = assetData.p;\r\n\r\n if (imagePath.indexOf('images/') !== -1) {\r\n imagePath = imagePath.split('/')[1];\r\n }\r\n\r\n path = assetsPath + imagePath;\r\n } else {\r\n path = originalPath;\r\n path += assetData.u ? assetData.u : '';\r\n path += assetData.p;\r\n }\r\n\r\n return path;\r\n }\r\n\r\n function testImageLoaded(img) {\r\n var _count = 0;\r\n var intervalId = setInterval(function () {\r\n var box = img.getBBox();\r\n\r\n if (box.width || _count > 500) {\r\n this._imageLoaded();\r\n\r\n clearInterval(intervalId);\r\n }\r\n\r\n _count += 1;\r\n }.bind(this), 50);\r\n }\r\n\r\n function createImageData(assetData) {\r\n var path = getAssetsPath(assetData, this.assetsPath, this.path);\r\n var img = createNS('image');\r\n\r\n if (isSafari) {\r\n this.testImageLoaded(img);\r\n } else {\r\n img.addEventListener('load', this._imageLoaded, false);\r\n }\r\n\r\n img.addEventListener('error', function () {\r\n ob.img = proxyImage;\r\n\r\n this._imageLoaded();\r\n }.bind(this), false);\r\n img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path);\r\n\r\n if (this._elementHelper.append) {\r\n this._elementHelper.append(img);\r\n } else {\r\n this._elementHelper.appendChild(img);\r\n }\r\n\r\n var ob = {\r\n img: img,\r\n assetData: assetData\r\n };\r\n return ob;\r\n }\r\n\r\n function createImgData(assetData) {\r\n var path = getAssetsPath(assetData, this.assetsPath, this.path);\r\n var img = createTag('img');\r\n img.crossOrigin = 'anonymous';\r\n img.addEventListener('load', this._imageLoaded, false);\r\n img.addEventListener('error', function () {\r\n ob.img = proxyImage;\r\n\r\n this._imageLoaded();\r\n }.bind(this), false);\r\n img.src = path;\r\n var ob = {\r\n img: img,\r\n assetData: assetData\r\n };\r\n return ob;\r\n }\r\n\r\n function createFootageData(data) {\r\n var ob = {\r\n assetData: data\r\n };\r\n var path = getAssetsPath(data, this.assetsPath, this.path);\r\n dataManager.loadData(path, function (footageData) {\r\n ob.img = footageData;\r\n\r\n this._footageLoaded();\r\n }.bind(this), function () {\r\n ob.img = {};\r\n\r\n this._footageLoaded();\r\n }.bind(this));\r\n return ob;\r\n }\r\n\r\n function loadAssets(assets, cb) {\r\n this.imagesLoadedCb = cb;\r\n var i;\r\n var len = assets.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (!assets[i].layers) {\r\n if (!assets[i].t || assets[i].t === 'seq') {\r\n this.totalImages += 1;\r\n this.images.push(this._createImageData(assets[i]));\r\n } else if (assets[i].t === 3) {\r\n this.totalFootages += 1;\r\n this.images.push(this.createFootageData(assets[i]));\r\n }\r\n }\r\n }\r\n }\r\n\r\n function setPath(path) {\r\n this.path = path || '';\r\n }\r\n\r\n function setAssetsPath(path) {\r\n this.assetsPath = path || '';\r\n }\r\n\r\n function getAsset(assetData) {\r\n var i = 0;\r\n var len = this.images.length;\r\n\r\n while (i < len) {\r\n if (this.images[i].assetData === assetData) {\r\n return this.images[i].img;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function destroy() {\r\n this.imagesLoadedCb = null;\r\n this.images.length = 0;\r\n }\r\n\r\n function loadedImages() {\r\n return this.totalImages === this.loadedAssets;\r\n }\r\n\r\n function loadedFootages() {\r\n return this.totalFootages === this.loadedFootagesCount;\r\n }\r\n\r\n function setCacheType(type, elementHelper) {\r\n if (type === 'svg') {\r\n this._elementHelper = elementHelper;\r\n this._createImageData = this.createImageData.bind(this);\r\n } else {\r\n this._createImageData = this.createImgData.bind(this);\r\n }\r\n }\r\n\r\n function ImagePreloaderFactory() {\r\n this._imageLoaded = imageLoaded.bind(this);\r\n this._footageLoaded = footageLoaded.bind(this);\r\n this.testImageLoaded = testImageLoaded.bind(this);\r\n this.createFootageData = createFootageData.bind(this);\r\n this.assetsPath = '';\r\n this.path = '';\r\n this.totalImages = 0;\r\n this.totalFootages = 0;\r\n this.loadedAssets = 0;\r\n this.loadedFootagesCount = 0;\r\n this.imagesLoadedCb = null;\r\n this.images = [];\r\n }\r\n\r\n ImagePreloaderFactory.prototype = {\r\n loadAssets: loadAssets,\r\n setAssetsPath: setAssetsPath,\r\n setPath: setPath,\r\n loadedImages: loadedImages,\r\n loadedFootages: loadedFootages,\r\n destroy: destroy,\r\n getAsset: getAsset,\r\n createImgData: createImgData,\r\n createImageData: createImageData,\r\n imageLoaded: imageLoaded,\r\n footageLoaded: footageLoaded,\r\n setCacheType: setCacheType\r\n };\r\n return ImagePreloaderFactory;\r\n }();\r\n\r\n function BaseEvent() {}\r\n\r\n BaseEvent.prototype = {\r\n triggerEvent: function triggerEvent(eventName, args) {\r\n if (this._cbs[eventName]) {\r\n var callbacks = this._cbs[eventName];\r\n\r\n for (var i = 0; i < callbacks.length; i += 1) {\r\n callbacks[i](args);\r\n }\r\n }\r\n },\r\n addEventListener: function addEventListener(eventName, callback) {\r\n if (!this._cbs[eventName]) {\r\n this._cbs[eventName] = [];\r\n }\r\n\r\n this._cbs[eventName].push(callback);\r\n\r\n return function () {\r\n this.removeEventListener(eventName, callback);\r\n }.bind(this);\r\n },\r\n removeEventListener: function removeEventListener(eventName, callback) {\r\n if (!callback) {\r\n this._cbs[eventName] = null;\r\n } else if (this._cbs[eventName]) {\r\n var i = 0;\r\n var len = this._cbs[eventName].length;\r\n\r\n while (i < len) {\r\n if (this._cbs[eventName][i] === callback) {\r\n this._cbs[eventName].splice(i, 1);\r\n\r\n i -= 1;\r\n len -= 1;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (!this._cbs[eventName].length) {\r\n this._cbs[eventName] = null;\r\n }\r\n }\r\n }\r\n };\r\n\r\n var markerParser = function () {\r\n function parsePayloadLines(payload) {\r\n var lines = payload.split('\\r\\n');\r\n var keys = {};\r\n var line;\r\n var keysCount = 0;\r\n\r\n for (var i = 0; i < lines.length; i += 1) {\r\n line = lines[i].split(':');\r\n\r\n if (line.length === 2) {\r\n keys[line[0]] = line[1].trim();\r\n keysCount += 1;\r\n }\r\n }\r\n\r\n if (keysCount === 0) {\r\n throw new Error();\r\n }\r\n\r\n return keys;\r\n }\r\n\r\n return function (_markers) {\r\n var markers = [];\r\n\r\n for (var i = 0; i < _markers.length; i += 1) {\r\n var _marker = _markers[i];\r\n var markerData = {\r\n time: _marker.tm,\r\n duration: _marker.dr\r\n };\r\n\r\n try {\r\n markerData.payload = JSON.parse(_markers[i].cm);\r\n } catch (_) {\r\n try {\r\n markerData.payload = parsePayloadLines(_markers[i].cm);\r\n } catch (__) {\r\n markerData.payload = {\r\n name: _markers[i].cm\r\n };\r\n }\r\n }\r\n\r\n markers.push(markerData);\r\n }\r\n\r\n return markers;\r\n };\r\n }();\r\n\r\n var ProjectInterface = function () {\r\n function registerComposition(comp) {\r\n this.compositions.push(comp);\r\n }\r\n\r\n return function () {\r\n function _thisProjectFunction(name) {\r\n var i = 0;\r\n var len = this.compositions.length;\r\n\r\n while (i < len) {\r\n if (this.compositions[i].data && this.compositions[i].data.nm === name) {\r\n if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) {\r\n this.compositions[i].prepareFrame(this.currentFrame);\r\n }\r\n\r\n return this.compositions[i].compInterface;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _thisProjectFunction.compositions = [];\r\n _thisProjectFunction.currentFrame = 0;\r\n _thisProjectFunction.registerComposition = registerComposition;\r\n return _thisProjectFunction;\r\n };\r\n }();\r\n\r\n var renderers = {};\r\n\r\n var registerRenderer = function registerRenderer(key, value) {\r\n renderers[key] = value;\r\n };\r\n\r\n function getRenderer(key) {\r\n return renderers[key];\r\n }\r\n\r\n function _typeof$4(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof$4 = function _typeof(obj) { return typeof obj; }; } else { _typeof$4 = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof$4(obj); }\r\n\r\n var AnimationItem = function AnimationItem() {\r\n this._cbs = [];\r\n this.name = '';\r\n this.path = '';\r\n this.isLoaded = false;\r\n this.currentFrame = 0;\r\n this.currentRawFrame = 0;\r\n this.firstFrame = 0;\r\n this.totalFrames = 0;\r\n this.frameRate = 0;\r\n this.frameMult = 0;\r\n this.playSpeed = 1;\r\n this.playDirection = 1;\r\n this.playCount = 0;\r\n this.animationData = {};\r\n this.assets = [];\r\n this.isPaused = true;\r\n this.autoplay = false;\r\n this.loop = true;\r\n this.renderer = null;\r\n this.animationID = createElementID();\r\n this.assetsPath = '';\r\n this.timeCompleted = 0;\r\n this.segmentPos = 0;\r\n this.isSubframeEnabled = getSubframeEnabled();\r\n this.segments = [];\r\n this._idle = true;\r\n this._completedLoop = false;\r\n this.projectInterface = ProjectInterface();\r\n this.imagePreloader = new ImagePreloader();\r\n this.audioController = audioControllerFactory();\r\n this.markers = [];\r\n this.configAnimation = this.configAnimation.bind(this);\r\n this.onSetupError = this.onSetupError.bind(this);\r\n this.onSegmentComplete = this.onSegmentComplete.bind(this);\r\n this.drawnFrameEvent = new BMEnterFrameEvent('drawnFrame', 0, 0, 0);\r\n };\r\n\r\n extendPrototype([BaseEvent], AnimationItem);\r\n\r\n AnimationItem.prototype.setParams = function (params) {\r\n if (params.wrapper || params.container) {\r\n this.wrapper = params.wrapper || params.container;\r\n }\r\n\r\n var animType = 'svg';\r\n\r\n if (params.animType) {\r\n animType = params.animType;\r\n } else if (params.renderer) {\r\n animType = params.renderer;\r\n }\r\n\r\n var RendererClass = getRenderer(animType);\r\n this.renderer = new RendererClass(this, params.rendererSettings);\r\n this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs);\r\n this.renderer.setProjectInterface(this.projectInterface);\r\n this.animType = animType;\r\n\r\n if (params.loop === '' || params.loop === null || params.loop === undefined || params.loop === true) {\r\n this.loop = true;\r\n } else if (params.loop === false) {\r\n this.loop = false;\r\n } else {\r\n this.loop = parseInt(params.loop, 10);\r\n }\r\n\r\n this.autoplay = 'autoplay' in params ? params.autoplay : true;\r\n this.name = params.name ? params.name : '';\r\n this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments') ? params.autoloadSegments : true;\r\n this.assetsPath = params.assetsPath;\r\n this.initialSegment = params.initialSegment;\r\n\r\n if (params.audioFactory) {\r\n this.audioController.setAudioFactory(params.audioFactory);\r\n }\r\n\r\n if (params.animationData) {\r\n this.setupAnimation(params.animationData);\r\n } else if (params.path) {\r\n if (params.path.lastIndexOf('\\\\') !== -1) {\r\n this.path = params.path.substr(0, params.path.lastIndexOf('\\\\') + 1);\r\n } else {\r\n this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1);\r\n }\r\n\r\n this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1);\r\n this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json'));\r\n dataManager.loadAnimation(params.path, this.configAnimation, this.onSetupError);\r\n }\r\n };\r\n\r\n AnimationItem.prototype.onSetupError = function () {\r\n this.trigger('data_failed');\r\n };\r\n\r\n AnimationItem.prototype.setupAnimation = function (data) {\r\n dataManager.completeAnimation(data, this.configAnimation);\r\n };\r\n\r\n AnimationItem.prototype.setData = function (wrapper, animationData) {\r\n if (animationData) {\r\n if (_typeof$4(animationData) !== 'object') {\r\n animationData = JSON.parse(animationData);\r\n }\r\n }\r\n\r\n var params = {\r\n wrapper: wrapper,\r\n animationData: animationData\r\n };\r\n var wrapperAttributes = wrapper.attributes;\r\n params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-animation-path').value : wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-bm-path').value : wrapperAttributes.getNamedItem('bm-path') ? wrapperAttributes.getNamedItem('bm-path').value : '';\r\n params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-anim-type').value : wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-bm-type').value : wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('bm-type').value : wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-bm-renderer').value : wrapperAttributes.getNamedItem('bm-renderer') ? wrapperAttributes.getNamedItem('bm-renderer').value : 'canvas';\r\n var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-anim-loop').value : wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-bm-loop').value : wrapperAttributes.getNamedItem('bm-loop') ? wrapperAttributes.getNamedItem('bm-loop').value : '';\r\n\r\n if (loop === 'false') {\r\n params.loop = false;\r\n } else if (loop === 'true') {\r\n params.loop = true;\r\n } else if (loop !== '') {\r\n params.loop = parseInt(loop, 10);\r\n }\r\n\r\n var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-anim-autoplay').value : wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-bm-autoplay').value : wrapperAttributes.getNamedItem('bm-autoplay') ? wrapperAttributes.getNamedItem('bm-autoplay').value : true;\r\n params.autoplay = autoplay !== 'false';\r\n params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-name').value : wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-bm-name').value : wrapperAttributes.getNamedItem('bm-name') ? wrapperAttributes.getNamedItem('bm-name').value : '';\r\n var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-anim-prerender').value : wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary\r\n ? wrapperAttributes.getNamedItem('data-bm-prerender').value : wrapperAttributes.getNamedItem('bm-prerender') ? wrapperAttributes.getNamedItem('bm-prerender').value : '';\r\n\r\n if (prerender === 'false') {\r\n params.prerender = false;\r\n }\r\n\r\n this.setParams(params);\r\n };\r\n\r\n AnimationItem.prototype.includeLayers = function (data) {\r\n if (data.op > this.animationData.op) {\r\n this.animationData.op = data.op;\r\n this.totalFrames = Math.floor(data.op - this.animationData.ip);\r\n }\r\n\r\n var layers = this.animationData.layers;\r\n var i;\r\n var len = layers.length;\r\n var newLayers = data.layers;\r\n var j;\r\n var jLen = newLayers.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n i = 0;\r\n\r\n while (i < len) {\r\n if (layers[i].id === newLayers[j].id) {\r\n layers[i] = newLayers[j];\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n }\r\n\r\n if (data.chars || data.fonts) {\r\n this.renderer.globalData.fontManager.addChars(data.chars);\r\n this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);\r\n }\r\n\r\n if (data.assets) {\r\n len = data.assets.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.animationData.assets.push(data.assets[i]);\r\n }\r\n }\r\n\r\n this.animationData.__complete = false;\r\n dataManager.completeAnimation(this.animationData, this.onSegmentComplete);\r\n };\r\n\r\n AnimationItem.prototype.onSegmentComplete = function (data) {\r\n this.animationData = data;\r\n var expressionsPlugin = getExpressionsPlugin();\r\n\r\n if (expressionsPlugin) {\r\n expressionsPlugin.initExpressions(this);\r\n }\r\n\r\n this.loadNextSegment();\r\n };\r\n\r\n AnimationItem.prototype.loadNextSegment = function () {\r\n var segments = this.animationData.segments;\r\n\r\n if (!segments || segments.length === 0 || !this.autoloadSegments) {\r\n this.trigger('data_ready');\r\n this.timeCompleted = this.totalFrames;\r\n return;\r\n }\r\n\r\n var segment = segments.shift();\r\n this.timeCompleted = segment.time * this.frameRate;\r\n var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json';\r\n this.segmentPos += 1;\r\n dataManager.loadData(segmentPath, this.includeLayers.bind(this), function () {\r\n this.trigger('data_failed');\r\n }.bind(this));\r\n };\r\n\r\n AnimationItem.prototype.loadSegments = function () {\r\n var segments = this.animationData.segments;\r\n\r\n if (!segments) {\r\n this.timeCompleted = this.totalFrames;\r\n }\r\n\r\n this.loadNextSegment();\r\n };\r\n\r\n AnimationItem.prototype.imagesLoaded = function () {\r\n this.trigger('loaded_images');\r\n this.checkLoaded();\r\n };\r\n\r\n AnimationItem.prototype.preloadImages = function () {\r\n this.imagePreloader.setAssetsPath(this.assetsPath);\r\n this.imagePreloader.setPath(this.path);\r\n this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));\r\n };\r\n\r\n AnimationItem.prototype.configAnimation = function (animData) {\r\n if (!this.renderer) {\r\n return;\r\n }\r\n\r\n try {\r\n this.animationData = animData;\r\n\r\n if (this.initialSegment) {\r\n this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]);\r\n this.firstFrame = Math.round(this.initialSegment[0]);\r\n } else {\r\n this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);\r\n this.firstFrame = Math.round(this.animationData.ip);\r\n }\r\n\r\n this.renderer.configAnimation(animData);\r\n\r\n if (!animData.assets) {\r\n animData.assets = [];\r\n }\r\n\r\n this.assets = this.animationData.assets;\r\n this.frameRate = this.animationData.fr;\r\n this.frameMult = this.animationData.fr / 1000;\r\n this.renderer.searchExtraCompositions(animData.assets);\r\n this.markers = markerParser(animData.markers || []);\r\n this.trigger('config_ready');\r\n this.preloadImages();\r\n this.loadSegments();\r\n this.updaFrameModifier();\r\n this.waitForFontsLoaded();\r\n\r\n if (this.isPaused) {\r\n this.audioController.pause();\r\n }\r\n } catch (error) {\r\n this.triggerConfigError(error);\r\n }\r\n };\r\n\r\n AnimationItem.prototype.waitForFontsLoaded = function () {\r\n if (!this.renderer) {\r\n return;\r\n }\r\n\r\n if (this.renderer.globalData.fontManager.isLoaded) {\r\n this.checkLoaded();\r\n } else {\r\n setTimeout(this.waitForFontsLoaded.bind(this), 20);\r\n }\r\n };\r\n\r\n AnimationItem.prototype.checkLoaded = function () {\r\n if (!this.isLoaded && this.renderer.globalData.fontManager.isLoaded && (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas') && this.imagePreloader.loadedFootages()) {\r\n this.isLoaded = true;\r\n var expressionsPlugin = getExpressionsPlugin();\r\n\r\n if (expressionsPlugin) {\r\n expressionsPlugin.initExpressions(this);\r\n }\r\n\r\n this.renderer.initItems();\r\n setTimeout(function () {\r\n this.trigger('DOMLoaded');\r\n }.bind(this), 0);\r\n this.gotoFrame();\r\n\r\n if (this.autoplay) {\r\n this.play();\r\n }\r\n }\r\n };\r\n\r\n AnimationItem.prototype.resize = function (width, height) {\r\n // Adding this validation for backwards compatibility in case an event object was being passed down\r\n var _width = typeof width === 'number' ? width : undefined;\r\n\r\n var _height = typeof height === 'number' ? height : undefined;\r\n\r\n this.renderer.updateContainerSize(_width, _height);\r\n };\r\n\r\n AnimationItem.prototype.setSubframe = function (flag) {\r\n this.isSubframeEnabled = !!flag;\r\n };\r\n\r\n AnimationItem.prototype.gotoFrame = function () {\r\n this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame; // eslint-disable-line no-bitwise\r\n\r\n if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) {\r\n this.currentFrame = this.timeCompleted;\r\n }\r\n\r\n this.trigger('enterFrame');\r\n this.renderFrame();\r\n this.trigger('drawnFrame');\r\n };\r\n\r\n AnimationItem.prototype.renderFrame = function () {\r\n if (this.isLoaded === false || !this.renderer) {\r\n return;\r\n }\r\n\r\n try {\r\n this.renderer.renderFrame(this.currentFrame + this.firstFrame);\r\n } catch (error) {\r\n this.triggerRenderFrameError(error);\r\n }\r\n };\r\n\r\n AnimationItem.prototype.play = function (name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n if (this.isPaused === true) {\r\n this.isPaused = false;\r\n this.trigger('_pause');\r\n this.audioController.resume();\r\n\r\n if (this._idle) {\r\n this._idle = false;\r\n this.trigger('_active');\r\n }\r\n }\r\n };\r\n\r\n AnimationItem.prototype.pause = function (name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n if (this.isPaused === false) {\r\n this.isPaused = true;\r\n this.trigger('_play');\r\n this._idle = true;\r\n this.trigger('_idle');\r\n this.audioController.pause();\r\n }\r\n };\r\n\r\n AnimationItem.prototype.togglePause = function (name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n if (this.isPaused === true) {\r\n this.play();\r\n } else {\r\n this.pause();\r\n }\r\n };\r\n\r\n AnimationItem.prototype.stop = function (name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n this.pause();\r\n this.playCount = 0;\r\n this._completedLoop = false;\r\n this.setCurrentRawFrameValue(0);\r\n };\r\n\r\n AnimationItem.prototype.getMarkerData = function (markerName) {\r\n var marker;\r\n\r\n for (var i = 0; i < this.markers.length; i += 1) {\r\n marker = this.markers[i];\r\n\r\n if (marker.payload && marker.payload.name === markerName) {\r\n return marker;\r\n }\r\n }\r\n\r\n return null;\r\n };\r\n\r\n AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n var numValue = Number(value);\r\n\r\n if (isNaN(numValue)) {\r\n var marker = this.getMarkerData(value);\r\n\r\n if (marker) {\r\n this.goToAndStop(marker.time, true);\r\n }\r\n } else if (isFrame) {\r\n this.setCurrentRawFrameValue(value);\r\n } else {\r\n this.setCurrentRawFrameValue(value * this.frameModifier);\r\n }\r\n\r\n this.pause();\r\n };\r\n\r\n AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n var numValue = Number(value);\r\n\r\n if (isNaN(numValue)) {\r\n var marker = this.getMarkerData(value);\r\n\r\n if (marker) {\r\n if (!marker.duration) {\r\n this.goToAndStop(marker.time, true);\r\n } else {\r\n this.playSegments([marker.time, marker.time + marker.duration], true);\r\n }\r\n }\r\n } else {\r\n this.goToAndStop(numValue, isFrame, name);\r\n }\r\n\r\n this.play();\r\n };\r\n\r\n AnimationItem.prototype.advanceTime = function (value) {\r\n if (this.isPaused === true || this.isLoaded === false) {\r\n return;\r\n }\r\n\r\n var nextValue = this.currentRawFrame + value * this.frameModifier;\r\n var _isComplete = false; // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.\r\n // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.\r\n\r\n if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {\r\n if (!this.loop || this.playCount === this.loop) {\r\n if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {\r\n _isComplete = true;\r\n nextValue = this.totalFrames - 1;\r\n }\r\n } else if (nextValue >= this.totalFrames) {\r\n this.playCount += 1;\r\n\r\n if (!this.checkSegments(nextValue % this.totalFrames)) {\r\n this.setCurrentRawFrameValue(nextValue % this.totalFrames);\r\n this._completedLoop = true;\r\n this.trigger('loopComplete');\r\n }\r\n } else {\r\n this.setCurrentRawFrameValue(nextValue);\r\n }\r\n } else if (nextValue < 0) {\r\n if (!this.checkSegments(nextValue % this.totalFrames)) {\r\n if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {\r\n // eslint-disable-line no-plusplus\r\n this.setCurrentRawFrameValue(this.totalFrames + nextValue % this.totalFrames);\r\n\r\n if (!this._completedLoop) {\r\n this._completedLoop = true;\r\n } else {\r\n this.trigger('loopComplete');\r\n }\r\n } else {\r\n _isComplete = true;\r\n nextValue = 0;\r\n }\r\n }\r\n } else {\r\n this.setCurrentRawFrameValue(nextValue);\r\n }\r\n\r\n if (_isComplete) {\r\n this.setCurrentRawFrameValue(nextValue);\r\n this.pause();\r\n this.trigger('complete');\r\n }\r\n };\r\n\r\n AnimationItem.prototype.adjustSegment = function (arr, offset) {\r\n this.playCount = 0;\r\n\r\n if (arr[1] < arr[0]) {\r\n if (this.frameModifier > 0) {\r\n if (this.playSpeed < 0) {\r\n this.setSpeed(-this.playSpeed);\r\n } else {\r\n this.setDirection(-1);\r\n }\r\n }\r\n\r\n this.totalFrames = arr[0] - arr[1];\r\n this.timeCompleted = this.totalFrames;\r\n this.firstFrame = arr[1];\r\n this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);\r\n } else if (arr[1] > arr[0]) {\r\n if (this.frameModifier < 0) {\r\n if (this.playSpeed < 0) {\r\n this.setSpeed(-this.playSpeed);\r\n } else {\r\n this.setDirection(1);\r\n }\r\n }\r\n\r\n this.totalFrames = arr[1] - arr[0];\r\n this.timeCompleted = this.totalFrames;\r\n this.firstFrame = arr[0];\r\n this.setCurrentRawFrameValue(0.001 + offset);\r\n }\r\n\r\n this.trigger('segmentStart');\r\n };\r\n\r\n AnimationItem.prototype.setSegment = function (init, end) {\r\n var pendingFrame = -1;\r\n\r\n if (this.isPaused) {\r\n if (this.currentRawFrame + this.firstFrame < init) {\r\n pendingFrame = init;\r\n } else if (this.currentRawFrame + this.firstFrame > end) {\r\n pendingFrame = end - init;\r\n }\r\n }\r\n\r\n this.firstFrame = init;\r\n this.totalFrames = end - init;\r\n this.timeCompleted = this.totalFrames;\r\n\r\n if (pendingFrame !== -1) {\r\n this.goToAndStop(pendingFrame, true);\r\n }\r\n };\r\n\r\n AnimationItem.prototype.playSegments = function (arr, forceFlag) {\r\n if (forceFlag) {\r\n this.segments.length = 0;\r\n }\r\n\r\n if (_typeof$4(arr[0]) === 'object') {\r\n var i;\r\n var len = arr.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.segments.push(arr[i]);\r\n }\r\n } else {\r\n this.segments.push(arr);\r\n }\r\n\r\n if (this.segments.length && forceFlag) {\r\n this.adjustSegment(this.segments.shift(), 0);\r\n }\r\n\r\n if (this.isPaused) {\r\n this.play();\r\n }\r\n };\r\n\r\n AnimationItem.prototype.resetSegments = function (forceFlag) {\r\n this.segments.length = 0;\r\n this.segments.push([this.animationData.ip, this.animationData.op]);\r\n\r\n if (forceFlag) {\r\n this.checkSegments(0);\r\n }\r\n };\r\n\r\n AnimationItem.prototype.checkSegments = function (offset) {\r\n if (this.segments.length) {\r\n this.adjustSegment(this.segments.shift(), offset);\r\n return true;\r\n }\r\n\r\n return false;\r\n };\r\n\r\n AnimationItem.prototype.destroy = function (name) {\r\n if (name && this.name !== name || !this.renderer) {\r\n return;\r\n }\r\n\r\n this.renderer.destroy();\r\n this.imagePreloader.destroy();\r\n this.trigger('destroy');\r\n this._cbs = null;\r\n this.onEnterFrame = null;\r\n this.onLoopComplete = null;\r\n this.onComplete = null;\r\n this.onSegmentStart = null;\r\n this.onDestroy = null;\r\n this.renderer = null;\r\n this.renderer = null;\r\n this.imagePreloader = null;\r\n this.projectInterface = null;\r\n };\r\n\r\n AnimationItem.prototype.setCurrentRawFrameValue = function (value) {\r\n this.currentRawFrame = value;\r\n this.gotoFrame();\r\n };\r\n\r\n AnimationItem.prototype.setSpeed = function (val) {\r\n this.playSpeed = val;\r\n this.updaFrameModifier();\r\n };\r\n\r\n AnimationItem.prototype.setDirection = function (val) {\r\n this.playDirection = val < 0 ? -1 : 1;\r\n this.updaFrameModifier();\r\n };\r\n\r\n AnimationItem.prototype.setVolume = function (val, name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n this.audioController.setVolume(val);\r\n };\r\n\r\n AnimationItem.prototype.getVolume = function () {\r\n return this.audioController.getVolume();\r\n };\r\n\r\n AnimationItem.prototype.mute = function (name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n this.audioController.mute();\r\n };\r\n\r\n AnimationItem.prototype.unmute = function (name) {\r\n if (name && this.name !== name) {\r\n return;\r\n }\r\n\r\n this.audioController.unmute();\r\n };\r\n\r\n AnimationItem.prototype.updaFrameModifier = function () {\r\n this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;\r\n this.audioController.setRate(this.playSpeed * this.playDirection);\r\n };\r\n\r\n AnimationItem.prototype.getPath = function () {\r\n return this.path;\r\n };\r\n\r\n AnimationItem.prototype.getAssetsPath = function (assetData) {\r\n var path = '';\r\n\r\n if (assetData.e) {\r\n path = assetData.p;\r\n } else if (this.assetsPath) {\r\n var imagePath = assetData.p;\r\n\r\n if (imagePath.indexOf('images/') !== -1) {\r\n imagePath = imagePath.split('/')[1];\r\n }\r\n\r\n path = this.assetsPath + imagePath;\r\n } else {\r\n path = this.path;\r\n path += assetData.u ? assetData.u : '';\r\n path += assetData.p;\r\n }\r\n\r\n return path;\r\n };\r\n\r\n AnimationItem.prototype.getAssetData = function (id) {\r\n var i = 0;\r\n var len = this.assets.length;\r\n\r\n while (i < len) {\r\n if (id === this.assets[i].id) {\r\n return this.assets[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n AnimationItem.prototype.hide = function () {\r\n this.renderer.hide();\r\n };\r\n\r\n AnimationItem.prototype.show = function () {\r\n this.renderer.show();\r\n };\r\n\r\n AnimationItem.prototype.getDuration = function (isFrame) {\r\n return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;\r\n };\r\n\r\n AnimationItem.prototype.updateDocumentData = function (path, documentData, index) {\r\n try {\r\n var element = this.renderer.getElementByPath(path);\r\n element.updateDocumentData(documentData, index);\r\n } catch (error) {// TODO: decide how to handle catch case\r\n }\r\n };\r\n\r\n AnimationItem.prototype.trigger = function (name) {\r\n if (this._cbs && this._cbs[name]) {\r\n switch (name) {\r\n case 'enterFrame':\r\n this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier));\r\n break;\r\n\r\n case 'drawnFrame':\r\n this.drawnFrameEvent.currentTime = this.currentFrame;\r\n this.drawnFrameEvent.totalTime = this.totalFrames;\r\n this.drawnFrameEvent.direction = this.frameModifier;\r\n this.triggerEvent(name, this.drawnFrameEvent);\r\n break;\r\n\r\n case 'loopComplete':\r\n this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\r\n break;\r\n\r\n case 'complete':\r\n this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult));\r\n break;\r\n\r\n case 'segmentStart':\r\n this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\r\n break;\r\n\r\n case 'destroy':\r\n this.triggerEvent(name, new BMDestroyEvent(name, this));\r\n break;\r\n\r\n default:\r\n this.triggerEvent(name);\r\n }\r\n }\r\n\r\n if (name === 'enterFrame' && this.onEnterFrame) {\r\n this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult));\r\n }\r\n\r\n if (name === 'loopComplete' && this.onLoopComplete) {\r\n this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult));\r\n }\r\n\r\n if (name === 'complete' && this.onComplete) {\r\n this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult));\r\n }\r\n\r\n if (name === 'segmentStart' && this.onSegmentStart) {\r\n this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames));\r\n }\r\n\r\n if (name === 'destroy' && this.onDestroy) {\r\n this.onDestroy.call(this, new BMDestroyEvent(name, this));\r\n }\r\n };\r\n\r\n AnimationItem.prototype.triggerRenderFrameError = function (nativeError) {\r\n var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame);\r\n this.triggerEvent('error', error);\r\n\r\n if (this.onError) {\r\n this.onError.call(this, error);\r\n }\r\n };\r\n\r\n AnimationItem.prototype.triggerConfigError = function (nativeError) {\r\n var error = new BMConfigErrorEvent(nativeError, this.currentFrame);\r\n this.triggerEvent('error', error);\r\n\r\n if (this.onError) {\r\n this.onError.call(this, error);\r\n }\r\n };\r\n\r\n var animationManager = function () {\r\n var moduleOb = {};\r\n var registeredAnimations = [];\r\n var initTime = 0;\r\n var len = 0;\r\n var playingAnimationsNum = 0;\r\n var _stopped = true;\r\n var _isFrozen = false;\r\n\r\n function removeElement(ev) {\r\n var i = 0;\r\n var animItem = ev.target;\r\n\r\n while (i < len) {\r\n if (registeredAnimations[i].animation === animItem) {\r\n registeredAnimations.splice(i, 1);\r\n i -= 1;\r\n len -= 1;\r\n\r\n if (!animItem.isPaused) {\r\n subtractPlayingCount();\r\n }\r\n }\r\n\r\n i += 1;\r\n }\r\n }\r\n\r\n function registerAnimation(element, animationData) {\r\n if (!element) {\r\n return null;\r\n }\r\n\r\n var i = 0;\r\n\r\n while (i < len) {\r\n if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) {\r\n return registeredAnimations[i].animation;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n var animItem = new AnimationItem();\r\n setupAnimation(animItem, element);\r\n animItem.setData(element, animationData);\r\n return animItem;\r\n }\r\n\r\n function getRegisteredAnimations() {\r\n var i;\r\n var lenAnims = registeredAnimations.length;\r\n var animations = [];\r\n\r\n for (i = 0; i < lenAnims; i += 1) {\r\n animations.push(registeredAnimations[i].animation);\r\n }\r\n\r\n return animations;\r\n }\r\n\r\n function addPlayingCount() {\r\n playingAnimationsNum += 1;\r\n activate();\r\n }\r\n\r\n function subtractPlayingCount() {\r\n playingAnimationsNum -= 1;\r\n }\r\n\r\n function setupAnimation(animItem, element) {\r\n animItem.addEventListener('destroy', removeElement);\r\n animItem.addEventListener('_active', addPlayingCount);\r\n animItem.addEventListener('_idle', subtractPlayingCount);\r\n registeredAnimations.push({\r\n elem: element,\r\n animation: animItem\r\n });\r\n len += 1;\r\n }\r\n\r\n function loadAnimation(params) {\r\n var animItem = new AnimationItem();\r\n setupAnimation(animItem, null);\r\n animItem.setParams(params);\r\n return animItem;\r\n }\r\n\r\n function setSpeed(val, animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.setSpeed(val, animation);\r\n }\r\n }\r\n\r\n function setDirection(val, animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.setDirection(val, animation);\r\n }\r\n }\r\n\r\n function play(animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.play(animation);\r\n }\r\n }\r\n\r\n function resume(nowTime) {\r\n var elapsedTime = nowTime - initTime;\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.advanceTime(elapsedTime);\r\n }\r\n\r\n initTime = nowTime;\r\n\r\n if (playingAnimationsNum && !_isFrozen) {\r\n window.requestAnimationFrame(resume);\r\n } else {\r\n _stopped = true;\r\n }\r\n }\r\n\r\n function first(nowTime) {\r\n initTime = nowTime;\r\n window.requestAnimationFrame(resume);\r\n }\r\n\r\n function pause(animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.pause(animation);\r\n }\r\n }\r\n\r\n function goToAndStop(value, isFrame, animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.goToAndStop(value, isFrame, animation);\r\n }\r\n }\r\n\r\n function stop(animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.stop(animation);\r\n }\r\n }\r\n\r\n function togglePause(animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.togglePause(animation);\r\n }\r\n }\r\n\r\n function destroy(animation) {\r\n var i;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n registeredAnimations[i].animation.destroy(animation);\r\n }\r\n }\r\n\r\n function searchAnimations(animationData, standalone, renderer) {\r\n var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')), [].slice.call(document.getElementsByClassName('bodymovin')));\r\n var i;\r\n var lenAnims = animElements.length;\r\n\r\n for (i = 0; i < lenAnims; i += 1) {\r\n if (renderer) {\r\n animElements[i].setAttribute('data-bm-type', renderer);\r\n }\r\n\r\n registerAnimation(animElements[i], animationData);\r\n }\r\n\r\n if (standalone && lenAnims === 0) {\r\n if (!renderer) {\r\n renderer = 'svg';\r\n }\r\n\r\n var body = document.getElementsByTagName('body')[0];\r\n body.innerText = '';\r\n var div = createTag('div');\r\n div.style.width = '100%';\r\n div.style.height = '100%';\r\n div.setAttribute('data-bm-type', renderer);\r\n body.appendChild(div);\r\n registerAnimation(div, animationData);\r\n }\r\n }\r\n\r\n function resize() {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.resize();\r\n }\r\n }\r\n\r\n function activate() {\r\n if (!_isFrozen && playingAnimationsNum) {\r\n if (_stopped) {\r\n window.requestAnimationFrame(first);\r\n _stopped = false;\r\n }\r\n }\r\n }\r\n\r\n function freeze() {\r\n _isFrozen = true;\r\n }\r\n\r\n function unfreeze() {\r\n _isFrozen = false;\r\n activate();\r\n }\r\n\r\n function setVolume(val, animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.setVolume(val, animation);\r\n }\r\n }\r\n\r\n function mute(animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.mute(animation);\r\n }\r\n }\r\n\r\n function unmute(animation) {\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registeredAnimations[i].animation.unmute(animation);\r\n }\r\n }\r\n\r\n moduleOb.registerAnimation = registerAnimation;\r\n moduleOb.loadAnimation = loadAnimation;\r\n moduleOb.setSpeed = setSpeed;\r\n moduleOb.setDirection = setDirection;\r\n moduleOb.play = play;\r\n moduleOb.pause = pause;\r\n moduleOb.stop = stop;\r\n moduleOb.togglePause = togglePause;\r\n moduleOb.searchAnimations = searchAnimations;\r\n moduleOb.resize = resize; // moduleOb.start = start;\r\n\r\n moduleOb.goToAndStop = goToAndStop;\r\n moduleOb.destroy = destroy;\r\n moduleOb.freeze = freeze;\r\n moduleOb.unfreeze = unfreeze;\r\n moduleOb.setVolume = setVolume;\r\n moduleOb.mute = mute;\r\n moduleOb.unmute = unmute;\r\n moduleOb.getRegisteredAnimations = getRegisteredAnimations;\r\n return moduleOb;\r\n }();\r\n\r\n /* eslint-disable */\r\n var BezierFactory = function () {\r\n /**\r\n * BezierEasing - use bezier curve for transition easing function\r\n * by Ga\u00EBtan Renaudeau 2014 - 2015 \u2013 MIT License\r\n *\r\n * Credits: is based on Firefox's nsSMILKeySpline.cpp\r\n * Usage:\r\n * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])\r\n * spline.get(x) => returns the easing value | x must be in [0, 1] range\r\n *\r\n */\r\n var ob = {};\r\n ob.getBezierEasing = getBezierEasing;\r\n var beziers = {};\r\n\r\n function getBezierEasing(a, b, c, d, nm) {\r\n var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\\./g, 'p');\r\n\r\n if (beziers[str]) {\r\n return beziers[str];\r\n }\r\n\r\n var bezEasing = new BezierEasing([a, b, c, d]);\r\n beziers[str] = bezEasing;\r\n return bezEasing;\r\n } // These values are established by empiricism with tests (tradeoff: performance VS precision)\r\n\r\n\r\n var NEWTON_ITERATIONS = 4;\r\n var NEWTON_MIN_SLOPE = 0.001;\r\n var SUBDIVISION_PRECISION = 0.0000001;\r\n var SUBDIVISION_MAX_ITERATIONS = 10;\r\n var kSplineTableSize = 11;\r\n var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);\r\n var float32ArraySupported = typeof Float32Array === 'function';\r\n\r\n function A(aA1, aA2) {\r\n return 1.0 - 3.0 * aA2 + 3.0 * aA1;\r\n }\r\n\r\n function B(aA1, aA2) {\r\n return 3.0 * aA2 - 6.0 * aA1;\r\n }\r\n\r\n function C(aA1) {\r\n return 3.0 * aA1;\r\n } // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\r\n\r\n\r\n function calcBezier(aT, aA1, aA2) {\r\n return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;\r\n } // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\r\n\r\n\r\n function getSlope(aT, aA1, aA2) {\r\n return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);\r\n }\r\n\r\n function binarySubdivide(aX, aA, aB, mX1, mX2) {\r\n var currentX,\r\n currentT,\r\n i = 0;\r\n\r\n do {\r\n currentT = aA + (aB - aA) / 2.0;\r\n currentX = calcBezier(currentT, mX1, mX2) - aX;\r\n\r\n if (currentX > 0.0) {\r\n aB = currentT;\r\n } else {\r\n aA = currentT;\r\n }\r\n } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);\r\n\r\n return currentT;\r\n }\r\n\r\n function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {\r\n for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\r\n var currentSlope = getSlope(aGuessT, mX1, mX2);\r\n if (currentSlope === 0.0) return aGuessT;\r\n var currentX = calcBezier(aGuessT, mX1, mX2) - aX;\r\n aGuessT -= currentX / currentSlope;\r\n }\r\n\r\n return aGuessT;\r\n }\r\n /**\r\n * points is an array of [ mX1, mY1, mX2, mY2 ]\r\n */\r\n\r\n\r\n function BezierEasing(points) {\r\n this._p = points;\r\n this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);\r\n this._precomputed = false;\r\n this.get = this.get.bind(this);\r\n }\r\n\r\n BezierEasing.prototype = {\r\n get: function get(x) {\r\n var mX1 = this._p[0],\r\n mY1 = this._p[1],\r\n mX2 = this._p[2],\r\n mY2 = this._p[3];\r\n if (!this._precomputed) this._precompute();\r\n if (mX1 === mY1 && mX2 === mY2) return x; // linear\r\n // Because JavaScript number are imprecise, we should guarantee the extremes are right.\r\n\r\n if (x === 0) return 0;\r\n if (x === 1) return 1;\r\n return calcBezier(this._getTForX(x), mY1, mY2);\r\n },\r\n // Private part\r\n _precompute: function _precompute() {\r\n var mX1 = this._p[0],\r\n mY1 = this._p[1],\r\n mX2 = this._p[2],\r\n mY2 = this._p[3];\r\n this._precomputed = true;\r\n\r\n if (mX1 !== mY1 || mX2 !== mY2) {\r\n this._calcSampleValues();\r\n }\r\n },\r\n _calcSampleValues: function _calcSampleValues() {\r\n var mX1 = this._p[0],\r\n mX2 = this._p[2];\r\n\r\n for (var i = 0; i < kSplineTableSize; ++i) {\r\n this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\r\n }\r\n },\r\n\r\n /**\r\n * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.\r\n */\r\n _getTForX: function _getTForX(aX) {\r\n var mX1 = this._p[0],\r\n mX2 = this._p[2],\r\n mSampleValues = this._mSampleValues;\r\n var intervalStart = 0.0;\r\n var currentSample = 1;\r\n var lastSample = kSplineTableSize - 1;\r\n\r\n for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {\r\n intervalStart += kSampleStepSize;\r\n }\r\n\r\n --currentSample; // Interpolate to provide an initial guess for t\r\n\r\n var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]);\r\n var guessForT = intervalStart + dist * kSampleStepSize;\r\n var initialSlope = getSlope(guessForT, mX1, mX2);\r\n\r\n if (initialSlope >= NEWTON_MIN_SLOPE) {\r\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\r\n }\r\n\r\n if (initialSlope === 0.0) {\r\n return guessForT;\r\n }\r\n\r\n return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);\r\n }\r\n };\r\n return ob;\r\n }();\r\n\r\n var pooling = function () {\r\n function _double(arr) {\r\n return arr.concat(createSizedArray(arr.length));\r\n }\r\n\r\n return {\r\n \"double\": _double\r\n };\r\n }();\r\n\r\n var poolFactory = function () {\r\n return function (initialLength, _create, _release) {\r\n var _length = 0;\r\n var _maxLength = initialLength;\r\n var pool = createSizedArray(_maxLength);\r\n var ob = {\r\n newElement: newElement,\r\n release: release\r\n };\r\n\r\n function newElement() {\r\n var element;\r\n\r\n if (_length) {\r\n _length -= 1;\r\n element = pool[_length];\r\n } else {\r\n element = _create();\r\n }\r\n\r\n return element;\r\n }\r\n\r\n function release(element) {\r\n if (_length === _maxLength) {\r\n pool = pooling[\"double\"](pool);\r\n _maxLength *= 2;\r\n }\r\n\r\n if (_release) {\r\n _release(element);\r\n }\r\n\r\n pool[_length] = element;\r\n _length += 1;\r\n }\r\n\r\n return ob;\r\n };\r\n }();\r\n\r\n var bezierLengthPool = function () {\r\n function create() {\r\n return {\r\n addedLength: 0,\r\n percents: createTypedArray('float32', getDefaultCurveSegments()),\r\n lengths: createTypedArray('float32', getDefaultCurveSegments())\r\n };\r\n }\r\n\r\n return poolFactory(8, create);\r\n }();\r\n\r\n var segmentsLengthPool = function () {\r\n function create() {\r\n return {\r\n lengths: [],\r\n totalLength: 0\r\n };\r\n }\r\n\r\n function release(element) {\r\n var i;\r\n var len = element.lengths.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n bezierLengthPool.release(element.lengths[i]);\r\n }\r\n\r\n element.lengths.length = 0;\r\n }\r\n\r\n return poolFactory(8, create, release);\r\n }();\r\n\r\n function bezFunction() {\r\n var math = Math;\r\n\r\n function pointOnLine2D(x1, y1, x2, y2, x3, y3) {\r\n var det1 = x1 * y2 + y1 * x3 + x2 * y3 - x3 * y2 - y3 * x1 - x2 * y1;\r\n return det1 > -0.001 && det1 < 0.001;\r\n }\r\n\r\n function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) {\r\n if (z1 === 0 && z2 === 0 && z3 === 0) {\r\n return pointOnLine2D(x1, y1, x2, y2, x3, y3);\r\n }\r\n\r\n var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2));\r\n var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2));\r\n var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2));\r\n var diffDist;\r\n\r\n if (dist1 > dist2) {\r\n if (dist1 > dist3) {\r\n diffDist = dist1 - dist2 - dist3;\r\n } else {\r\n diffDist = dist3 - dist2 - dist1;\r\n }\r\n } else if (dist3 > dist2) {\r\n diffDist = dist3 - dist2 - dist1;\r\n } else {\r\n diffDist = dist2 - dist1 - dist3;\r\n }\r\n\r\n return diffDist > -0.0001 && diffDist < 0.0001;\r\n }\r\n\r\n var getBezierLength = function () {\r\n return function (pt1, pt2, pt3, pt4) {\r\n var curveSegments = getDefaultCurveSegments();\r\n var k;\r\n var i;\r\n var len;\r\n var ptCoord;\r\n var perc;\r\n var addedLength = 0;\r\n var ptDistance;\r\n var point = [];\r\n var lastPoint = [];\r\n var lengthData = bezierLengthPool.newElement();\r\n len = pt3.length;\r\n\r\n for (k = 0; k < curveSegments; k += 1) {\r\n perc = k / (curveSegments - 1);\r\n ptDistance = 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] + bmPow(perc, 3) * pt2[i];\r\n point[i] = ptCoord;\r\n\r\n if (lastPoint[i] !== null) {\r\n ptDistance += bmPow(point[i] - lastPoint[i], 2);\r\n }\r\n\r\n lastPoint[i] = point[i];\r\n }\r\n\r\n if (ptDistance) {\r\n ptDistance = bmSqrt(ptDistance);\r\n addedLength += ptDistance;\r\n }\r\n\r\n lengthData.percents[k] = perc;\r\n lengthData.lengths[k] = addedLength;\r\n }\r\n\r\n lengthData.addedLength = addedLength;\r\n return lengthData;\r\n };\r\n }();\r\n\r\n function getSegmentsLength(shapeData) {\r\n var segmentsLength = segmentsLengthPool.newElement();\r\n var closed = shapeData.c;\r\n var pathV = shapeData.v;\r\n var pathO = shapeData.o;\r\n var pathI = shapeData.i;\r\n var i;\r\n var len = shapeData._length;\r\n var lengths = segmentsLength.lengths;\r\n var totalLength = 0;\r\n\r\n for (i = 0; i < len - 1; i += 1) {\r\n lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]);\r\n totalLength += lengths[i].addedLength;\r\n }\r\n\r\n if (closed && len) {\r\n lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]);\r\n totalLength += lengths[i].addedLength;\r\n }\r\n\r\n segmentsLength.totalLength = totalLength;\r\n return segmentsLength;\r\n }\r\n\r\n function BezierData(length) {\r\n this.segmentLength = 0;\r\n this.points = new Array(length);\r\n }\r\n\r\n function PointData(partial, point) {\r\n this.partialLength = partial;\r\n this.point = point;\r\n }\r\n\r\n var buildBezierData = function () {\r\n var storedData = {};\r\n return function (pt1, pt2, pt3, pt4) {\r\n var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\\./g, 'p');\r\n\r\n if (!storedData[bezierName]) {\r\n var curveSegments = getDefaultCurveSegments();\r\n var k;\r\n var i;\r\n var len;\r\n var ptCoord;\r\n var perc;\r\n var addedLength = 0;\r\n var ptDistance;\r\n var point;\r\n var lastPoint = null;\r\n\r\n if (pt1.length === 2 && (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) {\r\n curveSegments = 2;\r\n }\r\n\r\n var bezierData = new BezierData(curveSegments);\r\n len = pt3.length;\r\n\r\n for (k = 0; k < curveSegments; k += 1) {\r\n point = createSizedArray(len);\r\n perc = k / (curveSegments - 1);\r\n ptDistance = 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) + bmPow(perc, 3) * pt2[i];\r\n point[i] = ptCoord;\r\n\r\n if (lastPoint !== null) {\r\n ptDistance += bmPow(point[i] - lastPoint[i], 2);\r\n }\r\n }\r\n\r\n ptDistance = bmSqrt(ptDistance);\r\n addedLength += ptDistance;\r\n bezierData.points[k] = new PointData(ptDistance, point);\r\n lastPoint = point;\r\n }\r\n\r\n bezierData.segmentLength = addedLength;\r\n storedData[bezierName] = bezierData;\r\n }\r\n\r\n return storedData[bezierName];\r\n };\r\n }();\r\n\r\n function getDistancePerc(perc, bezierData) {\r\n var percents = bezierData.percents;\r\n var lengths = bezierData.lengths;\r\n var len = percents.length;\r\n var initPos = bmFloor((len - 1) * perc);\r\n var lengthPos = perc * bezierData.addedLength;\r\n var lPerc = 0;\r\n\r\n if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) {\r\n return percents[initPos];\r\n }\r\n\r\n var dir = lengths[initPos] > lengthPos ? -1 : 1;\r\n var flag = true;\r\n\r\n while (flag) {\r\n if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) {\r\n lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]);\r\n flag = false;\r\n } else {\r\n initPos += dir;\r\n }\r\n\r\n if (initPos < 0 || initPos >= len - 1) {\r\n // FIX for TypedArrays that don't store floating point values with enough accuracy\r\n if (initPos === len - 1) {\r\n return percents[initPos];\r\n }\r\n\r\n flag = false;\r\n }\r\n }\r\n\r\n return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc;\r\n }\r\n\r\n function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {\r\n var t1 = getDistancePerc(percent, bezierData);\r\n var u1 = 1 - t1;\r\n var ptX = math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000;\r\n var ptY = math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000;\r\n return [ptX, ptY];\r\n }\r\n\r\n var bezierSegmentPoints = createTypedArray('float32', 8);\r\n\r\n function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) {\r\n if (startPerc < 0) {\r\n startPerc = 0;\r\n } else if (startPerc > 1) {\r\n startPerc = 1;\r\n }\r\n\r\n var t0 = getDistancePerc(startPerc, bezierData);\r\n endPerc = endPerc > 1 ? 1 : endPerc;\r\n var t1 = getDistancePerc(endPerc, bezierData);\r\n var i;\r\n var len = pt1.length;\r\n var u0 = 1 - t0;\r\n var u1 = 1 - t1;\r\n var u0u0u0 = u0 * u0 * u0;\r\n var t0u0u0_3 = t0 * u0 * u0 * 3; // eslint-disable-line camelcase\r\n\r\n var t0t0u0_3 = t0 * t0 * u0 * 3; // eslint-disable-line camelcase\r\n\r\n var t0t0t0 = t0 * t0 * t0; //\r\n\r\n var u0u0u1 = u0 * u0 * u1;\r\n var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1; // eslint-disable-line camelcase\r\n\r\n var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1; // eslint-disable-line camelcase\r\n\r\n var t0t0t1 = t0 * t0 * t1; //\r\n\r\n var u0u1u1 = u0 * u1 * u1;\r\n var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1; // eslint-disable-line camelcase\r\n\r\n var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1; // eslint-disable-line camelcase\r\n\r\n var t0t1t1 = t0 * t1 * t1; //\r\n\r\n var u1u1u1 = u1 * u1 * u1;\r\n var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1; // eslint-disable-line camelcase\r\n\r\n var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1; // eslint-disable-line camelcase\r\n\r\n var t1t1t1 = t1 * t1 * t1;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n bezierSegmentPoints[i * 4] = math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n\r\n bezierSegmentPoints[i * 4 + 1] = math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n\r\n bezierSegmentPoints[i * 4 + 2] = math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n\r\n bezierSegmentPoints[i * 4 + 3] = math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase\r\n }\r\n\r\n return bezierSegmentPoints;\r\n }\r\n\r\n return {\r\n getSegmentsLength: getSegmentsLength,\r\n getNewSegment: getNewSegment,\r\n getPointInSegment: getPointInSegment,\r\n buildBezierData: buildBezierData,\r\n pointOnLine2D: pointOnLine2D,\r\n pointOnLine3D: pointOnLine3D\r\n };\r\n }\r\n\r\n var bez = bezFunction();\r\n\r\n var PropertyFactory = function () {\r\n var initFrame = initialDefaultFrame;\r\n var mathAbs = Math.abs;\r\n\r\n function interpolateValue(frameNum, caching) {\r\n var offsetTime = this.offsetTime;\r\n var newValue;\r\n\r\n if (this.propType === 'multidimensional') {\r\n newValue = createTypedArray('float32', this.pv.length);\r\n }\r\n\r\n var iterationIndex = caching.lastIndex;\r\n var i = iterationIndex;\r\n var len = this.keyframes.length - 1;\r\n var flag = true;\r\n var keyData;\r\n var nextKeyData;\r\n var keyframeMetadata;\r\n\r\n while (flag) {\r\n keyData = this.keyframes[i];\r\n nextKeyData = this.keyframes[i + 1];\r\n\r\n if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) {\r\n if (keyData.h) {\r\n keyData = nextKeyData;\r\n }\r\n\r\n iterationIndex = 0;\r\n break;\r\n }\r\n\r\n if (nextKeyData.t - offsetTime > frameNum) {\r\n iterationIndex = i;\r\n break;\r\n }\r\n\r\n if (i < len - 1) {\r\n i += 1;\r\n } else {\r\n iterationIndex = 0;\r\n flag = false;\r\n }\r\n }\r\n\r\n keyframeMetadata = this.keyframesMetadata[i] || {};\r\n var k;\r\n var kLen;\r\n var perc;\r\n var jLen;\r\n var j;\r\n var fnc;\r\n var nextKeyTime = nextKeyData.t - offsetTime;\r\n var keyTime = keyData.t - offsetTime;\r\n var endValue;\r\n\r\n if (keyData.to) {\r\n if (!keyframeMetadata.bezierData) {\r\n keyframeMetadata.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);\r\n }\r\n\r\n var bezierData = keyframeMetadata.bezierData;\r\n\r\n if (frameNum >= nextKeyTime || frameNum < keyTime) {\r\n var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;\r\n kLen = bezierData.points[ind].point.length;\r\n\r\n for (k = 0; k < kLen; k += 1) {\r\n newValue[k] = bezierData.points[ind].point[k];\r\n } // caching._lastKeyframeIndex = -1;\r\n\r\n } else {\r\n if (keyframeMetadata.__fnct) {\r\n fnc = keyframeMetadata.__fnct;\r\n } else {\r\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;\r\n keyframeMetadata.__fnct = fnc;\r\n }\r\n\r\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\r\n var distanceInLine = bezierData.segmentLength * perc;\r\n var segmentPerc;\r\n var addedLength = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastAddedLength : 0;\r\n j = caching.lastFrame < frameNum && caching._lastKeyframeIndex === i ? caching._lastPoint : 0;\r\n flag = true;\r\n jLen = bezierData.points.length;\r\n\r\n while (flag) {\r\n addedLength += bezierData.points[j].partialLength;\r\n\r\n if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {\r\n kLen = bezierData.points[j].point.length;\r\n\r\n for (k = 0; k < kLen; k += 1) {\r\n newValue[k] = bezierData.points[j].point[k];\r\n }\r\n\r\n break;\r\n } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {\r\n segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;\r\n kLen = bezierData.points[j].point.length;\r\n\r\n for (k = 0; k < kLen; k += 1) {\r\n newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;\r\n }\r\n\r\n break;\r\n }\r\n\r\n if (j < jLen - 1) {\r\n j += 1;\r\n } else {\r\n flag = false;\r\n }\r\n }\r\n\r\n caching._lastPoint = j;\r\n caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;\r\n caching._lastKeyframeIndex = i;\r\n }\r\n } else {\r\n var outX;\r\n var outY;\r\n var inX;\r\n var inY;\r\n var keyValue;\r\n len = keyData.s.length;\r\n endValue = nextKeyData.s || keyData.e;\r\n\r\n if (this.sh && keyData.h !== 1) {\r\n if (frameNum >= nextKeyTime) {\r\n newValue[0] = endValue[0];\r\n newValue[1] = endValue[1];\r\n newValue[2] = endValue[2];\r\n } else if (frameNum <= keyTime) {\r\n newValue[0] = keyData.s[0];\r\n newValue[1] = keyData.s[1];\r\n newValue[2] = keyData.s[2];\r\n } else {\r\n var quatStart = createQuaternion(keyData.s);\r\n var quatEnd = createQuaternion(endValue);\r\n var time = (frameNum - keyTime) / (nextKeyTime - keyTime);\r\n quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));\r\n }\r\n } else {\r\n for (i = 0; i < len; i += 1) {\r\n if (keyData.h !== 1) {\r\n if (frameNum >= nextKeyTime) {\r\n perc = 1;\r\n } else if (frameNum < keyTime) {\r\n perc = 0;\r\n } else {\r\n if (keyData.o.x.constructor === Array) {\r\n if (!keyframeMetadata.__fnct) {\r\n keyframeMetadata.__fnct = [];\r\n }\r\n\r\n if (!keyframeMetadata.__fnct[i]) {\r\n outX = keyData.o.x[i] === undefined ? keyData.o.x[0] : keyData.o.x[i];\r\n outY = keyData.o.y[i] === undefined ? keyData.o.y[0] : keyData.o.y[i];\r\n inX = keyData.i.x[i] === undefined ? keyData.i.x[0] : keyData.i.x[i];\r\n inY = keyData.i.y[i] === undefined ? keyData.i.y[0] : keyData.i.y[i];\r\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\r\n keyframeMetadata.__fnct[i] = fnc;\r\n } else {\r\n fnc = keyframeMetadata.__fnct[i];\r\n }\r\n } else if (!keyframeMetadata.__fnct) {\r\n outX = keyData.o.x;\r\n outY = keyData.o.y;\r\n inX = keyData.i.x;\r\n inY = keyData.i.y;\r\n fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;\r\n keyData.keyframeMetadata = fnc;\r\n } else {\r\n fnc = keyframeMetadata.__fnct;\r\n }\r\n\r\n perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));\r\n }\r\n }\r\n\r\n endValue = nextKeyData.s || keyData.e;\r\n keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;\r\n\r\n if (this.propType === 'multidimensional') {\r\n newValue[i] = keyValue;\r\n } else {\r\n newValue = keyValue;\r\n }\r\n }\r\n }\r\n }\r\n\r\n caching.lastIndex = iterationIndex;\r\n return newValue;\r\n } // based on @Toji's https://github.com/toji/gl-matrix/\r\n\r\n\r\n function slerp(a, b, t) {\r\n var out = [];\r\n var ax = a[0];\r\n var ay = a[1];\r\n var az = a[2];\r\n var aw = a[3];\r\n var bx = b[0];\r\n var by = b[1];\r\n var bz = b[2];\r\n var bw = b[3];\r\n var omega;\r\n var cosom;\r\n var sinom;\r\n var scale0;\r\n var scale1;\r\n cosom = ax * bx + ay * by + az * bz + aw * bw;\r\n\r\n if (cosom < 0.0) {\r\n cosom = -cosom;\r\n bx = -bx;\r\n by = -by;\r\n bz = -bz;\r\n bw = -bw;\r\n }\r\n\r\n if (1.0 - cosom > 0.000001) {\r\n omega = Math.acos(cosom);\r\n sinom = Math.sin(omega);\r\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\r\n scale1 = Math.sin(t * omega) / sinom;\r\n } else {\r\n scale0 = 1.0 - t;\r\n scale1 = t;\r\n }\r\n\r\n out[0] = scale0 * ax + scale1 * bx;\r\n out[1] = scale0 * ay + scale1 * by;\r\n out[2] = scale0 * az + scale1 * bz;\r\n out[3] = scale0 * aw + scale1 * bw;\r\n return out;\r\n }\r\n\r\n function quaternionToEuler(out, quat) {\r\n var qx = quat[0];\r\n var qy = quat[1];\r\n var qz = quat[2];\r\n var qw = quat[3];\r\n var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz);\r\n var attitude = Math.asin(2 * qx * qy + 2 * qz * qw);\r\n var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz);\r\n out[0] = heading / degToRads;\r\n out[1] = attitude / degToRads;\r\n out[2] = bank / degToRads;\r\n }\r\n\r\n function createQuaternion(values) {\r\n var heading = values[0] * degToRads;\r\n var attitude = values[1] * degToRads;\r\n var bank = values[2] * degToRads;\r\n var c1 = Math.cos(heading / 2);\r\n var c2 = Math.cos(attitude / 2);\r\n var c3 = Math.cos(bank / 2);\r\n var s1 = Math.sin(heading / 2);\r\n var s2 = Math.sin(attitude / 2);\r\n var s3 = Math.sin(bank / 2);\r\n var w = c1 * c2 * c3 - s1 * s2 * s3;\r\n var x = s1 * s2 * c3 + c1 * c2 * s3;\r\n var y = s1 * c2 * c3 + c1 * s2 * s3;\r\n var z = c1 * s2 * c3 - s1 * c2 * s3;\r\n return [x, y, z, w];\r\n }\r\n\r\n function getValueAtCurrentTime() {\r\n var frameNum = this.comp.renderedFrame - this.offsetTime;\r\n var initTime = this.keyframes[0].t - this.offsetTime;\r\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\r\n\r\n if (!(frameNum === this._caching.lastFrame || this._caching.lastFrame !== initFrame && (this._caching.lastFrame >= endTime && frameNum >= endTime || this._caching.lastFrame < initTime && frameNum < initTime))) {\r\n if (this._caching.lastFrame >= frameNum) {\r\n this._caching._lastKeyframeIndex = -1;\r\n this._caching.lastIndex = 0;\r\n }\r\n\r\n var renderResult = this.interpolateValue(frameNum, this._caching);\r\n this.pv = renderResult;\r\n }\r\n\r\n this._caching.lastFrame = frameNum;\r\n return this.pv;\r\n }\r\n\r\n function setVValue(val) {\r\n var multipliedValue;\r\n\r\n if (this.propType === 'unidimensional') {\r\n multipliedValue = val * this.mult;\r\n\r\n if (mathAbs(this.v - multipliedValue) > 0.00001) {\r\n this.v = multipliedValue;\r\n this._mdf = true;\r\n }\r\n } else {\r\n var i = 0;\r\n var len = this.v.length;\r\n\r\n while (i < len) {\r\n multipliedValue = val[i] * this.mult;\r\n\r\n if (mathAbs(this.v[i] - multipliedValue) > 0.00001) {\r\n this.v[i] = multipliedValue;\r\n this._mdf = true;\r\n }\r\n\r\n i += 1;\r\n }\r\n }\r\n }\r\n\r\n function processEffectsSequence() {\r\n if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {\r\n return;\r\n }\r\n\r\n if (this.lock) {\r\n this.setVValue(this.pv);\r\n return;\r\n }\r\n\r\n this.lock = true;\r\n this._mdf = this._isFirstFrame;\r\n var i;\r\n var len = this.effectsSequence.length;\r\n var finalValue = this.kf ? this.pv : this.data.k;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n finalValue = this.effectsSequence[i](finalValue);\r\n }\r\n\r\n this.setVValue(finalValue);\r\n this._isFirstFrame = false;\r\n this.lock = false;\r\n this.frameId = this.elem.globalData.frameId;\r\n }\r\n\r\n function addEffect(effectFunction) {\r\n this.effectsSequence.push(effectFunction);\r\n this.container.addDynamicProperty(this);\r\n }\r\n\r\n function ValueProperty(elem, data, mult, container) {\r\n this.propType = 'unidimensional';\r\n this.mult = mult || 1;\r\n this.data = data;\r\n this.v = mult ? data.k * mult : data.k;\r\n this.pv = data.k;\r\n this._mdf = false;\r\n this.elem = elem;\r\n this.container = container;\r\n this.comp = elem.comp;\r\n this.k = false;\r\n this.kf = false;\r\n this.vel = 0;\r\n this.effectsSequence = [];\r\n this._isFirstFrame = true;\r\n this.getValue = processEffectsSequence;\r\n this.setVValue = setVValue;\r\n this.addEffect = addEffect;\r\n }\r\n\r\n function MultiDimensionalProperty(elem, data, mult, container) {\r\n this.propType = 'multidimensional';\r\n this.mult = mult || 1;\r\n this.data = data;\r\n this._mdf = false;\r\n this.elem = elem;\r\n this.container = container;\r\n this.comp = elem.comp;\r\n this.k = false;\r\n this.kf = false;\r\n this.frameId = -1;\r\n var i;\r\n var len = data.k.length;\r\n this.v = createTypedArray('float32', len);\r\n this.pv = createTypedArray('float32', len);\r\n this.vel = createTypedArray('float32', len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.v[i] = data.k[i] * this.mult;\r\n this.pv[i] = data.k[i];\r\n }\r\n\r\n this._isFirstFrame = true;\r\n this.effectsSequence = [];\r\n this.getValue = processEffectsSequence;\r\n this.setVValue = setVValue;\r\n this.addEffect = addEffect;\r\n }\r\n\r\n function KeyframedValueProperty(elem, data, mult, container) {\r\n this.propType = 'unidimensional';\r\n this.keyframes = data.k;\r\n this.keyframesMetadata = [];\r\n this.offsetTime = elem.data.st;\r\n this.frameId = -1;\r\n this._caching = {\r\n lastFrame: initFrame,\r\n lastIndex: 0,\r\n value: 0,\r\n _lastKeyframeIndex: -1\r\n };\r\n this.k = true;\r\n this.kf = true;\r\n this.data = data;\r\n this.mult = mult || 1;\r\n this.elem = elem;\r\n this.container = container;\r\n this.comp = elem.comp;\r\n this.v = initFrame;\r\n this.pv = initFrame;\r\n this._isFirstFrame = true;\r\n this.getValue = processEffectsSequence;\r\n this.setVValue = setVValue;\r\n this.interpolateValue = interpolateValue;\r\n this.effectsSequence = [getValueAtCurrentTime.bind(this)];\r\n this.addEffect = addEffect;\r\n }\r\n\r\n function KeyframedMultidimensionalProperty(elem, data, mult, container) {\r\n this.propType = 'multidimensional';\r\n var i;\r\n var len = data.k.length;\r\n var s;\r\n var e;\r\n var to;\r\n var ti;\r\n\r\n for (i = 0; i < len - 1; i += 1) {\r\n if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) {\r\n s = data.k[i].s;\r\n e = data.k[i + 1].s;\r\n to = data.k[i].to;\r\n ti = data.k[i].ti;\r\n\r\n if (s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1]) || s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2])) {\r\n data.k[i].to = null;\r\n data.k[i].ti = null;\r\n }\r\n\r\n if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {\r\n if (s.length === 2 || s[2] === e[2] && to[2] === 0 && ti[2] === 0) {\r\n data.k[i].to = null;\r\n data.k[i].ti = null;\r\n }\r\n }\r\n }\r\n }\r\n\r\n this.effectsSequence = [getValueAtCurrentTime.bind(this)];\r\n this.data = data;\r\n this.keyframes = data.k;\r\n this.keyframesMetadata = [];\r\n this.offsetTime = elem.data.st;\r\n this.k = true;\r\n this.kf = true;\r\n this._isFirstFrame = true;\r\n this.mult = mult || 1;\r\n this.elem = elem;\r\n this.container = container;\r\n this.comp = elem.comp;\r\n this.getValue = processEffectsSequence;\r\n this.setVValue = setVValue;\r\n this.interpolateValue = interpolateValue;\r\n this.frameId = -1;\r\n var arrLen = data.k[0].s.length;\r\n this.v = createTypedArray('float32', arrLen);\r\n this.pv = createTypedArray('float32', arrLen);\r\n\r\n for (i = 0; i < arrLen; i += 1) {\r\n this.v[i] = initFrame;\r\n this.pv[i] = initFrame;\r\n }\r\n\r\n this._caching = {\r\n lastFrame: initFrame,\r\n lastIndex: 0,\r\n value: createTypedArray('float32', arrLen)\r\n };\r\n this.addEffect = addEffect;\r\n }\r\n\r\n function getProp(elem, data, type, mult, container) {\r\n var p;\r\n\r\n if (!data.k.length) {\r\n p = new ValueProperty(elem, data, mult, container);\r\n } else if (typeof data.k[0] === 'number') {\r\n p = new MultiDimensionalProperty(elem, data, mult, container);\r\n } else {\r\n switch (type) {\r\n case 0:\r\n p = new KeyframedValueProperty(elem, data, mult, container);\r\n break;\r\n\r\n case 1:\r\n p = new KeyframedMultidimensionalProperty(elem, data, mult, container);\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n if (p.effectsSequence.length) {\r\n container.addDynamicProperty(p);\r\n }\r\n\r\n return p;\r\n }\r\n\r\n var ob = {\r\n getProp: getProp\r\n };\r\n return ob;\r\n }();\r\n\r\n function DynamicPropertyContainer() {}\r\n\r\n DynamicPropertyContainer.prototype = {\r\n addDynamicProperty: function addDynamicProperty(prop) {\r\n if (this.dynamicProperties.indexOf(prop) === -1) {\r\n this.dynamicProperties.push(prop);\r\n this.container.addDynamicProperty(this);\r\n this._isAnimated = true;\r\n }\r\n },\r\n iterateDynamicProperties: function iterateDynamicProperties() {\r\n this._mdf = false;\r\n var i;\r\n var len = this.dynamicProperties.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.dynamicProperties[i].getValue();\r\n\r\n if (this.dynamicProperties[i]._mdf) {\r\n this._mdf = true;\r\n }\r\n }\r\n },\r\n initDynamicPropertyContainer: function initDynamicPropertyContainer(container) {\r\n this.container = container;\r\n this.dynamicProperties = [];\r\n this._mdf = false;\r\n this._isAnimated = false;\r\n }\r\n };\r\n\r\n var pointPool = function () {\r\n function create() {\r\n return createTypedArray('float32', 2);\r\n }\r\n\r\n return poolFactory(8, create);\r\n }();\r\n\r\n function ShapePath() {\r\n this.c = false;\r\n this._length = 0;\r\n this._maxLength = 8;\r\n this.v = createSizedArray(this._maxLength);\r\n this.o = createSizedArray(this._maxLength);\r\n this.i = createSizedArray(this._maxLength);\r\n }\r\n\r\n ShapePath.prototype.setPathData = function (closed, len) {\r\n this.c = closed;\r\n this.setLength(len);\r\n var i = 0;\r\n\r\n while (i < len) {\r\n this.v[i] = pointPool.newElement();\r\n this.o[i] = pointPool.newElement();\r\n this.i[i] = pointPool.newElement();\r\n i += 1;\r\n }\r\n };\r\n\r\n ShapePath.prototype.setLength = function (len) {\r\n while (this._maxLength < len) {\r\n this.doubleArrayLength();\r\n }\r\n\r\n this._length = len;\r\n };\r\n\r\n ShapePath.prototype.doubleArrayLength = function () {\r\n this.v = this.v.concat(createSizedArray(this._maxLength));\r\n this.i = this.i.concat(createSizedArray(this._maxLength));\r\n this.o = this.o.concat(createSizedArray(this._maxLength));\r\n this._maxLength *= 2;\r\n };\r\n\r\n ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) {\r\n var arr;\r\n this._length = Math.max(this._length, pos + 1);\r\n\r\n if (this._length >= this._maxLength) {\r\n this.doubleArrayLength();\r\n }\r\n\r\n switch (type) {\r\n case 'v':\r\n arr = this.v;\r\n break;\r\n\r\n case 'i':\r\n arr = this.i;\r\n break;\r\n\r\n case 'o':\r\n arr = this.o;\r\n break;\r\n\r\n default:\r\n arr = [];\r\n break;\r\n }\r\n\r\n if (!arr[pos] || arr[pos] && !replace) {\r\n arr[pos] = pointPool.newElement();\r\n }\r\n\r\n arr[pos][0] = x;\r\n arr[pos][1] = y;\r\n };\r\n\r\n ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) {\r\n this.setXYAt(vX, vY, 'v', pos, replace);\r\n this.setXYAt(oX, oY, 'o', pos, replace);\r\n this.setXYAt(iX, iY, 'i', pos, replace);\r\n };\r\n\r\n ShapePath.prototype.reverse = function () {\r\n var newPath = new ShapePath();\r\n newPath.setPathData(this.c, this._length);\r\n var vertices = this.v;\r\n var outPoints = this.o;\r\n var inPoints = this.i;\r\n var init = 0;\r\n\r\n if (this.c) {\r\n newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);\r\n init = 1;\r\n }\r\n\r\n var cnt = this._length - 1;\r\n var len = this._length;\r\n var i;\r\n\r\n for (i = init; i < len; i += 1) {\r\n newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);\r\n cnt -= 1;\r\n }\r\n\r\n return newPath;\r\n };\r\n\r\n ShapePath.prototype.length = function () {\r\n return this._length;\r\n };\r\n\r\n var shapePool = function () {\r\n function create() {\r\n return new ShapePath();\r\n }\r\n\r\n function release(shapePath) {\r\n var len = shapePath._length;\r\n var i;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n pointPool.release(shapePath.v[i]);\r\n pointPool.release(shapePath.i[i]);\r\n pointPool.release(shapePath.o[i]);\r\n shapePath.v[i] = null;\r\n shapePath.i[i] = null;\r\n shapePath.o[i] = null;\r\n }\r\n\r\n shapePath._length = 0;\r\n shapePath.c = false;\r\n }\r\n\r\n function clone(shape) {\r\n var cloned = factory.newElement();\r\n var i;\r\n var len = shape._length === undefined ? shape.v.length : shape._length;\r\n cloned.setLength(len);\r\n cloned.c = shape.c;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i);\r\n }\r\n\r\n return cloned;\r\n }\r\n\r\n var factory = poolFactory(4, create, release);\r\n factory.clone = clone;\r\n return factory;\r\n }();\r\n\r\n function ShapeCollection() {\r\n this._length = 0;\r\n this._maxLength = 4;\r\n this.shapes = createSizedArray(this._maxLength);\r\n }\r\n\r\n ShapeCollection.prototype.addShape = function (shapeData) {\r\n if (this._length === this._maxLength) {\r\n this.shapes = this.shapes.concat(createSizedArray(this._maxLength));\r\n this._maxLength *= 2;\r\n }\r\n\r\n this.shapes[this._length] = shapeData;\r\n this._length += 1;\r\n };\r\n\r\n ShapeCollection.prototype.releaseShapes = function () {\r\n var i;\r\n\r\n for (i = 0; i < this._length; i += 1) {\r\n shapePool.release(this.shapes[i]);\r\n }\r\n\r\n this._length = 0;\r\n };\r\n\r\n var shapeCollectionPool = function () {\r\n var ob = {\r\n newShapeCollection: newShapeCollection,\r\n release: release\r\n };\r\n var _length = 0;\r\n var _maxLength = 4;\r\n var pool = createSizedArray(_maxLength);\r\n\r\n function newShapeCollection() {\r\n var shapeCollection;\r\n\r\n if (_length) {\r\n _length -= 1;\r\n shapeCollection = pool[_length];\r\n } else {\r\n shapeCollection = new ShapeCollection();\r\n }\r\n\r\n return shapeCollection;\r\n }\r\n\r\n function release(shapeCollection) {\r\n var i;\r\n var len = shapeCollection._length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shapePool.release(shapeCollection.shapes[i]);\r\n }\r\n\r\n shapeCollection._length = 0;\r\n\r\n if (_length === _maxLength) {\r\n pool = pooling[\"double\"](pool);\r\n _maxLength *= 2;\r\n }\r\n\r\n pool[_length] = shapeCollection;\r\n _length += 1;\r\n }\r\n\r\n return ob;\r\n }();\r\n\r\n var ShapePropertyFactory = function () {\r\n var initFrame = -999999;\r\n\r\n function interpolateShape(frameNum, previousValue, caching) {\r\n var iterationIndex = caching.lastIndex;\r\n var keyPropS;\r\n var keyPropE;\r\n var isHold;\r\n var j;\r\n var k;\r\n var jLen;\r\n var kLen;\r\n var perc;\r\n var vertexValue;\r\n var kf = this.keyframes;\r\n\r\n if (frameNum < kf[0].t - this.offsetTime) {\r\n keyPropS = kf[0].s[0];\r\n isHold = true;\r\n iterationIndex = 0;\r\n } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) {\r\n keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];\r\n /* if(kf[kf.length - 1].s){\r\n keyPropS = kf[kf.length - 1].s[0];\r\n }else{\r\n keyPropS = kf[kf.length - 2].e[0];\r\n } */\r\n\r\n isHold = true;\r\n } else {\r\n var i = iterationIndex;\r\n var len = kf.length - 1;\r\n var flag = true;\r\n var keyData;\r\n var nextKeyData;\r\n var keyframeMetadata;\r\n\r\n while (flag) {\r\n keyData = kf[i];\r\n nextKeyData = kf[i + 1];\r\n\r\n if (nextKeyData.t - this.offsetTime > frameNum) {\r\n break;\r\n }\r\n\r\n if (i < len - 1) {\r\n i += 1;\r\n } else {\r\n flag = false;\r\n }\r\n }\r\n\r\n keyframeMetadata = this.keyframesMetadata[i] || {};\r\n isHold = keyData.h === 1;\r\n iterationIndex = i;\r\n\r\n if (!isHold) {\r\n if (frameNum >= nextKeyData.t - this.offsetTime) {\r\n perc = 1;\r\n } else if (frameNum < keyData.t - this.offsetTime) {\r\n perc = 0;\r\n } else {\r\n var fnc;\r\n\r\n if (keyframeMetadata.__fnct) {\r\n fnc = keyframeMetadata.__fnct;\r\n } else {\r\n fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get;\r\n keyframeMetadata.__fnct = fnc;\r\n }\r\n\r\n perc = fnc((frameNum - (keyData.t - this.offsetTime)) / (nextKeyData.t - this.offsetTime - (keyData.t - this.offsetTime)));\r\n }\r\n\r\n keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];\r\n }\r\n\r\n keyPropS = keyData.s[0];\r\n }\r\n\r\n jLen = previousValue._length;\r\n kLen = keyPropS.i[0].length;\r\n caching.lastIndex = iterationIndex;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n for (k = 0; k < kLen; k += 1) {\r\n vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc;\r\n previousValue.i[j][k] = vertexValue;\r\n vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc;\r\n previousValue.o[j][k] = vertexValue;\r\n vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc;\r\n previousValue.v[j][k] = vertexValue;\r\n }\r\n }\r\n }\r\n\r\n function interpolateShapeCurrentTime() {\r\n var frameNum = this.comp.renderedFrame - this.offsetTime;\r\n var initTime = this.keyframes[0].t - this.offsetTime;\r\n var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;\r\n var lastFrame = this._caching.lastFrame;\r\n\r\n if (!(lastFrame !== initFrame && (lastFrame < initTime && frameNum < initTime || lastFrame > endTime && frameNum > endTime))) {\r\n /// /\r\n this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;\r\n this.interpolateShape(frameNum, this.pv, this._caching); /// /\r\n }\r\n\r\n this._caching.lastFrame = frameNum;\r\n return this.pv;\r\n }\r\n\r\n function resetShape() {\r\n this.paths = this.localShapeCollection;\r\n }\r\n\r\n function shapesEqual(shape1, shape2) {\r\n if (shape1._length !== shape2._length || shape1.c !== shape2.c) {\r\n return false;\r\n }\r\n\r\n var i;\r\n var len = shape1._length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (shape1.v[i][0] !== shape2.v[i][0] || shape1.v[i][1] !== shape2.v[i][1] || shape1.o[i][0] !== shape2.o[i][0] || shape1.o[i][1] !== shape2.o[i][1] || shape1.i[i][0] !== shape2.i[i][0] || shape1.i[i][1] !== shape2.i[i][1]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n function setVValue(newPath) {\r\n if (!shapesEqual(this.v, newPath)) {\r\n this.v = shapePool.clone(newPath);\r\n this.localShapeCollection.releaseShapes();\r\n this.localShapeCollection.addShape(this.v);\r\n this._mdf = true;\r\n this.paths = this.localShapeCollection;\r\n }\r\n }\r\n\r\n function processEffectsSequence() {\r\n if (this.elem.globalData.frameId === this.frameId) {\r\n return;\r\n }\r\n\r\n if (!this.effectsSequence.length) {\r\n this._mdf = false;\r\n return;\r\n }\r\n\r\n if (this.lock) {\r\n this.setVValue(this.pv);\r\n return;\r\n }\r\n\r\n this.lock = true;\r\n this._mdf = false;\r\n var finalValue;\r\n\r\n if (this.kf) {\r\n finalValue = this.pv;\r\n } else if (this.data.ks) {\r\n finalValue = this.data.ks.k;\r\n } else {\r\n finalValue = this.data.pt.k;\r\n }\r\n\r\n var i;\r\n var len = this.effectsSequence.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n finalValue = this.effectsSequence[i](finalValue);\r\n }\r\n\r\n this.setVValue(finalValue);\r\n this.lock = false;\r\n this.frameId = this.elem.globalData.frameId;\r\n }\r\n\r\n function ShapeProperty(elem, data, type) {\r\n this.propType = 'shape';\r\n this.comp = elem.comp;\r\n this.container = elem;\r\n this.elem = elem;\r\n this.data = data;\r\n this.k = false;\r\n this.kf = false;\r\n this._mdf = false;\r\n var pathData = type === 3 ? data.pt.k : data.ks.k;\r\n this.v = shapePool.clone(pathData);\r\n this.pv = shapePool.clone(this.v);\r\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n this.paths = this.localShapeCollection;\r\n this.paths.addShape(this.v);\r\n this.reset = resetShape;\r\n this.effectsSequence = [];\r\n }\r\n\r\n function addEffect(effectFunction) {\r\n this.effectsSequence.push(effectFunction);\r\n this.container.addDynamicProperty(this);\r\n }\r\n\r\n ShapeProperty.prototype.interpolateShape = interpolateShape;\r\n ShapeProperty.prototype.getValue = processEffectsSequence;\r\n ShapeProperty.prototype.setVValue = setVValue;\r\n ShapeProperty.prototype.addEffect = addEffect;\r\n\r\n function KeyframedShapeProperty(elem, data, type) {\r\n this.propType = 'shape';\r\n this.comp = elem.comp;\r\n this.elem = elem;\r\n this.container = elem;\r\n this.offsetTime = elem.data.st;\r\n this.keyframes = type === 3 ? data.pt.k : data.ks.k;\r\n this.keyframesMetadata = [];\r\n this.k = true;\r\n this.kf = true;\r\n var len = this.keyframes[0].s[0].i.length;\r\n this.v = shapePool.newElement();\r\n this.v.setPathData(this.keyframes[0].s[0].c, len);\r\n this.pv = shapePool.clone(this.v);\r\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n this.paths = this.localShapeCollection;\r\n this.paths.addShape(this.v);\r\n this.lastFrame = initFrame;\r\n this.reset = resetShape;\r\n this._caching = {\r\n lastFrame: initFrame,\r\n lastIndex: 0\r\n };\r\n this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];\r\n }\r\n\r\n KeyframedShapeProperty.prototype.getValue = processEffectsSequence;\r\n KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;\r\n KeyframedShapeProperty.prototype.setVValue = setVValue;\r\n KeyframedShapeProperty.prototype.addEffect = addEffect;\r\n\r\n var EllShapeProperty = function () {\r\n var cPoint = roundCorner;\r\n\r\n function EllShapePropertyFactory(elem, data) {\r\n this.v = shapePool.newElement();\r\n this.v.setPathData(true, 4);\r\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n this.paths = this.localShapeCollection;\r\n this.localShapeCollection.addShape(this.v);\r\n this.d = data.d;\r\n this.elem = elem;\r\n this.comp = elem.comp;\r\n this.frameId = -1;\r\n this.initDynamicPropertyContainer(elem);\r\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\r\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\r\n\r\n if (this.dynamicProperties.length) {\r\n this.k = true;\r\n } else {\r\n this.k = false;\r\n this.convertEllToPath();\r\n }\r\n }\r\n\r\n EllShapePropertyFactory.prototype = {\r\n reset: resetShape,\r\n getValue: function getValue() {\r\n if (this.elem.globalData.frameId === this.frameId) {\r\n return;\r\n }\r\n\r\n this.frameId = this.elem.globalData.frameId;\r\n this.iterateDynamicProperties();\r\n\r\n if (this._mdf) {\r\n this.convertEllToPath();\r\n }\r\n },\r\n convertEllToPath: function convertEllToPath() {\r\n var p0 = this.p.v[0];\r\n var p1 = this.p.v[1];\r\n var s0 = this.s.v[0] / 2;\r\n var s1 = this.s.v[1] / 2;\r\n\r\n var _cw = this.d !== 3;\r\n\r\n var _v = this.v;\r\n _v.v[0][0] = p0;\r\n _v.v[0][1] = p1 - s1;\r\n _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;\r\n _v.v[1][1] = p1;\r\n _v.v[2][0] = p0;\r\n _v.v[2][1] = p1 + s1;\r\n _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;\r\n _v.v[3][1] = p1;\r\n _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\r\n _v.i[0][1] = p1 - s1;\r\n _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;\r\n _v.i[1][1] = p1 - s1 * cPoint;\r\n _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\r\n _v.i[2][1] = p1 + s1;\r\n _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;\r\n _v.i[3][1] = p1 + s1 * cPoint;\r\n _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;\r\n _v.o[0][1] = p1 - s1;\r\n _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;\r\n _v.o[1][1] = p1 + s1 * cPoint;\r\n _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;\r\n _v.o[2][1] = p1 + s1;\r\n _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;\r\n _v.o[3][1] = p1 - s1 * cPoint;\r\n }\r\n };\r\n extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory);\r\n return EllShapePropertyFactory;\r\n }();\r\n\r\n var StarShapeProperty = function () {\r\n function StarShapePropertyFactory(elem, data) {\r\n this.v = shapePool.newElement();\r\n this.v.setPathData(true, 0);\r\n this.elem = elem;\r\n this.comp = elem.comp;\r\n this.data = data;\r\n this.frameId = -1;\r\n this.d = data.d;\r\n this.initDynamicPropertyContainer(elem);\r\n\r\n if (data.sy === 1) {\r\n this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this);\r\n this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this);\r\n this.convertToPath = this.convertStarToPath;\r\n } else {\r\n this.convertToPath = this.convertPolygonToPath;\r\n }\r\n\r\n this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this);\r\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\r\n this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this);\r\n this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this);\r\n this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this);\r\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n this.localShapeCollection.addShape(this.v);\r\n this.paths = this.localShapeCollection;\r\n\r\n if (this.dynamicProperties.length) {\r\n this.k = true;\r\n } else {\r\n this.k = false;\r\n this.convertToPath();\r\n }\r\n }\r\n\r\n StarShapePropertyFactory.prototype = {\r\n reset: resetShape,\r\n getValue: function getValue() {\r\n if (this.elem.globalData.frameId === this.frameId) {\r\n return;\r\n }\r\n\r\n this.frameId = this.elem.globalData.frameId;\r\n this.iterateDynamicProperties();\r\n\r\n if (this._mdf) {\r\n this.convertToPath();\r\n }\r\n },\r\n convertStarToPath: function convertStarToPath() {\r\n var numPts = Math.floor(this.pt.v) * 2;\r\n var angle = Math.PI * 2 / numPts;\r\n /* this.v.v.length = numPts;\r\n this.v.i.length = numPts;\r\n this.v.o.length = numPts; */\r\n\r\n var longFlag = true;\r\n var longRad = this.or.v;\r\n var shortRad = this.ir.v;\r\n var longRound = this.os.v;\r\n var shortRound = this.is.v;\r\n var longPerimSegment = 2 * Math.PI * longRad / (numPts * 2);\r\n var shortPerimSegment = 2 * Math.PI * shortRad / (numPts * 2);\r\n var i;\r\n var rad;\r\n var roundness;\r\n var perimSegment;\r\n var currentAng = -Math.PI / 2;\r\n currentAng += this.r.v;\r\n var dir = this.data.d === 3 ? -1 : 1;\r\n this.v._length = 0;\r\n\r\n for (i = 0; i < numPts; i += 1) {\r\n rad = longFlag ? longRad : shortRad;\r\n roundness = longFlag ? longRound : shortRound;\r\n perimSegment = longFlag ? longPerimSegment : shortPerimSegment;\r\n var x = rad * Math.cos(currentAng);\r\n var y = rad * Math.sin(currentAng);\r\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\r\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\r\n x += +this.p.v[0];\r\n y += +this.p.v[1];\r\n this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\r\n /* this.v.v[i] = [x,y];\r\n this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];\r\n this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];\r\n this.v._length = numPts; */\r\n\r\n longFlag = !longFlag;\r\n currentAng += angle * dir;\r\n }\r\n },\r\n convertPolygonToPath: function convertPolygonToPath() {\r\n var numPts = Math.floor(this.pt.v);\r\n var angle = Math.PI * 2 / numPts;\r\n var rad = this.or.v;\r\n var roundness = this.os.v;\r\n var perimSegment = 2 * Math.PI * rad / (numPts * 4);\r\n var i;\r\n var currentAng = -Math.PI * 0.5;\r\n var dir = this.data.d === 3 ? -1 : 1;\r\n currentAng += this.r.v;\r\n this.v._length = 0;\r\n\r\n for (i = 0; i < numPts; i += 1) {\r\n var x = rad * Math.cos(currentAng);\r\n var y = rad * Math.sin(currentAng);\r\n var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y);\r\n var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y);\r\n x += +this.p.v[0];\r\n y += +this.p.v[1];\r\n this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true);\r\n currentAng += angle * dir;\r\n }\r\n\r\n this.paths.length = 0;\r\n this.paths[0] = this.v;\r\n }\r\n };\r\n extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory);\r\n return StarShapePropertyFactory;\r\n }();\r\n\r\n var RectShapeProperty = function () {\r\n function RectShapePropertyFactory(elem, data) {\r\n this.v = shapePool.newElement();\r\n this.v.c = true;\r\n this.localShapeCollection = shapeCollectionPool.newShapeCollection();\r\n this.localShapeCollection.addShape(this.v);\r\n this.paths = this.localShapeCollection;\r\n this.elem = elem;\r\n this.comp = elem.comp;\r\n this.frameId = -1;\r\n this.d = data.d;\r\n this.initDynamicPropertyContainer(elem);\r\n this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this);\r\n this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this);\r\n this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this);\r\n\r\n if (this.dynamicProperties.length) {\r\n this.k = true;\r\n } else {\r\n this.k = false;\r\n this.convertRectToPath();\r\n }\r\n }\r\n\r\n RectShapePropertyFactory.prototype = {\r\n convertRectToPath: function convertRectToPath() {\r\n var p0 = this.p.v[0];\r\n var p1 = this.p.v[1];\r\n var v0 = this.s.v[0] / 2;\r\n var v1 = this.s.v[1] / 2;\r\n var round = bmMin(v0, v1, this.r.v);\r\n var cPoint = round * (1 - roundCorner);\r\n this.v._length = 0;\r\n\r\n if (this.d === 2 || this.d === 1) {\r\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true);\r\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true);\r\n\r\n if (round !== 0) {\r\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true);\r\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true);\r\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true);\r\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true);\r\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true);\r\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true);\r\n } else {\r\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2);\r\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3);\r\n }\r\n } else {\r\n this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true);\r\n\r\n if (round !== 0) {\r\n this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true);\r\n this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true);\r\n this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true);\r\n this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true);\r\n this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true);\r\n this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true);\r\n this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true);\r\n } else {\r\n this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true);\r\n this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true);\r\n this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true);\r\n }\r\n }\r\n },\r\n getValue: function getValue() {\r\n if (this.elem.globalData.frameId === this.frameId) {\r\n return;\r\n }\r\n\r\n this.frameId = this.elem.globalData.frameId;\r\n this.iterateDynamicProperties();\r\n\r\n if (this._mdf) {\r\n this.convertRectToPath();\r\n }\r\n },\r\n reset: resetShape\r\n };\r\n extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory);\r\n return RectShapePropertyFactory;\r\n }();\r\n\r\n function getShapeProp(elem, data, type) {\r\n var prop;\r\n\r\n if (type === 3 || type === 4) {\r\n var dataProp = type === 3 ? data.pt : data.ks;\r\n var keys = dataProp.k;\r\n\r\n if (keys.length) {\r\n prop = new KeyframedShapeProperty(elem, data, type);\r\n } else {\r\n prop = new ShapeProperty(elem, data, type);\r\n }\r\n } else if (type === 5) {\r\n prop = new RectShapeProperty(elem, data);\r\n } else if (type === 6) {\r\n prop = new EllShapeProperty(elem, data);\r\n } else if (type === 7) {\r\n prop = new StarShapeProperty(elem, data);\r\n }\r\n\r\n if (prop.k) {\r\n elem.addDynamicProperty(prop);\r\n }\r\n\r\n return prop;\r\n }\r\n\r\n function getConstructorFunction() {\r\n return ShapeProperty;\r\n }\r\n\r\n function getKeyframedConstructorFunction() {\r\n return KeyframedShapeProperty;\r\n }\r\n\r\n var ob = {};\r\n ob.getShapeProp = getShapeProp;\r\n ob.getConstructorFunction = getConstructorFunction;\r\n ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;\r\n return ob;\r\n }();\r\n\r\n /*!\r\n Transformation Matrix v2.0\r\n (c) Epistemex 2014-2015\r\n www.epistemex.com\r\n By Ken Fyrstenberg\r\n Contributions by leeoniya.\r\n License: MIT, header required.\r\n */\r\n\r\n /**\r\n * 2D transformation matrix object initialized with identity matrix.\r\n *\r\n * The matrix can synchronize a canvas context by supplying the context\r\n * as an argument, or later apply current absolute transform to an\r\n * existing context.\r\n *\r\n * All values are handled as floating point values.\r\n *\r\n * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix\r\n * @prop {number} a - scale x\r\n * @prop {number} b - shear y\r\n * @prop {number} c - shear x\r\n * @prop {number} d - scale y\r\n * @prop {number} e - translate x\r\n * @prop {number} f - translate y\r\n * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context\r\n * @constructor\r\n */\r\n\r\n var Matrix = function () {\r\n var _cos = Math.cos;\r\n var _sin = Math.sin;\r\n var _tan = Math.tan;\r\n var _rnd = Math.round;\r\n\r\n function reset() {\r\n this.props[0] = 1;\r\n this.props[1] = 0;\r\n this.props[2] = 0;\r\n this.props[3] = 0;\r\n this.props[4] = 0;\r\n this.props[5] = 1;\r\n this.props[6] = 0;\r\n this.props[7] = 0;\r\n this.props[8] = 0;\r\n this.props[9] = 0;\r\n this.props[10] = 1;\r\n this.props[11] = 0;\r\n this.props[12] = 0;\r\n this.props[13] = 0;\r\n this.props[14] = 0;\r\n this.props[15] = 1;\r\n return this;\r\n }\r\n\r\n function rotate(angle) {\r\n if (angle === 0) {\r\n return this;\r\n }\r\n\r\n var mCos = _cos(angle);\r\n\r\n var mSin = _sin(angle);\r\n\r\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n\r\n function rotateX(angle) {\r\n if (angle === 0) {\r\n return this;\r\n }\r\n\r\n var mCos = _cos(angle);\r\n\r\n var mSin = _sin(angle);\r\n\r\n return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);\r\n }\r\n\r\n function rotateY(angle) {\r\n if (angle === 0) {\r\n return this;\r\n }\r\n\r\n var mCos = _cos(angle);\r\n\r\n var mSin = _sin(angle);\r\n\r\n return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);\r\n }\r\n\r\n function rotateZ(angle) {\r\n if (angle === 0) {\r\n return this;\r\n }\r\n\r\n var mCos = _cos(angle);\r\n\r\n var mSin = _sin(angle);\r\n\r\n return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\r\n }\r\n\r\n function shear(sx, sy) {\r\n return this._t(1, sy, sx, 1, 0, 0);\r\n }\r\n\r\n function skew(ax, ay) {\r\n return this.shear(_tan(ax), _tan(ay));\r\n }\r\n\r\n function skewFromAxis(ax, angle) {\r\n var mCos = _cos(angle);\r\n\r\n var mSin = _sin(angle);\r\n\r\n return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); // return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);\r\n }\r\n\r\n function scale(sx, sy, sz) {\r\n if (!sz && sz !== 0) {\r\n sz = 1;\r\n }\r\n\r\n if (sx === 1 && sy === 1 && sz === 1) {\r\n return this;\r\n }\r\n\r\n return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);\r\n }\r\n\r\n function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {\r\n this.props[0] = a;\r\n this.props[1] = b;\r\n this.props[2] = c;\r\n this.props[3] = d;\r\n this.props[4] = e;\r\n this.props[5] = f;\r\n this.props[6] = g;\r\n this.props[7] = h;\r\n this.props[8] = i;\r\n this.props[9] = j;\r\n this.props[10] = k;\r\n this.props[11] = l;\r\n this.props[12] = m;\r\n this.props[13] = n;\r\n this.props[14] = o;\r\n this.props[15] = p;\r\n return this;\r\n }\r\n\r\n function translate(tx, ty, tz) {\r\n tz = tz || 0;\r\n\r\n if (tx !== 0 || ty !== 0 || tz !== 0) {\r\n return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {\r\n var _p = this.props;\r\n\r\n if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) {\r\n // NOTE: commenting this condition because TurboFan deoptimizes code when present\r\n // if(m2 !== 0 || n2 !== 0 || o2 !== 0){\r\n _p[12] = _p[12] * a2 + _p[15] * m2;\r\n _p[13] = _p[13] * f2 + _p[15] * n2;\r\n _p[14] = _p[14] * k2 + _p[15] * o2;\r\n _p[15] *= p2; // }\r\n\r\n this._identityCalculated = false;\r\n return this;\r\n }\r\n\r\n var a1 = _p[0];\r\n var b1 = _p[1];\r\n var c1 = _p[2];\r\n var d1 = _p[3];\r\n var e1 = _p[4];\r\n var f1 = _p[5];\r\n var g1 = _p[6];\r\n var h1 = _p[7];\r\n var i1 = _p[8];\r\n var j1 = _p[9];\r\n var k1 = _p[10];\r\n var l1 = _p[11];\r\n var m1 = _p[12];\r\n var n1 = _p[13];\r\n var o1 = _p[14];\r\n var p1 = _p[15];\r\n /* matrix order (canvas compatible):\r\n * ace\r\n * bdf\r\n * 001\r\n */\r\n\r\n _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;\r\n _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2;\r\n _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2;\r\n _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2;\r\n _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2;\r\n _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2;\r\n _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2;\r\n _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2;\r\n _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2;\r\n _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2;\r\n _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2;\r\n _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2;\r\n _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2;\r\n _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2;\r\n _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2;\r\n _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2;\r\n this._identityCalculated = false;\r\n return this;\r\n }\r\n\r\n function isIdentity() {\r\n if (!this._identityCalculated) {\r\n this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1);\r\n this._identityCalculated = true;\r\n }\r\n\r\n return this._identity;\r\n }\r\n\r\n function equals(matr) {\r\n var i = 0;\r\n\r\n while (i < 16) {\r\n if (matr.props[i] !== this.props[i]) {\r\n return false;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n function clone(matr) {\r\n var i;\r\n\r\n for (i = 0; i < 16; i += 1) {\r\n matr.props[i] = this.props[i];\r\n }\r\n\r\n return matr;\r\n }\r\n\r\n function cloneFromProps(props) {\r\n var i;\r\n\r\n for (i = 0; i < 16; i += 1) {\r\n this.props[i] = props[i];\r\n }\r\n }\r\n\r\n function applyToPoint(x, y, z) {\r\n return {\r\n x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],\r\n y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],\r\n z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]\r\n };\r\n /* return {\r\n x: x * me.a + y * me.c + me.e,\r\n y: x * me.b + y * me.d + me.f\r\n }; */\r\n }\r\n\r\n function applyToX(x, y, z) {\r\n return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];\r\n }\r\n\r\n function applyToY(x, y, z) {\r\n return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];\r\n }\r\n\r\n function applyToZ(x, y, z) {\r\n return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];\r\n }\r\n\r\n function getInverseMatrix() {\r\n var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];\r\n var a = this.props[5] / determinant;\r\n var b = -this.props[1] / determinant;\r\n var c = -this.props[4] / determinant;\r\n var d = this.props[0] / determinant;\r\n var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant;\r\n var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant;\r\n var inverseMatrix = new Matrix();\r\n inverseMatrix.props[0] = a;\r\n inverseMatrix.props[1] = b;\r\n inverseMatrix.props[4] = c;\r\n inverseMatrix.props[5] = d;\r\n inverseMatrix.props[12] = e;\r\n inverseMatrix.props[13] = f;\r\n return inverseMatrix;\r\n }\r\n\r\n function inversePoint(pt) {\r\n var inverseMatrix = this.getInverseMatrix();\r\n return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0);\r\n }\r\n\r\n function inversePoints(pts) {\r\n var i;\r\n var len = pts.length;\r\n var retPts = [];\r\n\r\n for (i = 0; i < len; i += 1) {\r\n retPts[i] = inversePoint(pts[i]);\r\n }\r\n\r\n return retPts;\r\n }\r\n\r\n function applyToTriplePoints(pt1, pt2, pt3) {\r\n var arr = createTypedArray('float32', 6);\r\n\r\n if (this.isIdentity()) {\r\n arr[0] = pt1[0];\r\n arr[1] = pt1[1];\r\n arr[2] = pt2[0];\r\n arr[3] = pt2[1];\r\n arr[4] = pt3[0];\r\n arr[5] = pt3[1];\r\n } else {\r\n var p0 = this.props[0];\r\n var p1 = this.props[1];\r\n var p4 = this.props[4];\r\n var p5 = this.props[5];\r\n var p12 = this.props[12];\r\n var p13 = this.props[13];\r\n arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;\r\n arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;\r\n arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;\r\n arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;\r\n arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;\r\n arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n function applyToPointArray(x, y, z) {\r\n var arr;\r\n\r\n if (this.isIdentity()) {\r\n arr = [x, y, z];\r\n } else {\r\n arr = [x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]];\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n function applyToPointStringified(x, y) {\r\n if (this.isIdentity()) {\r\n return x + ',' + y;\r\n }\r\n\r\n var _p = this.props;\r\n return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;\r\n }\r\n\r\n function toCSS() {\r\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\r\n\r\n /* if(this.isIdentity()) {\r\n return '';\r\n } */\r\n var i = 0;\r\n var props = this.props;\r\n var cssValue = 'matrix3d(';\r\n var v = 10000;\r\n\r\n while (i < 16) {\r\n cssValue += _rnd(props[i] * v) / v;\r\n cssValue += i === 15 ? ')' : ',';\r\n i += 1;\r\n }\r\n\r\n return cssValue;\r\n }\r\n\r\n function roundMatrixProperty(val) {\r\n var v = 10000;\r\n\r\n if (val < 0.000001 && val > 0 || val > -0.000001 && val < 0) {\r\n return _rnd(val * v) / v;\r\n }\r\n\r\n return val;\r\n }\r\n\r\n function to2dCSS() {\r\n // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.\r\n\r\n /* if(this.isIdentity()) {\r\n return '';\r\n } */\r\n var props = this.props;\r\n\r\n var _a = roundMatrixProperty(props[0]);\r\n\r\n var _b = roundMatrixProperty(props[1]);\r\n\r\n var _c = roundMatrixProperty(props[4]);\r\n\r\n var _d = roundMatrixProperty(props[5]);\r\n\r\n var _e = roundMatrixProperty(props[12]);\r\n\r\n var _f = roundMatrixProperty(props[13]);\r\n\r\n return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')';\r\n }\r\n\r\n return function () {\r\n this.reset = reset;\r\n this.rotate = rotate;\r\n this.rotateX = rotateX;\r\n this.rotateY = rotateY;\r\n this.rotateZ = rotateZ;\r\n this.skew = skew;\r\n this.skewFromAxis = skewFromAxis;\r\n this.shear = shear;\r\n this.scale = scale;\r\n this.setTransform = setTransform;\r\n this.translate = translate;\r\n this.transform = transform;\r\n this.applyToPoint = applyToPoint;\r\n this.applyToX = applyToX;\r\n this.applyToY = applyToY;\r\n this.applyToZ = applyToZ;\r\n this.applyToPointArray = applyToPointArray;\r\n this.applyToTriplePoints = applyToTriplePoints;\r\n this.applyToPointStringified = applyToPointStringified;\r\n this.toCSS = toCSS;\r\n this.to2dCSS = to2dCSS;\r\n this.clone = clone;\r\n this.cloneFromProps = cloneFromProps;\r\n this.equals = equals;\r\n this.inversePoints = inversePoints;\r\n this.inversePoint = inversePoint;\r\n this.getInverseMatrix = getInverseMatrix;\r\n this._t = this.transform;\r\n this.isIdentity = isIdentity;\r\n this._identity = true;\r\n this._identityCalculated = false;\r\n this.props = createTypedArray('float32', 16);\r\n this.reset();\r\n };\r\n }();\r\n\r\n function _typeof$3(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof$3 = function _typeof(obj) { return typeof obj; }; } else { _typeof$3 = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof$3(obj); }\r\n var lottie = {};\r\n var standalone = '__[STANDALONE]__';\r\n var animationData = '__[ANIMATIONDATA]__';\r\n var renderer = '';\r\n\r\n function setLocation(href) {\r\n setLocationHref(href);\r\n }\r\n\r\n function searchAnimations() {\r\n if (standalone === true) {\r\n animationManager.searchAnimations(animationData, standalone, renderer);\r\n } else {\r\n animationManager.searchAnimations();\r\n }\r\n }\r\n\r\n function setSubframeRendering(flag) {\r\n setSubframeEnabled(flag);\r\n }\r\n\r\n function setPrefix(prefix) {\r\n setIdPrefix(prefix);\r\n }\r\n\r\n function loadAnimation(params) {\r\n if (standalone === true) {\r\n params.animationData = JSON.parse(animationData);\r\n }\r\n\r\n return animationManager.loadAnimation(params);\r\n }\r\n\r\n function setQuality(value) {\r\n if (typeof value === 'string') {\r\n switch (value) {\r\n case 'high':\r\n setDefaultCurveSegments(200);\r\n break;\r\n\r\n default:\r\n case 'medium':\r\n setDefaultCurveSegments(50);\r\n break;\r\n\r\n case 'low':\r\n setDefaultCurveSegments(10);\r\n break;\r\n }\r\n } else if (!isNaN(value) && value > 1) {\r\n setDefaultCurveSegments(value);\r\n }\r\n\r\n if (getDefaultCurveSegments() >= 50) {\r\n roundValues(false);\r\n } else {\r\n roundValues(true);\r\n }\r\n }\r\n\r\n function inBrowser() {\r\n return typeof navigator !== 'undefined';\r\n }\r\n\r\n function installPlugin(type, plugin) {\r\n if (type === 'expressions') {\r\n setExpressionsPlugin(plugin);\r\n }\r\n }\r\n\r\n function getFactory(name) {\r\n switch (name) {\r\n case 'propertyFactory':\r\n return PropertyFactory;\r\n\r\n case 'shapePropertyFactory':\r\n return ShapePropertyFactory;\r\n\r\n case 'matrix':\r\n return Matrix;\r\n\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n lottie.play = animationManager.play;\r\n lottie.pause = animationManager.pause;\r\n lottie.setLocationHref = setLocation;\r\n lottie.togglePause = animationManager.togglePause;\r\n lottie.setSpeed = animationManager.setSpeed;\r\n lottie.setDirection = animationManager.setDirection;\r\n lottie.stop = animationManager.stop;\r\n lottie.searchAnimations = searchAnimations;\r\n lottie.registerAnimation = animationManager.registerAnimation;\r\n lottie.loadAnimation = loadAnimation;\r\n lottie.setSubframeRendering = setSubframeRendering;\r\n lottie.resize = animationManager.resize; // lottie.start = start;\r\n\r\n lottie.goToAndStop = animationManager.goToAndStop;\r\n lottie.destroy = animationManager.destroy;\r\n lottie.setQuality = setQuality;\r\n lottie.inBrowser = inBrowser;\r\n lottie.installPlugin = installPlugin;\r\n lottie.freeze = animationManager.freeze;\r\n lottie.unfreeze = animationManager.unfreeze;\r\n lottie.setVolume = animationManager.setVolume;\r\n lottie.mute = animationManager.mute;\r\n lottie.unmute = animationManager.unmute;\r\n lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations;\r\n lottie.useWebWorker = setWebWorker;\r\n lottie.setIDPrefix = setPrefix;\r\n lottie.__getFactory = getFactory;\r\n lottie.version = '5.10.0';\r\n\r\n function checkReady() {\r\n if (document.readyState === 'complete') {\r\n clearInterval(readyStateCheckInterval);\r\n searchAnimations();\r\n }\r\n }\r\n\r\n function getQueryVariable(variable) {\r\n var vars = queryString.split('&');\r\n\r\n for (var i = 0; i < vars.length; i += 1) {\r\n var pair = vars[i].split('=');\r\n\r\n if (decodeURIComponent(pair[0]) == variable) {\r\n // eslint-disable-line eqeqeq\r\n return decodeURIComponent(pair[1]);\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var queryString = '';\r\n\r\n if (standalone) {\r\n var scripts = document.getElementsByTagName('script');\r\n var index = scripts.length - 1;\r\n var myScript = scripts[index] || {\r\n src: ''\r\n };\r\n queryString = myScript.src ? myScript.src.replace(/^[^\\?]+\\??/, '') : ''; // eslint-disable-line no-useless-escape\r\n\r\n renderer = getQueryVariable('renderer');\r\n }\r\n\r\n var readyStateCheckInterval = setInterval(checkReady, 100); // this adds bodymovin to the window object for backwards compatibility\r\n\r\n try {\r\n if (!((typeof exports === \"undefined\" ? \"undefined\" : _typeof$3(exports)) === 'object' && typeof module !== 'undefined') && !(typeof define === 'function' && define.amd) // eslint-disable-line no-undef\r\n ) {\r\n window.bodymovin = lottie;\r\n }\r\n } catch (err) {//\r\n }\r\n\r\n var ShapeModifiers = function () {\r\n var ob = {};\r\n var modifiers = {};\r\n ob.registerModifier = registerModifier;\r\n ob.getModifier = getModifier;\r\n\r\n function registerModifier(nm, factory) {\r\n if (!modifiers[nm]) {\r\n modifiers[nm] = factory;\r\n }\r\n }\r\n\r\n function getModifier(nm, elem, data) {\r\n return new modifiers[nm](elem, data);\r\n }\r\n\r\n return ob;\r\n }();\r\n\r\n function ShapeModifier() {}\r\n\r\n ShapeModifier.prototype.initModifierProperties = function () {};\r\n\r\n ShapeModifier.prototype.addShapeToModifier = function () {};\r\n\r\n ShapeModifier.prototype.addShape = function (data) {\r\n if (!this.closed) {\r\n // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick.\r\n data.sh.container.addDynamicProperty(data.sh);\r\n var shapeData = {\r\n shape: data.sh,\r\n data: data,\r\n localShapeCollection: shapeCollectionPool.newShapeCollection()\r\n };\r\n this.shapes.push(shapeData);\r\n this.addShapeToModifier(shapeData);\r\n\r\n if (this._isAnimated) {\r\n data.setAsAnimated();\r\n }\r\n }\r\n };\r\n\r\n ShapeModifier.prototype.init = function (elem, data) {\r\n this.shapes = [];\r\n this.elem = elem;\r\n this.initDynamicPropertyContainer(elem);\r\n this.initModifierProperties(elem, data);\r\n this.frameId = initialDefaultFrame;\r\n this.closed = false;\r\n this.k = false;\r\n\r\n if (this.dynamicProperties.length) {\r\n this.k = true;\r\n } else {\r\n this.getValue(true);\r\n }\r\n };\r\n\r\n ShapeModifier.prototype.processKeys = function () {\r\n if (this.elem.globalData.frameId === this.frameId) {\r\n return;\r\n }\r\n\r\n this.frameId = this.elem.globalData.frameId;\r\n this.iterateDynamicProperties();\r\n };\r\n\r\n extendPrototype([DynamicPropertyContainer], ShapeModifier);\r\n\r\n function TrimModifier() {}\r\n\r\n extendPrototype([ShapeModifier], TrimModifier);\r\n\r\n TrimModifier.prototype.initModifierProperties = function (elem, data) {\r\n this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);\r\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);\r\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);\r\n this.sValue = 0;\r\n this.eValue = 0;\r\n this.getValue = this.processKeys;\r\n this.m = data.m;\r\n this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;\r\n };\r\n\r\n TrimModifier.prototype.addShapeToModifier = function (shapeData) {\r\n shapeData.pathsData = [];\r\n };\r\n\r\n TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) {\r\n var segments = [];\r\n\r\n if (e <= 1) {\r\n segments.push({\r\n s: s,\r\n e: e\r\n });\r\n } else if (s >= 1) {\r\n segments.push({\r\n s: s - 1,\r\n e: e - 1\r\n });\r\n } else {\r\n segments.push({\r\n s: s,\r\n e: 1\r\n });\r\n segments.push({\r\n s: 0,\r\n e: e - 1\r\n });\r\n }\r\n\r\n var shapeSegments = [];\r\n var i;\r\n var len = segments.length;\r\n var segmentOb;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n segmentOb = segments[i];\r\n\r\n if (!(segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength)) {\r\n var shapeS;\r\n var shapeE;\r\n\r\n if (segmentOb.s * totalModifierLength <= addedLength) {\r\n shapeS = 0;\r\n } else {\r\n shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;\r\n }\r\n\r\n if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) {\r\n shapeE = 1;\r\n } else {\r\n shapeE = (segmentOb.e * totalModifierLength - addedLength) / shapeLength;\r\n }\r\n\r\n shapeSegments.push([shapeS, shapeE]);\r\n }\r\n }\r\n\r\n if (!shapeSegments.length) {\r\n shapeSegments.push([0, 0]);\r\n }\r\n\r\n return shapeSegments;\r\n };\r\n\r\n TrimModifier.prototype.releasePathsData = function (pathsData) {\r\n var i;\r\n var len = pathsData.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n segmentsLengthPool.release(pathsData[i]);\r\n }\r\n\r\n pathsData.length = 0;\r\n return pathsData;\r\n };\r\n\r\n TrimModifier.prototype.processShapes = function (_isFirstFrame) {\r\n var s;\r\n var e;\r\n\r\n if (this._mdf || _isFirstFrame) {\r\n var o = this.o.v % 360 / 360;\r\n\r\n if (o < 0) {\r\n o += 1;\r\n }\r\n\r\n if (this.s.v > 1) {\r\n s = 1 + o;\r\n } else if (this.s.v < 0) {\r\n s = 0 + o;\r\n } else {\r\n s = this.s.v + o;\r\n }\r\n\r\n if (this.e.v > 1) {\r\n e = 1 + o;\r\n } else if (this.e.v < 0) {\r\n e = 0 + o;\r\n } else {\r\n e = this.e.v + o;\r\n }\r\n\r\n if (s > e) {\r\n var _s = s;\r\n s = e;\r\n e = _s;\r\n }\r\n\r\n s = Math.round(s * 10000) * 0.0001;\r\n e = Math.round(e * 10000) * 0.0001;\r\n this.sValue = s;\r\n this.eValue = e;\r\n } else {\r\n s = this.sValue;\r\n e = this.eValue;\r\n }\r\n\r\n var shapePaths;\r\n var i;\r\n var len = this.shapes.length;\r\n var j;\r\n var jLen;\r\n var pathsData;\r\n var pathData;\r\n var totalShapeLength;\r\n var totalModifierLength = 0;\r\n\r\n if (e === s) {\r\n for (i = 0; i < len; i += 1) {\r\n this.shapes[i].localShapeCollection.releaseShapes();\r\n this.shapes[i].shape._mdf = true;\r\n this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;\r\n\r\n if (this._mdf) {\r\n this.shapes[i].pathsData.length = 0;\r\n }\r\n }\r\n } else if (!(e === 1 && s === 0 || e === 0 && s === 1)) {\r\n var segments = [];\r\n var shapeData;\r\n var localShapeCollection;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shapeData = this.shapes[i]; // if shape hasn't changed and trim properties haven't changed, cached previous path can be used\r\n\r\n if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {\r\n shapeData.shape.paths = shapeData.localShapeCollection;\r\n } else {\r\n shapePaths = shapeData.shape.paths;\r\n jLen = shapePaths._length;\r\n totalShapeLength = 0;\r\n\r\n if (!shapeData.shape._mdf && shapeData.pathsData.length) {\r\n totalShapeLength = shapeData.totalShapeLength;\r\n } else {\r\n pathsData = this.releasePathsData(shapeData.pathsData);\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n pathData = bez.getSegmentsLength(shapePaths.shapes[j]);\r\n pathsData.push(pathData);\r\n totalShapeLength += pathData.totalLength;\r\n }\r\n\r\n shapeData.totalShapeLength = totalShapeLength;\r\n shapeData.pathsData = pathsData;\r\n }\r\n\r\n totalModifierLength += totalShapeLength;\r\n shapeData.shape._mdf = true;\r\n }\r\n }\r\n\r\n var shapeS = s;\r\n var shapeE = e;\r\n var addedLength = 0;\r\n var edges;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n shapeData = this.shapes[i];\r\n\r\n if (shapeData.shape._mdf) {\r\n localShapeCollection = shapeData.localShapeCollection;\r\n localShapeCollection.releaseShapes(); // if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group\r\n\r\n if (this.m === 2 && len > 1) {\r\n edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);\r\n addedLength += shapeData.totalShapeLength;\r\n } else {\r\n edges = [[shapeS, shapeE]];\r\n }\r\n\r\n jLen = edges.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n shapeS = edges[j][0];\r\n shapeE = edges[j][1];\r\n segments.length = 0;\r\n\r\n if (shapeE <= 1) {\r\n segments.push({\r\n s: shapeData.totalShapeLength * shapeS,\r\n e: shapeData.totalShapeLength * shapeE\r\n });\r\n } else if (shapeS >= 1) {\r\n segments.push({\r\n s: shapeData.totalShapeLength * (shapeS - 1),\r\n e: shapeData.totalShapeLength * (shapeE - 1)\r\n });\r\n } else {\r\n segments.push({\r\n s: shapeData.totalShapeLength * shapeS,\r\n e: shapeData.totalShapeLength\r\n });\r\n segments.push({\r\n s: 0,\r\n e: shapeData.totalShapeLength * (shapeE - 1)\r\n });\r\n }\r\n\r\n var newShapesData = this.addShapes(shapeData, segments[0]);\r\n\r\n if (segments[0].s !== segments[0].e) {\r\n if (segments.length > 1) {\r\n var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];\r\n\r\n if (lastShapeInCollection.c) {\r\n var lastShape = newShapesData.pop();\r\n this.addPaths(newShapesData, localShapeCollection);\r\n newShapesData = this.addShapes(shapeData, segments[1], lastShape);\r\n } else {\r\n this.addPaths(newShapesData, localShapeCollection);\r\n newShapesData = this.addShapes(shapeData, segments[1]);\r\n }\r\n }\r\n\r\n this.addPaths(newShapesData, localShapeCollection);\r\n }\r\n }\r\n\r\n shapeData.shape.paths = localShapeCollection;\r\n }\r\n }\r\n } else if (this._mdf) {\r\n for (i = 0; i < len; i += 1) {\r\n // Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.\r\n // Don't remove this even if it's losing cached info.\r\n this.shapes[i].pathsData.length = 0;\r\n this.shapes[i].shape._mdf = true;\r\n }\r\n }\r\n };\r\n\r\n TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) {\r\n var i;\r\n var len = newPaths.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n localShapeCollection.addShape(newPaths[i]);\r\n }\r\n };\r\n\r\n TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) {\r\n shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);\r\n shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);\r\n\r\n if (newShape) {\r\n shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);\r\n }\r\n\r\n shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);\r\n };\r\n\r\n TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) {\r\n shapePath.setXYAt(points[1], points[5], 'o', pos);\r\n shapePath.setXYAt(points[2], points[6], 'i', pos + 1);\r\n\r\n if (newShape) {\r\n shapePath.setXYAt(points[0], points[4], 'v', pos);\r\n }\r\n\r\n shapePath.setXYAt(points[3], points[7], 'v', pos + 1);\r\n };\r\n\r\n TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) {\r\n var pathsData = shapeData.pathsData;\r\n var shapePaths = shapeData.shape.paths.shapes;\r\n var i;\r\n var len = shapeData.shape.paths._length;\r\n var j;\r\n var jLen;\r\n var addedLength = 0;\r\n var currentLengthData;\r\n var segmentCount;\r\n var lengths;\r\n var segment;\r\n var shapes = [];\r\n var initPos;\r\n var newShape = true;\r\n\r\n if (!shapePath) {\r\n shapePath = shapePool.newElement();\r\n segmentCount = 0;\r\n initPos = 0;\r\n } else {\r\n segmentCount = shapePath._length;\r\n initPos = shapePath._length;\r\n }\r\n\r\n shapes.push(shapePath);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n lengths = pathsData[i].lengths;\r\n shapePath.c = shapePaths[i].c;\r\n jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;\r\n\r\n for (j = 1; j < jLen; j += 1) {\r\n currentLengthData = lengths[j - 1];\r\n\r\n if (addedLength + currentLengthData.addedLength < shapeSegment.s) {\r\n addedLength += currentLengthData.addedLength;\r\n shapePath.c = false;\r\n } else if (addedLength > shapeSegment.e) {\r\n shapePath.c = false;\r\n break;\r\n } else {\r\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {\r\n this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);\r\n newShape = false;\r\n } else {\r\n segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]);\r\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\r\n\r\n newShape = false;\r\n shapePath.c = false;\r\n }\r\n\r\n addedLength += currentLengthData.addedLength;\r\n segmentCount += 1;\r\n }\r\n }\r\n\r\n if (shapePaths[i].c && lengths.length) {\r\n currentLengthData = lengths[j - 1];\r\n\r\n if (addedLength <= shapeSegment.e) {\r\n var segmentLength = lengths[j - 1].addedLength;\r\n\r\n if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {\r\n this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);\r\n newShape = false;\r\n } else {\r\n segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);\r\n this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);\r\n\r\n newShape = false;\r\n shapePath.c = false;\r\n }\r\n } else {\r\n shapePath.c = false;\r\n }\r\n\r\n addedLength += currentLengthData.addedLength;\r\n segmentCount += 1;\r\n }\r\n\r\n if (shapePath._length) {\r\n shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);\r\n shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1);\r\n }\r\n\r\n if (addedLength > shapeSegment.e) {\r\n break;\r\n }\r\n\r\n if (i < len - 1) {\r\n shapePath = shapePool.newElement();\r\n newShape = true;\r\n shapes.push(shapePath);\r\n segmentCount = 0;\r\n }\r\n }\r\n\r\n return shapes;\r\n };\r\n\r\n function PuckerAndBloatModifier() {}\r\n\r\n extendPrototype([ShapeModifier], PuckerAndBloatModifier);\r\n\r\n PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) {\r\n this.getValue = this.processKeys;\r\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);\r\n this._isAnimated = !!this.amount.effectsSequence.length;\r\n };\r\n\r\n PuckerAndBloatModifier.prototype.processPath = function (path, amount) {\r\n var percent = amount / 100;\r\n var centerPoint = [0, 0];\r\n var pathLength = path._length;\r\n var i = 0;\r\n\r\n for (i = 0; i < pathLength; i += 1) {\r\n centerPoint[0] += path.v[i][0];\r\n centerPoint[1] += path.v[i][1];\r\n }\r\n\r\n centerPoint[0] /= pathLength;\r\n centerPoint[1] /= pathLength;\r\n var clonedPath = shapePool.newElement();\r\n clonedPath.c = path.c;\r\n var vX;\r\n var vY;\r\n var oX;\r\n var oY;\r\n var iX;\r\n var iY;\r\n\r\n for (i = 0; i < pathLength; i += 1) {\r\n vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent;\r\n vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent;\r\n oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent;\r\n oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent;\r\n iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent;\r\n iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent;\r\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i);\r\n }\r\n\r\n return clonedPath;\r\n };\r\n\r\n PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) {\r\n var shapePaths;\r\n var i;\r\n var len = this.shapes.length;\r\n var j;\r\n var jLen;\r\n var amount = this.amount.v;\r\n\r\n if (amount !== 0) {\r\n var shapeData;\r\n var localShapeCollection;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shapeData = this.shapes[i];\r\n localShapeCollection = shapeData.localShapeCollection;\r\n\r\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\r\n localShapeCollection.releaseShapes();\r\n shapeData.shape._mdf = true;\r\n shapePaths = shapeData.shape.paths.shapes;\r\n jLen = shapeData.shape.paths._length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount));\r\n }\r\n }\r\n\r\n shapeData.shape.paths = shapeData.localShapeCollection;\r\n }\r\n }\r\n\r\n if (!this.dynamicProperties.length) {\r\n this._mdf = false;\r\n }\r\n };\r\n\r\n var TransformPropertyFactory = function () {\r\n var defaultVector = [0, 0];\r\n\r\n function applyToMatrix(mat) {\r\n var _mdf = this._mdf;\r\n this.iterateDynamicProperties();\r\n this._mdf = this._mdf || _mdf;\r\n\r\n if (this.a) {\r\n mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\r\n }\r\n\r\n if (this.s) {\r\n mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\r\n }\r\n\r\n if (this.sk) {\r\n mat.skewFromAxis(-this.sk.v, this.sa.v);\r\n }\r\n\r\n if (this.r) {\r\n mat.rotate(-this.r.v);\r\n } else {\r\n mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\r\n }\r\n\r\n if (this.data.p.s) {\r\n if (this.data.p.z) {\r\n mat.translate(this.px.v, this.py.v, -this.pz.v);\r\n } else {\r\n mat.translate(this.px.v, this.py.v, 0);\r\n }\r\n } else {\r\n mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\r\n }\r\n }\r\n\r\n function processKeys(forceRender) {\r\n if (this.elem.globalData.frameId === this.frameId) {\r\n return;\r\n }\r\n\r\n if (this._isDirty) {\r\n this.precalculateMatrix();\r\n this._isDirty = false;\r\n }\r\n\r\n this.iterateDynamicProperties();\r\n\r\n if (this._mdf || forceRender) {\r\n var frameRate;\r\n this.v.cloneFromProps(this.pre.props);\r\n\r\n if (this.appliedTransformations < 1) {\r\n this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\r\n }\r\n\r\n if (this.appliedTransformations < 2) {\r\n this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\r\n }\r\n\r\n if (this.sk && this.appliedTransformations < 3) {\r\n this.v.skewFromAxis(-this.sk.v, this.sa.v);\r\n }\r\n\r\n if (this.r && this.appliedTransformations < 4) {\r\n this.v.rotate(-this.r.v);\r\n } else if (!this.r && this.appliedTransformations < 4) {\r\n this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\r\n }\r\n\r\n if (this.autoOriented) {\r\n var v1;\r\n var v2;\r\n frameRate = this.elem.globalData.frameRate;\r\n\r\n if (this.p && this.p.keyframes && this.p.getValueAtTime) {\r\n if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) {\r\n v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0);\r\n v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);\r\n } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {\r\n v1 = this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length - 1].t / frameRate, 0);\r\n v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0);\r\n } else {\r\n v1 = this.p.pv;\r\n v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);\r\n }\r\n } else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {\r\n v1 = [];\r\n v2 = [];\r\n var px = this.px;\r\n var py = this.py;\r\n\r\n if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) {\r\n v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0);\r\n v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0);\r\n v2[0] = px.getValueAtTime(px.keyframes[0].t / frameRate, 0);\r\n v2[1] = py.getValueAtTime(py.keyframes[0].t / frameRate, 0);\r\n } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {\r\n v1[0] = px.getValueAtTime(px.keyframes[px.keyframes.length - 1].t / frameRate, 0);\r\n v1[1] = py.getValueAtTime(py.keyframes[py.keyframes.length - 1].t / frameRate, 0);\r\n v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0);\r\n v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0);\r\n } else {\r\n v1 = [px.pv, py.pv];\r\n v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime);\r\n v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime);\r\n }\r\n } else {\r\n v2 = defaultVector;\r\n v1 = v2;\r\n }\r\n\r\n this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));\r\n }\r\n\r\n if (this.data.p && this.data.p.s) {\r\n if (this.data.p.z) {\r\n this.v.translate(this.px.v, this.py.v, -this.pz.v);\r\n } else {\r\n this.v.translate(this.px.v, this.py.v, 0);\r\n }\r\n } else {\r\n this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);\r\n }\r\n }\r\n\r\n this.frameId = this.elem.globalData.frameId;\r\n }\r\n\r\n function precalculateMatrix() {\r\n if (!this.a.k) {\r\n this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);\r\n this.appliedTransformations = 1;\r\n } else {\r\n return;\r\n }\r\n\r\n if (!this.s.effectsSequence.length) {\r\n this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);\r\n this.appliedTransformations = 2;\r\n } else {\r\n return;\r\n }\r\n\r\n if (this.sk) {\r\n if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {\r\n this.pre.skewFromAxis(-this.sk.v, this.sa.v);\r\n this.appliedTransformations = 3;\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n if (this.r) {\r\n if (!this.r.effectsSequence.length) {\r\n this.pre.rotate(-this.r.v);\r\n this.appliedTransformations = 4;\r\n }\r\n } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {\r\n this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);\r\n this.appliedTransformations = 4;\r\n }\r\n }\r\n\r\n function autoOrient() {//\r\n // var prevP = this.getValueAtTime();\r\n }\r\n\r\n function addDynamicProperty(prop) {\r\n this._addDynamicProperty(prop);\r\n\r\n this.elem.addDynamicProperty(prop);\r\n this._isDirty = true;\r\n }\r\n\r\n function TransformProperty(elem, data, container) {\r\n this.elem = elem;\r\n this.frameId = -1;\r\n this.propType = 'transform';\r\n this.data = data;\r\n this.v = new Matrix(); // Precalculated matrix with non animated properties\r\n\r\n this.pre = new Matrix();\r\n this.appliedTransformations = 0;\r\n this.initDynamicPropertyContainer(container || elem);\r\n\r\n if (data.p && data.p.s) {\r\n this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this);\r\n this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this);\r\n\r\n if (data.p.z) {\r\n this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this);\r\n }\r\n } else {\r\n this.p = PropertyFactory.getProp(elem, data.p || {\r\n k: [0, 0, 0]\r\n }, 1, 0, this);\r\n }\r\n\r\n if (data.rx) {\r\n this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);\r\n this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);\r\n this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);\r\n\r\n if (data.or.k[0].ti) {\r\n var i;\r\n var len = data.or.k.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n data.or.k[i].to = null;\r\n data.or.k[i].ti = null;\r\n }\r\n }\r\n\r\n this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this); // sh Indicates it needs to be capped between -180 and 180\r\n\r\n this.or.sh = true;\r\n } else {\r\n this.r = PropertyFactory.getProp(elem, data.r || {\r\n k: 0\r\n }, 0, degToRads, this);\r\n }\r\n\r\n if (data.sk) {\r\n this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);\r\n this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);\r\n }\r\n\r\n this.a = PropertyFactory.getProp(elem, data.a || {\r\n k: [0, 0, 0]\r\n }, 1, 0, this);\r\n this.s = PropertyFactory.getProp(elem, data.s || {\r\n k: [100, 100, 100]\r\n }, 1, 0.01, this); // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.\r\n\r\n if (data.o) {\r\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem);\r\n } else {\r\n this.o = {\r\n _mdf: false,\r\n v: 1\r\n };\r\n }\r\n\r\n this._isDirty = true;\r\n\r\n if (!this.dynamicProperties.length) {\r\n this.getValue(true);\r\n }\r\n }\r\n\r\n TransformProperty.prototype = {\r\n applyToMatrix: applyToMatrix,\r\n getValue: processKeys,\r\n precalculateMatrix: precalculateMatrix,\r\n autoOrient: autoOrient\r\n };\r\n extendPrototype([DynamicPropertyContainer], TransformProperty);\r\n TransformProperty.prototype.addDynamicProperty = addDynamicProperty;\r\n TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;\r\n\r\n function getTransformProperty(elem, data, container) {\r\n return new TransformProperty(elem, data, container);\r\n }\r\n\r\n return {\r\n getTransformProperty: getTransformProperty\r\n };\r\n }();\r\n\r\n function RepeaterModifier() {}\r\n\r\n extendPrototype([ShapeModifier], RepeaterModifier);\r\n\r\n RepeaterModifier.prototype.initModifierProperties = function (elem, data) {\r\n this.getValue = this.processKeys;\r\n this.c = PropertyFactory.getProp(elem, data.c, 0, null, this);\r\n this.o = PropertyFactory.getProp(elem, data.o, 0, null, this);\r\n this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this);\r\n this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this);\r\n this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this);\r\n this.data = data;\r\n\r\n if (!this.dynamicProperties.length) {\r\n this.getValue(true);\r\n }\r\n\r\n this._isAnimated = !!this.dynamicProperties.length;\r\n this.pMatrix = new Matrix();\r\n this.rMatrix = new Matrix();\r\n this.sMatrix = new Matrix();\r\n this.tMatrix = new Matrix();\r\n this.matrix = new Matrix();\r\n };\r\n\r\n RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) {\r\n var dir = inv ? -1 : 1;\r\n var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);\r\n var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);\r\n pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);\r\n rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\r\n rMatrix.rotate(-transform.r.v * dir * perc);\r\n rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\r\n sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);\r\n sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY);\r\n sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);\r\n };\r\n\r\n RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) {\r\n this.elem = elem;\r\n this.arr = arr;\r\n this.pos = pos;\r\n this.elemsData = elemsData;\r\n this._currentCopies = 0;\r\n this._elements = [];\r\n this._groups = [];\r\n this.frameId = -1;\r\n this.initDynamicPropertyContainer(elem);\r\n this.initModifierProperties(elem, arr[pos]);\r\n\r\n while (pos > 0) {\r\n pos -= 1; // this._elements.unshift(arr.splice(pos,1)[0]);\r\n\r\n this._elements.unshift(arr[pos]);\r\n }\r\n\r\n if (this.dynamicProperties.length) {\r\n this.k = true;\r\n } else {\r\n this.getValue(true);\r\n }\r\n };\r\n\r\n RepeaterModifier.prototype.resetElements = function (elements) {\r\n var i;\r\n var len = elements.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n elements[i]._processed = false;\r\n\r\n if (elements[i].ty === 'gr') {\r\n this.resetElements(elements[i].it);\r\n }\r\n }\r\n };\r\n\r\n RepeaterModifier.prototype.cloneElements = function (elements) {\r\n var newElements = JSON.parse(JSON.stringify(elements));\r\n this.resetElements(newElements);\r\n return newElements;\r\n };\r\n\r\n RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) {\r\n var i;\r\n var len = elements.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n elements[i]._render = renderFlag;\r\n\r\n if (elements[i].ty === 'gr') {\r\n this.changeGroupRender(elements[i].it, renderFlag);\r\n }\r\n }\r\n };\r\n\r\n RepeaterModifier.prototype.processShapes = function (_isFirstFrame) {\r\n var items;\r\n var itemsTransform;\r\n var i;\r\n var dir;\r\n var cont;\r\n var hasReloaded = false;\r\n\r\n if (this._mdf || _isFirstFrame) {\r\n var copies = Math.ceil(this.c.v);\r\n\r\n if (this._groups.length < copies) {\r\n while (this._groups.length < copies) {\r\n var group = {\r\n it: this.cloneElements(this._elements),\r\n ty: 'gr'\r\n };\r\n group.it.push({\r\n a: {\r\n a: 0,\r\n ix: 1,\r\n k: [0, 0]\r\n },\r\n nm: 'Transform',\r\n o: {\r\n a: 0,\r\n ix: 7,\r\n k: 100\r\n },\r\n p: {\r\n a: 0,\r\n ix: 2,\r\n k: [0, 0]\r\n },\r\n r: {\r\n a: 1,\r\n ix: 6,\r\n k: [{\r\n s: 0,\r\n e: 0,\r\n t: 0\r\n }, {\r\n s: 0,\r\n e: 0,\r\n t: 1\r\n }]\r\n },\r\n s: {\r\n a: 0,\r\n ix: 3,\r\n k: [100, 100]\r\n },\r\n sa: {\r\n a: 0,\r\n ix: 5,\r\n k: 0\r\n },\r\n sk: {\r\n a: 0,\r\n ix: 4,\r\n k: 0\r\n },\r\n ty: 'tr'\r\n });\r\n this.arr.splice(0, 0, group);\r\n\r\n this._groups.splice(0, 0, group);\r\n\r\n this._currentCopies += 1;\r\n }\r\n\r\n this.elem.reloadShapes();\r\n hasReloaded = true;\r\n }\r\n\r\n cont = 0;\r\n var renderFlag;\r\n\r\n for (i = 0; i <= this._groups.length - 1; i += 1) {\r\n renderFlag = cont < copies;\r\n this._groups[i]._render = renderFlag;\r\n this.changeGroupRender(this._groups[i].it, renderFlag);\r\n\r\n if (!renderFlag) {\r\n var elems = this.elemsData[i].it;\r\n var transformData = elems[elems.length - 1];\r\n\r\n if (transformData.transform.op.v !== 0) {\r\n transformData.transform.op._mdf = true;\r\n transformData.transform.op.v = 0;\r\n } else {\r\n transformData.transform.op._mdf = false;\r\n }\r\n }\r\n\r\n cont += 1;\r\n }\r\n\r\n this._currentCopies = copies; /// /\r\n\r\n var offset = this.o.v;\r\n var offsetModulo = offset % 1;\r\n var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);\r\n var pProps = this.pMatrix.props;\r\n var rProps = this.rMatrix.props;\r\n var sProps = this.sMatrix.props;\r\n this.pMatrix.reset();\r\n this.rMatrix.reset();\r\n this.sMatrix.reset();\r\n this.tMatrix.reset();\r\n this.matrix.reset();\r\n var iteration = 0;\r\n\r\n if (offset > 0) {\r\n while (iteration < roundOffset) {\r\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\r\n iteration += 1;\r\n }\r\n\r\n if (offsetModulo) {\r\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);\r\n iteration += offsetModulo;\r\n }\r\n } else if (offset < 0) {\r\n while (iteration > roundOffset) {\r\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);\r\n iteration -= 1;\r\n }\r\n\r\n if (offsetModulo) {\r\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true);\r\n iteration -= offsetModulo;\r\n }\r\n }\r\n\r\n i = this.data.m === 1 ? 0 : this._currentCopies - 1;\r\n dir = this.data.m === 1 ? 1 : -1;\r\n cont = this._currentCopies;\r\n var j;\r\n var jLen;\r\n\r\n while (cont) {\r\n items = this.elemsData[i].it;\r\n itemsTransform = items[items.length - 1].transform.mProps.v.props;\r\n jLen = itemsTransform.length;\r\n items[items.length - 1].transform.mProps._mdf = true;\r\n items[items.length - 1].transform.op._mdf = true;\r\n items[items.length - 1].transform.op.v = this._currentCopies === 1 ? this.so.v : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));\r\n\r\n if (iteration !== 0) {\r\n if (i !== 0 && dir === 1 || i !== this._currentCopies - 1 && dir === -1) {\r\n this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);\r\n }\r\n\r\n this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]);\r\n this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]);\r\n this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]);\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n itemsTransform[j] = this.matrix.props[j];\r\n }\r\n\r\n this.matrix.reset();\r\n } else {\r\n this.matrix.reset();\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n itemsTransform[j] = this.matrix.props[j];\r\n }\r\n }\r\n\r\n iteration += 1;\r\n cont -= 1;\r\n i += dir;\r\n }\r\n } else {\r\n cont = this._currentCopies;\r\n i = 0;\r\n dir = 1;\r\n\r\n while (cont) {\r\n items = this.elemsData[i].it;\r\n itemsTransform = items[items.length - 1].transform.mProps.v.props;\r\n items[items.length - 1].transform.mProps._mdf = false;\r\n items[items.length - 1].transform.op._mdf = false;\r\n cont -= 1;\r\n i += dir;\r\n }\r\n }\r\n\r\n return hasReloaded;\r\n };\r\n\r\n RepeaterModifier.prototype.addShape = function () {};\r\n\r\n function RoundCornersModifier() {}\r\n\r\n extendPrototype([ShapeModifier], RoundCornersModifier);\r\n\r\n RoundCornersModifier.prototype.initModifierProperties = function (elem, data) {\r\n this.getValue = this.processKeys;\r\n this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this);\r\n this._isAnimated = !!this.rd.effectsSequence.length;\r\n };\r\n\r\n RoundCornersModifier.prototype.processPath = function (path, round) {\r\n var clonedPath = shapePool.newElement();\r\n clonedPath.c = path.c;\r\n var i;\r\n var len = path._length;\r\n var currentV;\r\n var currentI;\r\n var currentO;\r\n var closerV;\r\n var distance;\r\n var newPosPerc;\r\n var index = 0;\r\n var vX;\r\n var vY;\r\n var oX;\r\n var oY;\r\n var iX;\r\n var iY;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n currentV = path.v[i];\r\n currentO = path.o[i];\r\n currentI = path.i[i];\r\n\r\n if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) {\r\n if ((i === 0 || i === len - 1) && !path.c) {\r\n clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index);\r\n /* clonedPath.v[index] = currentV;\r\n clonedPath.o[index] = currentO;\r\n clonedPath.i[index] = currentI; */\r\n\r\n index += 1;\r\n } else {\r\n if (i === 0) {\r\n closerV = path.v[len - 1];\r\n } else {\r\n closerV = path.v[i - 1];\r\n }\r\n\r\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\r\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\r\n iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\r\n vX = iX;\r\n iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc;\r\n vY = iY;\r\n oX = vX - (vX - currentV[0]) * roundCorner;\r\n oY = vY - (vY - currentV[1]) * roundCorner;\r\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\r\n index += 1;\r\n\r\n if (i === len - 1) {\r\n closerV = path.v[0];\r\n } else {\r\n closerV = path.v[i + 1];\r\n }\r\n\r\n distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2));\r\n newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0;\r\n oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc;\r\n vX = oX;\r\n oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc;\r\n vY = oY;\r\n iX = vX - (vX - currentV[0]) * roundCorner;\r\n iY = vY - (vY - currentV[1]) * roundCorner;\r\n clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index);\r\n index += 1;\r\n }\r\n } else {\r\n clonedPath.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index);\r\n index += 1;\r\n }\r\n }\r\n\r\n return clonedPath;\r\n };\r\n\r\n RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) {\r\n var shapePaths;\r\n var i;\r\n var len = this.shapes.length;\r\n var j;\r\n var jLen;\r\n var rd = this.rd.v;\r\n\r\n if (rd !== 0) {\r\n var shapeData;\r\n var localShapeCollection;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shapeData = this.shapes[i];\r\n localShapeCollection = shapeData.localShapeCollection;\r\n\r\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\r\n localShapeCollection.releaseShapes();\r\n shapeData.shape._mdf = true;\r\n shapePaths = shapeData.shape.paths.shapes;\r\n jLen = shapeData.shape.paths._length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n localShapeCollection.addShape(this.processPath(shapePaths[j], rd));\r\n }\r\n }\r\n\r\n shapeData.shape.paths = shapeData.localShapeCollection;\r\n }\r\n }\r\n\r\n if (!this.dynamicProperties.length) {\r\n this._mdf = false;\r\n }\r\n };\r\n\r\n function floatEqual(a, b) {\r\n return Math.abs(a - b) * 100000 <= Math.min(Math.abs(a), Math.abs(b));\r\n }\r\n\r\n function floatZero(f) {\r\n return Math.abs(f) <= 0.00001;\r\n }\r\n\r\n function lerp(p0, p1, amount) {\r\n return p0 * (1 - amount) + p1 * amount;\r\n }\r\n\r\n function lerpPoint(p0, p1, amount) {\r\n return [lerp(p0[0], p1[0], amount), lerp(p0[1], p1[1], amount)];\r\n }\r\n\r\n function quadRoots(a, b, c) {\r\n // no root\r\n if (a === 0) return [];\r\n var s = b * b - 4 * a * c; // Complex roots\r\n\r\n if (s < 0) return [];\r\n var singleRoot = -b / (2 * a); // 1 root\r\n\r\n if (s === 0) return [singleRoot];\r\n var delta = Math.sqrt(s) / (2 * a); // 2 roots\r\n\r\n return [singleRoot - delta, singleRoot + delta];\r\n }\r\n\r\n function polynomialCoefficients(p0, p1, p2, p3) {\r\n return [-p0 + 3 * p1 - 3 * p2 + p3, 3 * p0 - 6 * p1 + 3 * p2, -3 * p0 + 3 * p1, p0];\r\n }\r\n\r\n function singlePoint(p) {\r\n return new PolynomialBezier(p, p, p, p, false);\r\n }\r\n\r\n function PolynomialBezier(p0, p1, p2, p3, linearize) {\r\n if (linearize && pointEqual(p0, p1)) {\r\n p1 = lerpPoint(p0, p3, 1 / 3);\r\n }\r\n\r\n if (linearize && pointEqual(p2, p3)) {\r\n p2 = lerpPoint(p0, p3, 2 / 3);\r\n }\r\n\r\n var coeffx = polynomialCoefficients(p0[0], p1[0], p2[0], p3[0]);\r\n var coeffy = polynomialCoefficients(p0[1], p1[1], p2[1], p3[1]);\r\n this.a = [coeffx[0], coeffy[0]];\r\n this.b = [coeffx[1], coeffy[1]];\r\n this.c = [coeffx[2], coeffy[2]];\r\n this.d = [coeffx[3], coeffy[3]];\r\n this.points = [p0, p1, p2, p3];\r\n }\r\n\r\n PolynomialBezier.prototype.point = function (t) {\r\n return [((this.a[0] * t + this.b[0]) * t + this.c[0]) * t + this.d[0], ((this.a[1] * t + this.b[1]) * t + this.c[1]) * t + this.d[1]];\r\n };\r\n\r\n PolynomialBezier.prototype.derivative = function (t) {\r\n return [(3 * t * this.a[0] + 2 * this.b[0]) * t + this.c[0], (3 * t * this.a[1] + 2 * this.b[1]) * t + this.c[1]];\r\n };\r\n\r\n PolynomialBezier.prototype.tangentAngle = function (t) {\r\n var p = this.derivative(t);\r\n return Math.atan2(p[1], p[0]);\r\n };\r\n\r\n PolynomialBezier.prototype.normalAngle = function (t) {\r\n var p = this.derivative(t);\r\n return Math.atan2(p[0], p[1]);\r\n };\r\n\r\n PolynomialBezier.prototype.inflectionPoints = function () {\r\n var denom = this.a[1] * this.b[0] - this.a[0] * this.b[1];\r\n if (floatZero(denom)) return [];\r\n var tcusp = -0.5 * (this.a[1] * this.c[0] - this.a[0] * this.c[1]) / denom;\r\n var square = tcusp * tcusp - 1 / 3 * (this.b[1] * this.c[0] - this.b[0] * this.c[1]) / denom;\r\n if (square < 0) return [];\r\n var root = Math.sqrt(square);\r\n\r\n if (floatZero(root)) {\r\n if (root > 0 && root < 1) return [tcusp];\r\n return [];\r\n }\r\n\r\n return [tcusp - root, tcusp + root].filter(function (r) {\r\n return r > 0 && r < 1;\r\n });\r\n };\r\n\r\n PolynomialBezier.prototype.split = function (t) {\r\n if (t <= 0) return [singlePoint(this.points[0]), this];\r\n if (t >= 1) return [this, singlePoint(this.points[this.points.length - 1])];\r\n var p10 = lerpPoint(this.points[0], this.points[1], t);\r\n var p11 = lerpPoint(this.points[1], this.points[2], t);\r\n var p12 = lerpPoint(this.points[2], this.points[3], t);\r\n var p20 = lerpPoint(p10, p11, t);\r\n var p21 = lerpPoint(p11, p12, t);\r\n var p3 = lerpPoint(p20, p21, t);\r\n return [new PolynomialBezier(this.points[0], p10, p20, p3, true), new PolynomialBezier(p3, p21, p12, this.points[3], true)];\r\n };\r\n\r\n function extrema(bez, comp) {\r\n var min = bez.points[0][comp];\r\n var max = bez.points[bez.points.length - 1][comp];\r\n\r\n if (min > max) {\r\n var e = max;\r\n max = min;\r\n min = e;\r\n } // Derivative roots to find min/max\r\n\r\n\r\n var f = quadRoots(3 * bez.a[comp], 2 * bez.b[comp], bez.c[comp]);\r\n\r\n for (var i = 0; i < f.length; i += 1) {\r\n if (f[i] > 0 && f[i] < 1) {\r\n var val = bez.point(f[i])[comp];\r\n if (val < min) min = val;else if (val > max) max = val;\r\n }\r\n }\r\n\r\n return {\r\n min: min,\r\n max: max\r\n };\r\n }\r\n\r\n PolynomialBezier.prototype.bounds = function () {\r\n return {\r\n x: extrema(this, 0),\r\n y: extrema(this, 1)\r\n };\r\n };\r\n\r\n PolynomialBezier.prototype.boundingBox = function () {\r\n var bounds = this.bounds();\r\n return {\r\n left: bounds.x.min,\r\n right: bounds.x.max,\r\n top: bounds.y.min,\r\n bottom: bounds.y.max,\r\n width: bounds.x.max - bounds.x.min,\r\n height: bounds.y.max - bounds.y.min,\r\n cx: (bounds.x.max + bounds.x.min) / 2,\r\n cy: (bounds.y.max + bounds.y.min) / 2\r\n };\r\n };\r\n\r\n function intersectData(bez, t1, t2) {\r\n var box = bez.boundingBox();\r\n return {\r\n cx: box.cx,\r\n cy: box.cy,\r\n width: box.width,\r\n height: box.height,\r\n bez: bez,\r\n t: (t1 + t2) / 2,\r\n t1: t1,\r\n t2: t2\r\n };\r\n }\r\n\r\n function splitData(data) {\r\n var split = data.bez.split(0.5);\r\n return [intersectData(split[0], data.t1, data.t), intersectData(split[1], data.t, data.t2)];\r\n }\r\n\r\n function boxIntersect(b1, b2) {\r\n return Math.abs(b1.cx - b2.cx) * 2 < b1.width + b2.width && Math.abs(b1.cy - b2.cy) * 2 < b1.height + b2.height;\r\n }\r\n\r\n function intersectsImpl(d1, d2, depth, tolerance, intersections, maxRecursion) {\r\n if (!boxIntersect(d1, d2)) return;\r\n\r\n if (depth >= maxRecursion || d1.width <= tolerance && d1.height <= tolerance && d2.width <= tolerance && d2.height <= tolerance) {\r\n intersections.push([d1.t, d2.t]);\r\n return;\r\n }\r\n\r\n var d1s = splitData(d1);\r\n var d2s = splitData(d2);\r\n intersectsImpl(d1s[0], d2s[0], depth + 1, tolerance, intersections, maxRecursion);\r\n intersectsImpl(d1s[0], d2s[1], depth + 1, tolerance, intersections, maxRecursion);\r\n intersectsImpl(d1s[1], d2s[0], depth + 1, tolerance, intersections, maxRecursion);\r\n intersectsImpl(d1s[1], d2s[1], depth + 1, tolerance, intersections, maxRecursion);\r\n }\r\n\r\n PolynomialBezier.prototype.intersections = function (other, tolerance, maxRecursion) {\r\n if (tolerance === undefined) tolerance = 2;\r\n if (maxRecursion === undefined) maxRecursion = 7;\r\n var intersections = [];\r\n intersectsImpl(intersectData(this, 0, 1), intersectData(other, 0, 1), 0, tolerance, intersections, maxRecursion);\r\n return intersections;\r\n };\r\n\r\n PolynomialBezier.shapeSegment = function (shapePath, index) {\r\n var nextIndex = (index + 1) % shapePath.length();\r\n return new PolynomialBezier(shapePath.v[index], shapePath.o[index], shapePath.i[nextIndex], shapePath.v[nextIndex], true);\r\n };\r\n\r\n PolynomialBezier.shapeSegmentInverted = function (shapePath, index) {\r\n var nextIndex = (index + 1) % shapePath.length();\r\n return new PolynomialBezier(shapePath.v[nextIndex], shapePath.i[nextIndex], shapePath.o[index], shapePath.v[index], true);\r\n };\r\n\r\n function crossProduct(a, b) {\r\n return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];\r\n }\r\n\r\n function lineIntersection(start1, end1, start2, end2) {\r\n var v1 = [start1[0], start1[1], 1];\r\n var v2 = [end1[0], end1[1], 1];\r\n var v3 = [start2[0], start2[1], 1];\r\n var v4 = [end2[0], end2[1], 1];\r\n var r = crossProduct(crossProduct(v1, v2), crossProduct(v3, v4));\r\n if (floatZero(r[2])) return null;\r\n return [r[0] / r[2], r[1] / r[2]];\r\n }\r\n\r\n function polarOffset(p, angle, length) {\r\n return [p[0] + Math.cos(angle) * length, p[1] - Math.sin(angle) * length];\r\n }\r\n\r\n function pointDistance(p1, p2) {\r\n return Math.hypot(p1[0] - p2[0], p1[1] - p2[1]);\r\n }\r\n\r\n function pointEqual(p1, p2) {\r\n return floatEqual(p1[0], p2[0]) && floatEqual(p1[1], p2[1]);\r\n }\r\n\r\n function ZigZagModifier() {}\r\n\r\n extendPrototype([ShapeModifier], ZigZagModifier);\r\n\r\n ZigZagModifier.prototype.initModifierProperties = function (elem, data) {\r\n this.getValue = this.processKeys;\r\n this.amplitude = PropertyFactory.getProp(elem, data.s, 0, null, this);\r\n this.frequency = PropertyFactory.getProp(elem, data.r, 0, null, this);\r\n this.pointsType = PropertyFactory.getProp(elem, data.pt, 0, null, this);\r\n this._isAnimated = this.amplitude.effectsSequence.length !== 0 || this.frequency.effectsSequence.length !== 0 || this.pointsType.effectsSequence.length !== 0;\r\n };\r\n\r\n function setPoint(outputBezier, point, angle, direction, amplitude, outAmplitude, inAmplitude) {\r\n var angO = angle - Math.PI / 2;\r\n var angI = angle + Math.PI / 2;\r\n var px = point[0] + Math.cos(angle) * direction * amplitude;\r\n var py = point[1] - Math.sin(angle) * direction * amplitude;\r\n outputBezier.setTripleAt(px, py, px + Math.cos(angO) * outAmplitude, py - Math.sin(angO) * outAmplitude, px + Math.cos(angI) * inAmplitude, py - Math.sin(angI) * inAmplitude, outputBezier.length());\r\n }\r\n\r\n function getPerpendicularVector(pt1, pt2) {\r\n var vector = [pt2[0] - pt1[0], pt2[1] - pt1[1]];\r\n var rot = -Math.PI * 0.5;\r\n var rotatedVector = [Math.cos(rot) * vector[0] - Math.sin(rot) * vector[1], Math.sin(rot) * vector[0] + Math.cos(rot) * vector[1]];\r\n return rotatedVector;\r\n }\r\n\r\n function getProjectingAngle(path, cur) {\r\n var prevIndex = cur === 0 ? path.length() - 1 : cur - 1;\r\n var nextIndex = (cur + 1) % path.length();\r\n var prevPoint = path.v[prevIndex];\r\n var nextPoint = path.v[nextIndex];\r\n var pVector = getPerpendicularVector(prevPoint, nextPoint);\r\n return Math.atan2(0, 1) - Math.atan2(pVector[1], pVector[0]);\r\n }\r\n\r\n function zigZagCorner(outputBezier, path, cur, amplitude, frequency, pointType, direction) {\r\n var angle = getProjectingAngle(path, cur);\r\n var point = path.v[cur % path._length];\r\n var prevPoint = path.v[cur === 0 ? path._length - 1 : cur - 1];\r\n var nextPoint = path.v[(cur + 1) % path._length];\r\n var prevDist = pointType === 2 ? Math.sqrt(Math.pow(point[0] - prevPoint[0], 2) + Math.pow(point[1] - prevPoint[1], 2)) : 0;\r\n var nextDist = pointType === 2 ? Math.sqrt(Math.pow(point[0] - nextPoint[0], 2) + Math.pow(point[1] - nextPoint[1], 2)) : 0;\r\n setPoint(outputBezier, path.v[cur % path._length], angle, direction, amplitude, nextDist / ((frequency + 1) * 2), prevDist / ((frequency + 1) * 2), pointType);\r\n }\r\n\r\n function zigZagSegment(outputBezier, segment, amplitude, frequency, pointType, direction) {\r\n for (var i = 0; i < frequency; i += 1) {\r\n var t = (i + 1) / (frequency + 1);\r\n var dist = pointType === 2 ? Math.sqrt(Math.pow(segment.points[3][0] - segment.points[0][0], 2) + Math.pow(segment.points[3][1] - segment.points[0][1], 2)) : 0;\r\n var angle = segment.normalAngle(t);\r\n var point = segment.point(t);\r\n setPoint(outputBezier, point, angle, direction, amplitude, dist / ((frequency + 1) * 2), dist / ((frequency + 1) * 2), pointType);\r\n direction = -direction;\r\n }\r\n\r\n return direction;\r\n }\r\n\r\n ZigZagModifier.prototype.processPath = function (path, amplitude, frequency, pointType) {\r\n var count = path._length;\r\n var clonedPath = shapePool.newElement();\r\n clonedPath.c = path.c;\r\n\r\n if (!path.c) {\r\n count -= 1;\r\n }\r\n\r\n if (count === 0) return clonedPath;\r\n var direction = -1;\r\n var segment = PolynomialBezier.shapeSegment(path, 0);\r\n zigZagCorner(clonedPath, path, 0, amplitude, frequency, pointType, direction);\r\n\r\n for (var i = 0; i < count; i += 1) {\r\n direction = zigZagSegment(clonedPath, segment, amplitude, frequency, pointType, -direction);\r\n\r\n if (i === count - 1 && !path.c) {\r\n segment = null;\r\n } else {\r\n segment = PolynomialBezier.shapeSegment(path, (i + 1) % count);\r\n }\r\n\r\n zigZagCorner(clonedPath, path, i + 1, amplitude, frequency, pointType, direction);\r\n }\r\n\r\n return clonedPath;\r\n };\r\n\r\n ZigZagModifier.prototype.processShapes = function (_isFirstFrame) {\r\n var shapePaths;\r\n var i;\r\n var len = this.shapes.length;\r\n var j;\r\n var jLen;\r\n var amplitude = this.amplitude.v;\r\n var frequency = Math.max(0, Math.round(this.frequency.v));\r\n var pointType = this.pointsType.v;\r\n\r\n if (amplitude !== 0) {\r\n var shapeData;\r\n var localShapeCollection;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shapeData = this.shapes[i];\r\n localShapeCollection = shapeData.localShapeCollection;\r\n\r\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\r\n localShapeCollection.releaseShapes();\r\n shapeData.shape._mdf = true;\r\n shapePaths = shapeData.shape.paths.shapes;\r\n jLen = shapeData.shape.paths._length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n localShapeCollection.addShape(this.processPath(shapePaths[j], amplitude, frequency, pointType));\r\n }\r\n }\r\n\r\n shapeData.shape.paths = shapeData.localShapeCollection;\r\n }\r\n }\r\n\r\n if (!this.dynamicProperties.length) {\r\n this._mdf = false;\r\n }\r\n };\r\n\r\n function linearOffset(p1, p2, amount) {\r\n var angle = Math.atan2(p2[0] - p1[0], p2[1] - p1[1]);\r\n return [polarOffset(p1, angle, amount), polarOffset(p2, angle, amount)];\r\n }\r\n\r\n function offsetSegment(segment, amount) {\r\n var p0;\r\n var p1a;\r\n var p1b;\r\n var p2b;\r\n var p2a;\r\n var p3;\r\n var e;\r\n e = linearOffset(segment.points[0], segment.points[1], amount);\r\n p0 = e[0];\r\n p1a = e[1];\r\n e = linearOffset(segment.points[1], segment.points[2], amount);\r\n p1b = e[0];\r\n p2b = e[1];\r\n e = linearOffset(segment.points[2], segment.points[3], amount);\r\n p2a = e[0];\r\n p3 = e[1];\r\n var p1 = lineIntersection(p0, p1a, p1b, p2b);\r\n if (p1 === null) p1 = p1a;\r\n var p2 = lineIntersection(p2a, p3, p1b, p2b);\r\n if (p2 === null) p2 = p2a;\r\n return new PolynomialBezier(p0, p1, p2, p3);\r\n }\r\n\r\n function joinLines(outputBezier, seg1, seg2, lineJoin, miterLimit) {\r\n var p0 = seg1.points[3];\r\n var p1 = seg2.points[0]; // Bevel\r\n\r\n if (lineJoin === 3) return p0; // Connected, they don't need a joint\r\n\r\n if (pointEqual(p0, p1)) return p0; // Round\r\n\r\n if (lineJoin === 2) {\r\n var angleOut = -seg1.tangentAngle(1);\r\n var angleIn = -seg2.tangentAngle(0) + Math.PI;\r\n var center = lineIntersection(p0, polarOffset(p0, angleOut + Math.PI / 2, 100), p1, polarOffset(p1, angleOut + Math.PI / 2, 100));\r\n var radius = center ? pointDistance(center, p0) : pointDistance(p0, p1) / 2;\r\n var tan = polarOffset(p0, angleOut, 2 * radius * roundCorner);\r\n outputBezier.setXYAt(tan[0], tan[1], 'o', outputBezier.length() - 1);\r\n tan = polarOffset(p1, angleIn, 2 * radius * roundCorner);\r\n outputBezier.setTripleAt(p1[0], p1[1], p1[0], p1[1], tan[0], tan[1], outputBezier.length());\r\n return p1;\r\n } // Miter\r\n\r\n\r\n var t0 = pointEqual(p0, seg1.points[2]) ? seg1.points[0] : seg1.points[2];\r\n var t1 = pointEqual(p1, seg2.points[1]) ? seg2.points[3] : seg2.points[1];\r\n var intersection = lineIntersection(t0, p0, p1, t1);\r\n\r\n if (intersection && pointDistance(intersection, p0) < miterLimit) {\r\n outputBezier.setTripleAt(intersection[0], intersection[1], intersection[0], intersection[1], intersection[0], intersection[1], outputBezier.length());\r\n return intersection;\r\n }\r\n\r\n return p0;\r\n }\r\n\r\n function getIntersection(a, b) {\r\n var intersect = a.intersections(b);\r\n if (intersect.length && floatEqual(intersect[0][0], 1)) intersect.shift();\r\n if (intersect.length) return intersect[0];\r\n return null;\r\n }\r\n\r\n function pruneSegmentIntersection(a, b) {\r\n var outa = a.slice();\r\n var outb = b.slice();\r\n var intersect = getIntersection(a[a.length - 1], b[0]);\r\n\r\n if (intersect) {\r\n outa[a.length - 1] = a[a.length - 1].split(intersect[0])[0];\r\n outb[0] = b[0].split(intersect[1])[1];\r\n }\r\n\r\n if (a.length > 1 && b.length > 1) {\r\n intersect = getIntersection(a[0], b[b.length - 1]);\r\n\r\n if (intersect) {\r\n return [[a[0].split(intersect[0])[0]], [b[b.length - 1].split(intersect[1])[1]]];\r\n }\r\n }\r\n\r\n return [outa, outb];\r\n }\r\n\r\n function pruneIntersections(segments) {\r\n var e;\r\n\r\n for (var i = 1; i < segments.length; i += 1) {\r\n e = pruneSegmentIntersection(segments[i - 1], segments[i]);\r\n segments[i - 1] = e[0];\r\n segments[i] = e[1];\r\n }\r\n\r\n if (segments.length > 1) {\r\n e = pruneSegmentIntersection(segments[segments.length - 1], segments[0]);\r\n segments[segments.length - 1] = e[0];\r\n segments[0] = e[1];\r\n }\r\n\r\n return segments;\r\n }\r\n\r\n function offsetSegmentSplit(segment, amount) {\r\n /*\r\n We split each bezier segment into smaller pieces based\r\n on inflection points, this ensures the control point\r\n polygon is convex.\r\n (A cubic bezier can have none, one, or two inflection points)\r\n */\r\n var flex = segment.inflectionPoints();\r\n var left;\r\n var right;\r\n var split;\r\n var mid;\r\n\r\n if (flex.length === 0) {\r\n return [offsetSegment(segment, amount)];\r\n }\r\n\r\n if (flex.length === 1 || floatEqual(flex[1], 1)) {\r\n split = segment.split(flex[0]);\r\n left = split[0];\r\n right = split[1];\r\n return [offsetSegment(left, amount), offsetSegment(right, amount)];\r\n }\r\n\r\n split = segment.split(flex[0]);\r\n left = split[0];\r\n var t = (flex[1] - flex[0]) / (1 - flex[0]);\r\n split = split[1].split(t);\r\n mid = split[0];\r\n right = split[1];\r\n return [offsetSegment(left, amount), offsetSegment(mid, amount), offsetSegment(right, amount)];\r\n }\r\n\r\n function OffsetPathModifier() {}\r\n\r\n extendPrototype([ShapeModifier], OffsetPathModifier);\r\n\r\n OffsetPathModifier.prototype.initModifierProperties = function (elem, data) {\r\n this.getValue = this.processKeys;\r\n this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this);\r\n this.miterLimit = PropertyFactory.getProp(elem, data.ml, 0, null, this);\r\n this.lineJoin = data.lj;\r\n this._isAnimated = this.amount.effectsSequence.length !== 0;\r\n };\r\n\r\n OffsetPathModifier.prototype.processPath = function (inputBezier, amount, lineJoin, miterLimit) {\r\n var outputBezier = shapePool.newElement();\r\n outputBezier.c = inputBezier.c;\r\n var count = inputBezier.length();\r\n\r\n if (!inputBezier.c) {\r\n count -= 1;\r\n }\r\n\r\n var i;\r\n var j;\r\n var segment;\r\n var multiSegments = [];\r\n\r\n for (i = 0; i < count; i += 1) {\r\n segment = PolynomialBezier.shapeSegment(inputBezier, i);\r\n multiSegments.push(offsetSegmentSplit(segment, amount));\r\n }\r\n\r\n if (!inputBezier.c) {\r\n for (i = count - 1; i >= 0; i -= 1) {\r\n segment = PolynomialBezier.shapeSegmentInverted(inputBezier, i);\r\n multiSegments.push(offsetSegmentSplit(segment, amount));\r\n }\r\n }\r\n\r\n multiSegments = pruneIntersections(multiSegments); // Add bezier segments to the output and apply line joints\r\n\r\n var lastPoint = null;\r\n var lastSeg = null;\r\n\r\n for (i = 0; i < multiSegments.length; i += 1) {\r\n var multiSegment = multiSegments[i];\r\n if (lastSeg) lastPoint = joinLines(outputBezier, lastSeg, multiSegment[0], lineJoin, miterLimit);\r\n lastSeg = multiSegment[multiSegment.length - 1];\r\n\r\n for (j = 0; j < multiSegment.length; j += 1) {\r\n segment = multiSegment[j];\r\n\r\n if (lastPoint && pointEqual(segment.points[0], lastPoint)) {\r\n outputBezier.setXYAt(segment.points[1][0], segment.points[1][1], 'o', outputBezier.length() - 1);\r\n } else {\r\n outputBezier.setTripleAt(segment.points[0][0], segment.points[0][1], segment.points[1][0], segment.points[1][1], segment.points[0][0], segment.points[0][1], outputBezier.length());\r\n }\r\n\r\n outputBezier.setTripleAt(segment.points[3][0], segment.points[3][1], segment.points[3][0], segment.points[3][1], segment.points[2][0], segment.points[2][1], outputBezier.length());\r\n lastPoint = segment.points[3];\r\n }\r\n }\r\n\r\n if (multiSegments.length) joinLines(outputBezier, lastSeg, multiSegments[0][0], lineJoin, miterLimit);\r\n return outputBezier;\r\n };\r\n\r\n OffsetPathModifier.prototype.processShapes = function (_isFirstFrame) {\r\n var shapePaths;\r\n var i;\r\n var len = this.shapes.length;\r\n var j;\r\n var jLen;\r\n var amount = this.amount.v;\r\n var miterLimit = this.miterLimit.v;\r\n var lineJoin = this.lineJoin;\r\n\r\n if (amount !== 0) {\r\n var shapeData;\r\n var localShapeCollection;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shapeData = this.shapes[i];\r\n localShapeCollection = shapeData.localShapeCollection;\r\n\r\n if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) {\r\n localShapeCollection.releaseShapes();\r\n shapeData.shape._mdf = true;\r\n shapePaths = shapeData.shape.paths.shapes;\r\n jLen = shapeData.shape.paths._length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n localShapeCollection.addShape(this.processPath(shapePaths[j], amount, lineJoin, miterLimit));\r\n }\r\n }\r\n\r\n shapeData.shape.paths = shapeData.localShapeCollection;\r\n }\r\n }\r\n\r\n if (!this.dynamicProperties.length) {\r\n this._mdf = false;\r\n }\r\n };\r\n\r\n function getFontProperties(fontData) {\r\n var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];\r\n var fWeight = 'normal';\r\n var fStyle = 'normal';\r\n var len = styles.length;\r\n var styleName;\r\n\r\n for (var i = 0; i < len; i += 1) {\r\n styleName = styles[i].toLowerCase();\r\n\r\n switch (styleName) {\r\n case 'italic':\r\n fStyle = 'italic';\r\n break;\r\n\r\n case 'bold':\r\n fWeight = '700';\r\n break;\r\n\r\n case 'black':\r\n fWeight = '900';\r\n break;\r\n\r\n case 'medium':\r\n fWeight = '500';\r\n break;\r\n\r\n case 'regular':\r\n case 'normal':\r\n fWeight = '400';\r\n break;\r\n\r\n case 'light':\r\n case 'thin':\r\n fWeight = '200';\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n }\r\n\r\n return {\r\n style: fStyle,\r\n weight: fontData.fWeight || fWeight\r\n };\r\n }\r\n\r\n var FontManager = function () {\r\n var maxWaitingTime = 5000;\r\n var emptyChar = {\r\n w: 0,\r\n size: 0,\r\n shapes: [],\r\n data: {\r\n shapes: []\r\n }\r\n };\r\n var combinedCharacters = []; // Hindi characters\r\n\r\n combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366, 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);\r\n var surrogateModifiers = ['d83cdffb', 'd83cdffc', 'd83cdffd', 'd83cdffe', 'd83cdfff'];\r\n var zeroWidthJoiner = [65039, 8205];\r\n\r\n function trimFontOptions(font) {\r\n var familyArray = font.split(',');\r\n var i;\r\n var len = familyArray.length;\r\n var enabledFamilies = [];\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') {\r\n enabledFamilies.push(familyArray[i]);\r\n }\r\n }\r\n\r\n return enabledFamilies.join(',');\r\n }\r\n\r\n function setUpNode(font, family) {\r\n var parentNode = createTag('span'); // Node is invisible to screen readers.\r\n\r\n parentNode.setAttribute('aria-hidden', true);\r\n parentNode.style.fontFamily = family;\r\n var node = createTag('span'); // Characters that vary significantly among different fonts\r\n\r\n node.innerText = 'giItT1WQy@!-/#'; // Visible - so we can measure it - but not on the screen\r\n\r\n parentNode.style.position = 'absolute';\r\n parentNode.style.left = '-10000px';\r\n parentNode.style.top = '-10000px'; // Large font size makes even subtle changes obvious\r\n\r\n parentNode.style.fontSize = '300px'; // Reset any font properties\r\n\r\n parentNode.style.fontVariant = 'normal';\r\n parentNode.style.fontStyle = 'normal';\r\n parentNode.style.fontWeight = 'normal';\r\n parentNode.style.letterSpacing = '0';\r\n parentNode.appendChild(node);\r\n document.body.appendChild(parentNode); // Remember width with no applied web font\r\n\r\n var width = node.offsetWidth;\r\n node.style.fontFamily = trimFontOptions(font) + ', ' + family;\r\n return {\r\n node: node,\r\n w: width,\r\n parent: parentNode\r\n };\r\n }\r\n\r\n function checkLoadedFonts() {\r\n var i;\r\n var len = this.fonts.length;\r\n var node;\r\n var w;\r\n var loadedCount = len;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.fonts[i].loaded) {\r\n loadedCount -= 1;\r\n } else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) {\r\n this.fonts[i].loaded = true;\r\n } else {\r\n node = this.fonts[i].monoCase.node;\r\n w = this.fonts[i].monoCase.w;\r\n\r\n if (node.offsetWidth !== w) {\r\n loadedCount -= 1;\r\n this.fonts[i].loaded = true;\r\n } else {\r\n node = this.fonts[i].sansCase.node;\r\n w = this.fonts[i].sansCase.w;\r\n\r\n if (node.offsetWidth !== w) {\r\n loadedCount -= 1;\r\n this.fonts[i].loaded = true;\r\n }\r\n }\r\n\r\n if (this.fonts[i].loaded) {\r\n this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);\r\n this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);\r\n }\r\n }\r\n }\r\n\r\n if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) {\r\n setTimeout(this.checkLoadedFontsBinded, 20);\r\n } else {\r\n setTimeout(this.setIsLoadedBinded, 10);\r\n }\r\n }\r\n\r\n function createHelper(fontData, def) {\r\n var engine = document.body && def ? 'svg' : 'canvas';\r\n var helper;\r\n var fontProps = getFontProperties(fontData);\r\n\r\n if (engine === 'svg') {\r\n var tHelper = createNS('text');\r\n tHelper.style.fontSize = '100px'; // tHelper.style.fontFamily = fontData.fFamily;\r\n\r\n tHelper.setAttribute('font-family', fontData.fFamily);\r\n tHelper.setAttribute('font-style', fontProps.style);\r\n tHelper.setAttribute('font-weight', fontProps.weight);\r\n tHelper.textContent = '1';\r\n\r\n if (fontData.fClass) {\r\n tHelper.style.fontFamily = 'inherit';\r\n tHelper.setAttribute('class', fontData.fClass);\r\n } else {\r\n tHelper.style.fontFamily = fontData.fFamily;\r\n }\r\n\r\n def.appendChild(tHelper);\r\n helper = tHelper;\r\n } else {\r\n var tCanvasHelper = new OffscreenCanvas(500, 500).getContext('2d');\r\n tCanvasHelper.font = fontProps.style + ' ' + fontProps.weight + ' 100px ' + fontData.fFamily;\r\n helper = tCanvasHelper;\r\n }\r\n\r\n function measure(text) {\r\n if (engine === 'svg') {\r\n helper.textContent = text;\r\n return helper.getComputedTextLength();\r\n }\r\n\r\n return helper.measureText(text).width;\r\n }\r\n\r\n return {\r\n measureText: measure\r\n };\r\n }\r\n\r\n function addFonts(fontData, defs) {\r\n if (!fontData) {\r\n this.isLoaded = true;\r\n return;\r\n }\r\n\r\n if (this.chars) {\r\n this.isLoaded = true;\r\n this.fonts = fontData.list;\r\n return;\r\n }\r\n\r\n if (!document.body) {\r\n this.isLoaded = true;\r\n fontData.list.forEach(function (data) {\r\n data.helper = createHelper(data);\r\n data.cache = {};\r\n });\r\n this.fonts = fontData.list;\r\n return;\r\n }\r\n\r\n var fontArr = fontData.list;\r\n var i;\r\n var len = fontArr.length;\r\n var _pendingFonts = len;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n var shouldLoadFont = true;\r\n var loadedSelector;\r\n var j;\r\n fontArr[i].loaded = false;\r\n fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace');\r\n fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif');\r\n\r\n if (!fontArr[i].fPath) {\r\n fontArr[i].loaded = true;\r\n _pendingFonts -= 1;\r\n } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) {\r\n loadedSelector = document.querySelectorAll('style[f-forigin=\"p\"][f-family=\"' + fontArr[i].fFamily + '\"], style[f-origin=\"3\"][f-family=\"' + fontArr[i].fFamily + '\"]');\r\n\r\n if (loadedSelector.length > 0) {\r\n shouldLoadFont = false;\r\n }\r\n\r\n if (shouldLoadFont) {\r\n var s = createTag('style');\r\n s.setAttribute('f-forigin', fontArr[i].fOrigin);\r\n s.setAttribute('f-origin', fontArr[i].origin);\r\n s.setAttribute('f-family', fontArr[i].fFamily);\r\n s.type = 'text/css';\r\n s.innerText = '@font-face {font-family: ' + fontArr[i].fFamily + \"; font-style: normal; src: url('\" + fontArr[i].fPath + \"');}\";\r\n defs.appendChild(s);\r\n }\r\n } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) {\r\n loadedSelector = document.querySelectorAll('link[f-forigin=\"g\"], link[f-origin=\"1\"]');\r\n\r\n for (j = 0; j < loadedSelector.length; j += 1) {\r\n if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {\r\n // Font is already loaded\r\n shouldLoadFont = false;\r\n }\r\n }\r\n\r\n if (shouldLoadFont) {\r\n var l = createTag('link');\r\n l.setAttribute('f-forigin', fontArr[i].fOrigin);\r\n l.setAttribute('f-origin', fontArr[i].origin);\r\n l.type = 'text/css';\r\n l.rel = 'stylesheet';\r\n l.href = fontArr[i].fPath;\r\n document.body.appendChild(l);\r\n }\r\n } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) {\r\n loadedSelector = document.querySelectorAll('script[f-forigin=\"t\"], script[f-origin=\"2\"]');\r\n\r\n for (j = 0; j < loadedSelector.length; j += 1) {\r\n if (fontArr[i].fPath === loadedSelector[j].src) {\r\n // Font is already loaded\r\n shouldLoadFont = false;\r\n }\r\n }\r\n\r\n if (shouldLoadFont) {\r\n var sc = createTag('link');\r\n sc.setAttribute('f-forigin', fontArr[i].fOrigin);\r\n sc.setAttribute('f-origin', fontArr[i].origin);\r\n sc.setAttribute('rel', 'stylesheet');\r\n sc.setAttribute('href', fontArr[i].fPath);\r\n defs.appendChild(sc);\r\n }\r\n }\r\n\r\n fontArr[i].helper = createHelper(fontArr[i], defs);\r\n fontArr[i].cache = {};\r\n this.fonts.push(fontArr[i]);\r\n }\r\n\r\n if (_pendingFonts === 0) {\r\n this.isLoaded = true;\r\n } else {\r\n // On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.\r\n // Adding this timeout seems to fix it\r\n setTimeout(this.checkLoadedFonts.bind(this), 100);\r\n }\r\n }\r\n\r\n function addChars(chars) {\r\n if (!chars) {\r\n return;\r\n }\r\n\r\n if (!this.chars) {\r\n this.chars = [];\r\n }\r\n\r\n var i;\r\n var len = chars.length;\r\n var j;\r\n var jLen = this.chars.length;\r\n var found;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n j = 0;\r\n found = false;\r\n\r\n while (j < jLen) {\r\n if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) {\r\n found = true;\r\n }\r\n\r\n j += 1;\r\n }\r\n\r\n if (!found) {\r\n this.chars.push(chars[i]);\r\n jLen += 1;\r\n }\r\n }\r\n }\r\n\r\n function getCharData(_char, style, font) {\r\n var i = 0;\r\n var len = this.chars.length;\r\n\r\n while (i < len) {\r\n if (this.chars[i].ch === _char && this.chars[i].style === style && this.chars[i].fFamily === font) {\r\n return this.chars[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if ((typeof _char === 'string' && _char.charCodeAt(0) !== 13 || !_char) && console && console.warn // eslint-disable-line no-console\r\n && !this._warned) {\r\n this._warned = true;\r\n console.warn('Missing character from exported characters list: ', _char, style, font); // eslint-disable-line no-console\r\n }\r\n\r\n return emptyChar;\r\n }\r\n\r\n function measureText(_char2, fontName, size) {\r\n var fontData = this.getFontByName(fontName);\r\n\r\n var index = _char2.charCodeAt(0);\r\n\r\n if (!fontData.cache[index + 1]) {\r\n var tHelper = fontData.helper;\r\n\r\n if (_char2 === ' ') {\r\n var doubleSize = tHelper.measureText('|' + _char2 + '|');\r\n var singleSize = tHelper.measureText('||');\r\n fontData.cache[index + 1] = (doubleSize - singleSize) / 100;\r\n } else {\r\n fontData.cache[index + 1] = tHelper.measureText(_char2) / 100;\r\n }\r\n }\r\n\r\n return fontData.cache[index + 1] * size;\r\n }\r\n\r\n function getFontByName(name) {\r\n var i = 0;\r\n var len = this.fonts.length;\r\n\r\n while (i < len) {\r\n if (this.fonts[i].fName === name) {\r\n return this.fonts[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return this.fonts[0];\r\n }\r\n\r\n function isModifier(firstCharCode, secondCharCode) {\r\n var sum = firstCharCode.toString(16) + secondCharCode.toString(16);\r\n return surrogateModifiers.indexOf(sum) !== -1;\r\n }\r\n\r\n function isZeroWidthJoiner(firstCharCode, secondCharCode) {\r\n if (!secondCharCode) {\r\n return firstCharCode === zeroWidthJoiner[1];\r\n }\r\n\r\n return firstCharCode === zeroWidthJoiner[0] && secondCharCode === zeroWidthJoiner[1];\r\n }\r\n\r\n function isCombinedCharacter(_char3) {\r\n return combinedCharacters.indexOf(_char3) !== -1;\r\n }\r\n\r\n function setIsLoaded() {\r\n this.isLoaded = true;\r\n }\r\n\r\n var Font = function Font() {\r\n this.fonts = [];\r\n this.chars = null;\r\n this.typekitLoaded = 0;\r\n this.isLoaded = false;\r\n this._warned = false;\r\n this.initTime = Date.now();\r\n this.setIsLoadedBinded = this.setIsLoaded.bind(this);\r\n this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this);\r\n };\r\n\r\n Font.isModifier = isModifier;\r\n Font.isZeroWidthJoiner = isZeroWidthJoiner;\r\n Font.isCombinedCharacter = isCombinedCharacter;\r\n var fontPrototype = {\r\n addChars: addChars,\r\n addFonts: addFonts,\r\n getCharData: getCharData,\r\n getFontByName: getFontByName,\r\n measureText: measureText,\r\n checkLoadedFonts: checkLoadedFonts,\r\n setIsLoaded: setIsLoaded\r\n };\r\n Font.prototype = fontPrototype;\r\n return Font;\r\n }();\r\n\r\n function RenderableElement() {}\r\n\r\n RenderableElement.prototype = {\r\n initRenderable: function initRenderable() {\r\n // layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange\r\n this.isInRange = false; // layer's display state\r\n\r\n this.hidden = false; // If layer's transparency equals 0, it can be hidden\r\n\r\n this.isTransparent = false; // list of animated components\r\n\r\n this.renderableComponents = [];\r\n },\r\n addRenderableComponent: function addRenderableComponent(component) {\r\n if (this.renderableComponents.indexOf(component) === -1) {\r\n this.renderableComponents.push(component);\r\n }\r\n },\r\n removeRenderableComponent: function removeRenderableComponent(component) {\r\n if (this.renderableComponents.indexOf(component) !== -1) {\r\n this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);\r\n }\r\n },\r\n prepareRenderableFrame: function prepareRenderableFrame(num) {\r\n this.checkLayerLimits(num);\r\n },\r\n checkTransparency: function checkTransparency() {\r\n if (this.finalTransform.mProp.o.v <= 0) {\r\n if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) {\r\n this.isTransparent = true;\r\n this.hide();\r\n }\r\n } else if (this.isTransparent) {\r\n this.isTransparent = false;\r\n this.show();\r\n }\r\n },\r\n\r\n /**\r\n * @function\r\n * Initializes frame related properties.\r\n *\r\n * @param {number} num\r\n * current frame number in Layer's time\r\n *\r\n */\r\n checkLayerLimits: function checkLayerLimits(num) {\r\n if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) {\r\n if (this.isInRange !== true) {\r\n this.globalData._mdf = true;\r\n this._mdf = true;\r\n this.isInRange = true;\r\n this.show();\r\n }\r\n } else if (this.isInRange !== false) {\r\n this.globalData._mdf = true;\r\n this.isInRange = false;\r\n this.hide();\r\n }\r\n },\r\n renderRenderable: function renderRenderable() {\r\n var i;\r\n var len = this.renderableComponents.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.renderableComponents[i].renderFrame(this._isFirstFrame);\r\n }\r\n /* this.maskManager.renderFrame(this.finalTransform.mat);\r\n this.renderableEffectsManager.renderFrame(this._isFirstFrame); */\r\n\r\n },\r\n sourceRectAtTime: function sourceRectAtTime() {\r\n return {\r\n top: 0,\r\n left: 0,\r\n width: 100,\r\n height: 100\r\n };\r\n },\r\n getLayerSize: function getLayerSize() {\r\n if (this.data.ty === 5) {\r\n return {\r\n w: this.data.textData.width,\r\n h: this.data.textData.height\r\n };\r\n }\r\n\r\n return {\r\n w: this.data.width,\r\n h: this.data.height\r\n };\r\n }\r\n };\r\n\r\n var getBlendMode = function () {\r\n var blendModeEnums = {\r\n 0: 'source-over',\r\n 1: 'multiply',\r\n 2: 'screen',\r\n 3: 'overlay',\r\n 4: 'darken',\r\n 5: 'lighten',\r\n 6: 'color-dodge',\r\n 7: 'color-burn',\r\n 8: 'hard-light',\r\n 9: 'soft-light',\r\n 10: 'difference',\r\n 11: 'exclusion',\r\n 12: 'hue',\r\n 13: 'saturation',\r\n 14: 'color',\r\n 15: 'luminosity'\r\n };\r\n return function (mode) {\r\n return blendModeEnums[mode] || '';\r\n };\r\n }();\r\n\r\n function SliderEffect(data, elem, container) {\r\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n }\r\n\r\n function AngleEffect(data, elem, container) {\r\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n }\r\n\r\n function ColorEffect(data, elem, container) {\r\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\r\n }\r\n\r\n function PointEffect(data, elem, container) {\r\n this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container);\r\n }\r\n\r\n function LayerIndexEffect(data, elem, container) {\r\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n }\r\n\r\n function MaskIndexEffect(data, elem, container) {\r\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n }\r\n\r\n function CheckboxEffect(data, elem, container) {\r\n this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container);\r\n }\r\n\r\n function NoValueEffect() {\r\n this.p = {};\r\n }\r\n\r\n function EffectsManager(data, element) {\r\n var effects = data.ef || [];\r\n this.effectElements = [];\r\n var i;\r\n var len = effects.length;\r\n var effectItem;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n effectItem = new GroupEffect(effects[i], element);\r\n this.effectElements.push(effectItem);\r\n }\r\n }\r\n\r\n function GroupEffect(data, element) {\r\n this.init(data, element);\r\n }\r\n\r\n extendPrototype([DynamicPropertyContainer], GroupEffect);\r\n GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;\r\n\r\n GroupEffect.prototype.init = function (data, element) {\r\n this.data = data;\r\n this.effectElements = [];\r\n this.initDynamicPropertyContainer(element);\r\n var i;\r\n var len = this.data.ef.length;\r\n var eff;\r\n var effects = this.data.ef;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n eff = null;\r\n\r\n switch (effects[i].ty) {\r\n case 0:\r\n eff = new SliderEffect(effects[i], element, this);\r\n break;\r\n\r\n case 1:\r\n eff = new AngleEffect(effects[i], element, this);\r\n break;\r\n\r\n case 2:\r\n eff = new ColorEffect(effects[i], element, this);\r\n break;\r\n\r\n case 3:\r\n eff = new PointEffect(effects[i], element, this);\r\n break;\r\n\r\n case 4:\r\n case 7:\r\n eff = new CheckboxEffect(effects[i], element, this);\r\n break;\r\n\r\n case 10:\r\n eff = new LayerIndexEffect(effects[i], element, this);\r\n break;\r\n\r\n case 11:\r\n eff = new MaskIndexEffect(effects[i], element, this);\r\n break;\r\n\r\n case 5:\r\n eff = new EffectsManager(effects[i], element, this);\r\n break;\r\n // case 6:\r\n\r\n default:\r\n eff = new NoValueEffect(effects[i], element, this);\r\n break;\r\n }\r\n\r\n if (eff) {\r\n this.effectElements.push(eff);\r\n }\r\n }\r\n };\r\n\r\n function BaseElement() {}\r\n\r\n BaseElement.prototype = {\r\n checkMasks: function checkMasks() {\r\n if (!this.data.hasMask) {\r\n return false;\r\n }\r\n\r\n var i = 0;\r\n var len = this.data.masksProperties.length;\r\n\r\n while (i < len) {\r\n if (this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false) {\r\n return true;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return false;\r\n },\r\n initExpressions: function initExpressions() {\r\n var expressionsInterfaces = getExpressionInterfaces();\r\n\r\n if (!expressionsInterfaces) {\r\n return;\r\n }\r\n\r\n var LayerExpressionInterface = expressionsInterfaces('layer');\r\n var EffectsExpressionInterface = expressionsInterfaces('effects');\r\n var ShapeExpressionInterface = expressionsInterfaces('shape');\r\n var TextExpressionInterface = expressionsInterfaces('text');\r\n var CompExpressionInterface = expressionsInterfaces('comp');\r\n this.layerInterface = LayerExpressionInterface(this);\r\n\r\n if (this.data.hasMask && this.maskManager) {\r\n this.layerInterface.registerMaskInterface(this.maskManager);\r\n }\r\n\r\n var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface);\r\n this.layerInterface.registerEffectsInterface(effectsInterface);\r\n\r\n if (this.data.ty === 0 || this.data.xt) {\r\n this.compInterface = CompExpressionInterface(this);\r\n } else if (this.data.ty === 4) {\r\n this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface);\r\n this.layerInterface.content = this.layerInterface.shapeInterface;\r\n } else if (this.data.ty === 5) {\r\n this.layerInterface.textInterface = TextExpressionInterface(this);\r\n this.layerInterface.text = this.layerInterface.textInterface;\r\n }\r\n },\r\n setBlendMode: function setBlendMode() {\r\n var blendModeValue = getBlendMode(this.data.bm);\r\n var elem = this.baseElement || this.layerElement;\r\n elem.style['mix-blend-mode'] = blendModeValue;\r\n },\r\n initBaseData: function initBaseData(data, globalData, comp) {\r\n this.globalData = globalData;\r\n this.comp = comp;\r\n this.data = data;\r\n this.layerId = createElementID(); // Stretch factor for old animations missing this property.\r\n\r\n if (!this.data.sr) {\r\n this.data.sr = 1;\r\n } // effects manager\r\n\r\n\r\n this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties);\r\n },\r\n getType: function getType() {\r\n return this.type;\r\n },\r\n sourceRectAtTime: function sourceRectAtTime() {}\r\n };\r\n\r\n /**\r\n * @file\r\n * Handles element's layer frame update.\r\n * Checks layer in point and out point\r\n *\r\n */\r\n function FrameElement() {}\r\n\r\n FrameElement.prototype = {\r\n /**\r\n * @function\r\n * Initializes frame related properties.\r\n *\r\n */\r\n initFrame: function initFrame() {\r\n // set to true when inpoint is rendered\r\n this._isFirstFrame = false; // list of animated properties\r\n\r\n this.dynamicProperties = []; // If layer has been modified in current tick this will be true\r\n\r\n this._mdf = false;\r\n },\r\n\r\n /**\r\n * @function\r\n * Calculates all dynamic values\r\n *\r\n * @param {number} num\r\n * current frame number in Layer's time\r\n * @param {boolean} isVisible\r\n * if layers is currently in range\r\n *\r\n */\r\n prepareProperties: function prepareProperties(num, isVisible) {\r\n var i;\r\n var len = this.dynamicProperties.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (isVisible || this._isParent && this.dynamicProperties[i].propType === 'transform') {\r\n this.dynamicProperties[i].getValue();\r\n\r\n if (this.dynamicProperties[i]._mdf) {\r\n this.globalData._mdf = true;\r\n this._mdf = true;\r\n }\r\n }\r\n }\r\n },\r\n addDynamicProperty: function addDynamicProperty(prop) {\r\n if (this.dynamicProperties.indexOf(prop) === -1) {\r\n this.dynamicProperties.push(prop);\r\n }\r\n }\r\n };\r\n\r\n function FootageElement(data, globalData, comp) {\r\n this.initFrame();\r\n this.initRenderable();\r\n this.assetData = globalData.getAssetData(data.refId);\r\n this.footageData = globalData.imageLoader.getAsset(this.assetData);\r\n this.initBaseData(data, globalData, comp);\r\n }\r\n\r\n FootageElement.prototype.prepareFrame = function () {};\r\n\r\n extendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement);\r\n\r\n FootageElement.prototype.getBaseElement = function () {\r\n return null;\r\n };\r\n\r\n FootageElement.prototype.renderFrame = function () {};\r\n\r\n FootageElement.prototype.destroy = function () {};\r\n\r\n FootageElement.prototype.initExpressions = function () {\r\n var expressionsInterfaces = getExpressionInterfaces();\r\n\r\n if (!expressionsInterfaces) {\r\n return;\r\n }\r\n\r\n var FootageInterface = expressionsInterfaces('footage');\r\n this.layerInterface = FootageInterface(this);\r\n };\r\n\r\n FootageElement.prototype.getFootageData = function () {\r\n return this.footageData;\r\n };\r\n\r\n function AudioElement(data, globalData, comp) {\r\n this.initFrame();\r\n this.initRenderable();\r\n this.assetData = globalData.getAssetData(data.refId);\r\n this.initBaseData(data, globalData, comp);\r\n this._isPlaying = false;\r\n this._canPlay = false;\r\n var assetPath = this.globalData.getAssetsPath(this.assetData);\r\n this.audio = this.globalData.audioController.createAudio(assetPath);\r\n this._currentTime = 0;\r\n this.globalData.audioController.addAudio(this);\r\n this._volumeMultiplier = 1;\r\n this._volume = 1;\r\n this._previousVolume = null;\r\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\r\n _placeholder: true\r\n };\r\n this.lv = PropertyFactory.getProp(this, data.au && data.au.lv ? data.au.lv : {\r\n k: [100]\r\n }, 1, 0.01, this);\r\n }\r\n\r\n AudioElement.prototype.prepareFrame = function (num) {\r\n this.prepareRenderableFrame(num, true);\r\n this.prepareProperties(num, true);\r\n\r\n if (!this.tm._placeholder) {\r\n var timeRemapped = this.tm.v;\r\n this._currentTime = timeRemapped;\r\n } else {\r\n this._currentTime = num / this.data.sr;\r\n }\r\n\r\n this._volume = this.lv.v[0];\r\n var totalVolume = this._volume * this._volumeMultiplier;\r\n\r\n if (this._previousVolume !== totalVolume) {\r\n this._previousVolume = totalVolume;\r\n this.audio.volume(totalVolume);\r\n }\r\n };\r\n\r\n extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement);\r\n\r\n AudioElement.prototype.renderFrame = function () {\r\n if (this.isInRange && this._canPlay) {\r\n if (!this._isPlaying) {\r\n this.audio.play();\r\n this.audio.seek(this._currentTime / this.globalData.frameRate);\r\n this._isPlaying = true;\r\n } else if (!this.audio.playing() || Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1) {\r\n this.audio.seek(this._currentTime / this.globalData.frameRate);\r\n }\r\n }\r\n };\r\n\r\n AudioElement.prototype.show = function () {// this.audio.play()\r\n };\r\n\r\n AudioElement.prototype.hide = function () {\r\n this.audio.pause();\r\n this._isPlaying = false;\r\n };\r\n\r\n AudioElement.prototype.pause = function () {\r\n this.audio.pause();\r\n this._isPlaying = false;\r\n this._canPlay = false;\r\n };\r\n\r\n AudioElement.prototype.resume = function () {\r\n this._canPlay = true;\r\n };\r\n\r\n AudioElement.prototype.setRate = function (rateValue) {\r\n this.audio.rate(rateValue);\r\n };\r\n\r\n AudioElement.prototype.volume = function (volumeValue) {\r\n this._volumeMultiplier = volumeValue;\r\n this._previousVolume = volumeValue * this._volume;\r\n this.audio.volume(this._previousVolume);\r\n };\r\n\r\n AudioElement.prototype.getBaseElement = function () {\r\n return null;\r\n };\r\n\r\n AudioElement.prototype.destroy = function () {};\r\n\r\n AudioElement.prototype.sourceRectAtTime = function () {};\r\n\r\n AudioElement.prototype.initExpressions = function () {};\r\n\r\n function BaseRenderer() {}\r\n\r\n BaseRenderer.prototype.checkLayers = function (num) {\r\n var i;\r\n var len = this.layers.length;\r\n var data;\r\n this.completeLayers = true;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (!this.elements[i]) {\r\n data = this.layers[i];\r\n\r\n if (data.ip - data.st <= num - this.layers[i].st && data.op - data.st > num - this.layers[i].st) {\r\n this.buildItem(i);\r\n }\r\n }\r\n\r\n this.completeLayers = this.elements[i] ? this.completeLayers : false;\r\n }\r\n\r\n this.checkPendingElements();\r\n };\r\n\r\n BaseRenderer.prototype.createItem = function (layer) {\r\n switch (layer.ty) {\r\n case 2:\r\n return this.createImage(layer);\r\n\r\n case 0:\r\n return this.createComp(layer);\r\n\r\n case 1:\r\n return this.createSolid(layer);\r\n\r\n case 3:\r\n return this.createNull(layer);\r\n\r\n case 4:\r\n return this.createShape(layer);\r\n\r\n case 5:\r\n return this.createText(layer);\r\n\r\n case 6:\r\n return this.createAudio(layer);\r\n\r\n case 13:\r\n return this.createCamera(layer);\r\n\r\n case 15:\r\n return this.createFootage(layer);\r\n\r\n default:\r\n return this.createNull(layer);\r\n }\r\n };\r\n\r\n BaseRenderer.prototype.createCamera = function () {\r\n throw new Error('You\\'re using a 3d camera. Try the html renderer.');\r\n };\r\n\r\n BaseRenderer.prototype.createAudio = function (data) {\r\n return new AudioElement(data, this.globalData, this);\r\n };\r\n\r\n BaseRenderer.prototype.createFootage = function (data) {\r\n return new FootageElement(data, this.globalData, this);\r\n };\r\n\r\n BaseRenderer.prototype.buildAllItems = function () {\r\n var i;\r\n var len = this.layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.buildItem(i);\r\n }\r\n\r\n this.checkPendingElements();\r\n };\r\n\r\n BaseRenderer.prototype.includeLayers = function (newLayers) {\r\n this.completeLayers = false;\r\n var i;\r\n var len = newLayers.length;\r\n var j;\r\n var jLen = this.layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n j = 0;\r\n\r\n while (j < jLen) {\r\n if (this.layers[j].id === newLayers[i].id) {\r\n this.layers[j] = newLayers[i];\r\n break;\r\n }\r\n\r\n j += 1;\r\n }\r\n }\r\n };\r\n\r\n BaseRenderer.prototype.setProjectInterface = function (pInterface) {\r\n this.globalData.projectInterface = pInterface;\r\n };\r\n\r\n BaseRenderer.prototype.initItems = function () {\r\n if (!this.globalData.progressiveLoad) {\r\n this.buildAllItems();\r\n }\r\n };\r\n\r\n BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) {\r\n var elements = this.elements;\r\n var layers = this.layers;\r\n var i = 0;\r\n var len = layers.length;\r\n\r\n while (i < len) {\r\n if (layers[i].ind == parentName) {\r\n // eslint-disable-line eqeqeq\r\n if (!elements[i] || elements[i] === true) {\r\n this.buildItem(i);\r\n this.addPendingElement(element);\r\n } else {\r\n hierarchy.push(elements[i]);\r\n elements[i].setAsParent();\r\n\r\n if (layers[i].parent !== undefined) {\r\n this.buildElementParenting(element, layers[i].parent, hierarchy);\r\n } else {\r\n element.setHierarchy(hierarchy);\r\n }\r\n }\r\n }\r\n\r\n i += 1;\r\n }\r\n };\r\n\r\n BaseRenderer.prototype.addPendingElement = function (element) {\r\n this.pendingElements.push(element);\r\n };\r\n\r\n BaseRenderer.prototype.searchExtraCompositions = function (assets) {\r\n var i;\r\n var len = assets.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (assets[i].xt) {\r\n var comp = this.createComp(assets[i]);\r\n comp.initExpressions();\r\n this.globalData.projectInterface.registerComposition(comp);\r\n }\r\n }\r\n };\r\n\r\n BaseRenderer.prototype.getElementByPath = function (path) {\r\n var pathValue = path.shift();\r\n var element;\r\n\r\n if (typeof pathValue === 'number') {\r\n element = this.elements[pathValue];\r\n } else {\r\n var i;\r\n var len = this.elements.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.elements[i].data.nm === pathValue) {\r\n element = this.elements[i];\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (path.length === 0) {\r\n return element;\r\n }\r\n\r\n return element.getElementByPath(path);\r\n };\r\n\r\n BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) {\r\n this.globalData.fontManager = new FontManager();\r\n this.globalData.fontManager.addChars(animData.chars);\r\n this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);\r\n this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);\r\n this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);\r\n this.globalData.imageLoader = this.animationItem.imagePreloader;\r\n this.globalData.audioController = this.animationItem.audioController;\r\n this.globalData.frameId = 0;\r\n this.globalData.frameRate = animData.fr;\r\n this.globalData.nm = animData.nm;\r\n this.globalData.compSize = {\r\n w: animData.w,\r\n h: animData.h\r\n };\r\n };\r\n\r\n function TransformElement() {}\r\n\r\n TransformElement.prototype = {\r\n initTransform: function initTransform() {\r\n this.finalTransform = {\r\n mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : {\r\n o: 0\r\n },\r\n _matMdf: false,\r\n _opMdf: false,\r\n mat: new Matrix()\r\n };\r\n\r\n if (this.data.ao) {\r\n this.finalTransform.mProp.autoOriented = true;\r\n } // TODO: check TYPE 11: Guided elements\r\n\r\n\r\n if (this.data.ty !== 11) {// this.createElements();\r\n }\r\n },\r\n renderTransform: function renderTransform() {\r\n this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;\r\n this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;\r\n\r\n if (this.hierarchy) {\r\n var mat;\r\n var finalMat = this.finalTransform.mat;\r\n var i = 0;\r\n var len = this.hierarchy.length; // Checking if any of the transformation matrices in the hierarchy chain has changed.\r\n\r\n if (!this.finalTransform._matMdf) {\r\n while (i < len) {\r\n if (this.hierarchy[i].finalTransform.mProp._mdf) {\r\n this.finalTransform._matMdf = true;\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n }\r\n\r\n if (this.finalTransform._matMdf) {\r\n mat = this.finalTransform.mProp.v.props;\r\n finalMat.cloneFromProps(mat);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n mat = this.hierarchy[i].finalTransform.mProp.v.props;\r\n finalMat.transform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]);\r\n }\r\n }\r\n }\r\n },\r\n globalToLocal: function globalToLocal(pt) {\r\n var transforms = [];\r\n transforms.push(this.finalTransform);\r\n var flag = true;\r\n var comp = this.comp;\r\n\r\n while (flag) {\r\n if (comp.finalTransform) {\r\n if (comp.data.hasMask) {\r\n transforms.splice(0, 0, comp.finalTransform);\r\n }\r\n\r\n comp = comp.comp;\r\n } else {\r\n flag = false;\r\n }\r\n }\r\n\r\n var i;\r\n var len = transforms.length;\r\n var ptNew;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ptNew = transforms[i].mat.applyToPointArray(0, 0, 0); // ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);\r\n\r\n pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];\r\n }\r\n\r\n return pt;\r\n },\r\n mHelper: new Matrix()\r\n };\r\n\r\n function MaskElement(data, element, globalData) {\r\n this.data = data;\r\n this.element = element;\r\n this.globalData = globalData;\r\n this.storedData = [];\r\n this.masksProperties = this.data.masksProperties || [];\r\n this.maskElement = null;\r\n var defs = this.globalData.defs;\r\n var i;\r\n var len = this.masksProperties ? this.masksProperties.length : 0;\r\n this.viewData = createSizedArray(len);\r\n this.solidPath = '';\r\n var path;\r\n var properties = this.masksProperties;\r\n var count = 0;\r\n var currentMasks = [];\r\n var j;\r\n var jLen;\r\n var layerId = createElementID();\r\n var rect;\r\n var expansor;\r\n var feMorph;\r\n var x;\r\n var maskType = 'clipPath';\r\n var maskRef = 'clip-path';\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (properties[i].mode !== 'a' && properties[i].mode !== 'n' || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) {\r\n maskType = 'mask';\r\n maskRef = 'mask';\r\n }\r\n\r\n if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) {\r\n rect = createNS('rect');\r\n rect.setAttribute('fill', '#ffffff');\r\n rect.setAttribute('width', this.element.comp.data.w || 0);\r\n rect.setAttribute('height', this.element.comp.data.h || 0);\r\n currentMasks.push(rect);\r\n } else {\r\n rect = null;\r\n }\r\n\r\n path = createNS('path');\r\n\r\n if (properties[i].mode === 'n') {\r\n // TODO move this to a factory or to a constructor\r\n this.viewData[i] = {\r\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\r\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\r\n elem: path,\r\n lastPath: ''\r\n };\r\n defs.appendChild(path);\r\n } else {\r\n count += 1;\r\n path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff');\r\n path.setAttribute('clip-rule', 'nonzero');\r\n var filterID;\r\n\r\n if (properties[i].x.k !== 0) {\r\n maskType = 'mask';\r\n maskRef = 'mask';\r\n x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element);\r\n filterID = createElementID();\r\n expansor = createNS('filter');\r\n expansor.setAttribute('id', filterID);\r\n feMorph = createNS('feMorphology');\r\n feMorph.setAttribute('operator', 'erode');\r\n feMorph.setAttribute('in', 'SourceGraphic');\r\n feMorph.setAttribute('radius', '0');\r\n expansor.appendChild(feMorph);\r\n defs.appendChild(expansor);\r\n path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff');\r\n } else {\r\n feMorph = null;\r\n x = null;\r\n } // TODO move this to a factory or to a constructor\r\n\r\n\r\n this.storedData[i] = {\r\n elem: path,\r\n x: x,\r\n expan: feMorph,\r\n lastPath: '',\r\n lastOperator: '',\r\n filterId: filterID,\r\n lastRadius: 0\r\n };\r\n\r\n if (properties[i].mode === 'i') {\r\n jLen = currentMasks.length;\r\n var g = createNS('g');\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n g.appendChild(currentMasks[j]);\r\n }\r\n\r\n var mask = createNS('mask');\r\n mask.setAttribute('mask-type', 'alpha');\r\n mask.setAttribute('id', layerId + '_' + count);\r\n mask.appendChild(path);\r\n defs.appendChild(mask);\r\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + layerId + '_' + count + ')');\r\n currentMasks.length = 0;\r\n currentMasks.push(g);\r\n } else {\r\n currentMasks.push(path);\r\n }\r\n\r\n if (properties[i].inv && !this.solidPath) {\r\n this.solidPath = this.createLayerSolidPath();\r\n } // TODO move this to a factory or to a constructor\r\n\r\n\r\n this.viewData[i] = {\r\n elem: path,\r\n lastPath: '',\r\n op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element),\r\n prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3),\r\n invRect: rect\r\n };\r\n\r\n if (!this.viewData[i].prop.k) {\r\n this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]);\r\n }\r\n }\r\n }\r\n\r\n this.maskElement = createNS(maskType);\r\n len = currentMasks.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.maskElement.appendChild(currentMasks[i]);\r\n }\r\n\r\n if (count > 0) {\r\n this.maskElement.setAttribute('id', layerId);\r\n this.element.maskedElement.setAttribute(maskRef, 'url(' + getLocationHref() + '#' + layerId + ')');\r\n defs.appendChild(this.maskElement);\r\n }\r\n\r\n if (this.viewData.length) {\r\n this.element.addRenderableComponent(this);\r\n }\r\n }\r\n\r\n MaskElement.prototype.getMaskProperty = function (pos) {\r\n return this.viewData[pos].prop;\r\n };\r\n\r\n MaskElement.prototype.renderFrame = function (isFirstFrame) {\r\n var finalMat = this.element.finalTransform.mat;\r\n var i;\r\n var len = this.masksProperties.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.viewData[i].prop._mdf || isFirstFrame) {\r\n this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]);\r\n }\r\n\r\n if (this.viewData[i].op._mdf || isFirstFrame) {\r\n this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v);\r\n }\r\n\r\n if (this.masksProperties[i].mode !== 'n') {\r\n if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) {\r\n this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS());\r\n }\r\n\r\n if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) {\r\n var feMorph = this.storedData[i].expan;\r\n\r\n if (this.storedData[i].x.v < 0) {\r\n if (this.storedData[i].lastOperator !== 'erode') {\r\n this.storedData[i].lastOperator = 'erode';\r\n this.storedData[i].elem.setAttribute('filter', 'url(' + getLocationHref() + '#' + this.storedData[i].filterId + ')');\r\n }\r\n\r\n feMorph.setAttribute('radius', -this.storedData[i].x.v);\r\n } else {\r\n if (this.storedData[i].lastOperator !== 'dilate') {\r\n this.storedData[i].lastOperator = 'dilate';\r\n this.storedData[i].elem.setAttribute('filter', null);\r\n }\r\n\r\n this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n MaskElement.prototype.getMaskelement = function () {\r\n return this.maskElement;\r\n };\r\n\r\n MaskElement.prototype.createLayerSolidPath = function () {\r\n var path = 'M0,0 ';\r\n path += ' h' + this.globalData.compSize.w;\r\n path += ' v' + this.globalData.compSize.h;\r\n path += ' h-' + this.globalData.compSize.w;\r\n path += ' v-' + this.globalData.compSize.h + ' ';\r\n return path;\r\n };\r\n\r\n MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) {\r\n var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\r\n var i;\r\n var len;\r\n len = pathNodes._length;\r\n\r\n for (i = 1; i < len; i += 1) {\r\n // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[i][0]+','+pathNodes.i[i][1] + \" \"+pathNodes.v[i][0]+','+pathNodes.v[i][1];\r\n pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + ' ' + pathNodes.v[i][0] + ',' + pathNodes.v[i][1];\r\n } // pathString += \" C\"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + \" \"+pathNodes.i[0][0]+','+pathNodes.i[0][1] + \" \"+pathNodes.v[0][0]+','+pathNodes.v[0][1];\r\n\r\n\r\n if (pathNodes.c && len > 1) {\r\n pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + ' ' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1];\r\n } // pathNodes.__renderedString = pathString;\r\n\r\n\r\n if (viewData.lastPath !== pathString) {\r\n var pathShapeValue = '';\r\n\r\n if (viewData.elem) {\r\n if (pathNodes.c) {\r\n pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;\r\n }\r\n\r\n viewData.elem.setAttribute('d', pathShapeValue);\r\n }\r\n\r\n viewData.lastPath = pathString;\r\n }\r\n };\r\n\r\n MaskElement.prototype.destroy = function () {\r\n this.element = null;\r\n this.globalData = null;\r\n this.maskElement = null;\r\n this.data = null;\r\n this.masksProperties = null;\r\n };\r\n\r\n var filtersFactory = function () {\r\n var ob = {};\r\n ob.createFilter = createFilter;\r\n ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;\r\n\r\n function createFilter(filId, skipCoordinates) {\r\n var fil = createNS('filter');\r\n fil.setAttribute('id', filId);\r\n\r\n if (skipCoordinates !== true) {\r\n fil.setAttribute('filterUnits', 'objectBoundingBox');\r\n fil.setAttribute('x', '0%');\r\n fil.setAttribute('y', '0%');\r\n fil.setAttribute('width', '100%');\r\n fil.setAttribute('height', '100%');\r\n }\r\n\r\n return fil;\r\n }\r\n\r\n function createAlphaToLuminanceFilter() {\r\n var feColorMatrix = createNS('feColorMatrix');\r\n feColorMatrix.setAttribute('type', 'matrix');\r\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\r\n feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1');\r\n return feColorMatrix;\r\n }\r\n\r\n return ob;\r\n }();\r\n\r\n var featureSupport = function () {\r\n var ob = {\r\n maskType: true\r\n };\r\n\r\n if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\\/\\d./i.test(navigator.userAgent)) {\r\n ob.maskType = false;\r\n }\r\n\r\n return ob;\r\n }();\r\n\r\n var registeredEffects = {};\r\n var idPrefix = 'filter_result_';\r\n\r\n function SVGEffects(elem) {\r\n var i;\r\n var source = 'SourceGraphic';\r\n var len = elem.data.ef ? elem.data.ef.length : 0;\r\n var filId = createElementID();\r\n var fil = filtersFactory.createFilter(filId, true);\r\n var count = 0;\r\n this.filters = [];\r\n var filterManager;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n filterManager = null;\r\n var type = elem.data.ef[i].ty;\r\n\r\n if (registeredEffects[type]) {\r\n var Effect = registeredEffects[type].effect;\r\n filterManager = new Effect(fil, elem.effectsManager.effectElements[i], elem, idPrefix + count, source);\r\n source = idPrefix + count;\r\n\r\n if (registeredEffects[type].countsAsEffect) {\r\n count += 1;\r\n }\r\n }\r\n\r\n if (filterManager) {\r\n this.filters.push(filterManager);\r\n }\r\n }\r\n\r\n if (count) {\r\n elem.globalData.defs.appendChild(fil);\r\n elem.layerElement.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\r\n }\r\n\r\n if (this.filters.length) {\r\n elem.addRenderableComponent(this);\r\n }\r\n }\r\n\r\n SVGEffects.prototype.renderFrame = function (_isFirstFrame) {\r\n var i;\r\n var len = this.filters.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.filters[i].renderFrame(_isFirstFrame);\r\n }\r\n };\r\n\r\n function registerEffect(id, effect, countsAsEffect) {\r\n registeredEffects[id] = {\r\n effect: effect,\r\n countsAsEffect: countsAsEffect\r\n };\r\n }\r\n\r\n function SVGBaseElement() {}\r\n\r\n SVGBaseElement.prototype = {\r\n initRendererElement: function initRendererElement() {\r\n this.layerElement = createNS('g');\r\n },\r\n createContainerElements: function createContainerElements() {\r\n this.matteElement = createNS('g');\r\n this.transformedElement = this.layerElement;\r\n this.maskedElement = this.layerElement;\r\n this._sizeChanged = false;\r\n var layerElementParent = null; // If this layer acts as a mask for the following layer\r\n\r\n if (this.data.td) {\r\n this.matteMasks = {};\r\n var symbolElement = createNS('symbol');\r\n symbolElement.setAttribute('id', this.layerId);\r\n var gg = createNS('g');\r\n gg.appendChild(this.layerElement);\r\n symbolElement.appendChild(gg);\r\n layerElementParent = gg;\r\n this.globalData.defs.appendChild(symbolElement);\r\n } else if (this.data.tt) {\r\n this.matteElement.appendChild(this.layerElement);\r\n layerElementParent = this.matteElement;\r\n this.baseElement = this.matteElement;\r\n } else {\r\n this.baseElement = this.layerElement;\r\n }\r\n\r\n if (this.data.ln) {\r\n this.layerElement.setAttribute('id', this.data.ln);\r\n }\r\n\r\n if (this.data.cl) {\r\n this.layerElement.setAttribute('class', this.data.cl);\r\n } // Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped\r\n\r\n\r\n if (this.data.ty === 0 && !this.data.hd) {\r\n var cp = createNS('clipPath');\r\n var pt = createNS('path');\r\n pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');\r\n var clipId = createElementID();\r\n cp.setAttribute('id', clipId);\r\n cp.appendChild(pt);\r\n this.globalData.defs.appendChild(cp);\r\n\r\n if (this.checkMasks()) {\r\n var cpGroup = createNS('g');\r\n cpGroup.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')');\r\n cpGroup.appendChild(this.layerElement);\r\n this.transformedElement = cpGroup;\r\n\r\n if (layerElementParent) {\r\n layerElementParent.appendChild(this.transformedElement);\r\n } else {\r\n this.baseElement = this.transformedElement;\r\n }\r\n } else {\r\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')');\r\n }\r\n }\r\n\r\n if (this.data.bm !== 0) {\r\n this.setBlendMode();\r\n }\r\n },\r\n renderElement: function renderElement() {\r\n if (this.finalTransform._matMdf) {\r\n this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS());\r\n }\r\n\r\n if (this.finalTransform._opMdf) {\r\n this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v);\r\n }\r\n },\r\n destroyBaseElement: function destroyBaseElement() {\r\n this.layerElement = null;\r\n this.matteElement = null;\r\n this.maskManager.destroy();\r\n },\r\n getBaseElement: function getBaseElement() {\r\n if (this.data.hd) {\r\n return null;\r\n }\r\n\r\n return this.baseElement;\r\n },\r\n createRenderableComponents: function createRenderableComponents() {\r\n this.maskManager = new MaskElement(this.data, this, this.globalData);\r\n this.renderableEffectsManager = new SVGEffects(this);\r\n },\r\n getMatte: function getMatte(matteType) {\r\n if (!this.matteMasks[matteType]) {\r\n var id = this.layerId + '_' + matteType;\r\n var filId;\r\n var fil;\r\n var useElement;\r\n var gg;\r\n\r\n if (matteType === 1 || matteType === 3) {\r\n var masker = createNS('mask');\r\n masker.setAttribute('id', id);\r\n masker.setAttribute('mask-type', matteType === 3 ? 'luminance' : 'alpha');\r\n useElement = createNS('use');\r\n useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId);\r\n masker.appendChild(useElement);\r\n this.globalData.defs.appendChild(masker);\r\n\r\n if (!featureSupport.maskType && matteType === 1) {\r\n masker.setAttribute('mask-type', 'luminance');\r\n filId = createElementID();\r\n fil = filtersFactory.createFilter(filId);\r\n this.globalData.defs.appendChild(fil);\r\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\r\n gg = createNS('g');\r\n gg.appendChild(useElement);\r\n masker.appendChild(gg);\r\n gg.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\r\n }\r\n } else if (matteType === 2) {\r\n var maskGroup = createNS('mask');\r\n maskGroup.setAttribute('id', id);\r\n maskGroup.setAttribute('mask-type', 'alpha');\r\n var maskGrouper = createNS('g');\r\n maskGroup.appendChild(maskGrouper);\r\n filId = createElementID();\r\n fil = filtersFactory.createFilter(filId); /// /\r\n\r\n var feCTr = createNS('feComponentTransfer');\r\n feCTr.setAttribute('in', 'SourceGraphic');\r\n fil.appendChild(feCTr);\r\n var feFunc = createNS('feFuncA');\r\n feFunc.setAttribute('type', 'table');\r\n feFunc.setAttribute('tableValues', '1.0 0.0');\r\n feCTr.appendChild(feFunc); /// /\r\n\r\n this.globalData.defs.appendChild(fil);\r\n var alphaRect = createNS('rect');\r\n alphaRect.setAttribute('width', this.comp.data.w);\r\n alphaRect.setAttribute('height', this.comp.data.h);\r\n alphaRect.setAttribute('x', '0');\r\n alphaRect.setAttribute('y', '0');\r\n alphaRect.setAttribute('fill', '#ffffff');\r\n alphaRect.setAttribute('opacity', '0');\r\n maskGrouper.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')');\r\n maskGrouper.appendChild(alphaRect);\r\n useElement = createNS('use');\r\n useElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + this.layerId);\r\n maskGrouper.appendChild(useElement);\r\n\r\n if (!featureSupport.maskType) {\r\n maskGroup.setAttribute('mask-type', 'luminance');\r\n fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());\r\n gg = createNS('g');\r\n maskGrouper.appendChild(alphaRect);\r\n gg.appendChild(this.layerElement);\r\n maskGrouper.appendChild(gg);\r\n }\r\n\r\n this.globalData.defs.appendChild(maskGroup);\r\n }\r\n\r\n this.matteMasks[matteType] = id;\r\n }\r\n\r\n return this.matteMasks[matteType];\r\n },\r\n setMatte: function setMatte(id) {\r\n if (!this.matteElement) {\r\n return;\r\n }\r\n\r\n this.matteElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')');\r\n }\r\n };\r\n\r\n /**\r\n * @file\r\n * Handles AE's layer parenting property.\r\n *\r\n */\r\n function HierarchyElement() {}\r\n\r\n HierarchyElement.prototype = {\r\n /**\r\n * @function\r\n * Initializes hierarchy properties\r\n *\r\n */\r\n initHierarchy: function initHierarchy() {\r\n // element's parent list\r\n this.hierarchy = []; // if element is parent of another layer _isParent will be true\r\n\r\n this._isParent = false;\r\n this.checkParenting();\r\n },\r\n\r\n /**\r\n * @function\r\n * Sets layer's hierarchy.\r\n * @param {array} hierarch\r\n * layer's parent list\r\n *\r\n */\r\n setHierarchy: function setHierarchy(hierarchy) {\r\n this.hierarchy = hierarchy;\r\n },\r\n\r\n /**\r\n * @function\r\n * Sets layer as parent.\r\n *\r\n */\r\n setAsParent: function setAsParent() {\r\n this._isParent = true;\r\n },\r\n\r\n /**\r\n * @function\r\n * Searches layer's parenting chain\r\n *\r\n */\r\n checkParenting: function checkParenting() {\r\n if (this.data.parent !== undefined) {\r\n this.comp.buildElementParenting(this, this.data.parent, []);\r\n }\r\n }\r\n };\r\n\r\n function RenderableDOMElement() {}\r\n\r\n (function () {\r\n var _prototype = {\r\n initElement: function initElement(data, globalData, comp) {\r\n this.initFrame();\r\n this.initBaseData(data, globalData, comp);\r\n this.initTransform(data, globalData, comp);\r\n this.initHierarchy();\r\n this.initRenderable();\r\n this.initRendererElement();\r\n this.createContainerElements();\r\n this.createRenderableComponents();\r\n this.createContent();\r\n this.hide();\r\n },\r\n hide: function hide() {\r\n // console.log('HIDE', this);\r\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\r\n var elem = this.baseElement || this.layerElement;\r\n elem.style.display = 'none';\r\n this.hidden = true;\r\n }\r\n },\r\n show: function show() {\r\n // console.log('SHOW', this);\r\n if (this.isInRange && !this.isTransparent) {\r\n if (!this.data.hd) {\r\n var elem = this.baseElement || this.layerElement;\r\n elem.style.display = 'block';\r\n }\r\n\r\n this.hidden = false;\r\n this._isFirstFrame = true;\r\n }\r\n },\r\n renderFrame: function renderFrame() {\r\n // If it is exported as hidden (data.hd === true) no need to render\r\n // If it is not visible no need to render\r\n if (this.data.hd || this.hidden) {\r\n return;\r\n }\r\n\r\n this.renderTransform();\r\n this.renderRenderable();\r\n this.renderElement();\r\n this.renderInnerContent();\r\n\r\n if (this._isFirstFrame) {\r\n this._isFirstFrame = false;\r\n }\r\n },\r\n renderInnerContent: function renderInnerContent() {},\r\n prepareFrame: function prepareFrame(num) {\r\n this._mdf = false;\r\n this.prepareRenderableFrame(num);\r\n this.prepareProperties(num, this.isInRange);\r\n this.checkTransparency();\r\n },\r\n destroy: function destroy() {\r\n this.innerElem = null;\r\n this.destroyBaseElement();\r\n }\r\n };\r\n extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);\r\n })();\r\n\r\n function IImageElement(data, globalData, comp) {\r\n this.assetData = globalData.getAssetData(data.refId);\r\n this.initElement(data, globalData, comp);\r\n this.sourceRect = {\r\n top: 0,\r\n left: 0,\r\n width: this.assetData.w,\r\n height: this.assetData.h\r\n };\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement);\r\n\r\n IImageElement.prototype.createContent = function () {\r\n var assetPath = this.globalData.getAssetsPath(this.assetData);\r\n this.innerElem = createNS('image');\r\n this.innerElem.setAttribute('width', this.assetData.w + 'px');\r\n this.innerElem.setAttribute('height', this.assetData.h + 'px');\r\n this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);\r\n this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\r\n this.layerElement.appendChild(this.innerElem);\r\n };\r\n\r\n IImageElement.prototype.sourceRectAtTime = function () {\r\n return this.sourceRect;\r\n };\r\n\r\n function ProcessedElement(element, position) {\r\n this.elem = element;\r\n this.pos = position;\r\n }\r\n\r\n function IShapeElement() {}\r\n\r\n IShapeElement.prototype = {\r\n addShapeToModifiers: function addShapeToModifiers(data) {\r\n var i;\r\n var len = this.shapeModifiers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.shapeModifiers[i].addShape(data);\r\n }\r\n },\r\n isShapeInAnimatedModifiers: function isShapeInAnimatedModifiers(data) {\r\n var i = 0;\r\n var len = this.shapeModifiers.length;\r\n\r\n while (i < len) {\r\n if (this.shapeModifiers[i].isAnimatedWithShape(data)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n },\r\n renderModifiers: function renderModifiers() {\r\n if (!this.shapeModifiers.length) {\r\n return;\r\n }\r\n\r\n var i;\r\n var len = this.shapes.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.shapes[i].sh.reset();\r\n }\r\n\r\n len = this.shapeModifiers.length;\r\n var shouldBreakProcess;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame); // workaround to fix cases where a repeater resets the shape so the following processes get called twice\r\n // TODO: find a better solution for this\r\n\r\n if (shouldBreakProcess) {\r\n break;\r\n }\r\n }\r\n },\r\n searchProcessedElement: function searchProcessedElement(elem) {\r\n var elements = this.processedElements;\r\n var i = 0;\r\n var len = elements.length;\r\n\r\n while (i < len) {\r\n if (elements[i].elem === elem) {\r\n return elements[i].pos;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return 0;\r\n },\r\n addProcessedElement: function addProcessedElement(elem, pos) {\r\n var elements = this.processedElements;\r\n var i = elements.length;\r\n\r\n while (i) {\r\n i -= 1;\r\n\r\n if (elements[i].elem === elem) {\r\n elements[i].pos = pos;\r\n return;\r\n }\r\n }\r\n\r\n elements.push(new ProcessedElement(elem, pos));\r\n },\r\n prepareFrame: function prepareFrame(num) {\r\n this.prepareRenderableFrame(num);\r\n this.prepareProperties(num, this.isInRange);\r\n }\r\n };\r\n\r\n var lineCapEnum = {\r\n 1: 'butt',\r\n 2: 'round',\r\n 3: 'square'\r\n };\r\n var lineJoinEnum = {\r\n 1: 'miter',\r\n 2: 'round',\r\n 3: 'bevel'\r\n };\r\n\r\n function SVGShapeData(transformers, level, shape) {\r\n this.caches = [];\r\n this.styles = [];\r\n this.transformers = transformers;\r\n this.lStr = '';\r\n this.sh = shape;\r\n this.lvl = level; // TODO find if there are some cases where _isAnimated can be false.\r\n // For now, since shapes add up with other shapes. They have to be calculated every time.\r\n // One way of finding out is checking if all styles associated to this shape depend only of this shape\r\n\r\n this._isAnimated = !!shape.k; // TODO: commenting this for now since all shapes are animated\r\n\r\n var i = 0;\r\n var len = transformers.length;\r\n\r\n while (i < len) {\r\n if (transformers[i].mProps.dynamicProperties.length) {\r\n this._isAnimated = true;\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n }\r\n\r\n SVGShapeData.prototype.setAsAnimated = function () {\r\n this._isAnimated = true;\r\n };\r\n\r\n function SVGStyleData(data, level) {\r\n this.data = data;\r\n this.type = data.ty;\r\n this.d = '';\r\n this.lvl = level;\r\n this._mdf = false;\r\n this.closed = data.hd === true;\r\n this.pElem = createNS('path');\r\n this.msElem = null;\r\n }\r\n\r\n SVGStyleData.prototype.reset = function () {\r\n this.d = '';\r\n this._mdf = false;\r\n };\r\n\r\n function DashProperty(elem, data, renderer, container) {\r\n this.elem = elem;\r\n this.frameId = -1;\r\n this.dataProps = createSizedArray(data.length);\r\n this.renderer = renderer;\r\n this.k = false;\r\n this.dashStr = '';\r\n this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);\r\n this.dashoffset = createTypedArray('float32', 1);\r\n this.initDynamicPropertyContainer(container);\r\n var i;\r\n var len = data.length || 0;\r\n var prop;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this);\r\n this.k = prop.k || this.k;\r\n this.dataProps[i] = {\r\n n: data[i].n,\r\n p: prop\r\n };\r\n }\r\n\r\n if (!this.k) {\r\n this.getValue(true);\r\n }\r\n\r\n this._isAnimated = this.k;\r\n }\r\n\r\n DashProperty.prototype.getValue = function (forceRender) {\r\n if (this.elem.globalData.frameId === this.frameId && !forceRender) {\r\n return;\r\n }\r\n\r\n this.frameId = this.elem.globalData.frameId;\r\n this.iterateDynamicProperties();\r\n this._mdf = this._mdf || forceRender;\r\n\r\n if (this._mdf) {\r\n var i = 0;\r\n var len = this.dataProps.length;\r\n\r\n if (this.renderer === 'svg') {\r\n this.dashStr = '';\r\n }\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.dataProps[i].n !== 'o') {\r\n if (this.renderer === 'svg') {\r\n this.dashStr += ' ' + this.dataProps[i].p.v;\r\n } else {\r\n this.dashArray[i] = this.dataProps[i].p.v;\r\n }\r\n } else {\r\n this.dashoffset[0] = this.dataProps[i].p.v;\r\n }\r\n }\r\n }\r\n };\r\n\r\n extendPrototype([DynamicPropertyContainer], DashProperty);\r\n\r\n function SVGStrokeStyleData(elem, data, styleOb) {\r\n this.initDynamicPropertyContainer(elem);\r\n this.getValue = this.iterateDynamicProperties;\r\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\r\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\r\n this.d = new DashProperty(elem, data.d || {}, 'svg', this);\r\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\r\n this.style = styleOb;\r\n this._isAnimated = !!this._isAnimated;\r\n }\r\n\r\n extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);\r\n\r\n function SVGFillStyleData(elem, data, styleOb) {\r\n this.initDynamicPropertyContainer(elem);\r\n this.getValue = this.iterateDynamicProperties;\r\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\r\n this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this);\r\n this.style = styleOb;\r\n }\r\n\r\n extendPrototype([DynamicPropertyContainer], SVGFillStyleData);\r\n\r\n function SVGNoStyleData(elem, data, styleOb) {\r\n this.initDynamicPropertyContainer(elem);\r\n this.getValue = this.iterateDynamicProperties;\r\n this.style = styleOb;\r\n }\r\n\r\n extendPrototype([DynamicPropertyContainer], SVGNoStyleData);\r\n\r\n function GradientProperty(elem, data, container) {\r\n this.data = data;\r\n this.c = createTypedArray('uint8c', data.p * 4);\r\n var cLength = data.k.k[0].s ? data.k.k[0].s.length - data.p * 4 : data.k.k.length - data.p * 4;\r\n this.o = createTypedArray('float32', cLength);\r\n this._cmdf = false;\r\n this._omdf = false;\r\n this._collapsable = this.checkCollapsable();\r\n this._hasOpacity = cLength;\r\n this.initDynamicPropertyContainer(container);\r\n this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this);\r\n this.k = this.prop.k;\r\n this.getValue(true);\r\n }\r\n\r\n GradientProperty.prototype.comparePoints = function (values, points) {\r\n var i = 0;\r\n var len = this.o.length / 2;\r\n var diff;\r\n\r\n while (i < len) {\r\n diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]);\r\n\r\n if (diff > 0.01) {\r\n return false;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n GradientProperty.prototype.checkCollapsable = function () {\r\n if (this.o.length / 2 !== this.c.length / 4) {\r\n return false;\r\n }\r\n\r\n if (this.data.k.k[0].s) {\r\n var i = 0;\r\n var len = this.data.k.k.length;\r\n\r\n while (i < len) {\r\n if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {\r\n return false;\r\n }\r\n\r\n i += 1;\r\n }\r\n } else if (!this.comparePoints(this.data.k.k, this.data.p)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n GradientProperty.prototype.getValue = function (forceRender) {\r\n this.prop.getValue();\r\n this._mdf = false;\r\n this._cmdf = false;\r\n this._omdf = false;\r\n\r\n if (this.prop._mdf || forceRender) {\r\n var i;\r\n var len = this.data.p * 4;\r\n var mult;\r\n var val;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n mult = i % 4 === 0 ? 100 : 255;\r\n val = Math.round(this.prop.v[i] * mult);\r\n\r\n if (this.c[i] !== val) {\r\n this.c[i] = val;\r\n this._cmdf = !forceRender;\r\n }\r\n }\r\n\r\n if (this.o.length) {\r\n len = this.prop.v.length;\r\n\r\n for (i = this.data.p * 4; i < len; i += 1) {\r\n mult = i % 2 === 0 ? 100 : 1;\r\n val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i];\r\n\r\n if (this.o[i - this.data.p * 4] !== val) {\r\n this.o[i - this.data.p * 4] = val;\r\n this._omdf = !forceRender;\r\n }\r\n }\r\n }\r\n\r\n this._mdf = !forceRender;\r\n }\r\n };\r\n\r\n extendPrototype([DynamicPropertyContainer], GradientProperty);\r\n\r\n function SVGGradientFillStyleData(elem, data, styleOb) {\r\n this.initDynamicPropertyContainer(elem);\r\n this.getValue = this.iterateDynamicProperties;\r\n this.initGradientData(elem, data, styleOb);\r\n }\r\n\r\n SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) {\r\n this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this);\r\n this.s = PropertyFactory.getProp(elem, data.s, 1, null, this);\r\n this.e = PropertyFactory.getProp(elem, data.e, 1, null, this);\r\n this.h = PropertyFactory.getProp(elem, data.h || {\r\n k: 0\r\n }, 0, 0.01, this);\r\n this.a = PropertyFactory.getProp(elem, data.a || {\r\n k: 0\r\n }, 0, degToRads, this);\r\n this.g = new GradientProperty(elem, data.g, this);\r\n this.style = styleOb;\r\n this.stops = [];\r\n this.setGradientData(styleOb.pElem, data);\r\n this.setGradientOpacity(data, styleOb);\r\n this._isAnimated = !!this._isAnimated;\r\n };\r\n\r\n SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) {\r\n var gradientId = createElementID();\r\n var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\r\n gfill.setAttribute('id', gradientId);\r\n gfill.setAttribute('spreadMethod', 'pad');\r\n gfill.setAttribute('gradientUnits', 'userSpaceOnUse');\r\n var stops = [];\r\n var stop;\r\n var j;\r\n var jLen;\r\n jLen = data.g.p * 4;\r\n\r\n for (j = 0; j < jLen; j += 4) {\r\n stop = createNS('stop');\r\n gfill.appendChild(stop);\r\n stops.push(stop);\r\n }\r\n\r\n pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + gradientId + ')');\r\n this.gf = gfill;\r\n this.cst = stops;\r\n };\r\n\r\n SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) {\r\n if (this.g._hasOpacity && !this.g._collapsable) {\r\n var stop;\r\n var j;\r\n var jLen;\r\n var mask = createNS('mask');\r\n var maskElement = createNS('path');\r\n mask.appendChild(maskElement);\r\n var opacityId = createElementID();\r\n var maskId = createElementID();\r\n mask.setAttribute('id', maskId);\r\n var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');\r\n opFill.setAttribute('id', opacityId);\r\n opFill.setAttribute('spreadMethod', 'pad');\r\n opFill.setAttribute('gradientUnits', 'userSpaceOnUse');\r\n jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;\r\n var stops = this.stops;\r\n\r\n for (j = data.g.p * 4; j < jLen; j += 2) {\r\n stop = createNS('stop');\r\n stop.setAttribute('stop-color', 'rgb(255,255,255)');\r\n opFill.appendChild(stop);\r\n stops.push(stop);\r\n }\r\n\r\n maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + opacityId + ')');\r\n\r\n if (data.ty === 'gs') {\r\n maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\r\n maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\r\n\r\n if (data.lj === 1) {\r\n maskElement.setAttribute('stroke-miterlimit', data.ml);\r\n }\r\n }\r\n\r\n this.of = opFill;\r\n this.ms = mask;\r\n this.ost = stops;\r\n this.maskId = maskId;\r\n styleOb.msElem = maskElement;\r\n }\r\n };\r\n\r\n extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);\r\n\r\n function SVGGradientStrokeStyleData(elem, data, styleOb) {\r\n this.initDynamicPropertyContainer(elem);\r\n this.getValue = this.iterateDynamicProperties;\r\n this.w = PropertyFactory.getProp(elem, data.w, 0, null, this);\r\n this.d = new DashProperty(elem, data.d || {}, 'svg', this);\r\n this.initGradientData(elem, data, styleOb);\r\n this._isAnimated = !!this._isAnimated;\r\n }\r\n\r\n extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);\r\n\r\n function ShapeGroupData() {\r\n this.it = [];\r\n this.prevViewData = [];\r\n this.gr = createNS('g');\r\n }\r\n\r\n function SVGTransformData(mProps, op, container) {\r\n this.transform = {\r\n mProps: mProps,\r\n op: op,\r\n container: container\r\n };\r\n this.elements = [];\r\n this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;\r\n }\r\n\r\n var buildShapeString = function buildShapeString(pathNodes, length, closed, mat) {\r\n if (length === 0) {\r\n return '';\r\n }\r\n\r\n var _o = pathNodes.o;\r\n var _i = pathNodes.i;\r\n var _v = pathNodes.v;\r\n var i;\r\n var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\r\n\r\n for (i = 1; i < length; i += 1) {\r\n shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[i][0], _i[i][1]) + ' ' + mat.applyToPointStringified(_v[i][0], _v[i][1]);\r\n }\r\n\r\n if (closed && length) {\r\n shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[0][0], _i[0][1]) + ' ' + mat.applyToPointStringified(_v[0][0], _v[0][1]);\r\n shapeString += 'z';\r\n }\r\n\r\n return shapeString;\r\n };\r\n\r\n var SVGElementsRenderer = function () {\r\n var _identityMatrix = new Matrix();\r\n\r\n var _matrixHelper = new Matrix();\r\n\r\n var ob = {\r\n createRenderFunction: createRenderFunction\r\n };\r\n\r\n function createRenderFunction(data) {\r\n switch (data.ty) {\r\n case 'fl':\r\n return renderFill;\r\n\r\n case 'gf':\r\n return renderGradient;\r\n\r\n case 'gs':\r\n return renderGradientStroke;\r\n\r\n case 'st':\r\n return renderStroke;\r\n\r\n case 'sh':\r\n case 'el':\r\n case 'rc':\r\n case 'sr':\r\n return renderPath;\r\n\r\n case 'tr':\r\n return renderContentTransform;\r\n\r\n case 'no':\r\n return renderNoop;\r\n\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n function renderContentTransform(styleData, itemData, isFirstFrame) {\r\n if (isFirstFrame || itemData.transform.op._mdf) {\r\n itemData.transform.container.setAttribute('opacity', itemData.transform.op.v);\r\n }\r\n\r\n if (isFirstFrame || itemData.transform.mProps._mdf) {\r\n itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS());\r\n }\r\n }\r\n\r\n function renderNoop() {}\r\n\r\n function renderPath(styleData, itemData, isFirstFrame) {\r\n var j;\r\n var jLen;\r\n var pathStringTransformed;\r\n var redraw;\r\n var pathNodes;\r\n var l;\r\n var lLen = itemData.styles.length;\r\n var lvl = itemData.lvl;\r\n var paths;\r\n var mat;\r\n var props;\r\n var iterations;\r\n var k;\r\n\r\n for (l = 0; l < lLen; l += 1) {\r\n redraw = itemData.sh._mdf || isFirstFrame;\r\n\r\n if (itemData.styles[l].lvl < lvl) {\r\n mat = _matrixHelper.reset();\r\n iterations = lvl - itemData.styles[l].lvl;\r\n k = itemData.transformers.length - 1;\r\n\r\n while (!redraw && iterations > 0) {\r\n redraw = itemData.transformers[k].mProps._mdf || redraw;\r\n iterations -= 1;\r\n k -= 1;\r\n }\r\n\r\n if (redraw) {\r\n iterations = lvl - itemData.styles[l].lvl;\r\n k = itemData.transformers.length - 1;\r\n\r\n while (iterations > 0) {\r\n props = itemData.transformers[k].mProps.v.props;\r\n mat.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);\r\n iterations -= 1;\r\n k -= 1;\r\n }\r\n }\r\n } else {\r\n mat = _identityMatrix;\r\n }\r\n\r\n paths = itemData.sh.paths;\r\n jLen = paths._length;\r\n\r\n if (redraw) {\r\n pathStringTransformed = '';\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n pathNodes = paths.shapes[j];\r\n\r\n if (pathNodes && pathNodes._length) {\r\n pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);\r\n }\r\n }\r\n\r\n itemData.caches[l] = pathStringTransformed;\r\n } else {\r\n pathStringTransformed = itemData.caches[l];\r\n }\r\n\r\n itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;\r\n itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;\r\n }\r\n }\r\n\r\n function renderFill(styleData, itemData, isFirstFrame) {\r\n var styleElem = itemData.style;\r\n\r\n if (itemData.c._mdf || isFirstFrame) {\r\n styleElem.pElem.setAttribute('fill', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\r\n }\r\n\r\n if (itemData.o._mdf || isFirstFrame) {\r\n styleElem.pElem.setAttribute('fill-opacity', itemData.o.v);\r\n }\r\n }\r\n\r\n function renderGradientStroke(styleData, itemData, isFirstFrame) {\r\n renderGradient(styleData, itemData, isFirstFrame);\r\n renderStroke(styleData, itemData, isFirstFrame);\r\n }\r\n\r\n function renderGradient(styleData, itemData, isFirstFrame) {\r\n var gfill = itemData.gf;\r\n var hasOpacity = itemData.g._hasOpacity;\r\n var pt1 = itemData.s.v;\r\n var pt2 = itemData.e.v;\r\n\r\n if (itemData.o._mdf || isFirstFrame) {\r\n var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';\r\n itemData.style.pElem.setAttribute(attr, itemData.o.v);\r\n }\r\n\r\n if (itemData.s._mdf || isFirstFrame) {\r\n var attr1 = styleData.t === 1 ? 'x1' : 'cx';\r\n var attr2 = attr1 === 'x1' ? 'y1' : 'cy';\r\n gfill.setAttribute(attr1, pt1[0]);\r\n gfill.setAttribute(attr2, pt1[1]);\r\n\r\n if (hasOpacity && !itemData.g._collapsable) {\r\n itemData.of.setAttribute(attr1, pt1[0]);\r\n itemData.of.setAttribute(attr2, pt1[1]);\r\n }\r\n }\r\n\r\n var stops;\r\n var i;\r\n var len;\r\n var stop;\r\n\r\n if (itemData.g._cmdf || isFirstFrame) {\r\n stops = itemData.cst;\r\n var cValues = itemData.g.c;\r\n len = stops.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n stop = stops[i];\r\n stop.setAttribute('offset', cValues[i * 4] + '%');\r\n stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')');\r\n }\r\n }\r\n\r\n if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {\r\n var oValues = itemData.g.o;\r\n\r\n if (itemData.g._collapsable) {\r\n stops = itemData.cst;\r\n } else {\r\n stops = itemData.ost;\r\n }\r\n\r\n len = stops.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n stop = stops[i];\r\n\r\n if (!itemData.g._collapsable) {\r\n stop.setAttribute('offset', oValues[i * 2] + '%');\r\n }\r\n\r\n stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);\r\n }\r\n }\r\n\r\n if (styleData.t === 1) {\r\n if (itemData.e._mdf || isFirstFrame) {\r\n gfill.setAttribute('x2', pt2[0]);\r\n gfill.setAttribute('y2', pt2[1]);\r\n\r\n if (hasOpacity && !itemData.g._collapsable) {\r\n itemData.of.setAttribute('x2', pt2[0]);\r\n itemData.of.setAttribute('y2', pt2[1]);\r\n }\r\n }\r\n } else {\r\n var rad;\r\n\r\n if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {\r\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\r\n gfill.setAttribute('r', rad);\r\n\r\n if (hasOpacity && !itemData.g._collapsable) {\r\n itemData.of.setAttribute('r', rad);\r\n }\r\n }\r\n\r\n if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {\r\n if (!rad) {\r\n rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\r\n }\r\n\r\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\r\n var percent = itemData.h.v;\r\n\r\n if (percent >= 1) {\r\n percent = 0.99;\r\n } else if (percent <= -1) {\r\n percent = -0.99;\r\n }\r\n\r\n var dist = rad * percent;\r\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\r\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\r\n gfill.setAttribute('fx', x);\r\n gfill.setAttribute('fy', y);\r\n\r\n if (hasOpacity && !itemData.g._collapsable) {\r\n itemData.of.setAttribute('fx', x);\r\n itemData.of.setAttribute('fy', y);\r\n }\r\n } // gfill.setAttribute('fy','200');\r\n\r\n }\r\n }\r\n\r\n function renderStroke(styleData, itemData, isFirstFrame) {\r\n var styleElem = itemData.style;\r\n var d = itemData.d;\r\n\r\n if (d && (d._mdf || isFirstFrame) && d.dashStr) {\r\n styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);\r\n styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);\r\n }\r\n\r\n if (itemData.c && (itemData.c._mdf || isFirstFrame)) {\r\n styleElem.pElem.setAttribute('stroke', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')');\r\n }\r\n\r\n if (itemData.o._mdf || isFirstFrame) {\r\n styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);\r\n }\r\n\r\n if (itemData.w._mdf || isFirstFrame) {\r\n styleElem.pElem.setAttribute('stroke-width', itemData.w.v);\r\n\r\n if (styleElem.msElem) {\r\n styleElem.msElem.setAttribute('stroke-width', itemData.w.v);\r\n }\r\n }\r\n }\r\n\r\n return ob;\r\n }();\r\n\r\n function SVGShapeElement(data, globalData, comp) {\r\n // List of drawable elements\r\n this.shapes = []; // Full shape data\r\n\r\n this.shapesData = data.shapes; // List of styles that will be applied to shapes\r\n\r\n this.stylesList = []; // List of modifiers that will be applied to shapes\r\n\r\n this.shapeModifiers = []; // List of items in shape tree\r\n\r\n this.itemsData = []; // List of items in previous shape tree\r\n\r\n this.processedElements = []; // List of animated components\r\n\r\n this.animatedContents = [];\r\n this.initElement(data, globalData, comp); // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\r\n // List of elements that have been created\r\n\r\n this.prevViewData = []; // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement);\r\n\r\n SVGShapeElement.prototype.initSecondaryElement = function () {};\r\n\r\n SVGShapeElement.prototype.identityMatrix = new Matrix();\r\n\r\n SVGShapeElement.prototype.buildExpressionInterface = function () {};\r\n\r\n SVGShapeElement.prototype.createContent = function () {\r\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\r\n this.filterUniqueShapes();\r\n };\r\n /*\r\n This method searches for multiple shapes that affect a single element and one of them is animated\r\n */\r\n\r\n\r\n SVGShapeElement.prototype.filterUniqueShapes = function () {\r\n var i;\r\n var len = this.shapes.length;\r\n var shape;\r\n var j;\r\n var jLen = this.stylesList.length;\r\n var style;\r\n var tempShapes = [];\r\n var areAnimated = false;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n style = this.stylesList[j];\r\n areAnimated = false;\r\n tempShapes.length = 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shape = this.shapes[i];\r\n\r\n if (shape.styles.indexOf(style) !== -1) {\r\n tempShapes.push(shape);\r\n areAnimated = shape._isAnimated || areAnimated;\r\n }\r\n }\r\n\r\n if (tempShapes.length > 1 && areAnimated) {\r\n this.setShapesAsAnimated(tempShapes);\r\n }\r\n }\r\n };\r\n\r\n SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) {\r\n var i;\r\n var len = shapes.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n shapes[i].setAsAnimated();\r\n }\r\n };\r\n\r\n SVGShapeElement.prototype.createStyleElement = function (data, level) {\r\n // TODO: prevent drawing of hidden styles\r\n var elementData;\r\n var styleOb = new SVGStyleData(data, level);\r\n var pathElement = styleOb.pElem;\r\n\r\n if (data.ty === 'st') {\r\n elementData = new SVGStrokeStyleData(this, data, styleOb);\r\n } else if (data.ty === 'fl') {\r\n elementData = new SVGFillStyleData(this, data, styleOb);\r\n } else if (data.ty === 'gf' || data.ty === 'gs') {\r\n var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;\r\n elementData = new GradientConstructor(this, data, styleOb);\r\n this.globalData.defs.appendChild(elementData.gf);\r\n\r\n if (elementData.maskId) {\r\n this.globalData.defs.appendChild(elementData.ms);\r\n this.globalData.defs.appendChild(elementData.of);\r\n pathElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + elementData.maskId + ')');\r\n }\r\n } else if (data.ty === 'no') {\r\n elementData = new SVGNoStyleData(this, data, styleOb);\r\n }\r\n\r\n if (data.ty === 'st' || data.ty === 'gs') {\r\n pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]);\r\n pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]);\r\n pathElement.setAttribute('fill-opacity', '0');\r\n\r\n if (data.lj === 1) {\r\n pathElement.setAttribute('stroke-miterlimit', data.ml);\r\n }\r\n }\r\n\r\n if (data.r === 2) {\r\n pathElement.setAttribute('fill-rule', 'evenodd');\r\n }\r\n\r\n if (data.ln) {\r\n pathElement.setAttribute('id', data.ln);\r\n }\r\n\r\n if (data.cl) {\r\n pathElement.setAttribute('class', data.cl);\r\n }\r\n\r\n if (data.bm) {\r\n pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);\r\n }\r\n\r\n this.stylesList.push(styleOb);\r\n this.addToAnimatedContents(data, elementData);\r\n return elementData;\r\n };\r\n\r\n SVGShapeElement.prototype.createGroupElement = function (data) {\r\n var elementData = new ShapeGroupData();\r\n\r\n if (data.ln) {\r\n elementData.gr.setAttribute('id', data.ln);\r\n }\r\n\r\n if (data.cl) {\r\n elementData.gr.setAttribute('class', data.cl);\r\n }\r\n\r\n if (data.bm) {\r\n elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);\r\n }\r\n\r\n return elementData;\r\n };\r\n\r\n SVGShapeElement.prototype.createTransformElement = function (data, container) {\r\n var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this);\r\n var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);\r\n this.addToAnimatedContents(data, elementData);\r\n return elementData;\r\n };\r\n\r\n SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) {\r\n var ty = 4;\r\n\r\n if (data.ty === 'rc') {\r\n ty = 5;\r\n } else if (data.ty === 'el') {\r\n ty = 6;\r\n } else if (data.ty === 'sr') {\r\n ty = 7;\r\n }\r\n\r\n var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this);\r\n var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);\r\n this.shapes.push(elementData);\r\n this.addShapeToModifiers(elementData);\r\n this.addToAnimatedContents(data, elementData);\r\n return elementData;\r\n };\r\n\r\n SVGShapeElement.prototype.addToAnimatedContents = function (data, element) {\r\n var i = 0;\r\n var len = this.animatedContents.length;\r\n\r\n while (i < len) {\r\n if (this.animatedContents[i].element === element) {\r\n return;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n this.animatedContents.push({\r\n fn: SVGElementsRenderer.createRenderFunction(data),\r\n element: element,\r\n data: data\r\n });\r\n };\r\n\r\n SVGShapeElement.prototype.setElementStyles = function (elementData) {\r\n var arr = elementData.styles;\r\n var j;\r\n var jLen = this.stylesList.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (!this.stylesList[j].closed) {\r\n arr.push(this.stylesList[j]);\r\n }\r\n }\r\n };\r\n\r\n SVGShapeElement.prototype.reloadShapes = function () {\r\n this._isFirstFrame = true;\r\n var i;\r\n var len = this.itemsData.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.prevViewData[i] = this.itemsData[i];\r\n }\r\n\r\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true);\r\n this.filterUniqueShapes();\r\n len = this.dynamicProperties.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.dynamicProperties[i].getValue();\r\n }\r\n\r\n this.renderModifiers();\r\n };\r\n\r\n SVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) {\r\n var ownTransformers = [].concat(transformers);\r\n var i;\r\n var len = arr.length - 1;\r\n var j;\r\n var jLen;\r\n var ownStyles = [];\r\n var ownModifiers = [];\r\n var currentTransform;\r\n var modifier;\r\n var processedPos;\r\n\r\n for (i = len; i >= 0; i -= 1) {\r\n processedPos = this.searchProcessedElement(arr[i]);\r\n\r\n if (!processedPos) {\r\n arr[i]._render = render;\r\n } else {\r\n itemsData[i] = prevViewData[processedPos - 1];\r\n }\r\n\r\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs' || arr[i].ty === 'no') {\r\n if (!processedPos) {\r\n itemsData[i] = this.createStyleElement(arr[i], level);\r\n } else {\r\n itemsData[i].style.closed = false;\r\n }\r\n\r\n if (arr[i]._render) {\r\n if (itemsData[i].style.pElem.parentNode !== container) {\r\n container.appendChild(itemsData[i].style.pElem);\r\n }\r\n }\r\n\r\n ownStyles.push(itemsData[i].style);\r\n } else if (arr[i].ty === 'gr') {\r\n if (!processedPos) {\r\n itemsData[i] = this.createGroupElement(arr[i]);\r\n } else {\r\n jLen = itemsData[i].it.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n itemsData[i].prevViewData[j] = itemsData[i].it[j];\r\n }\r\n }\r\n\r\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render);\r\n\r\n if (arr[i]._render) {\r\n if (itemsData[i].gr.parentNode !== container) {\r\n container.appendChild(itemsData[i].gr);\r\n }\r\n }\r\n } else if (arr[i].ty === 'tr') {\r\n if (!processedPos) {\r\n itemsData[i] = this.createTransformElement(arr[i], container);\r\n }\r\n\r\n currentTransform = itemsData[i].transform;\r\n ownTransformers.push(currentTransform);\r\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\r\n if (!processedPos) {\r\n itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);\r\n }\r\n\r\n this.setElementStyles(itemsData[i]);\r\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb' || arr[i].ty === 'zz' || arr[i].ty === 'op') {\r\n if (!processedPos) {\r\n modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n modifier.init(this, arr[i]);\r\n itemsData[i] = modifier;\r\n this.shapeModifiers.push(modifier);\r\n } else {\r\n modifier = itemsData[i];\r\n modifier.closed = false;\r\n }\r\n\r\n ownModifiers.push(modifier);\r\n } else if (arr[i].ty === 'rp') {\r\n if (!processedPos) {\r\n modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n itemsData[i] = modifier;\r\n modifier.init(this, arr, i, itemsData);\r\n this.shapeModifiers.push(modifier);\r\n render = false;\r\n } else {\r\n modifier = itemsData[i];\r\n modifier.closed = true;\r\n }\r\n\r\n ownModifiers.push(modifier);\r\n }\r\n\r\n this.addProcessedElement(arr[i], i + 1);\r\n }\r\n\r\n len = ownStyles.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ownStyles[i].closed = true;\r\n }\r\n\r\n len = ownModifiers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ownModifiers[i].closed = true;\r\n }\r\n };\r\n\r\n SVGShapeElement.prototype.renderInnerContent = function () {\r\n this.renderModifiers();\r\n var i;\r\n var len = this.stylesList.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.stylesList[i].reset();\r\n }\r\n\r\n this.renderShape();\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.stylesList[i]._mdf || this._isFirstFrame) {\r\n if (this.stylesList[i].msElem) {\r\n this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d); // Adding M0 0 fixes same mask bug on all browsers\r\n\r\n this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;\r\n }\r\n\r\n this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');\r\n }\r\n }\r\n };\r\n\r\n SVGShapeElement.prototype.renderShape = function () {\r\n var i;\r\n var len = this.animatedContents.length;\r\n var animatedContent;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n animatedContent = this.animatedContents[i];\r\n\r\n if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {\r\n animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);\r\n }\r\n }\r\n };\r\n\r\n SVGShapeElement.prototype.destroy = function () {\r\n this.destroyBaseElement();\r\n this.shapesData = null;\r\n this.itemsData = null;\r\n };\r\n\r\n function LetterProps(o, sw, sc, fc, m, p) {\r\n this.o = o;\r\n this.sw = sw;\r\n this.sc = sc;\r\n this.fc = fc;\r\n this.m = m;\r\n this.p = p;\r\n this._mdf = {\r\n o: true,\r\n sw: !!sw,\r\n sc: !!sc,\r\n fc: !!fc,\r\n m: true,\r\n p: true\r\n };\r\n }\r\n\r\n LetterProps.prototype.update = function (o, sw, sc, fc, m, p) {\r\n this._mdf.o = false;\r\n this._mdf.sw = false;\r\n this._mdf.sc = false;\r\n this._mdf.fc = false;\r\n this._mdf.m = false;\r\n this._mdf.p = false;\r\n var updated = false;\r\n\r\n if (this.o !== o) {\r\n this.o = o;\r\n this._mdf.o = true;\r\n updated = true;\r\n }\r\n\r\n if (this.sw !== sw) {\r\n this.sw = sw;\r\n this._mdf.sw = true;\r\n updated = true;\r\n }\r\n\r\n if (this.sc !== sc) {\r\n this.sc = sc;\r\n this._mdf.sc = true;\r\n updated = true;\r\n }\r\n\r\n if (this.fc !== fc) {\r\n this.fc = fc;\r\n this._mdf.fc = true;\r\n updated = true;\r\n }\r\n\r\n if (this.m !== m) {\r\n this.m = m;\r\n this._mdf.m = true;\r\n updated = true;\r\n }\r\n\r\n if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {\r\n this.p = p;\r\n this._mdf.p = true;\r\n updated = true;\r\n }\r\n\r\n return updated;\r\n };\r\n\r\n function TextProperty(elem, data) {\r\n this._frameId = initialDefaultFrame;\r\n this.pv = '';\r\n this.v = '';\r\n this.kf = false;\r\n this._isFirstFrame = true;\r\n this._mdf = false;\r\n this.data = data;\r\n this.elem = elem;\r\n this.comp = this.elem.comp;\r\n this.keysIndex = 0;\r\n this.canResize = false;\r\n this.minimumFontSize = 1;\r\n this.effectsSequence = [];\r\n this.currentData = {\r\n ascent: 0,\r\n boxWidth: this.defaultBoxWidth,\r\n f: '',\r\n fStyle: '',\r\n fWeight: '',\r\n fc: '',\r\n j: '',\r\n justifyOffset: '',\r\n l: [],\r\n lh: 0,\r\n lineWidths: [],\r\n ls: '',\r\n of: '',\r\n s: '',\r\n sc: '',\r\n sw: 0,\r\n t: 0,\r\n tr: 0,\r\n sz: 0,\r\n ps: null,\r\n fillColorAnim: false,\r\n strokeColorAnim: false,\r\n strokeWidthAnim: false,\r\n yOffset: 0,\r\n finalSize: 0,\r\n finalText: [],\r\n finalLineHeight: 0,\r\n __complete: false\r\n };\r\n this.copyData(this.currentData, this.data.d.k[0].s);\r\n\r\n if (!this.searchProperty()) {\r\n this.completeTextData(this.currentData);\r\n }\r\n }\r\n\r\n TextProperty.prototype.defaultBoxWidth = [0, 0];\r\n\r\n TextProperty.prototype.copyData = function (obj, data) {\r\n for (var s in data) {\r\n if (Object.prototype.hasOwnProperty.call(data, s)) {\r\n obj[s] = data[s];\r\n }\r\n }\r\n\r\n return obj;\r\n };\r\n\r\n TextProperty.prototype.setCurrentData = function (data) {\r\n if (!data.__complete) {\r\n this.completeTextData(data);\r\n }\r\n\r\n this.currentData = data;\r\n this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;\r\n this._mdf = true;\r\n };\r\n\r\n TextProperty.prototype.searchProperty = function () {\r\n return this.searchKeyframes();\r\n };\r\n\r\n TextProperty.prototype.searchKeyframes = function () {\r\n this.kf = this.data.d.k.length > 1;\r\n\r\n if (this.kf) {\r\n this.addEffect(this.getKeyframeValue.bind(this));\r\n }\r\n\r\n return this.kf;\r\n };\r\n\r\n TextProperty.prototype.addEffect = function (effectFunction) {\r\n this.effectsSequence.push(effectFunction);\r\n this.elem.addDynamicProperty(this);\r\n };\r\n\r\n TextProperty.prototype.getValue = function (_finalValue) {\r\n if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {\r\n return;\r\n }\r\n\r\n this.currentData.t = this.data.d.k[this.keysIndex].s.t;\r\n var currentValue = this.currentData;\r\n var currentIndex = this.keysIndex;\r\n\r\n if (this.lock) {\r\n this.setCurrentData(this.currentData);\r\n return;\r\n }\r\n\r\n this.lock = true;\r\n this._mdf = false;\r\n var i;\r\n var len = this.effectsSequence.length;\r\n var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n // Checking if index changed to prevent creating a new object every time the expression updates.\r\n if (currentIndex !== this.keysIndex) {\r\n finalValue = this.effectsSequence[i](finalValue, finalValue.t);\r\n } else {\r\n finalValue = this.effectsSequence[i](this.currentData, finalValue.t);\r\n }\r\n }\r\n\r\n if (currentValue !== finalValue) {\r\n this.setCurrentData(finalValue);\r\n }\r\n\r\n this.v = this.currentData;\r\n this.pv = this.v;\r\n this.lock = false;\r\n this.frameId = this.elem.globalData.frameId;\r\n };\r\n\r\n TextProperty.prototype.getKeyframeValue = function () {\r\n var textKeys = this.data.d.k;\r\n var frameNum = this.elem.comp.renderedFrame;\r\n var i = 0;\r\n var len = textKeys.length;\r\n\r\n while (i <= len - 1) {\r\n if (i === len - 1 || textKeys[i + 1].t > frameNum) {\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (this.keysIndex !== i) {\r\n this.keysIndex = i;\r\n }\r\n\r\n return this.data.d.k[this.keysIndex].s;\r\n };\r\n\r\n TextProperty.prototype.buildFinalText = function (text) {\r\n var charactersArray = [];\r\n var i = 0;\r\n var len = text.length;\r\n var charCode;\r\n var secondCharCode;\r\n var shouldCombine = false;\r\n\r\n while (i < len) {\r\n charCode = text.charCodeAt(i);\r\n\r\n if (FontManager.isCombinedCharacter(charCode)) {\r\n charactersArray[charactersArray.length - 1] += text.charAt(i);\r\n } else if (charCode >= 0xD800 && charCode <= 0xDBFF) {\r\n secondCharCode = text.charCodeAt(i + 1);\r\n\r\n if (secondCharCode >= 0xDC00 && secondCharCode <= 0xDFFF) {\r\n if (shouldCombine || FontManager.isModifier(charCode, secondCharCode)) {\r\n charactersArray[charactersArray.length - 1] += text.substr(i, 2);\r\n shouldCombine = false;\r\n } else {\r\n charactersArray.push(text.substr(i, 2));\r\n }\r\n\r\n i += 1;\r\n } else {\r\n charactersArray.push(text.charAt(i));\r\n }\r\n } else if (charCode > 0xDBFF) {\r\n secondCharCode = text.charCodeAt(i + 1);\r\n\r\n if (FontManager.isZeroWidthJoiner(charCode, secondCharCode)) {\r\n shouldCombine = true;\r\n charactersArray[charactersArray.length - 1] += text.substr(i, 2);\r\n i += 1;\r\n } else {\r\n charactersArray.push(text.charAt(i));\r\n }\r\n } else if (FontManager.isZeroWidthJoiner(charCode)) {\r\n charactersArray[charactersArray.length - 1] += text.charAt(i);\r\n shouldCombine = true;\r\n } else {\r\n charactersArray.push(text.charAt(i));\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return charactersArray;\r\n };\r\n\r\n TextProperty.prototype.completeTextData = function (documentData) {\r\n documentData.__complete = true;\r\n var fontManager = this.elem.globalData.fontManager;\r\n var data = this.data;\r\n var letters = [];\r\n var i;\r\n var len;\r\n var newLineFlag;\r\n var index = 0;\r\n var val;\r\n var anchorGrouping = data.m.g;\r\n var currentSize = 0;\r\n var currentPos = 0;\r\n var currentLine = 0;\r\n var lineWidths = [];\r\n var lineWidth = 0;\r\n var maxLineWidth = 0;\r\n var j;\r\n var jLen;\r\n var fontData = fontManager.getFontByName(documentData.f);\r\n var charData;\r\n var cLength = 0;\r\n var fontProps = getFontProperties(fontData);\r\n documentData.fWeight = fontProps.weight;\r\n documentData.fStyle = fontProps.style;\r\n documentData.finalSize = documentData.s;\r\n documentData.finalText = this.buildFinalText(documentData.t);\r\n len = documentData.finalText.length;\r\n documentData.finalLineHeight = documentData.lh;\r\n var trackingOffset = documentData.tr / 1000 * documentData.finalSize;\r\n var charCode;\r\n\r\n if (documentData.sz) {\r\n var flag = true;\r\n var boxWidth = documentData.sz[0];\r\n var boxHeight = documentData.sz[1];\r\n var currentHeight;\r\n var finalText;\r\n\r\n while (flag) {\r\n finalText = this.buildFinalText(documentData.t);\r\n currentHeight = 0;\r\n lineWidth = 0;\r\n len = finalText.length;\r\n trackingOffset = documentData.tr / 1000 * documentData.finalSize;\r\n var lastSpaceIndex = -1;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n charCode = finalText[i].charCodeAt(0);\r\n newLineFlag = false;\r\n\r\n if (finalText[i] === ' ') {\r\n lastSpaceIndex = i;\r\n } else if (charCode === 13 || charCode === 3) {\r\n lineWidth = 0;\r\n newLineFlag = true;\r\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\r\n }\r\n\r\n if (fontManager.chars) {\r\n charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);\r\n cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;\r\n } else {\r\n // tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;\r\n cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);\r\n }\r\n\r\n if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') {\r\n if (lastSpaceIndex === -1) {\r\n len += 1;\r\n } else {\r\n i = lastSpaceIndex;\r\n }\r\n\r\n currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2;\r\n finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\\r'); // finalText = finalText.substr(0,i) + \"\\r\" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);\r\n\r\n lastSpaceIndex = -1;\r\n lineWidth = 0;\r\n } else {\r\n lineWidth += cLength;\r\n lineWidth += trackingOffset;\r\n }\r\n }\r\n\r\n currentHeight += fontData.ascent * documentData.finalSize / 100;\r\n\r\n if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {\r\n documentData.finalSize -= 1;\r\n documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s;\r\n } else {\r\n documentData.finalText = finalText;\r\n len = documentData.finalText.length;\r\n flag = false;\r\n }\r\n }\r\n }\r\n\r\n lineWidth = -trackingOffset;\r\n cLength = 0;\r\n var uncollapsedSpaces = 0;\r\n var currentChar;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n newLineFlag = false;\r\n currentChar = documentData.finalText[i];\r\n charCode = currentChar.charCodeAt(0);\r\n\r\n if (charCode === 13 || charCode === 3) {\r\n uncollapsedSpaces = 0;\r\n lineWidths.push(lineWidth);\r\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\r\n lineWidth = -2 * trackingOffset;\r\n val = '';\r\n newLineFlag = true;\r\n currentLine += 1;\r\n } else {\r\n val = currentChar;\r\n }\r\n\r\n if (fontManager.chars) {\r\n charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);\r\n cLength = newLineFlag ? 0 : charData.w * documentData.finalSize / 100;\r\n } else {\r\n // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);\r\n // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;\r\n cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);\r\n } //\r\n\r\n\r\n if (currentChar === ' ') {\r\n uncollapsedSpaces += cLength + trackingOffset;\r\n } else {\r\n lineWidth += cLength + trackingOffset + uncollapsedSpaces;\r\n uncollapsedSpaces = 0;\r\n }\r\n\r\n letters.push({\r\n l: cLength,\r\n an: cLength,\r\n add: currentSize,\r\n n: newLineFlag,\r\n anIndexes: [],\r\n val: val,\r\n line: currentLine,\r\n animatorJustifyOffset: 0\r\n });\r\n\r\n if (anchorGrouping == 2) {\r\n // eslint-disable-line eqeqeq\r\n currentSize += cLength;\r\n\r\n if (val === '' || val === ' ' || i === len - 1) {\r\n if (val === '' || val === ' ') {\r\n currentSize -= cLength;\r\n }\r\n\r\n while (currentPos <= i) {\r\n letters[currentPos].an = currentSize;\r\n letters[currentPos].ind = index;\r\n letters[currentPos].extra = cLength;\r\n currentPos += 1;\r\n }\r\n\r\n index += 1;\r\n currentSize = 0;\r\n }\r\n } else if (anchorGrouping == 3) {\r\n // eslint-disable-line eqeqeq\r\n currentSize += cLength;\r\n\r\n if (val === '' || i === len - 1) {\r\n if (val === '') {\r\n currentSize -= cLength;\r\n }\r\n\r\n while (currentPos <= i) {\r\n letters[currentPos].an = currentSize;\r\n letters[currentPos].ind = index;\r\n letters[currentPos].extra = cLength;\r\n currentPos += 1;\r\n }\r\n\r\n currentSize = 0;\r\n index += 1;\r\n }\r\n } else {\r\n letters[index].ind = index;\r\n letters[index].extra = 0;\r\n index += 1;\r\n }\r\n }\r\n\r\n documentData.l = letters;\r\n maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;\r\n lineWidths.push(lineWidth);\r\n\r\n if (documentData.sz) {\r\n documentData.boxWidth = documentData.sz[0];\r\n documentData.justifyOffset = 0;\r\n } else {\r\n documentData.boxWidth = maxLineWidth;\r\n\r\n switch (documentData.j) {\r\n case 1:\r\n documentData.justifyOffset = -documentData.boxWidth;\r\n break;\r\n\r\n case 2:\r\n documentData.justifyOffset = -documentData.boxWidth / 2;\r\n break;\r\n\r\n default:\r\n documentData.justifyOffset = 0;\r\n }\r\n }\r\n\r\n documentData.lineWidths = lineWidths;\r\n var animators = data.a;\r\n var animatorData;\r\n var letterData;\r\n jLen = animators.length;\r\n var based;\r\n var ind;\r\n var indexes = [];\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorData = animators[j];\r\n\r\n if (animatorData.a.sc) {\r\n documentData.strokeColorAnim = true;\r\n }\r\n\r\n if (animatorData.a.sw) {\r\n documentData.strokeWidthAnim = true;\r\n }\r\n\r\n if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) {\r\n documentData.fillColorAnim = true;\r\n }\r\n\r\n ind = 0;\r\n based = animatorData.s.b;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n letterData = letters[i];\r\n letterData.anIndexes[j] = ind;\r\n\r\n if (based == 1 && letterData.val !== '' || based == 2 && letterData.val !== '' && letterData.val !== ' ' || based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1) || based == 4 && (letterData.n || i == len - 1)) {\r\n // eslint-disable-line eqeqeq\r\n if (animatorData.s.rn === 1) {\r\n indexes.push(ind);\r\n }\r\n\r\n ind += 1;\r\n }\r\n }\r\n\r\n data.a[j].s.totalChars = ind;\r\n var currentInd = -1;\r\n var newInd;\r\n\r\n if (animatorData.s.rn === 1) {\r\n for (i = 0; i < len; i += 1) {\r\n letterData = letters[i];\r\n\r\n if (currentInd != letterData.anIndexes[j]) {\r\n // eslint-disable-line eqeqeq\r\n currentInd = letterData.anIndexes[j];\r\n newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0];\r\n }\r\n\r\n letterData.anIndexes[j] = newInd;\r\n }\r\n }\r\n }\r\n\r\n documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2;\r\n documentData.ls = documentData.ls || 0;\r\n documentData.ascent = fontData.ascent * documentData.finalSize / 100;\r\n };\r\n\r\n TextProperty.prototype.updateDocumentData = function (newData, index) {\r\n index = index === undefined ? this.keysIndex : index;\r\n var dData = this.copyData({}, this.data.d.k[index].s);\r\n dData = this.copyData(dData, newData);\r\n this.data.d.k[index].s = dData;\r\n this.recalculate(index);\r\n this.elem.addDynamicProperty(this);\r\n };\r\n\r\n TextProperty.prototype.recalculate = function (index) {\r\n var dData = this.data.d.k[index].s;\r\n dData.__complete = false;\r\n this.keysIndex = 0;\r\n this._isFirstFrame = true;\r\n this.getValue(dData);\r\n };\r\n\r\n TextProperty.prototype.canResizeFont = function (_canResize) {\r\n this.canResize = _canResize;\r\n this.recalculate(this.keysIndex);\r\n this.elem.addDynamicProperty(this);\r\n };\r\n\r\n TextProperty.prototype.setMinimumFontSize = function (_fontValue) {\r\n this.minimumFontSize = Math.floor(_fontValue) || 1;\r\n this.recalculate(this.keysIndex);\r\n this.elem.addDynamicProperty(this);\r\n };\r\n\r\n var TextSelectorProp = function () {\r\n var max = Math.max;\r\n var min = Math.min;\r\n var floor = Math.floor;\r\n\r\n function TextSelectorPropFactory(elem, data) {\r\n this._currentTextLength = -1;\r\n this.k = false;\r\n this.data = data;\r\n this.elem = elem;\r\n this.comp = elem.comp;\r\n this.finalS = 0;\r\n this.finalE = 0;\r\n this.initDynamicPropertyContainer(elem);\r\n this.s = PropertyFactory.getProp(elem, data.s || {\r\n k: 0\r\n }, 0, 0, this);\r\n\r\n if ('e' in data) {\r\n this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this);\r\n } else {\r\n this.e = {\r\n v: 100\r\n };\r\n }\r\n\r\n this.o = PropertyFactory.getProp(elem, data.o || {\r\n k: 0\r\n }, 0, 0, this);\r\n this.xe = PropertyFactory.getProp(elem, data.xe || {\r\n k: 0\r\n }, 0, 0, this);\r\n this.ne = PropertyFactory.getProp(elem, data.ne || {\r\n k: 0\r\n }, 0, 0, this);\r\n this.sm = PropertyFactory.getProp(elem, data.sm || {\r\n k: 100\r\n }, 0, 0, this);\r\n this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this);\r\n\r\n if (!this.dynamicProperties.length) {\r\n this.getValue();\r\n }\r\n }\r\n\r\n TextSelectorPropFactory.prototype = {\r\n getMult: function getMult(ind) {\r\n if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) {\r\n this.getValue();\r\n }\r\n\r\n var x1 = 0;\r\n var y1 = 0;\r\n var x2 = 1;\r\n var y2 = 1;\r\n\r\n if (this.ne.v > 0) {\r\n x1 = this.ne.v / 100.0;\r\n } else {\r\n y1 = -this.ne.v / 100.0;\r\n }\r\n\r\n if (this.xe.v > 0) {\r\n x2 = 1.0 - this.xe.v / 100.0;\r\n } else {\r\n y2 = 1.0 + this.xe.v / 100.0;\r\n }\r\n\r\n var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get;\r\n var mult = 0;\r\n var s = this.finalS;\r\n var e = this.finalE;\r\n var type = this.data.sh;\r\n\r\n if (type === 2) {\r\n if (e === s) {\r\n mult = ind >= e ? 1 : 0;\r\n } else {\r\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\r\n }\r\n\r\n mult = easer(mult);\r\n } else if (type === 3) {\r\n if (e === s) {\r\n mult = ind >= e ? 0 : 1;\r\n } else {\r\n mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\r\n }\r\n\r\n mult = easer(mult);\r\n } else if (type === 4) {\r\n if (e === s) {\r\n mult = 0;\r\n } else {\r\n mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1));\r\n\r\n if (mult < 0.5) {\r\n mult *= 2;\r\n } else {\r\n mult = 1 - 2 * (mult - 0.5);\r\n }\r\n }\r\n\r\n mult = easer(mult);\r\n } else if (type === 5) {\r\n if (e === s) {\r\n mult = 0;\r\n } else {\r\n var tot = e - s;\r\n /* ind += 0.5;\r\n mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */\r\n\r\n ind = min(max(0, ind + 0.5 - s), e - s);\r\n var x = -tot / 2 + ind;\r\n var a = tot / 2;\r\n mult = Math.sqrt(1 - x * x / (a * a));\r\n }\r\n\r\n mult = easer(mult);\r\n } else if (type === 6) {\r\n if (e === s) {\r\n mult = 0;\r\n } else {\r\n ind = min(max(0, ind + 0.5 - s), e - s);\r\n mult = (1 + Math.cos(Math.PI + Math.PI * 2 * ind / (e - s))) / 2; // eslint-disable-line\r\n }\r\n\r\n mult = easer(mult);\r\n } else {\r\n if (ind >= floor(s)) {\r\n if (ind - s < 0) {\r\n mult = max(0, min(min(e, 1) - (s - ind), 1));\r\n } else {\r\n mult = max(0, min(e - ind, 1));\r\n }\r\n }\r\n\r\n mult = easer(mult);\r\n } // Smoothness implementation.\r\n // The smoothness represents a reduced range of the original [0; 1] range.\r\n // if smoothness is 25%, the new range will be [0.375; 0.625]\r\n // Steps are:\r\n // - find the lower value of the new range (threshold)\r\n // - if multiplier is smaller than that value, floor it to 0\r\n // - if it is larger,\r\n // - subtract the threshold\r\n // - divide it by the smoothness (this will return the range to [0; 1])\r\n // Note: If it doesn't work on some scenarios, consider applying it before the easer.\r\n\r\n\r\n if (this.sm.v !== 100) {\r\n var smoothness = this.sm.v * 0.01;\r\n\r\n if (smoothness === 0) {\r\n smoothness = 0.00000001;\r\n }\r\n\r\n var threshold = 0.5 - smoothness * 0.5;\r\n\r\n if (mult < threshold) {\r\n mult = 0;\r\n } else {\r\n mult = (mult - threshold) / smoothness;\r\n\r\n if (mult > 1) {\r\n mult = 1;\r\n }\r\n }\r\n }\r\n\r\n return mult * this.a.v;\r\n },\r\n getValue: function getValue(newCharsFlag) {\r\n this.iterateDynamicProperties();\r\n this._mdf = newCharsFlag || this._mdf;\r\n this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;\r\n\r\n if (newCharsFlag && this.data.r === 2) {\r\n this.e.v = this._currentTextLength;\r\n }\r\n\r\n var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;\r\n var o = this.o.v / divisor;\r\n var s = this.s.v / divisor + o;\r\n var e = this.e.v / divisor + o;\r\n\r\n if (s > e) {\r\n var _s = s;\r\n s = e;\r\n e = _s;\r\n }\r\n\r\n this.finalS = s;\r\n this.finalE = e;\r\n }\r\n };\r\n extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory);\r\n\r\n function getTextSelectorProp(elem, data, arr) {\r\n return new TextSelectorPropFactory(elem, data, arr);\r\n }\r\n\r\n return {\r\n getTextSelectorProp: getTextSelectorProp\r\n };\r\n }();\r\n\r\n function TextAnimatorDataProperty(elem, animatorProps, container) {\r\n var defaultData = {\r\n propType: false\r\n };\r\n var getProp = PropertyFactory.getProp;\r\n var textAnimatorAnimatables = animatorProps.a;\r\n this.a = {\r\n r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData,\r\n rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData,\r\n ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData,\r\n sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData,\r\n sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData,\r\n s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData,\r\n a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData,\r\n o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData,\r\n p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData,\r\n sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData,\r\n sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData,\r\n fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData,\r\n fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData,\r\n fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData,\r\n fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData,\r\n t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData\r\n };\r\n this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container);\r\n this.s.t = animatorProps.s.t;\r\n }\r\n\r\n function TextAnimatorProperty(textData, renderType, elem) {\r\n this._isFirstFrame = true;\r\n this._hasMaskedPath = false;\r\n this._frameId = -1;\r\n this._textData = textData;\r\n this._renderType = renderType;\r\n this._elem = elem;\r\n this._animatorsData = createSizedArray(this._textData.a.length);\r\n this._pathData = {};\r\n this._moreOptions = {\r\n alignment: {}\r\n };\r\n this.renderedLetters = [];\r\n this.lettersChangedFlag = false;\r\n this.initDynamicPropertyContainer(elem);\r\n }\r\n\r\n TextAnimatorProperty.prototype.searchProperties = function () {\r\n var i;\r\n var len = this._textData.a.length;\r\n var animatorProps;\r\n var getProp = PropertyFactory.getProp;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n animatorProps = this._textData.a[i];\r\n this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);\r\n }\r\n\r\n if (this._textData.p && 'm' in this._textData.p) {\r\n this._pathData = {\r\n a: getProp(this._elem, this._textData.p.a, 0, 0, this),\r\n f: getProp(this._elem, this._textData.p.f, 0, 0, this),\r\n l: getProp(this._elem, this._textData.p.l, 0, 0, this),\r\n r: getProp(this._elem, this._textData.p.r, 0, 0, this),\r\n p: getProp(this._elem, this._textData.p.p, 0, 0, this),\r\n m: this._elem.maskManager.getMaskProperty(this._textData.p.m)\r\n };\r\n this._hasMaskedPath = true;\r\n } else {\r\n this._hasMaskedPath = false;\r\n }\r\n\r\n this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this);\r\n };\r\n\r\n TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) {\r\n this.lettersChangedFlag = lettersChangedFlag;\r\n\r\n if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {\r\n return;\r\n }\r\n\r\n this._isFirstFrame = false;\r\n var alignment = this._moreOptions.alignment.v;\r\n var animators = this._animatorsData;\r\n var textData = this._textData;\r\n var matrixHelper = this.mHelper;\r\n var renderType = this._renderType;\r\n var renderedLettersCount = this.renderedLetters.length;\r\n var xPos;\r\n var yPos;\r\n var i;\r\n var len;\r\n var letters = documentData.l;\r\n var pathInfo;\r\n var currentLength;\r\n var currentPoint;\r\n var segmentLength;\r\n var flag;\r\n var pointInd;\r\n var segmentInd;\r\n var prevPoint;\r\n var points;\r\n var segments;\r\n var partialLength;\r\n var totalLength;\r\n var perc;\r\n var tanAngle;\r\n var mask;\r\n\r\n if (this._hasMaskedPath) {\r\n mask = this._pathData.m;\r\n\r\n if (!this._pathData.n || this._pathData._mdf) {\r\n var paths = mask.v;\r\n\r\n if (this._pathData.r.v) {\r\n paths = paths.reverse();\r\n } // TODO: release bezier data cached from previous pathInfo: this._pathData.pi\r\n\r\n\r\n pathInfo = {\r\n tLength: 0,\r\n segments: []\r\n };\r\n len = paths._length - 1;\r\n var bezierData;\r\n totalLength = 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n bezierData = bez.buildBezierData(paths.v[i], paths.v[i + 1], [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);\r\n pathInfo.tLength += bezierData.segmentLength;\r\n pathInfo.segments.push(bezierData);\r\n totalLength += bezierData.segmentLength;\r\n }\r\n\r\n i = len;\r\n\r\n if (mask.v.c) {\r\n bezierData = bez.buildBezierData(paths.v[i], paths.v[0], [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);\r\n pathInfo.tLength += bezierData.segmentLength;\r\n pathInfo.segments.push(bezierData);\r\n totalLength += bezierData.segmentLength;\r\n }\r\n\r\n this._pathData.pi = pathInfo;\r\n }\r\n\r\n pathInfo = this._pathData.pi;\r\n currentLength = this._pathData.f.v;\r\n segmentInd = 0;\r\n pointInd = 1;\r\n segmentLength = 0;\r\n flag = true;\r\n segments = pathInfo.segments;\r\n\r\n if (currentLength < 0 && mask.v.c) {\r\n if (pathInfo.tLength < Math.abs(currentLength)) {\r\n currentLength = -Math.abs(currentLength) % pathInfo.tLength;\r\n }\r\n\r\n segmentInd = segments.length - 1;\r\n points = segments[segmentInd].points;\r\n pointInd = points.length - 1;\r\n\r\n while (currentLength < 0) {\r\n currentLength += points[pointInd].partialLength;\r\n pointInd -= 1;\r\n\r\n if (pointInd < 0) {\r\n segmentInd -= 1;\r\n points = segments[segmentInd].points;\r\n pointInd = points.length - 1;\r\n }\r\n }\r\n }\r\n\r\n points = segments[segmentInd].points;\r\n prevPoint = points[pointInd - 1];\r\n currentPoint = points[pointInd];\r\n partialLength = currentPoint.partialLength;\r\n }\r\n\r\n len = letters.length;\r\n xPos = 0;\r\n yPos = 0;\r\n var yOff = documentData.finalSize * 1.2 * 0.714;\r\n var firstLine = true;\r\n var animatorProps;\r\n var animatorSelector;\r\n var j;\r\n var jLen;\r\n var letterValue;\r\n jLen = animators.length;\r\n var mult;\r\n var ind = -1;\r\n var offf;\r\n var xPathPos;\r\n var yPathPos;\r\n var initPathPos = currentLength;\r\n var initSegmentInd = segmentInd;\r\n var initPointInd = pointInd;\r\n var currentLine = -1;\r\n var elemOpacity;\r\n var sc;\r\n var sw;\r\n var fc;\r\n var k;\r\n var letterSw;\r\n var letterSc;\r\n var letterFc;\r\n var letterM = '';\r\n var letterP = this.defaultPropsArray;\r\n var letterO; //\r\n\r\n if (documentData.j === 2 || documentData.j === 1) {\r\n var animatorJustifyOffset = 0;\r\n var animatorFirstCharOffset = 0;\r\n var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;\r\n var lastIndex = 0;\r\n var isNewLine = true;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (letters[i].n) {\r\n if (animatorJustifyOffset) {\r\n animatorJustifyOffset += animatorFirstCharOffset;\r\n }\r\n\r\n while (lastIndex < i) {\r\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\r\n lastIndex += 1;\r\n }\r\n\r\n animatorJustifyOffset = 0;\r\n isNewLine = true;\r\n } else {\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorProps = animators[j].a;\r\n\r\n if (animatorProps.t.propType) {\r\n if (isNewLine && documentData.j === 2) {\r\n animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;\r\n }\r\n\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n if (mult.length) {\r\n animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult;\r\n } else {\r\n animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult;\r\n }\r\n }\r\n }\r\n\r\n isNewLine = false;\r\n }\r\n }\r\n\r\n if (animatorJustifyOffset) {\r\n animatorJustifyOffset += animatorFirstCharOffset;\r\n }\r\n\r\n while (lastIndex < i) {\r\n letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;\r\n lastIndex += 1;\r\n }\r\n } //\r\n\r\n\r\n for (i = 0; i < len; i += 1) {\r\n matrixHelper.reset();\r\n elemOpacity = 1;\r\n\r\n if (letters[i].n) {\r\n xPos = 0;\r\n yPos += documentData.yOffset;\r\n yPos += firstLine ? 1 : 0;\r\n currentLength = initPathPos;\r\n firstLine = false;\r\n\r\n if (this._hasMaskedPath) {\r\n segmentInd = initSegmentInd;\r\n pointInd = initPointInd;\r\n points = segments[segmentInd].points;\r\n prevPoint = points[pointInd - 1];\r\n currentPoint = points[pointInd];\r\n partialLength = currentPoint.partialLength;\r\n segmentLength = 0;\r\n }\r\n\r\n letterM = '';\r\n letterFc = '';\r\n letterSw = '';\r\n letterO = '';\r\n letterP = this.defaultPropsArray;\r\n } else {\r\n if (this._hasMaskedPath) {\r\n if (currentLine !== letters[i].line) {\r\n switch (documentData.j) {\r\n case 1:\r\n currentLength += totalLength - documentData.lineWidths[letters[i].line];\r\n break;\r\n\r\n case 2:\r\n currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2;\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n\r\n currentLine = letters[i].line;\r\n }\r\n\r\n if (ind !== letters[i].ind) {\r\n if (letters[ind]) {\r\n currentLength += letters[ind].extra;\r\n }\r\n\r\n currentLength += letters[i].an / 2;\r\n ind = letters[i].ind;\r\n }\r\n\r\n currentLength += alignment[0] * letters[i].an * 0.005;\r\n var animatorOffset = 0;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorProps = animators[j].a;\r\n\r\n if (animatorProps.p.propType) {\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n if (mult.length) {\r\n animatorOffset += animatorProps.p.v[0] * mult[0];\r\n } else {\r\n animatorOffset += animatorProps.p.v[0] * mult;\r\n }\r\n }\r\n\r\n if (animatorProps.a.propType) {\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n if (mult.length) {\r\n animatorOffset += animatorProps.a.v[0] * mult[0];\r\n } else {\r\n animatorOffset += animatorProps.a.v[0] * mult;\r\n }\r\n }\r\n }\r\n\r\n flag = true; // Force alignment only works with a single line for now\r\n\r\n if (this._pathData.a.v) {\r\n currentLength = letters[0].an * 0.5 + (totalLength - this._pathData.f.v - letters[0].an * 0.5 - letters[letters.length - 1].an * 0.5) * ind / (len - 1);\r\n currentLength += this._pathData.f.v;\r\n }\r\n\r\n while (flag) {\r\n if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {\r\n perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;\r\n xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;\r\n yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;\r\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -(alignment[1] * yOff) * 0.01);\r\n flag = false;\r\n } else if (points) {\r\n segmentLength += currentPoint.partialLength;\r\n pointInd += 1;\r\n\r\n if (pointInd >= points.length) {\r\n pointInd = 0;\r\n segmentInd += 1;\r\n\r\n if (!segments[segmentInd]) {\r\n if (mask.v.c) {\r\n pointInd = 0;\r\n segmentInd = 0;\r\n points = segments[segmentInd].points;\r\n } else {\r\n segmentLength -= currentPoint.partialLength;\r\n points = null;\r\n }\r\n } else {\r\n points = segments[segmentInd].points;\r\n }\r\n }\r\n\r\n if (points) {\r\n prevPoint = currentPoint;\r\n currentPoint = points[pointInd];\r\n partialLength = currentPoint.partialLength;\r\n }\r\n }\r\n }\r\n\r\n offf = letters[i].an / 2 - letters[i].add;\r\n matrixHelper.translate(-offf, 0, 0);\r\n } else {\r\n offf = letters[i].an / 2 - letters[i].add;\r\n matrixHelper.translate(-offf, 0, 0); // Grouping alignment\r\n\r\n matrixHelper.translate(-alignment[0] * letters[i].an * 0.005, -alignment[1] * yOff * 0.01, 0);\r\n }\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorProps = animators[j].a;\r\n\r\n if (animatorProps.t.propType) {\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); // This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean \"isNewLine\"\r\n\r\n if (xPos !== 0 || documentData.j !== 0) {\r\n if (this._hasMaskedPath) {\r\n if (mult.length) {\r\n currentLength += animatorProps.t.v * mult[0];\r\n } else {\r\n currentLength += animatorProps.t.v * mult;\r\n }\r\n } else if (mult.length) {\r\n xPos += animatorProps.t.v * mult[0];\r\n } else {\r\n xPos += animatorProps.t.v * mult;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (documentData.strokeWidthAnim) {\r\n sw = documentData.sw || 0;\r\n }\r\n\r\n if (documentData.strokeColorAnim) {\r\n if (documentData.sc) {\r\n sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];\r\n } else {\r\n sc = [0, 0, 0];\r\n }\r\n }\r\n\r\n if (documentData.fillColorAnim && documentData.fc) {\r\n fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];\r\n }\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorProps = animators[j].a;\r\n\r\n if (animatorProps.a.propType) {\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n if (mult.length) {\r\n matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]);\r\n } else {\r\n matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult);\r\n }\r\n }\r\n }\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorProps = animators[j].a;\r\n\r\n if (animatorProps.s.propType) {\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n if (mult.length) {\r\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult[0], 1 + (animatorProps.s.v[1] - 1) * mult[1], 1);\r\n } else {\r\n matrixHelper.scale(1 + (animatorProps.s.v[0] - 1) * mult, 1 + (animatorProps.s.v[1] - 1) * mult, 1);\r\n }\r\n }\r\n }\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorProps = animators[j].a;\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n if (animatorProps.sk.propType) {\r\n if (mult.length) {\r\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);\r\n } else {\r\n matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);\r\n }\r\n }\r\n\r\n if (animatorProps.r.propType) {\r\n if (mult.length) {\r\n matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);\r\n } else {\r\n matrixHelper.rotateZ(-animatorProps.r.v * mult);\r\n }\r\n }\r\n\r\n if (animatorProps.ry.propType) {\r\n if (mult.length) {\r\n matrixHelper.rotateY(animatorProps.ry.v * mult[1]);\r\n } else {\r\n matrixHelper.rotateY(animatorProps.ry.v * mult);\r\n }\r\n }\r\n\r\n if (animatorProps.rx.propType) {\r\n if (mult.length) {\r\n matrixHelper.rotateX(animatorProps.rx.v * mult[0]);\r\n } else {\r\n matrixHelper.rotateX(animatorProps.rx.v * mult);\r\n }\r\n }\r\n\r\n if (animatorProps.o.propType) {\r\n if (mult.length) {\r\n elemOpacity += (animatorProps.o.v * mult[0] - elemOpacity) * mult[0];\r\n } else {\r\n elemOpacity += (animatorProps.o.v * mult - elemOpacity) * mult;\r\n }\r\n }\r\n\r\n if (documentData.strokeWidthAnim && animatorProps.sw.propType) {\r\n if (mult.length) {\r\n sw += animatorProps.sw.v * mult[0];\r\n } else {\r\n sw += animatorProps.sw.v * mult;\r\n }\r\n }\r\n\r\n if (documentData.strokeColorAnim && animatorProps.sc.propType) {\r\n for (k = 0; k < 3; k += 1) {\r\n if (mult.length) {\r\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0];\r\n } else {\r\n sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult;\r\n }\r\n }\r\n }\r\n\r\n if (documentData.fillColorAnim && documentData.fc) {\r\n if (animatorProps.fc.propType) {\r\n for (k = 0; k < 3; k += 1) {\r\n if (mult.length) {\r\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0];\r\n } else {\r\n fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult;\r\n }\r\n }\r\n }\r\n\r\n if (animatorProps.fh.propType) {\r\n if (mult.length) {\r\n fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]);\r\n } else {\r\n fc = addHueToRGB(fc, animatorProps.fh.v * mult);\r\n }\r\n }\r\n\r\n if (animatorProps.fs.propType) {\r\n if (mult.length) {\r\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]);\r\n } else {\r\n fc = addSaturationToRGB(fc, animatorProps.fs.v * mult);\r\n }\r\n }\r\n\r\n if (animatorProps.fb.propType) {\r\n if (mult.length) {\r\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]);\r\n } else {\r\n fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult);\r\n }\r\n }\r\n }\r\n }\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n animatorProps = animators[j].a;\r\n\r\n if (animatorProps.p.propType) {\r\n animatorSelector = animators[j].s;\r\n mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);\r\n\r\n if (this._hasMaskedPath) {\r\n if (mult.length) {\r\n matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);\r\n } else {\r\n matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\r\n }\r\n } else if (mult.length) {\r\n matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);\r\n } else {\r\n matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);\r\n }\r\n }\r\n }\r\n\r\n if (documentData.strokeWidthAnim) {\r\n letterSw = sw < 0 ? 0 : sw;\r\n }\r\n\r\n if (documentData.strokeColorAnim) {\r\n letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')';\r\n }\r\n\r\n if (documentData.fillColorAnim && documentData.fc) {\r\n letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')';\r\n }\r\n\r\n if (this._hasMaskedPath) {\r\n matrixHelper.translate(0, -documentData.ls);\r\n matrixHelper.translate(0, alignment[1] * yOff * 0.01 + yPos, 0);\r\n\r\n if (this._pathData.p.v) {\r\n tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);\r\n var rot = Math.atan(tanAngle) * 180 / Math.PI;\r\n\r\n if (currentPoint.point[0] < prevPoint.point[0]) {\r\n rot += 180;\r\n }\r\n\r\n matrixHelper.rotate(-rot * Math.PI / 180);\r\n }\r\n\r\n matrixHelper.translate(xPathPos, yPathPos, 0);\r\n currentLength -= alignment[0] * letters[i].an * 0.005;\r\n\r\n if (letters[i + 1] && ind !== letters[i + 1].ind) {\r\n currentLength += letters[i].an / 2;\r\n currentLength += documentData.tr * 0.001 * documentData.finalSize;\r\n }\r\n } else {\r\n matrixHelper.translate(xPos, yPos, 0);\r\n\r\n if (documentData.ps) {\r\n // matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);\r\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\r\n }\r\n\r\n switch (documentData.j) {\r\n case 1:\r\n matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0);\r\n break;\r\n\r\n case 2:\r\n matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0);\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n\r\n matrixHelper.translate(0, -documentData.ls);\r\n matrixHelper.translate(offf, 0, 0);\r\n matrixHelper.translate(alignment[0] * letters[i].an * 0.005, alignment[1] * yOff * 0.01, 0);\r\n xPos += letters[i].l + documentData.tr * 0.001 * documentData.finalSize;\r\n }\r\n\r\n if (renderType === 'html') {\r\n letterM = matrixHelper.toCSS();\r\n } else if (renderType === 'svg') {\r\n letterM = matrixHelper.to2dCSS();\r\n } else {\r\n letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]];\r\n }\r\n\r\n letterO = elemOpacity;\r\n }\r\n\r\n if (renderedLettersCount <= i) {\r\n letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP);\r\n this.renderedLetters.push(letterValue);\r\n renderedLettersCount += 1;\r\n this.lettersChangedFlag = true;\r\n } else {\r\n letterValue = this.renderedLetters[i];\r\n this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;\r\n }\r\n }\r\n };\r\n\r\n TextAnimatorProperty.prototype.getValue = function () {\r\n if (this._elem.globalData.frameId === this._frameId) {\r\n return;\r\n }\r\n\r\n this._frameId = this._elem.globalData.frameId;\r\n this.iterateDynamicProperties();\r\n };\r\n\r\n TextAnimatorProperty.prototype.mHelper = new Matrix();\r\n TextAnimatorProperty.prototype.defaultPropsArray = [];\r\n extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);\r\n\r\n function ITextElement() {}\r\n\r\n ITextElement.prototype.initElement = function (data, globalData, comp) {\r\n this.lettersChangedFlag = true;\r\n this.initFrame();\r\n this.initBaseData(data, globalData, comp);\r\n this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);\r\n this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);\r\n this.initTransform(data, globalData, comp);\r\n this.initHierarchy();\r\n this.initRenderable();\r\n this.initRendererElement();\r\n this.createContainerElements();\r\n this.createRenderableComponents();\r\n this.createContent();\r\n this.hide();\r\n this.textAnimator.searchProperties(this.dynamicProperties);\r\n };\r\n\r\n ITextElement.prototype.prepareFrame = function (num) {\r\n this._mdf = false;\r\n this.prepareRenderableFrame(num);\r\n this.prepareProperties(num, this.isInRange);\r\n\r\n if (this.textProperty._mdf || this.textProperty._isFirstFrame) {\r\n this.buildNewText();\r\n this.textProperty._isFirstFrame = false;\r\n this.textProperty._mdf = false;\r\n }\r\n };\r\n\r\n ITextElement.prototype.createPathShape = function (matrixHelper, shapes) {\r\n var j;\r\n var jLen = shapes.length;\r\n var pathNodes;\r\n var shapeStr = '';\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (shapes[j].ty === 'sh') {\r\n pathNodes = shapes[j].ks.k;\r\n shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);\r\n }\r\n }\r\n\r\n return shapeStr;\r\n };\r\n\r\n ITextElement.prototype.updateDocumentData = function (newData, index) {\r\n this.textProperty.updateDocumentData(newData, index);\r\n };\r\n\r\n ITextElement.prototype.canResizeFont = function (_canResize) {\r\n this.textProperty.canResizeFont(_canResize);\r\n };\r\n\r\n ITextElement.prototype.setMinimumFontSize = function (_fontSize) {\r\n this.textProperty.setMinimumFontSize(_fontSize);\r\n };\r\n\r\n ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) {\r\n if (documentData.ps) {\r\n matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0);\r\n }\r\n\r\n matrixHelper.translate(0, -documentData.ls, 0);\r\n\r\n switch (documentData.j) {\r\n case 1:\r\n matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0);\r\n break;\r\n\r\n case 2:\r\n matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0);\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n\r\n matrixHelper.translate(xPos, yPos, 0);\r\n };\r\n\r\n ITextElement.prototype.buildColor = function (colorData) {\r\n return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')';\r\n };\r\n\r\n ITextElement.prototype.emptyProp = new LetterProps();\r\n\r\n ITextElement.prototype.destroy = function () {};\r\n\r\n var emptyShapeData = {\r\n shapes: []\r\n };\r\n\r\n function SVGTextLottieElement(data, globalData, comp) {\r\n this.textSpans = [];\r\n this.renderType = 'svg';\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextLottieElement);\r\n\r\n SVGTextLottieElement.prototype.createContent = function () {\r\n if (this.data.singleShape && !this.globalData.fontManager.chars) {\r\n this.textContainer = createNS('text');\r\n }\r\n };\r\n\r\n SVGTextLottieElement.prototype.buildTextContents = function (textArray) {\r\n var i = 0;\r\n var len = textArray.length;\r\n var textContents = [];\r\n var currentTextContent = '';\r\n\r\n while (i < len) {\r\n if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {\r\n textContents.push(currentTextContent);\r\n currentTextContent = '';\r\n } else {\r\n currentTextContent += textArray[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n textContents.push(currentTextContent);\r\n return textContents;\r\n };\r\n\r\n SVGTextLottieElement.prototype.buildShapeData = function (data, scale) {\r\n // data should probably be cloned to apply scale separately to each instance of a text on different layers\r\n // but since text internal content gets only rendered once and then it's never rerendered,\r\n // it's probably safe not to clone data and reuse always the same instance even if the object is mutated.\r\n // Avoiding cloning is preferred since cloning each character shape data is expensive\r\n if (data.shapes && data.shapes.length) {\r\n var shape = data.shapes[0];\r\n\r\n if (shape.it) {\r\n var shapeItem = shape.it[shape.it.length - 1];\r\n\r\n if (shapeItem.s) {\r\n shapeItem.s.k[0] = scale;\r\n shapeItem.s.k[1] = scale;\r\n }\r\n }\r\n }\r\n\r\n return data;\r\n };\r\n\r\n SVGTextLottieElement.prototype.buildNewText = function () {\r\n this.addDynamicProperty(this);\r\n var i;\r\n var len;\r\n var documentData = this.textProperty.currentData;\r\n this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);\r\n\r\n if (documentData.fc) {\r\n this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));\r\n } else {\r\n this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');\r\n }\r\n\r\n if (documentData.sc) {\r\n this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));\r\n this.layerElement.setAttribute('stroke-width', documentData.sw);\r\n }\r\n\r\n this.layerElement.setAttribute('font-size', documentData.finalSize);\r\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\r\n\r\n if (fontData.fClass) {\r\n this.layerElement.setAttribute('class', fontData.fClass);\r\n } else {\r\n this.layerElement.setAttribute('font-family', fontData.fFamily);\r\n var fWeight = documentData.fWeight;\r\n var fStyle = documentData.fStyle;\r\n this.layerElement.setAttribute('font-style', fStyle);\r\n this.layerElement.setAttribute('font-weight', fWeight);\r\n }\r\n\r\n this.layerElement.setAttribute('aria-label', documentData.t);\r\n var letters = documentData.l || [];\r\n var usesGlyphs = !!this.globalData.fontManager.chars;\r\n len = letters.length;\r\n var tSpan;\r\n var matrixHelper = this.mHelper;\r\n var shapeStr = '';\r\n var singleShape = this.data.singleShape;\r\n var xPos = 0;\r\n var yPos = 0;\r\n var firstLine = true;\r\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\r\n\r\n if (singleShape && !usesGlyphs && !documentData.sz) {\r\n var tElement = this.textContainer;\r\n var justify = 'start';\r\n\r\n switch (documentData.j) {\r\n case 1:\r\n justify = 'end';\r\n break;\r\n\r\n case 2:\r\n justify = 'middle';\r\n break;\r\n\r\n default:\r\n justify = 'start';\r\n break;\r\n }\r\n\r\n tElement.setAttribute('text-anchor', justify);\r\n tElement.setAttribute('letter-spacing', trackingOffset);\r\n var textContent = this.buildTextContents(documentData.finalText);\r\n len = textContent.length;\r\n yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n tSpan = this.textSpans[i].span || createNS('tspan');\r\n tSpan.textContent = textContent[i];\r\n tSpan.setAttribute('x', 0);\r\n tSpan.setAttribute('y', yPos);\r\n tSpan.style.display = 'inherit';\r\n tElement.appendChild(tSpan);\r\n\r\n if (!this.textSpans[i]) {\r\n this.textSpans[i] = {\r\n span: null,\r\n glyph: null\r\n };\r\n }\r\n\r\n this.textSpans[i].span = tSpan;\r\n yPos += documentData.finalLineHeight;\r\n }\r\n\r\n this.layerElement.appendChild(tElement);\r\n } else {\r\n var cachedSpansLength = this.textSpans.length;\r\n var charData;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (!this.textSpans[i]) {\r\n this.textSpans[i] = {\r\n span: null,\r\n childSpan: null,\r\n glyph: null\r\n };\r\n }\r\n\r\n if (!usesGlyphs || !singleShape || i === 0) {\r\n tSpan = cachedSpansLength > i ? this.textSpans[i].span : createNS(usesGlyphs ? 'g' : 'text');\r\n\r\n if (cachedSpansLength <= i) {\r\n tSpan.setAttribute('stroke-linecap', 'butt');\r\n tSpan.setAttribute('stroke-linejoin', 'round');\r\n tSpan.setAttribute('stroke-miterlimit', '4');\r\n this.textSpans[i].span = tSpan;\r\n\r\n if (usesGlyphs) {\r\n var childSpan = createNS('g');\r\n tSpan.appendChild(childSpan);\r\n this.textSpans[i].childSpan = childSpan;\r\n }\r\n\r\n this.textSpans[i].span = tSpan;\r\n this.layerElement.appendChild(tSpan);\r\n }\r\n\r\n tSpan.style.display = 'inherit';\r\n }\r\n\r\n matrixHelper.reset();\r\n\r\n if (singleShape) {\r\n if (letters[i].n) {\r\n xPos = -trackingOffset;\r\n yPos += documentData.yOffset;\r\n yPos += firstLine ? 1 : 0;\r\n firstLine = false;\r\n }\r\n\r\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\r\n xPos += letters[i].l || 0; // xPos += letters[i].val === ' ' ? 0 : trackingOffset;\r\n\r\n xPos += trackingOffset;\r\n }\r\n\r\n if (usesGlyphs) {\r\n charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\r\n var glyphElement; // t === 1 means the character has been replaced with an animated shaped\r\n\r\n if (charData.t === 1) {\r\n glyphElement = new SVGCompElement(charData.data, this.globalData, this);\r\n } else {\r\n var data = emptyShapeData;\r\n\r\n if (charData.data && charData.data.shapes) {\r\n data = this.buildShapeData(charData.data, documentData.finalSize);\r\n }\r\n\r\n glyphElement = new SVGShapeElement(data, this.globalData, this);\r\n }\r\n\r\n if (this.textSpans[i].glyph) {\r\n var glyph = this.textSpans[i].glyph;\r\n this.textSpans[i].childSpan.removeChild(glyph.layerElement);\r\n glyph.destroy();\r\n }\r\n\r\n this.textSpans[i].glyph = glyphElement;\r\n glyphElement._debug = true;\r\n glyphElement.prepareFrame(0);\r\n glyphElement.renderFrame();\r\n this.textSpans[i].childSpan.appendChild(glyphElement.layerElement); // when using animated shapes, the layer will be scaled instead of replacing the internal scale\r\n // this might have issues with strokes and might need a different solution\r\n\r\n if (charData.t === 1) {\r\n this.textSpans[i].childSpan.setAttribute('transform', 'scale(' + documentData.finalSize / 100 + ',' + documentData.finalSize / 100 + ')');\r\n }\r\n } else {\r\n if (singleShape) {\r\n tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')');\r\n }\r\n\r\n tSpan.textContent = letters[i].val;\r\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\r\n } //\r\n\r\n }\r\n\r\n if (singleShape && tSpan) {\r\n tSpan.setAttribute('d', shapeStr);\r\n }\r\n }\r\n\r\n while (i < this.textSpans.length) {\r\n this.textSpans[i].span.style.display = 'none';\r\n i += 1;\r\n }\r\n\r\n this._sizeChanged = true;\r\n };\r\n\r\n SVGTextLottieElement.prototype.sourceRectAtTime = function () {\r\n this.prepareFrame(this.comp.renderedFrame - this.data.st);\r\n this.renderInnerContent();\r\n\r\n if (this._sizeChanged) {\r\n this._sizeChanged = false;\r\n var textBox = this.layerElement.getBBox();\r\n this.bbox = {\r\n top: textBox.y,\r\n left: textBox.x,\r\n width: textBox.width,\r\n height: textBox.height\r\n };\r\n }\r\n\r\n return this.bbox;\r\n };\r\n\r\n SVGTextLottieElement.prototype.getValue = function () {\r\n var i;\r\n var len = this.textSpans.length;\r\n var glyphElement;\r\n this.renderedFrame = this.comp.renderedFrame;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n glyphElement = this.textSpans[i].glyph;\r\n\r\n if (glyphElement) {\r\n glyphElement.prepareFrame(this.comp.renderedFrame - this.data.st);\r\n\r\n if (glyphElement._mdf) {\r\n this._mdf = true;\r\n }\r\n }\r\n }\r\n };\r\n\r\n SVGTextLottieElement.prototype.renderInnerContent = function () {\r\n if (!this.data.singleShape || this._mdf) {\r\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\r\n\r\n if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) {\r\n this._sizeChanged = true;\r\n var i;\r\n var len;\r\n var renderedLetters = this.textAnimator.renderedLetters;\r\n var letters = this.textProperty.currentData.l;\r\n len = letters.length;\r\n var renderedLetter;\r\n var textSpan;\r\n var glyphElement;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (!letters[i].n) {\r\n renderedLetter = renderedLetters[i];\r\n textSpan = this.textSpans[i].span;\r\n glyphElement = this.textSpans[i].glyph;\r\n\r\n if (glyphElement) {\r\n glyphElement.renderFrame();\r\n }\r\n\r\n if (renderedLetter._mdf.m) {\r\n textSpan.setAttribute('transform', renderedLetter.m);\r\n }\r\n\r\n if (renderedLetter._mdf.o) {\r\n textSpan.setAttribute('opacity', renderedLetter.o);\r\n }\r\n\r\n if (renderedLetter._mdf.sw) {\r\n textSpan.setAttribute('stroke-width', renderedLetter.sw);\r\n }\r\n\r\n if (renderedLetter._mdf.sc) {\r\n textSpan.setAttribute('stroke', renderedLetter.sc);\r\n }\r\n\r\n if (renderedLetter._mdf.fc) {\r\n textSpan.setAttribute('fill', renderedLetter.fc);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n function ISolidElement(data, globalData, comp) {\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([IImageElement], ISolidElement);\r\n\r\n ISolidElement.prototype.createContent = function () {\r\n var rect = createNS('rect'); /// /rect.style.width = this.data.sw;\r\n /// /rect.style.height = this.data.sh;\r\n /// /rect.style.fill = this.data.sc;\r\n\r\n rect.setAttribute('width', this.data.sw);\r\n rect.setAttribute('height', this.data.sh);\r\n rect.setAttribute('fill', this.data.sc);\r\n this.layerElement.appendChild(rect);\r\n };\r\n\r\n function NullElement(data, globalData, comp) {\r\n this.initFrame();\r\n this.initBaseData(data, globalData, comp);\r\n this.initFrame();\r\n this.initTransform(data, globalData, comp);\r\n this.initHierarchy();\r\n }\r\n\r\n NullElement.prototype.prepareFrame = function (num) {\r\n this.prepareProperties(num, true);\r\n };\r\n\r\n NullElement.prototype.renderFrame = function () {};\r\n\r\n NullElement.prototype.getBaseElement = function () {\r\n return null;\r\n };\r\n\r\n NullElement.prototype.destroy = function () {};\r\n\r\n NullElement.prototype.sourceRectAtTime = function () {};\r\n\r\n NullElement.prototype.hide = function () {};\r\n\r\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement);\r\n\r\n function SVGRendererBase() {}\r\n\r\n extendPrototype([BaseRenderer], SVGRendererBase);\r\n\r\n SVGRendererBase.prototype.createNull = function (data) {\r\n return new NullElement(data, this.globalData, this);\r\n };\r\n\r\n SVGRendererBase.prototype.createShape = function (data) {\r\n return new SVGShapeElement(data, this.globalData, this);\r\n };\r\n\r\n SVGRendererBase.prototype.createText = function (data) {\r\n return new SVGTextLottieElement(data, this.globalData, this);\r\n };\r\n\r\n SVGRendererBase.prototype.createImage = function (data) {\r\n return new IImageElement(data, this.globalData, this);\r\n };\r\n\r\n SVGRendererBase.prototype.createSolid = function (data) {\r\n return new ISolidElement(data, this.globalData, this);\r\n };\r\n\r\n SVGRendererBase.prototype.configAnimation = function (animData) {\r\n this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');\r\n this.svgElement.setAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');\r\n\r\n if (this.renderConfig.viewBoxSize) {\r\n this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize);\r\n } else {\r\n this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h);\r\n }\r\n\r\n if (!this.renderConfig.viewBoxOnly) {\r\n this.svgElement.setAttribute('width', animData.w);\r\n this.svgElement.setAttribute('height', animData.h);\r\n this.svgElement.style.width = '100%';\r\n this.svgElement.style.height = '100%';\r\n this.svgElement.style.transform = 'translate3d(0,0,0)';\r\n this.svgElement.style.contentVisibility = this.renderConfig.contentVisibility;\r\n }\r\n\r\n if (this.renderConfig.width) {\r\n this.svgElement.setAttribute('width', this.renderConfig.width);\r\n }\r\n\r\n if (this.renderConfig.height) {\r\n this.svgElement.setAttribute('height', this.renderConfig.height);\r\n }\r\n\r\n if (this.renderConfig.className) {\r\n this.svgElement.setAttribute('class', this.renderConfig.className);\r\n }\r\n\r\n if (this.renderConfig.id) {\r\n this.svgElement.setAttribute('id', this.renderConfig.id);\r\n }\r\n\r\n if (this.renderConfig.focusable !== undefined) {\r\n this.svgElement.setAttribute('focusable', this.renderConfig.focusable);\r\n }\r\n\r\n this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio); // this.layerElement.style.transform = 'translate3d(0,0,0)';\r\n // this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = \"0px 0px 0px\";\r\n\r\n this.animationItem.wrapper.appendChild(this.svgElement); // Mask animation\r\n\r\n var defs = this.globalData.defs;\r\n this.setupGlobalData(animData, defs);\r\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\r\n this.data = animData;\r\n var maskElement = createNS('clipPath');\r\n var rect = createNS('rect');\r\n rect.setAttribute('width', animData.w);\r\n rect.setAttribute('height', animData.h);\r\n rect.setAttribute('x', 0);\r\n rect.setAttribute('y', 0);\r\n var maskId = createElementID();\r\n maskElement.setAttribute('id', maskId);\r\n maskElement.appendChild(rect);\r\n this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + maskId + ')');\r\n defs.appendChild(maskElement);\r\n this.layers = animData.layers;\r\n this.elements = createSizedArray(animData.layers.length);\r\n };\r\n\r\n SVGRendererBase.prototype.destroy = function () {\r\n if (this.animationItem.wrapper) {\r\n this.animationItem.wrapper.innerText = '';\r\n }\r\n\r\n this.layerElement = null;\r\n this.globalData.defs = null;\r\n var i;\r\n var len = this.layers ? this.layers.length : 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.elements[i]) {\r\n this.elements[i].destroy();\r\n }\r\n }\r\n\r\n this.elements.length = 0;\r\n this.destroyed = true;\r\n this.animationItem = null;\r\n };\r\n\r\n SVGRendererBase.prototype.updateContainerSize = function () {};\r\n\r\n SVGRendererBase.prototype.findIndexByInd = function (ind) {\r\n var i = 0;\r\n var len = this.layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.layers[i].ind === ind) {\r\n return i;\r\n }\r\n }\r\n\r\n return -1;\r\n };\r\n\r\n SVGRendererBase.prototype.buildItem = function (pos) {\r\n var elements = this.elements;\r\n\r\n if (elements[pos] || this.layers[pos].ty === 99) {\r\n return;\r\n }\r\n\r\n elements[pos] = true;\r\n var element = this.createItem(this.layers[pos]);\r\n elements[pos] = element;\r\n\r\n if (getExpressionsPlugin()) {\r\n if (this.layers[pos].ty === 0) {\r\n this.globalData.projectInterface.registerComposition(element);\r\n }\r\n\r\n element.initExpressions();\r\n }\r\n\r\n this.appendElementInPos(element, pos);\r\n\r\n if (this.layers[pos].tt) {\r\n var elementIndex = 'tp' in this.layers[pos] ? this.findIndexByInd(this.layers[pos].tp) : pos - 1;\r\n\r\n if (elementIndex === -1) {\r\n return;\r\n }\r\n\r\n if (!this.elements[elementIndex] || this.elements[elementIndex] === true) {\r\n this.buildItem(elementIndex);\r\n this.addPendingElement(element);\r\n } else {\r\n var matteElement = elements[elementIndex];\r\n var matteMask = matteElement.getMatte(this.layers[pos].tt);\r\n element.setMatte(matteMask);\r\n }\r\n }\r\n };\r\n\r\n SVGRendererBase.prototype.checkPendingElements = function () {\r\n while (this.pendingElements.length) {\r\n var element = this.pendingElements.pop();\r\n element.checkParenting();\r\n\r\n if (element.data.tt) {\r\n var i = 0;\r\n var len = this.elements.length;\r\n\r\n while (i < len) {\r\n if (this.elements[i] === element) {\r\n var elementIndex = 'tp' in element.data ? this.findIndexByInd(element.data.tp) : i - 1;\r\n var matteElement = this.elements[elementIndex];\r\n var matteMask = matteElement.getMatte(this.layers[i].tt);\r\n element.setMatte(matteMask);\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n }\r\n }\r\n };\r\n\r\n SVGRendererBase.prototype.renderFrame = function (num) {\r\n if (this.renderedFrame === num || this.destroyed) {\r\n return;\r\n }\r\n\r\n if (num === null) {\r\n num = this.renderedFrame;\r\n } else {\r\n this.renderedFrame = num;\r\n } // console.log('-------');\r\n // console.log('FRAME ',num);\r\n\r\n\r\n this.globalData.frameNum = num;\r\n this.globalData.frameId += 1;\r\n this.globalData.projectInterface.currentFrame = num;\r\n this.globalData._mdf = false;\r\n var i;\r\n var len = this.layers.length;\r\n\r\n if (!this.completeLayers) {\r\n this.checkLayers(num);\r\n }\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (this.completeLayers || this.elements[i]) {\r\n this.elements[i].prepareFrame(num - this.layers[i].st);\r\n }\r\n }\r\n\r\n if (this.globalData._mdf) {\r\n for (i = 0; i < len; i += 1) {\r\n if (this.completeLayers || this.elements[i]) {\r\n this.elements[i].renderFrame();\r\n }\r\n }\r\n }\r\n };\r\n\r\n SVGRendererBase.prototype.appendElementInPos = function (element, pos) {\r\n var newElement = element.getBaseElement();\r\n\r\n if (!newElement) {\r\n return;\r\n }\r\n\r\n var i = 0;\r\n var nextElement;\r\n\r\n while (i < pos) {\r\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) {\r\n nextElement = this.elements[i].getBaseElement();\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (nextElement) {\r\n this.layerElement.insertBefore(newElement, nextElement);\r\n } else {\r\n this.layerElement.appendChild(newElement);\r\n }\r\n };\r\n\r\n SVGRendererBase.prototype.hide = function () {\r\n this.layerElement.style.display = 'none';\r\n };\r\n\r\n SVGRendererBase.prototype.show = function () {\r\n this.layerElement.style.display = 'block';\r\n };\r\n\r\n function ICompElement() {}\r\n\r\n extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);\r\n\r\n ICompElement.prototype.initElement = function (data, globalData, comp) {\r\n this.initFrame();\r\n this.initBaseData(data, globalData, comp);\r\n this.initTransform(data, globalData, comp);\r\n this.initRenderable();\r\n this.initHierarchy();\r\n this.initRendererElement();\r\n this.createContainerElements();\r\n this.createRenderableComponents();\r\n\r\n if (this.data.xt || !globalData.progressiveLoad) {\r\n this.buildAllItems();\r\n }\r\n\r\n this.hide();\r\n };\r\n /* ICompElement.prototype.hide = function(){\r\n if(!this.hidden){\r\n this.hideElement();\r\n var i,len = this.elements.length;\r\n for( i = 0; i < len; i+=1 ){\r\n if(this.elements[i]){\r\n this.elements[i].hide();\r\n }\r\n }\r\n }\r\n }; */\r\n\r\n\r\n ICompElement.prototype.prepareFrame = function (num) {\r\n this._mdf = false;\r\n this.prepareRenderableFrame(num);\r\n this.prepareProperties(num, this.isInRange);\r\n\r\n if (!this.isInRange && !this.data.xt) {\r\n return;\r\n }\r\n\r\n if (!this.tm._placeholder) {\r\n var timeRemapped = this.tm.v;\r\n\r\n if (timeRemapped === this.data.op) {\r\n timeRemapped = this.data.op - 1;\r\n }\r\n\r\n this.renderedFrame = timeRemapped;\r\n } else {\r\n this.renderedFrame = num / this.data.sr;\r\n }\r\n\r\n var i;\r\n var len = this.elements.length;\r\n\r\n if (!this.completeLayers) {\r\n this.checkLayers(this.renderedFrame);\r\n } // This iteration needs to be backwards because of how expressions connect between each other\r\n\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (this.completeLayers || this.elements[i]) {\r\n this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);\r\n\r\n if (this.elements[i]._mdf) {\r\n this._mdf = true;\r\n }\r\n }\r\n }\r\n };\r\n\r\n ICompElement.prototype.renderInnerContent = function () {\r\n var i;\r\n var len = this.layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.completeLayers || this.elements[i]) {\r\n this.elements[i].renderFrame();\r\n }\r\n }\r\n };\r\n\r\n ICompElement.prototype.setElements = function (elems) {\r\n this.elements = elems;\r\n };\r\n\r\n ICompElement.prototype.getElements = function () {\r\n return this.elements;\r\n };\r\n\r\n ICompElement.prototype.destroyElements = function () {\r\n var i;\r\n var len = this.layers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.elements[i]) {\r\n this.elements[i].destroy();\r\n }\r\n }\r\n };\r\n\r\n ICompElement.prototype.destroy = function () {\r\n this.destroyElements();\r\n this.destroyBaseElement();\r\n };\r\n\r\n function SVGCompElement(data, globalData, comp) {\r\n this.layers = data.layers;\r\n this.supports3d = true;\r\n this.completeLayers = false;\r\n this.pendingElements = [];\r\n this.elements = this.layers ? createSizedArray(this.layers.length) : [];\r\n this.initElement(data, globalData, comp);\r\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\r\n _placeholder: true\r\n };\r\n }\r\n\r\n extendPrototype([SVGRendererBase, ICompElement, SVGBaseElement], SVGCompElement);\r\n\r\n SVGCompElement.prototype.createComp = function (data) {\r\n return new SVGCompElement(data, this.globalData, this);\r\n };\r\n\r\n function SVGRenderer(animationItem, config) {\r\n this.animationItem = animationItem;\r\n this.layers = null;\r\n this.renderedFrame = -1;\r\n this.svgElement = createNS('svg');\r\n var ariaLabel = '';\r\n\r\n if (config && config.title) {\r\n var titleElement = createNS('title');\r\n var titleId = createElementID();\r\n titleElement.setAttribute('id', titleId);\r\n titleElement.textContent = config.title;\r\n this.svgElement.appendChild(titleElement);\r\n ariaLabel += titleId;\r\n }\r\n\r\n if (config && config.description) {\r\n var descElement = createNS('desc');\r\n var descId = createElementID();\r\n descElement.setAttribute('id', descId);\r\n descElement.textContent = config.description;\r\n this.svgElement.appendChild(descElement);\r\n ariaLabel += ' ' + descId;\r\n }\r\n\r\n if (ariaLabel) {\r\n this.svgElement.setAttribute('aria-labelledby', ariaLabel);\r\n }\r\n\r\n var defs = createNS('defs');\r\n this.svgElement.appendChild(defs);\r\n var maskElement = createNS('g');\r\n this.svgElement.appendChild(maskElement);\r\n this.layerElement = maskElement;\r\n this.renderConfig = {\r\n preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet',\r\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\r\n contentVisibility: config && config.contentVisibility || 'visible',\r\n progressiveLoad: config && config.progressiveLoad || false,\r\n hideOnTransparent: !(config && config.hideOnTransparent === false),\r\n viewBoxOnly: config && config.viewBoxOnly || false,\r\n viewBoxSize: config && config.viewBoxSize || false,\r\n className: config && config.className || '',\r\n id: config && config.id || '',\r\n focusable: config && config.focusable,\r\n filterSize: {\r\n width: config && config.filterSize && config.filterSize.width || '100%',\r\n height: config && config.filterSize && config.filterSize.height || '100%',\r\n x: config && config.filterSize && config.filterSize.x || '0%',\r\n y: config && config.filterSize && config.filterSize.y || '0%'\r\n },\r\n width: config && config.width,\r\n height: config && config.height,\r\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\r\n };\r\n this.globalData = {\r\n _mdf: false,\r\n frameNum: -1,\r\n defs: defs,\r\n renderConfig: this.renderConfig\r\n };\r\n this.elements = [];\r\n this.pendingElements = [];\r\n this.destroyed = false;\r\n this.rendererType = 'svg';\r\n }\r\n\r\n extendPrototype([SVGRendererBase], SVGRenderer);\r\n\r\n SVGRenderer.prototype.createComp = function (data) {\r\n return new SVGCompElement(data, this.globalData, this);\r\n };\r\n\r\n function CVContextData() {\r\n this.saved = [];\r\n this.cArrPos = 0;\r\n this.cTr = new Matrix();\r\n this.cO = 1;\r\n var i;\r\n var len = 15;\r\n this.savedOp = createTypedArray('float32', len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.saved[i] = createTypedArray('float32', 16);\r\n }\r\n\r\n this._length = len;\r\n }\r\n\r\n CVContextData.prototype.duplicate = function () {\r\n var newLength = this._length * 2;\r\n var currentSavedOp = this.savedOp;\r\n this.savedOp = createTypedArray('float32', newLength);\r\n this.savedOp.set(currentSavedOp);\r\n var i = 0;\r\n\r\n for (i = this._length; i < newLength; i += 1) {\r\n this.saved[i] = createTypedArray('float32', 16);\r\n }\r\n\r\n this._length = newLength;\r\n };\r\n\r\n CVContextData.prototype.reset = function () {\r\n this.cArrPos = 0;\r\n this.cTr.reset();\r\n this.cO = 1;\r\n };\r\n\r\n function ShapeTransformManager() {\r\n this.sequences = {};\r\n this.sequenceList = [];\r\n this.transform_key_count = 0;\r\n }\r\n\r\n ShapeTransformManager.prototype = {\r\n addTransformSequence: function addTransformSequence(transforms) {\r\n var i;\r\n var len = transforms.length;\r\n var key = '_';\r\n\r\n for (i = 0; i < len; i += 1) {\r\n key += transforms[i].transform.key + '_';\r\n }\r\n\r\n var sequence = this.sequences[key];\r\n\r\n if (!sequence) {\r\n sequence = {\r\n transforms: [].concat(transforms),\r\n finalTransform: new Matrix(),\r\n _mdf: false\r\n };\r\n this.sequences[key] = sequence;\r\n this.sequenceList.push(sequence);\r\n }\r\n\r\n return sequence;\r\n },\r\n processSequence: function processSequence(sequence, isFirstFrame) {\r\n var i = 0;\r\n var len = sequence.transforms.length;\r\n var _mdf = isFirstFrame;\r\n\r\n while (i < len && !isFirstFrame) {\r\n if (sequence.transforms[i].transform.mProps._mdf) {\r\n _mdf = true;\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (_mdf) {\r\n var props;\r\n sequence.finalTransform.reset();\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n props = sequence.transforms[i].transform.mProps.v.props;\r\n sequence.finalTransform.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]);\r\n }\r\n }\r\n\r\n sequence._mdf = _mdf;\r\n },\r\n processSequences: function processSequences(isFirstFrame) {\r\n var i;\r\n var len = this.sequenceList.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.processSequence(this.sequenceList[i], isFirstFrame);\r\n }\r\n },\r\n getNewKey: function getNewKey() {\r\n this.transform_key_count += 1;\r\n return '_' + this.transform_key_count;\r\n }\r\n };\r\n\r\n function CVEffects() {}\r\n\r\n CVEffects.prototype.renderFrame = function () {};\r\n\r\n function CVMaskElement(data, element) {\r\n this.data = data;\r\n this.element = element;\r\n this.masksProperties = this.data.masksProperties || [];\r\n this.viewData = createSizedArray(this.masksProperties.length);\r\n var i;\r\n var len = this.masksProperties.length;\r\n var hasMasks = false;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.masksProperties[i].mode !== 'n') {\r\n hasMasks = true;\r\n }\r\n\r\n this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3);\r\n }\r\n\r\n this.hasMasks = hasMasks;\r\n\r\n if (hasMasks) {\r\n this.element.addRenderableComponent(this);\r\n }\r\n }\r\n\r\n CVMaskElement.prototype.renderFrame = function () {\r\n if (!this.hasMasks) {\r\n return;\r\n }\r\n\r\n var transform = this.element.finalTransform.mat;\r\n var ctx = this.element.canvasContext;\r\n var i;\r\n var len = this.masksProperties.length;\r\n var pt;\r\n var pts;\r\n var data;\r\n ctx.beginPath();\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.masksProperties[i].mode !== 'n') {\r\n if (this.masksProperties[i].inv) {\r\n ctx.moveTo(0, 0);\r\n ctx.lineTo(this.element.globalData.compSize.w, 0);\r\n ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);\r\n ctx.lineTo(0, this.element.globalData.compSize.h);\r\n ctx.lineTo(0, 0);\r\n }\r\n\r\n data = this.viewData[i].v;\r\n pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0);\r\n ctx.moveTo(pt[0], pt[1]);\r\n var j;\r\n var jLen = data._length;\r\n\r\n for (j = 1; j < jLen; j += 1) {\r\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);\r\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\r\n }\r\n\r\n pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);\r\n ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);\r\n }\r\n }\r\n\r\n this.element.globalData.renderer.save(true);\r\n ctx.clip();\r\n };\r\n\r\n CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;\r\n\r\n CVMaskElement.prototype.destroy = function () {\r\n this.element = null;\r\n };\r\n\r\n function CVBaseElement() {}\r\n\r\n CVBaseElement.prototype = {\r\n createElements: function createElements() {},\r\n initRendererElement: function initRendererElement() {},\r\n createContainerElements: function createContainerElements() {\r\n this.canvasContext = this.globalData.canvasContext;\r\n this.renderableEffectsManager = new CVEffects(this);\r\n },\r\n createContent: function createContent() {},\r\n setBlendMode: function setBlendMode() {\r\n var globalData = this.globalData;\r\n\r\n if (globalData.blendMode !== this.data.bm) {\r\n globalData.blendMode = this.data.bm;\r\n var blendModeValue = getBlendMode(this.data.bm);\r\n globalData.canvasContext.globalCompositeOperation = blendModeValue;\r\n }\r\n },\r\n createRenderableComponents: function createRenderableComponents() {\r\n this.maskManager = new CVMaskElement(this.data, this);\r\n },\r\n hideElement: function hideElement() {\r\n if (!this.hidden && (!this.isInRange || this.isTransparent)) {\r\n this.hidden = true;\r\n }\r\n },\r\n showElement: function showElement() {\r\n if (this.isInRange && !this.isTransparent) {\r\n this.hidden = false;\r\n this._isFirstFrame = true;\r\n this.maskManager._isFirstFrame = true;\r\n }\r\n },\r\n renderFrame: function renderFrame() {\r\n if (this.hidden || this.data.hd) {\r\n return;\r\n }\r\n\r\n this.renderTransform();\r\n this.renderRenderable();\r\n this.setBlendMode();\r\n var forceRealStack = this.data.ty === 0;\r\n this.globalData.renderer.save(forceRealStack);\r\n this.globalData.renderer.ctxTransform(this.finalTransform.mat.props);\r\n this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v);\r\n this.renderInnerContent();\r\n this.globalData.renderer.restore(forceRealStack);\r\n\r\n if (this.maskManager.hasMasks) {\r\n this.globalData.renderer.restore(true);\r\n }\r\n\r\n if (this._isFirstFrame) {\r\n this._isFirstFrame = false;\r\n }\r\n },\r\n destroy: function destroy() {\r\n this.canvasContext = null;\r\n this.data = null;\r\n this.globalData = null;\r\n this.maskManager.destroy();\r\n },\r\n mHelper: new Matrix()\r\n };\r\n CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;\r\n CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;\r\n\r\n function CVShapeData(element, data, styles, transformsManager) {\r\n this.styledShapes = [];\r\n this.tr = [0, 0, 0, 0, 0, 0];\r\n var ty = 4;\r\n\r\n if (data.ty === 'rc') {\r\n ty = 5;\r\n } else if (data.ty === 'el') {\r\n ty = 6;\r\n } else if (data.ty === 'sr') {\r\n ty = 7;\r\n }\r\n\r\n this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element);\r\n var i;\r\n var len = styles.length;\r\n var styledShape;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (!styles[i].closed) {\r\n styledShape = {\r\n transforms: transformsManager.addTransformSequence(styles[i].transforms),\r\n trNodes: []\r\n };\r\n this.styledShapes.push(styledShape);\r\n styles[i].elements.push(styledShape);\r\n }\r\n }\r\n }\r\n\r\n CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;\r\n\r\n function CVShapeElement(data, globalData, comp) {\r\n this.shapes = [];\r\n this.shapesData = data.shapes;\r\n this.stylesList = [];\r\n this.itemsData = [];\r\n this.prevViewData = [];\r\n this.shapeModifiers = [];\r\n this.processedElements = [];\r\n this.transformsManager = new ShapeTransformManager();\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement);\r\n CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;\r\n CVShapeElement.prototype.transformHelper = {\r\n opacity: 1,\r\n _opMdf: false\r\n };\r\n CVShapeElement.prototype.dashResetter = [];\r\n\r\n CVShapeElement.prototype.createContent = function () {\r\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\r\n };\r\n\r\n CVShapeElement.prototype.createStyleElement = function (data, transforms) {\r\n var styleElem = {\r\n data: data,\r\n type: data.ty,\r\n preTransforms: this.transformsManager.addTransformSequence(transforms),\r\n transforms: [],\r\n elements: [],\r\n closed: data.hd === true\r\n };\r\n var elementData = {};\r\n\r\n if (data.ty === 'fl' || data.ty === 'st') {\r\n elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this);\r\n\r\n if (!elementData.c.k) {\r\n styleElem.co = 'rgb(' + bmFloor(elementData.c.v[0]) + ',' + bmFloor(elementData.c.v[1]) + ',' + bmFloor(elementData.c.v[2]) + ')';\r\n }\r\n } else if (data.ty === 'gf' || data.ty === 'gs') {\r\n elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this);\r\n elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this);\r\n elementData.h = PropertyFactory.getProp(this, data.h || {\r\n k: 0\r\n }, 0, 0.01, this);\r\n elementData.a = PropertyFactory.getProp(this, data.a || {\r\n k: 0\r\n }, 0, degToRads, this);\r\n elementData.g = new GradientProperty(this, data.g, this);\r\n }\r\n\r\n elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this);\r\n\r\n if (data.ty === 'st' || data.ty === 'gs') {\r\n styleElem.lc = lineCapEnum[data.lc || 2];\r\n styleElem.lj = lineJoinEnum[data.lj || 2];\r\n\r\n if (data.lj == 1) {\r\n // eslint-disable-line eqeqeq\r\n styleElem.ml = data.ml;\r\n }\r\n\r\n elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this);\r\n\r\n if (!elementData.w.k) {\r\n styleElem.wi = elementData.w.v;\r\n }\r\n\r\n if (data.d) {\r\n var d = new DashProperty(this, data.d, 'canvas', this);\r\n elementData.d = d;\r\n\r\n if (!elementData.d.k) {\r\n styleElem.da = elementData.d.dashArray;\r\n styleElem[\"do\"] = elementData.d.dashoffset[0];\r\n }\r\n }\r\n } else {\r\n styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';\r\n }\r\n\r\n this.stylesList.push(styleElem);\r\n elementData.style = styleElem;\r\n return elementData;\r\n };\r\n\r\n CVShapeElement.prototype.createGroupElement = function () {\r\n var elementData = {\r\n it: [],\r\n prevViewData: []\r\n };\r\n return elementData;\r\n };\r\n\r\n CVShapeElement.prototype.createTransformElement = function (data) {\r\n var elementData = {\r\n transform: {\r\n opacity: 1,\r\n _opMdf: false,\r\n key: this.transformsManager.getNewKey(),\r\n op: PropertyFactory.getProp(this, data.o, 0, 0.01, this),\r\n mProps: TransformPropertyFactory.getTransformProperty(this, data, this)\r\n }\r\n };\r\n return elementData;\r\n };\r\n\r\n CVShapeElement.prototype.createShapeElement = function (data) {\r\n var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);\r\n this.shapes.push(elementData);\r\n this.addShapeToModifiers(elementData);\r\n return elementData;\r\n };\r\n\r\n CVShapeElement.prototype.reloadShapes = function () {\r\n this._isFirstFrame = true;\r\n var i;\r\n var len = this.itemsData.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.prevViewData[i] = this.itemsData[i];\r\n }\r\n\r\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []);\r\n len = this.dynamicProperties.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.dynamicProperties[i].getValue();\r\n }\r\n\r\n this.renderModifiers();\r\n this.transformsManager.processSequences(this._isFirstFrame);\r\n };\r\n\r\n CVShapeElement.prototype.addTransformToStyleList = function (transform) {\r\n var i;\r\n var len = this.stylesList.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (!this.stylesList[i].closed) {\r\n this.stylesList[i].transforms.push(transform);\r\n }\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.removeTransformFromStyleList = function () {\r\n var i;\r\n var len = this.stylesList.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (!this.stylesList[i].closed) {\r\n this.stylesList[i].transforms.pop();\r\n }\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.closeStyles = function (styles) {\r\n var i;\r\n var len = styles.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n styles[i].closed = true;\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) {\r\n var i;\r\n var len = arr.length - 1;\r\n var j;\r\n var jLen;\r\n var ownStyles = [];\r\n var ownModifiers = [];\r\n var processedPos;\r\n var modifier;\r\n var currentTransform;\r\n var ownTransforms = [].concat(transforms);\r\n\r\n for (i = len; i >= 0; i -= 1) {\r\n processedPos = this.searchProcessedElement(arr[i]);\r\n\r\n if (!processedPos) {\r\n arr[i]._shouldRender = shouldRender;\r\n } else {\r\n itemsData[i] = prevViewData[processedPos - 1];\r\n }\r\n\r\n if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') {\r\n if (!processedPos) {\r\n itemsData[i] = this.createStyleElement(arr[i], ownTransforms);\r\n } else {\r\n itemsData[i].style.closed = false;\r\n }\r\n\r\n ownStyles.push(itemsData[i].style);\r\n } else if (arr[i].ty === 'gr') {\r\n if (!processedPos) {\r\n itemsData[i] = this.createGroupElement(arr[i]);\r\n } else {\r\n jLen = itemsData[i].it.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n itemsData[i].prevViewData[j] = itemsData[i].it[j];\r\n }\r\n }\r\n\r\n this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms);\r\n } else if (arr[i].ty === 'tr') {\r\n if (!processedPos) {\r\n currentTransform = this.createTransformElement(arr[i]);\r\n itemsData[i] = currentTransform;\r\n }\r\n\r\n ownTransforms.push(itemsData[i]);\r\n this.addTransformToStyleList(itemsData[i]);\r\n } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') {\r\n if (!processedPos) {\r\n itemsData[i] = this.createShapeElement(arr[i]);\r\n }\r\n } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb' || arr[i].ty === 'zz' || arr[i].ty === 'op') {\r\n if (!processedPos) {\r\n modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n modifier.init(this, arr[i]);\r\n itemsData[i] = modifier;\r\n this.shapeModifiers.push(modifier);\r\n } else {\r\n modifier = itemsData[i];\r\n modifier.closed = false;\r\n }\r\n\r\n ownModifiers.push(modifier);\r\n } else if (arr[i].ty === 'rp') {\r\n if (!processedPos) {\r\n modifier = ShapeModifiers.getModifier(arr[i].ty);\r\n itemsData[i] = modifier;\r\n modifier.init(this, arr, i, itemsData);\r\n this.shapeModifiers.push(modifier);\r\n shouldRender = false;\r\n } else {\r\n modifier = itemsData[i];\r\n modifier.closed = true;\r\n }\r\n\r\n ownModifiers.push(modifier);\r\n }\r\n\r\n this.addProcessedElement(arr[i], i + 1);\r\n }\r\n\r\n this.removeTransformFromStyleList();\r\n this.closeStyles(ownStyles);\r\n len = ownModifiers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ownModifiers[i].closed = true;\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.renderInnerContent = function () {\r\n this.transformHelper.opacity = 1;\r\n this.transformHelper._opMdf = false;\r\n this.renderModifiers();\r\n this.transformsManager.processSequences(this._isFirstFrame);\r\n this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true);\r\n };\r\n\r\n CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) {\r\n if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {\r\n groupTransform.opacity = parentTransform.opacity;\r\n groupTransform.opacity *= groupTransform.op.v;\r\n groupTransform._opMdf = true;\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.drawLayer = function () {\r\n var i;\r\n var len = this.stylesList.length;\r\n var j;\r\n var jLen;\r\n var k;\r\n var kLen;\r\n var elems;\r\n var nodes;\r\n var renderer = this.globalData.renderer;\r\n var ctx = this.globalData.canvasContext;\r\n var type;\r\n var currentStyle;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n currentStyle = this.stylesList[i];\r\n type = currentStyle.type; // Skipping style when\r\n // Stroke width equals 0\r\n // style should not be rendered (extra unused repeaters)\r\n // current opacity equals 0\r\n // global opacity equals 0\r\n\r\n if (!((type === 'st' || type === 'gs') && currentStyle.wi === 0 || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0)) {\r\n renderer.save();\r\n elems = currentStyle.elements;\r\n\r\n if (type === 'st' || type === 'gs') {\r\n ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;\r\n ctx.lineWidth = currentStyle.wi;\r\n ctx.lineCap = currentStyle.lc;\r\n ctx.lineJoin = currentStyle.lj;\r\n ctx.miterLimit = currentStyle.ml || 0;\r\n } else {\r\n ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;\r\n }\r\n\r\n renderer.ctxOpacity(currentStyle.coOp);\r\n\r\n if (type !== 'st' && type !== 'gs') {\r\n ctx.beginPath();\r\n }\r\n\r\n renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);\r\n jLen = elems.length;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (type === 'st' || type === 'gs') {\r\n ctx.beginPath();\r\n\r\n if (currentStyle.da) {\r\n ctx.setLineDash(currentStyle.da);\r\n ctx.lineDashOffset = currentStyle[\"do\"];\r\n }\r\n }\r\n\r\n nodes = elems[j].trNodes;\r\n kLen = nodes.length;\r\n\r\n for (k = 0; k < kLen; k += 1) {\r\n if (nodes[k].t === 'm') {\r\n ctx.moveTo(nodes[k].p[0], nodes[k].p[1]);\r\n } else if (nodes[k].t === 'c') {\r\n ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]);\r\n } else {\r\n ctx.closePath();\r\n }\r\n }\r\n\r\n if (type === 'st' || type === 'gs') {\r\n ctx.stroke();\r\n\r\n if (currentStyle.da) {\r\n ctx.setLineDash(this.dashResetter);\r\n }\r\n }\r\n }\r\n\r\n if (type !== 'st' && type !== 'gs') {\r\n ctx.fill(currentStyle.r);\r\n }\r\n\r\n renderer.restore();\r\n }\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) {\r\n var i;\r\n var len = items.length - 1;\r\n var groupTransform;\r\n groupTransform = parentTransform;\r\n\r\n for (i = len; i >= 0; i -= 1) {\r\n if (items[i].ty === 'tr') {\r\n groupTransform = data[i].transform;\r\n this.renderShapeTransform(parentTransform, groupTransform);\r\n } else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') {\r\n this.renderPath(items[i], data[i]);\r\n } else if (items[i].ty === 'fl') {\r\n this.renderFill(items[i], data[i], groupTransform);\r\n } else if (items[i].ty === 'st') {\r\n this.renderStroke(items[i], data[i], groupTransform);\r\n } else if (items[i].ty === 'gf' || items[i].ty === 'gs') {\r\n this.renderGradientFill(items[i], data[i], groupTransform);\r\n } else if (items[i].ty === 'gr') {\r\n this.renderShape(groupTransform, items[i].it, data[i].it);\r\n } else if (items[i].ty === 'tm') {//\r\n }\r\n }\r\n\r\n if (isMain) {\r\n this.drawLayer();\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) {\r\n if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {\r\n var shapeNodes = styledShape.trNodes;\r\n var paths = shape.paths;\r\n var i;\r\n var len;\r\n var j;\r\n var jLen = paths._length;\r\n shapeNodes.length = 0;\r\n var groupTransformMat = styledShape.transforms.finalTransform;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n var pathNodes = paths.shapes[j];\r\n\r\n if (pathNodes && pathNodes.v) {\r\n len = pathNodes._length;\r\n\r\n for (i = 1; i < len; i += 1) {\r\n if (i === 1) {\r\n shapeNodes.push({\r\n t: 'm',\r\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)\r\n });\r\n }\r\n\r\n shapeNodes.push({\r\n t: 'c',\r\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i])\r\n });\r\n }\r\n\r\n if (len === 1) {\r\n shapeNodes.push({\r\n t: 'm',\r\n p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)\r\n });\r\n }\r\n\r\n if (pathNodes.c && len) {\r\n shapeNodes.push({\r\n t: 'c',\r\n pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0])\r\n });\r\n shapeNodes.push({\r\n t: 'z'\r\n });\r\n }\r\n }\r\n }\r\n\r\n styledShape.trNodes = shapeNodes;\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.renderPath = function (pathData, itemData) {\r\n if (pathData.hd !== true && pathData._shouldRender) {\r\n var i;\r\n var len = itemData.styledShapes.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.renderStyledShape(itemData.styledShapes[i], itemData.sh);\r\n }\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) {\r\n var styleElem = itemData.style;\r\n\r\n if (itemData.c._mdf || this._isFirstFrame) {\r\n styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';\r\n }\r\n\r\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\r\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) {\r\n var styleElem = itemData.style;\r\n var grd;\r\n\r\n if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf)) {\r\n var ctx = this.globalData.canvasContext;\r\n var pt1 = itemData.s.v;\r\n var pt2 = itemData.e.v;\r\n\r\n if (styleData.t === 1) {\r\n grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);\r\n } else {\r\n var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));\r\n var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);\r\n var percent = itemData.h.v;\r\n\r\n if (percent >= 1) {\r\n percent = 0.99;\r\n } else if (percent <= -1) {\r\n percent = -0.99;\r\n }\r\n\r\n var dist = rad * percent;\r\n var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];\r\n var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];\r\n grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);\r\n }\r\n\r\n var i;\r\n var len = styleData.g.p;\r\n var cValues = itemData.g.c;\r\n var opacity = 1;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (itemData.g._hasOpacity && itemData.g._collapsable) {\r\n opacity = itemData.g.o[i * 2 + 1];\r\n }\r\n\r\n grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')');\r\n }\r\n\r\n styleElem.grd = grd;\r\n }\r\n\r\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\r\n };\r\n\r\n CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) {\r\n var styleElem = itemData.style;\r\n var d = itemData.d;\r\n\r\n if (d && (d._mdf || this._isFirstFrame)) {\r\n styleElem.da = d.dashArray;\r\n styleElem[\"do\"] = d.dashoffset[0];\r\n }\r\n\r\n if (itemData.c._mdf || this._isFirstFrame) {\r\n styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')';\r\n }\r\n\r\n if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {\r\n styleElem.coOp = itemData.o.v * groupTransform.opacity;\r\n }\r\n\r\n if (itemData.w._mdf || this._isFirstFrame) {\r\n styleElem.wi = itemData.w.v;\r\n }\r\n };\r\n\r\n CVShapeElement.prototype.destroy = function () {\r\n this.shapesData = null;\r\n this.globalData = null;\r\n this.canvasContext = null;\r\n this.stylesList.length = 0;\r\n this.itemsData.length = 0;\r\n };\r\n\r\n function CVTextElement(data, globalData, comp) {\r\n this.textSpans = [];\r\n this.yOffset = 0;\r\n this.fillColorAnim = false;\r\n this.strokeColorAnim = false;\r\n this.strokeWidthAnim = false;\r\n this.stroke = false;\r\n this.fill = false;\r\n this.justifyOffset = 0;\r\n this.currentRender = null;\r\n this.renderType = 'canvas';\r\n this.values = {\r\n fill: 'rgba(0,0,0,0)',\r\n stroke: 'rgba(0,0,0,0)',\r\n sWidth: 0,\r\n fValue: ''\r\n };\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement);\r\n CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');\r\n\r\n CVTextElement.prototype.buildNewText = function () {\r\n var documentData = this.textProperty.currentData;\r\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\r\n var hasFill = false;\r\n\r\n if (documentData.fc) {\r\n hasFill = true;\r\n this.values.fill = this.buildColor(documentData.fc);\r\n } else {\r\n this.values.fill = 'rgba(0,0,0,0)';\r\n }\r\n\r\n this.fill = hasFill;\r\n var hasStroke = false;\r\n\r\n if (documentData.sc) {\r\n hasStroke = true;\r\n this.values.stroke = this.buildColor(documentData.sc);\r\n this.values.sWidth = documentData.sw;\r\n }\r\n\r\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\r\n var i;\r\n var len;\r\n var letters = documentData.l;\r\n var matrixHelper = this.mHelper;\r\n this.stroke = hasStroke;\r\n this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily;\r\n len = documentData.finalText.length; // this.tHelper.font = this.values.fValue;\r\n\r\n var charData;\r\n var shapeData;\r\n var k;\r\n var kLen;\r\n var shapes;\r\n var j;\r\n var jLen;\r\n var pathNodes;\r\n var commands;\r\n var pathArr;\r\n var singleShape = this.data.singleShape;\r\n var trackingOffset = documentData.tr * 0.001 * documentData.finalSize;\r\n var xPos = 0;\r\n var yPos = 0;\r\n var firstLine = true;\r\n var cnt = 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\r\n shapeData = charData && charData.data || {};\r\n matrixHelper.reset();\r\n\r\n if (singleShape && letters[i].n) {\r\n xPos = -trackingOffset;\r\n yPos += documentData.yOffset;\r\n yPos += firstLine ? 1 : 0;\r\n firstLine = false;\r\n }\r\n\r\n shapes = shapeData.shapes ? shapeData.shapes[0].it : [];\r\n jLen = shapes.length;\r\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\r\n\r\n if (singleShape) {\r\n this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);\r\n }\r\n\r\n commands = createSizedArray(jLen - 1);\r\n var commandsCounter = 0;\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n if (shapes[j].ty === 'sh') {\r\n kLen = shapes[j].ks.k.i.length;\r\n pathNodes = shapes[j].ks.k;\r\n pathArr = [];\r\n\r\n for (k = 1; k < kLen; k += 1) {\r\n if (k === 1) {\r\n pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\r\n }\r\n\r\n pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0));\r\n }\r\n\r\n pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0));\r\n commands[commandsCounter] = pathArr;\r\n commandsCounter += 1;\r\n }\r\n }\r\n\r\n if (singleShape) {\r\n xPos += letters[i].l;\r\n xPos += trackingOffset;\r\n }\r\n\r\n if (this.textSpans[cnt]) {\r\n this.textSpans[cnt].elem = commands;\r\n } else {\r\n this.textSpans[cnt] = {\r\n elem: commands\r\n };\r\n }\r\n\r\n cnt += 1;\r\n }\r\n };\r\n\r\n CVTextElement.prototype.renderInnerContent = function () {\r\n var ctx = this.canvasContext;\r\n ctx.font = this.values.fValue;\r\n ctx.lineCap = 'butt';\r\n ctx.lineJoin = 'miter';\r\n ctx.miterLimit = 4;\r\n\r\n if (!this.data.singleShape) {\r\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\r\n }\r\n\r\n var i;\r\n var len;\r\n var j;\r\n var jLen;\r\n var k;\r\n var kLen;\r\n var renderedLetters = this.textAnimator.renderedLetters;\r\n var letters = this.textProperty.currentData.l;\r\n len = letters.length;\r\n var renderedLetter;\r\n var lastFill = null;\r\n var lastStroke = null;\r\n var lastStrokeW = null;\r\n var commands;\r\n var pathArr;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (!letters[i].n) {\r\n renderedLetter = renderedLetters[i];\r\n\r\n if (renderedLetter) {\r\n this.globalData.renderer.save();\r\n this.globalData.renderer.ctxTransform(renderedLetter.p);\r\n this.globalData.renderer.ctxOpacity(renderedLetter.o);\r\n }\r\n\r\n if (this.fill) {\r\n if (renderedLetter && renderedLetter.fc) {\r\n if (lastFill !== renderedLetter.fc) {\r\n lastFill = renderedLetter.fc;\r\n ctx.fillStyle = renderedLetter.fc;\r\n }\r\n } else if (lastFill !== this.values.fill) {\r\n lastFill = this.values.fill;\r\n ctx.fillStyle = this.values.fill;\r\n }\r\n\r\n commands = this.textSpans[i].elem;\r\n jLen = commands.length;\r\n this.globalData.canvasContext.beginPath();\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n pathArr = commands[j];\r\n kLen = pathArr.length;\r\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\r\n\r\n for (k = 2; k < kLen; k += 6) {\r\n this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\r\n }\r\n }\r\n\r\n this.globalData.canvasContext.closePath();\r\n this.globalData.canvasContext.fill(); /// ctx.fillText(this.textSpans[i].val,0,0);\r\n }\r\n\r\n if (this.stroke) {\r\n if (renderedLetter && renderedLetter.sw) {\r\n if (lastStrokeW !== renderedLetter.sw) {\r\n lastStrokeW = renderedLetter.sw;\r\n ctx.lineWidth = renderedLetter.sw;\r\n }\r\n } else if (lastStrokeW !== this.values.sWidth) {\r\n lastStrokeW = this.values.sWidth;\r\n ctx.lineWidth = this.values.sWidth;\r\n }\r\n\r\n if (renderedLetter && renderedLetter.sc) {\r\n if (lastStroke !== renderedLetter.sc) {\r\n lastStroke = renderedLetter.sc;\r\n ctx.strokeStyle = renderedLetter.sc;\r\n }\r\n } else if (lastStroke !== this.values.stroke) {\r\n lastStroke = this.values.stroke;\r\n ctx.strokeStyle = this.values.stroke;\r\n }\r\n\r\n commands = this.textSpans[i].elem;\r\n jLen = commands.length;\r\n this.globalData.canvasContext.beginPath();\r\n\r\n for (j = 0; j < jLen; j += 1) {\r\n pathArr = commands[j];\r\n kLen = pathArr.length;\r\n this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);\r\n\r\n for (k = 2; k < kLen; k += 6) {\r\n this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);\r\n }\r\n }\r\n\r\n this.globalData.canvasContext.closePath();\r\n this.globalData.canvasContext.stroke(); /// ctx.strokeText(letters[i].val,0,0);\r\n }\r\n\r\n if (renderedLetter) {\r\n this.globalData.renderer.restore();\r\n }\r\n }\r\n }\r\n };\r\n\r\n function CVImageElement(data, globalData, comp) {\r\n this.assetData = globalData.getAssetData(data.refId);\r\n this.img = globalData.imageLoader.getAsset(this.assetData);\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);\r\n CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;\r\n CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\r\n\r\n CVImageElement.prototype.createContent = function () {\r\n if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {\r\n var canvas = createTag('canvas');\r\n canvas.width = this.assetData.w;\r\n canvas.height = this.assetData.h;\r\n var ctx = canvas.getContext('2d');\r\n var imgW = this.img.width;\r\n var imgH = this.img.height;\r\n var imgRel = imgW / imgH;\r\n var canvasRel = this.assetData.w / this.assetData.h;\r\n var widthCrop;\r\n var heightCrop;\r\n var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;\r\n\r\n if (imgRel > canvasRel && par === 'xMidYMid slice' || imgRel < canvasRel && par !== 'xMidYMid slice') {\r\n heightCrop = imgH;\r\n widthCrop = heightCrop * canvasRel;\r\n } else {\r\n widthCrop = imgW;\r\n heightCrop = widthCrop / canvasRel;\r\n }\r\n\r\n ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h);\r\n this.img = canvas;\r\n }\r\n };\r\n\r\n CVImageElement.prototype.renderInnerContent = function () {\r\n this.canvasContext.drawImage(this.img, 0, 0);\r\n };\r\n\r\n CVImageElement.prototype.destroy = function () {\r\n this.img = null;\r\n };\r\n\r\n function CVSolidElement(data, globalData, comp) {\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);\r\n CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;\r\n CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;\r\n\r\n CVSolidElement.prototype.renderInnerContent = function () {\r\n var ctx = this.canvasContext;\r\n ctx.fillStyle = this.data.sc;\r\n ctx.fillRect(0, 0, this.data.sw, this.data.sh); //\r\n };\r\n\r\n function CanvasRendererBase(animationItem, config) {\r\n this.animationItem = animationItem;\r\n this.renderConfig = {\r\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\r\n context: config && config.context || null,\r\n progressiveLoad: config && config.progressiveLoad || false,\r\n preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet',\r\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\r\n contentVisibility: config && config.contentVisibility || 'visible',\r\n className: config && config.className || '',\r\n id: config && config.id || ''\r\n };\r\n this.renderConfig.dpr = config && config.dpr || 1;\r\n\r\n if (this.animationItem.wrapper) {\r\n this.renderConfig.dpr = config && config.dpr || window.devicePixelRatio || 1;\r\n }\r\n\r\n this.renderedFrame = -1;\r\n this.globalData = {\r\n frameNum: -1,\r\n _mdf: false,\r\n renderConfig: this.renderConfig,\r\n currentGlobalAlpha: -1\r\n };\r\n this.contextData = new CVContextData();\r\n this.elements = [];\r\n this.pendingElements = [];\r\n this.transformMat = new Matrix();\r\n this.completeLayers = false;\r\n this.rendererType = 'canvas';\r\n }\r\n\r\n extendPrototype([BaseRenderer], CanvasRendererBase);\r\n\r\n CanvasRendererBase.prototype.createShape = function (data) {\r\n return new CVShapeElement(data, this.globalData, this);\r\n };\r\n\r\n CanvasRendererBase.prototype.createText = function (data) {\r\n return new CVTextElement(data, this.globalData, this);\r\n };\r\n\r\n CanvasRendererBase.prototype.createImage = function (data) {\r\n return new CVImageElement(data, this.globalData, this);\r\n };\r\n\r\n CanvasRendererBase.prototype.createSolid = function (data) {\r\n return new CVSolidElement(data, this.globalData, this);\r\n };\r\n\r\n CanvasRendererBase.prototype.createNull = SVGRenderer.prototype.createNull;\r\n\r\n CanvasRendererBase.prototype.ctxTransform = function (props) {\r\n if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) {\r\n return;\r\n }\r\n\r\n if (!this.renderConfig.clearCanvas) {\r\n this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]);\r\n return;\r\n }\r\n\r\n this.transformMat.cloneFromProps(props);\r\n var cProps = this.contextData.cTr.props;\r\n this.transformMat.transform(cProps[0], cProps[1], cProps[2], cProps[3], cProps[4], cProps[5], cProps[6], cProps[7], cProps[8], cProps[9], cProps[10], cProps[11], cProps[12], cProps[13], cProps[14], cProps[15]); // this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);\r\n\r\n this.contextData.cTr.cloneFromProps(this.transformMat.props);\r\n var trProps = this.contextData.cTr.props;\r\n this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]);\r\n };\r\n\r\n CanvasRendererBase.prototype.ctxOpacity = function (op) {\r\n /* if(op === 1){\r\n return;\r\n } */\r\n if (!this.renderConfig.clearCanvas) {\r\n this.canvasContext.globalAlpha *= op < 0 ? 0 : op;\r\n this.globalData.currentGlobalAlpha = this.contextData.cO;\r\n return;\r\n }\r\n\r\n this.contextData.cO *= op < 0 ? 0 : op;\r\n\r\n if (this.globalData.currentGlobalAlpha !== this.contextData.cO) {\r\n this.canvasContext.globalAlpha = this.contextData.cO;\r\n this.globalData.currentGlobalAlpha = this.contextData.cO;\r\n }\r\n };\r\n\r\n CanvasRendererBase.prototype.reset = function () {\r\n if (!this.renderConfig.clearCanvas) {\r\n this.canvasContext.restore();\r\n return;\r\n }\r\n\r\n this.contextData.reset();\r\n };\r\n\r\n CanvasRendererBase.prototype.save = function (actionFlag) {\r\n if (!this.renderConfig.clearCanvas) {\r\n this.canvasContext.save();\r\n return;\r\n }\r\n\r\n if (actionFlag) {\r\n this.canvasContext.save();\r\n }\r\n\r\n var props = this.contextData.cTr.props;\r\n\r\n if (this.contextData._length <= this.contextData.cArrPos) {\r\n this.contextData.duplicate();\r\n }\r\n\r\n var i;\r\n var arr = this.contextData.saved[this.contextData.cArrPos];\r\n\r\n for (i = 0; i < 16; i += 1) {\r\n arr[i] = props[i];\r\n }\r\n\r\n this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO;\r\n this.contextData.cArrPos += 1;\r\n };\r\n\r\n CanvasRendererBase.prototype.restore = function (actionFlag) {\r\n if (!this.renderConfig.clearCanvas) {\r\n this.canvasContext.restore();\r\n return;\r\n }\r\n\r\n if (actionFlag) {\r\n this.canvasContext.restore();\r\n this.globalData.blendMode = 'source-over';\r\n }\r\n\r\n this.contextData.cArrPos -= 1;\r\n var popped = this.contextData.saved[this.contextData.cArrPos];\r\n var i;\r\n var arr = this.contextData.cTr.props;\r\n\r\n for (i = 0; i < 16; i += 1) {\r\n arr[i] = popped[i];\r\n }\r\n\r\n this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13]);\r\n popped = this.contextData.savedOp[this.contextData.cArrPos];\r\n this.contextData.cO = popped;\r\n\r\n if (this.globalData.currentGlobalAlpha !== popped) {\r\n this.canvasContext.globalAlpha = popped;\r\n this.globalData.currentGlobalAlpha = popped;\r\n }\r\n };\r\n\r\n CanvasRendererBase.prototype.configAnimation = function (animData) {\r\n if (this.animationItem.wrapper) {\r\n this.animationItem.container = createTag('canvas');\r\n var containerStyle = this.animationItem.container.style;\r\n containerStyle.width = '100%';\r\n containerStyle.height = '100%';\r\n var origin = '0px 0px 0px';\r\n containerStyle.transformOrigin = origin;\r\n containerStyle.mozTransformOrigin = origin;\r\n containerStyle.webkitTransformOrigin = origin;\r\n containerStyle['-webkit-transform'] = origin;\r\n containerStyle.contentVisibility = this.renderConfig.contentVisibility;\r\n this.animationItem.wrapper.appendChild(this.animationItem.container);\r\n this.canvasContext = this.animationItem.container.getContext('2d');\r\n\r\n if (this.renderConfig.className) {\r\n this.animationItem.container.setAttribute('class', this.renderConfig.className);\r\n }\r\n\r\n if (this.renderConfig.id) {\r\n this.animationItem.container.setAttribute('id', this.renderConfig.id);\r\n }\r\n } else {\r\n this.canvasContext = this.renderConfig.context;\r\n }\r\n\r\n this.data = animData;\r\n this.layers = animData.layers;\r\n this.transformCanvas = {\r\n w: animData.w,\r\n h: animData.h,\r\n sx: 0,\r\n sy: 0,\r\n tx: 0,\r\n ty: 0\r\n };\r\n this.setupGlobalData(animData, document.body);\r\n this.globalData.canvasContext = this.canvasContext;\r\n this.globalData.renderer = this;\r\n this.globalData.isDashed = false;\r\n this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;\r\n this.globalData.transformCanvas = this.transformCanvas;\r\n this.elements = createSizedArray(animData.layers.length);\r\n this.updateContainerSize();\r\n };\r\n\r\n CanvasRendererBase.prototype.updateContainerSize = function (width, height) {\r\n this.reset();\r\n var elementWidth;\r\n var elementHeight;\r\n\r\n if (width) {\r\n elementWidth = width;\r\n elementHeight = height;\r\n this.canvasContext.canvas.width = elementWidth;\r\n this.canvasContext.canvas.height = elementHeight;\r\n } else {\r\n if (this.animationItem.wrapper && this.animationItem.container) {\r\n elementWidth = this.animationItem.wrapper.offsetWidth;\r\n elementHeight = this.animationItem.wrapper.offsetHeight;\r\n } else {\r\n elementWidth = this.canvasContext.canvas.width;\r\n elementHeight = this.canvasContext.canvas.height;\r\n }\r\n\r\n this.canvasContext.canvas.width = elementWidth * this.renderConfig.dpr;\r\n this.canvasContext.canvas.height = elementHeight * this.renderConfig.dpr;\r\n }\r\n\r\n var elementRel;\r\n var animationRel;\r\n\r\n if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) {\r\n var par = this.renderConfig.preserveAspectRatio.split(' ');\r\n var fillType = par[1] || 'meet';\r\n var pos = par[0] || 'xMidYMid';\r\n var xPos = pos.substr(0, 4);\r\n var yPos = pos.substr(4);\r\n elementRel = elementWidth / elementHeight;\r\n animationRel = this.transformCanvas.w / this.transformCanvas.h;\r\n\r\n if (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice') {\r\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\r\n this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\r\n } else {\r\n this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\r\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\r\n }\r\n\r\n if (xPos === 'xMid' && (animationRel < elementRel && fillType === 'meet' || animationRel > elementRel && fillType === 'slice')) {\r\n this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2 * this.renderConfig.dpr;\r\n } else if (xPos === 'xMax' && (animationRel < elementRel && fillType === 'meet' || animationRel > elementRel && fillType === 'slice')) {\r\n this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr;\r\n } else {\r\n this.transformCanvas.tx = 0;\r\n }\r\n\r\n if (yPos === 'YMid' && (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice')) {\r\n this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2 * this.renderConfig.dpr;\r\n } else if (yPos === 'YMax' && (animationRel > elementRel && fillType === 'meet' || animationRel < elementRel && fillType === 'slice')) {\r\n this.transformCanvas.ty = (elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) * this.renderConfig.dpr;\r\n } else {\r\n this.transformCanvas.ty = 0;\r\n }\r\n } else if (this.renderConfig.preserveAspectRatio === 'none') {\r\n this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr);\r\n this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr);\r\n this.transformCanvas.tx = 0;\r\n this.transformCanvas.ty = 0;\r\n } else {\r\n this.transformCanvas.sx = this.renderConfig.dpr;\r\n this.transformCanvas.sy = this.renderConfig.dpr;\r\n this.transformCanvas.tx = 0;\r\n this.transformCanvas.ty = 0;\r\n }\r\n\r\n this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1];\r\n /* var i, len = this.elements.length;\r\n for(i=0;i= 0; i -= 1) {\r\n if (this.elements[i]) {\r\n this.elements[i].destroy();\r\n }\r\n }\r\n\r\n this.elements.length = 0;\r\n this.globalData.canvasContext = null;\r\n this.animationItem.container = null;\r\n this.destroyed = true;\r\n };\r\n\r\n CanvasRendererBase.prototype.renderFrame = function (num, forceRender) {\r\n if (this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender || this.destroyed || num === -1) {\r\n return;\r\n }\r\n\r\n this.renderedFrame = num;\r\n this.globalData.frameNum = num - this.animationItem._isFirstFrame;\r\n this.globalData.frameId += 1;\r\n this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;\r\n this.globalData.projectInterface.currentFrame = num; // console.log('--------');\r\n // console.log('NEW: ',num);\r\n\r\n var i;\r\n var len = this.layers.length;\r\n\r\n if (!this.completeLayers) {\r\n this.checkLayers(num);\r\n }\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.completeLayers || this.elements[i]) {\r\n this.elements[i].prepareFrame(num - this.layers[i].st);\r\n }\r\n }\r\n\r\n if (this.globalData._mdf) {\r\n if (this.renderConfig.clearCanvas === true) {\r\n this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);\r\n } else {\r\n this.save();\r\n }\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (this.completeLayers || this.elements[i]) {\r\n this.elements[i].renderFrame();\r\n }\r\n }\r\n\r\n if (this.renderConfig.clearCanvas !== true) {\r\n this.restore();\r\n }\r\n }\r\n };\r\n\r\n CanvasRendererBase.prototype.buildItem = function (pos) {\r\n var elements = this.elements;\r\n\r\n if (elements[pos] || this.layers[pos].ty === 99) {\r\n return;\r\n }\r\n\r\n var element = this.createItem(this.layers[pos], this, this.globalData);\r\n elements[pos] = element;\r\n element.initExpressions();\r\n /* if(this.layers[pos].ty === 0){\r\n element.resize(this.globalData.transformCanvas);\r\n } */\r\n };\r\n\r\n CanvasRendererBase.prototype.checkPendingElements = function () {\r\n while (this.pendingElements.length) {\r\n var element = this.pendingElements.pop();\r\n element.checkParenting();\r\n }\r\n };\r\n\r\n CanvasRendererBase.prototype.hide = function () {\r\n this.animationItem.container.style.display = 'none';\r\n };\r\n\r\n CanvasRendererBase.prototype.show = function () {\r\n this.animationItem.container.style.display = 'block';\r\n };\r\n\r\n function CVCompElement(data, globalData, comp) {\r\n this.completeLayers = false;\r\n this.layers = data.layers;\r\n this.pendingElements = [];\r\n this.elements = createSizedArray(this.layers.length);\r\n this.initElement(data, globalData, comp);\r\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\r\n _placeholder: true\r\n };\r\n }\r\n\r\n extendPrototype([CanvasRendererBase, ICompElement, CVBaseElement], CVCompElement);\r\n\r\n CVCompElement.prototype.renderInnerContent = function () {\r\n var ctx = this.canvasContext;\r\n ctx.beginPath();\r\n ctx.moveTo(0, 0);\r\n ctx.lineTo(this.data.w, 0);\r\n ctx.lineTo(this.data.w, this.data.h);\r\n ctx.lineTo(0, this.data.h);\r\n ctx.lineTo(0, 0);\r\n ctx.clip();\r\n var i;\r\n var len = this.layers.length;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (this.completeLayers || this.elements[i]) {\r\n this.elements[i].renderFrame();\r\n }\r\n }\r\n };\r\n\r\n CVCompElement.prototype.destroy = function () {\r\n var i;\r\n var len = this.layers.length;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n if (this.elements[i]) {\r\n this.elements[i].destroy();\r\n }\r\n }\r\n\r\n this.layers = null;\r\n this.elements = null;\r\n };\r\n\r\n CVCompElement.prototype.createComp = function (data) {\r\n return new CVCompElement(data, this.globalData, this);\r\n };\r\n\r\n function CanvasRenderer(animationItem, config) {\r\n this.animationItem = animationItem;\r\n this.renderConfig = {\r\n clearCanvas: config && config.clearCanvas !== undefined ? config.clearCanvas : true,\r\n context: config && config.context || null,\r\n progressiveLoad: config && config.progressiveLoad || false,\r\n preserveAspectRatio: config && config.preserveAspectRatio || 'xMidYMid meet',\r\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\r\n contentVisibility: config && config.contentVisibility || 'visible',\r\n className: config && config.className || '',\r\n id: config && config.id || '',\r\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\r\n };\r\n this.renderConfig.dpr = config && config.dpr || 1;\r\n\r\n if (this.animationItem.wrapper) {\r\n this.renderConfig.dpr = config && config.dpr || window.devicePixelRatio || 1;\r\n }\r\n\r\n this.renderedFrame = -1;\r\n this.globalData = {\r\n frameNum: -1,\r\n _mdf: false,\r\n renderConfig: this.renderConfig,\r\n currentGlobalAlpha: -1\r\n };\r\n this.contextData = new CVContextData();\r\n this.elements = [];\r\n this.pendingElements = [];\r\n this.transformMat = new Matrix();\r\n this.completeLayers = false;\r\n this.rendererType = 'canvas';\r\n }\r\n\r\n extendPrototype([CanvasRendererBase], CanvasRenderer);\r\n\r\n CanvasRenderer.prototype.createComp = function (data) {\r\n return new CVCompElement(data, this.globalData, this);\r\n };\r\n\r\n function HBaseElement() {}\r\n\r\n HBaseElement.prototype = {\r\n checkBlendMode: function checkBlendMode() {},\r\n initRendererElement: function initRendererElement() {\r\n this.baseElement = createTag(this.data.tg || 'div');\r\n\r\n if (this.data.hasMask) {\r\n this.svgElement = createNS('svg');\r\n this.layerElement = createNS('g');\r\n this.maskedElement = this.layerElement;\r\n this.svgElement.appendChild(this.layerElement);\r\n this.baseElement.appendChild(this.svgElement);\r\n } else {\r\n this.layerElement = this.baseElement;\r\n }\r\n\r\n styleDiv(this.baseElement);\r\n },\r\n createContainerElements: function createContainerElements() {\r\n this.renderableEffectsManager = new CVEffects(this);\r\n this.transformedElement = this.baseElement;\r\n this.maskedElement = this.layerElement;\r\n\r\n if (this.data.ln) {\r\n this.layerElement.setAttribute('id', this.data.ln);\r\n }\r\n\r\n if (this.data.cl) {\r\n this.layerElement.setAttribute('class', this.data.cl);\r\n }\r\n\r\n if (this.data.bm !== 0) {\r\n this.setBlendMode();\r\n }\r\n },\r\n renderElement: function renderElement() {\r\n var transformedElementStyle = this.transformedElement ? this.transformedElement.style : {};\r\n\r\n if (this.finalTransform._matMdf) {\r\n var matrixValue = this.finalTransform.mat.toCSS();\r\n transformedElementStyle.transform = matrixValue;\r\n transformedElementStyle.webkitTransform = matrixValue;\r\n }\r\n\r\n if (this.finalTransform._opMdf) {\r\n transformedElementStyle.opacity = this.finalTransform.mProp.o.v;\r\n }\r\n },\r\n renderFrame: function renderFrame() {\r\n // If it is exported as hidden (data.hd === true) no need to render\r\n // If it is not visible no need to render\r\n if (this.data.hd || this.hidden) {\r\n return;\r\n }\r\n\r\n this.renderTransform();\r\n this.renderRenderable();\r\n this.renderElement();\r\n this.renderInnerContent();\r\n\r\n if (this._isFirstFrame) {\r\n this._isFirstFrame = false;\r\n }\r\n },\r\n destroy: function destroy() {\r\n this.layerElement = null;\r\n this.transformedElement = null;\r\n\r\n if (this.matteElement) {\r\n this.matteElement = null;\r\n }\r\n\r\n if (this.maskManager) {\r\n this.maskManager.destroy();\r\n this.maskManager = null;\r\n }\r\n },\r\n createRenderableComponents: function createRenderableComponents() {\r\n this.maskManager = new MaskElement(this.data, this, this.globalData);\r\n },\r\n addEffects: function addEffects() {},\r\n setMatte: function setMatte() {}\r\n };\r\n HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;\r\n HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;\r\n HBaseElement.prototype.buildElementParenting = BaseRenderer.prototype.buildElementParenting;\r\n\r\n function HSolidElement(data, globalData, comp) {\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], HSolidElement);\r\n\r\n HSolidElement.prototype.createContent = function () {\r\n var rect;\r\n\r\n if (this.data.hasMask) {\r\n rect = createNS('rect');\r\n rect.setAttribute('width', this.data.sw);\r\n rect.setAttribute('height', this.data.sh);\r\n rect.setAttribute('fill', this.data.sc);\r\n this.svgElement.setAttribute('width', this.data.sw);\r\n this.svgElement.setAttribute('height', this.data.sh);\r\n } else {\r\n rect = createTag('div');\r\n rect.style.width = this.data.sw + 'px';\r\n rect.style.height = this.data.sh + 'px';\r\n rect.style.backgroundColor = this.data.sc;\r\n }\r\n\r\n this.layerElement.appendChild(rect);\r\n };\r\n\r\n function HShapeElement(data, globalData, comp) {\r\n // List of drawable elements\r\n this.shapes = []; // Full shape data\r\n\r\n this.shapesData = data.shapes; // List of styles that will be applied to shapes\r\n\r\n this.stylesList = []; // List of modifiers that will be applied to shapes\r\n\r\n this.shapeModifiers = []; // List of items in shape tree\r\n\r\n this.itemsData = []; // List of items in previous shape tree\r\n\r\n this.processedElements = []; // List of animated components\r\n\r\n this.animatedContents = [];\r\n this.shapesContainer = createNS('g');\r\n this.initElement(data, globalData, comp); // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.\r\n // List of elements that have been created\r\n\r\n this.prevViewData = [];\r\n this.currentBBox = {\r\n x: 999999,\r\n y: -999999,\r\n h: 0,\r\n w: 0\r\n };\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, HSolidElement, SVGShapeElement, HBaseElement, HierarchyElement, FrameElement, RenderableElement], HShapeElement);\r\n HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;\r\n\r\n HShapeElement.prototype.createContent = function () {\r\n var cont;\r\n this.baseElement.style.fontSize = 0;\r\n\r\n if (this.data.hasMask) {\r\n this.layerElement.appendChild(this.shapesContainer);\r\n cont = this.svgElement;\r\n } else {\r\n cont = createNS('svg');\r\n var size = this.comp.data ? this.comp.data : this.globalData.compSize;\r\n cont.setAttribute('width', size.w);\r\n cont.setAttribute('height', size.h);\r\n cont.appendChild(this.shapesContainer);\r\n this.layerElement.appendChild(cont);\r\n }\r\n\r\n this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.shapesContainer, 0, [], true);\r\n this.filterUniqueShapes();\r\n this.shapeCont = cont;\r\n };\r\n\r\n HShapeElement.prototype.getTransformedPoint = function (transformers, point) {\r\n var i;\r\n var len = transformers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);\r\n }\r\n\r\n return point;\r\n };\r\n\r\n HShapeElement.prototype.calculateShapeBoundingBox = function (item, boundingBox) {\r\n var shape = item.sh.v;\r\n var transformers = item.transformers;\r\n var i;\r\n var len = shape._length;\r\n var vPoint;\r\n var oPoint;\r\n var nextIPoint;\r\n var nextVPoint;\r\n\r\n if (len <= 1) {\r\n return;\r\n }\r\n\r\n for (i = 0; i < len - 1; i += 1) {\r\n vPoint = this.getTransformedPoint(transformers, shape.v[i]);\r\n oPoint = this.getTransformedPoint(transformers, shape.o[i]);\r\n nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);\r\n nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);\r\n this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\r\n }\r\n\r\n if (shape.c) {\r\n vPoint = this.getTransformedPoint(transformers, shape.v[i]);\r\n oPoint = this.getTransformedPoint(transformers, shape.o[i]);\r\n nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);\r\n nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);\r\n this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);\r\n }\r\n };\r\n\r\n HShapeElement.prototype.checkBounds = function (vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {\r\n this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);\r\n var bounds = this.shapeBoundingBox;\r\n boundingBox.x = bmMin(bounds.left, boundingBox.x);\r\n boundingBox.xMax = bmMax(bounds.right, boundingBox.xMax);\r\n boundingBox.y = bmMin(bounds.top, boundingBox.y);\r\n boundingBox.yMax = bmMax(bounds.bottom, boundingBox.yMax);\r\n };\r\n\r\n HShapeElement.prototype.shapeBoundingBox = {\r\n left: 0,\r\n right: 0,\r\n top: 0,\r\n bottom: 0\r\n };\r\n HShapeElement.prototype.tempBoundingBox = {\r\n x: 0,\r\n xMax: 0,\r\n y: 0,\r\n yMax: 0,\r\n width: 0,\r\n height: 0\r\n };\r\n\r\n HShapeElement.prototype.getBoundsOfCurve = function (p0, p1, p2, p3) {\r\n var bounds = [[p0[0], p3[0]], [p0[1], p3[1]]];\r\n\r\n for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) {\r\n // eslint-disable-line no-plusplus\r\n b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];\r\n a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];\r\n c = 3 * p1[i] - 3 * p0[i];\r\n b |= 0; // eslint-disable-line no-bitwise\r\n\r\n a |= 0; // eslint-disable-line no-bitwise\r\n\r\n c |= 0; // eslint-disable-line no-bitwise\r\n\r\n if (a === 0 && b === 0) {//\r\n } else if (a === 0) {\r\n t = -c / b;\r\n\r\n if (t > 0 && t < 1) {\r\n bounds[i].push(this.calculateF(t, p0, p1, p2, p3, i));\r\n }\r\n } else {\r\n b2ac = b * b - 4 * c * a;\r\n\r\n if (b2ac >= 0) {\r\n t1 = (-b + bmSqrt(b2ac)) / (2 * a);\r\n if (t1 > 0 && t1 < 1) bounds[i].push(this.calculateF(t1, p0, p1, p2, p3, i));\r\n t2 = (-b - bmSqrt(b2ac)) / (2 * a);\r\n if (t2 > 0 && t2 < 1) bounds[i].push(this.calculateF(t2, p0, p1, p2, p3, i));\r\n }\r\n }\r\n }\r\n\r\n this.shapeBoundingBox.left = bmMin.apply(null, bounds[0]);\r\n this.shapeBoundingBox.top = bmMin.apply(null, bounds[1]);\r\n this.shapeBoundingBox.right = bmMax.apply(null, bounds[0]);\r\n this.shapeBoundingBox.bottom = bmMax.apply(null, bounds[1]);\r\n };\r\n\r\n HShapeElement.prototype.calculateF = function (t, p0, p1, p2, p3, i) {\r\n return bmPow(1 - t, 3) * p0[i] + 3 * bmPow(1 - t, 2) * t * p1[i] + 3 * (1 - t) * bmPow(t, 2) * p2[i] + bmPow(t, 3) * p3[i];\r\n };\r\n\r\n HShapeElement.prototype.calculateBoundingBox = function (itemsData, boundingBox) {\r\n var i;\r\n var len = itemsData.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (itemsData[i] && itemsData[i].sh) {\r\n this.calculateShapeBoundingBox(itemsData[i], boundingBox);\r\n } else if (itemsData[i] && itemsData[i].it) {\r\n this.calculateBoundingBox(itemsData[i].it, boundingBox);\r\n } else if (itemsData[i] && itemsData[i].style && itemsData[i].w) {\r\n this.expandStrokeBoundingBox(itemsData[i].w, boundingBox);\r\n }\r\n }\r\n };\r\n\r\n HShapeElement.prototype.expandStrokeBoundingBox = function (widthProperty, boundingBox) {\r\n var width = 0;\r\n\r\n if (widthProperty.keyframes) {\r\n for (var i = 0; i < widthProperty.keyframes.length; i += 1) {\r\n var kfw = widthProperty.keyframes[i].s;\r\n\r\n if (kfw > width) {\r\n width = kfw;\r\n }\r\n }\r\n\r\n width *= widthProperty.mult;\r\n } else {\r\n width = widthProperty.v * widthProperty.mult;\r\n }\r\n\r\n boundingBox.x -= width;\r\n boundingBox.xMax += width;\r\n boundingBox.y -= width;\r\n boundingBox.yMax += width;\r\n };\r\n\r\n HShapeElement.prototype.currentBoxContains = function (box) {\r\n return this.currentBBox.x <= box.x && this.currentBBox.y <= box.y && this.currentBBox.width + this.currentBBox.x >= box.x + box.width && this.currentBBox.height + this.currentBBox.y >= box.y + box.height;\r\n };\r\n\r\n HShapeElement.prototype.renderInnerContent = function () {\r\n this._renderShapeFrame();\r\n\r\n if (!this.hidden && (this._isFirstFrame || this._mdf)) {\r\n var tempBoundingBox = this.tempBoundingBox;\r\n var max = 999999;\r\n tempBoundingBox.x = max;\r\n tempBoundingBox.xMax = -max;\r\n tempBoundingBox.y = max;\r\n tempBoundingBox.yMax = -max;\r\n this.calculateBoundingBox(this.itemsData, tempBoundingBox);\r\n tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;\r\n tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y; // var tempBoundingBox = this.shapeCont.getBBox();\r\n\r\n if (this.currentBoxContains(tempBoundingBox)) {\r\n return;\r\n }\r\n\r\n var changed = false;\r\n\r\n if (this.currentBBox.w !== tempBoundingBox.width) {\r\n this.currentBBox.w = tempBoundingBox.width;\r\n this.shapeCont.setAttribute('width', tempBoundingBox.width);\r\n changed = true;\r\n }\r\n\r\n if (this.currentBBox.h !== tempBoundingBox.height) {\r\n this.currentBBox.h = tempBoundingBox.height;\r\n this.shapeCont.setAttribute('height', tempBoundingBox.height);\r\n changed = true;\r\n }\r\n\r\n if (changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y) {\r\n this.currentBBox.w = tempBoundingBox.width;\r\n this.currentBBox.h = tempBoundingBox.height;\r\n this.currentBBox.x = tempBoundingBox.x;\r\n this.currentBBox.y = tempBoundingBox.y;\r\n this.shapeCont.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\r\n var shapeStyle = this.shapeCont.style;\r\n var shapeTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\r\n shapeStyle.transform = shapeTransform;\r\n shapeStyle.webkitTransform = shapeTransform;\r\n }\r\n }\r\n };\r\n\r\n function HTextElement(data, globalData, comp) {\r\n this.textSpans = [];\r\n this.textPaths = [];\r\n this.currentBBox = {\r\n x: 999999,\r\n y: -999999,\r\n h: 0,\r\n w: 0\r\n };\r\n this.renderType = 'svg';\r\n this.isMasked = false;\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, HBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], HTextElement);\r\n\r\n HTextElement.prototype.createContent = function () {\r\n this.isMasked = this.checkMasks();\r\n\r\n if (this.isMasked) {\r\n this.renderType = 'svg';\r\n this.compW = this.comp.data.w;\r\n this.compH = this.comp.data.h;\r\n this.svgElement.setAttribute('width', this.compW);\r\n this.svgElement.setAttribute('height', this.compH);\r\n var g = createNS('g');\r\n this.maskedElement.appendChild(g);\r\n this.innerElem = g;\r\n } else {\r\n this.renderType = 'html';\r\n this.innerElem = this.layerElement;\r\n }\r\n\r\n this.checkParenting();\r\n };\r\n\r\n HTextElement.prototype.buildNewText = function () {\r\n var documentData = this.textProperty.currentData;\r\n this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);\r\n var innerElemStyle = this.innerElem.style;\r\n var textColor = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';\r\n innerElemStyle.fill = textColor;\r\n innerElemStyle.color = textColor;\r\n\r\n if (documentData.sc) {\r\n innerElemStyle.stroke = this.buildColor(documentData.sc);\r\n innerElemStyle.strokeWidth = documentData.sw + 'px';\r\n }\r\n\r\n var fontData = this.globalData.fontManager.getFontByName(documentData.f);\r\n\r\n if (!this.globalData.fontManager.chars) {\r\n innerElemStyle.fontSize = documentData.finalSize + 'px';\r\n innerElemStyle.lineHeight = documentData.finalSize + 'px';\r\n\r\n if (fontData.fClass) {\r\n this.innerElem.className = fontData.fClass;\r\n } else {\r\n innerElemStyle.fontFamily = fontData.fFamily;\r\n var fWeight = documentData.fWeight;\r\n var fStyle = documentData.fStyle;\r\n innerElemStyle.fontStyle = fStyle;\r\n innerElemStyle.fontWeight = fWeight;\r\n }\r\n }\r\n\r\n var i;\r\n var len;\r\n var letters = documentData.l;\r\n len = letters.length;\r\n var tSpan;\r\n var tParent;\r\n var tCont;\r\n var matrixHelper = this.mHelper;\r\n var shapes;\r\n var shapeStr = '';\r\n var cnt = 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.globalData.fontManager.chars) {\r\n if (!this.textPaths[cnt]) {\r\n tSpan = createNS('path');\r\n tSpan.setAttribute('stroke-linecap', lineCapEnum[1]);\r\n tSpan.setAttribute('stroke-linejoin', lineJoinEnum[2]);\r\n tSpan.setAttribute('stroke-miterlimit', '4');\r\n } else {\r\n tSpan = this.textPaths[cnt];\r\n }\r\n\r\n if (!this.isMasked) {\r\n if (this.textSpans[cnt]) {\r\n tParent = this.textSpans[cnt];\r\n tCont = tParent.children[0];\r\n } else {\r\n tParent = createTag('div');\r\n tParent.style.lineHeight = 0;\r\n tCont = createNS('svg');\r\n tCont.appendChild(tSpan);\r\n styleDiv(tParent);\r\n }\r\n }\r\n } else if (!this.isMasked) {\r\n if (this.textSpans[cnt]) {\r\n tParent = this.textSpans[cnt];\r\n tSpan = this.textPaths[cnt];\r\n } else {\r\n tParent = createTag('span');\r\n styleDiv(tParent);\r\n tSpan = createTag('span');\r\n styleDiv(tSpan);\r\n tParent.appendChild(tSpan);\r\n }\r\n } else {\r\n tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');\r\n } // tSpan.setAttribute('visibility', 'hidden');\r\n\r\n\r\n if (this.globalData.fontManager.chars) {\r\n var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);\r\n var shapeData;\r\n\r\n if (charData) {\r\n shapeData = charData.data;\r\n } else {\r\n shapeData = null;\r\n }\r\n\r\n matrixHelper.reset();\r\n\r\n if (shapeData && shapeData.shapes && shapeData.shapes.length) {\r\n shapes = shapeData.shapes[0].it;\r\n matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);\r\n shapeStr = this.createPathShape(matrixHelper, shapes);\r\n tSpan.setAttribute('d', shapeStr);\r\n }\r\n\r\n if (!this.isMasked) {\r\n this.innerElem.appendChild(tParent);\r\n\r\n if (shapeData && shapeData.shapes) {\r\n // document.body.appendChild is needed to get exact measure of shape\r\n document.body.appendChild(tCont);\r\n var boundingBox = tCont.getBBox();\r\n tCont.setAttribute('width', boundingBox.width + 2);\r\n tCont.setAttribute('height', boundingBox.height + 2);\r\n tCont.setAttribute('viewBox', boundingBox.x - 1 + ' ' + (boundingBox.y - 1) + ' ' + (boundingBox.width + 2) + ' ' + (boundingBox.height + 2));\r\n var tContStyle = tCont.style;\r\n var tContTranslation = 'translate(' + (boundingBox.x - 1) + 'px,' + (boundingBox.y - 1) + 'px)';\r\n tContStyle.transform = tContTranslation;\r\n tContStyle.webkitTransform = tContTranslation;\r\n letters[i].yOffset = boundingBox.y - 1;\r\n } else {\r\n tCont.setAttribute('width', 1);\r\n tCont.setAttribute('height', 1);\r\n }\r\n\r\n tParent.appendChild(tCont);\r\n } else {\r\n this.innerElem.appendChild(tSpan);\r\n }\r\n } else {\r\n tSpan.textContent = letters[i].val;\r\n tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\r\n\r\n if (!this.isMasked) {\r\n this.innerElem.appendChild(tParent); //\r\n\r\n var tStyle = tSpan.style;\r\n var tSpanTranslation = 'translate3d(0,' + -documentData.finalSize / 1.2 + 'px,0)';\r\n tStyle.transform = tSpanTranslation;\r\n tStyle.webkitTransform = tSpanTranslation;\r\n } else {\r\n this.innerElem.appendChild(tSpan);\r\n }\r\n } //\r\n\r\n\r\n if (!this.isMasked) {\r\n this.textSpans[cnt] = tParent;\r\n } else {\r\n this.textSpans[cnt] = tSpan;\r\n }\r\n\r\n this.textSpans[cnt].style.display = 'block';\r\n this.textPaths[cnt] = tSpan;\r\n cnt += 1;\r\n }\r\n\r\n while (cnt < this.textSpans.length) {\r\n this.textSpans[cnt].style.display = 'none';\r\n cnt += 1;\r\n }\r\n };\r\n\r\n HTextElement.prototype.renderInnerContent = function () {\r\n var svgStyle;\r\n\r\n if (this.data.singleShape) {\r\n if (!this._isFirstFrame && !this.lettersChangedFlag) {\r\n return;\r\n }\r\n\r\n if (this.isMasked && this.finalTransform._matMdf) {\r\n // Todo Benchmark if using this is better than getBBox\r\n this.svgElement.setAttribute('viewBox', -this.finalTransform.mProp.p.v[0] + ' ' + -this.finalTransform.mProp.p.v[1] + ' ' + this.compW + ' ' + this.compH);\r\n svgStyle = this.svgElement.style;\r\n var translation = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';\r\n svgStyle.transform = translation;\r\n svgStyle.webkitTransform = translation;\r\n }\r\n }\r\n\r\n this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);\r\n\r\n if (!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag) {\r\n return;\r\n }\r\n\r\n var i;\r\n var len;\r\n var count = 0;\r\n var renderedLetters = this.textAnimator.renderedLetters;\r\n var letters = this.textProperty.currentData.l;\r\n len = letters.length;\r\n var renderedLetter;\r\n var textSpan;\r\n var textPath;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (letters[i].n) {\r\n count += 1;\r\n } else {\r\n textSpan = this.textSpans[i];\r\n textPath = this.textPaths[i];\r\n renderedLetter = renderedLetters[count];\r\n count += 1;\r\n\r\n if (renderedLetter._mdf.m) {\r\n if (!this.isMasked) {\r\n textSpan.style.webkitTransform = renderedLetter.m;\r\n textSpan.style.transform = renderedLetter.m;\r\n } else {\r\n textSpan.setAttribute('transform', renderedLetter.m);\r\n }\r\n } /// /textSpan.setAttribute('opacity',renderedLetter.o);\r\n\r\n\r\n textSpan.style.opacity = renderedLetter.o;\r\n\r\n if (renderedLetter.sw && renderedLetter._mdf.sw) {\r\n textPath.setAttribute('stroke-width', renderedLetter.sw);\r\n }\r\n\r\n if (renderedLetter.sc && renderedLetter._mdf.sc) {\r\n textPath.setAttribute('stroke', renderedLetter.sc);\r\n }\r\n\r\n if (renderedLetter.fc && renderedLetter._mdf.fc) {\r\n textPath.setAttribute('fill', renderedLetter.fc);\r\n textPath.style.color = renderedLetter.fc;\r\n }\r\n }\r\n }\r\n\r\n if (this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)) {\r\n var boundingBox = this.innerElem.getBBox();\r\n\r\n if (this.currentBBox.w !== boundingBox.width) {\r\n this.currentBBox.w = boundingBox.width;\r\n this.svgElement.setAttribute('width', boundingBox.width);\r\n }\r\n\r\n if (this.currentBBox.h !== boundingBox.height) {\r\n this.currentBBox.h = boundingBox.height;\r\n this.svgElement.setAttribute('height', boundingBox.height);\r\n }\r\n\r\n var margin = 1;\r\n\r\n if (this.currentBBox.w !== boundingBox.width + margin * 2 || this.currentBBox.h !== boundingBox.height + margin * 2 || this.currentBBox.x !== boundingBox.x - margin || this.currentBBox.y !== boundingBox.y - margin) {\r\n this.currentBBox.w = boundingBox.width + margin * 2;\r\n this.currentBBox.h = boundingBox.height + margin * 2;\r\n this.currentBBox.x = boundingBox.x - margin;\r\n this.currentBBox.y = boundingBox.y - margin;\r\n this.svgElement.setAttribute('viewBox', this.currentBBox.x + ' ' + this.currentBBox.y + ' ' + this.currentBBox.w + ' ' + this.currentBBox.h);\r\n svgStyle = this.svgElement.style;\r\n var svgTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';\r\n svgStyle.transform = svgTransform;\r\n svgStyle.webkitTransform = svgTransform;\r\n }\r\n }\r\n };\r\n\r\n function HCameraElement(data, globalData, comp) {\r\n this.initFrame();\r\n this.initBaseData(data, globalData, comp);\r\n this.initHierarchy();\r\n var getProp = PropertyFactory.getProp;\r\n this.pe = getProp(this, data.pe, 0, 0, this);\r\n\r\n if (data.ks.p.s) {\r\n this.px = getProp(this, data.ks.p.x, 1, 0, this);\r\n this.py = getProp(this, data.ks.p.y, 1, 0, this);\r\n this.pz = getProp(this, data.ks.p.z, 1, 0, this);\r\n } else {\r\n this.p = getProp(this, data.ks.p, 1, 0, this);\r\n }\r\n\r\n if (data.ks.a) {\r\n this.a = getProp(this, data.ks.a, 1, 0, this);\r\n }\r\n\r\n if (data.ks.or.k.length && data.ks.or.k[0].to) {\r\n var i;\r\n var len = data.ks.or.k.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n data.ks.or.k[i].to = null;\r\n data.ks.or.k[i].ti = null;\r\n }\r\n }\r\n\r\n this.or = getProp(this, data.ks.or, 1, degToRads, this);\r\n this.or.sh = true;\r\n this.rx = getProp(this, data.ks.rx, 0, degToRads, this);\r\n this.ry = getProp(this, data.ks.ry, 0, degToRads, this);\r\n this.rz = getProp(this, data.ks.rz, 0, degToRads, this);\r\n this.mat = new Matrix();\r\n this._prevMat = new Matrix();\r\n this._isFirstFrame = true; // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.\r\n\r\n this.finalTransform = {\r\n mProp: this\r\n };\r\n }\r\n\r\n extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);\r\n\r\n HCameraElement.prototype.setup = function () {\r\n var i;\r\n var len = this.comp.threeDElements.length;\r\n var comp;\r\n var perspectiveStyle;\r\n var containerStyle;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n // [perspectiveElem,container]\r\n comp = this.comp.threeDElements[i];\r\n\r\n if (comp.type === '3d') {\r\n perspectiveStyle = comp.perspectiveElem.style;\r\n containerStyle = comp.container.style;\r\n var perspective = this.pe.v + 'px';\r\n var origin = '0px 0px 0px';\r\n var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\r\n perspectiveStyle.perspective = perspective;\r\n perspectiveStyle.webkitPerspective = perspective;\r\n containerStyle.transformOrigin = origin;\r\n containerStyle.mozTransformOrigin = origin;\r\n containerStyle.webkitTransformOrigin = origin;\r\n perspectiveStyle.transform = matrix;\r\n perspectiveStyle.webkitTransform = matrix;\r\n }\r\n }\r\n };\r\n\r\n HCameraElement.prototype.createElements = function () {};\r\n\r\n HCameraElement.prototype.hide = function () {};\r\n\r\n HCameraElement.prototype.renderFrame = function () {\r\n var _mdf = this._isFirstFrame;\r\n var i;\r\n var len;\r\n\r\n if (this.hierarchy) {\r\n len = this.hierarchy.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;\r\n }\r\n }\r\n\r\n if (_mdf || this.pe._mdf || this.p && this.p._mdf || this.px && (this.px._mdf || this.py._mdf || this.pz._mdf) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || this.a && this.a._mdf) {\r\n this.mat.reset();\r\n\r\n if (this.hierarchy) {\r\n len = this.hierarchy.length - 1;\r\n\r\n for (i = len; i >= 0; i -= 1) {\r\n var mTransf = this.hierarchy[i].finalTransform.mProp;\r\n this.mat.translate(-mTransf.p.v[0], -mTransf.p.v[1], mTransf.p.v[2]);\r\n this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);\r\n this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);\r\n this.mat.scale(1 / mTransf.s.v[0], 1 / mTransf.s.v[1], 1 / mTransf.s.v[2]);\r\n this.mat.translate(mTransf.a.v[0], mTransf.a.v[1], mTransf.a.v[2]);\r\n }\r\n }\r\n\r\n if (this.p) {\r\n this.mat.translate(-this.p.v[0], -this.p.v[1], this.p.v[2]);\r\n } else {\r\n this.mat.translate(-this.px.v, -this.py.v, this.pz.v);\r\n }\r\n\r\n if (this.a) {\r\n var diffVector;\r\n\r\n if (this.p) {\r\n diffVector = [this.p.v[0] - this.a.v[0], this.p.v[1] - this.a.v[1], this.p.v[2] - this.a.v[2]];\r\n } else {\r\n diffVector = [this.px.v - this.a.v[0], this.py.v - this.a.v[1], this.pz.v - this.a.v[2]];\r\n }\r\n\r\n var mag = Math.sqrt(Math.pow(diffVector[0], 2) + Math.pow(diffVector[1], 2) + Math.pow(diffVector[2], 2)); // var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));\r\n\r\n var lookDir = [diffVector[0] / mag, diffVector[1] / mag, diffVector[2] / mag];\r\n var lookLengthOnXZ = Math.sqrt(lookDir[2] * lookDir[2] + lookDir[0] * lookDir[0]);\r\n var mRotationX = Math.atan2(lookDir[1], lookLengthOnXZ);\r\n var mRotationY = Math.atan2(lookDir[0], -lookDir[2]);\r\n this.mat.rotateY(mRotationY).rotateX(-mRotationX);\r\n }\r\n\r\n this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);\r\n this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);\r\n this.mat.translate(this.globalData.compSize.w / 2, this.globalData.compSize.h / 2, 0);\r\n this.mat.translate(0, 0, this.pe.v);\r\n var hasMatrixChanged = !this._prevMat.equals(this.mat);\r\n\r\n if ((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {\r\n len = this.comp.threeDElements.length;\r\n var comp;\r\n var perspectiveStyle;\r\n var containerStyle;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n comp = this.comp.threeDElements[i];\r\n\r\n if (comp.type === '3d') {\r\n if (hasMatrixChanged) {\r\n var matValue = this.mat.toCSS();\r\n containerStyle = comp.container.style;\r\n containerStyle.transform = matValue;\r\n containerStyle.webkitTransform = matValue;\r\n }\r\n\r\n if (this.pe._mdf) {\r\n perspectiveStyle = comp.perspectiveElem.style;\r\n perspectiveStyle.perspective = this.pe.v + 'px';\r\n perspectiveStyle.webkitPerspective = this.pe.v + 'px';\r\n }\r\n }\r\n }\r\n\r\n this.mat.clone(this._prevMat);\r\n }\r\n }\r\n\r\n this._isFirstFrame = false;\r\n };\r\n\r\n HCameraElement.prototype.prepareFrame = function (num) {\r\n this.prepareProperties(num, true);\r\n };\r\n\r\n HCameraElement.prototype.destroy = function () {};\r\n\r\n HCameraElement.prototype.getBaseElement = function () {\r\n return null;\r\n };\r\n\r\n function HImageElement(data, globalData, comp) {\r\n this.assetData = globalData.getAssetData(data.refId);\r\n this.initElement(data, globalData, comp);\r\n }\r\n\r\n extendPrototype([BaseElement, TransformElement, HBaseElement, HSolidElement, HierarchyElement, FrameElement, RenderableElement], HImageElement);\r\n\r\n HImageElement.prototype.createContent = function () {\r\n var assetPath = this.globalData.getAssetsPath(this.assetData);\r\n var img = new Image();\r\n\r\n if (this.data.hasMask) {\r\n this.imageElem = createNS('image');\r\n this.imageElem.setAttribute('width', this.assetData.w + 'px');\r\n this.imageElem.setAttribute('height', this.assetData.h + 'px');\r\n this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath);\r\n this.layerElement.appendChild(this.imageElem);\r\n this.baseElement.setAttribute('width', this.assetData.w);\r\n this.baseElement.setAttribute('height', this.assetData.h);\r\n } else {\r\n this.layerElement.appendChild(img);\r\n }\r\n\r\n img.crossOrigin = 'anonymous';\r\n img.src = assetPath;\r\n\r\n if (this.data.ln) {\r\n this.baseElement.setAttribute('id', this.data.ln);\r\n }\r\n };\r\n\r\n function HybridRendererBase(animationItem, config) {\r\n this.animationItem = animationItem;\r\n this.layers = null;\r\n this.renderedFrame = -1;\r\n this.renderConfig = {\r\n className: config && config.className || '',\r\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\r\n hideOnTransparent: !(config && config.hideOnTransparent === false),\r\n filterSize: {\r\n width: config && config.filterSize && config.filterSize.width || '400%',\r\n height: config && config.filterSize && config.filterSize.height || '400%',\r\n x: config && config.filterSize && config.filterSize.x || '-100%',\r\n y: config && config.filterSize && config.filterSize.y || '-100%'\r\n }\r\n };\r\n this.globalData = {\r\n _mdf: false,\r\n frameNum: -1,\r\n renderConfig: this.renderConfig\r\n };\r\n this.pendingElements = [];\r\n this.elements = [];\r\n this.threeDElements = [];\r\n this.destroyed = false;\r\n this.camera = null;\r\n this.supports3d = true;\r\n this.rendererType = 'html';\r\n }\r\n\r\n extendPrototype([BaseRenderer], HybridRendererBase);\r\n HybridRendererBase.prototype.buildItem = SVGRenderer.prototype.buildItem;\r\n\r\n HybridRendererBase.prototype.checkPendingElements = function () {\r\n while (this.pendingElements.length) {\r\n var element = this.pendingElements.pop();\r\n element.checkParenting();\r\n }\r\n };\r\n\r\n HybridRendererBase.prototype.appendElementInPos = function (element, pos) {\r\n var newDOMElement = element.getBaseElement();\r\n\r\n if (!newDOMElement) {\r\n return;\r\n }\r\n\r\n var layer = this.layers[pos];\r\n\r\n if (!layer.ddd || !this.supports3d) {\r\n if (this.threeDElements) {\r\n this.addTo3dContainer(newDOMElement, pos);\r\n } else {\r\n var i = 0;\r\n var nextDOMElement;\r\n var nextLayer;\r\n var tmpDOMElement;\r\n\r\n while (i < pos) {\r\n if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement) {\r\n nextLayer = this.elements[i];\r\n tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();\r\n nextDOMElement = tmpDOMElement || nextDOMElement;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (nextDOMElement) {\r\n if (!layer.ddd || !this.supports3d) {\r\n this.layerElement.insertBefore(newDOMElement, nextDOMElement);\r\n }\r\n } else if (!layer.ddd || !this.supports3d) {\r\n this.layerElement.appendChild(newDOMElement);\r\n }\r\n }\r\n } else {\r\n this.addTo3dContainer(newDOMElement, pos);\r\n }\r\n };\r\n\r\n HybridRendererBase.prototype.createShape = function (data) {\r\n if (!this.supports3d) {\r\n return new SVGShapeElement(data, this.globalData, this);\r\n }\r\n\r\n return new HShapeElement(data, this.globalData, this);\r\n };\r\n\r\n HybridRendererBase.prototype.createText = function (data) {\r\n if (!this.supports3d) {\r\n return new SVGTextLottieElement(data, this.globalData, this);\r\n }\r\n\r\n return new HTextElement(data, this.globalData, this);\r\n };\r\n\r\n HybridRendererBase.prototype.createCamera = function (data) {\r\n this.camera = new HCameraElement(data, this.globalData, this);\r\n return this.camera;\r\n };\r\n\r\n HybridRendererBase.prototype.createImage = function (data) {\r\n if (!this.supports3d) {\r\n return new IImageElement(data, this.globalData, this);\r\n }\r\n\r\n return new HImageElement(data, this.globalData, this);\r\n };\r\n\r\n HybridRendererBase.prototype.createSolid = function (data) {\r\n if (!this.supports3d) {\r\n return new ISolidElement(data, this.globalData, this);\r\n }\r\n\r\n return new HSolidElement(data, this.globalData, this);\r\n };\r\n\r\n HybridRendererBase.prototype.createNull = SVGRenderer.prototype.createNull;\r\n\r\n HybridRendererBase.prototype.getThreeDContainerByPos = function (pos) {\r\n var i = 0;\r\n var len = this.threeDElements.length;\r\n\r\n while (i < len) {\r\n if (this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {\r\n return this.threeDElements[i].perspectiveElem;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n HybridRendererBase.prototype.createThreeDContainer = function (pos, type) {\r\n var perspectiveElem = createTag('div');\r\n var style;\r\n var containerStyle;\r\n styleDiv(perspectiveElem);\r\n var container = createTag('div');\r\n styleDiv(container);\r\n\r\n if (type === '3d') {\r\n style = perspectiveElem.style;\r\n style.width = this.globalData.compSize.w + 'px';\r\n style.height = this.globalData.compSize.h + 'px';\r\n var center = '50% 50%';\r\n style.webkitTransformOrigin = center;\r\n style.mozTransformOrigin = center;\r\n style.transformOrigin = center;\r\n containerStyle = container.style;\r\n var matrix = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';\r\n containerStyle.transform = matrix;\r\n containerStyle.webkitTransform = matrix;\r\n }\r\n\r\n perspectiveElem.appendChild(container); // this.resizerElem.appendChild(perspectiveElem);\r\n\r\n var threeDContainerData = {\r\n container: container,\r\n perspectiveElem: perspectiveElem,\r\n startPos: pos,\r\n endPos: pos,\r\n type: type\r\n };\r\n this.threeDElements.push(threeDContainerData);\r\n return threeDContainerData;\r\n };\r\n\r\n HybridRendererBase.prototype.build3dContainers = function () {\r\n var i;\r\n var len = this.layers.length;\r\n var lastThreeDContainerData;\r\n var currentContainer = '';\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.layers[i].ddd && this.layers[i].ty !== 3) {\r\n if (currentContainer !== '3d') {\r\n currentContainer = '3d';\r\n lastThreeDContainerData = this.createThreeDContainer(i, '3d');\r\n }\r\n\r\n lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\r\n } else {\r\n if (currentContainer !== '2d') {\r\n currentContainer = '2d';\r\n lastThreeDContainerData = this.createThreeDContainer(i, '2d');\r\n }\r\n\r\n lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos, i);\r\n }\r\n }\r\n\r\n len = this.threeDElements.length;\r\n\r\n for (i = len - 1; i >= 0; i -= 1) {\r\n this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);\r\n }\r\n };\r\n\r\n HybridRendererBase.prototype.addTo3dContainer = function (elem, pos) {\r\n var i = 0;\r\n var len = this.threeDElements.length;\r\n\r\n while (i < len) {\r\n if (pos <= this.threeDElements[i].endPos) {\r\n var j = this.threeDElements[i].startPos;\r\n var nextElement;\r\n\r\n while (j < pos) {\r\n if (this.elements[j] && this.elements[j].getBaseElement) {\r\n nextElement = this.elements[j].getBaseElement();\r\n }\r\n\r\n j += 1;\r\n }\r\n\r\n if (nextElement) {\r\n this.threeDElements[i].container.insertBefore(elem, nextElement);\r\n } else {\r\n this.threeDElements[i].container.appendChild(elem);\r\n }\r\n\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n };\r\n\r\n HybridRendererBase.prototype.configAnimation = function (animData) {\r\n var resizerElem = createTag('div');\r\n var wrapper = this.animationItem.wrapper;\r\n var style = resizerElem.style;\r\n style.width = animData.w + 'px';\r\n style.height = animData.h + 'px';\r\n this.resizerElem = resizerElem;\r\n styleDiv(resizerElem);\r\n style.transformStyle = 'flat';\r\n style.mozTransformStyle = 'flat';\r\n style.webkitTransformStyle = 'flat';\r\n\r\n if (this.renderConfig.className) {\r\n resizerElem.setAttribute('class', this.renderConfig.className);\r\n }\r\n\r\n wrapper.appendChild(resizerElem);\r\n style.overflow = 'hidden';\r\n var svg = createNS('svg');\r\n svg.setAttribute('width', '1');\r\n svg.setAttribute('height', '1');\r\n styleDiv(svg);\r\n this.resizerElem.appendChild(svg);\r\n var defs = createNS('defs');\r\n svg.appendChild(defs);\r\n this.data = animData; // Mask animation\r\n\r\n this.setupGlobalData(animData, svg);\r\n this.globalData.defs = defs;\r\n this.layers = animData.layers;\r\n this.layerElement = this.resizerElem;\r\n this.build3dContainers();\r\n this.updateContainerSize();\r\n };\r\n\r\n HybridRendererBase.prototype.destroy = function () {\r\n if (this.animationItem.wrapper) {\r\n this.animationItem.wrapper.innerText = '';\r\n }\r\n\r\n this.animationItem.container = null;\r\n this.globalData.defs = null;\r\n var i;\r\n var len = this.layers ? this.layers.length : 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this.elements[i].destroy();\r\n }\r\n\r\n this.elements.length = 0;\r\n this.destroyed = true;\r\n this.animationItem = null;\r\n };\r\n\r\n HybridRendererBase.prototype.updateContainerSize = function () {\r\n var elementWidth = this.animationItem.wrapper.offsetWidth;\r\n var elementHeight = this.animationItem.wrapper.offsetHeight;\r\n var elementRel = elementWidth / elementHeight;\r\n var animationRel = this.globalData.compSize.w / this.globalData.compSize.h;\r\n var sx;\r\n var sy;\r\n var tx;\r\n var ty;\r\n\r\n if (animationRel > elementRel) {\r\n sx = elementWidth / this.globalData.compSize.w;\r\n sy = elementWidth / this.globalData.compSize.w;\r\n tx = 0;\r\n ty = (elementHeight - this.globalData.compSize.h * (elementWidth / this.globalData.compSize.w)) / 2;\r\n } else {\r\n sx = elementHeight / this.globalData.compSize.h;\r\n sy = elementHeight / this.globalData.compSize.h;\r\n tx = (elementWidth - this.globalData.compSize.w * (elementHeight / this.globalData.compSize.h)) / 2;\r\n ty = 0;\r\n }\r\n\r\n var style = this.resizerElem.style;\r\n style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,' + sy + ',0,0,0,0,1,0,' + tx + ',' + ty + ',0,1)';\r\n style.transform = style.webkitTransform;\r\n };\r\n\r\n HybridRendererBase.prototype.renderFrame = SVGRenderer.prototype.renderFrame;\r\n\r\n HybridRendererBase.prototype.hide = function () {\r\n this.resizerElem.style.display = 'none';\r\n };\r\n\r\n HybridRendererBase.prototype.show = function () {\r\n this.resizerElem.style.display = 'block';\r\n };\r\n\r\n HybridRendererBase.prototype.initItems = function () {\r\n this.buildAllItems();\r\n\r\n if (this.camera) {\r\n this.camera.setup();\r\n } else {\r\n var cWidth = this.globalData.compSize.w;\r\n var cHeight = this.globalData.compSize.h;\r\n var i;\r\n var len = this.threeDElements.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n var style = this.threeDElements[i].perspectiveElem.style;\r\n style.webkitPerspective = Math.sqrt(Math.pow(cWidth, 2) + Math.pow(cHeight, 2)) + 'px';\r\n style.perspective = style.webkitPerspective;\r\n }\r\n }\r\n };\r\n\r\n HybridRendererBase.prototype.searchExtraCompositions = function (assets) {\r\n var i;\r\n var len = assets.length;\r\n var floatingContainer = createTag('div');\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (assets[i].xt) {\r\n var comp = this.createComp(assets[i], floatingContainer, this.globalData.comp, null);\r\n comp.initExpressions();\r\n this.globalData.projectInterface.registerComposition(comp);\r\n }\r\n }\r\n };\r\n\r\n function HCompElement(data, globalData, comp) {\r\n this.layers = data.layers;\r\n this.supports3d = !data.hasMask;\r\n this.completeLayers = false;\r\n this.pendingElements = [];\r\n this.elements = this.layers ? createSizedArray(this.layers.length) : [];\r\n this.initElement(data, globalData, comp);\r\n this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : {\r\n _placeholder: true\r\n };\r\n }\r\n\r\n extendPrototype([HybridRendererBase, ICompElement, HBaseElement], HCompElement);\r\n HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;\r\n\r\n HCompElement.prototype.createContainerElements = function () {\r\n this._createBaseContainerElements(); // divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';\r\n\r\n\r\n if (this.data.hasMask) {\r\n this.svgElement.setAttribute('width', this.data.w);\r\n this.svgElement.setAttribute('height', this.data.h);\r\n this.transformedElement = this.baseElement;\r\n } else {\r\n this.transformedElement = this.layerElement;\r\n }\r\n };\r\n\r\n HCompElement.prototype.addTo3dContainer = function (elem, pos) {\r\n var j = 0;\r\n var nextElement;\r\n\r\n while (j < pos) {\r\n if (this.elements[j] && this.elements[j].getBaseElement) {\r\n nextElement = this.elements[j].getBaseElement();\r\n }\r\n\r\n j += 1;\r\n }\r\n\r\n if (nextElement) {\r\n this.layerElement.insertBefore(elem, nextElement);\r\n } else {\r\n this.layerElement.appendChild(elem);\r\n }\r\n };\r\n\r\n HCompElement.prototype.createComp = function (data) {\r\n if (!this.supports3d) {\r\n return new SVGCompElement(data, this.globalData, this);\r\n }\r\n\r\n return new HCompElement(data, this.globalData, this);\r\n };\r\n\r\n function HybridRenderer(animationItem, config) {\r\n this.animationItem = animationItem;\r\n this.layers = null;\r\n this.renderedFrame = -1;\r\n this.renderConfig = {\r\n className: config && config.className || '',\r\n imagePreserveAspectRatio: config && config.imagePreserveAspectRatio || 'xMidYMid slice',\r\n hideOnTransparent: !(config && config.hideOnTransparent === false),\r\n filterSize: {\r\n width: config && config.filterSize && config.filterSize.width || '400%',\r\n height: config && config.filterSize && config.filterSize.height || '400%',\r\n x: config && config.filterSize && config.filterSize.x || '-100%',\r\n y: config && config.filterSize && config.filterSize.y || '-100%'\r\n },\r\n runExpressions: !config || config.runExpressions === undefined || config.runExpressions\r\n };\r\n this.globalData = {\r\n _mdf: false,\r\n frameNum: -1,\r\n renderConfig: this.renderConfig\r\n };\r\n this.pendingElements = [];\r\n this.elements = [];\r\n this.threeDElements = [];\r\n this.destroyed = false;\r\n this.camera = null;\r\n this.supports3d = true;\r\n this.rendererType = 'html';\r\n }\r\n\r\n extendPrototype([HybridRendererBase], HybridRenderer);\r\n\r\n HybridRenderer.prototype.createComp = function (data) {\r\n if (!this.supports3d) {\r\n return new SVGCompElement(data, this.globalData, this);\r\n }\r\n\r\n return new HCompElement(data, this.globalData, this);\r\n };\r\n\r\n var CompExpressionInterface = function () {\r\n return function (comp) {\r\n function _thisLayerFunction(name) {\r\n var i = 0;\r\n var len = comp.layers.length;\r\n\r\n while (i < len) {\r\n if (comp.layers[i].nm === name || comp.layers[i].ind === name) {\r\n return comp.elements[i].layerInterface;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null; // return {active:false};\r\n }\r\n\r\n Object.defineProperty(_thisLayerFunction, '_name', {\r\n value: comp.data.nm\r\n });\r\n _thisLayerFunction.layer = _thisLayerFunction;\r\n _thisLayerFunction.pixelAspect = 1;\r\n _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;\r\n _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;\r\n _thisLayerFunction.pixelAspect = 1;\r\n _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;\r\n _thisLayerFunction.displayStartTime = 0;\r\n _thisLayerFunction.numLayers = comp.layers.length;\r\n return _thisLayerFunction;\r\n };\r\n }();\r\n\r\n var Expressions = function () {\r\n var ob = {};\r\n ob.initExpressions = initExpressions;\r\n\r\n function initExpressions(animation) {\r\n var stackCount = 0;\r\n var registers = [];\r\n\r\n function pushExpression() {\r\n stackCount += 1;\r\n }\r\n\r\n function popExpression() {\r\n stackCount -= 1;\r\n\r\n if (stackCount === 0) {\r\n releaseInstances();\r\n }\r\n }\r\n\r\n function registerExpressionProperty(expression) {\r\n if (registers.indexOf(expression) === -1) {\r\n registers.push(expression);\r\n }\r\n }\r\n\r\n function releaseInstances() {\r\n var i;\r\n var len = registers.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n registers[i].release();\r\n }\r\n\r\n registers.length = 0;\r\n }\r\n\r\n animation.renderer.compInterface = CompExpressionInterface(animation.renderer);\r\n animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);\r\n animation.renderer.globalData.pushExpression = pushExpression;\r\n animation.renderer.globalData.popExpression = popExpression;\r\n animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;\r\n }\r\n\r\n return ob;\r\n }();\r\n\r\n var MaskManagerInterface = function () {\r\n function MaskInterface(mask, data) {\r\n this._mask = mask;\r\n this._data = data;\r\n }\r\n\r\n Object.defineProperty(MaskInterface.prototype, 'maskPath', {\r\n get: function get() {\r\n if (this._mask.prop.k) {\r\n this._mask.prop.getValue();\r\n }\r\n\r\n return this._mask.prop;\r\n }\r\n });\r\n Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {\r\n get: function get() {\r\n if (this._mask.op.k) {\r\n this._mask.op.getValue();\r\n }\r\n\r\n return this._mask.op.v * 100;\r\n }\r\n });\r\n\r\n var MaskManager = function MaskManager(maskManager) {\r\n var _masksInterfaces = createSizedArray(maskManager.viewData.length);\r\n\r\n var i;\r\n var len = maskManager.viewData.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);\r\n }\r\n\r\n var maskFunction = function maskFunction(name) {\r\n i = 0;\r\n\r\n while (i < len) {\r\n if (maskManager.masksProperties[i].nm === name) {\r\n return _masksInterfaces[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n return maskFunction;\r\n };\r\n\r\n return MaskManager;\r\n }();\r\n\r\n var ExpressionPropertyInterface = function () {\r\n var defaultUnidimensionalValue = {\r\n pv: 0,\r\n v: 0,\r\n mult: 1\r\n };\r\n var defaultMultidimensionalValue = {\r\n pv: [0, 0, 0],\r\n v: [0, 0, 0],\r\n mult: 1\r\n };\r\n\r\n function completeProperty(expressionValue, property, type) {\r\n Object.defineProperty(expressionValue, 'velocity', {\r\n get: function get() {\r\n return property.getVelocityAtTime(property.comp.currentFrame);\r\n }\r\n });\r\n expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;\r\n\r\n expressionValue.key = function (pos) {\r\n if (!expressionValue.numKeys) {\r\n return 0;\r\n }\r\n\r\n var value = '';\r\n\r\n if ('s' in property.keyframes[pos - 1]) {\r\n value = property.keyframes[pos - 1].s;\r\n } else if ('e' in property.keyframes[pos - 2]) {\r\n value = property.keyframes[pos - 2].e;\r\n } else {\r\n value = property.keyframes[pos - 2].s;\r\n }\r\n\r\n var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value); // eslint-disable-line no-new-wrappers\r\n\r\n valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate;\r\n valueProp.value = type === 'unidimensional' ? value[0] : value;\r\n return valueProp;\r\n };\r\n\r\n expressionValue.valueAtTime = property.getValueAtTime;\r\n expressionValue.speedAtTime = property.getSpeedAtTime;\r\n expressionValue.velocityAtTime = property.getVelocityAtTime;\r\n expressionValue.propertyGroup = property.propertyGroup;\r\n }\r\n\r\n function UnidimensionalPropertyInterface(property) {\r\n if (!property || !('pv' in property)) {\r\n property = defaultUnidimensionalValue;\r\n }\r\n\r\n var mult = 1 / property.mult;\r\n var val = property.pv * mult;\r\n var expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\r\n\r\n expressionValue.value = val;\r\n completeProperty(expressionValue, property, 'unidimensional');\r\n return function () {\r\n if (property.k) {\r\n property.getValue();\r\n }\r\n\r\n val = property.v * mult;\r\n\r\n if (expressionValue.value !== val) {\r\n expressionValue = new Number(val); // eslint-disable-line no-new-wrappers\r\n\r\n expressionValue.value = val;\r\n completeProperty(expressionValue, property, 'unidimensional');\r\n }\r\n\r\n return expressionValue;\r\n };\r\n }\r\n\r\n function MultidimensionalPropertyInterface(property) {\r\n if (!property || !('pv' in property)) {\r\n property = defaultMultidimensionalValue;\r\n }\r\n\r\n var mult = 1 / property.mult;\r\n var len = property.data && property.data.l || property.pv.length;\r\n var expressionValue = createTypedArray('float32', len);\r\n var arrValue = createTypedArray('float32', len);\r\n expressionValue.value = arrValue;\r\n completeProperty(expressionValue, property, 'multidimensional');\r\n return function () {\r\n if (property.k) {\r\n property.getValue();\r\n }\r\n\r\n for (var i = 0; i < len; i += 1) {\r\n arrValue[i] = property.v[i] * mult;\r\n expressionValue[i] = arrValue[i];\r\n }\r\n\r\n return expressionValue;\r\n };\r\n } // TODO: try to avoid using this getter\r\n\r\n\r\n function defaultGetter() {\r\n return defaultUnidimensionalValue;\r\n }\r\n\r\n return function (property) {\r\n if (!property) {\r\n return defaultGetter;\r\n }\r\n\r\n if (property.propType === 'unidimensional') {\r\n return UnidimensionalPropertyInterface(property);\r\n }\r\n\r\n return MultidimensionalPropertyInterface(property);\r\n };\r\n }();\r\n\r\n var TransformExpressionInterface = function () {\r\n return function (transform) {\r\n function _thisFunction(name) {\r\n switch (name) {\r\n case 'scale':\r\n case 'Scale':\r\n case 'ADBE Scale':\r\n case 6:\r\n return _thisFunction.scale;\r\n\r\n case 'rotation':\r\n case 'Rotation':\r\n case 'ADBE Rotation':\r\n case 'ADBE Rotate Z':\r\n case 10:\r\n return _thisFunction.rotation;\r\n\r\n case 'ADBE Rotate X':\r\n return _thisFunction.xRotation;\r\n\r\n case 'ADBE Rotate Y':\r\n return _thisFunction.yRotation;\r\n\r\n case 'position':\r\n case 'Position':\r\n case 'ADBE Position':\r\n case 2:\r\n return _thisFunction.position;\r\n\r\n case 'ADBE Position_0':\r\n return _thisFunction.xPosition;\r\n\r\n case 'ADBE Position_1':\r\n return _thisFunction.yPosition;\r\n\r\n case 'ADBE Position_2':\r\n return _thisFunction.zPosition;\r\n\r\n case 'anchorPoint':\r\n case 'AnchorPoint':\r\n case 'Anchor Point':\r\n case 'ADBE AnchorPoint':\r\n case 1:\r\n return _thisFunction.anchorPoint;\r\n\r\n case 'opacity':\r\n case 'Opacity':\r\n case 11:\r\n return _thisFunction.opacity;\r\n\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n Object.defineProperty(_thisFunction, 'rotation', {\r\n get: ExpressionPropertyInterface(transform.r || transform.rz)\r\n });\r\n Object.defineProperty(_thisFunction, 'zRotation', {\r\n get: ExpressionPropertyInterface(transform.rz || transform.r)\r\n });\r\n Object.defineProperty(_thisFunction, 'xRotation', {\r\n get: ExpressionPropertyInterface(transform.rx)\r\n });\r\n Object.defineProperty(_thisFunction, 'yRotation', {\r\n get: ExpressionPropertyInterface(transform.ry)\r\n });\r\n Object.defineProperty(_thisFunction, 'scale', {\r\n get: ExpressionPropertyInterface(transform.s)\r\n });\r\n\r\n var _px;\r\n\r\n var _py;\r\n\r\n var _pz;\r\n\r\n var _transformFactory;\r\n\r\n if (transform.p) {\r\n _transformFactory = ExpressionPropertyInterface(transform.p);\r\n } else {\r\n _px = ExpressionPropertyInterface(transform.px);\r\n _py = ExpressionPropertyInterface(transform.py);\r\n\r\n if (transform.pz) {\r\n _pz = ExpressionPropertyInterface(transform.pz);\r\n }\r\n }\r\n\r\n Object.defineProperty(_thisFunction, 'position', {\r\n get: function get() {\r\n if (transform.p) {\r\n return _transformFactory();\r\n }\r\n\r\n return [_px(), _py(), _pz ? _pz() : 0];\r\n }\r\n });\r\n Object.defineProperty(_thisFunction, 'xPosition', {\r\n get: ExpressionPropertyInterface(transform.px)\r\n });\r\n Object.defineProperty(_thisFunction, 'yPosition', {\r\n get: ExpressionPropertyInterface(transform.py)\r\n });\r\n Object.defineProperty(_thisFunction, 'zPosition', {\r\n get: ExpressionPropertyInterface(transform.pz)\r\n });\r\n Object.defineProperty(_thisFunction, 'anchorPoint', {\r\n get: ExpressionPropertyInterface(transform.a)\r\n });\r\n Object.defineProperty(_thisFunction, 'opacity', {\r\n get: ExpressionPropertyInterface(transform.o)\r\n });\r\n Object.defineProperty(_thisFunction, 'skew', {\r\n get: ExpressionPropertyInterface(transform.sk)\r\n });\r\n Object.defineProperty(_thisFunction, 'skewAxis', {\r\n get: ExpressionPropertyInterface(transform.sa)\r\n });\r\n Object.defineProperty(_thisFunction, 'orientation', {\r\n get: ExpressionPropertyInterface(transform.or)\r\n });\r\n return _thisFunction;\r\n };\r\n }();\r\n\r\n var LayerExpressionInterface = function () {\r\n function getMatrix(time) {\r\n var toWorldMat = new Matrix();\r\n\r\n if (time !== undefined) {\r\n var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time);\r\n\r\n propMatrix.clone(toWorldMat);\r\n } else {\r\n var transformMat = this._elem.finalTransform.mProp;\r\n transformMat.applyToMatrix(toWorldMat);\r\n }\r\n\r\n return toWorldMat;\r\n }\r\n\r\n function toWorldVec(arr, time) {\r\n var toWorldMat = this.getMatrix(time);\r\n toWorldMat.props[12] = 0;\r\n toWorldMat.props[13] = 0;\r\n toWorldMat.props[14] = 0;\r\n return this.applyPoint(toWorldMat, arr);\r\n }\r\n\r\n function toWorld(arr, time) {\r\n var toWorldMat = this.getMatrix(time);\r\n return this.applyPoint(toWorldMat, arr);\r\n }\r\n\r\n function fromWorldVec(arr, time) {\r\n var toWorldMat = this.getMatrix(time);\r\n toWorldMat.props[12] = 0;\r\n toWorldMat.props[13] = 0;\r\n toWorldMat.props[14] = 0;\r\n return this.invertPoint(toWorldMat, arr);\r\n }\r\n\r\n function fromWorld(arr, time) {\r\n var toWorldMat = this.getMatrix(time);\r\n return this.invertPoint(toWorldMat, arr);\r\n }\r\n\r\n function applyPoint(matrix, arr) {\r\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\r\n var i;\r\n var len = this._elem.hierarchy.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\r\n }\r\n }\r\n\r\n return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0);\r\n }\r\n\r\n function invertPoint(matrix, arr) {\r\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\r\n var i;\r\n var len = this._elem.hierarchy.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix);\r\n }\r\n }\r\n\r\n return matrix.inversePoint(arr);\r\n }\r\n\r\n function fromComp(arr) {\r\n var toWorldMat = new Matrix();\r\n toWorldMat.reset();\r\n\r\n this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);\r\n\r\n if (this._elem.hierarchy && this._elem.hierarchy.length) {\r\n var i;\r\n var len = this._elem.hierarchy.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);\r\n }\r\n\r\n return toWorldMat.inversePoint(arr);\r\n }\r\n\r\n return toWorldMat.inversePoint(arr);\r\n }\r\n\r\n function sampleImage() {\r\n return [1, 1, 1, 1];\r\n }\r\n\r\n return function (elem) {\r\n var transformInterface;\r\n\r\n function _registerMaskInterface(maskManager) {\r\n _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);\r\n }\r\n\r\n function _registerEffectsInterface(effects) {\r\n _thisLayerFunction.effect = effects;\r\n }\r\n\r\n function _thisLayerFunction(name) {\r\n switch (name) {\r\n case 'ADBE Root Vectors Group':\r\n case 'Contents':\r\n case 2:\r\n return _thisLayerFunction.shapeInterface;\r\n\r\n case 1:\r\n case 6:\r\n case 'Transform':\r\n case 'transform':\r\n case 'ADBE Transform Group':\r\n return transformInterface;\r\n\r\n case 4:\r\n case 'ADBE Effect Parade':\r\n case 'effects':\r\n case 'Effects':\r\n return _thisLayerFunction.effect;\r\n\r\n case 'ADBE Text Properties':\r\n return _thisLayerFunction.textInterface;\r\n\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n _thisLayerFunction.getMatrix = getMatrix;\r\n _thisLayerFunction.invertPoint = invertPoint;\r\n _thisLayerFunction.applyPoint = applyPoint;\r\n _thisLayerFunction.toWorld = toWorld;\r\n _thisLayerFunction.toWorldVec = toWorldVec;\r\n _thisLayerFunction.fromWorld = fromWorld;\r\n _thisLayerFunction.fromWorldVec = fromWorldVec;\r\n _thisLayerFunction.toComp = toWorld;\r\n _thisLayerFunction.fromComp = fromComp;\r\n _thisLayerFunction.sampleImage = sampleImage;\r\n _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);\r\n _thisLayerFunction._elem = elem;\r\n transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);\r\n var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');\r\n Object.defineProperties(_thisLayerFunction, {\r\n hasParent: {\r\n get: function get() {\r\n return elem.hierarchy.length;\r\n }\r\n },\r\n parent: {\r\n get: function get() {\r\n return elem.hierarchy[0].layerInterface;\r\n }\r\n },\r\n rotation: getDescriptor(transformInterface, 'rotation'),\r\n scale: getDescriptor(transformInterface, 'scale'),\r\n position: getDescriptor(transformInterface, 'position'),\r\n opacity: getDescriptor(transformInterface, 'opacity'),\r\n anchorPoint: anchorPointDescriptor,\r\n anchor_point: anchorPointDescriptor,\r\n transform: {\r\n get: function get() {\r\n return transformInterface;\r\n }\r\n },\r\n active: {\r\n get: function get() {\r\n return elem.isInRange;\r\n }\r\n }\r\n });\r\n _thisLayerFunction.startTime = elem.data.st;\r\n _thisLayerFunction.index = elem.data.ind;\r\n _thisLayerFunction.source = elem.data.refId;\r\n _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;\r\n _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;\r\n _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate;\r\n _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate;\r\n _thisLayerFunction._name = elem.data.nm;\r\n _thisLayerFunction.registerMaskInterface = _registerMaskInterface;\r\n _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;\r\n return _thisLayerFunction;\r\n };\r\n }();\r\n\r\n var propertyGroupFactory = function () {\r\n return function (interfaceFunction, parentPropertyGroup) {\r\n return function (val) {\r\n val = val === undefined ? 1 : val;\r\n\r\n if (val <= 0) {\r\n return interfaceFunction;\r\n }\r\n\r\n return parentPropertyGroup(val - 1);\r\n };\r\n };\r\n }();\r\n\r\n var PropertyInterface = function () {\r\n return function (propertyName, propertyGroup) {\r\n var interfaceFunction = {\r\n _name: propertyName\r\n };\r\n\r\n function _propertyGroup(val) {\r\n val = val === undefined ? 1 : val;\r\n\r\n if (val <= 0) {\r\n return interfaceFunction;\r\n }\r\n\r\n return propertyGroup(val - 1);\r\n }\r\n\r\n return _propertyGroup;\r\n };\r\n }();\r\n\r\n var EffectsExpressionInterface = function () {\r\n var ob = {\r\n createEffectsInterface: createEffectsInterface\r\n };\r\n\r\n function createEffectsInterface(elem, propertyGroup) {\r\n if (elem.effectsManager) {\r\n var effectElements = [];\r\n var effectsData = elem.data.ef;\r\n var i;\r\n var len = elem.effectsManager.effectElements.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem));\r\n }\r\n\r\n var effects = elem.data.ef || [];\r\n\r\n var groupInterface = function groupInterface(name) {\r\n i = 0;\r\n len = effects.length;\r\n\r\n while (i < len) {\r\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\r\n return effectElements[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n Object.defineProperty(groupInterface, 'numProperties', {\r\n get: function get() {\r\n return effects.length;\r\n }\r\n });\r\n return groupInterface;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function createGroupInterface(data, elements, propertyGroup, elem) {\r\n function groupInterface(name) {\r\n var effects = data.ef;\r\n var i = 0;\r\n var len = effects.length;\r\n\r\n while (i < len) {\r\n if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) {\r\n if (effects[i].ty === 5) {\r\n return effectElements[i];\r\n }\r\n\r\n return effectElements[i]();\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n throw new Error();\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup);\r\n\r\n var effectElements = [];\r\n var i;\r\n var len = data.ef.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (data.ef[i].ty === 5) {\r\n effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem));\r\n } else {\r\n effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup));\r\n }\r\n }\r\n\r\n if (data.mn === 'ADBE Color Control') {\r\n Object.defineProperty(groupInterface, 'color', {\r\n get: function get() {\r\n return effectElements[0]();\r\n }\r\n });\r\n }\r\n\r\n Object.defineProperties(groupInterface, {\r\n numProperties: {\r\n get: function get() {\r\n return data.np;\r\n }\r\n },\r\n _name: {\r\n value: data.nm\r\n },\r\n propertyGroup: {\r\n value: _propertyGroup\r\n }\r\n });\r\n groupInterface.enabled = data.en !== 0;\r\n groupInterface.active = groupInterface.enabled;\r\n return groupInterface;\r\n }\r\n\r\n function createValueInterface(element, type, elem, propertyGroup) {\r\n var expressionProperty = ExpressionPropertyInterface(element.p);\r\n\r\n function interfaceFunction() {\r\n if (type === 10) {\r\n return elem.comp.compInterface(element.p.v);\r\n }\r\n\r\n return expressionProperty();\r\n }\r\n\r\n if (element.p.setGroupProperty) {\r\n element.p.setGroupProperty(PropertyInterface('', propertyGroup));\r\n }\r\n\r\n return interfaceFunction;\r\n }\r\n\r\n return ob;\r\n }();\r\n\r\n var ShapePathInterface = function () {\r\n return function pathInterfaceFactory(shape, view, propertyGroup) {\r\n var prop = view.sh;\r\n\r\n function interfaceFunction(val) {\r\n if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) {\r\n return interfaceFunction.path;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n prop.setGroupProperty(PropertyInterface('Path', _propertyGroup));\r\n Object.defineProperties(interfaceFunction, {\r\n path: {\r\n get: function get() {\r\n if (prop.k) {\r\n prop.getValue();\r\n }\r\n\r\n return prop;\r\n }\r\n },\r\n shape: {\r\n get: function get() {\r\n if (prop.k) {\r\n prop.getValue();\r\n }\r\n\r\n return prop;\r\n }\r\n },\r\n _name: {\r\n value: shape.nm\r\n },\r\n ix: {\r\n value: shape.ix\r\n },\r\n propertyIndex: {\r\n value: shape.ix\r\n },\r\n mn: {\r\n value: shape.mn\r\n },\r\n propertyGroup: {\r\n value: propertyGroup\r\n }\r\n });\r\n return interfaceFunction;\r\n };\r\n }();\r\n\r\n var ShapeExpressionInterface = function () {\r\n function iterateElements(shapes, view, propertyGroup) {\r\n var arr = [];\r\n var i;\r\n var len = shapes ? shapes.length : 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (shapes[i].ty === 'gr') {\r\n arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'fl') {\r\n arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'st') {\r\n arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'tm') {\r\n arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'tr') {// arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup));\r\n } else if (shapes[i].ty === 'el') {\r\n arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'sr') {\r\n arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'sh') {\r\n arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'rc') {\r\n arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'rd') {\r\n arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'rp') {\r\n arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else if (shapes[i].ty === 'gf') {\r\n arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n } else {\r\n arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup));\r\n }\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n function contentsInterfaceFactory(shape, view, propertyGroup) {\r\n var interfaces;\r\n\r\n var interfaceFunction = function _interfaceFunction(value) {\r\n var i = 0;\r\n var len = interfaces.length;\r\n\r\n while (i < len) {\r\n if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) {\r\n return interfaces[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (typeof value === 'number') {\r\n return interfaces[value - 1];\r\n }\r\n\r\n return null;\r\n };\r\n\r\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);\r\n interfaceFunction.numProperties = interfaces.length;\r\n var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\r\n interfaceFunction.transform = transformInterface;\r\n interfaceFunction.propertyIndex = shape.cix;\r\n interfaceFunction._name = shape.nm;\r\n return interfaceFunction;\r\n }\r\n\r\n function groupInterfaceFactory(shape, view, propertyGroup) {\r\n var interfaceFunction = function _interfaceFunction(value) {\r\n switch (value) {\r\n case 'ADBE Vectors Group':\r\n case 'Contents':\r\n case 2:\r\n return interfaceFunction.content;\r\n // Not necessary for now. Keeping them here in case a new case appears\r\n // case 'ADBE Vector Transform Group':\r\n // case 3:\r\n\r\n default:\r\n return interfaceFunction.transform;\r\n }\r\n };\r\n\r\n interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup);\r\n var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup);\r\n interfaceFunction.content = content;\r\n interfaceFunction.transform = transformInterface;\r\n Object.defineProperty(interfaceFunction, '_name', {\r\n get: function get() {\r\n return shape.nm;\r\n }\r\n }); // interfaceFunction.content = interfaceFunction;\r\n\r\n interfaceFunction.numProperties = shape.np;\r\n interfaceFunction.propertyIndex = shape.ix;\r\n interfaceFunction.nm = shape.nm;\r\n interfaceFunction.mn = shape.mn;\r\n return interfaceFunction;\r\n }\r\n\r\n function fillInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(val) {\r\n if (val === 'Color' || val === 'color') {\r\n return interfaceFunction.color;\r\n }\r\n\r\n if (val === 'Opacity' || val === 'opacity') {\r\n return interfaceFunction.opacity;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n Object.defineProperties(interfaceFunction, {\r\n color: {\r\n get: ExpressionPropertyInterface(view.c)\r\n },\r\n opacity: {\r\n get: ExpressionPropertyInterface(view.o)\r\n },\r\n _name: {\r\n value: shape.nm\r\n },\r\n mn: {\r\n value: shape.mn\r\n }\r\n });\r\n view.c.setGroupProperty(PropertyInterface('Color', propertyGroup));\r\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\r\n return interfaceFunction;\r\n }\r\n\r\n function gradientFillInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(val) {\r\n if (val === 'Start Point' || val === 'start point') {\r\n return interfaceFunction.startPoint;\r\n }\r\n\r\n if (val === 'End Point' || val === 'end point') {\r\n return interfaceFunction.endPoint;\r\n }\r\n\r\n if (val === 'Opacity' || val === 'opacity') {\r\n return interfaceFunction.opacity;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n Object.defineProperties(interfaceFunction, {\r\n startPoint: {\r\n get: ExpressionPropertyInterface(view.s)\r\n },\r\n endPoint: {\r\n get: ExpressionPropertyInterface(view.e)\r\n },\r\n opacity: {\r\n get: ExpressionPropertyInterface(view.o)\r\n },\r\n type: {\r\n get: function get() {\r\n return 'a';\r\n }\r\n },\r\n _name: {\r\n value: shape.nm\r\n },\r\n mn: {\r\n value: shape.mn\r\n }\r\n });\r\n view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup));\r\n view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup));\r\n view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));\r\n return interfaceFunction;\r\n }\r\n\r\n function defaultInterfaceFactory() {\r\n function interfaceFunction() {\r\n return null;\r\n }\r\n\r\n return interfaceFunction;\r\n }\r\n\r\n function strokeInterfaceFactory(shape, view, propertyGroup) {\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup);\r\n\r\n function addPropertyToDashOb(i) {\r\n Object.defineProperty(dashOb, shape.d[i].nm, {\r\n get: ExpressionPropertyInterface(view.d.dataProps[i].p)\r\n });\r\n }\r\n\r\n var i;\r\n var len = shape.d ? shape.d.length : 0;\r\n var dashOb = {};\r\n\r\n for (i = 0; i < len; i += 1) {\r\n addPropertyToDashOb(i);\r\n view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);\r\n }\r\n\r\n function interfaceFunction(val) {\r\n if (val === 'Color' || val === 'color') {\r\n return interfaceFunction.color;\r\n }\r\n\r\n if (val === 'Opacity' || val === 'opacity') {\r\n return interfaceFunction.opacity;\r\n }\r\n\r\n if (val === 'Stroke Width' || val === 'stroke width') {\r\n return interfaceFunction.strokeWidth;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n Object.defineProperties(interfaceFunction, {\r\n color: {\r\n get: ExpressionPropertyInterface(view.c)\r\n },\r\n opacity: {\r\n get: ExpressionPropertyInterface(view.o)\r\n },\r\n strokeWidth: {\r\n get: ExpressionPropertyInterface(view.w)\r\n },\r\n dash: {\r\n get: function get() {\r\n return dashOb;\r\n }\r\n },\r\n _name: {\r\n value: shape.nm\r\n },\r\n mn: {\r\n value: shape.mn\r\n }\r\n });\r\n view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup));\r\n view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\r\n view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup));\r\n return interfaceFunction;\r\n }\r\n\r\n function trimInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(val) {\r\n if (val === shape.e.ix || val === 'End' || val === 'end') {\r\n return interfaceFunction.end;\r\n }\r\n\r\n if (val === shape.s.ix) {\r\n return interfaceFunction.start;\r\n }\r\n\r\n if (val === shape.o.ix) {\r\n return interfaceFunction.offset;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n interfaceFunction.propertyIndex = shape.ix;\r\n view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup));\r\n view.e.setGroupProperty(PropertyInterface('End', _propertyGroup));\r\n view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\r\n interfaceFunction.propertyIndex = shape.ix;\r\n interfaceFunction.propertyGroup = propertyGroup;\r\n Object.defineProperties(interfaceFunction, {\r\n start: {\r\n get: ExpressionPropertyInterface(view.s)\r\n },\r\n end: {\r\n get: ExpressionPropertyInterface(view.e)\r\n },\r\n offset: {\r\n get: ExpressionPropertyInterface(view.o)\r\n },\r\n _name: {\r\n value: shape.nm\r\n }\r\n });\r\n interfaceFunction.mn = shape.mn;\r\n return interfaceFunction;\r\n }\r\n\r\n function transformInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(value) {\r\n if (shape.a.ix === value || value === 'Anchor Point') {\r\n return interfaceFunction.anchorPoint;\r\n }\r\n\r\n if (shape.o.ix === value || value === 'Opacity') {\r\n return interfaceFunction.opacity;\r\n }\r\n\r\n if (shape.p.ix === value || value === 'Position') {\r\n return interfaceFunction.position;\r\n }\r\n\r\n if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') {\r\n return interfaceFunction.rotation;\r\n }\r\n\r\n if (shape.s.ix === value || value === 'Scale') {\r\n return interfaceFunction.scale;\r\n }\r\n\r\n if (shape.sk && shape.sk.ix === value || value === 'Skew') {\r\n return interfaceFunction.skew;\r\n }\r\n\r\n if (shape.sa && shape.sa.ix === value || value === 'Skew Axis') {\r\n return interfaceFunction.skewAxis;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\r\n view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup));\r\n view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup));\r\n view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\r\n\r\n if (view.transform.mProps.sk) {\r\n view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup));\r\n view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup));\r\n }\r\n\r\n view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));\r\n Object.defineProperties(interfaceFunction, {\r\n opacity: {\r\n get: ExpressionPropertyInterface(view.transform.mProps.o)\r\n },\r\n position: {\r\n get: ExpressionPropertyInterface(view.transform.mProps.p)\r\n },\r\n anchorPoint: {\r\n get: ExpressionPropertyInterface(view.transform.mProps.a)\r\n },\r\n scale: {\r\n get: ExpressionPropertyInterface(view.transform.mProps.s)\r\n },\r\n rotation: {\r\n get: ExpressionPropertyInterface(view.transform.mProps.r)\r\n },\r\n skew: {\r\n get: ExpressionPropertyInterface(view.transform.mProps.sk)\r\n },\r\n skewAxis: {\r\n get: ExpressionPropertyInterface(view.transform.mProps.sa)\r\n },\r\n _name: {\r\n value: shape.nm\r\n }\r\n });\r\n interfaceFunction.ty = 'tr';\r\n interfaceFunction.mn = shape.mn;\r\n interfaceFunction.propertyGroup = propertyGroup;\r\n return interfaceFunction;\r\n }\r\n\r\n function ellipseInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(value) {\r\n if (shape.p.ix === value) {\r\n return interfaceFunction.position;\r\n }\r\n\r\n if (shape.s.ix === value) {\r\n return interfaceFunction.size;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n interfaceFunction.propertyIndex = shape.ix;\r\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\r\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\r\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n Object.defineProperties(interfaceFunction, {\r\n size: {\r\n get: ExpressionPropertyInterface(prop.s)\r\n },\r\n position: {\r\n get: ExpressionPropertyInterface(prop.p)\r\n },\r\n _name: {\r\n value: shape.nm\r\n }\r\n });\r\n interfaceFunction.mn = shape.mn;\r\n return interfaceFunction;\r\n }\r\n\r\n function starInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(value) {\r\n if (shape.p.ix === value) {\r\n return interfaceFunction.position;\r\n }\r\n\r\n if (shape.r.ix === value) {\r\n return interfaceFunction.rotation;\r\n }\r\n\r\n if (shape.pt.ix === value) {\r\n return interfaceFunction.points;\r\n }\r\n\r\n if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') {\r\n return interfaceFunction.outerRadius;\r\n }\r\n\r\n if (shape.os.ix === value) {\r\n return interfaceFunction.outerRoundness;\r\n }\r\n\r\n if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) {\r\n return interfaceFunction.innerRadius;\r\n }\r\n\r\n if (shape.is && shape.is.ix === value) {\r\n return interfaceFunction.innerRoundness;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\r\n interfaceFunction.propertyIndex = shape.ix;\r\n prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup));\r\n prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup));\r\n prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup));\r\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\r\n\r\n if (shape.ir) {\r\n prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup));\r\n prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup));\r\n }\r\n\r\n Object.defineProperties(interfaceFunction, {\r\n position: {\r\n get: ExpressionPropertyInterface(prop.p)\r\n },\r\n rotation: {\r\n get: ExpressionPropertyInterface(prop.r)\r\n },\r\n points: {\r\n get: ExpressionPropertyInterface(prop.pt)\r\n },\r\n outerRadius: {\r\n get: ExpressionPropertyInterface(prop.or)\r\n },\r\n outerRoundness: {\r\n get: ExpressionPropertyInterface(prop.os)\r\n },\r\n innerRadius: {\r\n get: ExpressionPropertyInterface(prop.ir)\r\n },\r\n innerRoundness: {\r\n get: ExpressionPropertyInterface(prop.is)\r\n },\r\n _name: {\r\n value: shape.nm\r\n }\r\n });\r\n interfaceFunction.mn = shape.mn;\r\n return interfaceFunction;\r\n }\r\n\r\n function rectInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(value) {\r\n if (shape.p.ix === value) {\r\n return interfaceFunction.position;\r\n }\r\n\r\n if (shape.r.ix === value) {\r\n return interfaceFunction.roundness;\r\n }\r\n\r\n if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') {\r\n return interfaceFunction.size;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;\r\n interfaceFunction.propertyIndex = shape.ix;\r\n prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));\r\n prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));\r\n prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));\r\n Object.defineProperties(interfaceFunction, {\r\n position: {\r\n get: ExpressionPropertyInterface(prop.p)\r\n },\r\n roundness: {\r\n get: ExpressionPropertyInterface(prop.r)\r\n },\r\n size: {\r\n get: ExpressionPropertyInterface(prop.s)\r\n },\r\n _name: {\r\n value: shape.nm\r\n }\r\n });\r\n interfaceFunction.mn = shape.mn;\r\n return interfaceFunction;\r\n }\r\n\r\n function roundedInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(value) {\r\n if (shape.r.ix === value || value === 'Round Corners 1') {\r\n return interfaceFunction.radius;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n var prop = view;\r\n interfaceFunction.propertyIndex = shape.ix;\r\n prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup));\r\n Object.defineProperties(interfaceFunction, {\r\n radius: {\r\n get: ExpressionPropertyInterface(prop.rd)\r\n },\r\n _name: {\r\n value: shape.nm\r\n }\r\n });\r\n interfaceFunction.mn = shape.mn;\r\n return interfaceFunction;\r\n }\r\n\r\n function repeaterInterfaceFactory(shape, view, propertyGroup) {\r\n function interfaceFunction(value) {\r\n if (shape.c.ix === value || value === 'Copies') {\r\n return interfaceFunction.copies;\r\n }\r\n\r\n if (shape.o.ix === value || value === 'Offset') {\r\n return interfaceFunction.offset;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup);\r\n\r\n var prop = view;\r\n interfaceFunction.propertyIndex = shape.ix;\r\n prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup));\r\n prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));\r\n Object.defineProperties(interfaceFunction, {\r\n copies: {\r\n get: ExpressionPropertyInterface(prop.c)\r\n },\r\n offset: {\r\n get: ExpressionPropertyInterface(prop.o)\r\n },\r\n _name: {\r\n value: shape.nm\r\n }\r\n });\r\n interfaceFunction.mn = shape.mn;\r\n return interfaceFunction;\r\n }\r\n\r\n return function (shapes, view, propertyGroup) {\r\n var interfaces;\r\n\r\n function _interfaceFunction(value) {\r\n if (typeof value === 'number') {\r\n value = value === undefined ? 1 : value;\r\n\r\n if (value === 0) {\r\n return propertyGroup;\r\n }\r\n\r\n return interfaces[value - 1];\r\n }\r\n\r\n var i = 0;\r\n var len = interfaces.length;\r\n\r\n while (i < len) {\r\n if (interfaces[i]._name === value) {\r\n return interfaces[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function parentGroupWrapper() {\r\n return propertyGroup;\r\n }\r\n\r\n _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper);\r\n interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup);\r\n _interfaceFunction.numProperties = interfaces.length;\r\n _interfaceFunction._name = 'Contents';\r\n return _interfaceFunction;\r\n };\r\n }();\r\n\r\n var TextExpressionInterface = function () {\r\n return function (elem) {\r\n var _prevValue;\r\n\r\n var _sourceText;\r\n\r\n function _thisLayerFunction(name) {\r\n switch (name) {\r\n case 'ADBE Text Document':\r\n return _thisLayerFunction.sourceText;\r\n\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n Object.defineProperty(_thisLayerFunction, 'sourceText', {\r\n get: function get() {\r\n elem.textProperty.getValue();\r\n var stringValue = elem.textProperty.currentData.t;\r\n\r\n if (stringValue !== _prevValue) {\r\n elem.textProperty.currentData.t = _prevValue;\r\n _sourceText = new String(stringValue); // eslint-disable-line no-new-wrappers\r\n // If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive\r\n\r\n _sourceText.value = stringValue || new String(stringValue); // eslint-disable-line no-new-wrappers\r\n }\r\n\r\n return _sourceText;\r\n }\r\n });\r\n return _thisLayerFunction;\r\n };\r\n }();\r\n\r\n function _typeof$2(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof$2(obj); }\r\n\r\n var FootageInterface = function () {\r\n var outlineInterfaceFactory = function outlineInterfaceFactory(elem) {\r\n var currentPropertyName = '';\r\n var currentProperty = elem.getFootageData();\r\n\r\n function init() {\r\n currentPropertyName = '';\r\n currentProperty = elem.getFootageData();\r\n return searchProperty;\r\n }\r\n\r\n function searchProperty(value) {\r\n if (currentProperty[value]) {\r\n currentPropertyName = value;\r\n currentProperty = currentProperty[value];\r\n\r\n if (_typeof$2(currentProperty) === 'object') {\r\n return searchProperty;\r\n }\r\n\r\n return currentProperty;\r\n }\r\n\r\n var propertyNameIndex = value.indexOf(currentPropertyName);\r\n\r\n if (propertyNameIndex !== -1) {\r\n var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10);\r\n currentProperty = currentProperty[index];\r\n\r\n if (_typeof$2(currentProperty) === 'object') {\r\n return searchProperty;\r\n }\r\n\r\n return currentProperty;\r\n }\r\n\r\n return '';\r\n }\r\n\r\n return init;\r\n };\r\n\r\n var dataInterfaceFactory = function dataInterfaceFactory(elem) {\r\n function interfaceFunction(value) {\r\n if (value === 'Outline') {\r\n return interfaceFunction.outlineInterface();\r\n }\r\n\r\n return null;\r\n }\r\n\r\n interfaceFunction._name = 'Outline';\r\n interfaceFunction.outlineInterface = outlineInterfaceFactory(elem);\r\n return interfaceFunction;\r\n };\r\n\r\n return function (elem) {\r\n function _interfaceFunction(value) {\r\n if (value === 'Data') {\r\n return _interfaceFunction.dataInterface;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n _interfaceFunction._name = 'Data';\r\n _interfaceFunction.dataInterface = dataInterfaceFactory(elem);\r\n return _interfaceFunction;\r\n };\r\n }();\r\n\r\n var interfaces = {\r\n layer: LayerExpressionInterface,\r\n effects: EffectsExpressionInterface,\r\n comp: CompExpressionInterface,\r\n shape: ShapeExpressionInterface,\r\n text: TextExpressionInterface,\r\n footage: FootageInterface\r\n };\r\n\r\n function getInterface(type) {\r\n return interfaces[type] || null;\r\n }\r\n\r\n function _typeof$1(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof$1(obj); }\r\n\r\n /* eslint-disable */\r\n\r\n /*\r\n Copyright 2014 David Bau.\r\n\r\n Permission is hereby granted, free of charge, to any person obtaining\r\n a copy of this software and associated documentation files (the\r\n \"Software\"), to deal in the Software without restriction, including\r\n without limitation the rights to use, copy, modify, merge, publish,\r\n distribute, sublicense, and/or sell copies of the Software, and to\r\n permit persons to whom the Software is furnished to do so, subject to\r\n the following conditions:\r\n\r\n The above copyright notice and this permission notice shall be\r\n included in all copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\n MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\r\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n */\r\n function seedRandom(pool, math) {\r\n //\r\n // The following constants are related to IEEE 754 limits.\r\n //\r\n var global = this,\r\n width = 256,\r\n // each RC4 output is 0 <= x < 256\r\n chunks = 6,\r\n // at least six RC4 outputs for each double\r\n digits = 52,\r\n // there are 52 significant digits in a double\r\n rngname = 'random',\r\n // rngname: name for Math.random and Math.seedrandom\r\n startdenom = math.pow(width, chunks),\r\n significance = math.pow(2, digits),\r\n overflow = significance * 2,\r\n mask = width - 1,\r\n nodecrypto; // node.js crypto module, initialized at the bottom.\r\n //\r\n // seedrandom()\r\n // This is the seedrandom function described above.\r\n //\r\n\r\n function seedrandom(seed, options, callback) {\r\n var key = [];\r\n options = options === true ? {\r\n entropy: true\r\n } : options || {}; // Flatten the seed string or build one from local entropy if needed.\r\n\r\n var shortseed = mixkey(flatten(options.entropy ? [seed, tostring(pool)] : seed === null ? autoseed() : seed, 3), key); // Use the seed to initialize an ARC4 generator.\r\n\r\n var arc4 = new ARC4(key); // This function returns a random double in [0, 1) that contains\r\n // randomness in every bit of the mantissa of the IEEE 754 value.\r\n\r\n var prng = function prng() {\r\n var n = arc4.g(chunks),\r\n // Start with a numerator n < 2 ^ 48\r\n d = startdenom,\r\n // and denominator d = 2 ^ 48.\r\n x = 0; // and no 'extra last byte'.\r\n\r\n while (n < significance) {\r\n // Fill up all significant digits by\r\n n = (n + x) * width; // shifting numerator and\r\n\r\n d *= width; // denominator and generating a\r\n\r\n x = arc4.g(1); // new least-significant-byte.\r\n }\r\n\r\n while (n >= overflow) {\r\n // To avoid rounding up, before adding\r\n n /= 2; // last byte, shift everything\r\n\r\n d /= 2; // right using integer math until\r\n\r\n x >>>= 1; // we have exactly the desired bits.\r\n }\r\n\r\n return (n + x) / d; // Form the number within [0, 1).\r\n };\r\n\r\n prng.int32 = function () {\r\n return arc4.g(4) | 0;\r\n };\r\n\r\n prng.quick = function () {\r\n return arc4.g(4) / 0x100000000;\r\n };\r\n\r\n prng[\"double\"] = prng; // Mix the randomness into accumulated entropy.\r\n\r\n mixkey(tostring(arc4.S), pool); // Calling convention: what to return as a function of prng, seed, is_math.\r\n\r\n return (options.pass || callback || function (prng, seed, is_math_call, state) {\r\n if (state) {\r\n // Load the arc4 state from the given state if it has an S array.\r\n if (state.S) {\r\n copy(state, arc4);\r\n } // Only provide the .state method if requested via options.state.\r\n\r\n\r\n prng.state = function () {\r\n return copy(arc4, {});\r\n };\r\n } // If called as a method of Math (Math.seedrandom()), mutate\r\n // Math.random because that is how seedrandom.js has worked since v1.0.\r\n\r\n\r\n if (is_math_call) {\r\n math[rngname] = prng;\r\n return seed;\r\n } // Otherwise, it is a newer calling convention, so return the\r\n // prng directly.\r\n else return prng;\r\n })(prng, shortseed, 'global' in options ? options.global : this == math, options.state);\r\n }\r\n\r\n math['seed' + rngname] = seedrandom; //\r\n // ARC4\r\n //\r\n // An ARC4 implementation. The constructor takes a key in the form of\r\n // an array of at most (width) integers that should be 0 <= x < (width).\r\n //\r\n // The g(count) method returns a pseudorandom integer that concatenates\r\n // the next (count) outputs from ARC4. Its return value is a number x\r\n // that is in the range 0 <= x < (width ^ count).\r\n //\r\n\r\n function ARC4(key) {\r\n var t,\r\n keylen = key.length,\r\n me = this,\r\n i = 0,\r\n j = me.i = me.j = 0,\r\n s = me.S = []; // The empty key [] is treated as [0].\r\n\r\n if (!keylen) {\r\n key = [keylen++];\r\n } // Set up S using the standard key scheduling algorithm.\r\n\r\n\r\n while (i < width) {\r\n s[i] = i++;\r\n }\r\n\r\n for (i = 0; i < width; i++) {\r\n s[i] = s[j = mask & j + key[i % keylen] + (t = s[i])];\r\n s[j] = t;\r\n } // The \"g\" method returns the next (count) outputs as one number.\r\n\r\n\r\n me.g = function (count) {\r\n // Using instance members instead of closure state nearly doubles speed.\r\n var t,\r\n r = 0,\r\n i = me.i,\r\n j = me.j,\r\n s = me.S;\r\n\r\n while (count--) {\r\n t = s[i = mask & i + 1];\r\n r = r * width + s[mask & (s[i] = s[j = mask & j + t]) + (s[j] = t)];\r\n }\r\n\r\n me.i = i;\r\n me.j = j;\r\n return r; // For robust unpredictability, the function call below automatically\r\n // discards an initial batch of values. This is called RC4-drop[256].\r\n // See http://google.com/search?q=rsa+fluhrer+response&btnI\r\n };\r\n } //\r\n // copy()\r\n // Copies internal state of ARC4 to or from a plain object.\r\n //\r\n\r\n\r\n function copy(f, t) {\r\n t.i = f.i;\r\n t.j = f.j;\r\n t.S = f.S.slice();\r\n return t;\r\n } //\r\n // flatten()\r\n // Converts an object tree to nested arrays of strings.\r\n //\r\n\r\n\r\n function flatten(obj, depth) {\r\n var result = [],\r\n typ = _typeof$1(obj),\r\n prop;\r\n\r\n if (depth && typ == 'object') {\r\n for (prop in obj) {\r\n try {\r\n result.push(flatten(obj[prop], depth - 1));\r\n } catch (e) {}\r\n }\r\n }\r\n\r\n return result.length ? result : typ == 'string' ? obj : obj + '\\0';\r\n } //\r\n // mixkey()\r\n // Mixes a string seed into a key that is an array of integers, and\r\n // returns a shortened string seed that is equivalent to the result key.\r\n //\r\n\r\n\r\n function mixkey(seed, key) {\r\n var stringseed = seed + '',\r\n smear,\r\n j = 0;\r\n\r\n while (j < stringseed.length) {\r\n key[mask & j] = mask & (smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++);\r\n }\r\n\r\n return tostring(key);\r\n } //\r\n // autoseed()\r\n // Returns an object for autoseeding, using window.crypto and Node crypto\r\n // module if available.\r\n //\r\n\r\n\r\n function autoseed() {\r\n try {\r\n if (nodecrypto) {\r\n return tostring(nodecrypto.randomBytes(width));\r\n }\r\n\r\n var out = new Uint8Array(width);\r\n (global.crypto || global.msCrypto).getRandomValues(out);\r\n return tostring(out);\r\n } catch (e) {\r\n var browser = global.navigator,\r\n plugins = browser && browser.plugins;\r\n return [+new Date(), global, plugins, global.screen, tostring(pool)];\r\n }\r\n } //\r\n // tostring()\r\n // Converts an array of charcodes to a string\r\n //\r\n\r\n\r\n function tostring(a) {\r\n return String.fromCharCode.apply(0, a);\r\n } //\r\n // When seedrandom.js is loaded, we immediately mix a few bits\r\n // from the built-in RNG into the entropy pool. Because we do\r\n // not want to interfere with deterministic PRNG state later,\r\n // seedrandom will not call math.random on its own again after\r\n // initialization.\r\n //\r\n\r\n\r\n mixkey(math.random(), pool); //\r\n // Nodejs and AMD support: export the implementation as a module using\r\n // either convention.\r\n //\r\n // End anonymous scope, and pass initial values.\r\n }\r\n\r\n ;\r\n\r\n function initialize$2(BMMath) {\r\n seedRandom([], BMMath);\r\n }\r\n\r\n var propTypes = {\r\n SHAPE: 'shape'\r\n };\r\n\r\n function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\r\n\r\n var ExpressionManager = function () {\r\n 'use strict';\r\n\r\n var ob = {};\r\n var Math = BMMath;\r\n var window = null;\r\n var document = null;\r\n var XMLHttpRequest = null;\r\n var fetch = null;\r\n var frames = null;\r\n initialize$2(BMMath);\r\n\r\n function $bm_isInstanceOfArray(arr) {\r\n return arr.constructor === Array || arr.constructor === Float32Array;\r\n }\r\n\r\n function isNumerable(tOfV, v) {\r\n return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number;\r\n }\r\n\r\n function $bm_neg(a) {\r\n var tOfA = _typeof(a);\r\n\r\n if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) {\r\n return -a;\r\n }\r\n\r\n if ($bm_isInstanceOfArray(a)) {\r\n var i;\r\n var lenA = a.length;\r\n var retArr = [];\r\n\r\n for (i = 0; i < lenA; i += 1) {\r\n retArr[i] = -a[i];\r\n }\r\n\r\n return retArr;\r\n }\r\n\r\n if (a.propType) {\r\n return a.v;\r\n }\r\n\r\n return -a;\r\n }\r\n\r\n var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get;\r\n var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get;\r\n var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get;\r\n\r\n function sum(a, b) {\r\n var tOfA = _typeof(a);\r\n\r\n var tOfB = _typeof(b);\r\n\r\n if (tOfA === 'string' || tOfB === 'string') {\r\n return a + b;\r\n }\r\n\r\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n return a + b;\r\n }\r\n\r\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n a = a.slice(0);\r\n a[0] += b;\r\n return a;\r\n }\r\n\r\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n b = b.slice(0);\r\n b[0] = a + b[0];\r\n return b;\r\n }\r\n\r\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\r\n var i = 0;\r\n var lenA = a.length;\r\n var lenB = b.length;\r\n var retArr = [];\r\n\r\n while (i < lenA || i < lenB) {\r\n if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\r\n retArr[i] = a[i] + b[i];\r\n } else {\r\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return retArr;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n var add = sum;\r\n\r\n function sub(a, b) {\r\n var tOfA = _typeof(a);\r\n\r\n var tOfB = _typeof(b);\r\n\r\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n if (tOfA === 'string') {\r\n a = parseInt(a, 10);\r\n }\r\n\r\n if (tOfB === 'string') {\r\n b = parseInt(b, 10);\r\n }\r\n\r\n return a - b;\r\n }\r\n\r\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n a = a.slice(0);\r\n a[0] -= b;\r\n return a;\r\n }\r\n\r\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n b = b.slice(0);\r\n b[0] = a - b[0];\r\n return b;\r\n }\r\n\r\n if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) {\r\n var i = 0;\r\n var lenA = a.length;\r\n var lenB = b.length;\r\n var retArr = [];\r\n\r\n while (i < lenA || i < lenB) {\r\n if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) {\r\n retArr[i] = a[i] - b[i];\r\n } else {\r\n retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return retArr;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n function mul(a, b) {\r\n var tOfA = _typeof(a);\r\n\r\n var tOfB = _typeof(b);\r\n\r\n var arr;\r\n\r\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n return a * b;\r\n }\r\n\r\n var i;\r\n var len;\r\n\r\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n len = a.length;\r\n arr = createTypedArray('float32', len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n arr[i] = a[i] * b;\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n len = b.length;\r\n arr = createTypedArray('float32', len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n arr[i] = a * b[i];\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n function div(a, b) {\r\n var tOfA = _typeof(a);\r\n\r\n var tOfB = _typeof(b);\r\n\r\n var arr;\r\n\r\n if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) {\r\n return a / b;\r\n }\r\n\r\n var i;\r\n var len;\r\n\r\n if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) {\r\n len = a.length;\r\n arr = createTypedArray('float32', len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n arr[i] = a[i] / b;\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) {\r\n len = b.length;\r\n arr = createTypedArray('float32', len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n arr[i] = a / b[i];\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n function mod(a, b) {\r\n if (typeof a === 'string') {\r\n a = parseInt(a, 10);\r\n }\r\n\r\n if (typeof b === 'string') {\r\n b = parseInt(b, 10);\r\n }\r\n\r\n return a % b;\r\n }\r\n\r\n var $bm_sum = sum;\r\n var $bm_sub = sub;\r\n var $bm_mul = mul;\r\n var $bm_div = div;\r\n var $bm_mod = mod;\r\n\r\n function clamp(num, min, max) {\r\n if (min > max) {\r\n var mm = max;\r\n max = min;\r\n min = mm;\r\n }\r\n\r\n return Math.min(Math.max(num, min), max);\r\n }\r\n\r\n function radiansToDegrees(val) {\r\n return val / degToRads;\r\n }\r\n\r\n var radians_to_degrees = radiansToDegrees;\r\n\r\n function degreesToRadians(val) {\r\n return val * degToRads;\r\n }\r\n\r\n var degrees_to_radians = radiansToDegrees;\r\n var helperLengthArray = [0, 0, 0, 0, 0, 0];\r\n\r\n function length(arr1, arr2) {\r\n if (typeof arr1 === 'number' || arr1 instanceof Number) {\r\n arr2 = arr2 || 0;\r\n return Math.abs(arr1 - arr2);\r\n }\r\n\r\n if (!arr2) {\r\n arr2 = helperLengthArray;\r\n }\r\n\r\n var i;\r\n var len = Math.min(arr1.length, arr2.length);\r\n var addedLength = 0;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n addedLength += Math.pow(arr2[i] - arr1[i], 2);\r\n }\r\n\r\n return Math.sqrt(addedLength);\r\n }\r\n\r\n function normalize(vec) {\r\n return div(vec, length(vec));\r\n }\r\n\r\n function rgbToHsl(val) {\r\n var r = val[0];\r\n var g = val[1];\r\n var b = val[2];\r\n var max = Math.max(r, g, b);\r\n var min = Math.min(r, g, b);\r\n var h;\r\n var s;\r\n var l = (max + min) / 2;\r\n\r\n if (max === min) {\r\n h = 0; // achromatic\r\n\r\n s = 0; // achromatic\r\n } else {\r\n var d = max - min;\r\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\r\n\r\n switch (max) {\r\n case r:\r\n h = (g - b) / d + (g < b ? 6 : 0);\r\n break;\r\n\r\n case g:\r\n h = (b - r) / d + 2;\r\n break;\r\n\r\n case b:\r\n h = (r - g) / d + 4;\r\n break;\r\n\r\n default:\r\n break;\r\n }\r\n\r\n h /= 6;\r\n }\r\n\r\n return [h, s, l, val[3]];\r\n }\r\n\r\n function hue2rgb(p, q, t) {\r\n if (t < 0) t += 1;\r\n if (t > 1) t -= 1;\r\n if (t < 1 / 6) return p + (q - p) * 6 * t;\r\n if (t < 1 / 2) return q;\r\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\r\n return p;\r\n }\r\n\r\n function hslToRgb(val) {\r\n var h = val[0];\r\n var s = val[1];\r\n var l = val[2];\r\n var r;\r\n var g;\r\n var b;\r\n\r\n if (s === 0) {\r\n r = l; // achromatic\r\n\r\n b = l; // achromatic\r\n\r\n g = l; // achromatic\r\n } else {\r\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n var p = 2 * l - q;\r\n r = hue2rgb(p, q, h + 1 / 3);\r\n g = hue2rgb(p, q, h);\r\n b = hue2rgb(p, q, h - 1 / 3);\r\n }\r\n\r\n return [r, g, b, val[3]];\r\n }\r\n\r\n function linear(t, tMin, tMax, value1, value2) {\r\n if (value1 === undefined || value2 === undefined) {\r\n value1 = tMin;\r\n value2 = tMax;\r\n tMin = 0;\r\n tMax = 1;\r\n }\r\n\r\n if (tMax < tMin) {\r\n var _tMin = tMax;\r\n tMax = tMin;\r\n tMin = _tMin;\r\n }\r\n\r\n if (t <= tMin) {\r\n return value1;\r\n }\r\n\r\n if (t >= tMax) {\r\n return value2;\r\n }\r\n\r\n var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin);\r\n\r\n if (!value1.length) {\r\n return value1 + (value2 - value1) * perc;\r\n }\r\n\r\n var i;\r\n var len = value1.length;\r\n var arr = createTypedArray('float32', len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n arr[i] = value1[i] + (value2[i] - value1[i]) * perc;\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n function random(min, max) {\r\n if (max === undefined) {\r\n if (min === undefined) {\r\n min = 0;\r\n max = 1;\r\n } else {\r\n max = min;\r\n min = undefined;\r\n }\r\n }\r\n\r\n if (max.length) {\r\n var i;\r\n var len = max.length;\r\n\r\n if (!min) {\r\n min = createTypedArray('float32', len);\r\n }\r\n\r\n var arr = createTypedArray('float32', len);\r\n var rnd = BMMath.random();\r\n\r\n for (i = 0; i < len; i += 1) {\r\n arr[i] = min[i] + rnd * (max[i] - min[i]);\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n if (min === undefined) {\r\n min = 0;\r\n }\r\n\r\n var rndm = BMMath.random();\r\n return min + rndm * (max - min);\r\n }\r\n\r\n function createPath(points, inTangents, outTangents, closed) {\r\n var i;\r\n var len = points.length;\r\n var path = shapePool.newElement();\r\n path.setPathData(!!closed, len);\r\n var arrPlaceholder = [0, 0];\r\n var inVertexPoint;\r\n var outVertexPoint;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n inVertexPoint = inTangents && inTangents[i] ? inTangents[i] : arrPlaceholder;\r\n outVertexPoint = outTangents && outTangents[i] ? outTangents[i] : arrPlaceholder;\r\n path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true);\r\n }\r\n\r\n return path;\r\n }\r\n\r\n function initiateExpression(elem, data, property) {\r\n // Bail out if we don't want expressions\r\n function noOp(_value) {\r\n return _value;\r\n }\r\n\r\n if (!elem.globalData.renderConfig.runExpressions) {\r\n return noOp;\r\n }\r\n\r\n var val = data.x;\r\n var needsVelocity = /velocity(?![\\w\\d])/.test(val);\r\n\r\n var _needsRandom = val.indexOf('random') !== -1;\r\n\r\n var elemType = elem.data.ty;\r\n var transform;\r\n var $bm_transform;\r\n var content;\r\n var effect;\r\n var thisProperty = property;\r\n thisProperty.valueAtTime = thisProperty.getValueAtTime;\r\n Object.defineProperty(thisProperty, 'value', {\r\n get: function get() {\r\n return thisProperty.v;\r\n }\r\n });\r\n elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate;\r\n elem.comp.displayStartTime = 0;\r\n var inPoint = elem.data.ip / elem.comp.globalData.frameRate;\r\n var outPoint = elem.data.op / elem.comp.globalData.frameRate;\r\n var width = elem.data.sw ? elem.data.sw : 0;\r\n var height = elem.data.sh ? elem.data.sh : 0;\r\n var name = elem.data.nm;\r\n var loopIn;\r\n var loop_in;\r\n var loopOut;\r\n var loop_out;\r\n var smooth;\r\n var toWorld;\r\n var fromWorld;\r\n var fromComp;\r\n var toComp;\r\n var fromCompToSurface;\r\n var position;\r\n var rotation;\r\n var anchorPoint;\r\n var scale;\r\n var thisLayer;\r\n var thisComp;\r\n var mask;\r\n var valueAtTime;\r\n var velocityAtTime;\r\n var scoped_bm_rt; // val = val.replace(/(\\\\?\"|')((http)(s)?(:\\/))?\\/.*?(\\\\?\"|')/g, \"\\\"\\\"\"); // deter potential network calls\r\n\r\n var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0]; // eslint-disable-line no-eval\r\n\r\n var numKeys = property.kf ? data.k.length : 0;\r\n var active = !this.data || this.data.hd !== true;\r\n\r\n var wiggle = function wiggle(freq, amp) {\r\n var iWiggle;\r\n var j;\r\n var lenWiggle = this.pv.length ? this.pv.length : 1;\r\n var addedAmps = createTypedArray('float32', lenWiggle);\r\n freq = 5;\r\n var iterations = Math.floor(time * freq);\r\n iWiggle = 0;\r\n j = 0;\r\n\r\n while (iWiggle < iterations) {\r\n // var rnd = BMMath.random();\r\n for (j = 0; j < lenWiggle; j += 1) {\r\n addedAmps[j] += -amp + amp * 2 * BMMath.random(); // addedAmps[j] += -amp + amp*2*rnd;\r\n }\r\n\r\n iWiggle += 1;\r\n } // var rnd2 = BMMath.random();\r\n\r\n\r\n var periods = time * freq;\r\n var perc = periods - Math.floor(periods);\r\n var arr = createTypedArray('float32', lenWiggle);\r\n\r\n if (lenWiggle > 1) {\r\n for (j = 0; j < lenWiggle; j += 1) {\r\n arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc; // arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;\r\n // arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc;\r\n }.bind(this);\r\n\r\n if (thisProperty.loopIn) {\r\n loopIn = thisProperty.loopIn.bind(thisProperty);\r\n loop_in = loopIn;\r\n }\r\n\r\n if (thisProperty.loopOut) {\r\n loopOut = thisProperty.loopOut.bind(thisProperty);\r\n loop_out = loopOut;\r\n }\r\n\r\n if (thisProperty.smooth) {\r\n smooth = thisProperty.smooth.bind(thisProperty);\r\n }\r\n\r\n function loopInDuration(type, duration) {\r\n return loopIn(type, duration, true);\r\n }\r\n\r\n function loopOutDuration(type, duration) {\r\n return loopOut(type, duration, true);\r\n }\r\n\r\n if (this.getValueAtTime) {\r\n valueAtTime = this.getValueAtTime.bind(this);\r\n }\r\n\r\n if (this.getVelocityAtTime) {\r\n velocityAtTime = this.getVelocityAtTime.bind(this);\r\n }\r\n\r\n var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);\r\n\r\n function lookAt(elem1, elem2) {\r\n var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]];\r\n var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads;\r\n var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads;\r\n return [yaw, pitch, 0];\r\n }\r\n\r\n function easeOut(t, tMin, tMax, val1, val2) {\r\n return applyEase(easeOutBez, t, tMin, tMax, val1, val2);\r\n }\r\n\r\n function easeIn(t, tMin, tMax, val1, val2) {\r\n return applyEase(easeInBez, t, tMin, tMax, val1, val2);\r\n }\r\n\r\n function ease(t, tMin, tMax, val1, val2) {\r\n return applyEase(easeInOutBez, t, tMin, tMax, val1, val2);\r\n }\r\n\r\n function applyEase(fn, t, tMin, tMax, val1, val2) {\r\n if (val1 === undefined) {\r\n val1 = tMin;\r\n val2 = tMax;\r\n } else {\r\n t = (t - tMin) / (tMax - tMin);\r\n }\r\n\r\n if (t > 1) {\r\n t = 1;\r\n } else if (t < 0) {\r\n t = 0;\r\n }\r\n\r\n var mult = fn(t);\r\n\r\n if ($bm_isInstanceOfArray(val1)) {\r\n var iKey;\r\n var lenKey = val1.length;\r\n var arr = createTypedArray('float32', lenKey);\r\n\r\n for (iKey = 0; iKey < lenKey; iKey += 1) {\r\n arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey];\r\n }\r\n\r\n return arr;\r\n }\r\n\r\n return (val2 - val1) * mult + val1;\r\n }\r\n\r\n function nearestKey(time) {\r\n var iKey;\r\n var lenKey = data.k.length;\r\n var index;\r\n var keyTime;\r\n\r\n if (!data.k.length || typeof data.k[0] === 'number') {\r\n index = 0;\r\n keyTime = 0;\r\n } else {\r\n index = -1;\r\n time *= elem.comp.globalData.frameRate;\r\n\r\n if (time < data.k[0].t) {\r\n index = 1;\r\n keyTime = data.k[0].t;\r\n } else {\r\n for (iKey = 0; iKey < lenKey - 1; iKey += 1) {\r\n if (time === data.k[iKey].t) {\r\n index = iKey + 1;\r\n keyTime = data.k[iKey].t;\r\n break;\r\n } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) {\r\n if (time - data.k[iKey].t > data.k[iKey + 1].t - time) {\r\n index = iKey + 2;\r\n keyTime = data.k[iKey + 1].t;\r\n } else {\r\n index = iKey + 1;\r\n keyTime = data.k[iKey].t;\r\n }\r\n\r\n break;\r\n }\r\n }\r\n\r\n if (index === -1) {\r\n index = iKey + 1;\r\n keyTime = data.k[iKey].t;\r\n }\r\n }\r\n }\r\n\r\n var obKey = {};\r\n obKey.index = index;\r\n obKey.time = keyTime / elem.comp.globalData.frameRate;\r\n return obKey;\r\n }\r\n\r\n function key(ind) {\r\n var obKey;\r\n var iKey;\r\n var lenKey;\r\n\r\n if (!data.k.length || typeof data.k[0] === 'number') {\r\n throw new Error('The property has no keyframe at index ' + ind);\r\n }\r\n\r\n ind -= 1;\r\n obKey = {\r\n time: data.k[ind].t / elem.comp.globalData.frameRate,\r\n value: []\r\n };\r\n var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e;\r\n lenKey = arr.length;\r\n\r\n for (iKey = 0; iKey < lenKey; iKey += 1) {\r\n obKey[iKey] = arr[iKey];\r\n obKey.value[iKey] = arr[iKey];\r\n }\r\n\r\n return obKey;\r\n }\r\n\r\n function framesToTime(fr, fps) {\r\n if (!fps) {\r\n fps = elem.comp.globalData.frameRate;\r\n }\r\n\r\n return fr / fps;\r\n }\r\n\r\n function timeToFrames(t, fps) {\r\n if (!t && t !== 0) {\r\n t = time;\r\n }\r\n\r\n if (!fps) {\r\n fps = elem.comp.globalData.frameRate;\r\n }\r\n\r\n return t * fps;\r\n }\r\n\r\n function seedRandom(seed) {\r\n BMMath.seedrandom(randSeed + seed);\r\n }\r\n\r\n function sourceRectAtTime() {\r\n return elem.sourceRectAtTime();\r\n }\r\n\r\n function substring(init, end) {\r\n if (typeof value === 'string') {\r\n if (end === undefined) {\r\n return value.substring(init);\r\n }\r\n\r\n return value.substring(init, end);\r\n }\r\n\r\n return '';\r\n }\r\n\r\n function substr(init, end) {\r\n if (typeof value === 'string') {\r\n if (end === undefined) {\r\n return value.substr(init);\r\n }\r\n\r\n return value.substr(init, end);\r\n }\r\n\r\n return '';\r\n }\r\n\r\n function posterizeTime(framesPerSecond) {\r\n time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond;\r\n value = valueAtTime(time);\r\n }\r\n\r\n var time;\r\n var velocity;\r\n var value;\r\n var text;\r\n var textIndex;\r\n var textTotal;\r\n var selectorValue;\r\n var index = elem.data.ind;\r\n var hasParent = !!(elem.hierarchy && elem.hierarchy.length);\r\n var parent;\r\n var randSeed = Math.floor(Math.random() * 1000000);\r\n var globalData = elem.globalData;\r\n\r\n function executeExpression(_value) {\r\n // globalData.pushExpression();\r\n value = _value;\r\n\r\n if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {\r\n return value;\r\n }\r\n\r\n if (this.propType === 'textSelector') {\r\n textIndex = this.textIndex;\r\n textTotal = this.textTotal;\r\n selectorValue = this.selectorValue;\r\n }\r\n\r\n if (!thisLayer) {\r\n text = elem.layerInterface.text;\r\n thisLayer = elem.layerInterface;\r\n thisComp = elem.comp.compInterface;\r\n toWorld = thisLayer.toWorld.bind(thisLayer);\r\n fromWorld = thisLayer.fromWorld.bind(thisLayer);\r\n fromComp = thisLayer.fromComp.bind(thisLayer);\r\n toComp = thisLayer.toComp.bind(thisLayer);\r\n mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;\r\n fromCompToSurface = fromComp;\r\n }\r\n\r\n if (!transform) {\r\n transform = elem.layerInterface('ADBE Transform Group');\r\n $bm_transform = transform;\r\n\r\n if (transform) {\r\n anchorPoint = transform.anchorPoint;\r\n /* position = transform.position;\r\n rotation = transform.rotation;\r\n scale = transform.scale; */\r\n }\r\n }\r\n\r\n if (elemType === 4 && !content) {\r\n content = thisLayer('ADBE Root Vectors Group');\r\n }\r\n\r\n if (!effect) {\r\n effect = thisLayer(4);\r\n }\r\n\r\n hasParent = !!(elem.hierarchy && elem.hierarchy.length);\r\n\r\n if (hasParent && !parent) {\r\n parent = elem.hierarchy[0].layerInterface;\r\n }\r\n\r\n time = this.comp.renderedFrame / this.comp.globalData.frameRate;\r\n\r\n if (_needsRandom) {\r\n seedRandom(randSeed + time);\r\n }\r\n\r\n if (needsVelocity) {\r\n velocity = velocityAtTime(time);\r\n }\r\n\r\n expression_function();\r\n this.frameExpressionId = elem.globalData.frameId; // TODO: Check if it's possible to return on ShapeInterface the .v value\r\n // Changed this to a ternary operation because Rollup failed compiling it correctly\r\n\r\n scoped_bm_rt = scoped_bm_rt.propType === propTypes.SHAPE ? scoped_bm_rt.v : scoped_bm_rt;\r\n return scoped_bm_rt;\r\n } // Bundlers will see these as dead code and unless we reference them\r\n\r\n\r\n executeExpression.__preventDeadCodeRemoval = [$bm_transform, anchorPoint, time, velocity, inPoint, outPoint, width, height, name, loop_in, loop_out, smooth, toComp, fromCompToSurface, toWorld, fromWorld, mask, position, rotation, scale, thisComp, numKeys, active, wiggle, loopInDuration, loopOutDuration, comp, lookAt, easeOut, easeIn, ease, nearestKey, key, text, textIndex, textTotal, selectorValue, framesToTime, timeToFrames, sourceRectAtTime, substring, substr, posterizeTime, index, globalData];\r\n return executeExpression;\r\n }\r\n\r\n ob.initiateExpression = initiateExpression;\r\n ob.__preventDeadCodeRemoval = [window, document, XMLHttpRequest, fetch, frames, $bm_neg, add, $bm_sum, $bm_sub, $bm_mul, $bm_div, $bm_mod, clamp, radians_to_degrees, degreesToRadians, degrees_to_radians, normalize, rgbToHsl, hslToRgb, linear, random, createPath];\r\n return ob;\r\n }();\r\n\r\n var expressionHelpers = function () {\r\n function searchExpressions(elem, data, prop) {\r\n if (data.x) {\r\n prop.k = true;\r\n prop.x = true;\r\n prop.initiateExpression = ExpressionManager.initiateExpression;\r\n prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop));\r\n }\r\n }\r\n\r\n function getValueAtTime(frameNum) {\r\n frameNum *= this.elem.globalData.frameRate;\r\n frameNum -= this.offsetTime;\r\n\r\n if (frameNum !== this._cachingAtTime.lastFrame) {\r\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;\r\n this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);\r\n this._cachingAtTime.lastFrame = frameNum;\r\n }\r\n\r\n return this._cachingAtTime.value;\r\n }\r\n\r\n function getSpeedAtTime(frameNum) {\r\n var delta = -0.01;\r\n var v1 = this.getValueAtTime(frameNum);\r\n var v2 = this.getValueAtTime(frameNum + delta);\r\n var speed = 0;\r\n\r\n if (v1.length) {\r\n var i;\r\n\r\n for (i = 0; i < v1.length; i += 1) {\r\n speed += Math.pow(v2[i] - v1[i], 2);\r\n }\r\n\r\n speed = Math.sqrt(speed) * 100;\r\n } else {\r\n speed = 0;\r\n }\r\n\r\n return speed;\r\n }\r\n\r\n function getVelocityAtTime(frameNum) {\r\n if (this.vel !== undefined) {\r\n return this.vel;\r\n }\r\n\r\n var delta = -0.001; // frameNum += this.elem.data.st;\r\n\r\n var v1 = this.getValueAtTime(frameNum);\r\n var v2 = this.getValueAtTime(frameNum + delta);\r\n var velocity;\r\n\r\n if (v1.length) {\r\n velocity = createTypedArray('float32', v1.length);\r\n var i;\r\n\r\n for (i = 0; i < v1.length; i += 1) {\r\n // removing frameRate\r\n // if needed, don't add it here\r\n // velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);\r\n velocity[i] = (v2[i] - v1[i]) / delta;\r\n }\r\n } else {\r\n velocity = (v2 - v1) / delta;\r\n }\r\n\r\n return velocity;\r\n }\r\n\r\n function getStaticValueAtTime() {\r\n return this.pv;\r\n }\r\n\r\n function setGroupProperty(propertyGroup) {\r\n this.propertyGroup = propertyGroup;\r\n }\r\n\r\n return {\r\n searchExpressions: searchExpressions,\r\n getSpeedAtTime: getSpeedAtTime,\r\n getVelocityAtTime: getVelocityAtTime,\r\n getValueAtTime: getValueAtTime,\r\n getStaticValueAtTime: getStaticValueAtTime,\r\n setGroupProperty: setGroupProperty\r\n };\r\n }();\r\n\r\n function addPropertyDecorator() {\r\n function loopOut(type, duration, durationFlag) {\r\n if (!this.k || !this.keyframes) {\r\n return this.pv;\r\n }\r\n\r\n type = type ? type.toLowerCase() : '';\r\n var currentFrame = this.comp.renderedFrame;\r\n var keyframes = this.keyframes;\r\n var lastKeyFrame = keyframes[keyframes.length - 1].t;\r\n\r\n if (currentFrame <= lastKeyFrame) {\r\n return this.pv;\r\n }\r\n\r\n var cycleDuration;\r\n var firstKeyFrame;\r\n\r\n if (!durationFlag) {\r\n if (!duration || duration > keyframes.length - 1) {\r\n duration = keyframes.length - 1;\r\n }\r\n\r\n firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;\r\n cycleDuration = lastKeyFrame - firstKeyFrame;\r\n } else {\r\n if (!duration) {\r\n cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip);\r\n } else {\r\n cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration);\r\n }\r\n\r\n firstKeyFrame = lastKeyFrame - cycleDuration;\r\n }\r\n\r\n var i;\r\n var len;\r\n var ret;\r\n\r\n if (type === 'pingpong') {\r\n var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\r\n\r\n if (iterations % 2 !== 0) {\r\n return this.getValueAtTime((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n }\r\n } else if (type === 'offset') {\r\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\r\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\r\n var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n\r\n var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration);\r\n\r\n if (this.pv.length) {\r\n ret = new Array(initV.length);\r\n len = ret.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ret[i] = (endV[i] - initV[i]) * repeats + current[i];\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n return (endV - initV) * repeats + current;\r\n } else if (type === 'continue') {\r\n var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\r\n var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);\r\n\r\n if (this.pv.length) {\r\n ret = new Array(lastValue.length);\r\n len = ret.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005; // eslint-disable-line\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n return lastValue + (lastValue - nextLastValue) * ((currentFrame - lastKeyFrame) / 0.001);\r\n }\r\n\r\n return this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n }\r\n\r\n function loopIn(type, duration, durationFlag) {\r\n if (!this.k) {\r\n return this.pv;\r\n }\r\n\r\n type = type ? type.toLowerCase() : '';\r\n var currentFrame = this.comp.renderedFrame;\r\n var keyframes = this.keyframes;\r\n var firstKeyFrame = keyframes[0].t;\r\n\r\n if (currentFrame >= firstKeyFrame) {\r\n return this.pv;\r\n }\r\n\r\n var cycleDuration;\r\n var lastKeyFrame;\r\n\r\n if (!durationFlag) {\r\n if (!duration || duration > keyframes.length - 1) {\r\n duration = keyframes.length - 1;\r\n }\r\n\r\n lastKeyFrame = keyframes[duration].t;\r\n cycleDuration = lastKeyFrame - firstKeyFrame;\r\n } else {\r\n if (!duration) {\r\n cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame);\r\n } else {\r\n cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration);\r\n }\r\n\r\n lastKeyFrame = firstKeyFrame + cycleDuration;\r\n }\r\n\r\n var i;\r\n var len;\r\n var ret;\r\n\r\n if (type === 'pingpong') {\r\n var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration);\r\n\r\n if (iterations % 2 === 0) {\r\n return this.getValueAtTime(((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n }\r\n } else if (type === 'offset') {\r\n var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\r\n var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);\r\n var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);\r\n var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1;\r\n\r\n if (this.pv.length) {\r\n ret = new Array(initV.length);\r\n len = ret.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ret[i] = current[i] - (endV[i] - initV[i]) * repeats;\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n return current - (endV - initV) * repeats;\r\n } else if (type === 'continue') {\r\n var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);\r\n var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);\r\n\r\n if (this.pv.length) {\r\n ret = new Array(firstValue.length);\r\n len = ret.length;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n ret[i] = firstValue[i] + (firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame) / 0.001;\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n return firstValue + (firstValue - nextFirstValue) * (firstKeyFrame - currentFrame) / 0.001;\r\n }\r\n\r\n return this.getValueAtTime((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line\r\n }\r\n\r\n function smooth(width, samples) {\r\n if (!this.k) {\r\n return this.pv;\r\n }\r\n\r\n width = (width || 0.4) * 0.5;\r\n samples = Math.floor(samples || 5);\r\n\r\n if (samples <= 1) {\r\n return this.pv;\r\n }\r\n\r\n var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;\r\n var initFrame = currentTime - width;\r\n var endFrame = currentTime + width;\r\n var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;\r\n var i = 0;\r\n var j = 0;\r\n var value;\r\n\r\n if (this.pv.length) {\r\n value = createTypedArray('float32', this.pv.length);\r\n } else {\r\n value = 0;\r\n }\r\n\r\n var sampleValue;\r\n\r\n while (i < samples) {\r\n sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);\r\n\r\n if (this.pv.length) {\r\n for (j = 0; j < this.pv.length; j += 1) {\r\n value[j] += sampleValue[j];\r\n }\r\n } else {\r\n value += sampleValue;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (this.pv.length) {\r\n for (j = 0; j < this.pv.length; j += 1) {\r\n value[j] /= samples;\r\n }\r\n } else {\r\n value /= samples;\r\n }\r\n\r\n return value;\r\n }\r\n\r\n function getTransformValueAtTime(time) {\r\n if (!this._transformCachingAtTime) {\r\n this._transformCachingAtTime = {\r\n v: new Matrix()\r\n };\r\n } /// /\r\n\r\n\r\n var matrix = this._transformCachingAtTime.v;\r\n matrix.cloneFromProps(this.pre.props);\r\n\r\n if (this.appliedTransformations < 1) {\r\n var anchor = this.a.getValueAtTime(time);\r\n matrix.translate(-anchor[0] * this.a.mult, -anchor[1] * this.a.mult, anchor[2] * this.a.mult);\r\n }\r\n\r\n if (this.appliedTransformations < 2) {\r\n var scale = this.s.getValueAtTime(time);\r\n matrix.scale(scale[0] * this.s.mult, scale[1] * this.s.mult, scale[2] * this.s.mult);\r\n }\r\n\r\n if (this.sk && this.appliedTransformations < 3) {\r\n var skew = this.sk.getValueAtTime(time);\r\n var skewAxis = this.sa.getValueAtTime(time);\r\n matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult);\r\n }\r\n\r\n if (this.r && this.appliedTransformations < 4) {\r\n var rotation = this.r.getValueAtTime(time);\r\n matrix.rotate(-rotation * this.r.mult);\r\n } else if (!this.r && this.appliedTransformations < 4) {\r\n var rotationZ = this.rz.getValueAtTime(time);\r\n var rotationY = this.ry.getValueAtTime(time);\r\n var rotationX = this.rx.getValueAtTime(time);\r\n var orientation = this.or.getValueAtTime(time);\r\n matrix.rotateZ(-rotationZ * this.rz.mult).rotateY(rotationY * this.ry.mult).rotateX(rotationX * this.rx.mult).rotateZ(-orientation[2] * this.or.mult).rotateY(orientation[1] * this.or.mult).rotateX(orientation[0] * this.or.mult);\r\n }\r\n\r\n if (this.data.p && this.data.p.s) {\r\n var positionX = this.px.getValueAtTime(time);\r\n var positionY = this.py.getValueAtTime(time);\r\n\r\n if (this.data.p.z) {\r\n var positionZ = this.pz.getValueAtTime(time);\r\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, -positionZ * this.pz.mult);\r\n } else {\r\n matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0);\r\n }\r\n } else {\r\n var position = this.p.getValueAtTime(time);\r\n matrix.translate(position[0] * this.p.mult, position[1] * this.p.mult, -position[2] * this.p.mult);\r\n }\r\n\r\n return matrix; /// /\r\n }\r\n\r\n function getTransformStaticValueAtTime() {\r\n return this.v.clone(new Matrix());\r\n }\r\n\r\n var getTransformProperty = TransformPropertyFactory.getTransformProperty;\r\n\r\n TransformPropertyFactory.getTransformProperty = function (elem, data, container) {\r\n var prop = getTransformProperty(elem, data, container);\r\n\r\n if (prop.dynamicProperties.length) {\r\n prop.getValueAtTime = getTransformValueAtTime.bind(prop);\r\n } else {\r\n prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);\r\n }\r\n\r\n prop.setGroupProperty = expressionHelpers.setGroupProperty;\r\n return prop;\r\n };\r\n\r\n var propertyGetProp = PropertyFactory.getProp;\r\n\r\n PropertyFactory.getProp = function (elem, data, type, mult, container) {\r\n var prop = propertyGetProp(elem, data, type, mult, container); // prop.getVelocityAtTime = getVelocityAtTime;\r\n // prop.loopOut = loopOut;\r\n // prop.loopIn = loopIn;\r\n\r\n if (prop.kf) {\r\n prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);\r\n } else {\r\n prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);\r\n }\r\n\r\n prop.setGroupProperty = expressionHelpers.setGroupProperty;\r\n prop.loopOut = loopOut;\r\n prop.loopIn = loopIn;\r\n prop.smooth = smooth;\r\n prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);\r\n prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);\r\n prop.numKeys = data.a === 1 ? data.k.length : 0;\r\n prop.propertyIndex = data.ix;\r\n var value = 0;\r\n\r\n if (type !== 0) {\r\n value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);\r\n }\r\n\r\n prop._cachingAtTime = {\r\n lastFrame: initialDefaultFrame,\r\n lastIndex: 0,\r\n value: value\r\n };\r\n expressionHelpers.searchExpressions(elem, data, prop);\r\n\r\n if (prop.k) {\r\n container.addDynamicProperty(prop);\r\n }\r\n\r\n return prop;\r\n };\r\n\r\n function getShapeValueAtTime(frameNum) {\r\n // For now this caching object is created only when needed instead of creating it when the shape is initialized.\r\n if (!this._cachingAtTime) {\r\n this._cachingAtTime = {\r\n shapeValue: shapePool.clone(this.pv),\r\n lastIndex: 0,\r\n lastTime: initialDefaultFrame\r\n };\r\n }\r\n\r\n frameNum *= this.elem.globalData.frameRate;\r\n frameNum -= this.offsetTime;\r\n\r\n if (frameNum !== this._cachingAtTime.lastTime) {\r\n this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;\r\n this._cachingAtTime.lastTime = frameNum;\r\n this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);\r\n }\r\n\r\n return this._cachingAtTime.shapeValue;\r\n }\r\n\r\n var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();\r\n var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();\r\n\r\n function ShapeExpressions() {}\r\n\r\n ShapeExpressions.prototype = {\r\n vertices: function vertices(prop, time) {\r\n if (this.k) {\r\n this.getValue();\r\n }\r\n\r\n var shapePath = this.v;\r\n\r\n if (time !== undefined) {\r\n shapePath = this.getValueAtTime(time, 0);\r\n }\r\n\r\n var i;\r\n var len = shapePath._length;\r\n var vertices = shapePath[prop];\r\n var points = shapePath.v;\r\n var arr = createSizedArray(len);\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (prop === 'i' || prop === 'o') {\r\n arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];\r\n } else {\r\n arr[i] = [vertices[i][0], vertices[i][1]];\r\n }\r\n }\r\n\r\n return arr;\r\n },\r\n points: function points(time) {\r\n return this.vertices('v', time);\r\n },\r\n inTangents: function inTangents(time) {\r\n return this.vertices('i', time);\r\n },\r\n outTangents: function outTangents(time) {\r\n return this.vertices('o', time);\r\n },\r\n isClosed: function isClosed() {\r\n return this.v.c;\r\n },\r\n pointOnPath: function pointOnPath(perc, time) {\r\n var shapePath = this.v;\r\n\r\n if (time !== undefined) {\r\n shapePath = this.getValueAtTime(time, 0);\r\n }\r\n\r\n if (!this._segmentsLength) {\r\n this._segmentsLength = bez.getSegmentsLength(shapePath);\r\n }\r\n\r\n var segmentsLength = this._segmentsLength;\r\n var lengths = segmentsLength.lengths;\r\n var lengthPos = segmentsLength.totalLength * perc;\r\n var i = 0;\r\n var len = lengths.length;\r\n var accumulatedLength = 0;\r\n var pt;\r\n\r\n while (i < len) {\r\n if (accumulatedLength + lengths[i].addedLength > lengthPos) {\r\n var initIndex = i;\r\n var endIndex = shapePath.c && i === len - 1 ? 0 : i + 1;\r\n var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength;\r\n pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);\r\n break;\r\n } else {\r\n accumulatedLength += lengths[i].addedLength;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n if (!pt) {\r\n pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]];\r\n }\r\n\r\n return pt;\r\n },\r\n vectorOnPath: function vectorOnPath(perc, time, vectorType) {\r\n // perc doesn't use triple equality because it can be a Number object as well as a primitive.\r\n if (perc == 1) {\r\n // eslint-disable-line eqeqeq\r\n perc = this.v.c;\r\n } else if (perc == 0) {\r\n // eslint-disable-line eqeqeq\r\n perc = 0.999;\r\n }\r\n\r\n var pt1 = this.pointOnPath(perc, time);\r\n var pt2 = this.pointOnPath(perc + 0.001, time);\r\n var xLength = pt2[0] - pt1[0];\r\n var yLength = pt2[1] - pt1[1];\r\n var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2));\r\n\r\n if (magnitude === 0) {\r\n return [0, 0];\r\n }\r\n\r\n var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude];\r\n return unitVector;\r\n },\r\n tangentOnPath: function tangentOnPath(perc, time) {\r\n return this.vectorOnPath(perc, time, 'tangent');\r\n },\r\n normalOnPath: function normalOnPath(perc, time) {\r\n return this.vectorOnPath(perc, time, 'normal');\r\n },\r\n setGroupProperty: expressionHelpers.setGroupProperty,\r\n getValueAtTime: expressionHelpers.getStaticValueAtTime\r\n };\r\n extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);\r\n extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);\r\n KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;\r\n KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;\r\n var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;\r\n\r\n ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) {\r\n var prop = propertyGetShapeProp(elem, data, type, arr, trims);\r\n prop.propertyIndex = data.ix;\r\n prop.lock = false;\r\n\r\n if (type === 3) {\r\n expressionHelpers.searchExpressions(elem, data.pt, prop);\r\n } else if (type === 4) {\r\n expressionHelpers.searchExpressions(elem, data.ks, prop);\r\n }\r\n\r\n if (prop.k) {\r\n elem.addDynamicProperty(prop);\r\n }\r\n\r\n return prop;\r\n };\r\n }\r\n\r\n function initialize$1() {\r\n addPropertyDecorator();\r\n }\r\n\r\n function addDecorator() {\r\n function searchExpressions() {\r\n if (this.data.d.x) {\r\n this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this);\r\n this.addEffect(this.getExpressionValue.bind(this));\r\n return true;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n TextProperty.prototype.getExpressionValue = function (currentValue, text) {\r\n var newValue = this.calculateExpression(text);\r\n\r\n if (currentValue.t !== newValue) {\r\n var newData = {};\r\n this.copyData(newData, currentValue);\r\n newData.t = newValue.toString();\r\n newData.__complete = false;\r\n return newData;\r\n }\r\n\r\n return currentValue;\r\n };\r\n\r\n TextProperty.prototype.searchProperty = function () {\r\n var isKeyframed = this.searchKeyframes();\r\n var hasExpressions = this.searchExpressions();\r\n this.kf = isKeyframed || hasExpressions;\r\n return this.kf;\r\n };\r\n\r\n TextProperty.prototype.searchExpressions = searchExpressions;\r\n }\r\n\r\n function initialize() {\r\n addDecorator();\r\n }\r\n\r\n function SVGComposableEffect() {}\r\n\r\n SVGComposableEffect.prototype = {\r\n createMergeNode: function createMergeNode(resultId, ins) {\r\n var feMerge = createNS('feMerge');\r\n feMerge.setAttribute('result', resultId);\r\n var feMergeNode;\r\n var i;\r\n\r\n for (i = 0; i < ins.length; i += 1) {\r\n feMergeNode = createNS('feMergeNode');\r\n feMergeNode.setAttribute('in', ins[i]);\r\n feMerge.appendChild(feMergeNode);\r\n feMerge.appendChild(feMergeNode);\r\n }\r\n\r\n return feMerge;\r\n }\r\n };\r\n\r\n function SVGTintFilter(filter, filterManager, elem, id, source) {\r\n this.filterManager = filterManager;\r\n var feColorMatrix = createNS('feColorMatrix');\r\n feColorMatrix.setAttribute('type', 'matrix');\r\n feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\r\n feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');\r\n feColorMatrix.setAttribute('result', id + '_tint_1');\r\n filter.appendChild(feColorMatrix);\r\n feColorMatrix = createNS('feColorMatrix');\r\n feColorMatrix.setAttribute('type', 'matrix');\r\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\r\n feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\r\n feColorMatrix.setAttribute('result', id + '_tint_2');\r\n filter.appendChild(feColorMatrix);\r\n this.matrixFilter = feColorMatrix;\r\n var feMerge = this.createMergeNode(id, [source, id + '_tint_1', id + '_tint_2']);\r\n filter.appendChild(feMerge);\r\n }\r\n\r\n extendPrototype([SVGComposableEffect], SVGTintFilter);\r\n\r\n SVGTintFilter.prototype.renderFrame = function (forceRender) {\r\n if (forceRender || this.filterManager._mdf) {\r\n var colorBlack = this.filterManager.effectElements[0].p.v;\r\n var colorWhite = this.filterManager.effectElements[1].p.v;\r\n var opacity = this.filterManager.effectElements[2].p.v / 100;\r\n this.matrixFilter.setAttribute('values', colorWhite[0] - colorBlack[0] + ' 0 0 0 ' + colorBlack[0] + ' ' + (colorWhite[1] - colorBlack[1]) + ' 0 0 0 ' + colorBlack[1] + ' ' + (colorWhite[2] - colorBlack[2]) + ' 0 0 0 ' + colorBlack[2] + ' 0 0 0 ' + opacity + ' 0');\r\n }\r\n };\r\n\r\n function SVGFillFilter(filter, filterManager, elem, id) {\r\n this.filterManager = filterManager;\r\n var feColorMatrix = createNS('feColorMatrix');\r\n feColorMatrix.setAttribute('type', 'matrix');\r\n feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');\r\n feColorMatrix.setAttribute('values', '1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');\r\n feColorMatrix.setAttribute('result', id);\r\n filter.appendChild(feColorMatrix);\r\n this.matrixFilter = feColorMatrix;\r\n }\r\n\r\n SVGFillFilter.prototype.renderFrame = function (forceRender) {\r\n if (forceRender || this.filterManager._mdf) {\r\n var color = this.filterManager.effectElements[2].p.v;\r\n var opacity = this.filterManager.effectElements[6].p.v;\r\n this.matrixFilter.setAttribute('values', '0 0 0 0 ' + color[0] + ' 0 0 0 0 ' + color[1] + ' 0 0 0 0 ' + color[2] + ' 0 0 0 ' + opacity + ' 0');\r\n }\r\n };\r\n\r\n function SVGStrokeEffect(fil, filterManager, elem) {\r\n this.initialized = false;\r\n this.filterManager = filterManager;\r\n this.elem = elem;\r\n this.paths = [];\r\n }\r\n\r\n SVGStrokeEffect.prototype.initialize = function () {\r\n var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\r\n var path;\r\n var groupPath;\r\n var i;\r\n var len;\r\n\r\n if (this.filterManager.effectElements[1].p.v === 1) {\r\n len = this.elem.maskManager.masksProperties.length;\r\n i = 0;\r\n } else {\r\n i = this.filterManager.effectElements[0].p.v - 1;\r\n len = i + 1;\r\n }\r\n\r\n groupPath = createNS('g');\r\n groupPath.setAttribute('fill', 'none');\r\n groupPath.setAttribute('stroke-linecap', 'round');\r\n groupPath.setAttribute('stroke-dashoffset', 1);\r\n\r\n for (i; i < len; i += 1) {\r\n path = createNS('path');\r\n groupPath.appendChild(path);\r\n this.paths.push({\r\n p: path,\r\n m: i\r\n });\r\n }\r\n\r\n if (this.filterManager.effectElements[10].p.v === 3) {\r\n var mask = createNS('mask');\r\n var id = createElementID();\r\n mask.setAttribute('id', id);\r\n mask.setAttribute('mask-type', 'alpha');\r\n mask.appendChild(groupPath);\r\n this.elem.globalData.defs.appendChild(mask);\r\n var g = createNS('g');\r\n g.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')');\r\n\r\n while (elemChildren[0]) {\r\n g.appendChild(elemChildren[0]);\r\n }\r\n\r\n this.elem.layerElement.appendChild(g);\r\n this.masker = mask;\r\n groupPath.setAttribute('stroke', '#fff');\r\n } else if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\r\n if (this.filterManager.effectElements[10].p.v === 2) {\r\n elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;\r\n\r\n while (elemChildren.length) {\r\n this.elem.layerElement.removeChild(elemChildren[0]);\r\n }\r\n }\r\n\r\n this.elem.layerElement.appendChild(groupPath);\r\n this.elem.layerElement.removeAttribute('mask');\r\n groupPath.setAttribute('stroke', '#fff');\r\n }\r\n\r\n this.initialized = true;\r\n this.pathMasker = groupPath;\r\n };\r\n\r\n SVGStrokeEffect.prototype.renderFrame = function (forceRender) {\r\n if (!this.initialized) {\r\n this.initialize();\r\n }\r\n\r\n var i;\r\n var len = this.paths.length;\r\n var mask;\r\n var path;\r\n\r\n for (i = 0; i < len; i += 1) {\r\n if (this.paths[i].m !== -1) {\r\n mask = this.elem.maskManager.viewData[this.paths[i].m];\r\n path = this.paths[i].p;\r\n\r\n if (forceRender || this.filterManager._mdf || mask.prop._mdf) {\r\n path.setAttribute('d', mask.lastPath);\r\n }\r\n\r\n if (forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf) {\r\n var dasharrayValue;\r\n\r\n if (this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100) {\r\n var s = Math.min(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\r\n var e = Math.max(this.filterManager.effectElements[7].p.v, this.filterManager.effectElements[8].p.v) * 0.01;\r\n var l = path.getTotalLength();\r\n dasharrayValue = '0 0 0 ' + l * s + ' ';\r\n var lineLength = l * (e - s);\r\n var segment = 1 + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\r\n var units = Math.floor(lineLength / segment);\r\n var j;\r\n\r\n for (j = 0; j < units; j += 1) {\r\n dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01 + ' ';\r\n }\r\n\r\n dasharrayValue += '0 ' + l * 10 + ' 0 0';\r\n } else {\r\n dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v * 2 * this.filterManager.effectElements[9].p.v * 0.01;\r\n }\r\n\r\n path.setAttribute('stroke-dasharray', dasharrayValue);\r\n }\r\n }\r\n }\r\n\r\n if (forceRender || this.filterManager.effectElements[4].p._mdf) {\r\n this.pathMasker.setAttribute('stroke-width', this.filterManager.effectElements[4].p.v * 2);\r\n }\r\n\r\n if (forceRender || this.filterManager.effectElements[6].p._mdf) {\r\n this.pathMasker.setAttribute('opacity', this.filterManager.effectElements[6].p.v);\r\n }\r\n\r\n if (this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2) {\r\n if (forceRender || this.filterManager.effectElements[3].p._mdf) {\r\n var color = this.filterManager.effectElements[3].p.v;\r\n this.pathMasker.setAttribute('stroke', 'rgb(' + bmFloor(color[0] * 255) + ',' + bmFloor(color[1] * 255) + ',' + bmFloor(color[2] * 255) + ')');\r\n }\r\n }\r\n };\r\n\r\n function SVGTritoneFilter(filter, filterManager, elem, id) {\r\n this.filterManager = filterManager;\r\n var feColorMatrix = createNS('feColorMatrix');\r\n feColorMatrix.setAttribute('type', 'matrix');\r\n feColorMatrix.setAttribute('color-interpolation-filters', 'linearRGB');\r\n feColorMatrix.setAttribute('values', '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');\r\n filter.appendChild(feColorMatrix);\r\n var feComponentTransfer = createNS('feComponentTransfer');\r\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\r\n feComponentTransfer.setAttribute('result', id);\r\n this.matrixFilter = feComponentTransfer;\r\n var feFuncR = createNS('feFuncR');\r\n feFuncR.setAttribute('type', 'table');\r\n feComponentTransfer.appendChild(feFuncR);\r\n this.feFuncR = feFuncR;\r\n var feFuncG = createNS('feFuncG');\r\n feFuncG.setAttribute('type', 'table');\r\n feComponentTransfer.appendChild(feFuncG);\r\n this.feFuncG = feFuncG;\r\n var feFuncB = createNS('feFuncB');\r\n feFuncB.setAttribute('type', 'table');\r\n feComponentTransfer.appendChild(feFuncB);\r\n this.feFuncB = feFuncB;\r\n filter.appendChild(feComponentTransfer);\r\n }\r\n\r\n SVGTritoneFilter.prototype.renderFrame = function (forceRender) {\r\n if (forceRender || this.filterManager._mdf) {\r\n var color1 = this.filterManager.effectElements[0].p.v;\r\n var color2 = this.filterManager.effectElements[1].p.v;\r\n var color3 = this.filterManager.effectElements[2].p.v;\r\n var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];\r\n var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];\r\n var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];\r\n this.feFuncR.setAttribute('tableValues', tableR);\r\n this.feFuncG.setAttribute('tableValues', tableG);\r\n this.feFuncB.setAttribute('tableValues', tableB);\r\n }\r\n };\r\n\r\n function SVGProLevelsFilter(filter, filterManager, elem, id) {\r\n this.filterManager = filterManager;\r\n var effectElements = this.filterManager.effectElements;\r\n var feComponentTransfer = createNS('feComponentTransfer'); // Red\r\n\r\n if (effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1) {\r\n this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);\r\n } // Green\r\n\r\n\r\n if (effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1) {\r\n this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);\r\n } // Blue\r\n\r\n\r\n if (effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1) {\r\n this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);\r\n } // Alpha\r\n\r\n\r\n if (effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1) {\r\n this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);\r\n } // RGB\r\n\r\n\r\n if (this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA) {\r\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\r\n filter.appendChild(feComponentTransfer);\r\n }\r\n\r\n if (effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1) {\r\n feComponentTransfer = createNS('feComponentTransfer');\r\n feComponentTransfer.setAttribute('color-interpolation-filters', 'sRGB');\r\n feComponentTransfer.setAttribute('result', id);\r\n filter.appendChild(feComponentTransfer);\r\n this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);\r\n this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);\r\n this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);\r\n }\r\n }\r\n\r\n SVGProLevelsFilter.prototype.createFeFunc = function (type, feComponentTransfer) {\r\n var feFunc = createNS(type);\r\n feFunc.setAttribute('type', 'table');\r\n feComponentTransfer.appendChild(feFunc);\r\n return feFunc;\r\n };\r\n\r\n SVGProLevelsFilter.prototype.getTableValue = function (inputBlack, inputWhite, gamma, outputBlack, outputWhite) {\r\n var cnt = 0;\r\n var segments = 256;\r\n var perc;\r\n var min = Math.min(inputBlack, inputWhite);\r\n var max = Math.max(inputBlack, inputWhite);\r\n var table = Array.call(null, {\r\n length: segments\r\n });\r\n var colorValue;\r\n var pos = 0;\r\n var outputDelta = outputWhite - outputBlack;\r\n var inputDelta = inputWhite - inputBlack;\r\n\r\n while (cnt <= 256) {\r\n perc = cnt / 256;\r\n\r\n if (perc <= min) {\r\n colorValue = inputDelta < 0 ? outputWhite : outputBlack;\r\n } else if (perc >= max) {\r\n colorValue = inputDelta < 0 ? outputBlack : outputWhite;\r\n } else {\r\n colorValue = outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma);\r\n }\r\n\r\n table[pos] = colorValue;\r\n pos += 1;\r\n cnt += 256 / (segments - 1);\r\n }\r\n\r\n return table.join(' ');\r\n };\r\n\r\n SVGProLevelsFilter.prototype.renderFrame = function (forceRender) {\r\n if (forceRender || this.filterManager._mdf) {\r\n var val;\r\n var effectElements = this.filterManager.effectElements;\r\n\r\n if (this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)) {\r\n val = this.getTableValue(effectElements[3].p.v, effectElements[4].p.v, effectElements[5].p.v, effectElements[6].p.v, effectElements[7].p.v);\r\n this.feFuncRComposed.setAttribute('tableValues', val);\r\n this.feFuncGComposed.setAttribute('tableValues', val);\r\n this.feFuncBComposed.setAttribute('tableValues', val);\r\n }\r\n\r\n if (this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)) {\r\n val = this.getTableValue(effectElements[10].p.v, effectElements[11].p.v, effectElements[12].p.v, effectElements[13].p.v, effectElements[14].p.v);\r\n this.feFuncR.setAttribute('tableValues', val);\r\n }\r\n\r\n if (this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)) {\r\n val = this.getTableValue(effectElements[17].p.v, effectElements[18].p.v, effectElements[19].p.v, effectElements[20].p.v, effectElements[21].p.v);\r\n this.feFuncG.setAttribute('tableValues', val);\r\n }\r\n\r\n if (this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)) {\r\n val = this.getTableValue(effectElements[24].p.v, effectElements[25].p.v, effectElements[26].p.v, effectElements[27].p.v, effectElements[28].p.v);\r\n this.feFuncB.setAttribute('tableValues', val);\r\n }\r\n\r\n if (this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)) {\r\n val = this.getTableValue(effectElements[31].p.v, effectElements[32].p.v, effectElements[33].p.v, effectElements[34].p.v, effectElements[35].p.v);\r\n this.feFuncA.setAttribute('tableValues', val);\r\n }\r\n }\r\n };\r\n\r\n function SVGDropShadowEffect(filter, filterManager, elem, id, source) {\r\n var globalFilterSize = filterManager.container.globalData.renderConfig.filterSize;\r\n var filterSize = filterManager.data.fs || globalFilterSize;\r\n filter.setAttribute('x', filterSize.x || globalFilterSize.x);\r\n filter.setAttribute('y', filterSize.y || globalFilterSize.y);\r\n filter.setAttribute('width', filterSize.width || globalFilterSize.width);\r\n filter.setAttribute('height', filterSize.height || globalFilterSize.height);\r\n this.filterManager = filterManager;\r\n var feGaussianBlur = createNS('feGaussianBlur');\r\n feGaussianBlur.setAttribute('in', 'SourceAlpha');\r\n feGaussianBlur.setAttribute('result', id + '_drop_shadow_1');\r\n feGaussianBlur.setAttribute('stdDeviation', '0');\r\n this.feGaussianBlur = feGaussianBlur;\r\n filter.appendChild(feGaussianBlur);\r\n var feOffset = createNS('feOffset');\r\n feOffset.setAttribute('dx', '25');\r\n feOffset.setAttribute('dy', '0');\r\n feOffset.setAttribute('in', id + '_drop_shadow_1');\r\n feOffset.setAttribute('result', id + '_drop_shadow_2');\r\n this.feOffset = feOffset;\r\n filter.appendChild(feOffset);\r\n var feFlood = createNS('feFlood');\r\n feFlood.setAttribute('flood-color', '#00ff00');\r\n feFlood.setAttribute('flood-opacity', '1');\r\n feFlood.setAttribute('result', id + '_drop_shadow_3');\r\n this.feFlood = feFlood;\r\n filter.appendChild(feFlood);\r\n var feComposite = createNS('feComposite');\r\n feComposite.setAttribute('in', id + '_drop_shadow_3');\r\n feComposite.setAttribute('in2', id + '_drop_shadow_2');\r\n feComposite.setAttribute('operator', 'in');\r\n feComposite.setAttribute('result', id + '_drop_shadow_4');\r\n filter.appendChild(feComposite);\r\n var feMerge = this.createMergeNode(id, [id + '_drop_shadow_4', source]);\r\n filter.appendChild(feMerge); //\r\n }\r\n\r\n extendPrototype([SVGComposableEffect], SVGDropShadowEffect);\r\n\r\n SVGDropShadowEffect.prototype.renderFrame = function (forceRender) {\r\n if (forceRender || this.filterManager._mdf) {\r\n if (forceRender || this.filterManager.effectElements[4].p._mdf) {\r\n this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);\r\n }\r\n\r\n if (forceRender || this.filterManager.effectElements[0].p._mdf) {\r\n var col = this.filterManager.effectElements[0].p.v;\r\n this.feFlood.setAttribute('flood-color', rgbToHex(Math.round(col[0] * 255), Math.round(col[1] * 255), Math.round(col[2] * 255)));\r\n }\r\n\r\n if (forceRender || this.filterManager.effectElements[1].p._mdf) {\r\n this.feFlood.setAttribute('flood-opacity', this.filterManager.effectElements[1].p.v / 255);\r\n }\r\n\r\n if (forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf) {\r\n var distance = this.filterManager.effectElements[3].p.v;\r\n var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;\r\n var x = distance * Math.cos(angle);\r\n var y = distance * Math.sin(angle);\r\n this.feOffset.setAttribute('dx', x);\r\n this.feOffset.setAttribute('dy', y);\r\n }\r\n }\r\n };\r\n\r\n var _svgMatteSymbols = [];\r\n\r\n function SVGMatte3Effect(filterElem, filterManager, elem) {\r\n this.initialized = false;\r\n this.filterManager = filterManager;\r\n this.filterElem = filterElem;\r\n this.elem = elem;\r\n elem.matteElement = createNS('g');\r\n elem.matteElement.appendChild(elem.layerElement);\r\n elem.matteElement.appendChild(elem.transformedElement);\r\n elem.baseElement = elem.matteElement;\r\n }\r\n\r\n SVGMatte3Effect.prototype.findSymbol = function (mask) {\r\n var i = 0;\r\n var len = _svgMatteSymbols.length;\r\n\r\n while (i < len) {\r\n if (_svgMatteSymbols[i] === mask) {\r\n return _svgMatteSymbols[i];\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n SVGMatte3Effect.prototype.replaceInParent = function (mask, symbolId) {\r\n var parentNode = mask.layerElement.parentNode;\r\n\r\n if (!parentNode) {\r\n return;\r\n }\r\n\r\n var children = parentNode.children;\r\n var i = 0;\r\n var len = children.length;\r\n\r\n while (i < len) {\r\n if (children[i] === mask.layerElement) {\r\n break;\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n var nextChild;\r\n\r\n if (i <= len - 2) {\r\n nextChild = children[i + 1];\r\n }\r\n\r\n var useElem = createNS('use');\r\n useElem.setAttribute('href', '#' + symbolId);\r\n\r\n if (nextChild) {\r\n parentNode.insertBefore(useElem, nextChild);\r\n } else {\r\n parentNode.appendChild(useElem);\r\n }\r\n };\r\n\r\n SVGMatte3Effect.prototype.setElementAsMask = function (elem, mask) {\r\n if (!this.findSymbol(mask)) {\r\n var symbolId = createElementID();\r\n var masker = createNS('mask');\r\n masker.setAttribute('id', mask.layerId);\r\n masker.setAttribute('mask-type', 'alpha');\r\n\r\n _svgMatteSymbols.push(mask);\r\n\r\n var defs = elem.globalData.defs;\r\n defs.appendChild(masker);\r\n var symbol = createNS('symbol');\r\n symbol.setAttribute('id', symbolId);\r\n this.replaceInParent(mask, symbolId);\r\n symbol.appendChild(mask.layerElement);\r\n defs.appendChild(symbol);\r\n var useElem = createNS('use');\r\n useElem.setAttribute('href', '#' + symbolId);\r\n masker.appendChild(useElem);\r\n mask.data.hd = false;\r\n mask.show();\r\n }\r\n\r\n elem.setMatte(mask.layerId);\r\n };\r\n\r\n SVGMatte3Effect.prototype.initialize = function () {\r\n var ind = this.filterManager.effectElements[0].p.v;\r\n var elements = this.elem.comp.elements;\r\n var i = 0;\r\n var len = elements.length;\r\n\r\n while (i < len) {\r\n if (elements[i] && elements[i].data.ind === ind) {\r\n this.setElementAsMask(this.elem, elements[i]);\r\n }\r\n\r\n i += 1;\r\n }\r\n\r\n this.initialized = true;\r\n };\r\n\r\n SVGMatte3Effect.prototype.renderFrame = function () {\r\n if (!this.initialized) {\r\n this.initialize();\r\n }\r\n };\r\n\r\n function SVGGaussianBlurEffect(filter, filterManager, elem, id) {\r\n // Outset the filter region by 100% on all sides to accommodate blur expansion.\r\n filter.setAttribute('x', '-100%');\r\n filter.setAttribute('y', '-100%');\r\n filter.setAttribute('width', '300%');\r\n filter.setAttribute('height', '300%');\r\n this.filterManager = filterManager;\r\n var feGaussianBlur = createNS('feGaussianBlur');\r\n feGaussianBlur.setAttribute('result', id);\r\n filter.appendChild(feGaussianBlur);\r\n this.feGaussianBlur = feGaussianBlur;\r\n }\r\n\r\n SVGGaussianBlurEffect.prototype.renderFrame = function (forceRender) {\r\n if (forceRender || this.filterManager._mdf) {\r\n // Empirical value, matching AE's blur appearance.\r\n var kBlurrinessToSigma = 0.3;\r\n var sigma = this.filterManager.effectElements[0].p.v * kBlurrinessToSigma; // Dimensions mapping:\r\n //\r\n // 1 -> horizontal & vertical\r\n // 2 -> horizontal only\r\n // 3 -> vertical only\r\n //\r\n\r\n var dimensions = this.filterManager.effectElements[1].p.v;\r\n var sigmaX = dimensions == 3 ? 0 : sigma; // eslint-disable-line eqeqeq\r\n\r\n var sigmaY = dimensions == 2 ? 0 : sigma; // eslint-disable-line eqeqeq\r\n\r\n this.feGaussianBlur.setAttribute('stdDeviation', sigmaX + ' ' + sigmaY); // Repeat edges mapping:\r\n //\r\n // 0 -> off -> duplicate\r\n // 1 -> on -> wrap\r\n\r\n var edgeMode = this.filterManager.effectElements[2].p.v == 1 ? 'wrap' : 'duplicate'; // eslint-disable-line eqeqeq\r\n\r\n this.feGaussianBlur.setAttribute('edgeMode', edgeMode);\r\n }\r\n };\r\n\r\n registerRenderer('canvas', CanvasRenderer);\r\n registerRenderer('html', HybridRenderer);\r\n registerRenderer('svg', SVGRenderer); // Registering shape modifiers\r\n\r\n ShapeModifiers.registerModifier('tm', TrimModifier);\r\n ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier);\r\n ShapeModifiers.registerModifier('rp', RepeaterModifier);\r\n ShapeModifiers.registerModifier('rd', RoundCornersModifier);\r\n ShapeModifiers.registerModifier('zz', ZigZagModifier);\r\n ShapeModifiers.registerModifier('op', OffsetPathModifier); // Registering expression plugin\r\n\r\n setExpressionsPlugin(Expressions);\r\n setExpressionInterfaces(getInterface);\r\n initialize$1();\r\n initialize(); // Registering svg effects\r\n\r\n registerEffect(20, SVGTintFilter, true);\r\n registerEffect(21, SVGFillFilter, true);\r\n registerEffect(22, SVGStrokeEffect, false);\r\n registerEffect(23, SVGTritoneFilter, true);\r\n registerEffect(24, SVGProLevelsFilter, true);\r\n registerEffect(25, SVGDropShadowEffect, true);\r\n registerEffect(28, SVGMatte3Effect, false);\r\n registerEffect(29, SVGGaussianBlurEffect, true);\r\n\r\n return lottie;\r\n\r\n}));\r\n", "/**\n * Copyright 2021 Design Barn Inc.\n */\n\nimport { css } from \"lit\";\n\nexport default css`\n * {\n box-sizing: border-box;\n }\n\n :host {\n --lottie-player-toolbar-height: 35px;\n --lottie-player-toolbar-background-color: transparent;\n --lottie-player-toolbar-icon-color: #999;\n --lottie-player-toolbar-icon-hover-color: #222;\n --lottie-player-toolbar-icon-active-color: #555;\n --lottie-player-seeker-track-color: #ccc;\n --lottie-player-seeker-thumb-color: rgba(0, 107, 120, 0.8);\n --lottie-player-seeker-display: block;\n\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .main {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n }\n\n .animation {\n width: 100%;\n height: 100%;\n display: flex;\n }\n .animation.controls {\n height: calc(100% - 35px);\n }\n\n .toolbar {\n display: flex;\n align-items: center;\n justify-items: center;\n background-color: var(--lottie-player-toolbar-background-color);\n margin: 0 5px;\n height: 35px;\n }\n\n .toolbar button {\n cursor: pointer;\n fill: var(--lottie-player-toolbar-icon-color);\n display: flex;\n background: none;\n border: 0;\n padding: 0;\n outline: none;\n height: 100%;\n }\n\n .toolbar button:hover {\n fill: var(--lottie-player-toolbar-icon-hover-color);\n }\n\n .toolbar button.active {\n fill: var(--lottie-player-toolbar-icon-active-color);\n }\n\n .toolbar button.active:hover {\n fill: var(--lottie-player-toolbar-icon-hover-color);\n }\n\n .toolbar button:focus {\n outline: 1px dotted var(--lottie-player-toolbar-icon-active-color);\n }\n\n .toolbar button svg {\n }\n\n .toolbar button.disabled svg {\n display: none;\n }\n\n .seeker {\n -webkit-appearance: none;\n width: 95%;\n outline: none;\n background-color: var(--lottie-player-toolbar-background-color);\n display: var(--lottie-player-seeker-display);\n }\n\n .seeker::-webkit-slider-runnable-track {\n width: 100%;\n height: 5px;\n cursor: pointer;\n background: var(--lottie-player-seeker-track-color);\n border-radius: 3px;\n }\n .seeker::-webkit-slider-thumb {\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background: var(--lottie-player-seeker-thumb-color);\n cursor: pointer;\n -webkit-appearance: none;\n margin-top: -5px;\n }\n .seeker:focus::-webkit-slider-runnable-track {\n background: #999;\n }\n .seeker::-moz-range-track {\n width: 100%;\n height: 5px;\n cursor: pointer;\n background: var(--lottie-player-seeker-track-color);\n border-radius: 3px;\n }\n .seeker::-moz-range-thumb {\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background: var(--lottie-player-seeker-thumb-color);\n cursor: pointer;\n }\n .seeker::-ms-track {\n width: 100%;\n height: 5px;\n cursor: pointer;\n background: transparent;\n border-color: transparent;\n color: transparent;\n }\n .seeker::-ms-fill-lower {\n background: var(--lottie-player-seeker-track-color);\n border-radius: 3px;\n }\n .seeker::-ms-fill-upper {\n background: var(--lottie-player-seeker-track-color);\n border-radius: 3px;\n }\n .seeker::-ms-thumb {\n border: 0;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background: var(--lottie-player-seeker-thumb-color);\n cursor: pointer;\n }\n .seeker:focus::-ms-fill-lower {\n background: var(--lottie-player-seeker-track-color);\n }\n .seeker:focus::-ms-fill-upper {\n background: var(--lottie-player-seeker-track-color);\n }\n\n .error {\n display: flex;\n justify-content: center;\n height: 100%;\n align-items: center;\n }\n`;\n", "export const LOTTIE_PLAYER_VERSION = \"1.7.1\"; \nexport const LOTTIE_WEB_VERSION = \"^5.10.0\";\n", "// eslint-disable-next-line header/header\nimport { LitElement, html } from \"lit\";\nimport { customElement, property, query } from \"lit/decorators.js\";\nimport { TemplateResult } from \"lit/html.js\";\nimport * as lottie from \"lottie-web/build/player/lottie\";\n\nimport styles from \"./lottie-player.styles\";\nimport { LOTTIE_PLAYER_VERSION, LOTTIE_WEB_VERSION } from \"./versions\";\n\n// import ResizeObserver from \"resize-observer-polyfill\";\n\n// Define valid player states\nexport enum PlayerState {\n Destroyed = \"destroyed\",\n Error = \"error\",\n Frozen = \"frozen\",\n Loading = \"loading\",\n Paused = \"paused\",\n Playing = \"playing\",\n Stopped = \"stopped\",\n}\n\n// Define play modes\nexport enum PlayMode {\n Bounce = \"bounce\",\n Normal = \"normal\",\n}\n\n// Define player events\nexport enum PlayerEvents {\n Complete = \"complete\",\n Destroyed = \"destroyed\",\n Error = \"error\",\n Frame = \"frame\",\n Freeze = \"freeze\",\n Load = \"load\",\n Loop = \"loop\",\n Pause = \"pause\",\n Play = \"play\",\n Ready = \"ready\",\n Rendered = \"rendered\",\n Stop = \"stop\",\n}\n\nexport interface Versions {\n lottiePlayerVersion: string;\n lottieWebVersion: string;\n}\n\n/**\n * Parse a resource into a JSON object or a URL string\n */\nexport function parseSrc(src: string | object): string | object {\n if (typeof src === \"object\") {\n return src;\n }\n\n try {\n return JSON.parse(src);\n } catch (e) {\n // Try construct an absolute URL from the src URL\n const srcUrl: URL = new URL(src, window.location.href);\n\n return srcUrl.toString();\n }\n}\n\nfunction isLottie(json: Record): boolean {\n const mandatory: string[] = [\"v\", \"ip\", \"op\", \"layers\", \"fr\", \"w\", \"h\"];\n\n return mandatory.every((field: string) =>\n Object.prototype.hasOwnProperty.call(json, field)\n );\n}\n\nasync function fromURL(url: string): Promise> {\n if (typeof url !== \"string\") {\n throw new Error(`The url value must be a string`);\n }\n\n let json;\n\n try {\n // Try construct an absolute URL from the src URL\n const srcUrl: URL = new URL(url);\n\n // Fetch the JSON file from the URL\n const result: any = await fetch(srcUrl.toString());\n\n json = await result.json();\n } catch (err) {\n throw new Error(\n `An error occurred while trying to load the Lottie file from URL`\n );\n }\n\n return json;\n}\n/**\n * LottiePlayer web component class\n *\n * @export\n * @class LottiePlayer\n * @extends {LitElement}\n */\n@customElement(\"lottie-player\")\nexport class LottiePlayer extends LitElement {\n /**\n * Autoplay animation on load.\n */\n @property({ type: Boolean })\n public autoplay: boolean = false;\n\n /**\n * Background color.\n */\n @property({ type: String, reflect: true })\n public background?: string = \"transparent\";\n\n /**\n * Show controls.\n */\n @property({ type: Boolean })\n public controls: boolean = false;\n\n /**\n * Number of times to loop animation.\n */\n @property({ type: Number })\n public count?: number;\n\n /**\n * Player state.\n */\n @property({ type: String })\n public currentState: PlayerState = PlayerState.Loading;\n\n /**\n * Animation description for screen readers.\n */\n @property({ type: String })\n public description: string = \"Lottie animation\";\n\n /**\n * Direction of animation.\n */\n @property({ type: Number })\n public direction: number = 1;\n\n /**\n * Disable checking if the Lottie is valid before loading\n */\n @property({ type: Boolean })\n public disableCheck?: boolean = false;\n\n /**\n * Disable using shadow dom as the root\n */\n @property({ type: Boolean })\n public disableShadowDOM: boolean = false;\n\n /**\n * Whether to play on mouse hover\n */\n @property({ type: Boolean })\n public hover: boolean = false;\n\n /**\n * Intermission\n */\n @property()\n public intermission: number = 1;\n\n /**\n * Whether to loop animation.\n */\n @property({ type: Boolean, reflect: true })\n public loop: boolean = false;\n\n /**\n * Play mode.\n */\n @property()\n public mode: PlayMode = PlayMode.Normal;\n\n /**\n * Aspect ratio to pass to lottie-web.\n */\n @property({ type: String })\n public preserveAspectRatio: string = \"xMidYMid meet\";\n\n /**\n * Renderer to use.\n */\n @property({ type: String })\n public renderer: \"svg\" = \"svg\";\n\n /**\n * Viewbox size for renderer settings\n */\n @property({ type: String })\n public viewBoxSize?: string;\n\n /**\n * seeker\n */\n\n @property()\n public seeker: any;\n\n /**\n * Animation speed.\n */\n @property({ type: Number })\n public speed: number = 1;\n\n /**\n * Bodymovin JSON data or URL to JSON.\n */\n @property({ type: String })\n public src?: string;\n\n /**\n * Enable web workers\n */\n @property({ type: Boolean })\n public webworkers?: boolean;\n\n /**\n * Animation container.\n */\n @query(\".animation\")\n protected container!: HTMLElement;\n\n private _io: IntersectionObserver | undefined = undefined;\n\n // private _ro: ResizeObserver | undefined = undefined;\n private _lottie?: any;\n\n private _prevState?: any;\n\n private _counter: number = 1;\n\n /**\n * Configure and initialize lottie-web player instance.\n */\n public async load(src: string | object) {\n const options: any = {\n container: this.container,\n loop: false,\n autoplay: false,\n renderer: this.renderer,\n rendererSettings: {\n preserveAspectRatio: this.preserveAspectRatio,\n clearCanvas: false,\n progressiveLoad: true,\n hideOnTransparent: true,\n ...(this.viewBoxSize && { viewBoxSize: this.viewBoxSize }),\n },\n };\n\n // Load the resource information\n try {\n const srcParsed = parseSrc(src);\n let jsonData = {};\n let srcAttrib = typeof srcParsed === \"string\" ? \"path\" : \"animationData\";\n\n // Clear previous animation, if any\n if (this._lottie) {\n this._lottie.destroy();\n }\n\n if (this.webworkers) {\n lottie.useWebWorker(true);\n }\n\n // Initialize lottie player and load animation\n this._lottie = lottie.loadAnimation({\n ...options,\n\n [srcAttrib]: srcParsed,\n });\n\n // Attach the event listeners before we check the requested json file for errors\n this._attachEventListeners();\n\n if (!this.disableCheck) {\n // Fetch resource if src is a remote URL\n if (srcAttrib === \"path\") {\n jsonData = await fromURL(srcParsed as string);\n srcAttrib = \"animationData\";\n } else {\n jsonData = srcParsed;\n }\n\n if (!isLottie(jsonData)) {\n this.currentState = PlayerState.Error;\n this.dispatchEvent(new CustomEvent(PlayerEvents.Error));\n }\n }\n } catch (err) {\n this.currentState = PlayerState.Error;\n this.dispatchEvent(new CustomEvent(PlayerEvents.Error));\n }\n }\n\n /**\n * Returns the lottie-web instance used in the component.\n */\n public getLottie(): any {\n return this._lottie;\n }\n\n /**\n * Returns the lottie-web version and this player's version\n */\n public getVersions(): Versions {\n return {\n lottieWebVersion: LOTTIE_WEB_VERSION,\n lottiePlayerVersion: LOTTIE_PLAYER_VERSION,\n };\n }\n\n /**\n * Start playing animation.\n */\n public play() {\n if (!this._lottie) {\n return;\n }\n\n this._lottie.play();\n this.currentState = PlayerState.Playing;\n\n this.dispatchEvent(new CustomEvent(PlayerEvents.Play));\n }\n\n /**\n * Pause animation play.\n */\n public pause(): void {\n if (!this._lottie) {\n return;\n }\n\n this._lottie.pause();\n this.currentState = PlayerState.Paused;\n\n this.dispatchEvent(new CustomEvent(PlayerEvents.Pause));\n }\n\n /**\n * Stops animation play.\n */\n public stop(): void {\n if (!this._lottie) {\n return;\n }\n\n this._counter = 1;\n this._lottie.stop();\n this.currentState = PlayerState.Stopped;\n\n this.dispatchEvent(new CustomEvent(PlayerEvents.Stop));\n }\n\n /**\n * Destroy animation and lottie-player element.\n */\n public destroy(): void {\n if (!this._lottie) {\n return;\n }\n\n this._lottie.destroy();\n this._lottie = null;\n this.currentState = PlayerState.Destroyed;\n this.dispatchEvent(new CustomEvent(PlayerEvents.Destroyed));\n this.remove();\n }\n\n /**\n * Seek to a given frame.\n */\n public seek(value: number | string): void {\n if (!this._lottie) {\n return;\n }\n\n // Extract frame number from either number or percentage value\n const matches = /^(\\d+)(%?)$/.exec(value.toString());\n\n if (!matches) {\n return;\n }\n\n // Calculate and set the frame number\n const frame =\n matches[2] === \"%\"\n ? (this._lottie.totalFrames * Number(matches[1])) / 100\n : Number(matches[1]);\n\n // Set seeker to new frame number\n this.seeker = frame;\n\n // Send lottie player to the new frame\n if (this.currentState === PlayerState.Playing) {\n this._lottie.goToAndPlay(frame, true);\n } else {\n this._lottie.goToAndStop(frame, true);\n this._lottie.pause();\n }\n }\n\n /**\n * Snapshot the current frame as SVG.\n *\n * If 'download' argument is boolean true, then a download is triggered in browser.\n */\n public snapshot(download: boolean = true): string | void {\n if (!this.shadowRoot) return;\n\n // Get SVG element and serialize markup\n const svgElement = this.shadowRoot.querySelector(\".animation svg\") as Node;\n const data = new XMLSerializer().serializeToString(svgElement);\n\n // Trigger file download\n if (download) {\n const element = document.createElement(\"a\");\n\n element.href = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(\n data\n )}`;\n element.download = `download_${this.seeker}.svg`;\n document.body.appendChild(element);\n\n element.click();\n\n document.body.removeChild(element);\n }\n\n return data;\n }\n\n /**\n * Sets animation play speed.\n *\n * @param value Playback speed.\n */\n public setSpeed(value = 1): void {\n if (!this._lottie) {\n return;\n }\n\n this._lottie.setSpeed(value);\n }\n\n /**\n * Animation play direction.\n *\n * @param value Direction values.\n */\n public setDirection(value: number): void {\n if (!this._lottie) {\n return;\n }\n\n this._lottie.setDirection(value);\n }\n\n /**\n * Sets the looping of the animation.\n *\n * @param value Whether to enable looping. Boolean true enables looping.\n */\n public setLooping(value: boolean): void {\n if (this._lottie) {\n this.loop = value;\n this._lottie.loop = value;\n }\n }\n\n /**\n * Toggle playing state.\n */\n public togglePlay(): void {\n return this.currentState === PlayerState.Playing\n ? this.pause()\n : this.play();\n }\n\n /**\n * Toggles animation looping.\n */\n public toggleLooping(): void {\n this.setLooping(!this.loop);\n }\n\n /**\n * Resize animation.\n */\n public resize() {\n if (!this._lottie) {\n return;\n }\n\n this._lottie.resize();\n }\n\n /**\n * Returns the styles for the component.\n */\n static get styles() {\n return styles;\n }\n\n /**\n * Cleanup on component destroy.\n */\n public disconnectedCallback(): void {\n // Don't clean up if node is still connected to the context (i.e. this is a move).\n if (this.isConnected) return;\n\n // Remove intersection observer for detecting component being out-of-view.\n if (this._io) {\n this._io.disconnect();\n this._io = undefined;\n }\n\n // Remove resize observer for detecting resize/reflow events affecting element.\n // if (this._ro) {\n // this._ro.disconnect();\n // this._ro = undefined;\n // }\n\n // Remove the attached Visibility API's change event listener.\n document.removeEventListener(\"visibilitychange\", () =>\n this._onVisibilityChange()\n );\n\n // Destroy the animation instance and element\n this.destroy();\n }\n\n public render(): TemplateResult | void {\n const className: string = this.controls ? \"main controls\" : \"main\";\n const animationClass: string = this.controls\n ? \"animation controls\"\n : \"animation\";\n\n return html` \n \n ${this.currentState === PlayerState.Error\n ? html`
\u26A0\uFE0F
`\n : undefined}\n \n ${this.controls && !this.disableShadowDOM\n ? this.renderControls()\n : undefined}\n `;\n }\n\n protected createRenderRoot(): Element | ShadowRoot {\n if (this.disableShadowDOM) this.style.display = \"block\";\n\n return this.disableShadowDOM ? this : super.createRenderRoot();\n }\n\n /**\n * Initialize everything on component first render.\n */\n protected firstUpdated(): void {\n // Add intersection observer for detecting component being out-of-view.\n if (\"IntersectionObserver\" in window) {\n this._io = new IntersectionObserver(\n (entries: IntersectionObserverEntry[]) => {\n if (entries[0].isIntersecting) {\n if (this.currentState === PlayerState.Frozen) {\n this.play();\n }\n } else if (this.currentState === PlayerState.Playing) {\n this.freeze();\n }\n }\n );\n\n this._io.observe(this.container);\n }\n\n // Add listener for Visibility API's change event.\n if (typeof document.hidden !== \"undefined\") {\n document.addEventListener(\"visibilitychange\", () =>\n this._onVisibilityChange()\n );\n }\n\n // Setup lottie player\n if (this.src) {\n this.load(this.src);\n }\n this.dispatchEvent(new CustomEvent(PlayerEvents.Rendered));\n }\n\n protected renderControls(): TemplateResult {\n const isPlaying: boolean = this.currentState === PlayerState.Playing;\n const isPaused: boolean = this.currentState === PlayerState.Paused;\n const isStopped: boolean = this.currentState === PlayerState.Stopped;\n\n return html`\n \n \n ${isPlaying\n ? html`\n \n `\n : html`\n \n `}\n \n \n \n \n \n \n {\n this._prevState = this.currentState;\n this.freeze();\n }}\n @mouseup=${() => {\n this._prevState === PlayerState.Playing && this.play();\n }}\n aria-valuemin=\"1\"\n aria-valuemax=\"100\"\n role=\"slider\"\n aria-valuenow=${this.seeker}\n tabindex=\"0\"\n aria-label=\"lottie-seek-input\"\n />\n \n \n \n \n \n \n `;\n }\n\n /**\n * Handle visibility change events.\n */\n private _onVisibilityChange(): void {\n if (document.hidden === true && this.currentState === PlayerState.Playing) {\n this.freeze();\n } else if (this.currentState === PlayerState.Frozen) {\n this.play();\n }\n }\n\n /**\n * Handles click and drag actions on the progress track.\n */\n private _handleSeekChange(e: any): void {\n if (!this._lottie || isNaN(e.target.value)) {\n return;\n }\n\n const frame: number = (e.target.value / 100) * this._lottie.totalFrames;\n\n this.seek(frame);\n }\n\n private _attachEventListeners(): void {\n this._lottie.addEventListener(\"enterFrame\", () => {\n this.seeker =\n (this._lottie.currentFrame / this._lottie.totalFrames) * 100;\n\n this.dispatchEvent(\n new CustomEvent(PlayerEvents.Frame, {\n detail: {\n frame: this._lottie.currentFrame,\n seeker: this.seeker,\n },\n })\n );\n });\n\n // Handle animation play complete\n this._lottie.addEventListener(\"complete\", () => {\n if (this.currentState !== PlayerState.Playing) {\n this.dispatchEvent(new CustomEvent(PlayerEvents.Complete));\n\n return;\n }\n\n if (!this.loop || (this.count && this._counter >= this.count)) {\n this.dispatchEvent(new CustomEvent(PlayerEvents.Complete));\n\n if (this.mode === PlayMode.Bounce) {\n if (this._lottie.currentFrame === 0) {\n return;\n }\n } else {\n return;\n }\n }\n\n if (this.mode === PlayMode.Bounce) {\n if (this.count) {\n this._counter += 0.5;\n }\n\n setTimeout(() => {\n this.dispatchEvent(new CustomEvent(PlayerEvents.Loop));\n\n if (this.currentState === PlayerState.Playing) {\n this._lottie.setDirection(this._lottie.playDirection * -1);\n this._lottie.play();\n }\n }, this.intermission);\n } else {\n if (this.count) {\n this._counter += 1;\n }\n\n window.setTimeout(() => {\n this.dispatchEvent(new CustomEvent(PlayerEvents.Loop));\n\n if (this.currentState === PlayerState.Playing) {\n if (this.direction === -1) {\n // Prevents flickering\n this.seek(\"99%\");\n this.play();\n } else {\n this._lottie.stop();\n this._lottie.play();\n }\n }\n }, this.intermission);\n }\n });\n\n // Handle lottie-web ready event\n this._lottie.addEventListener(\"DOMLoaded\", () => {\n // Set initial playback speed and direction\n this.setSpeed(this.speed);\n this.setDirection(this.direction);\n\n // Start playing if autoplay is enabled\n if (this.autoplay) {\n if (this.direction === -1) this.seek(\"100%\");\n this.play();\n }\n\n this.dispatchEvent(new CustomEvent(PlayerEvents.Ready));\n });\n\n // Handle animation data load complete\n this._lottie.addEventListener(\"data_ready\", () => {\n this.dispatchEvent(new CustomEvent(PlayerEvents.Load));\n });\n\n // Set error state when animation load fail event triggers\n this._lottie.addEventListener(\"data_failed\", () => {\n this.currentState = PlayerState.Error;\n\n this.dispatchEvent(new CustomEvent(PlayerEvents.Error));\n });\n\n // Set handlers to auto play animation on hover if enabled\n this.container.addEventListener(\"mouseenter\", () => {\n if (this.hover && this.currentState !== PlayerState.Playing) {\n this.play();\n }\n });\n this.container.addEventListener(\"mouseleave\", () => {\n if (this.hover && this.currentState === PlayerState.Playing) {\n this.stop();\n }\n });\n }\n\n /**\n * Freeze animation play.\n * This internal state pauses animation and is used to differentiate between\n * user requested pauses and component instigated pauses.\n */\n private freeze(): void {\n if (!this._lottie) {\n return;\n }\n\n this._lottie.pause();\n this.currentState = PlayerState.Frozen;\n\n this.dispatchEvent(new CustomEvent(PlayerEvents.Freeze));\n }\n}\n", "const DEFAULT_OPTIONS = {\n player: 'lottie-player',\n};\nconst LOTTIE_PLAYER_NODE = 'LOTTIE-PLAYER';\nconst ERROR_PREFIX = '[lottieInteractivity]:';\n\n/**\n * LottieFiles interactivity for Lottie\n */\nexport class LottieInteractivity {\n constructor({ actions, container, mode, player, ...options } = DEFAULT_OPTIONS) {\n // Save the original player entered by user, used for interaction chaining / loading animations on the fly\n this.enteredPlayer = player;\n\n // Resolve lottie instance specified in player option\n if (!(typeof player === 'object' && player.constructor.name === 'AnimationItem')) {\n if (typeof player === 'string') {\n const elem = document.querySelector(player);\n\n if (elem && elem.nodeName === LOTTIE_PLAYER_NODE) {\n player = elem.getLottie();\n }\n } else if (player instanceof HTMLElement && player.nodeName === LOTTIE_PLAYER_NODE) {\n player = player.getLottie();\n }\n\n // Throw error no player instance has been successfully resolved\n if (!player) {\n let message = ERROR_PREFIX + \"Specified player:\" + player + \" is invalid.\";\n\n throw new Error(message);\n }\n }\n\n // Get the configured container element.\n if (typeof container === 'string') {\n container = document.querySelector(container);\n }\n\n // Use player wrapper as fallback if container couldn't be resolved.\n if (!container) {\n container = player.wrapper;\n }\n\n this.player = player;\n this.loadedAnimation = this.player.path + this.player.fileName + \".json\";\n this.attachedListeners = false;\n this.container = container;\n this.mode = mode;\n this.actions = actions;\n this.options = options;\n this.assignedSegment = null;\n this.scrolledAndPlayed = false;\n\n // Interaction chaining\n this.interactionIdx = 0;\n this.oldInterctionIdx = 0;\n this.clickCounter = 0;\n this.playCounter = 0;\n this.stateHandler = new Map();\n this.transitionHandler = new Map();\n }\n\n getContainerVisibility() {\n // Get the bounding box for the lottie player or container\n const { top, height } = this.container.getBoundingClientRect();\n\n // Calculate current view percentage\n const current = window.innerHeight - top;\n const max = window.innerHeight + height;\n return current / max;\n }\n\n getContainerCursorPosition(cursorX, cursorY) {\n const { top, left, width, height } = this.container.getBoundingClientRect();\n\n const x = (cursorX - left) / width;\n const y = (cursorY - top) / height;\n\n return { x, y };\n }\n\n initScrollMode() {\n this.player.stop();\n window.addEventListener('scroll', this.#scrollHandler, true);\n }\n\n initCursorMode() {\n // To have click and hover interaction, force to only have that type and single action\n // If there are multiple actions, click and hover are ignored\n if (this.actions &&\n this.actions.length === 1) {\n if (this.actions[0].type === \"click\") {\n this.player.loop = false;\n this.player.stop();\n this.container.addEventListener('click', this.#clickHoverHandler);\n } else if (this.actions[0].type === \"hover\") {\n this.player.loop = false;\n this.player.stop();\n this.container.addEventListener('mouseenter', this.#clickHoverHandler);\n\n // For mobile\n this.container.addEventListener('touchstart', this.#clickHoverHandler, { passive: true });\n } else if (this.actions[0].type === \"toggle\") {\n this.player.loop = false;\n this.player.stop();\n this.container.addEventListener('click', this.#toggleHandler);\n } else if (this.actions[0].type === \"hold\" || this.actions[0].type === \"pauseHold\") {\n this.container.addEventListener('mouseenter', this.#holdTransitionEnter);\n this.container.addEventListener('mouseleave', this.#holdTransitionLeave);\n\n // For mobile\n this.container.addEventListener('touchstart', this.#holdTransitionEnter, { passive: true });\n this.container.addEventListener('touchend', this.#holdTransitionLeave, { passive: true });\n\n } else if (this.actions[0].type === \"seek\") {\n this.player.loop = true;\n this.player.stop();\n this.container.addEventListener('mousemove', this.#mousemoveHandler);\n // For mobile\n this.container.addEventListener('touchmove', this.#touchmoveHandler, { passive: false });\n this.container.addEventListener('mouseout', this.#mouseoutHandler);\n }\n } else {\n this.player.loop = true;\n this.player.stop();\n this.container.addEventListener('mousemove', this.#mousemoveHandler);\n this.container.addEventListener('mouseleave', this.#mouseoutHandler);\n\n // Init the animations that set states when the cursor is outside the container, so that they\n // are visibly idle at the desired frame before first interaction with them\n this.#cursorHandler(-1, -1);\n }\n }\n\n initChainMode() {\n this.#initInteractionMaps();\n this.player.loop = false;\n this.player.stop();\n this.#chainedInteractionHandler({ ignorePath: false });\n }\n\n start() {\n if (this.mode === 'scroll') {\n if (this.player.isLoaded) {\n this.initScrollMode();\n } else {\n this.player.addEventListener('DOMLoaded', () => {\n this.initScrollMode();\n });\n }\n } else if (this.mode === 'cursor') {\n if (this.player.isLoaded) {\n this.initCursorMode();\n } else {\n this.player.addEventListener('DOMLoaded', () => {\n this.initCursorMode();\n });\n }\n } else if (this.mode === 'chain') {\n // When passing animation object to LI the player is already loaded\n if (this.player.isLoaded) {\n this.initChainMode();\n } else {\n this.player.addEventListener('DOMLoaded', () => {\n this.initChainMode();\n });\n }\n }\n }\n\n redefineOptions({ actions, container, mode, player, ...options }) {\n this.stop();\n\n // Save the original player entered by user, used for interaction chaining / loading animations on the fly\n this.enteredPlayer = player;\n\n // Resolve lottie instance specified in player option\n if (!(typeof player === 'object' && player.constructor.name === 'AnimationItem')) {\n if (typeof player === 'string') {\n const elem = document.querySelector(player);\n\n if (elem && elem.nodeName === LOTTIE_PLAYER_NODE) {\n player = elem.getLottie();\n }\n } else if (player instanceof HTMLElement && player.nodeName === LOTTIE_PLAYER_NODE) {\n player = player.getLottie();\n }\n\n // Throw error no player instance has been successfully resolved\n if (!player) {\n let message = ERROR_PREFIX + \"Specified player:\" + player + \" is invalid.\";\n\n throw new Error(message, player);\n }\n }\n\n // Get the configured container element.\n if (typeof container === 'string') {\n container = document.querySelector(container);\n }\n\n // Use player wrapper as fallback if container couldn't be resolved.\n if (!container) {\n container = player.wrapper;\n }\n\n this.player = player;\n this.loadedAnimation = this.player.path + this.player.fileName + \".json\";\n this.attachedListeners = false;\n this.container = container;\n this.mode = mode;\n this.actions = actions;\n this.options = options;\n this.assignedSegment = null;\n this.scrolledAndPlayed = false;\n\n // Interaction chaining\n this.interactionIdx = 0;\n this.clickCounter = 0;\n this.playCounter = 0;\n this.holdStatus = null;\n this.stateHandler = new Map();\n this.transitionHandler = new Map();\n\n this.start();\n }\n\n stop() {\n if (this.mode === 'scroll') {\n window.removeEventListener('scroll', this.#scrollHandler, true);\n }\n\n if (this.mode === 'cursor') {\n this.container.removeEventListener('click', this.#clickHoverHandler);\n this.container.removeEventListener('click', this.#toggleHandler);\n this.container.removeEventListener('mouseenter', this.#clickHoverHandler);\n this.container.removeEventListener('touchstart', this.#clickHoverHandler);\n this.container.removeEventListener('touchmove', this.#touchmoveHandler);\n this.container.removeEventListener('mousemove', this.#mousemoveHandler);\n this.container.removeEventListener('mouseleave', this.#mouseoutHandler);\n this.container.removeEventListener('touchstart', this.#holdTransitionEnter);\n this.container.removeEventListener('touchend', this.#holdTransitionLeave);\n }\n\n if (this.mode === 'chain') {\n this.container.removeEventListener('click', this.#clickHoverHandler);\n this.container.removeEventListener('click', this.#clickHoverStateHandler);\n\n this.container.removeEventListener('mouseenter', this.#clickHoverHandler);\n this.container.removeEventListener('touchstart', this.#clickHoverHandler);\n this.container.removeEventListener('touchmove', this.#touchmoveHandler);\n this.container.removeEventListener('mouseenter', this.#clickHoverStateHandler);\n this.container.removeEventListener('touchstart', this.#clickHoverStateHandler);\n this.container.removeEventListener('mouseenter', this.#holdTransitionEnter);\n this.container.removeEventListener('touchstart', this.#holdTransitionEnter);\n\n this.container.removeEventListener('mouseleave', this.#holdTransitionLeave);\n this.container.removeEventListener('mousemove', this.#mousemoveHandler);\n this.container.removeEventListener('mouseout', this.#mouseoutHandler);\n this.container.removeEventListener('touchend', this.#holdTransitionLeave);\n\n if (this.player) {\n try {\n this.player.removeEventListener('loopComplete', this.#onCompleteHandler);\n this.player.removeEventListener('complete', this.#onCompleteHandler);\n this.player.removeEventListener('enterFrame', this.#cursorSyncHandler);\n this.player.removeEventListener('enterFrame', this.#holdHandler);\n } catch (e) {\n // User deleted the player before calling stop()\n // Ignore\n }\n }\n }\n if (this.player) {\n this.player.destroy();\n this.player = null;\n }\n }\n\n /**\n * [chain mode]\n * Init the state and transitions maps containing all the state and transition methods used for interaction chaining\n */\n #initInteractionMaps = () => {\n if (!this.player)\n return;\n\n let loopState = () => {\n if (this.actions[this.interactionIdx].loop) {\n this.player.loop = parseInt(this.actions[this.interactionIdx].loop) - 1;\n } else {\n this.player.loop = true;\n }\n this.player.autoplay = true;\n }\n let autoplayState = () => {\n this.player.loop = false;\n this.player.autoplay = true;\n }\n let clickState = () => {\n this.player.loop = false;\n this.player.autoplay = false;\n this.container.addEventListener('click', this.#clickHoverStateHandler);\n }\n let hoverState = () => {\n this.player.loop = false;\n this.player.autoplay = false;\n this.container.addEventListener('mouseenter', this.#clickHoverStateHandler);\n // For mobile\n this.container.addEventListener('touchstart', this.#clickHoverStateHandler, { passive: true });\n }\n let clickTransition = () => {\n this.container.addEventListener('click', this.#clickHoverHandler);\n }\n let hoverTransition = () => {\n this.container.addEventListener('mouseenter', this.#clickHoverHandler);\n // For mobile\n this.container.addEventListener('touchstart', this.#clickHoverHandler, { passive: true });\n }\n let holdTransition = () => {\n this.player.addEventListener('enterFrame', this.#holdHandler);\n this.container.addEventListener('mouseenter', this.#holdTransitionEnter);\n this.container.addEventListener('mouseleave', this.#holdTransitionLeave);\n // For mobile\n this.container.addEventListener('touchstart', this.#holdTransitionEnter, { passive: true });\n this.container.addEventListener('touchend', this.#holdTransitionLeave, { passive: true });\n }\n let holdState = () => {\n this.container.addEventListener('mouseenter', this.#holdTransitionEnter);\n this.container.addEventListener('mouseleave', this.#holdTransitionLeave);\n // For mobile\n this.container.addEventListener('touchstart', this.#holdTransitionEnter, { passive: true });\n this.container.addEventListener('touchend', this.#holdTransitionLeave, { passive: true });\n }\n let repeatTransition = () => {\n this.player.loop = true;\n this.player.autoplay = true;\n let handler = () => { this.#repeatTransition({ handler }) };\n this.player.addEventListener('loopComplete', handler);\n }\n let onCompleteTransition = () => {\n let state = this.actions[this.interactionIdx].state;\n\n if (state === 'loop')\n this.player.addEventListener('loopComplete', this.#onCompleteHandler);\n else\n this.player.addEventListener('complete', this.#onCompleteHandler);\n }\n let cursorSyncTransition = () => {\n this.player.stop();\n this.player.addEventListener('enterFrame', this.#cursorSyncHandler);\n this.container.addEventListener('mousemove', this.#mousemoveHandler);\n this.container.addEventListener('touchmove', this.#touchmoveHandler, { passive: false });\n this.container.addEventListener('mouseout', this.#mouseoutHandler);\n }\n this.stateHandler.set('loop', loopState);\n this.stateHandler.set('autoplay', autoplayState);\n this.stateHandler.set('click', clickState);\n this.stateHandler.set('hover', hoverState);\n this.stateHandler.set('hold', holdState);\n this.stateHandler.set('pauseHold', holdState);\n\n this.transitionHandler.set('click', clickTransition);\n this.transitionHandler.set('hover', hoverTransition);\n this.transitionHandler.set('hold', holdTransition);\n this.transitionHandler.set('pauseHold', holdTransition);\n this.transitionHandler.set('repeat', repeatTransition);\n this.transitionHandler.set('onComplete', onCompleteTransition);\n this.transitionHandler.set('seek', cursorSyncTransition);\n }\n\n /**\n * [chain mode]\n * Handle hover state on chained interactions\n */\n #clickHoverStateHandler = () => {\n let forceFlag = this.actions[this.interactionIdx].forceFlag;\n\n if (!forceFlag && this.player.isPaused === true) {\n this.#playSegmentHandler(true);\n } else if (forceFlag) {\n this.#playSegmentHandler(true);\n }\n }\n\n // [cursor mode]\n #toggleHandler = () => {\n if (this.clickCounter === 0) {\n this.player.play();\n this.clickCounter++;\n } else {\n this.clickCounter++;\n this.player.setDirection(this.player.playDirection * -1);\n this.player.play();\n }\n }\n\n /**\n * [cursor + chain mode]\n * Handle click and hover in both cursor and chain mode\n */\n #clickHoverHandler = () => {\n let forceFlag = this.actions[this.interactionIdx].forceFlag;\n let state = this.actions[this.interactionIdx].state;\n let transition = this.actions[this.interactionIdx].transition;\n\n // If we're in chain mode and the click or hover transition is used, otherwise just play the animation\n if (this.mode === 'chain') {\n // Check if there is a counter or not and make a transition\n if (this.actions[this.interactionIdx].count) {\n let clickLimit = parseInt(this.actions[this.interactionIdx].count);\n if (this.clickCounter < clickLimit - 1) {\n this.clickCounter += 1;\n return;\n }\n }\n // No click counter, so we remove the listeners and got to next interaction\n this.clickCounter = 0;\n // Transition when the animation has finished playing\n if (!forceFlag && (transition === \"click\" && state === \"click\") || (transition === \"hover\" && state === \"hover\"))\n this.transitionHandler.get(\"onComplete\").call();\n else\n this.nextInteraction();\n this.container.removeEventListener('click', this.#clickHoverHandler);\n this.container.removeEventListener('mouseenter', this.#clickHoverHandler);\n return;\n }\n // Using goToAndPlay rather than this.#playSegmentHandler(forceFlag) because we're in cursor mode\n // there for we want to play from the beginning\n if (!forceFlag && this.player.isPaused === true) {\n this.player.goToAndPlay(0, true);\n } else if (forceFlag) {\n this.player.goToAndPlay(0, true);\n }\n }\n\n // [cursor mode]\n #mousemoveHandler = e => {\n this.#cursorHandler(e.clientX, e.clientY);\n };\n\n // [cursor mode]\n #touchmoveHandler = e => {\n // Allows for syncing on Y axis without scrolling the page\n if (e.cancelable)\n e.preventDefault();\n this.#cursorHandler(e.touches[0].clientX, e.touches[0].clientY);\n };\n\n // [cursor mode]\n #mouseoutHandler = () => {\n this.#cursorHandler(-1, -1);\n };\n\n\n /**\n * [chain mode]\n * Handle when a segment of the animation has finished playing\n */\n #onCompleteHandler = () => {\n if (this.actions[this.interactionIdx].state === 'loop') {\n this.player.removeEventListener('loopComplete', this.#onCompleteHandler);\n } else {\n this.player.removeEventListener('complete', this.#onCompleteHandler);\n }\n this.nextInteraction();\n }\n\n // [chain mode]\n #repeatTransition = ({ handler }) => {\n let repeatAmount = 1;\n\n if (this.actions[this.interactionIdx].repeat)\n repeatAmount = this.actions[this.interactionIdx].repeat;\n if (this.playCounter >= repeatAmount - 1) {\n this.playCounter = 0;\n this.player.removeEventListener('loopComplete', handler);\n this.player.loop = false;\n this.player.autoplay = false;\n this.nextInteraction();\n } else {\n this.playCounter += 1;\n }\n }\n\n /**\n * [chain mode]\n * TODO: How does this work with markers? Get marker duration?\n */\n #cursorSyncHandler = () => {\n let frames = this.actions[this.interactionIdx].frames;\n\n if (frames && this.player.currentFrame >= parseInt(frames[1]) - 1) {\n this.player.removeEventListener('enterFrame', this.#cursorSyncHandler);\n this.container.removeEventListener('mousemove', this.#mousemoveHandler);\n this.container.removeEventListener('mouseout', this.#mouseoutHandler);\n setTimeout(this.nextInteraction, 0);\n }\n }\n\n /**\n * [chain mode]\n * TODO: How does this work with markers? Get marker duration?\n *\n * With the hold transition we can't use playSegment so we have to manually verify if\n * The user held long enough and check if the current frame is within the segment limits\n *\n */\n #holdHandler = () => {\n let frames = this.actions[this.interactionIdx].frames;\n\n if ((frames && this.player.currentFrame >= frames[1]) || (this.player.currentFrame >= this.player.totalFrames - 1)) {\n this.player.removeEventListener('enterFrame', this.#holdHandler);\n this.container.removeEventListener('mouseenter', this.#holdTransitionEnter);\n this.container.removeEventListener('mouseleave', this.#holdTransitionLeave);\n // For mobile\n this.container.removeEventListener('touchstart', this.#holdTransitionEnter, { passive: true });\n this.container.removeEventListener('touchend', this.#holdTransitionLeave, { passive: true });\n this.player.pause();\n\n this.holdStatus = false;\n this.nextInteraction();\n }\n // Pause player so that reverse playback doesn't leave the set frame boundries\n if (this.player.playDirection === -1 && frames && this.player.currentFrame < frames[0]) {\n this.player.pause();\n }\n }\n\n // [cursor + chain mode]\n #holdTransitionEnter = () => {\n // On first cursor enter needs check\n if (this.player.playDirection === -1 || this.holdStatus === null || !this.holdStatus) {\n this.player.setDirection(1);\n this.player.play();\n this.holdStatus = true;\n }\n }\n\n // [cursor + chain mode]\n #holdTransitionLeave = () => {\n if (this.actions[this.interactionIdx].transition === \"hold\" ||\n this.actions[this.interactionIdx].state === \"hold\" ||\n this.actions[0].type === \"hold\") {\n this.player.setDirection(-1);\n this.player.play();\n } else if (this.actions[this.interactionIdx].transition === \"pauseHold\" ||\n this.actions[this.interactionIdx].state === \"pauseHold\" ||\n this.actions[0].type === \"pauseHold\") {\n this.player.pause();\n }\n this.holdStatus = false;\n }\n\n // [chain mode]\n #clearStateListeners = () => {\n this.container.removeEventListener('click', this.#clickHoverHandler);\n this.container.removeEventListener('click', this.#clickHoverStateHandler);\n\n this.container.removeEventListener('mouseenter', this.#clickHoverHandler);\n this.container.removeEventListener('touchstart', this.#clickHoverHandler);\n this.container.removeEventListener('touchmove', this.#touchmoveHandler);\n this.container.removeEventListener('mouseenter', this.#clickHoverStateHandler);\n this.container.removeEventListener('touchstart', this.#clickHoverStateHandler);\n this.container.removeEventListener('mouseenter', this.#holdTransitionEnter);\n this.container.removeEventListener('touchstart', this.#holdTransitionEnter);\n\n this.container.removeEventListener('mouseleave', this.#holdTransitionLeave);\n this.container.removeEventListener('mousemove', this.#mousemoveHandler);\n this.container.removeEventListener('mouseout', this.#mouseoutHandler);\n this.container.removeEventListener('touchend', this.#holdTransitionLeave);\n\n if (this.player) {\n try {\n this.player.removeEventListener('loopComplete', this.#onCompleteHandler);\n this.player.removeEventListener('complete', this.#onCompleteHandler);\n this.player.removeEventListener('enterFrame', this.#cursorSyncHandler);\n this.player.removeEventListener('enterFrame', this.#holdHandler);\n } catch (e) {\n // User deleted the player before calling stop()\n // Ignore\n }\n }\n }\n\n jumpToInteraction = (index) => {\n this.#clearStateListeners();\n this.interactionIdx = index;\n this.interactionIdx < 0 ? this.interactionIdx = 0 : this.interactionIdx;\n this.nextInteraction(false);\n }\n\n // [chain mode]\n nextInteraction = (incrementIndex = true) => {\n this.oldInterctionIdx = this.interactionIdx;\n // If state is hover or click we need to remove listeners\n this.#clearStateListeners();\n this.player.loop = false;\n\n // Check if theres a jump-to before incrementing\n let jumpToIndex = this.actions[this.interactionIdx].jumpTo;\n if (jumpToIndex) {\n // If jumpToIndex is inside action length jump to it otherwise go to first action\n if (jumpToIndex >= 0 && jumpToIndex < this.actions.length) {\n this.interactionIdx = jumpToIndex;\n this.#chainedInteractionHandler({ ignorePath: false });\n } else {\n this.interactionIdx = 0;\n this.player.goToAndStop(0, true);\n this.#chainedInteractionHandler({ ignorePath: false });\n }\n } else {\n // Go to next interaction\n if (incrementIndex)\n this.interactionIdx++;\n if (this.interactionIdx >= this.actions.length) {\n // Go back to the first interaction\n if (this.actions[this.actions.length - 1].reset) {\n this.interactionIdx = 0;\n this.player.resetSegments(true);\n if (this.actions[this.interactionIdx].frames)\n this.player.goToAndStop(this.actions[this.interactionIdx].frames, true);\n else\n this.player.goToAndStop(0, true);\n this.#chainedInteractionHandler({ ignorePath: false });\n }\n else {\n this.interactionIdx = this.actions.length - 1;\n this.#chainedInteractionHandler({ ignorePath: false });\n }\n } else {\n this.#chainedInteractionHandler({ ignorePath: false });\n }\n }\n\n // Emit event from the lottie-player element\n this.container.dispatchEvent(new CustomEvent(\"transition\", {\n bubbles: true,\n composed: true,\n detail: { oldIndex: this.oldInterctionIdx, newIndex: this.interactionIdx }\n }));\n }\n\n /**\n * [chain mode]\n * Checks if frames are an array or string, and calls appropriate method to play animation\n */\n #playSegmentHandler = (forceFlag) => {\n let frames = this.actions[this.interactionIdx].frames;\n\n //If no frame segment is defined, play the whole animation\n if (!frames) {\n this.player.resetSegments(true);\n this.player.goToAndPlay(0, true);\n return;\n }\n // If using named markers\n if (typeof frames === 'string') {\n this.player.goToAndPlay(frames, forceFlag);\n } else {\n this.player.playSegments(frames, forceFlag);\n }\n }\n\n /**\n * [chain mode]\n * Load a new animation using the path defined in the current interaction\n */\n #loadAnimationInChain = () => {\n let path = this.actions[this.interactionIdx].path;\n\n // The animation path declared on the lottie-player was saved in the constructor under 'enteredPlayer'\n // We assume that the path on the lottie-player element is the animation to use in the first action\n if (!path) {\n // If we passed animationData to Lottie-Interactivity, load the animation data otherwise use the path\n if (typeof this.enteredPlayer === 'object' && this.enteredPlayer.constructor.name === 'AnimationItem') {\n path = this.enteredPlayer;\n\n if (this.player === path) {\n this.#chainedInteractionHandler({ ignorePath: true });\n return;\n }\n } else {\n path = this.loadedAnimation;\n let fileName = path.substr(path.lastIndexOf('/') + 1);\n fileName = fileName.substr(0, fileName.lastIndexOf('.json'));\n\n // Prevents reloading animation the same animation\n if (this.player.fileName === fileName) {\n this.#chainedInteractionHandler({ ignorePath: true });\n return;\n }\n }\n }\n\n // Force width and height on the container to retain its size while the next animation is being loaded\n let lottieContainerSize = this.container.getBoundingClientRect();\n let newContainerStyle = \"width: \" + lottieContainerSize.width + \"px !important; height: \" +\n lottieContainerSize.height + \"px !important; background: \" + this.container.style.background;\n this.container.setAttribute('style', newContainerStyle);\n\n if (!(typeof this.enteredPlayer === 'object' && this.enteredPlayer.constructor.name === 'AnimationItem')) {\n if (typeof this.enteredPlayer === 'string') {\n const elem = document.querySelector(this.enteredPlayer);\n\n if (elem && elem.nodeName === LOTTIE_PLAYER_NODE) {\n // Prevents adding the listeners multiple times if multiple animations are needed to be loaded from actions\n if (!this.attachedListeners) {\n // Remove the styling that prevents flickering\n elem.addEventListener(\"ready\", () => {\n this.container.style.width = '';\n this.container.style.height = '';\n });\n elem.addEventListener(\"load\", () => {\n this.player = elem.getLottie();\n this.#chainedInteractionHandler({ ignorePath: true });\n });\n this.attachedListeners = true;\n }\n // The LottieFiles player destroys the animation when a new one is Loaded\n elem.load(path);\n }\n } else if (this.enteredPlayer instanceof HTMLElement && this.enteredPlayer.nodeName === LOTTIE_PLAYER_NODE) {\n // Prevents adding the listeners multiple times if multiple animations are needed to be loaded from actions\n if (!this.attachedListeners) {\n // Remove the styling that prevents flickering\n this.enteredPlayer.addEventListener(\"ready\", () => {\n this.container.style.width = '';\n this.container.style.height = '';\n });\n this.enteredPlayer.addEventListener(\"load\", () => {\n this.player = this.enteredPlayer.getLottie();\n this.#chainedInteractionHandler({ ignorePath: true });\n });\n this.attachedListeners = true;\n }\n // The LottieFiles player destroys the animation when a new one is Loaded\n this.enteredPlayer.load(path);\n }\n // Throw error no player instance has been successfully resolved\n if (!this.player) {\n throw new Error(`${ERROR_PREFIX} Specified player is invalid.`, this.enteredPlayer);\n }\n } else {\n if (window.lottie) {\n this.stop();\n // Removes svg animation contained inside\n this.container.innerHTML = \"\";\n\n if (typeof path === 'object' && path.constructor.name === 'AnimationItem') {\n this.player = window.lottie.loadAnimation({\n loop: false,\n autoplay: false,\n animationData: path.animationData,\n container: this.container\n });\n }\n else {\n this.player = window.lottie.loadAnimation({\n loop: false,\n autoplay: false,\n path,\n container: this.container\n });\n }\n\n this.player.addEventListener('DOMLoaded', () => {\n // Remove the styling that prevents flickering\n this.container.style.width = '';\n this.container.style.height = '';\n this.#chainedInteractionHandler({ ignorePath: true });\n });\n } else {\n throw new Error(`${ERROR_PREFIX} A Lottie player is required.`);\n }\n }\n // Reset counters\n this.clickCounter = 0;\n this.playCounter = 0;\n }\n\n /**\n * [chain mode]\n * Check the action object at the current interaction index and set the needed interaction listeners as well\n * as any extra options\n */\n #chainedInteractionHandler = ({ ignorePath }) => {\n let frames = this.actions[this.interactionIdx].frames;\n let state = this.actions[this.interactionIdx].state;\n let transition = this.actions[this.interactionIdx].transition;\n let path = this.actions[this.interactionIdx].path;\n let stateFunction = this.stateHandler.get(state);\n let transitionFunction = this.transitionHandler.get(transition);\n let speed = this.actions[this.interactionIdx].speed ? this.actions[this.interactionIdx].speed : 1;\n let delay = this.actions[this.interactionIdx].delay ? this.actions[this.interactionIdx].delay : 0;\n\n // Check if path is detected or that we are at the beginning again and reset\n // If we are back at the first action, we need to reload the animation declared on the lottie-player element\n if (!ignorePath && (path || (this.actions[this.actions.length - 1].reset && this.interactionIdx === 0))) {\n this.#loadAnimationInChain();\n return;\n }\n setTimeout(() => {\n if (frames) {\n this.player.autoplay = false;\n this.player.resetSegments(true);\n this.player.goToAndStop(frames[0], true);\n }\n if (stateFunction) {\n stateFunction.call();\n } else if (state === \"none\") {\n this.player.loop = false;\n this.player.autoplay = false;\n }\n if (transitionFunction) {\n transitionFunction.call();\n }\n if (this.player.autoplay) {\n this.player.resetSegments(true);\n this.#playSegmentHandler(true);\n }\n this.player.setSpeed(speed);\n }, delay);\n }\n\n // [cursor mode]\n #cursorHandler = (x, y) => {\n // Resolve cursor position if cursor is inside container\n if (x !== -1 && y !== -1) {\n // Get container cursor position\n const pos = this.getContainerCursorPosition(x, y);\n\n // Use the resolved position\n x = pos.x;\n y = pos.y;\n }\n\n // Find the first action that satisfies the current position conditions\n const action = this.actions.find(({ position }) => {\n if (position) {\n if (Array.isArray(position.x) && Array.isArray(position.y)) {\n return x >= position.x[0] && x <= position.x[1] && y >= position.y[0] && y <= position.y[1];\n } else if (!Number.isNaN(position.x) && !Number.isNaN(position.y)) {\n return x === position.x && y === position.y;\n }\n }\n\n return false;\n });\n\n // Skip if no matching action was found!\n if (!action) {\n return;\n }\n\n // Process action types:\n if (action.type === 'seek' || action.transition === 'seek') {\n // Seek: Go to a frame based on player scroll position action\n const xPercent = (x - action.position.x[0]) / (action.position.x[1] - action.position.x[0]);\n const yPercent = (y - action.position.y[0]) / (action.position.y[1] - action.position.y[0]);\n\n this.player.playSegments(action.frames, true);\n\n if (action.position.y[0] < 0 && action.position.y[1] > 1) {\n this.player.goToAndStop(Math.floor(xPercent * this.player.totalFrames), true);\n } else {\n this.player.goToAndStop(Math.ceil(((xPercent + yPercent) / 2) * this.player.totalFrames), true);\n }\n } else if (action.type === 'loop') {\n this.player.playSegments(action.frames, true);\n } else if (action.type === 'play') {\n // Play: Reset segments and continue playing full animation from current position\n if (this.player.isPaused === true) {\n this.player.resetSegments();\n }\n this.player.playSegments(action.frames);\n } else if (action.type === 'stop') {\n this.player.resetSegments(true);\n // Stop: Stop playback\n this.player.goToAndStop(action.frames[0], true);\n }\n };\n\n // [scroll mode]\n #scrollHandler = () => {\n // Get container visibility percentage\n const currentPercent = this.getContainerVisibility();\n\n // Find the first action that satisfies the current position conditions\n const action = this.actions.find(\n ({ visibility }) => currentPercent >= visibility[0] && currentPercent <= visibility[1],\n );\n\n // Skip if no matching action was found!\n if (!action) {\n return;\n }\n\n // Process action types:\n if (action.type === 'seek') {\n // Seek: Go to a frame based on player scroll position action\n const start = action.frames[0];\n const end = action.frames.length == 2 ? action.frames[1] : (this.player.totalFrames - 1);\n\n // Use global frame reference for frames within the seek section.\n // Without this, if you follow a seek with a loop and then scroll back up,\n // it will treat frame numbers as relative to the loop.\n if (this.assignedSegment !== null) {\n this.player.resetSegments(true);\n this.assignedSegment = null;\n }\n\n this.player.goToAndStop(\n start + Math.round(\n ((currentPercent - action.visibility[0]) / (action.visibility[1] - action.visibility[0])) *\n (end - start)\n ),\n true,\n );\n } else if (action.type === 'loop') {\n this.player.loop = true;\n // Loop: Loop a given frames\n if (this.assignedSegment === null) {\n // if not playing any segments currently. play those segments and save to state\n this.player.playSegments(action.frames, true);\n this.assignedSegment = action.frames;\n } else {\n // if playing any segments currently.\n //check if segments in state are equal to the frames selected by action\n if (this.assignedSegment !== action.frames) {\n // if they are not equal. new segments are to be loaded\n this.player.playSegments(action.frames, true);\n this.assignedSegment = action.frames;\n } else {\n // if they are equal the play method must be called only if lottie is paused\n if (this.player.isPaused === true) {\n this.player.playSegments(action.frames, true);\n this.assignedSegment = action.frames;\n }\n }\n }\n } else if (action.type === 'play' || action.type === 'playOnce') {\n // Play: Reset segments and continue playing full animation from current position\n if (action.type === 'playOnce' && !this.scrolledAndPlayed) {\n this.scrolledAndPlayed = true;\n this.player.resetSegments(true);\n if (action.frames) {\n this.player.playSegments(action.frames, true);\n } else {\n this.player.play();\n }\n return;\n } else if (action.type === 'play' && this.player.isPaused) {\n this.player.resetSegments(true);\n if (action.frames) {\n this.player.playSegments(action.frames, true);\n } else {\n this.player.play();\n }\n }\n } else if (action.type === 'stop') {\n // Stop: Stop playback\n this.player.goToAndStop(action.frames[0], true);\n }\n };\n}\n\nexport const create = options => {\n const instance = new LottieInteractivity(options);\n instance.start();\n\n return instance;\n};\n\nexport default create;\n", "export default function cssHasPseudo (document) {\n\tconst observedItems = [];\n\n\t// document.createAttribute() doesn't support `:` in the name. innerHTML does\n\tconst attributeElement = document.createElement('x');\n\n\t// walk all stylesheets to collect observed css rules\n\t[].forEach.call(document.styleSheets, walkStyleSheet);\n\ttransformObservedItems();\n\n\t// observe DOM modifications that affect selectors\n\tconst mutationObserver = new MutationObserver(mutationsList => {\n\t\tmutationsList.forEach(mutation => {\n\t\t\t[].forEach.call(mutation.addedNodes || [], node => {\n\t\t\t\t// walk stylesheets to collect observed css rules\n\t\t\t\tif (node.nodeType === 1 && node.sheet) {\n\t\t\t\t\twalkStyleSheet(node.sheet);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// transform observed css rules\n\t\t\tcleanupObservedCssRules();\n\t\t\ttransformObservedItems();\n\t\t});\n\t});\n\n\tmutationObserver.observe(document, { childList: true, subtree: true });\n\n\t// observe DOM events that affect pseudo-selectors\n\tdocument.addEventListener('focus', transformObservedItems, true);\n\tdocument.addEventListener('blur', transformObservedItems, true);\n\tdocument.addEventListener('input', transformObservedItems);\n\n\t// transform observed css rules\n\tfunction transformObservedItems () {\n\t\trequestAnimationFrame(() => {\n\t\t\tobservedItems.forEach(\n\t\t\t\titem => {\n\t\t\t\t\tconst nodes = [];\n\n\t\t\t\t\t[].forEach.call(\n\t\t\t\t\t\tdocument.querySelectorAll(item.scopeSelector),\n\t\t\t\t\t\telement => {\n\t\t\t\t\t\t\tconst nthChild = [].indexOf.call(element.parentNode.children, element) + 1;\n\t\t\t\t\t\t\tconst relativeSelectors = item.relativeSelectors.map(\n\t\t\t\t\t\t\t\trelativeSelector => item.scopeSelector + ':nth-child(' + nthChild + ') ' + relativeSelector\n\t\t\t\t\t\t\t).join();\n\n\t\t\t\t\t\t\t// find any relative :has element from the :scope element\n\t\t\t\t\t\t\tconst relativeElement = element.parentNode.querySelector(relativeSelectors);\n\n\t\t\t\t\t\t\tconst shouldElementMatch = item.isNot ? !relativeElement : relativeElement;\n\n\t\t\t\t\t\t\tif (shouldElementMatch) {\n\t\t\t\t\t\t\t\t// memorize the node\n\t\t\t\t\t\t\t\tnodes.push(element);\n\n\t\t\t\t\t\t\t\t// set an attribute with an irregular attribute name\n\t\t\t\t\t\t\t\t// document.createAttribute() doesn't support special characters\n\t\t\t\t\t\t\t\tattributeElement.innerHTML = '';\n\n\t\t\t\t\t\t\t\telement.setAttributeNode(attributeElement.children[0].attributes[0].cloneNode());\n\n\t\t\t\t\t\t\t\t// trigger a style refresh in IE and Edge\n\t\t\t\t\t\t\t\tdocument.documentElement.style.zoom = 1; document.documentElement.style.zoom = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\t// remove the encoded attribute from all nodes that no longer match them\n\t\t\t\t\titem.nodes.forEach(node => {\n\t\t\t\t\t\tif (nodes.indexOf(node) === -1) {\n\t\t\t\t\t\t\tnode.removeAttribute(item.attributeName);\n\n\t\t\t\t\t\t\t// trigger a style refresh in IE and Edge\n\t\t\t\t\t\t\tdocument.documentElement.style.zoom = 1; document.documentElement.style.zoom = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\t// update the\n\t\t\t\t\titem.nodes = nodes;\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\t}\n\n\t// remove any observed cssrules that no longer apply\n\tfunction cleanupObservedCssRules () {\n\t\t[].push.apply(\n\t\t\tobservedItems,\n\t\t\tobservedItems.splice(0).filter(\n\t\t\t\titem => item.rule.parentStyleSheet &&\n\t\t\t\t\titem.rule.parentStyleSheet.ownerNode &&\n\t\t\t\t\tdocument.documentElement.contains(item.rule.parentStyleSheet.ownerNode)\n\t\t\t)\n\t\t);\n\t}\n\n\t// walk a stylesheet to collect observed css rules\n\tfunction walkStyleSheet (styleSheet) {\n\t\ttry {\n\t\t\t// walk a css rule to collect observed css rules\n\t\t\t[].forEach.call(styleSheet.cssRules || [], rule => {\n\t\t\t\tif (rule.selectorText) {\n\t\t\t\t\t// decode the selector text in all browsers to:\n\t\t\t\t\t// [1] = :scope, [2] = :not(:has), [3] = :has relative, [4] = :scope relative\n\t\t\t\t\tconst selectors = decodeURIComponent(rule.selectorText.replace(/\\\\(.)/g, '$1')).match(/^(.*?)\\[:(not-)?has\\((.+?)\\)\\](.*?)$/);\n\n\t\t\t\t\tif (selectors) {\n\t\t\t\t\t\tconst attributeName = ':' + (selectors[2] ? 'not-' : '') + 'has(' +\n\t\t\t\t\t\t\t// encode a :has() pseudo selector as an attribute name\n\t\t\t\t\t\t\tencodeURIComponent(selectors[3]).replace(/%3A/g, ':').replace(/%5B/g, '[').replace(/%5D/g, ']').replace(/%2C/g, ',') +\n\t\t\t\t\t\t')';\n\n\t\t\t\t\t\tobservedItems.push({\n\t\t\t\t\t\t\trule,\n\t\t\t\t\t\t\tscopeSelector: selectors[1],\n\t\t\t\t\t\t\tisNot: selectors[2],\n\t\t\t\t\t\t\trelativeSelectors: selectors[3].split(/\\s*,\\s*/),\n\t\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\t\tnodes: []\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\twalkStyleSheet(rule);\n\t\t\t\t}\n\t\t\t});\n\t\t} catch (error) {\n\t\t\t/* do nothing and continue */\n\t\t}\n\t}\n}\n", "const $ = (selector, parent = document) => parent.querySelector(selector);\nconst $$ = (selector, parent = document) => parent.querySelectorAll(selector);\n\nfunction openMenu(parent) {\n const button = $(\"button\", parent);\n\n parent?.classList.add(\"open\");\n button?.setAttribute(`aria-expanded`, `true`);\n}\n\nfunction closeMenu(parent) {\n const button = $(\"button\", parent);\n\n parent?.classList.remove(\"open\");\n button?.setAttribute(`aria-expanded`, `false`);\n}\n\n// Observes the site header, which should have `top: -1px`, and toggles\n// the `stuck` class when it hits the top of the page.\nnew IntersectionObserver(\n ([e]) => e.target.classList.toggle(\"stuck\", e.intersectionRatio < 1),\n { threshold: [1] }\n).observe($(`header[role=\"banner\"]`));\n\ndocument.addEventListener(\"click\", function(event) {\n const button = event.target.closest(`.platforma-nav-with-utility [aria-controls=\"menu\"]`);\n if (!button) {\n return;\n }\n\n const state = button.getAttribute(\"aria-expanded\");\n const isOpen = state === \"true\";\n const mobileMenu = $(\"header[role='banner'].platforma-nav-with-utility\");\n\n button.setAttribute(\"aria-expanded\", isOpen ? \"false\" : \"true\");\n button.innerText = isOpen ? \"Menu\" : \"Close\";\n mobileMenu.classList.toggle(\"menu-open\");\n $(\"body\").classList.toggle(\"overflow-hidden\");\n});\n\ndocument.addEventListener('mouseover', function (event) {\n let closest = event.target.closest(\".platforma-nav-with-utility:not(.menu-open) nav > ul > .isParent\");\n if (!closest) return;\n openMenu(closest);\n}, false);\n\ndocument.addEventListener('mouseout', function (event) {\n let closest = event.target.closest(\".platforma-nav-with-utility:not(.menu-open) nav > ul > .isParent\");\n if (!closest) return;\n closeMenu(closest);\n}, false);\n\ndocument.addEventListener('click', function (event) {\n let closest = event.target.closest(\".platforma-nav-with-utility li > a + button\");\n if (!closest) return;\n\n let $toggle = closest;\n let $navItem = $toggle.closest(`li`);\n let $otherNavItems = Array.prototype.filter.call($navItem.parentNode.children, function(child){\n return child !== $navItem;\n });\n\n $otherNavItems.forEach(item => {\n closeMenu(item);\n })\n\n if ($navItem.classList.contains(\"open\")) {\n closeMenu($navItem);\n } else {\n openMenu($navItem);\n }\n}, false);\n\ndocument.addEventListener('click', function (event) {\n let closest = event.target.closest(\".platforma-nav-with-utility.menu-open nav ul > .isParent > a\");\n if (!closest) return;\n\n const $navItem = closest.parentNode;\n let siblings = Array.prototype.filter.call($navItem.parentNode.children, function(child){\n return child !== $navItem;\n });\n\n event.preventDefault();\n\n if ($navItem.classList.contains(`open`)) {\n closeMenu($navItem);\n } else {\n openMenu($navItem);\n siblings.forEach(sibling => {\n closeMenu(sibling);\n })\n }\n}, false);\n", "const supportsVideo = !!document.createElement(\"video\").canPlayType;\n\ndocument.addEventListener(\"DOMContentLoaded\", function() {\n if (supportsVideo) {\n const video = document.querySelector(\"video\");\n \n if (video) {\n const playPauseButton = document.querySelector(\".video-button\");\n \n // Hide the default controls\n video.controls = false;\n\n playPauseButton.addEventListener(\"click\", () => {\n \n playPauseButton.classList.toggle(\"playing\");\n if (playPauseButton.classList.contains(\"playing\")) {\n video.play();\n } else {\n video.pause();\n }\n });\n\n video.addEventListener(\"ended\", () => {\n playPauseButton.classList.remove(\"playing\");\n });\n }\n }\n});", "const BACKSPACE = 8;\nconst TAB = 9;\nconst ENTER = 13;\nconst SHIFT = 16;\nconst ESCAPE = 27;\nconst SPACE = 32;\nconst PAGE_UP = 33;\nconst PAGE_DOWN = 34;\nconst END = 35;\nconst HOME = 36;\nconst ARROW_LEFT = 37;\nconst ARROW_UP = 38;\nconst ARROW_RIGHT = 39;\nconst ARROW_DOWN = 40;\nconst DELETE = 46;\n\nconst direction = {\n 37: -1,\n 38: -1,\n 39: 1,\n 40: 1,\n};\n\n// Tabs with Automatic Activation\n// https://www.w3.org/TR/wai-aria-practices/examples/tabs/tabs-1/tabs.html\nclass A11yTab {\n constructor(tablist, options = {}) {\n this.tablist = tablist;\n this.orientation = tablist.getAttribute(\"aria-orientation\") || \"horizontal\";\n const tabs = this.tabs = [];\n const panels = this.panels = [];\n\n // Bind.\n this.onKeydown = this.onKeydown.bind(this);\n this.onKeyup = this.onKeyup.bind(this);\n this.onClick = this.onClick.bind(this);\n this.focusEventHandler = this.focusEventHandler.bind(this);\n\n // Determine whether there should be a delay when user navigates with\n // the arrow keys, default is\n this.delay = tablist.getAttribute(\"data-delay\") || 0;\n\n const hash = window.location.hash;\n\n let activeTab;\n tablist.querySelectorAll(`[role=\"tab\"]`).forEach((tab, index) => {\n tabs.push(tab);\n const panelId = tab.getAttribute(\"aria-controls\");\n panels.push(document.getElementById(panelId));\n\n const active = hash === `#${ panelId }`;\n if (active) {\n activeTab = tab;\n }\n\n tab.addEventListener(\"click\", this.onClick, false);\n tab.addEventListener(\"keydown\", this.onKeydown, false);\n tab.addEventListener(\"keyup\", this.onKeyup, false);\n });\n\n if (activeTab) {\n this.activateTab(activeTab);\n }\n }\n\n /**\n * Click event listener\n *\n * When a tab is clicked, activateTab is fired to activate it\n *\n * @param {object} event\n * @return void\n */\n onClick(event) {\n const tab = event.target;\n this.activateTab(tab, false);\n\n const href = tab.getAttribute(\"href\");\n if (href) {\n event.preventDefault();\n }\n }\n\n /**\n * Keydown event listener\n *\n * Handle keydown on tabs\n *\n * @param {object} event\n * @return void\n */\n onKeydown(event) {\n const { keyCode: key } = event;\n\n const codes = {\n [END]: () => {\n event.preventDefault();\n this.activateTab(this.tabs[this.tabs.length - 1]);\n },\n [HOME]: () => {\n event.preventDefault();\n this.activateTab(this.tabs[0]);\n },\n [PAGE_UP]: () => this.determineOrientation(event),\n [PAGE_DOWN]: () => this.determineOrientation(event),\n // Up and down are in keydown because we need to prevent page scroll >:)\n [ARROW_UP]: () => this.determineOrientation(event),\n [ARROW_DOWN]: () => this.determineOrientation(event),\n default: () => false,\n };\n\n return (codes[key] || codes.default)();\n }\n\n /**\n * Keyup event listener\n *\n * Handle keyup on tabs\n *\n * @param {object} event\n * @return void\n */\n onKeyup(event) {\n const { keyCode: key, target } = event;\n // const selected = target.getAttribute(\"aria-selected\") === \"true\";\n\n const codes = {\n [ARROW_LEFT]: () => this.determineOrientation(event),\n [ARROW_RIGHT]: () => this.determineOrientation(event),\n // [DELETE]: () => selected && this.determineDeletable(event),\n // [BACKSPACE]: () => selected && this.determineDeletable(event),\n default: () => false,\n };\n\n return (codes[key] || codes.default)();\n }\n\n /**\n * Determine orientation\n *\n * When a tablist's aria-orientation is set to vertical, only up and down\n * arrow should function. In all other cases only left and right arrow\n * function.\n *\n * @param {object} event\n */\n determineOrientation(event) {\n const { keyCode: key } = event;\n const vertical = \"vertical\" === this.orientation;\n let proceed = false;\n\n if (vertical && (key === PAGE_UP || key === PAGE_DOWN || key === ARROW_UP || key === ARROW_DOWN)) {\n event.preventDefault();\n proceed = true;\n } else if (key === ARROW_LEFT || key === ARROW_RIGHT) {\n proceed = true;\n }\n\n if (proceed) {\n this.switchTabOnArrowPress(event);\n }\n }\n\n /**\n * Switch tab on arrow press\n *\n * Either focus the next, previous, first, or last tab depening on key\n * pressed\n *\n * @param {object} event\n * @return void\n */\n switchTabOnArrowPress(event) {\n const { target, keyCode: key } = event;\n const tabs = this.tabs;\n\n tabs.forEach(tab => tab.addEventListener(\"focus\", this.focusEventHandler));\n\n if (direction[key]) {\n const index = this.tabs.indexOf(target);\n if (index !== undefined) {\n if (this.tabs[index + direction[key]]) {\n this.tabs[index + direction[key]].focus();\n } else if (key === ARROW_LEFT || key === PAGE_UP || key === ARROW_UP) {\n this.focusLastTab();\n } else if (key === ARROW_RIGHT || key === PAGE_DOWN || key === ARROW_DOWN) {\n this.focusFirstTab();\n }\n }\n }\n }\n\n /**\n * Activate tab\n *\n * Activates any given tab panel\n *\n * @param {object} tab\n * @param {boolean} [setFocus=true]\n * @return void\n */\n activateTab(tab, setFocus = true) {\n // Deactivate all other tabs\n this.deactivateTabs();\n\n tab.setAttribute(\"tabindex\", 0);\n // Set the tab as selected\n tab.setAttribute(\"aria-selected\", \"true\");\n // Get the value of aria-controls (which is an ID)\n const panelId = tab.getAttribute(\"aria-controls\");\n const panel = document.getElementById(panelId);\n\n // Remove hidden attribute from tab panel to make it visible\n // panel.removeAttribute(\"aria-hidden\");\n panel.setAttribute(\"open\",\"open\");\n\n // Set focus when required\n if (setFocus) {\n tab.click();\n } else {\n history.replaceState(null, null, `#${ panel.id}`);\n }\n\n const event = new CustomEvent(\"change\", {\n detail: {\n currentTab: tab,\n currentIndex: this.tabs.indexOf(tab),\n }\n });\n this.tablist.dispatchEvent(event);\n\n // Dispatches a \"resize\" event so content inside tabs can redraw if needs.\n window.dispatchEvent(new Event(\"resize\"));\n }\n\n /**\n * Deactivate tabs\n *\n * Deactivate all tabs and tab panels\n *\n * @return void\n */\n deactivateTabs() {\n this.tabs.forEach(tab => {\n tab.setAttribute(\"tabindex\", -1);\n tab.setAttribute(\"aria-selected\", \"false\");\n tab.removeEventListener(\"focus\", this.focusEventHandler);\n });\n\n this.panels.forEach(panel => {\n // panel.setAttribute(\"aria-hidden\", \"true\");\n panel.removeAttribute(\"open\");\n });\n }\n\n /**\n * Focus first tab\n *\n * @return\n */\n focusFirstTab() {\n return this.tabs[0].focus();\n }\n\n\n /**\n * Focus last tab\n *\n * @return\n */\n focusLastTab() {\n return this.tabs[this.tabs.length - 1].focus();\n }\n\n /**\n * Focus event handler\n *\n * @param {object} event\n * @return void\n */\n focusEventHandler(event) {\n const { target } = event;\n\n setTimeout(() => {\n this.checkTabFocus(target);\n }, this.delay);\n }\n\n /**\n * Check tab focus\n *\n * Only activate tab on focus if it still has focus after the delay\n *\n * @param {object} target\n * @return void\n */\n checkTabFocus(target) {\n const focused = document.activeElement;\n\n if (target === focused) {\n this.activateTab(target, false);\n }\n }\n}\n\n/** @type {NodeListOf} */\nconst tabsCollections = document.querySelectorAll(\"[role=\\\"tablist\\\"\");\nfor (let i = 0, count = tabsCollections.length; i < count; i++) {\n new A11yTab(tabsCollections[i], {\n\n });\n}\n\nexport default A11yTab;\n", "import \"../../../../node_modules/@lottiefiles/lottie-player/dist/lottie-player.js\";\nimport { create } from \"../../../../node_modules/@lottiefiles/lottie-interactivity/dist/lottie-interactivity.min.js\";\n\nwindow.addEventListener('load', (event) => {\n const animations = document.getElementsByTagName(\"lottie-player\");\n\n for (i=0;i parent.querySelector(selector);\nconst $$ = (selector, parent = document) => parent.querySelectorAll(selector);\n\n/**\n * Handles keyboard navigations on the \n *\n * * Down Arrow: moves focus to next `` in the accordion,\n * or the first ``.\n * * Up Arrow: moves focus to previous `` in the accordion,\n * or the last ``.\n * * Home : moves focus to the first accordion header.\n * * End : moves focus to the last accordion header.\n * @param {KeyboardEvent} event\n */\nfunction onKeyDownOnAccordion(event) {\n const target = /** @type {HTMLElement} */(event.target);\n const key = event.key;\n\n // Ignores if event is not coming from an accordion header.\n if (target.tagName !== \"SUMMARY\") {\n return;\n }\n\n // Ignore other keys\n if ([\"Down\", \"ArrowDown\", \"Up\", \"ArrowUp\", \"Home\", \"End\"].indexOf(key) === -1) {\n return;\n }\n\n const accordion = target.closest(\".accordion\");\n const triggers = Array.from(accordion.querySelectorAll(\"summary\"));\n const length = triggers.length;\n const index = triggers.indexOf(target);\n let newIndex;\n\n switch (key) {\n case \"Down\": // IE/Edge specific value\n case \"ArrowDown\":\n newIndex = (index + length + 1) % length;\n break;\n case \"Up\": // IE/Edge specific value\n case \"ArrowUp\":\n newIndex = (index + length -1) % length;\n break;\n case \"Home\":\n // Go to first accordion\n newIndex = 0;\n break;\n case \"End\":\n // Go to last accordion\n newIndex = length - 1;\n break;\n }\n\n triggers[newIndex].focus();\n event.preventDefault();\n}\n\ndocument.querySelectorAll(\".accordion\").forEach((accordion) => {\n let details = $$(\"details\", accordion);\n\n details.forEach ((detail) => {\n detail.addEventListener(\"toggle\", function(e) {\n\n if (e.target.getAttribute(\"open\") !== null) {\n $$(\"details[open]\", accordion).forEach((openTab) => {\n if (openTab !== e.target) {\n openTab.removeAttribute(\"open\");\n }\n })\n\n\n const headerHeight = $(\"body > header\").offsetHeight;\n let scrollTop = window.pageYOffset || document.documentElement.scrollTop\n let samBar = 0;\n\n if ($(\"body\").classList.contains(\"samadmin\")) {\n samBar = 97;\n }\n\n window.scroll({\n top: e.target.getBoundingClientRect()[\"top\"] + scrollTop - samBar - headerHeight - 20,\n behavior: 'smooth'\n });\n }\n })\n })\n accordion.addEventListener(\"keydown\", onKeyDownOnAccordion);\n});", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Namespace\n *\n * */\n/**\n * Shared Highcharts properties.\n * @private\n */\nvar Globals;\n(function (Globals) {\n /* *\n *\n * Constants\n *\n * */\n Globals.SVG_NS = 'http://www.w3.org/2000/svg', Globals.product = 'Highcharts', Globals.version = '@product.version@', Globals.win = (typeof window !== 'undefined' ?\n window :\n {}), // eslint-disable-line node/no-unsupported-features/es-builtins\n Globals.doc = Globals.win.document, Globals.svg = (Globals.doc &&\n Globals.doc.createElementNS &&\n !!Globals.doc.createElementNS(Globals.SVG_NS, 'svg').createSVGRect), Globals.userAgent = (Globals.win.navigator && Globals.win.navigator.userAgent) || '', Globals.isChrome = Globals.userAgent.indexOf('Chrome') !== -1, Globals.isFirefox = Globals.userAgent.indexOf('Firefox') !== -1, Globals.isMS = /(edge|msie|trident)/i.test(Globals.userAgent) && !Globals.win.opera, Globals.isSafari = !Globals.isChrome && Globals.userAgent.indexOf('Safari') !== -1, Globals.isTouchDevice = /(Mobile|Android|Windows Phone)/.test(Globals.userAgent), Globals.isWebKit = Globals.userAgent.indexOf('AppleWebKit') !== -1, Globals.deg2rad = Math.PI * 2 / 360, Globals.hasBidiBug = (Globals.isFirefox &&\n parseInt(Globals.userAgent.split('Firefox/')[1], 10) < 4 // issue #38\n ), Globals.marginNames = [\n 'plotTop',\n 'marginRight',\n 'marginBottom',\n 'plotLeft'\n ], Globals.noop = function () { }, Globals.supportsPassiveEvents = (function () {\n // Checks whether the browser supports passive events, (#11353).\n let supportsPassive = false;\n // Object.defineProperty doesn't work on IE as well as passive\n // events - instead of using polyfill, we can exclude IE totally.\n if (!Globals.isMS) {\n const opts = Object.defineProperty({}, 'passive', {\n get: function () {\n supportsPassive = true;\n }\n });\n if (Globals.win.addEventListener && Globals.win.removeEventListener) {\n Globals.win.addEventListener('testPassive', Globals.noop, opts);\n Globals.win.removeEventListener('testPassive', Globals.noop, opts);\n }\n }\n return supportsPassive;\n }());\n /**\n * An array containing the current chart objects in the page. A chart's\n * position in the array is preserved throughout the page's lifetime. When\n * a chart is destroyed, the array item becomes `undefined`.\n *\n * @name Highcharts.charts\n * @type {Array}\n */\n Globals.charts = [];\n /**\n * A shared registry between all bundles to keep track of applied\n * compositions.\n * @private\n */\n Globals.composed = [];\n /**\n * A hook for defining additional date format specifiers. New\n * specifiers are defined as key-value pairs by using the\n * specifier as key, and a function which takes the timestamp as\n * value. This function returns the formatted portion of the\n * date.\n *\n * @sample highcharts/global/dateformats/\n * Adding support for week number\n *\n * @name Highcharts.dateFormats\n * @type {Record}\n */\n Globals.dateFormats = {};\n /**\n * @private\n * @deprecated\n * @todo Use only `Core/Series/SeriesRegistry.seriesTypes`\n */\n Globals.seriesTypes = {};\n /**\n * @private\n */\n Globals.symbolSizes = {};\n /* *\n *\n * Properties\n *\n * */\n // eslint-disable-next-line prefer-const\n Globals.chartCount = 0;\n})(Globals || (Globals = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default Globals;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Theme options that should get applied to the chart. In module mode it\n * might not be possible to change this property because of read-only\n * restrictions, instead use {@link Highcharts.setOptions}.\n *\n * @deprecated\n * @name Highcharts.theme\n * @type {Highcharts.Options}\n */\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from './Globals.js';\nconst { charts, doc, win } = H;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Provide error messages for debugging, with links to online explanation. This\n * function can be overridden to provide custom error handling.\n *\n * @sample highcharts/chart/highcharts-error/\n * Custom error handler\n *\n * @function Highcharts.error\n *\n * @param {number|string} code\n * The error code. See\n * [errors.xml](https://github.com/highcharts/highcharts/blob/master/errors/errors.xml)\n * for available codes. If it is a string, the error message is printed\n * directly in the console.\n *\n * @param {boolean} [stop=false]\n * Whether to throw an error or just log a warning in the console.\n *\n * @param {Highcharts.Chart} [chart]\n * Reference to the chart that causes the error. Used in 'debugger'\n * module to display errors directly on the chart.\n * Important note: This argument is undefined for errors that lack\n * access to the Chart instance. In such case, the error will be\n * displayed on the last created chart.\n *\n * @param {Highcharts.Dictionary} [params]\n * Additional parameters for the generated message.\n *\n * @return {void}\n */\nfunction error(code, stop, chart, params) {\n const severity = stop ? 'Highcharts error' : 'Highcharts warning';\n if (code === 32) {\n code = `${severity}: Deprecated member`;\n }\n const isCode = isNumber(code);\n let message = isCode ?\n `${severity} #${code}: www.highcharts.com/errors/${code}/` :\n code.toString();\n const defaultHandler = function () {\n if (stop) {\n throw new Error(message);\n }\n // else ...\n if (win.console &&\n error.messages.indexOf(message) === -1 // prevent console flooting\n ) {\n console.warn(message); // eslint-disable-line no-console\n }\n };\n if (typeof params !== 'undefined') {\n let additionalMessages = '';\n if (isCode) {\n message += '?';\n }\n objectEach(params, function (value, key) {\n additionalMessages += `\\n - ${key}: ${value}`;\n if (isCode) {\n message += encodeURI(key) + '=' + encodeURI(value);\n }\n });\n message += additionalMessages;\n }\n fireEvent(H, 'displayError', { chart, code, message, params }, defaultHandler);\n error.messages.push(message);\n}\n(function (error) {\n error.messages = [];\n})(error || (error = {}));\n/* eslint-disable valid-jsdoc */\n/**\n * Utility function to deep merge two or more objects and return a third object.\n * If the first argument is true, the contents of the second object is copied\n * into the first object. The merge function can also be used with a single\n * object argument to create a deep copy of an object.\n *\n * @function Highcharts.merge\n *\n * @param {boolean} extend\n * Whether to extend the left-side object (a) or return a whole new\n * object.\n *\n * @param {T|undefined} a\n * The first object to extend. When only this is given, the function\n * returns a deep copy.\n *\n * @param {...Array} [n]\n * An object to merge into the previous one.\n *\n * @return {T}\n * The merged object. If the first argument is true, the return is the\n * same as the second argument.\n */ /**\n* Utility function to deep merge two or more objects and return a third object.\n* The merge function can also be used with a single object argument to create a\n* deep copy of an object.\n*\n* @function Highcharts.merge\n*\n* @param {T|undefined} a\n* The first object to extend. When only this is given, the function\n* returns a deep copy.\n*\n* @param {...Array} [n]\n* An object to merge into the previous one.\n*\n* @return {T}\n* The merged object. If the first argument is true, the return is the\n* same as the second argument.\n*/\nfunction merge() {\n /* eslint-enable valid-jsdoc */\n let i, args = arguments, ret = {};\n const doCopy = function (copy, original) {\n // An object is replacing a primitive\n if (typeof copy !== 'object') {\n copy = {};\n }\n objectEach(original, function (value, key) {\n // Prototype pollution (#14883)\n if (key === '__proto__' || key === 'constructor') {\n return;\n }\n // Copy the contents of objects, but not arrays or DOM nodes\n if (isObject(value, true) &&\n !isClass(value) &&\n !isDOMElement(value)) {\n copy[key] = doCopy(copy[key] || {}, value);\n // Primitives and arrays are copied over directly\n }\n else {\n copy[key] = original[key];\n }\n });\n return copy;\n };\n // If first argument is true, copy into the existing object. Used in\n // setOptions.\n if (args[0] === true) {\n ret = args[1];\n args = Array.prototype.slice.call(args, 2);\n }\n // For each argument, extend the return\n const len = args.length;\n for (i = 0; i < len; i++) {\n ret = doCopy(ret, args[i]);\n }\n return ret;\n}\n/**\n * Constrain a value to within a lower and upper threshold.\n *\n * @private\n * @param {number} value The initial value\n * @param {number} min The lower threshold\n * @param {number} max The upper threshold\n * @return {number} Returns a number value within min and max.\n */\nfunction clamp(value, min, max) {\n return value > min ? value < max ? value : max : min;\n}\n// eslint-disable-next-line valid-jsdoc\n/**\n * Return the deep difference between two objects. It can either return the new\n * properties, or optionally return the old values of new properties.\n * @private\n */\nfunction diffObjects(newer, older, keepOlder, collectionsWithUpdate) {\n const ret = {};\n /**\n * Recurse over a set of options and its current values, and store the\n * current values in the ret object.\n */\n function diff(newer, older, ret, depth) {\n const keeper = keepOlder ? older : newer;\n objectEach(newer, function (newerVal, key) {\n if (!depth &&\n collectionsWithUpdate &&\n collectionsWithUpdate.indexOf(key) > -1 &&\n older[key]) {\n newerVal = splat(newerVal);\n ret[key] = [];\n // Iterate over collections like series, xAxis or yAxis and map\n // the items by index.\n for (let i = 0; i < Math.max(newerVal.length, older[key].length); i++) {\n // Item exists in current data (#6347)\n if (older[key][i]) {\n // If the item is missing from the new data, we need to\n // save the whole config structure. Like when\n // responsively updating from a dual axis layout to a\n // single axis and back (#13544).\n if (newerVal[i] === void 0) {\n ret[key][i] = older[key][i];\n // Otherwise, proceed\n }\n else {\n ret[key][i] = {};\n diff(newerVal[i], older[key][i], ret[key][i], depth + 1);\n }\n }\n }\n }\n else if (isObject(newerVal, true) &&\n !newerVal.nodeType // #10044\n ) {\n ret[key] = isArray(newerVal) ? [] : {};\n diff(newerVal, older[key] || {}, ret[key], depth + 1);\n // Delete empty nested objects\n if (Object.keys(ret[key]).length === 0 &&\n // Except colorAxis which is a special case where the empty\n // object means it is enabled. Which is unfortunate and we\n // should try to find a better way.\n !(key === 'colorAxis' && depth === 0)) {\n delete ret[key];\n }\n }\n else if (newer[key] !== older[key] ||\n // If the newer key is explicitly undefined, keep it (#10525)\n (key in newer && !(key in older))) {\n if (key !== '__proto__' && key !== 'constructor') {\n ret[key] = keeper[key];\n }\n }\n });\n }\n diff(newer, older, ret, 0);\n return ret;\n}\n/**\n * Shortcut for parseInt\n *\n * @private\n * @function Highcharts.pInt\n *\n * @param {*} s\n * any\n *\n * @param {number} [mag]\n * Magnitude\n *\n * @return {number}\n * number\n */\nfunction pInt(s, mag) {\n return parseInt(s, mag || 10);\n}\n/**\n * Utility function to check for string type.\n *\n * @function Highcharts.isString\n *\n * @param {*} s\n * The item to check.\n *\n * @return {boolean}\n * True if the argument is a string.\n */\nfunction isString(s) {\n return typeof s === 'string';\n}\n/**\n * Utility function to check if an item is an array.\n *\n * @function Highcharts.isArray\n *\n * @param {*} obj\n * The item to check.\n *\n * @return {boolean}\n * True if the argument is an array.\n */\nfunction isArray(obj) {\n const str = Object.prototype.toString.call(obj);\n return str === '[object Array]' || str === '[object Array Iterator]';\n}\n/**\n * Utility function to check if an item is of type object.\n *\n * @function Highcharts.isObject\n *\n * @param {*} obj\n * The item to check.\n *\n * @param {boolean} [strict=false]\n * Also checks that the object is not an array.\n *\n * @return {boolean}\n * True if the argument is an object.\n */\nfunction isObject(obj, strict) {\n return (!!obj &&\n typeof obj === 'object' &&\n (!strict || !isArray(obj))); // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n/**\n * Utility function to check if an Object is a HTML Element.\n *\n * @function Highcharts.isDOMElement\n *\n * @param {*} obj\n * The item to check.\n *\n * @return {boolean}\n * True if the argument is a HTML Element.\n */\nfunction isDOMElement(obj) {\n return isObject(obj) && typeof obj.nodeType === 'number';\n}\n/**\n * Utility function to check if an Object is a class.\n *\n * @function Highcharts.isClass\n *\n * @param {object|undefined} obj\n * The item to check.\n *\n * @return {boolean}\n * True if the argument is a class.\n */\nfunction isClass(obj) {\n const c = obj && obj.constructor;\n return !!(isObject(obj, true) &&\n !isDOMElement(obj) &&\n (c && c.name && c.name !== 'Object'));\n}\n/**\n * Utility function to check if an item is a number and it is finite (not NaN,\n * Infinity or -Infinity).\n *\n * @function Highcharts.isNumber\n *\n * @param {*} n\n * The item to check.\n *\n * @return {boolean}\n * True if the item is a finite number\n */\nfunction isNumber(n) {\n return typeof n === 'number' && !isNaN(n) && n < Infinity && n > -Infinity;\n}\n/**\n * Remove the last occurence of an item from an array.\n *\n * @function Highcharts.erase\n *\n * @param {Array<*>} arr\n * The array.\n *\n * @param {*} item\n * The item to remove.\n *\n * @return {void}\n */\nfunction erase(arr, item) {\n let i = arr.length;\n while (i--) {\n if (arr[i] === item) {\n arr.splice(i, 1);\n break;\n }\n }\n}\n/**\n * Insert a series or an axis in a collection with other items, either the\n * chart series or yAxis series or axis collections, in the correct order\n * according to the index option and whether it is internal. Used internally\n * when adding series and axes.\n *\n * @private\n * @function Highcharts.Chart#insertItem\n * @param {Highcharts.Series|Highcharts.Axis} item\n * The item to insert\n * @param {Array|Array} collection\n * A collection of items, like `chart.series` or `xAxis.series`.\n * @return {number} The index of the series in the collection.\n */\nfunction insertItem(item, collection) {\n const indexOption = item.options.index, length = collection.length;\n let i;\n for (\n // Internal item (navigator) should always be pushed to the end\n i = item.options.isInternal ? length : 0; i < length + 1; i++) {\n if (\n // No index option, reached the end of the collection,\n // equivalent to pushing\n !collection[i] ||\n // Handle index option, the element to insert has lower index\n (isNumber(indexOption) &&\n indexOption < pick(collection[i].options.index, collection[i]._i)) ||\n // Insert the new item before other internal items\n // (navigator)\n collection[i].options.isInternal) {\n collection.splice(i, 0, item);\n break;\n }\n }\n return i;\n}\n/**\n * Adds an item to an array, if it is not present in the array.\n *\n * @function Highcharts.pushUnique\n *\n * @param {Array} array\n * The array to add the item to.\n *\n * @param {unknown} item\n * The item to add.\n *\n * @return {boolean}\n * Returns true, if the item was not present and has been added.\n */\nfunction pushUnique(array, item) {\n return array.indexOf(item) < 0 && !!array.push(item);\n}\n/**\n * Check if an object is null or undefined.\n *\n * @function Highcharts.defined\n *\n * @param {*} obj\n * The object to check.\n *\n * @return {boolean}\n * False if the object is null or undefined, otherwise true.\n */\nfunction defined(obj) {\n return typeof obj !== 'undefined' && obj !== null;\n}\n/**\n * Set or get an attribute or an object of attributes.\n *\n * To use as a setter, pass a key and a value, or let the second argument be a\n * collection of keys and values. When using a collection, passing a value of\n * `null` or `undefined` will remove the attribute.\n *\n * To use as a getter, pass only a string as the second argument.\n *\n * @function Highcharts.attr\n *\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} elem\n * The DOM element to receive the attribute(s).\n *\n * @param {string|Highcharts.HTMLAttributes|Highcharts.SVGAttributes} [keyOrAttribs]\n * The property or an object of key-value pairs.\n *\n * @param {number|string} [value]\n * The value if a single property is set.\n *\n * @return {string|null|undefined}\n * When used as a getter, return the value.\n */\nfunction attr(elem, keyOrAttribs, value) {\n const isGetter = isString(keyOrAttribs) && !defined(value);\n let ret;\n const attrSingle = (value, key) => {\n // Set the value\n if (defined(value)) {\n elem.setAttribute(key, value);\n // Get the value\n }\n else if (isGetter) {\n ret = elem.getAttribute(key);\n // IE7 and below cannot get class through getAttribute (#7850)\n if (!ret && key === 'class') {\n ret = elem.getAttribute(key + 'Name');\n }\n // Remove the value\n }\n else {\n elem.removeAttribute(key);\n }\n };\n // If keyOrAttribs is a string\n if (isString(keyOrAttribs)) {\n attrSingle(value, keyOrAttribs);\n // Else if keyOrAttribs is defined, it is a hash of key/value pairs\n }\n else {\n objectEach(keyOrAttribs, attrSingle);\n }\n return ret;\n}\n/**\n * Check if an element is an array, and if not, make it into an array.\n *\n * @function Highcharts.splat\n *\n * @param {*} obj\n * The object to splat.\n *\n * @return {Array}\n * The produced or original array.\n */\nfunction splat(obj) {\n return isArray(obj) ? obj : [obj];\n}\n/**\n * Set a timeout if the delay is given, otherwise perform the function\n * synchronously.\n *\n * @function Highcharts.syncTimeout\n *\n * @param {Function} fn\n * The function callback.\n *\n * @param {number} delay\n * Delay in milliseconds.\n *\n * @param {*} [context]\n * An optional context to send to the function callback.\n *\n * @return {number}\n * An identifier for the timeout that can later be cleared with\n * Highcharts.clearTimeout. Returns -1 if there is no timeout.\n */\nfunction syncTimeout(fn, delay, context) {\n if (delay > 0) {\n return setTimeout(fn, delay, context);\n }\n fn.call(0, context);\n return -1;\n}\n/**\n * Internal clear timeout. The function checks that the `id` was not removed\n * (e.g. by `chart.destroy()`). For the details see\n * [issue #7901](https://github.com/highcharts/highcharts/issues/7901).\n *\n * @function Highcharts.clearTimeout\n *\n * @param {number|undefined} id\n * Id of a timeout.\n */\nfunction internalClearTimeout(id) {\n if (defined(id)) {\n clearTimeout(id);\n }\n}\n/* eslint-disable valid-jsdoc */\n/**\n * Utility function to extend an object with the members of another.\n *\n * @function Highcharts.extend\n *\n * @param {T|undefined} a\n * The object to be extended.\n *\n * @param {Partial} b\n * The object to add to the first one.\n *\n * @return {T}\n * Object a, the original object.\n */\nfunction extend(a, b) {\n /* eslint-enable valid-jsdoc */\n let n;\n if (!a) {\n a = {};\n }\n for (n in b) { // eslint-disable-line guard-for-in\n a[n] = b[n];\n }\n return a;\n}\n/* eslint-disable valid-jsdoc */\n/**\n * Return the first value that is not null or undefined.\n *\n * @function Highcharts.pick\n *\n * @param {...Array} items\n * Variable number of arguments to inspect.\n *\n * @return {T}\n * The value of the first argument that is not null or undefined.\n */\nfunction pick() {\n const args = arguments;\n const length = args.length;\n for (let i = 0; i < length; i++) {\n const arg = args[i];\n if (typeof arg !== 'undefined' && arg !== null) {\n return arg;\n }\n }\n}\n/**\n * Set CSS on a given element.\n *\n * @function Highcharts.css\n *\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} el\n * An HTML DOM element.\n *\n * @param {Highcharts.CSSObject} styles\n * Style object with camel case property names.\n *\n * @return {void}\n */\nfunction css(el, styles) {\n extend(el.style, styles);\n}\n/**\n * Utility function to create an HTML element with attributes and styles.\n *\n * @function Highcharts.createElement\n *\n * @param {string} tag\n * The HTML tag.\n *\n * @param {Highcharts.HTMLAttributes} [attribs]\n * Attributes as an object of key-value pairs.\n *\n * @param {Highcharts.CSSObject} [styles]\n * Styles as an object of key-value pairs.\n *\n * @param {Highcharts.HTMLDOMElement} [parent]\n * The parent HTML object.\n *\n * @param {boolean} [nopad=false]\n * If true, remove all padding, border and margin.\n *\n * @return {Highcharts.HTMLDOMElement}\n * The created DOM element.\n */\nfunction createElement(tag, attribs, styles, parent, nopad) {\n const el = doc.createElement(tag);\n if (attribs) {\n extend(el, attribs);\n }\n if (nopad) {\n css(el, { padding: '0', border: 'none', margin: '0' });\n }\n if (styles) {\n css(el, styles);\n }\n if (parent) {\n parent.appendChild(el);\n }\n return el;\n}\n// eslint-disable-next-line valid-jsdoc\n/**\n * Extend a prototyped class by new members.\n *\n * @deprecated\n * @function Highcharts.extendClass\n *\n * @param {Highcharts.Class} parent\n * The parent prototype to inherit.\n *\n * @param {Highcharts.Dictionary<*>} members\n * A collection of prototype members to add or override compared to the\n * parent prototype.\n *\n * @return {Highcharts.Class}\n * A new prototype.\n */\nfunction extendClass(parent, members) {\n const obj = (function () { });\n obj.prototype = new parent(); // eslint-disable-line new-cap\n extend(obj.prototype, members);\n return obj;\n}\n/**\n * Left-pad a string to a given length by adding a character repetitively.\n *\n * @function Highcharts.pad\n *\n * @param {number} number\n * The input string or number.\n *\n * @param {number} [length]\n * The desired string length.\n *\n * @param {string} [padder=0]\n * The character to pad with.\n *\n * @return {string}\n * The padded string.\n */\nfunction pad(number, length, padder) {\n return new Array((length || 2) +\n 1 -\n String(number)\n .replace('-', '')\n .length).join(padder || '0') + number;\n}\n/**\n * Return a length based on either the integer value, or a percentage of a base.\n *\n * @function Highcharts.relativeLength\n *\n * @param {Highcharts.RelativeSize} value\n * A percentage string or a number.\n *\n * @param {number} base\n * The full length that represents 100%.\n *\n * @param {number} [offset=0]\n * A pixel offset to apply for percentage values. Used internally in\n * axis positioning.\n *\n * @return {number}\n * The computed length.\n */\nfunction relativeLength(value, base, offset) {\n return (/%$/).test(value) ?\n (base * parseFloat(value) / 100) + (offset || 0) :\n parseFloat(value);\n}\n/**\n * Replaces text in a string with a given replacement in a loop to catch nested\n * matches after previous replacements.\n *\n * @function Highcharts.replaceNested\n *\n * @param {string} text\n * Text to search and modify.\n *\n * @param {...Array<(RegExp|string)>} replacements\n * One or multiple tuples with search pattern (`[0]: (string|RegExp)`) and\n * replacement (`[1]: string`) for matching text.\n *\n * @return {string}\n * Text with replacements.\n */\nfunction replaceNested(text, ...replacements) {\n let previous, replacement;\n do {\n previous = text;\n for (replacement of replacements) {\n text = text.replace(replacement[0], replacement[1]);\n }\n } while (text !== previous);\n return text;\n}\n/**\n * Wrap a method with extended functionality, preserving the original function.\n *\n * @function Highcharts.wrap\n *\n * @param {*} obj\n * The context object that the method belongs to. In real cases, this is\n * often a prototype.\n *\n * @param {string} method\n * The name of the method to extend.\n *\n * @param {Highcharts.WrapProceedFunction} func\n * A wrapper function callback. This function is called with the same\n * arguments as the original function, except that the original function\n * is unshifted and passed as the first argument.\n */\nfunction wrap(obj, method, func) {\n const proceed = obj[method];\n obj[method] = function () {\n const outerArgs = arguments, scope = this;\n return func.apply(this, [\n function () {\n return proceed.apply(scope, arguments.length ? arguments : outerArgs);\n }\n ].concat([].slice.call(arguments)));\n };\n}\n/**\n * Get the magnitude of a number.\n *\n * @function Highcharts.getMagnitude\n *\n * @param {number} num\n * The number.\n *\n * @return {number}\n * The magnitude, where 1-9 are magnitude 1, 10-99 magnitude 2 etc.\n */\nfunction getMagnitude(num) {\n return Math.pow(10, Math.floor(Math.log(num) / Math.LN10));\n}\n/**\n * Take an interval and normalize it to multiples of round numbers.\n *\n * @deprecated\n * @function Highcharts.normalizeTickInterval\n *\n * @param {number} interval\n * The raw, un-rounded interval.\n *\n * @param {Array<*>} [multiples]\n * Allowed multiples.\n *\n * @param {number} [magnitude]\n * The magnitude of the number.\n *\n * @param {boolean} [allowDecimals]\n * Whether to allow decimals.\n *\n * @param {boolean} [hasTickAmount]\n * If it has tickAmount, avoid landing on tick intervals lower than\n * original.\n *\n * @return {number}\n * The normalized interval.\n *\n * @todo\n * Move this function to the Axis prototype. It is here only for historical\n * reasons.\n */\nfunction normalizeTickInterval(interval, multiples, magnitude, allowDecimals, hasTickAmount) {\n let i, retInterval = interval;\n // round to a tenfold of 1, 2, 2.5 or 5\n magnitude = pick(magnitude, getMagnitude(interval));\n const normalized = interval / magnitude;\n // multiples for a linear scale\n if (!multiples) {\n multiples = hasTickAmount ?\n // Finer grained ticks when the tick amount is hard set, including\n // when alignTicks is true on multiple axes (#4580).\n [1, 1.2, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10] :\n // Else, let ticks fall on rounder numbers\n [1, 2, 2.5, 5, 10];\n // the allowDecimals option\n if (allowDecimals === false) {\n if (magnitude === 1) {\n multiples = multiples.filter(function (num) {\n return num % 1 === 0;\n });\n }\n else if (magnitude <= 0.1) {\n multiples = [1 / magnitude];\n }\n }\n }\n // normalize the interval to the nearest multiple\n for (i = 0; i < multiples.length; i++) {\n retInterval = multiples[i];\n // only allow tick amounts smaller than natural\n if ((hasTickAmount &&\n retInterval * magnitude >= interval) ||\n (!hasTickAmount &&\n (normalized <=\n (multiples[i] +\n (multiples[i + 1] || multiples[i])) / 2))) {\n break;\n }\n }\n // Multiply back to the correct magnitude. Correct floats to appropriate\n // precision (#6085).\n retInterval = correctFloat(retInterval * magnitude, -Math.round(Math.log(0.001) / Math.LN10));\n return retInterval;\n}\n/**\n * Sort an object array and keep the order of equal items. The ECMAScript\n * standard does not specify the behaviour when items are equal.\n *\n * @function Highcharts.stableSort\n *\n * @param {Array<*>} arr\n * The array to sort.\n *\n * @param {Function} sortFunction\n * The function to sort it with, like with regular Array.prototype.sort.\n */\nfunction stableSort(arr, sortFunction) {\n // @todo It seems like Chrome since v70 sorts in a stable way internally,\n // plus all other browsers do it, so over time we may be able to remove this\n // function\n const length = arr.length;\n let sortValue, i;\n // Add index to each item\n for (i = 0; i < length; i++) {\n arr[i].safeI = i; // stable sort index\n }\n arr.sort(function (a, b) {\n sortValue = sortFunction(a, b);\n return sortValue === 0 ? a.safeI - b.safeI : sortValue;\n });\n // Remove index from items\n for (i = 0; i < length; i++) {\n delete arr[i].safeI; // stable sort index\n }\n}\n/**\n * Non-recursive method to find the lowest member of an array. `Math.min` raises\n * a maximum call stack size exceeded error in Chrome when trying to apply more\n * than 150.000 points. This method is slightly slower, but safe.\n *\n * @function Highcharts.arrayMin\n *\n * @param {Array<*>} data\n * An array of numbers.\n *\n * @return {number}\n * The lowest number.\n */\nfunction arrayMin(data) {\n let i = data.length, min = data[0];\n while (i--) {\n if (data[i] < min) {\n min = data[i];\n }\n }\n return min;\n}\n/**\n * Non-recursive method to find the lowest member of an array. `Math.max` raises\n * a maximum call stack size exceeded error in Chrome when trying to apply more\n * than 150.000 points. This method is slightly slower, but safe.\n *\n * @function Highcharts.arrayMax\n *\n * @param {Array<*>} data\n * An array of numbers.\n *\n * @return {number}\n * The highest number.\n */\nfunction arrayMax(data) {\n let i = data.length, max = data[0];\n while (i--) {\n if (data[i] > max) {\n max = data[i];\n }\n }\n return max;\n}\n/**\n * Utility method that destroys any SVGElement instances that are properties on\n * the given object. It loops all properties and invokes destroy if there is a\n * destroy method. The property is then delete.\n *\n * @function Highcharts.destroyObjectProperties\n *\n * @param {*} obj\n * The object to destroy properties on.\n *\n * @param {*} [except]\n * Exception, do not destroy this property, only delete it.\n */\nfunction destroyObjectProperties(obj, except, destructablesOnly) {\n objectEach(obj, function (val, n) {\n // If the object is non-null and destroy is defined\n if (val !== except && val?.destroy) {\n // Invoke the destroy\n val.destroy();\n }\n // Delete the property from the object\n if (val?.destroy || !destructablesOnly) {\n delete obj[n];\n }\n });\n}\n/**\n * Discard a HTML element\n *\n * @function Highcharts.discardElement\n *\n * @param {Highcharts.HTMLDOMElement} element\n * The HTML node to discard.\n */\nfunction discardElement(element) {\n if (element && element.parentElement) {\n element.parentElement.removeChild(element);\n }\n}\n/**\n * Fix JS round off float errors.\n *\n * @function Highcharts.correctFloat\n *\n * @param {number} num\n * A float number to fix.\n *\n * @param {number} [prec=14]\n * The precision.\n *\n * @return {number}\n * The corrected float number.\n */\nfunction correctFloat(num, prec) {\n // When the number is higher than 1e14 use the number (#16275)\n return num > 1e14 ? num : parseFloat(num.toPrecision(prec || 14));\n}\n/**\n * The time unit lookup\n *\n * @ignore\n */\nconst timeUnits = {\n millisecond: 1,\n second: 1000,\n minute: 60000,\n hour: 3600000,\n day: 24 * 3600000,\n week: 7 * 24 * 3600000,\n month: 28 * 24 * 3600000,\n year: 364 * 24 * 3600000\n};\n/**\n * Easing definition\n *\n * @private\n * @function Math.easeInOutSine\n *\n * @param {number} pos\n * Current position, ranging from 0 to 1.\n *\n * @return {number}\n * Ease result\n */\nMath.easeInOutSine = function (pos) {\n return -0.5 * (Math.cos(Math.PI * pos) - 1);\n};\n/**\n * Find the closest distance between two values of a two-dimensional array\n * @private\n * @function Highcharts.getClosestDistance\n *\n * @param {Array>} arrays\n * An array of arrays of numbers\n *\n * @return {number | undefined}\n * The closest distance between values\n */\nfunction getClosestDistance(arrays, onError) {\n const allowNegative = !onError;\n let closest, loopLength, distance, i;\n arrays.forEach((xData) => {\n if (xData.length > 1) {\n loopLength = xData.length - 1;\n for (i = loopLength; i > 0; i--) {\n distance = xData[i] - xData[i - 1];\n if (distance < 0 && !allowNegative) {\n onError?.();\n // Only one call\n onError = void 0;\n }\n else if (distance && (typeof closest === 'undefined' || distance < closest)) {\n closest = distance;\n }\n }\n }\n });\n return closest;\n}\n/**\n * Returns the value of a property path on a given object.\n *\n * @private\n * @function getNestedProperty\n *\n * @param {string} path\n * Path to the property, for example `custom.myValue`.\n *\n * @param {unknown} obj\n * Instance containing the property on the specific path.\n *\n * @return {unknown}\n * The unknown property value.\n */\nfunction getNestedProperty(path, parent) {\n const pathElements = path.split('.');\n while (pathElements.length && defined(parent)) {\n const pathElement = pathElements.shift();\n // Filter on the key\n if (typeof pathElement === 'undefined' ||\n pathElement === '__proto__') {\n return; // undefined\n }\n if (pathElement === 'this') {\n let thisProp;\n if (isObject(parent)) {\n thisProp = parent['@this'];\n }\n return thisProp ?? parent;\n }\n const child = parent[pathElement];\n // Filter on the child\n if (!defined(child) ||\n typeof child === 'function' ||\n typeof child.nodeType === 'number' ||\n child === win) {\n return; // undefined\n }\n // Else, proceed\n parent = child;\n }\n return parent;\n}\n/**\n * Get the computed CSS value for given element and property, only for numerical\n * properties. For width and height, the dimension of the inner box (excluding\n * padding) is returned. Used for fitting the chart within the container.\n *\n * @function Highcharts.getStyle\n *\n * @param {Highcharts.HTMLDOMElement} el\n * An HTML element.\n *\n * @param {string} prop\n * The property name.\n *\n * @param {boolean} [toInt=true]\n * Parse to integer.\n *\n * @return {number|string|undefined}\n * The style value.\n */\nfunction getStyle(el, prop, toInt) {\n let style;\n // For width and height, return the actual inner pixel size (#4913)\n if (prop === 'width') {\n let offsetWidth = Math.min(el.offsetWidth, el.scrollWidth);\n // In flex boxes, we need to use getBoundingClientRect and floor it,\n // because scrollWidth doesn't support subpixel precision (#6427) ...\n const boundingClientRectWidth = el.getBoundingClientRect &&\n el.getBoundingClientRect().width;\n // ...unless if the containing div or its parents are transform-scaled\n // down, in which case the boundingClientRect can't be used as it is\n // also scaled down (#9871, #10498).\n if (boundingClientRectWidth < offsetWidth &&\n boundingClientRectWidth >= offsetWidth - 1) {\n offsetWidth = Math.floor(boundingClientRectWidth);\n }\n return Math.max(0, // #8377\n (offsetWidth -\n (getStyle(el, 'padding-left', true) || 0) -\n (getStyle(el, 'padding-right', true) || 0)));\n }\n if (prop === 'height') {\n return Math.max(0, // #8377\n (Math.min(el.offsetHeight, el.scrollHeight) -\n (getStyle(el, 'padding-top', true) || 0) -\n (getStyle(el, 'padding-bottom', true) || 0)));\n }\n // Otherwise, get the computed style\n const css = win.getComputedStyle(el, void 0); // eslint-disable-line no-undefined\n if (css) {\n style = css.getPropertyValue(prop);\n if (pick(toInt, prop !== 'opacity')) {\n style = pInt(style);\n }\n }\n return style;\n}\n/**\n * Search for an item in an array.\n *\n * @function Highcharts.inArray\n *\n * @deprecated\n *\n * @param {*} item\n * The item to search for.\n *\n * @param {Array<*>} arr\n * The array or node collection to search in.\n *\n * @param {number} [fromIndex=0]\n * The index to start searching from.\n *\n * @return {number}\n * The index within the array, or -1 if not found.\n */\nfunction inArray(item, arr, fromIndex) {\n error(32, false, void 0, { 'Highcharts.inArray': 'use Array.indexOf' });\n return arr.indexOf(item, fromIndex);\n}\n/**\n * Return the value of the first element in the array that satisfies the\n * provided testing function.\n *\n * @function Highcharts.find\n *\n * @param {Array} arr\n * The array to test.\n *\n * @param {Function} callback\n * The callback function. The function receives the item as the first\n * argument. Return `true` if this item satisfies the condition.\n *\n * @return {T|undefined}\n * The value of the element.\n */\nconst find = Array.prototype.find ?\n function (arr, callback) {\n return arr.find(callback);\n } :\n // Legacy implementation. PhantomJS, IE <= 11 etc. #7223.\n function (arr, callback) {\n let i;\n const length = arr.length;\n for (i = 0; i < length; i++) {\n if (callback(arr[i], i)) { // eslint-disable-line node/callback-return\n return arr[i];\n }\n }\n };\n/**\n * Returns an array of a given object's own properties.\n *\n * @function Highcharts.keys\n * @deprecated\n *\n * @param {*} obj\n * The object of which the properties are to be returned.\n *\n * @return {Array}\n * An array of strings that represents all the properties.\n */\nfunction keys(obj) {\n error(32, false, void 0, { 'Highcharts.keys': 'use Object.keys' });\n return Object.keys(obj);\n}\n/**\n * Get the element's offset position, corrected for `overflow: auto`.\n *\n * @function Highcharts.offset\n *\n * @param {global.Element} el\n * The DOM element.\n *\n * @return {Highcharts.OffsetObject}\n * An object containing `left` and `top` properties for the position in\n * the page.\n */\nfunction offset(el) {\n const docElem = doc.documentElement, box = (el.parentElement || el.parentNode) ?\n el.getBoundingClientRect() :\n { top: 0, left: 0, width: 0, height: 0 };\n return {\n top: box.top + (win.pageYOffset || docElem.scrollTop) -\n (docElem.clientTop || 0),\n left: box.left + (win.pageXOffset || docElem.scrollLeft) -\n (docElem.clientLeft || 0),\n width: box.width,\n height: box.height\n };\n}\n/* eslint-disable valid-jsdoc */\n/**\n * Iterate over object key pairs in an object.\n *\n * @function Highcharts.objectEach\n *\n * @param {*} obj\n * The object to iterate over.\n *\n * @param {Highcharts.ObjectEachCallbackFunction} fn\n * The iterator callback. It passes three arguments:\n * * value - The property value.\n * * key - The property key.\n * * obj - The object that objectEach is being applied to.\n *\n * @param {T} [ctx]\n * The context.\n */\nfunction objectEach(obj, fn, ctx) {\n /* eslint-enable valid-jsdoc */\n for (const key in obj) {\n if (Object.hasOwnProperty.call(obj, key)) {\n fn.call(ctx || obj[key], obj[key], key, obj);\n }\n }\n}\n/**\n * Iterate over an array.\n *\n * @deprecated\n * @function Highcharts.each\n *\n * @param {Array<*>} arr\n * The array to iterate over.\n *\n * @param {Function} fn\n * The iterator callback. It passes three arguments:\n * - `item`: The array item.\n * - `index`: The item's index in the array.\n * - `arr`: The array that each is being applied to.\n *\n * @param {*} [ctx]\n * The context.\n *\n * @return {void}\n */\n/**\n * Filter an array by a callback.\n *\n * @deprecated\n * @function Highcharts.grep\n *\n * @param {Array<*>} arr\n * The array to filter.\n *\n * @param {Function} callback\n * The callback function. The function receives the item as the first\n * argument. Return `true` if the item is to be preserved.\n *\n * @return {Array<*>}\n * A new, filtered array.\n */\n/**\n * Map an array by a callback.\n *\n * @deprecated\n * @function Highcharts.map\n *\n * @param {Array<*>} arr\n * The array to map.\n *\n * @param {Function} fn\n * The callback function. Return the new value for the new array.\n *\n * @return {Array<*>}\n * A new array item with modified items.\n */\n/**\n * Reduce an array to a single value.\n *\n * @deprecated\n * @function Highcharts.reduce\n *\n * @param {Array<*>} arr\n * The array to reduce.\n *\n * @param {Function} fn\n * The callback function. Return the reduced value. Receives 4\n * arguments: Accumulated/reduced value, current value, current array\n * index, and the array.\n *\n * @param {*} initialValue\n * The initial value of the accumulator.\n *\n * @return {*}\n * The reduced value.\n */\n/**\n * Test whether at least one element in the array passes the test implemented by\n * the provided function.\n *\n * @deprecated\n * @function Highcharts.some\n *\n * @param {Array<*>} arr\n * The array to test\n *\n * @param {Function} fn\n * The function to run on each item. Return truthy to pass the test.\n * Receives arguments `currentValue`, `index` and `array`.\n *\n * @param {*} ctx\n * The context.\n *\n * @return {boolean}\n */\nobjectEach({\n map: 'map',\n each: 'forEach',\n grep: 'filter',\n reduce: 'reduce',\n some: 'some'\n}, function (val, key) {\n H[key] = function (arr) {\n error(32, false, void 0, { [`Highcharts.${key}`]: `use Array.${val}` });\n return Array.prototype[val].apply(arr, [].slice.call(arguments, 1));\n };\n});\n/* eslint-disable valid-jsdoc */\n/**\n * Add an event listener.\n *\n * @function Highcharts.addEvent\n *\n * @param {Highcharts.Class|T} el\n * The element or object to add a listener to. It can be a\n * {@link HTMLDOMElement}, an {@link SVGElement} or any other object.\n *\n * @param {string} type\n * The event type.\n *\n * @param {Highcharts.EventCallbackFunction|Function} fn\n * The function callback to execute when the event is fired.\n *\n * @param {Highcharts.EventOptionsObject} [options]\n * Options for adding the event.\n *\n * @sample highcharts/members/addevent\n * Use a general `render` event to draw shapes on a chart\n *\n * @return {Function}\n * A callback function to remove the added event.\n */\nfunction addEvent(el, type, fn, options = {}) {\n /* eslint-enable valid-jsdoc */\n // Add hcEvents to either the prototype (in case we're running addEvent on a\n // class) or the instance. If hasOwnProperty('hcEvents') is false, it is\n // inherited down the prototype chain, in which case we need to set the\n // property on this instance (which may itself be a prototype).\n const owner = typeof el === 'function' && el.prototype || el;\n if (!Object.hasOwnProperty.call(owner, 'hcEvents')) {\n owner.hcEvents = {};\n }\n const events = owner.hcEvents;\n // Allow click events added to points, otherwise they will be prevented by\n // the TouchPointer.pinch function after a pinch zoom operation (#7091).\n if (H.Point && // without H a dependency loop occurs\n el instanceof H.Point &&\n el.series &&\n el.series.chart) {\n el.series.chart.runTrackerClick = true;\n }\n // Handle DOM events\n // If the browser supports passive events, add it to improve performance\n // on touch events (#11353).\n const addEventListener = el.addEventListener;\n if (addEventListener) {\n addEventListener.call(el, type, fn, H.supportsPassiveEvents ? {\n passive: options.passive === void 0 ?\n type.indexOf('touch') !== -1 : options.passive,\n capture: false\n } : false);\n }\n if (!events[type]) {\n events[type] = [];\n }\n const eventObject = {\n fn,\n order: typeof options.order === 'number' ? options.order : Infinity\n };\n events[type].push(eventObject);\n // Order the calls\n events[type].sort((a, b) => a.order - b.order);\n // Return a function that can be called to remove this event.\n return function () {\n removeEvent(el, type, fn);\n };\n}\n/* eslint-disable valid-jsdoc */\n/**\n * Remove an event that was added with {@link Highcharts#addEvent}.\n *\n * @function Highcharts.removeEvent\n *\n * @param {Highcharts.Class|T} el\n * The element to remove events on.\n *\n * @param {string} [type]\n * The type of events to remove. If undefined, all events are removed\n * from the element.\n *\n * @param {Highcharts.EventCallbackFunction} [fn]\n * The specific callback to remove. If undefined, all events that match\n * the element and optionally the type are removed.\n *\n * @return {void}\n */\nfunction removeEvent(el, type, fn) {\n /* eslint-enable valid-jsdoc */\n /**\n * @private\n */\n function removeOneEvent(type, fn) {\n const removeEventListener = el.removeEventListener;\n if (removeEventListener) {\n removeEventListener.call(el, type, fn, false);\n }\n }\n /**\n * @private\n */\n function removeAllEvents(eventCollection) {\n let types, len;\n if (!el.nodeName) {\n return; // break on non-DOM events\n }\n if (type) {\n types = {};\n types[type] = true;\n }\n else {\n types = eventCollection;\n }\n objectEach(types, function (_val, n) {\n if (eventCollection[n]) {\n len = eventCollection[n].length;\n while (len--) {\n removeOneEvent(n, eventCollection[n][len].fn);\n }\n }\n });\n }\n const owner = typeof el === 'function' && el.prototype || el;\n if (Object.hasOwnProperty.call(owner, 'hcEvents')) {\n const events = owner.hcEvents;\n if (type) {\n const typeEvents = (events[type] || []);\n if (fn) {\n events[type] = typeEvents.filter(function (obj) {\n return fn !== obj.fn;\n });\n removeOneEvent(type, fn);\n }\n else {\n removeAllEvents(events);\n events[type] = [];\n }\n }\n else {\n removeAllEvents(events);\n delete owner.hcEvents;\n }\n }\n}\n/* eslint-disable valid-jsdoc */\n/**\n * Fire an event that was registered with {@link Highcharts#addEvent}.\n *\n * @function Highcharts.fireEvent\n *\n * @param {T} el\n * The object to fire the event on. It can be a {@link HTMLDOMElement},\n * an {@link SVGElement} or any other object.\n *\n * @param {string} type\n * The type of event.\n *\n * @param {Highcharts.Dictionary<*>|Event} [eventArguments]\n * Custom event arguments that are passed on as an argument to the event\n * handler.\n *\n * @param {Highcharts.EventCallbackFunction|Function} [defaultFunction]\n * The default function to execute if the other listeners haven't\n * returned false.\n *\n * @return {void}\n */\nfunction fireEvent(el, type, eventArguments, defaultFunction) {\n /* eslint-enable valid-jsdoc */\n eventArguments = eventArguments || {};\n if (doc.createEvent &&\n (el.dispatchEvent ||\n (el.fireEvent &&\n // Enable firing events on Highcharts instance.\n el !== H))) {\n const e = doc.createEvent('Events');\n e.initEvent(type, true, true);\n eventArguments = extend(e, eventArguments);\n if (el.dispatchEvent) {\n el.dispatchEvent(eventArguments);\n }\n else {\n el.fireEvent(type, eventArguments);\n }\n }\n else if (el.hcEvents) {\n if (!eventArguments.target) {\n // We're running a custom event\n extend(eventArguments, {\n // Attach a simple preventDefault function to skip\n // default handler if called. The built-in\n // defaultPrevented property is not overwritable (#5112)\n preventDefault: function () {\n eventArguments.defaultPrevented = true;\n },\n // Setting target to native events fails with clicking\n // the zoom-out button in Chrome.\n target: el,\n // If the type is not set, we're running a custom event\n // (#2297). If it is set, we're running a browser event.\n type: type\n });\n }\n const events = [];\n let object = el;\n let multilevel = false;\n // Recurse up the inheritance chain and collect hcEvents set as own\n // objects on the prototypes.\n while (object.hcEvents) {\n if (Object.hasOwnProperty.call(object, 'hcEvents') &&\n object.hcEvents[type]) {\n if (events.length) {\n multilevel = true;\n }\n events.unshift.apply(events, object.hcEvents[type]);\n }\n object = Object.getPrototypeOf(object);\n }\n // For performance reasons, only sort the event handlers in case we are\n // dealing with multiple levels in the prototype chain. Otherwise, the\n // events are already sorted in the addEvent function.\n if (multilevel) {\n // Order the calls\n events.sort((a, b) => a.order - b.order);\n }\n // Call the collected event handlers\n events.forEach((obj) => {\n // If the event handler returns false, prevent the default handler\n // from executing\n if (obj.fn.call(el, eventArguments) === false) {\n eventArguments.preventDefault();\n }\n });\n }\n // Run the default if not prevented\n if (defaultFunction && !eventArguments.defaultPrevented) {\n defaultFunction.call(el, eventArguments);\n }\n}\nlet serialMode;\n/**\n * Get a unique key for using in internal element id's and pointers. The key is\n * composed of a random hash specific to this Highcharts instance, and a\n * counter.\n *\n * @example\n * let id = uniqueKey(); // => 'highcharts-x45f6hp-0'\n *\n * @function Highcharts.uniqueKey\n *\n * @return {string}\n * A unique key.\n */\nconst uniqueKey = (function () {\n const hash = Math.random().toString(36).substring(2, 9) + '-';\n let id = 0;\n return function () {\n return 'highcharts-' + (serialMode ? '' : hash) + id++;\n };\n}());\n/**\n * Activates a serial mode for element IDs provided by\n * {@link Highcharts.uniqueKey}. This mode can be used in automated tests, where\n * a simple comparison of two rendered SVG graphics is needed.\n *\n * **Note:** This is only for testing purposes and will break functionality in\n * webpages with multiple charts.\n *\n * @example\n * if (\n * process &&\n * process.env.NODE_ENV === 'development'\n * ) {\n * Highcharts.useSerialIds(true);\n * }\n *\n * @function Highcharts.useSerialIds\n *\n * @param {boolean} [mode]\n * Changes the state of serial mode.\n *\n * @return {boolean|undefined}\n * State of the serial mode.\n */\nfunction useSerialIds(mode) {\n return (serialMode = pick(mode, serialMode));\n}\nfunction isFunction(obj) {\n return typeof obj === 'function';\n}\n// Register Highcharts as a plugin in jQuery\nif (win.jQuery) {\n /**\n * Highcharts-extended JQuery.\n *\n * @external JQuery\n */\n /**\n * Helper function to return the chart of the current JQuery selector\n * element.\n *\n * @function external:JQuery#highcharts\n *\n * @return {Highcharts.Chart}\n * The chart that is linked to the JQuery selector element.\n */ /**\n * Factory function to create a chart in the current JQuery selector\n * element.\n *\n * @function external:JQuery#highcharts\n *\n * @param {'Chart'|'Map'|'StockChart'|string} [className]\n * Name of the factory class in the Highcharts namespace.\n *\n * @param {Highcharts.Options} [options]\n * The chart options structure.\n *\n * @param {Highcharts.ChartCallbackFunction} [callback]\n * Function to run when the chart has loaded and all external\n * images are loaded. Defining a\n * [chart.events.load](https://api.highcharts.com/highcharts/chart.events.load)\n * handler is equivalent.\n *\n * @return {JQuery}\n * The current JQuery selector.\n */\n win.jQuery.fn.highcharts = function () {\n const args = [].slice.call(arguments);\n if (this[0]) { // this[0] is the renderTo div\n // Create the chart\n if (args[0]) {\n new H[ // eslint-disable-line computed-property-spacing, no-new\n // Constructor defaults to Chart\n isString(args[0]) ? args.shift() : 'Chart'](this[0], args[0], args[1]);\n return this;\n }\n // When called without parameters or with the return argument,\n // return an existing chart\n return charts[attr(this[0], 'data-highcharts-chart')];\n }\n };\n}\n/* *\n *\n * Default Export\n *\n * */\n// TODO use named exports when supported.\nconst Utilities = {\n addEvent,\n arrayMax,\n arrayMin,\n attr,\n clamp,\n clearTimeout: internalClearTimeout,\n correctFloat,\n createElement,\n css,\n defined,\n destroyObjectProperties,\n diffObjects,\n discardElement,\n erase,\n error,\n extend,\n extendClass,\n find,\n fireEvent,\n getClosestDistance,\n getMagnitude,\n getNestedProperty,\n getStyle,\n inArray,\n insertItem,\n isArray,\n isClass,\n isDOMElement,\n isFunction,\n isNumber,\n isObject,\n isString,\n keys,\n merge,\n normalizeTickInterval,\n objectEach,\n offset,\n pad,\n pick,\n pInt,\n pushUnique,\n relativeLength,\n removeEvent,\n replaceNested,\n splat,\n stableSort,\n syncTimeout,\n timeUnits,\n uniqueKey,\n useSerialIds,\n wrap\n};\nexport default Utilities;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * An animation configuration. Animation configurations can also be defined as\n * booleans, where `false` turns off animation and `true` defaults to a duration\n * of 500ms and defer of 0ms.\n *\n * @interface Highcharts.AnimationOptionsObject\n */ /**\n* A callback function to execute when the animation finishes.\n* @name Highcharts.AnimationOptionsObject#complete\n* @type {Function|undefined}\n*/ /**\n* The animation defer in milliseconds.\n* @name Highcharts.AnimationOptionsObject#defer\n* @type {number|undefined}\n*/ /**\n* The animation duration in milliseconds.\n* @name Highcharts.AnimationOptionsObject#duration\n* @type {number|undefined}\n*/ /**\n* The name of an easing function as defined on the `Math` object.\n* @name Highcharts.AnimationOptionsObject#easing\n* @type {string|Function|undefined}\n*/ /**\n* A callback function to execute on each step of each attribute or CSS property\n* that's being animated. The first argument contains information about the\n* animation and progress.\n* @name Highcharts.AnimationOptionsObject#step\n* @type {Function|undefined}\n*/\n/**\n * Creates a frame for the animated SVG element.\n *\n * @callback Highcharts.AnimationStepCallbackFunction\n *\n * @param {Highcharts.SVGElement} this\n * The SVG element to animate.\n *\n * @return {void}\n */\n/**\n * Interface description for a class.\n *\n * @interface Highcharts.Class\n * @extends Function\n */ /**\n* Class constructor.\n* @function Highcharts.Class#new\n* @param {...Array<*>} args\n* Constructor arguments.\n* @return {T}\n* Class instance.\n*/\n/**\n * A style object with camel case property names to define visual appearance of\n * a SVG element or HTML element. The properties can be whatever styles are\n * supported on the given SVG or HTML element.\n *\n * @example\n * {\n * fontFamily: 'monospace',\n * fontSize: '1.2em'\n * }\n *\n * @interface Highcharts.CSSObject\n */ /**\n* @name Highcharts.CSSObject#[key:string]\n* @type {boolean|number|string|undefined}\n*/ /**\n* Background style for the element.\n* @name Highcharts.CSSObject#background\n* @type {string|undefined}\n*/ /**\n* Background color of the element.\n* @name Highcharts.CSSObject#backgroundColor\n* @type {Highcharts.ColorString|undefined}\n*/ /**\n* Border style for the element.\n* @name Highcharts.CSSObject#border\n* @type {string|undefined}\n*/ /**\n* Radius of the element border.\n* @name Highcharts.CSSObject#borderRadius\n* @type {number|undefined}\n*/ /**\n* Color used in the element. The 'contrast' option is a Highcharts custom\n* property that results in black or white, depending on the background of the\n* element.\n* @name Highcharts.CSSObject#color\n* @type {'contrast'|Highcharts.ColorString|undefined}\n*/ /**\n* Style of the mouse cursor when resting over the element.\n* @name Highcharts.CSSObject#cursor\n* @type {Highcharts.CursorValue|undefined}\n*/ /**\n* Font family of the element text. Multiple values have to be in decreasing\n* preference order and separated by comma.\n* @name Highcharts.CSSObject#fontFamily\n* @type {string|undefined}\n*/ /**\n* Font size of the element text.\n* @name Highcharts.CSSObject#fontSize\n* @type {string|undefined}\n*/ /**\n* Font weight of the element text.\n* @name Highcharts.CSSObject#fontWeight\n* @type {string|undefined}\n*/ /**\n* Height of the element.\n* @name Highcharts.CSSObject#height\n* @type {number|undefined}\n*/ /**\n* Width of the element border.\n* @name Highcharts.CSSObject#lineWidth\n* @type {number|undefined}\n*/ /**\n* Opacity of the element.\n* @name Highcharts.CSSObject#opacity\n* @type {number|undefined}\n*/ /**\n* Space around the element content.\n* @name Highcharts.CSSObject#padding\n* @type {string|undefined}\n*/ /**\n* Behaviour of the element when the mouse cursor rests over it.\n* @name Highcharts.CSSObject#pointerEvents\n* @type {string|undefined}\n*/ /**\n* Positioning of the element.\n* @name Highcharts.CSSObject#position\n* @type {string|undefined}\n*/ /**\n* Alignment of the element text.\n* @name Highcharts.CSSObject#textAlign\n* @type {string|undefined}\n*/ /**\n* Additional decoration of the element text.\n* @name Highcharts.CSSObject#textDecoration\n* @type {string|undefined}\n*/ /**\n* Outline style of the element text.\n* @name Highcharts.CSSObject#textOutline\n* @type {string|undefined}\n*/ /**\n* Line break style of the element text. Highcharts SVG elements support\n* `ellipsis` when a `width` is set.\n* @name Highcharts.CSSObject#textOverflow\n* @type {string|undefined}\n*/ /**\n* Top spacing of the element relative to the parent element.\n* @name Highcharts.CSSObject#top\n* @type {string|undefined}\n*/ /**\n* Animated transition of selected element properties.\n* @name Highcharts.CSSObject#transition\n* @type {string|undefined}\n*/ /**\n* Line break style of the element text.\n* @name Highcharts.CSSObject#whiteSpace\n* @type {string|undefined}\n*/ /**\n* Width of the element.\n* @name Highcharts.CSSObject#width\n* @type {number|undefined}\n*/\n/**\n * All possible cursor styles.\n *\n * @typedef {'alias'|'all-scroll'|'auto'|'cell'|'col-resize'|'context-menu'|'copy'|'crosshair'|'default'|'e-resize'|'ew-resize'|'grab'|'grabbing'|'help'|'move'|'n-resize'|'ne-resize'|'nesw-resize'|'no-drop'|'none'|'not-allowed'|'ns-resize'|'nw-resize'|'nwse-resize'|'pointer'|'progress'|'row-resize'|'s-resize'|'se-resize'|'sw-resize'|'text'|'vertical-text'|'w-resize'|'wait'|'zoom-in'|'zoom-out'} Highcharts.CursorValue\n */\n/**\n * All possible dash styles.\n *\n * @typedef {'Dash'|'DashDot'|'Dot'|'LongDash'|'LongDashDot'|'LongDashDotDot'|'ShortDash'|'ShortDashDot'|'ShortDashDotDot'|'ShortDot'|'Solid'} Highcharts.DashStyleValue\n */\n/**\n * Generic dictionary in TypeScript notation.\n * Use the native `AnyRecord` instead.\n *\n * @deprecated\n * @interface Highcharts.Dictionary\n */ /**\n* @name Highcharts.Dictionary#[key:string]\n* @type {T}\n*/\n/**\n * The function callback to execute when the event is fired. The `this` context\n * contains the instance, that fired the event.\n *\n * @callback Highcharts.EventCallbackFunction\n *\n * @param {T} this\n *\n * @param {Highcharts.Dictionary<*>|Event} [eventArguments]\n * Event arguments.\n *\n * @return {boolean|void}\n */\n/**\n * The event options for adding function callback.\n *\n * @interface Highcharts.EventOptionsObject\n */ /**\n* The order the event handler should be called. This opens for having one\n* handler be called before another, independent of in which order they were\n* added.\n* @name Highcharts.EventOptionsObject#order\n* @type {number}\n*/ /**\n* Whether an event should be passive or not.\n* When set to `true`, the function specified by listener will never call\n* `preventDefault()`.\n* @name Highcharts.EventOptionsObject#passive\n* @type boolean\n*/\n/**\n * Formats data as a string. Usually the data is accessible through the `this`\n * keyword.\n *\n * @callback Highcharts.FormatterCallbackFunction\n *\n * @param {T} this\n * Context to format\n *\n * @return {string}\n * Formatted text\n */\n/**\n * An object of key-value pairs for HTML attributes.\n *\n * @typedef {Highcharts.Dictionary} Highcharts.HTMLAttributes\n */\n/**\n * An HTML DOM element. The type is a reference to the regular HTMLElement in\n * the global scope.\n *\n * @typedef {global.HTMLElement} Highcharts.HTMLDOMElement\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement\n */\n/**\n * The iterator callback.\n *\n * @callback Highcharts.ObjectEachCallbackFunction\n *\n * @param {T} this\n * The context.\n *\n * @param {*} value\n * The property value.\n *\n * @param {string} key\n * The property key.\n *\n * @param {*} obj\n * The object that objectEach is being applied to.\n */\n/**\n * An object containing `left` and `top` properties for the position in the\n * page.\n *\n * @interface Highcharts.OffsetObject\n */ /**\n* Left distance to the page border.\n* @name Highcharts.OffsetObject#left\n* @type {number}\n*/ /**\n* Top distance to the page border.\n* @name Highcharts.OffsetObject#top\n* @type {number}\n*/\n/**\n * Describes a range.\n *\n * @interface Highcharts.RangeObject\n */ /**\n* Maximum number of the range.\n* @name Highcharts.RangeObject#max\n* @type {number}\n*/ /**\n* Minimum number of the range.\n* @name Highcharts.RangeObject#min\n* @type {number}\n*/\n/**\n * If a number is given, it defines the pixel length. If a percentage string is\n * given, like for example `'50%'`, the setting defines a length relative to a\n * base size, for example the size of a container.\n *\n * @typedef {number|string} Highcharts.RelativeSize\n */\n/**\n * Proceed function to call original (wrapped) function.\n *\n * @callback Highcharts.WrapProceedFunction\n *\n * @param {*} [arg1]\n * Optional argument. Without any arguments defaults to first argument of\n * the wrapping function.\n *\n * @param {*} [arg2]\n * Optional argument. Without any arguments defaults to second argument\n * of the wrapping function.\n *\n * @param {*} [arg3]\n * Optional argument. Without any arguments defaults to third argument of\n * the wrapping function.\n *\n * @return {*}\n * Return value of the original function.\n */\n/**\n * The Highcharts object is the placeholder for all other members, and various\n * utility functions. The most important member of the namespace would be the\n * chart constructor.\n *\n * @example\n * let chart = Highcharts.chart('container', { ... });\n *\n * @namespace Highcharts\n */\n''; // detach doclets above\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * General options for the chart.\n *\n * @optionparent chart\n */\nconst ChartDefaults = {\n /**\n * Default `mapData` for all series, in terms of a GeoJSON or TopoJSON\n * object. If set to a string, it functions as an index into the\n * `Highcharts.maps` array.\n *\n * For picking out individual shapes and geometries to use for each series\n * of the map, see [series.mapData](#series.map.mapData).\n *\n * @sample maps/demo/geojson\n * Loading GeoJSON data\n * @sample maps/chart/topojson\n * Loading TopoJSON data\n *\n * @type {string|Array<*>|Highcharts.GeoJSON|Highcharts.TopoJSON}\n * @since 5.0.0\n * @product highmaps\n * @apioption chart.map\n */\n /**\n * Set lat/lon transformation definitions for the chart. If not defined,\n * these are extracted from the map data.\n *\n * @type {*}\n * @since 5.0.0\n * @product highmaps\n * @apioption chart.mapTransforms\n */\n /**\n * When using multiple axes, the ticks of two or more opposite axes\n * will automatically be aligned by adding ticks to the axis or axes\n * with the least ticks, as if `tickAmount` were specified.\n *\n * This can be prevented by setting `alignTicks` to false. If the grid\n * lines look messy, it's a good idea to hide them for the secondary\n * axis by setting `gridLineWidth` to 0.\n *\n * If `startOnTick` or `endOnTick` in the axis options are set to false,\n * then the `alignTicks ` will be disabled for the axis.\n *\n * Disabled for logarithmic axes.\n *\n * @sample {highcharts} highcharts/chart/alignticks-true/\n * True by default\n * @sample {highcharts} highcharts/chart/alignticks-false/\n * False\n * @sample {highstock} stock/chart/alignticks-true/\n * True by default\n * @sample {highstock} stock/chart/alignticks-false/\n * False\n *\n * @type {boolean}\n * @default true\n * @product highcharts highstock gantt\n * @apioption chart.alignTicks\n */\n /**\n * When using multiple axes, align the thresholds. When this is true, other\n * ticks will also be aligned.\n *\n * Note that for line series and some other series types, the `threshold`\n * option is set to `null` by default. This will in turn cause their y-axis\n * to not have a threshold. In order to avoid that, set the series\n * `threshold` to 0 or another number.\n *\n * If `startOnTick` or `endOnTick` in the axis options are set to false, or\n * if the axis is logarithmic, the threshold will not be aligned.\n *\n * @sample {highcharts} highcharts/chart/alignthresholds/ Set to true\n *\n * @since 10.0.0\n * @product highcharts highstock gantt\n * @apioption chart.alignThresholds\n */\n alignThresholds: false,\n /**\n * Set the overall animation for all chart updating. Animation can be\n * disabled throughout the chart by setting it to false here. It can\n * be overridden for each individual API method as a function parameter.\n * The only animation not affected by this option is the initial series\n * animation, see [plotOptions.series.animation](\n * #plotOptions.series.animation).\n *\n * The animation can either be set as a boolean or a configuration\n * object. If `true`, it will use the 'swing' jQuery easing and a\n * duration of 500 ms. If used as a configuration object, the following\n * properties are supported:\n *\n * - `defer`: The animation delay time in milliseconds.\n *\n * - `duration`: The duration of the animation in milliseconds.\n *\n * - `easing`: A string reference to an easing function set on the\n * `Math` object. See\n * [the easing demo](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-animation-easing/).\n *\n * When zooming on a series with less than 100 points, the chart redraw\n * will be done with animation, but in case of more data points, it is\n * necessary to set this option to ensure animation on zoom.\n *\n * @sample {highcharts} highcharts/chart/animation-none/\n * Updating with no animation\n * @sample {highcharts} highcharts/chart/animation-duration/\n * With a longer duration\n * @sample {highcharts} highcharts/chart/animation-easing/\n * With a jQuery UI easing\n * @sample {highmaps} maps/chart/animation-none/\n * Updating with no animation\n * @sample {highmaps} maps/chart/animation-duration/\n * With a longer duration\n *\n * @type {boolean|Partial}\n * @default true\n * @apioption chart.animation\n */\n /**\n * A CSS class name to apply to the charts container `div`, allowing\n * unique CSS styling for each chart.\n *\n * @type {string}\n * @apioption chart.className\n */\n /**\n * Event listeners for the chart.\n *\n * @apioption chart.events\n */\n /**\n * Fires when a series is added to the chart after load time, using the\n * `addSeries` method. One parameter, `event`, is passed to the\n * function, containing common event information. Through\n * `event.options` you can access the series options that were passed to\n * the `addSeries` method. Returning false prevents the series from\n * being added.\n *\n * @sample {highcharts} highcharts/chart/events-addseries/\n * Alert on add series\n * @sample {highstock} stock/chart/events-addseries/\n * Alert on add series\n *\n * @type {Highcharts.ChartAddSeriesCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Chart\n * @apioption chart.events.addSeries\n */\n /**\n * Fires when clicking on the plot background. One parameter, `event`,\n * is passed to the function, containing common event information.\n *\n * Information on the clicked spot can be found through `event.xAxis`\n * and `event.yAxis`, which are arrays containing the axes of each\n * dimension and each axis' value at the clicked spot. The primary axes\n * are `event.xAxis[0]` and `event.yAxis[0]`. Remember the unit of a\n * datetime axis is milliseconds since 1970-01-01 00:00:00.\n *\n * ```js\n * click: function(e) {\n * console.log(\n * Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', e.xAxis[0].value),\n * e.yAxis[0].value\n * )\n * }\n * ```\n *\n * @sample {highcharts} highcharts/chart/events-click/\n * Alert coordinates on click\n * @sample {highcharts} highcharts/chart/events-container/\n * Alternatively, attach event to container\n * @sample {highstock} stock/chart/events-click/\n * Alert coordinates on click\n * @sample {highstock} highcharts/chart/events-container/\n * Alternatively, attach event to container\n * @sample {highmaps} maps/chart/events-click/\n * Record coordinates on click\n * @sample {highmaps} highcharts/chart/events-container/\n * Alternatively, attach event to container\n *\n * @type {Highcharts.ChartClickCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Chart\n * @apioption chart.events.click\n */\n /**\n * Fires when the chart is finished loading. Since v4.2.2, it also waits\n * for images to be loaded, for example from point markers. One\n * parameter, `event`, is passed to the function, containing common\n * event information.\n *\n * There is also a second parameter to the chart constructor where a\n * callback function can be passed to be executed on chart.load.\n *\n * @sample {highcharts} highcharts/chart/events-load/\n * Alert on chart load\n * @sample {highcharts} highcharts/chart/events-render/\n * Load vs Redraw vs Render\n * @sample {highstock} stock/chart/events-load/\n * Alert on chart load\n * @sample {highmaps} maps/chart/events-load/\n * Add series on chart load\n *\n * @type {Highcharts.ChartLoadCallbackFunction}\n * @context Highcharts.Chart\n * @apioption chart.events.load\n */\n /**\n * Fires when the chart is redrawn, either after a call to\n * `chart.redraw()` or after an axis, series or point is modified with\n * the `redraw` option set to `true`. One parameter, `event`, is passed\n * to the function, containing common event information.\n *\n * @sample {highcharts} highcharts/chart/events-redraw/\n * Alert on chart redraw\n * @sample {highcharts} highcharts/chart/events-render/\n * Load vs Redraw vs Render\n * @sample {highstock} stock/chart/events-redraw/\n * Alert on chart redraw when adding a series or moving the\n * zoomed range\n * @sample {highmaps} maps/chart/events-redraw/\n * Set subtitle on chart redraw\n *\n * @type {Highcharts.ChartRedrawCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Chart\n * @apioption chart.events.redraw\n */\n /**\n * Fires after initial load of the chart (directly after the `load`\n * event), and after each redraw (directly after the `redraw` event).\n *\n * @sample {highcharts} highcharts/chart/events-render/\n * Load vs Redraw vs Render\n *\n * @type {Highcharts.ChartRenderCallbackFunction}\n * @since 5.0.7\n * @context Highcharts.Chart\n * @apioption chart.events.render\n */\n /**\n * Fires when an area of the chart has been selected. Selection is\n * enabled by setting the chart's zoomType. One parameter, `event`, is\n * passed to the function, containing common event information. The\n * default action for the selection event is to zoom the chart to the\n * selected area. It can be prevented by calling\n * `event.preventDefault()` or return false.\n *\n * Information on the selected area can be found through `event.xAxis`\n * and `event.yAxis`, which are arrays containing the axes of each\n * dimension and each axis' min and max values. The primary axes are\n * `event.xAxis[0]` and `event.yAxis[0]`. Remember the unit of a\n * datetime axis is milliseconds since 1970-01-01 00:00:00.\n *\n * ```js\n * selection: function(event) {\n * // log the min and max of the primary, datetime x-axis\n * console.log(\n * Highcharts.dateFormat(\n * '%Y-%m-%d %H:%M:%S',\n * event.xAxis[0].min\n * ),\n * Highcharts.dateFormat(\n * '%Y-%m-%d %H:%M:%S',\n * event.xAxis[0].max\n * )\n * );\n * // log the min and max of the y axis\n * console.log(event.yAxis[0].min, event.yAxis[0].max);\n * }\n * ```\n *\n * @sample {highcharts} highcharts/chart/events-selection/\n * Report on selection and reset\n * @sample {highcharts} highcharts/chart/events-selection-points/\n * Select a range of points through a drag selection\n * @sample {highstock} stock/chart/events-selection/\n * Report on selection and reset\n * @sample {highstock} highcharts/chart/events-selection-points/\n * Select a range of points through a drag selection\n * (Highcharts)\n *\n * @type {Highcharts.ChartSelectionCallbackFunction}\n * @apioption chart.events.selection\n */\n /**\n * The margin between the outer edge of the chart and the plot area.\n * The numbers in the array designate top, right, bottom and left\n * respectively. Use the options `marginTop`, `marginRight`,\n * `marginBottom` and `marginLeft` for shorthand setting of one option.\n *\n * By default there is no margin. The actual space is dynamically\n * calculated from the offset of axis labels, axis title, title,\n * subtitle and legend in addition to the `spacingTop`, `spacingRight`,\n * `spacingBottom` and `spacingLeft` options.\n *\n * @sample {highcharts} highcharts/chart/margins-zero/\n * Zero margins\n * @sample {highstock} stock/chart/margin-zero/\n * Zero margins\n *\n * @type {number|Array}\n * @apioption chart.margin\n */\n /**\n * The margin between the bottom outer edge of the chart and the plot\n * area. Use this to set a fixed pixel value for the margin as opposed\n * to the default dynamic margin. See also `spacingBottom`.\n *\n * @sample {highcharts} highcharts/chart/marginbottom/\n * 100px bottom margin\n * @sample {highstock} stock/chart/marginbottom/\n * 100px bottom margin\n * @sample {highmaps} maps/chart/margin/\n * 100px margins\n *\n * @type {number}\n * @since 2.0\n * @apioption chart.marginBottom\n */\n /**\n * The margin between the left outer edge of the chart and the plot\n * area. Use this to set a fixed pixel value for the margin as opposed\n * to the default dynamic margin. See also `spacingLeft`.\n *\n * @sample {highcharts} highcharts/chart/marginleft/\n * 150px left margin\n * @sample {highstock} stock/chart/marginleft/\n * 150px left margin\n * @sample {highmaps} maps/chart/margin/\n * 100px margins\n *\n * @type {number}\n * @since 2.0\n * @apioption chart.marginLeft\n */\n /**\n * The margin between the right outer edge of the chart and the plot\n * area. Use this to set a fixed pixel value for the margin as opposed\n * to the default dynamic margin. See also `spacingRight`.\n *\n * @sample {highcharts} highcharts/chart/marginright/\n * 100px right margin\n * @sample {highstock} stock/chart/marginright/\n * 100px right margin\n * @sample {highmaps} maps/chart/margin/\n * 100px margins\n *\n * @type {number}\n * @since 2.0\n * @apioption chart.marginRight\n */\n /**\n * The margin between the top outer edge of the chart and the plot area.\n * Use this to set a fixed pixel value for the margin as opposed to\n * the default dynamic margin. See also `spacingTop`.\n *\n * @sample {highcharts} highcharts/chart/margintop/ 100px top margin\n * @sample {highstock} stock/chart/margintop/\n * 100px top margin\n * @sample {highmaps} maps/chart/margin/\n * 100px margins\n *\n * @type {number}\n * @since 2.0\n * @apioption chart.marginTop\n */\n /**\n * Callback function to override the default function that formats all\n * the numbers in the chart. Returns a string with the formatted number.\n *\n * @sample highcharts/members/highcharts-numberformat\n * Arabic digits in Highcharts\n * @type {Highcharts.NumberFormatterCallbackFunction}\n * @since 8.0.0\n * @apioption chart.numberFormatter\n */\n /**\n * When a chart with an x and a y-axis is rendered, we first pre-render the\n * labels of both in order to measure them. Then, if either of the axis\n * labels take up so much space that it significantly affects the length of\n * the other axis, we repeat the process.\n *\n * By default we stop at two axis layout runs, but it may be that the second\n * run also alter the space required by either axis, for example if it\n * causes the labels to rotate. In this situation, a subsequent redraw of\n * the chart may cause the tick and label placement to change for apparently\n * no reason.\n *\n * Use the `axisLayoutRuns` option to set the maximum allowed number of\n * repetitions. But keep in mind that the default value of 2 is set because\n * every run costs performance time.\n *\n * **Note:** Changing that option to higher than the default might decrease\n * performance significantly, especially with bigger sets of data.\n *\n * @type {number}\n * @default 2\n * @since @next\n * @apioption chart.axisLayoutRuns\n */\n /**\n * Allows setting a key to switch between zooming and panning. Can be\n * one of `alt`, `ctrl`, `meta` (the command key on Mac and Windows\n * key on Windows) or `shift`. The keys are mapped directly to the key\n * properties of the click event argument (`event.altKey`,\n * `event.ctrlKey`, `event.metaKey` and `event.shiftKey`).\n *\n * @type {string}\n * @since 4.0.3\n * @product highcharts gantt\n * @validvalue [\"alt\", \"ctrl\", \"meta\", \"shift\"]\n * @apioption chart.panKey\n */\n /**\n * Allow panning in a chart. Best used with [panKey](#chart.panKey)\n * to combine zooming and panning.\n *\n * On touch devices, when the [tooltip.followTouchMove](\n * #tooltip.followTouchMove) option is `true` (default), panning\n * requires two fingers. To allow panning with one finger, set\n * `followTouchMove` to `false`.\n *\n * @sample {highcharts} highcharts/chart/pankey/ Zooming and panning\n * @sample {highstock} stock/chart/panning/ Zooming and xy panning\n */\n panning: {\n /**\n * Enable or disable chart panning.\n *\n * @type {boolean}\n * @default {highcharts} false\n * @default {highstock|highmaps} true\n */\n enabled: false,\n /**\n * Decides in what dimensions the user can pan the chart. Can be\n * one of `x`, `y`, or `xy`.\n *\n * When this option is set to `y` or `xy`, [yAxis.startOnTick](#yAxis.startOnTick)\n * and [yAxis.endOnTick](#yAxis.endOnTick) are overwritten to `false`.\n *\n * @sample {highcharts} highcharts/chart/panning-type\n * Zooming and xy panning\n *\n * @declare Highcharts.OptionsChartPanningTypeValue\n * @type {string}\n * @validvalue [\"x\", \"y\", \"xy\"]\n * @default {highcharts|highstock} x\n * @product highcharts highstock gantt\n */\n type: 'x'\n },\n /**\n * Equivalent to [zoomType](#chart.zoomType), but for multitouch\n * gestures only. By default, the `pinchType` is the same as the\n * `zoomType` setting. However, pinching can be enabled separately in\n * some cases, for example in stock charts where a mouse drag pans the\n * chart, while pinching is enabled. When [tooltip.followTouchMove](\n * #tooltip.followTouchMove) is true, pinchType only applies to\n * two-finger touches.\n *\n * @type {string}\n * @default {highcharts} undefined\n * @default {highstock} undefined\n * @since 3.0\n * @product highcharts highstock gantt\n * @deprecated\n * @validvalue [\"x\", \"y\", \"xy\"]\n * @apioption chart.pinchType\n */\n /**\n * Whether to apply styled mode. When in styled mode, no presentational\n * attributes or CSS are applied to the chart SVG. Instead, CSS rules\n * are required to style the chart. The default style sheet is\n * available from `https://code.highcharts.com/css/highcharts.css`.\n *\n * [Read more in the docs](https://www.highcharts.com/docs/chart-design-and-style/style-by-css)\n * on what classes and variables are available.\n *\n * @sample highcharts/css/colors\n * Color theming with CSS\n * @sample highcharts/css/prefers-color-scheme\n * Dynamic theme based on system settings\n * @type {boolean}\n * @default false\n * @since 7.0\n * @apioption chart.styledMode\n */\n styledMode: false,\n /**\n * The corner radius of the outer chart border.\n *\n * @sample {highcharts} highcharts/chart/borderradius/\n * 20px radius\n * @sample {highstock} stock/chart/border/\n * 10px radius\n * @sample {highmaps} maps/chart/border/\n * Border options\n *\n */\n borderRadius: 0,\n /**\n * In styled mode, this sets how many colors the class names\n * should rotate between. With ten colors, series (or points) are\n * given class names like `highcharts-color-0`, `highcharts-color-1`\n * [...] `highcharts-color-9`. The equivalent in non-styled mode\n * is to set colors using the [colors](#colors) setting.\n *\n * @since 5.0.0\n */\n colorCount: 10,\n /**\n * By default, (because of memory and performance reasons) the chart does\n * not copy the data but keeps it as a reference. In some cases, this might\n * result in mutating the original data source. In order to prevent that,\n * set that property to false. Please note that changing that might decrease\n * performance, especially with bigger sets of data.\n *\n * @type {boolean}\n * @since 10.1.0\n */\n allowMutatingData: true,\n /**\n * If true, the axes will scale to the remaining visible series once\n * one series is hidden. If false, hiding and showing a series will\n * not affect the axes or the other series. For stacks, once one series\n * within the stack is hidden, the rest of the stack will close in\n * around it even if the axis is not affected.\n *\n * @sample {highcharts} highcharts/chart/ignorehiddenseries-true/\n * True by default\n * @sample {highcharts} highcharts/chart/ignorehiddenseries-false/\n * False\n * @sample {highcharts} highcharts/chart/ignorehiddenseries-true-stacked/\n * True with stack\n * @sample {highstock} stock/chart/ignorehiddenseries-true/\n * True by default\n * @sample {highstock} stock/chart/ignorehiddenseries-false/\n * False\n *\n * @since 1.2.0\n * @product highcharts highstock gantt\n */\n ignoreHiddenSeries: true,\n /**\n * Whether to invert the axes so that the x axis is vertical and y axis\n * is horizontal. When `true`, the x axis is [reversed](#xAxis.reversed)\n * by default.\n *\n * @productdesc {highcharts}\n * If a bar series is present in the chart, it will be inverted\n * automatically. Inverting the chart doesn't have an effect if there\n * are no cartesian series in the chart.\n *\n * @sample {highcharts} highcharts/chart/inverted/\n * Inverted line\n * @sample {highstock} stock/navigator/inverted/\n * Inverted stock chart\n *\n * @type {boolean}\n * @default false\n * @product highcharts highstock gantt\n * @apioption chart.inverted\n */\n /**\n * The distance between the outer edge of the chart and the content,\n * like title or legend, or axis title and labels if present. The\n * numbers in the array designate top, right, bottom and left\n * respectively. Use the options spacingTop, spacingRight, spacingBottom\n * and spacingLeft options for shorthand setting of one option.\n *\n * @type {Array}\n * @see [chart.margin](#chart.margin)\n * @default [10, 10, 15, 10]\n * @since 3.0.6\n */\n spacing: [10, 10, 15, 10],\n /**\n * The button that appears after a selection zoom, allowing the user\n * to reset zoom. This option is deprecated in favor of\n * [zooming](#chart.zooming).\n *\n * @since 2.2\n * @deprecated 10.2.1\n */\n resetZoomButton: {\n /**\n * What frame the button placement should be related to. Can be\n * either `plotBox` or `spacingBox`.\n *\n * @sample {highcharts} highcharts/chart/resetzoombutton-relativeto/\n * Relative to the chart\n * @sample {highstock} highcharts/chart/resetzoombutton-relativeto/\n * Relative to the chart\n *\n * @type {Highcharts.ButtonRelativeToValue}\n * @apioption chart.resetZoomButton.relativeTo\n */\n /**\n * A collection of attributes for the button. The object takes SVG\n * attributes like `fill`, `stroke`, `stroke-width` or `r`, the\n * border radius. The theme also supports `style`, a collection of\n * CSS properties for the text. Equivalent attributes for the hover\n * state are given in `theme.states.hover`.\n *\n * @sample {highcharts} highcharts/chart/resetzoombutton-theme/\n * Theming the button\n * @sample {highstock} highcharts/chart/resetzoombutton-theme/\n * Theming the button\n *\n * @type {Highcharts.SVGAttributes}\n */\n theme: {\n /**\n * zIndex of the button.\n *\n * @type {number}\n * @apioption chart.resetZoomButton.theme.zIndex\n */\n },\n /**\n * The position of the button.\n *\n * @sample {highcharts} highcharts/chart/resetzoombutton-position/\n * Above the plot area\n * @sample {highstock} highcharts/chart/resetzoombutton-position/\n * Above the plot area\n * @sample {highmaps} highcharts/chart/resetzoombutton-position/\n * Above the plot area\n *\n * @type {Highcharts.AlignObject}\n */\n position: {\n /**\n * The horizontal alignment of the button.\n *\n * @type {number}\n * @apioption chart.resetZoomButton.position.align\n */\n /**\n * The horizontal offset of the button.\n *\n * @type {number}\n * @apioption chart.resetZoomButton.position.x\n */\n /**\n * The vertical alignment of the button.\n *\n * @type {Highcharts.VerticalAlignValue}\n * @apioption chart.resetZoomButton.position.verticalAlign\n */\n /**\n * The vertical offset of the button.\n *\n * @type {number}\n * @apioption chart.resetZoomButton.position.y\n */\n }\n },\n /**\n * The pixel width of the plot area border.\n *\n * @sample {highcharts} highcharts/chart/plotborderwidth/\n * 1px border\n * @sample {highstock} stock/chart/plotborder/\n * 2px border\n * @sample {highmaps} maps/chart/plotborder/\n * Plot border options\n *\n * @type {number}\n * @default 0\n * @apioption chart.plotBorderWidth\n */\n /**\n * Whether to apply a drop shadow to the plot area. Requires that\n * plotBackgroundColor be set. The shadow can be an object configuration\n * containing `color`, `offsetX`, `offsetY`, `opacity` and `width`.\n *\n * @sample {highcharts} highcharts/chart/plotshadow/\n * Plot shadow\n * @sample {highstock} stock/chart/plotshadow/\n * Plot shadow\n * @sample {highmaps} maps/chart/plotborder/\n * Plot border options\n *\n * @type {boolean|Highcharts.ShadowOptionsObject}\n * @default false\n * @apioption chart.plotShadow\n */\n /**\n * When true, cartesian charts like line, spline, area and column are\n * transformed into the polar coordinate system. This produces _polar\n * charts_, also known as _radar charts_.\n *\n * @sample {highcharts} highcharts/demo/polar/\n * Polar chart\n * @sample {highcharts} highcharts/demo/polar-wind-rose/\n * Wind rose, stacked polar column chart\n * @sample {highcharts} highcharts/demo/polar-spider/\n * Spider web chart\n * @sample {highcharts} highcharts/parallel-coordinates/polar/\n * Star plot, multivariate data in a polar chart\n *\n * @type {boolean}\n * @default false\n * @since 2.3.0\n * @product highcharts\n * @requires highcharts-more\n * @apioption chart.polar\n */\n /**\n * Whether to reflow the chart to fit the width of the container div\n * on resizing the window.\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * True by default\n * @sample {highcharts} highcharts/chart/reflow-false/\n * False\n * @sample {highstock} stock/chart/reflow-true/\n * True by default\n * @sample {highstock} stock/chart/reflow-false/\n * False\n * @sample {highmaps} maps/chart/reflow-true/\n * True by default\n * @sample {highmaps} maps/chart/reflow-false/\n * False\n *\n * @since 2.1\n */\n reflow: true,\n /**\n * The HTML element where the chart will be rendered. If it is a string,\n * the element by that id is used. The HTML element can also be passed\n * by direct reference, or as the first argument of the chart\n * constructor, in which case the option is not needed.\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * String\n * @sample {highcharts} highcharts/chart/renderto-object/\n * Object reference\n * @sample {highstock} stock/chart/renderto-string/\n * String\n * @sample {highstock} stock/chart/renderto-object/\n * Object reference\n *\n * @type {string|Highcharts.HTMLDOMElement}\n * @apioption chart.renderTo\n */\n /**\n * The background color of the marker square when selecting (zooming\n * in on) an area of the chart.\n *\n * @see In styled mode, the selection marker fill is set with the\n * `.highcharts-selection-marker` class.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default rgba(51,92,173,0.25)\n * @since 2.1.7\n * @apioption chart.selectionMarkerFill\n */\n /**\n * Whether to apply a drop shadow to the global series group. This causes\n * all the series to have the same shadow. Contrary to the `series.shadow`\n * option, this prevents items from casting shadows on each other, like for\n * others series in a stack. The shadow can be an object configuration\n * containing `color`, `offsetX`, `offsetY`, `opacity` and `width`.\n *\n * @sample highcharts/chart/seriesgroupshadow/ Shadow\n *\n * @type {boolean|Highcharts.ShadowOptionsObject}\n * @default false\n * @apioption chart.shadow\n */\n /**\n * Whether to apply a drop shadow to the outer chart area. Requires\n * that backgroundColor be set. The shadow can be an object\n * configuration containing `color`, `offsetX`, `offsetY`, `opacity` and\n * `width`.\n *\n * @sample {highcharts} highcharts/chart/shadow/\n * Shadow\n * @sample {highstock} stock/chart/shadow/\n * Shadow\n * @sample {highmaps} maps/chart/border/\n * Chart border and shadow\n *\n * @type {boolean|Highcharts.ShadowOptionsObject}\n * @default false\n * @apioption chart.shadow\n */\n /**\n * Whether to show the axes initially. This only applies to empty charts\n * where series are added dynamically, as axes are automatically added\n * to cartesian series.\n *\n * @sample {highcharts} highcharts/chart/showaxes-false/\n * False by default\n * @sample {highcharts} highcharts/chart/showaxes-true/\n * True\n *\n * @type {boolean}\n * @since 1.2.5\n * @product highcharts gantt\n * @apioption chart.showAxes\n */\n /**\n * The space between the bottom edge of the chart and the content (plot\n * area, axis title and labels, title, subtitle or legend in top\n * position).\n *\n * @sample {highcharts} highcharts/chart/spacingbottom/\n * Spacing bottom set to 100\n * @sample {highstock} stock/chart/spacingbottom/\n * Spacing bottom set to 100\n * @sample {highmaps} maps/chart/spacing/\n * Spacing 100 all around\n *\n * @type {number}\n * @default 15\n * @since 2.1\n * @apioption chart.spacingBottom\n */\n /**\n * The space between the left edge of the chart and the content (plot\n * area, axis title and labels, title, subtitle or legend in top\n * position).\n *\n * @sample {highcharts} highcharts/chart/spacingleft/\n * Spacing left set to 100\n * @sample {highstock} stock/chart/spacingleft/\n * Spacing left set to 100\n * @sample {highmaps} maps/chart/spacing/\n * Spacing 100 all around\n *\n * @type {number}\n * @default 10\n * @since 2.1\n * @apioption chart.spacingLeft\n */\n /**\n * The space between the right edge of the chart and the content (plot\n * area, axis title and labels, title, subtitle or legend in top\n * position).\n *\n * @sample {highcharts} highcharts/chart/spacingright-100/\n * Spacing set to 100\n * @sample {highcharts} highcharts/chart/spacingright-legend/\n * Legend in right position with default spacing\n * @sample {highstock} stock/chart/spacingright/\n * Spacing set to 100\n * @sample {highmaps} maps/chart/spacing/\n * Spacing 100 all around\n *\n * @type {number}\n * @default 10\n * @since 2.1\n * @apioption chart.spacingRight\n */\n /**\n * The space between the top edge of the chart and the content (plot\n * area, axis title and labels, title, subtitle or legend in top\n * position).\n *\n * @sample {highcharts} highcharts/chart/spacingtop-100/\n * A top spacing of 100\n * @sample {highcharts} highcharts/chart/spacingtop-10/\n * Floating chart title makes the plot area align to the default\n * spacingTop of 10.\n * @sample {highstock} stock/chart/spacingtop/\n * A top spacing of 100\n * @sample {highmaps} maps/chart/spacing/\n * Spacing 100 all around\n *\n * @type {number}\n * @default 10\n * @since 2.1\n * @apioption chart.spacingTop\n */\n /**\n * Additional CSS styles to apply inline to the container `div` and the root\n * SVG.\n *\n * According to the CSS syntax documentation, it is recommended to quote\n * font family names that contain white space, digits, or punctuation\n * characters other than hyphens. In such cases, wrap the fontFamily\n * name as follows: `fontFamily: '\"Font name\"'`.\n *\n * Since v11, the root font size is 1rem by default, and all child element\n * are given a relative `em` font size by default. This allows implementers\n * to control all the chart's font sizes by only setting the root level.\n *\n * @see In styled mode, general chart styles can be set with the\n * `.highcharts-root` class.\n * @sample {highcharts} highcharts/chart/style-serif-font/\n * Using a serif type font\n * @sample {highcharts} highcharts/chart/style-special-font/\n * Using a font with special character in name\n * @sample {highcharts} highcharts/members/relative-font-size/\n * Relative font sizes\n * @sample {highcharts} highcharts/css/em/\n * Styled mode with relative font sizes\n * @sample {highstock} stock/chart/style/\n * Using a serif type font\n * @sample {highmaps} maps/chart/style-serif-font/\n * Using a serif type font\n *\n * @type {Highcharts.CSSObject}\n * @default {\"fontFamily\": Helvetica, Arial, sans-serif\",\"fontSize\":\"1rem\"}\n * @apioption chart.style\n */\n /**\n * The default series type for the chart. Can be any of the chart types\n * listed under [plotOptions](#plotOptions) and [series](#series) or can\n * be a series provided by an additional module.\n *\n * In TypeScript this option has no effect in sense of typing and\n * instead the `type` option must always be set in the series.\n *\n * @sample {highcharts} highcharts/chart/type-bar/\n * Bar\n * @sample {highstock} stock/chart/type/\n * Areaspline\n * @sample {highmaps} maps/chart/type-mapline/\n * Mapline\n *\n * @type {string}\n * @default {highcharts} line\n * @default {highstock} line\n * @default {highmaps} map\n * @since 2.1.0\n * @apioption chart.type\n */\n type: 'line',\n /**\n * Decides in what dimensions the user can zoom by dragging the mouse.\n * Can be one of `x`, `y` or `xy`.\n *\n * @see [panKey](#chart.panKey)\n *\n * @sample {highcharts} highcharts/chart/zoomtype-none/\n * None by default\n * @sample {highcharts} highcharts/chart/zoomtype-x/\n * X\n * @sample {highcharts} highcharts/chart/zoomtype-y/\n * Y\n * @sample {highcharts} highcharts/chart/zoomtype-xy/\n * Xy\n * @sample {highcharts} highcharts/chart/zoomtype-polar/\n * Zoom on polar chart\n * @sample {highstock} stock/demo/basic-line/\n * None by default\n * @sample {highstock} stock/chart/zoomtype-x/\n * X\n * @sample {highstock} stock/chart/zoomtype-y/\n * Y\n * @sample {highstock} stock/chart/zoomtype-xy/\n * Xy\n * @sample {highmaps} maps/chart/zoomtype-xy/\n * Map with selection zoom\n *\n * @type {string}\n * @validvalue [\"x\", \"y\", \"xy\"]\n * @deprecated\n * @apioption chart.zoomType\n */\n /**\n * Enables zooming by a single touch, in combination with\n * [chart.zoomType](#chart.zoomType). When enabled, two-finger pinch\n * will still work as set up by [chart.pinchType](#chart.pinchType).\n * However, `zoomBySingleTouch` will interfere with touch-dragging the\n * chart to read the tooltip. And especially when vertical zooming is\n * enabled, it will make it hard to scroll vertically on the page.\n * @since 9.0.0\n * @sample highcharts/chart/zoombysingletouch\n * Zoom by single touch enabled, with buttons to toggle\n * @product highcharts highstock gantt\n * @deprecated\n */\n /**\n * Chart zooming options.\n * @since 10.2.1\n */\n zooming: {\n /**\n * Equivalent to [type](#chart.zooming.type), but for multitouch\n * gestures only. By default, the `pinchType` is the same as the\n * `type` setting. However, pinching can be enabled separately in\n * some cases, for example in stock charts where a mouse drag pans the\n * chart, while pinching is enabled. When [tooltip.followTouchMove](\n * #tooltip.followTouchMove) is true, pinchType only applies to\n * two-finger touches.\n *\n * @type {string}\n * @default {highcharts} undefined\n * @default {highstock} x\n * @product highcharts highstock gantt\n * @validvalue [\"x\", \"y\", \"xy\"]\n * @apioption chart.zooming.pinchType\n */\n /**\n * Decides in what dimensions the user can zoom by dragging the mouse.\n * Can be one of `x`, `y` or `xy`.\n *\n * @declare Highcharts.OptionsChartZoomingTypeValue\n * @type {string}\n * @default {highcharts} undefined\n * @product highcharts highstock gantt\n * @validvalue [\"x\", \"y\", \"xy\"]\n * @apioption chart.zooming.type\n */\n /**\n * Set a key to hold when dragging to zoom the chart. This is useful to\n * avoid zooming while moving points. Should be set different than\n * [chart.panKey](#chart.panKey).\n *\n * @type {string}\n * @default {highcharts} undefined\n * @validvalue [\"alt\", \"ctrl\", \"meta\", \"shift\"]\n * @requires modules/draggable-points\n * @apioption chart.zooming.key\n */\n /**\n * Enables zooming by a single touch, in combination with\n * [chart.zooming.type](#chart.zooming.type). When enabled, two-finger\n * pinch will still work as set up by [chart.zooming.pinchType]\n * (#chart.zooming.pinchType). However, `singleTouch` will interfere\n * with touch-dragging the chart to read the tooltip. And especially\n * when vertical zooming is enabled, it will make it hard to scroll\n * vertically on the page.\n *\n * @sample highcharts/chart/zoombysingletouch\n * Zoom by single touch enabled, with buttons to toggle\n *\n * @product highcharts highstock gantt\n */\n singleTouch: false,\n /**\n * The button that appears after a selection zoom, allowing the user\n * to reset zoom.\n */\n resetButton: {\n /**\n * What frame the button placement should be related to. Can be\n * either `plotBox` or `spacingBox`.\n *\n * @sample {highcharts} highcharts/chart/resetzoombutton-relativeto/\n * Relative to the chart\n * @sample {highstock} highcharts/chart/resetzoombutton-relativeto/\n * Relative to the chart\n *\n * @type {Highcharts.ButtonRelativeToValue}\n * @default plot\n * @apioption chart.zooming.resetButton.relativeTo\n */\n /**\n * A collection of attributes for the button. The object takes SVG\n * attributes like `fill`, `stroke`, `stroke-width` or `r`, the\n * border radius. The theme also supports `style`, a collection of\n * CSS properties for the text. Equivalent attributes for the hover\n * state are given in `theme.states.hover`.\n *\n * @sample {highcharts} highcharts/chart/resetzoombutton-theme/\n * Theming the button\n * @sample {highstock} highcharts/chart/resetzoombutton-theme/\n * Theming the button\n *\n * @type {Highcharts.SVGAttributes}\n * @since 10.2.1\n */\n theme: {\n /** @internal */\n zIndex: 6\n },\n /**\n * The position of the button.\n *\n * Note: Adjusting position values might cause overlap with chart\n * elements. Ensure coordinates do not obstruct other components or\n * data visibility.\n *\n * @sample {highcharts} highcharts/chart/resetzoombutton-position/\n * Above the plot area\n * @sample {highstock} highcharts/chart/resetzoombutton-position/\n * Above the plot area\n * @sample {highmaps} highcharts/chart/resetzoombutton-position/\n * Above the plot area\n *\n * @type {Highcharts.AlignObject}\n * @since 10.2.1\n */\n position: {\n /**\n * The horizontal alignment of the button.\n */\n align: 'right',\n /**\n * The horizontal offset of the button.\n */\n x: -10,\n /**\n * The vertical alignment of the button.\n *\n * @type {Highcharts.VerticalAlignValue}\n * @default top\n * @apioption chart.zooming.resetButton.position.verticalAlign\n */\n /**\n * The vertical offset of the button.\n */\n y: 10\n }\n }\n },\n /**\n * An explicit width for the chart. By default (when `null`) the width\n * is calculated from the offset width of the containing element.\n *\n * @sample {highcharts} highcharts/chart/width/\n * 800px wide\n * @sample {highstock} stock/chart/width/\n * 800px wide\n * @sample {highmaps} maps/chart/size/\n * Chart with explicit size\n *\n * @type {null|number|string}\n */\n width: null,\n /**\n * An explicit height for the chart. If a _number_, the height is\n * given in pixels. If given a _percentage string_ (for example\n * `'56%'`), the height is given as the percentage of the actual chart\n * width. This allows for preserving the aspect ratio across responsive\n * sizes.\n *\n * By default (when `null`) the height is calculated from the offset\n * height of the containing element, or 400 pixels if the containing\n * element's height is 0.\n *\n * @sample {highcharts} highcharts/chart/height/\n * 500px height\n * @sample {highstock} stock/chart/height/\n * 300px height\n * @sample {highmaps} maps/chart/size/\n * Chart with explicit size\n * @sample highcharts/chart/height-percent/\n * Highcharts with percentage height\n *\n * @type {null|number|string}\n */\n height: null,\n /**\n * The color of the outer chart border.\n *\n * @see In styled mode, the stroke is set with the\n * `.highcharts-background` class.\n *\n * @sample {highcharts} highcharts/chart/bordercolor/\n * Brown border\n * @sample {highstock} stock/chart/border/\n * Brown border\n * @sample {highmaps} maps/chart/border/\n * Border options\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n borderColor: \"#334eff\" /* Palette.highlightColor80 */,\n /**\n * The pixel width of the outer chart border.\n *\n * @see In styled mode, the stroke is set with the\n * `.highcharts-background` class.\n *\n * @sample {highcharts} highcharts/chart/borderwidth/\n * 5px border\n * @sample {highstock} stock/chart/border/\n * 2px border\n * @sample {highmaps} maps/chart/border/\n * Border options\n *\n * @type {number}\n * @default 0\n * @apioption chart.borderWidth\n */\n /**\n * The background color or gradient for the outer chart area.\n *\n * @see In styled mode, the background is set with the\n * `.highcharts-background` class.\n *\n * @sample {highcharts} highcharts/chart/backgroundcolor-color/\n * Color\n * @sample {highcharts} highcharts/chart/backgroundcolor-gradient/\n * Gradient\n * @sample {highstock} stock/chart/backgroundcolor-color/\n * Color\n * @sample {highstock} stock/chart/backgroundcolor-gradient/\n * Gradient\n * @sample {highmaps} maps/chart/backgroundcolor-color/\n * Color\n * @sample {highmaps} maps/chart/backgroundcolor-gradient/\n * Gradient\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n backgroundColor: \"#ffffff\" /* Palette.backgroundColor */,\n /**\n * The background color or gradient for the plot area.\n *\n * @see In styled mode, the plot background is set with the\n * `.highcharts-plot-background` class.\n *\n * @sample {highcharts} highcharts/chart/plotbackgroundcolor-color/\n * Color\n * @sample {highcharts} highcharts/chart/plotbackgroundcolor-gradient/\n * Gradient\n * @sample {highstock} stock/chart/plotbackgroundcolor-color/\n * Color\n * @sample {highstock} stock/chart/plotbackgroundcolor-gradient/\n * Gradient\n * @sample {highmaps} maps/chart/plotbackgroundcolor-color/\n * Color\n * @sample {highmaps} maps/chart/plotbackgroundcolor-gradient/\n * Gradient\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption chart.plotBackgroundColor\n */\n /**\n * The URL for an image to use as the plot background. To set an image\n * as the background for the entire chart, set a CSS background image\n * to the container element. Note that for the image to be applied to\n * exported charts, its URL needs to be accessible by the export server.\n *\n * @see In styled mode, a plot background image can be set with the\n * `.highcharts-plot-background` class and a [custom pattern](\n * https://www.highcharts.com/docs/chart-design-and-style/gradients-shadows-and-patterns).\n *\n * @sample {highcharts} highcharts/chart/plotbackgroundimage/\n * Skies\n * @sample {highstock} stock/chart/plotbackgroundimage/\n * Skies\n *\n * @type {string}\n * @apioption chart.plotBackgroundImage\n */\n /**\n * The color of the inner chart or plot area border.\n *\n * @see In styled mode, a plot border stroke can be set with the\n * `.highcharts-plot-border` class.\n *\n * @sample {highcharts} highcharts/chart/plotbordercolor/\n * Blue border\n * @sample {highstock} stock/chart/plotborder/\n * Blue border\n * @sample {highmaps} maps/chart/plotborder/\n * Plot border options\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n plotBorderColor: \"#cccccc\" /* Palette.neutralColor20 */\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default ChartDefaults;\n", "/*\n * Series palettes for Highcharts. Series colors are defined in highcharts.css.\n * **Do not edit this file!** This file is generated using the 'gulp palette' task.\n */\nconst SeriesPalettes = {\n /**\n * Colors for data series and points\n */\n colors: [\n '#2caffe',\n '#544fc5',\n '#00e272',\n '#fe6a35',\n '#6b8abc',\n '#d568fb',\n '#2ee0ca',\n '#fa4b42',\n '#feb56a',\n '#91e8e1'\n ],\n};\nexport default SeriesPalettes;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from './Globals.js';\nconst { win } = H;\nimport U from './Utilities.js';\nconst { defined, error, extend, isNumber, isObject, merge, objectEach, pad, pick, splat, timeUnits } = U;\n/* *\n *\n * Constants\n *\n * */\nconst hasNewSafariBug = H.isSafari &&\n win.Intl &&\n win.Intl.DateTimeFormat.prototype.formatRange;\n// To do: Remove this when we no longer need support for Safari < v14.1\nconst hasOldSafariBug = H.isSafari &&\n win.Intl &&\n !win.Intl.DateTimeFormat.prototype.formatRange;\n/* *\n *\n * Class\n *\n * */\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/**\n * The Time class. Time settings are applied in general for each page using\n * `Highcharts.setOptions`, or individually for each Chart item through the\n * [time](https://api.highcharts.com/highcharts/time) options set.\n *\n * The Time object is available from {@link Highcharts.Chart#time},\n * which refers to `Highcharts.time` if no individual time settings are\n * applied.\n *\n * @example\n * // Apply time settings globally\n * Highcharts.setOptions({\n * time: {\n * timezone: 'Europe/London'\n * }\n * });\n *\n * // Apply time settings by instance\n * let chart = Highcharts.chart('container', {\n * time: {\n * timezone: 'America/New_York'\n * },\n * series: [{\n * data: [1, 4, 3, 5]\n * }]\n * });\n *\n * // Use the Time object\n * console.log(\n * 'Current time in New York',\n * chart.time.dateFormat('%Y-%m-%d %H:%M:%S', Date.now())\n * );\n *\n * @since 6.0.5\n *\n * @class\n * @name Highcharts.Time\n *\n * @param {Highcharts.TimeOptions} [options]\n * Time options as defined in [chart.options.time](/highcharts/time).\n */\nclass Time {\n /* *\n *\n * Constructors\n *\n * */\n constructor(options) {\n /* *\n *\n * Properties\n *\n * */\n this.options = {};\n this.useUTC = false;\n this.variableTimezone = false;\n this.Date = win.Date;\n /**\n * Get the time zone offset based on the current timezone information as\n * set in the global options.\n *\n * @function Highcharts.Time#getTimezoneOffset\n *\n * @param {number} timestamp\n * The JavaScript timestamp to inspect.\n *\n * @return {number}\n * The timezone offset in minutes compared to UTC.\n */\n this.getTimezoneOffset = this.timezoneOffsetFunction();\n this.update(options);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Time units used in `Time.get` and `Time.set`\n *\n * @typedef {\"Date\"|\"Day\"|\"FullYear\"|\"Hours\"|\"Milliseconds\"|\"Minutes\"|\"Month\"|\"Seconds\"} Highcharts.TimeUnitValue\n */\n /**\n * Get the value of a date object in given units, and subject to the Time\n * object's current timezone settings. This function corresponds directly to\n * JavaScripts `Date.getXXX / Date.getUTCXXX`, so instead of calling\n * `date.getHours()` or `date.getUTCHours()` we will call\n * `time.get('Hours')`.\n *\n * @function Highcharts.Time#get\n *\n * @param {Highcharts.TimeUnitValue} unit\n * @param {Date} date\n *\n * @return {number}\n * The given time unit\n */\n get(unit, date) {\n if (this.variableTimezone || this.timezoneOffset) {\n const realMs = date.getTime();\n const ms = realMs - this.getTimezoneOffset(date);\n date.setTime(ms); // Temporary adjust to timezone\n const ret = date['getUTC' + unit]();\n date.setTime(realMs); // Reset\n return ret;\n }\n // UTC time with no timezone handling\n if (this.useUTC) {\n return date['getUTC' + unit]();\n }\n // Else, local time\n return date['get' + unit]();\n }\n /**\n * Set the value of a date object in given units, and subject to the Time\n * object's current timezone settings. This function corresponds directly to\n * JavaScripts `Date.setXXX / Date.setUTCXXX`, so instead of calling\n * `date.setHours(0)` or `date.setUTCHours(0)` we will call\n * `time.set('Hours', 0)`.\n *\n * @function Highcharts.Time#set\n *\n * @param {Highcharts.TimeUnitValue} unit\n * @param {Date} date\n * @param {number} value\n *\n * @return {number}\n * The epoch milliseconds of the updated date\n */\n set(unit, date, value) {\n // UTC time with timezone handling\n if (this.variableTimezone || this.timezoneOffset) {\n // For lower order time units, just set it directly using UTC\n // time\n if (unit === 'Milliseconds' ||\n unit === 'Seconds' ||\n (unit === 'Minutes' &&\n this.getTimezoneOffset(date) % 3600000 === 0) // #13961\n ) {\n return date['setUTC' + unit](value);\n }\n // Higher order time units need to take the time zone into\n // account\n // Adjust by timezone\n const offset = this.getTimezoneOffset(date);\n let ms = date.getTime() - offset;\n date.setTime(ms);\n date['setUTC' + unit](value);\n const newOffset = this.getTimezoneOffset(date);\n ms = date.getTime() + newOffset;\n return date.setTime(ms);\n }\n // UTC time with no timezone handling\n if (this.useUTC ||\n // leap calculation in UTC only\n (hasNewSafariBug && unit === 'FullYear')) {\n return date['setUTC' + unit](value);\n }\n // Else, local time\n return date['set' + unit](value);\n }\n /**\n * Update the Time object with current options. It is called internally on\n * initializing Highcharts, after running `Highcharts.setOptions` and on\n * `Chart.update`.\n *\n * @private\n * @function Highcharts.Time#update\n *\n * @param {Highcharts.TimeOptions} [options]\n *\n */\n update(options = {}) {\n const useUTC = pick(options.useUTC, true);\n this.options = options = merge(true, this.options, options);\n // Allow using a different Date class\n this.Date = options.Date || win.Date || Date;\n this.useUTC = useUTC;\n this.timezoneOffset = (useUTC && options.timezoneOffset) || void 0;\n this.getTimezoneOffset = this.timezoneOffsetFunction();\n /*\n * The time object has options allowing for variable time zones, meaning\n * the axis ticks or series data needs to consider this.\n */\n this.variableTimezone = useUTC && !!(options.getTimezoneOffset ||\n options.timezone);\n }\n /**\n * Make a time and returns milliseconds. Interprets the inputs as UTC time,\n * local time or a specific timezone time depending on the current time\n * settings.\n *\n * @function Highcharts.Time#makeTime\n *\n * @param {number} year\n * The year\n *\n * @param {number} month\n * The month. Zero-based, so January is 0.\n *\n * @param {number} [date=1]\n * The day of the month\n *\n * @param {number} [hours=0]\n * The hour of the day, 0-23.\n *\n * @param {number} [minutes=0]\n * The minutes\n *\n * @param {number} [seconds=0]\n * The seconds\n *\n * @return {number}\n * The time in milliseconds since January 1st 1970.\n */\n makeTime(year, month, date, hours, minutes, seconds) {\n let d, offset, newOffset;\n if (this.useUTC) {\n d = this.Date.UTC.apply(0, arguments);\n offset = this.getTimezoneOffset(d);\n d += offset;\n newOffset = this.getTimezoneOffset(d);\n if (offset !== newOffset) {\n d += newOffset - offset;\n // A special case for transitioning from summer time to winter time.\n // When the clock is set back, the same time is repeated twice, i.e.\n // 02:30 am is repeated since the clock is set back from 3 am to\n // 2 am. We need to make the same time as local Date does.\n }\n else if (offset - 36e5 === this.getTimezoneOffset(d - 36e5) &&\n !hasOldSafariBug) {\n d -= 36e5;\n }\n }\n else {\n d = new this.Date(year, month, pick(date, 1), pick(hours, 0), pick(minutes, 0), pick(seconds, 0)).getTime();\n }\n return d;\n }\n /**\n * Sets the getTimezoneOffset function. If the `timezone` option is set, a\n * default getTimezoneOffset function with that timezone is returned. If\n * a `getTimezoneOffset` option is defined, it is returned. If neither are\n * specified, the function using the `timezoneOffset` option or 0 offset is\n * returned.\n *\n * @private\n * @function Highcharts.Time#timezoneOffsetFunction\n *\n * @return {Function}\n * A getTimezoneOffset function\n */\n timezoneOffsetFunction() {\n const time = this, options = this.options, getTimezoneOffset = options.getTimezoneOffset;\n if (!this.useUTC) {\n return (timestamp) => new Date(timestamp.toString()).getTimezoneOffset() * 60000;\n }\n if (options.timezone) {\n return (timestamp) => {\n try {\n // Cache the DateTimeFormat instances for performance\n // (#20720)\n const cacheKey = `shortOffset,${options.timezone || ''}`, dateTimeFormat = Time.formatCache[cacheKey] = (Time.formatCache[cacheKey] ||\n // eslint-disable-next-line new-cap\n Intl.DateTimeFormat('en', {\n timeZone: options.timezone,\n timeZoneName: 'shortOffset'\n }));\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [date, gmt, hours, colon, minutes = 0] = dateTimeFormat\n .format(timestamp)\n .split(/(GMT|:)/)\n .map(Number), offset = -(hours + minutes / 60) * 60 * 60000;\n // Possible future NaNs stop here\n if (isNumber(offset)) {\n return offset;\n }\n }\n catch (e) {\n error(34);\n }\n return 0;\n };\n }\n // If not timezone is set, look for the getTimezoneOffset callback\n if (this.useUTC && getTimezoneOffset) {\n return (timestamp) => getTimezoneOffset(timestamp.valueOf()) * 60000;\n }\n // Last, use the `timezoneOffset` option if set\n return () => (time.timezoneOffset || 0) * 60000;\n }\n /**\n * Formats a JavaScript date timestamp (milliseconds since Jan 1st 1970)\n * into a human readable date string. The available format keys are listed\n * below. Additional formats can be given in the\n * {@link Highcharts.dateFormats} hook.\n *\n * Supported format keys:\n * - `%a`: Short weekday, like 'Mon'\n * - `%A`: Long weekday, like 'Monday'\n * - `%d`: Two digit day of the month, 01 to 31\n * - `%e`: Day of the month, 1 through 31\n * - `%w`: Day of the week, 0 through 6\n * - `%b`: Short month, like 'Jan'\n * - `%B`: Long month, like 'January'\n * - `%m`: Two digit month number, 01 through 12\n * - `%y`: Two digits year, like 09 for 2009\n * - `%Y`: Four digits year, like 2009\n * - `%H`: Two digits hours in 24h format, 00 through 23\n * - `%k`: Hours in 24h format, 0 through 23\n * - `%I`: Two digits hours in 12h format, 00 through 11\n * - `%l`: Hours in 12h format, 1 through 12\n * - `%M`: Two digits minutes, 00 through 59\n * - `%p`: Upper case AM or PM\n * - `%P`: Lower case AM or PM\n * - `%S`: Two digits seconds, 00 through 59\n * - `%L`: Milliseconds (naming from Ruby)\n *\n * @example\n * const time = new Highcharts.Time();\n * const s = time.dateFormat('%Y-%m-%d %H:%M:%S', Date.UTC(2020, 0, 1));\n * console.log(s); // => 2020-01-01 00:00:00\n *\n * @function Highcharts.Time#dateFormat\n *\n * @param {string} format\n * The desired format where various time representations are\n * prefixed with %.\n *\n * @param {number} [timestamp]\n * The JavaScript timestamp.\n *\n * @param {boolean} [capitalize=false]\n * Upper case first letter in the return.\n *\n * @return {string}\n * The formatted date.\n */\n dateFormat(format, timestamp, capitalize) {\n if (!defined(timestamp) || isNaN(timestamp)) {\n return (H.defaultOptions.lang &&\n H.defaultOptions.lang.invalidDate ||\n '');\n }\n format = pick(format, '%Y-%m-%d %H:%M:%S');\n const time = this, date = new this.Date(timestamp), \n // get the basic time values\n hours = this.get('Hours', date), day = this.get('Day', date), dayOfMonth = this.get('Date', date), month = this.get('Month', date), fullYear = this.get('FullYear', date), lang = H.defaultOptions.lang, langWeekdays = (lang && lang.weekdays), shortWeekdays = (lang && lang.shortWeekdays), \n // List all format keys. Custom formats can be added from the\n // outside.\n replacements = extend({\n // Day\n // Short weekday, like 'Mon'\n a: shortWeekdays ?\n shortWeekdays[day] :\n langWeekdays[day].substr(0, 3),\n // Long weekday, like 'Monday'\n A: langWeekdays[day],\n // Two digit day of the month, 01 to 31\n d: pad(dayOfMonth),\n // Day of the month, 1 through 31\n e: pad(dayOfMonth, 2, ' '),\n // Day of the week, 0 through 6\n w: day,\n // Week (none implemented)\n // 'W': weekNumber(),\n // Month\n // Short month, like 'Jan'\n b: lang.shortMonths[month],\n // Long month, like 'January'\n B: lang.months[month],\n // Two digit month number, 01 through 12\n m: pad(month + 1),\n // Month number, 1 through 12 (#8150)\n o: month + 1,\n // Year\n // Two digits year, like 09 for 2009\n y: fullYear.toString().substr(2, 2),\n // Four digits year, like 2009\n Y: fullYear,\n // Time\n // Two digits hours in 24h format, 00 through 23\n H: pad(hours),\n // Hours in 24h format, 0 through 23\n k: hours,\n // Two digits hours in 12h format, 00 through 11\n I: pad((hours % 12) || 12),\n // Hours in 12h format, 1 through 12\n l: (hours % 12) || 12,\n // Two digits minutes, 00 through 59\n M: pad(this.get('Minutes', date)),\n // Upper case AM or PM\n p: hours < 12 ? 'AM' : 'PM',\n // Lower case AM or PM\n P: hours < 12 ? 'am' : 'pm',\n // Two digits seconds, 00 through 59\n S: pad(this.get('Seconds', date)),\n // Milliseconds (naming from Ruby)\n L: pad(Math.floor(timestamp % 1000), 3)\n }, H.dateFormats);\n // Do the replaces\n objectEach(replacements, function (val, key) {\n // Regex would do it in one line, but this is faster\n while (format.indexOf('%' + key) !== -1) {\n format = format.replace('%' + key, typeof val === 'function' ? val.call(time, timestamp) : val);\n }\n });\n // Optionally capitalize the string and return\n return capitalize ?\n (format.substr(0, 1).toUpperCase() +\n format.substr(1)) :\n format;\n }\n /**\n * Resolve legacy formats of dateTimeLabelFormats (strings and arrays) into\n * an object.\n * @private\n * @param {string|Array|Highcharts.Dictionary} f\n * General format description\n * @return {Highcharts.Dictionary}\n * The object definition\n */\n resolveDTLFormat(f) {\n if (!isObject(f, true)) { // check for string or array\n f = splat(f);\n return {\n main: f[0],\n from: f[1],\n to: f[2]\n };\n }\n return f;\n }\n /**\n * Return an array with time positions distributed on round time values\n * right and right after min and max. Used in datetime axes as well as for\n * grouping data on a datetime axis.\n *\n * @function Highcharts.Time#getTimeTicks\n *\n * @param {Highcharts.TimeNormalizedObject} normalizedInterval\n * The interval in axis values (ms) and the count\n *\n * @param {number} [min]\n * The minimum in axis values\n *\n * @param {number} [max]\n * The maximum in axis values\n *\n * @param {number} [startOfWeek=1]\n *\n * @return {Highcharts.AxisTickPositionsArray}\n * Time positions\n */\n getTimeTicks(normalizedInterval, min, max, startOfWeek) {\n const time = this, Date = time.Date, tickPositions = [], higherRanks = {}, \n // When crossing DST, use the max. Resolves #6278.\n minDate = new Date(min), interval = normalizedInterval.unitRange, count = normalizedInterval.count || 1;\n let i, minYear, // used in months and years as a basis for Date.UTC()\n variableDayLength, minDay;\n startOfWeek = pick(startOfWeek, 1);\n if (defined(min)) { // #1300\n time.set('Milliseconds', minDate, interval >= timeUnits.second ?\n 0 : // #3935\n count * Math.floor(time.get('Milliseconds', minDate) / count)); // #3652, #3654\n if (interval >= timeUnits.second) { // second\n time.set('Seconds', minDate, interval >= timeUnits.minute ?\n 0 : // #3935\n count * Math.floor(time.get('Seconds', minDate) / count));\n }\n if (interval >= timeUnits.minute) { // minute\n time.set('Minutes', minDate, interval >= timeUnits.hour ?\n 0 :\n count * Math.floor(time.get('Minutes', minDate) / count));\n }\n if (interval >= timeUnits.hour) { // hour\n time.set('Hours', minDate, interval >= timeUnits.day ?\n 0 :\n count * Math.floor(time.get('Hours', minDate) / count));\n }\n if (interval >= timeUnits.day) { // day\n time.set('Date', minDate, interval >= timeUnits.month ?\n 1 :\n Math.max(1, count * Math.floor(time.get('Date', minDate) / count)));\n }\n if (interval >= timeUnits.month) { // month\n time.set('Month', minDate, interval >= timeUnits.year ? 0 :\n count * Math.floor(time.get('Month', minDate) / count));\n minYear = time.get('FullYear', minDate);\n }\n if (interval >= timeUnits.year) { // year\n minYear -= minYear % count;\n time.set('FullYear', minDate, minYear);\n }\n // week is a special case that runs outside the hierarchy\n if (interval === timeUnits.week) {\n // get start of current week, independent of count\n minDay = time.get('Day', minDate);\n time.set('Date', minDate, (time.get('Date', minDate) -\n minDay + startOfWeek +\n // We don't want to skip days that are before\n // startOfWeek (#7051)\n (minDay < startOfWeek ? -7 : 0)));\n }\n // Get basics for variable time spans\n minYear = time.get('FullYear', minDate);\n const minMonth = time.get('Month', minDate), minDateDate = time.get('Date', minDate), minHours = time.get('Hours', minDate);\n // Redefine min to the floored/rounded minimum time (#7432)\n min = minDate.getTime();\n // Handle local timezone offset\n if ((time.variableTimezone || !time.useUTC) && defined(max)) {\n // Detect whether we need to take the DST crossover into\n // consideration. If we're crossing over DST, the day length may\n // be 23h or 25h and we need to compute the exact clock time for\n // each tick instead of just adding hours. This comes at a cost,\n // so first we find out if it is needed (#4951).\n variableDayLength = (\n // Long range, assume we're crossing over.\n max - min > 4 * timeUnits.month ||\n // Short range, check if min and max are in different time\n // zones.\n time.getTimezoneOffset(min) !==\n time.getTimezoneOffset(max));\n }\n // Iterate and add tick positions at appropriate values\n let t = minDate.getTime();\n i = 1;\n while (t < max) {\n tickPositions.push(t);\n // if the interval is years, use Date.UTC to increase years\n if (interval === timeUnits.year) {\n t = time.makeTime(minYear + i * count, 0);\n // if the interval is months, use Date.UTC to increase months\n }\n else if (interval === timeUnits.month) {\n t = time.makeTime(minYear, minMonth + i * count);\n // if we're using global time, the interval is not fixed as it\n // jumps one hour at the DST crossover\n }\n else if (variableDayLength &&\n (interval === timeUnits.day || interval === timeUnits.week)) {\n t = time.makeTime(minYear, minMonth, minDateDate +\n i * count * (interval === timeUnits.day ? 1 : 7));\n }\n else if (variableDayLength &&\n interval === timeUnits.hour &&\n count > 1) {\n // make sure higher ranks are preserved across DST (#6797,\n // #7621)\n t = time.makeTime(minYear, minMonth, minDateDate, minHours + i * count);\n // else, the interval is fixed and we use simple addition\n }\n else {\n t += interval * count;\n }\n i++;\n }\n // push the last time\n tickPositions.push(t);\n // Handle higher ranks. Mark new days if the time is on midnight\n // (#950, #1649, #1760, #3349). Use a reasonable dropout threshold\n // to prevent looping over dense data grouping (#6156).\n if (interval <= timeUnits.hour && tickPositions.length < 10000) {\n tickPositions.forEach(function (t) {\n if (\n // Speed optimization, no need to run dateFormat unless\n // we're on a full or half hour\n t % 1800000 === 0 &&\n // Check for local or global midnight\n time.dateFormat('%H%M%S%L', t) === '000000000') {\n higherRanks[t] = 'day';\n }\n });\n }\n }\n // record information on the chosen unit - for dynamic label formatter\n tickPositions.info = extend(normalizedInterval, {\n higherRanks,\n totalRange: interval * count\n });\n return tickPositions;\n }\n /**\n * Get the optimal date format for a point, based on a range.\n *\n * @private\n * @function Highcharts.Time#getDateFormat\n *\n * @param {number} range\n * The time range\n *\n * @param {number} timestamp\n * The timestamp of the date\n *\n * @param {number} startOfWeek\n * An integer representing the first day of the week, where 0 is\n * Sunday.\n *\n * @param {Highcharts.Dictionary} dateTimeLabelFormats\n * A map of time units to formats.\n *\n * @return {string}\n * The optimal date format for a point.\n */\n getDateFormat(range, timestamp, startOfWeek, dateTimeLabelFormats) {\n const dateStr = this.dateFormat('%m-%d %H:%M:%S.%L', timestamp), blank = '01-01 00:00:00.000', strpos = {\n millisecond: 15,\n second: 12,\n minute: 9,\n hour: 6,\n day: 3\n };\n let n = 'millisecond', \n // for sub-millisecond data, #4223\n lastN = n;\n for (n in timeUnits) { // eslint-disable-line guard-for-in\n // If the range is exactly one week and we're looking at a\n // Sunday/Monday, go for the week format\n if (range === timeUnits.week &&\n +this.dateFormat('%w', timestamp) === startOfWeek &&\n dateStr.substr(6) === blank.substr(6)) {\n n = 'week';\n break;\n }\n // The first format that is too great for the range\n if (timeUnits[n] > range) {\n n = lastN;\n break;\n }\n // If the point is placed every day at 23:59, we need to show\n // the minutes as well. #2637.\n if (strpos[n] &&\n dateStr.substr(strpos[n]) !== blank.substr(strpos[n])) {\n break;\n }\n // Weeks are outside the hierarchy, only apply them on\n // Mondays/Sundays like in the first condition\n if (n !== 'week') {\n lastN = n;\n }\n }\n return this.resolveDTLFormat(dateTimeLabelFormats[n]).main;\n }\n}\nTime.formatCache = {};\n/* *\n *\n * Default export\n *\n * */\nexport default Time;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Normalized interval.\n *\n * @interface Highcharts.TimeNormalizedObject\n */ /**\n* The count.\n*\n* @name Highcharts.TimeNormalizedObject#count\n* @type {number|undefined}\n*/ /**\n* The interval in axis values (ms).\n*\n* @name Highcharts.TimeNormalizedObject#unitRange\n* @type {number}\n*/\n/**\n * Function of an additional date format specifier.\n *\n * @callback Highcharts.TimeFormatCallbackFunction\n *\n * @param {number} timestamp\n * The time to format.\n *\n * @return {string}\n * The formatted portion of the date.\n */\n/**\n * Time ticks.\n *\n * @interface Highcharts.AxisTickPositionsArray\n * @extends global.Array\n */ /**\n* @name Highcharts.AxisTickPositionsArray#info\n* @type {Highcharts.TimeTicksInfoObject|undefined}\n*/\n/**\n * A callback to return the time zone offset for a given datetime. It\n * takes the timestamp in terms of milliseconds since January 1 1970,\n * and returns the timezone offset in minutes. This provides a hook\n * for drawing time based charts in specific time zones using their\n * local DST crossover dates, with the help of external libraries.\n *\n * @callback Highcharts.TimezoneOffsetCallbackFunction\n *\n * @param {number} timestamp\n * Timestamp in terms of milliseconds since January 1 1970.\n *\n * @return {number}\n * Timezone offset in minutes.\n */\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport ChartDefaults from './Chart/ChartDefaults.js';\nimport H from './Globals.js';\nconst { isTouchDevice, svg } = H;\nimport Palettes from './Color/Palettes.js';\nimport Time from './Time.js';\nimport U from './Utilities.js';\nconst { merge } = U;\n/* *\n *\n * API Options\n *\n * */\n/**\n * Global default settings.\n *\n * @name Highcharts.defaultOptions\n * @type {Highcharts.Options}\n */ /**\n* @optionparent\n* @private\n*/\nconst defaultOptions = {\n /**\n * An array containing the default colors for the chart's series. When\n * all colors are used, new colors are pulled from the start again.\n *\n * Default colors can also be set on a series or series.type basis,\n * see [column.colors](#plotOptions.column.colors),\n * [pie.colors](#plotOptions.pie.colors).\n *\n * In styled mode, the colors option doesn't exist. Instead, colors\n * are defined in CSS and applied either through series or point class\n * names, or through the [chart.colorCount](#chart.colorCount) option.\n *\n * @sample {highcharts} highcharts/chart/colors/\n * Assign a global color theme\n * @sample highcharts/members/theme-v10/\n * Latest release styled like version 10\n *\n * @type {Array<(Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject)>}\n * @default [\n * \"#2caffe\",\n * \"#544fc5\",\n * \"#00e272\",\n * \"#fe6a35\",\n * \"#6b8abc\",\n * \"#d568fb\",\n * \"#2ee0ca\",\n * \"#fa4b42\",\n * \"#feb56a\",\n * \"#91e8e1\"\n * ]\n */\n colors: Palettes.colors,\n /**\n * Styled mode only. Configuration object for adding SVG definitions for\n * reusable elements. See [gradients, shadows and\n * patterns](https://www.highcharts.com/docs/chart-design-and-style/gradients-shadows-and-patterns)\n * for more information and code examples.\n *\n * @type {*}\n * @since 5.0.0\n * @apioption defs\n */\n /**\n * @ignore-option\n */\n symbols: ['circle', 'diamond', 'square', 'triangle', 'triangle-down'],\n /**\n * The language object is global and it can't be set on each chart\n * initialization. Instead, use `Highcharts.setOptions` to set it before any\n * chart is initialized.\n *\n * ```js\n * Highcharts.setOptions({\n * lang: {\n * months: [\n * 'Janvier', 'F\u00E9vrier', 'Mars', 'Avril',\n * 'Mai', 'Juin', 'Juillet', 'Ao\u00FBt',\n * 'Septembre', 'Octobre', 'Novembre', 'D\u00E9cembre'\n * ],\n * weekdays: [\n * 'Dimanche', 'Lundi', 'Mardi', 'Mercredi',\n * 'Jeudi', 'Vendredi', 'Samedi'\n * ]\n * }\n * });\n * ```\n */\n lang: {\n /**\n * The loading text that appears when the chart is set into the loading\n * state following a call to `chart.showLoading`.\n */\n loading: 'Loading...',\n /**\n * An array containing the months names. Corresponds to the `%B` format\n * in `Highcharts.dateFormat()`.\n *\n * @type {Array}\n * @default [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\n * \"July\", \"August\", \"September\", \"October\", \"November\",\n * \"December\"]\n */\n months: [\n 'January', 'February', 'March', 'April', 'May', 'June', 'July',\n 'August', 'September', 'October', 'November', 'December'\n ],\n /**\n * An array containing the months names in abbreviated form. Corresponds\n * to the `%b` format in `Highcharts.dateFormat()`.\n *\n * @type {Array}\n * @default [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\",\n * \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n */\n shortMonths: [\n 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',\n 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'\n ],\n /**\n * An array containing the weekday names.\n *\n * @type {Array}\n * @default [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\",\n * \"Friday\", \"Saturday\"]\n */\n weekdays: [\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday',\n 'Thursday', 'Friday', 'Saturday'\n ],\n /**\n * Short week days, starting Sunday. If not specified, Highcharts uses\n * the first three letters of the `lang.weekdays` option.\n *\n * @sample highcharts/lang/shortweekdays/\n * Finnish two-letter abbreviations\n *\n * @type {Array}\n * @since 4.2.4\n * @apioption lang.shortWeekdays\n */\n /**\n * What to show in a date field for invalid dates. Defaults to an empty\n * string.\n *\n * @type {string}\n * @since 4.1.8\n * @product highcharts highstock\n * @apioption lang.invalidDate\n */\n /**\n * The title appearing on hovering the zoom in button. The text itself\n * defaults to \"+\" and can be changed in the button options.\n *\n * @type {string}\n * @default Zoom in\n * @product highmaps\n * @apioption lang.zoomIn\n */\n /**\n * The title appearing on hovering the zoom out button. The text itself\n * defaults to \"-\" and can be changed in the button options.\n *\n * @type {string}\n * @default Zoom out\n * @product highmaps\n * @apioption lang.zoomOut\n */\n /**\n * The default decimal point used in the `Highcharts.numberFormat`\n * method unless otherwise specified in the function arguments.\n *\n * @since 1.2.2\n */\n decimalPoint: '.',\n /**\n * [Metric prefixes](https://en.wikipedia.org/wiki/Metric_prefix) used\n * to shorten high numbers in axis labels. Replacing any of the\n * positions with `null` causes the full number to be written. Setting\n * `numericSymbols` to `undefined` disables shortening altogether.\n *\n * @sample {highcharts} highcharts/lang/numericsymbols/\n * Replacing the symbols with text\n * @sample {highstock} highcharts/lang/numericsymbols/\n * Replacing the symbols with text\n *\n * @type {Array}\n * @default [\"k\", \"M\", \"G\", \"T\", \"P\", \"E\"]\n * @since 2.3.0\n */\n numericSymbols: ['k', 'M', 'G', 'T', 'P', 'E'],\n /**\n * The magnitude of [numericSymbols](#lang.numericSymbol) replacements.\n * Use 10000 for Japanese, Korean and various Chinese locales, which\n * use symbols for 10^4, 10^8 and 10^12.\n *\n * @sample highcharts/lang/numericsymbolmagnitude/\n * 10000 magnitude for Japanese\n *\n * @type {number}\n * @default 1000\n * @since 5.0.3\n * @apioption lang.numericSymbolMagnitude\n */\n /**\n * The text for the label appearing when a chart is zoomed.\n *\n * @since 1.2.4\n */\n resetZoom: 'Reset zoom',\n /**\n * The tooltip title for the label appearing when a chart is zoomed.\n *\n * @since 1.2.4\n */\n resetZoomTitle: 'Reset zoom level 1:1',\n /**\n * The default thousands separator used in the `Highcharts.numberFormat`\n * method unless otherwise specified in the function arguments. Defaults\n * to a single space character, which is recommended in\n * [ISO 31-0](https://en.wikipedia.org/wiki/ISO_31-0#Numbers) and works\n * across Anglo-American and continental European languages.\n *\n * @default \\u0020\n * @since 1.2.2\n */\n thousandsSep: ' '\n },\n /**\n * Global options that don't apply to each chart. These options, like\n * the `lang` options, must be set using the `Highcharts.setOptions`\n * method.\n *\n * ```js\n * Highcharts.setOptions({\n * global: {\n * useUTC: false\n * }\n * });\n * ```\n */\n /**\n * _Canvg rendering for Android 2.x is removed as of Highcharts 5.0\\.\n * Use the [libURL](#exporting.libURL) option to configure exporting._\n *\n * The URL to the additional file to lazy load for Android 2.x devices.\n * These devices don't support SVG, so we download a helper file that\n * contains [canvg](https://github.com/canvg/canvg), its dependency\n * rbcolor, and our own CanVG Renderer class. To avoid hotlinking to\n * our site, you can install canvas-tools.js on your own server and\n * change this option accordingly.\n *\n * @deprecated\n *\n * @type {string}\n * @default https://code.highcharts.com/{version}/modules/canvas-tools.js\n * @product highcharts highmaps\n * @apioption global.canvasToolsURL\n */\n /**\n * This option is deprecated since v6.0.5. Instead, use\n * [time.useUTC](#time.useUTC) that supports individual time settings\n * per chart.\n *\n * @deprecated\n *\n * @type {boolean}\n * @apioption global.useUTC\n */\n /**\n * This option is deprecated since v6.0.5. Instead, use\n * [time.Date](#time.Date) that supports individual time settings\n * per chart.\n *\n * @deprecated\n *\n * @type {Function}\n * @product highcharts highstock\n * @apioption global.Date\n */\n /**\n * This option is deprecated since v6.0.5. Instead, use\n * [time.getTimezoneOffset](#time.getTimezoneOffset) that supports\n * individual time settings per chart.\n *\n * @deprecated\n *\n * @type {Function}\n * @product highcharts highstock\n * @apioption global.getTimezoneOffset\n */\n /**\n * This option is deprecated since v6.0.5. Instead, use\n * [time.timezone](#time.timezone) that supports individual time\n * settings per chart.\n *\n * @deprecated\n *\n * @type {string}\n * @product highcharts highstock\n * @apioption global.timezone\n */\n /**\n * This option is deprecated since v6.0.5. Instead, use\n * [time.timezoneOffset](#time.timezoneOffset) that supports individual\n * time settings per chart.\n *\n * @deprecated\n *\n * @type {number}\n * @product highcharts highstock\n * @apioption global.timezoneOffset\n */\n global: {},\n /**\n * Time options that can apply globally or to individual charts. These\n * settings affect how `datetime` axes are laid out, how tooltips are\n * formatted, how series\n * [pointIntervalUnit](#plotOptions.series.pointIntervalUnit) works and how\n * the Highcharts Stock range selector handles time.\n *\n * The common use case is that all charts in the same Highcharts object\n * share the same time settings, in which case the global settings are set\n * using `setOptions`.\n *\n * ```js\n * // Apply time settings globally\n * Highcharts.setOptions({\n * time: {\n * timezone: 'Europe/London'\n * }\n * });\n * // Apply time settings by instance\n * let chart = Highcharts.chart('container', {\n * time: {\n * timezone: 'America/New_York'\n * },\n * series: [{\n * data: [1, 4, 3, 5]\n * }]\n * });\n *\n * // Use the Time object\n * console.log(\n * 'Current time in New York',\n * chart.time.dateFormat('%Y-%m-%d %H:%M:%S', Date.now())\n * );\n * ```\n *\n * Since v6.0.5, the time options were moved from the `global` object to the\n * `time` object, and time options can be set on each individual chart.\n *\n * @sample {highcharts|highstock}\n * highcharts/time/timezone/\n * Set the timezone globally\n * @sample {highcharts}\n * highcharts/time/individual/\n * Set the timezone per chart instance\n * @sample {highstock}\n * stock/time/individual/\n * Set the timezone per chart instance\n *\n * @since 6.0.5\n * @optionparent time\n */\n time: {\n /**\n * A custom `Date` class for advanced date handling. For example,\n * [JDate](https://github.com/tahajahangir/jdate) can be hooked in to\n * handle Jalali dates.\n *\n * @type {*}\n * @since 4.0.4\n * @product highcharts highstock gantt\n */\n Date: void 0,\n /**\n * A callback to return the time zone offset for a given datetime. It\n * takes the timestamp in terms of milliseconds since January 1 1970,\n * and returns the timezone offset in minutes. This provides a hook\n * for drawing time based charts in specific time zones using their\n * local DST crossover dates, with the help of external libraries.\n *\n * @see [global.timezoneOffset](#global.timezoneOffset)\n *\n * @sample {highcharts|highstock} highcharts/time/gettimezoneoffset/\n * Use moment.js to draw Oslo time regardless of browser locale\n *\n * @type {Highcharts.TimezoneOffsetCallbackFunction}\n * @since 4.1.0\n * @product highcharts highstock gantt\n */\n getTimezoneOffset: void 0,\n /**\n * A named time zone. Supported time zone names rely on the browser\n * implementations, as described in the [mdn\n * docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#timezone).\n * If the given time zone is not recognized by the browser, Highcharts\n * provides a warning and falls back to returning a 0 offset,\n * corresponding to the UCT time zone.\n *\n * Until v11.2.0, this option depended on moment.js.\n *\n * @see [getTimezoneOffset](#time.getTimezoneOffset)\n *\n * @sample {highcharts|highstock} highcharts/time/timezone/ Europe/Oslo\n *\n * @type {string}\n * @since 5.0.7\n * @product highcharts highstock gantt\n */\n timezone: void 0,\n /**\n * The timezone offset in minutes. Positive values are west, negative\n * values are east of UTC, as in the ECMAScript\n * [getTimezoneOffset](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset)\n * method. Use this to display UTC based data in a predefined time zone.\n *\n * @see [time.getTimezoneOffset](#time.getTimezoneOffset)\n *\n * @sample {highcharts|highstock} highcharts/time/timezoneoffset/\n * Timezone offset\n *\n * @since 3.0.8\n * @product highcharts highstock gantt\n */\n timezoneOffset: 0,\n /**\n * Whether to use UTC time for axis scaling, tickmark placement and\n * time display in `Highcharts.dateFormat`. Advantages of using UTC\n * is that the time displays equally regardless of the user agent's\n * time zone settings. Local time can be used when the data is loaded\n * in real time or when correct Daylight Saving Time transitions are\n * required.\n *\n * @sample {highcharts} highcharts/time/useutc-true/\n * True by default\n * @sample {highcharts} highcharts/time/useutc-false/\n * False\n */\n useUTC: true\n },\n chart: ChartDefaults,\n /**\n * The chart's main title.\n *\n * @sample {highmaps} maps/title/title/\n * Title options demonstrated\n */\n title: {\n /**\n * When the title is floating, the plot area will not move to make space\n * for it.\n *\n * @sample {highcharts} highcharts/chart/zoomtype-none/\n * False by default\n * @sample {highcharts} highcharts/title/floating/\n * True - title on top of the plot area\n * @sample {highstock} stock/chart/title-floating/\n * True - title on top of the plot area\n *\n * @type {boolean}\n * @default false\n * @since 2.1\n * @apioption title.floating\n */\n /**\n * Whether to\n * [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the text.\n *\n * @type {boolean}\n * @default false\n * @apioption title.useHTML\n */\n /**\n * The vertical alignment of the title. Can be one of `\"top\"`,\n * `\"middle\"` and `\"bottom\"`. When a value is given, the title behaves\n * as if [floating](#title.floating) were `true`.\n *\n * @sample {highcharts} highcharts/title/verticalalign/\n * Chart title in bottom right corner\n * @sample {highstock} stock/chart/title-verticalalign/\n * Chart title in bottom right corner\n *\n * @type {Highcharts.VerticalAlignValue}\n * @since 2.1\n * @apioption title.verticalAlign\n */\n /**\n * The x position of the title relative to the alignment within\n * `chart.spacingLeft` and `chart.spacingRight`.\n *\n * @sample {highcharts} highcharts/title/align/\n * Aligned to the plot area (x = 70px = margin left - spacing\n * left)\n * @sample {highstock} stock/chart/title-align/\n * Aligned to the plot area (x = 50px = margin left - spacing\n * left)\n *\n * @type {number}\n * @default 0\n * @since 2.0\n * @apioption title.x\n */\n /**\n * The y position of the title relative to the alignment within\n * [chart.spacingTop](#chart.spacingTop) and [chart.spacingBottom](\n * #chart.spacingBottom). By default it depends on the font size.\n *\n * @sample {highcharts} highcharts/title/y/\n * Title inside the plot area\n * @sample {highstock} stock/chart/title-verticalalign/\n * Chart title in bottom right corner\n *\n * @type {number}\n * @since 2.0\n * @apioption title.y\n */\n /**\n * CSS styles for the title. Use this for font styling, but use `align`,\n * `x` and `y` for text alignment.\n *\n * In styled mode, the title style is given in the `.highcharts-title`\n * class.\n *\n * @sample {highcharts} highcharts/title/style/\n * Custom color and weight\n * @sample {highstock} stock/chart/title-style/\n * Custom color and weight\n * @sample highcharts/css/titles/\n * Styled mode\n *\n * @type {Highcharts.CSSObject}\n * @default {highcharts|highmaps} { \"color\": \"#333333\", \"fontSize\": \"18px\" }\n * @default {highstock} { \"color\": \"#333333\", \"fontSize\": \"16px\" }\n */\n style: {\n color: \"#333333\" /* Palette.neutralColor80 */,\n fontWeight: 'bold'\n },\n /**\n * The title of the chart. To disable the title, set the `text` to\n * `undefined`.\n *\n * @sample {highcharts} highcharts/title/text/\n * Custom title\n * @sample {highstock} stock/chart/title-text/\n * Custom title\n *\n * @default {highcharts|highmaps} Chart title\n * @default {highstock} undefined\n */\n text: 'Chart title',\n /**\n * The horizontal alignment of the title. Can be one of \"left\", \"center\"\n * and \"right\".\n *\n * @sample {highcharts} highcharts/title/align/\n * Aligned to the plot area (x = 70px = margin left - spacing\n * left)\n * @sample {highstock} stock/chart/title-align/\n * Aligned to the plot area (x = 50px = margin left - spacing\n * left)\n *\n * @type {Highcharts.AlignValue}\n * @since 2.0\n */\n align: 'center',\n /**\n * The margin between the title and the plot area, or if a subtitle\n * is present, the margin between the subtitle and the plot area.\n *\n * @sample {highcharts} highcharts/title/margin-50/\n * A chart title margin of 50\n * @sample {highcharts} highcharts/title/margin-subtitle/\n * The same margin applied with a subtitle\n * @sample {highstock} stock/chart/title-margin/\n * A chart title margin of 50\n *\n * @since 2.1\n */\n margin: 15,\n /**\n * Adjustment made to the title width, normally to reserve space for\n * the exporting burger menu.\n *\n * @sample highcharts/title/widthadjust/\n * Wider menu, greater padding\n *\n * @since 4.2.5\n */\n widthAdjust: -44\n },\n /**\n * The chart's subtitle. This can be used both to display a subtitle below\n * the main title, and to display random text anywhere in the chart. The\n * subtitle can be updated after chart initialization through the\n * `Chart.setTitle` method.\n *\n * @sample {highmaps} maps/title/subtitle/\n * Subtitle options demonstrated\n */\n subtitle: {\n /**\n * When the subtitle is floating, the plot area will not move to make\n * space for it.\n *\n * @sample {highcharts} highcharts/subtitle/floating/\n * Floating title and subtitle\n * @sample {highstock} stock/chart/subtitle-footnote\n * Footnote floating at bottom right of plot area\n *\n * @type {boolean}\n * @default false\n * @since 2.1\n * @apioption subtitle.floating\n */\n /**\n * CSS styles for the title.\n *\n * In styled mode, the subtitle style is given in the\n * `.highcharts-subtitle` class.\n *\n * @sample {highcharts} highcharts/subtitle/style/\n * Custom color and weight\n * @sample {highcharts} highcharts/css/titles/\n * Styled mode\n * @sample {highstock} stock/chart/subtitle-style\n * Custom color and weight\n * @sample {highstock} highcharts/css/titles/\n * Styled mode\n * @sample {highmaps} highcharts/css/titles/\n * Styled mode\n *\n * @type {Highcharts.CSSObject}\n * @default {\"color\": \"#666666\"}\n * @apioption subtitle.style\n */\n /**\n * Whether to\n * [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the text.\n *\n * @type {boolean}\n * @default false\n * @apioption subtitle.useHTML\n */\n /**\n * The vertical alignment of the title. Can be one of `\"top\"`,\n * `\"middle\"` and `\"bottom\"`. When middle, the subtitle behaves as\n * floating.\n *\n * @sample {highcharts} highcharts/subtitle/verticalalign/\n * Footnote at the bottom right of plot area\n * @sample {highstock} stock/chart/subtitle-footnote\n * Footnote at the bottom right of plot area\n *\n * @type {Highcharts.VerticalAlignValue}\n * @since 2.1\n * @apioption subtitle.verticalAlign\n */\n /**\n * The x position of the subtitle relative to the alignment within\n * `chart.spacingLeft` and `chart.spacingRight`.\n *\n * @sample {highcharts} highcharts/subtitle/align/\n * Footnote at right of plot area\n * @sample {highstock} stock/chart/subtitle-footnote\n * Footnote at the bottom right of plot area\n *\n * @type {number}\n * @default 0\n * @since 2.0\n * @apioption subtitle.x\n */\n /**\n * The y position of the subtitle relative to the alignment within\n * `chart.spacingTop` and `chart.spacingBottom`. By default the subtitle\n * is laid out below the title unless the title is floating.\n *\n * @sample {highcharts} highcharts/subtitle/verticalalign/\n * Footnote at the bottom right of plot area\n * @sample {highstock} stock/chart/subtitle-footnote\n * Footnote at the bottom right of plot area\n *\n * @type {number}\n * @since 2.0\n * @apioption subtitle.y\n */\n /**\n * CSS styles for the title.\n *\n * In styled mode, the subtitle style is given in the\n * `.highcharts-subtitle` class.\n *\n * @sample {highcharts} highcharts/subtitle/style/\n * Custom color and weight\n * @sample {highcharts} highcharts/css/titles/\n * Styled mode\n * @sample {highstock} stock/chart/subtitle-style\n * Custom color and weight\n * @sample {highstock} highcharts/css/titles/\n * Styled mode\n * @sample {highmaps} highcharts/css/titles/\n * Styled mode\n *\n * @type {Highcharts.CSSObject}\n * @default {\"color\": \"#666666\"}\n */\n style: {\n color: \"#666666\" /* Palette.neutralColor60 */,\n fontSize: '0.8em'\n },\n /**\n * The subtitle of the chart.\n *\n * @sample {highcharts|highstock} highcharts/subtitle/text/\n * Custom subtitle\n * @sample {highcharts|highstock} highcharts/subtitle/text-formatted/\n * Formatted and linked text.\n */\n text: '',\n /**\n * The horizontal alignment of the subtitle. Can be one of \"left\",\n * \"center\" and \"right\".\n *\n * @sample {highcharts} highcharts/subtitle/align/\n * Footnote at right of plot area\n * @sample {highstock} stock/chart/subtitle-footnote\n * Footnote at bottom right of plot area\n *\n * @type {Highcharts.AlignValue}\n * @since 2.0\n */\n align: 'center',\n /**\n * Adjustment made to the subtitle width, normally to reserve space\n * for the exporting burger menu.\n *\n * @see [title.widthAdjust](#title.widthAdjust)\n *\n * @sample highcharts/title/widthadjust/\n * Wider menu, greater padding\n *\n * @since 4.2.5\n */\n widthAdjust: -44\n },\n /**\n * The chart's caption, which will render below the chart and will be part\n * of exported charts. The caption can be updated after chart initialization\n * through the `Chart.update` or `Chart.caption.update` methods.\n *\n * @sample highcharts/caption/text/\n * A chart with a caption\n * @since 7.2.0\n */\n caption: {\n /**\n * When the caption is floating, the plot area will not move to make\n * space for it.\n *\n * @type {boolean}\n * @default false\n * @apioption caption.floating\n */\n /**\n * The margin between the caption and the plot area.\n */\n margin: 15,\n /**\n * Whether to\n * [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the text.\n *\n * @type {boolean}\n * @default false\n * @apioption caption.useHTML\n */\n /**\n * The x position of the caption relative to the alignment within\n * `chart.spacingLeft` and `chart.spacingRight`.\n *\n * @type {number}\n * @default 0\n * @apioption caption.x\n */\n /**\n * The y position of the caption relative to the alignment within\n * `chart.spacingTop` and `chart.spacingBottom`.\n *\n * @type {number}\n * @apioption caption.y\n */\n /**\n * CSS styles for the caption.\n *\n * In styled mode, the caption style is given in the\n * `.highcharts-caption` class.\n *\n * @sample {highcharts} highcharts/css/titles/\n * Styled mode\n *\n * @type {Highcharts.CSSObject}\n * @default {\"color\": \"#666666\"}\n */\n style: {\n color: \"#666666\" /* Palette.neutralColor60 */,\n fontSize: '0.8em'\n },\n /**\n * The caption text of the chart.\n *\n * @sample {highcharts} highcharts/caption/text/\n * Custom caption\n */\n text: '',\n /**\n * The horizontal alignment of the caption. Can be one of \"left\",\n * \"center\" and \"right\".\n *\n * @type {Highcharts.AlignValue}\n */\n align: 'left',\n /**\n * The vertical alignment of the caption. Can be one of `\"top\"`,\n * `\"middle\"` and `\"bottom\"`. When middle, the caption behaves as\n * floating.\n *\n * @type {Highcharts.VerticalAlignValue}\n */\n verticalAlign: 'bottom'\n },\n /**\n * The plotOptions is a wrapper object for config objects for each series\n * type. The config objects for each series can also be overridden for\n * each series item as given in the series array.\n *\n * Configuration options for the series are given in three levels. Options\n * for all series in a chart are given in the [plotOptions.series](\n * #plotOptions.series) object. Then options for all series of a specific\n * type are given in the plotOptions of that type, for example\n * `plotOptions.line`. Next, options for one single series are given in\n * [the series array](#series).\n */\n plotOptions: {},\n /**\n * The legend is a box containing a symbol and name for each series\n * item or point item in the chart. Each series (or points in case\n * of pie charts) is represented by a symbol and its name in the legend.\n *\n * It is possible to override the symbol creator function and create\n * [custom legend symbols](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/studies/legend-custom-symbol/).\n *\n * @productdesc {highmaps}\n * A Highmaps legend by default contains one legend item per series, but if\n * a `colorAxis` is defined, the axis will be displayed in the legend.\n * Either as a gradient, or as multiple legend items for `dataClasses`.\n */\n legend: {\n /**\n * The background color of the legend.\n *\n * @see In styled mode, the legend background fill can be applied with\n * the `.highcharts-legend-box` class.\n *\n * @sample {highcharts} highcharts/legend/backgroundcolor/\n * Yellowish background\n * @sample {highstock} stock/legend/align/\n * Various legend options\n * @sample {highmaps} maps/legend/border-background/\n * Border and background options\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption legend.backgroundColor\n */\n /**\n * The width of the drawn border around the legend.\n *\n * @see In styled mode, the legend border stroke width can be applied\n * with the `.highcharts-legend-box` class.\n *\n * @sample {highcharts} highcharts/legend/borderwidth/\n * 2px border width\n * @sample {highstock} stock/legend/align/\n * Various legend options\n * @sample {highmaps} maps/legend/border-background/\n * Border and background options\n *\n * @type {number}\n * @default 0\n * @apioption legend.borderWidth\n */\n /**\n * Enable or disable the legend. There is also a series-specific option,\n * [showInLegend](#plotOptions.series.showInLegend), that can hide the\n * series from the legend. In some series types this is `false` by\n * default, so it must set to `true` in order to show the legend for the\n * series.\n *\n * @sample {highcharts} highcharts/legend/enabled-false/ Legend disabled\n * @sample {highstock} stock/legend/align/ Various legend options\n * @sample {highmaps} maps/legend/enabled-false/ Legend disabled\n *\n * @default {highstock} false\n * @default {highmaps} true\n * @default {gantt} false\n */\n enabled: true,\n /**\n * The horizontal alignment of the legend box within the chart area.\n * Valid values are `left`, `center` and `right`.\n *\n * In the case that the legend is aligned in a corner position, the\n * `layout` option will determine whether to place it above/below\n * or on the side of the plot area.\n *\n * @sample {highcharts} highcharts/legend/align/\n * Legend at the right of the chart\n * @sample {highstock} stock/legend/align/\n * Various legend options\n * @sample {highmaps} maps/legend/alignment/\n * Legend alignment\n *\n * @type {Highcharts.AlignValue}\n * @since 2.0\n */\n align: 'center',\n /**\n * If the [layout](legend.layout) is `horizontal` and the legend items\n * span over two lines or more, whether to align the items into vertical\n * columns. Setting this to `false` makes room for more items, but will\n * look more messy.\n *\n * @since 6.1.0\n */\n alignColumns: true,\n /**\n * A CSS class name to apply to the legend group.\n */\n className: 'highcharts-no-tooltip',\n /**\n * When the legend is floating, the plot area ignores it and is allowed\n * to be placed below it.\n *\n * @sample {highcharts} highcharts/legend/floating-false/\n * False by default\n * @sample {highcharts} highcharts/legend/floating-true/\n * True\n * @sample {highmaps} maps/legend/alignment/\n * Floating legend\n *\n * @type {boolean}\n * @default false\n * @since 2.1\n * @apioption legend.floating\n */\n /**\n * The layout of the legend items. Can be one of `horizontal` or\n * `vertical` or `proximate`. When `proximate`, the legend items will be\n * placed as close as possible to the graphs they're representing,\n * except in inverted charts or when the legend position doesn't allow\n * it.\n *\n * @sample {highcharts} highcharts/legend/layout-horizontal/\n * Horizontal by default\n * @sample {highcharts} highcharts/legend/layout-vertical/\n * Vertical\n * @sample highcharts/legend/layout-proximate\n * Labels proximate to the data\n * @sample {highstock} stock/legend/layout-horizontal/\n * Horizontal by default\n * @sample {highmaps} maps/legend/padding-itemmargin/\n * Vertical with data classes\n * @sample {highmaps} maps/legend/layout-vertical/\n * Vertical with color axis gradient\n *\n * @validvalue [\"horizontal\", \"vertical\", \"proximate\"]\n */\n layout: 'horizontal',\n /**\n * In a legend with horizontal layout, the itemDistance defines the\n * pixel distance between each item.\n *\n * @sample {highcharts} highcharts/legend/layout-horizontal/\n * 50px item distance\n * @sample {highstock} highcharts/legend/layout-horizontal/\n * 50px item distance\n *\n * @type {number}\n * @default {highcharts} 20\n * @default {highstock} 20\n * @default {highmaps} 8\n * @since 3.0.3\n * @apioption legend.itemDistance\n */\n /**\n * The pixel bottom margin for each legend item.\n *\n * @sample {highcharts|highstock} highcharts/legend/padding-itemmargin/\n * Padding and item margins demonstrated\n * @sample {highmaps} maps/legend/padding-itemmargin/\n * Padding and item margins demonstrated\n *\n * @since 2.2.0\n */\n itemMarginBottom: 2,\n /**\n * The pixel top margin for each legend item.\n *\n * @sample {highcharts|highstock} highcharts/legend/padding-itemmargin/\n * Padding and item margins demonstrated\n * @sample {highmaps} maps/legend/padding-itemmargin/\n * Padding and item margins demonstrated\n *\n * @since 2.2.0\n */\n itemMarginTop: 2,\n /**\n * The width for each legend item. By default the items are laid out\n * successively. In a [horizontal layout](legend.layout), if the items\n * are laid out across two rows or more, they will be vertically aligned\n * depending on the [legend.alignColumns](legend.alignColumns) option.\n *\n * @sample {highcharts} highcharts/legend/itemwidth-default/\n * Undefined by default\n * @sample {highcharts} highcharts/legend/itemwidth-80/\n * 80 for aligned legend items\n *\n * @type {number}\n * @since 2.0\n * @apioption legend.itemWidth\n */\n /**\n * A [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)\n * for each legend label. Available variables relates to properties on\n * the series, or the point in case of pies.\n *\n * @type {string}\n * @default {name}\n * @since 1.3\n * @apioption legend.labelFormat\n */\n /* eslint-disable valid-jsdoc */\n /**\n * Callback function to format each of the series' labels. The `this`\n * keyword refers to the series object, or the point object in case of\n * pie charts. By default the series or point name is printed.\n *\n * @productdesc {highmaps}\n * In Highmaps the context can also be a data class in case of a\n * `colorAxis`.\n *\n * @sample {highcharts} highcharts/legend/labelformatter/\n * Add text\n * @sample {highmaps} maps/legend/labelformatter/\n * Data classes with label formatter\n *\n * @type {Highcharts.FormatterCallbackFunction}\n */\n labelFormatter: function () {\n /** eslint-enable valid-jsdoc */\n return this.name;\n },\n /**\n * Line height for the legend items. Deprecated as of 2.1\\. Instead,\n * the line height for each item can be set using\n * `itemStyle.lineHeight`, and the padding between items using\n * `itemMarginTop` and `itemMarginBottom`.\n *\n * @sample {highcharts} highcharts/legend/lineheight/\n * Setting padding\n *\n * @deprecated\n *\n * @type {number}\n * @default 16\n * @since 2.0\n * @product highcharts gantt\n * @apioption legend.lineHeight\n */\n /**\n * If the plot area sized is calculated automatically and the legend is\n * not floating, the legend margin is the space between the legend and\n * the axis labels or plot area.\n *\n * @sample {highcharts} highcharts/legend/margin-default/\n * 12 pixels by default\n * @sample {highcharts} highcharts/legend/margin-30/\n * 30 pixels\n *\n * @type {number}\n * @default 12\n * @since 2.1\n * @apioption legend.margin\n */\n /**\n * Maximum pixel height for the legend. When the maximum height is\n * extended, navigation will show.\n *\n * @type {number}\n * @since 2.3.0\n * @apioption legend.maxHeight\n */\n /**\n * The color of the drawn border around the legend.\n *\n * @see In styled mode, the legend border stroke can be applied with the\n * `.highcharts-legend-box` class.\n *\n * @sample {highcharts} highcharts/legend/bordercolor/\n * Brown border\n * @sample {highstock} stock/legend/align/\n * Various legend options\n * @sample {highmaps} maps/legend/border-background/\n * Border and background options\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n borderColor: \"#999999\" /* Palette.neutralColor40 */,\n /**\n * The border corner radius of the legend.\n *\n * @sample {highcharts} highcharts/legend/borderradius-default/\n * Square by default\n * @sample {highcharts} highcharts/legend/borderradius-round/\n * 5px rounded\n * @sample {highmaps} maps/legend/border-background/\n * Border and background options\n */\n borderRadius: 0,\n /**\n * Options for the paging or navigation appearing when the legend is\n * overflown. Navigation works well on screen, but not in static\n * exported images. One way of working around that is to\n * [increase the chart height in\n * export](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/legend/navigation-enabled-false/).\n *\n * @sample highcharts/legend/scrollable-vertical/\n * Legend with vertical scrollable extension\n * @sample highcharts/legend/scrollable-horizontal/\n * Legend with horizontal scrollable extension\n *\n */\n navigation: {\n /**\n * How to animate the pages when navigating up or down. A value of\n * `true` applies the default navigation given in the\n * `chart.animation` option. Additional options can be given as an\n * object containing values for easing and duration.\n *\n * @sample {highcharts} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n * @sample {highstock} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n *\n * @type {boolean|Partial}\n * @default true\n * @since 2.2.4\n * @apioption legend.navigation.animation\n */\n /**\n * The pixel size of the up and down arrows in the legend paging\n * navigation.\n *\n * @sample {highcharts} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n * @sample {highstock} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n *\n * @type {number}\n * @default 12\n * @since 2.2.4\n * @apioption legend.navigation.arrowSize\n */\n /**\n * Whether to enable the legend navigation. In most cases, disabling\n * the navigation results in an unwanted overflow.\n *\n * See also the\n * [adapt chart to legend](https://github.com/highcharts/adapt-chart-to-legend)\n * plugin for a solution to extend the chart height to make room for\n * the legend, optionally in exported charts only.\n *\n * @type {boolean}\n * @default true\n * @since 4.2.4\n * @apioption legend.navigation.enabled\n */\n /**\n * Text styles for the legend page navigation.\n *\n * @see In styled mode, the navigation items are styled with the\n * `.highcharts-legend-navigation` class.\n *\n * @sample {highcharts} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n * @sample {highstock} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n *\n * @type {Highcharts.CSSObject}\n * @since 2.2.4\n * @apioption legend.navigation.style\n */\n style: {\n fontSize: '0.8em'\n },\n /**\n * The color for the active up or down arrow in the legend page\n * navigation.\n *\n * @see In styled mode, the active arrow be styled with the\n * `.highcharts-legend-nav-active` class.\n *\n * @sample {highcharts} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n * @sample {highstock} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 2.2.4\n */\n activeColor: \"#0022ff\" /* Palette.highlightColor100 */,\n /**\n * The color of the inactive up or down arrow in the legend page\n * navigation. .\n *\n * @see In styled mode, the inactive arrow be styled with the\n * `.highcharts-legend-nav-inactive` class.\n *\n * @sample {highcharts} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n * @sample {highstock} highcharts/legend/navigation/\n * Legend page navigation demonstrated\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 2.2.4\n */\n inactiveColor: \"#cccccc\" /* Palette.neutralColor20 */\n },\n /**\n * The inner padding of the legend box.\n *\n * @sample {highcharts|highstock} highcharts/legend/padding-itemmargin/\n * Padding and item margins demonstrated\n * @sample {highmaps} maps/legend/padding-itemmargin/\n * Padding and item margins demonstrated\n *\n * @type {number}\n * @default 8\n * @since 2.2.0\n * @apioption legend.padding\n */\n /**\n * Whether to reverse the order of the legend items compared to the\n * order of the series or points as defined in the configuration object.\n *\n * @see [yAxis.reversedStacks](#yAxis.reversedStacks),\n * [series.legendIndex](#series.legendIndex)\n *\n * @sample {highcharts} highcharts/legend/reversed/\n * Stacked bar with reversed legend\n *\n * @type {boolean}\n * @default false\n * @since 1.2.5\n * @apioption legend.reversed\n */\n /**\n * Whether to show the symbol on the right side of the text rather than\n * the left side. This is common in Arabic and Hebrew.\n *\n * @sample {highcharts} highcharts/legend/rtl/\n * Symbol to the right\n *\n * @type {boolean}\n * @default false\n * @since 2.2\n * @apioption legend.rtl\n */\n /**\n * CSS styles for the legend area. In the 1.x versions the position\n * of the legend area was determined by CSS. In 2.x, the position is\n * determined by properties like `align`, `verticalAlign`, `x` and `y`,\n * but the styles are still parsed for backwards compatibility.\n *\n * @deprecated\n *\n * @type {Highcharts.CSSObject}\n * @product highcharts highstock\n * @apioption legend.style\n */\n /**\n * CSS styles for each legend item. Only a subset of CSS is supported,\n * notably those options related to text. The default `textOverflow`\n * property makes long texts truncate. Set it to `undefined` to wrap\n * text instead. A `width` property can be added to control the text\n * width.\n *\n * @see In styled mode, the legend items can be styled with the\n * `.highcharts-legend-item` class.\n *\n * @sample {highcharts} highcharts/legend/itemstyle/\n * Bold black text\n * @sample {highmaps} maps/legend/itemstyle/\n * Item text styles\n *\n * @type {Highcharts.CSSObject}\n * @default {\"color\": \"#333333\", \"cursor\": \"pointer\", \"fontSize\": \"0.75em\", \"fontWeight\": \"bold\", \"textOverflow\": \"ellipsis\"}\n */\n itemStyle: {\n /**\n * @ignore\n */\n color: \"#333333\" /* Palette.neutralColor80 */,\n /**\n * @ignore\n */\n cursor: 'pointer',\n /**\n * @ignore\n */\n fontSize: '0.8em',\n /**\n * @ignore\n */\n textDecoration: 'none',\n /**\n * @ignore\n */\n textOverflow: 'ellipsis'\n },\n /**\n * CSS styles for each legend item in hover mode. Only a subset of\n * CSS is supported, notably those options related to text. Properties\n * are inherited from `style` unless overridden here.\n *\n * @see In styled mode, the hovered legend items can be styled with\n * the `.highcharts-legend-item:hover` pseudo-class.\n *\n * @sample {highcharts} highcharts/legend/itemhoverstyle/\n * Red on hover\n * @sample {highmaps} maps/legend/itemstyle/\n * Item text styles\n *\n * @type {Highcharts.CSSObject}\n * @default {\"color\": \"#000000\"}\n */\n itemHoverStyle: {\n /**\n * @ignore\n */\n color: \"#000000\" /* Palette.neutralColor100 */\n },\n /**\n * CSS styles for each legend item when the corresponding series or\n * point is hidden. Only a subset of CSS is supported, notably those\n * options related to text. Properties are inherited from `style`\n * unless overridden here.\n *\n * @see In styled mode, the hidden legend items can be styled with\n * the `.highcharts-legend-item-hidden` class.\n *\n * @sample {highcharts} highcharts/legend/itemhiddenstyle/\n * Darker gray color\n *\n * @type {Highcharts.CSSObject}\n * @default {\"color\": \"#cccccc\"}\n */\n itemHiddenStyle: {\n /**\n * @ignore\n */\n color: \"#666666\" /* Palette.neutralColor60 */,\n /**\n * @ignore\n */\n textDecoration: 'line-through'\n },\n /**\n * Whether to apply a drop shadow to the legend. A `backgroundColor`\n * also needs to be applied for this to take effect. The shadow can be\n * an object configuration containing `color`, `offsetX`, `offsetY`,\n * `opacity` and `width`.\n *\n * @sample {highcharts} highcharts/legend/shadow/\n * White background and drop shadow\n * @sample {highstock} stock/legend/align/\n * Various legend options\n * @sample {highmaps} maps/legend/border-background/\n * Border and background options\n *\n * @type {boolean|Highcharts.CSSObject}\n */\n shadow: false,\n /**\n * Default styling for the checkbox next to a legend item when\n * `showCheckbox` is true.\n *\n * @type {Highcharts.CSSObject}\n * @default {\"width\": \"13px\", \"height\": \"13px\", \"position\":\"absolute\"}\n */\n itemCheckboxStyle: {\n /**\n * @ignore\n */\n position: 'absolute',\n /**\n * @ignore\n */\n width: '13px',\n /**\n * @ignore\n */\n height: '13px'\n },\n // itemWidth: undefined,\n /**\n * When this is true, the legend symbol width will be the same as\n * the symbol height, which in turn defaults to the font size of the\n * legend items.\n *\n * @since 5.0.0\n */\n squareSymbol: true,\n /**\n * The pixel height of the symbol for series types that use a rectangle\n * in the legend. Defaults to the font size of legend items.\n *\n * Note: This option is a default source of color axis height, if the\n * [colorAxis.height](https://api.highcharts.com/highcharts/colorAxis.height)\n * option is not set.\n *\n * @productdesc {highmaps}\n * In Highmaps, when the symbol is the gradient of a vertical color\n * axis, the height defaults to 200.\n *\n * @sample {highmaps} maps/legend/layout-vertical-sized/\n * Sized vertical gradient\n * @sample {highmaps} maps/legend/padding-itemmargin/\n * No distance between data classes\n *\n * @type {number}\n * @since 3.0.8\n * @apioption legend.symbolHeight\n */\n /**\n * The border radius of the symbol for series types that use a rectangle\n * in the legend. Defaults to half the `symbolHeight`, effectively\n * creating a circle.\n *\n * For color axis scales, it defaults to 3.\n *\n * @sample {highcharts} highcharts/legend/symbolradius/\n * Round symbols\n * @sample {highstock} highcharts/legend/symbolradius/\n * Round symbols\n * @sample {highmaps} highcharts/legend/symbolradius/\n * Round symbols\n *\n * @type {number}\n * @since 3.0.8\n * @apioption legend.symbolRadius\n */\n /**\n * The pixel width of the legend item symbol. When the `squareSymbol`\n * option is set, this defaults to the `symbolHeight`, otherwise 16.\n *\n * Note: This option is a default source of color axis width, if the\n * [colorAxis.width](https://api.highcharts.com/highcharts/colorAxis.width)\n * option is not set.\n *\n * @productdesc {highmaps}\n * In Highmaps, when the symbol is the gradient of a horizontal color\n * axis, the width defaults to 200.\n *\n * @sample {highcharts} highcharts/legend/symbolwidth/\n * Greater symbol width and padding\n * @sample {highmaps} maps/legend/padding-itemmargin/\n * Padding and item margins demonstrated\n * @sample {highmaps} maps/legend/layout-vertical-sized/\n * Sized vertical gradient\n *\n * @type {number}\n * @apioption legend.symbolWidth\n */\n /**\n * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the legend item texts.\n *\n * Prior to 4.1.7, when using HTML, [legend.navigation](\n * #legend.navigation) was disabled.\n *\n * @sample highcharts/legend/scrollable-vertical/\n * Legend with vertical scrollable extension\n * @sample highcharts/legend/scrollable-horizontal/\n * Legend with horizontal scrollable extension\n *\n * @type {boolean}\n * @default false\n * @apioption legend.useHTML\n */\n /**\n * For a color axis with data classes, how many decimals to render in\n * the legend. The default preserves the decimals of the range numbers.\n *\n * @type {number}\n * @default -1\n * @product highcharts highmaps\n * @apioption legend.valueDecimals\n */\n /**\n * For a color axis with data classes, a suffix for the range numbers in\n * the legend.\n *\n * @type {string}\n * @default ''\n * @product highcharts highmaps\n * @apioption legend.valueSuffix\n */\n /**\n * The width of the legend box. If a number is set, it translates to\n * pixels. Since v7.0.2 it allows setting a percent string of the full\n * chart width, for example `40%`.\n *\n * Defaults to the full chart width for legends below or above the\n * chart, half the chart width for legends to the left and right.\n *\n * @sample {highcharts} highcharts/legend/width/\n * Aligned to the plot area\n * @sample {highcharts} highcharts/legend/width-percent/\n * A percent of the chart width\n *\n * @type {number|string}\n * @since 2.0\n * @apioption legend.width\n */\n /**\n * The pixel padding between the legend item symbol and the legend\n * item text.\n *\n * @sample {highcharts} highcharts/legend/symbolpadding/\n * Greater symbol width and padding\n */\n symbolPadding: 5,\n /**\n * The vertical alignment of the legend box. Can be one of `top`,\n * `middle` or `bottom`. Vertical position can be further determined\n * by the `y` option.\n *\n * In the case that the legend is aligned in a corner position, the\n * `layout` option will determine whether to place it above/below\n * or on the side of the plot area.\n *\n * When the [layout](#legend.layout) option is `proximate`, the\n * `verticalAlign` option doesn't apply.\n *\n * @sample {highcharts} highcharts/legend/verticalalign/\n * Legend 100px from the top of the chart\n * @sample {highstock} stock/legend/align/\n * Various legend options\n * @sample {highmaps} maps/legend/alignment/\n * Legend alignment\n *\n * @type {Highcharts.VerticalAlignValue}\n * @since 2.0\n */\n verticalAlign: 'bottom',\n // width: undefined,\n /**\n * The x offset of the legend relative to its horizontal alignment\n * `align` within chart.spacingLeft and chart.spacingRight. Negative\n * x moves it to the left, positive x moves it to the right.\n *\n * @sample {highcharts} highcharts/legend/width/\n * Aligned to the plot area\n *\n * @since 2.0\n */\n x: 0,\n /**\n * The vertical offset of the legend relative to it's vertical alignment\n * `verticalAlign` within chart.spacingTop and chart.spacingBottom.\n * Negative y moves it up, positive y moves it down.\n *\n * @sample {highcharts} highcharts/legend/verticalalign/\n * Legend 100px from the top of the chart\n * @sample {highstock} stock/legend/align/\n * Various legend options\n * @sample {highmaps} maps/legend/alignment/\n * Legend alignment\n *\n * @since 2.0\n */\n y: 0,\n /**\n * A title to be added on top of the legend.\n *\n * @sample {highcharts} highcharts/legend/title/\n * Legend title\n * @sample {highmaps} maps/legend/alignment/\n * Legend with title\n *\n * @since 3.0\n */\n title: {\n /**\n * A text or HTML string for the title.\n *\n * @type {string}\n * @since 3.0\n * @apioption legend.title.text\n */\n /**\n * Generic CSS styles for the legend title.\n *\n * @see In styled mode, the legend title is styled with the\n * `.highcharts-legend-title` class.\n *\n * @type {Highcharts.CSSObject}\n * @default {\"fontSize\": \"0.75em\", \"fontWeight\": \"bold\"}\n * @since 3.0\n */\n style: {\n /**\n * @ignore\n */\n fontSize: '0.8em',\n /**\n * @ignore\n */\n fontWeight: 'bold'\n }\n }\n },\n /**\n * The loading options control the appearance of the loading screen\n * that covers the plot area on chart operations. This screen only\n * appears after an explicit call to `chart.showLoading()`. It is a\n * utility for developers to communicate to the end user that something\n * is going on, for example while retrieving new data via an XHR connection.\n * The \"Loading...\" text itself is not part of this configuration\n * object, but part of the `lang` object.\n */\n loading: {\n /**\n * The duration in milliseconds of the fade out effect.\n *\n * @sample highcharts/loading/hideduration/\n * Fade in and out over a second\n *\n * @type {number}\n * @default 100\n * @since 1.2.0\n * @apioption loading.hideDuration\n */\n /**\n * The duration in milliseconds of the fade in effect.\n *\n * @sample highcharts/loading/hideduration/\n * Fade in and out over a second\n *\n * @type {number}\n * @default 100\n * @since 1.2.0\n * @apioption loading.showDuration\n */\n /**\n * CSS styles for the loading label `span`.\n *\n * @see In styled mode, the loading label is styled with the\n * `.highcharts-loading-inner` class.\n *\n * @sample {highcharts|highmaps} highcharts/loading/labelstyle/\n * Vertically centered\n * @sample {highstock} stock/loading/general/\n * Label styles\n *\n * @type {Highcharts.CSSObject}\n * @default {\"fontWeight\": \"bold\", \"position\": \"relative\", \"top\": \"45%\"}\n * @since 1.2.0\n */\n labelStyle: {\n /**\n * @ignore\n */\n fontWeight: 'bold',\n /**\n * @ignore\n */\n position: 'relative',\n /**\n * @ignore\n */\n top: '45%'\n },\n /**\n * CSS styles for the loading screen that covers the plot area.\n *\n * In styled mode, the loading label is styled with the\n * `.highcharts-loading` class.\n *\n * @sample {highcharts|highmaps} highcharts/loading/style/\n * Gray plot area, white text\n * @sample {highstock} stock/loading/general/\n * Gray plot area, white text\n *\n * @type {Highcharts.CSSObject}\n * @default {\"position\": \"absolute\", \"backgroundColor\": \"#ffffff\", \"opacity\": 0.5, \"textAlign\": \"center\"}\n * @since 1.2.0\n */\n style: {\n /**\n * @ignore\n */\n position: 'absolute',\n /**\n * @ignore\n */\n backgroundColor: \"#ffffff\" /* Palette.backgroundColor */,\n /**\n * @ignore\n */\n opacity: 0.5,\n /**\n * @ignore\n */\n textAlign: 'center'\n }\n },\n /**\n * Options for the tooltip that appears when the user hovers over a\n * series or point.\n *\n * @declare Highcharts.TooltipOptions\n */\n tooltip: {\n /**\n * The color of the tooltip border. When `undefined`, the border takes\n * the color of the corresponding series or point.\n *\n * Note that the [borderWidth](#tooltip.borderWidth) is usually 0 by\n * default, so the border color may not be visible until a border width\n * is set.\n *\n * @sample {highcharts} highcharts/tooltip/bordercolor-default/ Follow\n * series by default\n * @sample {highcharts} highcharts/tooltip/bordercolor-black/ Black\n * border\n * @sample {highstock} stock/tooltip/general/ Styled tooltip\n * @sample {highmaps} maps/tooltip/background-border/ Background and\n * border demo\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption tooltip.borderColor\n */\n /**\n * A CSS class name to apply to the tooltip's container div,\n * allowing unique CSS styling for each chart.\n *\n * @type {string}\n * @apioption tooltip.className\n */\n /**\n * Since 4.1, the crosshair definitions are moved to the Axis object\n * in order for a better separation from the tooltip. See\n * [xAxis.crosshair](#xAxis.crosshair).\n *\n * @sample {highcharts} highcharts/tooltip/crosshairs-x/\n * Enable a crosshair for the x value\n *\n * @deprecated\n *\n * @type {*}\n * @default true\n * @apioption tooltip.crosshairs\n */\n /**\n * Distance from point to tooltip in pixels.\n *\n * @type {number}\n * @default 16\n * @apioption tooltip.distance\n */\n /**\n * Whether the tooltip should follow the mouse as it moves across\n * columns, pie slices and other point types with an extent.\n * By default it behaves this way for pie, polygon, map, sankey\n * and wordcloud series by override in the `plotOptions`\n * for those series types.\n *\n * Does not apply if [split](#tooltip.split) is `true`.\n *\n * For touch moves to behave the same way, [followTouchMove](\n * #tooltip.followTouchMove) must be `true` also.\n *\n * @sample highcharts/tooltip/followpointer/\n * Tooltip follow pointer comparison\n *\n * @type {boolean}\n * @default {highcharts} false\n * @default {highstock} false\n * @default {highmaps} true\n * @since 3.0\n * @apioption tooltip.followPointer\n */\n /**\n * Whether the tooltip should update as the finger moves on a touch\n * device. If this is `true` and [chart.panning](#chart.panning) is\n * set,`followTouchMove` will take over one-finger touches, so the user\n * needs to use two fingers for zooming and panning.\n *\n * Note the difference to [followPointer](#tooltip.followPointer) that\n * only defines the _position_ of the tooltip. If `followPointer` is\n * false in for example a column series, the tooltip will show above or\n * below the column, but as `followTouchMove` is true, the tooltip will\n * jump from column to column as the user swipes across the plot area.\n *\n * @type {boolean}\n * @default {highcharts} true\n * @default {highstock} true\n * @default {highmaps} false\n * @since 3.0.1\n * @apioption tooltip.followTouchMove\n */\n /**\n * A [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)\n * for the whole tooltip. When format strings are a requirement, it is\n * usually more convenient to use `headerFormat`, `pointFormat` and\n * `footerFormat`, but the `format` option allows combining them into\n * one setting.\n *\n * The context of the format string is the same as that of the\n * `formatter` callback.\n *\n * @sample {highcharts} highcharts/tooltip/format-shared/\n * Format for shared tooltip\n *\n * @type {string}\n * @default undefined\n * @since 11.1.0\n * @apioption tooltip.format\n */\n /**\n * Callback function to format the text of the tooltip from scratch. In\n * case of single or [shared](#tooltip.shared) tooltips, a string should\n * be returned. In case of [split](#tooltip.split) tooltips, it should\n * return an array where the first item is the header, and subsequent\n * items are mapped to the points. Return `false` to disable tooltip for\n * a specific point on series.\n *\n * A subset of HTML is supported. Unless `useHTML` is true, the HTML of\n * the tooltip is parsed and converted to SVG, therefore this isn't a\n * complete HTML renderer. The following HTML tags are supported: `b`,\n * `br`, `em`, `i`, `span`, `strong`. Spans can be styled with a `style`\n * attribute, but only text-related CSS, that is shared with SVG, is\n * handled.\n *\n * The available data in the formatter differ a bit depending on whether\n * the tooltip is shared or split, or belongs to a single point. In a\n * shared/split tooltip, all properties except `x`, which is common for\n * all points, are kept in an array, `this.points`.\n *\n * Available data are:\n *\n * - **this.percentage (not shared) /**\n * **this.points[i].percentage (shared)**:\n * Stacked series and pies only. The point's percentage of the total.\n *\n * - **this.point (not shared) / this.points[i].point (shared)**:\n * The point object. The point name, if defined, is available through\n * `this.point.name`.\n *\n * - **this.points**:\n * In a shared tooltip, this is an array containing all other\n * properties for each point.\n *\n * - **this.series (not shared) / this.points[i].series (shared)**:\n * The series object. The series name is available through\n * `this.series.name`.\n *\n * - **this.total (not shared) / this.points[i].total (shared)**:\n * Stacked series only. The total value at this point's x value.\n *\n * - **this.x**:\n * The x value. This property is the same regardless of the tooltip\n * being shared or not.\n *\n * - **this.y (not shared) / this.points[i].y (shared)**:\n * The y value.\n *\n * @sample {highcharts} highcharts/tooltip/formatter-simple/\n * Simple string formatting\n * @sample {highcharts} highcharts/tooltip/formatter-shared/\n * Formatting with shared tooltip\n * @sample {highcharts|highstock} highcharts/tooltip/formatter-split/\n * Formatting with split tooltip\n * @sample highcharts/tooltip/formatter-conditional-default/\n * Extending default formatter\n * @sample {highstock} stock/tooltip/formatter/\n * Formatting with shared tooltip\n * @sample {highmaps} maps/tooltip/formatter/\n * String formatting\n *\n * @type {Highcharts.TooltipFormatterCallbackFunction}\n * @apioption tooltip.formatter\n */\n /**\n * Callback function to format the text of the tooltip for\n * visible null points.\n * Works analogously to [formatter](#tooltip.formatter).\n *\n * @sample highcharts/plotoptions/series-nullformat\n * Format data label and tooltip for null point.\n *\n * @type {Highcharts.TooltipFormatterCallbackFunction}\n * @apioption tooltip.nullFormatter\n */\n /**\n * Whether to allow the tooltip to render outside the chart's SVG\n * element box. By default (`false`), the tooltip is rendered within the\n * chart's SVG element, which results in the tooltip being aligned\n * inside the chart area. For small charts, this may result in clipping\n * or overlapping. When `true`, a separate SVG element is created and\n * overlaid on the page, allowing the tooltip to be aligned inside the\n * page itself.\n *\n * Defaults to `true` if `chart.scrollablePlotArea` is activated,\n * otherwise `false`.\n *\n * @sample highcharts/tooltip/outside\n * Small charts with tooltips outside\n *\n * @type {boolean|undefined}\n * @default undefined\n * @since 6.1.1\n * @apioption tooltip.outside\n */\n /**\n * A callback function for formatting the HTML output for a single point\n * in the tooltip. Like the `pointFormat` string, but with more\n * flexibility.\n *\n * @type {Highcharts.FormatterCallbackFunction}\n * @since 4.1.0\n * @context Highcharts.Point\n * @apioption tooltip.pointFormatter\n */\n /**\n * A callback function to place the tooltip in a custom position. The\n * callback receives three parameters: `labelWidth`, `labelHeight` and\n * `point`, where point contains values for `plotX` and `plotY` telling\n * where the reference point is in the plot area. Add `chart.plotLeft`\n * and `chart.plotTop` to get the full coordinates.\n *\n * To find the actual hovered `Point` instance, use\n * `this.chart.hoverPoint`. For shared or split tooltips, all the hover\n * points are available in `this.chart.hoverPoints`.\n *\n * Since v7, when [tooltip.split](#tooltip.split) option is enabled,\n * positioner is called for each of the boxes separately, including\n * xAxis header. xAxis header is not a point, instead `point` argument\n * contains info: `{ plotX: Number, plotY: Number, isHeader: Boolean }`\n *\n * The return should be an object containing x and y values, for example\n * `{ x: 100, y: 100 }`.\n *\n * @sample {highcharts} highcharts/tooltip/positioner/\n * A fixed tooltip position\n * @sample {highstock} stock/tooltip/positioner/\n * A fixed tooltip position on top of the chart\n * @sample {highmaps} maps/tooltip/positioner/\n * A fixed tooltip position\n * @sample {highstock} stock/tooltip/split-positioner/\n * Split tooltip with fixed positions\n * @sample {highstock} stock/tooltip/positioner-scrollable-plotarea/\n * Scrollable plot area combined with tooltip positioner\n *\n * @type {Highcharts.TooltipPositionerCallbackFunction}\n * @since 2.2.4\n * @apioption tooltip.positioner\n */\n /**\n * Split the tooltip into one label per series, with the header close\n * to the axis. This is recommended over [shared](#tooltip.shared)\n * tooltips for charts with multiple line series, generally making them\n * easier to read. This option takes precedence over `tooltip.shared`.\n *\n * Not supported for [polar](#chart.polar) and [inverted](#chart.inverted) charts.\n *\n * @productdesc {highstock} In Highcharts Stock, tooltips are split\n * by default since v6.0.0. Stock charts typically contain\n * multi-dimension points and multiple panes, making split tooltips\n * the preferred layout over\n * the previous `shared` tooltip.\n *\n * @sample highcharts/tooltip/split/\n * Split tooltip\n * @sample {highcharts|highstock} highcharts/tooltip/formatter-split/\n * Split tooltip and custom formatter callback\n *\n * @type {boolean}\n * @default {highcharts} false\n * @default {highstock} true\n * @since 5.0.0\n * @product highcharts highstock\n * @apioption tooltip.split\n */\n /**\n * Prevents the tooltip from switching or closing, when touched or\n * pointed.\n *\n * @sample highcharts/tooltip/stickoncontact/\n * Tooltip sticks on pointer contact\n *\n * @type {boolean}\n * @since 8.0.1\n * @apioption tooltip.stickOnContact\n */\n /**\n * Use HTML to render the contents of the tooltip instead of SVG. Using\n * HTML allows advanced formatting like tables and images in the\n * tooltip. It is also recommended for rtl languages as it works around\n * rtl bugs in early Firefox.\n *\n * @sample {highcharts|highstock} highcharts/tooltip/footerformat/\n * A table for value alignment\n * @sample {highcharts|highstock} highcharts/tooltip/fullhtml/\n * Full HTML tooltip\n * @sample {highmaps} maps/tooltip/usehtml/\n * Pure HTML tooltip\n *\n * @type {boolean}\n * @default false\n * @since 2.2\n * @apioption tooltip.useHTML\n */\n /**\n * How many decimals to show in each series' y value. This is\n * overridable in each series' tooltip options object. The default is to\n * preserve all decimals.\n *\n * @sample {highcharts|highstock} highcharts/tooltip/valuedecimals/\n * Set decimals, prefix and suffix for the value\n * @sample {highmaps} maps/tooltip/valuedecimals/\n * Set decimals, prefix and suffix for the value\n *\n * @type {number|undefined}\n * @since 2.2\n * @apioption tooltip.valueDecimals\n */\n /**\n * A string to prepend to each series' y value. Overridable in each\n * series' tooltip options object.\n *\n * @sample {highcharts|highstock} highcharts/tooltip/valuedecimals/\n * Set decimals, prefix and suffix for the value\n * @sample {highmaps} maps/tooltip/valuedecimals/\n * Set decimals, prefix and suffix for the value\n *\n * @type {string}\n * @since 2.2\n * @apioption tooltip.valuePrefix\n */\n /**\n * A string to append to each series' y value. Overridable in each\n * series' tooltip options object.\n *\n * @sample {highcharts|highstock} highcharts/tooltip/valuedecimals/\n * Set decimals, prefix and suffix for the value\n * @sample {highmaps} maps/tooltip/valuedecimals/\n * Set decimals, prefix and suffix for the value\n *\n * @type {string}\n * @since 2.2\n * @apioption tooltip.valueSuffix\n */\n /**\n * The format for the date in the tooltip header if the X axis is a\n * datetime axis. The default is a best guess based on the smallest\n * distance between points in the chart.\n *\n * @sample {highcharts} highcharts/tooltip/xdateformat/\n * A different format\n *\n * @type {string}\n * @product highcharts highstock gantt\n * @apioption tooltip.xDateFormat\n */\n /**\n * How many decimals to show for the `point.change`\n * or the `point.cumulativeSum` value when the `series.compare`\n * or the `series.cumulative` option is set.\n * This is overridable in each series' tooltip options object.\n *\n * @type {number}\n * @default 2\n * @since 1.0.1\n * @product highstock\n * @apioption tooltip.changeDecimals\n */\n /**\n * Enable or disable the tooltip.\n *\n * @sample {highcharts} highcharts/tooltip/enabled/\n * Disabled\n * @sample {highcharts} highcharts/plotoptions/series-point-events-mouseover/\n * Disable tooltip and show values on chart instead\n */\n enabled: true,\n /**\n * Enable or disable animation of the tooltip.\n *\n * @type {boolean}\n * @default true\n * @since 2.3.0\n */\n animation: svg,\n /**\n * The radius of the rounded border corners.\n *\n * @sample {highcharts} highcharts/tooltip/bordercolor-default/\n * Default border radius\n * @sample {highcharts} highcharts/tooltip/borderradius-0/\n * Square borders\n * @sample {highmaps} maps/tooltip/background-border/\n * Background and border demo\n */\n borderRadius: 3,\n /**\n * For series on datetime axes, the date format in the tooltip's\n * header will by default be guessed based on the closest data points.\n * This member gives the default string representations used for\n * each unit. For an overview of the replacement codes, see\n * [dateFormat](/class-reference/Highcharts.Time#dateFormat).\n *\n * @see [xAxis.dateTimeLabelFormats](#xAxis.dateTimeLabelFormats)\n *\n * @type {Highcharts.Dictionary}\n * @product highcharts highstock gantt\n */\n dateTimeLabelFormats: {\n /** @internal */\n millisecond: '%A, %e %b, %H:%M:%S.%L',\n /** @internal */\n second: '%A, %e %b, %H:%M:%S',\n /** @internal */\n minute: '%A, %e %b, %H:%M',\n /** @internal */\n hour: '%A, %e %b, %H:%M',\n /** @internal */\n day: '%A, %e %b %Y',\n /** @internal */\n week: 'Week from %A, %e %b %Y',\n /** @internal */\n month: '%B %Y',\n /** @internal */\n year: '%Y'\n },\n /**\n * A string to append to the tooltip format.\n *\n * @sample {highcharts} highcharts/tooltip/footerformat/\n * A table for value alignment\n * @sample {highmaps} maps/tooltip/format/\n * Format demo\n *\n * @since 2.2\n */\n footerFormat: '',\n /**\n * The name of a symbol to use for the border around the tooltip\n * header. Applies only when [tooltip.split](#tooltip.split) is\n * enabled.\n *\n * Custom callbacks for symbol path generation can also be added to\n * `Highcharts.SVGRenderer.prototype.symbols` the same way as for\n * [series.marker.symbol](plotOptions.line.marker.symbol).\n *\n * @see [tooltip.shape](#tooltip.shape)\n *\n * @sample {highstock} stock/tooltip/split-positioner/\n * Different shapes for header and split boxes\n *\n * @type {Highcharts.TooltipShapeValue}\n * @validvalue [\"callout\", \"rect\"]\n * @since 7.0\n */\n headerShape: 'callout',\n /**\n * The number of milliseconds to wait until the tooltip is hidden when\n * mouse out from a point or chart.\n *\n * @since 3.0\n */\n hideDelay: 500,\n /**\n * Padding inside the tooltip, in pixels.\n *\n * @since 5.0.0\n */\n padding: 8,\n /**\n * The name of a symbol to use for the border around the tooltip. Can\n * be one of: `\"callout\"`, `\"circle\"` or `\"rect\"`. When\n * [tooltip.split](#tooltip.split)\n * option is enabled, shape is applied to all boxes except header, which\n * is controlled by\n * [tooltip.headerShape](#tooltip.headerShape).\n *\n * Custom callbacks for symbol path generation can also be added to\n * `Highcharts.SVGRenderer.prototype.symbols` the same way as for\n * [series.marker.symbol](plotOptions.line.marker.symbol).\n *\n * @type {Highcharts.TooltipShapeValue}\n * @since 4.0\n */\n shape: 'callout',\n /**\n * When the tooltip is shared, the entire plot area will capture mouse\n * movement or touch events. Tooltip texts for series types with ordered\n * data (not pie, scatter, flags etc) will be shown in a single bubble.\n * This is recommended for single series charts and for tablet/mobile\n * optimized charts.\n *\n * See also [tooltip.split](#tooltip.split), that is better suited for\n * charts with many series, especially line-type series. The\n * `tooltip.split` option takes precedence over `tooltip.shared`.\n *\n * @sample {highcharts} highcharts/tooltip/shared-false/\n * False by default\n * @sample {highcharts} highcharts/tooltip/shared-true/\n * True\n * @sample {highcharts} highcharts/tooltip/shared-x-crosshair/\n * True with x axis crosshair\n * @sample {highcharts} highcharts/tooltip/shared-true-mixed-types/\n * True with mixed series types\n *\n * @since 2.1\n * @product highcharts highstock\n */\n shared: false,\n /**\n * Proximity snap for graphs or single points. It defaults to 10 for\n * mouse-powered devices and 25 for touch devices.\n *\n * Note that in most cases the whole plot area captures the mouse\n * movement, and in these cases `tooltip.snap` doesn't make sense. This\n * applies when [stickyTracking](#plotOptions.series.stickyTracking)\n * is `true` (default) and when the tooltip is [shared](#tooltip.shared)\n * or [split](#tooltip.split).\n *\n * @sample {highcharts} highcharts/tooltip/bordercolor-default/\n * 10 px by default\n * @sample {highcharts} highcharts/tooltip/snap-50/\n * 50 px on graph\n *\n * @type {number}\n * @default 10/25\n * @since 1.2.0\n * @product highcharts highstock\n */\n snap: isTouchDevice ? 25 : 10,\n /**\n * The HTML of the tooltip header line. Variables are enclosed by\n * curly brackets. Available variables are `point.key`, `series.name`,\n * `series.color` and other members from the `point` and `series`\n * objects. The `point.key` variable contains the category name, x\n * value or datetime string depending on the type of axis. For datetime\n * axes, the `point.key` date format can be set using\n * `tooltip.xDateFormat`.\n *\n * @sample {highcharts} highcharts/tooltip/footerformat/\n * An HTML table in the tooltip\n * @sample {highstock} highcharts/tooltip/footerformat/\n * An HTML table in the tooltip\n * @sample {highmaps} maps/tooltip/format/\n * Format demo\n *\n * @type {string}\n * @apioption tooltip.headerFormat\n */\n headerFormat: '{point.key}
',\n /**\n * The HTML of the null point's line in the tooltip. Works analogously\n * to [pointFormat](#tooltip.pointFormat).\n *\n * @sample {highcharts} highcharts/plotoptions/series-nullformat\n * Format data label and tooltip for null point.\n *\n * @type {string}\n * @apioption tooltip.nullFormat\n */\n /**\n * The HTML of the point's line in the tooltip. Variables are enclosed\n * by curly brackets. Available variables are `point.x`, `point.y`,\n * `series.name` and `series.color` and other properties on the same\n * form. Furthermore, `point.y` can be extended by the\n * `tooltip.valuePrefix` and `tooltip.valueSuffix` variables. This can\n * also be overridden for each series, which makes it a good hook for\n * displaying units.\n *\n * In styled mode, the dot is colored by a class name rather\n * than the point color.\n *\n * @sample {highcharts} highcharts/tooltip/pointformat/\n * A different point format with value suffix\n * @sample {highcharts|highstock} highcharts/tooltip/pointformat-extra-information/\n * Show extra information about points in the tooltip\n * @sample {highmaps} maps/tooltip/format/\n * Format demo\n *\n * @type {string}\n * @since 2.2\n * @apioption tooltip.pointFormat\n */\n pointFormat: '\\u25CF {series.name}: {point.y}
',\n /**\n * The background color or gradient for the tooltip.\n *\n * In styled mode, the stroke width is set in the\n * `.highcharts-tooltip-box` class.\n *\n * @sample {highcharts} highcharts/tooltip/backgroundcolor-solid/\n * Yellowish background\n * @sample {highcharts} highcharts/tooltip/backgroundcolor-gradient/\n * Gradient\n * @sample {highcharts} highcharts/css/tooltip-border-background/\n * Tooltip in styled mode\n * @sample {highstock} stock/tooltip/general/\n * Custom tooltip\n * @sample {highstock} highcharts/css/tooltip-border-background/\n * Tooltip in styled mode\n * @sample {highmaps} maps/tooltip/background-border/\n * Background and border demo\n * @sample {highmaps} highcharts/css/tooltip-border-background/\n * Tooltip in styled mode\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n backgroundColor: \"#ffffff\" /* Palette.backgroundColor */,\n /**\n * The pixel width of the tooltip border. Defaults to 0 for single\n * tooltips and 1 for split tooltips.\n *\n * In styled mode, the stroke width is set in the\n * `.highcharts-tooltip-box` class.\n *\n * @sample {highcharts} highcharts/tooltip/bordercolor-default/\n * 2 pixels\n * @sample {highcharts} highcharts/tooltip/borderwidth/\n * No border (shadow only)\n * @sample {highcharts} highcharts/css/tooltip-border-background/\n * Tooltip in styled mode\n * @sample {highstock} stock/tooltip/general/\n * Custom tooltip\n * @sample {highstock} highcharts/css/tooltip-border-background/\n * Tooltip in styled mode\n * @sample {highmaps} maps/tooltip/background-border/\n * Background and border demo\n * @sample {highmaps} highcharts/css/tooltip-border-background/\n * Tooltip in styled mode\n *\n * @type {number}\n */\n borderWidth: void 0,\n /**\n * Whether to apply a drop shadow to the tooltip.\n *\n * @sample {highcharts} highcharts/tooltip/bordercolor-default/\n * True by default\n * @sample {highcharts} highcharts/tooltip/shadow/\n * False\n * @sample {highmaps} maps/tooltip/positioner/\n * Fixed tooltip position, border and shadow disabled\n *\n * @type {boolean|Highcharts.ShadowOptionsObject}\n */\n shadow: true,\n /**\n * Prevents the tooltip from switching or closing when touched or\n * pointed.\n *\n * @sample highcharts/tooltip/stickoncontact/\n * Tooltip sticks on pointer contact\n *\n * @since 8.0.1\n */\n stickOnContact: false,\n /**\n * CSS styles for the tooltip. The tooltip can also be styled through\n * the CSS class `.highcharts-tooltip`.\n *\n * Note that the default `pointerEvents` style makes the tooltip ignore\n * mouse events, so in order to use clickable tooltips, this value must\n * be set to `auto`.\n *\n * @sample {highcharts} highcharts/tooltip/style/\n * Greater padding, bold text\n *\n * @type {Highcharts.CSSObject}\n */\n style: {\n /** @internal */\n color: \"#333333\" /* Palette.neutralColor80 */,\n /** @internal */\n cursor: 'default',\n /** @internal */\n fontSize: '0.8em'\n },\n /**\n * Use HTML to render the contents of the tooltip instead of SVG. Using\n * HTML allows advanced formatting like tables and images in the\n * tooltip. It is also recommended for rtl languages as it works around\n * rtl bugs in early Firefox.\n *\n * @sample {highcharts|highstock} highcharts/tooltip/footerformat/\n * A table for value alignment\n * @sample {highcharts|highstock} highcharts/tooltip/fullhtml/\n * Full HTML tooltip\n * @sample {highmaps} maps/tooltip/usehtml/\n * Pure HTML tooltip\n *\n * @since 2.2\n */\n useHTML: false\n },\n /**\n * Highchart by default puts a credits label in the lower right corner\n * of the chart. This can be changed using these options.\n */\n credits: {\n /**\n * Credits for map source to be concatenated with conventional credit\n * text. By default this is a format string that collects copyright\n * information from the map if available.\n *\n * @see [mapTextFull](#credits.mapTextFull)\n * @see [text](#credits.text)\n *\n * @type {string}\n * @default \\u00a9 {geojson.copyrightShort}\n * @since 4.2.2\n * @product highmaps\n * @apioption credits.mapText\n */\n /**\n * Detailed credits for map source to be displayed on hover of credits\n * text. By default this is a format string that collects copyright\n * information from the map if available.\n *\n * @see [mapText](#credits.mapText)\n * @see [text](#credits.text)\n *\n * @type {string}\n * @default {geojson.copyright}\n * @since 4.2.2\n * @product highmaps\n * @apioption credits.mapTextFull\n */\n /**\n * Whether to show the credits text.\n *\n * @sample {highcharts} highcharts/credits/enabled-false/\n * Credits disabled\n * @sample {highstock} stock/credits/enabled/\n * Credits disabled\n * @sample {highmaps} maps/credits/enabled-false/\n * Credits disabled\n */\n enabled: true,\n /**\n * The URL for the credits label.\n *\n * @sample {highcharts} highcharts/credits/href/\n * Custom URL and text\n * @sample {highmaps} maps/credits/customized/\n * Custom URL and text\n */\n href: 'https://www.highcharts.com?credits',\n /**\n * Position configuration for the credits label.\n *\n * @sample {highcharts} highcharts/credits/position-left/\n * Left aligned\n * @sample {highcharts} highcharts/credits/position-left/\n * Left aligned\n * @sample {highmaps} maps/credits/customized/\n * Left aligned\n * @sample {highmaps} maps/credits/customized/\n * Left aligned\n *\n * @type {Highcharts.AlignObject}\n * @since 2.1\n */\n position: {\n /** @internal */\n align: 'right',\n /** @internal */\n x: -10,\n /** @internal */\n verticalAlign: 'bottom',\n /** @internal */\n y: -5\n },\n /**\n * CSS styles for the credits label.\n *\n * @see In styled mode, credits styles can be set with the\n * `.highcharts-credits` class.\n *\n * @type {Highcharts.CSSObject}\n */\n style: {\n /** @internal */\n cursor: 'pointer',\n /** @internal */\n color: \"#999999\" /* Palette.neutralColor40 */,\n /** @internal */\n fontSize: '0.6em'\n },\n /**\n * The text for the credits label.\n *\n * @productdesc {highmaps}\n * If a map is loaded as GeoJSON, the text defaults to\n * `Highcharts @ {map-credits}`. Otherwise, it defaults to\n * `Highcharts.com`.\n *\n * @sample {highcharts} highcharts/credits/href/\n * Custom URL and text\n * @sample {highmaps} maps/credits/customized/\n * Custom URL and text\n */\n text: 'Highcharts.com'\n }\n};\n/* eslint-disable spaced-comment */\n/*= if (!build.classic) { =*/\n// Legacy build for styled mode, set the styledMode option to true by default.\ndefaultOptions.chart.styledMode = true;\n/*= } else { =*/\ndefaultOptions.chart.styledMode = false;\n/*= } =*/\n'';\nconst defaultTime = new Time(defaultOptions.time);\n/**\n * Get the updated default options. Until 3.0.7, merely exposing defaultOptions\n * for outside modules wasn't enough because the setOptions method created a new\n * object.\n *\n * @function Highcharts.getOptions\n *\n * @return {Highcharts.Options}\n * Default options.\n */\nfunction getOptions() {\n return defaultOptions;\n}\n/**\n * Merge the default options with custom options and return the new options\n * structure. Commonly used for defining reusable templates.\n *\n * @sample highcharts/global/useutc-false Setting a global option\n * @sample highcharts/members/setoptions Applying a global theme\n *\n * @function Highcharts.setOptions\n *\n * @param {Highcharts.Options} options\n * The new custom chart options.\n *\n * @return {Highcharts.Options}\n * Updated options.\n */\nfunction setOptions(options) {\n // Copy in the default options\n merge(true, defaultOptions, options);\n // Update the time object\n if (options.time || options.global) {\n if (H.time) {\n H.time.update(merge(defaultOptions.global, defaultOptions.time, options.global, options.time));\n }\n else {\n /**\n * Global `Time` object with default options. Since v6.0.5, time\n * settings can be applied individually for each chart. If no\n * individual settings apply, this `Time` object is shared by all\n * instances.\n *\n * @name Highcharts.time\n * @type {Highcharts.Time}\n */\n H.time = defaultTime;\n }\n }\n return defaultOptions;\n}\n/* *\n *\n * Default Export\n *\n * */\nconst DefaultOptions = {\n defaultOptions,\n defaultTime,\n getOptions,\n setOptions\n};\nexport default DefaultOptions;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * @typedef {\"plotBox\"|\"spacingBox\"} Highcharts.ButtonRelativeToValue\n */\n/**\n * Gets fired when a series is added to the chart after load time, using the\n * `addSeries` method. Returning `false` prevents the series from being added.\n *\n * @callback Highcharts.ChartAddSeriesCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * The chart on which the event occurred.\n *\n * @param {Highcharts.ChartAddSeriesEventObject} event\n * The event that occurred.\n */\n/**\n * Contains common event information. Through the `options` property you can\n * access the series options that were passed to the `addSeries` method.\n *\n * @interface Highcharts.ChartAddSeriesEventObject\n */ /**\n* The series options that were passed to the `addSeries` method.\n* @name Highcharts.ChartAddSeriesEventObject#options\n* @type {Highcharts.SeriesOptionsType}\n*/ /**\n* Prevents the default behaviour of the event.\n* @name Highcharts.ChartAddSeriesEventObject#preventDefault\n* @type {Function}\n*/ /**\n* The event target.\n* @name Highcharts.ChartAddSeriesEventObject#target\n* @type {Highcharts.Chart}\n*/ /**\n* The event type.\n* @name Highcharts.ChartAddSeriesEventObject#type\n* @type {\"addSeries\"}\n*/\n/**\n * Gets fired when clicking on the plot background.\n *\n * @callback Highcharts.ChartClickCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * The chart on which the event occurred.\n *\n * @param {Highcharts.PointerEventObject} event\n * The event that occurred.\n */\n/**\n * Contains an axes of the clicked spot.\n *\n * @interface Highcharts.ChartClickEventAxisObject\n */ /**\n* Axis at the clicked spot.\n* @name Highcharts.ChartClickEventAxisObject#axis\n* @type {Highcharts.Axis}\n*/ /**\n* Axis value at the clicked spot.\n* @name Highcharts.ChartClickEventAxisObject#value\n* @type {number}\n*/\n/**\n * Contains information about the clicked spot on the chart. Remember the unit\n * of a datetime axis is milliseconds since 1970-01-01 00:00:00.\n *\n * @interface Highcharts.ChartClickEventObject\n * @extends Highcharts.PointerEventObject\n */ /**\n* Information about the x-axis on the clicked spot.\n* @name Highcharts.ChartClickEventObject#xAxis\n* @type {Array}\n*/ /**\n* Information about the y-axis on the clicked spot.\n* @name Highcharts.ChartClickEventObject#yAxis\n* @type {Array}\n*/ /**\n* Information about the z-axis on the clicked spot.\n* @name Highcharts.ChartClickEventObject#zAxis\n* @type {Array|undefined}\n*/\n/**\n * Gets fired when the chart is finished loading.\n *\n * @callback Highcharts.ChartLoadCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * The chart on which the event occurred.\n *\n * @param {global.Event} event\n * The event that occurred.\n */\n/**\n * Fires when the chart is redrawn, either after a call to `chart.redraw()` or\n * after an axis, series or point is modified with the `redraw` option set to\n * `true`.\n *\n * @callback Highcharts.ChartRedrawCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * The chart on which the event occurred.\n *\n * @param {global.Event} event\n * The event that occurred.\n */\n/**\n * Gets fired after initial load of the chart (directly after the `load` event),\n * and after each redraw (directly after the `redraw` event).\n *\n * @callback Highcharts.ChartRenderCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * The chart on which the event occurred.\n *\n * @param {global.Event} event\n * The event that occurred.\n */\n/**\n * Gets fired when an area of the chart has been selected. The default action\n * for the selection event is to zoom the chart to the selected area. It can be\n * prevented by calling `event.preventDefault()` or return false.\n *\n * @callback Highcharts.ChartSelectionCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * The chart on which the event occurred.\n *\n * @param {Highcharts.SelectEventObject} event\n * Event informations\n *\n * @return {boolean|undefined}\n * Return false to prevent the default action, usually zoom.\n */\n(''); // detach doclets above\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Globals.js';\nimport U from '../Utilities.js';\nconst { isNumber, merge, pInt } = U;\n/* *\n *\n * Class\n *\n * */\n/* eslint-disable valid-jsdoc */\n/**\n * Handle color operations. Some object methods are chainable.\n *\n * @class\n * @name Highcharts.Color\n *\n * @param {Highcharts.ColorType} input\n * The input color in either rgba or hex format\n */\nclass Color {\n /* *\n *\n * Static Functions\n *\n * */\n /**\n * Creates a color instance out of a color string or object.\n *\n * @function Highcharts.Color.parse\n *\n * @param {Highcharts.ColorType} [input]\n * The input color in either rgba or hex format.\n *\n * @return {Highcharts.Color}\n * Color instance.\n */\n static parse(input) {\n return input ? new Color(input) : Color.None;\n }\n /* *\n *\n * Constructor\n *\n * */\n constructor(input) {\n this.rgba = [NaN, NaN, NaN, NaN];\n this.input = input;\n const GlobalColor = H.Color;\n // Backwards compatibility, allow class overwrite\n if (GlobalColor && GlobalColor !== Color) {\n return new GlobalColor(input);\n }\n let result, rgba, i, parser;\n // Gradients\n if (typeof input === 'object' &&\n typeof input.stops !== 'undefined') {\n this.stops = input.stops.map((stop) => new Color(stop[1]));\n // Solid colors\n }\n else if (typeof input === 'string') {\n this.input = input = (Color.names[input.toLowerCase()] || input);\n // Bitmasking as input[0] is not working for legacy IE.\n if (input.charAt(0) === '#') {\n const len = input.length, col = parseInt(input.substr(1), 16);\n // Handle long-form, e.g. #AABBCC\n if (len === 7) {\n rgba = [\n (col & 0xFF0000) >> 16,\n (col & 0xFF00) >> 8,\n (col & 0xFF),\n 1\n ];\n // Handle short-form, e.g. #ABC\n // In short form, the value is assumed to be the same\n // for both nibbles for each component. e.g. #ABC = #AABBCC\n }\n else if (len === 4) {\n rgba = [\n (((col & 0xF00) >> 4) |\n (col & 0xF00) >> 8),\n (((col & 0xF0) >> 4) |\n (col & 0xF0)),\n ((col & 0xF) << 4) | (col & 0xF),\n 1\n ];\n }\n }\n // Otherwise, check regex parsers\n if (!rgba) {\n i = Color.parsers.length;\n while (i-- && !rgba) {\n parser = Color.parsers[i];\n result = parser.regex.exec(input);\n if (result) {\n rgba = parser.parse(result);\n }\n }\n }\n }\n if (rgba) {\n this.rgba = rgba;\n }\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Return the color or gradient stops in the specified format\n *\n * @function Highcharts.Color#get\n *\n * @param {string} [format]\n * Possible values are 'a', 'rgb', 'rgba' (default).\n *\n * @return {Highcharts.ColorType}\n * This color as a string or gradient stops.\n */\n get(format) {\n const input = this.input, rgba = this.rgba;\n if (typeof input === 'object' &&\n typeof this.stops !== 'undefined') {\n const ret = merge(input);\n ret.stops = [].slice.call(ret.stops);\n this.stops.forEach((stop, i) => {\n ret.stops[i] = [\n ret.stops[i][0],\n stop.get(format)\n ];\n });\n return ret;\n }\n // it's NaN if gradient colors on a column chart\n if (rgba && isNumber(rgba[0])) {\n if (format === 'rgb' || (!format && rgba[3] === 1)) {\n return 'rgb(' + rgba[0] + ',' + rgba[1] + ',' + rgba[2] + ')';\n }\n if (format === 'a') {\n return `${rgba[3]}`;\n }\n return 'rgba(' + rgba.join(',') + ')';\n }\n return input;\n }\n /**\n * Brighten the color instance.\n *\n * @function Highcharts.Color#brighten\n *\n * @param {number} alpha\n * The alpha value.\n *\n * @return {Highcharts.Color}\n * This color with modifications.\n */\n brighten(alpha) {\n const rgba = this.rgba;\n if (this.stops) {\n this.stops.forEach(function (stop) {\n stop.brighten(alpha);\n });\n }\n else if (isNumber(alpha) && alpha !== 0) {\n for (let i = 0; i < 3; i++) {\n rgba[i] += pInt(alpha * 255);\n if (rgba[i] < 0) {\n rgba[i] = 0;\n }\n if (rgba[i] > 255) {\n rgba[i] = 255;\n }\n }\n }\n return this;\n }\n /**\n * Set the color's opacity to a given alpha value.\n *\n * @function Highcharts.Color#setOpacity\n *\n * @param {number} alpha\n * Opacity between 0 and 1.\n *\n * @return {Highcharts.Color}\n * Color with modifications.\n */\n setOpacity(alpha) {\n this.rgba[3] = alpha;\n return this;\n }\n /**\n * Return an intermediate color between two colors.\n *\n * @function Highcharts.Color#tweenTo\n *\n * @param {Highcharts.Color} to\n * The color object to tween to.\n *\n * @param {number} pos\n * The intermediate position, where 0 is the from color (current color\n * item), and 1 is the `to` color.\n *\n * @return {Highcharts.ColorType}\n * The intermediate color in rgba notation, or unsupported type.\n */\n tweenTo(to, pos) {\n const fromRgba = this.rgba, toRgba = to.rgba;\n // Unsupported color, return to-color (#3920, #7034)\n if (!isNumber(fromRgba[0]) || !isNumber(toRgba[0])) {\n return to.input || 'none';\n }\n // Check for has alpha, because rgba colors perform worse due to\n // lack of support in WebKit.\n const hasAlpha = (toRgba[3] !== 1 || fromRgba[3] !== 1);\n return (hasAlpha ? 'rgba(' : 'rgb(') +\n Math.round(toRgba[0] + (fromRgba[0] - toRgba[0]) * (1 - pos)) +\n ',' +\n Math.round(toRgba[1] + (fromRgba[1] - toRgba[1]) * (1 - pos)) +\n ',' +\n Math.round(toRgba[2] + (fromRgba[2] - toRgba[2]) * (1 - pos)) +\n (hasAlpha ?\n (',' +\n (toRgba[3] + (fromRgba[3] - toRgba[3]) * (1 - pos))) :\n '') +\n ')';\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\n/**\n * Collection of named colors. Can be extended from the outside by adding\n * colors to Highcharts.Color.names.\n * @private\n */\nColor.names = {\n white: '#ffffff',\n black: '#000000'\n};\n/**\n * Collection of parsers. This can be extended from the outside by pushing\n * parsers to `Color.parsers`.\n */\nColor.parsers = [{\n // RGBA color\n // eslint-disable-next-line max-len\n regex: /rgba\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]?(?:\\.[0-9]+)?)\\s*\\)/,\n parse: function (result) {\n return [\n pInt(result[1]),\n pInt(result[2]),\n pInt(result[3]),\n parseFloat(result[4], 10)\n ];\n }\n }, {\n // RGB color\n regex: /rgb\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)/,\n parse: function (result) {\n return [pInt(result[1]), pInt(result[2]), pInt(result[3]), 1];\n }\n }];\n// Must be last static member for init cycle\nColor.None = new Color('');\n/* *\n *\n * Default Export\n *\n * */\nexport default Color;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * A valid color to be parsed and handled by Highcharts. Highcharts internally\n * supports hex colors like `#ffffff`, rgb colors like `rgb(255,255,255)` and\n * rgba colors like `rgba(255,255,255,1)`. Other colors may be supported by the\n * browsers and displayed correctly, but Highcharts is not able to process them\n * and apply concepts like opacity and brightening.\n *\n * @typedef {string} Highcharts.ColorString\n */\n/**\n * A valid color type than can be parsed and handled by Highcharts. It can be a\n * color string, a gradient object, or a pattern object.\n *\n * @typedef {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} Highcharts.ColorType\n */\n/**\n * Gradient options instead of a solid color.\n *\n * @example\n * // Linear gradient used as a color option\n * color: {\n * linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 },\n * stops: [\n * [0, '#003399'], // start\n * [0.5, '#ffffff'], // middle\n * [1, '#3366AA'] // end\n * ]\n * }\n *\n * @interface Highcharts.GradientColorObject\n */ /**\n* Holds an object that defines the start position and the end position relative\n* to the shape.\n* @name Highcharts.GradientColorObject#linearGradient\n* @type {Highcharts.LinearGradientColorObject|undefined}\n*/ /**\n* Holds an object that defines the center position and the radius.\n* @name Highcharts.GradientColorObject#radialGradient\n* @type {Highcharts.RadialGradientColorObject|undefined}\n*/ /**\n* The first item in each tuple is the position in the gradient, where 0 is the\n* start of the gradient and 1 is the end of the gradient. Multiple stops can be\n* applied. The second item is the color for each stop. This color can also be\n* given in the rgba format.\n* @name Highcharts.GradientColorObject#stops\n* @type {Array}\n*/\n/**\n * Color stop tuple.\n *\n * @see Highcharts.GradientColorObject\n *\n * @interface Highcharts.GradientColorStopObject\n */ /**\n* @name Highcharts.GradientColorStopObject#0\n* @type {number}\n*/ /**\n* @name Highcharts.GradientColorStopObject#1\n* @type {Highcharts.ColorString}\n*/ /**\n* @name Highcharts.GradientColorStopObject#color\n* @type {Highcharts.Color|undefined}\n*/\n/**\n * Defines the start position and the end position for a gradient relative\n * to the shape. Start position (x1, y1) and end position (x2, y2) are relative\n * to the shape, where 0 means top/left and 1 is bottom/right.\n *\n * @interface Highcharts.LinearGradientColorObject\n */ /**\n* Start horizontal position of the gradient. Float ranges 0-1.\n* @name Highcharts.LinearGradientColorObject#x1\n* @type {number}\n*/ /**\n* End horizontal position of the gradient. Float ranges 0-1.\n* @name Highcharts.LinearGradientColorObject#x2\n* @type {number}\n*/ /**\n* Start vertical position of the gradient. Float ranges 0-1.\n* @name Highcharts.LinearGradientColorObject#y1\n* @type {number}\n*/ /**\n* End vertical position of the gradient. Float ranges 0-1.\n* @name Highcharts.LinearGradientColorObject#y2\n* @type {number}\n*/\n/**\n * Defines the center position and the radius for a gradient.\n *\n * @interface Highcharts.RadialGradientColorObject\n */ /**\n* Center horizontal position relative to the shape. Float ranges 0-1.\n* @name Highcharts.RadialGradientColorObject#cx\n* @type {number}\n*/ /**\n* Center vertical position relative to the shape. Float ranges 0-1.\n* @name Highcharts.RadialGradientColorObject#cy\n* @type {number}\n*/ /**\n* Radius relative to the shape. Float ranges 0-1.\n* @name Highcharts.RadialGradientColorObject#r\n* @type {number}\n*/\n/**\n * Creates a color instance out of a color string.\n *\n * @function Highcharts.color\n *\n * @param {Highcharts.ColorType} input\n * The input color in either rgba or hex format\n *\n * @return {Highcharts.Color}\n * Color instance\n */\n(''); // detach doclets above\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Color from '../Color/Color.js';\nconst { parse: color } = Color;\nimport H from '../Globals.js';\nconst { win } = H;\nimport U from '../Utilities.js';\nconst { isNumber, objectEach } = U;\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/* *\n *\n * Class\n *\n * */\n/**\n * An animator object used internally. One instance applies to one property\n * (attribute or style prop) on one element. Animation is always initiated\n * through {@link SVGElement#animate}.\n *\n * @example\n * let rect = renderer.rect(0, 0, 10, 10).add();\n * rect.animate({ width: 100 });\n *\n * @private\n * @class\n * @name Highcharts.Fx\n *\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGElement} elem\n * The element to animate.\n *\n * @param {Partial} options\n * Animation options.\n *\n * @param {string} prop\n * The single attribute or CSS property to animate.\n */\nclass Fx {\n /* *\n *\n * Constructors\n *\n * */\n constructor(elem, options, prop) {\n this.pos = NaN;\n this.options = options;\n this.elem = elem;\n this.prop = prop;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Set the current step of a path definition on SVGElement.\n *\n * @function Highcharts.Fx#dSetter\n *\n */\n dSetter() {\n const paths = this.paths, start = paths && paths[0], end = paths && paths[1], now = this.now || 0;\n let path = [];\n // Land on the final path without adjustment points appended in the ends\n if (now === 1 || !start || !end) {\n path = this.toD || [];\n }\n else if (start.length === end.length && now < 1) {\n for (let i = 0; i < end.length; i++) {\n // Tween between the start segment and the end segment. Start\n // with a copy of the end segment and tween the appropriate\n // numerics\n const startSeg = start[i];\n const endSeg = end[i];\n const tweenSeg = [];\n for (let j = 0; j < endSeg.length; j++) {\n const startItem = startSeg[j];\n const endItem = endSeg[j];\n // Tween numbers\n if (isNumber(startItem) &&\n isNumber(endItem) &&\n // Arc boolean flags\n !(endSeg[0] === 'A' && (j === 4 || j === 5))) {\n tweenSeg[j] = startItem + now * (endItem - startItem);\n // Strings, take directly from the end segment\n }\n else {\n tweenSeg[j] = endItem;\n }\n }\n path.push(tweenSeg);\n }\n // If animation is finished or length not matching, land on right value\n }\n else {\n path = end;\n }\n this.elem.attr('d', path, void 0, true);\n }\n /**\n * Update the element with the current animation step.\n *\n * @function Highcharts.Fx#update\n *\n */\n update() {\n const elem = this.elem, prop = this.prop, // if destroyed, it is null\n now = this.now, step = this.options.step;\n // Animation setter defined from outside\n if (this[prop + 'Setter']) {\n this[prop + 'Setter']();\n // Other animations on SVGElement\n }\n else if (elem.attr) {\n if (elem.element) {\n elem.attr(prop, now, null, true);\n }\n // HTML styles, raw HTML content like container size\n }\n else {\n elem.style[prop] = now + this.unit;\n }\n if (step) {\n step.call(elem, now, this);\n }\n }\n /**\n * Run an animation.\n *\n * @function Highcharts.Fx#run\n *\n * @param {number} from\n * The current value, value to start from.\n *\n * @param {number} to\n * The end value, value to land on.\n *\n * @param {string} unit\n * The property unit, for example `px`.\n *\n */\n run(from, to, unit) {\n const self = this, options = self.options, timer = function (gotoEnd) {\n return timer.stopped ? false : self.step(gotoEnd);\n }, requestAnimationFrame = win.requestAnimationFrame ||\n function (step) {\n setTimeout(step, 13);\n }, step = function () {\n for (let i = 0; i < Fx.timers.length; i++) {\n if (!Fx.timers[i]()) {\n Fx.timers.splice(i--, 1);\n }\n }\n if (Fx.timers.length) {\n requestAnimationFrame(step);\n }\n };\n if (from === to && !this.elem['forceAnimate:' + this.prop]) {\n delete options.curAnim[this.prop];\n if (options.complete &&\n Object.keys(options.curAnim).length === 0) {\n options.complete.call(this.elem);\n }\n }\n else { // #7166\n this.startTime = +new Date();\n this.start = from;\n this.end = to;\n this.unit = unit;\n this.now = this.start;\n this.pos = 0;\n timer.elem = this.elem;\n timer.prop = this.prop;\n if (timer() && Fx.timers.push(timer) === 1) {\n requestAnimationFrame(step);\n }\n }\n }\n /**\n * Run a single step in the animation.\n *\n * @function Highcharts.Fx#step\n *\n * @param {boolean} [gotoEnd]\n * Whether to go to the endpoint of the animation after abort.\n *\n * @return {boolean}\n * Returns `true` if animation continues.\n */\n step(gotoEnd) {\n const t = +new Date(), options = this.options, elem = this.elem, complete = options.complete, duration = options.duration, curAnim = options.curAnim;\n let ret, done;\n if (!!elem.attr && !elem.element) { // #2616, element is destroyed\n ret = false;\n }\n else if (gotoEnd || t >= duration + this.startTime) {\n this.now = this.end;\n this.pos = 1;\n this.update();\n curAnim[this.prop] = true;\n done = true;\n objectEach(curAnim, function (val) {\n if (val !== true) {\n done = false;\n }\n });\n if (done && complete) {\n complete.call(elem);\n }\n ret = false;\n }\n else {\n this.pos = options.easing((t - this.startTime) / duration);\n this.now = this.start + ((this.end -\n this.start) * this.pos);\n this.update();\n ret = true;\n }\n return ret;\n }\n /**\n * Prepare start and end values so that the path can be animated one to one.\n *\n * @function Highcharts.Fx#initPath\n *\n * @param {Highcharts.SVGElement} elem\n * The SVGElement item.\n *\n * @param {Highcharts.SVGPathArray|undefined} fromD\n * Starting path definition.\n *\n * @param {Highcharts.SVGPathArray} toD\n * Ending path definition.\n *\n * @return {Array}\n * An array containing start and end paths in array form so that\n * they can be animated in parallel.\n */\n initPath(elem, fromD, toD) {\n const startX = elem.startX, endX = elem.endX, end = toD.slice(), // copy\n isArea = elem.isArea, positionFactor = isArea ? 2 : 1;\n let shift, fullLength, i, reverse, start = fromD && fromD.slice(); // copy\n if (!start) {\n return [end, end];\n }\n /**\n * If shifting points, prepend a dummy point to the end path.\n * @private\n */\n function prepend(arr, other) {\n while (arr.length < fullLength) {\n // Move to, line to or curve to?\n const moveSegment = arr[0], otherSegment = other[fullLength - arr.length];\n if (otherSegment && moveSegment[0] === 'M') {\n if (otherSegment[0] === 'C') {\n arr[0] = [\n 'C',\n moveSegment[1],\n moveSegment[2],\n moveSegment[1],\n moveSegment[2],\n moveSegment[1],\n moveSegment[2]\n ];\n }\n else {\n arr[0] = ['L', moveSegment[1], moveSegment[2]];\n }\n }\n // Prepend a copy of the first point\n arr.unshift(moveSegment);\n // For areas, the bottom path goes back again to the left, so we\n // need to append a copy of the last point.\n if (isArea) {\n const z = arr.pop();\n arr.push(arr[arr.length - 1], z); // append point and the Z\n }\n }\n }\n /**\n * Copy and append last point until the length matches the end length.\n * @private\n */\n function append(arr) {\n while (arr.length < fullLength) {\n // Pull out the slice that is going to be appended or inserted.\n // In a line graph, the positionFactor is 1, and the last point\n // is sliced out. In an area graph, the positionFactor is 2,\n // causing the middle two points to be sliced out, since an area\n // path starts at left, follows the upper path then turns and\n // follows the bottom back.\n const segmentToAdd = arr[Math.floor(arr.length / positionFactor) - 1].slice();\n // Disable the first control point of curve segments\n if (segmentToAdd[0] === 'C') {\n segmentToAdd[1] = segmentToAdd[5];\n segmentToAdd[2] = segmentToAdd[6];\n }\n if (!isArea) {\n arr.push(segmentToAdd);\n }\n else {\n const lowerSegmentToAdd = arr[Math.floor(arr.length / positionFactor)].slice();\n arr.splice(arr.length / 2, 0, segmentToAdd, lowerSegmentToAdd);\n }\n }\n }\n // For sideways animation, find out how much we need to shift to get the\n // start path Xs to match the end path Xs.\n if (startX && endX && endX.length) {\n for (i = 0; i < startX.length; i++) {\n // Moving left, new points coming in on right\n if (startX[i] === endX[0]) {\n shift = i;\n break;\n // Moving right\n }\n else if (startX[0] ===\n endX[endX.length - startX.length + i]) {\n shift = i;\n reverse = true;\n break;\n // Fixed from the right side, \"scaling\" left\n }\n else if (startX[startX.length - 1] ===\n endX[endX.length - startX.length + i]) {\n shift = startX.length - i;\n break;\n }\n }\n if (typeof shift === 'undefined') {\n start = [];\n }\n }\n if (start.length && isNumber(shift)) {\n // The common target length for the start and end array, where both\n // arrays are padded in opposite ends\n fullLength = end.length + shift * positionFactor;\n if (!reverse) {\n prepend(end, start);\n append(start);\n }\n else {\n prepend(start, end);\n append(end);\n }\n }\n return [start, end];\n }\n /**\n * Handle animation of the color attributes directly.\n *\n * @function Highcharts.Fx#fillSetter\n *\n */\n fillSetter() {\n Fx.prototype.strokeSetter.apply(this, arguments);\n }\n /**\n * Handle animation of the color attributes directly.\n *\n * @function Highcharts.Fx#strokeSetter\n *\n */\n strokeSetter() {\n this.elem.attr(this.prop, color(this.start).tweenTo(color(this.end), this.pos), void 0, true);\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nFx.timers = [];\n/* *\n *\n * Default Export\n *\n * */\nexport default Fx;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Fx from './Fx.js';\nimport U from '../Utilities.js';\nconst { defined, getStyle, isArray, isNumber, isObject, merge, objectEach, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Set the global animation to either a given value, or fall back to the given\n * chart's animation option.\n *\n * @function Highcharts.setAnimation\n *\n * @param {boolean|Partial|undefined} animation\n * The animation object.\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @todo\n * This function always relates to a chart, and sets a property on the renderer,\n * so it should be moved to the SVGRenderer.\n */\nfunction setAnimation(animation, chart) {\n chart.renderer.globalAnimation = pick(animation, chart.options.chart.animation, true);\n}\n/**\n * Get the animation in object form, where a disabled animation is always\n * returned as `{ duration: 0 }`.\n *\n * @function Highcharts.animObject\n *\n * @param {boolean|Highcharts.AnimationOptionsObject} [animation=0]\n * An animation setting. Can be an object with duration, complete and\n * easing properties, or a boolean to enable or disable.\n *\n * @return {Highcharts.AnimationOptionsObject}\n * An object with at least a duration property.\n */\nfunction animObject(animation) {\n return isObject(animation) ?\n merge({ duration: 500, defer: 0 }, animation) :\n { duration: animation ? 500 : 0, defer: 0 };\n}\n/**\n * Get the defer as a number value from series animation options.\n *\n * @function Highcharts.getDeferredAnimation\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @param {boolean|Highcharts.AnimationOptionsObject} animation\n * An animation setting. Can be an object with duration, complete and\n * easing properties, or a boolean to enable or disable.\n *\n * @param {Highcharts.Series} [series]\n * Series to defer animation.\n *\n * @return {number}\n * The numeric value.\n */\nfunction getDeferredAnimation(chart, animation, series) {\n const labelAnimation = animObject(animation), s = series ? [series] : chart.series;\n let defer = 0, duration = 0;\n s.forEach((series) => {\n const seriesAnim = animObject(series.options.animation);\n defer = isObject(animation) && defined(animation.defer) ?\n labelAnimation.defer :\n Math.max(defer, seriesAnim.duration + seriesAnim.defer);\n duration = Math.min(labelAnimation.duration, seriesAnim.duration);\n });\n // Disable defer for exporting\n if (chart.renderer.forExport) {\n defer = 0;\n }\n const anim = {\n defer: Math.max(0, defer - duration),\n duration: Math.min(defer, duration)\n };\n return anim;\n}\n/**\n * The global animate method, which uses Fx to create individual animators.\n *\n * @function Highcharts.animate\n *\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGElement} el\n * The element to animate.\n *\n * @param {Highcharts.CSSObject|Highcharts.SVGAttributes} params\n * An object containing key-value pairs of the properties to animate.\n * Supports numeric as pixel-based CSS properties for HTML objects and\n * attributes for SVGElements.\n *\n * @param {Partial} [opt]\n * Animation options.\n *\n * @return {void}\n */\nfunction animate(el, params, opt) {\n let start, unit = '', end, fx, args;\n if (!isObject(opt)) { // Number or undefined/null\n args = arguments;\n opt = {\n duration: args[2],\n easing: args[3],\n complete: args[4]\n };\n }\n if (!isNumber(opt.duration)) {\n opt.duration = 400;\n }\n opt.easing = typeof opt.easing === 'function' ?\n opt.easing :\n (Math[opt.easing] || Math.easeInOutSine);\n opt.curAnim = merge(params);\n objectEach(params, function (val, prop) {\n // Stop current running animation of this property\n stop(el, prop);\n fx = new Fx(el, opt, prop);\n end = void 0;\n if (prop === 'd' && isArray(params.d)) {\n fx.paths = fx.initPath(el, el.pathArray, params.d);\n fx.toD = params.d;\n start = 0;\n end = 1;\n }\n else if (el.attr) {\n start = el.attr(prop);\n }\n else {\n start = parseFloat(getStyle(el, prop)) || 0;\n if (prop !== 'opacity') {\n unit = 'px';\n }\n }\n if (!end) {\n end = val;\n }\n if (typeof end === 'string' && end.match('px')) {\n end = end.replace(/px/g, ''); // #4351\n }\n fx.run(start, end, unit);\n });\n}\n/**\n * Stop running animation.\n *\n * @function Highcharts.stop\n *\n * @param {Highcharts.SVGElement} el\n * The SVGElement to stop animation on.\n *\n * @param {string} [prop]\n * The property to stop animating. If given, the stop method will stop a\n * single property from animating, while others continue.\n *\n * @return {void}\n *\n * @todo\n * A possible extension to this would be to stop a single property, when\n * we want to continue animating others. Then assign the prop to the timer\n * in the Fx.run method, and check for the prop here. This would be an\n * improvement in all cases where we stop the animation from .attr. Instead of\n * stopping everything, we can just stop the actual attributes we're setting.\n */\nfunction stop(el, prop) {\n let i = Fx.timers.length;\n // Remove timers related to this element (#4519)\n while (i--) {\n if (Fx.timers[i].elem === el && (!prop || prop === Fx.timers[i].prop)) {\n Fx.timers[i].stopped = true; // #4667\n }\n }\n}\nconst animationExports = {\n animate,\n animObject,\n getDeferredAnimation,\n setAnimation,\n stop\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default animationExports;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Globals.js';\nconst { SVG_NS, win } = H;\nimport U from '../../Utilities.js';\nconst { attr, createElement, css, error, isFunction, isString, objectEach, splat } = U;\nconst { trustedTypes } = win;\n/* *\n *\n * Constants\n *\n * */\n// Create the trusted type policy. This should not be exposed.\nconst trustedTypesPolicy = (trustedTypes &&\n isFunction(trustedTypes.createPolicy) &&\n trustedTypes.createPolicy('highcharts', {\n createHTML: (s) => s\n }));\nconst emptyHTML = trustedTypesPolicy ?\n trustedTypesPolicy.createHTML('') :\n '';\n// IE9 and PhantomJS are only able to parse XML.\nconst hasValidDOMParser = (function () {\n try {\n return Boolean(new DOMParser().parseFromString(emptyHTML, 'text/html'));\n }\n catch (e) {\n return false;\n }\n}());\n/* *\n *\n * Class\n *\n * */\n/**\n * The AST class represents an abstract syntax tree of HTML or SVG content. It\n * can take HTML as an argument, parse it, optionally transform it to SVG, then\n * perform sanitation before inserting it into the DOM.\n *\n * @class\n * @name Highcharts.AST\n *\n * @param {string|Array} source\n * Either an HTML string or an ASTNode list to populate the tree.\n */\nclass AST {\n /* *\n *\n * Static Functions\n *\n * */\n /**\n * Filter an object of SVG or HTML attributes against the allow list.\n *\n * @static\n *\n * @function Highcharts.AST#filterUserAttributes\n *\n * @param {Highcharts.SVGAttributes} attributes The attributes to filter\n *\n * @return {Highcharts.SVGAttributes}\n * The filtered attributes\n */\n static filterUserAttributes(attributes) {\n objectEach(attributes, (val, key) => {\n let valid = true;\n if (AST.allowedAttributes.indexOf(key) === -1) {\n valid = false;\n }\n if (['background', 'dynsrc', 'href', 'lowsrc', 'src']\n .indexOf(key) !== -1) {\n valid = isString(val) && AST.allowedReferences.some((ref) => val.indexOf(ref) === 0);\n }\n if (!valid) {\n error(33, false, void 0, {\n 'Invalid attribute in config': `${key}`\n });\n delete attributes[key];\n }\n // #17753, < is not allowed in SVG attributes\n if (isString(val) && attributes[key]) {\n attributes[key] = val.replace(/ {\n const pair = line.split(':').map((s) => s.trim()), key = pair.shift();\n if (key && pair.length) {\n styles[key.replace(/-([a-z])/g, (g) => g[1].toUpperCase())] = pair.join(':'); // #17146\n }\n return styles;\n }, {});\n }\n /**\n * Utility function to set html content for an element by passing in a\n * markup string. The markup is safely parsed by the AST class to avoid\n * XSS vulnerabilities. This function should be used instead of setting\n * `innerHTML` in all cases where the content is not fully trusted.\n *\n * @static\n * @function Highcharts.AST#setElementHTML\n *\n * @param {SVGDOMElement|HTMLDOMElement} el\n * Node to set content of.\n *\n * @param {string} html\n * Markup string\n */\n static setElementHTML(el, html) {\n el.innerHTML = AST.emptyHTML; // Clear previous\n if (html) {\n const ast = new AST(html);\n ast.addToDOM(el);\n }\n }\n /* *\n *\n * Constructor\n *\n * */\n // Construct an AST from HTML markup, or wrap an array of existing AST nodes\n constructor(source) {\n this.nodes = typeof source === 'string' ?\n this.parseMarkup(source) : source;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Add the tree defined as a hierarchical JS structure to the DOM\n *\n * @function Highcharts.AST#addToDOM\n *\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} parent\n * The node where it should be added\n *\n * @return {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement}\n * The inserted node.\n */\n addToDOM(parent) {\n /**\n * @private\n * @param {Highcharts.ASTNode} subtree\n * HTML/SVG definition\n * @param {Element} [subParent]\n * parent node\n * @return {Highcharts.SVGDOMElement|Highcharts.HTMLDOMElement}\n * The inserted node.\n */\n function recurse(subtree, subParent) {\n let ret;\n splat(subtree).forEach(function (item) {\n const tagName = item.tagName;\n const textNode = item.textContent ?\n H.doc.createTextNode(item.textContent) :\n void 0;\n // Whether to ignore the AST filtering totally, #15345\n const bypassHTMLFiltering = AST.bypassHTMLFiltering;\n let node;\n if (tagName) {\n if (tagName === '#text') {\n node = textNode;\n }\n else if (AST.allowedTags.indexOf(tagName) !== -1 ||\n bypassHTMLFiltering) {\n const NS = tagName === 'svg' ?\n SVG_NS :\n (subParent.namespaceURI || SVG_NS);\n const element = H.doc.createElementNS(NS, tagName);\n const attributes = item.attributes || {};\n // Apply attributes from root of AST node, legacy from\n // from before TextBuilder\n objectEach(item, function (val, key) {\n if (key !== 'tagName' &&\n key !== 'attributes' &&\n key !== 'children' &&\n key !== 'style' &&\n key !== 'textContent') {\n attributes[key] = val;\n }\n });\n attr(element, bypassHTMLFiltering ?\n attributes :\n AST.filterUserAttributes(attributes));\n if (item.style) {\n css(element, item.style);\n }\n // Add text content\n if (textNode) {\n element.appendChild(textNode);\n }\n // Recurse\n recurse(item.children || [], element);\n node = element;\n }\n else {\n error(33, false, void 0, {\n 'Invalid tagName in config': tagName\n });\n }\n }\n // Add to the tree\n if (node) {\n subParent.appendChild(node);\n }\n ret = node;\n });\n // Return last node added (on top level it's the only one)\n return ret;\n }\n return recurse(this.nodes, parent);\n }\n /**\n * Parse HTML/SVG markup into AST Node objects. Used internally from the\n * constructor.\n *\n * @private\n *\n * @function Highcharts.AST#getNodesFromMarkup\n *\n * @param {string} markup The markup string.\n *\n * @return {Array} The parsed nodes.\n */\n parseMarkup(markup) {\n const nodes = [];\n markup = markup\n .trim()\n // The style attribute throws a warning when parsing when CSP is\n // enabled (#6884), so use an alias and pick it up below\n // Make all quotation marks parse correctly to DOM (#17627)\n .replace(/ style=([\"'])/g, ' data-style=$1');\n let doc;\n if (hasValidDOMParser) {\n doc = new DOMParser().parseFromString(trustedTypesPolicy ?\n trustedTypesPolicy.createHTML(markup) :\n markup, 'text/html');\n }\n else {\n const body = createElement('div');\n body.innerHTML = markup;\n doc = { body };\n }\n const appendChildNodes = (node, addTo) => {\n const tagName = node.nodeName.toLowerCase();\n // Add allowed tags\n const astNode = {\n tagName\n };\n if (tagName === '#text') {\n astNode.textContent = node.textContent || '';\n }\n const parsedAttributes = node.attributes;\n // Add attributes\n if (parsedAttributes) {\n const attributes = {};\n [].forEach.call(parsedAttributes, (attrib) => {\n if (attrib.name === 'data-style') {\n astNode.style = AST.parseStyle(attrib.value);\n }\n else {\n attributes[attrib.name] = attrib.value;\n }\n });\n astNode.attributes = attributes;\n }\n // Handle children\n if (node.childNodes.length) {\n const children = [];\n [].forEach.call(node.childNodes, (childNode) => {\n appendChildNodes(childNode, children);\n });\n if (children.length) {\n astNode.children = children;\n }\n }\n addTo.push(astNode);\n };\n [].forEach.call(doc.body.childNodes, (childNode) => appendChildNodes(childNode, nodes));\n return nodes;\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\n/**\n * The list of allowed SVG or HTML attributes, used for sanitizing\n * potentially harmful content from the chart configuration before adding to\n * the DOM.\n *\n * @see [Source code with default values](\n * https://github.com/highcharts/highcharts/blob/master/ts/Core/Renderer/HTML/AST.ts#:~:text=public%20static%20allowedAttributes)\n *\n * @example\n * // Allow a custom, trusted attribute\n * Highcharts.AST.allowedAttributes.push('data-value');\n *\n * @name Highcharts.AST.allowedAttributes\n * @type {Array}\n */\nAST.allowedAttributes = [\n 'alt',\n 'aria-controls',\n 'aria-describedby',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-pressed',\n 'aria-readonly',\n 'aria-roledescription',\n 'aria-selected',\n 'class',\n 'clip-path',\n 'color',\n 'colspan',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'disabled',\n 'fill',\n 'filterUnits',\n 'flood-color',\n 'flood-opacity',\n 'height',\n 'href',\n 'id',\n 'in',\n 'markerHeight',\n 'markerWidth',\n 'offset',\n 'opacity',\n 'orient',\n 'padding',\n 'paddingLeft',\n 'paddingRight',\n 'patternUnits',\n 'r',\n 'refX',\n 'refY',\n 'role',\n 'scope',\n 'slope',\n 'src',\n 'startOffset',\n 'stdDeviation',\n 'stroke',\n 'stroke-linecap',\n 'stroke-width',\n 'style',\n 'tableValues',\n 'result',\n 'rowspan',\n 'summary',\n 'target',\n 'tabindex',\n 'text-align',\n 'text-anchor',\n 'textAnchor',\n 'textLength',\n 'title',\n 'type',\n 'valign',\n 'width',\n 'x',\n 'x1',\n 'x2',\n 'xlink:href',\n 'y',\n 'y1',\n 'y2',\n 'zIndex'\n];\n/**\n * The list of allowed references for referring attributes like `href` and\n * `src`. Attribute values will only be allowed if they start with one of\n * these strings.\n *\n * @see [Source code with default values](\n * https://github.com/highcharts/highcharts/blob/master/ts/Core/Renderer/HTML/AST.ts#:~:text=public%20static%20allowedReferences)\n *\n * @example\n * // Allow tel:\n * Highcharts.AST.allowedReferences.push('tel:');\n *\n * @name Highcharts.AST.allowedReferences\n * @type {Array}\n */\nAST.allowedReferences = [\n 'https://',\n 'http://',\n 'mailto:',\n '/',\n '../',\n './',\n '#'\n];\n/**\n * The list of allowed SVG or HTML tags, used for sanitizing potentially\n * harmful content from the chart configuration before adding to the DOM.\n *\n * @see [Source code with default values](\n * https://github.com/highcharts/highcharts/blob/master/ts/Core/Renderer/HTML/AST.ts#:~:text=public%20static%20allowedTags)\n *\n * @example\n * // Allow a custom, trusted tag\n * Highcharts.AST.allowedTags.push('blink'); // ;)\n *\n * @name Highcharts.AST.allowedTags\n * @type {Array}\n */\nAST.allowedTags = [\n 'a',\n 'abbr',\n 'b',\n 'br',\n 'button',\n 'caption',\n 'circle',\n 'clipPath',\n 'code',\n 'dd',\n 'defs',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'feComponentTransfer',\n 'feDropShadow',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feOffset',\n 'feMerge',\n 'feMergeNode',\n 'filter',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'hr',\n 'i',\n 'img',\n 'li',\n 'linearGradient',\n 'marker',\n 'ol',\n 'p',\n 'path',\n 'pattern',\n 'pre',\n 'rect',\n 'small',\n 'span',\n 'stop',\n 'strong',\n 'style',\n 'sub',\n 'sup',\n 'svg',\n 'table',\n 'text',\n 'textPath',\n 'thead',\n 'title',\n 'tbody',\n 'tspan',\n 'td',\n 'th',\n 'tr',\n 'u',\n 'ul',\n '#text'\n];\nAST.emptyHTML = emptyHTML;\n/**\n * Allow all custom SVG and HTML attributes, references and tags (together\n * with potentially harmful ones) to be added to the DOM from the chart\n * configuration. In other words, disable the allow-listing which is the\n * primary functionality of the AST.\n *\n * WARNING: Setting this property to `true` while allowing untrusted user\n * data in the chart configuration will expose your application to XSS\n * security risks!\n *\n * Note that in case you want to allow a known set of tags or attributes,\n * you should allow-list them instead of disabling the filtering totally.\n * See [allowedAttributes](Highcharts.AST#.allowedAttributes),\n * [allowedReferences](Highcharts.AST#.allowedReferences) and\n * [allowedTags](Highcharts.AST#.allowedTags). The `bypassHTMLFiltering`\n * setting is intended only for those cases where allow-listing is not\n * practical, and the chart configuration already comes from a secure\n * source.\n *\n * @example\n * // Allow all custom attributes, references and tags (disable DOM XSS\n * // filtering)\n * Highcharts.AST.bypassHTMLFiltering = true;\n *\n * @name Highcharts.AST.bypassHTMLFiltering\n * @static\n */\nAST.bypassHTMLFiltering = false;\n/* *\n *\n * Default Export\n *\n * */\nexport default AST;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Serialized form of an SVG/HTML definition, including children.\n *\n * @interface Highcharts.ASTNode\n */ /**\n* @name Highcharts.ASTNode#attributes\n* @type {Highcharts.SVGAttributes|undefined}\n*/ /**\n* @name Highcharts.ASTNode#children\n* @type {Array|undefined}\n*/ /**\n* @name Highcharts.ASTNode#tagName\n* @type {string|undefined}\n*/ /**\n* @name Highcharts.ASTNode#textContent\n* @type {string|undefined}\n*/\n(''); // keeps doclets above in file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport D from './Defaults.js';\nconst { defaultOptions, defaultTime } = D;\nimport U from './Utilities.js';\nconst { extend, getNestedProperty, isArray, isNumber, isObject, pick, pInt } = U;\nconst helpers = {\n // Built-in helpers\n add: (a, b) => a + b,\n divide: (a, b) => (b !== 0 ? a / b : ''),\n // eslint-disable-next-line eqeqeq\n eq: (a, b) => a == b,\n each: function (arr) {\n const match = arguments[arguments.length - 1];\n return isArray(arr) ?\n arr.map((item, i) => format(match.body, extend(isObject(item) ? item : { '@this': item }, {\n '@index': i,\n '@first': i === 0,\n '@last': i === arr.length - 1\n }))).join('') :\n false;\n },\n ge: (a, b) => a >= b,\n gt: (a, b) => a > b,\n 'if': (condition) => !!condition,\n le: (a, b) => a <= b,\n lt: (a, b) => a < b,\n multiply: (a, b) => a * b,\n // eslint-disable-next-line eqeqeq\n ne: (a, b) => a != b,\n subtract: (a, b) => a - b,\n unless: (condition) => !condition\n};\n/* *\n *\n * Functions\n *\n * */\n/**\n * Formats a JavaScript date timestamp (milliseconds since Jan 1st 1970) into a\n * human readable date string. The format is a subset of the formats for PHP's\n * [strftime](https://www.php.net/manual/en/function.strftime.php) function.\n * Additional formats can be given in the {@link Highcharts.dateFormats} hook.\n *\n * Since v6.0.5, all internal dates are formatted through the\n * {@link Highcharts.Chart#time} instance to respect chart-level time settings.\n * The `Highcharts.dateFormat` function only reflects global time settings set\n * with `setOptions`.\n *\n * Supported format keys:\n * - `%a`: Short weekday, like 'Mon'\n * - `%A`: Long weekday, like 'Monday'\n * - `%d`: Two digit day of the month, 01 to 31\n * - `%e`: Day of the month, 1 through 31\n * - `%w`: Day of the week, 0 through 6\n * - `%b`: Short month, like 'Jan'\n * - `%B`: Long month, like 'January'\n * - `%m`: Two digit month number, 01 through 12\n * - `%y`: Two digits year, like 09 for 2009\n * - `%Y`: Four digits year, like 2009\n * - `%H`: Two digits hours in 24h format, 00 through 23\n * - `%k`: Hours in 24h format, 0 through 23\n * - `%I`: Two digits hours in 12h format, 00 through 11\n * - `%l`: Hours in 12h format, 1 through 12\n * - `%M`: Two digits minutes, 00 through 59\n * - `%p`: Upper case AM or PM\n * - `%P`: Lower case AM or PM\n * - `%S`: Two digits seconds, 00 through 59\n * - `%L`: Milliseconds (naming from Ruby)\n *\n * @function Highcharts.dateFormat\n *\n * @param {string} format\n * The desired format where various time representations are prefixed\n * with `%`.\n *\n * @param {number} timestamp\n * The JavaScript timestamp.\n *\n * @param {boolean} [capitalize=false]\n * Upper case first letter in the return.\n *\n * @return {string}\n * The formatted date.\n */\nfunction dateFormat(format, timestamp, capitalize) {\n return defaultTime.dateFormat(format, timestamp, capitalize);\n}\n/**\n * Format a string according to a subset of the rules of Python's String.format\n * method.\n *\n * @example\n * let s = Highcharts.format(\n * 'The {color} fox was {len:.2f} feet long',\n * { color: 'red', len: Math.PI }\n * );\n * // => The red fox was 3.14 feet long\n *\n * @function Highcharts.format\n *\n * @param {string} str\n * The string to format.\n *\n * @param {Record} ctx\n * The context, a collection of key-value pairs where each key is\n * replaced by its value.\n *\n * @param {Highcharts.Chart} [chart]\n * A `Chart` instance used to get numberFormatter and time.\n *\n * @return {string}\n * The formatted string.\n */\nfunction format(str = '', ctx, chart) {\n const regex = /\\{([a-zA-Z0-9\\:\\.\\,;\\-\\/<>%_@\"'= #\\(\\)]+)\\}/g, \n // The sub expression regex is the same as the top expression regex,\n // but except parens and block helpers (#), and surrounded by parens\n // instead of curly brackets.\n subRegex = /\\(([a-zA-Z0-9\\:\\.\\,;\\-\\/<>%_@\"'= ]+)\\)/g, matches = [], floatRegex = /f$/, decRegex = /\\.([0-9])/, lang = defaultOptions.lang, time = chart && chart.time || defaultTime, numberFormatter = chart && chart.numberFormatter || numberFormat;\n /*\n * Get a literal or variable value inside a template expression. May be\n * extended with other types like string or null if needed, but keep it\n * small for now.\n */\n const resolveProperty = (key = '') => {\n let n;\n // Literals\n if (key === 'true') {\n return true;\n }\n if (key === 'false') {\n return false;\n }\n if ((n = Number(key)).toString() === key) {\n return n;\n }\n // Variables and constants\n return getNestedProperty(key, ctx);\n };\n let match, currentMatch, depth = 0, hasSub;\n // Parse and create tree\n while ((match = regex.exec(str)) !== null) {\n // When a sub expression is found, it is evaluated first, and the\n // results recursively evaluated until no subexpression exists.\n const subMatch = subRegex.exec(match[1]);\n if (subMatch) {\n match = subMatch;\n hasSub = true;\n }\n if (!currentMatch || !currentMatch.isBlock) {\n currentMatch = {\n ctx,\n expression: match[1],\n find: match[0],\n isBlock: match[1].charAt(0) === '#',\n start: match.index,\n startInner: match.index + match[0].length,\n length: match[0].length\n };\n }\n // Identify helpers\n const fn = match[1].split(' ')[0].replace('#', '');\n if (helpers[fn]) {\n // Block helper, only 0 level is handled\n if (currentMatch.isBlock && fn === currentMatch.fn) {\n depth++;\n }\n if (!currentMatch.fn) {\n currentMatch.fn = fn;\n }\n }\n // Closing a block helper\n const startingElseSection = match[1] === 'else';\n if (currentMatch.isBlock &&\n currentMatch.fn && (match[1] === `/${currentMatch.fn}` ||\n startingElseSection)) {\n if (!depth) { // === 0\n const start = currentMatch.startInner, body = str.substr(start, match.index - start);\n // Either closing without an else section, or when encountering\n // an else section\n if (currentMatch.body === void 0) {\n currentMatch.body = body;\n currentMatch.startInner = match.index + match[0].length;\n // The body exists already, so this is the else section\n }\n else {\n currentMatch.elseBody = body;\n }\n currentMatch.find += body + match[0];\n if (!startingElseSection) {\n matches.push(currentMatch);\n currentMatch = void 0;\n }\n }\n else if (!startingElseSection) {\n depth--;\n }\n // Common expression\n }\n else if (!currentMatch.isBlock) {\n matches.push(currentMatch);\n }\n // Evaluate sub-matches one by one to prevent orphaned block closers\n if (subMatch && !currentMatch?.isBlock) {\n break;\n }\n }\n // Execute\n matches.forEach((match) => {\n const { body, elseBody, expression, fn } = match;\n let replacement, i;\n // Helper function\n if (fn) {\n // Pass the helpers the amount of arguments defined by the function,\n // then the match as the last argument.\n const args = [match], parts = expression.split(' ');\n i = helpers[fn].length;\n while (i--) {\n args.unshift(resolveProperty(parts[i + 1]));\n }\n replacement = helpers[fn].apply(ctx, args);\n // Block helpers may return true or false. They may also return a\n // string, like the `each` helper.\n if (match.isBlock && typeof replacement === 'boolean') {\n replacement = format(replacement ? body : elseBody, ctx);\n }\n // Simple variable replacement\n }\n else {\n const valueAndFormat = expression.split(':');\n replacement = resolveProperty(valueAndFormat.shift() || '');\n // Format the replacement\n if (valueAndFormat.length && typeof replacement === 'number') {\n const segment = valueAndFormat.join(':');\n if (floatRegex.test(segment)) { // float\n const decimals = parseInt((segment.match(decRegex) || ['', '-1'])[1], 10);\n if (replacement !== null) {\n replacement = numberFormatter(replacement, decimals, lang.decimalPoint, segment.indexOf(',') > -1 ? lang.thousandsSep : '');\n }\n }\n else {\n replacement = time.dateFormat(segment, replacement);\n }\n }\n }\n str = str.replace(match.find, pick(replacement, ''));\n });\n return hasSub ? format(str, ctx, chart) : str;\n}\n/**\n * Format a number and return a string based on input settings.\n *\n * @sample highcharts/members/highcharts-numberformat/\n * Custom number format\n *\n * @function Highcharts.numberFormat\n *\n * @param {number} number\n * The input number to format.\n *\n * @param {number} decimals\n * The amount of decimals. A value of -1 preserves the amount in the\n * input number.\n *\n * @param {string} [decimalPoint]\n * The decimal point, defaults to the one given in the lang options, or\n * a dot.\n *\n * @param {string} [thousandsSep]\n * The thousands separator, defaults to the one given in the lang\n * options, or a space character.\n *\n * @return {string}\n * The formatted number.\n */\nfunction numberFormat(number, decimals, decimalPoint, thousandsSep) {\n number = +number || 0;\n decimals = +decimals;\n let ret, fractionDigits;\n const lang = defaultOptions.lang, origDec = (number.toString().split('.')[1] || '').split('e')[0].length, exponent = number.toString().split('e'), firstDecimals = decimals;\n if (decimals === -1) {\n // Preserve decimals. Not huge numbers (#3793).\n decimals = Math.min(origDec, 20);\n }\n else if (!isNumber(decimals)) {\n decimals = 2;\n }\n else if (decimals && exponent[1] && exponent[1] < 0) {\n // Expose decimals from exponential notation (#7042)\n fractionDigits = decimals + +exponent[1];\n if (fractionDigits >= 0) {\n // remove too small part of the number while keeping the notation\n exponent[0] = (+exponent[0]).toExponential(fractionDigits)\n .split('e')[0];\n decimals = fractionDigits;\n }\n else {\n // fractionDigits < 0\n exponent[0] = exponent[0].split('.')[0] || 0;\n if (decimals < 20) {\n // use number instead of exponential notation (#7405)\n number = (exponent[0] * Math.pow(10, exponent[1]))\n .toFixed(decimals);\n }\n else {\n // or zero\n number = 0;\n }\n exponent[1] = 0;\n }\n }\n // Add another decimal to avoid rounding errors of float numbers. (#4573)\n // Then use toFixed to handle rounding.\n const roundedNumber = (Math.abs(exponent[1] ? exponent[0] : number) +\n Math.pow(10, -Math.max(decimals, origDec) - 1)).toFixed(decimals);\n // A string containing the positive integer component of the number\n const strinteger = String(pInt(roundedNumber));\n // Leftover after grouping into thousands. Can be 0, 1 or 2.\n const thousands = strinteger.length > 3 ? strinteger.length % 3 : 0;\n // Language\n decimalPoint = pick(decimalPoint, lang.decimalPoint);\n thousandsSep = pick(thousandsSep, lang.thousandsSep);\n // Start building the return\n ret = number < 0 ? '-' : '';\n // Add the leftover after grouping into thousands. For example, in the\n // number 42 000 000, this line adds 42.\n ret += thousands ? strinteger.substr(0, thousands) + thousandsSep : '';\n if (+exponent[1] < 0 && !firstDecimals) {\n ret = '0';\n }\n else {\n // Add the remaining thousands groups, joined by the thousands separator\n ret += strinteger\n .substr(thousands)\n .replace(/(\\d{3})(?=\\d)/g, '$1' + thousandsSep);\n }\n // Add the decimal point and the decimal component\n if (decimals) {\n // Get the decimal component\n ret += decimalPoint + roundedNumber.slice(-decimals);\n }\n if (exponent[1] && +ret !== 0) {\n ret += 'e' + exponent[1];\n }\n return ret;\n}\n/* *\n *\n * Default Export\n *\n * */\nconst Templating = {\n dateFormat,\n format,\n helpers,\n numberFormat\n};\nexport default Templating;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Globals.js';\n/* *\n *\n * Namespace\n *\n * */\nvar RendererRegistry;\n(function (RendererRegistry) {\n /* *\n *\n * Constants\n *\n * */\n RendererRegistry.rendererTypes = {};\n /* *\n *\n * Variables\n *\n * */\n let defaultRenderer;\n /* *\n *\n * Functions\n *\n * */\n /**\n * Gets a registered renderer class. If no renderer type is provided or the\n * requested renderer was not founded, the default renderer is returned.\n *\n * @param {string} [rendererType]\n * Renderer type or the default renderer.\n *\n * @return {Highcharts.Class}\n * Returns the requested renderer class or the default renderer class.\n */\n function getRendererType(rendererType = defaultRenderer) {\n return (RendererRegistry.rendererTypes[rendererType] || RendererRegistry.rendererTypes[defaultRenderer]);\n }\n RendererRegistry.getRendererType = getRendererType;\n /**\n * Register a renderer class.\n *\n * @param {string} rendererType\n * Renderer type to register.\n *\n * @param {Highcharts.Class} rendererClass\n * Returns the requested renderer class or the default renderer class.\n *\n * @param {boolean} setAsDefault\n * Sets the renderer class as the default renderer.\n */\n function registerRendererType(rendererType, rendererClass, setAsDefault) {\n RendererRegistry.rendererTypes[rendererType] = rendererClass;\n if (!defaultRenderer || setAsDefault) {\n defaultRenderer = rendererType;\n H.Renderer = rendererClass; // compatibility\n }\n }\n RendererRegistry.registerRendererType = registerRendererType;\n})(RendererRegistry || (RendererRegistry = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default RendererRegistry;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Imports\n *\n * */\nimport U from '../Utilities.js';\nconst { clamp, pick, pushUnique, stableSort } = U;\n/* *\n *\n * Namespace\n *\n * */\nvar RendererUtilities;\n(function (RendererUtilities) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * General distribution algorithm for distributing labels of differing size\n * along a confined length in two dimensions. The algorithm takes an array\n * of objects containing a size, a target and a rank. It will place the\n * labels as close as possible to their targets, skipping the lowest ranked\n * labels if necessary.\n * @private\n */\n function distribute(boxes, len, maxDistance) {\n // Original array will be altered with added .pos\n const origBoxes = boxes, reducedLen = origBoxes.reducedLen || len, sortByRank = (a, b) => (b.rank || 0) - (a.rank || 0), sortByTarget = (a, b) => a.target - b.target, restBoxes = [], // The outranked overshoot\n boxesLength = boxes.length, forDeletion = [], push = restBoxes.push;\n let i, cursor, step, overlapping = true, box, target, total = 0, equalRank;\n // If the total size exceeds the len, remove those boxes with the lowest\n // rank\n i = boxesLength;\n while (i--) {\n total += boxes[i].size;\n }\n // Sort by rank, then slice away overshoot\n if (total > reducedLen) {\n stableSort(boxes, sortByRank);\n equalRank = boxes[0].rank === boxes[boxes.length - 1].rank;\n step = equalRank ? boxesLength / 2 : -1;\n cursor = equalRank ? step : boxesLength - 1;\n // When the boxes have equal rank (pie data labels, flags - #10073),\n // decimate the boxes by starting in the middle and gradually remove\n // more items inside the array. When they are sorted by rank, just\n // remove the ones with the lowest rank from the end.\n while (step && total > reducedLen) {\n i = Math.floor(cursor);\n box = boxes[i];\n if (pushUnique(forDeletion, i)) {\n total -= box.size;\n }\n cursor += step;\n // Start over the decimation with smaller steps\n if (equalRank && cursor >= boxes.length) {\n step /= 2;\n cursor = step;\n }\n }\n // Clean out the boxes marked for deletion\n forDeletion\n .sort((a, b) => b - a)\n .forEach((i) => push.apply(restBoxes, boxes.splice(i, 1)));\n }\n // Order by target\n stableSort(boxes, sortByTarget);\n // So far we have been mutating the original array. Now\n // create a copy with target arrays\n boxes = boxes.map((box) => ({\n size: box.size,\n targets: [box.target],\n align: pick(box.align, 0.5)\n }));\n while (overlapping) {\n // Initial positions: target centered in box\n i = boxes.length;\n while (i--) {\n box = boxes[i];\n // Composite box, average of targets\n target = (Math.min.apply(0, box.targets) +\n Math.max.apply(0, box.targets)) / 2;\n box.pos = clamp(target - box.size * box.align, 0, len - box.size);\n }\n // Detect overlap and join boxes\n i = boxes.length;\n overlapping = false;\n while (i--) {\n // Overlap\n if (i > 0 &&\n boxes[i - 1].pos + boxes[i - 1].size >\n boxes[i].pos) {\n // Add this size to the previous box\n boxes[i - 1].size += boxes[i].size;\n boxes[i - 1].targets = boxes[i - 1]\n .targets\n .concat(boxes[i].targets);\n boxes[i - 1].align = 0.5;\n // Overlapping right, push left\n if (boxes[i - 1].pos + boxes[i - 1].size > len) {\n boxes[i - 1].pos = len - boxes[i - 1].size;\n }\n boxes.splice(i, 1); // Remove this item\n overlapping = true;\n }\n }\n }\n // Add the rest (hidden boxes)\n push.apply(origBoxes, restBoxes);\n // Now the composite boxes are placed, we need to put the original boxes\n // within them\n i = 0;\n boxes.some((box) => {\n let posInCompositeBox = 0;\n // Exceeded maxDistance => abort\n return (box.targets || []).some(() => {\n origBoxes[i].pos = box.pos + posInCompositeBox;\n // If the distance between the position and the target exceeds\n // maxDistance, abort the loop and decrease the length in\n // increments of 10% to recursively reduce the number of\n // visible boxes by rank. Once all boxes are within the\n // maxDistance, we're good.\n if (typeof maxDistance !== 'undefined' &&\n Math.abs(origBoxes[i].pos - origBoxes[i].target) > maxDistance) {\n // Reset the positions that are already set\n origBoxes\n .slice(0, i + 1)\n .forEach((box) => delete box.pos);\n // Try with a smaller length\n origBoxes.reducedLen =\n (origBoxes.reducedLen || len) - (len * 0.1);\n // Recurse\n if (origBoxes.reducedLen > len * 0.1) {\n distribute(origBoxes, len, maxDistance);\n }\n // Exceeded maxDistance => abort\n return true;\n }\n posInCompositeBox += origBoxes[i].size;\n i++;\n return false;\n });\n });\n // Add the rest (hidden) boxes and sort by target\n stableSort(origBoxes, sortByTarget);\n return origBoxes;\n }\n RendererUtilities.distribute = distribute;\n})(RendererUtilities || (RendererUtilities = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default RendererUtilities;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../../Animation/AnimationUtilities.js';\nconst { animate, animObject, stop } = A;\nimport Color from '../../Color/Color.js';\nimport H from '../../Globals.js';\nconst { deg2rad, doc, svg, SVG_NS, win } = H;\nimport U from '../../Utilities.js';\nconst { addEvent, attr, createElement, css, defined, erase, extend, fireEvent, isArray, isFunction, isObject, isString, merge, objectEach, pick, pInt, replaceNested, syncTimeout, uniqueKey } = U;\n/* *\n *\n * Class\n *\n * */\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/**\n * The SVGElement prototype is a JavaScript wrapper for SVG elements used in the\n * rendering layer of Highcharts. Combined with the\n * {@link Highcharts.SVGRenderer}\n * object, these prototypes allow freeform annotation in the charts or even in\n * HTML pages without instanciating a chart. The SVGElement can also wrap HTML\n * labels, when `text` or `label` elements are created with the `useHTML`\n * parameter.\n *\n * The SVGElement instances are created through factory functions on the\n * {@link Highcharts.SVGRenderer}\n * object, like\n * {@link Highcharts.SVGRenderer#rect|rect},\n * {@link Highcharts.SVGRenderer#path|path},\n * {@link Highcharts.SVGRenderer#text|text},\n * {@link Highcharts.SVGRenderer#label|label},\n * {@link Highcharts.SVGRenderer#g|g}\n * and more.\n *\n * See [How to use the SVG Renderer](\n * https://www.highcharts.com/docs/advanced-chart-features/renderer) for a\n * comprehensive tutorial on how to draw SVG elements on a chart.\n *\n * @class\n * @name Highcharts.SVGElement\n */\nclass SVGElement {\n // @todo public zIndex?: number;\n /* *\n *\n * Functions\n *\n * */\n /**\n * Get the current value of an attribute or pseudo attribute,\n * used mainly for animation. Called internally from\n * the {@link Highcharts.SVGRenderer#attr} function.\n *\n * @private\n * @function Highcharts.SVGElement#_defaultGetter\n *\n * @param {string} key\n * Property key.\n *\n * @return {number|string}\n * Property value.\n */\n _defaultGetter(key) {\n let ret = pick(this[key + 'Value'], // align getter\n this[key], this.element ? this.element.getAttribute(key) : null, 0);\n if (/^[\\-0-9\\.]+$/.test(ret)) { // is numerical\n ret = parseFloat(ret);\n }\n return ret;\n }\n /**\n * @private\n * @function Highcharts.SVGElement#_defaultSetter\n *\n * @param {string} value\n *\n * @param {string} key\n *\n * @param {Highcharts.SVGDOMElement} element\n *\n */\n _defaultSetter(value, key, element) {\n element.setAttribute(key, value);\n }\n /**\n * Add the element to the DOM. All elements must be added this way.\n *\n * @sample highcharts/members/renderer-g\n * Elements added to a group\n *\n * @function Highcharts.SVGElement#add\n *\n * @param {Highcharts.SVGElement} [parent]\n * The parent item to add it to. If undefined, the element is added\n * to the {@link Highcharts.SVGRenderer.box}.\n *\n * @return {Highcharts.SVGElement}\n * Returns the SVGElement for chaining.\n */\n add(parent) {\n const renderer = this.renderer, element = this.element;\n let inserted;\n if (parent) {\n this.parentGroup = parent;\n }\n // Build formatted text\n if (typeof this.textStr !== 'undefined' &&\n this.element.nodeName === 'text' // Not for SVGLabel instances\n ) {\n renderer.buildText(this);\n }\n // Mark as added\n this.added = true;\n // If we're adding to renderer root, or other elements in the group\n // have a z index, we need to handle it\n if (!parent || parent.handleZ || this.zIndex) {\n inserted = this.zIndexSetter();\n }\n // If zIndex is not handled, append at the end\n if (!inserted) {\n (parent ?\n parent.element :\n renderer.box).appendChild(element);\n }\n // fire an event for internal hooks\n if (this.onAdd) {\n this.onAdd();\n }\n return this;\n }\n /**\n * Add a class name to an element.\n *\n * @function Highcharts.SVGElement#addClass\n *\n * @param {string} className\n * The new class name to add.\n *\n * @param {boolean} [replace=false]\n * When true, the existing class name(s) will be overwritten with the new\n * one. When false, the new one is added.\n *\n * @return {Highcharts.SVGElement}\n * Return the SVG element for chainability.\n */\n addClass(className, replace) {\n const currentClassName = replace ? '' : (this.attr('class') || '');\n // Trim the string and remove duplicates\n className = (className || '')\n .split(/ /g)\n .reduce(function (newClassName, name) {\n if (currentClassName.indexOf(name) === -1) {\n newClassName.push(name);\n }\n return newClassName;\n }, (currentClassName ?\n [currentClassName] :\n []))\n .join(' ');\n if (className !== currentClassName) {\n this.attr('class', className);\n }\n return this;\n }\n /**\n * This method is executed in the end of `attr()`, after setting all\n * attributes in the hash. In can be used to efficiently consolidate\n * multiple attributes in one SVG property -- e.g., translate, rotate and\n * scale are merged in one \"transform\" attribute in the SVG node.\n *\n * @private\n * @function Highcharts.SVGElement#afterSetters\n */\n afterSetters() {\n // Update transform. Do this outside the loop to prevent redundant\n // updating for batch setting of attributes.\n if (this.doTransform) {\n this.updateTransform();\n this.doTransform = false;\n }\n }\n /**\n * Align the element relative to the chart or another box.\n *\n * @function Highcharts.SVGElement#align\n *\n * @param {Highcharts.AlignObject} [alignOptions]\n * The alignment options. The function can be called without this\n * parameter in order to re-align an element after the box has been\n * updated.\n *\n * @param {boolean} [alignByTranslate]\n * Align element by translation.\n *\n * @param {string|Highcharts.BBoxObject} [box]\n * The box to align to, needs a width and height. When the box is a\n * string, it refers to an object in the Renderer. For example, when\n * box is `spacingBox`, it refers to `Renderer.spacingBox` which\n * holds `width`, `height`, `x` and `y` properties.\n *\n * @param {boolean} [redraw]\n * Decide if SVGElement should be redrawn with new alignment or\n * just change its attributes.\n *\n * @return {Highcharts.SVGElement} Returns the SVGElement for chaining.\n */\n align(alignOptions, alignByTranslate, box, redraw = true) {\n const attribs = {}, renderer = this.renderer, alignedObjects = renderer.alignedObjects;\n let x, y, alignTo, alignFactor, vAlignFactor;\n // First call on instanciate\n if (alignOptions) {\n this.alignOptions = alignOptions;\n this.alignByTranslate = alignByTranslate;\n if (!box || isString(box)) {\n this.alignTo = alignTo = box || 'renderer';\n // prevent duplicates, like legendGroup after resize\n erase(alignedObjects, this);\n alignedObjects.push(this);\n box = void 0; // reassign it below\n }\n // When called on resize, no arguments are supplied\n }\n else {\n alignOptions = this.alignOptions;\n alignByTranslate = this.alignByTranslate;\n alignTo = this.alignTo;\n }\n box = pick(box, renderer[alignTo], renderer);\n // Assign variables\n const align = alignOptions.align, vAlign = alignOptions.verticalAlign;\n // default: left align\n x = (box.x || 0) + (alignOptions.x || 0);\n // default: top align\n y = (box.y || 0) + (alignOptions.y || 0);\n // Align\n if (align === 'right') {\n alignFactor = 1;\n }\n else if (align === 'center') {\n alignFactor = 2;\n }\n if (alignFactor) {\n x += (box.width - (alignOptions.width || 0)) /\n alignFactor;\n }\n attribs[alignByTranslate ? 'translateX' : 'x'] = Math.round(x);\n // Vertical align\n if (vAlign === 'bottom') {\n vAlignFactor = 1;\n }\n else if (vAlign === 'middle') {\n vAlignFactor = 2;\n }\n if (vAlignFactor) {\n y += (box.height - (alignOptions.height || 0)) /\n vAlignFactor;\n }\n attribs[alignByTranslate ? 'translateY' : 'y'] = Math.round(y);\n // Animate only if already placed\n if (redraw) {\n this[this.placed ? 'animate' : 'attr'](attribs);\n this.placed = true;\n }\n this.alignAttr = attribs;\n return this;\n }\n /**\n * @private\n * @function Highcharts.SVGElement#alignSetter\n * @param {\"left\"|\"center\"|\"right\"} value\n */\n alignSetter(value) {\n const convert = {\n left: 'start',\n center: 'middle',\n right: 'end'\n };\n if (convert[value]) {\n this.alignValue = value;\n this.element.setAttribute('text-anchor', convert[value]);\n }\n }\n /**\n * Animate to given attributes or CSS properties.\n *\n * @sample highcharts/members/element-on/\n * Setting some attributes by animation\n *\n * @function Highcharts.SVGElement#animate\n *\n * @param {Highcharts.SVGAttributes} params\n * SVG attributes or CSS to animate.\n *\n * @param {boolean|Partial} [options]\n * Animation options.\n *\n * @param {Function} [complete]\n * Function to perform at the end of animation.\n *\n * @return {Highcharts.SVGElement}\n * Returns the SVGElement for chaining.\n */\n animate(params, options, complete) {\n const animOptions = animObject(pick(options, this.renderer.globalAnimation, true)), deferTime = animOptions.defer;\n // When the page is hidden save resources in the background by not\n // running animation at all (#9749).\n if (doc.hidden) {\n animOptions.duration = 0;\n }\n if (animOptions.duration !== 0) {\n // allows using a callback with the global animation without\n // overwriting it\n if (complete) {\n animOptions.complete = complete;\n }\n // If defer option is defined delay the animation #12901\n syncTimeout(() => {\n if (this.element) {\n animate(this, params, animOptions);\n }\n }, deferTime);\n }\n else {\n this.attr(params, void 0, complete || animOptions.complete);\n // Call the end step synchronously\n objectEach(params, function (val, prop) {\n if (animOptions.step) {\n animOptions.step.call(this, val, { prop: prop, pos: 1, elem: this });\n }\n }, this);\n }\n return this;\n }\n /**\n * Apply a text outline through a custom CSS property, by copying the text\n * element and apply stroke to the copy. Used internally. Contrast checks at\n * [example](https://jsfiddle.net/highcharts/43soe9m1/2/).\n *\n * @example\n * // Specific color\n * text.css({\n * textOutline: '1px black'\n * });\n * // Automatic contrast\n * text.css({\n * color: '#000000', // black text\n * textOutline: '1px contrast' // => white outline\n * });\n *\n * @private\n * @function Highcharts.SVGElement#applyTextOutline\n *\n * @param {string} textOutline\n * A custom CSS `text-outline` setting, defined by `width color`.\n */\n applyTextOutline(textOutline) {\n const elem = this.element, hasContrast = textOutline.indexOf('contrast') !== -1, styles = {};\n // When the text shadow is set to contrast, use dark stroke for light\n // text and vice versa.\n if (hasContrast) {\n styles.textOutline = textOutline = textOutline.replace(/contrast/g, this.renderer.getContrast(elem.style.fill));\n }\n // Extract the stroke width and color\n const parts = textOutline.split(' ');\n const color = parts[parts.length - 1];\n let strokeWidth = parts[0];\n if (strokeWidth && strokeWidth !== 'none' && H.svg) {\n this.fakeTS = true; // Fake text shadow\n // Since the stroke is applied on center of the actual outline, we\n // need to double it to get the correct stroke-width outside the\n // glyphs.\n strokeWidth = strokeWidth.replace(/(^[\\d\\.]+)(.*?)$/g, function (match, digit, unit) {\n return (2 * Number(digit)) + unit;\n });\n // Remove shadows from previous runs.\n this.removeTextOutline();\n const outline = doc.createElementNS(SVG_NS, 'tspan');\n attr(outline, {\n 'class': 'highcharts-text-outline',\n fill: color,\n stroke: color,\n 'stroke-width': strokeWidth,\n 'stroke-linejoin': 'round'\n });\n // For each of the tspans and text nodes, create a copy in the\n // outline.\n const parentElem = elem.querySelector('textPath') || elem;\n [].forEach.call(parentElem.childNodes, (childNode) => {\n const clone = childNode.cloneNode(true);\n if (clone.removeAttribute) {\n ['fill', 'stroke', 'stroke-width', 'stroke'].forEach((prop) => clone\n .removeAttribute(prop));\n }\n outline.appendChild(clone);\n });\n // Collect the sum of dy from all children, included nested ones\n let totalHeight = 0;\n [].forEach.call(parentElem.querySelectorAll('text tspan'), (element) => {\n totalHeight += Number(element.getAttribute('dy'));\n });\n // Insert an absolutely positioned break before the original text\n // to keep it in place\n const br = doc.createElementNS(SVG_NS, 'tspan');\n br.textContent = '\\u200B';\n // Reset the position for the following text\n attr(br, {\n x: Number(elem.getAttribute('x')),\n dy: -totalHeight\n });\n // Insert the outline\n outline.appendChild(br);\n parentElem.insertBefore(outline, parentElem.firstChild);\n }\n }\n /**\n * @function Highcharts.SVGElement#attr\n * @param {string} key\n * @return {number|string}\n */ /**\n * Apply native and custom attributes to the SVG elements.\n *\n * In order to set the rotation center for rotation, set x and y to 0 and\n * use `translateX` and `translateY` attributes to position the element\n * instead.\n *\n * Attributes frequently used in Highcharts are `fill`, `stroke`,\n * `stroke-width`.\n *\n * @sample highcharts/members/renderer-rect/\n * Setting some attributes\n *\n * @example\n * // Set multiple attributes\n * element.attr({\n * stroke: 'red',\n * fill: 'blue',\n * x: 10,\n * y: 10\n * });\n *\n * // Set a single attribute\n * element.attr('stroke', 'red');\n *\n * // Get an attribute\n * element.attr('stroke'); // => 'red'\n *\n * @function Highcharts.SVGElement#attr\n *\n * @param {string|Highcharts.SVGAttributes} [hash]\n * The native and custom SVG attributes.\n *\n * @param {number|string|Highcharts.SVGPathArray} [val]\n * If the type of the first argument is `string`, the second can be a\n * value, which will serve as a single attribute setter. If the first\n * argument is a string and the second is undefined, the function\n * serves as a getter and the current value of the property is\n * returned.\n *\n * @param {Function} [complete]\n * A callback function to execute after setting the attributes. This\n * makes the function compliant and interchangeable with the\n * {@link SVGElement#animate} function.\n *\n * @param {boolean} [continueAnimation=true]\n * Used internally when `.attr` is called as part of an animation\n * step. Otherwise, calling `.attr` for an attribute will stop\n * animation for that attribute.\n *\n * @return {Highcharts.SVGElement}\n * If used as a setter, it returns the current\n * {@link Highcharts.SVGElement} so the calls can be chained. If\n * used as a getter, the current value of the attribute is returned.\n */\n attr(hash, val, complete, continueAnimation) {\n const element = this.element, symbolCustomAttribs = SVGElement.symbolCustomAttribs;\n let key, hasSetSymbolSize, ret = this, skipAttr, setter;\n // single key-value pair\n if (typeof hash === 'string' && typeof val !== 'undefined') {\n key = hash;\n hash = {};\n hash[key] = val;\n }\n // used as a getter: first argument is a string, second is undefined\n if (typeof hash === 'string') {\n ret = (this[hash + 'Getter'] ||\n this._defaultGetter).call(this, hash, element);\n // setter\n }\n else {\n objectEach(hash, function eachAttribute(val, key) {\n skipAttr = false;\n // Unless .attr is from the animator update, stop current\n // running animation of this property\n if (!continueAnimation) {\n stop(this, key);\n }\n // Special handling of symbol attributes\n if (this.symbolName &&\n symbolCustomAttribs.indexOf(key) !== -1) {\n if (!hasSetSymbolSize) {\n this.symbolAttr(hash);\n hasSetSymbolSize = true;\n }\n skipAttr = true;\n }\n if (this.rotation && (key === 'x' || key === 'y')) {\n this.doTransform = true;\n }\n if (!skipAttr) {\n setter = (this[key + 'Setter'] ||\n this._defaultSetter);\n setter.call(this, val, key, element);\n }\n }, this);\n this.afterSetters();\n }\n // In accordance with animate, run a complete callback\n if (complete) {\n complete.call(this);\n }\n return ret;\n }\n /**\n * Apply a clipping shape to this element.\n *\n * @function Highcharts.SVGElement#clip\n *\n * @param {SVGElement} [clipElem]\n * The clipping shape. If skipped, the current clip is removed.\n *\n * @return {Highcharts.SVGElement}\n * Returns the SVG element to allow chaining.\n */\n clip(clipElem) {\n if (clipElem && !clipElem.clipPath) {\n // Add a hyphen at the end to avoid confusion in testing indexes\n // -1 and -10, -11 etc (#6550)\n const id = uniqueKey() + '-', clipPath = this.renderer.createElement('clipPath')\n .attr({ id })\n .add(this.renderer.defs);\n extend(clipElem, { clipPath, id, count: 0 });\n clipElem.add(clipPath);\n }\n return this.attr('clip-path', clipElem ?\n `url(${this.renderer.url}#${clipElem.id})` :\n 'none');\n }\n /**\n * Calculate the coordinates needed for drawing a rectangle crisply and\n * return the calculated attributes.\n *\n * @function Highcharts.SVGElement#crisp\n *\n * @param {Highcharts.RectangleObject} rect\n * Rectangle to crisp.\n *\n * @param {number} [strokeWidth]\n * The stroke width to consider when computing crisp positioning. It can\n * also be set directly on the rect parameter.\n *\n * @return {Highcharts.RectangleObject}\n * The modified rectangle arguments.\n */\n crisp(rect, strokeWidth) {\n const wrapper = this;\n strokeWidth = strokeWidth || rect.strokeWidth || 0;\n // Math.round because strokeWidth can sometimes have roundoff errors\n const normalizer = Math.round(strokeWidth) % 2 / 2;\n // normalize for crisp edges\n rect.x = Math.floor(rect.x || wrapper.x || 0) + normalizer;\n rect.y = Math.floor(rect.y || wrapper.y || 0) + normalizer;\n rect.width = Math.floor((rect.width || wrapper.width || 0) - 2 * normalizer);\n rect.height = Math.floor((rect.height || wrapper.height || 0) - 2 * normalizer);\n if (defined(rect.strokeWidth)) {\n rect.strokeWidth = strokeWidth;\n }\n return rect;\n }\n /**\n * Build and apply an SVG gradient out of a common JavaScript configuration\n * object. This function is called from the attribute setters. An event\n * hook is added for supporting other complex color types.\n *\n * @private\n * @function Highcharts.SVGElement#complexColor\n *\n * @param {Highcharts.GradientColorObject|Highcharts.PatternObject} colorOptions\n * The gradient or pattern options structure.\n *\n * @param {string} prop\n * The property to apply, can either be `fill` or `stroke`.\n *\n * @param {Highcharts.SVGDOMElement} elem\n * SVG element to apply the gradient on.\n */\n complexColor(colorOptions, prop, elem) {\n const renderer = this.renderer;\n let colorObject, gradName, gradAttr, radAttr, gradients, stops, stopColor, stopOpacity, radialReference, id, key = [], value;\n fireEvent(this.renderer, 'complexColor', {\n args: arguments\n }, function () {\n // Apply linear or radial gradients\n if (colorOptions.radialGradient) {\n gradName = 'radialGradient';\n }\n else if (colorOptions.linearGradient) {\n gradName = 'linearGradient';\n }\n if (gradName) {\n gradAttr = colorOptions[gradName];\n gradients = renderer.gradients;\n stops = colorOptions.stops;\n radialReference = elem.radialReference;\n // Keep < 2.2 compatibility\n if (isArray(gradAttr)) {\n colorOptions[gradName] = gradAttr = {\n x1: gradAttr[0],\n y1: gradAttr[1],\n x2: gradAttr[2],\n y2: gradAttr[3],\n gradientUnits: 'userSpaceOnUse'\n };\n }\n // Correct the radial gradient for the radial reference system\n if (gradName === 'radialGradient' &&\n radialReference &&\n !defined(gradAttr.gradientUnits)) {\n // Save the radial attributes for updating\n radAttr = gradAttr;\n gradAttr = merge(gradAttr, renderer.getRadialAttr(radialReference, radAttr), { gradientUnits: 'userSpaceOnUse' });\n }\n // Build the unique key to detect whether we need to create a\n // new element (#1282)\n objectEach(gradAttr, function (value, n) {\n if (n !== 'id') {\n key.push(n, value);\n }\n });\n objectEach(stops, function (val) {\n key.push(val);\n });\n key = key.join(',');\n // Check if a gradient object with the same config object is\n // created within this renderer\n if (gradients[key]) {\n id = gradients[key].attr('id');\n }\n else {\n // Set the id and create the element\n gradAttr.id = id = uniqueKey();\n const gradientObject = gradients[key] =\n renderer.createElement(gradName)\n .attr(gradAttr)\n .add(renderer.defs);\n gradientObject.radAttr = radAttr;\n // The gradient needs to keep a list of stops to be able to\n // destroy them\n gradientObject.stops = [];\n stops.forEach(function (stop) {\n if (stop[1].indexOf('rgba') === 0) {\n colorObject = Color.parse(stop[1]);\n stopColor = colorObject.get('rgb');\n stopOpacity = colorObject.get('a');\n }\n else {\n stopColor = stop[1];\n stopOpacity = 1;\n }\n const stopObject = renderer.createElement('stop').attr({\n offset: stop[0],\n 'stop-color': stopColor,\n 'stop-opacity': stopOpacity\n }).add(gradientObject);\n // Add the stop element to the gradient\n gradientObject.stops.push(stopObject);\n });\n }\n // Set the reference to the gradient object\n value = 'url(' + renderer.url + '#' + id + ')';\n elem.setAttribute(prop, value);\n elem.gradient = key;\n // Allow the color to be concatenated into tooltips formatters\n // etc. (#2995)\n colorOptions.toString = function () {\n return value;\n };\n }\n });\n }\n /**\n * Set styles for the element. In addition to CSS styles supported by\n * native SVG and HTML elements, there are also some custom made for\n * Highcharts, like `width`, `ellipsis` and `textOverflow` for SVG text\n * elements.\n *\n * @sample highcharts/members/renderer-text-on-chart/\n * Styled text\n *\n * @function Highcharts.SVGElement#css\n *\n * @param {Highcharts.CSSObject} styles\n * The new CSS styles.\n *\n * @return {Highcharts.SVGElement}\n * Return the SVG element for chaining.\n */\n css(styles) {\n const oldStyles = this.styles, newStyles = {}, elem = this.element;\n let textWidth, hasNew = !oldStyles;\n // Filter out existing styles to increase performance (#2640)\n if (oldStyles) {\n objectEach(styles, function (value, n) {\n if (oldStyles && oldStyles[n] !== value) {\n newStyles[n] = value;\n hasNew = true;\n }\n });\n }\n if (hasNew) {\n // Merge the new styles with the old ones\n if (oldStyles) {\n styles = extend(oldStyles, newStyles);\n }\n // Get the text width from style\n // Previously set, unset it (#8234)\n if (styles.width === null || styles.width === 'auto') {\n delete this.textWidth;\n // Apply new\n }\n else if (elem.nodeName.toLowerCase() === 'text' &&\n styles.width) {\n textWidth = this.textWidth = pInt(styles.width);\n }\n // Store object\n extend(this.styles, styles);\n if (textWidth && (!svg && this.renderer.forExport)) {\n delete styles.width;\n }\n const stylesToApply = merge(styles);\n if (elem.namespaceURI === this.SVG_NS) {\n // These CSS properties are interpreted internally by the SVG\n // renderer, but are not supported by SVG and should not be\n // added to the DOM. In styled mode, no CSS should find its way\n // to the DOM whatsoever (#6173, #6474).\n ['textOutline', 'textOverflow', 'width'].forEach((key) => (stylesToApply &&\n delete stylesToApply[key]));\n // SVG requires fill for text\n if (stylesToApply.color) {\n stylesToApply.fill = stylesToApply.color;\n }\n }\n css(elem, stylesToApply);\n }\n if (this.added) {\n // Rebuild text after added. Cache mechanisms in the buildText will\n // prevent building if there are no significant changes.\n if (this.element.nodeName === 'text') {\n this.renderer.buildText(this);\n }\n // Apply text outline after added\n if (styles.textOutline) {\n this.applyTextOutline(styles.textOutline);\n }\n }\n return this;\n }\n /**\n * @private\n * @function Highcharts.SVGElement#dashstyleSetter\n * @param {string} value\n */\n dashstyleSetter(value) {\n let i, strokeWidth = this['stroke-width'];\n // If \"inherit\", like maps in IE, assume 1 (#4981). With HC5 and the new\n // strokeWidth function, we should be able to use that instead.\n if (strokeWidth === 'inherit') {\n strokeWidth = 1;\n }\n value = value && value.toLowerCase();\n if (value) {\n const v = value\n .replace('shortdashdotdot', '3,1,1,1,1,1,')\n .replace('shortdashdot', '3,1,1,1')\n .replace('shortdot', '1,1,')\n .replace('shortdash', '3,1,')\n .replace('longdash', '8,3,')\n .replace(/dot/g, '1,3,')\n .replace('dash', '4,3,')\n .replace(/,$/, '')\n .split(','); // ending comma\n i = v.length;\n while (i--) {\n v[i] = '' + (pInt(v[i]) * pick(strokeWidth, NaN));\n }\n value = v.join(',').replace(/NaN/g, 'none'); // #3226\n this.element.setAttribute('stroke-dasharray', value);\n }\n }\n /**\n * Destroy the element and element wrapper and clear up the DOM and event\n * hooks.\n *\n * @function Highcharts.SVGElement#destroy\n */\n destroy() {\n const wrapper = this, element = wrapper.element || {}, renderer = wrapper.renderer, ownerSVGElement = element.ownerSVGElement;\n let parentToClean = (element.nodeName === 'SPAN' &&\n wrapper.parentGroup ||\n void 0), grandParent, i;\n // remove events\n element.onclick = element.onmouseout = element.onmouseover =\n element.onmousemove = element.point = null;\n stop(wrapper); // stop running animations\n if (wrapper.clipPath && ownerSVGElement) {\n const clipPath = wrapper.clipPath;\n // Look for existing references to this clipPath and remove them\n // before destroying the element (#6196).\n // The upper case version is for Edge\n [].forEach.call(ownerSVGElement.querySelectorAll('[clip-path],[CLIP-PATH]'), function (el) {\n if (el.getAttribute('clip-path').indexOf(clipPath.element.id) > -1) {\n el.removeAttribute('clip-path');\n }\n });\n wrapper.clipPath = clipPath.destroy();\n }\n wrapper.connector = wrapper.connector?.destroy();\n // Destroy stops in case this is a gradient object @todo old code?\n if (wrapper.stops) {\n for (i = 0; i < wrapper.stops.length; i++) {\n wrapper.stops[i].destroy();\n }\n wrapper.stops.length = 0;\n wrapper.stops = void 0;\n }\n // remove element\n wrapper.safeRemoveChild(element);\n // In case of useHTML, clean up empty containers emulating SVG groups\n // (#1960, #2393, #2697).\n while (parentToClean &&\n parentToClean.div &&\n parentToClean.div.childNodes.length === 0) {\n grandParent = parentToClean.parentGroup;\n wrapper.safeRemoveChild(parentToClean.div);\n delete parentToClean.div;\n parentToClean = grandParent;\n }\n // remove from alignObjects\n if (wrapper.alignTo) {\n erase(renderer.alignedObjects, wrapper);\n }\n objectEach(wrapper, function (val, key) {\n // Destroy child elements of a group\n if (wrapper[key] &&\n wrapper[key].parentGroup === wrapper &&\n wrapper[key].destroy) {\n wrapper[key].destroy();\n }\n // Delete all properties\n delete wrapper[key];\n });\n return;\n }\n /**\n * @private\n * @function Highcharts.SVGElement#dSettter\n * @param {number|string|Highcharts.SVGPathArray} value\n * @param {string} key\n * @param {Highcharts.SVGDOMElement} element\n */\n dSetter(value, key, element) {\n if (isArray(value)) {\n // Backwards compatibility, convert one-dimensional array into an\n // array of segments\n if (typeof value[0] === 'string') {\n value = this.renderer.pathToSegments(value);\n }\n this.pathArray = value;\n value = value.reduce((acc, seg, i) => {\n if (!seg || !seg.join) {\n return (seg || '').toString();\n }\n return (i ? acc + ' ' : '') + seg.join(' ');\n }, '');\n }\n if (/(NaN| {2}|^$)/.test(value)) {\n value = 'M 0 0';\n }\n // Check for cache before resetting. Resetting causes disturbance in the\n // DOM, causing flickering in some cases in Edge/IE (#6747). Also\n // possible performance gain.\n if (this[key] !== value) {\n element.setAttribute(key, value);\n this[key] = value;\n }\n }\n /**\n * @private\n * @function Highcharts.SVGElement#fillSetter\n * @param {Highcharts.ColorType} value\n * @param {string} key\n * @param {Highcharts.SVGDOMElement} element\n */\n fillSetter(value, key, element) {\n if (typeof value === 'string') {\n element.setAttribute(key, value);\n }\n else if (value) {\n this.complexColor(value, key, element);\n }\n }\n /**\n * @private\n * @function Highcharts.SVGElement#hrefSetter\n * @param {Highcharts.ColorType} value\n * @param {string} key\n * @param {Highcharts.SVGDOMElement} element\n */\n hrefSetter(value, key, element) {\n // Namespace is needed for offline export, #19106\n element.setAttributeNS('http://www.w3.org/1999/xlink', key, value);\n }\n /**\n * Get the bounding box (width, height, x and y) for the element. Generally\n * used to get rendered text size. Since this is called a lot in charts,\n * the results are cached based on text properties, in order to save DOM\n * traffic. The returned bounding box includes the rotation, so for example\n * a single text line of rotation 90 will report a greater height, and a\n * width corresponding to the line-height.\n *\n * @sample highcharts/members/renderer-on-chart/\n * Draw a rectangle based on a text's bounding box\n *\n * @function Highcharts.SVGElement#getBBox\n *\n * @param {boolean} [reload]\n * Skip the cache and get the updated DOM bounding box.\n *\n * @param {number} [rot]\n * Override the element's rotation. This is internally used on axis\n * labels with a value of 0 to find out what the bounding box would\n * be have been if it were not rotated.\n *\n * @return {Highcharts.BBoxObject}\n * The bounding box with `x`, `y`, `width` and `height` properties.\n */\n getBBox(reload, rot) {\n const wrapper = this, { alignValue, element, renderer, styles, textStr } = wrapper, { cache, cacheKeys } = renderer, isSVG = element.namespaceURI === wrapper.SVG_NS, rotation = pick(rot, wrapper.rotation, 0), fontSize = renderer.styledMode ? (element &&\n SVGElement.prototype.getStyle.call(element, 'font-size')) : (styles.fontSize);\n let bBox, height, toggleTextShadowShim, cacheKey;\n // Avoid undefined and null (#7316)\n if (defined(textStr)) {\n cacheKey = textStr.toString();\n // Since numbers are monospaced, and numerical labels appear a lot\n // in a chart, we assume that a label of n characters has the same\n // bounding box as others of the same length. Unless there is inner\n // HTML in the label. In that case, leave the numbers as is (#5899).\n if (cacheKey.indexOf('<') === -1) {\n cacheKey = cacheKey.replace(/[0-9]/g, '0');\n }\n // Properties that affect bounding box\n cacheKey += [\n '',\n renderer.rootFontSize,\n fontSize,\n rotation,\n wrapper.textWidth,\n alignValue,\n styles.textOverflow,\n styles.fontWeight // #12163\n ].join(',');\n }\n if (cacheKey && !reload) {\n bBox = cache[cacheKey];\n }\n // No cache found\n if (!bBox) {\n // SVG elements\n if (isSVG || renderer.forExport) {\n try { // Fails in Firefox if the container has display: none.\n // When the text shadow shim is used, we need to hide the\n // fake shadows to get the correct bounding box (#3872)\n toggleTextShadowShim = this.fakeTS && function (display) {\n const outline = element.querySelector('.highcharts-text-outline');\n if (outline) {\n css(outline, { display });\n }\n };\n // Workaround for #3842, Firefox reporting wrong bounding\n // box for shadows\n if (isFunction(toggleTextShadowShim)) {\n toggleTextShadowShim('none');\n }\n bBox = element.getBBox ?\n // SVG: use extend because IE9 is not allowed to change\n // width and height in case of rotation (below)\n extend({}, element.getBBox()) : {\n // HTML elements with `exporting.allowHTML` and\n // legacy IE in export mode\n width: element.offsetWidth,\n height: element.offsetHeight,\n x: 0,\n y: 0\n };\n // #3842\n if (isFunction(toggleTextShadowShim)) {\n toggleTextShadowShim('');\n }\n }\n catch (e) {\n '';\n }\n // If the bBox is not set, the try-catch block above failed. The\n // other condition is for Opera that returns a width of\n // -Infinity on hidden elements.\n if (!bBox || bBox.width < 0) {\n bBox = { x: 0, y: 0, width: 0, height: 0 };\n }\n // useHTML within SVG\n }\n else {\n bBox = wrapper.htmlGetBBox();\n }\n // True SVG elements as well as HTML elements in modern browsers\n // using the .useHTML option need to compensated for rotation\n height = bBox.height;\n // Workaround for wrong bounding box in IE, Edge and Chrome on\n // Windows. With Highcharts' default font, IE and Edge report\n // a box height of 16.899 and Chrome rounds it to 17. If this\n // stands uncorrected, it results in more padding added below\n // the text than above when adding a label border or background.\n // Also vertical positioning is affected.\n // https://jsfiddle.net/highcharts/em37nvuj/\n // (#1101, #1505, #1669, #2568, #6213).\n if (isSVG) {\n bBox.height = height = ({\n '11px,17': 14,\n '13px,20': 16\n }[`${fontSize || ''},${Math.round(height)}`] ||\n height);\n }\n // Adjust for rotated text\n if (rotation) {\n bBox = this.getRotatedBox(bBox, rotation);\n }\n }\n // Cache it. When loading a chart in a hidden iframe in Firefox and\n // IE/Edge, the bounding box height is 0, so don't cache it (#5620).\n if (cacheKey && (textStr === '' || bBox.height > 0)) {\n // Rotate (#4681)\n while (cacheKeys.length > 250) {\n delete cache[cacheKeys.shift()];\n }\n if (!cache[cacheKey]) {\n cacheKeys.push(cacheKey);\n }\n cache[cacheKey] = bBox;\n }\n return bBox;\n }\n /**\n * Get the rotated box.\n * @private\n */\n getRotatedBox(box, rotation) {\n const { x: boxX, y: boxY, width, height } = box, { alignValue, translateY, rotationOriginX = 0, rotationOriginY = 0 } = this, alignFactor = {\n 'right': 1,\n 'center': 0.5\n }[alignValue || 0] || 0, baseline = Number(this.element.getAttribute('y') || 0) -\n (translateY ? 0 : boxY), rad = rotation * deg2rad, rad90 = (rotation - 90) * deg2rad, cosRad = Math.cos(rad), sinRad = Math.sin(rad), wCosRad = width * cosRad, wSinRad = width * sinRad, cosRad90 = Math.cos(rad90), sinRad90 = Math.sin(rad90), [[xOriginCosRad, xOriginSinRad], [yOriginCosRad, yOriginSinRad]] = [\n rotationOriginX,\n rotationOriginY\n ].map((rotOrigin) => [\n rotOrigin - (rotOrigin * cosRad),\n rotOrigin * sinRad\n ]), \n // Find the starting point on the left side baseline of\n // the text\n pX = ((boxX + alignFactor * (width - wCosRad)) +\n xOriginCosRad + yOriginSinRad), pY = ((boxY + baseline - alignFactor * wSinRad) -\n xOriginSinRad + yOriginCosRad), \n // Find all corners\n aX = pX + baseline * cosRad90, bX = aX + wCosRad, cX = bX - height * cosRad90, dX = cX - wCosRad, aY = pY + baseline * sinRad90, bY = aY + wSinRad, cY = bY - height * sinRad90, dY = cY - wSinRad;\n // Deduct the bounding box from the corners\n const x = Math.min(aX, bX, cX, dX), y = Math.min(aY, bY, cY, dY), boxWidth = Math.max(aX, bX, cX, dX) - x, boxHeight = Math.max(aY, bY, cY, dY) - y;\n return {\n x,\n y,\n width: boxWidth,\n height: boxHeight\n };\n }\n /**\n * Get the computed style. Only in styled mode.\n *\n * @example\n * chart.series[0].points[0].graphic.getStyle('stroke-width'); // => '1px'\n *\n * @function Highcharts.SVGElement#getStyle\n *\n * @param {string} prop\n * The property name to check for.\n *\n * @return {string}\n * The current computed value.\n */\n getStyle(prop) {\n return win\n .getComputedStyle(this.element || this, '')\n .getPropertyValue(prop);\n }\n /**\n * Check if an element has the given class name.\n *\n * @function Highcharts.SVGElement#hasClass\n *\n * @param {string} className\n * The class name to check for.\n *\n * @return {boolean}\n * Whether the class name is found.\n */\n hasClass(className) {\n return ('' + this.attr('class'))\n .split(' ')\n .indexOf(className) !== -1;\n }\n /**\n * Hide the element, similar to setting the `visibility` attribute to\n * `hidden`.\n *\n * @function Highcharts.SVGElement#hide\n *\n * @return {Highcharts.SVGElement}\n * Returns the SVGElement for chaining.\n */\n hide() {\n return this.attr({ visibility: 'hidden' });\n }\n /**\n * @private\n */\n htmlGetBBox() {\n return { height: 0, width: 0, x: 0, y: 0 };\n }\n /**\n * Initialize the SVG element. This function only exists to make the\n * initialization process overridable. It should not be called directly.\n *\n * @function Highcharts.SVGElement#init\n *\n * @param {Highcharts.SVGRenderer} renderer\n * The SVGRenderer instance to initialize to.\n *\n * @param {string} nodeName\n * The SVG node name.\n */\n constructor(renderer, nodeName) {\n this.onEvents = {};\n this.opacity = 1; // Default base for animation\n this.SVG_NS = SVG_NS;\n /**\n * The primary DOM node. Each `SVGElement` instance wraps a main DOM\n * node, but may also represent more nodes.\n *\n * @name Highcharts.SVGElement#element\n * @type {Highcharts.SVGDOMElement|Highcharts.HTMLDOMElement}\n */\n this.element = nodeName === 'span' || nodeName === 'body' ?\n createElement(nodeName) :\n doc.createElementNS(this.SVG_NS, nodeName);\n /**\n * The renderer that the SVGElement belongs to.\n *\n * @name Highcharts.SVGElement#renderer\n * @type {Highcharts.SVGRenderer}\n */\n this.renderer = renderer;\n this.styles = {};\n fireEvent(this, 'afterInit');\n }\n /**\n * Add an event listener. This is a simple setter that replaces the\n * previous event of the same type added by this function, as opposed to\n * the {@link Highcharts#addEvent} function.\n *\n * @sample highcharts/members/element-on/\n * A clickable rectangle\n *\n * @function Highcharts.SVGElement#on\n *\n * @param {string} eventType\n * The event type.\n *\n * @param {Function} handler\n * The handler callback.\n *\n * @return {Highcharts.SVGElement}\n * The SVGElement for chaining.\n */\n on(eventType, handler) {\n const { onEvents } = this;\n if (onEvents[eventType]) {\n // Unbind existing event\n onEvents[eventType]();\n }\n onEvents[eventType] = addEvent(this.element, eventType, handler);\n return this;\n }\n /**\n * @private\n * @function Highcharts.SVGElement#opacitySetter\n * @param {string} value\n * @param {string} key\n * @param {Highcharts.SVGDOMElement} element\n */\n opacitySetter(value, key, element) {\n // Round off to avoid float errors, like tests where opacity lands on\n // 9.86957e-06 instead of 0\n const opacity = Number(Number(value).toFixed(3));\n this.opacity = opacity;\n element.setAttribute(key, opacity);\n }\n /**\n * Remove a class name from the element.\n *\n * @function Highcharts.SVGElement#removeClass\n *\n * @param {string|RegExp} className\n * The class name to remove.\n *\n * @return {Highcharts.SVGElement} Returns the SVG element for chainability.\n */\n removeClass(className) {\n return this.attr('class', ('' + this.attr('class'))\n .replace(isString(className) ?\n new RegExp(`(^| )${className}( |$)`) : // #12064, #13590\n className, ' ')\n .replace(/ +/g, ' ')\n .trim());\n }\n /**\n *\n * @private\n */\n removeTextOutline() {\n const outline = this.element\n .querySelector('tspan.highcharts-text-outline');\n if (outline) {\n this.safeRemoveChild(outline);\n }\n }\n /**\n * Removes an element from the DOM.\n *\n * @private\n * @function Highcharts.SVGElement#safeRemoveChild\n *\n * @param {Highcharts.SVGDOMElement|Highcharts.HTMLDOMElement} element\n * The DOM node to remove.\n */\n safeRemoveChild(element) {\n const parentNode = element.parentNode;\n if (parentNode) {\n parentNode.removeChild(element);\n }\n }\n /**\n * Set the coordinates needed to draw a consistent radial gradient across\n * a shape regardless of positioning inside the chart. Used on pie slices\n * to make all the slices have the same radial reference point.\n *\n * @function Highcharts.SVGElement#setRadialReference\n *\n * @param {Array} coordinates\n * The center reference. The format is `[centerX, centerY, diameter]` in\n * pixels.\n *\n * @return {Highcharts.SVGElement}\n * Returns the SVGElement for chaining.\n */\n setRadialReference(coordinates) {\n const existingGradient = (this.element.gradient &&\n this.renderer.gradients[this.element.gradient]);\n this.element.radialReference = coordinates;\n // On redrawing objects with an existing gradient, the gradient needs\n // to be repositioned (#3801)\n if (existingGradient && existingGradient.radAttr) {\n existingGradient.animate(this.renderer.getRadialAttr(coordinates, existingGradient.radAttr));\n }\n return this;\n }\n /**\n * Set a text path for a `text` or `label` element, allowing the text to\n * flow along a path.\n *\n * In order to unset the path for an existing element, call `setTextPath`\n * with `{ enabled: false }` as the second argument.\n *\n * @sample highcharts/members/renderer-textpath/ Text path demonstrated\n *\n * @function Highcharts.SVGElement#setTextPath\n *\n * @param {Highcharts.SVGElement|undefined} path\n * Path to follow. If undefined, it allows changing options for the\n * existing path.\n *\n * @param {Highcharts.DataLabelsTextPathOptionsObject} textPathOptions\n * Options.\n *\n * @return {Highcharts.SVGElement} Returns the SVGElement for chaining.\n */\n setTextPath(path, textPathOptions) {\n // Defaults\n textPathOptions = merge(true, {\n enabled: true,\n attributes: {\n dy: -5,\n startOffset: '50%',\n textAnchor: 'middle'\n }\n }, textPathOptions);\n const url = this.renderer.url, textWrapper = this.text || this, textPath = textWrapper.textPath, { attributes, enabled } = textPathOptions;\n path = path || (textPath && textPath.path);\n // Remove previously added event\n if (textPath) {\n textPath.undo();\n }\n if (path && enabled) {\n const undo = addEvent(textWrapper, 'afterModifyTree', (e) => {\n if (path && enabled) {\n // Set ID for the path\n let textPathId = path.attr('id');\n if (!textPathId) {\n path.attr('id', textPathId = uniqueKey());\n }\n // Set attributes for the \n const textAttribs = {\n // dx/dy options must by set on (parent), the\n // rest should be set on \n x: 0,\n y: 0\n };\n if (defined(attributes.dx)) {\n textAttribs.dx = attributes.dx;\n delete attributes.dx;\n }\n if (defined(attributes.dy)) {\n textAttribs.dy = attributes.dy;\n delete attributes.dy;\n }\n textWrapper.attr(textAttribs);\n // Handle label properties\n this.attr({ transform: '' });\n if (this.box) {\n this.box = this.box.destroy();\n }\n // Wrap the nodes in a textPath\n const children = e.nodes.slice(0);\n e.nodes.length = 0;\n e.nodes[0] = {\n tagName: 'textPath',\n attributes: extend(attributes, {\n 'text-anchor': attributes.textAnchor,\n href: `${url}#${textPathId}`\n }),\n children\n };\n }\n });\n // Set the reference\n textWrapper.textPath = { path, undo };\n }\n else {\n textWrapper.attr({ dx: 0, dy: 0 });\n delete textWrapper.textPath;\n }\n if (this.added) {\n // Rebuild text after added\n textWrapper.textCache = '';\n this.renderer.buildText(textWrapper);\n }\n return this;\n }\n /**\n * Add a shadow to the element. In styled mode, this method is not used,\n * instead use `defs` and filters.\n *\n * @example\n * renderer.rect(10, 100, 100, 100)\n * .attr({ fill: 'red' })\n * .shadow(true);\n *\n * @function Highcharts.SVGElement#shadow\n *\n * @param {boolean|Highcharts.ShadowOptionsObject} [shadowOptions] The\n * shadow options. If `true`, the default options are applied. If\n * `false`, the current shadow will be removed.\n *\n * @return {Highcharts.SVGElement} Returns the SVGElement for chaining.\n */\n shadow(shadowOptions) {\n const { renderer } = this, options = merge(this.parentGroup?.rotation === 90 ? {\n offsetX: -1,\n offsetY: -1\n } : {}, isObject(shadowOptions) ? shadowOptions : {}), id = renderer.shadowDefinition(options);\n return this.attr({\n filter: shadowOptions ?\n `url(${renderer.url}#${id})` :\n 'none'\n });\n }\n /**\n * Show the element after it has been hidden.\n *\n * @function Highcharts.SVGElement#show\n *\n * @param {boolean} [inherit=true]\n * Set the visibility attribute to `inherit` rather than `visible`.\n * The difference is that an element with `visibility=\"visible\"`\n * will be visible even if the parent is hidden.\n *\n * @return {Highcharts.SVGElement}\n * Returns the SVGElement for chaining.\n */\n show(inherit = true) {\n return this.attr({ visibility: inherit ? 'inherit' : 'visible' });\n }\n /**\n * Set the stroke-width and record it on the SVGElement\n *\n * @private\n * @function Highcharts.SVGElement#strokeSetter\n * @param {number|string|ColorType} value\n * @param {string} key\n * @param {Highcharts.SVGDOMElement} element\n */\n 'stroke-widthSetter'(value, key, element) {\n // Record it for quick access in getter\n this[key] = value;\n element.setAttribute(key, value);\n }\n /**\n * Get the computed stroke width in pixel values. This is used extensively\n * when drawing shapes to ensure the shapes are rendered crisp and\n * positioned correctly relative to each other. Using\n * `shape-rendering: crispEdges` leaves us less control over positioning,\n * for example when we want to stack columns next to each other, or position\n * things pixel-perfectly within the plot box.\n *\n * The common pattern when placing a shape is:\n * - Create the SVGElement and add it to the DOM. In styled mode, it will\n * now receive a stroke width from the style sheet. In classic mode we\n * will add the `stroke-width` attribute.\n * - Read the computed `elem.strokeWidth()`.\n * - Place it based on the stroke width.\n *\n * @function Highcharts.SVGElement#strokeWidth\n *\n * @return {number}\n * The stroke width in pixels. Even if the given stroke width (in CSS or by\n * attributes) is based on `em` or other units, the pixel size is returned.\n */\n strokeWidth() {\n // In non-styled mode, read the stroke width as set by .attr\n if (!this.renderer.styledMode) {\n return this['stroke-width'] || 0;\n }\n // In styled mode, read computed stroke width\n const val = this.getStyle('stroke-width');\n let ret = 0, tempElement;\n // Read pixel values directly\n if (/px$/.test(val)) {\n ret = pInt(val);\n // Other values like em, pt etc need to be measured\n }\n else if (val !== '') {\n tempElement = doc.createElementNS(SVG_NS, 'rect');\n attr(tempElement, {\n width: val,\n 'stroke-width': 0\n });\n this.element.parentNode.appendChild(tempElement);\n ret = tempElement.getBBox().width;\n tempElement.parentNode.removeChild(tempElement);\n }\n return ret;\n }\n /**\n * If one of the symbol size affecting parameters are changed,\n * check all the others only once for each call to an element's\n * .attr() method\n *\n * @private\n * @function Highcharts.SVGElement#symbolAttr\n *\n * @param {Highcharts.SVGAttributes} hash\n * The attributes to set.\n */\n symbolAttr(hash) {\n const wrapper = this;\n SVGElement.symbolCustomAttribs.forEach(function (key) {\n wrapper[key] = pick(hash[key], wrapper[key]);\n });\n wrapper.attr({\n d: wrapper.renderer.symbols[wrapper.symbolName](wrapper.x, wrapper.y, wrapper.width, wrapper.height, wrapper)\n });\n }\n /**\n * @private\n * @function Highcharts.SVGElement#textSetter\n * @param {string} value\n */\n textSetter(value) {\n if (value !== this.textStr) {\n // Delete size caches when the text changes\n // delete this.bBox; // old code in series-label\n delete this.textPxLength;\n this.textStr = value;\n if (this.added) {\n this.renderer.buildText(this);\n }\n }\n }\n /**\n * @private\n * @function Highcharts.SVGElement#titleSetter\n * @param {string} value\n */\n titleSetter(value) {\n const el = this.element;\n const titleNode = el.getElementsByTagName('title')[0] ||\n doc.createElementNS(this.SVG_NS, 'title');\n // Move to first child\n if (el.insertBefore) {\n el.insertBefore(titleNode, el.firstChild);\n }\n else {\n el.appendChild(titleNode);\n }\n // Replace text content and escape markup\n titleNode.textContent = replaceNested(// Scan #[73]\n pick(value, ''), // #3276, #3895\n [/<[^>]*>/g, '']).replace(/</g, '<').replace(/>/g, '>');\n }\n /**\n * Bring the element to the front. Alternatively, a new zIndex can be set.\n *\n * @sample highcharts/members/element-tofront/\n * Click an element to bring it to front\n *\n * @function Highcharts.SVGElement#toFront\n *\n * @return {Highcharts.SVGElement}\n * Returns the SVGElement for chaining.\n */\n toFront() {\n const element = this.element;\n element.parentNode.appendChild(element);\n return this;\n }\n /**\n * Move an object and its children by x and y values.\n *\n * @function Highcharts.SVGElement#translate\n *\n * @param {number} x\n * The x value.\n *\n * @param {number} y\n * The y value.\n *\n * @return {Highcharts.SVGElement}\n * Translated element.\n */\n translate(x, y) {\n return this.attr({\n translateX: x,\n translateY: y\n });\n }\n /**\n * Update the transform attribute based on internal properties. Deals with\n * the custom `translateX`, `translateY`, `rotation`, `scaleX` and `scaleY`\n * attributes and updates the SVG `transform` attribute.\n *\n * @private\n * @function Highcharts.SVGElement#updateTransform\n */\n updateTransform(attrib = 'transform') {\n const { element, matrix, rotation = 0, rotationOriginX, rotationOriginY, scaleX, scaleY, translateX = 0, translateY = 0 } = this;\n // Apply translate. Nearly all transformed elements have translation,\n // so instead of checking for translate = 0, do it always (#1767,\n // #1846).\n const transform = ['translate(' + translateX + ',' + translateY + ')'];\n // Apply matrix\n if (defined(matrix)) {\n transform.push('matrix(' + matrix.join(',') + ')');\n }\n // Apply rotation\n if (rotation) {\n transform.push('rotate(' + rotation + ' ' +\n pick(rotationOriginX, element.getAttribute('x'), 0) +\n ' ' +\n pick(rotationOriginY, element.getAttribute('y') || 0) + ')');\n // HTML labels rotation (#20685)\n if (this.text?.element.tagName === 'SPAN') {\n this.text.attr({\n rotation,\n rotationOriginX: (rotationOriginX || 0) - this.padding,\n rotationOriginY: (rotationOriginY || 0) - this.padding\n });\n }\n }\n // Apply scale\n if (defined(scaleX) || defined(scaleY)) {\n transform.push('scale(' + pick(scaleX, 1) + ' ' + pick(scaleY, 1) + ')');\n }\n if (transform.length && !(this.text || this).textPath) {\n element.setAttribute(attrib, transform.join(' '));\n }\n }\n /**\n * @private\n * @function Highcharts.SVGElement#visibilitySetter\n *\n * @param {string} value\n *\n * @param {string} key\n *\n * @param {Highcharts.SVGDOMElement} element\n *\n */\n visibilitySetter(value, key, element) {\n // IE9-11 doesn't handle visibility:inherit well, so we remove the\n // attribute instead (#2881, #3909)\n if (value === 'inherit') {\n element.removeAttribute(key);\n }\n else if (this[key] !== value) { // #6747\n element.setAttribute(key, value);\n }\n this[key] = value;\n }\n /**\n * @private\n * @function Highcharts.SVGElement#xGetter\n */\n xGetter(key) {\n if (this.element.nodeName === 'circle') {\n if (key === 'x') {\n key = 'cx';\n }\n else if (key === 'y') {\n key = 'cy';\n }\n }\n return this._defaultGetter(key);\n }\n /**\n * @private\n * @function Highcharts.SVGElement#zIndexSetter\n */\n zIndexSetter(value, key) {\n const renderer = this.renderer, parentGroup = this.parentGroup, parentWrapper = parentGroup || renderer, parentNode = parentWrapper.element || renderer.box, element = this.element, svgParent = parentNode === renderer.box;\n let childNodes, otherElement, otherZIndex, inserted = false, undefinedOtherZIndex, run = this.added, i;\n if (defined(value)) {\n // So we can read it for other elements in the group\n element.setAttribute('data-z-index', value);\n value = +value;\n if (this[key] === value) {\n // Only update when needed (#3865)\n run = false;\n }\n }\n else if (defined(this[key])) {\n element.removeAttribute('data-z-index');\n }\n this[key] = value;\n // Insert according to this and other elements' zIndex. Before .add() is\n // called, nothing is done. Then on add, or by later calls to\n // zIndexSetter, the node is placed on the right place in the DOM.\n if (run) {\n value = this.zIndex;\n if (value && parentGroup) {\n parentGroup.handleZ = true;\n }\n childNodes = parentNode.childNodes;\n for (i = childNodes.length - 1; i >= 0 && !inserted; i--) {\n otherElement = childNodes[i];\n otherZIndex = otherElement.getAttribute('data-z-index');\n undefinedOtherZIndex = !defined(otherZIndex);\n if (otherElement !== element) {\n if (\n // Negative zIndex versus no zIndex:\n // On all levels except the highest. If the parent is\n // , then we don't want to put items before \n // or \n value < 0 &&\n undefinedOtherZIndex &&\n !svgParent &&\n !i) {\n parentNode.insertBefore(element, childNodes[i]);\n inserted = true;\n }\n else if (\n // Insert after the first element with a lower zIndex\n pInt(otherZIndex) <= value ||\n // If negative zIndex, add this before first undefined\n // zIndex element\n (undefinedOtherZIndex &&\n (!defined(value) || value >= 0))) {\n parentNode.insertBefore(element, childNodes[i + 1]);\n inserted = true;\n }\n }\n }\n if (!inserted) {\n parentNode.insertBefore(element, childNodes[svgParent ? 3 : 0]);\n inserted = true;\n }\n }\n return inserted;\n }\n}\n/* *\n *\n * Properties\n *\n * */\n// Custom attributes used for symbols, these should be filtered out when\n// setting SVGElement attributes (#9375).\nSVGElement.symbolCustomAttribs = [\n 'anchorX',\n 'anchorY',\n 'clockwise',\n 'end',\n 'height',\n 'innerR',\n 'r',\n 'start',\n 'width',\n 'x',\n 'y'\n];\n// Some shared setters and getters\nSVGElement.prototype.strokeSetter = SVGElement.prototype.fillSetter;\nSVGElement.prototype.yGetter = SVGElement.prototype.xGetter;\nSVGElement.prototype.matrixSetter =\n SVGElement.prototype.rotationOriginXSetter =\n SVGElement.prototype.rotationOriginYSetter =\n SVGElement.prototype.rotationSetter =\n SVGElement.prototype.scaleXSetter =\n SVGElement.prototype.scaleYSetter =\n SVGElement.prototype.translateXSetter =\n SVGElement.prototype.translateYSetter =\n SVGElement.prototype.verticalAlignSetter = function (value, key) {\n this[key] = value;\n this.doTransform = true;\n };\n/* *\n *\n * Default Export\n *\n * */\nexport default SVGElement;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Reference to the global SVGElement class as a workaround for a name conflict\n * in the Highcharts namespace.\n *\n * @global\n * @typedef {global.SVGElement} GlobalSVGElement\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGElement\n */\n/**\n * The horizontal alignment of an element.\n *\n * @typedef {\"center\"|\"left\"|\"right\"} Highcharts.AlignValue\n */\n/**\n * Options to align the element relative to the chart or another box.\n *\n * @interface Highcharts.AlignObject\n */ /**\n* Horizontal alignment. Can be one of `left`, `center` and `right`.\n*\n* @name Highcharts.AlignObject#align\n* @type {Highcharts.AlignValue|undefined}\n*\n* @default left\n*/ /**\n* Vertical alignment. Can be one of `top`, `middle` and `bottom`.\n*\n* @name Highcharts.AlignObject#verticalAlign\n* @type {Highcharts.VerticalAlignValue|undefined}\n*\n* @default top\n*/ /**\n* Horizontal pixel offset from alignment.\n*\n* @name Highcharts.AlignObject#x\n* @type {number|undefined}\n*\n* @default 0\n*/ /**\n* Vertical pixel offset from alignment.\n*\n* @name Highcharts.AlignObject#y\n* @type {number|undefined}\n*\n* @default 0\n*/ /**\n* Use the `transform` attribute with translateX and translateY custom\n* attributes to align this elements rather than `x` and `y` attributes.\n*\n* @name Highcharts.AlignObject#alignByTranslate\n* @type {boolean|undefined}\n*\n* @default false\n*/\n/**\n * Bounding box of an element.\n *\n * @interface Highcharts.BBoxObject\n * @extends Highcharts.PositionObject\n */ /**\n* Height of the bounding box.\n*\n* @name Highcharts.BBoxObject#height\n* @type {number}\n*/ /**\n* Width of the bounding box.\n*\n* @name Highcharts.BBoxObject#width\n* @type {number}\n*/ /**\n* Horizontal position of the bounding box.\n*\n* @name Highcharts.BBoxObject#x\n* @type {number}\n*/ /**\n* Vertical position of the bounding box.\n*\n* @name Highcharts.BBoxObject#y\n* @type {number}\n*/\n/**\n * An object of key-value pairs for SVG attributes. Attributes in Highcharts\n * elements for the most parts correspond to SVG, but some are specific to\n * Highcharts, like `zIndex`, `rotation`, `rotationOriginX`,\n * `rotationOriginY`, `translateX`, `translateY`, `scaleX` and `scaleY`. SVG\n * attributes containing a hyphen are _not_ camel-cased, they should be\n * quoted to preserve the hyphen.\n *\n * @example\n * {\n * 'stroke': '#ff0000', // basic\n * 'stroke-width': 2, // hyphenated\n * 'rotation': 45 // custom\n * 'd': ['M', 10, 10, 'L', 30, 30, 'z'] // path definition, note format\n * }\n *\n * @interface Highcharts.SVGAttributes\n */ /**\n* @name Highcharts.SVGAttributes#[key:string]\n* @type {*}\n*/ /**\n* @name Highcharts.SVGAttributes#d\n* @type {string|Highcharts.SVGPathArray|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#dx\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#dy\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#fill\n* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#inverted\n* @type {boolean|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#matrix\n* @type {Array|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#rotation\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#rotationOriginX\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#rotationOriginY\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#scaleX\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#scaleY\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#stroke\n* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#style\n* @type {string|Highcharts.CSSObject|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#translateX\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#translateY\n* @type {number|undefined}\n*/ /**\n* @name Highcharts.SVGAttributes#zIndex\n* @type {number|undefined}\n*/\n/**\n * An SVG DOM element. The type is a reference to the regular SVGElement in the\n * global scope.\n *\n * @typedef {globals.GlobalSVGElement} Highcharts.SVGDOMElement\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGElement\n */\n/**\n * The vertical alignment of an element.\n *\n * @typedef {\"bottom\"|\"middle\"|\"top\"} Highcharts.VerticalAlignValue\n */\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\nimport SVGElement from './SVGElement.js';\nimport U from '../../Utilities.js';\nconst { defined, extend, isNumber, merge, pick, removeEvent } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * SVG label to render text.\n * @private\n * @class\n * @name Highcharts.SVGLabel\n * @augments Highcharts.SVGElement\n */\nclass SVGLabel extends SVGElement {\n /* *\n *\n * Constructor\n *\n * */\n constructor(renderer, str, x, y, shape, anchorX, anchorY, useHTML, baseline, className) {\n super(renderer, 'g');\n this.paddingLeftSetter = this.paddingSetter;\n this.paddingRightSetter = this.paddingSetter;\n this.textStr = str;\n this.x = x;\n this.y = y;\n this.anchorX = anchorX;\n this.anchorY = anchorY;\n this.baseline = baseline;\n this.className = className;\n this.addClass(className === 'button' ?\n 'highcharts-no-tooltip' :\n 'highcharts-label');\n if (className) {\n this.addClass('highcharts-' + className);\n }\n // Create the text element. An undefined text content prevents redundant\n // box calculation (#16121)\n this.text = renderer.text(void 0, 0, 0, useHTML).attr({ zIndex: 1 });\n // Validate the shape argument\n let hasBGImage;\n if (typeof shape === 'string') {\n hasBGImage = /^url\\((.*?)\\)$/.test(shape);\n if (hasBGImage || this.renderer.symbols[shape]) {\n this.symbolKey = shape;\n }\n }\n this.bBox = SVGLabel.emptyBBox;\n this.padding = 3;\n this.baselineOffset = 0;\n this.needsBox = renderer.styledMode || hasBGImage;\n this.deferredAttr = {};\n this.alignFactor = 0;\n }\n /* *\n *\n * Functions\n *\n * */\n alignSetter(value) {\n const alignFactor = ({\n left: 0,\n center: 0.5,\n right: 1\n })[value];\n if (alignFactor !== this.alignFactor) {\n this.alignFactor = alignFactor;\n // Bounding box exists, means we're dynamically changing\n if (this.bBox && isNumber(this.xSetting)) {\n this.attr({ x: this.xSetting }); // #5134\n }\n }\n }\n anchorXSetter(value, key) {\n this.anchorX = value;\n this.boxAttr(key, Math.round(value) - this.getCrispAdjust() - this.xSetting);\n }\n anchorYSetter(value, key) {\n this.anchorY = value;\n this.boxAttr(key, value - this.ySetting);\n }\n /*\n * Set a box attribute, or defer it if the box is not yet created\n */\n boxAttr(key, value) {\n if (this.box) {\n this.box.attr(key, value);\n }\n else {\n this.deferredAttr[key] = value;\n }\n }\n /*\n * Pick up some properties and apply them to the text instead of the\n * wrapper.\n */\n css(styles) {\n if (styles) {\n const textStyles = {};\n // Create a copy to avoid altering the original object\n // (#537)\n styles = merge(styles);\n SVGLabel.textProps.forEach((prop) => {\n if (typeof styles[prop] !== 'undefined') {\n textStyles[prop] = styles[prop];\n delete styles[prop];\n }\n });\n this.text.css(textStyles);\n // Update existing text, box (#9400, #12163, #18212)\n if ('fontSize' in textStyles || 'fontWeight' in textStyles) {\n this.updateTextPadding();\n }\n else if ('width' in textStyles || 'textOverflow' in textStyles) {\n this.updateBoxSize();\n }\n }\n return SVGElement.prototype.css.call(this, styles);\n }\n /*\n * Destroy and release memory.\n */\n destroy() {\n // Added by button implementation\n removeEvent(this.element, 'mouseenter');\n removeEvent(this.element, 'mouseleave');\n if (this.text) {\n this.text.destroy();\n }\n if (this.box) {\n this.box = this.box.destroy();\n }\n // Call base implementation to destroy the rest\n SVGElement.prototype.destroy.call(this);\n return void 0;\n }\n fillSetter(value, key) {\n if (value) {\n this.needsBox = true;\n }\n // for animation getter (#6776)\n this.fill = value;\n this.boxAttr(key, value);\n }\n /*\n * Return the bounding box of the box, not the group.\n */\n getBBox(reload, rot) {\n // If we have a text string and the DOM bBox was 0, it typically means\n // that the label was first rendered hidden, so we need to update the\n // bBox (#15246)\n if (this.textStr && this.bBox.width === 0 && this.bBox.height === 0) {\n this.updateBoxSize();\n }\n const { padding, height = 0, translateX = 0, translateY = 0, width = 0 } = this, paddingLeft = pick(this.paddingLeft, padding), rotation = rot ?? (this.rotation || 0);\n let bBox = {\n width,\n height,\n x: translateX + this.bBox.x - paddingLeft,\n y: translateY + this.bBox.y - padding + this.baselineOffset\n };\n if (rotation) {\n bBox = this.getRotatedBox(bBox, rotation);\n }\n return bBox;\n }\n getCrispAdjust() {\n return this.renderer.styledMode && this.box ?\n this.box.strokeWidth() % 2 / 2 :\n (this['stroke-width'] ? parseInt(this['stroke-width'], 10) : 0) % 2 / 2;\n }\n heightSetter(value) {\n this.heightSetting = value;\n }\n /*\n * After the text element is added, get the desired size of the border\n * box and add it before the text in the DOM.\n */\n onAdd() {\n this.text.add(this);\n this.attr({\n // Alignment is available now (#3295, 0 not rendered if given\n // as a value)\n text: pick(this.textStr, ''),\n x: this.x || 0,\n y: this.y || 0\n });\n if (this.box && defined(this.anchorX)) {\n this.attr({\n anchorX: this.anchorX,\n anchorY: this.anchorY\n });\n }\n }\n paddingSetter(value, key) {\n if (!isNumber(value)) {\n this[key] = void 0;\n }\n else if (value !== this[key]) {\n this[key] = value;\n this.updateTextPadding();\n }\n }\n rSetter(value, key) {\n this.boxAttr(key, value);\n }\n strokeSetter(value, key) {\n // For animation getter (#6776)\n this.stroke = value;\n this.boxAttr(key, value);\n }\n 'stroke-widthSetter'(value, key) {\n if (value) {\n this.needsBox = true;\n }\n this['stroke-width'] = value;\n this.boxAttr(key, value);\n }\n 'text-alignSetter'(value) {\n this.textAlign = value;\n }\n textSetter(text) {\n if (typeof text !== 'undefined') {\n // Must use .attr to ensure transforms are done (#10009)\n this.text.attr({ text });\n }\n this.updateTextPadding();\n }\n /*\n * This function runs after the label is added to the DOM (when the bounding\n * box is available), and after the text of the label is updated to detect\n * the new bounding box and reflect it in the border box.\n */\n updateBoxSize() {\n const text = this.text, attribs = {}, padding = this.padding, \n // #12165 error when width is null (auto)\n // #12163 when fontweight: bold, recalculate bBox without cache\n // #3295 && 3514 box failure when string equals 0\n bBox = this.bBox = (((!isNumber(this.widthSetting) ||\n !isNumber(this.heightSetting) ||\n this.textAlign) && defined(text.textStr)) ?\n text.getBBox(void 0, 0) :\n SVGLabel.emptyBBox);\n let crispAdjust;\n this.width = this.getPaddedWidth();\n this.height = (this.heightSetting || bBox.height || 0) + 2 * padding;\n const metrics = this.renderer.fontMetrics(text);\n // Update the label-scoped y offset. Math.min because of inline\n // style (#9400)\n this.baselineOffset = padding + Math.min(\n // When applicable, use the font size of the first line (#15707)\n (this.text.firstLineMetrics || metrics).b, \n // When the height is 0, there is no bBox, so go with the font\n // metrics. Highmaps CSS demos.\n bBox.height || Infinity);\n // #15491: Vertical centering\n if (this.heightSetting) {\n this.baselineOffset += (this.heightSetting - metrics.h) / 2;\n }\n if (this.needsBox && !text.textPath) {\n // Create the border box if it is not already present\n if (!this.box) {\n // Symbol definition exists (#5324)\n const box = this.box = this.symbolKey ?\n this.renderer.symbol(this.symbolKey) :\n this.renderer.rect();\n box.addClass(// Don't use label className for buttons\n (this.className === 'button' ?\n '' : 'highcharts-label-box') +\n (this.className ?\n ' highcharts-' + this.className + '-box' : ''));\n box.add(this);\n }\n crispAdjust = this.getCrispAdjust();\n attribs.x = crispAdjust;\n attribs.y = ((this.baseline ? -this.baselineOffset : 0) + crispAdjust);\n // Apply the box attributes\n attribs.width = Math.round(this.width);\n attribs.height = Math.round(this.height);\n this.box.attr(extend(attribs, this.deferredAttr));\n this.deferredAttr = {};\n }\n }\n /*\n * This function runs after setting text or padding, but only if padding\n * is changed.\n */\n updateTextPadding() {\n const text = this.text;\n if (!text.textPath) {\n this.updateBoxSize();\n // Determine y based on the baseline\n const textY = this.baseline ? 0 : this.baselineOffset;\n let textX = pick(this.paddingLeft, this.padding);\n // compensate for alignment\n if (defined(this.widthSetting) &&\n this.bBox &&\n (this.textAlign === 'center' || this.textAlign === 'right')) {\n textX += { center: 0.5, right: 1 }[this.textAlign] * (this.widthSetting - this.bBox.width);\n }\n // update if anything changed\n if (textX !== text.x || textY !== text.y) {\n text.attr('x', textX);\n // #8159 - prevent misplaced data labels in treemap\n // (useHTML: true)\n if (text.hasBoxWidthChanged) {\n this.bBox = text.getBBox(true);\n }\n if (typeof textY !== 'undefined') {\n text.attr('y', textY);\n }\n }\n // record current values\n text.x = textX;\n text.y = textY;\n }\n }\n widthSetter(value) {\n // width:auto => null\n this.widthSetting = isNumber(value) ? value : void 0;\n }\n getPaddedWidth() {\n const padding = this.padding;\n const paddingLeft = pick(this.paddingLeft, padding);\n const paddingRight = pick(this.paddingRight, padding);\n return ((this.widthSetting || this.bBox.width || 0) +\n paddingLeft +\n paddingRight);\n }\n xSetter(value) {\n this.x = value; // for animation getter\n if (this.alignFactor) {\n value -= this.alignFactor * this.getPaddedWidth();\n // Force animation even when setting to the same value (#7898)\n this['forceAnimate:x'] = true;\n }\n this.xSetting = Math.round(value);\n this.attr('translateX', this.xSetting);\n }\n ySetter(value) {\n this.ySetting = this.y = Math.round(value);\n this.attr('translateY', this.ySetting);\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nSVGLabel.emptyBBox = {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n};\n/**\n * For labels, these CSS properties are applied to the `text` node directly.\n *\n * @private\n * @name Highcharts.SVGLabel#textProps\n * @type {Array}\n */\nSVGLabel.textProps = [\n 'color', 'direction', 'fontFamily', 'fontSize', 'fontStyle',\n 'fontWeight', 'lineHeight', 'textAlign', 'textDecoration',\n 'textOutline', 'textOverflow', 'whiteSpace', 'width'\n];\n/* *\n *\n * Default Export\n *\n * */\nexport default SVGLabel;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../../Utilities.js';\nconst { defined, isNumber, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/* eslint-disable require-jsdoc, valid-jsdoc */\nfunction arc(cx, cy, w, h, options) {\n const arc = [];\n if (options) {\n const start = options.start || 0, rx = pick(options.r, w), ry = pick(options.r, h || w), proximity = 0.001, fullCircle = (Math.abs((options.end || 0) - start - 2 * Math.PI) <\n proximity), \n // Subtract a small number to prevent cos and sin of start\n // and end from becoming equal on 360 arcs (related: #1561)\n end = (options.end || 0) - proximity, innerRadius = options.innerR, open = pick(options.open, fullCircle), cosStart = Math.cos(start), sinStart = Math.sin(start), cosEnd = Math.cos(end), sinEnd = Math.sin(end), \n // Proximity takes care of rounding errors around PI (#6971)\n longArc = pick(options.longArc, end - start - Math.PI < proximity ? 0 : 1);\n let arcSegment = [\n 'A',\n rx,\n ry,\n 0,\n longArc,\n pick(options.clockwise, 1),\n cx + rx * cosEnd,\n cy + ry * sinEnd\n ];\n arcSegment.params = { start, end, cx, cy }; // Memo for border radius\n arc.push([\n 'M',\n cx + rx * cosStart,\n cy + ry * sinStart\n ], arcSegment);\n if (defined(innerRadius)) {\n arcSegment = [\n 'A',\n innerRadius,\n innerRadius,\n 0,\n longArc,\n // Clockwise - opposite to the outer arc clockwise\n defined(options.clockwise) ? 1 - options.clockwise : 0,\n cx + innerRadius * cosStart,\n cy + innerRadius * sinStart\n ];\n // Memo for border radius\n arcSegment.params = {\n start: end,\n end: start,\n cx,\n cy\n };\n arc.push(open ?\n [\n 'M',\n cx + innerRadius * cosEnd,\n cy + innerRadius * sinEnd\n ] : [\n 'L',\n cx + innerRadius * cosEnd,\n cy + innerRadius * sinEnd\n ], arcSegment);\n }\n if (!open) {\n arc.push(['Z']);\n }\n }\n return arc;\n}\n/**\n * Callout shape used for default tooltips.\n */\nfunction callout(x, y, w, h, options) {\n const arrowLength = 6, halfDistance = 6, r = Math.min((options && options.r) || 0, w, h), safeDistance = r + halfDistance, anchorX = options && options.anchorX, anchorY = options && options.anchorY || 0;\n const path = roundedRect(x, y, w, h, { r });\n if (!isNumber(anchorX)) {\n return path;\n }\n // Do not render a connector, if anchor starts inside the label\n if (anchorX < w && anchorX > 0 && anchorY < h && anchorY > 0) {\n return path;\n }\n // Anchor on right side\n if (x + anchorX > w - safeDistance) {\n // Chevron\n if (anchorY > y + safeDistance &&\n anchorY < y + h - safeDistance) {\n path.splice(3, 1, ['L', x + w, anchorY - halfDistance], ['L', x + w + arrowLength, anchorY], ['L', x + w, anchorY + halfDistance], ['L', x + w, y + h - r]);\n // Simple connector\n }\n else {\n if (anchorX < w) { // Corner connector\n const isTopCorner = anchorY < y + safeDistance, cornerY = isTopCorner ? y : y + h, sliceStart = isTopCorner ? 2 : 5;\n path.splice(sliceStart, 0, ['L', anchorX, anchorY], ['L', x + w - r, cornerY]);\n }\n else { // Side connector\n path.splice(3, 1, ['L', x + w, h / 2], ['L', anchorX, anchorY], ['L', x + w, h / 2], ['L', x + w, y + h - r]);\n }\n }\n // Anchor on left side\n }\n else if (x + anchorX < safeDistance) {\n // Chevron\n if (anchorY > y + safeDistance &&\n anchorY < y + h - safeDistance) {\n path.splice(7, 1, ['L', x, anchorY + halfDistance], ['L', x - arrowLength, anchorY], ['L', x, anchorY - halfDistance], ['L', x, y + r]);\n // Simple connector\n }\n else {\n if (anchorX > 0) { // Corner connector\n const isTopCorner = anchorY < y + safeDistance, cornerY = isTopCorner ? y : y + h, sliceStart = isTopCorner ? 1 : 6;\n path.splice(sliceStart, 0, ['L', anchorX, anchorY], ['L', x + r, cornerY]);\n }\n else { // Side connector\n path.splice(7, 1, ['L', x, h / 2], ['L', anchorX, anchorY], ['L', x, h / 2], ['L', x, y + r]);\n }\n }\n }\n else if ( // replace bottom\n anchorY > h &&\n anchorX < w - safeDistance) {\n path.splice(5, 1, ['L', anchorX + halfDistance, y + h], ['L', anchorX, y + h + arrowLength], ['L', anchorX - halfDistance, y + h], ['L', x + r, y + h]);\n }\n else if ( // replace top\n anchorY < 0 &&\n anchorX > safeDistance) {\n path.splice(1, 1, ['L', anchorX - halfDistance, y], ['L', anchorX, y - arrowLength], ['L', anchorX + halfDistance, y], ['L', w - r, y]);\n }\n return path;\n}\nfunction circle(x, y, w, h) {\n // Return a full arc\n return arc(x + w / 2, y + h / 2, w / 2, h / 2, {\n start: Math.PI * 0.5,\n end: Math.PI * 2.5,\n open: false\n });\n}\nfunction diamond(x, y, w, h) {\n return [\n ['M', x + w / 2, y],\n ['L', x + w, y + h / 2],\n ['L', x + w / 2, y + h],\n ['L', x, y + h / 2],\n ['Z']\n ];\n}\n// #15291\nfunction rect(x, y, w, h, options) {\n if (options && options.r) {\n return roundedRect(x, y, w, h, options);\n }\n return [\n ['M', x, y],\n ['L', x + w, y],\n ['L', x + w, y + h],\n ['L', x, y + h],\n ['Z']\n ];\n}\nfunction roundedRect(x, y, w, h, options) {\n const r = options?.r || 0;\n return [\n ['M', x + r, y],\n ['L', x + w - r, y],\n ['A', r, r, 0, 0, 1, x + w, y + r],\n ['L', x + w, y + h - r],\n ['A', r, r, 0, 0, 1, x + w - r, y + h],\n ['L', x + r, y + h],\n ['A', r, r, 0, 0, 1, x, y + h - r],\n ['L', x, y + r],\n ['A', r, r, 0, 0, 1, x + r, y],\n ['Z'] // top-left corner\n ];\n}\nfunction triangle(x, y, w, h) {\n return [\n ['M', x + w / 2, y],\n ['L', x + w, y + h],\n ['L', x, y + h],\n ['Z']\n ];\n}\nfunction triangleDown(x, y, w, h) {\n return [\n ['M', x, y],\n ['L', x + w, y],\n ['L', x + w / 2, y + h],\n ['Z']\n ];\n}\nconst Symbols = {\n arc,\n callout,\n circle,\n diamond,\n rect,\n roundedRect,\n square: rect,\n triangle,\n 'triangle-down': triangleDown\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default Symbols;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AST from '../HTML/AST.js';\nimport H from '../../Globals.js';\nconst { doc, SVG_NS, win } = H;\nimport U from '../../Utilities.js';\nconst { attr, extend, fireEvent, isString, objectEach, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * SVG Text Builder\n * @private\n * @class\n * @name Highcharts.TextBuilder\n */\nclass TextBuilder {\n constructor(svgElement) {\n const textStyles = svgElement.styles;\n this.renderer = svgElement.renderer;\n this.svgElement = svgElement;\n this.width = svgElement.textWidth;\n this.textLineHeight = textStyles && textStyles.lineHeight;\n this.textOutline = textStyles && textStyles.textOutline;\n this.ellipsis = Boolean(textStyles && textStyles.textOverflow === 'ellipsis');\n this.noWrap = Boolean(textStyles && textStyles.whiteSpace === 'nowrap');\n }\n /**\n * Build an SVG representation of the pseudo HTML given in the object's\n * svgElement.\n *\n * @private\n *\n * @return {void}.\n */\n buildSVG() {\n const wrapper = this.svgElement, textNode = wrapper.element, renderer = wrapper.renderer, textStr = pick(wrapper.textStr, '').toString(), hasMarkup = textStr.indexOf('<') !== -1, childNodes = textNode.childNodes, tempParent = !wrapper.added && renderer.box, regexMatchBreaks = //g, \n // The buildText code is quite heavy, so if we're not changing\n // something that affects the text, skip it (#6113).\n textCache = [\n textStr,\n this.ellipsis,\n this.noWrap,\n this.textLineHeight,\n this.textOutline,\n wrapper.getStyle('font-size'),\n this.width\n ].join(',');\n if (textCache === wrapper.textCache) {\n return;\n }\n wrapper.textCache = textCache;\n delete wrapper.actualWidth;\n // Remove old text\n for (let i = childNodes.length; i--;) {\n textNode.removeChild(childNodes[i]);\n }\n // Simple strings, add text directly and return\n if (!hasMarkup &&\n !this.ellipsis &&\n !this.width &&\n !wrapper.textPath &&\n (textStr.indexOf(' ') === -1 ||\n (this.noWrap && !regexMatchBreaks.test(textStr)))) {\n textNode.appendChild(doc.createTextNode(this.unescapeEntities(textStr)));\n // Complex strings, add more logic\n }\n else if (textStr !== '') {\n if (tempParent) {\n // attach it to the DOM to read offset width and font size\n tempParent.appendChild(textNode);\n }\n // Step 1. Parse the markup safely and directly into a tree\n // structure.\n const ast = new AST(textStr);\n // Step 2. Do as many as we can of the modifications to the tree\n // structure before it is added to the DOM\n this.modifyTree(ast.nodes);\n ast.addToDOM(textNode);\n // Step 3. Some modifications can't be done until the structure is\n // in the DOM, because we need to read computed metrics.\n this.modifyDOM();\n // Add title if an ellipsis was added\n if (this.ellipsis &&\n (textNode.textContent || '').indexOf('\\u2026') !== -1) {\n wrapper.attr('title', this.unescapeEntities(wrapper.textStr || '', ['<', '>']) // #7179\n );\n }\n if (tempParent) {\n tempParent.removeChild(textNode);\n }\n }\n // Apply the text outline\n if (isString(this.textOutline) && wrapper.applyTextOutline) {\n wrapper.applyTextOutline(this.textOutline);\n }\n }\n /**\n * Modify the DOM of the generated SVG structure. This function only does\n * operations that cannot be done until the elements are attached to the\n * DOM, like doing layout based on rendered metrics of the added elements.\n *\n * @private\n *\n */\n modifyDOM() {\n const wrapper = this.svgElement;\n const x = attr(wrapper.element, 'x');\n wrapper.firstLineMetrics = void 0;\n // Remove empty tspans (including breaks) from the beginning because\n // SVG's getBBox doesn't count empty lines. The use case is tooltip\n // where the header is empty. By doing this in the DOM rather than in\n // the AST, we can inspect the textContent directly and don't have to\n // recurse down to look for valid content.\n let firstChild;\n while ((firstChild = wrapper.element.firstChild)) {\n if (/^[\\s\\u200B]*$/.test(firstChild.textContent || ' ')) {\n wrapper.element.removeChild(firstChild);\n }\n else {\n break;\n }\n }\n // Modify hard line breaks by applying the rendered line height\n [].forEach.call(wrapper.element.querySelectorAll('tspan.highcharts-br'), (br, i) => {\n if (br.nextSibling && br.previousSibling) { // #5261\n if (i === 0 && br.previousSibling.nodeType === 1) {\n wrapper.firstLineMetrics = wrapper.renderer\n .fontMetrics(br.previousSibling);\n }\n attr(br, {\n // Since the break is inserted in front of the next\n // line, we need to use the next sibling for the line\n // height\n dy: this.getLineHeight(br.nextSibling),\n x\n });\n }\n });\n // Constrain the line width, either by ellipsis or wrapping\n const width = this.width || 0;\n if (!width) {\n return;\n }\n // Insert soft line breaks into each text node\n const modifyTextNode = (textNode, parentElement) => {\n const text = textNode.textContent || '';\n const words = text\n .replace(/([^\\^])-/g, '$1- ') // Split on hyphens\n // .trim()\n .split(' '); // #1273\n const hasWhiteSpace = !this.noWrap && (words.length > 1 || wrapper.element.childNodes.length > 1);\n const dy = this.getLineHeight(parentElement);\n let lineNo = 0;\n let startAt = wrapper.actualWidth;\n if (this.ellipsis) {\n if (text) {\n this.truncate(textNode, text, void 0, 0, \n // Target width\n Math.max(0, \n // Subtract the font face to make room for the\n // ellipsis itself\n width - 0.8 * dy), \n // Build the text to test for\n (text, currentIndex) => text.substring(0, currentIndex) + '\\u2026');\n }\n }\n else if (hasWhiteSpace) {\n const lines = [];\n // Remove preceding siblings in order to make the text length\n // calculation correct in the truncate function\n const precedingSiblings = [];\n while (parentElement.firstChild &&\n parentElement.firstChild !== textNode) {\n precedingSiblings.push(parentElement.firstChild);\n parentElement.removeChild(parentElement.firstChild);\n }\n while (words.length) {\n // Apply the previous line\n if (words.length && !this.noWrap && lineNo > 0) {\n lines.push(textNode.textContent || '');\n textNode.textContent = words.join(' ')\n .replace(/- /g, '-');\n }\n // For each line, truncate the remaining\n // words into the line length.\n this.truncate(textNode, void 0, words, lineNo === 0 ? (startAt || 0) : 0, width, \n // Build the text to test for\n (t, currentIndex) => words\n .slice(0, currentIndex)\n .join(' ')\n .replace(/- /g, '-'));\n startAt = wrapper.actualWidth;\n lineNo++;\n }\n // Reinsert the preceding child nodes\n precedingSiblings.forEach((childNode) => {\n parentElement.insertBefore(childNode, textNode);\n });\n // Insert the previous lines before the original text node\n lines.forEach((line) => {\n // Insert the line\n parentElement.insertBefore(doc.createTextNode(line), textNode);\n // Insert a break\n const br = doc.createElementNS(SVG_NS, 'tspan');\n br.textContent = '\\u200B'; // zero-width space\n attr(br, { dy, x });\n parentElement.insertBefore(br, textNode);\n });\n }\n };\n // Recurse down the DOM tree and handle line breaks for each text node\n const modifyChildren = ((node) => {\n const childNodes = [].slice.call(node.childNodes);\n childNodes.forEach((childNode) => {\n if (childNode.nodeType === win.Node.TEXT_NODE) {\n modifyTextNode(childNode, node);\n }\n else {\n // Reset word-wrap width readings after hard breaks\n if (childNode.className.baseVal\n .indexOf('highcharts-br') !== -1) {\n wrapper.actualWidth = 0;\n }\n // Recurse down to child node\n modifyChildren(childNode);\n }\n });\n });\n modifyChildren(wrapper.element);\n }\n /**\n * Get the rendered line height of a , or pure text node.\n *\n * @param {DOMElementType|Text} node The node to check for\n *\n * @return {number} The rendered line height\n */\n getLineHeight(node) {\n // If the node is a text node, use its parent\n const element = (node.nodeType === win.Node.TEXT_NODE) ?\n node.parentElement :\n node;\n return this.textLineHeight ?\n parseInt(this.textLineHeight.toString(), 10) :\n this.renderer.fontMetrics(element || this.svgElement.element).h;\n }\n /**\n * Transform a pseudo HTML AST node tree into an SVG structure. We do as\n * much heavy lifting as we can here, before doing the final processing in\n * the modifyDOM function. The original data is mutated.\n *\n * @private\n *\n * @param {ASTNode[]} nodes The AST nodes\n *\n */\n modifyTree(nodes) {\n const modifyChild = (node, i) => {\n const { attributes = {}, children, style = {}, tagName } = node, styledMode = this.renderer.styledMode;\n // Apply styling to text tags\n if (tagName === 'b' || tagName === 'strong') {\n if (styledMode) {\n // eslint-disable-next-line dot-notation\n attributes['class'] = 'highcharts-strong';\n }\n else {\n style.fontWeight = 'bold';\n }\n }\n else if (tagName === 'i' || tagName === 'em') {\n if (styledMode) {\n // eslint-disable-next-line dot-notation\n attributes['class'] = 'highcharts-emphasized';\n }\n else {\n style.fontStyle = 'italic';\n }\n }\n // Modify styling\n if (style && style.color) {\n style.fill = style.color;\n }\n // Handle breaks\n if (tagName === 'br') {\n attributes['class'] = 'highcharts-br'; // eslint-disable-line dot-notation\n node.textContent = '\\u200B'; // zero-width space\n // Trim whitespace off the beginning of new lines\n const nextNode = nodes[i + 1];\n if (nextNode && nextNode.textContent) {\n nextNode.textContent =\n nextNode.textContent.replace(/^ +/gm, '');\n }\n // If an anchor has direct text node children, the text is unable to\n // wrap because there is no `getSubStringLength` function on the\n // element. Therefore we need to wrap the child text node or nodes\n // in a tspan. #16173.\n }\n else if (tagName === 'a' &&\n children &&\n children.some((child) => child.tagName === '#text')) {\n node.children = [{ children, tagName: 'tspan' }];\n }\n if (tagName !== '#text' && tagName !== 'a') {\n node.tagName = 'tspan';\n }\n extend(node, { attributes, style });\n // Recurse\n if (children) {\n children\n .filter((c) => c.tagName !== '#text')\n .forEach(modifyChild);\n }\n };\n nodes.forEach(modifyChild);\n fireEvent(this.svgElement, 'afterModifyTree', { nodes });\n }\n /*\n * Truncate the text node contents to a given length. Used when the css\n * width is set. If the `textOverflow` is `ellipsis`, the text is truncated\n * character by character to the given length. If not, the text is\n * word-wrapped line by line.\n */\n truncate(textNode, text, words, startAt, width, getString) {\n const svgElement = this.svgElement;\n const { rotation } = svgElement;\n // Cache the lengths to avoid checking the same twice\n const lengths = [];\n // Word wrap cannot be truncated to shorter than one word, ellipsis\n // text can be completely blank.\n let minIndex = words ? 1 : 0;\n let maxIndex = (text || words || '').length;\n let currentIndex = maxIndex;\n let str;\n let actualWidth;\n const getSubStringLength = function (charEnd, concatenatedEnd) {\n // charEnd is used when finding the character-by-character\n // break for ellipsis, concatenatedEnd is used for word-by-word\n // break for word wrapping.\n const end = concatenatedEnd || charEnd;\n const parentNode = textNode.parentNode;\n if (parentNode && typeof lengths[end] === 'undefined') {\n // Modern browsers\n if (parentNode.getSubStringLength) {\n // Fails with DOM exception on unit-tests/legend/members\n // of unknown reason. Desired width is 0, text content\n // is \"5\" and end is 1.\n try {\n lengths[end] = startAt +\n parentNode.getSubStringLength(0, words ? end + 1 : end);\n }\n catch (e) {\n '';\n }\n }\n }\n return lengths[end];\n };\n svgElement.rotation = 0; // discard rotation when computing box\n actualWidth = getSubStringLength(textNode.textContent.length);\n if (startAt + actualWidth > width) {\n // Do a binary search for the index where to truncate the text\n while (minIndex <= maxIndex) {\n currentIndex = Math.ceil((minIndex + maxIndex) / 2);\n // When checking words for word-wrap, we need to build the\n // string and measure the subStringLength at the concatenated\n // word length.\n if (words) {\n str = getString(words, currentIndex);\n }\n actualWidth = getSubStringLength(currentIndex, str && str.length - 1);\n if (minIndex === maxIndex) {\n // Complete\n minIndex = maxIndex + 1;\n }\n else if (actualWidth > width) {\n // Too large. Set max index to current.\n maxIndex = currentIndex - 1;\n }\n else {\n // Within width. Set min index to current.\n minIndex = currentIndex;\n }\n }\n // If max index was 0 it means the shortest possible text was also\n // too large. For ellipsis that means only the ellipsis, while for\n // word wrap it means the whole first word.\n if (maxIndex === 0) {\n // Remove ellipsis\n textNode.textContent = '';\n // If the new text length is one less than the original, we don't\n // need the ellipsis\n }\n else if (!(text && maxIndex === text.length - 1)) {\n textNode.textContent = str || getString(text || words, currentIndex);\n }\n }\n // When doing line wrapping, prepare for the next line by removing the\n // items from this line.\n if (words) {\n words.splice(0, currentIndex);\n }\n svgElement.actualWidth = actualWidth;\n svgElement.rotation = rotation; // Apply rotation again.\n }\n /*\n * Un-escape HTML entities based on the public `renderer.escapes` list\n *\n * @private\n *\n * @param {string} inputStr The string to unescape\n * @param {Array} [except] Exceptions\n *\n * @return {string} The processed string\n */\n unescapeEntities(inputStr, except) {\n objectEach(this.renderer.escapes, function (value, key) {\n if (!except || except.indexOf(value) === -1) {\n inputStr = inputStr.toString().replace(new RegExp(value, 'g'), key);\n }\n });\n return inputStr;\n }\n}\nexport default TextBuilder;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AST from '../HTML/AST.js';\nimport Color from '../../Color/Color.js';\nimport H from '../../Globals.js';\nconst { charts, deg2rad, doc, isFirefox, isMS, isWebKit, noop, SVG_NS, symbolSizes, win } = H;\nimport RendererRegistry from '../RendererRegistry.js';\nimport SVGElement from './SVGElement.js';\nimport SVGLabel from './SVGLabel.js';\nimport Symbols from './Symbols.js';\nimport TextBuilder from './TextBuilder.js';\nimport U from '../../Utilities.js';\nconst { addEvent, attr, createElement, css, defined, destroyObjectProperties, extend, isArray, isNumber, isObject, isString, merge, pick, pInt, replaceNested, uniqueKey } = U;\n/* *\n *\n * Variables\n *\n * */\nlet hasInternalReferenceBug;\n/* *\n *\n * Class\n *\n * */\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/**\n * Allows direct access to the Highcharts rendering layer in order to draw\n * primitive shapes like circles, rectangles, paths or text directly on a chart,\n * or independent from any chart. The SVGRenderer represents a wrapper object\n * for SVG in modern browsers.\n *\n * An existing chart's renderer can be accessed through {@link Chart.renderer}.\n * The renderer can also be used completely decoupled from a chart.\n *\n * See [How to use the SVG Renderer](\n * https://www.highcharts.com/docs/advanced-chart-features/renderer) for a\n * comprehensive tutorial.\n *\n * @sample highcharts/members/renderer-on-chart\n * Annotating a chart programmatically.\n * @sample highcharts/members/renderer-basic\n * Independent SVG drawing.\n *\n * @example\n * // Use directly without a chart object.\n * let renderer = new Highcharts.Renderer(parentNode, 600, 400);\n *\n * @class\n * @name Highcharts.SVGRenderer\n *\n * @param {Highcharts.HTMLDOMElement} container\n * Where to put the SVG in the web page.\n *\n * @param {number} width\n * The width of the SVG.\n *\n * @param {number} height\n * The height of the SVG.\n *\n * @param {Highcharts.CSSObject} [style]\n * The box style, if not in styleMode\n *\n * @param {boolean} [forExport=false]\n * Whether the rendered content is intended for export.\n *\n * @param {boolean} [allowHTML=true]\n * Whether the renderer is allowed to include HTML text, which will be\n * projected on top of the SVG.\n *\n * @param {boolean} [styledMode=false]\n * Whether the renderer belongs to a chart that is in styled mode.\n * If it does, it will avoid setting presentational attributes in\n * some cases, but not when set explicitly through `.attr` and `.css`\n * etc.\n */\nclass SVGRenderer {\n /**\n * The root `svg` node of the renderer.\n *\n * @name Highcharts.SVGRenderer#box\n * @type {Highcharts.SVGDOMElement}\n */\n /**\n * The wrapper for the root `svg` node of the renderer.\n *\n * @name Highcharts.SVGRenderer#boxWrapper\n * @type {Highcharts.SVGElement}\n */\n /**\n * A pointer to the `defs` node of the root SVG.\n *\n * @name Highcharts.SVGRenderer#defs\n * @type {Highcharts.SVGElement}\n */\n /**\n * Whether the rendered content is intended for export.\n *\n * @name Highcharts.SVGRenderer#forExport\n * @type {boolean | undefined}\n */\n /**\n * Page url used for internal references.\n *\n * @private\n * @name Highcharts.SVGRenderer#url\n * @type {string}\n */\n /**\n * Initialize the SVGRenderer. Overridable initializer function that takes\n * the same parameters as the constructor.\n *\n * @function Highcharts.SVGRenderer#init\n *\n * @param {Highcharts.HTMLDOMElement} container\n * Where to put the SVG in the web page.\n *\n * @param {number} width\n * The width of the SVG.\n *\n * @param {number} height\n * The height of the SVG.\n *\n * @param {Highcharts.CSSObject} [style]\n * The box style, if not in styleMode\n *\n * @param {boolean} [forExport=false]\n * Whether the rendered content is intended for export.\n *\n * @param {boolean} [allowHTML=true]\n * Whether the renderer is allowed to include HTML text, which will be\n * projected on top of the SVG.\n *\n * @param {boolean} [styledMode=false]\n * Whether the renderer belongs to a chart that is in styled mode. If it\n * does, it will avoid setting presentational attributes in some cases, but\n * not when set explicitly through `.attr` and `.css` etc.\n */\n constructor(container, width, height, style, forExport, allowHTML, styledMode) {\n const renderer = this, boxWrapper = renderer\n .createElement('svg')\n .attr({\n version: '1.1',\n 'class': 'highcharts-root'\n }), element = boxWrapper.element;\n if (!styledMode) {\n boxWrapper.css(this.getStyle(style || {}));\n }\n container.appendChild(element);\n // Always use ltr on the container, otherwise text-anchor will be\n // flipped and text appear outside labels, buttons, tooltip etc (#3482)\n attr(container, 'dir', 'ltr');\n // For browsers other than IE, add the namespace attribute (#1978)\n if (container.innerHTML.indexOf('xmlns') === -1) {\n attr(element, 'xmlns', this.SVG_NS);\n }\n this.box = element;\n this.boxWrapper = boxWrapper;\n this.alignedObjects = [];\n this.url = this.getReferenceURL();\n // Add description\n const desc = this.createElement('desc').add();\n desc.element.appendChild(doc.createTextNode('Created with @product.name@ @product.version@'));\n this.defs = this.createElement('defs').add();\n this.allowHTML = allowHTML;\n this.forExport = forExport;\n this.styledMode = styledMode;\n this.gradients = {}; // Object where gradient SvgElements are stored\n this.cache = {}; // Cache for numerical bounding boxes\n this.cacheKeys = [];\n this.imgCount = 0;\n this.rootFontSize = boxWrapper.getStyle('font-size');\n renderer.setSize(width, height, false);\n // Issue 110 workaround:\n // In Firefox, if a div is positioned by percentage, its pixel position\n // may land between pixels. The container itself doesn't display this,\n // but an SVG element inside this container will be drawn at subpixel\n // precision. In order to draw sharp lines, this must be compensated\n // for. This doesn't seem to work inside iframes though (like in\n // jsFiddle).\n let subPixelFix, rect;\n if (isFirefox && container.getBoundingClientRect) {\n subPixelFix = function () {\n css(container, { left: 0, top: 0 });\n rect = container.getBoundingClientRect();\n css(container, {\n left: (Math.ceil(rect.left) - rect.left) + 'px',\n top: (Math.ceil(rect.top) - rect.top) + 'px'\n });\n };\n // run the fix now\n subPixelFix();\n // run it on resize\n renderer.unSubPixelFix = addEvent(win, 'resize', subPixelFix);\n }\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * General method for adding a definition to the SVG `defs` tag. Can be used\n * for gradients, fills, filters etc. Styled mode only. A hook for adding\n * general definitions to the SVG's defs tag. Definitions can be referenced\n * from the CSS by its `id`. Read more in\n * [gradients, shadows and patterns](https://www.highcharts.com/docs/chart-design-and-style/gradients-shadows-and-patterns).\n * Styled mode only.\n *\n * @function Highcharts.SVGRenderer#definition\n *\n * @param {Highcharts.ASTNode} def\n * A serialized form of an SVG definition, including children.\n *\n * @return {Highcharts.SVGElement}\n * The inserted node.\n */\n definition(def) {\n const ast = new AST([def]);\n return ast.addToDOM(this.defs.element);\n }\n /**\n * Get the prefix needed for internal URL references to work in certain\n * cases. Some older browser versions had a bug where internal url\n * references in SVG attributes, on the form `url(#some-id)`, would fail if\n * a base tag was present in the page. There were also issues with\n * `history.pushState` related to this prefix.\n *\n * Related issues: #24, #672, #1070, #5244.\n *\n * The affected browsers are:\n * - Chrome <= 53 (May 2018)\n * - Firefox <= 51 (January 2017)\n * - Safari/Mac <= 12.1 (2018 or 2019)\n * - Safari/iOS <= 13\n *\n * @todo Remove this hack when time has passed. All the affected browsers\n * are evergreens, so it is increasingly unlikely that users are affected by\n * the bug.\n *\n * @return {string}\n * The prefix to use. An empty string for modern browsers.\n */\n getReferenceURL() {\n if ((isFirefox || isWebKit) &&\n doc.getElementsByTagName('base').length) {\n // Detect if a clip path is taking effect by performing a hit test\n // outside the clipped area. If the hit element is the rectangle\n // that was supposed to be clipped, the bug is present. This only\n // has to be performed once per page load, so we store the result\n // locally in the module.\n if (!defined(hasInternalReferenceBug)) {\n const id = uniqueKey();\n const ast = new AST([{\n tagName: 'svg',\n attributes: {\n width: 8,\n height: 8\n },\n children: [{\n tagName: 'defs',\n children: [{\n tagName: 'clipPath',\n attributes: {\n id\n },\n children: [{\n tagName: 'rect',\n attributes: {\n width: 4,\n height: 4\n }\n }]\n }]\n }, {\n tagName: 'rect',\n attributes: {\n id: 'hitme',\n width: 8,\n height: 8,\n 'clip-path': `url(#${id})`,\n fill: 'rgba(0,0,0,0.001)'\n }\n }]\n }]);\n const svg = ast.addToDOM(doc.body);\n css(svg, {\n position: 'fixed',\n top: 0,\n left: 0,\n zIndex: 9e5\n });\n const hitElement = doc.elementFromPoint(6, 6);\n hasInternalReferenceBug = (hitElement && hitElement.id) === 'hitme';\n doc.body.removeChild(svg);\n }\n if (hasInternalReferenceBug) {\n // Scan alert #[72]: Loop for nested patterns\n return replaceNested(win.location.href.split('#')[0], // remove hash\n [/<[^>]*>/g, ''], // wing cut HTML\n [/([\\('\\)])/g, '\\\\$1'], // escape parantheses and quotes\n [/ /g, '%20'] // replace spaces (needed for Safari only)\n );\n }\n }\n return '';\n }\n /**\n * Get the global style setting for the renderer.\n *\n * @private\n * @function Highcharts.SVGRenderer#getStyle\n *\n * @param {Highcharts.CSSObject} style\n * Style settings.\n *\n * @return {Highcharts.CSSObject}\n * The style settings mixed with defaults.\n */\n getStyle(style) {\n this.style = extend({\n fontFamily: 'Helvetica, Arial, sans-serif',\n fontSize: '1rem'\n }, style);\n return this.style;\n }\n /**\n * Apply the global style on the renderer, mixed with the default styles.\n *\n * @function Highcharts.SVGRenderer#setStyle\n *\n * @param {Highcharts.CSSObject} style\n * CSS to apply.\n */\n setStyle(style) {\n this.boxWrapper.css(this.getStyle(style));\n }\n /**\n * Detect whether the renderer is hidden. This happens when one of the\n * parent elements has `display: none`. Used internally to detect when we\n * need to render preliminarily in another div to get the text bounding\n * boxes right.\n *\n * @function Highcharts.SVGRenderer#isHidden\n *\n * @return {boolean}\n * True if it is hidden.\n */\n isHidden() {\n return !this.boxWrapper.getBBox().width;\n }\n /**\n * Destroys the renderer and its allocated members.\n *\n * @function Highcharts.SVGRenderer#destroy\n *\n * @return {null}\n * Pass through value.\n */\n destroy() {\n const renderer = this, rendererDefs = renderer.defs;\n renderer.box = null;\n renderer.boxWrapper = renderer.boxWrapper.destroy();\n // Call destroy on all gradient elements\n destroyObjectProperties(renderer.gradients || {});\n renderer.gradients = null;\n renderer.defs = rendererDefs.destroy();\n // Remove sub pixel fix handler (#982)\n if (renderer.unSubPixelFix) {\n renderer.unSubPixelFix();\n }\n renderer.alignedObjects = null;\n return null;\n }\n /**\n * Create a wrapper for an SVG element. Serves as a factory for\n * {@link SVGElement}, but this function is itself mostly called from\n * primitive factories like {@link SVGRenderer#path}, {@link\n * SVGRenderer#rect} or {@link SVGRenderer#text}.\n *\n * @function Highcharts.SVGRenderer#createElement\n *\n * @param {string} nodeName\n * The node name, for example `rect`, `g` etc.\n *\n * @return {Highcharts.SVGElement}\n * The generated SVGElement.\n */\n createElement(nodeName) {\n return new this.Element(this, nodeName);\n }\n /**\n * Get converted radial gradient attributes according to the radial\n * reference. Used internally from the {@link SVGElement#colorGradient}\n * function.\n *\n * @private\n * @function Highcharts.SVGRenderer#getRadialAttr\n */\n getRadialAttr(radialReference, gradAttr) {\n return {\n cx: (radialReference[0] - radialReference[2] / 2) +\n (gradAttr.cx || 0) * radialReference[2],\n cy: (radialReference[1] - radialReference[2] / 2) +\n (gradAttr.cy || 0) * radialReference[2],\n r: (gradAttr.r || 0) * radialReference[2]\n };\n }\n /**\n * Create a drop shadow definition and return its id\n *\n * @private\n * @function Highcharts.SVGRenderer#shadowDefinition\n *\n * @param {boolean|Highcharts.ShadowOptionsObject} [shadowOptions] The\n * shadow options. If `true`, the default options are applied\n */\n shadowDefinition(shadowOptions) {\n const id = [\n `highcharts-drop-shadow-${this.chartIndex}`,\n ...Object.keys(shadowOptions)\n .map((key) => `${key}-${shadowOptions[key]}`)\n ].join('-').toLowerCase().replace(/[^a-z0-9\\-]/g, ''), options = merge({\n color: '#000000',\n offsetX: 1,\n offsetY: 1,\n opacity: 0.15,\n width: 5\n }, shadowOptions);\n if (!this.defs.element.querySelector(`#${id}`)) {\n this.definition({\n tagName: 'filter',\n attributes: {\n id,\n filterUnits: options.filterUnits\n },\n children: [{\n tagName: 'feDropShadow',\n attributes: {\n dx: options.offsetX,\n dy: options.offsetY,\n 'flood-color': options.color,\n // Tuned and modified to keep a preserve compatibility\n // with the old settings\n 'flood-opacity': Math.min(options.opacity * 5, 1),\n stdDeviation: options.width / 2\n }\n }]\n });\n }\n return id;\n }\n /**\n * Parse a simple HTML string into SVG tspans. Called internally when text\n * is set on an SVGElement. The function supports a subset of HTML tags, CSS\n * text features like `width`, `text-overflow`, `white-space`, and also\n * attributes like `href` and `style`.\n *\n * @private\n * @function Highcharts.SVGRenderer#buildText\n *\n * @param {Highcharts.SVGElement} wrapper\n * The parent SVGElement.\n */\n buildText(wrapper) {\n new TextBuilder(wrapper).buildSVG();\n }\n /**\n * Returns white for dark colors and black for bright colors, based on W3C's\n * definition of [Relative luminance](\n * https://www.w3.org/WAI/GL/wiki/Relative_luminance).\n *\n * @function Highcharts.SVGRenderer#getContrast\n *\n * @param {Highcharts.ColorString} color\n * The color to get the contrast for.\n *\n * @return {Highcharts.ColorString}\n * The contrast color, either `#000000` or `#FFFFFF`.\n */\n getContrast(color) {\n // #6216, #17273\n const rgba = Color.parse(color).rgba\n .map((b8) => {\n const c = b8 / 255;\n return c <= 0.03928 ?\n c / 12.92 :\n Math.pow((c + 0.055) / 1.055, 2.4);\n });\n // Relative luminance\n const l = 0.2126 * rgba[0] + 0.7152 * rgba[1] + 0.0722 * rgba[2];\n // Use white or black based on which provides more contrast\n return 1.05 / (l + 0.05) > (l + 0.05) / 0.05 ? '#FFFFFF' : '#000000';\n }\n /**\n * Create a button with preset states.\n *\n * @function Highcharts.SVGRenderer#button\n *\n * @param {string} text\n * The text or HTML to draw.\n *\n * @param {number} x\n * The x position of the button's left side.\n *\n * @param {number} y\n * The y position of the button's top side.\n *\n * @param {Highcharts.EventCallbackFunction} callback\n * The function to execute on button click or touch.\n *\n * @param {Highcharts.SVGAttributes} [theme]\n * SVG attributes for the normal state.\n *\n * @param {Highcharts.SVGAttributes} [hoverState]\n * SVG attributes for the hover state.\n *\n * @param {Highcharts.SVGAttributes} [selectState]\n * SVG attributes for the pressed state.\n *\n * @param {Highcharts.SVGAttributes} [disabledState]\n * SVG attributes for the disabled state.\n *\n * @param {Highcharts.SymbolKeyValue} [shape=rect]\n * The shape type.\n *\n * @param {boolean} [useHTML=false]\n * Whether to use HTML to render the label.\n *\n * @return {Highcharts.SVGElement}\n * The button element.\n */\n button(text, x, y, callback, theme = {}, hoverState, selectState, disabledState, shape, useHTML) {\n const label = this.label(text, x, y, shape, void 0, void 0, useHTML, void 0, 'button'), styledMode = this.styledMode, states = theme.states || {};\n let curState = 0;\n theme = merge(theme);\n delete theme.states;\n const normalStyle = merge({\n color: \"#333333\" /* Palette.neutralColor80 */,\n cursor: 'pointer',\n fontSize: '0.8em',\n fontWeight: 'normal'\n }, theme.style);\n delete theme.style;\n // Remove stylable attributes. Pass in the ButtonThemeObject and get the\n // SVGAttributes subset back.\n let normalState = AST.filterUserAttributes(theme);\n // Default, non-stylable attributes\n label.attr(merge({ padding: 8, r: 2 }, normalState));\n // Presentational. The string type is a mistake, it is just for\n // compliance with SVGAttribute and is not used in button theme.\n let hoverStyle, selectStyle, disabledStyle;\n if (!styledMode) {\n // Normal state - prepare the attributes\n normalState = merge({\n fill: \"#f7f7f7\" /* Palette.neutralColor3 */,\n stroke: \"#cccccc\" /* Palette.neutralColor20 */,\n 'stroke-width': 1\n }, normalState);\n // Hover state\n hoverState = merge(normalState, {\n fill: \"#e6e6e6\" /* Palette.neutralColor10 */\n }, AST.filterUserAttributes(hoverState || states.hover || {}));\n hoverStyle = hoverState.style;\n delete hoverState.style;\n // Pressed state\n selectState = merge(normalState, {\n fill: \"#e6e9ff\" /* Palette.highlightColor10 */,\n style: {\n color: \"#000000\" /* Palette.neutralColor100 */,\n fontWeight: 'bold'\n }\n }, AST.filterUserAttributes(selectState || states.select || {}));\n selectStyle = selectState.style;\n delete selectState.style;\n // Disabled state\n disabledState = merge(normalState, {\n style: {\n color: \"#cccccc\" /* Palette.neutralColor20 */\n }\n }, AST.filterUserAttributes(disabledState || states.disabled || {}));\n disabledStyle = disabledState.style;\n delete disabledState.style;\n }\n // Add the events. IE9 and IE10 need mouseover and mouseout to function\n // (#667).\n addEvent(label.element, isMS ? 'mouseover' : 'mouseenter', function () {\n if (curState !== 3) {\n label.setState(1);\n }\n });\n addEvent(label.element, isMS ? 'mouseout' : 'mouseleave', function () {\n if (curState !== 3) {\n label.setState(curState);\n }\n });\n label.setState = function (state) {\n // Hover state is temporary, don't record it\n if (state !== 1) {\n label.state = curState = state;\n }\n // Update visuals\n label\n .removeClass(/highcharts-button-(normal|hover|pressed|disabled)/)\n .addClass('highcharts-button-' +\n ['normal', 'hover', 'pressed', 'disabled'][state || 0]);\n if (!styledMode) {\n label\n .attr([\n normalState,\n hoverState,\n selectState,\n disabledState\n ][state || 0]);\n const css = [\n normalStyle,\n hoverStyle,\n selectStyle,\n disabledStyle\n ][state || 0];\n if (isObject(css)) {\n label.css(css);\n }\n }\n };\n // Presentational attributes\n if (!styledMode) {\n label\n .attr(normalState)\n .css(extend({ cursor: 'default' }, normalStyle));\n // HTML labels don't need to handle pointer events because click and\n // mouseenter/mouseleave is bound to the underlying element.\n // Should this be reconsidered, we need more complex logic to share\n // events between the and its
counterpart, and avoid\n // triggering mouseenter/mouseleave when hovering from one to the\n // other (#17440).\n if (useHTML) {\n label.text.css({ pointerEvents: 'none' });\n }\n }\n return label\n .on('touchstart', (e) => e.stopPropagation())\n .on('click', function (e) {\n if (curState !== 3) {\n callback.call(label, e);\n }\n });\n }\n /**\n * Make a straight line crisper by not spilling out to neighbour pixels.\n *\n * @function Highcharts.SVGRenderer#crispLine\n *\n * @param {Highcharts.SVGPathArray} points\n * The original points on the format `[['M', 0, 0], ['L', 100, 0]]`.\n *\n * @param {number} width\n * The width of the line.\n *\n * @param {string} [roundingFunction=round]\n * The rounding function name on the `Math` object, can be one of\n * `round`, `floor` or `ceil`.\n *\n * @return {Highcharts.SVGPathArray}\n * The original points array, but modified to render crisply.\n */\n crispLine(points, width, roundingFunction = 'round') {\n const start = points[0];\n const end = points[1];\n // Normalize to a crisp line\n if (defined(start[1]) && start[1] === end[1]) {\n // Subtract due to #1129. Now bottom and left axis gridlines behave\n // the same.\n start[1] = end[1] =\n Math[roundingFunction](start[1]) - (width % 2 / 2);\n }\n if (defined(start[2]) && start[2] === end[2]) {\n start[2] = end[2] =\n Math[roundingFunction](start[2]) + (width % 2 / 2);\n }\n return points;\n }\n /**\n * Draw a path, wraps the SVG `path` element.\n *\n * @sample highcharts/members/renderer-path-on-chart/\n * Draw a path in a chart\n * @sample highcharts/members/renderer-path/\n * Draw a path independent from a chart\n *\n * @example\n * let path = renderer.path(['M', 10, 10, 'L', 30, 30, 'z'])\n * .attr({ stroke: '#ff00ff' })\n * .add();\n *\n * @function Highcharts.SVGRenderer#path\n *\n * @param {Highcharts.SVGPathArray} [path]\n * An SVG path definition in array form.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n *\n */ /**\n * Draw a path, wraps the SVG `path` element.\n *\n * @function Highcharts.SVGRenderer#path\n *\n * @param {Highcharts.SVGAttributes} [attribs]\n * The initial attributes.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */\n path(path) {\n const attribs = (this.styledMode ? {} : {\n fill: 'none'\n });\n if (isArray(path)) {\n attribs.d = path;\n }\n else if (isObject(path)) { // attributes\n extend(attribs, path);\n }\n return this.createElement('path').attr(attribs);\n }\n /**\n * Draw a circle, wraps the SVG `circle` element.\n *\n * @sample highcharts/members/renderer-circle/\n * Drawing a circle\n *\n * @function Highcharts.SVGRenderer#circle\n *\n * @param {number} [x]\n * The center x position.\n *\n * @param {number} [y]\n * The center y position.\n *\n * @param {number} [r]\n * The radius.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */ /**\n * Draw a circle, wraps the SVG `circle` element.\n *\n * @function Highcharts.SVGRenderer#circle\n *\n * @param {Highcharts.SVGAttributes} [attribs]\n * The initial attributes.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */\n circle(x, y, r) {\n const attribs = (isObject(x) ?\n x :\n typeof x === 'undefined' ? {} : { x: x, y: y, r: r }), wrapper = this.createElement('circle');\n // Setting x or y translates to cx and cy\n wrapper.xSetter = wrapper.ySetter = function (value, key, element) {\n element.setAttribute('c' + key, value);\n };\n return wrapper.attr(attribs);\n }\n /**\n * Draw and return an arc.\n *\n * @sample highcharts/members/renderer-arc/\n * Drawing an arc\n *\n * @function Highcharts.SVGRenderer#arc\n *\n * @param {number} [x=0]\n * Center X position.\n *\n * @param {number} [y=0]\n * Center Y position.\n *\n * @param {number} [r=0]\n * The outer radius' of the arc.\n *\n * @param {number} [innerR=0]\n * Inner radius like used in donut charts.\n *\n * @param {number} [start=0]\n * The starting angle of the arc in radians, where 0 is to the right and\n * `-Math.PI/2` is up.\n *\n * @param {number} [end=0]\n * The ending angle of the arc in radians, where 0 is to the right and\n * `-Math.PI/2` is up.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */ /**\n * Draw and return an arc. Overloaded function that takes arguments object.\n *\n * @function Highcharts.SVGRenderer#arc\n *\n * @param {Highcharts.SVGAttributes} attribs\n * Initial SVG attributes.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */\n arc(x, y, r, innerR, start, end) {\n let options;\n if (isObject(x)) {\n options = x;\n y = options.y;\n r = options.r;\n innerR = options.innerR;\n start = options.start;\n end = options.end;\n x = options.x;\n }\n else {\n options = { innerR, start, end };\n }\n // Arcs are defined as symbols for the ability to set\n // attributes in attr and animate\n const arc = this.symbol('arc', x, y, r, r, options);\n arc.r = r; // #959\n return arc;\n }\n /**\n * Draw and return a rectangle.\n *\n * @function Highcharts.SVGRenderer#rect\n *\n * @param {number} [x]\n * Left position.\n *\n * @param {number} [y]\n * Top position.\n *\n * @param {number} [width]\n * Width of the rectangle.\n *\n * @param {number} [height]\n * Height of the rectangle.\n *\n * @param {number} [r]\n * Border corner radius.\n *\n * @param {number} [strokeWidth]\n * A stroke width can be supplied to allow crisp drawing.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */ /**\n * Draw and return a rectangle.\n *\n * @sample highcharts/members/renderer-rect-on-chart/\n * Draw a rectangle in a chart\n * @sample highcharts/members/renderer-rect/\n * Draw a rectangle independent from a chart\n *\n * @function Highcharts.SVGRenderer#rect\n *\n * @param {Highcharts.SVGAttributes} [attributes]\n * General SVG attributes for the rectangle.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */\n rect(x, y, width, height, r, strokeWidth) {\n const attribs = (isObject(x) ?\n x :\n typeof x === 'undefined' ?\n {} :\n {\n x,\n y,\n r,\n width: Math.max(width || 0, 0),\n height: Math.max(height || 0, 0)\n }), wrapper = this.createElement('rect');\n if (!this.styledMode) {\n if (typeof strokeWidth !== 'undefined') {\n attribs['stroke-width'] = strokeWidth;\n extend(attribs, wrapper.crisp(attribs));\n }\n attribs.fill = 'none';\n }\n wrapper.rSetter = function (value, _key, element) {\n wrapper.r = value;\n attr(element, {\n rx: value,\n ry: value\n });\n };\n wrapper.rGetter = function () {\n return wrapper.r || 0;\n };\n return wrapper.attr(attribs);\n }\n /**\n * Draw and return a rectangle with advanced corner rounding options.\n *\n * @function Highcharts.SVGRenderer#roundedRect\n *\n * @param {Highcharts.SVGAttributes} attribs\n * Attributes\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */\n roundedRect(attribs) {\n return this.symbol('roundedRect').attr(attribs);\n }\n /**\n * Resize the {@link SVGRenderer#box} and re-align all aligned child\n * elements.\n *\n * @sample highcharts/members/renderer-g/\n * Show and hide grouped objects\n *\n * @function Highcharts.SVGRenderer#setSize\n *\n * @param {number} width\n * The new pixel width.\n *\n * @param {number} height\n * The new pixel height.\n *\n * @param {boolean|Partial} [animate=true]\n * Whether and how to animate.\n */\n setSize(width, height, animate) {\n const renderer = this;\n renderer.width = width;\n renderer.height = height;\n renderer.boxWrapper.animate({\n width: width,\n height: height\n }, {\n step: function () {\n this.attr({\n viewBox: '0 0 ' + this.attr('width') + ' ' +\n this.attr('height')\n });\n },\n duration: pick(animate, true) ? void 0 : 0\n });\n renderer.alignElements();\n }\n /**\n * Create and return an svg group element. Child\n * {@link Highcharts.SVGElement} objects are added to the group by using the\n * group as the first parameter in {@link Highcharts.SVGElement#add|add()}.\n *\n * @function Highcharts.SVGRenderer#g\n *\n * @param {string} [name]\n * The group will be given a class name of `highcharts-{name}`. This\n * can be used for styling and scripting.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */\n g(name) {\n const elem = this.createElement('g');\n return name ?\n elem.attr({ 'class': 'highcharts-' + name }) :\n elem;\n }\n /**\n * Display an image.\n *\n * @sample highcharts/members/renderer-image-on-chart/\n * Add an image in a chart\n * @sample highcharts/members/renderer-image/\n * Add an image independent of a chart\n *\n * @function Highcharts.SVGRenderer#image\n *\n * @param {string} href\n * The image source.\n *\n * @param {number} [x]\n * The X position.\n *\n * @param {number} [y]\n * The Y position.\n *\n * @param {number} [width]\n * The image width. If omitted, it defaults to the image file width.\n *\n * @param {number} [height]\n * The image height. If omitted it defaults to the image file\n * height.\n *\n * @param {Function} [onload]\n * Event handler for image load.\n *\n * @return {Highcharts.SVGElement}\n * The generated wrapper element.\n */\n image(href, x, y, width, height, onload) {\n const attribs = { preserveAspectRatio: 'none' };\n // Optional properties (#11756)\n if (isNumber(x)) {\n attribs.x = x;\n }\n if (isNumber(y)) {\n attribs.y = y;\n }\n if (isNumber(width)) {\n attribs.width = width;\n }\n if (isNumber(height)) {\n attribs.height = height;\n }\n const elemWrapper = this.createElement('image').attr(attribs), onDummyLoad = function (e) {\n elemWrapper.attr({ href });\n onload.call(elemWrapper, e);\n };\n // Add load event if supplied\n if (onload) {\n // We have to use a dummy HTML image since IE support for SVG image\n // load events is very buggy. First set a transparent src, wait for\n // dummy to load, and then add the real src to the SVG image.\n elemWrapper.attr({\n /* eslint-disable-next-line max-len */\n href: 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n });\n const dummy = new win.Image();\n addEvent(dummy, 'load', onDummyLoad);\n dummy.src = href;\n if (dummy.complete) {\n onDummyLoad({});\n }\n }\n else {\n elemWrapper.attr({ href });\n }\n return elemWrapper;\n }\n /**\n * Draw a symbol out of pre-defined shape paths from\n * {@link SVGRenderer#symbols}.\n * It is used in Highcharts for point makers, which cake a `symbol` option,\n * and label and button backgrounds like in the tooltip and stock flags.\n *\n * @function Highcharts.SVGRenderer#symbol\n *\n * @param {string} symbol\n * The symbol name.\n *\n * @param {number} [x]\n * The X coordinate for the top left position.\n *\n * @param {number} [y]\n * The Y coordinate for the top left position.\n *\n * @param {number} [width]\n * The pixel width.\n *\n * @param {number} [height]\n * The pixel height.\n *\n * @param {Highcharts.SymbolOptionsObject} [options]\n * Additional options, depending on the actual symbol drawn.\n *\n * @return {Highcharts.SVGElement}\n * SVG symbol.\n */\n symbol(symbol, x, y, width, height, options) {\n const ren = this, imageRegex = /^url\\((.*?)\\)$/, isImage = imageRegex.test(symbol), sym = (!isImage && (this.symbols[symbol] ? symbol : 'circle')), \n // get the symbol definition function\n symbolFn = (sym && this.symbols[sym]);\n let obj, path, imageSrc, centerImage;\n if (symbolFn) {\n // Check if there's a path defined for this symbol\n if (typeof x === 'number') {\n path = symbolFn.call(this.symbols, Math.round(x || 0), Math.round(y || 0), width || 0, height || 0, options);\n }\n obj = this.path(path);\n if (!ren.styledMode) {\n obj.attr('fill', 'none');\n }\n // expando properties for use in animate and attr\n extend(obj, {\n symbolName: (sym || void 0),\n x: x,\n y: y,\n width: width,\n height: height\n });\n if (options) {\n extend(obj, options);\n }\n // Image symbols\n }\n else if (isImage) {\n imageSrc = symbol.match(imageRegex)[1];\n // Create the image synchronously, add attribs async\n const img = obj = this.image(imageSrc);\n // The image width is not always the same as the symbol width. The\n // image may be centered within the symbol, as is the case when\n // image shapes are used as label backgrounds, for example in flags.\n img.imgwidth = pick(options && options.width, symbolSizes[imageSrc] && symbolSizes[imageSrc].width);\n img.imgheight = pick(options && options.height, symbolSizes[imageSrc] && symbolSizes[imageSrc].height);\n /**\n * Set the size and position\n */\n centerImage = (obj) => obj.attr({\n width: obj.width,\n height: obj.height\n });\n /**\n * Width and height setters that take both the image's physical size\n * and the label size into consideration, and translates the image\n * to center within the label.\n */\n ['width', 'height'].forEach((key) => {\n img[`${key}Setter`] = function (value, key) {\n this[key] = value;\n const { alignByTranslate, element, width, height, imgwidth, imgheight } = this, imgSize = key === 'width' ? imgwidth : imgheight;\n let scale = 1;\n // Scale and center the image within its container. The name\n // `backgroundSize` is taken from the CSS spec, but the\n // value `within` is made up. Other possible values in the\n // spec, `cover` and `contain`, can be implemented if\n // needed.\n if (options &&\n options.backgroundSize === 'within' &&\n width &&\n height &&\n imgwidth &&\n imgheight) {\n scale = Math.min(width / imgwidth, height / imgheight);\n // Update both width and height to keep the ratio\n // correct (#17315)\n attr(element, {\n width: Math.round(imgwidth * scale),\n height: Math.round(imgheight * scale)\n });\n }\n else if (element && imgSize) {\n element.setAttribute(key, imgSize);\n }\n if (!alignByTranslate && imgwidth && imgheight) {\n this.translate(((width || 0) - (imgwidth * scale)) / 2, ((height || 0) - (imgheight * scale)) / 2);\n }\n };\n });\n if (defined(x)) {\n img.attr({\n x: x,\n y: y\n });\n }\n img.isImg = true;\n if (defined(img.imgwidth) && defined(img.imgheight)) {\n centerImage(img);\n }\n else {\n // Initialize image to be 0 size so export will still function\n // if there's no cached sizes.\n img.attr({ width: 0, height: 0 });\n // Create a dummy JavaScript image to get the width and height.\n createElement('img', {\n onload: function () {\n const chart = charts[ren.chartIndex];\n // Special case for SVGs on IE11, the width is not\n // accessible until the image is part of the DOM\n // (#2854).\n if (this.width === 0) {\n css(this, {\n position: 'absolute',\n top: '-999em'\n });\n doc.body.appendChild(this);\n }\n // Center the image\n symbolSizes[imageSrc] = {\n width: this.width,\n height: this.height\n };\n img.imgwidth = this.width;\n img.imgheight = this.height;\n if (img.element) {\n centerImage(img);\n }\n // Clean up after #2854 workaround.\n if (this.parentNode) {\n this.parentNode.removeChild(this);\n }\n // Fire the load event when all external images are\n // loaded\n ren.imgCount--;\n if (!ren.imgCount && chart && !chart.hasLoaded) {\n chart.onload();\n }\n },\n src: imageSrc\n });\n this.imgCount++;\n }\n }\n return obj;\n }\n /**\n * Define a clipping rectangle. The clipping rectangle is later applied\n * to {@link SVGElement} objects through the {@link SVGElement#clip}\n * function.\n *\n * This function is deprecated as of v11.2. Instead, use a regular shape\n * (`rect`, `path` etc), and the `SVGElement.clipTo` function.\n *\n * @example\n * let circle = renderer.circle(100, 100, 100)\n * .attr({ fill: 'red' })\n * .add();\n * let clipRect = renderer.clipRect(100, 100, 100, 100);\n *\n * // Leave only the lower right quarter visible\n * circle.clip(clipRect);\n *\n * @deprecated\n *\n * @function Highcharts.SVGRenderer#clipRect\n *\n * @param {number} [x]\n *\n * @param {number} [y]\n *\n * @param {number} [width]\n *\n * @param {number} [height]\n *\n * @return {Highcharts.ClipRectElement}\n * A clipping rectangle.\n */\n clipRect(x, y, width, height) {\n return this.rect(x, y, width, height, 0);\n }\n /**\n * Draw text. The text can contain a subset of HTML, like spans and anchors\n * and some basic text styling of these. For more advanced features like\n * border and background, use {@link Highcharts.SVGRenderer#label} instead.\n * To update the text after render, run `text.attr({ text: 'New text' })`.\n *\n * @sample highcharts/members/renderer-text-on-chart/\n * Annotate the chart freely\n * @sample highcharts/members/renderer-on-chart/\n * Annotate with a border and in response to the data\n * @sample highcharts/members/renderer-text/\n * Formatted text\n *\n * @function Highcharts.SVGRenderer#text\n *\n * @param {string} [str]\n * The text of (subset) HTML to draw.\n *\n * @param {number} [x]\n * The x position of the text's lower left corner.\n *\n * @param {number} [y]\n * The y position of the text's lower left corner.\n *\n * @param {boolean} [useHTML=false]\n * Use HTML to render the text.\n *\n * @return {Highcharts.SVGElement}\n * The text object.\n */\n text(str, x, y, useHTML) {\n const renderer = this, attribs = {};\n if (useHTML && (renderer.allowHTML || !renderer.forExport)) {\n return renderer.html(str, x, y);\n }\n attribs.x = Math.round(x || 0); // X always needed for line-wrap logic\n if (y) {\n attribs.y = Math.round(y);\n }\n if (defined(str)) {\n attribs.text = str;\n }\n const wrapper = renderer.createElement('text').attr(attribs);\n if (!useHTML || (renderer.forExport && !renderer.allowHTML)) {\n wrapper.xSetter = function (value, key, element) {\n const tspans = element.getElementsByTagName('tspan'), parentVal = element.getAttribute(key);\n for (let i = 0, tspan; i < tspans.length; i++) {\n tspan = tspans[i];\n // If the x values are equal, the tspan represents a line\n // break\n if (tspan.getAttribute(key) === parentVal) {\n tspan.setAttribute(key, value);\n }\n }\n element.setAttribute(key, value);\n };\n }\n return wrapper;\n }\n /**\n * Utility to return the baseline offset and total line height from the font\n * size.\n *\n * @function Highcharts.SVGRenderer#fontMetrics\n *\n * @param {Highcharts.SVGElement|Highcharts.SVGDOMElement|number} [element]\n * The element to inspect for a current font size. If a number is\n * given, it's used as a fall back for direct font size in pixels.\n *\n * @return {Highcharts.FontMetricsObject}\n * The font metrics.\n */\n fontMetrics(element) {\n const f = pInt(SVGElement.prototype.getStyle.call(element, 'font-size') || 0);\n // Empirical values found by comparing font size and bounding box\n // height. Applies to the default font family.\n // https://jsfiddle.net/highcharts/7xvn7/\n const h = f < 24 ? f + 3 : Math.round(f * 1.2), b = Math.round(h * 0.8);\n return {\n // Line height\n h,\n // Baseline\n b,\n // Font size\n f\n };\n }\n /**\n * Correct X and Y positioning of a label for rotation (#1764).\n *\n * @private\n * @function Highcharts.SVGRenderer#rotCorr\n */\n rotCorr(baseline, rotation, alterY) {\n let y = baseline;\n if (rotation && alterY) {\n y = Math.max(y * Math.cos(rotation * deg2rad), 4);\n }\n return {\n x: (-baseline / 3) * Math.sin(rotation * deg2rad),\n y: y\n };\n }\n /**\n * Compatibility function to convert the legacy one-dimensional path array\n * into an array of segments.\n *\n * It is used in maps to parse the `path` option, and in SVGRenderer.dSetter\n * to support legacy paths from demos.\n *\n * @private\n * @function Highcharts.SVGRenderer#pathToSegments\n */\n pathToSegments(path) {\n const ret = [];\n const segment = [];\n const commandLength = {\n A: 8,\n C: 7,\n H: 2,\n L: 3,\n M: 3,\n Q: 5,\n S: 5,\n T: 3,\n V: 2\n };\n // Short, non-typesafe parsing of the one-dimensional array. It splits\n // the path on any string. This is not type checked against the tuple\n // types, but is shorter, and doesn't require specific checks for any\n // command type in SVG.\n for (let i = 0; i < path.length; i++) {\n // Command skipped, repeat previous or insert L/l for M/m\n if (isString(segment[0]) &&\n isNumber(path[i]) &&\n segment.length === commandLength[(segment[0].toUpperCase())]) {\n path.splice(i, 0, segment[0].replace('M', 'L').replace('m', 'l'));\n }\n // Split on string\n if (typeof path[i] === 'string') {\n if (segment.length) {\n ret.push(segment.slice(0));\n }\n segment.length = 0;\n }\n segment.push(path[i]);\n }\n ret.push(segment.slice(0));\n return ret;\n /*\n // Fully type-safe version where each tuple type is checked. The\n // downside is filesize and a lack of flexibility for unsupported\n // commands\n const ret: SVGPath = [],\n commands = {\n A: 7,\n C: 6,\n H: 1,\n L: 2,\n M: 2,\n Q: 4,\n S: 4,\n T: 2,\n V: 1,\n Z: 0\n };\n\n let i = 0,\n lastI = 0,\n lastCommand;\n\n while (i < path.length) {\n const item = path[i];\n\n let command;\n\n if (typeof item === 'string') {\n command = item;\n i += 1;\n } else {\n command = lastCommand || 'M';\n }\n\n // Upper case\n const commandUC = command.toUpperCase();\n\n if (commandUC in commands) {\n\n // No numeric parameters\n if (command === 'Z' || command === 'z') {\n ret.push([command]);\n\n // One numeric parameter\n } else {\n const val0 = path[i];\n if (typeof val0 === 'number') {\n\n // Horizontal line to\n if (command === 'H' || command === 'h') {\n ret.push([command, val0]);\n i += 1;\n\n // Vertical line to\n } else if (command === 'V' || command === 'v') {\n ret.push([command, val0]);\n i += 1;\n\n // Two numeric parameters\n } else {\n const val1 = path[i + 1];\n if (typeof val1 === 'number') {\n // lineTo\n if (command === 'L' || command === 'l') {\n ret.push([command, val0, val1]);\n i += 2;\n\n // moveTo\n } else if (command === 'M' || command === 'm') {\n ret.push([command, val0, val1]);\n i += 2;\n\n // Smooth quadratic bezier\n } else if (command === 'T' || command === 't') {\n ret.push([command, val0, val1]);\n i += 2;\n\n // Four numeric parameters\n } else {\n const val2 = path[i + 2],\n val3 = path[i + 3];\n if (\n typeof val2 === 'number' &&\n typeof val3 === 'number'\n ) {\n // Quadratic bezier to\n if (\n command === 'Q' ||\n command === 'q'\n ) {\n ret.push([\n command,\n val0,\n val1,\n val2,\n val3\n ]);\n i += 4;\n\n // Smooth cubic bezier to\n } else if (\n command === 'S' ||\n command === 's'\n ) {\n ret.push([\n command,\n val0,\n val1,\n val2,\n val3\n ]);\n i += 4;\n\n // Six numeric parameters\n } else {\n const val4 = path[i + 4],\n val5 = path[i + 5];\n\n if (\n typeof val4 === 'number' &&\n typeof val5 === 'number'\n ) {\n // Curve to\n if (\n command === 'C' ||\n command === 'c'\n ) {\n ret.push([\n command,\n val0,\n val1,\n val2,\n val3,\n val4,\n val5\n ]);\n i += 6;\n\n // Seven numeric parameters\n } else {\n const val6 = path[i + 6];\n\n // Arc to\n if (\n typeof val6 ===\n 'number' &&\n (\n command === 'A' ||\n command === 'a'\n )\n ) {\n ret.push([\n command,\n val0,\n val1,\n val2,\n val3,\n val4,\n val5,\n val6\n ]);\n i += 7;\n\n }\n\n }\n }\n }\n }\n }\n }\n\n }\n }\n }\n }\n\n // An unmarked command following a moveTo is a lineTo\n lastCommand = command === 'M' ? 'L' : command;\n\n if (i === lastI) {\n break;\n }\n lastI = i;\n }\n return ret;\n */\n }\n /**\n * Draw a label, which is an extended text element with support for border\n * and background. Highcharts creates a `g` element with a text and a `path`\n * or `rect` inside, to make it behave somewhat like a HTML div. Border and\n * background are set through `stroke`, `stroke-width` and `fill` attributes\n * using the {@link Highcharts.SVGElement#attr|attr} method. To update the\n * text after render, run `label.attr({ text: 'New text' })`.\n *\n * @sample highcharts/members/renderer-label-on-chart/\n * A label on the chart\n *\n * @function Highcharts.SVGRenderer#label\n *\n * @param {string} str\n * The initial text string or (subset) HTML to render.\n *\n * @param {number} x\n * The x position of the label's left side.\n *\n * @param {number} [y]\n * The y position of the label's top side or baseline, depending on\n * the `baseline` parameter.\n *\n * @param {string} [shape='rect']\n * The shape of the label's border/background, if any. Defaults to\n * `rect`. Other possible values are `callout` or other shapes\n * defined in {@link Highcharts.SVGRenderer#symbols}.\n *\n * @param {number} [anchorX]\n * In case the `shape` has a pointer, like a flag, this is the\n * coordinates it should be pinned to.\n *\n * @param {number} [anchorY]\n * In case the `shape` has a pointer, like a flag, this is the\n * coordinates it should be pinned to.\n *\n * @param {boolean} [useHTML=false]\n * Whether to use HTML to render the label.\n *\n * @param {boolean} [baseline=false]\n * Whether to position the label relative to the text baseline,\n * like {@link Highcharts.SVGRenderer#text|renderer.text}, or to the\n * upper border of the rectangle.\n *\n * @param {string} [className]\n * Class name for the group.\n *\n * @return {Highcharts.SVGElement}\n * The generated label.\n */\n label(str, x, y, shape, anchorX, anchorY, useHTML, baseline, className) {\n return new SVGLabel(this, str, x, y, shape, anchorX, anchorY, useHTML, baseline, className);\n }\n /**\n * Re-align all aligned elements.\n *\n * @private\n * @function Highcharts.SVGRenderer#alignElements\n */\n alignElements() {\n this.alignedObjects.forEach((el) => el.align());\n }\n}\nextend(SVGRenderer.prototype, {\n /**\n * A pointer to the renderer's associated Element class.\n *\n * @name Highcharts.SVGRenderer#Element\n * @type {Highcharts.SVGElement}\n */\n Element: SVGElement,\n SVG_NS,\n /**\n * A collection of characters mapped to HTML entities. When `useHTML` on an\n * element is true, these entities will be rendered correctly by HTML. In\n * the SVG pseudo-HTML, they need to be unescaped back to simple characters,\n * so for example `<` will render as `<`.\n *\n * @example\n * // Add support for unescaping quotes\n * Highcharts.SVGRenderer.prototype.escapes['\"'] = '"';\n *\n * @name Highcharts.SVGRenderer#escapes\n * @type {Highcharts.Dictionary}\n */\n escapes: {\n '&': '&',\n '<': '<',\n '>': '>',\n \"'\": ''',\n '\"': '"'\n },\n /**\n * An extendable collection of functions for defining symbol paths.\n *\n * @name Highcharts.SVGRenderer#symbols\n * @type {Highcharts.SymbolDictionary}\n */\n symbols: Symbols,\n /**\n * Dummy function for plugins, called every time the renderer is updated.\n * Prior to Highcharts 5, this was used for the canvg renderer.\n *\n * @deprecated\n * @function Highcharts.SVGRenderer#draw\n */\n draw: noop\n});\n/* *\n *\n * Registry\n *\n * */\nRendererRegistry.registerRendererType('svg', SVGRenderer, true);\n/* *\n *\n * Export Default\n *\n * */\nexport default SVGRenderer;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * A clipping rectangle that can be applied to one or more {@link SVGElement}\n * instances. It is instantiated with the {@link SVGRenderer#clipRect} function\n * and applied with the {@link SVGElement#clip} function.\n *\n * @example\n * let circle = renderer.circle(100, 100, 100)\n * .attr({ fill: 'red' })\n * .add();\n * let clipRect = renderer.clipRect(100, 100, 100, 100);\n *\n * // Leave only the lower right quarter visible\n * circle.clip(clipRect);\n *\n * @typedef {Highcharts.SVGElement} Highcharts.ClipRectElement\n */\n/**\n * The font metrics.\n *\n * @interface Highcharts.FontMetricsObject\n */ /**\n* The baseline relative to the top of the box.\n*\n* @name Highcharts.FontMetricsObject#b\n* @type {number}\n*/ /**\n* The font size.\n*\n* @name Highcharts.FontMetricsObject#f\n* @type {number}\n*/ /**\n* The line height.\n*\n* @name Highcharts.FontMetricsObject#h\n* @type {number}\n*/\n/**\n * An object containing `x` and `y` properties for the position of an element.\n *\n * @interface Highcharts.PositionObject\n */ /**\n* X position of the element.\n* @name Highcharts.PositionObject#x\n* @type {number}\n*/ /**\n* Y position of the element.\n* @name Highcharts.PositionObject#y\n* @type {number}\n*/\n/**\n * A rectangle.\n *\n * @interface Highcharts.RectangleObject\n */ /**\n* Height of the rectangle.\n* @name Highcharts.RectangleObject#height\n* @type {number}\n*/ /**\n* Width of the rectangle.\n* @name Highcharts.RectangleObject#width\n* @type {number}\n*/ /**\n* Horizontal position of the rectangle.\n* @name Highcharts.RectangleObject#x\n* @type {number}\n*/ /**\n* Vertical position of the rectangle.\n* @name Highcharts.RectangleObject#y\n* @type {number}\n*/\n/**\n * The shadow options.\n *\n * @interface Highcharts.ShadowOptionsObject\n */ /**\n* The shadow color.\n* @name Highcharts.ShadowOptionsObject#color\n* @type {Highcharts.ColorString|undefined}\n* @default ${palette.neutralColor100}\n*/ /**\n* The horizontal offset from the element.\n*\n* @name Highcharts.ShadowOptionsObject#offsetX\n* @type {number|undefined}\n* @default 1\n*/ /**\n* The vertical offset from the element.\n* @name Highcharts.ShadowOptionsObject#offsetY\n* @type {number|undefined}\n* @default 1\n*/ /**\n* The shadow opacity.\n*\n* @name Highcharts.ShadowOptionsObject#opacity\n* @type {number|undefined}\n* @default 0.15\n*/ /**\n* The shadow width or distance from the element.\n* @name Highcharts.ShadowOptionsObject#width\n* @type {number|undefined}\n* @default 3\n*/\n/**\n * @interface Highcharts.SizeObject\n */ /**\n* @name Highcharts.SizeObject#height\n* @type {number}\n*/ /**\n* @name Highcharts.SizeObject#width\n* @type {number}\n*/\n/**\n * Array of path commands, that will go into the `d` attribute of an SVG\n * element.\n *\n * @typedef {Array<(Array|Array|Array|Array|Array|Array)>} Highcharts.SVGPathArray\n */\n/**\n * Possible path commands in an SVG path array. Valid values are `A`, `C`, `H`,\n * `L`, `M`, `Q`, `S`, `T`, `V`, `Z`.\n *\n * @typedef {string} Highcharts.SVGPathCommand\n * @validvalue [\"a\",\"c\",\"h\",\"l\",\"m\",\"q\",\"s\",\"t\",\"v\",\"z\",\"A\",\"C\",\"H\",\"L\",\"M\",\"Q\",\"S\",\"T\",\"V\",\"Z\"]\n */\n/**\n * An extendable collection of functions for defining symbol paths. Symbols are\n * used internally for point markers, button and label borders and backgrounds,\n * or custom shapes. Extendable by adding to {@link SVGRenderer#symbols}.\n *\n * @interface Highcharts.SymbolDictionary\n */ /**\n* @name Highcharts.SymbolDictionary#[key:string]\n* @type {Function|undefined}\n*/ /**\n* @name Highcharts.SymbolDictionary#arc\n* @type {Function|undefined}\n*/ /**\n* @name Highcharts.SymbolDictionary#callout\n* @type {Function|undefined}\n*/ /**\n* @name Highcharts.SymbolDictionary#circle\n* @type {Function|undefined}\n*/ /**\n* @name Highcharts.SymbolDictionary#diamond\n* @type {Function|undefined}\n*/ /**\n* @name Highcharts.SymbolDictionary#square\n* @type {Function|undefined}\n*/ /**\n* @name Highcharts.SymbolDictionary#triangle\n* @type {Function|undefined}\n*/\n/**\n * Can be one of `arc`, `callout`, `circle`, `diamond`, `square`, `triangle`,\n * and `triangle-down`. Symbols are used internally for point markers, button\n * and label borders and backgrounds, or custom shapes. Extendable by adding to\n * {@link SVGRenderer#symbols}.\n *\n * @typedef {\"arc\"|\"callout\"|\"circle\"|\"diamond\"|\"square\"|\"triangle\"|\"triangle-down\"} Highcharts.SymbolKeyValue\n */\n/**\n * Additional options, depending on the actual symbol drawn.\n *\n * @interface Highcharts.SymbolOptionsObject\n */ /**\n* The anchor X position for the `callout` symbol. This is where the chevron\n* points to.\n*\n* @name Highcharts.SymbolOptionsObject#anchorX\n* @type {number|undefined}\n*/ /**\n* The anchor Y position for the `callout` symbol. This is where the chevron\n* points to.\n*\n* @name Highcharts.SymbolOptionsObject#anchorY\n* @type {number|undefined}\n*/ /**\n* The end angle of an `arc` symbol.\n*\n* @name Highcharts.SymbolOptionsObject#end\n* @type {number|undefined}\n*/ /**\n* Whether to draw `arc` symbol open or closed.\n*\n* @name Highcharts.SymbolOptionsObject#open\n* @type {boolean|undefined}\n*/ /**\n* The radius of an `arc` symbol, or the border radius for the `callout` symbol.\n*\n* @name Highcharts.SymbolOptionsObject#r\n* @type {number|undefined}\n*/ /**\n* The start angle of an `arc` symbol.\n*\n* @name Highcharts.SymbolOptionsObject#start\n* @type {number|undefined}\n*/\n(''); // keeps doclets above in transpiled file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AST from './AST.js';\nimport H from '../../Globals.js';\nconst { composed } = H;\nimport SVGElement from '../SVG/SVGElement.js';\nimport U from '../../Utilities.js';\nconst { attr, css, createElement, defined, extend, pInt, pushUnique } = U;\n/**\n * The opacity and visibility properties are set as attributes on the main\n * element and SVG groups, and as identical CSS properties on the HTML element\n * and the ancestry divs. (#3542)\n *\n * @private\n */\nfunction commonSetter(value, key, elem) {\n const style = this.div?.style || elem.style;\n SVGElement.prototype[`${key}Setter`].call(this, value, key, elem);\n if (style) {\n style[key] = value;\n }\n}\n/**\n * Decorate each SVG group in the ancestry line. Each SVG `g` element that\n * contains children with useHTML, will receive a `div` element counterpart to\n * contain the HTML span. These div elements are translated and styled like\n * original `g` counterparts.\n *\n * @private\n */\nconst decorateSVGGroup = (g, container) => {\n if (!g.div) {\n const className = attr(g.element, 'class'), cssProto = g.css;\n // Create the parallel HTML group\n const div = createElement('div', className ? { className } : void 0, {\n // Add HTML specific styles\n position: 'absolute',\n left: `${g.translateX || 0}px`,\n top: `${g.translateY || 0}px`,\n // Add pre-existing styles\n ...g.styles,\n // Add g attributes that correspond to CSS\n display: g.display,\n opacity: g.opacity,\n visibility: g.visibility\n }, \n // The top group is appended to container\n g.parentGroup?.div || container);\n g.classSetter = (value, key, element) => {\n element.setAttribute('class', value);\n div.className = value;\n };\n /**\n * Common translate setter for X and Y on the HTML group.\n *\n * Reverted the fix for #6957 due to positioning problems and offline\n * export (#7254, #7280, #7529)\n * @private\n */\n g.translateXSetter = g.translateYSetter = (value, key) => {\n g[key] = value;\n div.style[key === 'translateX' ? 'left' : 'top'] = `${value}px`;\n g.doTransform = true;\n };\n g.opacitySetter = g.visibilitySetter = commonSetter;\n // Extend the parent group's css function by updating the parallel div\n // counterpart with the same style.\n g.css = (styles) => {\n // Call the base css method. The `parentGroup` can be either an\n // SVGElement or an SVGLabel, in which the css method is extended\n // (#19200).\n cssProto.call(g, styles);\n // #6794\n if (styles.cursor) {\n div.style.cursor = styles.cursor;\n }\n // #18821\n if (styles.pointerEvents) {\n div.style.pointerEvents = styles.pointerEvents;\n }\n return g;\n };\n // Event handling\n g.on = function () {\n SVGElement.prototype.on.apply({\n element: div,\n onEvents: g.onEvents\n }, arguments);\n return g;\n };\n g.div = div;\n }\n return g.div;\n};\n/* *\n *\n * Class\n *\n * */\nclass HTMLElement extends SVGElement {\n /* *\n *\n * Static Functions\n *\n * */\n /**\n * Compose\n * @private\n */\n static compose(SVGRendererClass) {\n if (pushUnique(composed, this.compose)) {\n /**\n * Create a HTML text node. This is used by the SVG renderer `text`\n * and `label` functions through the `useHTML` parameter.\n *\n * @private\n */\n SVGRendererClass.prototype.html = function (str, x, y) {\n return new HTMLElement(this, 'span')\n // Set the default attributes\n .attr({\n text: str,\n x: Math.round(x),\n y: Math.round(y)\n });\n };\n }\n }\n /* *\n *\n * Functions\n *\n * */\n constructor(renderer, nodeName) {\n super(renderer, nodeName);\n this.css({\n position: 'absolute',\n ...(renderer.styledMode ? {} : {\n fontFamily: renderer.style.fontFamily,\n fontSize: renderer.style.fontSize\n })\n });\n // Keep the whiteSpace style outside the `HTMLElement.styles` collection\n this.element.style.whiteSpace = 'nowrap';\n }\n /**\n * Get the correction in X and Y positioning as the element is rotated.\n * @private\n */\n getSpanCorrection(width, baseline, alignCorrection) {\n this.xCorr = -width * alignCorrection;\n this.yCorr = -baseline;\n }\n /**\n * Apply CSS to HTML elements. This is used in text within SVG rendering.\n * @private\n */\n css(styles) {\n const { element } = this, \n // When setting or unsetting the width style, we need to update\n // transform (#8809)\n isSettingWidth = (element.tagName === 'SPAN' &&\n styles &&\n 'width' in styles), textWidth = isSettingWidth && styles.width;\n let doTransform;\n if (isSettingWidth) {\n delete styles.width;\n this.textWidth = pInt(textWidth) || void 0;\n doTransform = true;\n }\n if (styles?.textOverflow === 'ellipsis') {\n styles.whiteSpace = 'nowrap';\n styles.overflow = 'hidden';\n }\n extend(this.styles, styles);\n css(element, styles);\n // Now that all styles are applied, to the transform\n if (doTransform) {\n this.updateTransform();\n }\n return this;\n }\n /**\n * The useHTML method for calculating the bounding box based on offsets.\n * Called internally from the `SVGElement.getBBox` function and subsequently\n * rotated.\n *\n * @private\n */\n htmlGetBBox() {\n const { element } = this;\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: element.offsetWidth,\n height: element.offsetHeight\n };\n }\n /**\n * Batch update styles and attributes related to transform\n *\n * @private\n */\n updateTransform() {\n // Aligning non added elements is expensive\n if (!this.added) {\n this.alignOnAdd = true;\n return;\n }\n const { element, renderer, rotation, rotationOriginX, rotationOriginY, styles, textAlign = 'left', textWidth, translateX = 0, translateY = 0, x = 0, y = 0 } = this, alignCorrection = {\n left: 0, center: 0.5, right: 1\n }[textAlign], whiteSpace = styles.whiteSpace;\n // Get the pixel length of the text\n const getTextPxLength = () => {\n if (this.textPxLength) {\n return this.textPxLength;\n }\n // Reset multiline/ellipsis in order to read width (#4928,\n // #5417)\n css(element, {\n width: '',\n whiteSpace: whiteSpace || 'nowrap'\n });\n return element.offsetWidth;\n };\n // Apply translate\n css(element, {\n marginLeft: `${translateX}px`,\n marginTop: `${translateY}px`\n });\n if (element.tagName === 'SPAN') {\n const currentTextTransform = [\n rotation,\n textAlign,\n element.innerHTML,\n textWidth,\n this.textAlign\n ].join(','), parentPadding = (this.parentGroup?.padding * -1) || 0;\n let baseline, hasBoxWidthChanged = false;\n // Update textWidth. Use the memoized textPxLength if possible, to\n // avoid the getTextPxLength function using elem.offsetWidth.\n // Calling offsetWidth affects rendering time as it forces layout\n // (#7656).\n if (textWidth !== this.oldTextWidth) { // #983, #1254\n const textPxLength = getTextPxLength(), textWidthNum = textWidth || 0;\n if (((textWidthNum > this.oldTextWidth) ||\n textPxLength > textWidthNum) && (\n // Only set the width if the text is able to word-wrap,\n // or text-overflow is ellipsis (#9537)\n /[ \\-]/.test(element.textContent || element.innerText) ||\n element.style.textOverflow === 'ellipsis')) {\n css(element, {\n width: (textPxLength > textWidthNum) || rotation ?\n textWidth + 'px' :\n 'auto',\n display: 'block',\n whiteSpace: whiteSpace || 'normal' // #3331\n });\n this.oldTextWidth = textWidth;\n hasBoxWidthChanged = true; // #8159\n }\n }\n this.hasBoxWidthChanged = hasBoxWidthChanged; // #8159\n // Do the calculations and DOM access only if properties changed\n if (currentTextTransform !== this.cTT) {\n baseline = renderer.fontMetrics(element).b;\n // Renderer specific handling of span rotation, but only if we\n // have something to update.\n if (defined(rotation) &&\n ((rotation !== (this.oldRotation || 0)) ||\n (textAlign !== this.oldAlign))) {\n this.setSpanRotation(rotation, parentPadding, parentPadding);\n }\n this.getSpanCorrection(\n // Avoid elem.offsetWidth if we can, it affects rendering\n // time heavily (#7656)\n ((!defined(rotation) && this.textPxLength) || // #7920\n element.offsetWidth), baseline, alignCorrection);\n }\n // Apply position with correction and rotation origin\n const { xCorr = 0, yCorr = 0 } = this, rotOriginX = (rotationOriginX ?? x) - xCorr - x - parentPadding, rotOriginY = (rotationOriginY ?? y) - yCorr - y - parentPadding, styles = {\n left: `${x + xCorr}px`,\n top: `${y + yCorr}px`,\n transformOrigin: `${rotOriginX}px ${rotOriginY}px`\n };\n css(element, styles);\n // Record current text transform\n this.cTT = currentTextTransform;\n this.oldRotation = rotation;\n this.oldAlign = textAlign;\n }\n }\n /**\n * Set the rotation of an individual HTML span.\n * @private\n */\n setSpanRotation(rotation, originX, originY) {\n // CSS transform and transform-origin both supported without prefix\n // since Firefox 16 (2012), IE 10 (2012), Chrome 36 (2014), Safari 9\n // (2015).;\n css(this.element, {\n transform: `rotate(${rotation}deg)`,\n transformOrigin: `${originX}% ${originY}px`\n });\n }\n /**\n * Add the element to a group wrapper. For HTML elements, a parallel div\n * will be created for each ancenstor SVG `g` element.\n *\n * @private\n */\n add(parentGroup) {\n const container = this.renderer.box\n .parentNode, parents = [];\n let div;\n this.parentGroup = parentGroup;\n // Create a parallel divs to hold the HTML elements\n if (parentGroup) {\n div = parentGroup.div;\n if (!div) {\n // Read the parent chain into an array and read from top\n // down\n let svgGroup = parentGroup;\n while (svgGroup) {\n parents.push(svgGroup);\n // Move up to the next parent group\n svgGroup = svgGroup.parentGroup;\n }\n // Decorate each of the ancestor group elements with a parallel\n // div that reflects translation and styling\n for (const parentGroup of parents.reverse()) {\n div = decorateSVGGroup(parentGroup, container);\n }\n }\n }\n (div || container).appendChild(this.element);\n this.added = true;\n if (this.alignOnAdd) {\n this.updateTransform();\n }\n return this;\n }\n /**\n * Text setter\n * @private\n */\n textSetter(value) {\n if (value !== this.textStr) {\n delete this.bBox;\n delete this.oldTextWidth;\n AST.setElementHTML(this.element, value ?? '');\n this.textStr = value;\n this.doTransform = true;\n }\n }\n /**\n * Align setter\n *\n * @private\n */\n alignSetter(value) {\n this.alignValue = this.textAlign = value;\n this.doTransform = true;\n }\n /**\n * Various setters which rely on update transform\n * @private\n */\n xSetter(value, key) {\n this[key] = value;\n this.doTransform = true;\n }\n}\n// Some shared setters\nconst proto = HTMLElement.prototype;\nproto.visibilitySetter = proto.opacitySetter = commonSetter;\nproto.ySetter =\n proto.rotationSetter =\n proto.rotationOriginXSetter =\n proto.rotationOriginYSetter = proto.xSetter;\n/* *\n *\n * Default Export\n *\n * */\nexport default HTMLElement;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Namespace\n *\n * */\nvar AxisDefaults;\n(function (AxisDefaults) {\n /* *\n *\n * Constants\n *\n * */\n /**\n * The X axis or category axis. Normally this is the horizontal axis,\n * though if the chart is inverted this is the vertical axis. In case of\n * multiple axes, the xAxis node is an array of configuration objects.\n *\n * See the [Axis class](/class-reference/Highcharts.Axis) for programmatic\n * access to the axis.\n *\n * @productdesc {highmaps}\n * In Highmaps, the axis is hidden, but it is used behind the scenes to\n * control features like zooming and panning. Zooming is in effect the same\n * as setting the extremes of one of the exes.\n *\n * @type {*|Array<*>}\n * @optionparent xAxis\n */\n AxisDefaults.xAxis = {\n /**\n * When using multiple axis, the ticks of two or more opposite axes\n * will automatically be aligned by adding ticks to the axis or axes\n * with the least ticks, as if `tickAmount` were specified.\n *\n * This can be prevented by setting `alignTicks` to false. If the grid\n * lines look messy, it's a good idea to hide them for the secondary\n * axis by setting `gridLineWidth` to 0.\n *\n * If `startOnTick` or `endOnTick` in an Axis options are set to false,\n * then the `alignTicks ` will be disabled for the Axis.\n *\n * Disabled for logarithmic axes.\n *\n * @product highcharts highstock gantt\n */\n alignTicks: true,\n /**\n * Whether to allow decimals in this axis' ticks. When counting\n * integers, like persons or hits on a web page, decimals should\n * be avoided in the labels. By default, decimals are allowed on small\n * scale axes.\n *\n * @see [minTickInterval](#xAxis.minTickInterval)\n *\n * @sample {highcharts|highstock} highcharts/yaxis/allowdecimals-true/\n * True by default\n * @sample {highcharts|highstock} highcharts/yaxis/allowdecimals-false/\n * False\n *\n * @type {boolean|undefined}\n * @default undefined\n * @since 2.0\n */\n allowDecimals: void 0,\n /**\n * When using an alternate grid color, a band is painted across the\n * plot area between every other grid line.\n *\n * @sample {highcharts} highcharts/yaxis/alternategridcolor/\n * Alternate grid color on the Y axis\n * @sample {highstock} stock/xaxis/alternategridcolor/\n * Alternate grid color on the Y axis\n *\n * @type {Highcharts.ColorType}\n * @apioption xAxis.alternateGridColor\n */\n /**\n * An array defining breaks in the axis, the sections defined will be\n * left out and all the points shifted closer to each other.\n *\n * @productdesc {highcharts}\n * Requires that the broken-axis.js module is loaded.\n *\n * @sample {highcharts} highcharts/axisbreak/break-simple/\n * Simple break\n * @sample {highcharts|highstock} highcharts/axisbreak/break-visualized/\n * Advanced with callback\n * @sample {highstock} stock/demo/intraday-breaks/\n * Break on nights and weekends\n *\n * @type {Array<*>}\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption xAxis.breaks\n */\n /**\n * A number indicating how much space should be left between the start\n * and the end of the break. The break size is given in axis units,\n * so for instance on a `datetime` axis, a break size of 3600000 would\n * indicate the equivalent of an hour.\n *\n * @type {number}\n * @default 0\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption xAxis.breaks.breakSize\n */\n /**\n * The point where the break starts.\n *\n * @type {number}\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption xAxis.breaks.from\n */\n /**\n * Defines an interval after which the break appears again. By default\n * the breaks do not repeat.\n *\n * @type {number}\n * @default 0\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption xAxis.breaks.repeat\n */\n /**\n * The point where the break ends.\n *\n * @type {number}\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption xAxis.breaks.to\n */\n /**\n * If categories are present for the xAxis, names are used instead of\n * numbers for that axis.\n *\n * Since Highcharts 3.0, categories can also\n * be extracted by giving each point a [name](#series.data) and setting\n * axis [type](#xAxis.type) to `category`. However, if you have multiple\n * series, best practice remains defining the `categories` array.\n *\n * Example: `categories: ['Apples', 'Bananas', 'Oranges']`\n *\n * @sample {highcharts} highcharts/demo/line-labels/\n * With\n * @sample {highcharts} highcharts/xaxis/categories/\n * Without\n *\n * @type {Array}\n * @product highcharts gantt\n * @apioption xAxis.categories\n */\n /**\n * The highest allowed value for automatically computed axis extremes.\n *\n * @see [floor](#xAxis.floor)\n *\n * @sample {highcharts|highstock} highcharts/yaxis/floor-ceiling/\n * Floor and ceiling\n *\n * @type {number}\n * @since 4.0\n * @product highcharts highstock gantt\n * @apioption xAxis.ceiling\n */\n /**\n * A class name that opens for styling the axis by CSS, especially in\n * Highcharts styled mode. The class name is applied to group elements\n * for the grid, axis elements and labels.\n *\n * @sample {highcharts|highstock|highmaps} highcharts/css/axis/\n * Multiple axes with separate styling\n *\n * @type {string}\n * @since 5.0.0\n * @apioption xAxis.className\n */\n /**\n * Configure a crosshair that follows either the mouse pointer or the\n * hovered point.\n *\n * In styled mode, the crosshairs are styled in the\n * `.highcharts-crosshair`, `.highcharts-crosshair-thin` or\n * `.highcharts-xaxis-category` classes.\n *\n * @productdesc {highstock}\n * In Highcharts stock, by default, the crosshair is enabled on the\n * X axis and disabled on the Y axis.\n *\n * @sample {highcharts} highcharts/xaxis/crosshair-both/\n * Crosshair on both axes\n * @sample {highstock} stock/xaxis/crosshairs-xy/\n * Crosshair on both axes, with y axis label\n * @sample {highmaps} highcharts/xaxis/crosshair-both/\n * Crosshair on both axes\n *\n * @declare Highcharts.AxisCrosshairOptions\n * @type {boolean|*}\n * @default false\n * @since 4.1\n * @apioption xAxis.crosshair\n */\n /**\n * The value on a perpendicular axis where this axis should cross. This\n * is typically used on mathematical plots where the axes cross at 0.\n * When `crossing` is set, space will not be reserved at the sides of\n * the chart for axis labels and title, so those may be clipped. In this\n * case it is better to place the axes without the `crossing` option.\n *\n * @type {number}\n * @sample highcharts/xaxis/crossing\n * Function plot with axes crossing at 0\n * @since 11.0.1\n * @apioption xAxis.crossing\n */\n /**\n * A class name for the crosshair, especially as a hook for styling.\n *\n * @type {string}\n * @since 5.0.0\n * @apioption xAxis.crosshair.className\n */\n /**\n * The color of the crosshair. Defaults to `#cccccc` for numeric and\n * datetime axes, and `rgba(204,214,235,0.25)` for category axes, where\n * the crosshair by default highlights the whole category.\n *\n * @sample {highcharts|highstock|highmaps} highcharts/xaxis/crosshair-customized/\n * Customized crosshairs\n *\n * @type {Highcharts.ColorType}\n * @default #cccccc\n * @since 4.1\n * @apioption xAxis.crosshair.color\n */\n /**\n * The dash style for the crosshair. See\n * [plotOptions.series.dashStyle](#plotOptions.series.dashStyle)\n * for possible values.\n *\n * @sample {highcharts|highmaps} highcharts/xaxis/crosshair-dotted/\n * Dotted crosshair\n * @sample {highstock} stock/xaxis/crosshair-dashed/\n * Dashed X axis crosshair\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 4.1\n * @apioption xAxis.crosshair.dashStyle\n */\n /**\n * A label on the axis next to the crosshair.\n *\n * In styled mode, the label is styled with the\n * `.highcharts-crosshair-label` class.\n *\n * @sample {highstock} stock/xaxis/crosshair-label/\n * Crosshair labels\n * @sample {highstock} highcharts/css/crosshair-label/\n * Style mode\n *\n * @declare Highcharts.AxisCrosshairLabelOptions\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label\n */\n /**\n * Alignment of the label compared to the axis. Defaults to `\"left\"` for\n * right-side axes, `\"right\"` for left-side axes and `\"center\"` for\n * horizontal axes.\n *\n * @type {Highcharts.AlignValue}\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.align\n */\n /**\n * The background color for the label. Defaults to the related series\n * color, or `#666666` if that is not available.\n *\n * @type {Highcharts.ColorType}\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.backgroundColor\n */\n /**\n * The border color for the crosshair label\n *\n * @type {Highcharts.ColorType}\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.borderColor\n */\n /**\n * The border corner radius of the crosshair label.\n *\n * @type {number}\n * @default 3\n * @since 2.1.10\n * @product highstock\n * @apioption xAxis.crosshair.label.borderRadius\n */\n /**\n * The border width for the crosshair label.\n *\n * @type {number}\n * @default 0\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.borderWidth\n */\n /**\n * Flag to enable crosshair's label.\n *\n * @sample {highstock} stock/xaxis/crosshairs-xy/\n * Enabled label for yAxis' crosshair\n *\n * @type {boolean}\n * @default false\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.enabled\n */\n /**\n * A format string for the crosshair label. Defaults to `{value}` for\n * numeric axes and `{value:%b %d, %Y}` for datetime axes.\n *\n * @type {string}\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.format\n */\n /**\n * Formatter function for the label text.\n *\n * @type {Highcharts.XAxisCrosshairLabelFormatterCallbackFunction}\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.formatter\n */\n /**\n * Padding inside the crosshair label.\n *\n * @type {number}\n * @default 8\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.padding\n */\n /**\n * The shape to use for the label box.\n *\n * @type {string}\n * @default callout\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.shape\n */\n /**\n * Text styles for the crosshair label.\n *\n * @type {Highcharts.CSSObject}\n * @default {\"color\": \"white\", \"fontWeight\": \"normal\", \"fontSize\": \"11px\", \"textAlign\": \"center\"}\n * @since 2.1\n * @product highstock\n * @apioption xAxis.crosshair.label.style\n */\n /**\n * Whether the crosshair should snap to the point or follow the pointer\n * independent of points.\n *\n * @sample {highcharts|highstock} highcharts/xaxis/crosshair-snap-false/\n * True by default\n * @sample {highmaps} maps/demo/latlon-advanced/\n * Snap is false\n *\n * @type {boolean}\n * @default true\n * @since 4.1\n * @apioption xAxis.crosshair.snap\n */\n /**\n * The pixel width of the crosshair. Defaults to 1 for numeric or\n * datetime axes, and for one category width for category axes.\n *\n * @sample {highcharts} highcharts/xaxis/crosshair-customized/\n * Customized crosshairs\n * @sample {highstock} highcharts/xaxis/crosshair-customized/\n * Customized crosshairs\n * @sample {highmaps} highcharts/xaxis/crosshair-customized/\n * Customized crosshairs\n *\n * @type {number}\n * @default 1\n * @since 4.1\n * @apioption xAxis.crosshair.width\n */\n /**\n * The Z index of the crosshair. Higher Z indices allow drawing the\n * crosshair on top of the series or behind the grid lines.\n *\n * @type {number}\n * @default 2\n * @since 4.1\n * @apioption xAxis.crosshair.zIndex\n */\n /**\n * Whether to pan axis. If `chart.panning` is enabled, the option\n * allows to disable panning on an individual axis.\n */\n panningEnabled: true,\n /**\n * The Z index for the axis group.\n *\n * @see [axis.gridZIndex](#xAxis.gridZIndex)\n * @see [axis.labels.zIndex](#xAxis.labels.zIndex)\n */\n zIndex: 2,\n /**\n * Whether to zoom axis. If `chart.zoomType` is set, the option allows\n * to disable zooming on an individual axis.\n *\n * @sample {highcharts} highcharts/xaxis/zoomenabled/\n * Zoom enabled is false\n */\n zoomEnabled: true,\n /**\n * For a datetime axis, the scale will automatically adjust to the\n * appropriate unit. This member gives the default string\n * representations used for each unit. For intermediate values,\n * different units may be used, for example the `day` unit can be used\n * on midnight and `hour` unit be used for intermediate values on the\n * same axis.\n *\n * For an overview of the replacement codes, see\n * [dateFormat](/class-reference/Highcharts.Time#dateFormat).\n *\n * Defaults to:\n * ```js\n * {\n * millisecond: '%H:%M:%S.%L',\n * second: '%H:%M:%S',\n * minute: '%H:%M',\n * hour: '%H:%M',\n * day: '%e. %b',\n * week: '%e. %b',\n * month: '%b \\'%y',\n * year: '%Y'\n * }\n * ```\n *\n * @sample {highcharts} highcharts/xaxis/datetimelabelformats/\n * Different day format on X axis\n * @sample {highstock} stock/xaxis/datetimelabelformats/\n * More information in x axis labels\n *\n * @declare Highcharts.AxisDateTimeLabelFormatsOptions\n * @product highcharts highstock gantt\n */\n dateTimeLabelFormats: {\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n millisecond: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.millisecond.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.millisecond.main\n */\n main: '%H:%M:%S.%L',\n range: false\n },\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n second: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.second.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.second.main\n */\n main: '%H:%M:%S',\n range: false\n },\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n minute: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.minute.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.minute.main\n */\n main: '%H:%M',\n range: false\n },\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n hour: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.hour.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.hour.main\n */\n main: '%H:%M',\n range: false\n },\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n day: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.day.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.day.main\n */\n main: '%e %b'\n },\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n week: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.week.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.week.main\n */\n main: '%e %b'\n },\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n month: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.month.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.month.main\n */\n main: '%b \\'%y'\n },\n /**\n * @declare Highcharts.AxisDateTimeLabelFormatsOptionsObject\n * @type {string|*}\n */\n year: {\n /**\n * @type {Array}\n * @default undefined\n * @apioption xAxis.dateTimeLabelFormats.year.list\n */\n /**\n * @apioption xAxis.dateTimeLabelFormats.year.main\n */\n main: '%Y'\n }\n },\n /**\n * Whether to force the axis to end on a tick. Use this option with\n * the `maxPadding` option to control the axis end.\n *\n * @productdesc {highstock}\n * In Highcharts Stock, `endOnTick` is always `false` when the navigator\n * is enabled, to prevent jumpy scrolling. With disabled navigator\n * enabling `endOnTick` may lead to extending the xAxis to show the last\n * tick, therefore range selector buttons may not have an active state\n * if the axis gets extended.\n *\n * @sample {highcharts} highcharts/yaxis/endontick/\n * True by default\n * @sample {highcharts} highcharts/yaxis/endontick-false/\n * False\n * @sample {highstock} stock/demo/basic-line/\n * True by default\n * @sample {highstock} stock/xaxis/endontick/\n * False\n *\n * @since 1.2.0\n */\n endOnTick: false,\n /**\n * Event handlers for the axis.\n *\n * @type {*}\n * @apioption xAxis.events\n */\n /**\n * An event fired after the breaks have rendered.\n *\n * @see [breaks](#xAxis.breaks)\n *\n * @sample {highcharts} highcharts/axisbreak/break-event/\n * AfterBreak Event\n *\n * @type {Highcharts.AxisEventCallbackFunction}\n * @since 4.1.0\n * @product highcharts gantt\n * @apioption xAxis.events.afterBreaks\n */\n /**\n * As opposed to the `setExtremes` event, this event fires after the\n * final min and max values are computed and corrected for `minRange`.\n *\n * Fires when the minimum and maximum is set for the axis, either by\n * calling the `.setExtremes()` method or by selecting an area in the\n * chart. One parameter, `event`, is passed to the function, containing\n * common event information.\n *\n * The new user set minimum and maximum values can be found by\n * `event.min` and `event.max`. These reflect the axis minimum and\n * maximum in axis values. The actual data extremes are found in\n * `event.dataMin` and `event.dataMax`.\n *\n * @type {Highcharts.AxisSetExtremesEventCallbackFunction}\n * @since 2.3\n * @context Highcharts.Axis\n * @apioption xAxis.events.afterSetExtremes\n */\n /**\n * An event fired when a break from this axis occurs on a point.\n *\n * @see [breaks](#xAxis.breaks)\n *\n * @sample {highcharts} highcharts/axisbreak/break-visualized/\n * Visualization of a Break\n *\n * @type {Highcharts.AxisPointBreakEventCallbackFunction}\n * @since 4.1.0\n * @product highcharts gantt\n * @context Highcharts.Axis\n * @apioption xAxis.events.pointBreak\n */\n /**\n * An event fired when a point falls inside a break from this axis.\n *\n * @type {Highcharts.AxisPointBreakEventCallbackFunction}\n * @product highcharts highstock gantt\n * @context Highcharts.Axis\n * @apioption xAxis.events.pointInBreak\n */\n /**\n * An event fired when a point is outside a break after zoom.\n *\n * @type {Highcharts.AxisPointBreakEventCallbackFunction}\n * @product highcharts highstock gantt\n * @context Highcharts.Axis\n * @apioption xAxis.events.pointBreakOut\n */\n /**\n * Fires when the minimum and maximum is set for the axis, either by\n * calling the `.setExtremes()` method or by selecting an area in the\n * chart. One parameter, `event`, is passed to the function,\n * containing common event information.\n *\n * The new user set minimum and maximum values can be found by\n * `event.min` and `event.max`. These reflect the axis minimum and\n * maximum in data values. When an axis is zoomed all the way out from\n * the \"Reset zoom\" button, `event.min` and `event.max` are null, and\n * the new extremes are set based on `this.dataMin` and `this.dataMax`.\n *\n * @sample {highstock} stock/xaxis/events-setextremes/\n * Log new extremes on x axis\n *\n * @type {Highcharts.AxisSetExtremesEventCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Axis\n * @apioption xAxis.events.setExtremes\n */\n /**\n * The lowest allowed value for automatically computed axis extremes.\n *\n * @see [ceiling](#yAxis.ceiling)\n *\n * @sample {highcharts} highcharts/yaxis/floor-ceiling/\n * Floor and ceiling\n * @sample {highstock} stock/demo/lazy-loading/\n * Prevent negative stock price on Y axis\n *\n * @type {number}\n * @since 4.0\n * @product highcharts highstock gantt\n * @apioption xAxis.floor\n */\n /**\n * The dash or dot style of the grid lines. For possible values, see\n * [this demonstration](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/).\n *\n * @sample {highcharts} highcharts/yaxis/gridlinedashstyle/\n * Long dashes\n * @sample {highstock} stock/xaxis/gridlinedashstyle/\n * Long dashes\n *\n * @type {Highcharts.DashStyleValue}\n * @since 1.2\n */\n gridLineDashStyle: 'Solid',\n /**\n * The Z index of the grid lines.\n *\n * @sample {highcharts|highstock} highcharts/xaxis/gridzindex/\n * A Z index of 4 renders the grid above the graph\n *\n * @product highcharts highstock gantt\n *\n * @see [axis.zIndex](#xAxis.zIndex)\n * @see [axis.labels.zIndex](#xAxis.labels.zIndex)\n */\n gridZIndex: 1,\n /**\n * An id for the axis. This can be used after render time to get\n * a pointer to the axis object through `chart.get()`.\n *\n * @sample {highcharts} highcharts/xaxis/id/\n * Get the object\n * @sample {highstock} stock/xaxis/id/\n * Get the object\n *\n * @type {string}\n * @since 1.2.0\n * @apioption xAxis.id\n */\n /**\n * The axis labels show the number or category for each tick.\n *\n * Since v8.0.0: Labels are animated in categorized x-axis with\n * updating data if `tickInterval` and `step` is set to 1.\n *\n * @productdesc {highmaps}\n * X and Y axis labels are by default disabled in Highmaps, but the\n * functionality is inherited from Highcharts and used on `colorAxis`,\n * and can be enabled on X and Y axes too.\n */\n labels: {\n /**\n * What part of the string the given position is anchored to.\n * If `left`, the left side of the string is at the axis position.\n * Can be one of `\"left\"`, `\"center\"` or `\"right\"`. Defaults to\n * an intelligent guess based on which side of the chart the axis\n * is on and the rotation of the label.\n *\n * @see [reserveSpace](#xAxis.labels.reserveSpace)\n *\n * @sample {highcharts} highcharts/xaxis/labels-align-left/\n * Left\n * @sample {highcharts} highcharts/xaxis/labels-align-right/\n * Right\n * @sample {highcharts} highcharts/xaxis/labels-reservespace-true/\n * Left-aligned labels on a vertical category axis\n *\n * @type {Highcharts.AlignValue}\n * @apioption xAxis.labels.align\n */\n /**\n * Whether to allow the axis labels to overlap. When false,\n * overlapping labels are hidden.\n *\n * @sample {highcharts} highcharts/xaxis/labels-allowoverlap-true/\n * X axis labels overlap enabled\n *\n * @type {boolean}\n * @default false\n * @apioption xAxis.labels.allowOverlap\n */\n /**\n * For horizontal axes, the allowed degrees of label rotation\n * to prevent overlapping labels. If there is enough space,\n * labels are not rotated. As the chart gets narrower, it\n * will start rotating the labels -45 degrees, then remove\n * every second label and try again with rotations 0 and -45 etc.\n * Set it to `undefined` to disable rotation, which will\n * cause the labels to word-wrap if possible. Defaults to `[-45]``\n * on bottom and top axes, `undefined` on left and right axes.\n *\n * @sample {highcharts|highstock} highcharts/xaxis/labels-autorotation-default/\n * Default auto rotation of 0 or -45\n * @sample {highcharts|highstock} highcharts/xaxis/labels-autorotation-0-90/\n * Custom graded auto rotation\n *\n * @type {Array}\n * @default undefined\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption xAxis.labels.autoRotation\n */\n /**\n * When each category width is more than this many pixels, we don't\n * apply auto rotation. Instead, we lay out the axis label with word\n * wrap. A lower limit makes sense when the label contains multiple\n * short words that don't extend the available horizontal space for\n * each label.\n *\n * @sample {highcharts} highcharts/xaxis/labels-autorotationlimit/\n * Lower limit\n *\n * @since 4.1.5\n * @product highcharts gantt\n */\n autoRotationLimit: 80,\n /**\n * The label's pixel distance from the perimeter of the plot area.\n * On cartesian charts, this is overridden if the `labels.y` setting\n * is set.\n *\n * @sample {highcharts} highcharts/yaxis/labels-distance/\n * Polar chart, labels centered under the arc\n *\n * @type {number}\n * @product highcharts gantt\n */\n distance: 15,\n /**\n * Enable or disable the axis labels.\n *\n * @sample {highcharts} highcharts/xaxis/labels-enabled/\n * X axis labels disabled\n * @sample {highstock} stock/xaxis/labels-enabled/\n * X axis labels disabled\n *\n */\n enabled: true,\n /**\n * A format string for the axis label. The context is available as\n * format string variables. For example, you can use `{text}` to\n * insert the default formatted text. The recommended way of adding\n * units for the label is using `text`, for example `{text} km`.\n *\n * To add custom numeric or datetime formatting, use `{value}` with\n * formatting, for example `{value:.1f}` or `{value:%Y-%m-%d}`.\n *\n * See\n * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)\n * for more examples of formatting.\n *\n * The default value is not specified due to the dynamic\n * nature of the default implementation.\n *\n * @sample {highcharts|highstock} highcharts/yaxis/labels-format/\n * Add units to Y axis label\n * @sample {highcharts} highcharts/xaxis/labels-format-linked/\n * Linked category names\n * @sample {highcharts} highcharts/xaxis/labels-format-custom/\n * Custom number format\n *\n * @type {string}\n * @since 3.0\n * @apioption xAxis.labels.format\n */\n /**\n * Callback JavaScript function to format the label. The value\n * is given by `this.value`. Additional properties for `this` are\n * `axis`, `chart`, `isFirst`, `isLast` and `text` which holds the\n * value of the default formatter.\n *\n * Defaults to a built in function returning a formatted string\n * depending on whether the axis is `category`, `datetime`,\n * `numeric` or other.\n *\n * @sample {highcharts} highcharts/xaxis/labels-formatter-linked/\n * Linked category names\n * @sample {highcharts} highcharts/xaxis/labels-formatter-extended/\n * Modified numeric labels\n * @sample {highstock} stock/xaxis/labels-formatter/\n * Added units on Y axis\n *\n * @type {Highcharts.AxisLabelsFormatterCallbackFunction}\n * @apioption xAxis.labels.formatter\n */\n /**\n * The number of pixels to indent the labels per level in a treegrid\n * axis.\n *\n * @sample gantt/treegrid-axis/demo\n * Indentation 10px by default.\n * @sample gantt/treegrid-axis/indentation-0px\n * Indentation set to 0px.\n *\n * @product gantt\n */\n indentation: 10,\n /**\n * Horizontal axis only. When `staggerLines` is not set,\n * `maxStaggerLines` defines how many lines the axis is allowed to\n * add to automatically avoid overlapping X labels. Set to `1` to\n * disable overlap detection.\n *\n * @deprecated\n * @type {number}\n * @default 5\n * @since 1.3.3\n * @apioption xAxis.labels.maxStaggerLines\n */\n /**\n * How to handle overflowing labels on horizontal axis. If set to\n * `\"allow\"`, it will not be aligned at all. By default it\n * `\"justify\"` labels inside the chart area. If there is room to\n * move it, it will be aligned to the edge, else it will be removed.\n *\n * @since 2.2.5\n * @validvalue [\"allow\", \"justify\"]\n */\n overflow: 'justify',\n /**\n * The pixel padding for axis labels, to ensure white space between\n * them.\n *\n * @product highcharts gantt\n */\n padding: 5,\n /**\n * Whether to reserve space for the labels. By default, space is\n * reserved for the labels in these cases:\n *\n * * On all horizontal axes.\n * * On vertical axes if `label.align` is `right` on a left-side\n * axis or `left` on a right-side axis.\n * * On vertical axes if `label.align` is `center`.\n *\n * This can be turned off when for example the labels are rendered\n * inside the plot area instead of outside.\n *\n * @see [labels.align](#xAxis.labels.align)\n *\n * @sample {highcharts} highcharts/xaxis/labels-reservespace/\n * No reserved space, labels inside plot\n * @sample {highcharts} highcharts/xaxis/labels-reservespace-true/\n * Left-aligned labels on a vertical category axis\n *\n * @type {boolean}\n * @since 4.1.10\n * @product highcharts highstock gantt\n * @apioption xAxis.labels.reserveSpace\n */\n reserveSpace: void 0,\n /**\n * Rotation of the labels in degrees. When `undefined`, the\n * `autoRotation` option takes precedence.\n *\n * @sample {highcharts} highcharts/xaxis/labels-rotation/\n * X axis labels rotated 90\u00B0\n *\n * @type {number}\n * @default 0\n * @apioption xAxis.labels.rotation\n */\n rotation: void 0,\n /**\n * Horizontal axes only. The number of lines to spread the labels\n * over to make room or tighter labels. 0 disables staggering.\n *\n * @sample {highcharts} highcharts/xaxis/labels-staggerlines/\n * Show labels over two lines\n * @sample {highstock} stock/xaxis/labels-staggerlines/\n * Show labels over two lines\n *\n * @since 2.1\n */\n staggerLines: 0,\n /**\n * To show only every _n_'th label on the axis, set the step to _n_.\n * Setting the step to 2 shows every other label.\n *\n * By default, when 0, the step is calculated automatically to avoid\n * overlap. To prevent this, set it to 1\\. This usually only\n * happens on a category axis, and is often a sign that you have\n * chosen the wrong axis type.\n *\n * Read more at\n * [Axis docs](https://www.highcharts.com/docs/chart-concepts/axes)\n * => What axis should I use?\n *\n * @sample {highcharts} highcharts/xaxis/labels-step/\n * Showing only every other axis label on a categorized\n * x-axis\n * @sample {highcharts} highcharts/xaxis/labels-step-auto/\n * Auto steps on a category axis\n *\n * @since 2.1\n */\n step: 0,\n /**\n * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the labels.\n */\n useHTML: false,\n /**\n * The x position offset of all labels relative to the tick\n * positions on the axis. Overrides the `labels.distance` option.\n *\n * @type {number}\n * @apioption xAxis.labels.x\n */\n /**\n * The y position offset of all labels relative to the tick\n * positions on the axis. Overrides the `labels.distance` option.\n *\n * @sample {highcharts} highcharts/xaxis/labels-x/\n * X axis labels placed on grid lines\n *\n * @type {number}\n * @apioption xAxis.labels.y\n */\n /**\n * The Z index for the axis labels.\n *\n * @see [axis.zIndex](#xAxis.zIndex)\n * @see [axis.gridZIndex](#xAxis.gridZIndex)\n */\n zIndex: 7,\n /**\n * CSS styles for the label. Use `whiteSpace: 'nowrap'` to prevent\n * wrapping of category labels. Use `textOverflow: 'none'` to\n * prevent ellipsis (dots).\n *\n * In styled mode, the labels are styled with the\n * `.highcharts-axis-labels` class.\n *\n * @sample {highcharts} highcharts/xaxis/labels-style/\n * Red X axis labels\n *\n * @type {Highcharts.CSSObject}\n */\n style: {\n /** @internal */\n color: \"#333333\" /* Palette.neutralColor80 */,\n /** @internal */\n cursor: 'default',\n /** @internal */\n fontSize: '0.8em'\n }\n },\n /**\n * The left position as the horizontal axis. If it's a number, it is\n * interpreted as pixel position relative to the chart.\n *\n * Since Highcharts v5.0.13: If it's a percentage string, it is\n * interpreted as percentages of the plot width, offset from plot area\n * left.\n *\n * @sample {highcharts} highcharts/xaxis/axis-position-properties\n * Different axis position properties\n *\n * @type {number|string}\n * @product highcharts highstock\n * @apioption xAxis.left\n */\n /**\n * The top position as the vertical axis. If it's a number, it is\n * interpreted as pixel position relative to the chart.\n *\n * Since Highcharts 2: If it's a percentage string, it is interpreted\n * as percentages of the plot height, offset from plot area top.\n *\n * @sample {highcharts} highcharts/xaxis/axis-position-properties\n * Different axis position properties\n *\n * @type {number|string}\n * @product highcharts highstock\n * @apioption xAxis.top\n */\n /**\n * Index of another axis that this axis is linked to. When an axis is\n * linked to a master axis, it will take the same extremes as\n * the master, but as assigned by min or max or by setExtremes.\n * It can be used to show additional info, or to ease reading the\n * chart by duplicating the scales.\n *\n * @sample {highcharts} highcharts/xaxis/linkedto/\n * Different string formats of the same date\n * @sample {highcharts} highcharts/yaxis/linkedto/\n * Y values on both sides\n *\n * @type {number}\n * @since 2.0.2\n * @product highcharts highstock gantt\n * @apioption xAxis.linkedTo\n */\n /**\n * The maximum value of the axis. If `null`, the max value is\n * automatically calculated.\n *\n * If the [endOnTick](#yAxis.endOnTick) option is true, the `max` value\n * might be rounded up.\n *\n * If a [tickAmount](#yAxis.tickAmount) is set, the axis may be extended\n * beyond the set max in order to reach the given number of ticks. The\n * same may happen in a chart with multiple axes, determined by [chart.\n * alignTicks](#chart), where a `tickAmount` is applied internally.\n *\n * @sample {highcharts} highcharts/yaxis/max-200/\n * Y axis max of 200\n * @sample {highcharts} highcharts/yaxis/max-logarithmic/\n * Y axis max on logarithmic axis\n * @sample {highstock} stock/xaxis/min-max/\n * Fixed min and max on X axis\n *\n * @type {number|null}\n * @apioption xAxis.max\n */\n /**\n * Padding of the max value relative to the length of the axis. A\n * padding of 0.05 will make a 100px axis 5px longer. This is useful\n * when you don't want the highest data value to appear on the edge\n * of the plot area. When the axis' `max` option is set or a max extreme\n * is set using `axis.setExtremes()`, the maxPadding will be ignored.\n *\n * @productdesc {highstock}\n * For an [ordinal](#xAxis.ordinal) axis, `minPadding` and `maxPadding`\n * are ignored. Use [overscroll](#xAxis.overscroll) instead.\n *\n * @sample {highcharts} highcharts/yaxis/maxpadding/\n * Max padding of 0.25 on y axis\n * @sample {highstock} stock/xaxis/minpadding-maxpadding/\n * Greater min- and maxPadding\n * @sample {highmaps} maps/chart/plotbackgroundcolor-gradient/\n * Add some padding\n *\n * @default {highcharts} 0.01\n * @default {highstock|highmaps} 0\n * @since 1.2.0\n */\n maxPadding: 0.01,\n /**\n * Deprecated. Use `minRange` instead.\n *\n * @deprecated\n * @type {number}\n * @product highcharts highstock\n * @apioption xAxis.maxZoom\n */\n /**\n * The minimum value of the axis. If `null` the min value is\n * automatically calculated.\n *\n * If the [startOnTick](#yAxis.startOnTick) option is true (default),\n * the `min` value might be rounded down.\n *\n * The automatically calculated minimum value is also affected by\n * [floor](#yAxis.floor), [softMin](#yAxis.softMin),\n * [minPadding](#yAxis.minPadding), [minRange](#yAxis.minRange)\n * as well as [series.threshold](#plotOptions.series.threshold)\n * and [series.softThreshold](#plotOptions.series.softThreshold).\n *\n * @sample {highcharts} highcharts/yaxis/min-startontick-false/\n * -50 with startOnTick to false\n * @sample {highcharts} highcharts/yaxis/min-startontick-true/\n * -50 with startOnTick true by default\n * @sample {highstock} stock/xaxis/min-max/\n * Set min and max on X axis\n *\n * @type {number|null}\n * @apioption xAxis.min\n */\n /**\n * The dash or dot style of the minor grid lines. For possible values,\n * see [this demonstration](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/).\n *\n * @sample {highcharts} highcharts/yaxis/minorgridlinedashstyle/\n * Long dashes on minor grid lines\n * @sample {highstock} stock/xaxis/minorgridlinedashstyle/\n * Long dashes on minor grid lines\n *\n * @type {Highcharts.DashStyleValue}\n * @since 1.2\n */\n minorGridLineDashStyle: 'Solid',\n /**\n * Specific tick interval in axis units for the minor ticks. On a linear\n * axis, if `\"auto\"`, the minor tick interval is calculated as a fifth\n * of the tickInterval. If `undefined`, minor ticks are not shown.\n *\n * On logarithmic axes, the unit is the power of the value. For example,\n * setting the minorTickInterval to 1 puts one tick on each of 0.1, 1,\n * 10, 100 etc. Setting the minorTickInterval to 0.1 produces 9 ticks\n * between 1 and 10, 10 and 100 etc.\n *\n * If user settings dictate minor ticks to become too dense, they don't\n * make sense, and will be ignored to prevent performance problems.\n *\n * @sample {highcharts} highcharts/yaxis/minortickinterval-null/\n * Undefined by default\n * @sample {highcharts} highcharts/yaxis/minortickinterval-5/ 5 units\n * @sample {highcharts} highcharts/yaxis/minortickinterval-log-auto/\n * \"auto\"\n * @sample {highcharts} highcharts/yaxis/minortickinterval-log/ 0.1\n * @sample {highstock} stock/demo/basic-line/ Null by default\n * @sample {highstock} stock/xaxis/minortickinterval-auto/ \"auto\"\n *\n * @type {number|'auto'}\n * @apioption xAxis.minorTickInterval\n */\n /**\n * The pixel length of the minor tick marks.\n *\n * @sample {highcharts} highcharts/yaxis/minorticklength/\n * 10px on Y axis\n * @sample {highstock} stock/xaxis/minorticks/\n * 10px on Y axis\n */\n minorTickLength: 2,\n /**\n * The position of the minor tick marks relative to the axis line.\n * Can be one of `inside` and `outside`.\n *\n * @sample {highcharts} highcharts/yaxis/minortickposition-outside/\n * Outside by default\n * @sample {highcharts} highcharts/yaxis/minortickposition-inside/\n * Inside\n * @sample {highstock} stock/xaxis/minorticks/\n * Inside\n *\n * @validvalue [\"inside\", \"outside\"]\n */\n minorTickPosition: 'outside',\n /**\n * Enable or disable minor ticks. The interval between the minor ticks\n * can be controlled either by the\n * [minorTicksPerMajor](#xAxis.minorTicksPerMajor) setting, or as an\n * absolute [minorTickInterval](#xAxis.minorTickInterval) value.\n *\n * On a logarithmic axis, minor ticks are laid out based on a best\n * guess, attempting to enter an approximate number of minor ticks\n * between each major tick based on\n * [minorTicksPerMajor](#xAxis.minorTicksPerMajor).\n *\n * Prior to v6.0.0, ticks were enabled in auto layout by setting\n * `minorTickInterval` to `\"auto\"`.\n *\n * @productdesc {highcharts} On axes using\n * [categories](#xAxis.categories), minor ticks are not supported.\n *\n * @sample {highcharts} highcharts/yaxis/minorticks-true/ Enabled on\n * linear Y axis\n *\n * @type {boolean}\n * @default false\n * @since 6.0.0\n * @apioption xAxis.minorTicks\n */\n /**\n * The number of minor ticks per major tick. Works for `linear`,\n * `logarithmic` and `datetime` axes.\n *\n * @sample {highcharts} highcharts/yaxis/minortickspermajor/\n * 2 minor ticks per major tick on Y axis\n *\n * @since 11.0.0\n *\n * @type {number}\n */\n minorTicksPerMajor: 5,\n /**\n * The pixel width of the minor tick mark.\n *\n * @sample {highcharts} highcharts/yaxis/minortickwidth/\n * 3px width\n * @sample {highstock} stock/xaxis/minorticks/\n * 1px width\n *\n * @type {number}\n * @default 0\n * @apioption xAxis.minorTickWidth\n */\n /**\n * Padding of the min value relative to the length of the axis. A\n * padding of 0.05 will make a 100px axis 5px longer. This is useful\n * when you don't want the lowest data value to appear on the edge\n * of the plot area. When the axis' `min` option is set or a min extreme\n * is set using `axis.setExtremes()`, the minPadding will be ignored.\n *\n * @productdesc {highstock}\n * For an [ordinal](#xAxis.ordinal) axis, `minPadding` and `maxPadding`\n * are ignored. Use [overscroll](#xAxis.overscroll) instead.\n *\n * @sample {highcharts} highcharts/yaxis/minpadding/\n * Min padding of 0.2\n * @sample {highstock} stock/xaxis/minpadding-maxpadding/\n * Greater min- and maxPadding\n * @sample {highmaps} maps/chart/plotbackgroundcolor-gradient/\n * Add some padding\n *\n * @default {highcharts} 0.01\n * @default {highstock|highmaps} 0\n * @since 1.2.0\n * @product highcharts highstock gantt\n */\n minPadding: 0.01,\n /**\n * The minimum range to display on this axis. The entire axis will not\n * be allowed to span over a smaller interval than this. For example,\n * for a datetime axis the main unit is milliseconds. If minRange is\n * set to 3600000, you can't zoom in more than to one hour.\n *\n * The default minRange for the x axis is five times the smallest\n * interval between any of the data points.\n *\n * On a logarithmic axis, the unit for the minimum range is the power.\n * So a minRange of 1 means that the axis can be zoomed to 10-100,\n * 100-1000, 1000-10000 etc.\n *\n * **Note**: The `minPadding`, `maxPadding`, `startOnTick` and\n * `endOnTick` settings also affect how the extremes of the axis\n * are computed.\n *\n * @sample {highcharts} highcharts/xaxis/minrange/\n * Minimum range of 5\n * @sample {highstock} stock/xaxis/minrange/\n * Max zoom of 6 months overrides user selections\n *\n * @type {number}\n * @apioption xAxis.minRange\n */\n /**\n * The minimum tick interval allowed in axis values. For example on\n * zooming in on an axis with daily data, this can be used to prevent\n * the axis from showing hours. Defaults to the closest distance between\n * two points on the axis.\n *\n * @type {number}\n * @since 2.3.0\n * @apioption xAxis.minTickInterval\n */\n /**\n * The distance in pixels from the plot area to the axis line.\n * A positive offset moves the axis with it's line, labels and ticks\n * away from the plot area. This is typically used when two or more\n * axes are displayed on the same side of the plot. With multiple\n * axes the offset is dynamically adjusted to avoid collision, this\n * can be overridden by setting offset explicitly.\n *\n * @sample {highcharts} highcharts/yaxis/offset/\n * Y axis offset of 70\n * @sample {highcharts} highcharts/yaxis/offset-centered/\n * Axes positioned in the center of the plot\n * @sample {highstock} stock/xaxis/offset/\n * Y axis offset by 70 px\n *\n * @type {number}\n */\n offset: void 0,\n /**\n * Whether to display the axis on the opposite side of the normal. The\n * normal is on the left side for vertical axes and bottom for\n * horizontal, so the opposite sides will be right and top respectively.\n * This is typically used with dual or multiple axes.\n *\n * @sample {highcharts} highcharts/yaxis/opposite/\n * Secondary Y axis opposite\n * @sample {highstock} stock/xaxis/opposite/\n * Y axis on left side\n *\n * @default {highcharts|highstock|highmaps} false\n * @default {gantt} true\n * @type Boolean\n * @apioption xAxis.opposite\n */\n /**\n * In an ordinal axis, the points are equally spaced in the chart\n * regardless of the actual time or x distance between them. This means\n * that missing data periods (e.g. nights or weekends for a stock chart)\n * will not take up space in the chart.\n * Having `ordinal: false` will show any gaps created by the `gapSize`\n * setting proportionate to their duration.\n *\n * In stock charts the X axis is ordinal by default, unless\n * the boost module is used and at least one of the series' data length\n * exceeds the [boostThreshold](#series.line.boostThreshold).\n *\n * For an ordinal axis, `minPadding` and `maxPadding` are ignored. Use\n * [overscroll](#xAxis.overscroll) instead.\n *\n * @sample {highstock} stock/xaxis/ordinal-true/\n * True by default\n * @sample {highstock} stock/xaxis/ordinal-false/\n * False\n *\n * @see [overscroll](#xAxis.overscroll)\n *\n * @type {boolean}\n * @default true\n * @since 1.1\n * @product highstock\n * @apioption xAxis.ordinal\n */\n /**\n * Additional range on the right side of the xAxis. Works similar to\n * `xAxis.maxPadding`, but the value is set in terms of axis values,\n * percentage or pixels.\n *\n * If it's a number, it is interpreted as axis values, which in a\n * datetime axis equals milliseconds.\n *\n * If it's a percentage string, is interpreted as percentages of axis\n * length. An overscroll of 50% will make a 100px axis 50px longer.\n *\n * If it's a pixel string, it is interpreted as a fixed pixel value, but\n * limited to 90% of the axis length.\n *\n * @sample {highstock} stock/xaxis/overscroll/ One minute overscroll\n * with live data\n * @sample {highstock} stock/xaxis/overscroll-percent/ Overscroll set in\n * percentage\n * @sample {highstock} stock/xaxis/overscroll-pixel/ Overscroll set in\n * pixels\n *\n * @type {number | string}\n * @default 0\n * @since 6.0.0\n * @product highstock\n * @apioption xAxis.overscroll\n */\n /**\n * Refers to the index in the [panes](#panes) array. Used for circular\n * gauges and polar charts. When the option is not set then first pane\n * will be used.\n *\n * @sample highcharts/demo/gauge-vu-meter\n * Two gauges with different center\n *\n * @type {number}\n * @product highcharts\n * @apioption xAxis.pane\n */\n /**\n * The zoomed range to display when only defining one or none of `min`\n * or `max`. For example, to show the latest month, a range of one month\n * can be set.\n *\n * @sample {highstock} stock/xaxis/range/\n * Setting a zoomed range when the rangeSelector is disabled\n *\n * @type {number}\n * @product highstock\n * @apioption xAxis.range\n */\n /**\n * Whether to reverse the axis so that the highest number is closest\n * to the origin. If the chart is inverted, the x axis is reversed by\n * default.\n *\n * @sample {highcharts} highcharts/yaxis/reversed/\n * Reversed Y axis\n * @sample {highstock} stock/xaxis/reversed/\n * Reversed Y axis\n *\n * @type {boolean}\n * @default undefined\n * @apioption xAxis.reversed\n */\n reversed: void 0,\n /**\n * This option determines how stacks should be ordered within a group.\n * For example reversed xAxis also reverses stacks, so first series\n * comes last in a group. To keep order like for non-reversed xAxis\n * enable this option.\n *\n * @sample {highcharts} highcharts/xaxis/reversedstacks/\n * Reversed stacks comparison\n * @sample {highstock} highcharts/xaxis/reversedstacks/\n * Reversed stacks comparison\n *\n * @since 6.1.1\n * @product highcharts highstock\n */\n reversedStacks: false,\n /**\n * An optional scrollbar to display on the X axis in response to\n * limiting the minimum and maximum of the axis values.\n *\n * In styled mode, all the presentational options for the scrollbar are\n * replaced by the classes `.highcharts-scrollbar-thumb`,\n * `.highcharts-scrollbar-arrow`, `.highcharts-scrollbar-button`,\n * `.highcharts-scrollbar-rifles` and `.highcharts-scrollbar-track`.\n *\n * @sample {highstock} stock/yaxis/heatmap-scrollbars/\n * Heatmap with both scrollbars\n *\n * @extends scrollbar\n * @since 4.2.6\n * @product highstock\n * @apioption xAxis.scrollbar\n */\n /**\n * Whether to show the axis line and title when the axis has no data.\n *\n * @sample {highcharts} highcharts/yaxis/showempty/\n * When clicking the legend to hide series, one axis preserves\n * line and title, the other doesn't\n * @sample {highstock} highcharts/yaxis/showempty/\n * When clicking the legend to hide series, one axis preserves\n * line and title, the other doesn't\n *\n * @since 1.1\n */\n showEmpty: true,\n /**\n * Whether to show the first tick label.\n *\n * @sample {highcharts} highcharts/xaxis/showfirstlabel-false/\n * Set to false on X axis\n * @sample {highstock} stock/xaxis/showfirstlabel/\n * Labels below plot lines on Y axis\n */\n showFirstLabel: true,\n /**\n * Whether to show the last tick label. Defaults to `true` on cartesian\n * charts, and `false` on polar charts.\n *\n * @sample {highcharts} highcharts/xaxis/showlastlabel-true/\n * Set to true on X axis\n * @sample {highstock} stock/xaxis/showfirstlabel/\n * Labels below plot lines on Y axis\n *\n * @type {boolean}\n * @default undefined\n * @product highcharts highstock gantt\n */\n showLastLabel: true,\n /**\n * A soft maximum for the axis. If the series data maximum is less than\n * this, the axis will stay at this maximum, but if the series data\n * maximum is higher, the axis will flex to show all data.\n *\n * @sample highcharts/yaxis/softmin-softmax/\n * Soft min and max\n *\n * @type {number}\n * @since 5.0.1\n * @product highcharts highstock gantt\n * @apioption xAxis.softMax\n */\n /**\n * A soft minimum for the axis. If the series data minimum is greater\n * than this, the axis will stay at this minimum, but if the series\n * data minimum is lower, the axis will flex to show all data.\n *\n * @sample highcharts/yaxis/softmin-softmax/\n * Soft min and max\n *\n * @type {number}\n * @since 5.0.1\n * @product highcharts highstock gantt\n * @apioption xAxis.softMin\n */\n /**\n * For datetime axes, this decides where to put the tick between weeks.\n * 0 = Sunday, 1 = Monday.\n *\n * @sample {highcharts} highcharts/xaxis/startofweek-monday/\n * Monday by default\n * @sample {highcharts} highcharts/xaxis/startofweek-sunday/\n * Sunday\n * @sample {highstock} stock/xaxis/startofweek-1\n * Monday by default\n * @sample {highstock} stock/xaxis/startofweek-0\n * Sunday\n *\n * @product highcharts highstock gantt\n */\n startOfWeek: 1,\n /**\n * Whether to force the axis to start on a tick. Use this option with\n * the `minPadding` option to control the axis start.\n *\n * @productdesc {highstock}\n * In Highcharts Stock, `startOnTick` is always `false` when\n * the navigator is enabled, to prevent jumpy scrolling.\n *\n * @sample {highcharts} highcharts/xaxis/startontick-false/\n * False by default\n * @sample {highcharts} highcharts/xaxis/startontick-true/\n * True\n *\n * @since 1.2.0\n */\n startOnTick: false,\n /**\n * The amount of ticks to draw on the axis. This opens up for aligning\n * the ticks of multiple charts or panes within a chart. This option\n * overrides the `tickPixelInterval` option.\n *\n * This option only has an effect on linear axes. Datetime, logarithmic\n * or category axes are not affected.\n *\n * @sample {highcharts} highcharts/yaxis/tickamount/\n * 8 ticks on Y axis\n * @sample {highstock} highcharts/yaxis/tickamount/\n * 8 ticks on Y axis\n *\n * @type {number}\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption xAxis.tickAmount\n */\n /**\n * The interval of the tick marks in axis units. When `undefined`, the\n * tick interval is computed to approximately follow the\n * [tickPixelInterval](#xAxis.tickPixelInterval) on linear and datetime\n * axes. On categorized axes, a `undefined` tickInterval will default to\n * 1, one category. Note that datetime axes are based on milliseconds,\n * so for example an interval of one day is expressed as\n * `24 * 3600 * 1000`.\n *\n * On logarithmic axes, the tickInterval is based on powers, so a\n * tickInterval of 1 means one tick on each of 0.1, 1, 10, 100 etc. A\n * tickInterval of 2 means a tick of 0.1, 10, 1000 etc. A tickInterval\n * of 0.2 puts a tick on 0.1, 0.2, 0.4, 0.6, 0.8, 1, 2, 4, 6, 8, 10, 20,\n * 40 etc.\n *\n *\n * If the tickInterval is too dense for labels to be drawn, Highcharts\n * may remove ticks.\n *\n * If the chart has multiple axes, the [alignTicks](#chart.alignTicks)\n * option may interfere with the `tickInterval` setting.\n *\n * @see [tickPixelInterval](#xAxis.tickPixelInterval)\n * @see [tickPositions](#xAxis.tickPositions)\n * @see [tickPositioner](#xAxis.tickPositioner)\n *\n * @sample {highcharts} highcharts/xaxis/tickinterval-5/\n * Tick interval of 5 on a linear axis\n * @sample {highstock} stock/xaxis/tickinterval/\n * Tick interval of 0.01 on Y axis\n *\n * @type {number}\n * @apioption xAxis.tickInterval\n */\n /**\n * The pixel length of the main tick marks.\n *\n * @sample {highcharts} highcharts/xaxis/ticklength/\n * 20 px tick length on the X axis\n * @sample {highstock} stock/xaxis/ticks/\n * Formatted ticks on X axis\n */\n tickLength: 10,\n /**\n * If tickInterval is `null` this option sets the approximate pixel\n * interval of the tick marks. Not applicable to categorized axis.\n *\n * The tick interval is also influenced by the [minTickInterval](\n * #xAxis.minTickInterval) option, that, by default prevents ticks from\n * being denser than the data points.\n *\n * @see [tickInterval](#xAxis.tickInterval)\n * @see [tickPositioner](#xAxis.tickPositioner)\n * @see [tickPositions](#xAxis.tickPositions)\n *\n * @sample {highcharts} highcharts/xaxis/tickpixelinterval-50/\n * 50 px on X axis\n * @sample {highstock} stock/xaxis/tickpixelinterval/\n * 200 px on X axis\n */\n tickPixelInterval: 100,\n /**\n * For categorized axes only. If `on` the tick mark is placed in the\n * center of the category, if `between` the tick mark is placed between\n * categories. The default is `between` if the `tickInterval` is 1, else\n * `on`. In order to render tick marks on a category axis it is necessary\n * to provide a [tickWidth](#xAxis.tickWidth).\n *\n * @sample {highcharts} highcharts/xaxis/tickmarkplacement-between/\n * \"between\" by default\n * @sample {highcharts} highcharts/xaxis/tickmarkplacement-on/\n * \"on\"\n *\n * @product highcharts gantt\n * @validvalue [\"on\", \"between\"]\n */\n tickmarkPlacement: 'between',\n /**\n * The position of the major tick marks relative to the axis line.\n * Can be one of `inside` and `outside`.\n *\n * @sample {highcharts} highcharts/xaxis/tickposition-outside/\n * \"outside\" by default\n * @sample {highcharts} highcharts/xaxis/tickposition-inside/\n * \"inside\"\n * @sample {highstock} stock/xaxis/ticks/\n * Formatted ticks on X axis\n *\n * @validvalue [\"inside\", \"outside\"]\n */\n tickPosition: 'outside',\n /**\n * A callback function returning array defining where the ticks are\n * laid out on the axis. This overrides the default behaviour of\n * [tickPixelInterval](#xAxis.tickPixelInterval) and [tickInterval](\n * #xAxis.tickInterval). The automatic tick positions are accessible\n * through `this.tickPositions` and can be modified by the callback.\n *\n * @see [tickPositions](#xAxis.tickPositions)\n *\n * @sample {highcharts} highcharts/xaxis/tickpositions-tickpositioner/\n * Demo of tickPositions and tickPositioner\n * @sample {highstock} highcharts/xaxis/tickpositions-tickpositioner/\n * Demo of tickPositions and tickPositioner\n *\n * @type {Highcharts.AxisTickPositionerCallbackFunction}\n * @apioption xAxis.tickPositioner\n */\n /**\n * An array defining where the ticks are laid out on the axis. This\n * overrides the default behaviour of [tickPixelInterval](\n * #xAxis.tickPixelInterval) and [tickInterval](#xAxis.tickInterval).\n *\n * @see [tickPositioner](#xAxis.tickPositioner)\n *\n * @sample {highcharts} highcharts/xaxis/tickpositions-tickpositioner/\n * Demo of tickPositions and tickPositioner\n * @sample {highstock} highcharts/xaxis/tickpositions-tickpositioner/\n * Demo of tickPositions and tickPositioner\n *\n * @type {Array}\n * @apioption xAxis.tickPositions\n */\n /**\n * The pixel width of the major tick marks. Defaults to 0 on category\n * axes, otherwise 1.\n *\n * In styled mode, the stroke width is given in the `.highcharts-tick`\n * class, but in order for the element to be generated on category axes,\n * the option must be explicitly set to 1.\n *\n * @sample {highcharts} highcharts/xaxis/tickwidth/\n * 10 px width\n * @sample {highcharts} highcharts/css/axis-grid/\n * Styled mode\n * @sample {highstock} stock/xaxis/ticks/\n * Formatted ticks on X axis\n * @sample {highstock} highcharts/css/axis-grid/\n * Styled mode\n *\n * @type {undefined|number}\n * @default {highstock} 1\n * @default {highmaps} 0\n * @apioption xAxis.tickWidth\n */\n /**\n * The axis title, showing next to the axis line.\n *\n * @productdesc {highmaps}\n * In Highmaps, the axis is hidden by default, but adding an axis title\n * is still possible. X axis and Y axis titles will appear at the bottom\n * and left by default.\n */\n title: {\n /**\n * Alignment of the title relative to the axis values. Possible\n * values are \"low\", \"middle\" or \"high\".\n *\n * @sample {highcharts} highcharts/xaxis/title-align-low/\n * \"low\"\n * @sample {highcharts} highcharts/xaxis/title-align-center/\n * \"middle\" by default\n * @sample {highcharts} highcharts/xaxis/title-align-high/\n * \"high\"\n * @sample {highcharts} highcharts/yaxis/title-offset/\n * Place the Y axis title on top of the axis\n * @sample {highstock} stock/xaxis/title-align/\n * Aligned to \"high\" value\n *\n * @type {Highcharts.AxisTitleAlignValue}\n */\n align: 'middle',\n /**\n * Deprecated. Set the `text` to `undefined` to disable the title.\n *\n * @deprecated\n * @type {boolean}\n * @product highcharts\n * @apioption xAxis.title.enabled\n */\n /**\n * The pixel distance between the axis labels or line and the title.\n * Defaults to 0 for horizontal axes, 10 for vertical\n *\n * @sample {highcharts} highcharts/xaxis/title-margin/\n * Y axis title margin of 60\n *\n * @type {number}\n * @apioption xAxis.title.margin\n */\n /**\n * The distance of the axis title from the axis line. By default,\n * this distance is computed from the offset width of the labels,\n * the labels' distance from the axis and the title's margin.\n * However when the offset option is set, it overrides all this.\n *\n * @sample {highcharts} highcharts/yaxis/title-offset/\n * Place the axis title on top of the axis\n * @sample {highstock} highcharts/yaxis/title-offset/\n * Place the axis title on top of the Y axis\n *\n * @type {number}\n * @since 2.2.0\n * @apioption xAxis.title.offset\n */\n /**\n * Whether to reserve space for the title when laying out the axis.\n *\n * @type {boolean}\n * @default true\n * @since 5.0.11\n * @product highcharts highstock gantt\n * @apioption xAxis.title.reserveSpace\n */\n /**\n * The rotation of the text in degrees. 0 is horizontal, 270 is\n * vertical reading from bottom to top. Defaults to 0 for horizontal\n * axes, 270 for left-side axes and 90 for right-side axes.\n *\n * @sample {highcharts} highcharts/yaxis/title-offset/\n * Horizontal\n *\n * @type {number}\n * @default undefined\n * @apioption xAxis.title.rotation\n */\n /**\n * The actual text of the axis title. It can contain basic HTML tags\n * like `b`, `i` and `span` with style.\n *\n * @sample {highcharts} highcharts/xaxis/title-text/\n * Custom HTML\n * @sample {highstock} stock/xaxis/title-text/\n * Titles for both axes\n *\n * @type {string|null}\n * @apioption xAxis.title.text\n */\n /**\n * Alignment of the text, can be `\"left\"`, `\"right\"` or `\"center\"`.\n * Default alignment depends on the\n * [title.align](xAxis.title.align):\n *\n * Horizontal axes:\n * - for `align` = `\"low\"`, `textAlign` is set to `left`\n * - for `align` = `\"middle\"`, `textAlign` is set to `center`\n * - for `align` = `\"high\"`, `textAlign` is set to `right`\n *\n * Vertical axes:\n * - for `align` = `\"low\"` and `opposite` = `true`, `textAlign` is\n * set to `right`\n * - for `align` = `\"low\"` and `opposite` = `false`, `textAlign` is\n * set to `left`\n * - for `align` = `\"middle\"`, `textAlign` is set to `center`\n * - for `align` = `\"high\"` and `opposite` = `true` `textAlign` is\n * set to `left`\n * - for `align` = `\"high\"` and `opposite` = `false` `textAlign` is\n * set to `right`\n *\n * @type {Highcharts.AlignValue}\n * @apioption xAxis.title.textAlign\n */\n /**\n * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the axis title.\n *\n * @product highcharts highstock gantt\n */\n useHTML: false,\n /**\n * Horizontal pixel offset of the title position.\n *\n * @since 4.1.6\n * @product highcharts highstock gantt\n */\n x: 0,\n /**\n * Vertical pixel offset of the title position.\n *\n * @product highcharts highstock gantt\n */\n y: 0,\n /**\n * CSS styles for the title. If the title text is longer than the\n * axis length, it will wrap to multiple lines by default. This can\n * be customized by setting `textOverflow: 'ellipsis'`, by\n * setting a specific `width` or by setting `whiteSpace: 'nowrap'`.\n *\n * In styled mode, the stroke width is given in the\n * `.highcharts-axis-title` class.\n *\n * @sample {highcharts} highcharts/xaxis/title-style/\n * Red\n * @sample {highcharts} highcharts/css/axis/\n * Styled mode\n *\n * @type {Highcharts.CSSObject}\n */\n style: {\n /** @internal */\n color: \"#666666\" /* Palette.neutralColor60 */,\n /** @internal */\n fontSize: '0.8em'\n }\n },\n /**\n * The type of axis. Can be one of `linear`, `logarithmic`, `datetime`\n * or `category`. In a datetime axis, the numbers are given in\n * milliseconds, and tick marks are placed on appropriate values like\n * full hours or days. In a category axis, the\n * [point names](#series.line.data.name) of the chart's series are used\n * for categories, if not a [categories](#xAxis.categories) array is\n * defined.\n *\n * @sample {highcharts} highcharts/xaxis/type-linear/\n * Linear\n * @sample {highcharts} highcharts/yaxis/type-log/\n * Logarithmic\n * @sample {highcharts} highcharts/yaxis/type-log-minorgrid/\n * Logarithmic with minor grid lines\n * @sample {highcharts} highcharts/xaxis/type-log-both/\n * Logarithmic on two axes\n * @sample {highcharts} highcharts/yaxis/type-log-negative/\n * Logarithmic with extension to emulate negative values\n *\n * @type {Highcharts.AxisTypeValue}\n * @product highcharts gantt\n */\n type: 'linear',\n /**\n * If there are multiple axes on the same side of the chart, the pixel\n * margin between the axes. Defaults to 0 on vertical axes, 15 on\n * horizontal axes.\n *\n * @type {number}\n * @since 7.0.3\n * @apioption xAxis.margin\n */\n /**\n * Applies only when the axis `type` is `category`. When `uniqueNames`\n * is true, points are placed on the X axis according to their names.\n * If the same point name is repeated in the same or another series,\n * the point is placed on the same X position as other points of the\n * same name. When `uniqueNames` is false, the points are laid out in\n * increasing X positions regardless of their names, and the X axis\n * category will take the name of the last point in each position.\n *\n * @sample {highcharts} highcharts/xaxis/uniquenames-true/\n * True by default\n * @sample {highcharts} highcharts/xaxis/uniquenames-false/\n * False\n *\n * @since 4.2.7\n * @product highcharts gantt\n */\n uniqueNames: true,\n /**\n * Datetime axis only. An array determining what time intervals the\n * ticks are allowed to fall on. Each array item is an array where the\n * first value is the time unit and the second value another array of\n * allowed multiples.\n *\n * Defaults to:\n * ```js\n * units: [[\n * 'millisecond', // unit name\n * [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples\n * ], [\n * 'second',\n * [1, 2, 5, 10, 15, 30]\n * ], [\n * 'minute',\n * [1, 2, 5, 10, 15, 30]\n * ], [\n * 'hour',\n * [1, 2, 3, 4, 6, 8, 12]\n * ], [\n * 'day',\n * [1, 2]\n * ], [\n * 'week',\n * [1, 2]\n * ], [\n * 'month',\n * [1, 2, 3, 4, 6]\n * ], [\n * 'year',\n * null\n * ]]\n * ```\n *\n * @sample {highcharts} highcharts/xaxis/units/\n * Axis units demonstrated\n *\n * @type {Array|null)>>}\n * @product highcharts highstock gantt\n * @apioption xAxis.units\n */\n /**\n * Whether axis, including axis title, line, ticks and labels, should\n * be visible.\n *\n * @since 4.1.9\n * @product highcharts highstock gantt\n */\n visible: true,\n /**\n * Color of the minor, secondary grid lines.\n *\n * In styled mode, the stroke width is given in the\n * `.highcharts-minor-grid-line` class.\n *\n * @sample {highcharts} highcharts/yaxis/minorgridlinecolor/\n * Bright grey lines from Y axis\n * @sample {highcharts|highstock} highcharts/css/axis-grid/\n * Styled mode\n * @sample {highstock} stock/xaxis/minorgridlinecolor/\n * Bright grey lines from Y axis\n *\n * @type {Highcharts.ColorType}\n * @default #f2f2f2\n */\n minorGridLineColor: \"#f2f2f2\" /* Palette.neutralColor5 */,\n /**\n * Width of the minor, secondary grid lines.\n *\n * In styled mode, the stroke width is given in the\n * `.highcharts-grid-line` class.\n *\n * @sample {highcharts} highcharts/yaxis/minorgridlinewidth/\n * 2px lines from Y axis\n * @sample {highcharts|highstock} highcharts/css/axis-grid/\n * Styled mode\n * @sample {highstock} stock/xaxis/minorgridlinewidth/\n * 2px lines from Y axis\n */\n minorGridLineWidth: 1,\n /**\n * Color for the minor tick marks.\n *\n * @sample {highcharts} highcharts/yaxis/minortickcolor/\n * Black tick marks on Y axis\n * @sample {highstock} stock/xaxis/minorticks/\n * Black tick marks on Y axis\n *\n * @type {Highcharts.ColorType}\n * @default #999999\n */\n minorTickColor: \"#999999\" /* Palette.neutralColor40 */,\n /**\n * The color of the line marking the axis itself.\n *\n * In styled mode, the line stroke is given in the\n * `.highcharts-axis-line` or `.highcharts-xaxis-line` class.\n *\n * @sample {highcharts} highcharts/yaxis/linecolor/\n * A red line on Y axis\n * @sample {highcharts|highstock} highcharts/css/axis/\n * Axes in styled mode\n * @sample {highstock} stock/xaxis/linecolor/\n * A red line on X axis\n *\n * @type {Highcharts.ColorType}\n */\n lineColor: \"#333333\" /* Palette.neutralColor80 */,\n /**\n * The width of the line marking the axis itself.\n *\n * In styled mode, the stroke width is given in the\n * `.highcharts-axis-line` or `.highcharts-xaxis-line` class.\n *\n * @sample {highcharts} highcharts/yaxis/linecolor/\n * A 1px line on Y axis\n * @sample {highcharts|highstock} highcharts/css/axis/\n * Axes in styled mode\n * @sample {highstock} stock/xaxis/linewidth/\n * A 2px line on X axis\n *\n * @default {highcharts|highstock} 1\n * @default {highmaps} 0\n */\n lineWidth: 1,\n /**\n * Color of the grid lines extending the ticks across the plot area.\n *\n * In styled mode, the stroke is given in the `.highcharts-grid-line`\n * class.\n *\n * @productdesc {highmaps}\n * In Highmaps, the grid lines are hidden by default.\n *\n * @sample {highcharts} highcharts/yaxis/gridlinecolor/\n * Green lines\n * @sample {highcharts|highstock} highcharts/css/axis-grid/\n * Styled mode\n * @sample {highstock} stock/xaxis/gridlinecolor/\n * Green lines\n *\n * @type {Highcharts.ColorType}\n * @default #e6e6e6\n */\n gridLineColor: \"#e6e6e6\" /* Palette.neutralColor10 */,\n /**\n * The width of the grid lines extending the ticks across the plot area.\n * Defaults to 1 on the Y axis and 0 on the X axis, except for 3d\n * charts.\n *\n * In styled mode, the stroke width is given in the\n * `.highcharts-grid-line` class.\n *\n * @sample {highcharts} highcharts/yaxis/gridlinewidth/\n * 2px lines\n * @sample {highcharts|highstock} highcharts/css/axis-grid/\n * Styled mode\n * @sample {highstock} stock/xaxis/gridlinewidth/\n * 2px lines\n *\n * @type {number}\n * @apioption xAxis.gridLineWidth\n */\n gridLineWidth: void 0,\n /**\n * The height as the vertical axis. If it's a number, it is\n * interpreted as pixels.\n *\n * Since Highcharts 2: If it's a percentage string, it is interpreted\n * as percentages of the total plot height.\n *\n * @sample {highcharts} highcharts/xaxis/axis-position-properties\n * Different axis position properties\n *\n * @type {number|string}\n * @product highcharts highstock\n * @apioption xAxis.height\n */\n /**\n * The width as the horizontal axis. If it's a number, it is interpreted\n * as pixels.\n *\n * Since Highcharts v5.0.13: If it's a percentage string, it is\n * interpreted as percentages of the total plot width.\n *\n * @sample {highcharts} highcharts/xaxis/axis-position-properties\n * Different axis position properties\n *\n * @type {number|string}\n * @product highcharts highstock\n * @apioption xAxis.width\n */\n /**\n * Color for the main tick marks.\n *\n * In styled mode, the stroke is given in the `.highcharts-tick`\n * class.\n *\n * @sample {highcharts} highcharts/xaxis/tickcolor/\n * Red ticks on X axis\n * @sample {highcharts|highstock} highcharts/css/axis-grid/\n * Styled mode\n * @sample {highstock} stock/xaxis/ticks/\n * Formatted ticks on X axis\n *\n * @type {Highcharts.ColorType}\n */\n tickColor: \"#333333\" /* Palette.neutralColor80 */\n // tickWidth: 1\n };\n /**\n * The Z axis or depth axis for 3D plots.\n *\n * See the [Axis class](/class-reference/Highcharts.Axis) for programmatic\n * access to the axis.\n *\n * @sample {highcharts} highcharts/3d/scatter-zaxis-categories/\n * Z-Axis with Categories\n * @sample {highcharts} highcharts/3d/scatter-zaxis-grid/\n * Z-Axis with styling\n *\n * @type {*|Array<*>}\n * @extends xAxis\n * @since 5.0.0\n * @product highcharts\n * @excluding breaks, crosshair, height, left, lineColor, lineWidth,\n * nameToX, showEmpty, top, width\n * @apioption zAxis\n */\n /**\n * The Y axis or value axis. Normally this is the vertical axis,\n * though if the chart is inverted this is the horizontal axis.\n * In case of multiple axes, the yAxis node is an array of\n * configuration objects.\n *\n * See [the Axis object](/class-reference/Highcharts.Axis) for programmatic\n * access to the axis.\n *\n * @type {*|Array<*>}\n * @extends xAxis\n * @excluding currentDateIndicator,ordinal,overscroll\n * @optionparent yAxis\n */\n AxisDefaults.yAxis = {\n /**\n * The type of axis. Can be one of `linear`, `logarithmic`, `datetime`,\n * `category` or `treegrid`. Defaults to `treegrid` for Gantt charts,\n * `linear` for other chart types.\n *\n * In a datetime axis, the numbers are given in milliseconds, and tick\n * marks are placed on appropriate values, like full hours or days. In a\n * category or treegrid axis, the [point names](#series.line.data.name)\n * of the chart's series are used for categories, if a\n * [categories](#xAxis.categories) array is not defined.\n *\n * @sample {highcharts} highcharts/yaxis/type-log-minorgrid/\n * Logarithmic with minor grid lines\n * @sample {highcharts} highcharts/yaxis/type-log-negative/\n * Logarithmic with extension to emulate negative values\n * @sample {gantt} gantt/treegrid-axis/demo\n * Treegrid axis\n *\n * @type {Highcharts.AxisTypeValue}\n * @default {highcharts} linear\n * @default {gantt} treegrid\n * @product highcharts gantt\n * @apioption yAxis.type\n */\n /**\n * The height of the Y axis. If it's a number, it is interpreted as\n * pixels.\n *\n * Since Highcharts 2: If it's a percentage string, it is interpreted as\n * percentages of the total plot height.\n *\n * @see [yAxis.top](#yAxis.top)\n *\n * @sample {highstock} stock/demo/candlestick-and-volume/\n * Percentage height panes\n *\n * @type {number|string}\n * @product highcharts highstock\n * @apioption yAxis.height\n */\n /**\n * Solid gauge only. Unless [stops](#yAxis.stops) are set, the color\n * to represent the maximum value of the Y axis.\n *\n * @sample {highcharts} highcharts/yaxis/mincolor-maxcolor/\n * Min and max colors\n *\n * @type {Highcharts.ColorType}\n * @default #003399\n * @since 4.0\n * @product highcharts\n * @apioption yAxis.maxColor\n */\n /**\n * Solid gauge only. Unless [stops](#yAxis.stops) are set, the color\n * to represent the minimum value of the Y axis.\n *\n * @sample {highcharts} highcharts/yaxis/mincolor-maxcolor/\n * Min and max color\n *\n * @type {Highcharts.ColorType}\n * @default #e6ebf5\n * @since 4.0\n * @product highcharts\n * @apioption yAxis.minColor\n */\n /**\n * Whether to reverse the axis so that the highest number is closest\n * to the origin.\n *\n * @sample {highcharts} highcharts/yaxis/reversed/\n * Reversed Y axis\n * @sample {highstock} stock/xaxis/reversed/\n * Reversed Y axis\n *\n * @type {boolean}\n * @default {highcharts} false\n * @default {highstock} false\n * @default {highmaps} true\n * @default {gantt} true\n * @apioption yAxis.reversed\n */\n /**\n * If `true`, the first series in a stack will be drawn on top in a\n * positive, non-reversed Y axis. If `false`, the first series is in\n * the base of the stack.\n *\n * @sample {highcharts} highcharts/yaxis/reversedstacks-false/\n * Non-reversed stacks\n * @sample {highstock} highcharts/yaxis/reversedstacks-false/\n * Non-reversed stacks\n *\n * @type {boolean}\n * @default true\n * @since 3.0.10\n * @product highcharts highstock\n * @apioption yAxis.reversedStacks\n */\n reversedStacks: true,\n /**\n * Solid gauge series only. Color stops for the solid gauge. Use this\n * in cases where a linear gradient between a `minColor` and `maxColor`\n * is not sufficient. The stops is an array of tuples, where the first\n * item is a float between 0 and 1 assigning the relative position in\n * the gradient, and the second item is the color.\n *\n * For solid gauges, the Y axis also inherits the concept of\n * [data classes](https://api.highcharts.com/highmaps#colorAxis.dataClasses)\n * from the Highmaps color axis.\n *\n * @sample {highcharts} highcharts/demo/gauge-solid/\n * Gauge with stops\n *\n * @see [minColor](#yAxis.minColor)\n * @see [maxColor](#yAxis.maxColor)\n *\n * @type {Array>}\n * @since 4.0\n * @product highcharts\n * @apioption yAxis.stops\n */\n /**\n * The pixel width of the major tick marks.\n *\n * @sample {highcharts} highcharts/xaxis/tickwidth/ 10 px width\n * @sample {highstock} stock/xaxis/ticks/ Formatted ticks on X axis\n *\n * @type {number}\n * @default 0\n * @product highcharts highstock gantt\n * @apioption yAxis.tickWidth\n */\n /**\n * Whether to force the axis to end on a tick. Use this option with\n * the `maxPadding` option to control the axis end.\n *\n * This option is always disabled, when panning type is\n * either `y` or `xy`.\n *\n * @see [type](#chart.panning.type)\n *\n *\n * @sample {highcharts} highcharts/yaxis/endontick/\n * True by default\n * @sample {highcharts} highcharts/yaxis/endontick-false/\n * False\n * @sample {highstock} stock/demo/basic-line/\n * True by default\n * @sample {highstock} stock/xaxis/endontick/\n * False for Y axis\n *\n * @since 1.2.0\n */\n endOnTick: true,\n /**\n * Padding of the max value relative to the length of the axis. A\n * padding of 0.05 will make a 100px axis 5px longer. This is useful\n * when you don't want the highest data value to appear on the edge\n * of the plot area. When the axis' `max` option is set or a max extreme\n * is set using `axis.setExtremes()`, the maxPadding will be ignored.\n *\n * Also the `softThreshold` option takes precedence over `maxPadding`,\n * so if the data is tangent to the threshold, `maxPadding` may not\n * apply unless `softThreshold` is set to false.\n *\n * @sample {highcharts} highcharts/yaxis/maxpadding-02/\n * Max padding of 0.2\n * @sample {highstock} stock/xaxis/minpadding-maxpadding/\n * Greater min- and maxPadding\n *\n * @since 1.2.0\n * @product highcharts highstock gantt\n */\n maxPadding: 0.05,\n /**\n * Padding of the min value relative to the length of the axis. A\n * padding of 0.05 will make a 100px axis 5px longer. This is useful\n * when you don't want the lowest data value to appear on the edge\n * of the plot area. When the axis' `min` option is set or a max extreme\n * is set using `axis.setExtremes()`, the maxPadding will be ignored.\n *\n * Also the `softThreshold` option takes precedence over `minPadding`,\n * so if the data is tangent to the threshold, `minPadding` may not\n * apply unless `softThreshold` is set to false.\n *\n * @sample {highcharts} highcharts/yaxis/minpadding/\n * Min padding of 0.2\n * @sample {highstock} stock/xaxis/minpadding-maxpadding/\n * Greater min- and maxPadding\n *\n * @since 1.2.0\n * @product highcharts highstock gantt\n */\n minPadding: 0.05,\n /**\n * @productdesc {highstock}\n * In Highcharts Stock 1.x, the Y axis was placed\n * on the left side by default.\n *\n * @sample {highcharts} highcharts/yaxis/opposite/\n * Secondary Y axis opposite\n * @sample {highstock} stock/xaxis/opposite/\n * Y axis on left side\n *\n * @type {boolean}\n * @default {highstock} true\n * @default {highcharts} false\n * @product highstock highcharts gantt\n * @apioption yAxis.opposite\n */\n /**\n * @see [tickInterval](#xAxis.tickInterval)\n * @see [tickPositioner](#xAxis.tickPositioner)\n * @see [tickPositions](#xAxis.tickPositions)\n */\n tickPixelInterval: 72,\n /**\n * Whether to show the last tick label.\n *\n * @productdesc {highcharts|gantt}\n * Defaults to `true` on cartesian charts, and `false` on polar charts.\n *\n * @productdesc {highstock}\n * Defaults to `true` for categorized yAxis and `false` for other types\n * of yAxis.\n *\n * @default undefined\n */\n showLastLabel: true,\n /**\n * @extends xAxis.labels\n */\n labels: {\n /**\n * The label's pixel distance from the perimeter of the plot area.\n * On cartesian charts, this is overridden if the `labels.y` setting\n * is set.\n *\n * On polar charts, if it's a percentage string, it is interpreted\n * the same as [series.radius](#plotOptions.gauge.radius), so the\n * label can be aligned under the gauge's shape.\n *\n * @sample {highcharts} highcharts/yaxis/labels-distance/\n * Polar chart, labels centered under the arc\n *\n * @type {number|string}\n * @product highcharts\n * @apioption yAxis.labels.distance\n */\n /**\n * The y position offset of all labels relative to the tick\n * positions on the axis. For polar and radial axis consider the use\n * of the [distance](#yAxis.labels.distance) option.\n *\n * @sample {highcharts} highcharts/xaxis/labels-x/\n * Y axis labels placed on grid lines\n *\n * @type {number}\n * @default {highcharts} 3\n * @default {highstock} -2\n * @default {highmaps} 3\n * @apioption yAxis.labels.y\n */\n /**\n * What part of the string the given position is anchored to. Can\n * be one of `\"left\"`, `\"center\"` or `\"right\"`. The exact position\n * also depends on the `labels.x` setting.\n *\n * Angular gauges and solid gauges defaults to `\"center\"`.\n * Solid gauges with two labels have additional option `\"auto\"`\n * for automatic horizontal and vertical alignment.\n *\n * @sample {highcharts} highcharts/yaxis/labels-align-left/\n * Left\n * @sample {highcharts} highcharts/series-solidgauge/labels-auto-aligned/\n * Solid gauge labels auto aligned\n *\n * @type {Highcharts.AlignValue}\n * @default {highstock} right\n * @apioption yAxis.labels.align\n */\n /**\n * The x position offset of all labels relative to the tick\n * positions on the axis. Defaults to -15 for left axis, 15 for\n * right axis.\n *\n * @sample {highcharts} highcharts/xaxis/labels-x/\n * Y axis labels placed on grid lines\n *\n * @type {number}\n */\n x: void 0\n },\n /**\n * @sample {highcharts} highcharts/yaxis/max-200/\n * Y axis max of 200\n * @sample {highcharts} highcharts/yaxis/max-logarithmic/\n * Y axis max on logarithmic axis\n * @sample {highstock} stock/yaxis/min-max/\n * Fixed min and max on Y axis\n *\n * @apioption yAxis.max\n */\n /**\n * @sample {highcharts} highcharts/yaxis/min-startontick-false/\n * -50 with startOnTick to false\n * @sample {highcharts} highcharts/yaxis/min-startontick-true/\n * -50 with startOnTick true by default\n * @sample {highstock} stock/yaxis/min-max/\n * Fixed min and max on Y axis\n *\n * @apioption yAxis.min\n */\n /**\n * An optional scrollbar to display on the Y axis in response to\n * limiting the minimum an maximum of the axis values.\n *\n * In styled mode, all the presentational options for the scrollbar\n * are replaced by the classes `.highcharts-scrollbar-thumb`,\n * `.highcharts-scrollbar-arrow`, `.highcharts-scrollbar-button`,\n * `.highcharts-scrollbar-rifles` and `.highcharts-scrollbar-track`.\n *\n * @sample {highstock} stock/yaxis/scrollbar/\n * Scrollbar on the Y axis\n *\n * @extends scrollbar\n * @since 4.2.6\n * @product highstock\n * @excluding height\n * @apioption yAxis.scrollbar\n */\n /**\n * Enable the scrollbar on the Y axis.\n *\n * @sample {highstock} stock/yaxis/scrollbar/\n * Enabled on Y axis\n *\n * @type {boolean}\n * @default false\n * @since 4.2.6\n * @product highstock\n * @apioption yAxis.scrollbar.enabled\n */\n /**\n * Pixel margin between the scrollbar and the axis elements.\n *\n * @type {number}\n * @default 10\n * @since 4.2.6\n * @product highstock\n * @apioption yAxis.scrollbar.margin\n */\n /* eslint-disable highcharts/doclet-apioption-last */\n /**\n * Defines the position of the scrollbar. By default, it is positioned\n * on the opposite of the main axis (right side of the chart).\n * However, in the case of RTL languages could be set to `false`\n * which positions the scrollbar on the left.\n *\n * Works only for vertical axes.\n * This means yAxis in a non-inverted chart and xAxis in the inverted.\n *\n * @sample stock/yaxis/scrollbar-opposite/\n * A scrollbar not on the opposite side\n *\n * @type {boolean}\n * @default true\n * @since 9.3.0\n *\n * @apioption yAxis.scrollbar.opposite\n * @apioption xAxis.scrollbar.opposite\n *\n */\n /* eslint-enable highcharts/doclet-apioption-last */\n /**\n * Whether to show the scrollbar when it is fully zoomed out at max\n * range. Setting it to `false` on the Y axis makes the scrollbar stay\n * hidden until the user zooms in, like common in browsers.\n *\n * @type {boolean}\n * @default true\n * @since 4.2.6\n * @product highstock\n * @apioption yAxis.scrollbar.showFull\n */\n /**\n * The width of a vertical scrollbar or height of a horizontal\n * scrollbar. Defaults to 20 on touch devices.\n *\n * @type {number}\n * @default 14\n * @since 4.2.6\n * @product highstock\n * @apioption yAxis.scrollbar.size\n */\n /**\n * Z index of the scrollbar elements.\n *\n * @type {number}\n * @default 3\n * @since 4.2.6\n * @product highstock\n * @apioption yAxis.scrollbar.zIndex\n */\n /**\n * A soft maximum for the axis. If the series data maximum is less\n * than this, the axis will stay at this maximum, but if the series\n * data maximum is higher, the axis will flex to show all data.\n *\n * **Note**: The [series.softThreshold](\n * #plotOptions.series.softThreshold) option takes precedence over this\n * option.\n *\n * @sample highcharts/yaxis/softmin-softmax/\n * Soft min and max\n *\n * @type {number}\n * @since 5.0.1\n * @product highcharts highstock gantt\n * @apioption yAxis.softMax\n */\n /**\n * A soft minimum for the axis. If the series data minimum is greater\n * than this, the axis will stay at this minimum, but if the series\n * data minimum is lower, the axis will flex to show all data.\n *\n * **Note**: The [series.softThreshold](\n * #plotOptions.series.softThreshold) option takes precedence over this\n * option.\n *\n * @sample highcharts/yaxis/softmin-softmax/\n * Soft min and max\n *\n * @type {number}\n * @since 5.0.1\n * @product highcharts highstock gantt\n * @apioption yAxis.softMin\n */\n /**\n * Defines the horizontal alignment of the stack total label. Can be one\n * of `\"left\"`, `\"center\"` or `\"right\"`. The default value is calculated\n * at runtime and depends on orientation and whether the stack is\n * positive or negative.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-align-left/\n * Aligned to the left\n * @sample {highcharts} highcharts/yaxis/stacklabels-align-center/\n * Aligned in center\n * @sample {highcharts} highcharts/yaxis/stacklabels-align-right/\n * Aligned to the right\n *\n * @type {Highcharts.AlignValue}\n * @since 2.1.5\n * @product highcharts\n * @apioption yAxis.stackLabels.align\n */\n /**\n * A format string for the data label. Available variables are the same\n * as for `formatter`.\n *\n * @type {string}\n * @default {total}\n * @since 3.0.2\n * @product highcharts highstock\n * @apioption yAxis.stackLabels.format\n */\n /**\n * Rotation of the labels in degrees.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-rotation/\n * Labels rotated 45\u00B0\n *\n * @type {number}\n * @default 0\n * @since 2.1.5\n * @product highcharts\n * @apioption yAxis.stackLabels.rotation\n */\n /**\n * The text alignment for the label. While `align` determines where the\n * texts anchor point is placed with regards to the stack, `textAlign`\n * determines how the text is aligned against its anchor point. Possible\n * values are `\"left\"`, `\"center\"` and `\"right\"`. The default value is\n * calculated at runtime and depends on orientation and whether the\n * stack is positive or negative.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-textalign-left/\n * Label in center position but text-aligned left\n *\n * @type {Highcharts.AlignValue}\n * @since 2.1.5\n * @product highcharts\n * @apioption yAxis.stackLabels.textAlign\n */\n /**\n * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the labels.\n *\n * @type {boolean}\n * @default false\n * @since 3.0\n * @product highcharts highstock\n * @apioption yAxis.stackLabels.useHTML\n */\n /**\n * Defines the vertical alignment of the stack total label. Can be one\n * of `\"top\"`, `\"middle\"` or `\"bottom\"`. The default value is calculated\n * at runtime and depends on orientation and whether the stack is\n * positive or negative.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-verticalalign-top/\n * Vertically aligned top\n * @sample {highcharts} highcharts/yaxis/stacklabels-verticalalign-middle/\n * Vertically aligned middle\n * @sample {highcharts} highcharts/yaxis/stacklabels-verticalalign-bottom/\n * Vertically aligned bottom\n *\n * @type {Highcharts.VerticalAlignValue}\n * @since 2.1.5\n * @product highcharts\n * @apioption yAxis.stackLabels.verticalAlign\n */\n /**\n * The x position offset of the label relative to the left of the\n * stacked bar. The default value is calculated at runtime and depends\n * on orientation and whether the stack is positive or negative.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-x/\n * Stack total labels with x offset\n *\n * @type {number}\n * @since 2.1.5\n * @product highcharts\n * @apioption yAxis.stackLabels.x\n */\n /**\n * The y position offset of the label relative to the tick position\n * on the axis. The default value is calculated at runtime and depends\n * on orientation and whether the stack is positive or negative.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-y/\n * Stack total labels with y offset\n *\n * @type {number}\n * @since 2.1.5\n * @product highcharts\n * @apioption yAxis.stackLabels.y\n */\n /**\n * Whether to force the axis to start on a tick. Use this option with\n * the `maxPadding` option to control the axis start.\n *\n * This option is always disabled, when panning type is\n * either `y` or `xy`.\n *\n * @see [type](#chart.panning.type)\n *\n * @sample {highcharts} highcharts/xaxis/startontick-false/\n * False by default\n * @sample {highcharts} highcharts/xaxis/startontick-true/\n * True\n * @sample {highstock} stock/xaxis/endontick/\n * False for Y axis\n *\n * @since 1.2.0\n * @product highcharts highstock gantt\n */\n startOnTick: true,\n title: {\n /**\n * The pixel distance between the axis labels and the title.\n * Positive values are outside the axis line, negative are inside.\n *\n * @sample {highcharts} highcharts/xaxis/title-margin/\n * Y axis title margin of 60\n *\n * @type {number}\n * @default 40\n * @apioption yAxis.title.margin\n */\n /**\n * The actual text of the axis title. Horizontal texts can contain\n * HTML, but rotated texts are painted using vector techniques and\n * must be clean text. The Y axis title is disabled by setting the\n * `text` option to `undefined`.\n *\n * @sample {highcharts} highcharts/xaxis/title-text/\n * Custom HTML\n *\n * @type {string|null}\n * @default {highcharts} Values\n * @default {highstock} undefined\n * @product highcharts highstock gantt\n */\n text: 'Values'\n },\n /**\n * The top position of the Y axis. If it's a number, it is interpreted\n * as pixel position relative to the chart.\n *\n * Since Highcharts 2: If it's a percentage string, it is interpreted as\n * percentages of the plot height, offset from plot area top.\n *\n * @see [yAxis.height](#yAxis.height)\n *\n * @sample {highstock} stock/demo/candlestick-and-volume/\n * Percentage height panes\n *\n * @type {number|string}\n * @product highcharts highstock\n * @apioption yAxis.top\n */\n /**\n * The stack labels show the total value for each bar in a stacked\n * column or bar chart. The label will be placed on top of positive\n * columns and below negative columns. In case of an inverted column\n * chart or a bar chart the label is placed to the right of positive\n * bars and to the left of negative bars.\n *\n * @product highcharts\n */\n stackLabels: {\n /**\n * Enable or disable the initial animation when a series is\n * displayed for the `stackLabels`. The animation can also be set as\n * a configuration object. Please note that this option only\n * applies to the initial animation.\n * For other animations, see [chart.animation](#chart.animation)\n * and the animation parameter under the API methods.\n * The following properties are supported:\n *\n * - `defer`: The animation delay time in milliseconds.\n *\n * @sample {highcharts} highcharts/plotoptions/animation-defer/\n * Animation defer settings\n * @type {boolean|Partial}\n * @since 8.2.0\n * @apioption yAxis.stackLabels.animation\n */\n animation: {},\n /**\n * The animation delay time in milliseconds.\n * Set to `0` renders stackLabel immediately.\n * As `undefined` inherits defer time from the [series.animation.defer](#plotOptions.series.animation.defer).\n *\n * @type {number}\n * @since 8.2.0\n * @apioption yAxis.stackLabels.animation.defer\n */\n /**\n * Allow the stack labels to overlap.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-allowoverlap-false/\n * Default false\n *\n * @since 5.0.13\n * @product highcharts\n */\n allowOverlap: false,\n /**\n * The background color or gradient for the stack label.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-box/\n * Stack labels box options\n * @type {Highcharts.ColorType}\n * @since 8.1.0\n * @apioption yAxis.stackLabels.backgroundColor\n */\n /**\n * The border color for the stack label. Defaults to `undefined`.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-box/\n * Stack labels box options\n * @type {Highcharts.ColorType}\n * @since 8.1.0\n * @apioption yAxis.stackLabels.borderColor\n */\n /**\n * The border radius in pixels for the stack label.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-box/\n * Stack labels box options\n * @type {number}\n * @default 0\n * @since 8.1.0\n * @apioption yAxis.stackLabels.borderRadius\n */\n /**\n * The border width in pixels for the stack label.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-box/\n * Stack labels box options\n * @type {number}\n * @default 0\n * @since 8.1.0\n * @apioption yAxis.stackLabels.borderWidth\n */\n /**\n * Enable or disable the stack total labels.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-enabled/\n * Enabled stack total labels\n * @sample {highcharts} highcharts/yaxis/stacklabels-enabled-waterfall/\n * Enabled stack labels in waterfall chart\n *\n * @since 2.1.5\n * @product highcharts\n */\n enabled: false,\n /**\n * Whether to hide stack labels that are outside the plot area.\n * By default, the stack label is moved\n * inside the plot area according to the\n * [overflow](/highcharts/#yAxis/stackLabels/overflow)\n * option.\n *\n * @type {boolean}\n * @since 7.1.3\n */\n crop: true,\n /**\n * How to handle stack total labels that flow outside the plot area.\n * The default is set to `\"justify\"`,\n * which aligns them inside the plot area.\n * For columns and bars, this means it will be moved inside the bar.\n * To display stack labels outside the plot area,\n * set `crop` to `false` and `overflow` to `\"allow\"`.\n *\n * @sample highcharts/yaxis/stacklabels-overflow/\n * Stack labels flows outside the plot area.\n *\n * @type {Highcharts.DataLabelsOverflowValue}\n * @since 7.1.3\n */\n overflow: 'justify',\n /* eslint-disable valid-jsdoc */\n /**\n * Callback JavaScript function to format the label. The value is\n * given by `this.total`.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-formatter/\n * Added units to stack total value\n *\n * @type {Highcharts.FormatterCallbackFunction}\n * @since 2.1.5\n * @product highcharts\n */\n formatter: function () {\n const { numberFormatter } = this.axis.chart;\n /* eslint-enable valid-jsdoc */\n return numberFormatter(this.total || 0, -1);\n },\n /**\n * CSS styles for the label.\n *\n * In styled mode, the styles are set in the\n * `.highcharts-stack-label` class.\n *\n * @sample {highcharts} highcharts/yaxis/stacklabels-style/\n * Red stack total labels\n *\n * @type {Highcharts.CSSObject}\n * @since 2.1.5\n * @product highcharts\n */\n style: {\n /** @internal */\n color: \"#000000\" /* Palette.neutralColor100 */,\n /** @internal */\n fontSize: '0.7em',\n /** @internal */\n fontWeight: 'bold',\n /** @internal */\n textOutline: '1px contrast'\n }\n },\n gridLineWidth: 1,\n lineWidth: 0\n };\n})(AxisDefaults || (AxisDefaults = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default AxisDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from './Utilities.js';\nconst { addEvent, isFunction, objectEach, removeEvent } = U;\n/* *\n *\n * Class Namespace\n *\n * */\nvar Foundation;\n(function (Foundation) {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Register event options. If an event handler is set on the options, it\n * should be subject to Chart.update, Axis.update and Series.update. This is\n * contrary to general handlers that are set directly using addEvent either\n * on the class or on the instance. #6538, #6943, #10861.\n * @private\n */\n function registerEventOptions(component, options) {\n // A lookup over those events that are added by _options_ (not\n // programmatically). These are updated through .update()\n component.eventOptions = component.eventOptions || {};\n // Register event listeners\n objectEach(options.events, function (event, eventType) {\n // If event does not exist, or is changed by the .update()\n // function\n if (component.eventOptions[eventType] !== event) {\n // Remove existing if set by option\n if (component.eventOptions[eventType]) {\n removeEvent(component, eventType, component.eventOptions[eventType]);\n delete component.eventOptions[eventType];\n }\n if (isFunction(event)) {\n component.eventOptions[eventType] = event;\n addEvent(component, eventType, event, {\n order: 0 // #14080 fire those events as firsts\n });\n }\n }\n });\n }\n Foundation.registerEventOptions = registerEventOptions;\n})(Foundation || (Foundation = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default Foundation;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport F from '../Templating.js';\nimport H from '../Globals.js';\nconst { deg2rad } = H;\nimport U from '../Utilities.js';\nconst { clamp, correctFloat, defined, destroyObjectProperties, extend, fireEvent, isNumber, merge, objectEach, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/**\n * The Tick class.\n *\n * @class\n * @name Highcharts.Tick\n *\n * @param {Highcharts.Axis} axis\n * The axis of the tick.\n *\n * @param {number} pos\n * The position of the tick on the axis in terms of axis values.\n *\n * @param {string} [type]\n * The type of tick, either 'minor' or an empty string\n *\n * @param {boolean} [noLabel=false]\n * Whether to disable the label or not. Defaults to false.\n *\n * @param {Object} [parameters]\n * Optional parameters for the tick.\n */\nclass Tick {\n /* *\n *\n * Constructors\n *\n * */\n constructor(axis, pos, type, noLabel, parameters) {\n this.isNew = true;\n this.isNewLabel = true;\n /**\n * The related axis of the tick.\n * @name Highcharts.Tick#axis\n * @type {Highcharts.Axis}\n */\n this.axis = axis;\n /**\n * The logical position of the tick on the axis in terms of axis values.\n * @name Highcharts.Tick#pos\n * @type {number}\n */\n this.pos = pos;\n /**\n * The tick type, which can be `\"minor\"`, or an empty string.\n * @name Highcharts.Tick#type\n * @type {string}\n */\n this.type = type || '';\n this.parameters = parameters || {};\n /**\n * The mark offset of the tick on the axis. Usually `undefined`, numeric\n * for grid axes.\n * @name Highcharts.Tick#tickmarkOffset\n * @type {number|undefined}\n */\n this.tickmarkOffset = this.parameters.tickmarkOffset;\n this.options = this.parameters.options;\n fireEvent(this, 'init');\n if (!type && !noLabel) {\n this.addLabel();\n }\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Write the tick label.\n *\n * @private\n * @function Highcharts.Tick#addLabel\n */\n addLabel() {\n const tick = this, axis = tick.axis, options = axis.options, chart = axis.chart, categories = axis.categories, log = axis.logarithmic, names = axis.names, pos = tick.pos, labelOptions = pick(tick.options && tick.options.labels, options.labels), tickPositions = axis.tickPositions, isFirst = pos === tickPositions[0], isLast = pos === tickPositions[tickPositions.length - 1], animateLabels = (!labelOptions.step || labelOptions.step === 1) &&\n axis.tickInterval === 1, tickPositionInfo = tickPositions.info;\n let label = tick.label, dateTimeLabelFormat, dateTimeLabelFormats, i;\n // The context value\n let value = this.parameters.category || (categories ?\n pick(categories[pos], names[pos], pos) :\n pos);\n if (log && isNumber(value)) {\n value = correctFloat(log.lin2log(value));\n }\n // Set the datetime label format. If a higher rank is set for this\n // position, use that. If not, use the general format.\n if (axis.dateTime) {\n if (tickPositionInfo) {\n dateTimeLabelFormats = chart.time.resolveDTLFormat(options.dateTimeLabelFormats[(!options.grid &&\n tickPositionInfo.higherRanks[pos]) ||\n tickPositionInfo.unitName]);\n dateTimeLabelFormat = dateTimeLabelFormats.main;\n }\n else if (isNumber(value)) { // #1441\n dateTimeLabelFormat = axis.dateTime.getXDateFormat(value, options.dateTimeLabelFormats ||\n {});\n }\n }\n // set properties for access in render method\n /**\n * True if the tick is the first one on the axis.\n * @name Highcharts.Tick#isFirst\n * @readonly\n * @type {boolean|undefined}\n */\n tick.isFirst = isFirst;\n /**\n * True if the tick is the last one on the axis.\n * @name Highcharts.Tick#isLast\n * @readonly\n * @type {boolean|undefined}\n */\n tick.isLast = isLast;\n // Get the string\n const ctx = {\n axis,\n chart,\n dateTimeLabelFormat: dateTimeLabelFormat,\n isFirst,\n isLast,\n pos,\n tick: tick,\n tickPositionInfo,\n value\n };\n // Fire an event that allows modifying the context for use in\n // `labels.format` and `labels.formatter`.\n fireEvent(this, 'labelFormat', ctx);\n // Label formatting. When `labels.format` is given, we first run the\n // defaultFormatter and append the result to the context as `text`.\n // Handy for adding prefix or suffix while keeping default number\n // formatting.\n const labelFormatter = (ctx) => {\n if (labelOptions.formatter) {\n return labelOptions.formatter.call(ctx, ctx);\n }\n if (labelOptions.format) {\n ctx.text = axis.defaultLabelFormatter.call(ctx);\n return F.format(labelOptions.format, ctx, chart);\n }\n return axis.defaultLabelFormatter.call(ctx);\n };\n const str = labelFormatter.call(ctx, ctx);\n // Set up conditional formatting based on the format list if existing.\n const list = dateTimeLabelFormats && dateTimeLabelFormats.list;\n if (list) {\n tick.shortenLabel = function () {\n for (i = 0; i < list.length; i++) {\n extend(ctx, { dateTimeLabelFormat: list[i] });\n label.attr({\n text: labelFormatter.call(ctx, ctx)\n });\n if (label.getBBox().width <\n axis.getSlotWidth(tick) - 2 *\n labelOptions.padding) {\n return;\n }\n }\n label.attr({\n text: ''\n });\n };\n }\n else {\n // #15692\n tick.shortenLabel = void 0;\n }\n // Call only after first render\n if (animateLabels && axis._addedPlotLB) {\n tick.moveLabel(str, labelOptions);\n }\n // First call\n if (!defined(label) && !tick.movedLabel) {\n /**\n * The rendered text label of the tick.\n * @name Highcharts.Tick#label\n * @type {Highcharts.SVGElement|undefined}\n */\n tick.label = label = tick.createLabel(str, labelOptions);\n // Base value to detect change for new calls to getBBox\n tick.rotation = 0;\n // update\n }\n else if (label && label.textStr !== str && !animateLabels) {\n // When resetting text, also reset the width if dynamically set\n // (#8809)\n if (label.textWidth &&\n !labelOptions.style.width &&\n !label.styles.width) {\n label.css({ width: null });\n }\n label.attr({ text: str });\n label.textPxLength = label.getBBox().width;\n }\n }\n /**\n * Render and return the label of the tick.\n *\n * @private\n * @function Highcharts.Tick#createLabel\n */\n createLabel(str, labelOptions, xy) {\n const axis = this.axis, chart = axis.chart, label = defined(str) && labelOptions.enabled ?\n chart.renderer\n .text(str, xy?.x, xy?.y, labelOptions.useHTML)\n .add(axis.labelGroup) :\n void 0;\n // Un-rotated length\n if (label) {\n // Without position absolute, IE export sometimes is wrong\n if (!chart.styledMode) {\n label.css(merge(labelOptions.style));\n }\n label.textPxLength = label.getBBox().width;\n }\n return label;\n }\n /**\n * Destructor for the tick prototype\n *\n * @private\n * @function Highcharts.Tick#destroy\n */\n destroy() {\n destroyObjectProperties(this, this.axis);\n }\n /**\n * Gets the x and y positions for ticks in terms of pixels.\n *\n * @private\n * @function Highcharts.Tick#getPosition\n *\n * @param {boolean} horiz\n * Whether the tick is on an horizontal axis or not.\n *\n * @param {number} tickPos\n * Position of the tick.\n *\n * @param {number} tickmarkOffset\n * Tickmark offset for all ticks.\n *\n * @param {boolean} [old]\n * Whether the axis has changed or not.\n *\n * @return {Highcharts.PositionObject}\n * The tick position.\n *\n * @emits Highcharts.Tick#event:afterGetPosition\n */\n getPosition(horiz, tickPos, tickmarkOffset, old) {\n const axis = this.axis, chart = axis.chart, cHeight = (old && chart.oldChartHeight) || chart.chartHeight, pos = {\n x: horiz ?\n correctFloat(axis.translate(tickPos + tickmarkOffset, void 0, void 0, old) +\n axis.transB) :\n (axis.left +\n axis.offset +\n (axis.opposite ?\n (((old && chart.oldChartWidth) ||\n chart.chartWidth) -\n axis.right -\n axis.left) :\n 0)),\n y: horiz ?\n (cHeight -\n axis.bottom +\n axis.offset -\n (axis.opposite ? axis.height : 0)) :\n correctFloat(cHeight -\n axis.translate(tickPos + tickmarkOffset, void 0, void 0, old) -\n axis.transB)\n };\n // Chrome workaround for #10516\n pos.y = clamp(pos.y, -1e5, 1e5);\n fireEvent(this, 'afterGetPosition', { pos: pos });\n return pos;\n }\n /**\n * Get the x, y position of the tick label\n * @private\n */\n getLabelPosition(x, y, label, horiz, labelOptions, tickmarkOffset, index, step) {\n const axis = this.axis, transA = axis.transA, reversed = ( // #7911\n axis.isLinked && axis.linkedParent ?\n axis.linkedParent.reversed :\n axis.reversed), staggerLines = axis.staggerLines, rotCorr = axis.tickRotCorr || { x: 0, y: 0 }, \n // Adjust for label alignment if we use reserveSpace: true (#5286)\n labelOffsetCorrection = (!horiz && !axis.reserveSpaceDefault ?\n -axis.labelOffset * (axis.labelAlign === 'center' ? 0.5 : 1) :\n 0), distance = labelOptions.distance, pos = {};\n let yOffset, line;\n if (axis.side === 0) {\n yOffset = label.rotation ? -distance : -label.getBBox().height;\n }\n else if (axis.side === 2) {\n yOffset = rotCorr.y + distance;\n }\n else {\n // #3140, #3140\n yOffset = Math.cos(label.rotation * deg2rad) *\n (rotCorr.y - label.getBBox(false, 0).height / 2);\n }\n if (defined(labelOptions.y)) {\n yOffset = axis.side === 0 && axis.horiz ?\n labelOptions.y + yOffset :\n labelOptions.y;\n }\n x = x +\n pick(labelOptions.x, [0, 1, 0, -1][axis.side] * distance) +\n labelOffsetCorrection +\n rotCorr.x -\n (tickmarkOffset && horiz ?\n tickmarkOffset * transA * (reversed ? -1 : 1) :\n 0);\n y = y + yOffset - (tickmarkOffset && !horiz ?\n tickmarkOffset * transA * (reversed ? 1 : -1) : 0);\n // Correct for staggered labels\n if (staggerLines) {\n line = (index / (step || 1) % staggerLines);\n if (axis.opposite) {\n line = staggerLines - line - 1;\n }\n y += line * (axis.labelOffset / staggerLines);\n }\n pos.x = x;\n pos.y = Math.round(y);\n fireEvent(this, 'afterGetLabelPosition', { pos: pos, tickmarkOffset: tickmarkOffset, index: index });\n return pos;\n }\n /**\n * Get the offset height or width of the label\n *\n * @private\n * @function Highcharts.Tick#getLabelSize\n */\n getLabelSize() {\n return this.label ?\n this.label.getBBox()[this.axis.horiz ? 'height' : 'width'] :\n 0;\n }\n /**\n * Extendible method to return the path of the marker\n * @private\n */\n getMarkPath(x, y, tickLength, tickWidth, horiz, renderer) {\n return renderer.crispLine([[\n 'M',\n x,\n y\n ], [\n 'L',\n x + (horiz ? 0 : -tickLength),\n y + (horiz ? tickLength : 0)\n ]], tickWidth);\n }\n /**\n * Handle the label overflow by adjusting the labels to the left and right\n * edge, or hide them if they collide into the neighbour label.\n *\n * @private\n * @function Highcharts.Tick#handleOverflow\n */\n handleOverflow(xy) {\n const tick = this, axis = this.axis, labelOptions = axis.options.labels, pxPos = xy.x, chartWidth = axis.chart.chartWidth, spacing = axis.chart.spacing, leftBound = pick(axis.labelLeft, Math.min(axis.pos, spacing[3])), rightBound = pick(axis.labelRight, Math.max(!axis.isRadial ? axis.pos + axis.len : 0, chartWidth - spacing[1])), label = this.label, rotation = this.rotation, factor = {\n left: 0,\n center: 0.5,\n right: 1\n }[axis.labelAlign || label.attr('align')], labelWidth = label.getBBox().width, slotWidth = axis.getSlotWidth(tick), xCorrection = factor, css = {};\n let modifiedSlotWidth = slotWidth, goRight = 1, leftPos, rightPos, textWidth;\n // Check if the label overshoots the chart spacing box. If it does, move\n // it. If it now overshoots the slotWidth, add ellipsis.\n if (!rotation && labelOptions.overflow === 'justify') {\n leftPos = pxPos - factor * labelWidth;\n rightPos = pxPos + (1 - factor) * labelWidth;\n if (leftPos < leftBound) {\n modifiedSlotWidth =\n xy.x + modifiedSlotWidth * (1 - factor) - leftBound;\n }\n else if (rightPos > rightBound) {\n modifiedSlotWidth =\n rightBound - xy.x + modifiedSlotWidth * factor;\n goRight = -1;\n }\n modifiedSlotWidth = Math.min(slotWidth, modifiedSlotWidth); // #4177\n if (modifiedSlotWidth < slotWidth && axis.labelAlign === 'center') {\n xy.x += (goRight *\n (slotWidth -\n modifiedSlotWidth -\n xCorrection * (slotWidth - Math.min(labelWidth, modifiedSlotWidth))));\n }\n // If the label width exceeds the available space, set a text width\n // to be picked up below. Also, if a width has been set before, we\n // need to set a new one because the reported labelWidth will be\n // limited by the box (#3938).\n if (labelWidth > modifiedSlotWidth ||\n (axis.autoRotation && (label.styles || {}).width)) {\n textWidth = modifiedSlotWidth;\n }\n // Add ellipsis to prevent rotated labels to be clipped against the edge\n // of the chart\n }\n else if (rotation < 0 &&\n pxPos - factor * labelWidth < leftBound) {\n textWidth = Math.round(pxPos / Math.cos(rotation * deg2rad) - leftBound);\n }\n else if (rotation > 0 &&\n pxPos + factor * labelWidth > rightBound) {\n textWidth = Math.round((chartWidth - pxPos) /\n Math.cos(rotation * deg2rad));\n }\n if (textWidth) {\n if (tick.shortenLabel) {\n tick.shortenLabel();\n }\n else {\n css.width = Math.floor(textWidth) + 'px';\n if (!(labelOptions.style || {}).textOverflow) {\n css.textOverflow = 'ellipsis';\n }\n label.css(css);\n }\n }\n }\n /**\n * Try to replace the label if the same one already exists.\n *\n * @private\n * @function Highcharts.Tick#moveLabel\n */\n moveLabel(str, labelOptions) {\n const tick = this, label = tick.label, axis = tick.axis;\n let moved = false, labelPos;\n if (label && label.textStr === str) {\n tick.movedLabel = label;\n moved = true;\n delete tick.label;\n }\n else { // Find a label with the same string\n objectEach(axis.ticks, function (currentTick) {\n if (!moved &&\n !currentTick.isNew &&\n currentTick !== tick &&\n currentTick.label &&\n currentTick.label.textStr === str) {\n tick.movedLabel = currentTick.label;\n moved = true;\n currentTick.labelPos = tick.movedLabel.xy;\n delete currentTick.label;\n }\n });\n }\n // Create new label if the actual one is moved\n if (!moved && (tick.labelPos || label)) {\n labelPos = tick.labelPos || label.xy;\n tick.movedLabel = tick.createLabel(str, labelOptions, labelPos);\n if (tick.movedLabel) {\n tick.movedLabel.attr({ opacity: 0 });\n }\n }\n }\n /**\n * Put everything in place\n *\n * @private\n * @param {number} index\n *\n * @param {boolean} [old]\n * Use old coordinates to prepare an animation into new position\n *\n * @param {number} [opacity]\n */\n render(index, old, opacity) {\n const tick = this, axis = tick.axis, horiz = axis.horiz, pos = tick.pos, tickmarkOffset = pick(tick.tickmarkOffset, axis.tickmarkOffset), xy = tick.getPosition(horiz, pos, tickmarkOffset, old), x = xy.x, y = xy.y, axisStart = axis.pos, axisEnd = axisStart + axis.len, reverseCrisp = ((horiz && x === axisEnd) ||\n (!horiz && y === axisStart)) ? -1 : 1, // #1480, #1687\n pxPos = horiz ? x : y;\n // Anything that is not between `axis.pos` and `axis.pos + axis.length`\n // should not be visible (#20166). The `correctFloat` is for reversed\n // axes in Safari.\n if (!axis.chart.polar &&\n tick.isNew &&\n (correctFloat(pxPos) < axisStart || pxPos > axisEnd)) {\n opacity = 0;\n }\n const labelOpacity = pick(opacity, tick.label && tick.label.newOpacity, // #15528\n 1);\n opacity = pick(opacity, 1);\n this.isActive = true;\n // Create the grid line\n this.renderGridLine(old, opacity, reverseCrisp);\n // Create the tick mark\n this.renderMark(xy, opacity, reverseCrisp);\n // The label is created on init - now move it into place\n this.renderLabel(xy, old, labelOpacity, index);\n tick.isNew = false;\n fireEvent(this, 'afterRender');\n }\n /**\n * Renders the gridLine.\n *\n * @private\n * @function Highcharts.Tick#renderGridLine\n * @param {boolean} old Whether or not the tick is old\n * @param {number} opacity The opacity of the grid line\n * @param {number} reverseCrisp Modifier for avoiding overlapping 1 or -1\n */\n renderGridLine(old, opacity, reverseCrisp) {\n const tick = this, axis = tick.axis, options = axis.options, attribs = {}, pos = tick.pos, type = tick.type, tickmarkOffset = pick(tick.tickmarkOffset, axis.tickmarkOffset), renderer = axis.chart.renderer;\n let gridLine = tick.gridLine, gridLinePath, gridLineWidth = options.gridLineWidth, gridLineColor = options.gridLineColor, dashStyle = options.gridLineDashStyle;\n if (tick.type === 'minor') {\n gridLineWidth = options.minorGridLineWidth;\n gridLineColor = options.minorGridLineColor;\n dashStyle = options.minorGridLineDashStyle;\n }\n if (!gridLine) {\n if (!axis.chart.styledMode) {\n attribs.stroke = gridLineColor;\n attribs['stroke-width'] = gridLineWidth || 0;\n attribs.dashstyle = dashStyle;\n }\n if (!type) {\n attribs.zIndex = 1;\n }\n if (old) {\n opacity = 0;\n }\n /**\n * The rendered grid line of the tick.\n * @name Highcharts.Tick#gridLine\n * @type {Highcharts.SVGElement|undefined}\n */\n tick.gridLine = gridLine = renderer.path()\n .attr(attribs)\n .addClass('highcharts-' + (type ? type + '-' : '') + 'grid-line')\n .add(axis.gridGroup);\n }\n if (gridLine) {\n gridLinePath = axis.getPlotLinePath({\n value: pos + tickmarkOffset,\n lineWidth: gridLine.strokeWidth() * reverseCrisp,\n force: 'pass',\n old: old,\n acrossPanes: false // #18025\n });\n // If the parameter 'old' is set, the current call will be followed\n // by another call, therefore do not do any animations this time\n if (gridLinePath) {\n gridLine[old || tick.isNew ? 'attr' : 'animate']({\n d: gridLinePath,\n opacity: opacity\n });\n }\n }\n }\n /**\n * Renders the tick mark.\n *\n * @private\n * @function Highcharts.Tick#renderMark\n * @param {Highcharts.PositionObject} xy The position vector of the mark\n * @param {number} opacity The opacity of the mark\n * @param {number} reverseCrisp Modifier for avoiding overlapping 1 or -1\n */\n renderMark(xy, opacity, reverseCrisp) {\n const tick = this, axis = tick.axis, options = axis.options, renderer = axis.chart.renderer, type = tick.type, tickSize = axis.tickSize(type ? type + 'Tick' : 'tick'), x = xy.x, y = xy.y, tickWidth = pick(options[type !== 'minor' ? 'tickWidth' : 'minorTickWidth'], !type && axis.isXAxis ? 1 : 0), // X axis defaults to 1\n tickColor = options[type !== 'minor' ? 'tickColor' : 'minorTickColor'];\n let mark = tick.mark;\n const isNewMark = !mark;\n if (tickSize) {\n // negate the length\n if (axis.opposite) {\n tickSize[0] = -tickSize[0];\n }\n // First time, create it\n if (!mark) {\n /**\n * The rendered mark of the tick.\n * @name Highcharts.Tick#mark\n * @type {Highcharts.SVGElement|undefined}\n */\n tick.mark = mark = renderer.path()\n .addClass('highcharts-' + (type ? type + '-' : '') + 'tick')\n .add(axis.axisGroup);\n if (!axis.chart.styledMode) {\n mark.attr({\n stroke: tickColor,\n 'stroke-width': tickWidth\n });\n }\n }\n mark[isNewMark ? 'attr' : 'animate']({\n d: tick.getMarkPath(x, y, tickSize[0], mark.strokeWidth() * reverseCrisp, axis.horiz, renderer),\n opacity: opacity\n });\n }\n }\n /**\n * Renders the tick label.\n * Note: The label should already be created in init(), so it should only\n * have to be moved into place.\n *\n * @private\n * @function Highcharts.Tick#renderLabel\n * @param {Highcharts.PositionObject} xy The position vector of the label\n * @param {boolean} old Whether or not the tick is old\n * @param {number} opacity The opacity of the label\n * @param {number} index The index of the tick\n */\n renderLabel(xy, old, opacity, index) {\n const tick = this, axis = tick.axis, horiz = axis.horiz, options = axis.options, label = tick.label, labelOptions = options.labels, step = labelOptions.step, tickmarkOffset = pick(tick.tickmarkOffset, axis.tickmarkOffset), x = xy.x, y = xy.y;\n let show = true;\n if (label && isNumber(x)) {\n label.xy = xy = tick.getLabelPosition(x, y, label, horiz, labelOptions, tickmarkOffset, index, step);\n // Apply show first and show last. If the tick is both first and\n // last, it is a single centered tick, in which case we show the\n // label anyway (#2100).\n if ((tick.isFirst &&\n !tick.isLast &&\n !options.showFirstLabel) ||\n (tick.isLast &&\n !tick.isFirst &&\n !options.showLastLabel)) {\n show = false;\n // Handle label overflow and show or hide accordingly\n }\n else if (horiz &&\n !labelOptions.step &&\n !labelOptions.rotation &&\n !old &&\n opacity !== 0) {\n tick.handleOverflow(xy);\n }\n // apply step\n if (step && index % step) {\n // show those indices dividable by step\n show = false;\n }\n // Set the new position, and show or hide\n if (show && isNumber(xy.y)) {\n xy.opacity = opacity;\n label[tick.isNewLabel ? 'attr' : 'animate'](xy).show(true);\n tick.isNewLabel = false;\n }\n else {\n label.hide(); // #1338, #15863\n tick.isNewLabel = true;\n }\n }\n }\n /**\n * Replace labels with the moved ones to perform animation. Additionally\n * destroy unused labels.\n *\n * @private\n * @function Highcharts.Tick#replaceMovedLabel\n */\n replaceMovedLabel() {\n const tick = this, label = tick.label, axis = tick.axis;\n // Animate and destroy\n if (label && !tick.isNew) {\n label.animate({ opacity: 0 }, void 0, label.destroy);\n delete tick.label;\n }\n axis.isDirty = true;\n tick.label = tick.movedLabel;\n delete tick.movedLabel;\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default Tick;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Optional parameters for the tick.\n * @private\n * @interface Highcharts.TickParametersObject\n */ /**\n* Set category for the tick.\n* @name Highcharts.TickParametersObject#category\n* @type {string|undefined}\n*/ /**\n* @name Highcharts.TickParametersObject#options\n* @type {Highcharts.Dictionary|undefined}\n*/ /**\n* Set tickmarkOffset for the tick.\n* @name Highcharts.TickParametersObject#tickmarkOffset\n* @type {number|undefined}\n*/\n/**\n * Additional time tick information.\n *\n * @interface Highcharts.TimeTicksInfoObject\n * @extends Highcharts.TimeNormalizedObject\n */ /**\n* @name Highcharts.TimeTicksInfoObject#higherRanks\n* @type {Array}\n*/ /**\n* @name Highcharts.TimeTicksInfoObject#totalRange\n* @type {number}\n*/\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../Animation/AnimationUtilities.js';\nconst { animObject } = A;\nimport AxisDefaults from './AxisDefaults.js';\nconst { xAxis, yAxis } = AxisDefaults;\nimport Color from '../Color/Color.js';\nimport D from '../Defaults.js';\nconst { defaultOptions } = D;\nimport F from '../Foundation.js';\nconst { registerEventOptions } = F;\nimport H from '../Globals.js';\nconst { deg2rad } = H;\nimport Tick from './Tick.js';\nimport U from '../Utilities.js';\nconst { arrayMax, arrayMin, clamp, correctFloat, defined, destroyObjectProperties, erase, error, extend, fireEvent, getClosestDistance, insertItem, isArray, isNumber, isString, merge, normalizeTickInterval, objectEach, pick, relativeLength, removeEvent, splat, syncTimeout } = U;\nconst getNormalizedTickInterval = (axis, tickInterval) => normalizeTickInterval(tickInterval, void 0, void 0, pick(axis.options.allowDecimals, \n// If the tick interval is greater than 0.5, avoid decimals, as\n// linear axes are often used to render discrete values (#3363). If\n// a tick amount is set, allow decimals by default, as it increases\n// the chances for a good fit.\ntickInterval < 0.5 || axis.tickAmount !== void 0), !!axis.tickAmount);\nextend(defaultOptions, { xAxis, yAxis: merge(xAxis, yAxis) });\n/* *\n *\n * Class\n *\n * */\n/**\n * Create a new axis object. Called internally when instantiating a new chart or\n * adding axes by {@link Highcharts.Chart#addAxis}.\n *\n * A chart can have from 0 axes (pie chart) to multiples. In a normal, single\n * series cartesian chart, there is one X axis and one Y axis.\n *\n * The X axis or axes are referenced by {@link Highcharts.Chart.xAxis}, which is\n * an array of Axis objects. If there is only one axis, it can be referenced\n * through `chart.xAxis[0]`, and multiple axes have increasing indices. The same\n * pattern goes for Y axes.\n *\n * If you need to get the axes from a series object, use the `series.xAxis` and\n * `series.yAxis` properties. These are not arrays, as one series can only be\n * associated to one X and one Y axis.\n *\n * A third way to reference the axis programmatically is by `id`. Add an `id` in\n * the axis configuration options, and get the axis by\n * {@link Highcharts.Chart#get}.\n *\n * Configuration options for the axes are given in options.xAxis and\n * options.yAxis.\n *\n * @class\n * @name Highcharts.Axis\n *\n * @param {Highcharts.Chart} chart\n * The Chart instance to apply the axis on.\n *\n * @param {Highcharts.AxisOptions} userOptions\n * Axis options\n */\nclass Axis {\n /* *\n *\n * Constructors\n *\n * */\n constructor(chart, userOptions, coll) {\n this.init(chart, userOptions, coll);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Overrideable function to initialize the axis.\n *\n * @see {@link Axis}\n *\n * @function Highcharts.Axis#init\n *\n * @param {Highcharts.Chart} chart\n * The Chart instance to apply the axis on.\n *\n * @param {AxisOptions} userOptions\n * Axis options.\n *\n * @emits Highcharts.Axis#event:afterInit\n * @emits Highcharts.Axis#event:init\n */\n init(chart, userOptions, coll = this.coll) {\n const isXAxis = coll === 'xAxis', axis = this, horiz = axis.isZAxis || (chart.inverted ? !isXAxis : isXAxis);\n /**\n * The Chart that the axis belongs to.\n *\n * @name Highcharts.Axis#chart\n * @type {Highcharts.Chart}\n */\n axis.chart = chart;\n /**\n * Whether the axis is horizontal.\n *\n * @name Highcharts.Axis#horiz\n * @type {boolean|undefined}\n */\n axis.horiz = horiz;\n /**\n * Whether the axis is the x-axis.\n *\n * @name Highcharts.Axis#isXAxis\n * @type {boolean|undefined}\n */\n axis.isXAxis = isXAxis;\n /**\n * The collection where the axis belongs, for example `xAxis`, `yAxis`\n * or `colorAxis`. Corresponds to properties on Chart, for example\n * {@link Chart.xAxis}.\n *\n * @name Highcharts.Axis#coll\n * @type {string}\n */\n axis.coll = coll;\n fireEvent(this, 'init', { userOptions: userOptions });\n // Needed in setOptions\n axis.opposite = pick(userOptions.opposite, axis.opposite);\n /**\n * The side on which the axis is rendered. 0 is top, 1 is right, 2\n * is bottom and 3 is left.\n *\n * @name Highcharts.Axis#side\n * @type {number}\n */\n axis.side = pick(userOptions.side, axis.side, (horiz ?\n (axis.opposite ? 0 : 2) : // top : bottom\n (axis.opposite ? 1 : 3)) // right : left\n );\n /**\n * Current options for the axis after merge of defaults and user's\n * options.\n *\n * @name Highcharts.Axis#options\n * @type {Highcharts.AxisOptions}\n */\n axis.setOptions(userOptions);\n const options = this.options, labelsOptions = options.labels, type = options.type;\n /**\n * User's options for this axis without defaults.\n *\n * @name Highcharts.Axis#userOptions\n * @type {Highcharts.AxisOptions}\n */\n axis.userOptions = userOptions;\n axis.minPixelPadding = 0;\n /**\n * Whether the axis is reversed. Based on the `axis.reversed`,\n * option, but inverted charts have reversed xAxis by default.\n *\n * @name Highcharts.Axis#reversed\n * @type {boolean}\n */\n axis.reversed = pick(options.reversed, axis.reversed);\n axis.visible = options.visible;\n axis.zoomEnabled = options.zoomEnabled;\n // Initial categories\n axis.hasNames = type === 'category' || options.categories === true;\n /**\n * If categories are present for the axis, names are used instead of\n * numbers for that axis.\n *\n * Since Highcharts 3.0, categories can also be extracted by giving each\n * point a name and setting axis type to `category`. However, if you\n * have multiple series, best practice remains defining the `categories`\n * array.\n *\n * @see [xAxis.categories](/highcharts/xAxis.categories)\n *\n * @name Highcharts.Axis#categories\n * @type {Array}\n * @readonly\n */\n axis.categories = (isArray(options.categories) && options.categories) ||\n (axis.hasNames ? [] : void 0);\n if (!axis.names) { // Preserve on update (#3830)\n axis.names = [];\n axis.names.keys = {};\n }\n // Placeholder for plotlines and plotbands groups\n axis.plotLinesAndBandsGroups = {};\n // Shorthand types\n axis.positiveValuesOnly = !!axis.logarithmic;\n // Flag, if axis is linked to another axis\n axis.isLinked = defined(options.linkedTo);\n /**\n * List of major ticks mapped by position on axis.\n *\n * @see {@link Highcharts.Tick}\n *\n * @name Highcharts.Axis#ticks\n * @type {Highcharts.Dictionary}\n */\n axis.ticks = {};\n axis.labelEdge = [];\n /**\n * List of minor ticks mapped by position on the axis.\n *\n * @see {@link Highcharts.Tick}\n *\n * @name Highcharts.Axis#minorTicks\n * @type {Highcharts.Dictionary}\n */\n axis.minorTicks = {};\n // List of plotLines/Bands\n axis.plotLinesAndBands = [];\n // Alternate bands\n axis.alternateBands = {};\n /**\n * The length of the axis in terms of pixels.\n *\n * @name Highcharts.Axis#len\n * @type {number}\n */\n axis.len = 0;\n axis.minRange = axis.userMinRange = options.minRange || options.maxZoom;\n axis.range = options.range;\n axis.offset = options.offset || 0;\n /**\n * The maximum value of the axis. In a logarithmic axis, this is the\n * logarithm of the real value, and the real value can be obtained from\n * {@link Axis#getExtremes}.\n *\n * @name Highcharts.Axis#max\n * @type {number|undefined}\n */\n axis.max = void 0;\n /**\n * The minimum value of the axis. In a logarithmic axis, this is the\n * logarithm of the real value, and the real value can be obtained from\n * {@link Axis#getExtremes}.\n *\n * @name Highcharts.Axis#min\n * @type {number|undefined}\n */\n axis.min = void 0;\n /**\n * The processed crosshair options.\n *\n * @name Highcharts.Axis#crosshair\n * @type {boolean|Highcharts.AxisCrosshairOptions}\n */\n const crosshair = pick(options.crosshair, splat(chart.options.tooltip.crosshairs)[isXAxis ? 0 : 1]);\n axis.crosshair = crosshair === true ? {} : crosshair;\n // Register. Don't add it again on Axis.update().\n if (chart.axes.indexOf(axis) === -1) { //\n if (isXAxis) { // #2713\n chart.axes.splice(chart.xAxis.length, 0, axis);\n }\n else {\n chart.axes.push(axis);\n }\n insertItem(this, chart[this.coll]);\n }\n chart.orderItems(axis.coll);\n /**\n * All series associated to the axis.\n *\n * @name Highcharts.Axis#series\n * @type {Array}\n */\n axis.series = axis.series || []; // Populated by Series\n // Reversed axis\n if (chart.inverted &&\n !axis.isZAxis &&\n isXAxis &&\n !defined(axis.reversed)) {\n axis.reversed = true;\n }\n axis.labelRotation = isNumber(labelsOptions.rotation) ?\n labelsOptions.rotation :\n void 0;\n // Register event listeners\n registerEventOptions(axis, options);\n fireEvent(this, 'afterInit');\n }\n /**\n * Merge and set options.\n *\n * @private\n * @function Highcharts.Axis#setOptions\n *\n * @param {Highcharts.AxisOptions} userOptions\n * Axis options.\n *\n * @emits Highcharts.Axis#event:afterSetOptions\n */\n setOptions(userOptions) {\n const sideSpecific = this.horiz ?\n // Top and bottom axis defaults\n {\n labels: {\n autoRotation: [-45]\n },\n margin: 15\n } :\n // Left and right axis, title rotated 90 or 270 degrees\n // respectively\n {\n title: {\n rotation: 90 * this.side\n }\n };\n this.options = merge(sideSpecific, defaultOptions[this.coll], userOptions);\n fireEvent(this, 'afterSetOptions', { userOptions });\n }\n /**\n * The default label formatter. The context is a special config object for\n * the label. In apps, use the\n * [labels.formatter](https://api.highcharts.com/highcharts/xAxis.labels.formatter)\n * instead, except when a modification is needed.\n *\n * @function Highcharts.Axis#defaultLabelFormatter\n *\n * @param {Highcharts.AxisLabelsFormatterContextObject} this\n * Formatter context of axis label.\n *\n * @param {Highcharts.AxisLabelsFormatterContextObject} [ctx]\n * Formatter context of axis label.\n *\n * @return {string}\n * The formatted label content.\n */\n defaultLabelFormatter() {\n const axis = this.axis, chart = this.chart, { numberFormatter } = chart, value = isNumber(this.value) ? this.value : NaN, time = axis.chart.time, categories = axis.categories, dateTimeLabelFormat = this.dateTimeLabelFormat, lang = defaultOptions.lang, numericSymbols = lang.numericSymbols, numSymMagnitude = lang.numericSymbolMagnitude || 1000, \n // Make sure the same symbol is added for all labels on a linear\n // axis\n numericSymbolDetector = axis.logarithmic ?\n Math.abs(value) :\n axis.tickInterval;\n let i = numericSymbols && numericSymbols.length, multi, ret;\n if (categories) {\n ret = `${this.value}`;\n }\n else if (dateTimeLabelFormat) { // Datetime axis\n ret = time.dateFormat(dateTimeLabelFormat, value);\n }\n else if (i &&\n numericSymbols &&\n numericSymbolDetector >= 1000) {\n // Decide whether we should add a numeric symbol like k (thousands)\n // or M (millions). If we are to enable this in tooltip or other\n // places as well, we can move this logic to the numberFormatter and\n // enable it by a parameter.\n while (i-- && typeof ret === 'undefined') {\n multi = Math.pow(numSymMagnitude, i + 1);\n if (\n // Only accept a numeric symbol when the distance is more\n // than a full unit. So for example if the symbol is k, we\n // don't accept numbers like 0.5k.\n numericSymbolDetector >= multi &&\n // Accept one decimal before the symbol. Accepts 0.5k but\n // not 0.25k. How does this work with the previous?\n (value * 10) % multi === 0 &&\n numericSymbols[i] !== null &&\n value !== 0) { // #5480\n ret = numberFormatter(value / multi, -1) + numericSymbols[i];\n }\n }\n }\n if (typeof ret === 'undefined') {\n if (Math.abs(value) >= 10000) { // Add thousands separators\n ret = numberFormatter(value, -1);\n }\n else { // Small numbers\n ret = numberFormatter(value, -1, void 0, ''); // #2466\n }\n }\n return ret;\n }\n /**\n * Get the minimum and maximum for the series of each axis. The function\n * analyzes the axis series and updates `this.dataMin` and `this.dataMax`.\n *\n * @private\n * @function Highcharts.Axis#getSeriesExtremes\n *\n * @emits Highcharts.Axis#event:afterGetSeriesExtremes\n * @emits Highcharts.Axis#event:getSeriesExtremes\n */\n getSeriesExtremes() {\n const axis = this;\n let xExtremes;\n fireEvent(this, 'getSeriesExtremes', null, function () {\n axis.hasVisibleSeries = false;\n // Reset properties in case we're redrawing (#3353)\n axis.dataMin = axis.dataMax = axis.threshold = void 0;\n axis.softThreshold = !axis.isXAxis;\n // Loop through this axis' series\n axis.series.forEach((series) => {\n if (series.reserveSpace()) {\n const seriesOptions = series.options;\n let xData, threshold = seriesOptions.threshold, seriesDataMin, seriesDataMax;\n axis.hasVisibleSeries = true;\n // Validate threshold in logarithmic axes\n if (axis.positiveValuesOnly && (threshold || 0) <= 0) {\n threshold = void 0;\n }\n // Get dataMin and dataMax for X axes\n if (axis.isXAxis) {\n xData = series.xData;\n if (xData && xData.length) {\n xData = axis.logarithmic ?\n xData.filter((x) => x > 0) :\n xData;\n xExtremes = series.getXExtremes(xData);\n // If xData contains values which is not numbers,\n // then filter them out. To prevent performance hit,\n // we only do this after we have already found\n // seriesDataMin because in most cases all data is\n // valid. #5234.\n seriesDataMin = xExtremes.min;\n seriesDataMax = xExtremes.max;\n if (!isNumber(seriesDataMin) &&\n // #5010:\n !(seriesDataMin instanceof Date)) {\n xData = xData.filter(isNumber);\n xExtremes = series.getXExtremes(xData);\n // Do it again with valid data\n seriesDataMin = xExtremes.min;\n seriesDataMax = xExtremes.max;\n }\n if (xData.length) {\n axis.dataMin = Math.min(pick(axis.dataMin, seriesDataMin), seriesDataMin);\n axis.dataMax = Math.max(pick(axis.dataMax, seriesDataMax), seriesDataMax);\n }\n }\n // Get dataMin and dataMax for Y axes, as well as handle\n // stacking and processed data\n }\n else {\n // Get this particular series extremes\n const dataExtremes = series.applyExtremes();\n // Get the dataMin and dataMax so far. If percentage is\n // used, the min and max are always 0 and 100. If\n // seriesDataMin and seriesDataMax is null, then series\n // doesn't have active y data, we continue with nulls\n if (isNumber(dataExtremes.dataMin)) {\n seriesDataMin = dataExtremes.dataMin;\n axis.dataMin = Math.min(pick(axis.dataMin, seriesDataMin), seriesDataMin);\n }\n if (isNumber(dataExtremes.dataMax)) {\n seriesDataMax = dataExtremes.dataMax;\n axis.dataMax = Math.max(pick(axis.dataMax, seriesDataMax), seriesDataMax);\n }\n // Adjust to threshold\n if (defined(threshold)) {\n axis.threshold = threshold;\n }\n // If any series has a hard threshold, it takes\n // precedence\n if (!seriesOptions.softThreshold ||\n axis.positiveValuesOnly) {\n axis.softThreshold = false;\n }\n }\n }\n });\n });\n fireEvent(this, 'afterGetSeriesExtremes');\n }\n /**\n * Translate from axis value to pixel position on the chart, or back. Use\n * the `toPixels` and `toValue` functions in applications.\n *\n * @private\n * @function Highcharts.Axis#translate\n */\n translate(val, backwards, cvsCoord, old, handleLog, pointPlacement) {\n const axis = (this.linkedParent || this), // #1417\n localMin = (old && axis.old ? axis.old.min : axis.min);\n if (!isNumber(localMin)) {\n return NaN;\n }\n const minPixelPadding = axis.minPixelPadding, doPostTranslate = (axis.isOrdinal ||\n axis.brokenAxis?.hasBreaks ||\n (axis.logarithmic && handleLog)) && axis.lin2val;\n let sign = 1, cvsOffset = 0, localA = old && axis.old ? axis.old.transA : axis.transA, returnValue = 0;\n if (!localA) {\n localA = axis.transA;\n }\n // In vertical axes, the canvas coordinates start from 0 at the top like\n // in SVG.\n if (cvsCoord) {\n sign *= -1; // Canvas coordinates inverts the value\n cvsOffset = axis.len;\n }\n // Handle reversed axis\n if (axis.reversed) {\n sign *= -1;\n cvsOffset -= sign * (axis.sector || axis.len);\n }\n // From pixels to value\n if (backwards) { // Reverse translation\n val = val * sign + cvsOffset;\n val -= minPixelPadding;\n // From chart pixel to value:\n returnValue = val / localA + localMin;\n if (doPostTranslate) { // Log, ordinal and broken axis\n returnValue = axis.lin2val(returnValue);\n }\n // From value to pixels\n }\n else {\n if (doPostTranslate) { // Log, ordinal and broken axis\n val = axis.val2lin(val);\n }\n const value = sign * (val - localMin) * localA;\n returnValue = (!axis.isRadial ? correctFloat(value) : value) +\n cvsOffset +\n (sign * minPixelPadding) +\n (isNumber(pointPlacement) ? localA * pointPlacement : 0);\n }\n return returnValue;\n }\n /**\n * Translate a value in terms of axis units into pixels within the chart.\n *\n * @function Highcharts.Axis#toPixels\n *\n * @param {number} value\n * A value in terms of axis units.\n *\n * @param {boolean} paneCoordinates\n * Whether to return the pixel coordinate relative to the chart or just the\n * axis/pane itself.\n *\n * @return {number}\n * Pixel position of the value on the chart or axis.\n */\n toPixels(value, paneCoordinates) {\n return this.translate(value, false, !this.horiz, void 0, true) +\n (paneCoordinates ? 0 : this.pos);\n }\n /**\n * Translate a pixel position along the axis to a value in terms of axis\n * units.\n *\n * @function Highcharts.Axis#toValue\n *\n * @param {number} pixel\n * The pixel value coordinate.\n *\n * @param {boolean} [paneCoordinates=false]\n * Whether the input pixel is relative to the chart or just the axis/pane\n * itself.\n *\n * @return {number}\n * The axis value.\n */\n toValue(pixel, paneCoordinates) {\n return this.translate(pixel - (paneCoordinates ? 0 : this.pos), true, !this.horiz, void 0, true);\n }\n /**\n * Create the path for a plot line that goes from the given value on\n * this axis, across the plot to the opposite side. Also used internally for\n * grid lines and crosshairs.\n *\n * @function Highcharts.Axis#getPlotLinePath\n *\n * @param {Highcharts.AxisPlotLinePathOptionsObject} options\n * Options for the path.\n *\n * @return {Highcharts.SVGPathArray|null}\n * The SVG path definition for the plot line.\n */\n getPlotLinePath(options) {\n const axis = this, chart = axis.chart, axisLeft = axis.left, axisTop = axis.top, old = options.old, value = options.value, lineWidth = options.lineWidth, cHeight = (old && chart.oldChartHeight) || chart.chartHeight, cWidth = (old && chart.oldChartWidth) || chart.chartWidth, transB = axis.transB;\n let translatedValue = options.translatedValue, force = options.force, x1, y1, x2, y2, skip;\n // eslint-disable-next-line valid-jsdoc\n /**\n * Check if x is between a and b. If not, either move to a/b\n * or skip, depending on the force parameter.\n * @private\n */\n function between(x, a, b) {\n if (force !== 'pass' && (x < a || x > b)) {\n if (force) {\n x = clamp(x, a, b);\n }\n else {\n skip = true;\n }\n }\n return x;\n }\n const evt = {\n value,\n lineWidth,\n old,\n force,\n acrossPanes: options.acrossPanes,\n translatedValue\n };\n fireEvent(this, 'getPlotLinePath', evt, function (e) {\n translatedValue = pick(translatedValue, axis.translate(value, void 0, void 0, old));\n // Keep the translated value within sane bounds, and avoid Infinity\n // to fail the isNumber test (#7709).\n translatedValue = clamp(translatedValue, -1e5, 1e5);\n x1 = x2 = Math.round(translatedValue + transB);\n y1 = y2 = Math.round(cHeight - translatedValue - transB);\n if (!isNumber(translatedValue)) { // No min or max\n skip = true;\n force = false; // #7175, don't force it when path is invalid\n }\n else if (axis.horiz) {\n y1 = axisTop;\n y2 = cHeight - axis.bottom + (chart.scrollablePixelsY || 0);\n x1 = x2 = between(x1, axisLeft, axisLeft + axis.width);\n }\n else {\n x1 = axisLeft;\n x2 = cWidth - axis.right + (chart.scrollablePixelsX || 0);\n y1 = y2 = between(y1, axisTop, axisTop + axis.height);\n }\n e.path = skip && !force ?\n void 0 :\n chart.renderer.crispLine([['M', x1, y1], ['L', x2, y2]], lineWidth || 1);\n });\n return evt.path;\n }\n /**\n * Internal function to get the tick positions of a linear axis to round\n * values like whole tens or every five.\n *\n * @function Highcharts.Axis#getLinearTickPositions\n *\n * @param {number} tickInterval\n * The normalized tick interval.\n *\n * @param {number} min\n * Axis minimum.\n *\n * @param {number} max\n * Axis maximum.\n *\n * @return {Array}\n * An array of axis values where ticks should be placed.\n */\n getLinearTickPositions(tickInterval, min, max) {\n const roundedMin = correctFloat(Math.floor(min / tickInterval) * tickInterval), roundedMax = correctFloat(Math.ceil(max / tickInterval) * tickInterval), tickPositions = [];\n let pos, lastPos, precision;\n // When the precision is higher than what we filter out in\n // correctFloat, skip it (#6183).\n if (correctFloat(roundedMin + tickInterval) === roundedMin) {\n precision = 20;\n }\n // For single points, add a tick regardless of the relative position\n // (#2662, #6274)\n if (this.single) {\n return [min];\n }\n // Populate the intermediate values\n pos = roundedMin;\n while (pos <= roundedMax) {\n // Place the tick on the rounded value\n tickPositions.push(pos);\n // Always add the raw tickInterval, not the corrected one.\n pos = correctFloat(pos + tickInterval, precision);\n // If the interval is not big enough in the current min - max range\n // to actually increase the loop variable, we need to break out to\n // prevent endless loop. Issue #619\n if (pos === lastPos) {\n break;\n }\n // Record the last value\n lastPos = pos;\n }\n return tickPositions;\n }\n /**\n * Resolve the new minorTicks/minorTickInterval options into the legacy\n * loosely typed minorTickInterval option.\n *\n * @function Highcharts.Axis#getMinorTickInterval\n *\n * @return {number|\"auto\"|null}\n * Legacy option\n */\n getMinorTickInterval() {\n const { minorTicks, minorTickInterval } = this.options;\n if (minorTicks === true) {\n return pick(minorTickInterval, 'auto');\n }\n if (minorTicks === false) {\n return;\n }\n return minorTickInterval;\n }\n /**\n * Internal function to return the minor tick positions. For logarithmic\n * axes, the same logic as for major ticks is reused.\n *\n * @function Highcharts.Axis#getMinorTickPositions\n *\n * @return {Array}\n * An array of axis values where ticks should be placed.\n */\n getMinorTickPositions() {\n const axis = this, options = axis.options, tickPositions = axis.tickPositions, minorTickInterval = axis.minorTickInterval, pointRangePadding = axis.pointRangePadding || 0, min = (axis.min || 0) - pointRangePadding, // #1498\n max = (axis.max || 0) + pointRangePadding, // #1498\n range = max - min;\n let minorTickPositions = [], pos;\n // If minor ticks get too dense, they are hard to read, and may cause\n // long running script. So we don't draw them.\n if (range && range / minorTickInterval < axis.len / 3) { // #3875\n const logarithmic = axis.logarithmic;\n if (logarithmic) {\n // For each interval in the major ticks, compute the minor ticks\n // separately.\n this.paddedTicks.forEach(function (_pos, i, paddedTicks) {\n if (i) {\n minorTickPositions.push.apply(minorTickPositions, logarithmic.getLogTickPositions(minorTickInterval, paddedTicks[i - 1], paddedTicks[i], true));\n }\n });\n }\n else if (axis.dateTime &&\n this.getMinorTickInterval() === 'auto') { // #1314\n minorTickPositions = minorTickPositions.concat(axis.getTimeTicks(axis.dateTime.normalizeTimeTickInterval(minorTickInterval), min, max, options.startOfWeek));\n }\n else {\n for (pos = min + (tickPositions[0] - min) % minorTickInterval; pos <= max; pos += minorTickInterval) {\n // Very, very, tight grid lines (#5771)\n if (pos === minorTickPositions[0]) {\n break;\n }\n minorTickPositions.push(pos);\n }\n }\n }\n if (minorTickPositions.length !== 0) {\n axis.trimTicks(minorTickPositions); // #3652 #3743 #1498 #6330\n }\n return minorTickPositions;\n }\n /**\n * Adjust the min and max for the minimum range. Keep in mind that the\n * series data is not yet processed, so we don't have information on data\n * cropping and grouping, or updated `axis.pointRange` or\n * `series.pointRange`. The data can't be processed until we have finally\n * established min and max.\n *\n * @private\n * @function Highcharts.Axis#adjustForMinRange\n */\n adjustForMinRange() {\n const axis = this, options = axis.options, logarithmic = axis.logarithmic;\n let { max, min, minRange } = axis, zoomOffset, spaceAvailable, closestDataRange, minArgs, maxArgs;\n // Set the automatic minimum range based on the closest point distance\n if (axis.isXAxis &&\n typeof minRange === 'undefined' &&\n !logarithmic) {\n if (defined(options.min) ||\n defined(options.max) ||\n defined(options.floor) ||\n defined(options.ceiling)) {\n // Setting it to null, as opposed to undefined, signals we don't\n // run this block again as per the condition above.\n minRange = null;\n }\n else {\n // Find the closest distance between raw data points, as opposed\n // to closestPointRange that applies to processed points\n // (cropped and grouped)\n closestDataRange = getClosestDistance(axis.series.map((s) => \n // If xIncrement, we only need to measure the two first\n // points to get the distance. Saves processing time.\n (s.xIncrement ? s.xData?.slice(0, 2) : s.xData) || [])) || 0;\n minRange = Math.min(closestDataRange * 5, axis.dataMax - axis.dataMin);\n }\n }\n // If minRange is exceeded, adjust\n if (isNumber(max) &&\n isNumber(min) &&\n isNumber(minRange) &&\n max - min < minRange) {\n spaceAvailable =\n axis.dataMax - axis.dataMin >=\n minRange;\n zoomOffset = (minRange - max + min) / 2;\n // If min and max options have been set, don't go beyond it\n minArgs = [\n min - zoomOffset,\n pick(options.min, min - zoomOffset)\n ];\n // If space is available, stay within the data range\n if (spaceAvailable) {\n minArgs[2] = logarithmic ?\n logarithmic.log2lin(axis.dataMin) :\n axis.dataMin;\n }\n min = arrayMax(minArgs);\n maxArgs = [\n min + minRange,\n pick(options.max, min + minRange)\n ];\n // If space is available, stay within the data range\n if (spaceAvailable) {\n maxArgs[2] = logarithmic ?\n logarithmic.log2lin(axis.dataMax) :\n axis.dataMax;\n }\n max = arrayMin(maxArgs);\n // Now if the max is adjusted, adjust the min back\n if (max - min < minRange) {\n minArgs[0] = max - minRange;\n minArgs[1] = pick(options.min, max - minRange);\n min = arrayMax(minArgs);\n }\n }\n // Record modified extremes\n axis.minRange = minRange;\n axis.min = min;\n axis.max = max;\n }\n /**\n * Find the closestPointRange across all series, including the single data\n * series.\n *\n * @private\n * @function Highcharts.Axis#getClosest\n */\n getClosest() {\n let closestSingleDistance, closestDistance;\n if (this.categories) {\n closestDistance = 1;\n }\n else {\n const singleXs = [];\n this.series.forEach(function (series) {\n const seriesClosest = series.closestPointRange;\n if (series.xData?.length === 1) {\n singleXs.push(series.xData[0]);\n }\n else if (!series.noSharedTooltip &&\n defined(seriesClosest) &&\n series.reserveSpace()) {\n closestDistance = defined(closestDistance) ?\n Math.min(closestDistance, seriesClosest) :\n seriesClosest;\n }\n });\n if (singleXs.length) {\n singleXs.sort((a, b) => a - b);\n closestSingleDistance = getClosestDistance([singleXs]);\n }\n }\n if (closestSingleDistance && closestDistance) {\n return Math.min(closestSingleDistance, closestDistance);\n }\n return closestSingleDistance || closestDistance;\n }\n /**\n * When a point name is given and no x, search for the name in the existing\n * categories, or if categories aren't provided, search names or create a\n * new category (#2522).\n *\n * @private\n * @function Highcharts.Axis#nameToX\n *\n * @param {Highcharts.Point} point\n * The point to inspect.\n *\n * @return {number}\n * The X value that the point is given.\n */\n nameToX(point) {\n const explicitCategories = isArray(this.options.categories), names = explicitCategories ? this.categories : this.names;\n let nameX = point.options.x, x;\n point.series.requireSorting = false;\n if (!defined(nameX)) {\n nameX = this.options.uniqueNames && names ?\n (explicitCategories ?\n names.indexOf(point.name) :\n pick(names.keys[point.name], -1)) :\n point.series.autoIncrement();\n }\n if (nameX === -1) { // Not found in current categories\n if (!explicitCategories && names) {\n x = names.length;\n }\n }\n else {\n x = nameX;\n }\n // Write the last point's name to the names array\n if (typeof x !== 'undefined') {\n this.names[x] = point.name;\n // Backwards mapping is much faster than array searching (#7725)\n this.names.keys[point.name] = x;\n }\n else if (point.x) {\n x = point.x; // #17438\n }\n return x;\n }\n /**\n * When changes have been done to series data, update the axis.names.\n *\n * @private\n * @function Highcharts.Axis#updateNames\n */\n updateNames() {\n const axis = this, names = this.names, i = names.length;\n if (i > 0) {\n Object.keys(names.keys).forEach(function (key) {\n delete (names.keys)[key];\n });\n names.length = 0;\n this.minRange = this.userMinRange; // Reset\n (this.series || []).forEach((series) => {\n // Reset incrementer (#5928)\n series.xIncrement = null;\n // When adding a series, points are not yet generated\n if (!series.points || series.isDirtyData) {\n // When we're updating the series with data that is longer\n // than it was, and cropThreshold is passed, we need to make\n // sure that the axis.max is increased _before_ running the\n // premature processData. Otherwise this early iteration of\n // processData will crop the points to axis.max, and the\n // names array will be too short (#5857).\n axis.max = Math.max(axis.max, series.xData.length - 1);\n series.processData();\n series.generatePoints();\n }\n series.data.forEach(function (point, i) {\n let x;\n if (point?.options &&\n typeof point.name !== 'undefined' // #9562\n ) {\n x = axis.nameToX(point);\n if (typeof x !== 'undefined' && x !== point.x) {\n point.x = x;\n series.xData[i] = x;\n }\n }\n });\n });\n }\n }\n /**\n * Update translation information.\n *\n * @private\n * @function Highcharts.Axis#setAxisTranslation\n *\n * @emits Highcharts.Axis#event:afterSetAxisTranslation\n */\n setAxisTranslation() {\n const axis = this, range = axis.max - axis.min, linkedParent = axis.linkedParent, hasCategories = !!axis.categories, isXAxis = axis.isXAxis;\n let pointRange = axis.axisPointRange || 0, closestPointRange, minPointOffset = 0, pointRangePadding = 0, ordinalCorrection, transA = axis.transA;\n // Adjust translation for padding. Y axis with categories need to go\n // through the same (#1784).\n if (isXAxis || hasCategories || pointRange) {\n // Get the closest points\n closestPointRange = axis.getClosest();\n if (linkedParent) {\n minPointOffset = linkedParent.minPointOffset;\n pointRangePadding = linkedParent.pointRangePadding;\n }\n else {\n axis.series.forEach(function (series) {\n const seriesPointRange = hasCategories ?\n 1 :\n (isXAxis ?\n pick(series.options.pointRange, closestPointRange, 0) :\n (axis.axisPointRange || 0)), // #2806\n pointPlacement = series.options.pointPlacement;\n pointRange = Math.max(pointRange, seriesPointRange);\n if (!axis.single || hasCategories) {\n // TODO: series should internally set x- and y-\n // pointPlacement to simplify this logic.\n const isPointPlacementAxis = series.is('xrange') ?\n !isXAxis :\n isXAxis;\n // The `minPointOffset` is the value padding to the left\n // of the axis in order to make room for points with a\n // pointRange, typically columns. When the\n // pointPlacement option is 'between' or 'on', this\n // padding does not apply.\n minPointOffset = Math.max(minPointOffset, isPointPlacementAxis && isString(pointPlacement) ?\n 0 :\n seriesPointRange / 2);\n // Determine the total padding needed to the length of\n // the axis to make room for the pointRange. If the\n // series' pointPlacement is 'on', no padding is added.\n pointRangePadding = Math.max(pointRangePadding, isPointPlacementAxis && pointPlacement === 'on' ?\n 0 :\n seriesPointRange);\n }\n });\n }\n // Record minPointOffset and pointRangePadding\n ordinalCorrection = (axis.ordinal && axis.ordinal.slope && closestPointRange) ?\n axis.ordinal.slope / closestPointRange :\n 1; // #988, #1853\n axis.minPointOffset = minPointOffset =\n minPointOffset * ordinalCorrection;\n axis.pointRangePadding =\n pointRangePadding = pointRangePadding * ordinalCorrection;\n // The `pointRange` is the width reserved for each point, like in a\n // column chart\n axis.pointRange = Math.min(pointRange, axis.single && hasCategories ? 1 : range);\n // The `closestPointRange` is the closest distance between points.\n // In columns it is mostly equal to pointRange, but in lines\n // pointRange is 0 while closestPointRange is some other value\n if (isXAxis && closestPointRange) {\n axis.closestPointRange = closestPointRange;\n }\n }\n // Secondary values\n axis.translationSlope = axis.transA = transA =\n axis.staticScale ||\n axis.len / ((range + pointRangePadding) || 1);\n // Translation addend\n axis.transB = axis.horiz ? axis.left : axis.bottom;\n axis.minPixelPadding = transA * minPointOffset;\n fireEvent(this, 'afterSetAxisTranslation');\n }\n /**\n * @private\n * @function Highcharts.Axis#minFromRange\n */\n minFromRange() {\n const { max, min } = this;\n return isNumber(max) && isNumber(min) && max - min || void 0;\n }\n /**\n * Set the tick positions to round values and optionally extend the extremes\n * to the nearest tick.\n *\n * @private\n * @function Highcharts.Axis#setTickInterval\n *\n * @param {boolean} secondPass\n * TO-DO: parameter description\n *\n * @emits Highcharts.Axis#event:foundExtremes\n */\n setTickInterval(secondPass) {\n const axis = this, { categories, chart, dataMax, dataMin, dateTime, isXAxis, logarithmic, options, softThreshold } = axis, threshold = isNumber(axis.threshold) ? axis.threshold : void 0, minRange = axis.minRange || 0, { ceiling, floor, linkedTo, softMax, softMin } = options, linkedParent = isNumber(linkedTo) && chart[axis.coll]?.[linkedTo], tickPixelIntervalOption = options.tickPixelInterval;\n let maxPadding = options.maxPadding, minPadding = options.minPadding, range = 0, linkedParentExtremes, \n // Only non-negative tickInterval is valid, #12961\n tickIntervalOption = isNumber(options.tickInterval) && options.tickInterval >= 0 ?\n options.tickInterval : void 0, thresholdMin, thresholdMax, hardMin, hardMax;\n if (!dateTime && !categories && !linkedParent) {\n this.getTickAmount();\n }\n // Min or max set either by zooming/setExtremes or initial options\n hardMin = pick(axis.userMin, options.min);\n hardMax = pick(axis.userMax, options.max);\n // Linked axis gets the extremes from the parent axis\n if (linkedParent) {\n axis.linkedParent = linkedParent;\n linkedParentExtremes = linkedParent.getExtremes();\n axis.min = pick(linkedParentExtremes.min, linkedParentExtremes.dataMin);\n axis.max = pick(linkedParentExtremes.max, linkedParentExtremes.dataMax);\n if (options.type !== linkedParent.options.type) {\n // Can't link axes of different type\n error(11, true, chart);\n }\n // Initial min and max from the extreme data values\n }\n else {\n // Adjust to hard threshold\n if (softThreshold &&\n defined(threshold) &&\n isNumber(dataMax) &&\n isNumber(dataMin)) {\n if (dataMin >= threshold) {\n thresholdMin = threshold;\n minPadding = 0;\n }\n else if (dataMax <= threshold) {\n thresholdMax = threshold;\n maxPadding = 0;\n }\n }\n axis.min = pick(hardMin, thresholdMin, dataMin);\n axis.max = pick(hardMax, thresholdMax, dataMax);\n }\n if (isNumber(axis.max) && isNumber(axis.min)) {\n if (logarithmic) {\n if (axis.positiveValuesOnly &&\n !secondPass &&\n Math.min(axis.min, pick(dataMin, axis.min)) <= 0) { // #978\n // Can't plot negative values on log axis\n error(10, true, chart);\n }\n // The correctFloat cures #934, float errors on full tens. But\n // it was too aggressive for #4360 because of conversion back to\n // lin, therefore use precision 15.\n axis.min = correctFloat(logarithmic.log2lin(axis.min), 16);\n axis.max = correctFloat(logarithmic.log2lin(axis.max), 16);\n }\n // Handle zoomed range\n if (axis.range && isNumber(dataMin)) {\n // #618, #6773:\n axis.userMin = axis.min = hardMin = Math.max(dataMin, axis.minFromRange() || 0);\n axis.userMax = hardMax = axis.max;\n axis.range = void 0; // Don't use it when running setExtremes\n }\n }\n // Hook for Highcharts Stock Scroller and bubble axis padding\n fireEvent(axis, 'foundExtremes');\n // Adjust min and max for the minimum range\n axis.adjustForMinRange();\n if (isNumber(axis.min) && isNumber(axis.max)) {\n // Handle options for floor, ceiling, softMin and softMax (#6359)\n if (!isNumber(axis.userMin) &&\n isNumber(softMin) &&\n softMin < axis.min) {\n axis.min = hardMin = softMin; // #6894\n }\n if (!isNumber(axis.userMax) &&\n isNumber(softMax) &&\n softMax > axis.max) {\n axis.max = hardMax = softMax; // #6894\n }\n // Pad the values to get clear of the chart's edges. To avoid\n // tickInterval taking the padding into account, we do this after\n // computing tick interval (#1337).\n if (!categories &&\n !axis.axisPointRange &&\n !axis.stacking?.usePercentage &&\n !linkedParent) {\n range = axis.max - axis.min;\n if (range) {\n if (!defined(hardMin) && minPadding) {\n axis.min -= range * minPadding;\n }\n if (!defined(hardMax) && maxPadding) {\n axis.max += range * maxPadding;\n }\n }\n }\n if (!isNumber(axis.userMin) && isNumber(floor)) {\n axis.min = Math.max(axis.min, floor);\n }\n if (!isNumber(axis.userMax) && isNumber(ceiling)) {\n axis.max = Math.min(axis.max, ceiling);\n }\n // When the threshold is soft, adjust the extreme value only if the\n // data extreme and the padded extreme land on either side of the\n // threshold. For example, a series of [0, 1, 2, 3] would make the\n // yAxis add a tick for -1 because of the default `minPadding` and\n // `startOnTick` options. This is prevented by the `softThreshold`\n // option.\n if (softThreshold &&\n isNumber(dataMin) &&\n isNumber(dataMax)) {\n const numThreshold = threshold || 0;\n if (!defined(hardMin) &&\n axis.min < numThreshold &&\n dataMin >= numThreshold) {\n axis.min = options.minRange ?\n Math.min(numThreshold, axis.max - minRange) :\n numThreshold;\n }\n else if (!defined(hardMax) &&\n axis.max > numThreshold &&\n dataMax <= numThreshold) {\n axis.max = options.minRange ?\n Math.max(numThreshold, axis.min + minRange) :\n numThreshold;\n }\n }\n // If min is bigger than highest, or if max less than lowest value,\n // the chart should not render points. (#14417)\n if (!chart.polar && axis.min > axis.max) {\n if (defined(options.min)) {\n axis.max = axis.min;\n }\n else if (defined(options.max)) {\n axis.min = axis.max;\n }\n }\n range = axis.max - axis.min;\n }\n // Get tickInterval\n if (axis.min === axis.max ||\n !isNumber(axis.min) ||\n !isNumber(axis.max)) {\n axis.tickInterval = 1;\n }\n else if (linkedParent &&\n !tickIntervalOption &&\n tickPixelIntervalOption === linkedParent.options.tickPixelInterval) {\n axis.tickInterval = tickIntervalOption = linkedParent.tickInterval;\n }\n else {\n axis.tickInterval = pick(tickIntervalOption, this.tickAmount ?\n range / Math.max(this.tickAmount - 1, 1) :\n void 0, \n // For categorized axis, 1 is default, for linear axis use\n // tickPix\n categories ?\n 1 :\n // Don't let it be more than the data range\n range * tickPixelIntervalOption /\n Math.max(axis.len, tickPixelIntervalOption));\n }\n // Now we're finished detecting min and max, crop and group series data.\n // This is in turn needed in order to find tick positions in ordinal\n // axes.\n if (isXAxis && !secondPass) {\n const hasExtremesChanged = axis.min !== axis.old?.min ||\n axis.max !== axis.old?.max;\n // First process all series assigned to that axis.\n axis.series.forEach(function (series) {\n // Allows filtering out points outside the plot area.\n series.forceCrop = series.forceCropping?.();\n series.processData(hasExtremesChanged);\n });\n // Then apply grouping if needed. The hasExtremesChanged helps to\n // decide if the data grouping should be skipped in the further\n // calculations #16319.\n fireEvent(this, 'postProcessData', { hasExtremesChanged });\n }\n // Set the translation factor used in translate function\n axis.setAxisTranslation();\n // Hook for ordinal axes and radial axes\n fireEvent(this, 'initialAxisTranslation');\n // In column-like charts, don't cramp in more ticks than there are\n // points (#1943, #4184)\n if (axis.pointRange && !tickIntervalOption) {\n axis.tickInterval = Math.max(axis.pointRange, axis.tickInterval);\n }\n // Before normalizing the tick interval, handle minimum tick interval.\n // This applies only if tickInterval is not defined.\n const minTickInterval = pick(options.minTickInterval, \n // In datetime axes, don't go below the data interval, except when\n // there are scatter-like series involved (#13369).\n dateTime &&\n !axis.series.some((s) => s.noSharedTooltip) ?\n axis.closestPointRange : 0);\n if (!tickIntervalOption && axis.tickInterval < minTickInterval) {\n axis.tickInterval = minTickInterval;\n }\n // For linear axes, normalize the interval\n if (!dateTime && !logarithmic && !tickIntervalOption) {\n axis.tickInterval = getNormalizedTickInterval(axis, axis.tickInterval);\n }\n // Prevent ticks from getting so close that we can't draw the labels\n if (!this.tickAmount) {\n axis.tickInterval = axis.unsquish();\n }\n this.setTickPositions();\n }\n /**\n * Now we have computed the normalized tickInterval, get the tick positions.\n *\n * @private\n * @function Highcharts.Axis#setTickPositions\n *\n * @emits Highcharts.Axis#event:afterSetTickPositions\n */\n setTickPositions() {\n const axis = this, options = this.options, tickPositionsOption = options.tickPositions, tickPositioner = options.tickPositioner, minorTickIntervalOption = this.getMinorTickInterval(), allowEndOnTick = !this.isPanning, startOnTick = allowEndOnTick && options.startOnTick, endOnTick = allowEndOnTick && options.endOnTick;\n let tickPositions = [], tickPositionerResult;\n // Set the tickmarkOffset\n this.tickmarkOffset = (this.categories &&\n options.tickmarkPlacement === 'between' &&\n this.tickInterval === 1) ? 0.5 : 0; // #3202\n // Get minorTickInterval\n this.minorTickInterval =\n minorTickIntervalOption === 'auto' &&\n this.tickInterval ?\n this.tickInterval / options.minorTicksPerMajor :\n minorTickIntervalOption;\n // When there is only one point, or all points have the same value on\n // this axis, then min and max are equal and tickPositions.length is 0\n // or 1. In this case, add some padding in order to center the point,\n // but leave it with one tick. #1337.\n this.single =\n this.min === this.max &&\n defined(this.min) &&\n !this.tickAmount &&\n (\n // Data is on integer (#6563)\n this.min % 1 === 0 ||\n // Between integers and decimals are not allowed (#6274)\n options.allowDecimals !== false);\n /**\n * Contains the current positions that are laid out on the axis. The\n * positions are numbers in terms of axis values. In a category axis\n * they are integers, in a datetime axis they are also integers, but\n * designating milliseconds.\n *\n * This property is read only - for modifying the tick positions, use\n * the `tickPositioner` callback or [axis.tickPositions(\n * https://api.highcharts.com/highcharts/xAxis.tickPositions) option\n * instead.\n *\n * @name Highcharts.Axis#tickPositions\n * @type {Highcharts.AxisTickPositionsArray|undefined}\n */\n if (tickPositionsOption) {\n // Find the tick positions. Work on a copy (#1565)\n tickPositions = tickPositionsOption.slice();\n }\n else if (isNumber(this.min) && isNumber(this.max)) {\n // Too many ticks (#6405). Create a friendly warning and provide two\n // ticks so at least we can show the data series.\n if (!axis.ordinal?.positions &&\n ((this.max - this.min) /\n this.tickInterval >\n Math.max(2 * this.len, 200))) {\n tickPositions = [this.min, this.max];\n error(19, false, this.chart);\n }\n else if (axis.dateTime) {\n tickPositions = axis.getTimeTicks(axis.dateTime.normalizeTimeTickInterval(this.tickInterval, options.units), this.min, this.max, options.startOfWeek, axis.ordinal?.positions, this.closestPointRange, true);\n }\n else if (axis.logarithmic) {\n tickPositions = axis.logarithmic.getLogTickPositions(this.tickInterval, this.min, this.max);\n }\n else {\n const startingTickInterval = this.tickInterval;\n let adjustedTickInterval = startingTickInterval;\n while (adjustedTickInterval <= startingTickInterval * 2) {\n tickPositions = this.getLinearTickPositions(this.tickInterval, this.min, this.max);\n // If there are more tick positions than the set tickAmount,\n // increase the tickInterval and continue until it fits.\n // (#17100)\n if (this.tickAmount &&\n tickPositions.length > this.tickAmount) {\n this.tickInterval = getNormalizedTickInterval(this, adjustedTickInterval *= 1.1);\n }\n else {\n break;\n }\n }\n }\n // Too dense ticks, keep only the first and last (#4477)\n if (tickPositions.length > this.len) {\n tickPositions = [\n tickPositions[0],\n tickPositions[tickPositions.length - 1]\n ];\n // Reduce doubled value (#7339)\n if (tickPositions[0] === tickPositions[1]) {\n tickPositions.length = 1;\n }\n }\n // Run the tick positioner callback, that allows modifying auto tick\n // positions.\n if (tickPositioner) {\n // Make it available to the positioner\n this.tickPositions = tickPositions;\n tickPositionerResult = tickPositioner.apply(axis, [this.min, this.max]);\n if (tickPositionerResult) {\n tickPositions = tickPositionerResult;\n }\n }\n }\n this.tickPositions = tickPositions;\n // Reset min/max or remove extremes based on start/end on tick\n this.paddedTicks = tickPositions.slice(0); // Used for logarithmic minor\n this.trimTicks(tickPositions, startOnTick, endOnTick);\n if (!this.isLinked && isNumber(this.min) && isNumber(this.max)) {\n // Substract half a unit (#2619, #2846, #2515, #3390), but not in\n // case of multiple ticks (#6897)\n if (this.single &&\n tickPositions.length < 2 &&\n !this.categories &&\n !this.series.some((s) => (s.is('heatmap') && s.options.pointPlacement === 'between'))) {\n this.min -= 0.5;\n this.max += 0.5;\n }\n if (!tickPositionsOption && !tickPositionerResult) {\n this.adjustTickAmount();\n }\n }\n fireEvent(this, 'afterSetTickPositions');\n }\n /**\n * Handle startOnTick and endOnTick by either adapting to padding min/max or\n * rounded min/max. Also handle single data points.\n *\n * @private\n * @function Highcharts.Axis#trimTicks\n *\n * @param {Array} tickPositions\n * TO-DO: parameter description\n *\n * @param {boolean} [startOnTick]\n * TO-DO: parameter description\n *\n * @param {boolean} [endOnTick]\n * TO-DO: parameter description\n */\n trimTicks(tickPositions, startOnTick, endOnTick) {\n const roundedMin = tickPositions[0], roundedMax = tickPositions[tickPositions.length - 1], minPointOffset = (!this.isOrdinal && this.minPointOffset) || 0; // (#12716)\n fireEvent(this, 'trimTicks');\n if (!this.isLinked) {\n if (startOnTick && roundedMin !== -Infinity) { // #6502\n this.min = roundedMin;\n }\n else {\n while (this.min - minPointOffset > tickPositions[0]) {\n tickPositions.shift();\n }\n }\n if (endOnTick) {\n this.max = roundedMax;\n }\n else {\n while (this.max + minPointOffset <\n tickPositions[tickPositions.length - 1]) {\n tickPositions.pop();\n }\n }\n // If no tick are left, set one tick in the middle (#3195)\n if (tickPositions.length === 0 &&\n defined(roundedMin) &&\n !this.options.tickPositions) {\n tickPositions.push((roundedMax + roundedMin) / 2);\n }\n }\n }\n /**\n * Check if there are multiple axes in the same pane.\n *\n * @private\n * @function Highcharts.Axis#alignToOthers\n *\n * @return {boolean|undefined}\n * True if there are other axes.\n */\n alignToOthers() {\n const axis = this, chart = axis.chart, alignedAxes = [this], options = axis.options, chartOptions = chart.options.chart, alignThresholds = (this.coll === 'yAxis' &&\n chartOptions.alignThresholds), thresholdAlignments = [];\n let hasOther;\n axis.thresholdAlignment = void 0;\n if ((\n // Only if alignTicks or alignThresholds is true\n (chartOptions.alignTicks !== false && options.alignTicks) ||\n alignThresholds) &&\n // Disabled when startOnTick or endOnTick are false (#7604)\n options.startOnTick !== false &&\n options.endOnTick !== false &&\n // Don't try to align ticks on a log axis, they are not evenly\n // spaced (#6021)\n !axis.logarithmic) {\n // Get a key identifying which pane the axis belongs to\n const getKey = (axis) => {\n const { horiz, options } = axis;\n return [\n horiz ? options.left : options.top,\n options.width,\n options.height,\n options.pane\n ].join(',');\n };\n const thisKey = getKey(this);\n chart[this.coll].forEach(function (otherAxis) {\n const { series } = otherAxis;\n if (\n // #4442\n series.length &&\n series.some((s) => s.visible) &&\n otherAxis !== axis &&\n getKey(otherAxis) === thisKey) {\n hasOther = true; // #4201\n alignedAxes.push(otherAxis);\n }\n });\n }\n if (hasOther && alignThresholds) {\n // Handle alignThresholds. The `thresholdAlignments` array keeps\n // records of where each axis in the group wants its threshold, from\n // 0 which is on `axis.min`, to 1 which is on `axis.max`.\n alignedAxes.forEach((otherAxis) => {\n const threshAlign = otherAxis.getThresholdAlignment(axis);\n if (isNumber(threshAlign)) {\n thresholdAlignments.push(threshAlign);\n }\n });\n // For each of the axes in the group, record the average\n // `thresholdAlignment`.\n const thresholdAlignment = thresholdAlignments.length > 1 ?\n thresholdAlignments.reduce((sum, n) => (sum += n), 0) / thresholdAlignments.length :\n void 0;\n alignedAxes.forEach((axis) => {\n axis.thresholdAlignment = thresholdAlignment;\n });\n }\n return hasOther;\n }\n /**\n * Where the axis wants its threshold, from 0 which is on `axis.min`, to 1 which\n * is on `axis.max`.\n *\n * @private\n * @function Highcharts.Axis#getThresholdAlignment\n */\n getThresholdAlignment(callerAxis) {\n if (!isNumber(this.dataMin) ||\n (this !== callerAxis &&\n this.series.some((s) => (s.isDirty || s.isDirtyData)))) {\n this.getSeriesExtremes();\n }\n if (isNumber(this.threshold)) {\n let thresholdAlignment = clamp(((this.threshold - (this.dataMin || 0)) /\n ((this.dataMax || 0) - (this.dataMin || 0))), 0, 1);\n if (this.options.reversed) {\n thresholdAlignment = 1 - thresholdAlignment;\n }\n return thresholdAlignment;\n }\n }\n /**\n * Find the max ticks of either the x and y axis collection, and record it\n * in `this.tickAmount`.\n *\n * @private\n * @function Highcharts.Axis#getTickAmount\n */\n getTickAmount() {\n const axis = this, options = this.options, tickPixelInterval = options.tickPixelInterval;\n let tickAmount = options.tickAmount;\n if (!defined(options.tickInterval) &&\n !tickAmount &&\n this.len < tickPixelInterval &&\n !this.isRadial &&\n !axis.logarithmic &&\n options.startOnTick &&\n options.endOnTick) {\n tickAmount = 2;\n }\n if (!tickAmount && this.alignToOthers()) {\n // Add 1 because 4 tick intervals require 5 ticks (including first\n // and last)\n tickAmount = Math.ceil(this.len / tickPixelInterval) + 1;\n }\n // For tick amounts of 2 and 3, compute five ticks and remove the\n // intermediate ones. This prevents the axis from adding ticks that are\n // too far away from the data extremes.\n if (tickAmount < 4) {\n this.finalTickAmt = tickAmount;\n tickAmount = 5;\n }\n this.tickAmount = tickAmount;\n }\n /**\n * When using multiple axes, adjust the number of ticks to match the highest\n * number of ticks in that group.\n *\n * @private\n * @function Highcharts.Axis#adjustTickAmount\n */\n adjustTickAmount() {\n const axis = this, { finalTickAmt, max, min, options, tickPositions, tickAmount, thresholdAlignment } = axis, currentTickAmount = tickPositions?.length, threshold = pick(axis.threshold, axis.softThreshold ? 0 : null);\n let len, i, tickInterval = axis.tickInterval, thresholdTickIndex;\n const \n // Extend the tickPositions by appending a position\n append = () => tickPositions.push(correctFloat(tickPositions[tickPositions.length - 1] +\n tickInterval)), \n // Extend the tickPositions by prepending a position\n prepend = () => tickPositions.unshift(correctFloat(tickPositions[0] - tickInterval));\n // If `thresholdAlignment` is a number, it means the `alignThresholds`\n // option is true. The `thresholdAlignment` is a scalar value between 0\n // and 1 for where the threshold should be relative to `axis.min` and\n // `axis.max`. Now that we know the tick amount, convert this to the\n // tick index. Unless `thresholdAlignment` is exactly 0 or 1, avoid the\n // first or last tick because that would lead to series being clipped.\n if (isNumber(thresholdAlignment)) {\n thresholdTickIndex = thresholdAlignment < 0.5 ?\n Math.ceil(thresholdAlignment * (tickAmount - 1)) :\n Math.floor(thresholdAlignment * (tickAmount - 1));\n if (options.reversed) {\n thresholdTickIndex = tickAmount - 1 - thresholdTickIndex;\n }\n }\n if (axis.hasData() && isNumber(min) && isNumber(max)) { // #14769\n // Adjust extremes and translation to the modified tick positions\n const adjustExtremes = () => {\n axis.transA *= (currentTickAmount - 1) / (tickAmount - 1);\n // Do not crop when ticks are not extremes (#9841)\n axis.min = options.startOnTick ?\n tickPositions[0] :\n Math.min(min, tickPositions[0]);\n axis.max = options.endOnTick ?\n tickPositions[tickPositions.length - 1] :\n Math.max(max, tickPositions[tickPositions.length - 1]);\n };\n // When the axis is subject to the alignThresholds option. Use\n // axis.threshold because the local threshold includes the\n // `softThreshold`.\n if (isNumber(thresholdTickIndex) && isNumber(axis.threshold)) {\n // Throw away the previously computed tickPositions and start\n // from scratch with only the threshold itself, then add ticks\n // below the threshold first, then fill up above the threshold.\n // If we are not able to fill up to axis.max, double the\n // tickInterval and run again.\n while (tickPositions[thresholdTickIndex] !== threshold ||\n tickPositions.length !== tickAmount ||\n tickPositions[0] > min ||\n tickPositions[tickPositions.length - 1] < max) {\n tickPositions.length = 0;\n tickPositions.push(axis.threshold);\n while (tickPositions.length < tickAmount) {\n if (\n // Start by prepending positions until the threshold\n // is at the required index...\n tickPositions[thresholdTickIndex] === void 0 ||\n tickPositions[thresholdTickIndex] > axis.threshold) {\n prepend();\n }\n else {\n // ... then append positions until we have the\n // required length\n append();\n }\n }\n // Safety vent\n if (tickInterval > axis.tickInterval * 8) {\n break;\n }\n tickInterval *= 2;\n }\n adjustExtremes();\n }\n else if (currentTickAmount < tickAmount) {\n while (tickPositions.length < tickAmount) {\n // Extend evenly for both sides unless we're on the\n // threshold (#3965)\n if (tickPositions.length % 2 || min === threshold) {\n append();\n }\n else {\n prepend();\n }\n }\n adjustExtremes();\n }\n // The finalTickAmt property is set in getTickAmount\n if (defined(finalTickAmt)) {\n i = len = tickPositions.length;\n while (i--) {\n if (\n // Remove every other tick\n (finalTickAmt === 3 && i % 2 === 1) ||\n // Remove all but first and last\n (finalTickAmt <= 2 && i > 0 && i < len - 1)) {\n tickPositions.splice(i, 1);\n }\n }\n axis.finalTickAmt = void 0;\n }\n }\n }\n /**\n * Set the scale based on data min and max, user set min and max or options.\n *\n * @private\n * @function Highcharts.Axis#setScale\n *\n * @emits Highcharts.Axis#event:afterSetScale\n */\n setScale() {\n const axis = this, { coll, stacking } = axis;\n let isDirtyData = false, isXAxisDirty = false;\n axis.series.forEach((series) => {\n isDirtyData = isDirtyData || series.isDirtyData || series.isDirty;\n // When x axis is dirty, we need new data extremes for y as\n // well:\n isXAxisDirty = (isXAxisDirty ||\n (series.xAxis && series.xAxis.isDirty) ||\n false);\n });\n // Set the new axisLength\n axis.setAxisSize();\n const isDirtyAxisLength = axis.len !== (axis.old && axis.old.len);\n // Do we really need to go through all this?\n if (isDirtyAxisLength ||\n isDirtyData ||\n isXAxisDirty ||\n axis.isLinked ||\n axis.forceRedraw ||\n axis.userMin !== (axis.old && axis.old.userMin) ||\n axis.userMax !== (axis.old && axis.old.userMax) ||\n axis.alignToOthers()) {\n if (stacking && coll === 'yAxis') {\n stacking.buildStacks();\n }\n axis.forceRedraw = false;\n // #18066 delete minRange property to ensure that it will be\n // calculated again after dirty data in series\n if (!axis.userMinRange) {\n axis.minRange = void 0;\n }\n // Get data extremes if needed\n axis.getSeriesExtremes();\n // Get fixed positions based on tickInterval\n axis.setTickInterval();\n if (stacking && coll === 'xAxis') {\n stacking.buildStacks();\n }\n // Mark as dirty if it is not already set to dirty and extremes have\n // changed. #595.\n if (!axis.isDirty) {\n axis.isDirty =\n isDirtyAxisLength ||\n axis.min !== axis.old?.min ||\n axis.max !== axis.old?.max;\n }\n }\n else if (stacking) {\n stacking.cleanStacks();\n }\n // Recalculate all extremes object when the data has changed. It is\n // required when vertical panning is enabled.\n if (isDirtyData) {\n delete axis.allExtremes;\n }\n fireEvent(this, 'afterSetScale');\n }\n /**\n * Set the minimum and maximum of the axes after render time. If the\n * `startOnTick` and `endOnTick` options are true, the minimum and maximum\n * values are rounded off to the nearest tick. To prevent this, these\n * options can be set to false before calling setExtremes. Also, setExtremes\n * will not allow a range lower than the `minRange` option, which by default\n * is the range of five points.\n *\n * @sample highcharts/members/axis-setextremes/\n * Set extremes from a button\n * @sample highcharts/members/axis-setextremes-datetime/\n * Set extremes on a datetime axis\n * @sample highcharts/members/axis-setextremes-off-ticks/\n * Set extremes off ticks\n * @sample stock/members/axis-setextremes/\n * Set extremes in Highcharts Stock\n *\n * @function Highcharts.Axis#setExtremes\n *\n * @param {number} [newMin]\n * The new minimum value.\n *\n * @param {number} [newMax]\n * The new maximum value.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart or wait for an explicit call to\n * {@link Highcharts.Chart#redraw}\n *\n * @param {boolean|Partial} [animation=true]\n * Enable or modify animations.\n *\n * @param {*} [eventArguments]\n * Arguments to be accessed in event handler.\n *\n * @emits Highcharts.Axis#event:setExtremes\n */\n setExtremes(min, max, redraw = true, animation, eventArguments) {\n this.series.forEach((serie) => {\n delete serie.kdTree;\n });\n // Extend the arguments with min and max\n eventArguments = extend(eventArguments, { min, max });\n // Fire the event\n fireEvent(this, 'setExtremes', eventArguments, (e) => {\n this.userMin = e.min;\n this.userMax = e.max;\n this.eventArgs = e;\n if (redraw) {\n this.chart.redraw(animation);\n }\n });\n }\n /**\n * Update the axis metrics.\n *\n * @private\n * @function Highcharts.Axis#setAxisSize\n */\n setAxisSize() {\n const chart = this.chart, options = this.options, \n // [top, right, bottom, left]\n offsets = options.offsets || [0, 0, 0, 0], horiz = this.horiz, \n // Check for percentage based input values. Rounding fixes problems\n // with column overflow and plot line filtering (#4898, #4899)\n width = this.width = Math.round(relativeLength(pick(options.width, chart.plotWidth - offsets[3] + offsets[1]), chart.plotWidth)), height = this.height = Math.round(relativeLength(pick(options.height, chart.plotHeight - offsets[0] + offsets[2]), chart.plotHeight)), top = this.top = Math.round(relativeLength(pick(options.top, chart.plotTop + offsets[0]), chart.plotHeight, chart.plotTop)), left = this.left = Math.round(relativeLength(pick(options.left, chart.plotLeft + offsets[3]), chart.plotWidth, chart.plotLeft));\n // Expose basic values to use in Series object and navigator\n this.bottom = chart.chartHeight - height - top;\n this.right = chart.chartWidth - width - left;\n // Direction agnostic properties\n this.len = Math.max(horiz ? width : height, 0); // Math.max fixes #905\n /**\n * The position of the axis in terms of pixels, compared to the chart\n * edge. In a horizontal axis it is the same as `chart.plotLeft` unless\n * the axis is explicitly positioned, and in a default vertical axis it\n * is the same as `chart.plotTop`.\n *\n * @name Highcharts.Axis#pos\n * @type {number}\n */\n this.pos = horiz ? left : top; // Distance from SVG origin\n }\n /**\n * Get the current extremes for the axis.\n *\n * @sample highcharts/members/axis-getextremes/\n * Report extremes by click on a button\n *\n * @function Highcharts.Axis#getExtremes\n *\n * @return {Highcharts.ExtremesObject}\n * An object containing extremes information.\n */\n getExtremes() {\n const axis = this, log = axis.logarithmic;\n return {\n min: log ?\n correctFloat(log.lin2log(axis.min)) :\n axis.min,\n max: log ?\n correctFloat(log.lin2log(axis.max)) :\n axis.max,\n dataMin: axis.dataMin,\n dataMax: axis.dataMax,\n userMin: axis.userMin,\n userMax: axis.userMax\n };\n }\n /**\n * Get the zero plane either based on zero or on the min or max value.\n * Used in bar and area plots.\n *\n * @function Highcharts.Axis#getThreshold\n *\n * @param {number} threshold\n * The threshold in axis values.\n *\n * @return {number}\n * The translated threshold position in terms of pixels, and corrected to\n * stay within the axis bounds.\n */\n getThreshold(threshold) {\n const axis = this, log = axis.logarithmic, realMin = log ? log.lin2log(axis.min) : axis.min, realMax = log ? log.lin2log(axis.max) : axis.max;\n if (threshold === null || threshold === -Infinity) {\n threshold = realMin;\n }\n else if (threshold === Infinity) {\n threshold = realMax;\n }\n else if (realMin > threshold) {\n threshold = realMin;\n }\n else if (realMax < threshold) {\n threshold = realMax;\n }\n return axis.translate(threshold, 0, 1, 0, 1);\n }\n /**\n * Compute auto alignment for the axis label based on which side the axis is\n * on and the given rotation for the label.\n *\n * @private\n * @function Highcharts.Axis#autoLabelAlign\n *\n * @param {number} rotation\n * The rotation in degrees as set by either the `rotation` or `autoRotation`\n * options.\n *\n * @return {Highcharts.AlignValue}\n * Can be `\"center\"`, `\"left\"` or `\"right\"`.\n */\n autoLabelAlign(rotation) {\n const angle = (pick(rotation, 0) - (this.side * 90) + 720) % 360, evt = { align: 'center' };\n fireEvent(this, 'autoLabelAlign', evt, function (e) {\n if (angle > 15 && angle < 165) {\n e.align = 'right';\n }\n else if (angle > 195 && angle < 345) {\n e.align = 'left';\n }\n });\n return evt.align;\n }\n /**\n * Get the tick length and width for the axis based on axis options.\n *\n * @private\n * @function Highcharts.Axis#tickSize\n *\n * @param {string} [prefix]\n * 'tick' or 'minorTick'\n *\n * @return {Array|undefined}\n * An array of tickLength and tickWidth\n */\n tickSize(prefix) {\n const options = this.options, tickWidth = pick(options[prefix === 'tick' ? 'tickWidth' : 'minorTickWidth'], \n // Default to 1 on linear and datetime X axes\n prefix === 'tick' && this.isXAxis && !this.categories ? 1 : 0);\n let tickLength = options[prefix === 'tick' ? 'tickLength' : 'minorTickLength'], tickSize;\n if (tickWidth && tickLength) {\n // Negate the length\n if (options[prefix + 'Position'] === 'inside') {\n tickLength = -tickLength;\n }\n tickSize = [tickLength, tickWidth];\n }\n const e = { tickSize };\n fireEvent(this, 'afterTickSize', e);\n return e.tickSize;\n }\n /**\n * Return the size of the labels.\n *\n * @private\n * @function Highcharts.Axis#labelMetrics\n */\n labelMetrics() {\n const renderer = this.chart.renderer, ticks = this.ticks, tick = ticks[Object.keys(ticks)[0]] || {};\n return this.chart.renderer.fontMetrics(tick.label ||\n tick.movedLabel ||\n renderer.box);\n }\n /**\n * Prevent the ticks from getting so close we can't draw the labels. On a\n * horizontal axis, this is handled by rotating the labels, removing ticks\n * and adding ellipsis. On a vertical axis remove ticks and add ellipsis.\n *\n * @private\n * @function Highcharts.Axis#unsquish\n */\n unsquish() {\n const labelOptions = this.options.labels, horiz = this.horiz, tickInterval = this.tickInterval, slotSize = this.len / (((this.categories ? 1 : 0) +\n this.max -\n this.min) /\n tickInterval), rotationOption = labelOptions.rotation, \n // We don't know the actual rendered line height at this point, but\n // it defaults to 0.75em\n lineHeight = this.labelMetrics().h, range = Math.max(this.max - this.min, 0), \n // Return the multiple of tickInterval that is needed to avoid\n // collision\n getStep = function (spaceNeeded) {\n let step = spaceNeeded / (slotSize || 1);\n step = step > 1 ? Math.ceil(step) : 1;\n // Guard for very small or negative angles (#9835)\n if (step * tickInterval > range &&\n spaceNeeded !== Infinity &&\n slotSize !== Infinity &&\n range) {\n step = Math.ceil(range / tickInterval);\n }\n return correctFloat(step * tickInterval);\n };\n let newTickInterval = tickInterval, rotation, bestScore = Number.MAX_VALUE, autoRotation;\n if (horiz) {\n if (!labelOptions.staggerLines) {\n if (isNumber(rotationOption)) {\n autoRotation = [rotationOption];\n }\n else if (slotSize < labelOptions.autoRotationLimit) {\n autoRotation = labelOptions.autoRotation;\n }\n }\n if (autoRotation) {\n let step, score;\n // Loop over the given autoRotation options, and determine which\n // gives the best score. The best score is that with the lowest\n // number of steps and a rotation closest to horizontal.\n for (const rot of autoRotation) {\n if (rot === rotationOption ||\n (rot && rot >= -90 && rot <= 90)) { // #3891\n step = getStep(Math.abs(lineHeight / Math.sin(deg2rad * rot)));\n score = step + Math.abs(rot / 360);\n if (score < bestScore) {\n bestScore = score;\n rotation = rot;\n newTickInterval = step;\n }\n }\n }\n }\n }\n else { // #4411\n newTickInterval = getStep(lineHeight * 0.75);\n }\n this.autoRotation = autoRotation;\n this.labelRotation = pick(rotation, isNumber(rotationOption) ? rotationOption : 0);\n return labelOptions.step ? tickInterval : newTickInterval;\n }\n /**\n * Get the general slot width for labels/categories on this axis. This may\n * change between the pre-render (from Axis.getOffset) and the final tick\n * rendering and placement.\n *\n * @private\n * @function Highcharts.Axis#getSlotWidth\n *\n * @param {Highcharts.Tick} [tick] Optionally, calculate the slot width\n * basing on tick label. It is used in highcharts-3d module, where the slots\n * has different widths depending on perspective angles.\n *\n * @return {number}\n * The pixel width allocated to each axis label.\n */\n getSlotWidth(tick) {\n // #5086, #1580, #1931\n const chart = this.chart, horiz = this.horiz, labelOptions = this.options.labels, slotCount = Math.max(this.tickPositions.length - (this.categories ? 0 : 1), 1), marginLeft = chart.margin[3];\n // Used by grid axis\n if (tick && isNumber(tick.slotWidth)) { // #13221, can be 0\n return tick.slotWidth;\n }\n if (horiz && labelOptions.step < 2) {\n if (labelOptions.rotation) { // #4415\n return 0;\n }\n return ((this.staggerLines || 1) * this.len) / slotCount;\n }\n if (!horiz) {\n // #7028\n const cssWidth = labelOptions.style.width;\n if (cssWidth !== void 0) {\n return parseInt(String(cssWidth), 10);\n }\n if (marginLeft) {\n return marginLeft - chart.spacing[3];\n }\n }\n // Last resort, a fraction of the available size\n return chart.chartWidth * 0.33;\n }\n /**\n * Render the axis labels and determine whether ellipsis or rotation need to\n * be applied.\n *\n * @private\n * @function Highcharts.Axis#renderUnsquish\n */\n renderUnsquish() {\n const chart = this.chart, renderer = chart.renderer, tickPositions = this.tickPositions, ticks = this.ticks, labelOptions = this.options.labels, labelStyleOptions = labelOptions.style, horiz = this.horiz, slotWidth = this.getSlotWidth(), innerWidth = Math.max(1, Math.round(slotWidth - 2 * labelOptions.padding)), attr = {}, labelMetrics = this.labelMetrics(), textOverflowOption = labelStyleOptions.textOverflow;\n let commonWidth, commonTextOverflow, maxLabelLength = 0, label, i, pos;\n // Set rotation option unless it is \"auto\", like in gauges\n if (!isString(labelOptions.rotation)) {\n // #4443\n attr.rotation = labelOptions.rotation || 0;\n }\n // Get the longest label length\n tickPositions.forEach(function (tickPosition) {\n const tick = ticks[tickPosition];\n // Replace label - sorting animation\n if (tick.movedLabel) {\n tick.replaceMovedLabel();\n }\n if (tick &&\n tick.label &&\n tick.label.textPxLength > maxLabelLength) {\n maxLabelLength = tick.label.textPxLength;\n }\n });\n this.maxLabelLength = maxLabelLength;\n // Handle auto rotation on horizontal axis\n if (this.autoRotation) {\n // Apply rotation only if the label is too wide for the slot, and\n // the label is wider than its height.\n if (maxLabelLength > innerWidth &&\n maxLabelLength > labelMetrics.h) {\n attr.rotation = this.labelRotation;\n }\n else {\n this.labelRotation = 0;\n }\n // Handle word-wrap or ellipsis on vertical axis\n }\n else if (slotWidth) {\n // For word-wrap or ellipsis\n commonWidth = innerWidth;\n if (!textOverflowOption) {\n commonTextOverflow = 'clip';\n // On vertical axis, only allow word wrap if there is room\n // for more lines.\n i = tickPositions.length;\n while (!horiz && i--) {\n pos = tickPositions[i];\n label = ticks[pos].label;\n if (label) {\n // Reset ellipsis in order to get the correct\n // bounding box (#4070)\n if (label.styles.textOverflow === 'ellipsis') {\n label.css({ textOverflow: 'clip' });\n // Set the correct width in order to read\n // the bounding box height (#4678, #5034)\n }\n else if (label.textPxLength > slotWidth) {\n label.css({ width: slotWidth + 'px' });\n }\n if (label.getBBox().height > (this.len / tickPositions.length -\n (labelMetrics.h - labelMetrics.f))) {\n label.specificTextOverflow = 'ellipsis';\n }\n }\n }\n }\n }\n // Add ellipsis if the label length is significantly longer than ideal\n if (attr.rotation) {\n commonWidth = (maxLabelLength > chart.chartHeight * 0.5 ?\n chart.chartHeight * 0.33 :\n maxLabelLength);\n if (!textOverflowOption) {\n commonTextOverflow = 'ellipsis';\n }\n }\n // Set the explicit or automatic label alignment\n this.labelAlign = labelOptions.align ||\n this.autoLabelAlign(this.labelRotation);\n if (this.labelAlign) {\n attr.align = this.labelAlign;\n }\n // Apply general and specific CSS\n tickPositions.forEach(function (pos) {\n const tick = ticks[pos], label = tick && tick.label, widthOption = labelStyleOptions.width, css = {};\n if (label) {\n // This needs to go before the CSS in old IE (#4502)\n label.attr(attr);\n if (tick.shortenLabel) {\n tick.shortenLabel();\n }\n else if (commonWidth &&\n !widthOption &&\n // Setting width in this case messes with the bounding box\n // (#7975)\n labelStyleOptions.whiteSpace !== 'nowrap' &&\n (\n // Speed optimizing, #7656\n commonWidth < label.textPxLength ||\n // Resetting CSS, #4928\n label.element.tagName === 'SPAN')) {\n css.width = commonWidth + 'px';\n if (!textOverflowOption) {\n css.textOverflow = (label.specificTextOverflow ||\n commonTextOverflow);\n }\n label.css(css);\n // Reset previously shortened label (#8210)\n }\n else if (label.styles.width && !css.width && !widthOption) {\n label.css({ width: null });\n }\n delete label.specificTextOverflow;\n tick.rotation = attr.rotation;\n }\n }, this);\n // Note: Why is this not part of getLabelPosition?\n this.tickRotCorr = renderer.rotCorr(labelMetrics.b, this.labelRotation || 0, this.side !== 0);\n }\n /**\n * Return true if the axis has associated data.\n *\n * @function Highcharts.Axis#hasData\n *\n * @return {boolean}\n * True if the axis has associated visible series and those series have\n * either valid data points or explicit `min` and `max` settings.\n */\n hasData() {\n return this.series.some(function (s) {\n return s.hasData();\n }) ||\n (this.options.showEmpty &&\n defined(this.min) &&\n defined(this.max));\n }\n /**\n * Adds the title defined in axis.options.title.\n *\n * @function Highcharts.Axis#addTitle\n *\n * @param {boolean} [display]\n * Whether or not to display the title.\n */\n addTitle(display) {\n const axis = this, renderer = axis.chart.renderer, horiz = axis.horiz, opposite = axis.opposite, options = axis.options, axisTitleOptions = options.title, styledMode = axis.chart.styledMode;\n let textAlign;\n if (!axis.axisTitle) {\n textAlign = axisTitleOptions.textAlign;\n if (!textAlign) {\n textAlign = (horiz ? {\n low: 'left',\n middle: 'center',\n high: 'right'\n } : {\n low: opposite ? 'right' : 'left',\n middle: 'center',\n high: opposite ? 'left' : 'right'\n })[axisTitleOptions.align];\n }\n axis.axisTitle = renderer\n .text(axisTitleOptions.text || '', 0, 0, axisTitleOptions.useHTML)\n .attr({\n zIndex: 7,\n rotation: axisTitleOptions.rotation || 0,\n align: textAlign\n })\n .addClass('highcharts-axis-title');\n // #7814, don't mutate style option\n if (!styledMode) {\n axis.axisTitle.css(merge(axisTitleOptions.style));\n }\n axis.axisTitle.add(axis.axisGroup);\n axis.axisTitle.isNew = true;\n }\n // Max width defaults to the length of the axis\n if (!styledMode &&\n !axisTitleOptions.style.width &&\n !axis.isRadial) {\n axis.axisTitle.css({\n width: axis.len + 'px'\n });\n }\n // hide or show the title depending on whether showEmpty is set\n axis.axisTitle[display ? 'show' : 'hide'](display);\n }\n /**\n * Generates a tick for initial positioning.\n *\n * @private\n * @function Highcharts.Axis#generateTick\n *\n * @param {number} pos\n * The tick position in axis values.\n *\n * @param {number} [i]\n * The index of the tick in {@link Axis.tickPositions}.\n */\n generateTick(pos) {\n const axis = this, ticks = axis.ticks;\n if (!ticks[pos]) {\n ticks[pos] = new Tick(axis, pos);\n }\n else {\n ticks[pos].addLabel(); // update labels depending on tick interval\n }\n }\n /**\n * Create the axisGroup and gridGroup elements on first iteration.\n *\n * @private\n * @function Highcharts.Axis#getOffset\n *\n * @emits Highcharts.Axis#event:afterGetOffset\n */\n createGroups() {\n const { axisParent, // Used in color axis\n chart, coll, options } = this, renderer = chart.renderer;\n const createGroup = (name, suffix, zIndex) => renderer.g(name)\n .attr({ zIndex })\n .addClass(`highcharts-${coll.toLowerCase()}${suffix} ` +\n (this.isRadial ? `highcharts-radial-axis${suffix} ` : '') +\n (options.className || ''))\n .add(axisParent);\n if (!this.axisGroup) {\n this.gridGroup = createGroup('grid', '-grid', options.gridZIndex);\n this.axisGroup = createGroup('axis', '', options.zIndex);\n this.labelGroup = createGroup('axis-labels', '-labels', options.labels.zIndex);\n }\n }\n /**\n * Render the tick labels to a preliminary position to get their sizes\n *\n * @private\n * @function Highcharts.Axis#getOffset\n *\n * @emits Highcharts.Axis#event:afterGetOffset\n */\n getOffset() {\n const axis = this, { chart, horiz, options, side, ticks, tickPositions, coll } = axis, invertedSide = (chart.inverted && !axis.isZAxis ?\n [1, 0, 3, 2][side] :\n side), hasData = axis.hasData(), axisTitleOptions = options.title, labelOptions = options.labels, hasCrossing = isNumber(options.crossing), axisOffset = chart.axisOffset, clipOffset = chart.clipOffset, directionFactor = [-1, 1, 1, -1][side];\n let showAxis, titleOffset = 0, titleOffsetOption, titleMargin = 0, labelOffset = 0, // reset\n labelOffsetPadded, lineHeightCorrection;\n // For reuse in Axis.render\n axis.showAxis = showAxis = hasData || options.showEmpty;\n // Set/reset staggerLines\n axis.staggerLines = (axis.horiz && labelOptions.staggerLines) || void 0;\n axis.createGroups();\n if (hasData || axis.isLinked) {\n // Generate ticks\n tickPositions.forEach(function (pos) {\n // i is not used here, but may be used in overrides\n axis.generateTick(pos);\n });\n axis.renderUnsquish();\n // Left side must be align: right and right side must\n // have align: left for labels\n axis.reserveSpaceDefault = (side === 0 ||\n side === 2 ||\n { 1: 'left', 3: 'right' }[side] === axis.labelAlign);\n if (pick(labelOptions.reserveSpace, hasCrossing ? false : null, axis.labelAlign === 'center' ? true : null, axis.reserveSpaceDefault)) {\n tickPositions.forEach(function (pos) {\n // get the highest offset\n labelOffset = Math.max(ticks[pos].getLabelSize(), labelOffset);\n });\n }\n if (axis.staggerLines) {\n labelOffset *= axis.staggerLines;\n }\n axis.labelOffset = labelOffset * (axis.opposite ? -1 : 1);\n }\n else { // doesn't have data\n objectEach(ticks, function (tick, n) {\n tick.destroy();\n delete ticks[n];\n });\n }\n if (axisTitleOptions?.text &&\n axisTitleOptions.enabled !== false) {\n axis.addTitle(showAxis);\n if (showAxis &&\n !hasCrossing &&\n axisTitleOptions.reserveSpace !== false) {\n axis.titleOffset = titleOffset =\n axis.axisTitle.getBBox()[horiz ? 'height' : 'width'];\n titleOffsetOption = axisTitleOptions.offset;\n titleMargin = defined(titleOffsetOption) ?\n 0 :\n pick(axisTitleOptions.margin, horiz ? 5 : 10);\n }\n }\n // Render the axis line\n axis.renderLine();\n // handle automatic or user set offset\n axis.offset = directionFactor * pick(options.offset, axisOffset[side] ? axisOffset[side] + (options.margin || 0) : 0);\n axis.tickRotCorr = axis.tickRotCorr || { x: 0, y: 0 }; // polar\n if (side === 0) {\n lineHeightCorrection = -axis.labelMetrics().h;\n }\n else if (side === 2) {\n lineHeightCorrection = axis.tickRotCorr.y;\n }\n else {\n lineHeightCorrection = 0;\n }\n // Find the padded label offset\n labelOffsetPadded = Math.abs(labelOffset) + titleMargin;\n if (labelOffset) {\n labelOffsetPadded -= lineHeightCorrection;\n labelOffsetPadded += directionFactor * (horiz ?\n pick(labelOptions.y, axis.tickRotCorr.y +\n directionFactor * labelOptions.distance) :\n pick(labelOptions.x, directionFactor * labelOptions.distance));\n }\n axis.axisTitleMargin = pick(titleOffsetOption, labelOffsetPadded);\n if (axis.getMaxLabelDimensions) {\n axis.maxLabelDimensions = axis.getMaxLabelDimensions(ticks, tickPositions);\n }\n // Due to GridAxis.tickSize, tickSize should be calculated after ticks\n // has rendered.\n if (coll !== 'colorAxis') {\n const tickSize = this.tickSize('tick');\n axisOffset[side] = Math.max(axisOffset[side], (axis.axisTitleMargin || 0) + titleOffset +\n directionFactor * axis.offset, labelOffsetPadded, // #3027\n tickPositions && tickPositions.length && tickSize ?\n tickSize[0] + directionFactor * axis.offset :\n 0 // #4866\n );\n // Decide the clipping needed to keep the graph inside\n // the plot area and axis lines\n const clip = !axis.axisLine || options.offset ?\n 0 :\n // #4308, #4371:\n Math.floor(axis.axisLine.strokeWidth() / 2) * 2;\n clipOffset[invertedSide] =\n Math.max(clipOffset[invertedSide], clip);\n }\n fireEvent(this, 'afterGetOffset');\n }\n /**\n * Internal function to get the path for the axis line. Extended for polar\n * charts.\n *\n * @function Highcharts.Axis#getLinePath\n *\n * @param {number} lineWidth\n * The line width in pixels.\n *\n * @return {Highcharts.SVGPathArray}\n * The SVG path definition in array form.\n */\n getLinePath(lineWidth) {\n const chart = this.chart, opposite = this.opposite, offset = this.offset, horiz = this.horiz, lineLeft = this.left + (opposite ? this.width : 0) + offset, lineTop = chart.chartHeight - this.bottom -\n (opposite ? this.height : 0) + offset;\n if (opposite) {\n lineWidth *= -1; // crispify the other way - #1480, #1687\n }\n return chart.renderer\n .crispLine([\n [\n 'M',\n horiz ?\n this.left :\n lineLeft,\n horiz ?\n lineTop :\n this.top\n ],\n [\n 'L',\n horiz ?\n chart.chartWidth - this.right :\n lineLeft,\n horiz ?\n lineTop :\n chart.chartHeight - this.bottom\n ]\n ], lineWidth);\n }\n /**\n * Render the axis line. Called internally when rendering and redrawing the\n * axis.\n *\n * @function Highcharts.Axis#renderLine\n */\n renderLine() {\n if (!this.axisLine) {\n this.axisLine = this.chart.renderer.path()\n .addClass('highcharts-axis-line')\n .add(this.axisGroup);\n if (!this.chart.styledMode) {\n this.axisLine.attr({\n stroke: this.options.lineColor,\n 'stroke-width': this.options.lineWidth,\n zIndex: 7\n });\n }\n }\n }\n /**\n * Position the axis title.\n *\n * @private\n * @function Highcharts.Axis#getTitlePosition\n *\n * @return {Highcharts.PositionObject}\n * X and Y positions for the title.\n */\n getTitlePosition(axisTitle) {\n // compute anchor points for each of the title align options\n const horiz = this.horiz, axisLeft = this.left, axisTop = this.top, axisLength = this.len, axisTitleOptions = this.options.title, margin = horiz ? axisLeft : axisTop, opposite = this.opposite, offset = this.offset, xOption = axisTitleOptions.x, yOption = axisTitleOptions.y, fontMetrics = this.chart.renderer.fontMetrics(axisTitle), \n // The part of a multiline text that is below the baseline of the\n // first line. Subtract 1 to preserve pixel-perfectness from the\n // old behaviour (v5.0.12), where only one line was allowed.\n textHeightOvershoot = axisTitle ? Math.max(axisTitle.getBBox(false, 0).height - fontMetrics.h - 1, 0) : 0, \n // the position in the length direction of the axis\n alongAxis = ({\n low: margin + (horiz ? 0 : axisLength),\n middle: margin + axisLength / 2,\n high: margin + (horiz ? axisLength : 0)\n })[axisTitleOptions.align], \n // the position in the perpendicular direction of the axis\n offAxis = (horiz ? axisTop + this.height : axisLeft) +\n (horiz ? 1 : -1) * // horizontal axis reverses the margin\n (opposite ? -1 : 1) * // so does opposite axes\n (this.axisTitleMargin || 0) +\n [\n -textHeightOvershoot,\n textHeightOvershoot,\n fontMetrics.f,\n -textHeightOvershoot // left\n ][this.side], titlePosition = {\n x: horiz ?\n alongAxis + xOption :\n offAxis + (opposite ? this.width : 0) + offset + xOption,\n y: horiz ?\n offAxis + yOption - (opposite ? this.height : 0) + offset :\n alongAxis + yOption\n };\n fireEvent(this, 'afterGetTitlePosition', { titlePosition: titlePosition });\n return titlePosition;\n }\n /**\n * Render a minor tick into the given position. If a minor tick already\n * exists in this position, move it.\n *\n * @function Highcharts.Axis#renderMinorTick\n *\n * @param {number} pos\n * The position in axis values.\n *\n * @param {boolean} slideIn\n * Whether the tick should animate in from last computed position\n */\n renderMinorTick(pos, slideIn) {\n const axis = this;\n const minorTicks = axis.minorTicks;\n if (!minorTicks[pos]) {\n minorTicks[pos] = new Tick(axis, pos, 'minor');\n }\n // Render new ticks in old position\n if (slideIn && minorTicks[pos].isNew) {\n minorTicks[pos].render(null, true);\n }\n minorTicks[pos].render(null, false, 1);\n }\n /**\n * Render a major tick into the given position. If a tick already exists\n * in this position, move it.\n *\n * @function Highcharts.Axis#renderTick\n *\n * @param {number} pos\n * The position in axis values.\n *\n * @param {number} i\n * The tick index.\n *\n * @param {boolean} slideIn\n * Whether the tick should animate in from last computed position\n */\n renderTick(pos, i, slideIn) {\n const axis = this, isLinked = axis.isLinked, ticks = axis.ticks;\n // Linked axes need an extra check to find out if\n if (!isLinked ||\n (pos >= axis.min && pos <= axis.max) ||\n (axis.grid && axis.grid.isColumn)) {\n if (!ticks[pos]) {\n ticks[pos] = new Tick(axis, pos);\n }\n // NOTE this seems like overkill. Could be handled in tick.render by\n // setting old position in attr, then set new position in animate.\n // render new ticks in old position\n if (slideIn && ticks[pos].isNew) {\n // Start with negative opacity so that it is visible from\n // halfway into the animation\n ticks[pos].render(i, true, -1);\n }\n ticks[pos].render(i);\n }\n }\n /**\n * Render the axis.\n *\n * @private\n * @function Highcharts.Axis#render\n *\n * @emits Highcharts.Axis#event:afterRender\n */\n render() {\n const axis = this, chart = axis.chart, log = axis.logarithmic, renderer = chart.renderer, options = axis.options, isLinked = axis.isLinked, tickPositions = axis.tickPositions, axisTitle = axis.axisTitle, ticks = axis.ticks, minorTicks = axis.minorTicks, alternateBands = axis.alternateBands, stackLabelOptions = options.stackLabels, alternateGridColor = options.alternateGridColor, crossing = options.crossing, tickmarkOffset = axis.tickmarkOffset, axisLine = axis.axisLine, showAxis = axis.showAxis, animation = animObject(renderer.globalAnimation);\n let from, to;\n // Reset\n axis.labelEdge.length = 0;\n axis.overlap = false;\n // Mark all elements inActive before we go over and mark the active ones\n [ticks, minorTicks, alternateBands].forEach(function (coll) {\n objectEach(coll, function (tick) {\n tick.isActive = false;\n });\n });\n // Crossing\n if (isNumber(crossing)) {\n const otherAxis = this.isXAxis ? chart.yAxis[0] : chart.xAxis[0], directionFactor = [1, -1, -1, 1][this.side];\n if (otherAxis) {\n let px = otherAxis.toPixels(crossing, true);\n if (axis.horiz) {\n px = otherAxis.len - px;\n }\n axis.offset = directionFactor * px;\n }\n }\n // If the series has data draw the ticks. Else only the line and title\n if (axis.hasData() || isLinked) {\n const slideInTicks = axis.chart.hasRendered &&\n axis.old && isNumber(axis.old.min);\n // minor ticks\n if (axis.minorTickInterval && !axis.categories) {\n axis.getMinorTickPositions().forEach(function (pos) {\n axis.renderMinorTick(pos, slideInTicks);\n });\n }\n // Major ticks. Pull out the first item and render it last so that\n // we can get the position of the neighbour label. #808.\n if (tickPositions.length) { // #1300\n tickPositions.forEach(function (pos, i) {\n axis.renderTick(pos, i, slideInTicks);\n });\n // In a categorized axis, the tick marks are displayed\n // between labels. So we need to add a tick mark and\n // grid line at the left edge of the X axis.\n if (tickmarkOffset && (axis.min === 0 || axis.single)) {\n if (!ticks[-1]) {\n ticks[-1] = new Tick(axis, -1, null, true);\n }\n ticks[-1].render(-1);\n }\n }\n // Alternate grid color\n if (alternateGridColor) {\n tickPositions.forEach(function (pos, i) {\n to = typeof tickPositions[i + 1] !== 'undefined' ?\n tickPositions[i + 1] + tickmarkOffset :\n axis.max - tickmarkOffset;\n if (i % 2 === 0 &&\n pos < axis.max &&\n to <= axis.max + (chart.polar ?\n -tickmarkOffset :\n tickmarkOffset)) { // #2248, #4660\n if (!alternateBands[pos]) {\n // Should be imported from PlotLineOrBand.js, but\n // the dependency cycle with axis is a problem\n alternateBands[pos] = new H.PlotLineOrBand(axis, {});\n }\n from = pos + tickmarkOffset; // #949\n alternateBands[pos].options = {\n from: log ? log.lin2log(from) : from,\n to: log ? log.lin2log(to) : to,\n color: alternateGridColor,\n className: 'highcharts-alternate-grid'\n };\n alternateBands[pos].render();\n alternateBands[pos].isActive = true;\n }\n });\n }\n // custom plot lines and bands\n if (!axis._addedPlotLB) { // only first time\n axis._addedPlotLB = true;\n (options.plotLines || [])\n .concat(options.plotBands || [])\n .forEach(function (plotLineOptions) {\n axis\n .addPlotBandOrLine(plotLineOptions);\n });\n }\n } // end if hasData\n // Remove inactive ticks\n [ticks, minorTicks, alternateBands].forEach(function (coll) {\n const forDestruction = [], delay = animation.duration, destroyInactiveItems = function () {\n let i = forDestruction.length;\n while (i--) {\n // When resizing rapidly, the same items\n // may be destroyed in different timeouts,\n // or the may be reactivated\n if (coll[forDestruction[i]] &&\n !coll[forDestruction[i]].isActive) {\n coll[forDestruction[i]].destroy();\n delete coll[forDestruction[i]];\n }\n }\n };\n objectEach(coll, function (tick, pos) {\n if (!tick.isActive) {\n // Render to zero opacity\n tick.render(pos, false, 0);\n tick.isActive = false;\n forDestruction.push(pos);\n }\n });\n // When the objects are finished fading out, destroy them\n syncTimeout(destroyInactiveItems, coll === alternateBands ||\n !chart.hasRendered ||\n !delay ?\n 0 :\n delay);\n });\n // Set the axis line path\n if (axisLine) {\n axisLine[axisLine.isPlaced ? 'animate' : 'attr']({\n d: this.getLinePath(axisLine.strokeWidth())\n });\n axisLine.isPlaced = true;\n // Show or hide the line depending on options.showEmpty\n axisLine[showAxis ? 'show' : 'hide'](showAxis);\n }\n if (axisTitle && showAxis) {\n axisTitle[axisTitle.isNew ? 'attr' : 'animate'](axis.getTitlePosition(axisTitle));\n axisTitle.isNew = false;\n }\n // Stacked totals:\n if (stackLabelOptions && stackLabelOptions.enabled && axis.stacking) {\n axis.stacking.renderStackTotals();\n }\n // End stacked totals\n // Record old scaling for updating/animation. Pinch base must be\n // preserved until the pinch ends.\n axis.old = {\n len: axis.len,\n max: axis.max,\n min: axis.min,\n transA: axis.transA,\n userMax: axis.userMax,\n userMin: axis.userMin\n };\n axis.isDirty = false;\n fireEvent(this, 'afterRender');\n }\n /**\n * Redraw the axis to reflect changes in the data or axis extremes. Called\n * internally from Highcharts.Chart#redraw.\n *\n * @private\n * @function Highcharts.Axis#redraw\n */\n redraw() {\n if (this.visible) {\n // render the axis\n this.render();\n // move plot lines and bands\n this.plotLinesAndBands.forEach(function (plotLine) {\n plotLine.render();\n });\n }\n // mark associated series as dirty and ready for redraw\n this.series.forEach(function (series) {\n series.isDirty = true;\n });\n }\n /**\n * Returns an array of axis properties, that should be untouched during\n * reinitialization.\n *\n * @private\n * @function Highcharts.Axis#getKeepProps\n */\n getKeepProps() {\n return (this.keepProps || Axis.keepProps);\n }\n /**\n * Destroys an Axis instance. See {@link Axis#remove} for the API endpoint\n * to fully remove the axis.\n *\n * @private\n * @function Highcharts.Axis#destroy\n *\n * @param {boolean} [keepEvents]\n * Whether to preserve events, used internally in Axis.update.\n */\n destroy(keepEvents) {\n const axis = this, plotLinesAndBands = axis.plotLinesAndBands, eventOptions = this.eventOptions;\n fireEvent(this, 'destroy', { keepEvents: keepEvents });\n // Remove the events\n if (!keepEvents) {\n removeEvent(axis);\n }\n // Destroy collections\n [axis.ticks, axis.minorTicks, axis.alternateBands].forEach(function (coll) {\n destroyObjectProperties(coll);\n });\n if (plotLinesAndBands) {\n let i = plotLinesAndBands.length;\n while (i--) { // #1975\n plotLinesAndBands[i].destroy();\n }\n }\n // Destroy elements\n ['axisLine', 'axisTitle', 'axisGroup',\n 'gridGroup', 'labelGroup', 'cross', 'scrollbar'].forEach(function (prop) {\n if (axis[prop]) {\n axis[prop] = axis[prop].destroy();\n }\n });\n // Destroy each generated group for plotlines and plotbands\n for (const plotGroup in axis.plotLinesAndBandsGroups) { // eslint-disable-line guard-for-in\n axis.plotLinesAndBandsGroups[plotGroup] =\n axis.plotLinesAndBandsGroups[plotGroup].destroy();\n }\n // Delete all properties and fall back to the prototype.\n objectEach(axis, function (val, key) {\n if (axis.getKeepProps().indexOf(key) === -1) {\n delete axis[key];\n }\n });\n this.eventOptions = eventOptions;\n }\n /**\n * Internal function to draw a crosshair.\n *\n * @function Highcharts.Axis#drawCrosshair\n *\n * @param {Highcharts.PointerEventObject} [e]\n * The event arguments from the modified pointer event, extended with\n * `chartX` and `chartY`\n *\n * @param {Highcharts.Point} [point]\n * The Point object if the crosshair snaps to points.\n *\n * @emits Highcharts.Axis#event:afterDrawCrosshair\n * @emits Highcharts.Axis#event:drawCrosshair\n */\n drawCrosshair(e, point) {\n const options = this.crosshair, snap = pick(options && options.snap, true), chart = this.chart;\n let path, pos, categorized, graphic = this.cross, crossOptions;\n fireEvent(this, 'drawCrosshair', { e: e, point: point });\n // Use last available event when updating non-snapped crosshairs without\n // mouse interaction (#5287)\n if (!e) {\n e = this.cross && this.cross.e;\n }\n if (\n // Disabled in options\n !options ||\n // Snap\n ((defined(point) || !snap) === false)) {\n this.hideCrosshair();\n }\n else {\n // Get the path\n if (!snap) {\n pos = e &&\n (this.horiz ?\n e.chartX - this.pos :\n this.len - e.chartY + this.pos);\n }\n else if (defined(point)) {\n // #3834\n pos = pick(this.coll !== 'colorAxis' ?\n point.crosshairPos : // 3D axis extension\n null, this.isXAxis ?\n point.plotX :\n this.len - point.plotY);\n }\n if (defined(pos)) {\n crossOptions = {\n // value, only used on radial\n value: point && (this.isXAxis ?\n point.x :\n pick(point.stackY, point.y)),\n translatedValue: pos\n };\n if (chart.polar) {\n // Additional information required for crosshairs in\n // polar chart\n extend(crossOptions, {\n isCrosshair: true,\n chartX: e && e.chartX,\n chartY: e && e.chartY,\n point: point\n });\n }\n path = this.getPlotLinePath(crossOptions) ||\n null; // #3189\n }\n if (!defined(path)) {\n this.hideCrosshair();\n return;\n }\n categorized = this.categories && !this.isRadial;\n // Draw the cross\n if (!graphic) {\n this.cross = graphic = chart.renderer\n .path()\n .addClass('highcharts-crosshair highcharts-crosshair-' +\n (categorized ? 'category ' : 'thin ') +\n (options.className || ''))\n .attr({\n zIndex: pick(options.zIndex, 2)\n })\n .add();\n // Presentational attributes\n if (!chart.styledMode) {\n graphic.attr({\n stroke: options.color ||\n (categorized ?\n Color\n .parse(\"#ccd3ff\" /* Palette.highlightColor20 */)\n .setOpacity(0.25)\n .get() :\n \"#cccccc\" /* Palette.neutralColor20 */),\n 'stroke-width': pick(options.width, 1)\n }).css({\n 'pointer-events': 'none'\n });\n if (options.dashStyle) {\n graphic.attr({\n dashstyle: options.dashStyle\n });\n }\n }\n }\n graphic.show().attr({\n d: path\n });\n if (categorized && !options.width) {\n graphic.attr({\n 'stroke-width': this.transA\n });\n }\n this.cross.e = e;\n }\n fireEvent(this, 'afterDrawCrosshair', { e: e, point: point });\n }\n /**\n * Hide the crosshair if visible.\n *\n * @function Highcharts.Axis#hideCrosshair\n */\n hideCrosshair() {\n if (this.cross) {\n this.cross.hide();\n }\n fireEvent(this, 'afterHideCrosshair');\n }\n /**\n * Update an axis object with a new set of options. The options are merged\n * with the existing options, so only new or altered options need to be\n * specified.\n *\n * @sample highcharts/members/axis-update/\n * Axis update demo\n *\n * @function Highcharts.Axis#update\n *\n * @param {Highcharts.AxisOptions} options\n * The new options that will be merged in with existing options on the axis.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the axis is altered. If doing more\n * operations on the chart, it is a good idea to set redraw to false and\n * call {@link Chart#redraw} after.\n */\n update(options, redraw) {\n const chart = this.chart;\n options = merge(this.userOptions, options);\n this.destroy(true);\n this.init(chart, options);\n chart.isDirtyBox = true;\n if (pick(redraw, true)) {\n chart.redraw();\n }\n }\n /**\n * Remove the axis from the chart.\n *\n * @sample highcharts/members/chart-addaxis/\n * Add and remove axes\n *\n * @function Highcharts.Axis#remove\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart following the remove.\n */\n remove(redraw) {\n const chart = this.chart, coll = this.coll, axisSeries = this.series;\n let i = axisSeries.length;\n // Remove associated series (#2687)\n while (i--) {\n if (axisSeries[i]) {\n axisSeries[i].remove(false);\n }\n }\n // Remove the axis\n erase(chart.axes, this);\n erase(chart[coll] || [], this);\n chart.orderItems(coll);\n this.destroy();\n chart.isDirtyBox = true;\n if (pick(redraw, true)) {\n chart.redraw();\n }\n }\n /**\n * Update the axis title by options after render time.\n *\n * @sample highcharts/members/axis-settitle/\n * Set a new Y axis title\n *\n * @function Highcharts.Axis#setTitle\n *\n * @param {Highcharts.AxisTitleOptions} titleOptions\n * The additional title options.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after setting the title.\n */\n setTitle(titleOptions, redraw) {\n this.update({ title: titleOptions }, redraw);\n }\n /**\n * Set new axis categories and optionally redraw.\n *\n * @sample highcharts/members/axis-setcategories/\n * Set categories by click on a button\n *\n * @function Highcharts.Axis#setCategories\n *\n * @param {Array} categories\n * The new categories.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart.\n */\n setCategories(categories, redraw) {\n this.update({ categories: categories }, redraw);\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\n// Properties to survive after destroy, needed for Axis.update (#4317,\n// #5773, #5881).\nAxis.keepProps = [\n 'coll',\n 'extKey',\n 'hcEvents',\n 'names',\n 'series',\n 'userMax',\n 'userMin'\n];\n/* *\n *\n * Default Export\n *\n * */\nexport default Axis;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Options for the path on the Axis to be calculated.\n * @interface Highcharts.AxisPlotLinePathOptionsObject\n */ /**\n* Axis value.\n* @name Highcharts.AxisPlotLinePathOptionsObject#value\n* @type {number|undefined}\n*/ /**\n* Line width used for calculation crisp line coordinates. Defaults to 1.\n* @name Highcharts.AxisPlotLinePathOptionsObject#lineWidth\n* @type {number|undefined}\n*/ /**\n* If `false`, the function will return null when it falls outside the axis\n* bounds. If `true`, the function will return a path aligned to the plot area\n* sides if it falls outside. If `pass`, it will return a path outside.\n* @name Highcharts.AxisPlotLinePathOptionsObject#force\n* @type {string|boolean|undefined}\n*/ /**\n* Used in Highcharts Stock. When `true`, plot paths\n* (crosshair, plotLines, gridLines)\n* will be rendered on all axes when defined on the first axis.\n* @name Highcharts.AxisPlotLinePathOptionsObject#acrossPanes\n* @type {boolean|undefined}\n*/ /**\n* Use old coordinates (for resizing and rescaling).\n* If not set, defaults to `false`.\n* @name Highcharts.AxisPlotLinePathOptionsObject#old\n* @type {boolean|undefined}\n*/ /**\n* If given, return the plot line path of a pixel position on the axis.\n* @name Highcharts.AxisPlotLinePathOptionsObject#translatedValue\n* @type {number|undefined}\n*/ /**\n* Used in Polar axes. Reverse the positions for concatenation of polygonal\n* plot bands\n* @name Highcharts.AxisPlotLinePathOptionsObject#reverse\n* @type {boolean|undefined}\n*/\n/**\n * Options for crosshairs on axes.\n *\n * @product highstock\n *\n * @typedef {Highcharts.XAxisCrosshairOptions|Highcharts.YAxisCrosshairOptions} Highcharts.AxisCrosshairOptions\n */\n/**\n * @typedef {\"navigator\"|\"pan\"|\"rangeSelectorButton\"|\"rangeSelectorInput\"|\"scrollbar\"|\"traverseUpButton\"|\"zoom\"} Highcharts.AxisExtremesTriggerValue\n */\n/**\n * @callback Highcharts.AxisEventCallbackFunction\n *\n * @param {Highcharts.Axis} this\n */\n/**\n * @callback Highcharts.AxisLabelsFormatterCallbackFunction\n *\n * @param {Highcharts.AxisLabelsFormatterContextObject} this\n *\n * @param {Highcharts.AxisLabelsFormatterContextObject} ctx\n *\n * @return {string}\n */\n/**\n * @interface Highcharts.AxisLabelsFormatterContextObject\n */ /**\n* The axis item of the label\n* @name Highcharts.AxisLabelsFormatterContextObject#axis\n* @type {Highcharts.Axis}\n*/ /**\n* The chart instance.\n* @name Highcharts.AxisLabelsFormatterContextObject#chart\n* @type {Highcharts.Chart}\n*/ /**\n* Default formatting of date/time labels.\n* @name Highcharts.AxisLabelsFormatterContextObject#dateTimeLabelFormat\n* @type {string|undefined}\n*/ /**\n* Whether the label belongs to the first tick on the axis.\n* @name Highcharts.AxisLabelsFormatterContextObject#isFirst\n* @type {boolean}\n*/ /**\n* Whether the label belongs to the last tick on the axis.\n* @name Highcharts.AxisLabelsFormatterContextObject#isLast\n* @type {boolean}\n*/ /**\n* The position on the axis in terms of axis values. For category axes, a\n* zero-based index. For datetime axes, the JavaScript time in milliseconds\n* since 1970.\n* @name Highcharts.AxisLabelsFormatterContextObject#pos\n* @type {number}\n*/ /**\n* The preformatted text as the result of the default formatting. For example\n* dates will be formatted as strings, and numbers with language-specific comma\n* separators, thousands separators and numeric symbols like `k` or `M`.\n* @name Highcharts.AxisLabelsFormatterContextObject#text\n* @type {string|undefined}\n*/ /**\n* The Tick instance.\n* @name Highcharts.AxisLabelsFormatterContextObject#tick\n* @type {Highcharts.Tick}\n*/ /**\n* This can be either a numeric value or a category string.\n* @name Highcharts.AxisLabelsFormatterContextObject#value\n* @type {number|string}\n*/\n/**\n * Options for axes.\n *\n * @typedef {Highcharts.XAxisOptions|Highcharts.YAxisOptions|Highcharts.ZAxisOptions} Highcharts.AxisOptions\n */\n/**\n * @callback Highcharts.AxisPointBreakEventCallbackFunction\n *\n * @param {Highcharts.Axis} this\n *\n * @param {Highcharts.AxisPointBreakEventObject} evt\n */\n/**\n * @interface Highcharts.AxisPointBreakEventObject\n */ /**\n* @name Highcharts.AxisPointBreakEventObject#brk\n* @type {Highcharts.Dictionary}\n*/ /**\n* @name Highcharts.AxisPointBreakEventObject#point\n* @type {Highcharts.Point}\n*/ /**\n* @name Highcharts.AxisPointBreakEventObject#preventDefault\n* @type {Function}\n*/ /**\n* @name Highcharts.AxisPointBreakEventObject#target\n* @type {Highcharts.SVGElement}\n*/ /**\n* @name Highcharts.AxisPointBreakEventObject#type\n* @type {\"pointBreak\"|\"pointInBreak\"}\n*/\n/**\n * @callback Highcharts.AxisSetExtremesEventCallbackFunction\n *\n * @param {Highcharts.Axis} this\n *\n * @param {Highcharts.AxisSetExtremesEventObject} evt\n */\n/**\n * @interface Highcharts.AxisSetExtremesEventObject\n * @extends Highcharts.ExtremesObject\n */ /**\n* @name Highcharts.AxisSetExtremesEventObject#preventDefault\n* @type {Function}\n*/ /**\n* @name Highcharts.AxisSetExtremesEventObject#target\n* @type {Highcharts.SVGElement}\n*/ /**\n* @name Highcharts.AxisSetExtremesEventObject#trigger\n* @type {Highcharts.AxisExtremesTriggerValue|string}\n*/ /**\n* @name Highcharts.AxisSetExtremesEventObject#type\n* @type {\"setExtremes\"}\n*/\n/**\n * @callback Highcharts.AxisTickPositionerCallbackFunction\n *\n * @param {Highcharts.Axis} this\n *\n * @return {Highcharts.AxisTickPositionsArray}\n */\n/**\n * @interface Highcharts.AxisTickPositionsArray\n * @augments Array\n */\n/**\n * @typedef {\"high\"|\"low\"|\"middle\"} Highcharts.AxisTitleAlignValue\n */\n/**\n * @typedef {Highcharts.XAxisTitleOptions|Highcharts.YAxisTitleOptions|Highcharts.ZAxisTitleOptions} Highcharts.AxisTitleOptions\n */\n/**\n * @typedef {\"linear\"|\"logarithmic\"|\"datetime\"|\"category\"|\"treegrid\"} Highcharts.AxisTypeValue\n */\n/**\n * The returned object literal from the {@link Highcharts.Axis#getExtremes}\n * function.\n *\n * @interface Highcharts.ExtremesObject\n */ /**\n* The maximum value of the axis' associated series.\n* @name Highcharts.ExtremesObject#dataMax\n* @type {number}\n*/ /**\n* The minimum value of the axis' associated series.\n* @name Highcharts.ExtremesObject#dataMin\n* @type {number}\n*/ /**\n* The maximum axis value, either automatic or set manually. If the `max` option\n* is not set, `maxPadding` is 0 and `endOnTick` is false, this value will be\n* the same as `dataMax`.\n* @name Highcharts.ExtremesObject#max\n* @type {number}\n*/ /**\n* The minimum axis value, either automatic or set manually. If the `min` option\n* is not set, `minPadding` is 0 and `startOnTick` is false, this value will be\n* the same as `dataMin`.\n* @name Highcharts.ExtremesObject#min\n* @type {number}\n*/ /**\n* The user defined maximum, either from the `max` option or from a zoom or\n* `setExtremes` action.\n* @name Highcharts.ExtremesObject#userMax\n* @type {number|undefined}\n*/ /**\n* The user defined minimum, either from the `min` option or from a zoom or\n* `setExtremes` action.\n* @name Highcharts.ExtremesObject#userMin\n* @type {number|undefined}\n*/\n/**\n * Formatter function for the text of a crosshair label.\n *\n * @callback Highcharts.XAxisCrosshairLabelFormatterCallbackFunction\n *\n * @param {Highcharts.Axis} this\n * Axis context\n *\n * @param {number} value\n * Y value of the data point\n *\n * @return {string}\n */\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../Utilities.js';\nconst { addEvent, getMagnitude, normalizeTickInterval, timeUnits } = U;\n/* *\n *\n * Composition\n *\n * */\n/* eslint-disable valid-jsdoc */\nvar DateTimeAxis;\n(function (DateTimeAxis) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Extends axis class with date and time support.\n * @private\n */\n function compose(AxisClass) {\n if (!AxisClass.keepProps.includes('dateTime')) {\n AxisClass.keepProps.push('dateTime');\n const axisProto = AxisClass.prototype;\n axisProto.getTimeTicks = getTimeTicks;\n addEvent(AxisClass, 'afterSetOptions', onAfterSetOptions);\n }\n return AxisClass;\n }\n DateTimeAxis.compose = compose;\n /**\n * Set the tick positions to a time unit that makes sense, for example\n * on the first of each month or on every Monday. Return an array with\n * the time positions. Used in datetime axes as well as for grouping\n * data on a datetime axis.\n *\n * @private\n * @function Highcharts.Axis#getTimeTicks\n * @param {Highcharts.TimeNormalizeObject} normalizedInterval\n * The interval in axis values (ms) and the count.\n * @param {number} min\n * The minimum in axis values.\n * @param {number} max\n * The maximum in axis values.\n */\n function getTimeTicks() {\n return this.chart.time.getTimeTicks.apply(this.chart.time, arguments);\n }\n /**\n * @private\n */\n function onAfterSetOptions() {\n if (this.options.type !== 'datetime') {\n this.dateTime = void 0;\n return;\n }\n if (!this.dateTime) {\n this.dateTime = new Additions(this);\n }\n }\n /* *\n *\n * Classes\n *\n * */\n class Additions {\n /* *\n *\n * Constructors\n *\n * */\n constructor(axis) {\n this.axis = axis;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Get a normalized tick interval for dates. Returns a configuration\n * object with unit range (interval), count and name. Used to prepare\n * data for `getTimeTicks`. Previously this logic was part of\n * getTimeTicks, but as `getTimeTicks` now runs of segments in stock\n * charts, the normalizing logic was extracted in order to prevent it\n * for running over again for each segment having the same interval.\n * #662, #697.\n * @private\n */\n normalizeTimeTickInterval(tickInterval, unitsOption) {\n const units = (unitsOption || [[\n // unit name\n 'millisecond',\n // allowed multiples\n [1, 2, 5, 10, 20, 25, 50, 100, 200, 500]\n ], [\n 'second',\n [1, 2, 5, 10, 15, 30]\n ], [\n 'minute',\n [1, 2, 5, 10, 15, 30]\n ], [\n 'hour',\n [1, 2, 3, 4, 6, 8, 12]\n ], [\n 'day',\n [1, 2]\n ], [\n 'week',\n [1, 2]\n ], [\n 'month',\n [1, 2, 3, 4, 6]\n ], [\n 'year',\n null\n ]]);\n let unit = units[units.length - 1], // default unit is years\n interval = timeUnits[unit[0]], multiples = unit[1], i;\n // loop through the units to find the one that best fits the\n // tickInterval\n for (i = 0; i < units.length; i++) {\n unit = units[i];\n interval = timeUnits[unit[0]];\n multiples = unit[1];\n if (units[i + 1]) {\n // lessThan is in the middle between the highest multiple\n // and the next unit.\n const lessThan = (interval *\n multiples[multiples.length - 1] +\n timeUnits[units[i + 1][0]]) / 2;\n // break and keep the current unit\n if (tickInterval <= lessThan) {\n break;\n }\n }\n }\n // prevent 2.5 years intervals, though 25, 250 etc. are allowed\n if (interval === timeUnits.year && tickInterval < 5 * interval) {\n multiples = [1, 2, 5];\n }\n // get the count\n const count = normalizeTickInterval(tickInterval / interval, multiples, unit[0] === 'year' ? // #1913, #2360\n Math.max(getMagnitude(tickInterval / interval), 1) :\n 1);\n return {\n unitRange: interval,\n count: count,\n unitName: unit[0]\n };\n }\n /**\n * Get the best date format for a specific X value based on the closest\n * point range on the axis.\n *\n * @private\n */\n getXDateFormat(x, dateTimeLabelFormats) {\n const { axis } = this, time = axis.chart.time;\n return axis.closestPointRange ?\n time.getDateFormat(axis.closestPointRange, x, axis.options.startOfWeek, dateTimeLabelFormats) ||\n // #2546, 2581\n time.resolveDTLFormat(dateTimeLabelFormats.year).main :\n time.resolveDTLFormat(dateTimeLabelFormats.day).main;\n }\n }\n DateTimeAxis.Additions = Additions;\n})(DateTimeAxis || (DateTimeAxis = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default DateTimeAxis;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../Utilities.js';\nconst { addEvent, normalizeTickInterval, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * @private\n */\nvar LogarithmicAxis;\n(function (LogarithmicAxis) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Provides logarithmic support for axes.\n * @private\n */\n function compose(AxisClass) {\n if (!AxisClass.keepProps.includes('logarithmic')) {\n AxisClass.keepProps.push('logarithmic');\n addEvent(AxisClass, 'init', onInit);\n addEvent(AxisClass, 'afterInit', onAfterInit);\n }\n return AxisClass;\n }\n LogarithmicAxis.compose = compose;\n /**\n * @private\n */\n function onInit(e) {\n const axis = this;\n const options = e.userOptions;\n let logarithmic = axis.logarithmic;\n if (options.type !== 'logarithmic') {\n axis.logarithmic = void 0;\n }\n else {\n if (!logarithmic) {\n logarithmic = axis.logarithmic = new Additions(axis);\n }\n }\n }\n /**\n * @private\n */\n function onAfterInit() {\n const axis = this;\n const log = axis.logarithmic;\n // extend logarithmic axis\n if (log) {\n axis.lin2val = function (num) {\n return log.lin2log(num);\n };\n axis.val2lin = function (num) {\n return log.log2lin(num);\n };\n }\n }\n /* *\n *\n * Class\n *\n * */\n /**\n * Provides logarithmic support for axes.\n * @private\n * @class\n */\n class Additions {\n /* *\n *\n * Constructors\n *\n * */\n constructor(axis) {\n this.axis = axis;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Set the tick positions of a logarithmic axis.\n */\n getLogTickPositions(interval, min, max, minor) {\n const log = this;\n const axis = log.axis;\n const axisLength = axis.len;\n const options = axis.options;\n // Since we use this method for both major and minor ticks,\n // use a local variable and return the result\n let positions = [];\n // Reset\n if (!minor) {\n log.minorAutoInterval = void 0;\n }\n // First case: All ticks fall on whole logarithms: 1, 10, 100 etc.\n if (interval >= 0.5) {\n interval = Math.round(interval);\n positions = axis.getLinearTickPositions(interval, min, max);\n // Second case: We need intermediary ticks. For example\n // 1, 2, 4, 6, 8, 10, 20, 40 etc.\n }\n else if (interval >= 0.08) {\n const roundedMin = Math.floor(min);\n let intermediate, i, j, len, pos, lastPos, break2;\n if (interval > 0.3) {\n intermediate = [1, 2, 4];\n // 0.2 equals five minor ticks per 1, 10, 100 etc\n }\n else if (interval > 0.15) {\n intermediate = [1, 2, 4, 6, 8];\n }\n else { // 0.1 equals ten minor ticks per 1, 10, 100 etc\n intermediate = [1, 2, 3, 4, 5, 6, 7, 8, 9];\n }\n for (i = roundedMin; i < max + 1 && !break2; i++) {\n len = intermediate.length;\n for (j = 0; j < len && !break2; j++) {\n pos = log.log2lin(log.lin2log(i) * intermediate[j]);\n // #1670, lastPos is #3113\n if (pos > min &&\n (!minor || lastPos <= max) &&\n typeof lastPos !== 'undefined') {\n positions.push(lastPos);\n }\n if (lastPos > max) {\n break2 = true;\n }\n lastPos = pos;\n }\n }\n // Third case: We are so deep in between whole logarithmic values,\n // that we might as well handle the tick positions like a linear\n // axis. For example 1.01, 1.02, 1.03, 1.04.\n }\n else {\n const realMin = log.lin2log(min), realMax = log.lin2log(max), tickIntervalOption = minor ?\n axis.getMinorTickInterval() :\n options.tickInterval, filteredTickIntervalOption = tickIntervalOption === 'auto' ?\n null :\n tickIntervalOption, tickPixelIntervalOption = options.tickPixelInterval / (minor ? 5 : 1), totalPixelLength = minor ?\n axisLength / axis.tickPositions.length :\n axisLength;\n interval = pick(filteredTickIntervalOption, log.minorAutoInterval, (realMax - realMin) *\n tickPixelIntervalOption / (totalPixelLength || 1));\n interval = normalizeTickInterval(interval);\n positions = axis.getLinearTickPositions(interval, realMin, realMax).map(log.log2lin);\n if (!minor) {\n log.minorAutoInterval = interval / 5;\n }\n }\n // Set the axis-level tickInterval variable\n if (!minor) {\n axis.tickInterval = interval;\n }\n return positions;\n }\n lin2log(num) {\n return Math.pow(10, num);\n }\n log2lin(num) {\n return Math.log(num) / Math.LN10;\n }\n }\n LogarithmicAxis.Additions = Additions;\n})(LogarithmicAxis || (LogarithmicAxis = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default LogarithmicAxis;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../../Utilities.js';\nconst { erase, extend, isNumber } = U;\n/* *\n *\n * Composition\n *\n * */\nvar PlotLineOrBandAxis;\n(function (PlotLineOrBandAxis) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Variables\n *\n * */\n let PlotLineOrBandClass;\n /* *\n *\n * Functions\n *\n * */\n /**\n * Add a plot band after render time.\n *\n * @sample highcharts/members/axis-addplotband/\n * Toggle the plot band from a button\n *\n * @function Highcharts.Axis#addPlotBand\n *\n * @param {Highcharts.AxisPlotBandsOptions} options\n * A configuration object for the plot band, as defined in\n * [xAxis.plotBands](https://api.highcharts.com/highcharts/xAxis.plotBands).\n *\n * @return {Highcharts.PlotLineOrBand|undefined}\n * The added plot band, or `undefined` if the options are not valid.\n */\n function addPlotBand(options) {\n return this.addPlotBandOrLine(options, 'plotBands');\n }\n /**\n * Add a plot band or plot line after render time. Called from\n * addPlotBand and addPlotLine internally.\n *\n * @private\n * @function Highcharts.Axis#addPlotBandOrLine\n * @param {Highcharts.AxisPlotBandsOptions|Highcharts.AxisPlotLinesOptions} options\n * The plotBand or plotLine configuration object.\n */\n function addPlotBandOrLine(options, coll) {\n const userOptions = this.userOptions;\n let obj = new PlotLineOrBandClass(this, options);\n if (this.visible) {\n obj = obj.render();\n }\n if (obj) { // #2189\n if (!this._addedPlotLB) {\n this._addedPlotLB = true;\n (userOptions.plotLines || [])\n .concat(userOptions.plotBands || [])\n .forEach((plotLineOptions) => {\n this.addPlotBandOrLine(plotLineOptions);\n });\n }\n // Add it to the user options for exporting and Axis.update\n if (coll) {\n // Workaround Microsoft/TypeScript issue #32693\n const updatedOptions = (userOptions[coll] || []);\n updatedOptions.push(options);\n userOptions[coll] = updatedOptions;\n }\n this.plotLinesAndBands.push(obj);\n }\n return obj;\n }\n /**\n * Add a plot line after render time.\n *\n * @sample highcharts/members/axis-addplotline/\n * Toggle the plot line from a button\n *\n * @function Highcharts.Axis#addPlotLine\n *\n * @param {Highcharts.AxisPlotLinesOptions} options\n * A configuration object for the plot line, as defined in\n * [xAxis.plotLines](https://api.highcharts.com/highcharts/xAxis.plotLines).\n *\n * @return {Highcharts.PlotLineOrBand|undefined}\n * The added plot line, or `undefined` if the options are not valid.\n */\n function addPlotLine(options) {\n return this.addPlotBandOrLine(options, 'plotLines');\n }\n /**\n * @private\n */\n function compose(PlotLineOrBandType, AxisClass) {\n const axisProto = AxisClass.prototype;\n if (!axisProto.addPlotBand) {\n PlotLineOrBandClass = PlotLineOrBandType;\n extend(axisProto, {\n addPlotBand,\n addPlotLine,\n addPlotBandOrLine,\n getPlotBandPath,\n removePlotBand,\n removePlotLine,\n removePlotBandOrLine\n });\n }\n return AxisClass;\n }\n PlotLineOrBandAxis.compose = compose;\n /**\n * Internal function to create the SVG path definition for a plot band.\n *\n * @function Highcharts.Axis#getPlotBandPath\n *\n * @param {number} from\n * The axis value to start from.\n *\n * @param {number} to\n * The axis value to end on.\n *\n * @param {Highcharts.AxisPlotBandsOptions|Highcharts.AxisPlotLinesOptions} options\n * The plotBand or plotLine configuration object.\n *\n * @return {Highcharts.SVGPathArray}\n * The SVG path definition in array form.\n */\n function getPlotBandPath(from, to, options) {\n options = options || this.options;\n const toPath = this.getPlotLinePath({\n value: to,\n force: true,\n acrossPanes: options.acrossPanes\n }), result = [], horiz = this.horiz, outside = !isNumber(this.min) ||\n !isNumber(this.max) ||\n (from < this.min && to < this.min) ||\n (from > this.max && to > this.max), path = this.getPlotLinePath({\n value: from,\n force: true,\n acrossPanes: options.acrossPanes\n });\n let i, \n // #4964 check if chart is inverted or plotband is on yAxis\n plus = 1, isFlat;\n if (path && toPath) {\n // Flat paths don't need labels (#3836)\n if (outside) {\n isFlat = path.toString() === toPath.toString();\n plus = 0;\n }\n // Go over each subpath - for panes in Highcharts Stock\n for (i = 0; i < path.length; i += 2) {\n const pathStart = path[i], pathEnd = path[i + 1], toPathStart = toPath[i], toPathEnd = toPath[i + 1];\n // Type checking all affected path segments. Consider\n // something smarter.\n if ((pathStart[0] === 'M' || pathStart[0] === 'L') &&\n (pathEnd[0] === 'M' || pathEnd[0] === 'L') &&\n (toPathStart[0] === 'M' || toPathStart[0] === 'L') &&\n (toPathEnd[0] === 'M' || toPathEnd[0] === 'L')) {\n // Add 1 pixel when coordinates are the same\n if (horiz && toPathStart[1] === pathStart[1]) {\n toPathStart[1] += plus;\n toPathEnd[1] += plus;\n }\n else if (!horiz && toPathStart[2] === pathStart[2]) {\n toPathStart[2] += plus;\n toPathEnd[2] += plus;\n }\n result.push(['M', pathStart[1], pathStart[2]], ['L', pathEnd[1], pathEnd[2]], ['L', toPathEnd[1], toPathEnd[2]], ['L', toPathStart[1], toPathStart[2]], ['Z']);\n }\n result.isFlat = isFlat;\n }\n }\n return result;\n }\n /**\n * Remove a plot band by its id.\n *\n * @sample highcharts/members/axis-removeplotband/\n * Remove plot band by id\n * @sample highcharts/members/axis-addplotband/\n * Toggle the plot band from a button\n *\n * @function Highcharts.Axis#removePlotBand\n *\n * @param {string} id\n * The plot band's `id` as given in the original configuration\n * object or in the `addPlotBand` option.\n */\n function removePlotBand(id) {\n this.removePlotBandOrLine(id);\n }\n /**\n * Remove a plot band or plot line from the chart by id. Called\n * internally from `removePlotBand` and `removePlotLine`.\n * @private\n * @function Highcharts.Axis#removePlotBandOrLine\n */\n function removePlotBandOrLine(id) {\n const plotLinesAndBands = this.plotLinesAndBands, options = this.options, userOptions = this.userOptions;\n if (plotLinesAndBands) { // #15639\n let i = plotLinesAndBands.length;\n while (i--) {\n if (plotLinesAndBands[i].id === id) {\n plotLinesAndBands[i].destroy();\n }\n }\n ([\n options.plotLines || [],\n userOptions.plotLines || [],\n options.plotBands || [],\n userOptions.plotBands || []\n ]).forEach(function (arr) {\n i = arr.length;\n while (i--) {\n if ((arr[i] || {}).id === id) {\n erase(arr, arr[i]);\n }\n }\n });\n }\n }\n /**\n * Remove a plot line by its id.\n *\n * @sample highcharts/xaxis/plotlines-id/\n * Remove plot line by id\n * @sample highcharts/members/axis-addplotline/\n * Toggle the plot line from a button\n *\n * @function Highcharts.Axis#removePlotLine\n *\n * @param {string} id\n * The plot line's `id` as given in the original configuration\n * object or in the `addPlotLine` option.\n */\n function removePlotLine(id) {\n this.removePlotBandOrLine(id);\n }\n})(PlotLineOrBandAxis || (PlotLineOrBandAxis = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default PlotLineOrBandAxis;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport PlotLineOrBandAxis from './PlotLineOrBandAxis.js';\nimport U from '../../Utilities.js';\nconst { arrayMax, arrayMin, defined, destroyObjectProperties, erase, fireEvent, merge, objectEach, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The object wrapper for plot lines and plot bands\n *\n * @class\n * @name Highcharts.PlotLineOrBand\n *\n * @param {Highcharts.Axis} axis\n * Related axis.\n *\n * @param {Highcharts.AxisPlotLinesOptions|Highcharts.AxisPlotBandsOptions} [options]\n * Options to use.\n */\nclass PlotLineOrBand {\n /* *\n *\n * Static Functions\n *\n * */\n static compose(AxisClass) {\n return PlotLineOrBandAxis.compose(PlotLineOrBand, AxisClass);\n }\n /* *\n *\n * Constructor\n *\n * */\n constructor(axis, options) {\n /**\n * Related axis.\n *\n * @name Highcharts.PlotLineOrBand#axis\n * @type {Highcharts.Axis}\n */\n this.axis = axis;\n /**\n * Options of the plot line or band.\n *\n * @name Highcharts.PlotLineOrBand#options\n * @type {AxisPlotBandsOptions|AxisPlotLinesOptions}\n */\n this.options = options;\n this.id = options.id;\n }\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable no-invalid-this, valid-jsdoc */\n /**\n * Render the plot line or plot band. If it is already existing,\n * move it.\n * @private\n * @function Highcharts.PlotLineOrBand#render\n */\n render() {\n fireEvent(this, 'render');\n const { axis, options } = this, { horiz, logarithmic } = axis, { color, events, zIndex = 0 } = options, groupAttribs = {}, renderer = axis.chart.renderer, \n // These properties only exist on either band or line\n to = options.to, from = options.from, value = options.value, borderWidth = options.borderWidth;\n let optionsLabel = options.label, { label, svgElem } = this, path = [], group;\n const isBand = defined(from) && defined(to), isLine = defined(value), isNew = !svgElem, attribs = {\n 'class': 'highcharts-plot-' + (isBand ? 'band ' : 'line ') +\n (options.className || '')\n };\n let groupName = isBand ? 'bands' : 'lines';\n // Set the presentational attributes\n if (!axis.chart.styledMode) {\n if (isLine) {\n attribs.stroke = color || \"#999999\" /* Palette.neutralColor40 */;\n attribs['stroke-width'] = pick(options.width, 1);\n if (options.dashStyle) {\n attribs.dashstyle = options.dashStyle;\n }\n }\n else if (isBand) { // Plot band\n attribs.fill = color || \"#e6e9ff\" /* Palette.highlightColor10 */;\n if (borderWidth) {\n attribs.stroke = options.borderColor;\n attribs['stroke-width'] = borderWidth;\n }\n }\n }\n // Grouping and zIndex\n groupAttribs.zIndex = zIndex;\n groupName += '-' + zIndex;\n group = axis.plotLinesAndBandsGroups[groupName];\n if (!group) {\n axis.plotLinesAndBandsGroups[groupName] = group =\n renderer.g('plot-' + groupName)\n .attr(groupAttribs).add();\n }\n // Create the path\n if (!svgElem) {\n /**\n * SVG element of the plot line or band.\n *\n * @name Highcharts.PlotLineOrBand#svgElem\n * @type {Highcharts.SVGElement}\n */\n this.svgElem = svgElem = renderer\n .path()\n .attr(attribs)\n .add(group);\n }\n // Set the path or return\n if (defined(value)) { // Plot line\n path = axis.getPlotLinePath({\n value: logarithmic?.log2lin(value) ?? value,\n lineWidth: svgElem.strokeWidth(),\n acrossPanes: options.acrossPanes\n });\n }\n else if (defined(from) && defined(to)) { // Plot band\n path = axis.getPlotBandPath(logarithmic?.log2lin(from) ?? from, logarithmic?.log2lin(to) ?? to, options);\n }\n else {\n return;\n }\n // Common for lines and bands. Add events only if they were not added\n // before.\n if (!this.eventsAdded && events) {\n objectEach(events, (event, eventType) => {\n svgElem?.on(eventType, (e) => {\n events[eventType].apply(this, [e]);\n });\n });\n this.eventsAdded = true;\n }\n if ((isNew || !svgElem.d) && path?.length) {\n svgElem.attr({ d: path });\n }\n else if (svgElem) {\n if (path) {\n svgElem.show();\n svgElem.animate({ d: path });\n }\n else if (svgElem.d) {\n svgElem.hide();\n if (label) {\n this.label = label = label.destroy();\n }\n }\n }\n // The plot band/line label\n if (optionsLabel &&\n (defined(optionsLabel.text) || defined(optionsLabel.formatter)) &&\n path?.length &&\n axis.width > 0 &&\n axis.height > 0 &&\n !path.isFlat) {\n // Apply defaults\n optionsLabel = merge({\n align: horiz && isBand && 'center',\n x: horiz ? !isBand && 4 : 10,\n verticalAlign: !horiz && isBand && 'middle',\n y: horiz ? isBand ? 16 : 10 : isBand ? 6 : -4,\n rotation: horiz && !isBand && 90\n }, optionsLabel);\n this.renderLabel(optionsLabel, path, isBand, zIndex);\n // Move out of sight\n }\n else if (label) {\n label.hide();\n }\n // Chainable\n return this;\n }\n /**\n * Render and align label for plot line or band.\n * @private\n * @function Highcharts.PlotLineOrBand#renderLabel\n */\n renderLabel(optionsLabel, path, isBand, zIndex) {\n const plotLine = this, axis = plotLine.axis, renderer = axis.chart.renderer;\n let label = plotLine.label;\n // Add the SVG element\n if (!label) {\n /**\n * SVG element of the label.\n *\n * @name Highcharts.PlotLineOrBand#label\n * @type {Highcharts.SVGElement}\n */\n plotLine.label = label = renderer\n .text(this.getLabelText(optionsLabel), 0, 0, optionsLabel.useHTML)\n .attr({\n align: optionsLabel.textAlign || optionsLabel.align,\n rotation: optionsLabel.rotation,\n 'class': 'highcharts-plot-' + (isBand ? 'band' : 'line') +\n '-label' + (optionsLabel.className || ''),\n zIndex\n });\n if (!axis.chart.styledMode) {\n label.css(merge({\n fontSize: '0.8em',\n textOverflow: 'ellipsis'\n }, optionsLabel.style));\n }\n label.add();\n }\n // Get the bounding box and align the label\n // #3000 changed to better handle choice between plotband or plotline\n const xBounds = path.xBounds ||\n [path[0][1], path[1][1], (isBand ? path[2][1] : path[0][1])], yBounds = path.yBounds ||\n [path[0][2], path[1][2], (isBand ? path[2][2] : path[0][2])], x = arrayMin(xBounds), y = arrayMin(yBounds);\n label.align(optionsLabel, false, {\n x,\n y,\n width: arrayMax(xBounds) - x,\n height: arrayMax(yBounds) - y\n });\n if (!label.alignValue || label.alignValue === 'left') {\n const width = optionsLabel.clip ?\n axis.width : axis.chart.chartWidth;\n label.css({\n width: (label.rotation === 90 ?\n axis.height - (label.alignAttr.y - axis.top) :\n width - (label.alignAttr.x - axis.left)) + 'px'\n });\n }\n label.show(true);\n }\n /**\n * Get label's text content.\n * @private\n * @function Highcharts.PlotLineOrBand#getLabelText\n */\n getLabelText(optionsLabel) {\n return defined(optionsLabel.formatter) ?\n optionsLabel.formatter\n .call(this) :\n optionsLabel.text;\n }\n /**\n * Remove the plot line or band.\n *\n * @function Highcharts.PlotLineOrBand#destroy\n */\n destroy() {\n // Remove it from the lookup\n erase(this.axis.plotLinesAndBands, this);\n delete this.axis;\n destroyObjectProperties(this);\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default PlotLineOrBand;\n/* *\n *\n * API Options\n *\n * */\n/**\n * Options for plot bands on axes.\n *\n * @typedef {Highcharts.XAxisPlotBandsOptions|Highcharts.YAxisPlotBandsOptions|Highcharts.ZAxisPlotBandsOptions} Highcharts.AxisPlotBandsOptions\n */\n/**\n * Options for plot band labels on axes.\n *\n * @typedef {Highcharts.XAxisPlotBandsLabelOptions|Highcharts.YAxisPlotBandsLabelOptions|Highcharts.ZAxisPlotBandsLabelOptions} Highcharts.AxisPlotBandsLabelOptions\n */\n/**\n * Options for plot lines on axes.\n *\n * @typedef {Highcharts.XAxisPlotLinesOptions|Highcharts.YAxisPlotLinesOptions|Highcharts.ZAxisPlotLinesOptions} Highcharts.AxisPlotLinesOptions\n */\n/**\n * Options for plot line labels on axes.\n *\n * @typedef {Highcharts.XAxisPlotLinesLabelOptions|Highcharts.YAxisPlotLinesLabelOptions|Highcharts.ZAxisPlotLinesLabelOptions} Highcharts.AxisPlotLinesLabelOptions\n */\n('');\n/* *\n *\n * API Options\n *\n * */\n/**\n * An array of colored bands stretching across the plot area marking an\n * interval on the axis.\n *\n * In styled mode, the plot bands are styled by the `.highcharts-plot-band`\n * class in addition to the `className` option.\n *\n * @productdesc {highcharts}\n * In a gauge, a plot band on the Y axis (value axis) will stretch along the\n * perimeter of the gauge.\n *\n * @type {Array<*>}\n * @product highcharts highstock gantt\n * @apioption xAxis.plotBands\n */\n/**\n * Flag to decide if plotBand should be rendered across all panes.\n *\n * @since 7.1.2\n * @product highstock\n * @type {boolean}\n * @default true\n * @apioption xAxis.plotBands.acrossPanes\n */\n/**\n * Border color for the plot band. Also requires `borderWidth` to be set.\n *\n * @type {Highcharts.ColorString}\n * @apioption xAxis.plotBands.borderColor\n */\n/**\n * Border width for the plot band. Also requires `borderColor` to be set.\n *\n * @type {number}\n * @default 0\n * @apioption xAxis.plotBands.borderWidth\n */\n/**\n * A custom class name, in addition to the default `highcharts-plot-band`,\n * to apply to each individual band.\n *\n * @type {string}\n * @since 5.0.0\n * @apioption xAxis.plotBands.className\n */\n/**\n * The color of the plot band.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-color/\n * Color band\n * @sample {highstock} stock/xaxis/plotbands/\n * Plot band on Y axis\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default ${palette.highlightColor10}\n * @apioption xAxis.plotBands.color\n */\n/**\n * An object defining mouse events for the plot band. Supported properties\n * are `click`, `mouseover`, `mouseout`, `mousemove`.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-events/\n * Mouse events demonstrated\n *\n * @since 1.2\n * @apioption xAxis.plotBands.events\n */\n/**\n * Click event on a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotBands.events.click\n */\n/**\n * Mouse move event on a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotBands.events.mousemove\n */\n/**\n * Mouse out event on the corner of a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotBands.events.mouseout\n */\n/**\n * Mouse over event on a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotBands.events.mouseover\n */\n/**\n * The start position of the plot band in axis units.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-color/\n * Datetime axis\n * @sample {highcharts} highcharts/xaxis/plotbands-from/\n * Categorized axis\n * @sample {highstock} stock/xaxis/plotbands/\n * Plot band on Y axis\n *\n * @type {number}\n * @apioption xAxis.plotBands.from\n */\n/**\n * An id used for identifying the plot band in Axis.removePlotBand.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-id/\n * Remove plot band by id\n * @sample {highstock} highcharts/xaxis/plotbands-id/\n * Remove plot band by id\n *\n * @type {string}\n * @apioption xAxis.plotBands.id\n */\n/**\n * The end position of the plot band in axis units.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-color/\n * Datetime axis\n * @sample {highcharts} highcharts/xaxis/plotbands-from/\n * Categorized axis\n * @sample {highstock} stock/xaxis/plotbands/\n * Plot band on Y axis\n *\n * @type {number}\n * @apioption xAxis.plotBands.to\n */\n/**\n * The z index of the plot band within the chart, relative to other\n * elements. Using the same z index as another element may give\n * unpredictable results, as the last rendered element will be on top.\n * Values from 0 to 20 make sense.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-color/\n * Behind plot lines by default\n * @sample {highcharts} highcharts/xaxis/plotbands-zindex/\n * Above plot lines\n * @sample {highcharts} highcharts/xaxis/plotbands-zindex-above-series/\n * Above plot lines and series\n *\n * @type {number}\n * @since 1.2\n * @apioption xAxis.plotBands.zIndex\n */\n/**\n * Text labels for the plot bands\n *\n * @product highcharts highstock gantt\n * @apioption xAxis.plotBands.label\n */\n/**\n * Horizontal alignment of the label. Can be one of \"left\", \"center\" or\n * \"right\".\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-label-align/\n * Aligned to the right\n * @sample {highstock} stock/xaxis/plotbands-label/\n * Plot band with labels\n *\n * @type {Highcharts.AlignValue}\n * @default center\n * @since 2.1\n * @apioption xAxis.plotBands.label.align\n */\n/**\n * Rotation of the text label in degrees .\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-label-rotation/\n * Vertical text\n *\n * @type {number}\n * @default 0\n * @since 2.1\n * @apioption xAxis.plotBands.label.rotation\n */\n/**\n * CSS styles for the text label.\n *\n * In styled mode, the labels are styled by the\n * `.highcharts-plot-band-label` class.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-label-style/\n * Blue and bold label\n *\n * @type {Highcharts.CSSObject}\n * @since 2.1\n * @apioption xAxis.plotBands.label.style\n */\n/**\n * The string text itself. A subset of HTML is supported.\n *\n * @type {string}\n * @since 2.1\n * @apioption xAxis.plotBands.label.text\n */\n/**\n * The text alignment for the label. While `align` determines where the\n * texts anchor point is placed within the plot band, `textAlign` determines\n * how the text is aligned against its anchor point. Possible values are\n * \"left\", \"center\" and \"right\". Defaults to the same as the `align` option.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-label-rotation/\n * Vertical text in center position but text-aligned left\n *\n * @type {Highcharts.AlignValue}\n * @since 2.1\n * @apioption xAxis.plotBands.label.textAlign\n */\n/**\n * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the labels.\n *\n * @type {boolean}\n * @default false\n * @since 3.0.3\n * @apioption xAxis.plotBands.label.useHTML\n */\n/**\n * Vertical alignment of the label relative to the plot band. Can be one of\n * \"top\", \"middle\" or \"bottom\".\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-label-verticalalign/\n * Vertically centered label\n * @sample {highstock} stock/xaxis/plotbands-label/\n * Plot band with labels\n *\n * @type {Highcharts.VerticalAlignValue}\n * @default top\n * @since 2.1\n * @apioption xAxis.plotBands.label.verticalAlign\n */\n/**\n * Horizontal position relative the alignment. Default varies by\n * orientation.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-label-align/\n * Aligned 10px from the right edge\n * @sample {highstock} stock/xaxis/plotbands-label/\n * Plot band with labels\n *\n * @type {number}\n * @since 2.1\n * @apioption xAxis.plotBands.label.x\n */\n/**\n * Vertical position of the text baseline relative to the alignment. Default\n * varies by orientation.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-label-y/\n * Label on x axis\n * @sample {highstock} stock/xaxis/plotbands-label/\n * Plot band with labels\n *\n * @type {number}\n * @since 2.1\n * @apioption xAxis.plotBands.label.y\n */\n/**\n * An array of lines stretching across the plot area, marking a specific\n * value on one of the axes.\n *\n * In styled mode, the plot lines are styled by the\n * `.highcharts-plot-line` class in addition to the `className` option.\n *\n * @type {Array<*>}\n * @product highcharts highstock gantt\n * @sample {highcharts} highcharts/xaxis/plotlines-color/\n * Basic plot line\n * @sample {highcharts} highcharts/series-solidgauge/labels-auto-aligned/\n * Solid gauge plot line\n * @apioption xAxis.plotLines\n */\n/**\n * Flag to decide if plotLine should be rendered across all panes.\n *\n * @sample {highstock} stock/xaxis/plotlines-acrosspanes/\n * Plot lines on different panes\n *\n * @since 7.1.2\n * @product highstock\n * @type {boolean}\n * @default true\n * @apioption xAxis.plotLines.acrossPanes\n */\n/**\n * A custom class name, in addition to the default `highcharts-plot-line`,\n * to apply to each individual line.\n *\n * @type {string}\n * @since 5.0.0\n * @apioption xAxis.plotLines.className\n */\n/**\n * The color of the line.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-color/\n * A red line from X axis\n * @sample {highstock} stock/xaxis/plotlines/\n * Plot line on Y axis\n *\n * @type {Highcharts.ColorString}\n * @default ${palette.neutralColor40}\n * @apioption xAxis.plotLines.color\n */\n/**\n * The dashing or dot style for the plot line. For possible values see\n * [this overview](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/).\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-dashstyle/\n * Dash and dot pattern\n * @sample {highstock} stock/xaxis/plotlines/\n * Plot line on Y axis\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 1.2\n * @apioption xAxis.plotLines.dashStyle\n */\n/**\n * An object defining mouse events for the plot line. Supported\n * properties are `click`, `mouseover`, `mouseout`, `mousemove`.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-events/\n * Mouse events demonstrated\n *\n * @since 1.2\n * @apioption xAxis.plotLines.events\n */\n/**\n * Click event on a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotLines.events.click\n */\n/**\n * Mouse move event on a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotLines.events.mousemove\n */\n/**\n * Mouse out event on the corner of a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotLines.events.mouseout\n */\n/**\n * Mouse over event on a plot band.\n *\n * @type {Highcharts.EventCallbackFunction}\n * @apioption xAxis.plotLines.events.mouseover\n */\n/**\n * An id used for identifying the plot line in Axis.removePlotLine.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-id/\n * Remove plot line by id\n *\n * @type {string}\n * @apioption xAxis.plotLines.id\n */\n/**\n * The position of the line in axis units.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-color/\n * Between two categories on X axis\n * @sample {highstock} stock/xaxis/plotlines/\n * Plot line on Y axis\n *\n * @type {number}\n * @apioption xAxis.plotLines.value\n */\n/**\n * The width or thickness of the plot line.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-color/\n * 2px wide line from X axis\n * @sample {highstock} stock/xaxis/plotlines/\n * Plot line on Y axis\n *\n * @type {number}\n * @default 2\n * @apioption xAxis.plotLines.width\n */\n/**\n * The z index of the plot line within the chart.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-zindex-behind/\n * Behind plot lines by default\n * @sample {highcharts} highcharts/xaxis/plotlines-zindex-above/\n * Above plot lines\n * @sample {highcharts} highcharts/xaxis/plotlines-zindex-above-all/\n * Above plot lines and series\n *\n * @type {number}\n * @since 1.2\n * @apioption xAxis.plotLines.zIndex\n */\n/**\n * Text labels for the plot bands\n *\n * @apioption xAxis.plotLines.label\n */\n/**\n * Horizontal alignment of the label. Can be one of \"left\", \"center\" or\n * \"right\".\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-label-align-right/\n * Aligned to the right\n * @sample {highstock} stock/xaxis/plotlines/\n * Plot line on Y axis\n *\n * @type {Highcharts.AlignValue}\n * @default left\n * @since 2.1\n * @apioption xAxis.plotLines.label.align\n */\n/**\n * Whether to hide labels that are outside the plot area.\n *\n * @type {boolean}\n * @default false\n * @since 10.3.3\n * @apioption xAxis.plotLines.labels.clip\n */\n/**\n * Callback JavaScript function to format the label. Useful properties like\n * the value of plot line or the range of plot band (`from` & `to`\n * properties) can be found in `this.options` object.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-plotbands-label-formatter\n * Label formatters for plot line and plot band.\n * @type {Highcharts.FormatterCallbackFunction}\n * @apioption xAxis.plotLines.label.formatter\n */\n/**\n * Rotation of the text label in degrees. Defaults to 0 for horizontal plot\n * lines and 90 for vertical lines.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-label-verticalalign-middle/\n * Slanted text\n *\n * @type {number}\n * @since 2.1\n * @apioption xAxis.plotLines.label.rotation\n */\n/**\n * CSS styles for the text label.\n *\n * In styled mode, the labels are styled by the\n * `.highcharts-plot-line-label` class.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-label-style/\n * Blue and bold label\n *\n * @type {Highcharts.CSSObject}\n * @since 2.1\n * @apioption xAxis.plotLines.label.style\n */\n/**\n * The text itself. A subset of HTML is supported.\n *\n * @type {string}\n * @since 2.1\n * @apioption xAxis.plotLines.label.text\n */\n/**\n * The text alignment for the label. While `align` determines where the\n * texts anchor point is placed within the plot band, `textAlign` determines\n * how the text is aligned against its anchor point. Possible values are\n * \"left\", \"center\" and \"right\". Defaults to the same as the `align` option.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-label-textalign/\n * Text label in bottom position\n *\n * @type {Highcharts.AlignValue}\n * @since 2.1\n * @apioption xAxis.plotLines.label.textAlign\n */\n/**\n * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the labels.\n *\n * @type {boolean}\n * @default false\n * @since 3.0.3\n * @apioption xAxis.plotLines.label.useHTML\n */\n/**\n * Vertical alignment of the label relative to the plot line. Can be\n * one of \"top\", \"middle\" or \"bottom\".\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-label-verticalalign-middle/\n * Vertically centered label\n *\n * @type {Highcharts.VerticalAlignValue}\n * @default {highcharts} top\n * @default {highstock} top\n * @since 2.1\n * @apioption xAxis.plotLines.label.verticalAlign\n */\n/**\n * Horizontal position relative the alignment. Default varies by\n * orientation.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-label-align-right/\n * Aligned 10px from the right edge\n * @sample {highstock} stock/xaxis/plotlines/\n * Plot line on Y axis\n *\n * @type {number}\n * @since 2.1\n * @apioption xAxis.plotLines.label.x\n */\n/**\n * Vertical position of the text baseline relative to the alignment. Default\n * varies by orientation.\n *\n * @sample {highcharts} highcharts/xaxis/plotlines-label-y/\n * Label below the plot line\n * @sample {highstock} stock/xaxis/plotlines/\n * Plot line on Y axis\n *\n * @type {number}\n * @since 2.1\n * @apioption xAxis.plotLines.label.y\n */\n/**\n * @type {Array<*>}\n * @extends xAxis.plotBands\n * @apioption yAxis.plotBands\n */\n/**\n * In a gauge chart, this option determines the inner radius of the\n * plot band that stretches along the perimeter. It can be given as\n * a percentage string, like `\"100%\"`, or as a pixel number, like `100`.\n * By default, the inner radius is controlled by the [thickness](\n * #yAxis.plotBands.thickness) option.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-gauge\n * Gauge plot band\n *\n * @type {number|string}\n * @since 2.3\n * @product highcharts\n * @apioption yAxis.plotBands.innerRadius\n */\n/**\n * In a gauge chart, this option determines the outer radius of the\n * plot band that stretches along the perimeter. It can be given as\n * a percentage string, like `\"100%\"`, or as a pixel number, like `100`.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-gauge\n * Gauge plot band\n *\n * @type {number|string}\n * @default 100%\n * @since 2.3\n * @product highcharts\n * @apioption yAxis.plotBands.outerRadius\n */\n/**\n * In a gauge chart, this option sets the width of the plot band\n * stretching along the perimeter. It can be given as a percentage\n * string, like `\"10%\"`, or as a pixel number, like `10`. The default\n * value 10 is the same as the default [tickLength](#yAxis.tickLength),\n * thus making the plot band act as a background for the tick markers.\n *\n * @sample {highcharts} highcharts/xaxis/plotbands-gauge\n * Gauge plot band\n *\n * @type {number|string}\n * @default 10\n * @since 2.3\n * @product highcharts\n * @apioption yAxis.plotBands.thickness\n */\n/**\n * @type {Array<*>}\n * @extends xAxis.plotLines\n * @apioption yAxis.plotLines\n */\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport F from './Templating.js';\nconst { format } = F;\nimport H from './Globals.js';\nconst { composed, doc, isSafari } = H;\nimport R from './Renderer/RendererUtilities.js';\nconst { distribute } = R;\nimport RendererRegistry from './Renderer/RendererRegistry.js';\nimport U from './Utilities.js';\nconst { addEvent, clamp, css, discardElement, extend, fireEvent, isArray, isNumber, isString, merge, pick, pushUnique, splat, syncTimeout } = U;\n/* *\n *\n * Class\n *\n * */\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/**\n * Tooltip of a chart.\n *\n * @class\n * @name Highcharts.Tooltip\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @param {Highcharts.TooltipOptions} options\n * Tooltip options.\n */\nclass Tooltip {\n /* *\n *\n * Constructors\n *\n * */\n constructor(chart, options, pointer) {\n /* *\n *\n * Properties\n *\n * */\n this.allowShared = true;\n this.crosshairs = [];\n this.distance = 0;\n this.isHidden = true;\n this.isSticky = false;\n this.now = {};\n this.options = {};\n this.outside = false;\n this.chart = chart;\n this.init(chart, options);\n this.pointer = pointer;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Build the body (lines) of the tooltip by iterating over the items and\n * returning one entry for each item, abstracting this functionality allows\n * to easily overwrite and extend it.\n *\n * @private\n * @function Highcharts.Tooltip#bodyFormatter\n */\n bodyFormatter(items) {\n return items.map(function (item) {\n const tooltipOptions = item.series.tooltipOptions;\n return (tooltipOptions[(item.point.formatPrefix || 'point') + 'Formatter'] ||\n item.point.tooltipFormatter).call(item.point, tooltipOptions[(item.point.formatPrefix || 'point') + 'Format'] || '');\n });\n }\n /**\n * Destroy the single tooltips in a split tooltip.\n * If the tooltip is active then it is not destroyed, unless forced to.\n *\n * @private\n * @function Highcharts.Tooltip#cleanSplit\n *\n * @param {boolean} [force]\n * Force destroy all tooltips.\n */\n cleanSplit(force) {\n this.chart.series.forEach(function (series) {\n const tt = series && series.tt;\n if (tt) {\n if (!tt.isActive || force) {\n series.tt = tt.destroy();\n }\n else {\n tt.isActive = false;\n }\n }\n });\n }\n /**\n * In case no user defined formatter is given, this will be used. Note that\n * the context here is an object holding point, series, x, y etc.\n *\n * @function Highcharts.Tooltip#defaultFormatter\n *\n * @param {Highcharts.Tooltip} tooltip\n *\n * @return {string|Array}\n * Returns a string (single tooltip and shared)\n * or an array of strings (split tooltip)\n */\n defaultFormatter(tooltip) {\n const items = this.points || splat(this);\n let s;\n // Build the header\n s = [tooltip.tooltipFooterHeaderFormatter(items[0])];\n // build the values\n s = s.concat(tooltip.bodyFormatter(items));\n // footer\n s.push(tooltip.tooltipFooterHeaderFormatter(items[0], true));\n return s;\n }\n /**\n * Removes and destroys the tooltip and its elements.\n *\n * @function Highcharts.Tooltip#destroy\n */\n destroy() {\n // Destroy and clear local variables\n if (this.label) {\n this.label = this.label.destroy();\n }\n if (this.split) {\n this.cleanSplit(true);\n if (this.tt) {\n this.tt = this.tt.destroy();\n }\n }\n if (this.renderer) {\n this.renderer = this.renderer.destroy();\n discardElement(this.container);\n }\n U.clearTimeout(this.hideTimer);\n U.clearTimeout(this.tooltipTimeout);\n }\n /**\n * Extendable method to get the anchor position of the tooltip\n * from a point or set of points\n *\n * @private\n * @function Highcharts.Tooltip#getAnchor\n */\n getAnchor(points, mouseEvent) {\n const { chart, pointer } = this, inverted = chart.inverted, plotTop = chart.plotTop, plotLeft = chart.plotLeft;\n let ret;\n points = splat(points);\n // If reversedStacks are false the tooltip position should be taken from\n // the last point (#17948)\n if (points[0].series &&\n points[0].series.yAxis &&\n !points[0].series.yAxis.options.reversedStacks) {\n points = points.slice().reverse();\n }\n // When tooltip follows mouse, relate the position to the mouse\n if (this.followPointer && mouseEvent) {\n if (typeof mouseEvent.chartX === 'undefined') {\n mouseEvent = pointer.normalize(mouseEvent);\n }\n ret = [\n mouseEvent.chartX - plotLeft,\n mouseEvent.chartY - plotTop\n ];\n // Some series types use a specificly calculated tooltip position for\n // each point\n }\n else if (points[0].tooltipPos) {\n ret = points[0].tooltipPos;\n // Calculate the average position and adjust for axis positions\n }\n else {\n let chartX = 0, chartY = 0;\n points.forEach(function (point) {\n const pos = point.pos(true);\n if (pos) {\n chartX += pos[0];\n chartY += pos[1];\n }\n });\n chartX /= points.length;\n chartY /= points.length;\n // When shared, place the tooltip next to the mouse (#424)\n if (this.shared && points.length > 1 && mouseEvent) {\n if (inverted) {\n chartX = mouseEvent.chartX;\n }\n else {\n chartY = mouseEvent.chartY;\n }\n }\n // Use the average position for multiple points\n ret = [chartX - plotLeft, chartY - plotTop];\n }\n return ret.map(Math.round);\n }\n /**\n * Get the CSS class names for the tooltip's label. Styles the label\n * by `colorIndex` or user-defined CSS.\n *\n * @function Highcharts.Tooltip#getClassName\n *\n * @return {string}\n * The class names.\n */\n getClassName(point, isSplit, isHeader) {\n const options = this.options, series = point.series, seriesOptions = series.options;\n return [\n options.className,\n 'highcharts-label',\n isHeader && 'highcharts-tooltip-header',\n isSplit ? 'highcharts-tooltip-box' : 'highcharts-tooltip',\n !isHeader && 'highcharts-color-' + pick(point.colorIndex, series.colorIndex),\n (seriesOptions && seriesOptions.className)\n ].filter(isString).join(' ');\n }\n /**\n * Creates the Tooltip label element if it does not exist, then returns it.\n *\n * @function Highcharts.Tooltip#getLabel\n *\n * @return {Highcharts.SVGElement}\n * Tooltip label\n */\n getLabel() {\n const tooltip = this, styledMode = this.chart.styledMode, options = this.options, doSplit = this.split && this.allowShared;\n let container = this.container, renderer = this.chart.renderer;\n // If changing from a split tooltip to a non-split tooltip, we must\n // destroy it in order to get the SVG right. #13868.\n if (this.label) {\n const wasSplit = !this.label.hasClass('highcharts-label');\n if ((!doSplit && wasSplit) || (doSplit && !wasSplit)) {\n this.destroy();\n }\n }\n if (!this.label) {\n if (this.outside) {\n const chartStyle = this.chart.options.chart.style, Renderer = RendererRegistry.getRendererType();\n /**\n * Reference to the tooltip's container, when\n * [Highcharts.Tooltip#outside] is set to true, otherwise\n * it's undefined.\n *\n * @name Highcharts.Tooltip#container\n * @type {Highcharts.HTMLDOMElement|undefined}\n */\n this.container = container = H.doc.createElement('div');\n container.className = 'highcharts-tooltip-container';\n // We need to set pointerEvents = 'none' as otherwise it makes\n // the area under the tooltip non-hoverable even after the\n // tooltip disappears, #19035.\n css(container, {\n position: 'absolute',\n top: '1px',\n pointerEvents: 'none',\n zIndex: Math.max(this.options.style.zIndex || 0, (chartStyle && chartStyle.zIndex || 0) + 3)\n });\n /**\n * Reference to the tooltip's renderer, when\n * [Highcharts.Tooltip#outside] is set to true, otherwise\n * it's undefined.\n *\n * @name Highcharts.Tooltip#renderer\n * @type {Highcharts.SVGRenderer|undefined}\n */\n this.renderer = renderer = new Renderer(container, 0, 0, chartStyle, void 0, void 0, renderer.styledMode);\n }\n // Create the label\n if (doSplit) {\n this.label = renderer.g('tooltip');\n }\n else {\n this.label = renderer\n .label('', 0, 0, options.shape, void 0, void 0, options.useHTML, void 0, 'tooltip')\n .attr({\n padding: options.padding,\n r: options.borderRadius\n });\n if (!styledMode) {\n this.label\n .attr({\n fill: options.backgroundColor,\n 'stroke-width': options.borderWidth || 0\n })\n // #2301, #2657\n .css(options.style)\n .css({\n pointerEvents: (options.style.pointerEvents ||\n (this.shouldStickOnContact() ? 'auto' : 'none'))\n });\n }\n }\n // Split tooltip use updateTooltipContainer to position the tooltip\n // container.\n if (tooltip.outside) {\n const label = this.label;\n const { xSetter, ySetter } = label;\n label.xSetter = function (value) {\n xSetter.call(label, tooltip.distance);\n if (container) {\n container.style.left = value + 'px';\n }\n };\n label.ySetter = function (value) {\n ySetter.call(label, tooltip.distance);\n if (container) {\n container.style.top = value + 'px';\n }\n };\n }\n this.label\n .attr({ zIndex: 8 })\n .shadow(options.shadow)\n .add();\n }\n if (container && !container.parentElement) {\n H.doc.body.appendChild(container);\n }\n return this.label;\n }\n /**\n * Get the total area available area to place the tooltip\n *\n * @private\n */\n getPlayingField() {\n const { body, documentElement } = doc, { chart, distance, outside } = this;\n return {\n width: outside ?\n // Subtract distance to prevent scrollbars\n Math.max(body.scrollWidth, documentElement.scrollWidth, body.offsetWidth, documentElement.offsetWidth, documentElement.clientWidth) - 2 * distance :\n chart.chartWidth,\n height: outside ?\n Math.max(body.scrollHeight, documentElement.scrollHeight, body.offsetHeight, documentElement.offsetHeight, documentElement.clientHeight) :\n chart.chartHeight\n };\n }\n /**\n * Place the tooltip in a chart without spilling over and not covering the\n * point itself.\n *\n * @function Highcharts.Tooltip#getPosition\n *\n * @param {number} boxWidth\n * Width of the tooltip box.\n *\n * @param {number} boxHeight\n * Height of the tooltip box.\n *\n * @param {Highcharts.Point} point\n * Tooltip related point.\n *\n * @return {Highcharts.PositionObject}\n * Recommended position of the tooltip.\n */\n getPosition(boxWidth, boxHeight, point) {\n const { distance, chart, outside, pointer } = this, { inverted, plotLeft, plotTop, polar } = chart, { plotX = 0, plotY = 0 } = point, ret = {}, \n // Don't use h if chart isn't inverted (#7242) ???\n h = (inverted && point.h) || 0, // #4117 ???\n { height: outerHeight, width: outerWidth } = this.getPlayingField(), chartPosition = pointer.getChartPosition(), scaleX = (val) => (val * chartPosition.scaleX), scaleY = (val) => (val * chartPosition.scaleY), \n // Build parameter arrays for firstDimension()/secondDimension()\n buildDimensionArray = (dim) => {\n const isX = dim === 'x';\n return [\n dim,\n isX ? outerWidth : outerHeight,\n isX ? boxWidth : boxHeight\n ].concat(outside ? [\n // If we are using tooltip.outside, we need to scale the\n // position to match scaling of the container in case there\n // is a transform/zoom on the container. #11329\n isX ? scaleX(boxWidth) : scaleY(boxHeight),\n isX ? chartPosition.left - distance +\n scaleX(plotX + plotLeft) :\n chartPosition.top - distance +\n scaleY(plotY + plotTop),\n 0,\n isX ? outerWidth : outerHeight\n ] : [\n // Not outside, no scaling is needed\n isX ? boxWidth : boxHeight,\n isX ? plotX + plotLeft : plotY + plotTop,\n isX ? plotLeft : plotTop,\n isX ? plotLeft + chart.plotWidth :\n plotTop + chart.plotHeight\n ]);\n };\n let first = buildDimensionArray('y'), second = buildDimensionArray('x'), swapped;\n // Handle negative points or reversed axis (#13780)\n let flipped = !!point.negative;\n if (!polar &&\n chart.hoverSeries?.yAxis?.reversed) {\n flipped = !flipped;\n }\n // The far side is right or bottom\n const preferFarSide = !this.followPointer &&\n pick(point.ttBelow, polar ? false : !inverted === flipped), // #4984\n /*\n * Handle the preferred dimension. When the preferred dimension is\n * tooltip on top or bottom of the point, it will look for space\n * there.\n *\n * @private\n */\n firstDimension = function (dim, outerSize, innerSize, scaledInnerSize, // #11329\n point, min, max) {\n const scaledDist = outside ?\n (dim === 'y' ? scaleY(distance) : scaleX(distance)) :\n distance, scaleDiff = (innerSize - scaledInnerSize) / 2, roomLeft = scaledInnerSize < point - distance, roomRight = point + distance + scaledInnerSize < outerSize, alignedLeft = point - scaledDist - innerSize + scaleDiff, alignedRight = point + scaledDist - scaleDiff;\n if (preferFarSide && roomRight) {\n ret[dim] = alignedRight;\n }\n else if (!preferFarSide && roomLeft) {\n ret[dim] = alignedLeft;\n }\n else if (roomLeft) {\n ret[dim] = Math.min(max - scaledInnerSize, alignedLeft - h < 0 ? alignedLeft : alignedLeft - h);\n }\n else if (roomRight) {\n ret[dim] = Math.max(min, alignedRight + h + innerSize > outerSize ?\n alignedRight :\n alignedRight + h);\n }\n else {\n return false;\n }\n }, \n /*\n * Handle the secondary dimension. If the preferred dimension is\n * tooltip on top or bottom of the point, the second dimension is to\n * align the tooltip above the point, trying to align center but\n * allowing left or right align within the chart box.\n *\n * @private\n */\n secondDimension = function (dim, outerSize, innerSize, scaledInnerSize, // #11329\n point) {\n // Too close to the edge, return false and swap dimensions\n if (point < distance || point > outerSize - distance) {\n return false;\n }\n // Align left/top\n if (point < innerSize / 2) {\n ret[dim] = 1;\n // Align right/bottom\n }\n else if (point > outerSize - scaledInnerSize / 2) {\n ret[dim] = outerSize - scaledInnerSize - 2;\n // Align center\n }\n else {\n ret[dim] = point - innerSize / 2;\n }\n }, \n /*\n * Swap the dimensions\n */\n swap = function (count) {\n [first, second] = [second, first];\n swapped = count;\n }, run = () => {\n if (firstDimension.apply(0, first) !== false) {\n if (secondDimension.apply(0, second) === false &&\n !swapped) {\n swap(true);\n run();\n }\n }\n else if (!swapped) {\n swap(true);\n run();\n }\n else {\n ret.x = ret.y = 0;\n }\n };\n // Under these conditions, prefer the tooltip on the side of the point\n if ((inverted && !polar) || this.len > 1) {\n swap();\n }\n run();\n return ret;\n }\n /**\n * Hides the tooltip with a fade out animation.\n *\n * @function Highcharts.Tooltip#hide\n *\n * @param {number} [delay]\n * The fade out in milliseconds. If no value is provided the value\n * of the tooltip.hideDelay option is used. A value of 0 disables\n * the fade out animation.\n */\n hide(delay) {\n const tooltip = this;\n // Disallow duplicate timers (#1728, #1766)\n U.clearTimeout(this.hideTimer);\n delay = pick(delay, this.options.hideDelay);\n if (!this.isHidden) {\n this.hideTimer = syncTimeout(function () {\n const label = tooltip.getLabel();\n // If there is a delay, fade out with the default duration. If\n // the hideDelay is 0, we assume no animation is wanted, so we\n // pass 0 duration. #12994.\n tooltip.getLabel().animate({\n opacity: 0\n }, {\n duration: delay ? 150 : delay,\n complete: () => {\n // #3088, assuming we're only using this for tooltips\n label.hide();\n // Clear the container for outside tooltip (#18490)\n if (tooltip.container) {\n tooltip.container.remove();\n }\n }\n });\n tooltip.isHidden = true;\n }, delay);\n }\n }\n /**\n * Initialize tooltip.\n *\n * @private\n * @function Highcharts.Tooltip#init\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @param {Highcharts.TooltipOptions} options\n * Tooltip options.\n */\n init(chart, options) {\n /**\n * Chart of the tooltip.\n *\n * @readonly\n * @name Highcharts.Tooltip#chart\n * @type {Highcharts.Chart}\n */\n this.chart = chart;\n /**\n * Used tooltip options.\n *\n * @readonly\n * @name Highcharts.Tooltip#options\n * @type {Highcharts.TooltipOptions}\n */\n this.options = options;\n /**\n * List of crosshairs.\n *\n * @private\n * @readonly\n * @name Highcharts.Tooltip#crosshairs\n * @type {Array}\n */\n this.crosshairs = [];\n /**\n * Current values of x and y when animating.\n *\n * @private\n * @readonly\n * @name Highcharts.Tooltip#now\n * @type {Highcharts.PositionObject}\n */\n this.now = { x: 0, y: 0 };\n /**\n * Tooltips are initially hidden.\n *\n * @private\n * @readonly\n * @name Highcharts.Tooltip#isHidden\n * @type {boolean}\n */\n this.isHidden = true;\n /**\n * True, if the tooltip is split into one label per series, with the\n * header close to the axis.\n *\n * @readonly\n * @name Highcharts.Tooltip#split\n * @type {boolean|undefined}\n */\n this.split = options.split && !chart.inverted && !chart.polar;\n /**\n * When the tooltip is shared, the entire plot area will capture mouse\n * movement or touch events.\n *\n * @readonly\n * @name Highcharts.Tooltip#shared\n * @type {boolean|undefined}\n */\n this.shared = options.shared || this.split;\n /**\n * Whether to allow the tooltip to render outside the chart's SVG\n * element box. By default (false), the tooltip is rendered within the\n * chart's SVG element, which results in the tooltip being aligned\n * inside the chart area.\n *\n * @readonly\n * @name Highcharts.Tooltip#outside\n * @type {boolean}\n *\n * @todo\n * Split tooltip does not support outside in the first iteration. Should\n * not be too complicated to implement.\n */\n this.outside = pick(options.outside, Boolean(chart.scrollablePixelsX || chart.scrollablePixelsY));\n }\n shouldStickOnContact(pointerEvent) {\n return !!(!this.followPointer &&\n this.options.stickOnContact &&\n (!pointerEvent || this.pointer.inClass(pointerEvent.target, 'highcharts-tooltip')));\n }\n /**\n * Moves the tooltip with a soft animation to a new position.\n *\n * @private\n * @function Highcharts.Tooltip#move\n *\n * @param {number} x\n *\n * @param {number} y\n *\n * @param {number} anchorX\n *\n * @param {number} anchorY\n */\n move(x, y, anchorX, anchorY) {\n const tooltip = this, now = tooltip.now, animate = tooltip.options.animation !== false &&\n !tooltip.isHidden &&\n // When we get close to the target position, abort animation and\n // land on the right place (#3056)\n (Math.abs(x - now.x) > 1 || Math.abs(y - now.y) > 1), skipAnchor = tooltip.followPointer || tooltip.len > 1;\n // Get intermediate values for animation\n extend(now, {\n x: animate ? (2 * now.x + x) / 3 : x,\n y: animate ? (now.y + y) / 2 : y,\n anchorX: skipAnchor ?\n void 0 :\n animate ? (2 * now.anchorX + anchorX) / 3 : anchorX,\n anchorY: skipAnchor ?\n void 0 :\n animate ? (now.anchorY + anchorY) / 2 : anchorY\n });\n // Move to the intermediate value\n tooltip.getLabel().attr(now);\n tooltip.drawTracker();\n // Run on next tick of the mouse tracker\n if (animate) {\n // Never allow two timeouts\n U.clearTimeout(this.tooltipTimeout);\n // Set the fixed interval ticking for the smooth tooltip\n this.tooltipTimeout = setTimeout(function () {\n // The interval function may still be running during destroy,\n // so check that the chart is really there before calling.\n if (tooltip) {\n tooltip.move(x, y, anchorX, anchorY);\n }\n }, 32);\n }\n }\n /**\n * Refresh the tooltip's text and position.\n *\n * @function Highcharts.Tooltip#refresh\n *\n * @param {Highcharts.Point|Array} pointOrPoints\n * Either a point or an array of points.\n *\n * @param {Highcharts.PointerEventObject} [mouseEvent]\n * Mouse event, that is responsible for the refresh and should be\n * used for the tooltip update.\n */\n refresh(pointOrPoints, mouseEvent) {\n const tooltip = this, { chart, options, pointer, shared } = this, points = splat(pointOrPoints), point = points[0], pointConfig = [], formatString = options.format, formatter = options.formatter || tooltip.defaultFormatter, styledMode = chart.styledMode;\n let formatterContext = {};\n if (!options.enabled || !point.series) { // #16820\n return;\n }\n U.clearTimeout(this.hideTimer);\n // A switch saying if this specific tooltip configuration allows shared\n // or split modes\n tooltip.allowShared = !(!isArray(pointOrPoints) &&\n pointOrPoints.series &&\n pointOrPoints.series.noSharedTooltip);\n // get the reference point coordinates (pie charts use tooltipPos)\n tooltip.followPointer = (!tooltip.split && point.series.tooltipOptions.followPointer);\n const anchor = tooltip.getAnchor(pointOrPoints, mouseEvent), x = anchor[0], y = anchor[1];\n // shared tooltip, array is sent over\n if (shared && tooltip.allowShared) {\n pointer.applyInactiveState(points);\n // Now set hover state for the chosen ones:\n points.forEach(function (item) {\n item.setState('hover');\n pointConfig.push(item.getLabelConfig());\n });\n formatterContext = point.getLabelConfig();\n formatterContext.points = pointConfig;\n // single point tooltip\n }\n else {\n formatterContext = point.getLabelConfig();\n }\n this.len = pointConfig.length; // #6128\n const text = isString(formatString) ?\n format(formatString, formatterContext, chart) :\n formatter.call(formatterContext, tooltip);\n // register the current series\n const currentSeries = point.series;\n this.distance = pick(currentSeries.tooltipOptions.distance, 16);\n // update the inner HTML\n if (text === false) {\n this.hide();\n }\n else {\n // update text\n if (tooltip.split && tooltip.allowShared) { // #13868\n this.renderSplit(text, points);\n }\n else {\n let checkX = x;\n let checkY = y;\n if (mouseEvent && pointer.isDirectTouch) {\n checkX = mouseEvent.chartX - chart.plotLeft;\n checkY = mouseEvent.chartY - chart.plotTop;\n }\n // #11493, #13095\n if (chart.polar ||\n currentSeries.options.clip === false ||\n points.some((p) => // #16004\n pointer.isDirectTouch || // ##17929\n p.series.shouldShowTooltip(checkX, checkY))) {\n const label = tooltip.getLabel();\n // Prevent the tooltip from flowing over the chart box\n // (#6659)\n if (!options.style.width || styledMode) {\n label.css({\n width: (this.outside ?\n this.getPlayingField() :\n chart.spacingBox).width + 'px'\n });\n }\n label.attr({\n text: text && text.join ?\n text.join('') :\n text\n });\n // Set the stroke color of the box to reflect the point\n label.addClass(tooltip.getClassName(point), true);\n if (!styledMode) {\n label.attr({\n stroke: (options.borderColor ||\n point.color ||\n currentSeries.color ||\n \"#666666\" /* Palette.neutralColor60 */)\n });\n }\n tooltip.updatePosition({\n plotX: x,\n plotY: y,\n negative: point.negative,\n ttBelow: point.ttBelow,\n h: anchor[2] || 0\n });\n }\n else {\n tooltip.hide();\n return;\n }\n }\n // show it\n if (tooltip.isHidden && tooltip.label) {\n tooltip.label.attr({\n opacity: 1\n }).show();\n }\n tooltip.isHidden = false;\n }\n fireEvent(this, 'refresh');\n }\n /**\n * Render the split tooltip. Loops over each point's text and adds\n * a label next to the point, then uses the distribute function to\n * find best non-overlapping positions.\n *\n * @private\n * @function Highcharts.Tooltip#renderSplit\n *\n * @param {string|Array<(boolean|string)>} labels\n *\n * @param {Array} points\n */\n renderSplit(labels, points) {\n const tooltip = this;\n const { chart, chart: { chartWidth, chartHeight, plotHeight, plotLeft, plotTop, scrollablePixelsY = 0, scrollablePixelsX, styledMode }, distance, options, options: { positioner }, pointer } = tooltip;\n const { scrollLeft = 0, scrollTop = 0 } = chart.scrollablePlotArea?.scrollingContainer || {};\n // The area which the tooltip should be limited to. Limit to scrollable\n // plot area if enabled, otherwise limit to the chart container. If\n // outside is true it should be the whole viewport\n const bounds = (tooltip.outside &&\n typeof scrollablePixelsX !== 'number') ?\n doc.documentElement.getBoundingClientRect() : {\n left: scrollLeft,\n right: scrollLeft + chartWidth,\n top: scrollTop,\n bottom: scrollTop + chartHeight\n };\n const tooltipLabel = tooltip.getLabel();\n const ren = this.renderer || chart.renderer;\n const headerTop = Boolean(chart.xAxis[0] && chart.xAxis[0].opposite);\n const { left: chartLeft, top: chartTop } = pointer.getChartPosition();\n let distributionBoxTop = plotTop + scrollTop;\n let headerHeight = 0;\n let adjustedPlotHeight = plotHeight - scrollablePixelsY;\n /**\n * Calculates the anchor position for the partial tooltip\n *\n * @private\n * @param {Highcharts.Point} point The point related to the tooltip\n * @return {Object} Returns an object with anchorX and anchorY\n */\n function getAnchor(point) {\n const { isHeader, plotX = 0, plotY = 0, series } = point;\n let anchorX;\n let anchorY;\n if (isHeader) {\n // Set anchorX to plotX\n anchorX = Math.max(plotLeft + plotX, plotLeft);\n // Set anchorY to center of visible plot area.\n anchorY = plotTop + plotHeight / 2;\n }\n else {\n const { xAxis, yAxis } = series;\n // Set anchorX to plotX. Limit to within xAxis.\n anchorX = xAxis.pos + clamp(plotX, -distance, xAxis.len + distance);\n // Set anchorY, limit to the scrollable plot area\n if (series.shouldShowTooltip(0, yAxis.pos - plotTop + plotY, {\n ignoreX: true\n })) {\n anchorY = yAxis.pos + plotY;\n }\n }\n // Limit values to plot area\n anchorX = clamp(anchorX, bounds.left - distance, bounds.right + distance);\n return { anchorX, anchorY };\n }\n /**\n * Calculates the position of the partial tooltip\n *\n * @private\n * @param {number} anchorX\n * The partial tooltip anchor x position\n *\n * @param {number} anchorY\n * The partial tooltip anchor y position\n *\n * @param {boolean|undefined} isHeader\n * Whether the partial tooltip is a header\n *\n * @param {number} boxWidth\n * Width of the partial tooltip\n *\n * @return {Highcharts.PositionObject}\n * Returns the partial tooltip x and y position\n */\n function defaultPositioner(anchorX, anchorY, isHeader, boxWidth, alignedLeft = true) {\n let y;\n let x;\n if (isHeader) {\n y = headerTop ? 0 : adjustedPlotHeight;\n x = clamp(anchorX - (boxWidth / 2), bounds.left, bounds.right - boxWidth - (tooltip.outside ? chartLeft : 0));\n }\n else {\n y = anchorY - distributionBoxTop;\n x = alignedLeft ?\n anchorX - boxWidth - distance :\n anchorX + distance;\n x = clamp(x, alignedLeft ? x : bounds.left, bounds.right);\n }\n // NOTE: y is relative to distributionBoxTop\n return { x, y };\n }\n /**\n * Updates the attributes and styling of the partial tooltip. Creates a\n * new partial tooltip if it does not exists.\n *\n * @private\n * @param {Highcharts.SVGElement|undefined} partialTooltip\n * The partial tooltip to update\n * @param {Highcharts.Point} point\n * The point related to the partial tooltip\n * @param {boolean|string} str The text for the partial tooltip\n * @return {Highcharts.SVGElement} Returns the updated partial tooltip\n */\n function updatePartialTooltip(partialTooltip, point, str) {\n let tt = partialTooltip;\n const { isHeader, series } = point;\n if (!tt) {\n const attribs = {\n padding: options.padding,\n r: options.borderRadius\n };\n if (!styledMode) {\n attribs.fill = options.backgroundColor;\n attribs['stroke-width'] = options.borderWidth ?? 1;\n }\n tt = ren\n .label('', 0, 0, (options[isHeader ? 'headerShape' : 'shape']), void 0, void 0, options.useHTML)\n .addClass(tooltip.getClassName(point, true, isHeader))\n .attr(attribs)\n .add(tooltipLabel);\n }\n tt.isActive = true;\n tt.attr({\n text: str\n });\n if (!styledMode) {\n tt.css(options.style)\n .attr({\n stroke: (options.borderColor ||\n point.color ||\n series.color ||\n \"#333333\" /* Palette.neutralColor80 */)\n });\n }\n return tt;\n }\n // Graceful degradation for legacy formatters\n if (isString(labels)) {\n labels = [false, labels];\n }\n // Create the individual labels for header and points, ignore footer\n let boxes = labels.slice(0, points.length + 1).reduce(function (boxes, str, i) {\n if (str !== false && str !== '') {\n const point = (points[i - 1] ||\n {\n // Item 0 is the header. Instead of this, we could also\n // use the crosshair label\n isHeader: true,\n plotX: points[0].plotX,\n plotY: plotHeight,\n series: {}\n });\n const isHeader = point.isHeader;\n // Store the tooltip label reference on the series\n const owner = isHeader ? tooltip : point.series;\n const tt = owner.tt = updatePartialTooltip(owner.tt, point, str.toString());\n // Get X position now, so we can move all to the other side in\n // case of overflow\n const bBox = tt.getBBox();\n const boxWidth = bBox.width + tt.strokeWidth();\n if (isHeader) {\n headerHeight = bBox.height;\n adjustedPlotHeight += headerHeight;\n if (headerTop) {\n distributionBoxTop -= headerHeight;\n }\n }\n const { anchorX, anchorY } = getAnchor(point);\n if (typeof anchorY === 'number') {\n const size = bBox.height + 1;\n const boxPosition = (positioner ?\n positioner.call(tooltip, boxWidth, size, point) :\n defaultPositioner(anchorX, anchorY, isHeader, boxWidth));\n boxes.push({\n // 0-align to the top, 1-align to the bottom\n align: positioner ? 0 : void 0,\n anchorX,\n anchorY,\n boxWidth,\n point,\n rank: pick(boxPosition.rank, isHeader ? 1 : 0),\n size,\n target: boxPosition.y,\n tt,\n x: boxPosition.x\n });\n }\n else {\n // Hide tooltips which anchorY is outside the visible plot\n // area\n tt.isActive = false;\n }\n }\n return boxes;\n }, []);\n // Realign the tooltips towards the right if there is not enough space\n // to the left and there is space to the right\n if (!positioner && boxes.some((box) => {\n // Always realign if the beginning of a label is outside bounds\n const { outside } = tooltip;\n const boxStart = (outside ? chartLeft : 0) + box.anchorX;\n if (boxStart < bounds.left &&\n boxStart + box.boxWidth < bounds.right) {\n return true;\n }\n // Otherwise, check if there is more space available to the right\n return boxStart < (chartLeft - bounds.left) + box.boxWidth &&\n bounds.right - boxStart > boxStart;\n })) {\n boxes = boxes.map((box) => {\n const { x, y } = defaultPositioner(box.anchorX, box.anchorY, box.point.isHeader, box.boxWidth, false);\n return extend(box, {\n target: y,\n x\n });\n });\n }\n // Clean previous run (for missing points)\n tooltip.cleanSplit();\n // Distribute and put in place\n distribute(boxes, adjustedPlotHeight);\n const boxExtremes = {\n left: chartLeft,\n right: chartLeft\n };\n // Get the extremes from series tooltips\n boxes.forEach(function (box) {\n const { x, boxWidth, isHeader } = box;\n if (!isHeader) {\n if (tooltip.outside && chartLeft + x < boxExtremes.left) {\n boxExtremes.left = chartLeft + x;\n }\n if (!isHeader &&\n tooltip.outside &&\n boxExtremes.left + boxWidth > boxExtremes.right) {\n boxExtremes.right = chartLeft + x;\n }\n }\n });\n boxes.forEach(function (box) {\n const { x, anchorX, anchorY, pos, point: { isHeader } } = box;\n const attributes = {\n visibility: typeof pos === 'undefined' ? 'hidden' : 'inherit',\n x,\n /* NOTE: y should equal pos to be consistent with !split\n * tooltip, but is currently relative to plotTop. Is left as is\n * to avoid breaking change. Remove distributionBoxTop to make\n * it consistent.\n */\n y: (pos || 0) + distributionBoxTop,\n anchorX,\n anchorY\n };\n // Handle left-aligned tooltips overflowing the chart area\n if (tooltip.outside && x < anchorX) {\n const offset = chartLeft - boxExtremes.left;\n // Skip this if there is no overflow\n if (offset > 0) {\n if (!isHeader) {\n attributes.x = x + offset;\n attributes.anchorX = anchorX + offset;\n }\n if (isHeader) {\n attributes.x = (boxExtremes.right - boxExtremes.left) / 2;\n attributes.anchorX = anchorX + offset;\n }\n }\n }\n // Put the label in place\n box.tt.attr(attributes);\n });\n /* If we have a separate tooltip container, then update the necessary\n * container properties.\n * Test that tooltip has its own container and renderer before executing\n * the operation.\n */\n const { container, outside, renderer } = tooltip;\n if (outside && container && renderer) {\n // Set container size to fit the bounds\n const { width, height, x, y } = tooltipLabel.getBBox();\n renderer.setSize(width + x, height + y, false);\n // Position the tooltip container to the chart container\n container.style.left = boxExtremes.left + 'px';\n container.style.top = chartTop + 'px';\n }\n // Workaround for #18927, artefacts left by the shadows of split\n // tooltips in Safari v16 (2023). Check again with later versions if we\n // can remove this.\n if (isSafari) {\n tooltipLabel.attr({\n // Force a redraw of the whole group by chaining the opacity\n // slightly\n opacity: tooltipLabel.opacity === 1 ? 0.999 : 1\n });\n }\n }\n /**\n * If the `stickOnContact` option is active, this will add a tracker shape.\n *\n * @private\n * @function Highcharts.Tooltip#drawTracker\n */\n drawTracker() {\n const tooltip = this;\n if (!this.shouldStickOnContact()) {\n if (tooltip.tracker) {\n tooltip.tracker = tooltip.tracker.destroy();\n }\n return;\n }\n const chart = tooltip.chart;\n const label = tooltip.label;\n const points = tooltip.shared ? chart.hoverPoints : chart.hoverPoint;\n if (!label || !points) {\n return;\n }\n const box = {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n // Combine anchor and tooltip\n const anchorPos = this.getAnchor(points);\n const labelBBox = label.getBBox();\n anchorPos[0] += chart.plotLeft - (label.translateX || 0);\n anchorPos[1] += chart.plotTop - (label.translateY || 0);\n // When the mouse pointer is between the anchor point and the label,\n // the label should stick.\n box.x = Math.min(0, anchorPos[0]);\n box.y = Math.min(0, anchorPos[1]);\n box.width = (anchorPos[0] < 0 ?\n Math.max(Math.abs(anchorPos[0]), (labelBBox.width - anchorPos[0])) :\n Math.max(Math.abs(anchorPos[0]), labelBBox.width));\n box.height = (anchorPos[1] < 0 ?\n Math.max(Math.abs(anchorPos[1]), (labelBBox.height - Math.abs(anchorPos[1]))) :\n Math.max(Math.abs(anchorPos[1]), labelBBox.height));\n if (tooltip.tracker) {\n tooltip.tracker.attr(box);\n }\n else {\n tooltip.tracker = label.renderer\n .rect(box)\n .addClass('highcharts-tracker')\n .add(label);\n if (!chart.styledMode) {\n tooltip.tracker.attr({\n fill: 'rgba(0,0,0,0)'\n });\n }\n }\n }\n /**\n * @private\n */\n styledModeFormat(formatString) {\n return formatString\n .replace('style=\"font-size: 0.8em\"', 'class=\"highcharts-header\"')\n .replace(/style=\"color:{(point|series)\\.color}\"/g, 'class=\"highcharts-color-{$1.colorIndex} ' +\n '{series.options.className} ' +\n '{point.options.className}\"');\n }\n /**\n * Format the footer/header of the tooltip\n * #3397: abstraction to enable formatting of footer and header\n *\n * @private\n * @function Highcharts.Tooltip#tooltipFooterHeaderFormatter\n */\n tooltipFooterHeaderFormatter(labelConfig, isFooter) {\n const series = labelConfig.series, tooltipOptions = series.tooltipOptions, xAxis = series.xAxis, dateTime = xAxis && xAxis.dateTime, e = {\n isFooter: isFooter,\n labelConfig: labelConfig\n };\n let xDateFormat = tooltipOptions.xDateFormat, formatString = tooltipOptions[isFooter ? 'footerFormat' : 'headerFormat'];\n fireEvent(this, 'headerFormatter', e, function (e) {\n // Guess the best date format based on the closest point distance\n // (#568, #3418)\n if (dateTime && !xDateFormat && isNumber(labelConfig.key)) {\n xDateFormat = dateTime.getXDateFormat(labelConfig.key, tooltipOptions.dateTimeLabelFormats);\n }\n // Insert the footer date format if any\n if (dateTime && xDateFormat) {\n ((labelConfig.point && labelConfig.point.tooltipDateKeys) ||\n ['key']).forEach(function (key) {\n formatString = formatString.replace('{point.' + key + '}', '{point.' + key + ':' + xDateFormat + '}');\n });\n }\n // Replace default header style with class name\n if (series.chart.styledMode) {\n formatString = this.styledModeFormat(formatString);\n }\n e.text = format(formatString, {\n point: labelConfig,\n series: series\n }, this.chart);\n });\n return e.text;\n }\n /**\n * Updates the tooltip with the provided tooltip options.\n *\n * @function Highcharts.Tooltip#update\n *\n * @param {Highcharts.TooltipOptions} options\n * The tooltip options to update.\n */\n update(options) {\n this.destroy();\n this.init(this.chart, merge(true, this.options, options));\n }\n /**\n * Find the new position and perform the move\n *\n * @private\n * @function Highcharts.Tooltip#updatePosition\n *\n * @param {Highcharts.Point} point\n */\n updatePosition(point) {\n const { chart, container, distance, options, pointer, renderer } = this, { height = 0, width = 0 } = this.getLabel(), \n // Needed for outside: true (#11688)\n { left, top, scaleX, scaleY } = pointer.getChartPosition(), pos = (options.positioner || this.getPosition).call(this, width, height, point);\n let anchorX = (point.plotX || 0) + chart.plotLeft, anchorY = (point.plotY || 0) + chart.plotTop, pad;\n // Set the renderer size dynamically to prevent document size to change.\n // Renderer only exists when tooltip is outside.\n if (renderer && container) {\n // Corrects positions, occurs with tooltip positioner (#16944)\n if (options.positioner) {\n pos.x += left - distance;\n pos.y += top - distance;\n }\n // Pad it by the border width and distance. Add 2 to make room for\n // the default shadow (#19314).\n pad = (options.borderWidth || 0) + 2 * distance + 2;\n renderer.setSize(width + pad, height + pad, false);\n // Anchor and tooltip container need scaling if chart container has\n // scale transform/css zoom. #11329.\n if (scaleX !== 1 || scaleY !== 1) {\n css(container, {\n transform: `scale(${scaleX}, ${scaleY})`\n });\n anchorX *= scaleX;\n anchorY *= scaleY;\n }\n anchorX += left - pos.x;\n anchorY += top - pos.y;\n }\n // Do the move\n this.move(Math.round(pos.x), Math.round(pos.y || 0), // Can be undefined (#3977)\n anchorX, anchorY);\n }\n}\n/* *\n *\n * Class namespace\n *\n * */\n(function (Tooltip) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(PointerClass) {\n if (pushUnique(composed, 'Core.Tooltip')) {\n addEvent(PointerClass, 'afterInit', function () {\n const chart = this.chart;\n if (chart.options.tooltip) {\n /**\n * Tooltip object for points of series.\n *\n * @name Highcharts.Chart#tooltip\n * @type {Highcharts.Tooltip}\n */\n chart.tooltip = new Tooltip(chart, chart.options.tooltip, this);\n }\n });\n }\n }\n Tooltip.compose = compose;\n})(Tooltip || (Tooltip = {}));\n/* *\n *\n * Default export\n *\n * */\nexport default Tooltip;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Callback function to format the text of the tooltip from scratch.\n *\n * In case of single or shared tooltips, a string should be returned. In case\n * of splitted tooltips, it should return an array where the first item is the\n * header, and subsequent items are mapped to the points. Return `false` to\n * disable tooltip for a specific point on series.\n *\n * @callback Highcharts.TooltipFormatterCallbackFunction\n *\n * @param {Highcharts.TooltipFormatterContextObject} this\n * Context to format\n *\n * @param {Highcharts.Tooltip} tooltip\n * The tooltip instance\n *\n * @return {false|string|Array<(string|null|undefined)>|null|undefined}\n * Formatted text or false\n */\n/**\n * Configuration for the tooltip formatters.\n *\n * @interface Highcharts.TooltipFormatterContextObject\n * @extends Highcharts.PointLabelObject\n */ /**\n* Array of points in shared tooltips.\n* @name Highcharts.TooltipFormatterContextObject#points\n* @type {Array|undefined}\n*/\n/**\n * A callback function to place the tooltip in a specific position.\n *\n * @callback Highcharts.TooltipPositionerCallbackFunction\n *\n * @param {Highcharts.Tooltip} this\n * Tooltip context of the callback.\n *\n * @param {number} labelWidth\n * Width of the tooltip.\n *\n * @param {number} labelHeight\n * Height of the tooltip.\n *\n * @param {Highcharts.TooltipPositionerPointObject} point\n * Point information for positioning a tooltip.\n *\n * @return {Highcharts.PositionObject}\n * New position for the tooltip.\n */\n/**\n * Point information for positioning a tooltip.\n *\n * @interface Highcharts.TooltipPositionerPointObject\n * @extends Highcharts.Point\n */ /**\n* If `tooltip.split` option is enabled and positioner is called for each of the\n* boxes separately, this property indicates the call on the xAxis header, which\n* is not a point itself.\n* @name Highcharts.TooltipPositionerPointObject#isHeader\n* @type {boolean}\n*/ /**\n* The reference point relative to the plot area. Add chart.plotLeft to get the\n* full coordinates.\n* @name Highcharts.TooltipPositionerPointObject#plotX\n* @type {number}\n*/ /**\n* The reference point relative to the plot area. Add chart.plotTop to get the\n* full coordinates.\n* @name Highcharts.TooltipPositionerPointObject#plotY\n* @type {number}\n*/\n/**\n * @typedef {\"callout\"|\"circle\"|\"rect\"} Highcharts.TooltipShapeValue\n */\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AST from '../Renderer/HTML/AST.js';\nimport A from '../Animation/AnimationUtilities.js';\nconst { animObject } = A;\nimport D from '../Defaults.js';\nconst { defaultOptions } = D;\nimport F from '../Templating.js';\nconst { format } = F;\nimport U from '../Utilities.js';\nconst { addEvent, erase, extend, fireEvent, getNestedProperty, isArray, isFunction, isNumber, isObject, pick, syncTimeout, removeEvent, uniqueKey } = U;\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/* *\n *\n * Class\n *\n * */\n/**\n * The Point object. The point objects are generated from the `series.data`\n * configuration objects or raw numbers. They can be accessed from the\n * `Series.points` array. Other ways to instantiate points are through {@link\n * Highcharts.Series#addPoint} or {@link Highcharts.Series#setData}.\n *\n * @class\n * @name Highcharts.Point\n */\nclass Point {\n /**\n * For categorized axes this property holds the category name for the\n * point. For other axes it holds the X value.\n *\n * @name Highcharts.Point#category\n * @type {number|string}\n */\n /**\n * The name of the point. The name can be given as the first position of the\n * point configuration array, or as a `name` property in the configuration:\n *\n * @example\n * // Array config\n * data: [\n * ['John', 1],\n * ['Jane', 2]\n * ]\n *\n * // Object config\n * data: [{\n * name: 'John',\n * y: 1\n * }, {\n * name: 'Jane',\n * y: 2\n * }]\n *\n * @name Highcharts.Point#name\n * @type {string}\n */\n /**\n * The point's options as applied in the initial configuration, or\n * extended through `Point.update`.\n *\n * In TypeScript you have to extend `PointOptionsObject` via an\n * additional interface to allow custom data options:\n *\n * ```\n * declare interface PointOptionsObject {\n * customProperty: string;\n * }\n * ```\n *\n * @name Highcharts.Point#options\n * @type {Highcharts.PointOptionsObject}\n */\n /**\n * The percentage for points in a stacked series, pies or gauges.\n *\n * @name Highcharts.Point#percentage\n * @type {number|undefined}\n */\n /**\n * The series object associated with the point.\n *\n * @name Highcharts.Point#series\n * @type {Highcharts.Series}\n */\n /**\n * The attributes of the rendered SVG shape like in `column` or `pie`\n * series.\n *\n * @readonly\n * @name Highcharts.Point#shapeArgs\n * @type {Readonly|undefined}\n */\n /**\n * The total of values in either a stack for stacked series, or a pie in a\n * pie series.\n *\n * @name Highcharts.Point#total\n * @type {number|undefined}\n */\n /**\n * For certain series types, like pie charts, where individual points can\n * be shown or hidden.\n *\n * @name Highcharts.Point#visible\n * @type {boolean}\n * @default true\n */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Animate SVG elements associated with the point.\n *\n * @private\n * @function Highcharts.Point#animateBeforeDestroy\n */\n animateBeforeDestroy() {\n const point = this, animateParams = { x: point.startXPos, opacity: 0 }, graphicalProps = point.getGraphicalProps();\n graphicalProps.singular.forEach(function (prop) {\n const isDataLabel = prop === 'dataLabel';\n point[prop] = point[prop].animate(isDataLabel ? {\n x: point[prop].startXPos,\n y: point[prop].startYPos,\n opacity: 0\n } : animateParams);\n });\n graphicalProps.plural.forEach(function (plural) {\n point[plural].forEach(function (item) {\n if (item.element) {\n item.animate(extend({ x: point.startXPos }, (item.startYPos ? {\n x: item.startXPos,\n y: item.startYPos\n } : {})));\n }\n });\n });\n }\n /**\n * Apply the options containing the x and y data and possible some extra\n * properties. Called on point init or from point.update.\n *\n * @private\n * @function Highcharts.Point#applyOptions\n *\n * @param {Highcharts.PointOptionsType} options\n * The point options as defined in series.data.\n *\n * @param {number} [x]\n * Optionally, the x value.\n *\n * @return {Highcharts.Point}\n * The Point instance.\n */\n applyOptions(options, x) {\n const point = this, series = point.series, pointValKey = series.options.pointValKey || series.pointValKey;\n options = Point.prototype.optionsToObject.call(this, options);\n // copy options directly to point\n extend(point, options);\n point.options = point.options ?\n extend(point.options, options) :\n options;\n // Since options are copied into the Point instance, some accidental\n // options must be shielded (#5681)\n if (options.group) {\n delete point.group;\n }\n if (options.dataLabels) {\n delete point.dataLabels;\n }\n /**\n * The y value of the point.\n * @name Highcharts.Point#y\n * @type {number|undefined}\n */\n // For higher dimension series types. For instance, for ranges, point.y\n // is mapped to point.low.\n if (pointValKey) {\n point.y = Point.prototype.getNestedProperty.call(point, pointValKey);\n }\n // The point is initially selected by options (#5777)\n if (point.selected) {\n point.state = 'select';\n }\n /**\n * The x value of the point.\n * @name Highcharts.Point#x\n * @type {number}\n */\n // If no x is set by now, get auto incremented value. All points must\n // have an x value, however the y value can be null to create a gap in\n // the series\n if ('name' in point &&\n typeof x === 'undefined' &&\n series.xAxis &&\n series.xAxis.hasNames) {\n point.x = series.xAxis.nameToX(point);\n }\n if (typeof point.x === 'undefined' && series) {\n if (typeof x === 'undefined') {\n point.x = series.autoIncrement();\n }\n else {\n point.x = x;\n }\n }\n else if (isNumber(options.x) && series.options.relativeXValue) {\n point.x = series.autoIncrement(options.x);\n }\n point.isNull = this.isValid && !this.isValid();\n point.formatPrefix = point.isNull ? 'null' : 'point'; // #9233, #10874\n return point;\n }\n /**\n * Destroy a point to clear memory. Its reference still stays in\n * `series.data`.\n *\n * @private\n * @function Highcharts.Point#destroy\n */\n destroy() {\n if (!this.destroyed) {\n const point = this, series = point.series, chart = series.chart, dataSorting = series.options.dataSorting, hoverPoints = chart.hoverPoints, globalAnimation = point.series.chart.renderer.globalAnimation, animation = animObject(globalAnimation);\n /**\n * Allow to call after animation.\n * @private\n */\n const destroyPoint = () => {\n // Remove all events and elements\n if (point.graphic ||\n point.graphics ||\n point.dataLabel ||\n point.dataLabels) {\n removeEvent(point);\n point.destroyElements();\n }\n for (const prop in point) { // eslint-disable-line guard-for-in\n delete point[prop];\n }\n };\n if (point.legendItem) {\n // pies have legend items\n chart.legend.destroyItem(point);\n }\n if (hoverPoints) {\n point.setState();\n erase(hoverPoints, point);\n if (!hoverPoints.length) {\n chart.hoverPoints = null;\n }\n }\n if (point === chart.hoverPoint) {\n point.onMouseOut();\n }\n // Remove properties after animation\n if (!dataSorting || !dataSorting.enabled) {\n destroyPoint();\n }\n else {\n this.animateBeforeDestroy();\n syncTimeout(destroyPoint, animation.duration);\n }\n chart.pointCount--;\n }\n this.destroyed = true;\n }\n /**\n * Destroy SVG elements associated with the point.\n *\n * @private\n * @function Highcharts.Point#destroyElements\n * @param {Highcharts.Dictionary} [kinds]\n */\n destroyElements(kinds) {\n const point = this, props = point.getGraphicalProps(kinds);\n props.singular.forEach(function (prop) {\n point[prop] = point[prop].destroy();\n });\n props.plural.forEach(function (plural) {\n point[plural].forEach(function (item) {\n if (item && item.element) {\n item.destroy();\n }\n });\n delete point[plural];\n });\n }\n /**\n * Fire an event on the Point object.\n *\n * @private\n * @function Highcharts.Point#firePointEvent\n *\n * @param {string} eventType\n * Type of the event.\n *\n * @param {Highcharts.Dictionary|Event} [eventArgs]\n * Additional event arguments.\n *\n * @param {Highcharts.EventCallbackFunction|Function} [defaultFunction]\n * Default event handler.\n *\n * @emits Highcharts.Point#event:*\n */\n firePointEvent(eventType, eventArgs, defaultFunction) {\n const point = this, series = this.series, seriesOptions = series.options;\n // Load event handlers on demand to save time on mouseover/out\n point.manageEvent(eventType);\n // Add default handler if in selection mode\n if (eventType === 'click' && seriesOptions.allowPointSelect) {\n defaultFunction = function (event) {\n // Control key is for Windows, meta (= Cmd key) for Mac, Shift\n // for Opera.\n if (!point.destroyed && point.select) { // #2911, #19075\n point.select(null, event.ctrlKey || event.metaKey || event.shiftKey);\n }\n };\n }\n fireEvent(point, eventType, eventArgs, defaultFunction);\n }\n /**\n * Get the CSS class names for individual points. Used internally where the\n * returned value is set on every point.\n *\n * @function Highcharts.Point#getClassName\n *\n * @return {string}\n * The class names.\n */\n getClassName() {\n const point = this;\n return 'highcharts-point' +\n (point.selected ? ' highcharts-point-select' : '') +\n (point.negative ? ' highcharts-negative' : '') +\n (point.isNull ? ' highcharts-null-point' : '') +\n (typeof point.colorIndex !== 'undefined' ?\n ' highcharts-color-' + point.colorIndex : '') +\n (point.options.className ? ' ' + point.options.className : '') +\n (point.zone && point.zone.className ? ' ' +\n point.zone.className.replace('highcharts-negative', '') : '');\n }\n /**\n * Get props of all existing graphical point elements.\n *\n * @private\n * @function Highcharts.Point#getGraphicalProps\n */\n getGraphicalProps(kinds) {\n const point = this, props = [], graphicalProps = { singular: [], plural: [] };\n let prop, i;\n kinds = kinds || { graphic: 1, dataLabel: 1 };\n if (kinds.graphic) {\n props.push('graphic', 'connector' // Used by dumbbell\n );\n }\n if (kinds.dataLabel) {\n props.push('dataLabel', 'dataLabelPath', 'dataLabelUpper');\n }\n i = props.length;\n while (i--) {\n prop = props[i];\n if (point[prop]) {\n graphicalProps.singular.push(prop);\n }\n }\n [\n 'graphic',\n 'dataLabel'\n ].forEach(function (prop) {\n const plural = prop + 's';\n if (kinds[prop] && point[plural]) {\n graphicalProps.plural.push(plural);\n }\n });\n return graphicalProps;\n }\n /**\n * Return the configuration hash needed for the data label and tooltip\n * formatters.\n *\n * @function Highcharts.Point#getLabelConfig\n *\n * @return {Highcharts.PointLabelObject}\n * Abstract object used in formatters and formats.\n */\n getLabelConfig() {\n return {\n x: this.category,\n y: this.y,\n color: this.color,\n colorIndex: this.colorIndex,\n key: this.name || this.category,\n series: this.series,\n point: this,\n percentage: this.percentage,\n total: this.total || this.stackTotal\n };\n }\n /**\n * Returns the value of the point property for a given value.\n * @private\n */\n getNestedProperty(key) {\n if (!key) {\n return;\n }\n if (key.indexOf('custom.') === 0) {\n return getNestedProperty(key, this.options);\n }\n return this[key];\n }\n /**\n * In a series with `zones`, return the zone that the point belongs to.\n *\n * @function Highcharts.Point#getZone\n *\n * @return {Highcharts.SeriesZonesOptionsObject}\n * The zone item.\n */\n getZone() {\n const series = this.series, zones = series.zones, zoneAxis = series.zoneAxis || 'y';\n let zone, i = 0;\n zone = zones[i];\n while (this[zoneAxis] >= zone.value) {\n zone = zones[++i];\n }\n // For resetting or reusing the point (#8100)\n if (!this.nonZonedColor) {\n this.nonZonedColor = this.color;\n }\n if (zone && zone.color && !this.options.color) {\n this.color = zone.color;\n }\n else {\n this.color = this.nonZonedColor;\n }\n return zone;\n }\n /**\n * Utility to check if point has new shape type. Used in column series and\n * all others that are based on column series.\n * @private\n */\n hasNewShapeType() {\n const point = this;\n const oldShapeType = point.graphic &&\n (point.graphic.symbolName || point.graphic.element.nodeName);\n return oldShapeType !== this.shapeType;\n }\n /**\n * Initialize the point. Called internally based on the `series.data`\n * option.\n *\n * @function Highcharts.Point#init\n *\n * @param {Highcharts.Series} series\n * The series object containing this point.\n *\n * @param {Highcharts.PointOptionsType} options\n * The data in either number, array or object format.\n *\n * @param {number} [x]\n * Optionally, the X value of the point.\n *\n * @return {Highcharts.Point}\n * The Point instance.\n *\n * @emits Highcharts.Point#event:afterInit\n */\n constructor(series, options, x) {\n this.formatPrefix = 'point';\n this.visible = true;\n this.series = series;\n this.applyOptions(options, x);\n // Add a unique ID to the point if none is assigned\n this.id ?? (this.id = uniqueKey());\n this.resolveColor();\n series.chart.pointCount++;\n fireEvent(this, 'afterInit');\n }\n /**\n * Determine if point is valid.\n * @private\n * @function Highcharts.Point#isValid\n */\n isValid() {\n return ((isNumber(this.x) ||\n this.x instanceof Date) &&\n isNumber(this.y));\n }\n /**\n * Transform number or array configs into objects. Also called for object\n * configs. Used internally to unify the different configuration formats for\n * points. For example, a simple number `10` in a line series will be\n * transformed to `{ y: 10 }`, and an array config like `[1, 10]` in a\n * scatter series will be transformed to `{ x: 1, y: 10 }`.\n *\n * @deprecated\n * @function Highcharts.Point#optionsToObject\n *\n * @param {Highcharts.PointOptionsType} options\n * Series data options.\n *\n * @return {Highcharts.Dictionary<*>}\n * Transformed point options.\n */\n optionsToObject(options) {\n const series = this.series, keys = series.options.keys, pointArrayMap = keys || series.pointArrayMap || ['y'], valueCount = pointArrayMap.length;\n let ret = {}, firstItemType, i = 0, j = 0;\n if (isNumber(options) || options === null) {\n ret[pointArrayMap[0]] = options;\n }\n else if (isArray(options)) {\n // with leading x value\n if (!keys && options.length > valueCount) {\n firstItemType = typeof options[0];\n if (firstItemType === 'string') {\n ret.name = options[0];\n }\n else if (firstItemType === 'number') {\n ret.x = options[0];\n }\n i++;\n }\n while (j < valueCount) {\n // Skip undefined positions for keys\n if (!keys || typeof options[i] !== 'undefined') {\n if (pointArrayMap[j].indexOf('.') > 0) {\n // Handle nested keys, e.g. ['color.pattern.image']\n // Avoid function call unless necessary.\n Point.prototype.setNestedProperty(ret, options[i], pointArrayMap[j]);\n }\n else {\n ret[pointArrayMap[j]] = options[i];\n }\n }\n i++;\n j++;\n }\n }\n else if (typeof options === 'object') {\n ret = options;\n // This is the fastest way to detect if there are individual point\n // dataLabels that need to be considered in drawDataLabels. These\n // can only occur in object configs.\n if (options.dataLabels) {\n // Override the prototype function to always return true,\n // regardless of whether data labels are enabled series-wide\n series.hasDataLabels = () => true;\n }\n // Same approach as above for markers\n if (options.marker) {\n series._hasPointMarkers = true;\n }\n }\n return ret;\n }\n /**\n * Get the pixel position of the point relative to the plot area.\n * @function Highcharts.Point#pos\n *\n * @sample highcharts/point/position\n * Get point's position in pixels.\n *\n * @param {boolean} chartCoordinates\n * If true, the returned position is relative to the full chart area.\n * If false, it is relative to the plot area determined by the axes.\n *\n * @param {number|undefined} plotY\n * A custom plot y position to be computed. Used internally for some\n * series types that have multiple `y` positions, like area range (low\n * and high values).\n *\n * @return {Array|undefined}\n * Coordinates of the point if the point exists.\n */\n pos(chartCoordinates, plotY = this.plotY) {\n if (!this.destroyed) {\n const { plotX, series } = this, { chart, xAxis, yAxis } = series;\n let posX = 0, posY = 0;\n if (isNumber(plotX) && isNumber(plotY)) {\n if (chartCoordinates) {\n posX = xAxis ? xAxis.pos : chart.plotLeft;\n posY = yAxis ? yAxis.pos : chart.plotTop;\n }\n return chart.inverted && xAxis && yAxis ?\n [yAxis.len - plotY + posY, xAxis.len - plotX + posX] :\n [plotX + posX, plotY + posY];\n }\n }\n }\n /**\n * @private\n * @function Highcharts.Point#resolveColor\n */\n resolveColor() {\n const series = this.series, optionsChart = series.chart.options.chart, styledMode = series.chart.styledMode;\n let color, colors, colorCount = optionsChart.colorCount, colorIndex;\n // remove points nonZonedColor for later recalculation\n delete this.nonZonedColor;\n if (series.options.colorByPoint) {\n if (!styledMode) {\n colors = series.options.colors || series.chart.options.colors;\n color = colors[series.colorCounter];\n colorCount = colors.length;\n }\n colorIndex = series.colorCounter;\n series.colorCounter++;\n // loop back to zero\n if (series.colorCounter === colorCount) {\n series.colorCounter = 0;\n }\n }\n else {\n if (!styledMode) {\n color = series.color;\n }\n colorIndex = series.colorIndex;\n }\n /**\n * The point's current color index, used in styled mode instead of\n * `color`. The color index is inserted in class names used for styling.\n *\n * @name Highcharts.Point#colorIndex\n * @type {number|undefined}\n */\n this.colorIndex = pick(this.options.colorIndex, colorIndex);\n /**\n * The point's current color.\n *\n * @name Highcharts.Point#color\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject|undefined}\n */\n this.color = pick(this.options.color, color);\n }\n /**\n * Set a value in an object, on the property defined by key. The key\n * supports nested properties using dot notation. The function modifies the\n * input object and does not make a copy.\n *\n * @function Highcharts.Point#setNestedProperty\n *\n * @param {T} object\n * The object to set the value on.\n *\n * @param {*} value\n * The value to set.\n *\n * @param {string} key\n * Key to the property to set.\n *\n * @return {T}\n * The modified object.\n */\n setNestedProperty(object, value, key) {\n const nestedKeys = key.split('.');\n nestedKeys.reduce(function (result, key, i, arr) {\n const isLastKey = arr.length - 1 === i;\n result[key] = (isLastKey ?\n value :\n isObject(result[key], true) ?\n result[key] :\n {});\n return result[key];\n }, object);\n return object;\n }\n shouldDraw() {\n return !this.isNull;\n }\n /**\n * Extendable method for formatting each point's tooltip line.\n *\n * @function Highcharts.Point#tooltipFormatter\n *\n * @param {string} pointFormat\n * The point format.\n *\n * @return {string}\n * A string to be concatenated in to the common tooltip text.\n */\n tooltipFormatter(pointFormat) {\n // Insert options for valueDecimals, valuePrefix, and valueSuffix\n const series = this.series, seriesTooltipOptions = series.tooltipOptions, valueDecimals = pick(seriesTooltipOptions.valueDecimals, ''), valuePrefix = seriesTooltipOptions.valuePrefix || '', valueSuffix = seriesTooltipOptions.valueSuffix || '';\n // Replace default point style with class name\n if (series.chart.styledMode) {\n pointFormat =\n series.chart.tooltip.styledModeFormat(pointFormat);\n }\n // Loop over the point array map and replace unformatted values with\n // sprintf formatting markup\n (series.pointArrayMap || ['y']).forEach(function (key) {\n key = '{point.' + key; // without the closing bracket\n if (valuePrefix || valueSuffix) {\n pointFormat = pointFormat.replace(RegExp(key + '}', 'g'), valuePrefix + key + '}' + valueSuffix);\n }\n pointFormat = pointFormat.replace(RegExp(key + '}', 'g'), key + ':,.' + valueDecimals + 'f}');\n });\n return format(pointFormat, {\n point: this,\n series: this.series\n }, series.chart);\n }\n /**\n * Update point with new options (typically x/y data) and optionally redraw\n * the series.\n *\n * @sample highcharts/members/point-update-column/\n * Update column value\n * @sample highcharts/members/point-update-pie/\n * Update pie slice\n * @sample maps/members/point-update/\n * Update map area value in Highmaps\n *\n * @function Highcharts.Point#update\n *\n * @param {Highcharts.PointOptionsType} options\n * The point options. Point options are handled as described under\n * the `series.type.data` item for each series type. For example\n * for a line series, if options is a single number, the point will\n * be given that number as the marin y value. If it is an array, it\n * will be interpreted as x and y values respectively. If it is an\n * object, advanced options are applied.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the point is updated. If doing\n * more operations on the chart, it is best practice to set\n * `redraw` to false and call `chart.redraw()` after.\n *\n * @param {boolean|Partial} [animation=true]\n * Whether to apply animation, and optionally animation\n * configuration.\n *\n * @emits Highcharts.Point#event:update\n */\n update(options, redraw, animation, runEvent) {\n const point = this, series = point.series, graphic = point.graphic, chart = series.chart, seriesOptions = series.options;\n let i;\n redraw = pick(redraw, true);\n /**\n * @private\n */\n function update() {\n point.applyOptions(options);\n // Update visuals, #4146\n // Handle mock graphic elements for a11y, #12718\n const hasMockGraphic = graphic && point.hasMockGraphic;\n const shouldDestroyGraphic = point.y === null ?\n !hasMockGraphic :\n hasMockGraphic;\n if (graphic && shouldDestroyGraphic) {\n point.graphic = graphic.destroy();\n delete point.hasMockGraphic;\n }\n if (isObject(options, true)) {\n // Destroy so we can get new elements\n if (graphic && graphic.element) {\n // \"null\" is also a valid symbol\n if (options &&\n options.marker &&\n typeof options.marker.symbol !== 'undefined') {\n point.graphic = graphic.destroy();\n }\n }\n if (options?.dataLabels && point.dataLabel) {\n point.dataLabel = point.dataLabel.destroy(); // #2468\n }\n }\n // record changes in the parallel arrays\n i = point.index;\n series.updateParallelArrays(point, i);\n // Record the options to options.data. If the old or the new config\n // is an object, use point options, otherwise use raw options\n // (#4701, #4916).\n seriesOptions.data[i] = (isObject(seriesOptions.data[i], true) ||\n isObject(options, true)) ?\n point.options :\n pick(options, seriesOptions.data[i]);\n // redraw\n series.isDirty = series.isDirtyData = true;\n if (!series.fixedBox && series.hasCartesianSeries) { // #1906, #2320\n chart.isDirtyBox = true;\n }\n if (seriesOptions.legendType === 'point') { // #1831, #1885\n chart.isDirtyLegend = true;\n }\n if (redraw) {\n chart.redraw(animation);\n }\n }\n // Fire the event with a default handler of doing the update\n if (runEvent === false) { // When called from setData\n update();\n }\n else {\n point.firePointEvent('update', { options: options }, update);\n }\n }\n /**\n * Remove a point and optionally redraw the series and if necessary the axes\n *\n * @sample highcharts/plotoptions/series-point-events-remove/\n * Remove point and confirm\n * @sample highcharts/members/point-remove/\n * Remove pie slice\n * @sample maps/members/point-remove/\n * Remove selected points in Highmaps\n *\n * @function Highcharts.Point#remove\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart or wait for an explicit call. When\n * doing more operations on the chart, for example running\n * `point.remove()` in a loop, it is best practice to set `redraw`\n * to false and call `chart.redraw()` after.\n *\n * @param {boolean|Partial} [animation=false]\n * Whether to apply animation, and optionally animation\n * configuration.\n */\n remove(redraw, animation) {\n this.series.removePoint(this.series.data.indexOf(this), redraw, animation);\n }\n /**\n * Toggle the selection status of a point.\n *\n * @see Highcharts.Chart#getSelectedPoints\n *\n * @sample highcharts/members/point-select/\n * Select a point from a button\n * @sample highcharts/members/point-select-lasso/\n * Lasso selection\n * @sample highcharts/chart/events-selection-points/\n * Rectangle selection\n * @sample maps/series/data-id/\n * Select a point in Highmaps\n *\n * @function Highcharts.Point#select\n *\n * @param {boolean} [selected]\n * When `true`, the point is selected. When `false`, the point is\n * unselected. When `null` or `undefined`, the selection state is toggled.\n *\n * @param {boolean} [accumulate=false]\n * When `true`, the selection is added to other selected points.\n * When `false`, other selected points are deselected. Internally in\n * Highcharts, when\n * [allowPointSelect](https://api.highcharts.com/highcharts/plotOptions.series.allowPointSelect)\n * is `true`, selected points are accumulated on Control, Shift or Cmd\n * clicking the point.\n *\n * @emits Highcharts.Point#event:select\n * @emits Highcharts.Point#event:unselect\n */\n select(selected, accumulate) {\n const point = this, series = point.series, chart = series.chart;\n selected = pick(selected, !point.selected);\n this.selectedStaging = selected;\n // fire the event with the default handler\n point.firePointEvent(selected ? 'select' : 'unselect', { accumulate: accumulate }, function () {\n /**\n * Whether the point is selected or not.\n *\n * @see Point#select\n * @see Chart#getSelectedPoints\n *\n * @name Highcharts.Point#selected\n * @type {boolean}\n */\n point.selected = point.options.selected = selected;\n series.options.data[series.data.indexOf(point)] =\n point.options;\n point.setState(selected && 'select');\n // unselect all other points unless Ctrl or Cmd + click\n if (!accumulate) {\n chart.getSelectedPoints().forEach(function (loopPoint) {\n const loopSeries = loopPoint.series;\n if (loopPoint.selected && loopPoint !== point) {\n loopPoint.selected = loopPoint.options.selected =\n false;\n loopSeries.options.data[loopSeries.data.indexOf(loopPoint)] = loopPoint.options;\n // Programmatically selecting a point should restore\n // normal state, but when click happened on other\n // point, set inactive state to match other points\n loopPoint.setState(chart.hoverPoints &&\n loopSeries.options.inactiveOtherPoints ?\n 'inactive' : '');\n loopPoint.firePointEvent('unselect');\n }\n });\n }\n });\n delete this.selectedStaging;\n }\n /**\n * Runs on mouse over the point. Called internally from mouse and touch\n * events.\n *\n * @function Highcharts.Point#onMouseOver\n *\n * @param {Highcharts.PointerEventObject} [e]\n * The event arguments.\n */\n onMouseOver(e) {\n const point = this, series = point.series, { inverted, pointer } = series.chart;\n if (pointer) {\n e = e ?\n pointer.normalize(e) :\n // In cases where onMouseOver is called directly without an\n // event\n pointer.getChartCoordinatesFromPoint(point, inverted);\n pointer.runPointActions(e, point);\n }\n }\n /**\n * Runs on mouse out from the point. Called internally from mouse and touch\n * events.\n *\n * @function Highcharts.Point#onMouseOut\n * @emits Highcharts.Point#event:mouseOut\n */\n onMouseOut() {\n const point = this, chart = point.series.chart;\n point.firePointEvent('mouseOut');\n if (!point.series.options.inactiveOtherPoints) {\n (chart.hoverPoints || []).forEach(function (p) {\n p.setState();\n });\n }\n chart.hoverPoints = chart.hoverPoint = null;\n }\n /**\n * Manage specific event from the series' and point's options. Only do it on\n * demand, to save processing time on hovering.\n *\n * @private\n * @function Highcharts.Point#importEvents\n */\n manageEvent(eventType) {\n const point = this, options = point.series.options.point || {}, userEvent = options.events?.[eventType];\n if (isFunction(userEvent) &&\n (!point.hcEvents?.[eventType] ||\n // Some HC modules, like marker-clusters, draggable-poins etc.\n // use events in their logic, so we need to be sure, that\n // callback function is different\n point.hcEvents?.[eventType]?.map((el) => el.fn)\n .indexOf(userEvent) === -1)) {\n addEvent(point, eventType, userEvent);\n point.hasImportedEvents = true;\n }\n else if (point.hasImportedEvents &&\n !userEvent &&\n point.hcEvents?.[eventType]) {\n removeEvent(point, eventType);\n delete point.hcEvents[eventType];\n if (!Object.keys(point.hcEvents)) {\n point.hasImportedEvents = false;\n }\n }\n }\n /**\n * Set the point's state.\n *\n * @function Highcharts.Point#setState\n *\n * @param {Highcharts.PointStateValue|\"\"} [state]\n * The new state, can be one of `'hover'`, `'select'`, `'inactive'`,\n * or `''` (an empty string), `'normal'` or `undefined` to set to\n * normal state.\n * @param {boolean} [move]\n * State for animation.\n *\n * @emits Highcharts.Point#event:afterSetState\n */\n setState(state, move) {\n const point = this, series = point.series, previousState = point.state, stateOptions = (series.options.states[state || 'normal'] ||\n {}), markerOptions = (defaultOptions.plotOptions[series.type].marker &&\n series.options.marker), normalDisabled = (markerOptions && markerOptions.enabled === false), markerStateOptions = ((markerOptions &&\n markerOptions.states &&\n markerOptions.states[state || 'normal']) || {}), stateDisabled = markerStateOptions.enabled === false, pointMarker = point.marker || {}, chart = series.chart, hasMarkers = (markerOptions && series.markerAttribs);\n let halo = series.halo, markerAttribs, pointAttribs, pointAttribsAnimation, stateMarkerGraphic = series.stateMarkerGraphic, newSymbol;\n state = state || ''; // empty string\n if (\n // already has this state\n (state === point.state && !move) ||\n // selected points don't respond to hover\n (point.selected && state !== 'select') ||\n // series' state options is disabled\n (stateOptions.enabled === false) ||\n // general point marker's state options is disabled\n (state && (stateDisabled ||\n (normalDisabled &&\n markerStateOptions.enabled === false))) ||\n // individual point marker's state options is disabled\n (state &&\n pointMarker.states &&\n pointMarker.states[state] &&\n pointMarker.states[state].enabled === false) // #1610\n ) {\n return;\n }\n point.state = state;\n if (hasMarkers) {\n markerAttribs = series.markerAttribs(point, state);\n }\n // Apply hover styles to the existing point\n // Prevent from mocked null points (#14966)\n if (point.graphic && !point.hasMockGraphic) {\n if (previousState) {\n point.graphic.removeClass('highcharts-point-' + previousState);\n }\n if (state) {\n point.graphic.addClass('highcharts-point-' + state);\n }\n if (!chart.styledMode) {\n pointAttribs = series.pointAttribs(point, state);\n pointAttribsAnimation = pick(chart.options.chart.animation, stateOptions.animation);\n const opacity = pointAttribs.opacity;\n // Some inactive points (e.g. slices in pie) should apply\n // opacity also for their labels\n if (series.options.inactiveOtherPoints && isNumber(opacity)) {\n (point.dataLabels || []).forEach(function (label) {\n if (label &&\n !label.hasClass('highcharts-data-label-hidden')) {\n label.animate({ opacity }, pointAttribsAnimation);\n if (label.connector) {\n label.connector.animate({ opacity }, pointAttribsAnimation);\n }\n }\n });\n }\n point.graphic.animate(pointAttribs, pointAttribsAnimation);\n }\n if (markerAttribs) {\n point.graphic.animate(markerAttribs, pick(\n // Turn off globally:\n chart.options.chart.animation, markerStateOptions.animation, markerOptions.animation));\n }\n // Zooming in from a range with no markers to a range with markers\n if (stateMarkerGraphic) {\n stateMarkerGraphic.hide();\n }\n }\n else {\n // if a graphic is not applied to each point in the normal state,\n // create a shared graphic for the hover state\n if (state && markerStateOptions) {\n newSymbol = pointMarker.symbol || series.symbol;\n // If the point has another symbol than the previous one, throw\n // away the state marker graphic and force a new one (#1459)\n if (stateMarkerGraphic &&\n stateMarkerGraphic.currentSymbol !== newSymbol) {\n stateMarkerGraphic = stateMarkerGraphic.destroy();\n }\n // Add a new state marker graphic\n if (markerAttribs) {\n if (!stateMarkerGraphic) {\n if (newSymbol) {\n series.stateMarkerGraphic = stateMarkerGraphic =\n chart.renderer\n .symbol(newSymbol, markerAttribs.x, markerAttribs.y, markerAttribs.width, markerAttribs.height)\n .add(series.markerGroup);\n stateMarkerGraphic.currentSymbol = newSymbol;\n }\n // Move the existing graphic\n }\n else {\n stateMarkerGraphic[move ? 'animate' : 'attr']({\n x: markerAttribs.x,\n y: markerAttribs.y\n });\n }\n }\n if (!chart.styledMode && stateMarkerGraphic &&\n point.state !== 'inactive') {\n stateMarkerGraphic.attr(series.pointAttribs(point, state));\n }\n }\n if (stateMarkerGraphic) {\n stateMarkerGraphic[state && point.isInside ? 'show' : 'hide'](); // #2450\n stateMarkerGraphic.element.point = point; // #4310\n stateMarkerGraphic.addClass(point.getClassName(), true);\n }\n }\n // Show me your halo\n const haloOptions = stateOptions.halo;\n const markerGraphic = (point.graphic || stateMarkerGraphic);\n const markerVisibility = (markerGraphic && markerGraphic.visibility || 'inherit');\n if (haloOptions &&\n haloOptions.size &&\n markerGraphic &&\n markerVisibility !== 'hidden' &&\n !point.isCluster) {\n if (!halo) {\n series.halo = halo = chart.renderer.path()\n // #5818, #5903, #6705\n .add(markerGraphic.parentGroup);\n }\n halo.show()[move ? 'animate' : 'attr']({\n d: point.haloPath(haloOptions.size)\n });\n halo.attr({\n 'class': 'highcharts-halo highcharts-color-' +\n pick(point.colorIndex, series.colorIndex) +\n (point.className ? ' ' + point.className : ''),\n 'visibility': markerVisibility,\n 'zIndex': -1 // #4929, #8276\n });\n halo.point = point; // #6055\n if (!chart.styledMode) {\n halo.attr(extend({\n 'fill': point.color || series.color,\n 'fill-opacity': haloOptions.opacity\n }, AST.filterUserAttributes(haloOptions.attributes || {})));\n }\n }\n else if (halo && halo.point && halo.point.haloPath) {\n // Animate back to 0 on the current halo point (#6055)\n halo.animate({ d: halo.point.haloPath(0) }, null, \n // Hide after unhovering. The `complete` callback runs in the\n // halo's context (#7681).\n halo.hide);\n }\n fireEvent(point, 'afterSetState', { state });\n }\n /**\n * Get the path definition for the halo, which is usually a shadow-like\n * circle around the currently hovered point.\n *\n * @function Highcharts.Point#haloPath\n *\n * @param {number} size\n * The radius of the circular halo.\n *\n * @return {Highcharts.SVGPathArray}\n * The path definition.\n */\n haloPath(size) {\n const pos = this.pos();\n return pos ? this.series.chart.renderer.symbols.circle(Math.floor(pos[0]) - size, pos[1] - size, size * 2, size * 2) : [];\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default Point;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Function callback when a series point is clicked. Return false to cancel the\n * action.\n *\n * @callback Highcharts.PointClickCallbackFunction\n *\n * @param {Highcharts.Point} this\n * The point where the event occurred.\n *\n * @param {Highcharts.PointClickEventObject} event\n * Event arguments.\n */\n/**\n * Common information for a click event on a series point.\n *\n * @interface Highcharts.PointClickEventObject\n * @extends Highcharts.PointerEventObject\n */ /**\n* Clicked point.\n* @name Highcharts.PointClickEventObject#point\n* @type {Highcharts.Point}\n*/\n/**\n * Configuration for the data label and tooltip formatters.\n *\n * @interface Highcharts.PointLabelObject\n */ /**\n* The point's current color.\n* @name Highcharts.PointLabelObject#color\n* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject|undefined}\n*/ /**\n* The point's current color index, used in styled mode instead of `color`. The\n* color index is inserted in class names used for styling.\n* @name Highcharts.PointLabelObject#colorIndex\n* @type {number}\n*/ /**\n* The name of the related point.\n* @name Highcharts.PointLabelObject#key\n* @type {string|undefined}\n*/ /**\n* The percentage for related points in a stacked series or pies.\n* @name Highcharts.PointLabelObject#percentage\n* @type {number}\n*/ /**\n* The related point. The point name, if defined, is available through\n* `this.point.name`.\n* @name Highcharts.PointLabelObject#point\n* @type {Highcharts.Point}\n*/ /**\n* The related series. The series name is available through `this.series.name`.\n* @name Highcharts.PointLabelObject#series\n* @type {Highcharts.Series}\n*/ /**\n* The total of values in either a stack for stacked series, or a pie in a pie\n* series.\n* @name Highcharts.PointLabelObject#total\n* @type {number|undefined}\n*/ /**\n* For categorized axes this property holds the category name for the point. For\n* other axes it holds the X value.\n* @name Highcharts.PointLabelObject#x\n* @type {number|string|undefined}\n*/ /**\n* The y value of the point.\n* @name Highcharts.PointLabelObject#y\n* @type {number|null|undefined}\n*/\n/**\n * Gets fired when the mouse leaves the area close to the point.\n *\n * @callback Highcharts.PointMouseOutCallbackFunction\n *\n * @param {Highcharts.Point} this\n * Point where the event occurred.\n *\n * @param {global.PointerEvent} event\n * Event that occurred.\n */\n/**\n * Gets fired when the mouse enters the area close to the point.\n *\n * @callback Highcharts.PointMouseOverCallbackFunction\n *\n * @param {Highcharts.Point} this\n * Point where the event occurred.\n *\n * @param {global.Event} event\n * Event that occurred.\n */\n/**\n * The generic point options for all series.\n *\n * In TypeScript you have to extend `PointOptionsObject` with an additional\n * declaration to allow custom data options:\n *\n * ```\n * declare interface PointOptionsObject {\n * customProperty: string;\n * }\n * ```\n *\n * @interface Highcharts.PointOptionsObject\n */\n/**\n * Possible option types for a data point. Use `null` to indicate a gap.\n *\n * @typedef {number|string|Highcharts.PointOptionsObject|Array<(number|string|null)>|null} Highcharts.PointOptionsType\n */\n/**\n * Gets fired when the point is removed using the `.remove()` method.\n *\n * @callback Highcharts.PointRemoveCallbackFunction\n *\n * @param {Highcharts.Point} this\n * Point where the event occurred.\n *\n * @param {global.Event} event\n * Event that occurred.\n */\n/**\n * Possible key values for the point state options.\n *\n * @typedef {\"hover\"|\"inactive\"|\"normal\"|\"select\"} Highcharts.PointStateValue\n */\n/**\n * Gets fired when the point is updated programmatically through the `.update()`\n * method.\n *\n * @callback Highcharts.PointUpdateCallbackFunction\n *\n * @param {Highcharts.Point} this\n * Point where the event occurred.\n *\n * @param {Highcharts.PointUpdateEventObject} event\n * Event that occurred.\n */\n/**\n * Information about the update event.\n *\n * @interface Highcharts.PointUpdateEventObject\n * @extends global.Event\n */ /**\n* Options data of the update event.\n* @name Highcharts.PointUpdateEventObject#options\n* @type {Highcharts.PointOptionsType}\n*/\n/**\n * @interface Highcharts.PointEventsOptionsObject\n */ /**\n* Fires when the point is selected either programmatically or following a click\n* on the point. One parameter, `event`, is passed to the function. Returning\n* `false` cancels the operation.\n* @name Highcharts.PointEventsOptionsObject#select\n* @type {Highcharts.PointSelectCallbackFunction|undefined}\n*/ /**\n* Fires when the point is unselected either programmatically or following a\n* click on the point. One parameter, `event`, is passed to the function.\n* Returning `false` cancels the operation.\n* @name Highcharts.PointEventsOptionsObject#unselect\n* @type {Highcharts.PointUnselectCallbackFunction|undefined}\n*/\n/**\n * Information about the select/unselect event.\n *\n * @interface Highcharts.PointInteractionEventObject\n * @extends global.Event\n */ /**\n* @name Highcharts.PointInteractionEventObject#accumulate\n* @type {boolean}\n*/\n/**\n * Gets fired when the point is selected either programmatically or following a\n * click on the point.\n *\n * @callback Highcharts.PointSelectCallbackFunction\n *\n * @param {Highcharts.Point} this\n * Point where the event occurred.\n *\n * @param {Highcharts.PointInteractionEventObject} event\n * Event that occurred.\n */\n/**\n * Fires when the point is unselected either programmatically or following a\n * click on the point.\n *\n * @callback Highcharts.PointUnselectCallbackFunction\n *\n * @param {Highcharts.Point} this\n * Point where the event occurred.\n *\n * @param {Highcharts.PointInteractionEventObject} event\n * Event that occurred.\n */\n''; // keeps doclets above in JS file.\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Color from './Color/Color.js';\nconst { parse: color } = Color;\nimport H from './Globals.js';\nconst { charts, composed } = H;\nimport U from './Utilities.js';\nconst { addEvent, attr, css, extend, find, fireEvent, isNumber, isObject, objectEach, offset, pick, pushUnique, splat } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The mouse and touch tracker object. Each {@link Chart} item has one\n * associated Pointer item that can be accessed from the {@link Chart.pointer}\n * property.\n *\n * @class\n * @name Highcharts.Pointer\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @param {Highcharts.Options} options\n * The root options object. The pointer uses options from the chart and tooltip\n * structures.\n */\nclass Pointer {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Set inactive state to all series that are not currently hovered,\n * or, if `inactiveOtherPoints` is set to true, set inactive state to\n * all points within that series.\n *\n * @private\n * @function Highcharts.Pointer#applyInactiveState\n *\n * @param {Array} points\n * Currently hovered points\n */\n applyInactiveState(points) {\n let activeSeries = [], series;\n // Get all active series from the hovered points\n (points || []).forEach(function (item) {\n series = item.series;\n // Include itself\n activeSeries.push(series);\n // Include parent series\n if (series.linkedParent) {\n activeSeries.push(series.linkedParent);\n }\n // Include all child series\n if (series.linkedSeries) {\n activeSeries = activeSeries.concat(series.linkedSeries);\n }\n // Include navigator series\n if (series.navigatorSeries) {\n activeSeries.push(series.navigatorSeries);\n }\n });\n // Now loop over all series, filtering out active series\n this.chart.series.forEach(function (inactiveSeries) {\n if (activeSeries.indexOf(inactiveSeries) === -1) {\n // Inactive series\n inactiveSeries.setState('inactive', true);\n }\n else if (inactiveSeries.options.inactiveOtherPoints) {\n // Active series, but other points should be inactivated\n inactiveSeries.setAllPointsToState('inactive');\n }\n });\n }\n /**\n * Destroys the Pointer object and disconnects DOM events.\n *\n * @function Highcharts.Pointer#destroy\n */\n destroy() {\n const pointer = this;\n this.eventsToUnbind.forEach((unbind) => unbind());\n this.eventsToUnbind = [];\n if (!H.chartCount) {\n if (Pointer.unbindDocumentMouseUp) {\n Pointer.unbindDocumentMouseUp = Pointer.unbindDocumentMouseUp();\n }\n if (Pointer.unbindDocumentTouchEnd) {\n Pointer.unbindDocumentTouchEnd = (Pointer.unbindDocumentTouchEnd());\n }\n }\n // memory and CPU leak\n clearInterval(pointer.tooltipTimeout);\n objectEach(pointer, function (_val, prop) {\n pointer[prop] = void 0;\n });\n }\n /**\n * Calculate attrs for selection marker.\n * @private\n * @function Highcharts.Pointer#getSelectionMarkerAttrs\n * @emits getSelectionMarkerAttrs\n */\n getSelectionMarkerAttrs(chartX, chartY) {\n const e = {\n args: { chartX, chartY },\n attrs: {},\n shapeType: 'rect'\n };\n fireEvent(this, 'getSelectionMarkerAttrs', e, (e) => {\n const { chart, zoomHor, zoomVert } = this, { mouseDownX = 0, mouseDownY = 0 } = chart, attrs = e.attrs;\n let size;\n attrs.x = chart.plotLeft;\n attrs.y = chart.plotTop;\n attrs.width = zoomHor ? 1 : chart.plotWidth;\n attrs.height = zoomVert ? 1 : chart.plotHeight;\n // Adjust the width of the selection marker. Firefox needs at\n // least one pixel width or height in order to return a bounding\n // box.\n if (zoomHor) {\n size = chartX - mouseDownX;\n attrs.width = Math.max(1, Math.abs(size));\n attrs.x = (size > 0 ? 0 : size) + mouseDownX;\n }\n // Adjust the height of the selection marker\n if (zoomVert) {\n size = chartY - mouseDownY;\n attrs.height = Math.max(1, Math.abs(size));\n attrs.y = (size > 0 ? 0 : size) + mouseDownY;\n }\n });\n return e;\n }\n /**\n * Perform a drag operation in response to a mousemove event while the mouse\n * is down.\n * @private\n * @function Highcharts.Pointer#drag\n */\n drag(e) {\n const { chart } = this, { mouseDownX = 0, mouseDownY = 0 } = chart, { panning, panKey, selectionMarkerFill } = chart.options.chart, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, panningEnabled = isObject(panning) ?\n panning.enabled :\n panning, panKeyPressed = panKey && e[`${panKey}Key`];\n let chartX = e.chartX, chartY = e.chartY, clickedInside, selectionMarker = this.selectionMarker;\n // If the device supports both touch and mouse (like IE11), and we are\n // touch-dragging inside the plot area, don't handle the mouse event.\n // #4339.\n if (selectionMarker && selectionMarker.touch) {\n return;\n }\n // If the mouse is outside the plot area, adjust to coordinates\n // inside to prevent the selection marker from going outside\n if (chartX < plotLeft) {\n chartX = plotLeft;\n }\n else if (chartX > plotLeft + plotWidth) {\n chartX = plotLeft + plotWidth;\n }\n if (chartY < plotTop) {\n chartY = plotTop;\n }\n else if (chartY > plotTop + plotHeight) {\n chartY = plotTop + plotHeight;\n }\n // Determine if the mouse has moved more than 10px\n this.hasDragged = Math.sqrt(Math.pow(mouseDownX - chartX, 2) +\n Math.pow(mouseDownY - chartY, 2));\n if (this.hasDragged > 10) {\n clickedInside = chart.isInsidePlot(mouseDownX - plotLeft, mouseDownY - plotTop, {\n visiblePlotOnly: true\n });\n const { shapeType, attrs } = this.getSelectionMarkerAttrs(chartX, chartY);\n // Make a selection\n if ((chart.hasCartesianSeries || chart.mapView) &&\n this.hasZoom &&\n clickedInside &&\n !panKeyPressed) {\n if (!selectionMarker) {\n this.selectionMarker = selectionMarker =\n chart.renderer[shapeType]();\n selectionMarker\n .attr({\n 'class': 'highcharts-selection-marker',\n zIndex: 7\n })\n .add();\n if (!chart.styledMode) {\n selectionMarker.attr({\n fill: selectionMarkerFill ||\n color(\"#334eff\" /* Palette.highlightColor80 */)\n .setOpacity(0.25).get()\n });\n }\n }\n }\n if (selectionMarker) {\n selectionMarker.attr(attrs);\n }\n // Panning\n if (clickedInside && !selectionMarker && panningEnabled) {\n chart.pan(e, panning);\n }\n }\n }\n /**\n * Start a drag operation.\n * @private\n * @function Highcharts.Pointer#dragStart\n */\n dragStart(e) {\n const chart = this.chart;\n // Record the start position\n chart.mouseIsDown = e.type;\n chart.cancelClick = false;\n chart.mouseDownX = e.chartX;\n chart.mouseDownY = e.chartY;\n }\n /**\n * Get selection box to calculate extremes\n * @private\n * @function Highcharts.Pointer#getSelectionBox\n * @emits getSelectionBox\n */\n getSelectionBox(marker) {\n const e = {\n args: { marker },\n result: marker.getBBox()\n };\n fireEvent(this, 'getSelectionBox', e);\n return e.result;\n }\n /**\n * On mouse up or touch end across the entire document, drop the selection.\n * @private\n * @function Highcharts.Pointer#drop\n */\n drop(e) {\n const { chart, selectionMarker } = this;\n // During a mouse, touch or mousewheel pan, the `startOnTick` and\n // `endOnTick` options are ignored. Otherwise the zooming or panning\n // would be jumpy, or even not performed because the end ticks would\n // block it. After the touch has ended, we undo this and render again.\n let redraw;\n for (const axis of chart.axes) {\n if (axis.isPanning) {\n axis.isPanning = false;\n if (axis.options.startOnTick ||\n axis.options.endOnTick ||\n axis.series.some((s) => s.boosted)) {\n axis.forceRedraw = true;\n axis.setExtremes(axis.userMin, axis.userMax, false);\n redraw = true;\n }\n }\n }\n if (redraw) {\n chart.redraw();\n }\n if (selectionMarker && e) {\n // A selection has been made\n if (this.hasDragged) {\n const from = this.getSelectionBox(selectionMarker);\n chart.transform({\n axes: chart.axes.filter((a) => a.zoomEnabled &&\n ((a.coll === 'xAxis' && this.zoomX) ||\n (a.coll === 'yAxis' && this.zoomY))),\n selection: {\n originalEvent: e,\n xAxis: [],\n yAxis: [],\n ...from\n },\n from\n });\n }\n if (isNumber(chart.index)) {\n this.selectionMarker = selectionMarker.destroy();\n }\n }\n // Reset all. Check isNumber because it may be destroyed on mouse up\n // (#877)\n if (chart && isNumber(chart.index)) {\n css(chart.container, { cursor: chart._cursor });\n chart.cancelClick = this.hasDragged > 10; // #370\n chart.mouseIsDown = false;\n this.hasDragged = 0;\n this.pinchDown = [];\n }\n }\n /**\n * Finds the closest point to a set of coordinates, using the k-d-tree\n * algorithm.\n *\n * @function Highcharts.Pointer#findNearestKDPoint\n *\n * @param {Array} series\n * All the series to search in.\n *\n * @param {boolean|undefined} shared\n * Whether it is a shared tooltip or not.\n *\n * @param {Highcharts.PointerEventObject} e\n * The pointer event object, containing chart coordinates of the pointer.\n *\n * @return {Highcharts.Point|undefined}\n * The point closest to given coordinates.\n */\n findNearestKDPoint(series, shared, e) {\n let closest;\n /** @private */\n function sort(p1, p2) {\n const isCloserX = p1.distX - p2.distX, isCloser = p1.dist - p2.dist, isAbove = (p2.series.group?.zIndex -\n p1.series.group?.zIndex);\n let result;\n // We have two points which are not in the same place on xAxis\n // and shared tooltip:\n if (isCloserX !== 0 && shared) { // #5721\n result = isCloserX;\n // Points are not exactly in the same place on x/yAxis:\n }\n else if (isCloser !== 0) {\n result = isCloser;\n // The same xAxis and yAxis position, sort by z-index:\n }\n else if (isAbove !== 0) {\n result = isAbove;\n // The same zIndex, sort by array index:\n }\n else {\n result =\n p1.series.index > p2.series.index ?\n -1 :\n 1;\n }\n return result;\n }\n series.forEach(function (s) {\n const noSharedTooltip = s.noSharedTooltip && shared, compareX = (!noSharedTooltip &&\n s.options.findNearestPointBy.indexOf('y') < 0), point = s.searchPoint(e, compareX);\n if ( // Check that we actually found a point on the series.\n isObject(point, true) && point.series &&\n // Use the new point if it is closer.\n (!isObject(closest, true) ||\n (sort(closest, point) > 0))) {\n closest = point;\n }\n });\n return closest;\n }\n /**\n * @private\n * @function Highcharts.Pointer#getChartCoordinatesFromPoint\n */\n getChartCoordinatesFromPoint(point, inverted) {\n const { xAxis, yAxis } = point.series, shapeArgs = point.shapeArgs;\n if (xAxis && yAxis) {\n let x = point.clientX ?? point.plotX ?? 0, y = point.plotY || 0;\n if (point.isNode &&\n shapeArgs &&\n isNumber(shapeArgs.x) &&\n isNumber(shapeArgs.y)) {\n x = shapeArgs.x;\n y = shapeArgs.y;\n }\n return inverted ? {\n chartX: yAxis.len + yAxis.pos - y,\n chartY: xAxis.len + xAxis.pos - x\n } : {\n chartX: x + xAxis.pos,\n chartY: y + yAxis.pos\n };\n }\n if (shapeArgs && shapeArgs.x && shapeArgs.y) {\n // E.g. pies do not have axes\n return {\n chartX: shapeArgs.x,\n chartY: shapeArgs.y\n };\n }\n }\n /**\n * Return the cached chartPosition if it is available on the Pointer,\n * otherwise find it. Running offset is quite expensive, so it should be\n * avoided when we know the chart hasn't moved.\n *\n * @function Highcharts.Pointer#getChartPosition\n *\n * @return {Highcharts.ChartPositionObject}\n * The offset of the chart container within the page\n */\n getChartPosition() {\n if (this.chartPosition) {\n return this.chartPosition;\n }\n const { container } = this.chart;\n const pos = offset(container);\n this.chartPosition = {\n left: pos.left,\n top: pos.top,\n scaleX: 1,\n scaleY: 1\n };\n const { offsetHeight, offsetWidth } = container;\n // #13342 - tooltip was not visible in Chrome, when chart\n // updates height.\n if (offsetWidth > 2 && // #13342\n offsetHeight > 2 // #13342\n ) {\n this.chartPosition.scaleX = pos.width / offsetWidth;\n this.chartPosition.scaleY = pos.height / offsetHeight;\n }\n return this.chartPosition;\n }\n /**\n * Get the click position in terms of axis values.\n *\n * @function Highcharts.Pointer#getCoordinates\n *\n * @param {Highcharts.PointerEventObject} e\n * Pointer event, extended with `chartX` and `chartY` properties.\n *\n * @return {Highcharts.PointerAxisCoordinatesObject}\n * Axis coordinates.\n */\n getCoordinates(e) {\n const coordinates = {\n xAxis: [],\n yAxis: []\n };\n for (const axis of this.chart.axes) {\n coordinates[axis.isXAxis ? 'xAxis' : 'yAxis'].push({\n axis,\n value: axis.toValue(e[axis.horiz ? 'chartX' : 'chartY'])\n });\n }\n return coordinates;\n }\n /**\n * Calculates what is the current hovered point/points and series.\n *\n * @private\n * @function Highcharts.Pointer#getHoverData\n *\n * @param {Highcharts.Point|undefined} existingHoverPoint\n * The point currently being hovered.\n *\n * @param {Highcharts.Series|undefined} existingHoverSeries\n * The series currently being hovered.\n *\n * @param {Array} series\n * All the series in the chart.\n *\n * @param {boolean} isDirectTouch\n * Is the pointer directly hovering the point.\n *\n * @param {boolean|undefined} shared\n * Whether it is a shared tooltip or not.\n *\n * @param {Highcharts.PointerEventObject} [e]\n * The triggering event, containing chart coordinates of the pointer.\n *\n * @return {Object}\n * Object containing resulting hover data: hoverPoint, hoverSeries, and\n * hoverPoints.\n */\n getHoverData(existingHoverPoint, existingHoverSeries, series, isDirectTouch, shared, e) {\n const hoverPoints = [], useExisting = !!(isDirectTouch && existingHoverPoint), filter = function (s) {\n return (s.visible &&\n !(!shared && s.directTouch) && // #3821\n pick(s.options.enableMouseTracking, true));\n };\n let hoverSeries = existingHoverSeries, \n // Which series to look in for the hover point\n searchSeries, \n // Parameters needed for beforeGetHoverData event.\n eventArgs = {\n chartX: e ? e.chartX : void 0,\n chartY: e ? e.chartY : void 0,\n shared: shared\n };\n // Find chart.hoverPane and update filter method in polar.\n fireEvent(this, 'beforeGetHoverData', eventArgs);\n const notSticky = hoverSeries && !hoverSeries.stickyTracking;\n searchSeries = notSticky ?\n // Only search on hovered series if it has stickyTracking false\n [hoverSeries] :\n // Filter what series to look in.\n series.filter((s) => s.stickyTracking &&\n (eventArgs.filter || filter)(s));\n // Use existing hovered point or find the one closest to coordinates.\n const hoverPoint = useExisting || !e ?\n existingHoverPoint :\n this.findNearestKDPoint(searchSeries, shared, e);\n // Assign hover series\n hoverSeries = hoverPoint && hoverPoint.series;\n // If we have a hoverPoint, assign hoverPoints.\n if (hoverPoint) {\n // When tooltip is shared, it displays more than one point\n if (shared && !hoverSeries.noSharedTooltip) {\n searchSeries = series.filter(function (s) {\n return eventArgs.filter ?\n eventArgs.filter(s) : filter(s) && !s.noSharedTooltip;\n });\n // Get all points with the same x value as the hoverPoint\n searchSeries.forEach(function (s) {\n let point = find(s.points, function (p) {\n return p.x === hoverPoint.x && !p.isNull;\n });\n if (isObject(point)) {\n /*\n * Boost returns a minimal point. Convert it to a usable\n * point for tooltip and states.\n */\n if (s.boosted && s.boost) {\n point = s.boost.getPoint(point);\n }\n hoverPoints.push(point);\n }\n });\n }\n else {\n hoverPoints.push(hoverPoint);\n }\n }\n // Check whether the hoverPoint is inside pane we are hovering over.\n eventArgs = { hoverPoint: hoverPoint };\n fireEvent(this, 'afterGetHoverData', eventArgs);\n return {\n hoverPoint: eventArgs.hoverPoint,\n hoverSeries: hoverSeries,\n hoverPoints: hoverPoints\n };\n }\n /**\n * @private\n * @function Highcharts.Pointer#getPointFromEvent\n */\n getPointFromEvent(e) {\n let target = e.target, point;\n while (target && !point) {\n point = target.point;\n target = target.parentNode;\n }\n return point;\n }\n /**\n * @private\n * @function Highcharts.Pointer#onTrackerMouseOut\n */\n onTrackerMouseOut(e) {\n const chart = this.chart;\n const relatedTarget = e.relatedTarget;\n const series = chart.hoverSeries;\n this.isDirectTouch = false;\n if (series &&\n relatedTarget &&\n !series.stickyTracking &&\n !this.inClass(relatedTarget, 'highcharts-tooltip') &&\n (!this.inClass(relatedTarget, 'highcharts-series-' + series.index) || // #2499, #4465, #5553\n !this.inClass(relatedTarget, 'highcharts-tracker'))) {\n series.onMouseOut();\n }\n }\n /**\n * Utility to detect whether an element has, or has a parent with, a\n * specific class name. Used on detection of tracker objects and on deciding\n * whether hovering the tooltip should cause the active series to mouse out.\n *\n * @function Highcharts.Pointer#inClass\n *\n * @param {Highcharts.SVGDOMElement|Highcharts.HTMLDOMElement} element\n * The element to investigate.\n *\n * @param {string} className\n * The class name to look for.\n *\n * @return {boolean|undefined}\n * True if either the element or one of its parents has the given class\n * name.\n */\n inClass(element, className) {\n let elem = element, elemClassName;\n while (elem) {\n elemClassName = attr(elem, 'class');\n if (elemClassName) {\n if (elemClassName.indexOf(className) !== -1) {\n return true;\n }\n if (elemClassName.indexOf('highcharts-container') !== -1) {\n return false;\n }\n }\n elem = elem.parentElement;\n }\n }\n /**\n * Initialize the Pointer.\n *\n * @private\n * @function Highcharts.Pointer#init\n *\n * @param {Highcharts.Chart} chart\n * The Chart instance.\n *\n * @param {Highcharts.Options} options\n * The root options object. The pointer uses options from the chart and\n * tooltip structures.\n */\n constructor(chart, options) {\n this.hasDragged = 0;\n this.eventsToUnbind = [];\n // Store references\n this.options = options;\n this.chart = chart;\n // Do we need to handle click on a touch device?\n this.runChartClick = Boolean(options.chart.events?.click);\n this.pinchDown = [];\n this.setDOMEvents();\n fireEvent(this, 'afterInit');\n }\n /**\n * Takes a browser event object and extends it with custom Highcharts\n * properties `chartX` and `chartY` in order to work on the internal\n * coordinate system.\n *\n * On map charts, the properties `lon` and `lat` are added to the event\n * object given that the chart has projection information.\n *\n * @function Highcharts.Pointer#normalize\n *\n * @param {global.MouseEvent|global.PointerEvent|global.TouchEvent} e\n * Event object in standard browsers.\n *\n * @param {Highcharts.OffsetObject} [chartPosition]\n * Additional chart offset.\n *\n * @return {Highcharts.PointerEventObject}\n * A browser event with extended properties `chartX` and `chartY`.\n */\n normalize(e, chartPosition) {\n const touches = e.touches;\n // Position for iOS (#2757)\n const ePos = (touches ?\n touches.length ?\n touches.item(0) :\n (pick(// #13534\n touches.changedTouches, e.changedTouches))[0] :\n e);\n // Get mouse position\n if (!chartPosition) {\n chartPosition = this.getChartPosition();\n }\n let chartX = ePos.pageX - chartPosition.left, chartY = ePos.pageY - chartPosition.top;\n // #11329 - when there is scaling on a parent element, we need to take\n // this into account\n chartX /= chartPosition.scaleX;\n chartY /= chartPosition.scaleY;\n return extend(e, {\n chartX: Math.round(chartX),\n chartY: Math.round(chartY)\n });\n }\n /**\n * @private\n * @function Highcharts.Pointer#onContainerClick\n */\n onContainerClick(e) {\n const chart = this.chart;\n const hoverPoint = chart.hoverPoint;\n const pEvt = this.normalize(e);\n const plotLeft = chart.plotLeft;\n const plotTop = chart.plotTop;\n if (!chart.cancelClick) {\n // On tracker click, fire the series and point events. #783, #1583\n if (hoverPoint &&\n this.inClass(pEvt.target, 'highcharts-tracker')) {\n // The series click event\n fireEvent(hoverPoint.series, 'click', extend(pEvt, {\n point: hoverPoint\n }));\n // The point click event\n if (chart.hoverPoint) { // It may be destroyed (#1844)\n hoverPoint.firePointEvent('click', pEvt);\n }\n // When clicking outside a tracker, fire a chart event\n }\n else {\n extend(pEvt, this.getCoordinates(pEvt));\n // Fire a click event in the chart\n if (chart.isInsidePlot(pEvt.chartX - plotLeft, pEvt.chartY - plotTop, {\n visiblePlotOnly: true\n })) {\n fireEvent(chart, 'click', pEvt);\n }\n }\n }\n }\n /**\n * @private\n * @function Highcharts.Pointer#onContainerMouseDown\n */\n onContainerMouseDown(e) {\n const isPrimaryButton = ((e.buttons || e.button) & 1) === 1;\n e = this.normalize(e);\n // #11635, Firefox does not reliably fire move event after click scroll\n if (H.isFirefox &&\n e.button !== 0) {\n this.onContainerMouseMove(e);\n }\n // #11635, limiting to primary button\n if (typeof e.button === 'undefined' ||\n isPrimaryButton) {\n this.zoomOption(e);\n // #295, #13737 solve conflict between container drag and chart zoom\n if (isPrimaryButton) {\n e.preventDefault?.();\n }\n this.dragStart(e);\n }\n }\n /**\n * When mouse leaves the container, hide the tooltip.\n * @private\n * @function Highcharts.Pointer#onContainerMouseLeave\n */\n onContainerMouseLeave(e) {\n const { pointer } = charts[pick(Pointer.hoverChartIndex, -1)] || {};\n e = this.normalize(e);\n this.onContainerMouseMove(e);\n // #4886, MS Touch end fires mouseleave but with no related target\n if (pointer &&\n e.relatedTarget &&\n !this.inClass(e.relatedTarget, 'highcharts-tooltip')) {\n pointer.reset();\n // Also reset the chart position, used in #149 fix\n pointer.chartPosition = void 0;\n }\n }\n /**\n * When mouse enters the container, delete pointer's chartPosition.\n * @private\n * @function Highcharts.Pointer#onContainerMouseEnter\n */\n onContainerMouseEnter() {\n delete this.chartPosition;\n }\n /**\n * The mousemove, touchmove and touchstart event handler\n * @private\n * @function Highcharts.Pointer#onContainerMouseMove\n */\n onContainerMouseMove(e) {\n const chart = this.chart, tooltip = chart.tooltip, pEvt = this.normalize(e);\n this.setHoverChartIndex(e);\n if (chart.mouseIsDown === 'mousedown' || this.touchSelect(pEvt)) {\n this.drag(pEvt);\n }\n // Show the tooltip and run mouse over events (#977)\n if (!chart.openMenu &&\n (this.inClass(pEvt.target, 'highcharts-tracker') ||\n chart.isInsidePlot(pEvt.chartX - chart.plotLeft, pEvt.chartY - chart.plotTop, {\n visiblePlotOnly: true\n })) &&\n // If the tooltip has stickOnContact enabled, do nothing. This\n // applies regardless of any combinations of the `split` and\n // `useHTML` options.\n !(tooltip &&\n tooltip.shouldStickOnContact(pEvt))) {\n if (this.inClass(pEvt.target, 'highcharts-no-tooltip')) {\n this.reset(false, 0);\n }\n else {\n this.runPointActions(pEvt);\n }\n }\n }\n /**\n * @private\n * @function Highcharts.Pointer#onDocumentTouchEnd\n */\n onDocumentTouchEnd(e) {\n this.onDocumentMouseUp(e);\n }\n /**\n * @private\n * @function Highcharts.Pointer#onContainerTouchMove\n */\n onContainerTouchMove(e) {\n if (this.touchSelect(e)) {\n this.onContainerMouseMove(e);\n }\n else {\n this.touch(e);\n }\n }\n /**\n * @private\n * @function Highcharts.Pointer#onContainerTouchStart\n */\n onContainerTouchStart(e) {\n if (this.touchSelect(e)) {\n this.onContainerMouseDown(e);\n }\n else {\n this.zoomOption(e);\n this.touch(e, true);\n }\n }\n /**\n * Special handler for mouse move that will hide the tooltip when the mouse\n * leaves the plotarea. Issue #149 workaround. The mouseleave event does not\n * always fire.\n * @private\n * @function Highcharts.Pointer#onDocumentMouseMove\n */\n onDocumentMouseMove(e) {\n const chart = this.chart;\n const tooltip = chart.tooltip;\n const chartPosition = this.chartPosition;\n const pEvt = this.normalize(e, chartPosition);\n // If we're outside, hide the tooltip\n if (chartPosition &&\n !chart.isInsidePlot(pEvt.chartX - chart.plotLeft, pEvt.chartY - chart.plotTop, {\n visiblePlotOnly: true\n }) &&\n !(tooltip &&\n tooltip.shouldStickOnContact(pEvt)) &&\n !this.inClass(pEvt.target, 'highcharts-tracker')) {\n this.reset();\n }\n }\n /**\n * @private\n * @function Highcharts.Pointer#onDocumentMouseUp\n */\n onDocumentMouseUp(e) {\n charts[pick(Pointer.hoverChartIndex, -1)]\n ?.pointer\n ?.drop(e);\n }\n /**\n * Handle touch events with two touches\n * @private\n * @function Highcharts.Pointer#pinch\n */\n pinch(e) {\n const pointer = this, { chart, hasZoom, lastTouches } = pointer, touches = [].map.call(e.touches || [], \n // Normalize each touch\n (touch) => pointer.normalize(touch)), touchesLength = touches.length, fireClickEvent = touchesLength === 1 && ((pointer.inClass(e.target, 'highcharts-tracker') &&\n chart.runTrackerClick) ||\n pointer.runChartClick), tooltip = chart.tooltip, followTouchMove = touchesLength === 1 &&\n pick(tooltip?.options.followTouchMove, true);\n // Don't initiate panning until the user has pinched. This prevents us\n // from blocking page scrolling as users scroll down a long page\n // (#4210).\n if (touchesLength > 1) {\n pointer.initiated = true;\n }\n else if (followTouchMove) {\n // #16119: Prevent blocking scroll when single-finger panning is\n // not enabled\n pointer.initiated = false;\n }\n // On touch devices, only proceed to trigger click if a handler is\n // defined\n if (hasZoom &&\n pointer.initiated &&\n !fireClickEvent &&\n e.cancelable !== false) {\n e.preventDefault();\n }\n // Register the touch start position\n if (e.type === 'touchstart') {\n pointer.pinchDown = touches;\n pointer.res = true; // Reset on next move\n // Optionally move the tooltip on touchmove\n }\n else if (followTouchMove) {\n this.runPointActions(pointer.normalize(e));\n // Event type is touchmove, handle panning and pinching. The length can\n // be 0 when releasing, if touchend fires first\n }\n else if (lastTouches) {\n fireEvent(chart, 'touchpan', {\n originalEvent: e,\n touches\n }, () => {\n const boxFromTouches = (touches) => {\n const finger0 = touches[0], finger1 = touches[1] || finger0;\n return {\n x: finger0.chartX,\n y: finger0.chartY,\n width: finger1.chartX - finger0.chartX,\n height: finger1.chartY - finger0.chartY\n };\n };\n chart.transform({\n axes: chart.axes\n .filter((axis) => axis.zoomEnabled &&\n ((this.zoomHor && axis.horiz) ||\n (this.zoomVert && !axis.horiz))),\n to: boxFromTouches(touches),\n from: boxFromTouches(lastTouches),\n trigger: e.type\n });\n });\n if (pointer.res) {\n pointer.res = false;\n this.reset(false, 0);\n }\n }\n pointer.lastTouches = touches;\n }\n /**\n * Run translation operations\n * @private\n * @function Highcharts.Pointer#pinchTranslate\n * /\n public pinchTranslate(\n pinchDown: Array,\n touches: Array,\n transform: any,\n selectionMarker: any,\n clip: any,\n lastValidTouch: any\n ): void {\n if (this.zoomHor) {\n this.pinchTranslateDirection(\n true,\n pinchDown,\n touches,\n transform,\n selectionMarker,\n clip,\n lastValidTouch\n );\n }\n if (this.zoomVert) {\n this.pinchTranslateDirection(\n false,\n pinchDown,\n touches,\n transform,\n selectionMarker,\n clip,\n lastValidTouch\n );\n }\n }\n */\n /**\n * Run translation operations for each direction (horizontal and vertical)\n * independently.\n * @private\n * @function Highcharts.Pointer#pinchTranslateDirection\n * /\n public pinchTranslateDirection(\n horiz: boolean,\n pinchDown: Array,\n touches: Array,\n transform: any,\n selectionMarker: any,\n clip: any,\n lastValidTouch: any,\n forcedScale?: number\n ): void {\n const chart = this.chart,\n xy: ('x'|'y') = horiz ? 'x' : 'y',\n XY: ('X'|'Y') = horiz ? 'X' : 'Y',\n sChartXY: ('chartX'|'chartY') = ('chart' + XY) as any,\n wh = horiz ? 'width' : 'height',\n plotLeftTop = (chart as any)['plot' + (horiz ? 'Left' : 'Top')],\n inverted = chart.inverted,\n bounds = chart.bounds[horiz ? 'h' : 'v'],\n singleTouch = pinchDown.length === 1,\n touch0Start = pinchDown[0][sChartXY],\n touch1Start = !singleTouch && pinchDown[1][sChartXY],\n setScale = function (): void {\n // Don't zoom if fingers are too close on this axis\n if (\n typeof touch1Now === 'number' &&\n Math.abs(touch0Start - touch1Start) > 20\n ) {\n scale = forcedScale ||\n Math.abs(touch0Now - touch1Now) /\n Math.abs(touch0Start - touch1Start);\n }\n\n clipXY = ((plotLeftTop - touch0Now) / scale) + touch0Start;\n selectionWH = (chart as any)[\n 'plot' + (horiz ? 'Width' : 'Height')\n ] / scale;\n };\n\n let selectionWH: any,\n selectionXY,\n clipXY: any,\n scale = forcedScale || 1,\n touch0Now = touches[0][sChartXY],\n touch1Now = !singleTouch && touches[1][sChartXY],\n outOfBounds;\n\n // Set the scale, first pass\n setScale();\n\n // The clip position (x or y) is altered if out of bounds, the selection\n // position is not\n selectionXY = clipXY;\n\n // Out of bounds\n if (selectionXY < bounds.min) {\n selectionXY = bounds.min;\n outOfBounds = true;\n } else if (selectionXY + selectionWH > bounds.max) {\n selectionXY = bounds.max - selectionWH;\n outOfBounds = true;\n }\n\n // Is the chart dragged off its bounds, determined by dataMin and\n // dataMax?\n if (outOfBounds) {\n\n // Modify the touchNow position in order to create an elastic drag\n // movement. This indicates to the user that the chart is responsive\n // but can't be dragged further.\n touch0Now -= 0.8 * (touch0Now - lastValidTouch[xy][0]);\n if (typeof touch1Now === 'number') {\n touch1Now -= 0.8 * (touch1Now - lastValidTouch[xy][1]);\n }\n\n // Set the scale, second pass to adapt to the modified touchNow\n // positions\n setScale();\n\n } else {\n lastValidTouch[xy] = [touch0Now, touch1Now];\n }\n\n // Set geometry for clipping, selection and transformation\n if (!inverted) {\n clip[xy] = clipXY - plotLeftTop;\n clip[wh] = selectionWH;\n }\n const scaleKey = inverted ?\n (horiz ? 'scaleY' : 'scaleX') : 'scale' + XY;\n const transformScale = inverted ? 1 / scale : scale;\n\n selectionMarker[wh] = selectionWH;\n selectionMarker[xy] = selectionXY;\n // Invert scale if needed (#19217)\n transform[scaleKey] = scale * (inverted && !horiz ? -1 : 1);\n transform['translate' + XY] = (transformScale * plotLeftTop) +\n (touch0Now - (transformScale * touch0Start));\n }\n */\n /**\n * Reset the tracking by hiding the tooltip, the hover series state and the\n * hover point\n *\n * @function Highcharts.Pointer#reset\n *\n * @param {boolean} [allowMove]\n * Instead of destroying the tooltip altogether, allow moving it if\n * possible.\n *\n * @param {number} [delay]\n */\n reset(allowMove, delay) {\n const pointer = this, chart = pointer.chart, hoverSeries = chart.hoverSeries, hoverPoint = chart.hoverPoint, hoverPoints = chart.hoverPoints, tooltip = chart.tooltip, tooltipPoints = tooltip && tooltip.shared ?\n hoverPoints :\n hoverPoint;\n // Check if the points have moved outside the plot area (#1003, #4736,\n // #5101)\n if (allowMove && tooltipPoints) {\n splat(tooltipPoints).forEach(function (point) {\n if (point.series.isCartesian &&\n typeof point.plotX === 'undefined') {\n allowMove = false;\n }\n });\n }\n // Just move the tooltip, #349\n if (allowMove) {\n if (tooltip && tooltipPoints && splat(tooltipPoints).length) {\n tooltip.refresh(tooltipPoints);\n if (tooltip.shared && hoverPoints) { // #8284\n hoverPoints.forEach(function (point) {\n point.setState(point.state, true);\n if (point.series.isCartesian) {\n if (point.series.xAxis.crosshair) {\n point.series.xAxis\n .drawCrosshair(null, point);\n }\n if (point.series.yAxis.crosshair) {\n point.series.yAxis\n .drawCrosshair(null, point);\n }\n }\n });\n }\n else if (hoverPoint) { // #2500\n hoverPoint.setState(hoverPoint.state, true);\n chart.axes.forEach(function (axis) {\n if (axis.crosshair &&\n hoverPoint.series[axis.coll] === axis) {\n axis.drawCrosshair(null, hoverPoint);\n }\n });\n }\n }\n // Full reset\n }\n else {\n if (hoverPoint) {\n hoverPoint.onMouseOut();\n }\n if (hoverPoints) {\n hoverPoints.forEach(function (point) {\n point.setState();\n });\n }\n if (hoverSeries) {\n hoverSeries.onMouseOut();\n }\n if (tooltip) {\n tooltip.hide(delay);\n }\n if (pointer.unDocMouseMove) {\n pointer.unDocMouseMove = pointer.unDocMouseMove();\n }\n // Remove crosshairs\n chart.axes.forEach(function (axis) {\n axis.hideCrosshair();\n });\n chart.hoverPoints = chart.hoverPoint = void 0;\n }\n }\n /**\n * With line type charts with a single tracker, get the point closest to the\n * mouse. Run Point.onMouseOver and display tooltip for the point or points.\n *\n * @private\n * @function Highcharts.Pointer#runPointActions\n *\n * @emits Highcharts.Point#event:mouseOut\n * @emits Highcharts.Point#event:mouseOver\n */\n runPointActions(e, p, force) {\n const pointer = this, chart = pointer.chart, series = chart.series, tooltip = (chart.tooltip && chart.tooltip.options.enabled ?\n chart.tooltip :\n void 0), shared = (tooltip ?\n tooltip.shared :\n false);\n let hoverPoint = p || chart.hoverPoint, hoverSeries = hoverPoint && hoverPoint.series || chart.hoverSeries;\n const // onMouseOver or already hovering a series with directTouch\n isDirectTouch = (!e || e.type !== 'touchmove') && (!!p || ((hoverSeries && hoverSeries.directTouch) &&\n pointer.isDirectTouch)), hoverData = this.getHoverData(hoverPoint, hoverSeries, series, isDirectTouch, shared, e);\n // Update variables from hoverData.\n hoverPoint = hoverData.hoverPoint;\n hoverSeries = hoverData.hoverSeries;\n const points = hoverData.hoverPoints, followPointer = hoverSeries &&\n hoverSeries.tooltipOptions.followPointer &&\n !hoverSeries.tooltipOptions.split, useSharedTooltip = (shared &&\n hoverSeries &&\n !hoverSeries.noSharedTooltip);\n // Refresh tooltip for kdpoint if new hover point or tooltip was hidden\n // #3926, #4200\n if (hoverPoint &&\n (force ||\n hoverPoint !== chart.hoverPoint ||\n (tooltip && tooltip.isHidden))) {\n (chart.hoverPoints || []).forEach(function (p) {\n if (points.indexOf(p) === -1) {\n p.setState();\n }\n });\n // Set normal state to previous series\n if (chart.hoverSeries !== hoverSeries) {\n hoverSeries.onMouseOver();\n }\n pointer.applyInactiveState(points);\n // Do mouseover on all points (#3919, #3985, #4410, #5622)\n (points || []).forEach(function (p) {\n p.setState('hover');\n });\n // If tracking is on series in stead of on each point,\n // fire mouseOver on hover point. // #4448\n if (chart.hoverPoint) {\n chart.hoverPoint.firePointEvent('mouseOut');\n }\n // Hover point may have been destroyed in the event handlers (#7127)\n if (!hoverPoint.series) {\n return;\n }\n /**\n * Contains all hovered points.\n *\n * @name Highcharts.Chart#hoverPoints\n * @type {Array|null}\n */\n chart.hoverPoints = points;\n /**\n * Contains the original hovered point.\n *\n * @name Highcharts.Chart#hoverPoint\n * @type {Highcharts.Point|null}\n */\n chart.hoverPoint = hoverPoint;\n /**\n * Hover state should not be lost when axis is updated (#12569)\n * Axis.update runs pointer.reset which uses chart.hoverPoint.state\n * to apply state which does not exist in hoverPoint yet.\n * The mouseOver event should be triggered when hoverPoint\n * is correct.\n */\n hoverPoint.firePointEvent('mouseOver', void 0, () => {\n // Draw tooltip if necessary\n if (tooltip && hoverPoint) {\n tooltip.refresh(useSharedTooltip ? points : hoverPoint, e);\n }\n });\n // Update positions (regardless of kdpoint or hoverPoint)\n }\n else if (followPointer && tooltip && !tooltip.isHidden) {\n const anchor = tooltip.getAnchor([{}], e);\n if (chart.isInsidePlot(anchor[0], anchor[1], {\n visiblePlotOnly: true\n })) {\n tooltip.updatePosition({ plotX: anchor[0], plotY: anchor[1] });\n }\n }\n // Start the event listener to pick up the tooltip and crosshairs\n if (!pointer.unDocMouseMove) {\n pointer.unDocMouseMove = addEvent(chart.container.ownerDocument, 'mousemove', (e) => charts[Pointer.hoverChartIndex ?? -1]\n ?.pointer\n ?.onDocumentMouseMove(e));\n pointer.eventsToUnbind.push(pointer.unDocMouseMove);\n }\n // Issues related to crosshair #4927, #5269 #5066, #5658\n chart.axes.forEach(function drawAxisCrosshair(axis) {\n const snap = pick((axis.crosshair || {}).snap, true);\n let point;\n if (snap) {\n point = chart.hoverPoint; // #13002\n if (!point || point.series[axis.coll] !== axis) {\n point = find(points, (p) => p.series && p.series[axis.coll] === axis);\n }\n }\n // Axis has snapping crosshairs, and one of the hover points belongs\n // to axis. Always call drawCrosshair when it is not snap.\n if (point || !snap) {\n axis.drawCrosshair(e, point);\n // Axis has snapping crosshairs, but no hover point belongs to axis\n }\n else {\n axis.hideCrosshair();\n }\n });\n }\n /**\n * Set the JS DOM events on the container and document. This method should\n * contain a one-to-one assignment between methods and their handlers. Any\n * advanced logic should be moved to the handler reflecting the event's\n * name.\n * @private\n * @function Highcharts.Pointer#setDOMEvents\n */\n setDOMEvents() {\n const container = this.chart.container, ownerDoc = container.ownerDocument;\n container.onmousedown = this.onContainerMouseDown.bind(this);\n container.onmousemove = this.onContainerMouseMove.bind(this);\n container.onclick = this.onContainerClick.bind(this);\n this.eventsToUnbind.push(addEvent(container, 'mouseenter', this.onContainerMouseEnter.bind(this)), addEvent(container, 'mouseleave', this.onContainerMouseLeave.bind(this)));\n if (!Pointer.unbindDocumentMouseUp) {\n Pointer.unbindDocumentMouseUp = addEvent(ownerDoc, 'mouseup', this.onDocumentMouseUp.bind(this));\n }\n // In case we are dealing with overflow, reset the chart position when\n // scrolling parent elements\n let parent = this.chart.renderTo.parentElement;\n while (parent && parent.tagName !== 'BODY') {\n this.eventsToUnbind.push(addEvent(parent, 'scroll', () => {\n delete this.chartPosition;\n }));\n parent = parent.parentElement;\n }\n this.eventsToUnbind.push(addEvent(container, 'touchstart', this.onContainerTouchStart.bind(this), { passive: false }), addEvent(container, 'touchmove', this.onContainerTouchMove.bind(this), { passive: false }));\n if (!Pointer.unbindDocumentTouchEnd) {\n Pointer.unbindDocumentTouchEnd = addEvent(ownerDoc, 'touchend', this.onDocumentTouchEnd.bind(this), { passive: false });\n }\n }\n /**\n * Sets the index of the hovered chart and leaves the previous hovered\n * chart, to reset states like tooltip.\n * @private\n * @function Highcharts.Pointer#setHoverChartIndex\n */\n setHoverChartIndex(e) {\n const chart = this.chart;\n const hoverChart = H.charts[pick(Pointer.hoverChartIndex, -1)];\n if (hoverChart &&\n hoverChart !== chart) {\n hoverChart.pointer?.onContainerMouseLeave(e || { relatedTarget: chart.container });\n }\n if (!hoverChart ||\n !hoverChart.mouseIsDown) {\n Pointer.hoverChartIndex = chart.index;\n }\n }\n /**\n * General touch handler shared by touchstart and touchmove.\n * @private\n * @function Highcharts.Pointer#touch\n */\n touch(e, start) {\n const { chart, pinchDown = [] } = this;\n let hasMoved, isInside;\n this.setHoverChartIndex();\n if (e.touches.length === 1) {\n e = this.normalize(e);\n isInside = chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop, {\n visiblePlotOnly: true\n });\n if (isInside && !chart.openMenu) {\n // Run mouse events and display tooltip etc\n if (start) {\n this.runPointActions(e);\n }\n // Android fires touchmove events after the touchstart even if\n // the finger hasn't moved, or moved only a pixel or two. In iOS\n // however, the touchmove doesn't fire unless the finger moves\n // more than ~4px. So we emulate this behaviour in Android by\n // checking how much it moved, and cancelling on small\n // distances. #3450. Tested and still relevant as of 2024.\n if (e.type === 'touchmove') {\n hasMoved = pinchDown[0] ? // #5266\n (Math.pow(pinchDown[0].chartX - e.chartX, 2) +\n Math.pow(pinchDown[0].chartY - e.chartY, 2)) >= 16 :\n false;\n }\n if (pick(hasMoved, true)) {\n this.pinch(e);\n }\n }\n else if (start) {\n // Hide the tooltip on touching outside the plot area (#1203)\n this.reset();\n }\n }\n else if (e.touches.length === 2) {\n this.pinch(e);\n }\n }\n /**\n * Returns true if the chart is set up for zooming by single touch and the\n * event is capable\n * @private\n * @function Highcharts.Pointer#touchSelect\n */\n touchSelect(e) {\n return Boolean(this.chart.zooming.singleTouch &&\n e.touches &&\n e.touches.length === 1);\n }\n /**\n * Resolve the zoomType option, this is reset on all touch start and mouse\n * down events.\n * @private\n * @function Highcharts.Pointer#zoomOption\n */\n zoomOption(e) {\n const chart = this.chart, inverted = chart.inverted;\n let zoomType = chart.zooming.type || '', zoomX, zoomY;\n // Look for the pinchType option\n if (/touch/.test(e.type)) {\n zoomType = pick(chart.zooming.pinchType, zoomType);\n }\n this.zoomX = zoomX = /x/.test(zoomType);\n this.zoomY = zoomY = /y/.test(zoomType);\n this.zoomHor = (zoomX && !inverted) || (zoomY && inverted);\n this.zoomVert = (zoomY && !inverted) || (zoomX && inverted);\n this.hasZoom = zoomX || zoomY;\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (Pointer) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(ChartClass) {\n if (pushUnique(composed, 'Core.Pointer')) {\n addEvent(ChartClass, 'beforeRender', function () {\n /**\n * The Pointer that keeps track of mouse and touch\n * interaction.\n *\n * @memberof Highcharts.Chart\n * @name pointer\n * @type {Highcharts.Pointer}\n * @instance\n */\n this.pointer = new Pointer(this, this.options);\n });\n }\n }\n Pointer.compose = compose;\n})(Pointer || (Pointer = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default Pointer;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Chart position and scale.\n *\n * @interface Highcharts.ChartPositionObject\n */ /**\n* @name Highcharts.ChartPositionObject#left\n* @type {number}\n*/ /**\n* @name Highcharts.ChartPositionObject#scaleX\n* @type {number}\n*/ /**\n* @name Highcharts.ChartPositionObject#scaleY\n* @type {number}\n*/ /**\n* @name Highcharts.ChartPositionObject#top\n* @type {number}\n*/\n/**\n * One position in relation to an axis.\n *\n * @interface Highcharts.PointerAxisCoordinateObject\n */ /**\n* Related axis.\n*\n* @name Highcharts.PointerAxisCoordinateObject#axis\n* @type {Highcharts.Axis}\n*/ /**\n* Axis value.\n*\n* @name Highcharts.PointerAxisCoordinateObject#value\n* @type {number}\n*/\n/**\n * Positions in terms of axis values.\n *\n * @interface Highcharts.PointerAxisCoordinatesObject\n */ /**\n* Positions on the x-axis.\n* @name Highcharts.PointerAxisCoordinatesObject#xAxis\n* @type {Array}\n*/ /**\n* Positions on the y-axis.\n* @name Highcharts.PointerAxisCoordinatesObject#yAxis\n* @type {Array}\n*/\n/**\n * Pointer coordinates.\n *\n * @interface Highcharts.PointerCoordinatesObject\n */ /**\n* @name Highcharts.PointerCoordinatesObject#chartX\n* @type {number}\n*/ /**\n* @name Highcharts.PointerCoordinatesObject#chartY\n* @type {number}\n*/\n/**\n * A native browser mouse or touch event, extended with position information\n * relative to the {@link Chart.container}.\n *\n * @interface Highcharts.PointerEventObject\n * @extends global.PointerEvent\n */ /**\n* The X coordinate of the pointer interaction relative to the chart.\n*\n* @name Highcharts.PointerEventObject#chartX\n* @type {number}\n*/ /**\n* The Y coordinate of the pointer interaction relative to the chart.\n*\n* @name Highcharts.PointerEventObject#chartY\n* @type {number}\n*/\n/**\n * Axis-specific data of a selection.\n *\n * @interface Highcharts.SelectDataObject\n */ /**\n* The selected Axis.\n* @name Highcharts.SelectDataObject#axis\n* @type {Highcharts.Axis}\n*/ /**\n* The maximum axis value, either automatic or set manually.\n* @name Highcharts.SelectDataObject#max\n* @type {number}\n*/ /**\n* The minimum axis value, either automatic or set manually.\n* @name Highcharts.SelectDataObject#min\n* @type {number}\n*/\n/**\n * Object for select events.\n * The primary axes are `xAxis[0]` and `yAxis[0]`. Remember the unit of a\n * datetime axis is milliseconds since 1970-01-01 00:00:00.\n *\n * @interface Highcharts.SelectEventObject\n */ /**\n* The related browser event.\n* @name Highcharts.SelectEventObject#originalEvent\n* @type {global.Event}\n*/ /**\n* Indicates a reset event to restore default state.\n* @name Highcharts.SelectEventObject#resetSelection\n* @type {boolean|undefined}\n*/ /**\n* Arrays containing the axes of each dimension and each axis' min and max\n* values.\n* @name Highcharts.SelectEventObject#xAxis\n* @type {Array}\n*/ /**\n* Arrays containing the axes of each dimension and each axis' min and max\n* values.\n* @name Highcharts.SelectEventObject#yAxis\n* @type {Array}\n*/\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../Animation/AnimationUtilities.js';\nconst { animObject, setAnimation } = A;\nimport F from '../Templating.js';\nconst { format } = F;\nimport H from '../Globals.js';\nconst { composed, marginNames } = H;\nimport Point from '../Series/Point.js';\nimport R from '../Renderer/RendererUtilities.js';\nconst { distribute } = R;\nimport U from '../Utilities.js';\nconst { addEvent, createElement, css, defined, discardElement, find, fireEvent, isNumber, merge, pick, pushUnique, relativeLength, stableSort, syncTimeout } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The overview of the chart's series. The legend object is instantiated\n * internally in the chart constructor, and is available from the `chart.legend`\n * property. Each chart has only one legend.\n *\n * @class\n * @name Highcharts.Legend\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @param {Highcharts.LegendOptions} options\n * Legend options.\n */\nclass Legend {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Initialize the legend.\n *\n * @private\n * @function Highcharts.Legend#init\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @param {Highcharts.LegendOptions} options\n * Legend options.\n */\n constructor(chart, options) {\n /* *\n *\n * Properties\n *\n * */\n this.allItems = [];\n this.initialItemY = 0;\n this.itemHeight = 0;\n this.itemMarginBottom = 0;\n this.itemMarginTop = 0;\n this.itemX = 0;\n this.itemY = 0;\n this.lastItemY = 0;\n this.lastLineHeight = 0;\n this.legendHeight = 0;\n this.legendWidth = 0;\n this.maxItemWidth = 0;\n this.maxLegendWidth = 0;\n this.offsetWidth = 0;\n this.padding = 0;\n this.pages = [];\n this.symbolHeight = 0;\n this.symbolWidth = 0;\n this.titleHeight = 0;\n this.totalItemWidth = 0;\n this.widthOption = 0;\n /**\n * Chart of this legend.\n *\n * @readonly\n * @name Highcharts.Legend#chart\n * @type {Highcharts.Chart}\n */\n this.chart = chart;\n this.setOptions(options);\n if (options.enabled) {\n // Render it\n this.render();\n // Move checkboxes\n addEvent(this.chart, 'endResize', function () {\n this.legend.positionCheckboxes();\n });\n }\n // On Legend.init and Legend.update, make sure that proximate layout\n // events are either added or removed (#18362).\n addEvent(this.chart, 'render', () => {\n if (this.options.enabled && this.proximate) {\n this.proximatePositions();\n this.positionItems();\n }\n });\n }\n /**\n * @private\n * @function Highcharts.Legend#setOptions\n * @param {Highcharts.LegendOptions} options\n */\n setOptions(options) {\n const padding = pick(options.padding, 8);\n /**\n * Legend options.\n *\n * @readonly\n * @name Highcharts.Legend#options\n * @type {Highcharts.LegendOptions}\n */\n this.options = options;\n if (!this.chart.styledMode) {\n this.itemStyle = options.itemStyle;\n this.itemHiddenStyle = merge(this.itemStyle, options.itemHiddenStyle);\n }\n this.itemMarginTop = options.itemMarginTop;\n this.itemMarginBottom = options.itemMarginBottom;\n this.padding = padding;\n this.initialItemY = padding - 5; // 5 is pixels above the text\n this.symbolWidth = pick(options.symbolWidth, 16);\n this.pages = [];\n this.proximate = options.layout === 'proximate' && !this.chart.inverted;\n // #12705: baseline has to be reset on every update\n this.baseline = void 0;\n }\n /**\n * Update the legend with new options. Equivalent to running `chart.update`\n * with a legend configuration option.\n *\n * @sample highcharts/legend/legend-update/\n * Legend update\n *\n * @function Highcharts.Legend#update\n *\n * @param {Highcharts.LegendOptions} options\n * Legend options.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the axis is altered. If doing more\n * operations on the chart, it is a good idea to set redraw to false and\n * call {@link Chart#redraw} after. Whether to redraw the chart.\n *\n * @emits Highcharts.Legends#event:afterUpdate\n */\n update(options, redraw) {\n const chart = this.chart;\n this.setOptions(merge(true, this.options, options));\n this.destroy();\n chart.isDirtyLegend = chart.isDirtyBox = true;\n if (pick(redraw, true)) {\n chart.redraw();\n }\n fireEvent(this, 'afterUpdate', { redraw });\n }\n /**\n * Set the colors for the legend item.\n *\n * @private\n * @function Highcharts.Legend#colorizeItem\n * @param {Highcharts.BubbleLegendItem|Highcharts.Point|Highcharts.Series} item\n * A Series or Point instance\n * @param {boolean} [visible=false]\n * Dimmed or colored\n *\n * @todo\n * Make events official: Fires the event `afterColorizeItem`.\n */\n colorizeItem(item, visible) {\n const { area, group, label, line, symbol } = item.legendItem || {};\n group?.[visible ? 'removeClass' : 'addClass']('highcharts-legend-item-hidden');\n if (!this.chart.styledMode) {\n const { itemHiddenStyle = {} } = this, hiddenColor = itemHiddenStyle.color, { fillColor, fillOpacity, lineColor, marker } = item.options, colorizeHidden = (attr) => {\n if (!visible) {\n if (attr.fill) {\n attr.fill = hiddenColor;\n }\n if (attr.stroke) {\n attr.stroke = hiddenColor;\n }\n }\n return attr;\n };\n label?.css(merge(visible ? this.itemStyle : itemHiddenStyle));\n line?.attr(colorizeHidden({ stroke: lineColor || item.color }));\n if (symbol) {\n // Apply marker options\n symbol.attr(colorizeHidden(marker && symbol.isMarker ? // #585\n item.pointAttribs() :\n { fill: item.color }));\n }\n area?.attr(colorizeHidden({\n fill: fillColor || item.color,\n 'fill-opacity': fillColor ? 1 : (fillOpacity ?? 0.75)\n }));\n }\n fireEvent(this, 'afterColorizeItem', { item, visible });\n }\n /**\n * @private\n * @function Highcharts.Legend#positionItems\n */\n positionItems() {\n // Now that the legend width and height are established, put the items\n // in the final position\n this.allItems.forEach(this.positionItem, this);\n if (!this.chart.isResizing) {\n this.positionCheckboxes();\n }\n }\n /**\n * Position the legend item.\n *\n * @private\n * @function Highcharts.Legend#positionItem\n * @param {Highcharts.BubbleLegendItem|Highcharts.Point|Highcharts.Series} item\n * The item to position\n */\n positionItem(item) {\n const legend = this, { group, x = 0, y = 0 } = item.legendItem || {}, options = legend.options, symbolPadding = options.symbolPadding, ltr = !options.rtl, checkbox = item.checkbox;\n if (group && group.element) {\n const attribs = {\n translateX: ltr ?\n x :\n legend.legendWidth - x - 2 * symbolPadding - 4,\n translateY: y\n };\n const complete = () => {\n fireEvent(this, 'afterPositionItem', { item });\n };\n group[defined(group.translateY) ? 'animate' : 'attr'](attribs, void 0, complete);\n }\n if (checkbox) {\n checkbox.x = x;\n checkbox.y = y;\n }\n }\n /**\n * Destroy a single legend item, used internally on removing series items.\n *\n * @private\n * @function Highcharts.Legend#destroyItem\n * @param {Highcharts.BubbleLegendItem|Highcharts.Point|Highcharts.Series} item\n * The item to remove\n */\n destroyItem(item) {\n const checkbox = item.checkbox, legendItem = item.legendItem || {};\n // destroy SVG elements\n for (const key of ['group', 'label', 'line', 'symbol']) {\n if (legendItem[key]) {\n legendItem[key] = legendItem[key].destroy();\n }\n }\n if (checkbox) {\n discardElement(checkbox);\n }\n item.legendItem = void 0;\n }\n /**\n * Destroy the legend. Used internally. To reflow objects, `chart.redraw`\n * must be called after destruction.\n *\n * @private\n * @function Highcharts.Legend#destroy\n */\n destroy() {\n const legend = this;\n // Destroy items\n for (const item of this.getAllItems()) {\n this.destroyItem(item);\n }\n // Destroy legend elements\n for (const key of [\n 'clipRect',\n 'up',\n 'down',\n 'pager',\n 'nav',\n 'box',\n 'title',\n 'group'\n ]) {\n if (legend[key]) {\n legend[key] = legend[key].destroy();\n }\n }\n this.display = null; // Reset in .render on update.\n }\n /**\n * Position the checkboxes after the width is determined.\n *\n * @private\n * @function Highcharts.Legend#positionCheckboxes\n */\n positionCheckboxes() {\n const alignAttr = this.group && this.group.alignAttr, clipHeight = this.clipHeight || this.legendHeight, titleHeight = this.titleHeight;\n let translateY;\n if (alignAttr) {\n translateY = alignAttr.translateY;\n this.allItems.forEach(function (item) {\n const checkbox = item.checkbox;\n let top;\n if (checkbox) {\n top = translateY + titleHeight + checkbox.y +\n (this.scrollOffset || 0) + 3;\n css(checkbox, {\n left: (alignAttr.translateX + item.checkboxOffset +\n checkbox.x - 20) + 'px',\n top: top + 'px',\n display: this.proximate || (top > translateY - 6 &&\n top < translateY + clipHeight - 6) ?\n '' :\n 'none'\n });\n }\n }, this);\n }\n }\n /**\n * Render the legend title on top of the legend.\n *\n * @private\n * @function Highcharts.Legend#renderTitle\n */\n renderTitle() {\n const options = this.options, padding = this.padding, titleOptions = options.title;\n let bBox, titleHeight = 0;\n if (titleOptions.text) {\n if (!this.title) {\n /**\n * SVG element of the legend title.\n *\n * @readonly\n * @name Highcharts.Legend#title\n * @type {Highcharts.SVGElement}\n */\n this.title = this.chart.renderer.label(titleOptions.text, padding - 3, padding - 4, void 0, void 0, void 0, options.useHTML, void 0, 'legend-title')\n .attr({ zIndex: 1 });\n if (!this.chart.styledMode) {\n this.title.css(titleOptions.style);\n }\n this.title.add(this.group);\n }\n // Set the max title width (#7253)\n if (!titleOptions.width) {\n this.title.css({\n width: this.maxLegendWidth + 'px'\n });\n }\n bBox = this.title.getBBox();\n titleHeight = bBox.height;\n this.offsetWidth = bBox.width; // #1717\n this.contentGroup.attr({ translateY: titleHeight });\n }\n this.titleHeight = titleHeight;\n }\n /**\n * Set the legend item text.\n *\n * @function Highcharts.Legend#setText\n * @param {Highcharts.Point|Highcharts.Series} item\n * The item for which to update the text in the legend.\n */\n setText(item) {\n const options = this.options;\n item.legendItem.label.attr({\n text: options.labelFormat ?\n format(options.labelFormat, item, this.chart) :\n options.labelFormatter.call(item)\n });\n }\n /**\n * Render a single specific legend item. Called internally from the `render`\n * function.\n *\n * @private\n * @function Highcharts.Legend#renderItem\n * @param {Highcharts.BubbleLegendItem|Highcharts.Point|Highcharts.Series} item\n * The item to render.\n */\n renderItem(item) {\n const legend = this, legendItem = item.legendItem = item.legendItem || {}, chart = legend.chart, renderer = chart.renderer, options = legend.options, horizontal = options.layout === 'horizontal', symbolWidth = legend.symbolWidth, symbolPadding = options.symbolPadding || 0, itemStyle = legend.itemStyle, itemHiddenStyle = legend.itemHiddenStyle, itemDistance = horizontal ? pick(options.itemDistance, 20) : 0, ltr = !options.rtl, isSeries = !item.series, series = !isSeries && item.series.drawLegendSymbol ?\n item.series :\n item, seriesOptions = series.options, showCheckbox = (!!legend.createCheckboxForItem &&\n seriesOptions &&\n seriesOptions.showCheckbox), useHTML = options.useHTML, itemClassName = item.options.className;\n let label = legendItem.label, \n // full width minus text width\n itemExtraWidth = symbolWidth + symbolPadding +\n itemDistance + (showCheckbox ? 20 : 0);\n if (!label) { // generate it once, later move it\n // Generate the group box, a group to hold the symbol and text. Text\n // is to be appended in Legend class.\n legendItem.group = renderer\n .g('legend-item')\n .addClass('highcharts-' + series.type + '-series ' +\n 'highcharts-color-' + item.colorIndex +\n (itemClassName ? ' ' + itemClassName : '') +\n (isSeries ?\n ' highcharts-series-' + item.index :\n ''))\n .attr({ zIndex: 1 })\n .add(legend.scrollGroup);\n // Generate the list item text and add it to the group\n legendItem.label = label = renderer.text('', ltr ?\n symbolWidth + symbolPadding :\n -symbolPadding, legend.baseline || 0, useHTML);\n if (!chart.styledMode) {\n // merge to prevent modifying original (#1021)\n label.css(merge(item.visible ?\n itemStyle :\n itemHiddenStyle));\n }\n label\n .attr({\n align: ltr ? 'left' : 'right',\n zIndex: 2\n })\n .add(legendItem.group);\n // Get the baseline for the first item - the font size is equal for\n // all\n if (!legend.baseline) {\n legend.fontMetrics = renderer.fontMetrics(label);\n legend.baseline =\n legend.fontMetrics.f + 3 + legend.itemMarginTop;\n label.attr('y', legend.baseline);\n legend.symbolHeight =\n pick(options.symbolHeight, legend.fontMetrics.f);\n if (options.squareSymbol) {\n legend.symbolWidth = pick(options.symbolWidth, Math.max(legend.symbolHeight, 16));\n itemExtraWidth = legend.symbolWidth + symbolPadding +\n itemDistance + (showCheckbox ? 20 : 0);\n if (ltr) {\n label.attr('x', legend.symbolWidth + symbolPadding);\n }\n }\n }\n // Draw the legend symbol inside the group box\n series.drawLegendSymbol(legend, item);\n if (legend.setItemEvents) {\n legend.setItemEvents(item, label, useHTML);\n }\n }\n // Add the HTML checkbox on top\n if (showCheckbox && !item.checkbox && legend.createCheckboxForItem) {\n legend.createCheckboxForItem(item);\n }\n // Colorize the items\n legend.colorizeItem(item, item.visible);\n // Take care of max width and text overflow (#6659)\n if (chart.styledMode || !itemStyle.width) {\n label.css({\n width: ((options.itemWidth ||\n legend.widthOption ||\n chart.spacingBox.width) - itemExtraWidth) + 'px'\n });\n }\n // Always update the text\n legend.setText(item);\n // calculate the positions for the next line\n const bBox = label.getBBox();\n const fontMetricsH = (legend.fontMetrics && legend.fontMetrics.h) || 0;\n item.itemWidth = item.checkboxOffset =\n options.itemWidth ||\n legendItem.labelWidth ||\n bBox.width + itemExtraWidth;\n legend.maxItemWidth = Math.max(legend.maxItemWidth, item.itemWidth);\n legend.totalItemWidth += item.itemWidth;\n legend.itemHeight = item.itemHeight = Math.round(legendItem.labelHeight ||\n // use bBox for multiline (#16398)\n (bBox.height > fontMetricsH * 1.5 ? bBox.height : fontMetricsH));\n }\n /**\n * Get the position of the item in the layout. We now know the\n * maxItemWidth from the previous loop.\n *\n * @private\n * @function Highcharts.Legend#layoutItem\n * @param {Highcharts.BubbleLegendItem|Highcharts.Point|Highcharts.Series} item\n */\n layoutItem(item) {\n const options = this.options, padding = this.padding, horizontal = options.layout === 'horizontal', itemHeight = item.itemHeight, itemMarginBottom = this.itemMarginBottom, itemMarginTop = this.itemMarginTop, itemDistance = horizontal ? pick(options.itemDistance, 20) : 0, maxLegendWidth = this.maxLegendWidth, itemWidth = (options.alignColumns &&\n this.totalItemWidth > maxLegendWidth) ?\n this.maxItemWidth :\n item.itemWidth, legendItem = item.legendItem || {};\n // If the item exceeds the width, start a new line\n if (horizontal &&\n this.itemX - padding + itemWidth > maxLegendWidth) {\n this.itemX = padding;\n if (this.lastLineHeight) { // Not for the first line (#10167)\n this.itemY += (itemMarginTop +\n this.lastLineHeight +\n itemMarginBottom);\n }\n this.lastLineHeight = 0; // reset for next line (#915, #3976)\n }\n // Set the edge positions\n this.lastItemY = itemMarginTop + this.itemY + itemMarginBottom;\n this.lastLineHeight = Math.max(// #915\n itemHeight, this.lastLineHeight);\n // cache the position of the newly generated or reordered items\n legendItem.x = this.itemX;\n legendItem.y = this.itemY;\n // advance\n if (horizontal) {\n this.itemX += itemWidth;\n }\n else {\n this.itemY +=\n itemMarginTop + itemHeight + itemMarginBottom;\n this.lastLineHeight = itemHeight;\n }\n // the width of the widest item\n this.offsetWidth = this.widthOption || Math.max((horizontal ? this.itemX - padding - (item.checkbox ?\n // decrease by itemDistance only when no checkbox #4853\n 0 :\n itemDistance) : itemWidth) + padding, this.offsetWidth);\n }\n /**\n * Get all items, which is one item per series for most series and one\n * item per point for pie series and its derivatives. Fires the event\n * `afterGetAllItems`.\n *\n * @private\n * @function Highcharts.Legend#getAllItems\n * @return {Array<(Highcharts.BubbleLegendItem|Highcharts.Point|Highcharts.Series)>}\n * The current items in the legend.\n * @emits Highcharts.Legend#event:afterGetAllItems\n */\n getAllItems() {\n let allItems = [];\n this.chart.series.forEach(function (series) {\n const seriesOptions = series && series.options;\n // Handle showInLegend. If the series is linked to another series,\n // defaults to false.\n if (series && pick(seriesOptions.showInLegend, !defined(seriesOptions.linkedTo) ? void 0 : false, true)) {\n // Use points or series for the legend item depending on\n // legendType\n allItems = allItems.concat((series.legendItem || {}).labels ||\n (seriesOptions.legendType === 'point' ?\n series.data :\n series));\n }\n });\n fireEvent(this, 'afterGetAllItems', { allItems });\n return allItems;\n }\n /**\n * Get a short, three letter string reflecting the alignment and layout.\n *\n * @private\n * @function Highcharts.Legend#getAlignment\n * @return {string}\n * The alignment, empty string if floating\n */\n getAlignment() {\n const options = this.options;\n // Use the first letter of each alignment option in order to detect\n // the side. (#4189 - use charAt(x) notation instead of [x] for IE7)\n if (this.proximate) {\n return options.align.charAt(0) + 'tv';\n }\n return options.floating ? '' : (options.align.charAt(0) +\n options.verticalAlign.charAt(0) +\n options.layout.charAt(0));\n }\n /**\n * Adjust the chart margins by reserving space for the legend on only one\n * side of the chart. If the position is set to a corner, top or bottom is\n * reserved for horizontal legends and left or right for vertical ones.\n *\n * @private\n * @function Highcharts.Legend#adjustMargins\n * @param {Array} margin\n * @param {Array} spacing\n */\n adjustMargins(margin, spacing) {\n const chart = this.chart, options = this.options, alignment = this.getAlignment();\n if (alignment) {\n ([\n /(lth|ct|rth)/,\n /(rtv|rm|rbv)/,\n /(rbh|cb|lbh)/,\n /(lbv|lm|ltv)/\n ]).forEach(function (alignments, side) {\n if (alignments.test(alignment) && !defined(margin[side])) {\n // Now we have detected on which side of the chart we should\n // reserve space for the legend\n chart[marginNames[side]] = Math.max(chart[marginNames[side]], (chart.legend[(side + 1) % 2 ? 'legendHeight' : 'legendWidth'] +\n [1, -1, -1, 1][side] * options[(side % 2) ? 'x' : 'y'] +\n pick(options.margin, 12) +\n spacing[side] +\n (chart.titleOffset[side] || 0)));\n }\n });\n }\n }\n /**\n * @private\n * @function Highcharts.Legend#proximatePositions\n */\n proximatePositions() {\n const chart = this.chart, boxes = [], alignLeft = this.options.align === 'left';\n this.allItems.forEach(function (item) {\n let lastPoint, height, useFirstPoint = alignLeft, target, top;\n if (item.yAxis) {\n if (item.xAxis.options.reversed) {\n useFirstPoint = !useFirstPoint;\n }\n if (item.points) {\n lastPoint = find(useFirstPoint ?\n item.points :\n item.points.slice(0).reverse(), function (item) {\n return isNumber(item.plotY);\n });\n }\n height = this.itemMarginTop +\n item.legendItem.label.getBBox().height +\n this.itemMarginBottom;\n top = item.yAxis.top - chart.plotTop;\n if (item.visible) {\n target = lastPoint ?\n lastPoint.plotY :\n item.yAxis.height;\n target += top - 0.3 * height;\n }\n else {\n target = top + item.yAxis.height;\n }\n boxes.push({\n target: target,\n size: height,\n item\n });\n }\n }, this);\n let legendItem;\n for (const box of distribute(boxes, chart.plotHeight)) {\n legendItem = box.item.legendItem || {};\n if (isNumber(box.pos)) {\n legendItem.y = chart.plotTop - chart.spacing[0] + box.pos;\n }\n }\n }\n /**\n * Render the legend. This method can be called both before and after\n * `chart.render`. If called after, it will only rearrange items instead\n * of creating new ones. Called internally on initial render and after\n * redraws.\n *\n * @private\n * @function Highcharts.Legend#render\n */\n render() {\n const legend = this, chart = legend.chart, renderer = chart.renderer, options = legend.options, padding = legend.padding, \n // add each series or point\n allItems = legend.getAllItems();\n let display, legendWidth, legendHeight, legendGroup = legend.group, allowedWidth, box = legend.box;\n legend.itemX = padding;\n legend.itemY = legend.initialItemY;\n legend.offsetWidth = 0;\n legend.lastItemY = 0;\n legend.widthOption = relativeLength(options.width, chart.spacingBox.width - padding);\n // Compute how wide the legend is allowed to be\n allowedWidth = chart.spacingBox.width - 2 * padding - options.x;\n if (['rm', 'lm'].indexOf(legend.getAlignment().substring(0, 2)) > -1) {\n allowedWidth /= 2;\n }\n legend.maxLegendWidth = legend.widthOption || allowedWidth;\n if (!legendGroup) {\n /**\n * SVG group of the legend.\n *\n * @readonly\n * @name Highcharts.Legend#group\n * @type {Highcharts.SVGElement}\n */\n legend.group = legendGroup = renderer\n .g('legend')\n .addClass(options.className || '')\n .attr({ zIndex: 7 })\n .add();\n legend.contentGroup = renderer\n .g()\n .attr({ zIndex: 1 }) // above background\n .add(legendGroup);\n legend.scrollGroup = renderer\n .g()\n .add(legend.contentGroup);\n }\n legend.renderTitle();\n // sort by legendIndex\n stableSort(allItems, (a, b) => ((a.options && a.options.legendIndex) || 0) -\n ((b.options && b.options.legendIndex) || 0));\n // reversed legend\n if (options.reversed) {\n allItems.reverse();\n }\n /**\n * All items for the legend, which is an array of series for most series\n * and an array of points for pie series and its derivatives.\n *\n * @readonly\n * @name Highcharts.Legend#allItems\n * @type {Array<(Highcharts.Point|Highcharts.Series)>}\n */\n legend.allItems = allItems;\n legend.display = display = !!allItems.length;\n // Render the items. First we run a loop to set the text and properties\n // and read all the bounding boxes. The next loop computes the item\n // positions based on the bounding boxes.\n legend.lastLineHeight = 0;\n legend.maxItemWidth = 0;\n legend.totalItemWidth = 0;\n legend.itemHeight = 0;\n allItems.forEach(legend.renderItem, legend);\n allItems.forEach(legend.layoutItem, legend);\n // Get the box\n legendWidth = (legend.widthOption || legend.offsetWidth) + padding;\n legendHeight = legend.lastItemY + legend.lastLineHeight +\n legend.titleHeight;\n legendHeight = legend.handleOverflow(legendHeight);\n legendHeight += padding;\n // Draw the border and/or background\n if (!box) {\n /**\n * SVG element of the legend box.\n *\n * @readonly\n * @name Highcharts.Legend#box\n * @type {Highcharts.SVGElement}\n */\n legend.box = box = renderer.rect()\n .addClass('highcharts-legend-box')\n .attr({\n r: options.borderRadius\n })\n .add(legendGroup);\n }\n // Presentational\n if (!chart.styledMode) {\n box\n .attr({\n stroke: options.borderColor,\n 'stroke-width': options.borderWidth || 0,\n fill: options.backgroundColor || 'none'\n })\n .shadow(options.shadow);\n }\n if (legendWidth > 0 && legendHeight > 0) {\n box[box.placed ? 'animate' : 'attr'](box.crisp.call({}, {\n x: 0,\n y: 0,\n width: legendWidth,\n height: legendHeight\n }, box.strokeWidth()));\n }\n // hide the border if no items\n legendGroup[display ? 'show' : 'hide']();\n // Open for responsiveness\n if (chart.styledMode && legendGroup.getStyle('display') === 'none') {\n legendWidth = legendHeight = 0;\n }\n legend.legendWidth = legendWidth;\n legend.legendHeight = legendHeight;\n if (display) {\n legend.align();\n }\n if (!this.proximate) {\n this.positionItems();\n }\n fireEvent(this, 'afterRender');\n }\n /**\n * Align the legend to chart's box.\n *\n * @private\n * @function Highcharts.align\n * @param {Highcharts.BBoxObject} alignTo\n */\n align(alignTo = this.chart.spacingBox) {\n const chart = this.chart, options = this.options;\n // If aligning to the top and the layout is horizontal, adjust for\n // the title (#7428)\n let y = alignTo.y;\n if (/(lth|ct|rth)/.test(this.getAlignment()) &&\n chart.titleOffset[0] > 0) {\n y += chart.titleOffset[0];\n }\n else if (/(lbh|cb|rbh)/.test(this.getAlignment()) &&\n chart.titleOffset[2] > 0) {\n y -= chart.titleOffset[2];\n }\n if (y !== alignTo.y) {\n alignTo = merge(alignTo, { y });\n }\n if (!chart.hasRendered) {\n // Avoid animation when adjusting alignment for responsiveness and\n // colorAxis label layout\n this.group.placed = false;\n }\n this.group.align(merge(options, {\n width: this.legendWidth,\n height: this.legendHeight,\n verticalAlign: this.proximate ? 'top' : options.verticalAlign\n }), true, alignTo);\n }\n /**\n * Set up the overflow handling by adding navigation with up and down arrows\n * below the legend.\n *\n * @private\n * @function Highcharts.Legend#handleOverflow\n */\n handleOverflow(legendHeight) {\n const legend = this, chart = this.chart, renderer = chart.renderer, options = this.options, optionsY = options.y, alignTop = options.verticalAlign === 'top', padding = this.padding, maxHeight = options.maxHeight, navOptions = options.navigation, animation = pick(navOptions.animation, true), arrowSize = navOptions.arrowSize || 12, pages = this.pages, allItems = this.allItems, clipToHeight = function (height) {\n if (typeof height === 'number') {\n clipRect.attr({\n height: height\n });\n }\n else if (clipRect) { // Reset (#5912)\n legend.clipRect = clipRect.destroy();\n legend.contentGroup.clip();\n }\n // useHTML\n if (legend.contentGroup.div) {\n legend.contentGroup.div.style.clip = height ?\n 'rect(' + padding + 'px,9999px,' +\n (padding + height) + 'px,0)' :\n 'auto';\n }\n }, addTracker = function (key) {\n legend[key] = renderer\n .circle(0, 0, arrowSize * 1.3)\n .translate(arrowSize / 2, arrowSize / 2)\n .add(nav);\n if (!chart.styledMode) {\n legend[key].attr('fill', 'rgba(0,0,0,0.0001)');\n }\n return legend[key];\n };\n let clipHeight, lastY, legendItem, spaceHeight = (chart.spacingBox.height +\n (alignTop ? -optionsY : optionsY) - padding), nav = this.nav, clipRect = this.clipRect;\n // Adjust the height\n if (options.layout === 'horizontal' &&\n options.verticalAlign !== 'middle' &&\n !options.floating) {\n spaceHeight /= 2;\n }\n if (maxHeight) {\n spaceHeight = Math.min(spaceHeight, maxHeight);\n }\n // Reset the legend height and adjust the clipping rectangle\n pages.length = 0;\n if (legendHeight &&\n spaceHeight > 0 &&\n legendHeight > spaceHeight &&\n navOptions.enabled !== false) {\n this.clipHeight = clipHeight =\n Math.max(spaceHeight - 20 - this.titleHeight - padding, 0);\n this.currentPage = pick(this.currentPage, 1);\n this.fullHeight = legendHeight;\n // Fill pages with Y positions so that the top of each a legend item\n // defines the scroll top for each page (#2098)\n allItems.forEach((item, i) => {\n legendItem = item.legendItem || {};\n const y = legendItem.y || 0, h = Math.round(legendItem.label.getBBox().height);\n let len = pages.length;\n if (!len || (y - pages[len - 1] > clipHeight &&\n (lastY || y) !== pages[len - 1])) {\n pages.push(lastY || y);\n len++;\n }\n // Keep track of which page each item is on\n legendItem.pageIx = len - 1;\n if (lastY) {\n (allItems[i - 1].legendItem || {}).pageIx = len - 1;\n }\n // add the last page if needed (#2617, #13683)\n if (\n // check the last item\n i === allItems.length - 1 &&\n // if adding next page is needed (#18768)\n y + h - pages[len - 1] > clipHeight &&\n y > pages[len - 1]) {\n pages.push(y);\n legendItem.pageIx = len;\n }\n if (y !== lastY) {\n lastY = y;\n }\n });\n // Only apply clipping if needed. Clipping causes blurred legend in\n // PDF export (#1787)\n if (!clipRect) {\n clipRect = legend.clipRect =\n renderer.clipRect(0, padding - 2, 9999, 0);\n legend.contentGroup.clip(clipRect);\n }\n clipToHeight(clipHeight);\n // Add navigation elements\n if (!nav) {\n this.nav = nav = renderer.g()\n .attr({ zIndex: 1 })\n .add(this.group);\n this.up = renderer\n .symbol('triangle', 0, 0, arrowSize, arrowSize)\n .add(nav);\n addTracker('upTracker')\n .on('click', function () {\n legend.scroll(-1, animation);\n });\n this.pager = renderer.text('', 15, 10)\n .addClass('highcharts-legend-navigation');\n if (!chart.styledMode && navOptions.style) {\n this.pager.css(navOptions.style);\n }\n this.pager.add(nav);\n this.down = renderer\n .symbol('triangle-down', 0, 0, arrowSize, arrowSize)\n .add(nav);\n addTracker('downTracker')\n .on('click', function () {\n legend.scroll(1, animation);\n });\n }\n // Set initial position\n legend.scroll(0);\n legendHeight = spaceHeight;\n // Reset\n }\n else if (nav) {\n clipToHeight();\n this.nav = nav.destroy(); // #6322\n this.scrollGroup.attr({\n translateY: 1\n });\n this.clipHeight = 0; // #1379\n }\n return legendHeight;\n }\n /**\n * Scroll the legend by a number of pages.\n *\n * @private\n * @function Highcharts.Legend#scroll\n *\n * @param {number} scrollBy\n * The number of pages to scroll.\n *\n * @param {boolean|Partial} [animation]\n * Whether and how to apply animation.\n *\n */\n scroll(scrollBy, animation) {\n const chart = this.chart, pages = this.pages, pageCount = pages.length, clipHeight = this.clipHeight, navOptions = this.options.navigation, pager = this.pager, padding = this.padding;\n let currentPage = this.currentPage + scrollBy;\n // When resizing while looking at the last page\n if (currentPage > pageCount) {\n currentPage = pageCount;\n }\n if (currentPage > 0) {\n if (typeof animation !== 'undefined') {\n setAnimation(animation, chart);\n }\n this.nav.attr({\n translateX: padding,\n translateY: clipHeight + this.padding + 7 + this.titleHeight,\n visibility: 'inherit'\n });\n [this.up, this.upTracker].forEach(function (elem) {\n elem.attr({\n 'class': currentPage === 1 ?\n 'highcharts-legend-nav-inactive' :\n 'highcharts-legend-nav-active'\n });\n });\n pager.attr({\n text: currentPage + '/' + pageCount\n });\n [this.down, this.downTracker].forEach(function (elem) {\n elem.attr({\n // adjust to text width\n x: 18 + this.pager.getBBox().width,\n 'class': currentPage === pageCount ?\n 'highcharts-legend-nav-inactive' :\n 'highcharts-legend-nav-active'\n });\n }, this);\n if (!chart.styledMode) {\n this.up\n .attr({\n fill: currentPage === 1 ?\n navOptions.inactiveColor :\n navOptions.activeColor\n });\n this.upTracker\n .css({\n cursor: currentPage === 1 ? 'default' : 'pointer'\n });\n this.down\n .attr({\n fill: currentPage === pageCount ?\n navOptions.inactiveColor :\n navOptions.activeColor\n });\n this.downTracker\n .css({\n cursor: currentPage === pageCount ?\n 'default' :\n 'pointer'\n });\n }\n this.scrollOffset = -pages[currentPage - 1] + this.initialItemY;\n this.scrollGroup.animate({\n translateY: this.scrollOffset\n });\n this.currentPage = currentPage;\n this.positionCheckboxes();\n // Fire event after scroll animation is complete\n const animOptions = animObject(pick(animation, chart.renderer.globalAnimation, true));\n syncTimeout(() => {\n fireEvent(this, 'afterScroll', { currentPage });\n }, animOptions.duration);\n }\n }\n /**\n * @private\n * @function Highcharts.Legend#setItemEvents\n * @param {Highcharts.BubbleLegendItem|Point|Highcharts.Series} item\n * @param {Highcharts.SVGElement} legendLabel\n * @param {boolean} [useHTML=false]\n * @emits Highcharts.Point#event:legendItemClick\n * @emits Highcharts.Series#event:legendItemClick\n */\n setItemEvents(item, legendLabel, useHTML) {\n const legend = this, legendItem = item.legendItem || {}, boxWrapper = legend.chart.renderer.boxWrapper, isPoint = item instanceof Point, activeClass = 'highcharts-legend-' +\n (isPoint ? 'point' : 'series') + '-active', styledMode = legend.chart.styledMode, \n // When `useHTML`, the symbol is rendered in other group, so\n // we need to apply events listeners to both places\n legendElements = useHTML ?\n [legendLabel, legendItem.symbol] :\n [legendItem.group];\n const setOtherItemsState = (state) => {\n legend.allItems.forEach((otherItem) => {\n if (item !== otherItem) {\n [otherItem]\n .concat(otherItem.linkedSeries || [])\n .forEach((otherItem) => {\n otherItem.setState(state, !isPoint);\n });\n }\n });\n };\n // Set the events on the item group, or in case of useHTML, the item\n // itself (#1249)\n for (const element of legendElements) {\n if (element) {\n element\n .on('mouseover', function () {\n if (item.visible) {\n setOtherItemsState('inactive');\n }\n item.setState('hover');\n // A CSS class to dim or hide other than the hovered\n // series.\n // Works only if hovered series is visible (#10071).\n if (item.visible) {\n boxWrapper.addClass(activeClass);\n }\n if (!styledMode) {\n legendLabel.css(legend.options.itemHoverStyle);\n }\n })\n .on('mouseout', function () {\n if (!legend.chart.styledMode) {\n legendLabel.css(merge(item.visible ?\n legend.itemStyle :\n legend.itemHiddenStyle));\n }\n setOtherItemsState('');\n // A CSS class to dim or hide other than the hovered\n // series.\n boxWrapper.removeClass(activeClass);\n item.setState();\n })\n .on('click', function (event) {\n const strLegendItemClick = 'legendItemClick', fnLegendItemClick = function () {\n if (item.setVisible) {\n item.setVisible();\n }\n // Reset inactive state\n setOtherItemsState(item.visible ? 'inactive' : '');\n };\n // A CSS class to dim or hide other than the hovered\n // series. Event handling in iOS causes the activeClass\n // to be added prior to click in some cases (#7418).\n boxWrapper.removeClass(activeClass);\n // Pass over the click/touch event. #4.\n event = {\n browserEvent: event\n };\n // click the name or symbol\n if (item.firePointEvent) { // point\n item.firePointEvent(strLegendItemClick, event, fnLegendItemClick);\n }\n else {\n fireEvent(item, strLegendItemClick, event, fnLegendItemClick);\n }\n });\n }\n }\n }\n /**\n * @private\n * @function Highcharts.Legend#createCheckboxForItem\n * @param {Highcharts.BubbleLegendItem|Point|Highcharts.Series} item\n * @emits Highcharts.Series#event:checkboxClick\n */\n createCheckboxForItem(item) {\n const legend = this;\n item.checkbox = createElement('input', {\n type: 'checkbox',\n className: 'highcharts-legend-checkbox',\n checked: item.selected,\n defaultChecked: item.selected // required by IE7\n }, legend.options.itemCheckboxStyle, legend.chart.container);\n addEvent(item.checkbox, 'click', function (event) {\n const target = event.target;\n fireEvent(item.series || item, 'checkboxClick', {\n checked: target.checked,\n item: item\n }, function () {\n item.select();\n });\n });\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (Legend) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(ChartClass) {\n if (pushUnique(composed, 'Core.Legend')) {\n addEvent(ChartClass, 'beforeMargins', function () {\n /**\n * The legend contains an interactive overview over chart items,\n * usually individual series or points depending on the series\n * type. The color axis and bubble legend are also rendered in\n * the chart legend.\n *\n * @name Highcharts.Chart#legend\n * @type {Highcharts.Legend}\n */\n this.legend = new Legend(this, this.options.legend);\n });\n }\n }\n Legend.compose = compose;\n})(Legend || (Legend = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default Legend;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * @interface Highcharts.LegendItemObject\n */ /**\n* @name Highcharts.LegendItemObject#item\n* @type {Highcharts.SVGElement|undefined}\n*/ /**\n* @name Highcharts.LegendItemObject#line\n* @type {Highcharts.SVGElement|undefined}\n*/ /**\n* @name Highcharts.LegendItemObject#symbol\n* @type {Highcharts.SVGElement|undefined}\n*/\n/**\n * Gets fired when the legend item belonging to a point is clicked. The default\n * action is to toggle the visibility of the point. This can be prevented by\n * returning `false` or calling `event.preventDefault()`.\n *\n * @callback Highcharts.PointLegendItemClickCallbackFunction\n *\n * @param {Highcharts.Point} this\n * The point on which the event occurred.\n *\n * @param {Highcharts.PointLegendItemClickEventObject} event\n * The event that occurred.\n */\n/**\n * Information about the legend click event.\n *\n * @interface Highcharts.PointLegendItemClickEventObject\n */ /**\n* Related browser event.\n* @name Highcharts.PointLegendItemClickEventObject#browserEvent\n* @type {Highcharts.PointerEvent}\n*/ /**\n* Prevent the default action of toggle the visibility of the point.\n* @name Highcharts.PointLegendItemClickEventObject#preventDefault\n* @type {Function}\n*/ /**\n* Related point.\n* @name Highcharts.PointLegendItemClickEventObject#target\n* @type {Highcharts.Point}\n*/ /**\n* Event type.\n* @name Highcharts.PointLegendItemClickEventObject#type\n* @type {\"legendItemClick\"}\n*/\n/**\n * Series color as used by the legend and some series types.\n * @name Highcharts.Series#color\n * @type {Highcharts.ColorType|undefined}\n */ /**\n* Legend data for the series.\n* @name Highcharts.Series#legendItem\n* @type {Highcharts.LegendItemObject|undefined}\n* @since 10.3.0\n*/\n/**\n * Gets fired when the legend item belonging to a series is clicked. The default\n * action is to toggle the visibility of the series. This can be prevented by\n * returning `false` or calling `event.preventDefault()`.\n *\n * @callback Highcharts.SeriesLegendItemClickCallbackFunction\n *\n * @param {Highcharts.Series} this\n * The series where the event occurred.\n *\n * @param {Highcharts.SeriesLegendItemClickEventObject} event\n * The event that occurred.\n */\n/**\n * Information about the legend click event.\n *\n * @interface Highcharts.SeriesLegendItemClickEventObject\n */ /**\n* Related browser event.\n* @name Highcharts.SeriesLegendItemClickEventObject#browserEvent\n* @type {Highcharts.PointerEvent}\n*/ /**\n* Prevent the default action of toggle the visibility of the series.\n* @name Highcharts.SeriesLegendItemClickEventObject#preventDefault\n* @type {Function}\n*/ /**\n* Related series.\n* @name Highcharts.SeriesLegendItemClickEventObject#target\n* @type {Highcharts.Series}\n*/ /**\n* Event type.\n* @name Highcharts.SeriesLegendItemClickEventObject#type\n* @type {\"legendItemClick\"}\n*/\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../Utilities.js';\nconst { extend, merge, pick } = U;\n/* *\n *\n * Namespace\n *\n * */\nvar LegendSymbol;\n(function (LegendSymbol) {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Draw a line, a point marker and an area in the legend.\n *\n * @private\n * @function Highcharts.LegendSymbolMixin.areaMarker\n *\n * @param {Highcharts.Legend} legend\n * The legend object.\n */\n function areaMarker(legend, item) {\n lineMarker.call(this, legend, item, true);\n }\n LegendSymbol.areaMarker = areaMarker;\n /**\n * Draw a line and a point marker in the legend.\n *\n * @private\n * @function Highcharts.LegendSymbolMixin.lineMarker\n *\n * @param {Highcharts.Legend} legend\n * The legend object.\n */\n function lineMarker(legend, item, hasArea) {\n const legendItem = this.legendItem = this.legendItem || {}, { chart, options } = this, { baseline = 0, symbolWidth, symbolHeight } = legend, symbol = this.symbol || 'circle', generalRadius = symbolHeight / 2, renderer = chart.renderer, legendItemGroup = legendItem.group, verticalCenter = baseline - Math.round(symbolHeight *\n // Render line and marker slightly higher to make room for the\n // area\n (hasArea ? 0.4 : 0.3)), attr = {};\n let legendSymbol, markerOptions = options.marker, lineSizer = 0;\n // Draw the line\n if (!chart.styledMode) {\n attr['stroke-width'] = Math.min(options.lineWidth || 0, 24);\n if (options.dashStyle) {\n attr.dashstyle = options.dashStyle;\n }\n else if (options.linecap !== 'square') {\n attr['stroke-linecap'] = 'round';\n }\n }\n legendItem.line = renderer\n .path()\n .addClass('highcharts-graph')\n .attr(attr)\n .add(legendItemGroup);\n if (hasArea) {\n legendItem.area = renderer\n .path()\n .addClass('highcharts-area')\n .add(legendItemGroup);\n }\n if (attr['stroke-linecap']) {\n lineSizer = Math.min(legendItem.line.strokeWidth(), symbolWidth) / 2;\n }\n if (symbolWidth) {\n const d = [\n ['M', lineSizer, verticalCenter],\n ['L', symbolWidth - lineSizer, verticalCenter]\n ];\n legendItem.line.attr({ d });\n legendItem.area?.attr({\n d: [\n ...d,\n ['L', symbolWidth - lineSizer, baseline],\n ['L', lineSizer, baseline]\n ]\n });\n }\n // Draw the marker\n if (markerOptions && markerOptions.enabled !== false && symbolWidth) {\n // Do not allow the marker to be larger than the symbolHeight\n let radius = Math.min(pick(markerOptions.radius, generalRadius), generalRadius);\n // Restrict symbol markers size\n if (symbol.indexOf('url') === 0) {\n markerOptions = merge(markerOptions, {\n width: symbolHeight,\n height: symbolHeight\n });\n radius = 0;\n }\n legendItem.symbol = legendSymbol = renderer\n .symbol(symbol, (symbolWidth / 2) - radius, verticalCenter - radius, 2 * radius, 2 * radius, extend({ context: 'legend' }, markerOptions))\n .addClass('highcharts-point')\n .add(legendItemGroup);\n legendSymbol.isMarker = true;\n }\n }\n LegendSymbol.lineMarker = lineMarker;\n /**\n * Get the series' symbol in the legend.\n *\n * This method should be overridable to create custom symbols through\n * Highcharts.seriesTypes[type].prototype.drawLegendSymbol.\n *\n * @private\n * @function Highcharts.LegendSymbolMixin.rectangle\n *\n * @param {Highcharts.Legend} legend\n * The legend object\n *\n * @param {Highcharts.Point|Highcharts.Series} item\n * The series (this) or point\n */\n function rectangle(legend, item) {\n const legendItem = item.legendItem || {}, options = legend.options, symbolHeight = legend.symbolHeight, square = options.squareSymbol, symbolWidth = square ? symbolHeight : legend.symbolWidth;\n legendItem.symbol = this.chart.renderer\n .rect(square ? (legend.symbolWidth - symbolHeight) / 2 : 0, legend.baseline - symbolHeight + 1, // #3988\n symbolWidth, symbolHeight, pick(legend.options.symbolRadius, symbolHeight / 2))\n .addClass('highcharts-point')\n .attr({\n zIndex: 3\n })\n .add(legendItem.group);\n }\n LegendSymbol.rectangle = rectangle;\n})(LegendSymbol || (LegendSymbol = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default LegendSymbol;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * General options for all series types.\n *\n * @optionparent plotOptions.series\n */\nconst seriesDefaults = {\n // base series options\n /**\n * The SVG value used for the `stroke-linecap` and `stroke-linejoin`\n * of a line graph. Round means that lines are rounded in the ends and\n * bends.\n *\n * @type {Highcharts.SeriesLinecapValue}\n * @default round\n * @since 3.0.7\n * @apioption plotOptions.line.linecap\n */\n /**\n * Pixel width of the graph line.\n *\n * @see In styled mode, the line stroke-width can be set with the\n * `.highcharts-graph` class name.\n *\n * @sample {highcharts} highcharts/plotoptions/series-linewidth-general/\n * On all series\n * @sample {highcharts} highcharts/plotoptions/series-linewidth-specific/\n * On one single series\n *\n * @product highcharts highstock\n */\n lineWidth: 2,\n /**\n * For some series, there is a limit that shuts down animation\n * by default when the total number of points in the chart is too high.\n * For example, for a column chart and its derivatives, animation does\n * not run if there is more than 250 points totally. To disable this\n * cap, set `animationLimit` to `Infinity`. This option works if animation\n * is fired on individual points, not on a group of points like e.g. during\n * the initial animation.\n *\n * @sample {highcharts} highcharts/plotoptions/series-animationlimit/\n * Animation limit on updating individual points\n *\n * @type {number}\n * @apioption plotOptions.series.animationLimit\n */\n /**\n * Allow this series' points to be selected by clicking on the graphic\n * (columns, point markers, pie slices, map areas etc).\n *\n * The selected points can be handled by point select and unselect\n * events, or collectively by the [getSelectedPoints\n * ](/class-reference/Highcharts.Chart#getSelectedPoints) function.\n *\n * And alternative way of selecting points is through dragging.\n *\n * @sample {highcharts} highcharts/plotoptions/series-allowpointselect-line/\n * Line\n * @sample {highcharts} highcharts/plotoptions/series-allowpointselect-column/\n * Column\n * @sample {highcharts} highcharts/plotoptions/series-allowpointselect-pie/\n * Pie\n * @sample {highcharts} highcharts/chart/events-selection-points/\n * Select a range of points through a drag selection\n * @sample {highmaps} maps/plotoptions/series-allowpointselect/\n * Map area\n * @sample {highmaps} maps/plotoptions/mapbubble-allowpointselect/\n * Map bubble\n *\n * @since 1.2.0\n *\n * @private\n */\n allowPointSelect: false,\n /**\n * When true, each point or column edge is rounded to its nearest pixel\n * in order to render sharp on screen. In some cases, when there are a\n * lot of densely packed columns, this leads to visible difference\n * in column widths or distance between columns. In these cases,\n * setting `crisp` to `false` may look better, even though each column\n * is rendered blurry.\n *\n * @sample {highcharts} highcharts/plotoptions/column-crisp-false/\n * Crisp is false\n *\n * @since 5.0.10\n * @product highcharts highstock gantt\n *\n * @private\n */\n crisp: true,\n /**\n * If true, a checkbox is displayed next to the legend item to allow\n * selecting the series. The state of the checkbox is determined by\n * the `selected` option.\n *\n * @productdesc {highmaps}\n * Note that if a `colorAxis` is defined, the color axis is represented\n * in the legend, not the series.\n *\n * @sample {highcharts} highcharts/plotoptions/series-showcheckbox-true/\n * Show select box\n *\n * @since 1.2.0\n *\n * @private\n */\n showCheckbox: false,\n /**\n * Enable or disable the initial animation when a series is displayed.\n * The animation can also be set as a configuration object. Please\n * note that this option only applies to the initial animation of the\n * series itself. For other animations, see [chart.animation](\n * #chart.animation) and the animation parameter under the API methods.\n * The following properties are supported:\n *\n * - `defer`: The animation delay time in milliseconds.\n *\n * - `duration`: The duration of the animation in milliseconds. (Defaults to\n * `1000`)\n *\n * - `easing`: Can be a string reference to an easing function set on\n * the `Math` object or a function. See the _Custom easing function_\n * demo below. (Defaults to `easeInOutSine`)\n *\n * Due to poor performance, animation is disabled in old IE browsers\n * for several chart types.\n *\n * @sample {highcharts} highcharts/plotoptions/series-animation-disabled/\n * Animation disabled\n * @sample {highcharts} highcharts/plotoptions/series-animation-slower/\n * Slower animation\n * @sample {highcharts} highcharts/plotoptions/series-animation-easing/\n * Custom easing function\n * @sample {highstock} stock/plotoptions/animation-slower/\n * Slower animation\n * @sample {highstock} stock/plotoptions/animation-easing/\n * Custom easing function\n * @sample {highmaps} maps/plotoptions/series-animation-true/\n * Animation enabled on map series\n * @sample {highmaps} maps/plotoptions/mapbubble-animation-false/\n * Disabled on mapbubble series\n *\n * @type {boolean|Highcharts.AnimationOptionsObject}\n * @default {highcharts} true\n * @default {highstock} true\n * @default {highmaps} false\n *\n * @private\n */\n animation: {\n /** @ignore-option */\n duration: 1000\n },\n /**\n * An additional class name to apply to the series' graphical elements.\n * This option does not replace default class names of the graphical\n * element. Changes to the series' color will also be reflected in a\n * chart's legend and tooltip.\n *\n * @sample {highcharts} highcharts/css/point-series-classname\n * Series and point class name\n *\n * @type {string}\n * @since 5.0.0\n * @apioption plotOptions.series.className\n */\n /**\n * Disable this option to allow series rendering in the whole plotting\n * area.\n *\n * **Note:** Clipping should be always enabled when\n * [chart.zoomType](#chart.zoomType) is set\n *\n * @sample {highcharts} highcharts/plotoptions/series-clip/\n * Disabled clipping\n *\n * @default true\n * @type {boolean}\n * @since 3.0.0\n * @apioption plotOptions.series.clip\n */\n /**\n * The main color of the series. In line type series it applies to the\n * line and the point markers unless otherwise specified. In bar type\n * series it applies to the bars unless a color is specified per point.\n * The default value is pulled from the `options.colors` array.\n *\n * In styled mode, the color can be defined by the\n * [colorIndex](#plotOptions.series.colorIndex) option. Also, the series\n * color can be set with the `.highcharts-series`,\n * `.highcharts-color-{n}`, `.highcharts-{type}-series` or\n * `.highcharts-series-{n}` class, or individual classes given by the\n * `className` option.\n *\n * @productdesc {highmaps}\n * In maps, the series color is rarely used, as most choropleth maps use\n * the color to denote the value of each point. The series color can\n * however be used in a map with multiple series holding categorized\n * data.\n *\n * @sample {highcharts} highcharts/plotoptions/series-color-general/\n * General plot option\n * @sample {highcharts} highcharts/plotoptions/series-color-specific/\n * One specific series\n * @sample {highcharts} highcharts/plotoptions/series-color-area/\n * Area color\n * @sample {highcharts} highcharts/series/infographic/\n * Pattern fill\n * @sample {highmaps} maps/demo/category-map/\n * Category map by multiple series\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption plotOptions.series.color\n */\n /**\n * Styled mode only. A specific color index to use for the series, so its\n * graphic representations are given the class name `highcharts-color-{n}`.\n *\n * Since v11, CSS variables on the form `--highcharts-color-{n}` make\n * changing the color scheme very convenient.\n *\n * @sample {highcharts} highcharts/css/colorindex/ Series and point color\n * index\n *\n * @type {number}\n * @since 5.0.0\n * @apioption plotOptions.series.colorIndex\n */\n /**\n * Whether to connect a graph line across null points, or render a gap\n * between the two points on either side of the null.\n *\n * In stacked area chart, if `connectNulls` is set to true,\n * null points are interpreted as 0.\n *\n * @sample {highcharts} highcharts/plotoptions/series-connectnulls-false/\n * False by default\n * @sample {highcharts} highcharts/plotoptions/series-connectnulls-true/\n * True\n *\n * @type {boolean}\n * @default false\n * @product highcharts highstock\n * @apioption plotOptions.series.connectNulls\n */\n /**\n * You can set the cursor to \"pointer\" if you have click events attached\n * to the series, to signal to the user that the points and lines can\n * be clicked.\n *\n * In styled mode, the series cursor can be set with the same classes\n * as listed under [series.color](#plotOptions.series.color).\n *\n * @sample {highcharts} highcharts/plotoptions/series-cursor-line/\n * On line graph\n * @sample {highcharts} highcharts/plotoptions/series-cursor-column/\n * On columns\n * @sample {highcharts} highcharts/plotoptions/series-cursor-scatter/\n * On scatter markers\n * @sample {highstock} stock/plotoptions/cursor/\n * Pointer on a line graph\n * @sample {highmaps} maps/plotoptions/series-allowpointselect/\n * Map area\n * @sample {highmaps} maps/plotoptions/mapbubble-allowpointselect/\n * Map bubble\n *\n * @type {string|Highcharts.CursorValue}\n * @apioption plotOptions.series.cursor\n */\n /**\n * A reserved subspace to store options and values for customized\n * functionality. Here you can add additional data for your own event\n * callbacks and formatter callbacks.\n *\n * @sample {highcharts} highcharts/point/custom/\n * Point and series with custom data\n *\n * @type {Highcharts.Dictionary<*>}\n * @apioption plotOptions.series.custom\n */\n /**\n * Name of the dash style to use for the graph, or for some series types\n * the outline of each shape.\n *\n * In styled mode, the\n * [stroke dash-array](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/css/series-dashstyle/)\n * can be set with the same classes as listed under\n * [series.color](#plotOptions.series.color).\n *\n * @sample {highcharts} highcharts/plotoptions/series-dashstyle-all/\n * Possible values demonstrated\n * @sample {highcharts} highcharts/plotoptions/series-dashstyle/\n * Chart suitable for printing in black and white\n * @sample {highstock} highcharts/plotoptions/series-dashstyle-all/\n * Possible values demonstrated\n * @sample {highmaps} highcharts/plotoptions/series-dashstyle-all/\n * Possible values demonstrated\n * @sample {highmaps} maps/plotoptions/series-dashstyle/\n * Dotted borders on a map\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 2.1\n * @apioption plotOptions.series.dashStyle\n */\n /**\n * A description of the series to add to the screen reader information\n * about the series.\n *\n * @type {string}\n * @since 5.0.0\n * @requires modules/accessibility\n * @apioption plotOptions.series.description\n */\n /**\n * Options for the series data sorting.\n *\n * @type {Highcharts.DataSortingOptionsObject}\n * @since 8.0.0\n * @product highcharts highstock\n * @apioption plotOptions.series.dataSorting\n */\n /**\n * Enable or disable data sorting for the series. Use [xAxis.reversed](\n * #xAxis.reversed) to change the sorting order.\n *\n * @sample {highcharts} highcharts/datasorting/animation/\n * Data sorting in scatter-3d\n * @sample {highcharts} highcharts/datasorting/labels-animation/\n * Axis labels animation\n * @sample {highcharts} highcharts/datasorting/dependent-sorting/\n * Dependent series sorting\n * @sample {highcharts} highcharts/datasorting/independent-sorting/\n * Independent series sorting\n *\n * @type {boolean}\n * @since 8.0.0\n * @apioption plotOptions.series.dataSorting.enabled\n */\n /**\n * Whether to allow matching points by name in an update. If this option\n * is disabled, points will be matched by order.\n *\n * @sample {highcharts} highcharts/datasorting/match-by-name/\n * Enabled match by name\n *\n * @type {boolean}\n * @since 8.0.0\n * @apioption plotOptions.series.dataSorting.matchByName\n */\n /**\n * Determines what data value should be used to sort by.\n *\n * @sample {highcharts} highcharts/datasorting/sort-key/\n * Sort key as `z` value\n *\n * @type {string}\n * @since 8.0.0\n * @default y\n * @apioption plotOptions.series.dataSorting.sortKey\n */\n /**\n * Enable or disable the mouse tracking for a specific series. This\n * includes point tooltips and click events on graphs and points. For\n * large datasets it improves performance.\n *\n * @sample {highcharts} highcharts/plotoptions/series-enablemousetracking-false/\n * No mouse tracking\n * @sample {highmaps} maps/plotoptions/series-enablemousetracking-false/\n * No mouse tracking\n *\n * @type {boolean}\n * @default true\n * @apioption plotOptions.series.enableMouseTracking\n */\n enableMouseTracking: true,\n /**\n * Whether to use the Y extremes of the total chart width or only the\n * zoomed area when zooming in on parts of the X axis. By default, the\n * Y axis adjusts to the min and max of the visible data. Cartesian\n * series only.\n *\n * @type {boolean}\n * @default false\n * @since 4.1.6\n * @product highcharts highstock gantt\n * @apioption plotOptions.series.getExtremesFromAll\n */\n /**\n * Highlight only the hovered point and fade the remaining points.\n *\n * Scatter-type series require enabling the 'inactive' marker state and\n * adjusting opacity. Note that this approach could affect performance\n * with large datasets.\n *\n * @sample {highcharts} highcharts/plotoptions/series-inactiveotherpoints-enabled/\n * Chart with inactiveOtherPoints option enabled.\n *\n * @type {boolean}\n * @default false\n * @apioption plotOptions.series.inactiveOtherPoints\n */\n /**\n * An array specifying which option maps to which key in the data point\n * array. This makes it convenient to work with unstructured data arrays\n * from different sources.\n *\n * @see [series.data](#series.line.data)\n *\n * @sample {highcharts|highstock} highcharts/series/data-keys/\n * An extended data array with keys\n * @sample {highcharts|highstock} highcharts/series/data-nested-keys/\n * Nested keys used to access object properties\n *\n * @type {Array}\n * @since 4.1.6\n * @apioption plotOptions.series.keys\n */\n /**\n * The line cap used for line ends and line joins on the graph.\n *\n * @sample highcharts/series-line/linecap/\n * Line cap comparison\n *\n * @type {Highcharts.SeriesLinecapValue}\n * @default round\n * @product highcharts highstock\n * @apioption plotOptions.series.linecap\n */\n /**\n * The [id](#series.id) of another series to link to. Additionally,\n * the value can be \":previous\" to link to the previous series. When\n * two series are linked, only the first one appears in the legend.\n * Toggling the visibility of this also toggles the linked series.\n *\n * If master series uses data sorting and linked series does not have\n * its own sorting definition, the linked series will be sorted in the\n * same order as the master one.\n *\n * @sample {highcharts|highstock} highcharts/demo/arearange-line/\n * Linked series\n *\n * @type {string}\n * @since 3.0\n * @product highcharts highstock gantt\n * @apioption plotOptions.series.linkedTo\n */\n /**\n * Options for the corresponding navigator series if `showInNavigator`\n * is `true` for this series. Available options are the same as any\n * series, documented at [plotOptions](#plotOptions.series) and\n * [series](#series).\n *\n * These options are merged with options in [navigator.series](\n * #navigator.series), and will take precedence if the same option is\n * defined both places.\n *\n * @see [navigator.series](#navigator.series)\n *\n * @type {Highcharts.PlotSeriesOptions}\n * @since 5.0.0\n * @product highstock\n * @apioption plotOptions.series.navigatorOptions\n */\n /**\n * The color for the parts of the graph or points that are below the\n * [threshold](#plotOptions.series.threshold). Note that `zones` takes\n * precedence over the negative color. Using `negativeColor` is\n * equivalent to applying a zone with value of 0.\n *\n * @see In styled mode, a negative color is applied by setting this option\n * to `true` combined with the `.highcharts-negative` class name.\n *\n * @sample {highcharts} highcharts/plotoptions/series-negative-color/\n * Spline, area and column\n * @sample {highcharts} highcharts/plotoptions/arearange-negativecolor/\n * Arearange\n * @sample {highcharts} highcharts/css/series-negative-color/\n * Styled mode\n * @sample {highstock} highcharts/plotoptions/series-negative-color/\n * Spline, area and column\n * @sample {highstock} highcharts/plotoptions/arearange-negativecolor/\n * Arearange\n * @sample {highmaps} highcharts/plotoptions/series-negative-color/\n * Spline, area and column\n * @sample {highmaps} highcharts/plotoptions/arearange-negativecolor/\n * Arearange\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 3.0\n * @apioption plotOptions.series.negativeColor\n */\n /**\n * Same as\n * [accessibility.point.descriptionFormat](#accessibility.point.descriptionFormat),\n * but for an individual series. Overrides the chart wide configuration.\n *\n * @type {Function}\n * @since 11.1.0\n * @apioption plotOptions.series.pointDescriptionFormat\n */\n /**\n * Same as\n * [accessibility.series.descriptionFormatter](#accessibility.series.descriptionFormatter),\n * but for an individual series. Overrides the chart wide configuration.\n *\n * @type {Function}\n * @since 5.0.12\n * @apioption plotOptions.series.pointDescriptionFormatter\n */\n /**\n * If no x values are given for the points in a series, `pointInterval`\n * defines the interval of the x values. For example, if a series\n * contains one value every decade starting from year 0, set\n * `pointInterval` to `10`. In true `datetime` axes, the `pointInterval`\n * is set in milliseconds.\n *\n * It can be also be combined with `pointIntervalUnit` to draw irregular\n * time intervals.\n *\n * If combined with `relativeXValue`, an x value can be set on each\n * point, and the `pointInterval` is added x times to the `pointStart`\n * setting.\n *\n * Please note that this options applies to the _series data_, not the\n * interval of the axis ticks, which is independent.\n *\n * @sample {highcharts} highcharts/plotoptions/series-pointstart-datetime/\n * Datetime X axis\n * @sample {highcharts} highcharts/plotoptions/series-relativexvalue/\n * Relative x value\n * @sample {highstock} stock/plotoptions/pointinterval-pointstart/\n * Using pointStart and pointInterval\n * @sample {highstock} stock/plotoptions/relativexvalue/\n * Relative x value\n *\n * @type {number}\n * @default 1\n * @product highcharts highstock gantt\n * @apioption plotOptions.series.pointInterval\n */\n /**\n * On datetime series, this allows for setting the\n * [pointInterval](#plotOptions.series.pointInterval) to irregular time\n * units, `day`, `month` and `year`. A day is usually the same as 24\n * hours, but `pointIntervalUnit` also takes the DST crossover into\n * consideration when dealing with local time. Combine this option with\n * `pointInterval` to draw weeks, quarters, 6 months, 10 years etc.\n *\n * Please note that this options applies to the _series data_, not the\n * interval of the axis ticks, which is independent.\n *\n * @sample {highcharts} highcharts/plotoptions/series-pointintervalunit/\n * One point a month\n * @sample {highstock} highcharts/plotoptions/series-pointintervalunit/\n * One point a month\n *\n * @type {string}\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @validvalue [\"day\", \"month\", \"year\"]\n * @apioption plotOptions.series.pointIntervalUnit\n */\n /**\n * Possible values: `\"on\"`, `\"between\"`, `number`.\n *\n * In a column chart, when pointPlacement is `\"on\"`, the point will not\n * create any padding of the X axis. In a polar column chart this means\n * that the first column points directly north. If the pointPlacement is\n * `\"between\"`, the columns will be laid out between ticks. This is\n * useful for example for visualising an amount between two points in\n * time or in a certain sector of a polar chart.\n *\n * Since Highcharts 3.0.2, the point placement can also be numeric,\n * where 0 is on the axis value, -0.5 is between this value and the\n * previous, and 0.5 is between this value and the next. Unlike the\n * textual options, numeric point placement options won't affect axis\n * padding.\n *\n * Note that pointPlacement needs a [pointRange](\n * #plotOptions.series.pointRange) to work. For column series this is\n * computed, but for line-type series it needs to be set.\n *\n * For the `xrange` series type and gantt charts, if the Y axis is a\n * category axis, the `pointPlacement` applies to the Y axis rather than\n * the (typically datetime) X axis.\n *\n * Defaults to `undefined` in cartesian charts, `\"between\"` in polar\n * charts.\n *\n * @see [xAxis.tickmarkPlacement](#xAxis.tickmarkPlacement)\n *\n * @sample {highcharts|highstock} highcharts/plotoptions/series-pointplacement-between/\n * Between in a column chart\n * @sample {highcharts|highstock} highcharts/plotoptions/series-pointplacement-numeric/\n * Numeric placement for custom layout\n * @sample {highcharts|highstock} maps/plotoptions/heatmap-pointplacement/\n * Placement in heatmap\n *\n * @type {string|number}\n * @since 2.3.0\n * @product highcharts highstock gantt\n * @apioption plotOptions.series.pointPlacement\n */\n /**\n * If no x values are given for the points in a series, pointStart\n * defines on what value to start. For example, if a series contains one\n * yearly value starting from 1945, set pointStart to 1945.\n *\n * If combined with `relativeXValue`, an x value can be set on each\n * point. The x value from the point options is multiplied by\n * `pointInterval` and added to `pointStart` to produce a modified x\n * value.\n *\n * @sample {highcharts} highcharts/plotoptions/series-pointstart-linear/\n * Linear\n * @sample {highcharts} highcharts/plotoptions/series-pointstart-datetime/\n * Datetime\n * @sample {highcharts} highcharts/plotoptions/series-relativexvalue/\n * Relative x value\n * @sample {highstock} stock/plotoptions/pointinterval-pointstart/\n * Using pointStart and pointInterval\n * @sample {highstock} stock/plotoptions/relativexvalue/\n * Relative x value\n *\n * @type {number}\n * @default 0\n * @product highcharts highstock gantt\n * @apioption plotOptions.series.pointStart\n */\n /**\n * When true, X values in the data set are relative to the current\n * `pointStart`, `pointInterval` and `pointIntervalUnit` settings. This\n * allows compression of the data for datasets with irregular X values.\n *\n * The real X values are computed on the formula `f(x) = ax + b`, where\n * `a` is the `pointInterval` (optionally with a time unit given by\n * `pointIntervalUnit`), and `b` is the `pointStart`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-relativexvalue/\n * Relative X value\n * @sample {highstock} stock/plotoptions/relativexvalue/\n * Relative X value\n *\n * @type {boolean}\n * @default false\n * @product highcharts highstock\n * @apioption plotOptions.series.relativeXValue\n */\n /**\n * Whether to select the series initially. If `showCheckbox` is true,\n * the checkbox next to the series name in the legend will be checked\n * for a selected series.\n *\n * @sample {highcharts} highcharts/plotoptions/series-selected/\n * One out of two series selected\n *\n * @type {boolean}\n * @default false\n * @since 1.2.0\n * @apioption plotOptions.series.selected\n */\n /**\n * Whether to apply a drop shadow to the graph line. Since 2.3 the\n * shadow can be an object configuration containing `color`, `offsetX`,\n * `offsetY`, `opacity` and `width`.\n *\n * Note that in some cases, like stacked columns or other dense layouts, the\n * series may cast shadows on each other. In that case, the\n * `chart.seriesGroupShadow` allows applying a common drop shadow to the\n * whole series group.\n *\n * @sample {highcharts} highcharts/plotoptions/series-shadow/\n * Shadow enabled\n *\n * @type {boolean|Highcharts.ShadowOptionsObject}\n * @default false\n * @apioption plotOptions.series.shadow\n */\n /**\n * Whether to display this particular series or series type in the\n * legend. Standalone series are shown in legend by default, and linked\n * series are not. Since v7.2.0 it is possible to show series that use\n * colorAxis by setting this option to `true`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-showinlegend/\n * One series in the legend, one hidden\n *\n * @type {boolean}\n * @apioption plotOptions.series.showInLegend\n */\n /**\n * Whether or not to show the series in the navigator. Takes precedence\n * over [navigator.baseSeries](#navigator.baseSeries) if defined.\n *\n * @type {boolean}\n * @since 5.0.0\n * @product highstock\n * @apioption plotOptions.series.showInNavigator\n */\n /**\n * If set to `true`, the accessibility module will skip past the points\n * in this series for keyboard navigation.\n *\n * @type {boolean}\n * @since 5.0.12\n * @apioption plotOptions.series.skipKeyboardNavigation\n */\n /**\n * Whether to stack the values of each series on top of each other.\n * Possible values are `undefined` to disable, `\"normal\"` to stack by\n * value or `\"percent\"`.\n *\n * When stacking is enabled, data must be sorted\n * in ascending X order.\n *\n * Some stacking options are related to specific series types. In the\n * streamgraph series type, the stacking option is set to `\"stream\"`.\n * The second one is `\"overlap\"`, which only applies to waterfall\n * series.\n *\n * @see [yAxis.reversedStacks](#yAxis.reversedStacks)\n *\n * @sample {highcharts} highcharts/plotoptions/series-stacking-line/\n * Line\n * @sample {highcharts} highcharts/plotoptions/series-stacking-column/\n * Column\n * @sample {highcharts} highcharts/plotoptions/series-stacking-bar/\n * Bar\n * @sample {highcharts} highcharts/plotoptions/series-stacking-area/\n * Area\n * @sample {highcharts} highcharts/plotoptions/series-stacking-percent-line/\n * Line\n * @sample {highcharts} highcharts/plotoptions/series-stacking-percent-column/\n * Column\n * @sample {highcharts} highcharts/plotoptions/series-stacking-percent-bar/\n * Bar\n * @sample {highcharts} highcharts/plotoptions/series-stacking-percent-area/\n * Area\n * @sample {highcharts} highcharts/plotoptions/series-waterfall-with-normal-stacking\n * Waterfall with normal stacking\n * @sample {highcharts} highcharts/plotoptions/series-waterfall-with-overlap-stacking\n * Waterfall with overlap stacking\n * @sample {highstock} stock/plotoptions/stacking/\n * Area\n *\n * @type {string}\n * @product highcharts highstock\n * @validvalue [\"normal\", \"overlap\", \"percent\", \"stream\"]\n * @apioption plotOptions.series.stacking\n */\n /**\n * Whether to apply steps to the line. Possible values are `left`,\n * `center` and `right`.\n *\n * @sample {highcharts} highcharts/plotoptions/line-step/\n * Different step line options\n * @sample {highcharts} highcharts/plotoptions/area-step/\n * Stepped, stacked area\n * @sample {highstock} stock/plotoptions/line-step/\n * Step line\n *\n * @type {string}\n * @since 1.2.5\n * @product highcharts highstock\n * @validvalue [\"left\", \"center\", \"right\"]\n * @apioption plotOptions.series.step\n */\n /**\n * The threshold, also called zero level or base level. For line type\n * series this is only used in conjunction with\n * [negativeColor](#plotOptions.series.negativeColor).\n *\n * @see [softThreshold](#plotOptions.series.softThreshold).\n *\n * @type {number|null}\n * @default 0\n * @since 3.0\n * @product highcharts highstock\n * @apioption plotOptions.series.threshold\n */\n /**\n * Set the initial visibility of the series.\n *\n * @sample {highcharts} highcharts/plotoptions/series-visible/\n * Two series, one hidden and one visible\n * @sample {highstock} stock/plotoptions/series-visibility/\n * Hidden series\n *\n * @type {boolean}\n * @default true\n * @apioption plotOptions.series.visible\n */\n /**\n * Defines the Axis on which the zones are applied.\n *\n * @see [zones](#plotOptions.series.zones)\n *\n * @sample {highcharts} highcharts/series/color-zones-zoneaxis-x/\n * Zones on the X-Axis\n * @sample {highstock} highcharts/series/color-zones-zoneaxis-x/\n * Zones on the X-Axis\n *\n * @type {string}\n * @default y\n * @since 4.1.0\n * @product highcharts highstock\n * @apioption plotOptions.series.zoneAxis\n */\n /**\n * General event handlers for the series items. These event hooks can\n * also be attached to the series at run time using the\n * `Highcharts.addEvent` function.\n *\n * @declare Highcharts.SeriesEventsOptionsObject\n *\n * @private\n */\n events: {},\n /**\n * Fires after the series has finished its initial animation, or in case\n * animation is disabled, immediately as the series is displayed.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-afteranimate/\n * Show label after animate\n * @sample {highstock} highcharts/plotoptions/series-events-afteranimate/\n * Show label after animate\n *\n * @type {Highcharts.SeriesAfterAnimateCallbackFunction}\n * @since 4.0\n * @product highcharts highstock gantt\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.afterAnimate\n */\n /**\n * Fires when the checkbox next to the series' name in the legend is\n * clicked. One parameter, `event`, is passed to the function. The state\n * of the checkbox is found by `event.checked`. The checked item is\n * found by `event.item`. Return `false` to prevent the default action\n * which is to toggle the select state of the series.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-checkboxclick/\n * Alert checkbox status\n *\n * @type {Highcharts.SeriesCheckboxClickCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.checkboxClick\n */\n /**\n * Fires when the series is clicked. One parameter, `event`, is passed\n * to the function, containing common event information. Additionally,\n * `event.point` holds a pointer to the nearest point on the graph.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-click/\n * Alert click info\n * @sample {highstock} stock/plotoptions/series-events-click/\n * Alert click info\n * @sample {highmaps} maps/plotoptions/series-events-click/\n * Display click info in subtitle\n *\n * @type {Highcharts.SeriesClickCallbackFunction}\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.click\n */\n /**\n * Fires when the series is hidden after chart generation time, either\n * by clicking the legend item or by calling `.hide()`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-hide/\n * Alert when the series is hidden by clicking the legend item\n *\n * @type {Highcharts.SeriesHideCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.hide\n */\n /**\n * Fires when the legend item belonging to the series is clicked. One\n * parameter, `event`, is passed to the function. The default action\n * is to toggle the visibility of the series. This can be prevented\n * by returning `false` or calling `event.preventDefault()`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-legenditemclick/\n * Confirm hiding and showing\n *\n * @type {Highcharts.SeriesLegendItemClickCallbackFunction}\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.legendItemClick\n */\n /**\n * Fires when the mouse leaves the graph. One parameter, `event`, is\n * passed to the function, containing common event information. If the\n * [stickyTracking](#plotOptions.series) option is true, `mouseOut`\n * doesn't happen before the mouse enters another graph or leaves the\n * plot area.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-mouseover-sticky/\n * With sticky tracking by default\n * @sample {highcharts} highcharts/plotoptions/series-events-mouseover-no-sticky/\n * Without sticky tracking\n *\n * @type {Highcharts.SeriesMouseOutCallbackFunction}\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.mouseOut\n */\n /**\n * Fires when the mouse enters the graph. One parameter, `event`, is\n * passed to the function, containing common event information.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-mouseover-sticky/\n * With sticky tracking by default\n * @sample {highcharts} highcharts/plotoptions/series-events-mouseover-no-sticky/\n * Without sticky tracking\n *\n * @type {Highcharts.SeriesMouseOverCallbackFunction}\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.mouseOver\n */\n /**\n * Fires when the series is shown after chart generation time, either\n * by clicking the legend item or by calling `.show()`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-show/\n * Alert when the series is shown by clicking the legend item.\n *\n * @type {Highcharts.SeriesShowCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Series\n * @apioption plotOptions.series.events.show\n */\n /**\n * Options for the point markers of line and scatter-like series. Properties\n * like `fillColor`, `lineColor` and `lineWidth` define the visual\n * appearance of the markers. The `symbol` option defines the shape. Other\n * series types, like column series, don't have markers, but have visual\n * options on the series level instead.\n *\n * In styled mode, the markers can be styled with the `.highcharts-point`,\n * `.highcharts-point-hover` and `.highcharts-point-select` class names.\n *\n * @declare Highcharts.PointMarkerOptionsObject\n *\n * @sample {highmaps} maps/demo/mappoint-mapmarker\n * Using the mapmarker symbol for points\n *\n * @private\n */\n marker: {\n /**\n * Enable or disable the point marker. If `undefined`, the markers\n * are hidden when the data is dense, and shown for more widespread\n * data points.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-enabled/\n * Disabled markers\n * @sample {highcharts} highcharts/plotoptions/series-marker-enabled-false/\n * Disabled in normal state but enabled on hover\n * @sample {highstock} stock/plotoptions/series-marker/\n * Enabled markers\n *\n * @type {boolean}\n * @default {highcharts} undefined\n * @default {highstock} false\n * @apioption plotOptions.series.marker.enabled\n */\n /**\n * The threshold for how dense the point markers should be before\n * they are hidden, given that `enabled` is not defined. The number\n * indicates the horizontal distance between the two closest points\n * in the series, as multiples of the `marker.radius`. In other\n * words, the default value of 2 means points are hidden if\n * overlapping horizontally.\n *\n * @sample highcharts/plotoptions/series-marker-enabledthreshold\n * A higher threshold\n *\n * @since 6.0.5\n */\n enabledThreshold: 2,\n /**\n * The fill color of the point marker. When `undefined`, the series'\n * or point's color is used.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-fillcolor/\n * White fill\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption plotOptions.series.marker.fillColor\n */\n /**\n * Image markers only. Set the image width explicitly. When using\n * this option, a `width` must also be set.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-width-height/\n * Fixed width and height\n * @sample {highstock} highcharts/plotoptions/series-marker-width-height/\n * Fixed width and height\n *\n * @type {number}\n * @since 4.0.4\n * @apioption plotOptions.series.marker.height\n */\n /**\n * The color of the point marker's outline. When `undefined`, the\n * series' or point's color is used.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-fillcolor/\n * Inherit from series color (undefined)\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n lineColor: \"#ffffff\" /* Palette.backgroundColor */,\n /**\n * The width of the point marker's outline.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-fillcolor/\n * 2px blue marker\n */\n lineWidth: 0,\n /**\n * The radius of the point marker.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-radius/\n * Bigger markers\n *\n * @default {highstock} 2\n * @default {highcharts} 4\n *\n */\n radius: 4,\n /**\n * A predefined shape or symbol for the marker. When undefined, the\n * symbol is pulled from options.symbols. Other possible values are\n * `'circle'`, `'square'`,`'diamond'`, `'triangle'` and\n * `'triangle-down'`.\n *\n * Additionally, the URL to a graphic can be given on this form:\n * `'url(graphic.png)'`. Note that for the image to be applied to\n * exported charts, its URL needs to be accessible by the export\n * server.\n *\n * Custom callbacks for symbol path generation can also be added to\n * `Highcharts.SVGRenderer.prototype.symbols`. The callback is then\n * used by its method name, as shown in the demo.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-symbol/\n * Predefined, graphic and custom markers\n * @sample {highstock} highcharts/plotoptions/series-marker-symbol/\n * Predefined, graphic and custom markers\n * @sample {highmaps} maps/demo/mappoint-mapmarker\n * Using the mapmarker symbol for points\n *\n * @type {string}\n * @apioption plotOptions.series.marker.symbol\n */\n /**\n * Image markers only. Set the image width explicitly. When using\n * this option, a `height` must also be set.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-width-height/\n * Fixed width and height\n * @sample {highstock} highcharts/plotoptions/series-marker-width-height/\n * Fixed width and height\n *\n * @type {number}\n * @since 4.0.4\n * @apioption plotOptions.series.marker.width\n */\n /**\n * States for a single point marker.\n *\n * @declare Highcharts.PointStatesOptionsObject\n */\n states: {\n /**\n * The normal state of a single point marker. Currently only\n * used for setting animation when returning to normal state\n * from hover.\n *\n * @declare Highcharts.PointStatesNormalOptionsObject\n */\n normal: {\n /**\n * Animation when returning to normal state after hovering.\n *\n * @type {boolean|Partial}\n */\n animation: true\n },\n /**\n * The hover state for a single point marker.\n *\n * @declare Highcharts.PointStatesHoverOptionsObject\n */\n hover: {\n /**\n * Animation when hovering over the marker.\n *\n * @type {boolean|Partial}\n */\n animation: {\n /** @internal */\n duration: 150\n },\n /**\n * Enable or disable the point marker.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-hover-enabled/\n * Disabled hover state\n */\n enabled: true,\n /**\n * The fill color of the marker in hover state. When\n * `undefined`, the series' or point's fillColor for normal\n * state is used.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption plotOptions.series.marker.states.hover.fillColor\n */\n /**\n * The color of the point marker's outline. When\n * `undefined`, the series' or point's lineColor for normal\n * state is used.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-hover-linecolor/\n * White fill color, black line color\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption plotOptions.series.marker.states.hover.lineColor\n */\n /**\n * The width of the point marker's outline. When\n * `undefined`, the series' or point's lineWidth for normal\n * state is used.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-hover-linewidth/\n * 3px line width\n *\n * @type {number}\n * @apioption plotOptions.series.marker.states.hover.lineWidth\n */\n /**\n * The radius of the point marker. In hover state, it\n * defaults to the normal state's radius + 2 as per the\n * [radiusPlus](#plotOptions.series.marker.states.hover.radiusPlus)\n * option.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-hover-radius/\n * 10px radius\n *\n * @type {number}\n * @apioption plotOptions.series.marker.states.hover.radius\n */\n /**\n * The number of pixels to increase the radius of the\n * hovered point.\n *\n * @sample {highcharts} highcharts/plotoptions/series-states-hover-linewidthplus/\n * 5 pixels greater radius on hover\n * @sample {highstock} highcharts/plotoptions/series-states-hover-linewidthplus/\n * 5 pixels greater radius on hover\n *\n * @since 4.0.3\n */\n radiusPlus: 2,\n /**\n * The additional line width for a hovered point.\n *\n * @sample {highcharts} highcharts/plotoptions/series-states-hover-linewidthplus/\n * 2 pixels wider on hover\n * @sample {highstock} highcharts/plotoptions/series-states-hover-linewidthplus/\n * 2 pixels wider on hover\n *\n * @since 4.0.3\n */\n lineWidthPlus: 1\n },\n /**\n * The appearance of the point marker when selected. In order to\n * allow a point to be selected, set the\n * `series.allowPointSelect` option to true.\n *\n * @declare Highcharts.PointStatesSelectOptionsObject\n */\n select: {\n /**\n * Enable or disable visible feedback for selection.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-select-enabled/\n * Disabled select state\n *\n * @type {boolean}\n * @default true\n * @apioption plotOptions.series.marker.states.select.enabled\n */\n /**\n * The radius of the point marker. In hover state, it\n * defaults to the normal state's radius + 2.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-select-radius/\n * 10px radius for selected points\n *\n * @type {number}\n * @apioption plotOptions.series.marker.states.select.radius\n */\n /**\n * The fill color of the point marker.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-select-fillcolor/\n * Solid red discs for selected points\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n fillColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The color of the point marker's outline. When\n * `undefined`, the series' or point's color is used.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-select-linecolor/\n * Red line color for selected points\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n lineColor: \"#000000\" /* Palette.neutralColor100 */,\n /**\n * The width of the point marker's outline.\n *\n * @sample {highcharts} highcharts/plotoptions/series-marker-states-select-linewidth/\n * 3px line width for selected points\n */\n lineWidth: 2\n }\n }\n },\n /**\n * Properties for each single point.\n *\n * @declare Highcharts.PlotSeriesPointOptions\n *\n * @private\n */\n point: {\n /**\n * Fires when a point is clicked. One parameter, `event`, is passed\n * to the function, containing common event information.\n *\n * If the `series.allowPointSelect` option is true, the default\n * action for the point's click event is to toggle the point's\n * select state. Returning `false` cancels this action.\n *\n * @sample {highcharts} highcharts/plotoptions/series-point-events-click/\n * Click marker to alert values\n * @sample {highcharts} highcharts/plotoptions/series-point-events-click-column/\n * Click column\n * @sample {highcharts} highcharts/plotoptions/series-point-events-click-url/\n * Go to URL\n * @sample {highmaps} maps/plotoptions/series-point-events-click/\n * Click marker to display values\n * @sample {highmaps} maps/plotoptions/series-point-events-click-url/\n * Go to URL\n *\n * @type {Highcharts.PointClickCallbackFunction}\n * @context Highcharts.Point\n * @apioption plotOptions.series.point.events.click\n */\n /**\n * Fires when the mouse leaves the area close to the point. One\n * parameter, `event`, is passed to the function, containing common\n * event information.\n *\n * @sample {highcharts} highcharts/plotoptions/series-point-events-mouseover/\n * Show values in the chart's corner on mouse over\n *\n * @type {Highcharts.PointMouseOutCallbackFunction}\n * @context Highcharts.Point\n * @apioption plotOptions.series.point.events.mouseOut\n */\n /**\n * Fires when the mouse enters the area close to the point. One\n * parameter, `event`, is passed to the function, containing common\n * event information.\n *\n * Returning `false` cancels the default behavior, which is to show a\n * tooltip for the point.\n *\n * @sample {highcharts} highcharts/plotoptions/series-point-events-mouseover/\n * Show values in the chart's corner on mouse over\n *\n * @type {Highcharts.PointMouseOverCallbackFunction}\n * @context Highcharts.Point\n * @apioption plotOptions.series.point.events.mouseOver\n */\n /**\n * Fires when the point is removed using the `.remove()` method. One\n * parameter, `event`, is passed to the function. Returning `false`\n * cancels the operation.\n *\n * @sample {highcharts} highcharts/plotoptions/series-point-events-remove/\n * Remove point and confirm\n *\n * @type {Highcharts.PointRemoveCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Point\n * @apioption plotOptions.series.point.events.remove\n */\n /**\n * Fires when the point is selected either programmatically or\n * following a click on the point. One parameter, `event`, is passed\n * to the function. Returning `false` cancels the operation.\n *\n * @sample {highcharts} highcharts/plotoptions/series-point-events-select/\n * Report the last selected point\n * @sample {highmaps} maps/plotoptions/series-allowpointselect/\n * Report select and unselect\n *\n * @type {Highcharts.PointSelectCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Point\n * @apioption plotOptions.series.point.events.select\n */\n /**\n * Fires when the point is unselected either programmatically or\n * following a click on the point. One parameter, `event`, is passed\n * to the function.\n * Returning `false` cancels the operation.\n *\n * @sample {highcharts} highcharts/plotoptions/series-point-events-unselect/\n * Report the last unselected point\n * @sample {highmaps} maps/plotoptions/series-allowpointselect/\n * Report select and unselect\n *\n * @type {Highcharts.PointUnselectCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Point\n * @apioption plotOptions.series.point.events.unselect\n */\n /**\n * Fires when the point is updated programmatically through the\n * `.update()` method. One parameter, `event`, is passed to the\n * function. The new point options can be accessed through\n * `event.options`. Returning `false` cancels the operation.\n *\n * @sample {highcharts} highcharts/plotoptions/series-point-events-update/\n * Confirm point updating\n *\n * @type {Highcharts.PointUpdateCallbackFunction}\n * @since 1.2.0\n * @context Highcharts.Point\n * @apioption plotOptions.series.point.events.update\n */\n /**\n * Events for each single point.\n *\n * @declare Highcharts.PointEventsOptionsObject\n */\n events: {}\n },\n /**\n * Options for the series data labels, appearing next to each data\n * point.\n *\n * Since v6.2.0, multiple data labels can be applied to each single\n * point by defining them as an array of configs.\n *\n * In styled mode, the data labels can be styled with the\n * `.highcharts-data-label-box` and `.highcharts-data-label` class names\n * ([see example](https://www.highcharts.com/samples/highcharts/css/series-datalabels)).\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-enabled\n * Data labels enabled\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-multiple\n * Multiple data labels on a bar series\n * @sample {highcharts} highcharts/css/series-datalabels\n * Styled mode example\n * @sample {highmaps} maps/demo/color-axis\n * Choropleth map with data labels\n * @sample {highmaps} maps/demo/mappoint-datalabels-mapmarker\n * Using data labels as map markers\n *\n * @type {*|Array<*>}\n * @product highcharts highstock highmaps gantt\n *\n * @private\n */\n dataLabels: {\n /**\n * Enable or disable the initial animation when a series is displayed\n * for the `dataLabels`. The animation can also be set as a\n * configuration object. Please note that this option only applies to\n * the initial animation.\n *\n * For other animations, see [chart.animation](#chart.animation) and the\n * animation parameter under the API methods. The following properties\n * are supported:\n *\n * - `defer`: The animation delay time in milliseconds.\n *\n * @sample {highcharts} highcharts/plotoptions/animation-defer/\n * Animation defer settings\n *\n * @type {boolean|Partial}\n * @since 8.2.0\n * @apioption plotOptions.series.dataLabels.animation\n */\n animation: {},\n /**\n * The animation delay time in milliseconds. Set to `0` to render the\n * data labels immediately. As `undefined` inherits defer time from the\n * [series.animation.defer](#plotOptions.series.animation.defer).\n *\n * @type {number}\n * @since 8.2.0\n * @apioption plotOptions.series.dataLabels.animation.defer\n */\n /**\n * The alignment of the data label compared to the point. If `right`,\n * the right side of the label should be touching the point. For points\n * with an extent, like columns, the alignments also dictates how to\n * align it inside the box, as given with the\n * [inside](#plotOptions.column.dataLabels.inside) option. Can be one of\n * `left`, `center` or `right`.\n *\n * @sample {highcharts}\n * highcharts/plotoptions/series-datalabels-align-left/ Left\n * aligned\n * @sample {highcharts}\n * highcharts/plotoptions/bar-datalabels-align-inside-bar/ Data\n * labels inside the bar\n *\n * @type {Highcharts.AlignValue|null}\n */\n align: 'center',\n /**\n * Whether to allow data labels to overlap. To make the labels less\n * sensitive for overlapping, the\n * [dataLabels.padding](#plotOptions.series.dataLabels.padding)\n * can be set to 0.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-allowoverlap-false/\n * Don't allow overlap\n *\n * @type {boolean}\n * @default false\n * @since 4.1.0\n * @apioption plotOptions.series.dataLabels.allowOverlap\n */\n /**\n * The background color or gradient for the data label. Setting it to\n * `auto` will use the point's color.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-box/\n * Data labels box options\n * @sample {highmaps} maps/plotoptions/series-datalabels-box/\n * Data labels box options\n * @sample {highmaps} maps/demo/mappoint-datalabels-mapmarker\n * Data labels as map markers\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 2.2.1\n * @apioption plotOptions.series.dataLabels.backgroundColor\n */\n /**\n * The border color for the data label. Setting it to `auto` will use\n * the point's color. Defaults to `undefined`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-box/\n * Data labels box options\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 2.2.1\n * @apioption plotOptions.series.dataLabels.borderColor\n */\n /**\n * The border radius in pixels for the data label.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-box/\n * Data labels box options\n * @sample {highmaps} maps/plotoptions/series-datalabels-box/\n * Data labels box options\n *\n * @type {number}\n * @default 0\n * @since 2.2.1\n * @apioption plotOptions.series.dataLabels.borderRadius\n */\n /**\n * The border width in pixels for the data label.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-box/\n * Data labels box options\n *\n * @type {number}\n * @default 0\n * @since 2.2.1\n * @apioption plotOptions.series.dataLabels.borderWidth\n */\n borderWidth: 0,\n /**\n * A class name for the data label. Particularly in styled mode,\n * this can be used to give each series' or point's data label\n * unique styling. In addition to this option, a default color class\n * name is added so that we can give the labels a contrast text\n * shadow.\n *\n * @sample {highcharts} highcharts/css/data-label-contrast/\n * Contrast text shadow\n * @sample {highcharts} highcharts/css/series-datalabels/\n * Styling by CSS\n *\n * @type {string}\n * @since 5.0.0\n * @apioption plotOptions.series.dataLabels.className\n */\n /**\n * This options is deprecated.\n * Use [style.color](#plotOptions.series.dataLabels.style) instead.\n *\n * The text color for the data labels. Defaults to `undefined`. For\n * certain series types, like column or map, the data labels can be\n * drawn inside the points. In this case the data label will be\n * drawn with maximum contrast by default. Additionally, it will be\n * given a `text-outline` style with the opposite color, to further\n * increase the contrast. This can be overridden by setting the\n * `text-outline` style to `none` in the `dataLabels.style` option.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-color/\n * Red data labels\n * @sample {highmaps} maps/demo/color-axis/\n * White data labels\n *\n * @see [style.color](#plotOptions.series.dataLabels.style)\n *\n * @type {Highcharts.ColorType}\n * @deprecated 10.3\n * @apioption plotOptions.series.dataLabels.color\n */\n /**\n * Whether to hide data labels that are outside the plot area. By\n * default, the data label is moved inside the plot area according\n * to the\n * [overflow](#plotOptions.series.dataLabels.overflow)\n * option.\n *\n * @type {boolean}\n * @default true\n * @since 2.3.3\n * @apioption plotOptions.series.dataLabels.crop\n */\n /**\n * Whether to defer displaying the data labels until the initial\n * series animation has finished. Setting to `false` renders the\n * data label immediately. If set to `true` inherits the defer\n * time set in [plotOptions.series.animation](#plotOptions.series.animation).\n *\n * @since 4.0.0\n * @type {boolean}\n * @product highcharts highstock gantt\n */\n defer: true,\n /**\n * Enable or disable the data labels.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-enabled/\n * Data labels enabled\n * @sample {highmaps} maps/demo/color-axis/\n * Data labels enabled\n *\n * @type {boolean}\n * @default false\n * @apioption plotOptions.series.dataLabels.enabled\n */\n /**\n * A declarative filter to control of which data labels to display.\n * The declarative filter is designed for use when callback\n * functions are not available, like when the chart options require\n * a pure JSON structure or for use with graphical editors. For\n * programmatic control, use the `formatter` instead, and return\n * `undefined` to disable a single data label.\n *\n * @example\n * filter: {\n * property: 'percentage',\n * operator: '>',\n * value: 4\n * }\n *\n * @sample {highcharts} highcharts/demo/pie-monochrome\n * Data labels filtered by percentage\n *\n * @declare Highcharts.DataLabelsFilterOptionsObject\n * @since 6.0.3\n * @apioption plotOptions.series.dataLabels.filter\n */\n /**\n * The operator to compare by. Can be one of `>`, `<`, `>=`, `<=`,\n * `==`, `===`, `!=` and `!==`.\n *\n * @type {string}\n * @validvalue [\">\", \"<\", \">=\", \"<=\", \"==\", \"===\", \"!=\", \"!==\"]\n * @apioption plotOptions.series.dataLabels.filter.operator\n */\n /**\n * The point property to filter by. Point options are passed\n * directly to properties, additionally there are `y` value,\n * `percentage` and others listed under {@link Highcharts.Point}\n * members.\n *\n * @type {string}\n * @apioption plotOptions.series.dataLabels.filter.property\n */\n /**\n * The value to compare against.\n *\n * @type {number}\n * @apioption plotOptions.series.dataLabels.filter.value\n */\n /**\n * A\n * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)\n * for the data label. Available variables are the same as for\n * `formatter`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-format/\n * Add a unit\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-format-subexpression/\n * Complex logic in the format string\n * @sample {highmaps} maps/plotoptions/series-datalabels-format/\n * Formatted value in the data label\n *\n * @type {string}\n * @default y\n * @default point.value\n * @since 3.0\n * @apioption plotOptions.series.dataLabels.format\n */\n // eslint-disable-next-line valid-jsdoc\n /**\n * Callback JavaScript function to format the data label. Note that if a\n * `format` is defined, the format takes precedence and the formatter is\n * ignored.\n *\n * @sample {highmaps} maps/plotoptions/series-datalabels-format/\n * Formatted value\n *\n * @type {Highcharts.DataLabelsFormatterCallbackFunction}\n */\n formatter: function () {\n const { numberFormatter } = this.series.chart;\n return typeof this.y !== 'number' ?\n '' : numberFormatter(this.y, -1);\n },\n /**\n * For points with an extent, like columns or map areas, whether to\n * align the data label inside the box or to the actual value point.\n * Defaults to `false` in most cases, `true` in stacked columns.\n *\n * @type {boolean}\n * @since 3.0\n * @apioption plotOptions.series.dataLabels.inside\n */\n /**\n * Format for points with the value of null. Works analogously to\n * [format](#plotOptions.series.dataLabels.format). `nullFormat` can\n * be applied only to series which support displaying null points\n * i.e `heatmap` or `tilemap`. Does not work with series that don't\n * display null points, like `line`, `column`, `bar` or `pie`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-nullformat/\n * Format data label for null points in heat map\n *\n * @type {boolean|string}\n * @since 7.1.0\n * @apioption plotOptions.series.dataLabels.nullFormat\n */\n /**\n * Callback JavaScript function that defines formatting for points\n * with the value of null. Works analogously to\n * [formatter](#plotOptions.series.dataLabels.formatter).\n * `nullFormatter` can be applied only to series which support\n * displaying null points i.e `heatmap` or `tilemap`. Does not work\n * with series that don't display null points, like `line`, `column`,\n * `bar` or `pie`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-nullformat/\n * Format data label for null points in heat map\n *\n * @type {Highcharts.DataLabelsFormatterCallbackFunction}\n * @since 7.1.0\n * @apioption plotOptions.series.dataLabels.nullFormatter\n */\n /**\n * How to handle data labels that flow outside the plot area. The\n * default is `\"justify\"`, which aligns them inside the plot area.\n * For columns and bars, this means it will be moved inside the bar.\n * To display data labels outside the plot area, set `crop` to\n * `false` and `overflow` to `\"allow\"`.\n *\n * @type {Highcharts.DataLabelsOverflowValue}\n * @default justify\n * @since 3.0.6\n * @apioption plotOptions.series.dataLabels.overflow\n */\n /**\n * When either the `borderWidth` or the `backgroundColor` is set,\n * this is the padding within the box.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-box/\n * Data labels box options\n * @sample {highmaps} maps/plotoptions/series-datalabels-box/\n * Data labels box options\n *\n * @since 2.2.1\n */\n padding: 5,\n /**\n * Aligns data labels relative to points. If `center` alignment is\n * not possible, it defaults to `right`.\n *\n * @type {Highcharts.AlignValue}\n * @default center\n * @apioption plotOptions.series.dataLabels.position\n */\n /**\n * Text rotation in degrees. Note that due to a more complex\n * structure, backgrounds, borders and padding will be lost on a\n * rotated data label.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-rotation/\n * Vertical labels\n *\n * @type {number}\n * @default 0\n * @apioption plotOptions.series.dataLabels.rotation\n */\n /**\n * The shadow of the box. Works best with `borderWidth` or\n * `backgroundColor`. Since 2.3 the shadow can be an object\n * configuration containing `color`, `offsetX`, `offsetY`, `opacity`\n * and `width`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-box/\n * Data labels box options\n *\n * @type {boolean|Highcharts.ShadowOptionsObject}\n * @default false\n * @since 2.2.1\n * @apioption plotOptions.series.dataLabels.shadow\n */\n /**\n * The name of a symbol to use for the border around the label.\n * Symbols are predefined functions on the Renderer object.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-shape/\n * A callout for annotations\n *\n * @type {string}\n * @default square\n * @since 4.1.2\n * @apioption plotOptions.series.dataLabels.shape\n */\n /**\n * Styles for the label. The default `color` setting is\n * `\"contrast\"`, which is a pseudo color that Highcharts picks up\n * and applies the maximum contrast to the underlying point item,\n * for example the bar in a bar chart.\n *\n * The `textOutline` is a pseudo property that applies an outline of\n * the given width with the given color, which by default is the\n * maximum contrast to the text. So a bright text color will result\n * in a black text outline for maximum readability on a mixed\n * background. In some cases, especially with grayscale text, the\n * text outline doesn't work well, in which cases it can be disabled\n * by setting it to `\"none\"`. When `useHTML` is true, the\n * `textOutline` will not be picked up. In this, case, the same\n * effect can be acheived through the `text-shadow` CSS property.\n *\n * For some series types, where each point has an extent, like for\n * example tree maps, the data label may overflow the point. There\n * are two strategies for handling overflow. By default, the text\n * will wrap to multiple lines. The other strategy is to set\n * `style.textOverflow` to `ellipsis`, which will keep the text on\n * one line plus it will break inside long words.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-style/\n * Bold labels\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-overflow/\n * Long labels truncated with an ellipsis in a pie\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-overflow-wrap/\n * Long labels are wrapped in a pie\n * @sample {highmaps} maps/demo/color-axis/\n * Bold labels\n *\n * @type {Highcharts.CSSObject}\n * @since 4.1.0\n * @apioption plotOptions.series.dataLabels.style\n */\n style: {\n /** @internal */\n fontSize: '0.7em',\n /** @internal */\n fontWeight: 'bold',\n /** @internal */\n color: 'contrast',\n /** @internal */\n textOutline: '1px contrast'\n },\n /**\n * Options for a label text which should follow marker's shape.\n * Border and background are disabled for a label that follows a\n * path.\n *\n * **Note:** Only SVG-based renderer supports this option. Setting\n * `useHTML` to true will disable this option.\n *\n * @declare Highcharts.DataLabelsTextPathOptionsObject\n * @since 7.1.0\n * @apioption plotOptions.series.dataLabels.textPath\n */\n /**\n * Presentation attributes for the text path.\n *\n * @type {Highcharts.SVGAttributes}\n * @since 7.1.0\n * @apioption plotOptions.series.dataLabels.textPath.attributes\n */\n /**\n * Enable or disable `textPath` option for link's or marker's data\n * labels.\n *\n * @type {boolean}\n * @since 7.1.0\n * @apioption plotOptions.series.dataLabels.textPath.enabled\n */\n /**\n * Whether to\n * [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)\n * to render the labels.\n *\n * @type {boolean}\n * @default false\n * @apioption plotOptions.series.dataLabels.useHTML\n */\n /**\n * The vertical alignment of a data label. Can be one of `top`,\n * `middle` or `bottom`. The default value depends on the data, for\n * instance in a column chart, the label is above positive values\n * and below negative values.\n *\n * @type {Highcharts.VerticalAlignValue|null}\n * @since 2.3.3\n */\n verticalAlign: 'bottom',\n /**\n * The x position offset of the label relative to the point in\n * pixels.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-rotation/\n * Vertical and positioned\n * @sample {highcharts} highcharts/plotoptions/bar-datalabels-align-inside-bar/\n * Data labels inside the bar\n */\n x: 0,\n /**\n * The z index of the data labels. Use a `zIndex` of 6 to display it above\n * the series, or use a `zIndex` of 2 to display it behind the series.\n *\n * @type {number}\n * @default 6\n * @since 2.3.5\n * @apioption plotOptions.series.dataLabels.zIndex\n */\n /**\n * The y position offset of the label relative to the point in\n * pixels.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-rotation/\n * Vertical and positioned\n */\n y: 0\n },\n /**\n * When the series contains less points than the crop threshold, all\n * points are drawn, even if the points fall outside the visible plot\n * area at the current zoom. The advantage of drawing all points\n * (including markers and columns), is that animation is performed on\n * updates. On the other hand, when the series contains more points than\n * the crop threshold, the series data is cropped to only contain points\n * that fall within the plot area. The advantage of cropping away\n * invisible points is to increase performance on large series.\n *\n * @since 2.2\n * @product highcharts highstock\n *\n * @private\n */\n cropThreshold: 300,\n /**\n * Opacity of a series parts: line, fill (e.g. area) and dataLabels.\n *\n * @see [states.inactive.opacity](#plotOptions.series.states.inactive.opacity)\n *\n * @since 7.1.0\n *\n * @private\n */\n opacity: 1,\n /**\n * The width of each point on the x axis. For example in a column chart\n * with one value each day, the pointRange would be 1 day (= 24 * 3600\n * * 1000 milliseconds). This is normally computed automatically, but\n * this option can be used to override the automatic value.\n *\n * @product highstock\n *\n * @private\n */\n pointRange: 0,\n /**\n * When this is true, the series will not cause the Y axis to cross\n * the zero plane (or [threshold](#plotOptions.series.threshold) option)\n * unless the data actually crosses the plane.\n *\n * For example, if `softThreshold` is `false`, a series of 0, 1, 2,\n * 3 will make the Y axis show negative values according to the\n * `minPadding` option. If `softThreshold` is `true`, the Y axis starts\n * at 0.\n *\n * @since 4.1.9\n * @product highcharts highstock\n *\n * @private\n */\n softThreshold: true,\n /**\n * @declare Highcharts.SeriesStatesOptionsObject\n *\n * @private\n */\n states: {\n /**\n * The normal state of a series, or for point items in column, pie\n * and similar series. Currently only used for setting animation\n * when returning to normal state from hover.\n *\n * @declare Highcharts.SeriesStatesNormalOptionsObject\n */\n normal: {\n /**\n * Animation when returning to normal state after hovering.\n *\n * @type {boolean|Partial}\n */\n animation: true\n },\n /**\n * Options for the hovered series. These settings override the\n * normal state options when a series is moused over or touched.\n *\n * @declare Highcharts.SeriesStatesHoverOptionsObject\n */\n hover: {\n /**\n * Enable separate styles for the hovered series to visualize\n * that the user hovers either the series itself or the legend.\n *\n * @sample {highcharts} highcharts/plotoptions/series-states-hover-enabled/\n * Line\n * @sample {highcharts} highcharts/plotoptions/series-states-hover-enabled-column/\n * Column\n * @sample {highcharts} highcharts/plotoptions/series-states-hover-enabled-pie/\n * Pie\n *\n * @type {boolean}\n * @default true\n * @since 1.2\n * @apioption plotOptions.series.states.hover.enabled\n */\n /**\n * Animation setting for hovering the graph in line-type series.\n *\n * @type {boolean|Partial}\n * @since 5.0.8\n * @product highcharts highstock\n */\n animation: {\n /**\n * The duration of the hover animation in milliseconds. By\n * default the hover state animates quickly in, and slowly\n * back to normal.\n *\n * @internal\n */\n duration: 150\n },\n /**\n * Pixel width of the graph line. By default this property is\n * undefined, and the `lineWidthPlus` property dictates how much\n * to increase the linewidth from normal state.\n *\n * @sample {highcharts} highcharts/plotoptions/series-states-hover-linewidth/\n * 5px line on hover\n *\n * @type {number}\n * @product highcharts highstock\n * @apioption plotOptions.series.states.hover.lineWidth\n */\n /**\n * The additional line width for the graph of a hovered series.\n *\n * @sample {highcharts} highcharts/plotoptions/series-states-hover-linewidthplus/\n * 5 pixels wider\n * @sample {highstock} highcharts/plotoptions/series-states-hover-linewidthplus/\n * 5 pixels wider\n *\n * @since 4.0.3\n * @product highcharts highstock\n */\n lineWidthPlus: 1,\n /**\n * In Highcharts 1.0, the appearance of all markers belonging\n * to the hovered series. For settings on the hover state of the\n * individual point, see\n * [marker.states.hover](#plotOptions.series.marker.states.hover).\n *\n * @deprecated\n *\n * @extends plotOptions.series.marker\n * @excluding states, symbol\n * @product highcharts highstock\n */\n marker: {\n // lineWidth: base + 1,\n // radius: base + 1\n },\n /**\n * Options for the halo appearing around the hovered point in\n * line-type series as well as outside the hovered slice in pie\n * charts. By default the halo is filled by the current point or\n * series color with an opacity of 0.25\\. The halo can be\n * disabled by setting the `halo` option to `null`.\n *\n * In styled mode, the halo is styled with the\n * `.highcharts-halo` class, with colors inherited from\n * `.highcharts-color-{n}`.\n *\n * @sample {highcharts} highcharts/plotoptions/halo/\n * Halo options\n * @sample {highstock} highcharts/plotoptions/halo/\n * Halo options\n *\n * @declare Highcharts.SeriesStatesHoverHaloOptionsObject\n * @type {null|*}\n * @since 4.0\n * @product highcharts highstock\n */\n halo: {\n /**\n * A collection of SVG attributes to override the appearance\n * of the halo, for example `fill`, `stroke` and\n * `stroke-width`.\n *\n * @type {Highcharts.SVGAttributes}\n * @since 4.0\n * @product highcharts highstock\n * @apioption plotOptions.series.states.hover.halo.attributes\n */\n /**\n * The pixel size of the halo. For point markers this is the\n * radius of the halo. For pie slices it is the width of the\n * halo outside the slice. For bubbles it defaults to 5 and\n * is the width of the halo outside the bubble.\n *\n * @since 4.0\n * @product highcharts highstock\n */\n size: 10,\n /**\n * Opacity for the halo unless a specific fill is overridden\n * using the `attributes` setting. Note that Highcharts is\n * only able to apply opacity to colors of hex or rgb(a)\n * formats.\n *\n * @since 4.0\n * @product highcharts highstock\n */\n opacity: 0.25\n }\n },\n /**\n * Specific options for point in selected states, after being\n * selected by\n * [allowPointSelect](#plotOptions.series.allowPointSelect)\n * or programmatically.\n *\n * @sample maps/plotoptions/series-allowpointselect/\n * Allow point select demo\n *\n * @declare Highcharts.SeriesStatesSelectOptionsObject\n * @extends plotOptions.series.states.hover\n * @excluding brightness\n */\n select: {\n animation: {\n /** @internal */\n duration: 0\n }\n },\n /**\n * The opposite state of a hover for series.\n *\n * @sample highcharts/plotoptions/series-states-inactive-disabled\n * Disabled inactive state\n *\n * @declare Highcharts.SeriesStatesInactiveOptionsObject\n */\n inactive: {\n /**\n * Enable or disable the inactive state for a series\n *\n * @sample highcharts/plotoptions/series-states-inactive-disabled\n * Disabled inactive state\n *\n * @type {boolean}\n * @default true\n * @apioption plotOptions.series.states.inactive.enabled\n */\n /**\n * The animation for entering the inactive state.\n *\n * @type {boolean|Partial}\n */\n animation: {\n /** @internal */\n duration: 150\n },\n /**\n * Opacity of series elements (dataLabels, line, area).\n *\n * @type {number}\n */\n opacity: 0.2\n }\n },\n /**\n * Sticky tracking of mouse events. When true, the `mouseOut` event on a\n * series isn't triggered until the mouse moves over another series, or\n * out of the plot area. When false, the `mouseOut` event on a series is\n * triggered when the mouse leaves the area around the series' graph or\n * markers. This also implies the tooltip when not shared. When\n * `stickyTracking` is false and `tooltip.shared` is false, the tooltip\n * will be hidden when moving the mouse between series. Defaults to true\n * for line and area type series, but to false for columns, pies etc.\n *\n * **Note:** The boost module will force this option because of\n * technical limitations.\n *\n * @sample {highcharts} highcharts/plotoptions/series-stickytracking-true/\n * True by default\n * @sample {highcharts} highcharts/plotoptions/series-stickytracking-false/\n * False\n *\n * @default {highcharts} true\n * @default {highstock} true\n * @default {highmaps} false\n * @since 2.0\n *\n * @private\n */\n stickyTracking: true,\n /**\n * A configuration object for the tooltip rendering of each single\n * series. Properties are inherited from [tooltip](#tooltip), but only\n * the following properties can be defined on a series level.\n *\n * @declare Highcharts.SeriesTooltipOptionsObject\n * @since 2.3\n * @extends tooltip\n * @excluding animation, backgroundColor, borderColor, borderRadius,\n * borderWidth, className, crosshairs, enabled, formatter,\n * headerShape, hideDelay, outside, padding, positioner,\n * shadow, shape, shared, snap, split, stickOnContact,\n * style, useHTML\n * @apioption plotOptions.series.tooltip\n */\n /**\n * When a series contains a data array that is longer than this, only\n * one dimensional arrays of numbers, or two dimensional arrays with\n * x and y values are allowed. Also, only the first point is tested,\n * and the rest are assumed to be the same format. This saves expensive\n * data checking and indexing in long series. Set it to `0` disable.\n *\n * Note:\n * In boost mode turbo threshold is forced. Only array of numbers or\n * two dimensional arrays are allowed.\n *\n * @since 2.2\n * @product highcharts highstock gantt\n *\n * @private\n */\n turboThreshold: 1000,\n /**\n * An array defining zones within a series. Zones can be applied to the\n * X axis, Y axis or Z axis for bubbles, according to the `zoneAxis`\n * option. The zone definitions have to be in ascending order regarding\n * to the value.\n *\n * In styled mode, the color zones are styled with the\n * `.highcharts-zone-{n}` class, or custom classed from the `className`\n * option\n * ([view live demo](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/css/color-zones/)).\n *\n * @see [zoneAxis](#plotOptions.series.zoneAxis)\n *\n * @sample {highcharts} highcharts/series/color-zones-simple/\n * Color zones\n * @sample {highstock} highcharts/series/color-zones-simple/\n * Color zones\n *\n * @declare Highcharts.SeriesZonesOptionsObject\n * @type {Array<*>}\n * @since 4.1.0\n * @product highcharts highstock\n * @apioption plotOptions.series.zones\n */\n /**\n * Styled mode only. A custom class name for the zone.\n *\n * @sample highcharts/css/color-zones/\n * Zones styled by class name\n *\n * @type {string}\n * @since 5.0.0\n * @apioption plotOptions.series.zones.className\n */\n /**\n * Defines the color of the series.\n *\n * @see [series color](#plotOptions.series.color)\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 4.1.0\n * @product highcharts highstock\n * @apioption plotOptions.series.zones.color\n */\n /**\n * A name for the dash style to use for the graph.\n *\n * @see [plotOptions.series.dashStyle](#plotOptions.series.dashStyle)\n *\n * @sample {highcharts|highstock} highcharts/series/color-zones-dashstyle-dot/\n * Dashed line indicates prognosis\n *\n * @type {Highcharts.DashStyleValue}\n * @since 4.1.0\n * @product highcharts highstock\n * @apioption plotOptions.series.zones.dashStyle\n */\n /**\n * Defines the fill color for the series (in area type series)\n *\n * @see [fillColor](#plotOptions.area.fillColor)\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 4.1.0\n * @product highcharts highstock\n * @apioption plotOptions.series.zones.fillColor\n */\n /**\n * The value up to where the zone extends, if undefined the zones\n * stretches to the last value in the series.\n *\n * @type {number}\n * @since 4.1.0\n * @product highcharts highstock\n * @apioption plotOptions.series.zones.value\n */\n /**\n * When using dual or multiple color axes, this number defines which\n * colorAxis the particular series is connected to. It refers to\n * either the\n * {@link #colorAxis.id|axis id}\n * or the index of the axis in the colorAxis array, with 0 being the\n * first. Set this option to false to prevent a series from connecting\n * to the default color axis.\n *\n * Since v7.2.0 the option can also be an axis id or an axis index\n * instead of a boolean flag.\n *\n * @sample highcharts/coloraxis/coloraxis-with-pie/\n * Color axis with pie series\n * @sample highcharts/coloraxis/multiple-coloraxis/\n * Multiple color axis\n *\n * @type {number|string|boolean}\n * @default 0\n * @product highcharts highstock highmaps\n * @apioption plotOptions.series.colorAxis\n */\n /**\n * Determines what data value should be used to calculate point color\n * if `colorAxis` is used. Requires to set `min` and `max` if some\n * custom point property is used or if approximation for data grouping\n * is set to `'sum'`.\n *\n * @sample highcharts/coloraxis/custom-color-key/\n * Custom color key\n * @sample highcharts/coloraxis/color-key-with-stops/\n * Custom colorKey with color axis stops\n * @sample highcharts/coloraxis/changed-default-color-key/\n * Changed default color key\n *\n * @type {string}\n * @default y\n * @since 7.2.0\n * @product highcharts highstock highmaps\n * @apioption plotOptions.series.colorKey\n */\n /**\n * What type of legend symbol to render for this series. Can be one of\n * `areaMarker`, `lineMarker` or `rectangle`.\n *\n * @validvalue [\"areaMarker\", \"lineMarker\", \"rectangle\"]\n *\n * @sample {highcharts} highcharts/series/legend-symbol/\n * Change the legend symbol\n *\n * @type {string}\n * @default rectangle\n * @since 11.0.1\n * @apioption plotOptions.series.legendSymbol\n */\n /**\n * Determines whether the series should look for the nearest point\n * in both dimensions or just the x-dimension when hovering the series.\n * Defaults to `'xy'` for scatter series and `'x'` for most other\n * series. If the data has duplicate x-values, it is recommended to\n * set this to `'xy'` to allow hovering over all points.\n *\n * Applies only to series types using nearest neighbor search (not\n * direct hover) for tooltip.\n *\n * @sample {highcharts} highcharts/series/findnearestpointby/\n * Different hover behaviors\n * @sample {highstock} highcharts/series/findnearestpointby/\n * Different hover behaviors\n * @sample {highmaps} highcharts/series/findnearestpointby/\n * Different hover behaviors\n *\n * @since 5.0.10\n * @validvalue [\"x\", \"xy\"]\n *\n * @private\n */\n findNearestPointBy: 'x'\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default seriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Globals.js';\nimport D from '../Defaults.js';\nconst { defaultOptions } = D;\nimport Point from './Point.js';\nimport U from '../Utilities.js';\nconst { extend, extendClass, merge } = U;\n/* *\n *\n * Namespace\n *\n * */\nvar SeriesRegistry;\n(function (SeriesRegistry) {\n /* *\n *\n * Properties\n *\n * */\n /**\n * @internal\n * @todo Move `Globals.seriesTypes` code to her.\n */\n SeriesRegistry.seriesTypes = H.seriesTypes;\n /* *\n *\n * Functions\n *\n * */\n /**\n * Registers class pattern of a series.\n *\n * @private\n */\n function registerSeriesType(seriesType, SeriesClass) {\n const defaultPlotOptions = defaultOptions.plotOptions || {}, seriesOptions = SeriesClass.defaultOptions, seriesProto = SeriesClass.prototype;\n seriesProto.type = seriesType;\n if (!seriesProto.pointClass) {\n seriesProto.pointClass = Point;\n }\n if (SeriesRegistry.seriesTypes[seriesType]) {\n return false;\n }\n if (seriesOptions) {\n defaultPlotOptions[seriesType] = seriesOptions;\n }\n SeriesRegistry.seriesTypes[seriesType] = SeriesClass;\n return true;\n }\n SeriesRegistry.registerSeriesType = registerSeriesType;\n /**\n * Old factory to create new series prototypes.\n *\n * @deprecated\n * @function Highcharts.seriesType\n *\n * @param {string} type\n * The series type name.\n *\n * @param {string} parent\n * The parent series type name. Use `line` to inherit from the basic\n * {@link Series} object.\n *\n * @param {Highcharts.SeriesOptionsType|Highcharts.Dictionary<*>} options\n * The additional default options that are merged with the parent's options.\n *\n * @param {Highcharts.Dictionary<*>} [props]\n * The properties (functions and primitives) to set on the new prototype.\n *\n * @param {Highcharts.Dictionary<*>} [pointProps]\n * Members for a series-specific extension of the {@link Point} prototype if\n * needed.\n *\n * @return {Highcharts.Series}\n * The newly created prototype as extended from {@link Series} or its\n * derivatives.\n */\n function seriesType(type, parent, options, seriesProto, pointProto) {\n const defaultPlotOptions = defaultOptions.plotOptions || {};\n parent = parent || '';\n // Merge the options\n defaultPlotOptions[type] = merge(defaultPlotOptions[parent], options);\n // Create the class\n delete SeriesRegistry.seriesTypes[type];\n registerSeriesType(type, extendClass(SeriesRegistry.seriesTypes[parent] || function () { }, seriesProto));\n SeriesRegistry.seriesTypes[type].prototype.type = type;\n // Create the point class if needed\n if (pointProto) {\n class PointClass extends Point {\n }\n extend(PointClass.prototype, pointProto);\n SeriesRegistry.seriesTypes[type].prototype.pointClass = PointClass;\n }\n return SeriesRegistry.seriesTypes[type];\n }\n SeriesRegistry.seriesType = seriesType;\n})(SeriesRegistry || (SeriesRegistry = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default SeriesRegistry;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../Animation/AnimationUtilities.js';\nconst { animObject, setAnimation } = A;\nimport D from '../Defaults.js';\nconst { defaultOptions } = D;\nimport F from '../Foundation.js';\nconst { registerEventOptions } = F;\nimport H from '../Globals.js';\nconst { svg, win } = H;\nimport LegendSymbol from '../Legend/LegendSymbol.js';\nimport Point from './Point.js';\nimport SeriesDefaults from './SeriesDefaults.js';\nimport SeriesRegistry from './SeriesRegistry.js';\nconst { seriesTypes } = SeriesRegistry;\nimport SVGElement from '../Renderer/SVG/SVGElement.js';\nimport U from '../Utilities.js';\nconst { arrayMax, arrayMin, clamp, correctFloat, defined, destroyObjectProperties, diffObjects, erase, error, extend, find, fireEvent, getClosestDistance, getNestedProperty, insertItem, isArray, isNumber, isString, merge, objectEach, pick, removeEvent, splat, syncTimeout } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * This is the base series prototype that all other series types inherit from.\n * A new series is initialized either through the\n * [series](https://api.highcharts.com/highcharts/series)\n * option structure, or after the chart is initialized, through\n * {@link Highcharts.Chart#addSeries}.\n *\n * The object can be accessed in a number of ways. All series and point event\n * handlers give a reference to the `series` object. The chart object has a\n * {@link Highcharts.Chart#series|series} property that is a collection of all\n * the chart's series. The point objects and axis objects also have the same\n * reference.\n *\n * Another way to reference the series programmatically is by `id`. Add an id\n * in the series configuration options, and get the series object by\n * {@link Highcharts.Chart#get}.\n *\n * Configuration options for the series are given in three levels. Options for\n * all series in a chart are given in the\n * [plotOptions.series](https://api.highcharts.com/highcharts/plotOptions.series)\n * object. Then options for all series of a specific type\n * are given in the plotOptions of that type, for example `plotOptions.line`.\n * Next, options for one single series are given in the series array, or as\n * arguments to `chart.addSeries`.\n *\n * The data in the series is stored in various arrays.\n *\n * - First, `series.options.data` contains all the original config options for\n * each point whether added by options or methods like `series.addPoint`.\n *\n * - Next, `series.data` contains those values converted to points, but in case\n * the series data length exceeds the `cropThreshold`, or if the data is\n * grouped, `series.data` doesn't contain all the points. It only contains the\n * points that have been created on demand.\n *\n * - Then there's `series.points` that contains all currently visible point\n * objects. In case of cropping, the cropped-away points are not part of this\n * array. The `series.points` array starts at `series.cropStart` compared to\n * `series.data` and `series.options.data`. If however the series data is\n * grouped, these can't be correlated one to one.\n *\n * - `series.xData` and `series.processedXData` contain clean x values,\n * equivalent to `series.data` and `series.points`.\n *\n * - `series.yData` and `series.processedYData` contain clean y values,\n * equivalent to `series.data` and `series.points`.\n *\n * @class\n * @name Highcharts.Series\n *\n * @param {Highcharts.Chart} chart\n * The chart instance.\n *\n * @param {Highcharts.SeriesOptionsType|object} options\n * The series options.\n */\nclass Series {\n constructor() {\n /* *\n *\n * Static Properties\n *\n * */\n this.zoneAxis = 'y';\n /** eslint-enable valid-jsdoc */\n }\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n init(chart, userOptions) {\n fireEvent(this, 'init', { options: userOptions });\n const series = this, chartSeries = chart.series;\n // The 'eventsToUnbind' property moved from prototype into the\n // Series init to avoid reference to the same array between\n // the different series and charts. #12959, #13937\n this.eventsToUnbind = [];\n /**\n * Read only. The chart that the series belongs to.\n *\n * @name Highcharts.Series#chart\n * @type {Highcharts.Chart}\n */\n series.chart = chart;\n /**\n * Read only. The series' type, like \"line\", \"area\", \"column\" etc.\n * The type in the series options anc can be altered using\n * {@link Series#update}.\n *\n * @name Highcharts.Series#type\n * @type {string}\n */\n /**\n * Read only. The series' current options. To update, use\n * {@link Series#update}.\n *\n * @name Highcharts.Series#options\n * @type {Highcharts.SeriesOptionsType}\n */\n series.options = series.setOptions(userOptions);\n const options = series.options, visible = options.visible !== false;\n /**\n * All child series that are linked to the current series through the\n * [linkedTo](https://api.highcharts.com/highcharts/series.line.linkedTo)\n * option.\n *\n * @name Highcharts.Series#linkedSeries\n * @type {Array}\n * @readonly\n */\n series.linkedSeries = [];\n // Bind the axes\n series.bindAxes();\n extend(series, {\n /**\n * The series name as given in the options. Defaults to\n * \"Series {n}\".\n *\n * @name Highcharts.Series#name\n * @type {string}\n */\n name: options.name,\n state: '',\n /**\n * Read only. The series' visibility state as set by {@link\n * Series#show}, {@link Series#hide}, or in the initial\n * configuration.\n *\n * @name Highcharts.Series#visible\n * @type {boolean}\n */\n visible,\n /**\n * Read only. The series' selected state as set by {@link\n * Highcharts.Series#select}.\n *\n * @name Highcharts.Series#selected\n * @type {boolean}\n */\n selected: options.selected === true // False by default\n });\n registerEventOptions(this, options);\n const events = options.events;\n if ((events && events.click) ||\n (options.point &&\n options.point.events &&\n options.point.events.click) ||\n options.allowPointSelect) {\n chart.runTrackerClick = true;\n }\n series.getColor();\n series.getSymbol();\n // Initialize the parallel data arrays\n series.parallelArrays.forEach(function (key) {\n if (!series[key + 'Data']) {\n series[key + 'Data'] = [];\n }\n });\n // Mark cartesian\n if (series.isCartesian) {\n chart.hasCartesianSeries = true;\n }\n // Get the index and register the series in the chart. The index is\n // one more than the current latest series index (#5960).\n let lastSeries;\n if (chartSeries.length) {\n lastSeries = chartSeries[chartSeries.length - 1];\n }\n series._i = pick(lastSeries && lastSeries._i, -1) + 1;\n series.opacity = series.options.opacity;\n // Insert the series and re-order all series above the insertion\n // point.\n chart.orderItems('series', insertItem(this, chartSeries));\n // Set options for series with sorting and set data later.\n if (options.dataSorting && options.dataSorting.enabled) {\n series.setDataSortingOptions();\n }\n else if (!series.points && !series.data) {\n series.setData(options.data, false);\n }\n fireEvent(this, 'afterInit');\n }\n /**\n * Check whether the series item is itself or inherits from a certain\n * series type.\n *\n * @function Highcharts.Series#is\n * @param {string} type The type of series to check for, can be either\n * featured or custom series types. For example `column`, `pie`,\n * `ohlc` etc.\n *\n * @return {boolean}\n * True if this item is or inherits from the given type.\n */\n is(type) {\n return seriesTypes[type] && this instanceof seriesTypes[type];\n }\n /**\n * Set the xAxis and yAxis properties of cartesian series, and register\n * the series in the `axis.series` array.\n *\n * @private\n * @function Highcharts.Series#bindAxes\n */\n bindAxes() {\n const series = this, seriesOptions = series.options, chart = series.chart;\n let axisOptions;\n fireEvent(this, 'bindAxes', null, function () {\n // repeat for xAxis and yAxis\n (series.axisTypes || []).forEach(function (coll) {\n // loop through the chart's axis objects\n chart[coll].forEach(function (axis) {\n axisOptions = axis.options;\n // apply if the series xAxis or yAxis option matches\n // the number of the axis, or if undefined, use the\n // first axis\n if (pick(seriesOptions[coll], 0) === axis.index ||\n (typeof seriesOptions[coll] !==\n 'undefined' &&\n seriesOptions[coll] === axisOptions.id)) {\n // register this series in the axis.series lookup\n insertItem(series, axis.series);\n // set this series.xAxis or series.yAxis reference\n /**\n * Read only. The unique xAxis object associated\n * with the series.\n *\n * @name Highcharts.Series#xAxis\n * @type {Highcharts.Axis}\n */\n /**\n * Read only. The unique yAxis object associated\n * with the series.\n *\n * @name Highcharts.Series#yAxis\n * @type {Highcharts.Axis}\n */\n series[coll] = axis;\n // mark dirty for redraw\n axis.isDirty = true;\n }\n });\n // The series needs an X and an Y axis\n if (!series[coll] &&\n series.optionalAxis !== coll) {\n error(18, true, chart);\n }\n });\n });\n fireEvent(this, 'afterBindAxes');\n }\n /**\n * For simple series types like line and column, the data values are\n * held in arrays like xData and yData for quick lookup to find extremes\n * and more. For multidimensional series like bubble and map, this can\n * be extended with arrays like zData and valueData by adding to the\n * `series.parallelArrays` array.\n *\n * @private\n * @function Highcharts.Series#updateParallelArrays\n */\n updateParallelArrays(point, i, iArgs) {\n const series = point.series, fn = isNumber(i) ?\n // Insert the value in the given position\n function (key) {\n const val = key === 'y' && series.toYData ?\n series.toYData(point) :\n point[key];\n series[key + 'Data'][i] = val;\n } :\n // Apply the method specified in i with the following\n // arguments as arguments\n function (key) {\n Array.prototype[i].apply(series[key + 'Data'], iArgs);\n };\n series.parallelArrays.forEach(fn);\n }\n /**\n * Define hasData functions for series. These return true if there\n * are data points on this series within the plot area.\n *\n * @private\n * @function Highcharts.Series#hasData\n */\n hasData() {\n return ((this.visible &&\n typeof this.dataMax !== 'undefined' &&\n typeof this.dataMin !== 'undefined') || ( // #3703\n this.visible &&\n this.yData &&\n this.yData.length > 0) // #9758\n );\n }\n /**\n * Determine whether the marker in a series has changed.\n *\n * @private\n * @function Highcharts.Series#hasMarkerChanged\n */\n hasMarkerChanged(options, oldOptions) {\n const marker = options.marker, oldMarker = oldOptions.marker || {};\n return marker && ((oldMarker.enabled && !marker.enabled) ||\n oldMarker.symbol !== marker.symbol || // #10870, #15946\n oldMarker.height !== marker.height || // #16274\n oldMarker.width !== marker.width // #16274\n );\n }\n /**\n * Return an auto incremented x value based on the pointStart and\n * pointInterval options. This is only used if an x value is not given\n * for the point that calls autoIncrement.\n *\n * @private\n * @function Highcharts.Series#autoIncrement\n */\n autoIncrement(x) {\n const options = this.options, pointIntervalUnit = options.pointIntervalUnit, relativeXValue = options.relativeXValue, time = this.chart.time;\n let xIncrement = this.xIncrement, date, pointInterval;\n xIncrement = pick(xIncrement, options.pointStart, 0);\n this.pointInterval = pointInterval = pick(this.pointInterval, options.pointInterval, 1);\n if (relativeXValue && isNumber(x)) {\n pointInterval *= x;\n }\n // Added code for pointInterval strings\n if (pointIntervalUnit) {\n date = new time.Date(xIncrement);\n if (pointIntervalUnit === 'day') {\n time.set('Date', date, time.get('Date', date) + pointInterval);\n }\n else if (pointIntervalUnit === 'month') {\n time.set('Month', date, time.get('Month', date) + pointInterval);\n }\n else if (pointIntervalUnit === 'year') {\n time.set('FullYear', date, time.get('FullYear', date) + pointInterval);\n }\n pointInterval = date.getTime() - xIncrement;\n }\n if (relativeXValue && isNumber(x)) {\n return xIncrement + pointInterval;\n }\n this.xIncrement = xIncrement + pointInterval;\n return xIncrement;\n }\n /**\n * Internal function to set properties for series if data sorting is\n * enabled.\n *\n * @private\n * @function Highcharts.Series#setDataSortingOptions\n */\n setDataSortingOptions() {\n const options = this.options;\n extend(this, {\n requireSorting: false,\n sorted: false,\n enabledDataSorting: true,\n allowDG: false\n });\n // To allow unsorted data for column series.\n if (!defined(options.pointRange)) {\n options.pointRange = 1;\n }\n }\n /**\n * Set the series options by merging from the options tree. Called\n * internally on initializing and updating series. This function will\n * not redraw the series. For API usage, use {@link Series#update}.\n * @private\n * @function Highcharts.Series#setOptions\n * @param {Highcharts.SeriesOptionsType} itemOptions\n * The series options.\n * @emits Highcharts.Series#event:afterSetOptions\n */\n setOptions(itemOptions) {\n const chart = this.chart, chartOptions = chart.options, plotOptions = chartOptions.plotOptions, userOptions = chart.userOptions || {}, seriesUserOptions = merge(itemOptions), styledMode = chart.styledMode, e = {\n plotOptions: plotOptions,\n userOptions: seriesUserOptions\n };\n let zone;\n fireEvent(this, 'setOptions', e);\n // These may be modified by the event\n const typeOptions = e.plotOptions[this.type], userPlotOptions = (userOptions.plotOptions || {}), userPlotOptionsSeries = userPlotOptions.series || {}, defaultPlotOptionsType = (defaultOptions.plotOptions[this.type] || {}), userPlotOptionsType = userPlotOptions[this.type] || {};\n // use copy to prevent undetected changes (#9762)\n /**\n * Contains series options by the user without defaults.\n * @name Highcharts.Series#userOptions\n * @type {Highcharts.SeriesOptionsType}\n */\n this.userOptions = e.userOptions;\n const options = merge(typeOptions, plotOptions.series, \n // #3881, chart instance plotOptions[type] should trump\n // plotOptions.series\n userPlotOptionsType, seriesUserOptions);\n // The tooltip options are merged between global and series specific\n // options. Importance order asscendingly:\n // globals: (1)tooltip, (2)plotOptions.series,\n // (3)plotOptions[this.type]\n // init userOptions with possible later updates: 4-6 like 1-3 and\n // (7)this series options\n this.tooltipOptions = merge(defaultOptions.tooltip, // 1\n defaultOptions.plotOptions.series?.tooltip, // 2\n defaultPlotOptionsType?.tooltip, // 3\n chart.userOptions.tooltip, // 4\n userPlotOptions.series?.tooltip, // 5\n userPlotOptionsType.tooltip, // 6\n seriesUserOptions.tooltip // 7\n );\n // When shared tooltip, stickyTracking is true by default,\n // unless user says otherwise.\n this.stickyTracking = pick(seriesUserOptions.stickyTracking, userPlotOptionsType.stickyTracking, userPlotOptionsSeries.stickyTracking, (this.tooltipOptions.shared && !this.noSharedTooltip ?\n true :\n options.stickyTracking));\n // Delete marker object if not allowed (#1125)\n if (typeOptions.marker === null) {\n delete options.marker;\n }\n // Handle color zones\n this.zoneAxis = options.zoneAxis || 'y';\n const zones = this.zones = // #20440, create deep copy of zones options\n (options.zones || []).map((z) => ({ ...z }));\n if ((options.negativeColor || options.negativeFillColor) &&\n !options.zones) {\n zone = {\n value: options[this.zoneAxis + 'Threshold'] ||\n options.threshold ||\n 0,\n className: 'highcharts-negative'\n };\n if (!styledMode) {\n zone.color = options.negativeColor;\n zone.fillColor = options.negativeFillColor;\n }\n zones.push(zone);\n }\n // Push one extra zone for the rest\n if (zones.length && defined(zones[zones.length - 1].value)) {\n zones.push(styledMode ? {} : {\n color: this.color,\n fillColor: this.fillColor\n });\n }\n fireEvent(this, 'afterSetOptions', { options: options });\n return options;\n }\n /**\n * Return series name in \"Series {Number}\" format or the one defined by\n * a user. This method can be simply overridden as series name format\n * can vary (e.g. technical indicators).\n *\n * @function Highcharts.Series#getName\n *\n * @return {string}\n * The series name.\n */\n getName() {\n // #4119\n return pick(this.options.name, 'Series ' + (this.index + 1));\n }\n /**\n * @private\n * @function Highcharts.Series#getCyclic\n */\n getCyclic(prop, value, defaults) {\n const chart = this.chart, indexName = `${prop}Index`, counterName = `${prop}Counter`, len = (\n // Symbol count\n defaults?.length ||\n // Color count\n chart.options.chart.colorCount);\n let i, setting;\n if (!value) {\n // Pick up either the colorIndex option, or the series.colorIndex\n // after Series.update()\n setting = pick(prop === 'color' ? this.options.colorIndex : void 0, this[indexName]);\n if (defined(setting)) { // after Series.update()\n i = setting;\n }\n else {\n // #6138\n if (!chart.series.length) {\n chart[counterName] = 0;\n }\n i = chart[counterName] % len;\n chart[counterName] += 1;\n }\n if (defaults) {\n value = defaults[i];\n }\n }\n // Set the colorIndex\n if (typeof i !== 'undefined') {\n this[indexName] = i;\n }\n this[prop] = value;\n }\n /**\n * Get the series' color based on either the options or pulled from\n * global options.\n *\n * @private\n * @function Highcharts.Series#getColor\n */\n getColor() {\n if (this.chart.styledMode) {\n this.getCyclic('color');\n }\n else if (this.options.colorByPoint) {\n this.color = \"#cccccc\" /* Palette.neutralColor20 */;\n }\n else {\n this.getCyclic('color', this.options.color ||\n defaultOptions.plotOptions[this.type].color, this.chart.options.colors);\n }\n }\n /**\n * Get all points' instances created for this series.\n *\n * @private\n * @function Highcharts.Series#getPointsCollection\n */\n getPointsCollection() {\n return (this.hasGroupedData ? this.points : this.data) || [];\n }\n /**\n * Get the series' symbol based on either the options or pulled from\n * global options.\n *\n * @private\n * @function Highcharts.Series#getSymbol\n */\n getSymbol() {\n const seriesMarkerOption = this.options.marker;\n this.getCyclic('symbol', seriesMarkerOption.symbol, this.chart.options.symbols);\n }\n /**\n * Finds the index of an existing point that matches the given point\n * options.\n *\n * @private\n * @function Highcharts.Series#findPointIndex\n * @param {Highcharts.PointOptionsObject} optionsObject\n * The options of the point.\n * @param {number} fromIndex\n * The index to start searching from, used for optimizing series with\n * required sorting.\n * @return {number|undefined}\n * Returns the index of a matching point, or undefined if no match is found.\n */\n findPointIndex(optionsObject, fromIndex) {\n const id = optionsObject.id, x = optionsObject.x, oldData = this.points, dataSorting = this.options.dataSorting;\n let matchingPoint, matchedById, pointIndex;\n if (id) {\n const item = this.chart.get(id);\n if (item instanceof Point) {\n matchingPoint = item;\n }\n }\n else if (this.linkedParent ||\n this.enabledDataSorting ||\n this.options.relativeXValue) {\n let matcher = (oldPoint) => !oldPoint.touched &&\n oldPoint.index === optionsObject.index;\n if (dataSorting && dataSorting.matchByName) {\n matcher = (oldPoint) => !oldPoint.touched &&\n oldPoint.name === optionsObject.name;\n }\n else if (this.options.relativeXValue) {\n matcher = (oldPoint) => !oldPoint.touched &&\n oldPoint.options.x === optionsObject.x;\n }\n matchingPoint = find(oldData, matcher);\n // Add unmatched point as a new point\n if (!matchingPoint) {\n return void 0;\n }\n }\n if (matchingPoint) {\n pointIndex = matchingPoint && matchingPoint.index;\n if (typeof pointIndex !== 'undefined') {\n matchedById = true;\n }\n }\n // Search for the same X in the existing data set\n if (typeof pointIndex === 'undefined' && isNumber(x)) {\n pointIndex = this.xData.indexOf(x, fromIndex);\n }\n // Reduce pointIndex if data is cropped\n if (pointIndex !== -1 &&\n typeof pointIndex !== 'undefined' &&\n this.cropped) {\n pointIndex = (pointIndex >= this.cropStart) ?\n pointIndex - this.cropStart : pointIndex;\n }\n if (!matchedById &&\n isNumber(pointIndex) &&\n oldData[pointIndex] && oldData[pointIndex].touched) {\n pointIndex = void 0;\n }\n return pointIndex;\n }\n /**\n * Internal function called from setData. If the point count is the same\n * as it was, or if there are overlapping X values, just run\n * Point.update which is cheaper, allows animation, and keeps references\n * to points. This also allows adding or removing points if the X-es\n * don't match.\n *\n * @private\n * @function Highcharts.Series#updateData\n */\n updateData(data, animation) {\n const options = this.options, dataSorting = options.dataSorting, oldData = this.points, pointsToAdd = [], requireSorting = this.requireSorting, equalLength = data.length === oldData.length;\n let hasUpdatedByKey, i, point, lastIndex, succeeded = true;\n this.xIncrement = null;\n // Iterate the new data\n data.forEach(function (pointOptions, i) {\n const optionsObject = (defined(pointOptions) &&\n this.pointClass.prototype.optionsToObject.call({ series: this }, pointOptions)) || {};\n let pointIndex;\n // Get the x of the new data point\n const x = optionsObject.x, id = optionsObject.id;\n if (id || isNumber(x)) {\n pointIndex = this.findPointIndex(optionsObject, lastIndex);\n // Matching X not found\n // or used already due to ununique x values (#8995),\n // add point (but later)\n if (pointIndex === -1 ||\n typeof pointIndex === 'undefined') {\n pointsToAdd.push(pointOptions);\n // Matching X found, update\n }\n else if (oldData[pointIndex] &&\n pointOptions !== options.data[pointIndex]) {\n oldData[pointIndex].update(pointOptions, false, null, false);\n // Mark it touched, below we will remove all points that\n // are not touched.\n oldData[pointIndex].touched = true;\n // Speed optimize by only searching after last known\n // index. Performs ~20% bettor on large data sets.\n if (requireSorting) {\n lastIndex = pointIndex + 1;\n }\n // Point exists, no changes, don't remove it\n }\n else if (oldData[pointIndex]) {\n oldData[pointIndex].touched = true;\n }\n // If the length is equal and some of the nodes had a\n // match in the same position, we don't want to remove\n // non-matches.\n if (!equalLength ||\n i !== pointIndex ||\n (dataSorting && dataSorting.enabled) ||\n this.hasDerivedData) {\n hasUpdatedByKey = true;\n }\n }\n else {\n // Gather all points that are not matched\n pointsToAdd.push(pointOptions);\n }\n }, this);\n // Remove points that don't exist in the updated data set\n if (hasUpdatedByKey) {\n i = oldData.length;\n while (i--) {\n point = oldData[i];\n if (point && !point.touched && point.remove) {\n point.remove(false, animation);\n }\n }\n // If we did not find keys (ids or x-values), and the length is the\n // same, update one-to-one\n }\n else if (equalLength && (!dataSorting || !dataSorting.enabled)) {\n data.forEach(function (point, i) {\n // .update doesn't exist on a linked, hidden series (#3709)\n // (#10187)\n if (point !== oldData[i].y && !oldData[i].destroyed) {\n oldData[i].update(point, false, null, false);\n }\n });\n // Don't add new points since those configs are used above\n pointsToAdd.length = 0;\n // Did not succeed in updating data\n }\n else {\n succeeded = false;\n }\n oldData.forEach(function (point) {\n if (point) {\n point.touched = false;\n }\n });\n if (!succeeded) {\n return false;\n }\n // Add new points\n pointsToAdd.forEach(function (point) {\n this.addPoint(point, false, null, null, false);\n }, this);\n if (this.xIncrement === null &&\n this.xData &&\n this.xData.length) {\n this.xIncrement = arrayMax(this.xData);\n this.autoIncrement();\n }\n return true;\n }\n /**\n * Apply a new set of data to the series and optionally redraw it. The\n * new data array is passed by reference (except in case of\n * `updatePoints`), and may later be mutated when updating the chart\n * data.\n *\n * Note the difference in behaviour when setting the same amount of\n * points, or a different amount of points, as handled by the\n * `updatePoints` parameter.\n *\n * @sample highcharts/members/series-setdata/\n * Set new data from a button\n * @sample highcharts/members/series-setdata-pie/\n * Set data in a pie\n * @sample stock/members/series-setdata/\n * Set new data in Highcharts Stock\n * @sample maps/members/series-setdata/\n * Set new data in Highmaps\n *\n * @function Highcharts.Series#setData\n *\n * @param {Array} data\n * Takes an array of data in the same format as described under\n * `series.{type}.data` for the given series type, for example a\n * line series would take data in the form described under\n * [series.line.data](https://api.highcharts.com/highcharts/series.line.data).\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the series is altered. If\n * doing more operations on the chart, it is a good idea to set\n * redraw to false and call {@link Chart#redraw} after.\n *\n * @param {boolean|Partial} [animation]\n * When the updated data is the same length as the existing data,\n * points will be updated by default, and animation visualizes\n * how the points are changed. Set false to disable animation, or\n * a configuration object to set duration or easing.\n *\n * @param {boolean} [updatePoints=true]\n * When this is true, points will be updated instead of replaced\n * whenever possible. This occurs a) when the updated data is the\n * same length as the existing data, b) when points are matched\n * by their id's, or c) when points can be matched by X values.\n * This allows updating with animation and performs better. In\n * this case, the original array is not passed by reference. Set\n * `false` to prevent.\n */\n setData(data, redraw = true, animation, updatePoints) {\n const series = this, oldData = series.points, oldDataLength = (oldData && oldData.length) || 0, options = series.options, chart = series.chart, dataSorting = options.dataSorting, xAxis = series.xAxis, turboThreshold = options.turboThreshold, xData = this.xData, yData = this.yData, pointArrayMap = series.pointArrayMap, valueCount = pointArrayMap && pointArrayMap.length, keys = options.keys;\n let i, pt, updatedData, indexOfX = 0, indexOfY = 1, firstPoint = null, copiedData;\n if (!chart.options.chart.allowMutatingData) { // #4259\n // Remove old reference\n if (options.data) {\n delete series.options.data;\n }\n if (series.userOptions.data) {\n delete series.userOptions.data;\n }\n copiedData = merge(true, data);\n }\n data = copiedData || data || [];\n const dataLength = data.length;\n if (dataSorting && dataSorting.enabled) {\n data = this.sortData(data);\n }\n // First try to run Point.update which is cheaper, allows animation,\n // and keeps references to points.\n if (chart.options.chart.allowMutatingData &&\n updatePoints !== false &&\n dataLength &&\n oldDataLength &&\n !series.cropped &&\n !series.hasGroupedData &&\n series.visible &&\n // Soft updating has no benefit in boost, and causes JS error\n // (#8355)\n !series.boosted) {\n updatedData = this.updateData(data, animation);\n }\n if (!updatedData) {\n // Reset properties\n series.xIncrement = null;\n series.colorCounter = 0; // for series with colorByPoint (#1547)\n // Update parallel arrays\n this.parallelArrays.forEach(function (key) {\n series[key + 'Data'].length = 0;\n });\n // In turbo mode, only one- or twodimensional arrays of numbers\n // are allowed. The first value is tested, and we assume that\n // all the rest are defined the same way. Although the 'for'\n // loops are similar, they are repeated inside each if-else\n // conditional for max performance.\n if (turboThreshold && dataLength > turboThreshold) {\n firstPoint = series.getFirstValidPoint(data);\n if (isNumber(firstPoint)) { // assume all points are numbers\n for (i = 0; i < dataLength; i++) {\n xData[i] = this.autoIncrement();\n yData[i] = data[i];\n }\n // Assume all points are arrays when first point is\n }\n else if (isArray(firstPoint)) {\n if (valueCount) { // [x, low, high] or [x, o, h, l, c]\n if (firstPoint.length === valueCount) {\n for (i = 0; i < dataLength; i++) {\n xData[i] = this.autoIncrement();\n yData[i] = data[i];\n }\n }\n else {\n for (i = 0; i < dataLength; i++) {\n pt = data[i];\n xData[i] = pt[0];\n yData[i] =\n pt.slice(1, valueCount + 1);\n }\n }\n }\n else { // [x, y]\n if (keys) {\n indexOfX = keys.indexOf('x');\n indexOfY = keys.indexOf('y');\n indexOfX = indexOfX >= 0 ? indexOfX : 0;\n indexOfY = indexOfY >= 0 ? indexOfY : 1;\n }\n if (firstPoint.length === 1) {\n indexOfY = 0;\n }\n if (indexOfX === indexOfY) {\n for (i = 0; i < dataLength; i++) {\n xData[i] = this.autoIncrement();\n yData[i] = data[i][indexOfY];\n }\n }\n else {\n for (i = 0; i < dataLength; i++) {\n pt = data[i];\n xData[i] = pt[indexOfX];\n yData[i] = pt[indexOfY];\n }\n }\n }\n }\n else {\n // Highcharts expects configs to be numbers or arrays in\n // turbo mode\n error(12, false, chart);\n }\n }\n else {\n for (i = 0; i < dataLength; i++) {\n pt = { series: series };\n series.pointClass.prototype.applyOptions.apply(pt, [data[i]]);\n series.updateParallelArrays(pt, i);\n }\n }\n // Forgetting to cast strings to numbers is a common caveat when\n // handling CSV or JSON\n if (yData && isString(yData[0])) {\n error(14, true, chart);\n }\n series.data = [];\n series.options.data = series.userOptions.data = data;\n // destroy old points\n i = oldDataLength;\n while (i--) {\n oldData[i]?.destroy();\n }\n // reset minRange (#878)\n if (xAxis) {\n xAxis.minRange = xAxis.userMinRange;\n }\n // redraw\n series.isDirty = chart.isDirtyBox = true;\n series.isDirtyData = !!oldData;\n animation = false;\n }\n // Typically for pie series, points need to be processed and\n // generated prior to rendering the legend\n if (options.legendType === 'point') {\n this.processData();\n this.generatePoints();\n }\n if (redraw) {\n chart.redraw(animation);\n }\n }\n /**\n * Internal function to sort series data\n *\n * @private\n * @function Highcharts.Series#sortData\n * @param {Array} data\n * Force data grouping.\n */\n sortData(data) {\n const series = this, options = series.options, dataSorting = options.dataSorting, sortKey = dataSorting.sortKey || 'y', getPointOptionsObject = function (series, pointOptions) {\n return (defined(pointOptions) &&\n series.pointClass.prototype.optionsToObject.call({\n series: series\n }, pointOptions)) || {};\n };\n data.forEach(function (pointOptions, i) {\n data[i] = getPointOptionsObject(series, pointOptions);\n data[i].index = i;\n }, this);\n // Sorting\n const sortedData = data.concat().sort((a, b) => {\n const aValue = getNestedProperty(sortKey, a);\n const bValue = getNestedProperty(sortKey, b);\n return bValue < aValue ? -1 : bValue > aValue ? 1 : 0;\n });\n // Set x value depending on the position in the array\n sortedData.forEach(function (point, i) {\n point.x = i;\n }, this);\n // Set the same x for linked series points if they don't have their\n // own sorting\n if (series.linkedSeries) {\n series.linkedSeries.forEach(function (linkedSeries) {\n const options = linkedSeries.options, seriesData = options.data;\n if ((!options.dataSorting ||\n !options.dataSorting.enabled) &&\n seriesData) {\n seriesData.forEach(function (pointOptions, i) {\n seriesData[i] = getPointOptionsObject(linkedSeries, pointOptions);\n if (data[i]) {\n seriesData[i].x = data[i].x;\n seriesData[i].index = i;\n }\n });\n linkedSeries.setData(seriesData, false);\n }\n });\n }\n return data;\n }\n /**\n * Internal function to process the data by cropping away unused data\n * points if the series is longer than the crop threshold. This saves\n * computing time for large series.\n *\n * @private\n * @function Highcharts.Series#getProcessedData\n * @param {boolean} [forceExtremesFromAll]\n * Force getting extremes of a total series data range.\n */\n getProcessedData(forceExtremesFromAll) {\n const series = this, xAxis = series.xAxis, options = series.options, cropThreshold = options.cropThreshold, getExtremesFromAll = forceExtremesFromAll ||\n series.getExtremesFromAll ||\n options.getExtremesFromAll, // #4599\n logarithmic = xAxis?.logarithmic, isCartesian = series.isCartesian;\n let croppedData, cropped, cropStart = 0, xExtremes, min, max, \n // copied during slice operation:\n processedXData = series.xData, processedYData = series.yData, updatingNames = false;\n const dataLength = processedXData.length;\n if (xAxis) {\n // corrected for log axis (#3053)\n xExtremes = xAxis.getExtremes();\n min = xExtremes.min;\n max = xExtremes.max;\n updatingNames = !!(xAxis.categories && !xAxis.names.length);\n }\n // optionally filter out points outside the plot area\n if (isCartesian &&\n series.sorted &&\n !getExtremesFromAll &&\n (!cropThreshold ||\n dataLength > cropThreshold ||\n series.forceCrop)) {\n // it's outside current extremes\n if (processedXData[dataLength - 1] < min ||\n processedXData[0] > max) {\n processedXData = [];\n processedYData = [];\n // only crop if it's actually spilling out\n }\n else if (series.yData && (processedXData[0] < min ||\n processedXData[dataLength - 1] > max)) {\n croppedData = this.cropData(series.xData, series.yData, min, max);\n processedXData = croppedData.xData;\n processedYData = croppedData.yData;\n cropStart = croppedData.start;\n cropped = true;\n }\n }\n // Find the closest distance between processed points\n const closestPointRange = getClosestDistance([\n logarithmic ?\n processedXData.map(logarithmic.log2lin) :\n processedXData\n ], \n // Unsorted data is not supported by the line tooltip, as well as\n // data grouping and navigation in Stock charts (#725) and width\n // calculation of columns (#1900). Avoid warning during the\n // premature processing pass in updateNames (#16104).\n () => (series.requireSorting &&\n !updatingNames &&\n error(15, false, series.chart)));\n return {\n xData: processedXData,\n yData: processedYData,\n cropped: cropped,\n cropStart: cropStart,\n closestPointRange: closestPointRange\n };\n }\n /**\n * Internal function to apply processed data.\n * In Highcharts Stock, this function is extended to provide data grouping.\n *\n * @private\n * @function Highcharts.Series#processData\n * @param {boolean} [force]\n * Force data grouping.\n */\n processData(force) {\n const series = this, xAxis = series.xAxis;\n // If the series data or axes haven't changed, don't go through\n // this. Return false to pass the message on to override methods\n // like in data grouping.\n if (series.isCartesian &&\n !series.isDirty &&\n !xAxis.isDirty &&\n !series.yAxis.isDirty &&\n !force) {\n return false;\n }\n const processedData = series.getProcessedData();\n // Record the properties\n series.cropped = processedData.cropped; // undefined or true\n series.cropStart = processedData.cropStart;\n series.processedXData = processedData.xData;\n series.processedYData = processedData.yData;\n series.closestPointRange = (series.basePointRange = processedData.closestPointRange);\n fireEvent(series, 'afterProcessData');\n }\n /**\n * Iterate over xData and crop values between min and max. Returns\n * object containing crop start/end cropped xData with corresponding\n * part of yData, dataMin and dataMax within the cropped range.\n *\n * @private\n * @function Highcharts.Series#cropData\n */\n cropData(xData, yData, min, max) {\n const dataLength = xData.length;\n let i, j, start = 0, end = dataLength;\n // Iterate up to find slice start\n for (i = 0; i < dataLength; i++) {\n if (xData[i] >= min) {\n start = Math.max(0, i - 1);\n break;\n }\n }\n // Proceed to find slice end\n for (j = i; j < dataLength; j++) {\n if (xData[j] > max) {\n end = j + 1;\n break;\n }\n }\n return {\n xData: xData.slice(start, end),\n yData: yData.slice(start, end),\n start,\n end\n };\n }\n /**\n * Generate the data point after the data has been processed by cropping\n * away unused points and optionally grouped in Highcharts Stock.\n *\n * @private\n * @function Highcharts.Series#generatePoints\n */\n generatePoints() {\n const series = this, options = series.options, dataOptions = series.processedData || options.data, processedXData = series.processedXData, processedYData = series.processedYData, PointClass = series.pointClass, processedDataLength = processedXData.length, cropStart = series.cropStart || 0, hasGroupedData = series.hasGroupedData, keys = options.keys, points = [], groupCropStartIndex = (options.dataGrouping &&\n options.dataGrouping.groupAll ?\n cropStart :\n 0);\n let dataLength, cursor, point, i, data = series.data;\n if (!data && !hasGroupedData) {\n const arr = [];\n arr.length = dataOptions.length;\n data = series.data = arr;\n }\n if (keys && hasGroupedData) {\n // grouped data has already applied keys (#6590)\n series.options.keys = false;\n }\n for (i = 0; i < processedDataLength; i++) {\n cursor = cropStart + i;\n if (!hasGroupedData) {\n point = data[cursor];\n // #970:\n if (!point &&\n typeof dataOptions[cursor] !== 'undefined') {\n data[cursor] = point = new PointClass(series, dataOptions[cursor], processedXData[i]);\n }\n }\n else {\n // Splat the y data in case of ohlc data array\n point = new PointClass(series, [processedXData[i]].concat(splat(processedYData[i])));\n point.dataGroup = series.groupMap[groupCropStartIndex + i];\n if (point.dataGroup.options) {\n point.options = point.dataGroup.options;\n extend(point, point.dataGroup.options);\n // Collision of props and options (#9770)\n delete point.dataLabels;\n }\n }\n if (point) { // #6279\n /**\n * Contains the point's index in the `Series.points` array.\n *\n * @name Highcharts.Point#index\n * @type {number}\n * @readonly\n */\n // For faster access in Point.update\n point.index = hasGroupedData ?\n (groupCropStartIndex + i) : cursor;\n points[i] = point;\n }\n }\n // restore keys options (#6590)\n series.options.keys = keys;\n // Hide cropped-away points - this only runs when the number of\n // points is above cropThreshold, or when switching view from\n // non-grouped data to grouped data (#637)\n if (data &&\n (processedDataLength !== (dataLength = data.length) ||\n hasGroupedData)) {\n for (i = 0; i < dataLength; i++) {\n // when has grouped data, clear all points\n if (i === cropStart && !hasGroupedData) {\n i += processedDataLength;\n }\n if (data[i]) {\n data[i].destroyElements();\n data[i].plotX = void 0; // #1003\n }\n }\n }\n /**\n * Read only. An array containing those values converted to points.\n * In case the series data length exceeds the `cropThreshold`, or if\n * the data is grouped, `series.data` doesn't contain all the\n * points. Also, in case a series is hidden, the `data` array may be\n * empty. In case of cropping, the `data` array may contain `undefined`\n * values, instead of points. To access raw values,\n * `series.options.data` will always be up to date. `Series.data` only\n * contains the points that have been created on demand. To modify the\n * data, use\n * {@link Highcharts.Series#setData} or\n * {@link Highcharts.Point#update}.\n *\n * @see Series.points\n *\n * @name Highcharts.Series#data\n * @type {Array}\n */\n series.data = data;\n /**\n * An array containing all currently visible point objects. In case\n * of cropping, the cropped-away points are not part of this array.\n * The `series.points` array starts at `series.cropStart` compared\n * to `series.data` and `series.options.data`. If however the series\n * data is grouped, these can't be correlated one to one. To modify\n * the data, use {@link Highcharts.Series#setData} or\n * {@link Highcharts.Point#update}.\n *\n * @name Highcharts.Series#points\n * @type {Array}\n */\n series.points = points;\n fireEvent(this, 'afterGeneratePoints');\n }\n /**\n * Get current X extremes for the visible data.\n *\n * @private\n * @function Highcharts.Series#getXExtremes\n * @param {Array} xData\n * The data to inspect. Defaults to the current data within the visible\n * range.\n */\n getXExtremes(xData) {\n return {\n min: arrayMin(xData),\n max: arrayMax(xData)\n };\n }\n /**\n * Calculate Y extremes for the visible data. The result is returned\n * as an object with `dataMin` and `dataMax` properties.\n *\n * @private\n * @function Highcharts.Series#getExtremes\n * @param {Array} [yData]\n * The data to inspect. Defaults to the current data within the visible\n * range.\n * @param {boolean} [forceExtremesFromAll]\n * Force getting extremes of a total series data range.\n */\n getExtremes(yData, forceExtremesFromAll) {\n const xAxis = this.xAxis, yAxis = this.yAxis, xData = this.processedXData || this.xData, activeYData = [], \n // Handle X outside the viewed area. This does not work with\n // non-sorted data like scatter (#7639).\n shoulder = this.requireSorting && !this.is('column') ?\n 1 : 0, \n // #2117, need to compensate for log X axis\n positiveValuesOnly = yAxis ? yAxis.positiveValuesOnly : false;\n let xExtremes, validValue, withinRange, x, y, i, j, xMin = 0, xMax = 0, activeCounter = 0;\n yData = yData || this.stackedYData || this.processedYData || [];\n const yDataLength = yData.length;\n if (xAxis) {\n xExtremes = xAxis.getExtremes();\n xMin = xExtremes.min;\n xMax = xExtremes.max;\n }\n for (i = 0; i < yDataLength; i++) {\n x = xData[i];\n y = yData[i];\n // For points within the visible range, including the first\n // point outside the visible range (#7061), consider y extremes.\n validValue = ((isNumber(y) ||\n isArray(y)) && ((isNumber(y) ? y > 0 : y.length) ||\n !positiveValuesOnly));\n withinRange = (forceExtremesFromAll ||\n this.getExtremesFromAll ||\n this.options.getExtremesFromAll ||\n this.cropped ||\n !xAxis || // for colorAxis support\n ((xData[i + shoulder] || x) >= xMin &&\n (xData[i - shoulder] || x) <= xMax));\n if (validValue && withinRange) {\n j = y.length;\n if (j) { // array, like ohlc or range data\n while (j--) {\n if (isNumber(y[j])) { // #7380, #11513\n activeYData[activeCounter++] = y[j];\n }\n }\n }\n else {\n activeYData[activeCounter++] = y;\n }\n }\n }\n const dataExtremes = {\n activeYData,\n dataMin: arrayMin(activeYData),\n dataMax: arrayMax(activeYData)\n };\n fireEvent(this, 'afterGetExtremes', { dataExtremes });\n return dataExtremes;\n }\n /**\n * Set the current data extremes as `dataMin` and `dataMax` on the\n * Series item. Use this only when the series properties should be\n * updated.\n *\n * @private\n * @function Highcharts.Series#applyExtremes\n */\n applyExtremes() {\n const dataExtremes = this.getExtremes();\n /**\n * Contains the minimum value of the series' data point. Some series\n * types like `networkgraph` do not support this property as they\n * lack a `y`-value.\n * @name Highcharts.Series#dataMin\n * @type {number|undefined}\n * @readonly\n */\n this.dataMin = dataExtremes.dataMin;\n /**\n * Contains the maximum value of the series' data point. Some series\n * types like `networkgraph` do not support this property as they\n * lack a `y`-value.\n * @name Highcharts.Series#dataMax\n * @type {number|undefined}\n * @readonly\n */\n this.dataMax = dataExtremes.dataMax;\n return dataExtremes;\n }\n /**\n * Find and return the first non null point in the data\n *\n * @private\n * @function Highcharts.Series.getFirstValidPoint\n * @param {Array} data\n * Array of options for points\n */\n getFirstValidPoint(data) {\n const dataLength = data.length;\n let i = 0, firstPoint = null;\n while (firstPoint === null && i < dataLength) {\n firstPoint = data[i];\n i++;\n }\n return firstPoint;\n }\n /**\n * Translate data points from raw data values to chart specific\n * positioning data needed later in the `drawPoints` and `drawGraph`\n * functions. This function can be overridden in plugins and custom\n * series type implementations.\n *\n * @function Highcharts.Series#translate\n *\n * @emits Highcharts.Series#events:translate\n */\n translate() {\n if (!this.processedXData) { // hidden series\n this.processData();\n }\n this.generatePoints();\n const series = this, options = series.options, stacking = options.stacking, xAxis = series.xAxis, categories = xAxis.categories, enabledDataSorting = series.enabledDataSorting, yAxis = series.yAxis, points = series.points, dataLength = points.length, pointPlacement = series.pointPlacementToXValue(), // #7860\n dynamicallyPlaced = Boolean(pointPlacement), threshold = options.threshold, stackThreshold = options.startFromThreshold ? threshold : 0;\n let i, plotX, lastPlotX, stackIndicator, closestPointRangePx = Number.MAX_VALUE;\n /**\n * Plotted coordinates need to be within a limited range. Drawing\n * too far outside the viewport causes various rendering issues\n * (#3201, #3923, #7555).\n * @private\n */\n function limitedRange(val) {\n return clamp(val, -1e5, 1e5);\n }\n // Translate each point\n for (i = 0; i < dataLength; i++) {\n const point = points[i], xValue = point.x;\n let stackItem, stackValues, yValue = point.y, lowValue = point.low;\n const stacks = stacking && yAxis.stacking?.stacks[(series.negStacks &&\n yValue <\n (stackThreshold ? 0 : threshold) ?\n '-' :\n '') + series.stackKey];\n plotX = xAxis.translate(// #3923\n xValue, false, false, false, true, pointPlacement);\n /**\n * The translated X value for the point in terms of pixels. Relative\n * to the X axis position if the series has one, otherwise relative\n * to the plot area. Depending on the series type this value might\n * not be defined.\n *\n * In an inverted chart the x-axis is going from the bottom to the\n * top so the `plotX` value is the number of pixels from the bottom\n * of the axis.\n *\n * @see Highcharts.Point#pos\n * @name Highcharts.Point#plotX\n * @type {number|undefined}\n */\n point.plotX = isNumber(plotX) ? correctFloat(// #5236\n limitedRange(plotX) // #3923\n ) : void 0;\n // Calculate the bottom y value for stacked series\n if (stacking &&\n series.visible &&\n stacks &&\n stacks[xValue]) {\n stackIndicator = series.getStackIndicator(stackIndicator, xValue, series.index);\n if (!point.isNull && stackIndicator.key) {\n stackItem = stacks[xValue];\n stackValues = stackItem.points[stackIndicator.key];\n }\n if (stackItem && isArray(stackValues)) {\n lowValue = stackValues[0];\n yValue = stackValues[1];\n if (lowValue === stackThreshold &&\n stackIndicator.key === stacks[xValue].base) {\n lowValue = pick(isNumber(threshold) ? threshold : yAxis.min);\n }\n // #1200, #1232\n if (yAxis.positiveValuesOnly &&\n defined(lowValue) &&\n lowValue <= 0) {\n lowValue = void 0;\n }\n point.total = point.stackTotal = pick(stackItem.total);\n point.percentage = defined(point.y) && stackItem.total ?\n (point.y / stackItem.total * 100) : void 0;\n point.stackY = yValue;\n // in case of variwide series (where widths of points are\n // different in most cases), stack labels are positioned\n // wrongly, so the call of the setOffset is omitted here and\n // labels are correctly positioned later, at the end of the\n // variwide's translate function (#10962)\n if (!series.irregularWidths) {\n stackItem.setOffset(series.pointXOffset || 0, series.barW || 0, void 0, void 0, void 0, series.xAxis);\n }\n }\n }\n // Set translated yBottom or remove it\n point.yBottom = defined(lowValue) ?\n limitedRange(yAxis.translate(lowValue, false, true, false, true)) :\n void 0;\n // General hook, used for Highcharts Stock compare and cumulative\n if (series.dataModify) {\n yValue = series.dataModify.modifyValue(yValue, i);\n }\n // Set the plotY value, reset it for redraws #3201, #18422\n let plotY;\n if (isNumber(yValue) && point.plotX !== void 0) {\n plotY = yAxis.translate(yValue, false, true, false, true);\n plotY = isNumber(plotY) ? limitedRange(plotY) : void 0;\n }\n /**\n * The translated Y value for the point in terms of pixels. Relative\n * to the Y axis position if the series has one, otherwise relative\n * to the plot area. Depending on the series type this value might\n * not be defined.\n *\n * In an inverted chart the y-axis is going from right to left\n * so the `plotY` value is the number of pixels from the right\n * of the `yAxis`.\n *\n * @see Highcharts.Point#pos\n * @name Highcharts.Point#plotY\n * @type {number|undefined}\n */\n point.plotY = plotY;\n point.isInside = this.isPointInside(point);\n // Set client related positions for mouse tracking\n point.clientX = dynamicallyPlaced ?\n correctFloat(xAxis.translate(xValue, false, false, false, true, pointPlacement)) :\n plotX; // #1514, #5383, #5518\n // Negative points #19028\n point.negative = (point.y || 0) < (threshold || 0);\n // some API data\n point.category = pick(categories && categories[point.x], point.x);\n // Determine auto enabling of markers (#3635, #5099)\n if (!point.isNull && point.visible !== false) {\n if (typeof lastPlotX !== 'undefined') {\n closestPointRangePx = Math.min(closestPointRangePx, Math.abs(plotX - lastPlotX));\n }\n lastPlotX = plotX;\n }\n // Find point zone\n point.zone = this.zones.length ? point.getZone() : void 0;\n // Animate new points with data sorting\n if (!point.graphic && series.group && enabledDataSorting) {\n point.isNew = true;\n }\n }\n series.closestPointRangePx = closestPointRangePx;\n fireEvent(this, 'afterTranslate');\n }\n /**\n * Return the series points with null points filtered out.\n *\n * @function Highcharts.Series#getValidPoints\n *\n * @param {Array} [points]\n * The points to inspect, defaults to {@link Series.points}.\n *\n * @param {boolean} [insideOnly=false]\n * Whether to inspect only the points that are inside the visible view.\n *\n * @param {boolean} [allowNull=false]\n * Whether to allow null points to pass as valid points.\n *\n * @return {Array}\n * The valid points.\n */\n getValidPoints(points, insideOnly, allowNull) {\n const chart = this.chart;\n // #3916, #5029, #5085\n return (points || this.points || []).filter(function (point) {\n const { plotX, plotY } = point, \n // Undefined plotY is treated as null when negative values\n // in log axis (#18422)\n asNull = !allowNull && (point.isNull || !isNumber(plotY));\n if (asNull || (insideOnly && !chart.isInsidePlot(plotX, plotY, { inverted: chart.inverted }))) {\n return false;\n }\n return point.visible !== false;\n });\n }\n /**\n * Get the clipping for the series. Could be called for a series to\n * initiate animating the clip or to set the final clip (only width\n * and x).\n *\n * @private\n * @function Highcharts.Series#getClip\n */\n getClipBox() {\n const { chart, xAxis, yAxis } = this;\n // If no axes on the series, use global clipBox\n let { x, y, width, height } = merge(chart.clipBox);\n // Otherwise, use clipBox.width which is corrected for plotBorderWidth\n // and clipOffset\n if (xAxis && xAxis.len !== chart.plotSizeX) {\n width = xAxis.len;\n }\n if (yAxis && yAxis.len !== chart.plotSizeY) {\n height = yAxis.len;\n }\n // If the chart is inverted and the series is not invertible, the chart\n // clip box should be inverted, but not the series clip box (#20264)\n if (chart.inverted && !this.invertible) {\n [width, height] = [height, width];\n }\n return { x, y, width, height };\n }\n /**\n * Get the shared clip key, creating it if it doesn't exist.\n *\n * @private\n * @function Highcharts.Series#getSharedClipKey\n */\n getSharedClipKey() {\n this.sharedClipKey = (this.options.xAxis || 0) + ',' +\n (this.options.yAxis || 0);\n return this.sharedClipKey;\n }\n /**\n * Set the clipping for the series. For animated series the clip is later\n * modified.\n *\n * @private\n * @function Highcharts.Series#setClip\n */\n setClip() {\n const { chart, group, markerGroup } = this, sharedClips = chart.sharedClips, renderer = chart.renderer, clipBox = this.getClipBox(), sharedClipKey = this.getSharedClipKey(); // #4526\n let clipRect = sharedClips[sharedClipKey];\n // If a clipping rectangle for the same set of axes does not exist,\n // create it\n if (!clipRect) {\n sharedClips[sharedClipKey] = clipRect = renderer.clipRect(clipBox);\n // When setting chart size, or when the series is rendered again before\n // starting animating, in compliance to a responsive rule\n }\n else {\n clipRect.animate(clipBox);\n }\n if (group) {\n // When clip is false, reset to no clip after animation\n group.clip(this.options.clip === false ? void 0 : clipRect);\n }\n // Unclip temporary animation clip\n if (markerGroup) {\n markerGroup.clip();\n }\n }\n /**\n * Animate in the series. Called internally twice. First with the `init`\n * parameter set to true, which sets up the initial state of the\n * animation. Then when ready, it is called with the `init` parameter\n * undefined, in order to perform the actual animation.\n *\n * @function Highcharts.Series#animate\n *\n * @param {boolean} [init]\n * Initialize the animation.\n */\n animate(init) {\n const { chart, group, markerGroup } = this, inverted = chart.inverted, animation = animObject(this.options.animation), \n // The key for temporary animation clips\n animationClipKey = [\n this.getSharedClipKey(),\n animation.duration,\n animation.easing,\n animation.defer\n ].join(',');\n let animationClipRect = chart.sharedClips[animationClipKey], markerAnimationClipRect = chart.sharedClips[animationClipKey + 'm'];\n // Initialize the animation. Set up the clipping rectangle.\n if (init && group) {\n const clipBox = this.getClipBox();\n // Create temporary animation clips\n if (!animationClipRect) {\n clipBox.width = 0;\n if (inverted) {\n clipBox.x = chart.plotHeight;\n }\n animationClipRect = chart.renderer.clipRect(clipBox);\n chart.sharedClips[animationClipKey] = animationClipRect;\n // The marker clip box. The number 99 is a safe margin to avoid\n // markers being clipped during animation.\n const markerClipBox = {\n x: inverted ? -99 : -99,\n y: inverted ? -99 : -99,\n width: inverted ? chart.plotWidth + 199 : 99,\n height: inverted ? 99 : chart.plotHeight + 199\n };\n markerAnimationClipRect = chart.renderer.clipRect(markerClipBox);\n chart.sharedClips[animationClipKey + 'm'] = markerAnimationClipRect;\n }\n else {\n // When height changes during animation, typically due to\n // responsive settings\n animationClipRect.attr('height', clipBox.height);\n }\n group.clip(animationClipRect);\n markerGroup?.clip(markerAnimationClipRect);\n // Run the animation\n }\n else if (animationClipRect &&\n // Only first series in this pane\n !animationClipRect.hasClass('highcharts-animating')) {\n const finalBox = this.getClipBox(), step = animation.step;\n // Only do this when there are actually markers, or we have multiple\n // series (#20473)\n if (markerGroup?.element.childNodes.length ||\n chart.series.length > 1) {\n // To provide as smooth animation as possible, update the marker\n // group clipping in steps of the main group animation\n animation.step = function (val, fx) {\n if (step) {\n step.apply(fx, arguments);\n }\n if (fx.prop === 'width' &&\n markerAnimationClipRect?.element) {\n markerAnimationClipRect.attr(inverted ? 'height' : 'width', val + 99);\n }\n };\n }\n animationClipRect\n .addClass('highcharts-animating')\n .animate(finalBox, animation);\n }\n }\n /**\n * This runs after animation to land on the final plot clipping.\n *\n * @private\n * @function Highcharts.Series#afterAnimate\n *\n * @emits Highcharts.Series#event:afterAnimate\n */\n afterAnimate() {\n this.setClip();\n // Destroy temporary clip rectangles that are no longer in use\n objectEach(this.chart.sharedClips, (clip, key, sharedClips) => {\n if (clip && !this.chart.container.querySelector(`[clip-path=\"url(#${clip.id})\"]`)) {\n clip.destroy();\n delete sharedClips[key];\n }\n });\n this.finishedAnimating = true;\n fireEvent(this, 'afterAnimate');\n }\n /**\n * Draw the markers for line-like series types, and columns or other\n * graphical representation for {@link Point} objects for other series\n * types. The resulting element is typically stored as\n * {@link Point.graphic}, and is created on the first call and updated\n * and moved on subsequent calls.\n *\n * @function Highcharts.Series#drawPoints\n */\n drawPoints(points = this.points) {\n const series = this, chart = series.chart, styledMode = chart.styledMode, { colorAxis, options } = series, seriesMarkerOptions = options.marker, markerGroup = series[series.specialGroup || 'markerGroup'], xAxis = series.xAxis, globallyEnabled = pick(seriesMarkerOptions.enabled, !xAxis || xAxis.isRadial ? true : null, \n // Use larger or equal as radius is null in bubbles (#6321)\n series.closestPointRangePx >= (seriesMarkerOptions.enabledThreshold *\n seriesMarkerOptions.radius));\n let i, point, graphic, verb, pointMarkerOptions, hasPointMarker, markerAttribs;\n if (seriesMarkerOptions.enabled !== false ||\n series._hasPointMarkers) {\n for (i = 0; i < points.length; i++) {\n point = points[i];\n graphic = point.graphic;\n verb = graphic ? 'animate' : 'attr';\n pointMarkerOptions = point.marker || {};\n hasPointMarker = !!point.marker;\n const shouldDrawMarker = ((globallyEnabled &&\n typeof pointMarkerOptions.enabled === 'undefined') || pointMarkerOptions.enabled) && !point.isNull && point.visible !== false;\n // only draw the point if y is defined\n if (shouldDrawMarker) {\n // Shortcuts\n const symbol = pick(pointMarkerOptions.symbol, series.symbol, 'rect');\n markerAttribs = series.markerAttribs(point, (point.selected && 'select'));\n // Set starting position for point sliding animation.\n if (series.enabledDataSorting) {\n point.startXPos = xAxis.reversed ?\n -(markerAttribs.width || 0) :\n xAxis.width;\n }\n const isInside = point.isInside !== false;\n if (!graphic &&\n isInside &&\n ((markerAttribs.width || 0) > 0 || point.hasImage)) {\n /**\n * SVG graphic representing the point in the chart. In\n * some cases it may be a hidden graphic to improve\n * accessibility.\n *\n * Typically this is a simple shape, like a `rect`\n * for column charts or `path` for line markers, but\n * for some complex series types like boxplot or 3D\n * charts, the graphic may be a `g` element\n * containing other shapes. The graphic is generated\n * the first time {@link Series#drawPoints} runs,\n * and updated and moved on subsequent runs.\n *\n * @see Highcharts.Point#graphics\n *\n * @name Highcharts.Point#graphic\n * @type {Highcharts.SVGElement|undefined}\n */\n point.graphic = graphic = chart.renderer\n .symbol(symbol, markerAttribs.x, markerAttribs.y, markerAttribs.width, markerAttribs.height, hasPointMarker ?\n pointMarkerOptions :\n seriesMarkerOptions)\n .add(markerGroup);\n // Sliding animation for new points\n if (series.enabledDataSorting &&\n chart.hasRendered) {\n graphic.attr({\n x: point.startXPos\n });\n verb = 'animate';\n }\n }\n if (graphic && verb === 'animate') { // update\n // Since the marker group isn't clipped, each\n // individual marker must be toggled\n graphic[isInside ? 'show' : 'hide'](isInside)\n .animate(markerAttribs);\n }\n // Presentational attributes\n if (graphic) {\n const pointAttr = series.pointAttribs(point, ((styledMode || !point.selected) ?\n void 0 :\n 'select'));\n if (!styledMode) {\n graphic[verb](pointAttr);\n }\n else if (colorAxis) { // #14114\n graphic['css']({\n fill: pointAttr.fill\n });\n }\n }\n if (graphic) {\n graphic.addClass(point.getClassName(), true);\n }\n }\n else if (graphic) {\n point.graphic = graphic.destroy(); // #1269\n }\n }\n }\n }\n /**\n * Get non-presentational attributes for a point. Used internally for\n * both styled mode and classic. Can be overridden for different series\n * types.\n *\n * @see Series#pointAttribs\n *\n * @function Highcharts.Series#markerAttribs\n *\n * @param {Highcharts.Point} point\n * The Point to inspect.\n *\n * @param {string} [state]\n * The state, can be either `hover`, `select` or undefined.\n *\n * @return {Highcharts.SVGAttributes}\n * A hash containing those attributes that are not settable from CSS.\n */\n markerAttribs(point, state) {\n const seriesOptions = this.options, seriesMarkerOptions = seriesOptions.marker, pointMarkerOptions = point.marker || {}, symbol = (pointMarkerOptions.symbol ||\n seriesMarkerOptions.symbol), attribs = {};\n let seriesStateOptions, pointStateOptions, radius = pick(pointMarkerOptions.radius, seriesMarkerOptions && seriesMarkerOptions.radius);\n // Handle hover and select states\n if (state) {\n seriesStateOptions = seriesMarkerOptions.states[state];\n pointStateOptions = pointMarkerOptions.states &&\n pointMarkerOptions.states[state];\n radius = pick(pointStateOptions && pointStateOptions.radius, seriesStateOptions && seriesStateOptions.radius, radius && radius + (seriesStateOptions && seriesStateOptions.radiusPlus ||\n 0));\n }\n point.hasImage = symbol && symbol.indexOf('url') === 0;\n if (point.hasImage) {\n radius = 0; // and subsequently width and height is not set\n }\n const pos = point.pos();\n if (isNumber(radius) && pos) {\n attribs.x = pos[0] - radius;\n attribs.y = pos[1] - radius;\n if (seriesOptions.crisp) {\n // Math.floor for #1843:\n attribs.x = Math.floor(attribs.x);\n }\n }\n if (radius) {\n attribs.width = attribs.height = 2 * radius;\n }\n return attribs;\n }\n /**\n * Internal function to get presentational attributes for each point.\n * Unlike {@link Series#markerAttribs}, this function should return\n * those attributes that can also be set in CSS. In styled mode,\n * `pointAttribs` won't be called.\n *\n * @private\n * @function Highcharts.Series#pointAttribs\n *\n * @param {Highcharts.Point} [point]\n * The point instance to inspect.\n *\n * @param {string} [state]\n * The point state, can be either `hover`, `select` or 'normal'. If\n * undefined, normal state is assumed.\n *\n * @return {Highcharts.SVGAttributes}\n * The presentational attributes to be set on the point.\n */\n pointAttribs(point, state) {\n const seriesMarkerOptions = this.options.marker, pointOptions = point && point.options, pointMarkerOptions = ((pointOptions && pointOptions.marker) || {}), pointColorOption = pointOptions && pointOptions.color, pointColor = point && point.color, zoneColor = point && point.zone && point.zone.color;\n let seriesStateOptions, pointStateOptions, color = this.color, fill, stroke, strokeWidth = pick(pointMarkerOptions.lineWidth, seriesMarkerOptions.lineWidth), opacity = 1;\n color = (pointColorOption ||\n zoneColor ||\n pointColor ||\n color);\n fill = (pointMarkerOptions.fillColor ||\n seriesMarkerOptions.fillColor ||\n color);\n stroke = (pointMarkerOptions.lineColor ||\n seriesMarkerOptions.lineColor ||\n color);\n // Handle hover and select states\n state = state || 'normal';\n if (state) {\n seriesStateOptions = (seriesMarkerOptions.states[state] || {});\n pointStateOptions = (pointMarkerOptions.states &&\n pointMarkerOptions.states[state]) || {};\n strokeWidth = pick(pointStateOptions.lineWidth, seriesStateOptions.lineWidth, strokeWidth + pick(pointStateOptions.lineWidthPlus, seriesStateOptions.lineWidthPlus, 0));\n fill = (pointStateOptions.fillColor ||\n seriesStateOptions.fillColor ||\n fill);\n stroke = (pointStateOptions.lineColor ||\n seriesStateOptions.lineColor ||\n stroke);\n opacity = pick(pointStateOptions.opacity, seriesStateOptions.opacity, opacity);\n }\n return {\n 'stroke': stroke,\n 'stroke-width': strokeWidth,\n 'fill': fill,\n 'opacity': opacity\n };\n }\n /**\n * Clear DOM objects and free up memory.\n *\n * @private\n * @function Highcharts.Series#destroy\n *\n * @emits Highcharts.Series#event:destroy\n */\n destroy(keepEventsForUpdate) {\n const series = this, chart = series.chart, issue134 = /AppleWebKit\\/533/.test(win.navigator.userAgent), data = series.data || [];\n let destroy, i, point, axis;\n // Add event hook\n fireEvent(series, 'destroy', { keepEventsForUpdate });\n // Remove events\n this.removeEvents(keepEventsForUpdate);\n // Erase from axes\n (series.axisTypes || []).forEach(function (AXIS) {\n axis = series[AXIS];\n if (axis && axis.series) {\n erase(axis.series, series);\n axis.isDirty = axis.forceRedraw = true;\n }\n });\n // Remove legend items\n if (series.legendItem) {\n series.chart.legend.destroyItem(series);\n }\n // Destroy all points with their elements\n i = data.length;\n while (i--) {\n point = data[i];\n if (point && point.destroy) {\n point.destroy();\n }\n }\n for (const zone of series.zones) {\n // Destroy SVGElement's but preserve primitive props (#20426)\n destroyObjectProperties(zone, void 0, true);\n }\n // Clear the animation timeout if we are destroying the series\n // during initial animation\n U.clearTimeout(series.animationTimeout);\n // Destroy all SVGElements associated to the series\n objectEach(series, function (val, prop) {\n // Survive provides a hook for not destroying\n if (val instanceof SVGElement && !val.survive) {\n // Issue 134 workaround\n destroy = issue134 && prop === 'group' ?\n 'hide' :\n 'destroy';\n val[destroy]();\n }\n });\n // Remove from hoverSeries\n if (chart.hoverSeries === series) {\n chart.hoverSeries = void 0;\n }\n erase(chart.series, series);\n chart.orderItems('series');\n // Clear all members\n objectEach(series, function (val, prop) {\n if (!keepEventsForUpdate || prop !== 'hcEvents') {\n delete series[prop];\n }\n });\n }\n /**\n * Clip the graphs into zones for colors and styling.\n *\n * @private\n * @function Highcharts.Series#applyZones\n */\n applyZones() {\n const series = this, { area, chart, graph, zones, points, xAxis, yAxis, zoneAxis } = series, { inverted, renderer } = chart, axis = this[`${zoneAxis}Axis`], { isXAxis, len = 0 } = axis || {}, halfWidth = (graph?.strokeWidth() || 0) / 2 + 1, \n // Avoid points that are so close to the threshold that the graph\n // line would be split\n avoidClose = (zone, plotX = 0, plotY = 0) => {\n if (inverted) {\n plotY = len - plotY;\n }\n const { translated = 0, lineClip } = zone, distance = plotY - translated;\n lineClip?.push([\n 'L',\n plotX,\n Math.abs(distance) < halfWidth ?\n plotY - halfWidth * (distance <= 0 ? -1 : 1) :\n translated\n ]);\n };\n if (zones.length &&\n (graph || area) &&\n axis &&\n isNumber(axis.min)) {\n const axisMax = axis.getExtremes().max, \n // Invert the x and y coordinates of inverted charts\n invertPath = (path) => {\n path.forEach((segment, i) => {\n if (segment[0] === 'M' || segment[0] === 'L') {\n path[i] = [\n segment[0],\n isXAxis ? len - segment[1] : segment[1],\n isXAxis ? segment[2] : len - segment[2]\n ];\n }\n });\n };\n // Reset\n zones.forEach((zone) => {\n zone.lineClip = [];\n zone.translated = clamp(axis.toPixels(pick(zone.value, axisMax), true) || 0, 0, len);\n });\n // The use of the Color Threshold assumes there are no gaps so it is\n // safe to hide the original graph and area unless it is not\n // waterfall series, then use showLine property to set lines between\n // columns to be visible (#7862)\n if (graph && !this.showLine) {\n graph.hide();\n }\n if (area) {\n area.hide();\n }\n // Prepare for adaptive clips, avoiding segments close to the\n // threshold (#19709)\n if (zoneAxis === 'y' &&\n // Overheat protection\n points.length < xAxis.len) {\n for (const point of points) {\n const { plotX, plotY, zone } = point, zoneBelow = zone && zones[zones.indexOf(zone) - 1];\n // Close to upper boundary\n if (zone) {\n avoidClose(zone, plotX, plotY);\n }\n // Close to lower boundary\n if (zoneBelow) {\n avoidClose(zoneBelow, plotX, plotY);\n }\n }\n }\n // Compute and apply the clips\n let lastLineClip = [], lastTranslated = axis.toPixels(axis.getExtremes().min, true);\n zones.forEach((zone) => {\n const lineClip = zone.lineClip || [], translated = Math.round(zone.translated || 0);\n if (xAxis.reversed) {\n lineClip.reverse();\n }\n let { clip, simpleClip } = zone, x1 = 0, y1 = 0, x2 = xAxis.len, y2 = yAxis.len;\n if (isXAxis) {\n x1 = translated;\n x2 = lastTranslated;\n }\n else {\n y1 = translated;\n y2 = lastTranslated;\n }\n // Adaptive clips\n const simplePath = [\n ['M', x1, y1],\n ['L', x2, y1],\n ['L', x2, y2],\n ['L', x1, y2],\n ['Z']\n ], adaptivePath = [\n simplePath[0],\n ...lineClip,\n simplePath[1],\n simplePath[2],\n ...lastLineClip,\n simplePath[3],\n simplePath[4]\n ];\n lastLineClip = lineClip.reverse();\n lastTranslated = translated;\n if (inverted) {\n invertPath(adaptivePath);\n if (area) {\n invertPath(simplePath);\n }\n }\n /* Debug clip paths\n chart.renderer.path(adaptivePath)\n .attr({\n stroke: zone.color || this.color || 'gray',\n 'stroke-width': 1,\n 'dashstyle': 'Dash'\n })\n .add(series.group);\n // */\n if (clip) {\n clip.animate({ d: adaptivePath });\n simpleClip?.animate({ d: simplePath });\n }\n else {\n clip = zone.clip = renderer.path(adaptivePath);\n if (area) {\n simpleClip = zone.simpleClip = renderer.path(simplePath);\n }\n }\n // When no data, graph zone is not applied and after setData\n // clip was ignored. As a result, it should be applied each\n // time.\n if (graph) {\n zone.graph?.clip(clip);\n }\n if (area) {\n zone.area?.clip(simpleClip);\n }\n });\n }\n else if (series.visible) {\n // If zones were removed, restore graph and area\n if (graph) {\n graph.show();\n }\n if (area) {\n area.show();\n }\n }\n }\n /**\n * General abstraction for creating plot groups like series.group,\n * series.dataLabelsGroup and series.markerGroup. On subsequent calls,\n * the group will only be adjusted to the updated plot size.\n *\n * @private\n * @function Highcharts.Series#plotGroup\n */\n plotGroup(prop, name, visibility, zIndex, parent) {\n let group = this[prop];\n const isNew = !group, attrs = {\n visibility,\n zIndex: zIndex || 0.1 // Pointer logic uses this\n };\n // Avoid setting undefined opacity, or in styled mode\n if (defined(this.opacity) &&\n !this.chart.styledMode && this.state !== 'inactive' // #13719\n ) {\n attrs.opacity = this.opacity;\n }\n // Generate it on first call\n if (!group) {\n this[prop] = group = this.chart.renderer\n .g()\n .add(parent);\n }\n // Add the class names, and replace existing ones as response to\n // Series.update (#6660)\n group.addClass(('highcharts-' + name +\n ' highcharts-series-' + this.index +\n ' highcharts-' + this.type + '-series ' +\n (defined(this.colorIndex) ?\n 'highcharts-color-' + this.colorIndex + ' ' :\n '') +\n (this.options.className || '') +\n (group.hasClass('highcharts-tracker') ?\n ' highcharts-tracker' :\n '')), true);\n // Place it on first and subsequent (redraw) calls\n group.attr(attrs)[isNew ? 'attr' : 'animate'](this.getPlotBox(name));\n return group;\n }\n /**\n * Get the translation and scale for the plot area of this series.\n *\n * @function Highcharts.Series#getPlotBox\n */\n getPlotBox(name) {\n let horAxis = this.xAxis, vertAxis = this.yAxis;\n const chart = this.chart, inverted = (chart.inverted &&\n !chart.polar &&\n horAxis &&\n this.invertible &&\n name === 'series');\n // Swap axes for inverted (#2339)\n if (chart.inverted) {\n horAxis = vertAxis;\n vertAxis = this.xAxis;\n }\n return {\n translateX: horAxis ? horAxis.left : chart.plotLeft,\n translateY: vertAxis ? vertAxis.top : chart.plotTop,\n rotation: inverted ? 90 : 0,\n rotationOriginX: inverted ?\n (horAxis.len - vertAxis.len) / 2 :\n 0,\n rotationOriginY: inverted ?\n (horAxis.len + vertAxis.len) / 2 :\n 0,\n scaleX: inverted ? -1 : 1,\n scaleY: 1\n };\n }\n /**\n * Removes the event handlers attached previously with addEvents.\n * @private\n * @function Highcharts.Series#removeEvents\n */\n removeEvents(keepEventsForUpdate) {\n const { eventsToUnbind } = this;\n if (!keepEventsForUpdate) {\n // Remove all events\n removeEvent(this);\n }\n if (eventsToUnbind.length) {\n // Remove only internal events for proper update. #12355 solves\n // problem with multiple destroy events\n eventsToUnbind.forEach((unbind) => {\n unbind();\n });\n eventsToUnbind.length = 0;\n }\n }\n /**\n * Render the graph and markers. Called internally when first rendering\n * and later when redrawing the chart. This function can be extended in\n * plugins, but normally shouldn't be called directly.\n *\n * @function Highcharts.Series#render\n *\n * @emits Highcharts.Series#event:afterRender\n */\n render() {\n const series = this, { chart, options, hasRendered } = series, animOptions = animObject(options.animation), visibility = series.visible ?\n 'inherit' : 'hidden', // #2597\n zIndex = options.zIndex, chartSeriesGroup = chart.seriesGroup;\n let animDuration = series.finishedAnimating ?\n 0 : animOptions.duration;\n fireEvent(this, 'render');\n // The group\n series.plotGroup('group', 'series', visibility, zIndex, chartSeriesGroup);\n series.markerGroup = series.plotGroup('markerGroup', 'markers', visibility, zIndex, chartSeriesGroup);\n // Initial clipping, applies to columns etc. (#3839).\n if (options.clip !== false) {\n series.setClip();\n }\n // Initialize the animation\n if (animDuration) {\n series.animate?.(true);\n }\n // Draw the graph if any\n if (series.drawGraph) {\n series.drawGraph();\n series.applyZones();\n }\n // Draw the points\n if (series.visible) {\n series.drawPoints();\n }\n // Draw the data labels\n series.drawDataLabels?.();\n // In pie charts, slices are added to the DOM, but actual rendering\n // is postponed until labels reserved their space\n series.redrawPoints?.();\n // Draw the mouse tracking area\n if (options.enableMouseTracking) {\n series.drawTracker?.();\n }\n // Run the animation\n if (animDuration) {\n series.animate?.();\n }\n // Call the afterAnimate function on animation complete (but don't\n // overwrite the animation.complete option which should be available\n // to the user).\n if (!hasRendered) {\n // Additional time if defer is defined before afterAnimate\n // will be triggered\n if (animDuration && animOptions.defer) {\n animDuration += animOptions.defer;\n }\n series.animationTimeout = syncTimeout(() => {\n series.afterAnimate();\n }, animDuration || 0);\n }\n // Means data is in accordance with what you see\n series.isDirty = false;\n // (See #322) series.isDirty = series.isDirtyData = false; // means\n // data is in accordance with what you see\n series.hasRendered = true;\n fireEvent(series, 'afterRender');\n }\n /**\n * Redraw the series. This function is called internally from\n * `chart.redraw` and normally shouldn't be called directly.\n * @private\n * @function Highcharts.Series#redraw\n */\n redraw() {\n // Cache it here as it is set to false in render, but used after\n const wasDirty = this.isDirty || this.isDirtyData;\n this.translate();\n this.render();\n if (wasDirty) { // #3868, #3945\n delete this.kdTree;\n }\n }\n /**\n * Whether to reserve space for the series, either because it is visible or\n * because the `chart.ignoreHiddenSeries` option is false.\n *\n * @private\n */\n reserveSpace() {\n return this.visible || !this.chart.options.chart.ignoreHiddenSeries;\n }\n /**\n * Find the nearest point from a pointer event. This applies to series that\n * use k-d-trees to get the nearest point. Native pointer events must be\n * normalized using `Pointer.normalize`, that adds `chartX` and `chartY`\n * properties.\n *\n * @sample highcharts/demo/synchronized-charts\n * Synchronized charts with tooltips\n *\n * @function Highcharts.Series#searchPoint\n *\n * @param {Highcharts.PointerEvent} e\n * The normalized pointer event\n * @param {boolean} [compareX=false]\n * Search only by the X value, not Y\n *\n * @return {Point|undefined}\n * The closest point to the pointer event\n */\n searchPoint(e, compareX) {\n const { xAxis, yAxis } = this, inverted = this.chart.inverted;\n return this.searchKDTree({\n clientX: inverted ?\n xAxis.len - e.chartY + xAxis.pos :\n e.chartX - xAxis.pos,\n plotY: inverted ?\n yAxis.len - e.chartX + yAxis.pos :\n e.chartY - yAxis.pos\n }, compareX, e);\n }\n /**\n * Build the k-d-tree that is used by mouse and touch interaction to get\n * the closest point. Line-like series typically have a one-dimensional\n * tree where points are searched along the X axis, while scatter-like\n * series typically search in two dimensions, X and Y.\n *\n * @private\n * @function Highcharts.Series#buildKDTree\n */\n buildKDTree(e) {\n // Prevent multiple k-d-trees from being built simultaneously\n // (#6235)\n this.buildingKdTree = true;\n const series = this, dimensions = series.options.findNearestPointBy\n .indexOf('y') > -1 ? 2 : 1;\n /**\n * Internal function\n * @private\n */\n function kdtree(points, depth, dimensions) {\n const length = points?.length;\n let axis, median;\n if (length) {\n // Alternate between the axis\n axis = series.kdAxisArray[depth % dimensions];\n // Sort point array\n points.sort((a, b) => (a[axis] || 0) - (b[axis] || 0));\n median = Math.floor(length / 2);\n // Build and return node\n return {\n point: points[median],\n left: kdtree(points.slice(0, median), depth + 1, dimensions),\n right: kdtree(points.slice(median + 1), depth + 1, dimensions)\n };\n }\n }\n /**\n * Start the recursive build process with a clone of the points\n * array and null points filtered out. (#3873)\n * @private\n */\n function startRecursive() {\n series.kdTree = kdtree(series.getValidPoints(void 0, \n // For line-type series restrict to plot area, but\n // column-type series not (#3916, #4511)\n !series.directTouch), dimensions, dimensions);\n series.buildingKdTree = false;\n }\n delete series.kdTree;\n // For testing tooltips, don't build async. Also if touchstart, we may\n // be dealing with click events on mobile, so don't delay (#6817).\n syncTimeout(startRecursive, series.options.kdNow || e?.type === 'touchstart' ? 0 : 1);\n }\n /**\n * @private\n * @function Highcharts.Series#searchKDTree\n */\n searchKDTree(point, compareX, e) {\n const series = this, [kdX, kdY] = this.kdAxisArray, kdComparer = compareX ? 'distX' : 'dist', kdDimensions = (series.options.findNearestPointBy || '')\n .indexOf('y') > -1 ? 2 : 1, useRadius = !!series.isBubble;\n /**\n * Set the one and two dimensional distance on the point object.\n * @private\n */\n function setDistance(p1, p2) {\n const p1kdX = p1[kdX], p2kdX = p2[kdX], x = (defined(p1kdX) && defined(p2kdX)) ? p1kdX - p2kdX : null, p1kdY = p1[kdY], p2kdY = p2[kdY], y = (defined(p1kdY) && defined(p2kdY)) ? p1kdY - p2kdY : 0, radius = useRadius ? (p2.marker?.radius || 0) : 0;\n p2.dist = Math.sqrt(((x && x * x) || 0) + y * y) - radius;\n p2.distX = defined(x) ? (Math.abs(x) - radius) : Number.MAX_VALUE;\n }\n /**\n * @private\n */\n function doSearch(search, tree, depth, dimensions) {\n const point = tree.point, axis = series.kdAxisArray[depth % dimensions];\n let nPoint1, nPoint2, ret = point;\n setDistance(search, point);\n // Pick side based on distance to splitting point\n const tdist = (search[axis] || 0) - (point[axis] || 0) +\n (useRadius ? (point.marker?.radius || 0) : 0), sideA = tdist < 0 ? 'left' : 'right', sideB = tdist < 0 ? 'right' : 'left';\n // End of tree\n if (tree[sideA]) {\n nPoint1 = doSearch(search, tree[sideA], depth + 1, dimensions);\n ret = (nPoint1[kdComparer] <\n ret[kdComparer] ?\n nPoint1 :\n point);\n }\n if (tree[sideB]) {\n // Compare distance to current best to splitting point to decide\n // whether to check side B or not\n if (Math.sqrt(tdist * tdist) < ret[kdComparer]) {\n nPoint2 = doSearch(search, tree[sideB], depth + 1, dimensions);\n ret = (nPoint2[kdComparer] <\n ret[kdComparer] ?\n nPoint2 :\n ret);\n }\n }\n return ret;\n }\n if (!this.kdTree && !this.buildingKdTree) {\n this.buildKDTree(e);\n }\n if (this.kdTree) {\n return doSearch(point, this.kdTree, kdDimensions, kdDimensions);\n }\n }\n /**\n * @private\n * @function Highcharts.Series#pointPlacementToXValue\n */\n pointPlacementToXValue() {\n const { options, xAxis } = this;\n let factor = options.pointPlacement;\n // Point placement is relative to each series pointRange (#5889)\n if (factor === 'between') {\n factor = xAxis.reversed ? -0.5 : 0.5; // #11955\n }\n return isNumber(factor) ?\n factor * (options.pointRange || xAxis.pointRange) :\n 0;\n }\n /**\n * @private\n * @function Highcharts.Series#isPointInside\n */\n isPointInside(point) {\n const { chart, xAxis, yAxis } = this, { plotX = -1, plotY = -1 } = point, isInside = (plotY >= 0 &&\n plotY <= (yAxis ? yAxis.len : chart.plotHeight) &&\n plotX >= 0 &&\n plotX <= (xAxis ? xAxis.len : chart.plotWidth));\n return isInside;\n }\n /**\n * Draw the tracker object that sits above all data labels and markers to\n * track mouse events on the graph or points. For the line type charts\n * the tracker uses the same graphPath, but with a greater stroke width\n * for better control.\n * @private\n */\n drawTracker() {\n const series = this, options = series.options, trackByArea = options.trackByArea, trackerPath = [].concat((trackByArea ? series.areaPath : series.graphPath) || []), chart = series.chart, pointer = chart.pointer, renderer = chart.renderer, snap = chart.options.tooltip?.snap || 0, onMouseOver = () => {\n if (options.enableMouseTracking &&\n chart.hoverSeries !== series) {\n series.onMouseOver();\n }\n }, \n /*\n * Empirical lowest possible opacities for TRACKER_FILL for an\n * element to stay invisible but clickable\n * IE9: 0.00000000001 (unlimited)\n * IE10: 0.0001 (exporting only)\n * FF: 0.00000000001 (unlimited)\n * Chrome: 0.000001\n * Safari: 0.000001\n * Opera: 0.00000000001 (unlimited)\n */\n TRACKER_FILL = 'rgba(192,192,192,' + (svg ? 0.0001 : 0.002) + ')';\n let tracker = series.tracker;\n // Draw the tracker\n if (tracker) {\n tracker.attr({ d: trackerPath });\n }\n else if (series.graph) { // Create\n series.tracker = tracker = renderer.path(trackerPath)\n .attr({\n visibility: series.visible ? 'inherit' : 'hidden',\n zIndex: 2\n })\n .addClass(trackByArea ?\n 'highcharts-tracker-area' :\n 'highcharts-tracker-line')\n .add(series.group);\n if (!chart.styledMode) {\n tracker.attr({\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n stroke: TRACKER_FILL,\n fill: trackByArea ? TRACKER_FILL : 'none',\n 'stroke-width': series.graph.strokeWidth() +\n (trackByArea ? 0 : 2 * snap)\n });\n }\n // The tracker is added to the series group, which is clipped, but\n // is covered by the marker group. So the marker group also needs to\n // capture events.\n [\n series.tracker,\n series.markerGroup,\n series.dataLabelsGroup\n ].forEach((tracker) => {\n if (tracker) {\n tracker.addClass('highcharts-tracker')\n .on('mouseover', onMouseOver)\n .on('mouseout', (e) => {\n pointer?.onTrackerMouseOut(e);\n });\n if (options.cursor && !chart.styledMode) {\n tracker.css({ cursor: options.cursor });\n }\n tracker.on('touchstart', onMouseOver);\n }\n });\n }\n fireEvent(this, 'afterDrawTracker');\n }\n /**\n * Add a point to the series after render time. The point can be added at\n * the end, or by giving it an X value, to the start or in the middle of the\n * series.\n *\n * @sample highcharts/members/series-addpoint-append/\n * Append point\n * @sample highcharts/members/series-addpoint-append-and-shift/\n * Append and shift\n * @sample highcharts/members/series-addpoint-x-and-y/\n * Both X and Y values given\n * @sample highcharts/members/series-addpoint-pie/\n * Append pie slice\n * @sample stock/members/series-addpoint/\n * Append 100 points in Highcharts Stock\n * @sample stock/members/series-addpoint-shift/\n * Append and shift in Highcharts Stock\n * @sample maps/members/series-addpoint/\n * Add a point in Highmaps\n *\n * @function Highcharts.Series#addPoint\n *\n * @param {Highcharts.PointOptionsType} options\n * The point options. If options is a single number, a point with\n * that y value is appended to the series. If it is an array, it will\n * be interpreted as x and y values respectively. If it is an\n * object, advanced options as outlined under `series.data` are\n * applied.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the point is added. When adding\n * more than one point, it is highly recommended that the redraw\n * option be set to false, and instead {@link Chart#redraw} is\n * explicitly called after the adding of points is finished.\n * Otherwise, the chart will redraw after adding each point.\n *\n * @param {boolean} [shift=false]\n * If true, a point is shifted off the start of the series as one is\n * appended to the end.\n *\n * @param {boolean|Partial} [animation]\n * Whether to apply animation, and optionally animation\n * configuration.\n *\n * @param {boolean} [withEvent=true]\n * Used internally, whether to fire the series `addPoint` event.\n *\n * @emits Highcharts.Series#event:addPoint\n */\n addPoint(options, redraw, shift, animation, withEvent) {\n const series = this, seriesOptions = series.options, data = series.data, chart = series.chart, xAxis = series.xAxis, names = xAxis && xAxis.hasNames && xAxis.names, dataOptions = seriesOptions.data, xData = series.xData;\n let isInTheMiddle, i;\n // Optional redraw, defaults to true\n redraw = pick(redraw, true);\n // Get options and push the point to xData, yData and series.options. In\n // series.generatePoints the Point instance will be created on demand\n // and pushed to the series.data array.\n const point = { series: series };\n series.pointClass.prototype.applyOptions.apply(point, [options]);\n const x = point.x;\n // Get the insertion point\n i = xData.length;\n if (series.requireSorting && x < xData[i - 1]) {\n isInTheMiddle = true;\n while (i && xData[i - 1] > x) {\n i--;\n }\n }\n // Insert undefined item\n series.updateParallelArrays(point, 'splice', [i, 0, 0]);\n // Update it\n series.updateParallelArrays(point, i);\n if (names && point.name) {\n names[x] = point.name;\n }\n dataOptions.splice(i, 0, options);\n if (isInTheMiddle ||\n // When processedData is present we need to splice an empty slot\n // into series.data, otherwise generatePoints won't pick it up.\n series.processedData) {\n series.data.splice(i, 0, null);\n series.processData();\n }\n // Generate points to be added to the legend (#1329)\n if (seriesOptions.legendType === 'point') {\n series.generatePoints();\n }\n // Shift the first point off the parallel arrays\n if (shift) {\n if (data[0] && !!data[0].remove) {\n data[0].remove(false);\n }\n else {\n data.shift();\n series.updateParallelArrays(point, 'shift');\n dataOptions.shift();\n }\n }\n // Fire event\n if (withEvent !== false) {\n fireEvent(series, 'addPoint', { point: point });\n }\n // redraw\n series.isDirty = true;\n series.isDirtyData = true;\n if (redraw) {\n chart.redraw(animation); // Animation is set anyway on redraw, #5665\n }\n }\n /**\n * Remove a point from the series. Unlike the\n * {@link Highcharts.Point#remove} method, this can also be done on a point\n * that is not instantiated because it is outside the view or subject to\n * Highcharts Stock data grouping.\n *\n * @sample highcharts/members/series-removepoint/\n * Remove cropped point\n *\n * @function Highcharts.Series#removePoint\n *\n * @param {number} i\n * The index of the point in the {@link Highcharts.Series.data|data}\n * array.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the point is added. When\n * removing more than one point, it is highly recommended that the\n * `redraw` option be set to `false`, and instead {@link\n * Highcharts.Chart#redraw} is explicitly called after the adding of\n * points is finished.\n *\n * @param {boolean|Partial} [animation]\n * Whether and optionally how the series should be animated.\n *\n * @emits Highcharts.Point#event:remove\n */\n removePoint(i, redraw, animation) {\n const series = this, data = series.data, point = data[i], points = series.points, chart = series.chart, remove = function () {\n if (points && points.length === data.length) { // #4935\n points.splice(i, 1);\n }\n data.splice(i, 1);\n series.options.data.splice(i, 1);\n series.updateParallelArrays(point || { series: series }, 'splice', [i, 1]);\n if (point) {\n point.destroy();\n }\n // redraw\n series.isDirty = true;\n series.isDirtyData = true;\n if (redraw) {\n chart.redraw();\n }\n };\n setAnimation(animation, chart);\n redraw = pick(redraw, true);\n // Fire the event with a default handler of removing the point\n if (point) {\n point.firePointEvent('remove', null, remove);\n }\n else {\n remove();\n }\n }\n /**\n * Remove a series and optionally redraw the chart.\n *\n * @sample highcharts/members/series-remove/\n * Remove first series from a button\n *\n * @function Highcharts.Series#remove\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart or wait for an explicit call to\n * {@link Highcharts.Chart#redraw}.\n *\n * @param {boolean|Partial} [animation]\n * Whether to apply animation, and optionally animation\n * configuration.\n *\n * @param {boolean} [withEvent=true]\n * Used internally, whether to fire the series `remove` event.\n *\n * @emits Highcharts.Series#event:remove\n */\n remove(redraw, animation, withEvent, keepEvents) {\n const series = this, chart = series.chart;\n /**\n * @private\n */\n function remove() {\n // Destroy elements\n series.destroy(keepEvents);\n // Redraw\n chart.isDirtyLegend = chart.isDirtyBox = true;\n chart.linkSeries(keepEvents);\n if (pick(redraw, true)) {\n chart.redraw(animation);\n }\n }\n // Fire the event with a default handler of removing the point\n if (withEvent !== false) {\n fireEvent(series, 'remove', null, remove);\n }\n else {\n remove();\n }\n }\n /**\n * Update the series with a new set of options. For a clean and precise\n * handling of new options, all methods and elements from the series are\n * removed, and it is initialized from scratch. Therefore, this method is\n * more performance expensive than some other utility methods like {@link\n * Series#setData} or {@link Series#setVisible}.\n *\n * Note that `Series.update` may mutate the passed `data` options.\n *\n * @sample highcharts/members/series-update/\n * Updating series options\n * @sample maps/members/series-update/\n * Update series options in Highmaps\n *\n * @function Highcharts.Series#update\n *\n * @param {Highcharts.SeriesOptionsType} options\n * New options that will be merged with the series' existing options.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the series is altered. If doing\n * more operations on the chart, it is a good idea to set redraw to\n * false and call {@link Chart#redraw} after.\n *\n * @emits Highcharts.Series#event:update\n * @emits Highcharts.Series#event:afterUpdate\n */\n update(options, redraw) {\n options = diffObjects(options, this.userOptions);\n fireEvent(this, 'update', { options: options });\n const series = this, chart = series.chart, \n // must use user options when changing type because series.options\n // is merged in with type specific plotOptions\n oldOptions = series.userOptions, initialType = series.initialType || series.type, plotOptions = chart.options.plotOptions, initialSeriesProto = seriesTypes[initialType].prototype, groups = [\n 'group',\n 'markerGroup',\n 'dataLabelsGroup',\n 'transformGroup'\n ], optionsToCheck = [\n 'dataGrouping',\n 'pointStart',\n 'pointInterval',\n 'pointIntervalUnit',\n 'keys'\n ], \n // Animation must be enabled when calling update before the initial\n // animation has first run. This happens when calling update\n // directly after chart initialization, or when applying responsive\n // rules (#6912).\n animation = series.finishedAnimating && { animation: false }, kinds = {};\n let seriesOptions, n, preserve = [\n 'colorIndex',\n 'eventOptions',\n 'navigatorSeries',\n 'symbolIndex',\n 'baseSeries'\n ], newType = (options.type ||\n oldOptions.type ||\n chart.options.chart.type);\n const keepPoints = !(\n // Indicators, histograms etc recalculate the data. It should be\n // possible to omit this.\n this.hasDerivedData ||\n // New type requires new point classes\n (newType && newType !== this.type) ||\n // New options affecting how the data points are built\n typeof options.pointStart !== 'undefined' ||\n typeof options.pointInterval !== 'undefined' ||\n typeof options.relativeXValue !== 'undefined' ||\n options.joinBy ||\n options.mapData || // #11636\n // Changes to data grouping requires new points in new group\n optionsToCheck.some((option) => series.hasOptionChanged(option)));\n newType = newType || initialType;\n if (keepPoints) {\n preserve.push('data', 'isDirtyData', \n // GeoHeatMap interpolation\n 'isDirtyCanvas', 'points', 'processedData', // #17057\n 'processedXData', 'processedYData', 'xIncrement', 'cropped', '_hasPointMarkers', 'hasDataLabels', \n // Networkgraph (#14397)\n 'nodes', 'layout', \n // Treemap\n 'level', \n // Map specific, consider moving it to series-specific preserve-\n // properties (#10617)\n 'mapMap', 'mapData', 'minY', 'maxY', 'minX', 'maxX', 'transformGroups' // #18857\n );\n if (options.visible !== false) {\n preserve.push('area', 'graph');\n }\n series.parallelArrays.forEach(function (key) {\n preserve.push(key + 'Data');\n });\n if (options.data) {\n // setData uses dataSorting options so we need to update them\n // earlier\n if (options.dataSorting) {\n extend(series.options.dataSorting, options.dataSorting);\n }\n this.setData(options.data, false);\n }\n }\n // Do the merge, with some forced options\n options = merge(oldOptions, {\n // When oldOptions.index is null it should't be cleared.\n // Otherwise navigator series will have wrong indexes (#10193).\n index: oldOptions.index === void 0 ?\n series.index : oldOptions.index,\n pointStart: \n // When updating from blank (#7933)\n plotOptions?.series?.pointStart ??\n oldOptions.pointStart ??\n // When updating after addPoint\n series.xData?.[0]\n }, !keepPoints && { data: series.options.data }, options, animation);\n // Merge does not merge arrays, but replaces them. Since points were\n // updated, `series.options.data` has correct merged options, use it:\n if (keepPoints && options.data) {\n options.data = series.options.data;\n }\n // Make sure preserved properties are not destroyed (#3094)\n preserve = groups.concat(preserve);\n preserve.forEach(function (prop) {\n preserve[prop] = series[prop];\n delete series[prop];\n });\n let casting = false;\n if (seriesTypes[newType]) {\n casting = newType !== series.type;\n // Destroy the series and delete all properties, it will be\n // reinserted within the `init` call below\n series.remove(false, false, false, true);\n if (casting) {\n // #20264: Re-detect a certain chart properties from new series\n chart.propFromSeries();\n // Modern browsers including IE11\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(series, seriesTypes[newType].prototype);\n // Legacy (IE < 11)\n }\n else {\n const ownEvents = Object.hasOwnProperty.call(series, 'hcEvents') && series.hcEvents;\n for (n in initialSeriesProto) { // eslint-disable-line guard-for-in\n series[n] = void 0;\n }\n // Reinsert all methods and properties from the new type\n // prototype (#2270, #3719).\n extend(series, seriesTypes[newType].prototype);\n // The events are tied to the prototype chain, don't copy if\n // they're not the series' own\n if (ownEvents) {\n series.hcEvents = ownEvents;\n }\n else {\n delete series.hcEvents;\n }\n }\n }\n }\n else {\n error(17, true, chart, { missingModuleFor: newType });\n }\n // Re-register groups (#3094) and other preserved properties\n preserve.forEach(function (prop) {\n series[prop] = preserve[prop];\n });\n series.init(chart, options);\n // Remove particular elements of the points. Check `series.options`\n // because we need to consider the options being set on plotOptions as\n // well.\n if (keepPoints && this.points) {\n seriesOptions = series.options;\n // What kind of elements to destroy\n if (seriesOptions.visible === false) {\n kinds.graphic = 1;\n kinds.dataLabel = 1;\n }\n else {\n // If the marker got disabled or changed its symbol, width or\n // height - destroy\n if (this.hasMarkerChanged(seriesOptions, oldOptions)) {\n kinds.graphic = 1;\n }\n if (!series.hasDataLabels?.()) {\n kinds.dataLabel = 1;\n }\n }\n for (const point of this.points) {\n if (point && point.series) {\n point.resolveColor();\n // Destroy elements in order to recreate based on updated\n // series options.\n if (Object.keys(kinds).length) {\n point.destroyElements(kinds);\n }\n if (seriesOptions.showInLegend === false &&\n point.legendItem) {\n chart.legend.destroyItem(point);\n }\n }\n }\n }\n series.initialType = initialType;\n chart.linkSeries(); // Links are lost in series.remove (#3028)\n // Set data for series with sorting enabled if it isn't set yet (#19715)\n chart.setSortedData();\n // #15383: Fire updatedData if the type has changed to keep linked\n // series such as indicators updated\n if (casting && series.linkedSeries.length) {\n series.isDirtyData = true;\n }\n fireEvent(this, 'afterUpdate');\n if (pick(redraw, true)) {\n chart.redraw(keepPoints ? void 0 : false);\n }\n }\n /**\n * Used from within series.update\n * @private\n */\n setName(name) {\n this.name = this.options.name = this.userOptions.name = name;\n this.chart.isDirtyLegend = true;\n }\n /**\n * Check if the option has changed.\n * @private\n */\n hasOptionChanged(optionName) {\n const chart = this.chart, option = this.options[optionName], plotOptions = chart.options.plotOptions, oldOption = this.userOptions[optionName], plotOptionsOption = pick(plotOptions?.[this.type]?.[optionName], plotOptions?.series?.[optionName]);\n // Check if `plotOptions` are defined already, #19203\n if (oldOption && !defined(plotOptionsOption)) {\n return option !== oldOption;\n }\n return option !== pick(plotOptionsOption, option);\n }\n /**\n * Runs on mouse over the series graphical items.\n *\n * @function Highcharts.Series#onMouseOver\n * @emits Highcharts.Series#event:mouseOver\n */\n onMouseOver() {\n const series = this, chart = series.chart, hoverSeries = chart.hoverSeries, pointer = chart.pointer;\n pointer?.setHoverChartIndex();\n // set normal state to previous series\n if (hoverSeries && hoverSeries !== series) {\n hoverSeries.onMouseOut();\n }\n // trigger the event, but to save processing time,\n // only if defined\n if (series.options.events.mouseOver) {\n fireEvent(series, 'mouseOver');\n }\n // hover this\n series.setState('hover');\n /**\n * Contains the original hovered series.\n *\n * @name Highcharts.Chart#hoverSeries\n * @type {Highcharts.Series|null}\n */\n chart.hoverSeries = series;\n }\n /**\n * Runs on mouse out of the series graphical items.\n *\n * @function Highcharts.Series#onMouseOut\n *\n * @emits Highcharts.Series#event:mouseOut\n */\n onMouseOut() {\n // trigger the event only if listeners exist\n const series = this, options = series.options, chart = series.chart, tooltip = chart.tooltip, hoverPoint = chart.hoverPoint;\n // #182, set to null before the mouseOut event fires\n chart.hoverSeries = null;\n // trigger mouse out on the point, which must be in this series\n if (hoverPoint) {\n hoverPoint.onMouseOut();\n }\n // fire the mouse out event\n if (series && options.events.mouseOut) {\n fireEvent(series, 'mouseOut');\n }\n // hide the tooltip\n if (tooltip &&\n !series.stickyTracking &&\n (!tooltip.shared || series.noSharedTooltip)) {\n tooltip.hide();\n }\n // Reset all inactive states\n chart.series.forEach(function (s) {\n s.setState('', true);\n });\n }\n /**\n * Set the state of the series. Called internally on mouse interaction\n * operations, but it can also be called directly to visually\n * highlight a series.\n *\n * @function Highcharts.Series#setState\n *\n * @param {Highcharts.SeriesStateValue|\"\"} [state]\n * The new state, can be either `'hover'`, `'inactive'`, `'select'`,\n * or `''` (an empty string), `'normal'` or `undefined` to set to\n * normal state.\n * @param {boolean} [inherit]\n * Determines if state should be inherited by points too.\n */\n setState(state, inherit) {\n const series = this, options = series.options, graph = series.graph, inactiveOtherPoints = options.inactiveOtherPoints, stateOptions = options.states, \n // By default a quick animation to hover/inactive,\n // slower to un-hover\n stateAnimation = pick((stateOptions[state || 'normal'] &&\n stateOptions[state || 'normal'].animation), series.chart.options.chart.animation);\n let lineWidth = options.lineWidth, opacity = options.opacity;\n state = state || '';\n if (series.state !== state) {\n // Toggle class names\n [\n series.group,\n series.markerGroup,\n series.dataLabelsGroup\n ].forEach(function (group) {\n if (group) {\n // Old state\n if (series.state) {\n group.removeClass('highcharts-series-' + series.state);\n }\n // New state\n if (state) {\n group.addClass('highcharts-series-' + state);\n }\n }\n });\n series.state = state;\n if (!series.chart.styledMode) {\n if (stateOptions[state] &&\n stateOptions[state].enabled === false) {\n return;\n }\n if (state) {\n lineWidth = (stateOptions[state].lineWidth ||\n lineWidth + (stateOptions[state].lineWidthPlus || 0)); // #4035\n opacity = pick(stateOptions[state].opacity, opacity);\n }\n if (graph && !graph.dashstyle && isNumber(lineWidth)) {\n // Animate the graph stroke-width\n for (const graphElement of [\n graph,\n ...this.zones.map((zone) => zone.graph)\n ]) {\n graphElement?.animate({\n 'stroke-width': lineWidth\n }, stateAnimation);\n }\n }\n // For some types (pie, networkgraph, sankey) opacity is\n // resolved on a point level\n if (!inactiveOtherPoints) {\n [\n series.group,\n series.markerGroup,\n series.dataLabelsGroup,\n series.labelBySeries\n ].forEach(function (group) {\n if (group) {\n group.animate({\n opacity: opacity\n }, stateAnimation);\n }\n });\n }\n }\n }\n // Don't loop over points on a series that doesn't apply inactive state\n // to siblings markers (e.g. line, column)\n if (inherit && inactiveOtherPoints && series.points) {\n series.setAllPointsToState(state || void 0);\n }\n }\n /**\n * Set the state for all points in the series.\n *\n * @function Highcharts.Series#setAllPointsToState\n *\n * @private\n *\n * @param {string} [state]\n * Can be either `hover` or undefined to set to normal state.\n */\n setAllPointsToState(state) {\n this.points.forEach(function (point) {\n if (point.setState) {\n point.setState(state);\n }\n });\n }\n /**\n * Show or hide the series.\n *\n * @function Highcharts.Series#setVisible\n *\n * @param {boolean} [visible]\n * True to show the series, false to hide. If undefined, the visibility is\n * toggled.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after the series is altered. If doing more\n * operations on the chart, it is a good idea to set redraw to false and\n * call {@link Chart#redraw|chart.redraw()} after.\n *\n * @emits Highcharts.Series#event:hide\n * @emits Highcharts.Series#event:show\n */\n setVisible(vis, redraw) {\n const series = this, chart = series.chart, ignoreHiddenSeries = chart.options.chart.ignoreHiddenSeries, oldVisibility = series.visible;\n // If called without an argument, toggle visibility\n series.visible =\n vis =\n series.options.visible =\n series.userOptions.visible =\n typeof vis === 'undefined' ? !oldVisibility : vis; // #5618\n const showOrHide = vis ? 'show' : 'hide';\n // Show or hide elements\n [\n 'group',\n 'dataLabelsGroup',\n 'markerGroup',\n 'tracker',\n 'tt'\n ].forEach((key) => {\n series[key]?.[showOrHide]();\n });\n // Hide tooltip (#1361)\n if (chart.hoverSeries === series ||\n chart.hoverPoint?.series === series) {\n series.onMouseOut();\n }\n if (series.legendItem) {\n chart.legend.colorizeItem(series, vis);\n }\n // Rescale or adapt to resized chart\n series.isDirty = true;\n // In a stack, all other series are affected\n if (series.options.stacking) {\n chart.series.forEach((otherSeries) => {\n if (otherSeries.options.stacking && otherSeries.visible) {\n otherSeries.isDirty = true;\n }\n });\n }\n // Show or hide linked series\n series.linkedSeries.forEach((otherSeries) => {\n otherSeries.setVisible(vis, false);\n });\n if (ignoreHiddenSeries) {\n chart.isDirtyBox = true;\n }\n fireEvent(series, showOrHide);\n if (redraw !== false) {\n chart.redraw();\n }\n }\n /**\n * Show the series if hidden.\n *\n * @sample highcharts/members/series-hide/\n * Toggle visibility from a button\n *\n * @function Highcharts.Series#show\n * @emits Highcharts.Series#event:show\n */\n show() {\n this.setVisible(true);\n }\n /**\n * Hide the series if visible. If the\n * [chart.ignoreHiddenSeries](https://api.highcharts.com/highcharts/chart.ignoreHiddenSeries)\n * option is true, the chart is redrawn without this series.\n *\n * @sample highcharts/members/series-hide/\n * Toggle visibility from a button\n *\n * @function Highcharts.Series#hide\n * @emits Highcharts.Series#event:hide\n */\n hide() {\n this.setVisible(false);\n }\n /**\n * Select or unselect the series. This means its\n * {@link Highcharts.Series.selected|selected}\n * property is set, the checkbox in the legend is toggled and when selected,\n * the series is returned by the {@link Highcharts.Chart#getSelectedSeries}\n * function.\n *\n * @sample highcharts/members/series-select/\n * Select a series from a button\n *\n * @function Highcharts.Series#select\n *\n * @param {boolean} [selected]\n * True to select the series, false to unselect. If undefined, the selection\n * state is toggled.\n *\n * @emits Highcharts.Series#event:select\n * @emits Highcharts.Series#event:unselect\n */\n select(selected) {\n const series = this;\n series.selected =\n selected =\n this.options.selected = (typeof selected === 'undefined' ?\n !series.selected :\n selected);\n if (series.checkbox) {\n series.checkbox.checked = selected;\n }\n fireEvent(series, selected ? 'select' : 'unselect');\n }\n /**\n * Checks if a tooltip should be shown for a given point.\n *\n * @private\n */\n shouldShowTooltip(plotX, plotY, options = {}) {\n options.series = this;\n options.visiblePlotOnly = true;\n return this.chart.isInsidePlot(plotX, plotY, options);\n }\n /**\n * Draws the legend symbol based on the legendSymbol user option.\n *\n * @private\n */\n drawLegendSymbol(legend, item) {\n LegendSymbol[this.options.legendSymbol || 'rectangle']\n ?.call(this, legend, item);\n }\n}\nSeries.defaultOptions = SeriesDefaults;\n/**\n * Registry of all available series types.\n *\n * @name Highcharts.Series.types\n * @type {Highcharts.Dictionary}\n */\nSeries.types = SeriesRegistry.seriesTypes;\n/* *\n *\n * Static Functions\n *\n * */\n/**\n * Registers a series class to be accessible via `Series.types`.\n *\n * @function Highcharts.Series.registerType\n *\n * @param {string} seriesType\n * The series type as an identifier string in lower case.\n *\n * @param {Function} SeriesClass\n * The series class as a class pattern or a constructor function with\n * prototype.\n */\nSeries.registerType = SeriesRegistry.registerSeriesType;\nextend(Series.prototype, {\n axisTypes: ['xAxis', 'yAxis'],\n coll: 'series',\n colorCounter: 0,\n directTouch: false,\n invertible: true,\n isCartesian: true,\n kdAxisArray: ['clientX', 'plotY'],\n // Each point's x and y values are stored in this.xData and this.yData:\n parallelArrays: ['x', 'y'],\n pointClass: Point,\n requireSorting: true,\n // Requires the data to be sorted:\n sorted: true\n});\n/* *\n *\n * Registry\n *\n * */\nSeriesRegistry.series = Series;\n/* *\n *\n * Default Export\n *\n * */\nexport default Series;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * This is a placeholder type of the possible series options for\n * [Highcharts](../highcharts/series), [Highcharts Stock](../highstock/series),\n * [Highmaps](../highmaps/series), and [Gantt](../gantt/series).\n *\n * In TypeScript is this dynamically generated to reference all possible types\n * of series options.\n *\n * @ignore-declaration\n * @typedef {Highcharts.SeriesOptions|Highcharts.Dictionary<*>} Highcharts.SeriesOptionsType\n */\n/**\n * Options for `dataSorting`.\n *\n * @interface Highcharts.DataSortingOptionsObject\n * @since 8.0.0\n */ /**\n* Enable or disable data sorting for the series.\n* @name Highcharts.DataSortingOptionsObject#enabled\n* @type {boolean|undefined}\n*/ /**\n* Whether to allow matching points by name in an update.\n* @name Highcharts.DataSortingOptionsObject#matchByName\n* @type {boolean|undefined}\n*/ /**\n* Determines what data value should be used to sort by.\n* @name Highcharts.DataSortingOptionsObject#sortKey\n* @type {string|undefined}\n*/\n/**\n * Function callback when a series has been animated.\n *\n * @callback Highcharts.SeriesAfterAnimateCallbackFunction\n *\n * @param {Highcharts.Series} this\n * The series where the event occurred.\n *\n * @param {Highcharts.SeriesAfterAnimateEventObject} event\n * Event arguments.\n */\n/**\n * Event information regarding completed animation of a series.\n *\n * @interface Highcharts.SeriesAfterAnimateEventObject\n */ /**\n* Animated series.\n* @name Highcharts.SeriesAfterAnimateEventObject#target\n* @type {Highcharts.Series}\n*/ /**\n* Event type.\n* @name Highcharts.SeriesAfterAnimateEventObject#type\n* @type {\"afterAnimate\"}\n*/\n/**\n * Function callback when the checkbox next to the series' name in the legend is\n * clicked.\n *\n * @callback Highcharts.SeriesCheckboxClickCallbackFunction\n *\n * @param {Highcharts.Series} this\n * The series where the event occurred.\n *\n * @param {Highcharts.SeriesCheckboxClickEventObject} event\n * Event arguments.\n */\n/**\n * Event information regarding check of a series box.\n *\n * @interface Highcharts.SeriesCheckboxClickEventObject\n */ /**\n* Whether the box has been checked.\n* @name Highcharts.SeriesCheckboxClickEventObject#checked\n* @type {boolean}\n*/ /**\n* Related series.\n* @name Highcharts.SeriesCheckboxClickEventObject#item\n* @type {Highcharts.Series}\n*/ /**\n* Related series.\n* @name Highcharts.SeriesCheckboxClickEventObject#target\n* @type {Highcharts.Series}\n*/ /**\n* Event type.\n* @name Highcharts.SeriesCheckboxClickEventObject#type\n* @type {\"checkboxClick\"}\n*/\n/**\n * Function callback when a series is clicked. Return false to cancel toogle\n * actions.\n *\n * @callback Highcharts.SeriesClickCallbackFunction\n *\n * @param {Highcharts.Series} this\n * The series where the event occurred.\n *\n * @param {Highcharts.SeriesClickEventObject} event\n * Event arguments.\n */\n/**\n * Common information for a click event on a series.\n *\n * @interface Highcharts.SeriesClickEventObject\n * @extends global.Event\n */ /**\n* Nearest point on the graph.\n* @name Highcharts.SeriesClickEventObject#point\n* @type {Highcharts.Point}\n*/\n/**\n * Gets fired when the series is hidden after chart generation time, either by\n * clicking the legend item or by calling `.hide()`.\n *\n * @callback Highcharts.SeriesHideCallbackFunction\n *\n * @param {Highcharts.Series} this\n * The series where the event occurred.\n *\n * @param {global.Event} event\n * The event that occurred.\n */\n/**\n * The SVG value used for the `stroke-linecap` and `stroke-linejoin` of a line\n * graph.\n *\n * @typedef {\"butt\"|\"round\"|\"square\"|string} Highcharts.SeriesLinecapValue\n */\n/**\n * Gets fired when the legend item belonging to the series is clicked. The\n * default action is to toggle the visibility of the series. This can be\n * prevented by returning `false` or calling `event.preventDefault()`.\n *\n * @callback Highcharts.SeriesLegendItemClickCallbackFunction\n *\n * @param {Highcharts.Series} this\n * The series where the event occurred.\n *\n * @param {Highcharts.SeriesLegendItemClickEventObject} event\n * The event that occurred.\n */\n/**\n * Information about the event.\n *\n * @interface Highcharts.SeriesLegendItemClickEventObject\n */ /**\n* Related browser event.\n* @name Highcharts.SeriesLegendItemClickEventObject#browserEvent\n* @type {global.PointerEvent}\n*/ /**\n* Prevent the default action of toggle the visibility of the series.\n* @name Highcharts.SeriesLegendItemClickEventObject#preventDefault\n* @type {Function}\n*/ /**\n* Related series.\n* @name Highcharts.SeriesCheckboxClickEventObject#target\n* @type {Highcharts.Series}\n*/ /**\n* Event type.\n* @name Highcharts.SeriesCheckboxClickEventObject#type\n* @type {\"checkboxClick\"}\n*/\n/**\n * Gets fired when the mouse leaves the graph.\n *\n * @callback Highcharts.SeriesMouseOutCallbackFunction\n *\n * @param {Highcharts.Series} this\n * Series where the event occurred.\n *\n * @param {global.PointerEvent} event\n * Event that occurred.\n */\n/**\n * Gets fired when the mouse enters the graph.\n *\n * @callback Highcharts.SeriesMouseOverCallbackFunction\n *\n * @param {Highcharts.Series} this\n * Series where the event occurred.\n *\n * @param {global.PointerEvent} event\n * Event that occurred.\n */\n/**\n * Translation and scale for the plot area of a series.\n *\n * @interface Highcharts.SeriesPlotBoxObject\n */ /**\n* @name Highcharts.SeriesPlotBoxObject#scaleX\n* @type {number}\n*/ /**\n* @name Highcharts.SeriesPlotBoxObject#scaleY\n* @type {number}\n*/ /**\n* @name Highcharts.SeriesPlotBoxObject#translateX\n* @type {number}\n*/ /**\n* @name Highcharts.SeriesPlotBoxObject#translateY\n* @type {number}\n*/\n/**\n * Gets fired when the series is shown after chart generation time, either by\n * clicking the legend item or by calling `.show()`.\n *\n * @callback Highcharts.SeriesShowCallbackFunction\n *\n * @param {Highcharts.Series} this\n * Series where the event occurred.\n *\n * @param {global.Event} event\n * Event that occurred.\n */\n/**\n * Possible key values for the series state options.\n *\n * @typedef {\"hover\"|\"inactive\"|\"normal\"|\"select\"} Highcharts.SeriesStateValue\n */\n''; // detach doclets above\n/* *\n *\n * API Options\n *\n * */\n/**\n * Series options for specific data and the data itself. In TypeScript you\n * have to cast the series options to specific series types, to get all\n * possible options for a series.\n *\n * @example\n * // TypeScript example\n * Highcharts.chart('container', {\n * series: [{\n * color: '#06C',\n * data: [[0, 1], [2, 3]]\n * } as Highcharts.SeriesLineOptions ]\n * });\n *\n * @type {Array<*>}\n * @apioption series\n */\n/**\n * An id for the series. This can be used after render time to get a pointer\n * to the series object through `chart.get()`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-id/\n * Get series by id\n *\n * @type {string}\n * @since 1.2.0\n * @apioption series.id\n */\n/**\n * The index of the series in the chart, affecting the internal index in the\n * `chart.series` array, the visible Z index as well as the order in the\n * legend.\n *\n * @type {number}\n * @since 2.3.0\n * @apioption series.index\n */\n/**\n * The sequential index of the series in the legend.\n *\n * @see [legend.reversed](#legend.reversed),\n * [yAxis.reversedStacks](#yAxis.reversedStacks)\n *\n * @sample {highcharts|highstock} highcharts/series/legendindex/\n * Legend in opposite order\n *\n * @type {number}\n * @apioption series.legendIndex\n */\n/**\n * The name of the series as shown in the legend, tooltip etc.\n *\n * @sample {highcharts} highcharts/series/name/\n * Series name\n * @sample {highmaps} maps/demo/category-map/\n * Series name\n *\n * @type {string}\n * @apioption series.name\n */\n/**\n * This option allows grouping series in a stacked chart. The stack option\n * can be a string or anything else, as long as the grouped series' stack\n * options match each other after conversion into a string.\n *\n * @sample {highcharts} highcharts/series/stack/\n * Stacked and grouped columns\n *\n * @type {number|string}\n * @since 2.1\n * @product highcharts highstock\n * @apioption series.stack\n */\n/**\n * The type of series, for example `line` or `column`. By default, the\n * series type is inherited from [chart.type](#chart.type), so unless the\n * chart is a combination of series types, there is no need to set it on the\n * series level.\n *\n * @sample {highcharts} highcharts/series/type/\n * Line and column in the same chart\n * @sample highcharts/series/type-dynamic/\n * Dynamic types with button selector\n * @sample {highmaps} maps/demo/mapline-mappoint/\n * Multiple types in the same map\n *\n * @type {string}\n * @apioption series.type\n */\n/**\n * When using dual or multiple x axes, this number defines which xAxis the\n * particular series is connected to. It refers to either the\n * {@link #xAxis.id|axis id}\n * or the index of the axis in the xAxis array, with 0 being the first.\n *\n * @type {number|string}\n * @default 0\n * @product highcharts highstock\n * @apioption series.xAxis\n */\n/**\n * When using dual or multiple y axes, this number defines which yAxis the\n * particular series is connected to. It refers to either the\n * {@link #yAxis.id|axis id}\n * or the index of the axis in the yAxis array, with 0 being the first.\n *\n * @sample {highcharts} highcharts/series/yaxis/\n * Apply the column series to the secondary Y axis\n *\n * @type {number|string}\n * @default 0\n * @product highcharts highstock\n * @apioption series.yAxis\n */\n/**\n * Define the visual z index of the series.\n *\n * @sample {highcharts} highcharts/plotoptions/series-zindex-default/\n * With no z index, the series defined last are on top\n * @sample {highcharts} highcharts/plotoptions/series-zindex/\n * With a z index, the series with the highest z index is on top\n * @sample {highstock} highcharts/plotoptions/series-zindex-default/\n * With no z index, the series defined last are on top\n * @sample {highstock} highcharts/plotoptions/series-zindex/\n * With a z index, the series with the highest z index is on top\n *\n * @type {number}\n * @product highcharts highstock\n * @apioption series.zIndex\n */\n''; // include precedent doclets in transpiled\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../Animation/AnimationUtilities.js';\nconst { animate, animObject, setAnimation } = A;\nimport Axis from '../Axis/Axis.js';\nimport D from '../Defaults.js';\nconst { defaultOptions, defaultTime } = D;\nimport Templating from '../Templating.js';\nconst { numberFormat } = Templating;\nimport Foundation from '../Foundation.js';\nconst { registerEventOptions } = Foundation;\nimport H from '../Globals.js';\nconst { charts, doc, marginNames, svg, win } = H;\nimport RendererRegistry from '../Renderer/RendererRegistry.js';\nimport Series from '../Series/Series.js';\nimport SeriesRegistry from '../Series/SeriesRegistry.js';\nconst { seriesTypes } = SeriesRegistry;\nimport SVGRenderer from '../Renderer/SVG/SVGRenderer.js';\nimport Time from '../Time.js';\nimport U from '../Utilities.js';\nimport AST from '../Renderer/HTML/AST.js';\nimport Tick from '../Axis/Tick.js';\nconst { addEvent, attr, createElement, css, defined, diffObjects, discardElement, erase, error, extend, find, fireEvent, getStyle, isArray, isNumber, isObject, isString, merge, objectEach, pick, pInt, relativeLength, removeEvent, splat, syncTimeout, uniqueKey } = U;\n/* *\n *\n * Class\n *\n * */\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/**\n * The Chart class. The recommended constructor is {@link Highcharts#chart}.\n *\n * @example\n * let chart = Highcharts.chart('container', {\n * title: {\n * text: 'My chart'\n * },\n * series: [{\n * data: [1, 3, 2, 4]\n * }]\n * })\n *\n * @class\n * @name Highcharts.Chart\n *\n * @param {string|Highcharts.HTMLDOMElement} [renderTo]\n * The DOM element to render to, or its id.\n *\n * @param {Highcharts.Options} options\n * The chart options structure.\n *\n * @param {Highcharts.ChartCallbackFunction} [callback]\n * Function to run when the chart has loaded and all external images\n * are loaded. Defining a\n * [chart.events.load](https://api.highcharts.com/highcharts/chart.events.load)\n * handler is equivalent.\n */\nclass Chart {\n /**\n * Factory function for basic charts.\n *\n * @example\n * // Render a chart in to div#container\n * let chart = Highcharts.chart('container', {\n * title: {\n * text: 'My chart'\n * },\n * series: [{\n * data: [1, 3, 2, 4]\n * }]\n * });\n *\n * @function Highcharts.chart\n *\n * @param {string|Highcharts.HTMLDOMElement} [renderTo]\n * The DOM element to render to, or its id.\n *\n * @param {Highcharts.Options} options\n * The chart options structure.\n *\n * @param {Highcharts.ChartCallbackFunction} [callback]\n * Function to run when the chart has loaded and all external images are\n * loaded. Defining a\n * [chart.events.load](https://api.highcharts.com/highcharts/chart.events.load)\n * handler is equivalent.\n *\n * @return {Highcharts.Chart}\n * Returns the Chart object.\n */\n static chart(a, b, c) {\n return new Chart(a, b, c);\n }\n /** Implementation */\n constructor(a, \n /* eslint-disable @typescript-eslint/no-unused-vars */\n b, c\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ) {\n this.sharedClips = {};\n const args = [\n // ES5 builds fail unless we cast it to an Array\n ...arguments\n ];\n // Remove the optional first argument, renderTo, and set it on this.\n if (isString(a) || a.nodeName) {\n this.renderTo = args.shift();\n }\n this.init(args[0], args[1]);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Function setting zoom options after chart init and after chart update.\n * Offers support for deprecated options.\n *\n * @private\n * @function Highcharts.Chart#setZoomOptions\n */\n setZoomOptions() {\n const chart = this, options = chart.options.chart, zooming = options.zooming;\n chart.zooming = {\n ...zooming,\n type: pick(options.zoomType, zooming.type),\n key: pick(options.zoomKey, zooming.key),\n pinchType: pick(options.pinchType, zooming.pinchType),\n singleTouch: pick(options.zoomBySingleTouch, zooming.singleTouch, false),\n resetButton: merge(zooming.resetButton, options.resetZoomButton)\n };\n }\n /**\n * Overridable function that initializes the chart. The constructor's\n * arguments are passed on directly.\n *\n * @function Highcharts.Chart#init\n *\n * @param {Highcharts.Options} userOptions\n * Custom options.\n *\n * @param {Function} [callback]\n * Function to run when the chart has loaded and all external\n * images are loaded.\n *\n *\n * @emits Highcharts.Chart#event:init\n * @emits Highcharts.Chart#event:afterInit\n */\n init(userOptions, callback) {\n // Fire the event with a default function\n fireEvent(this, 'init', { args: arguments }, function () {\n const options = merge(defaultOptions, userOptions), // do the merge\n optionsChart = options.chart;\n /**\n * The original options given to the constructor or a chart factory\n * like {@link Highcharts.chart} and {@link Highcharts.stockChart}.\n * The original options are shallow copied to avoid mutation. The\n * copy, `chart.userOptions`, may later be mutated to reflect\n * updated options throughout the lifetime of the chart.\n *\n * For collections, like `series`, `xAxis` and `yAxis`, the chart\n * user options should always be reflected by the item user option,\n * so for example the following should always be true:\n *\n * `chart.xAxis[0].userOptions === chart.userOptions.xAxis[0]`\n *\n * @name Highcharts.Chart#userOptions\n * @type {Highcharts.Options}\n */\n this.userOptions = extend({}, userOptions);\n this.margin = [];\n this.spacing = [];\n // An array of functions that returns labels that should be\n // considered for anti-collision\n this.labelCollectors = [];\n this.callback = callback;\n this.isResizing = 0;\n /**\n * The options structure for the chart after merging\n * {@link #defaultOptions} and {@link #userOptions}. It contains\n * members for the sub elements like series, legend, tooltip etc.\n *\n * @name Highcharts.Chart#options\n * @type {Highcharts.Options}\n */\n this.options = options;\n /**\n * All the axes in the chart.\n *\n * @see Highcharts.Chart.xAxis\n * @see Highcharts.Chart.yAxis\n *\n * @name Highcharts.Chart#axes\n * @type {Array}\n */\n this.axes = [];\n /**\n * All the current series in the chart.\n *\n * @name Highcharts.Chart#series\n * @type {Array}\n */\n this.series = [];\n /**\n * The `Time` object associated with the chart. Since v6.0.5,\n * time settings can be applied individually for each chart. If\n * no individual settings apply, the `Time` object is shared by\n * all instances.\n *\n * @name Highcharts.Chart#time\n * @type {Highcharts.Time}\n */\n this.time =\n userOptions.time && Object.keys(userOptions.time).length ?\n new Time(userOptions.time) :\n H.time;\n /**\n * Callback function to override the default function that formats\n * all the numbers in the chart. Returns a string with the formatted\n * number.\n *\n * @name Highcharts.Chart#numberFormatter\n * @type {Highcharts.NumberFormatterCallbackFunction}\n */\n this.numberFormatter = optionsChart.numberFormatter || numberFormat;\n /**\n * Whether the chart is in styled mode, meaning all presentational\n * attributes are avoided.\n *\n * @name Highcharts.Chart#styledMode\n * @type {boolean}\n */\n this.styledMode = optionsChart.styledMode;\n this.hasCartesianSeries = optionsChart.showAxes;\n const chart = this;\n /**\n * Index position of the chart in the {@link Highcharts#charts}\n * property.\n *\n * @name Highcharts.Chart#index\n * @type {number}\n * @readonly\n */\n chart.index = charts.length; // Add the chart to the global lookup\n charts.push(chart);\n H.chartCount++;\n // Chart event handlers\n registerEventOptions(this, optionsChart);\n /**\n * A collection of the X axes in the chart.\n *\n * @name Highcharts.Chart#xAxis\n * @type {Array}\n */\n chart.xAxis = [];\n /**\n * A collection of the Y axes in the chart.\n *\n * @name Highcharts.Chart#yAxis\n * @type {Array}\n *\n * @todo\n * Make events official: Fire the event `afterInit`.\n */\n chart.yAxis = [];\n chart.pointCount = chart.colorCounter = chart.symbolCounter = 0;\n this.setZoomOptions();\n // Fire after init but before first render, before axes and series\n // have been initialized.\n fireEvent(chart, 'afterInit');\n chart.firstRender();\n });\n }\n /**\n * Internal function to unitialize an individual series.\n *\n * @private\n * @function Highcharts.Chart#initSeries\n */\n initSeries(options) {\n const chart = this, optionsChart = chart.options.chart, type = (options.type ||\n optionsChart.type), SeriesClass = seriesTypes[type];\n // No such series type\n if (!SeriesClass) {\n error(17, true, chart, { missingModuleFor: type });\n }\n const series = new SeriesClass();\n if (typeof series.init === 'function') {\n series.init(chart, options);\n }\n return series;\n }\n /**\n * Internal function to set data for all series with enabled sorting.\n *\n * @private\n * @function Highcharts.Chart#setSortedData\n */\n setSortedData() {\n this.getSeriesOrderByLinks().forEach(function (series) {\n // We need to set data for series with sorting after series init\n if (!series.points && !series.data && series.enabledDataSorting) {\n series.setData(series.options.data, false);\n }\n });\n }\n /**\n * Sort and return chart series in order depending on the number of linked\n * series.\n *\n * @private\n * @function Highcharts.Series#getSeriesOrderByLinks\n */\n getSeriesOrderByLinks() {\n return this.series.concat().sort(function (a, b) {\n if (a.linkedSeries.length || b.linkedSeries.length) {\n return b.linkedSeries.length - a.linkedSeries.length;\n }\n return 0;\n });\n }\n /**\n * Order all series or axes above a given index. When series or axes are\n * added and ordered by configuration, only the last series is handled\n * (#248, #1123, #2456, #6112). This function is called on series and axis\n * initialization and destroy.\n *\n * @private\n * @function Highcharts.Chart#orderItems\n * @param {string} coll The collection name\n * @param {number} [fromIndex=0]\n * If this is given, only the series above this index are handled.\n */\n orderItems(coll, fromIndex = 0) {\n const collection = this[coll], \n // Item options should be reflected in chart.options.series,\n // chart.options.yAxis etc\n optionsArray = this.options[coll] = splat(this.options[coll])\n .slice(), userOptionsArray = this.userOptions[coll] = this.userOptions[coll] ?\n splat(this.userOptions[coll]).slice() :\n [];\n if (this.hasRendered) {\n // Remove all above index\n optionsArray.splice(fromIndex);\n userOptionsArray.splice(fromIndex);\n }\n if (collection) {\n for (let i = fromIndex, iEnd = collection.length; i < iEnd; ++i) {\n const item = collection[i];\n if (item) {\n /**\n * Contains the series' index in the `Chart.series` array.\n *\n * @name Highcharts.Series#index\n * @type {number}\n * @readonly\n */\n item.index = i;\n if (item instanceof Series) {\n item.name = item.getName();\n }\n if (!item.options.isInternal) {\n optionsArray[i] = item.options;\n userOptionsArray[i] = item.userOptions;\n }\n }\n }\n }\n }\n /**\n * Check whether a given point is within the plot area.\n *\n * @function Highcharts.Chart#isInsidePlot\n *\n * @param {number} plotX\n * Pixel x relative to the plot area.\n *\n * @param {number} plotY\n * Pixel y relative to the plot area.\n *\n * @param {Highcharts.ChartIsInsideOptionsObject} [options]\n * Options object.\n *\n * @return {boolean}\n * Returns true if the given point is inside the plot area.\n */\n isInsidePlot(plotX, plotY, options = {}) {\n const { inverted, plotBox, plotLeft, plotTop, scrollablePlotBox } = this, { scrollLeft = 0, scrollTop = 0 } = (options.visiblePlotOnly &&\n this.scrollablePlotArea?.scrollingContainer) || {}, series = options.series, box = (options.visiblePlotOnly && scrollablePlotBox) || plotBox, x = options.inverted ? plotY : plotX, y = options.inverted ? plotX : plotY, e = {\n x,\n y,\n isInsidePlot: true,\n options\n };\n if (!options.ignoreX) {\n const xAxis = (series &&\n (inverted && !this.polar ? series.yAxis : series.xAxis)) || {\n pos: plotLeft,\n len: Infinity\n };\n const chartX = options.paneCoordinates ?\n xAxis.pos + x : plotLeft + x;\n if (!(chartX >= Math.max(scrollLeft + plotLeft, xAxis.pos) &&\n chartX <= Math.min(scrollLeft + plotLeft + box.width, xAxis.pos + xAxis.len))) {\n e.isInsidePlot = false;\n }\n }\n if (!options.ignoreY && e.isInsidePlot) {\n const yAxis = (!inverted && options.axis &&\n !options.axis.isXAxis && options.axis) || (series && (inverted ? series.xAxis : series.yAxis)) || {\n pos: plotTop,\n len: Infinity\n };\n const chartY = options.paneCoordinates ?\n yAxis.pos + y : plotTop + y;\n if (!(chartY >= Math.max(scrollTop + plotTop, yAxis.pos) &&\n chartY <= Math.min(scrollTop + plotTop + box.height, yAxis.pos + yAxis.len))) {\n e.isInsidePlot = false;\n }\n }\n fireEvent(this, 'afterIsInsidePlot', e);\n return e.isInsidePlot;\n }\n /**\n * Redraw the chart after changes have been done to the data, axis extremes\n * chart size or chart elements. All methods for updating axes, series or\n * points have a parameter for redrawing the chart. This is `true` by\n * default. But in many cases you want to do more than one operation on the\n * chart before redrawing, for example add a number of points. In those\n * cases it is a waste of resources to redraw the chart for each new point\n * added. So you add the points and call `chart.redraw()` after.\n *\n * @function Highcharts.Chart#redraw\n *\n * @param {boolean|Partial} [animation]\n * If or how to apply animation to the redraw. When `undefined`, it applies\n * the animation that is set in the `chart.animation` option.\n *\n * @emits Highcharts.Chart#event:afterSetExtremes\n * @emits Highcharts.Chart#event:beforeRedraw\n * @emits Highcharts.Chart#event:predraw\n * @emits Highcharts.Chart#event:redraw\n * @emits Highcharts.Chart#event:render\n * @emits Highcharts.Chart#event:updatedData\n */\n redraw(animation) {\n fireEvent(this, 'beforeRedraw');\n const chart = this, axes = chart.hasCartesianSeries ? chart.axes : chart.colorAxis || [], series = chart.series, pointer = chart.pointer, legend = chart.legend, legendUserOptions = chart.userOptions.legend, renderer = chart.renderer, isHiddenChart = renderer.isHidden(), afterRedraw = [];\n let hasDirtyStacks, hasStackedSeries, i, isDirtyBox = chart.isDirtyBox, redrawLegend = chart.isDirtyLegend, serie;\n renderer.rootFontSize = renderer.boxWrapper.getStyle('font-size');\n // Handle responsive rules, not only on resize (#6130)\n if (chart.setResponsive) {\n chart.setResponsive(false);\n }\n // Set the global animation. When chart.hasRendered is not true, the\n // redraw call comes from a responsive rule and animation should not\n // occur.\n setAnimation(chart.hasRendered ? animation : false, chart);\n if (isHiddenChart) {\n chart.temporaryDisplay();\n }\n // Adjust title layout (reflow multiline text)\n chart.layOutTitles(false);\n // link stacked series\n i = series.length;\n while (i--) {\n serie = series[i];\n if (serie.options.stacking || serie.options.centerInCategory) {\n hasStackedSeries = true;\n if (serie.isDirty) {\n hasDirtyStacks = true;\n break;\n }\n }\n }\n if (hasDirtyStacks) { // mark others as dirty\n i = series.length;\n while (i--) {\n serie = series[i];\n if (serie.options.stacking) {\n serie.isDirty = true;\n }\n }\n }\n // Handle updated data in the series\n series.forEach(function (serie) {\n if (serie.isDirty) {\n if (serie.options.legendType === 'point') {\n if (typeof serie.updateTotals === 'function') {\n serie.updateTotals();\n }\n redrawLegend = true;\n }\n else if (legendUserOptions &&\n (!!legendUserOptions.labelFormatter ||\n legendUserOptions.labelFormat)) {\n redrawLegend = true; // #2165\n }\n }\n if (serie.isDirtyData) {\n fireEvent(serie, 'updatedData');\n }\n });\n // handle added or removed series\n if (redrawLegend && legend && legend.options.enabled) {\n // draw legend graphics\n legend.render();\n chart.isDirtyLegend = false;\n }\n // reset stacks\n if (hasStackedSeries) {\n chart.getStacks();\n }\n // set axes scales\n axes.forEach(function (axis) {\n axis.updateNames();\n axis.setScale();\n });\n chart.getMargins(); // #3098\n // If one axis is dirty, all axes must be redrawn (#792, #2169)\n axes.forEach(function (axis) {\n if (axis.isDirty) {\n isDirtyBox = true;\n }\n });\n // redraw axes\n axes.forEach(function (axis) {\n // Fire 'afterSetExtremes' only if extremes are set\n const key = axis.min + ',' + axis.max;\n if (axis.extKey !== key) { // #821, #4452\n axis.extKey = key;\n // prevent a recursive call to chart.redraw() (#1119)\n afterRedraw.push(function () {\n fireEvent(axis, 'afterSetExtremes', extend(axis.eventArgs, axis.getExtremes())); // #747, #751\n delete axis.eventArgs;\n });\n }\n if (isDirtyBox || hasStackedSeries) {\n axis.redraw();\n }\n });\n // the plot areas size has changed\n if (isDirtyBox) {\n chart.drawChartBox();\n }\n // Fire an event before redrawing series, used by the boost module to\n // clear previous series renderings.\n fireEvent(chart, 'predraw');\n // redraw affected series\n series.forEach(function (serie) {\n if ((isDirtyBox || serie.isDirty) && serie.visible) {\n serie.redraw();\n }\n // Set it here, otherwise we will have unlimited 'updatedData' calls\n // for a hidden series after setData(). Fixes #6012\n serie.isDirtyData = false;\n });\n // move tooltip or reset\n if (pointer) {\n pointer.reset(true);\n }\n // redraw if canvas\n renderer.draw();\n // Fire the events\n fireEvent(chart, 'redraw');\n fireEvent(chart, 'render');\n if (isHiddenChart) {\n chart.temporaryDisplay(true);\n }\n // Fire callbacks that are put on hold until after the redraw\n afterRedraw.forEach(function (callback) {\n callback.call();\n });\n }\n /**\n * Get an axis, series or point object by `id` as given in the configuration\n * options. Returns `undefined` if no item is found.\n *\n * @sample highcharts/plotoptions/series-id/\n * Get series by id\n *\n * @function Highcharts.Chart#get\n *\n * @param {string} id\n * The id as given in the configuration options.\n *\n * @return {Highcharts.Axis|Highcharts.Series|Highcharts.Point|undefined}\n * The retrieved item.\n */\n get(id) {\n const series = this.series;\n /**\n * @private\n */\n function itemById(item) {\n return (item.id === id ||\n (item.options && item.options.id === id));\n }\n let ret = \n // Search axes\n find(this.axes, itemById) ||\n // Search series\n find(this.series, itemById);\n // Search points\n for (let i = 0; !ret && i < series.length; i++) {\n ret = find(series[i].points || [], itemById);\n }\n return ret;\n }\n /**\n * Create the Axis instances based on the config options.\n *\n * @private\n * @function Highcharts.Chart#getAxes\n * @emits Highcharts.Chart#event:afterGetAxes\n * @emits Highcharts.Chart#event:getAxes\n */\n getAxes() {\n const options = this.userOptions;\n fireEvent(this, 'getAxes');\n for (const coll of ['xAxis', 'yAxis']) {\n const arr = options[coll] = splat(options[coll] || {});\n for (const axisOptions of arr) {\n // eslint-disable-next-line no-new\n new Axis(this, axisOptions, coll);\n }\n }\n fireEvent(this, 'afterGetAxes');\n }\n /**\n * Returns an array of all currently selected points in the chart. Points\n * can be selected by clicking or programmatically by the\n * {@link Highcharts.Point#select}\n * function.\n *\n * @sample highcharts/plotoptions/series-allowpointselect-line/\n * Get selected points\n * @sample highcharts/members/point-select-lasso/\n * Lasso selection\n * @sample highcharts/chart/events-selection-points/\n * Rectangle selection\n *\n * @function Highcharts.Chart#getSelectedPoints\n *\n * @return {Array}\n * The currently selected points.\n */\n getSelectedPoints() {\n return this.series.reduce((acc, series) => {\n // For one-to-one points inspect series.data in order to retrieve\n // points outside the visible range (#6445). For grouped data,\n // inspect the generated series.points.\n series.getPointsCollection()\n .forEach((point) => {\n if (pick(point.selectedStaging, point.selected)) {\n acc.push(point);\n }\n });\n return acc;\n }, []);\n }\n /**\n * Returns an array of all currently selected series in the chart. Series\n * can be selected either programmatically by the\n * {@link Highcharts.Series#select}\n * function or by checking the checkbox next to the legend item if\n * [series.showCheckBox](https://api.highcharts.com/highcharts/plotOptions.series.showCheckbox)\n * is true.\n *\n * @sample highcharts/members/chart-getselectedseries/\n * Get selected series\n *\n * @function Highcharts.Chart#getSelectedSeries\n *\n * @return {Array}\n * The currently selected series.\n */\n getSelectedSeries() {\n return this.series.filter(function (serie) {\n return serie.selected;\n });\n }\n /**\n * Set a new title or subtitle for the chart.\n *\n * @sample highcharts/members/chart-settitle/\n * Set title text and styles\n *\n * @function Highcharts.Chart#setTitle\n *\n * @param {Highcharts.TitleOptions} [titleOptions]\n * New title options. The title text itself is set by the\n * `titleOptions.text` property.\n *\n * @param {Highcharts.SubtitleOptions} [subtitleOptions]\n * New subtitle options. The subtitle text itself is set by the\n * `subtitleOptions.text` property.\n *\n * @param {boolean} [redraw]\n * Whether to redraw the chart or wait for a later call to\n * `chart.redraw()`.\n */\n setTitle(titleOptions, subtitleOptions, redraw) {\n this.applyDescription('title', titleOptions);\n this.applyDescription('subtitle', subtitleOptions);\n // The initial call also adds the caption. On update, chart.update will\n // relay to Chart.setCaption.\n this.applyDescription('caption', void 0);\n this.layOutTitles(redraw);\n }\n /**\n * Apply a title, subtitle or caption for the chart\n *\n * @private\n * @function Highcharts.Chart#applyDescription\n * @param name {string}\n * Either title, subtitle or caption\n * @param {Highcharts.TitleOptions|Highcharts.SubtitleOptions|Highcharts.CaptionOptions|undefined} explicitOptions\n * The options to set, will be merged with default options.\n */\n applyDescription(name, explicitOptions) {\n const chart = this;\n // Merge default options with explicit options\n const options = this.options[name] = merge(this.options[name], explicitOptions);\n let elem = this[name];\n if (elem && explicitOptions) {\n this[name] = elem = elem.destroy(); // remove old\n }\n if (options && !elem) {\n elem = this.renderer.text(options.text, 0, 0, options.useHTML)\n .attr({\n align: options.align,\n 'class': 'highcharts-' + name,\n zIndex: options.zIndex || 4\n })\n .add();\n // Update methods, relay to `applyDescription`\n elem.update = function (updateOptions, redraw) {\n chart.applyDescription(name, updateOptions);\n chart.layOutTitles(redraw);\n };\n // Presentational\n if (!this.styledMode) {\n elem.css(extend(name === 'title' ? {\n // #2944\n fontSize: this.options.isStock ? '1em' : '1.2em'\n } : {}, options.style));\n }\n /**\n * The chart title. The title has an `update` method that allows\n * modifying the options directly or indirectly via\n * `chart.update`.\n *\n * @sample highcharts/members/title-update/\n * Updating titles\n *\n * @name Highcharts.Chart#title\n * @type {Highcharts.TitleObject}\n */\n /**\n * The chart subtitle. The subtitle has an `update` method that\n * allows modifying the options directly or indirectly via\n * `chart.update`.\n *\n * @name Highcharts.Chart#subtitle\n * @type {Highcharts.SubtitleObject}\n */\n this[name] = elem;\n }\n }\n /**\n * Internal function to lay out the chart title, subtitle and caption, and\n * cache the full offset height for use in `getMargins`. The result is\n * stored in `this.titleOffset`.\n *\n * @private\n * @function Highcharts.Chart#layOutTitles\n *\n * @param {boolean} [redraw=true]\n * @emits Highcharts.Chart#event:afterLayOutTitles\n */\n layOutTitles(redraw = true) {\n const titleOffset = [0, 0, 0], renderer = this.renderer, spacingBox = this.spacingBox;\n // Lay out the title and the subtitle respectively\n ['title', 'subtitle', 'caption'].forEach(function (key) {\n const title = this[key], titleOptions = (this.options[key]), verticalAlign = titleOptions.verticalAlign || 'top', offset = key === 'title' ?\n verticalAlign === 'top' ? -3 : 0 :\n // Floating subtitle (#6574)\n verticalAlign === 'top' ? titleOffset[0] + 2 : 0;\n if (title) {\n title\n .css({\n width: (titleOptions.width ||\n spacingBox.width + (titleOptions.widthAdjust || 0)) + 'px'\n });\n const baseline = renderer.fontMetrics(title).b, \n // Skip the cache for HTML (#3481, #11666)\n height = Math.round(title.getBBox(titleOptions.useHTML).height);\n title.align(extend({\n y: verticalAlign === 'bottom' ?\n baseline :\n offset + baseline,\n height\n }, titleOptions), false, 'spacingBox');\n if (!titleOptions.floating) {\n if (verticalAlign === 'top') {\n titleOffset[0] = Math.ceil(titleOffset[0] +\n height);\n }\n else if (verticalAlign === 'bottom') {\n titleOffset[2] = Math.ceil(titleOffset[2] +\n height);\n }\n }\n }\n }, this);\n // Handle title.margin and caption.margin\n if (titleOffset[0] &&\n (this.options.title.verticalAlign || 'top') === 'top') {\n titleOffset[0] += this.options.title.margin;\n }\n if (titleOffset[2] &&\n this.options.caption.verticalAlign === 'bottom') {\n titleOffset[2] += this.options.caption.margin;\n }\n const requiresDirtyBox = (!this.titleOffset ||\n this.titleOffset.join(',') !== titleOffset.join(','));\n // Used in getMargins\n this.titleOffset = titleOffset;\n fireEvent(this, 'afterLayOutTitles');\n if (!this.isDirtyBox && requiresDirtyBox) {\n this.isDirtyBox = this.isDirtyLegend = requiresDirtyBox;\n // Redraw if necessary (#2719, #2744)\n if (this.hasRendered && redraw && this.isDirtyBox) {\n this.redraw();\n }\n }\n }\n /**\n * Internal function to get the available size of the container element\n *\n * @private\n * @function Highcharts.Chart#getContainerBox\n */\n getContainerBox() {\n return {\n width: getStyle(this.renderTo, 'width', true) || 0,\n height: getStyle(this.renderTo, 'height', true) || 0\n };\n }\n /**\n * Internal function to get the chart width and height according to options\n * and container size. Sets {@link Chart.chartWidth} and\n * {@link Chart.chartHeight}.\n *\n * @private\n * @function Highcharts.Chart#getChartSize\n */\n getChartSize() {\n const chart = this, optionsChart = chart.options.chart, widthOption = optionsChart.width, heightOption = optionsChart.height, containerBox = chart.getContainerBox();\n /**\n * The current pixel width of the chart.\n *\n * @name Highcharts.Chart#chartWidth\n * @type {number}\n */\n chart.chartWidth = Math.max(// #1393\n 0, widthOption || containerBox.width || 600 // #1460\n );\n /**\n * The current pixel height of the chart.\n *\n * @name Highcharts.Chart#chartHeight\n * @type {number}\n */\n chart.chartHeight = Math.max(0, relativeLength(heightOption, chart.chartWidth) ||\n (containerBox.height > 1 ? containerBox.height : 400));\n chart.containerBox = containerBox;\n }\n /**\n * If the renderTo element has no offsetWidth, most likely one or more of\n * its parents are hidden. Loop up the DOM tree to temporarily display the\n * parents, then save the original display properties, and when the true\n * size is retrieved, reset them. Used on first render and on redraws.\n *\n * @private\n * @function Highcharts.Chart#temporaryDisplay\n *\n * @param {boolean} [revert]\n * Revert to the saved original styles.\n */\n temporaryDisplay(revert) {\n let node = this.renderTo, tempStyle;\n if (!revert) {\n while (node && node.style) {\n // When rendering to a detached node, it needs to be temporarily\n // attached in order to read styling and bounding boxes (#5783,\n // #7024).\n if (!doc.body.contains(node) && !node.parentNode) {\n node.hcOrigDetached = true;\n doc.body.appendChild(node);\n }\n if (getStyle(node, 'display', false) === 'none' ||\n node.hcOricDetached) {\n node.hcOrigStyle = {\n display: node.style.display,\n height: node.style.height,\n overflow: node.style.overflow\n };\n tempStyle = {\n display: 'block',\n overflow: 'hidden'\n };\n if (node !== this.renderTo) {\n tempStyle.height = 0;\n }\n css(node, tempStyle);\n // If it still doesn't have an offset width after setting\n // display to block, it probably has an !important priority\n // #2631, 6803\n if (!node.offsetWidth) {\n node.style.setProperty('display', 'block', 'important');\n }\n }\n node = node.parentNode;\n if (node === doc.body) {\n break;\n }\n }\n }\n else {\n while (node && node.style) {\n if (node.hcOrigStyle) {\n css(node, node.hcOrigStyle);\n delete node.hcOrigStyle;\n }\n if (node.hcOrigDetached) {\n doc.body.removeChild(node);\n node.hcOrigDetached = false;\n }\n node = node.parentNode;\n }\n }\n }\n /**\n * Set the {@link Chart.container|chart container's} class name, in\n * addition to `highcharts-container`.\n *\n * @function Highcharts.Chart#setClassName\n *\n * @param {string} [className]\n * The additional class name.\n */\n setClassName(className) {\n this.container.className = 'highcharts-container ' + (className || '');\n }\n /**\n * Get the containing element, determine the size and create the inner\n * container div to hold the chart.\n *\n * @private\n * @function Highcharts.Chart#afterGetContainer\n * @emits Highcharts.Chart#event:afterGetContainer\n */\n getContainer() {\n const chart = this, options = chart.options, optionsChart = options.chart, indexAttrName = 'data-highcharts-chart', containerId = uniqueKey();\n let containerStyle, renderTo = chart.renderTo;\n if (!renderTo) {\n chart.renderTo = renderTo =\n optionsChart.renderTo;\n }\n if (isString(renderTo)) {\n chart.renderTo = renderTo =\n doc.getElementById(renderTo);\n }\n // Display an error if the renderTo is wrong\n if (!renderTo) {\n error(13, true, chart);\n }\n // If the container already holds a chart, destroy it. The check for\n // hasRendered is there because web pages that are saved to disk from\n // the browser, will preserve the data-highcharts-chart attribute and\n // the SVG contents, but not an interactive chart. So in this case,\n // charts[oldChartIndex] will point to the wrong chart if any (#2609).\n const oldChartIndex = pInt(attr(renderTo, indexAttrName));\n if (isNumber(oldChartIndex) &&\n charts[oldChartIndex] &&\n charts[oldChartIndex].hasRendered) {\n charts[oldChartIndex].destroy();\n }\n // Make a reference to the chart from the div\n attr(renderTo, indexAttrName, chart.index);\n // remove previous chart\n renderTo.innerHTML = AST.emptyHTML;\n // If the container doesn't have an offsetWidth, it has or is a child of\n // a node that has display:none. We need to temporarily move it out to a\n // visible state to determine the size, else the legend and tooltips\n // won't render properly. The skipClone option is used in sparklines as\n // a micro optimization, saving about 1-2 ms each chart.\n if (!optionsChart.skipClone && !renderTo.offsetWidth) {\n chart.temporaryDisplay();\n }\n // get the width and height\n chart.getChartSize();\n const chartHeight = chart.chartHeight;\n let chartWidth = chart.chartWidth;\n // Allow table cells and flex-boxes to shrink without the chart blocking\n // them out (#6427)\n css(renderTo, { overflow: 'hidden' });\n // Create the inner container\n if (!chart.styledMode) {\n containerStyle = extend({\n position: 'relative',\n // needed for context menu (avoidscrollbars) and content\n // overflow in IE\n overflow: 'hidden',\n width: chartWidth + 'px',\n height: chartHeight + 'px',\n textAlign: 'left',\n lineHeight: 'normal',\n zIndex: 0,\n '-webkit-tap-highlight-color': 'rgba(0,0,0,0)',\n userSelect: 'none',\n 'touch-action': 'manipulation',\n outline: 'none'\n }, optionsChart.style || {});\n }\n /**\n * The containing HTML element of the chart. The container is\n * dynamically inserted into the element given as the `renderTo`\n * parameter in the {@link Highcharts#chart} constructor.\n *\n * @name Highcharts.Chart#container\n * @type {Highcharts.HTMLDOMElement}\n */\n const container = createElement('div', {\n id: containerId\n }, containerStyle, renderTo);\n chart.container = container;\n // Adjust width if setting height affected it (#20334)\n chart.getChartSize();\n if (chartWidth !== chart.chartWidth) {\n chartWidth = chart.chartWidth;\n if (!chart.styledMode) {\n css(container, {\n width: pick(optionsChart.style?.width, chartWidth + 'px')\n });\n }\n }\n chart.containerBox = chart.getContainerBox();\n // cache the cursor (#1650)\n chart._cursor = container.style.cursor;\n // Initialize the renderer\n const Renderer = optionsChart.renderer || !svg ?\n RendererRegistry.getRendererType(optionsChart.renderer) :\n SVGRenderer;\n /**\n * The renderer instance of the chart. Each chart instance has only one\n * associated renderer.\n *\n * @name Highcharts.Chart#renderer\n * @type {Highcharts.SVGRenderer}\n */\n chart.renderer = new Renderer(container, chartWidth, chartHeight, void 0, optionsChart.forExport, options.exporting && options.exporting.allowHTML, chart.styledMode);\n // Set the initial animation from the options\n setAnimation(void 0, chart);\n chart.setClassName(optionsChart.className);\n if (!chart.styledMode) {\n chart.renderer.setStyle(optionsChart.style);\n }\n else {\n // Initialize definitions\n for (const key in options.defs) { // eslint-disable-line guard-for-in\n this.renderer.definition(options.defs[key]);\n }\n }\n // Add a reference to the charts index\n chart.renderer.chartIndex = chart.index;\n fireEvent(this, 'afterGetContainer');\n }\n /**\n * Calculate margins by rendering axis labels in a preliminary position.\n * Title, subtitle and legend have already been rendered at this stage, but\n * will be moved into their final positions.\n *\n * @private\n * @function Highcharts.Chart#getMargins\n * @emits Highcharts.Chart#event:getMargins\n */\n getMargins(skipAxes) {\n const { spacing, margin, titleOffset } = this;\n this.resetMargins();\n // Adjust for title and subtitle\n if (titleOffset[0] && !defined(margin[0])) {\n this.plotTop = Math.max(this.plotTop, titleOffset[0] + spacing[0]);\n }\n if (titleOffset[2] && !defined(margin[2])) {\n this.marginBottom = Math.max(this.marginBottom, titleOffset[2] + spacing[2]);\n }\n // Adjust for legend\n if (this.legend && this.legend.display) {\n this.legend.adjustMargins(margin, spacing);\n }\n fireEvent(this, 'getMargins');\n if (!skipAxes) {\n this.getAxisMargins();\n }\n }\n /**\n * @private\n * @function Highcharts.Chart#getAxisMargins\n */\n getAxisMargins() {\n const chart = this, \n // [top, right, bottom, left]\n axisOffset = chart.axisOffset = [0, 0, 0, 0], colorAxis = chart.colorAxis, margin = chart.margin, getOffset = function (axes) {\n axes.forEach(function (axis) {\n if (axis.visible) {\n axis.getOffset();\n }\n });\n };\n // pre-render axes to get labels offset width\n if (chart.hasCartesianSeries) {\n getOffset(chart.axes);\n }\n else if (colorAxis && colorAxis.length) {\n getOffset(colorAxis);\n }\n // Add the axis offsets\n marginNames.forEach(function (m, side) {\n if (!defined(margin[side])) {\n chart[m] += axisOffset[side];\n }\n });\n chart.setChartSize();\n }\n /**\n * Return the current options of the chart, but only those that differ from\n * default options. Items that can be either an object or an array of\n * objects, like `series`, `xAxis` and `yAxis`, are always returned as\n * array.\n *\n * @sample highcharts/members/chart-getoptions\n *\n * @function Highcharts.Chart#getOptions\n *\n * @since 11.1.0\n */\n getOptions() {\n return diffObjects(this.userOptions, defaultOptions);\n }\n /**\n * Reflows the chart to its container. By default, the Resize Observer is\n * attached to the chart's div which allows to reflows the chart\n * automatically to its container, as per the\n * [chart.reflow](https://api.highcharts.com/highcharts/chart.reflow)\n * option.\n *\n * @sample highcharts/chart/events-container/\n * Pop up and reflow\n *\n * @function Highcharts.Chart#reflow\n *\n * @param {global.Event} [e]\n * Event arguments. Used primarily when the function is called\n * internally as a response to window resize.\n */\n reflow(e) {\n const chart = this, oldBox = chart.containerBox, containerBox = chart.getContainerBox();\n delete chart.pointer?.chartPosition;\n // Width and height checks for display:none. Target is doc in Opera\n // and win in Firefox, Chrome and IE9.\n if (!chart.isPrinting &&\n !chart.isResizing &&\n oldBox &&\n // When fired by resize observer inside hidden container\n containerBox.width) {\n if (containerBox.width !== oldBox.width ||\n containerBox.height !== oldBox.height) {\n U.clearTimeout(chart.reflowTimeout);\n // When called from window.resize, e is set, else it's called\n // directly (#2224)\n chart.reflowTimeout = syncTimeout(function () {\n // Set size, it may have been destroyed in the meantime\n // (#1257)\n if (chart.container) {\n chart.setSize(void 0, void 0, false);\n }\n }, e ? 100 : 0);\n }\n chart.containerBox = containerBox;\n }\n }\n /**\n * Toggle the event handlers necessary for auto resizing, depending on the\n * `chart.reflow` option.\n *\n * @private\n * @function Highcharts.Chart#setReflow\n */\n setReflow() {\n const chart = this;\n const runReflow = (e) => {\n if (chart.options?.chart.reflow && chart.hasLoaded) {\n chart.reflow(e);\n }\n };\n if (typeof ResizeObserver === 'function') {\n (new ResizeObserver(runReflow)).observe(chart.renderTo);\n // Fallback for more legacy browser versions.\n }\n else {\n const unbind = addEvent(win, 'resize', runReflow);\n addEvent(this, 'destroy', unbind);\n }\n }\n /**\n * Resize the chart to a given width and height. In order to set the width\n * only, the height argument may be skipped. To set the height only, pass\n * `undefined` for the width.\n *\n * @sample highcharts/members/chart-setsize-button/\n * Test resizing from buttons\n * @sample highcharts/members/chart-setsize-jquery-resizable/\n * Add a jQuery UI resizable\n * @sample stock/members/chart-setsize/\n * Highcharts Stock with UI resizable\n *\n * @function Highcharts.Chart#setSize\n *\n * @param {number|null} [width]\n * The new pixel width of the chart. Since v4.2.6, the argument can\n * be `undefined` in order to preserve the current value (when\n * setting height only), or `null` to adapt to the width of the\n * containing element.\n *\n * @param {number|null} [height]\n * The new pixel height of the chart. Since v4.2.6, the argument can\n * be `undefined` in order to preserve the current value, or `null`\n * in order to adapt to the height of the containing element.\n *\n * @param {boolean|Partial} [animation]\n * Whether and how to apply animation. When `undefined`, it applies\n * the animation that is set in the `chart.animation` option.\n *\n *\n * @emits Highcharts.Chart#event:endResize\n * @emits Highcharts.Chart#event:resize\n */\n setSize(width, height, animation) {\n const chart = this, renderer = chart.renderer;\n // Handle the isResizing counter\n chart.isResizing += 1;\n // Set the animation for the current process\n setAnimation(animation, chart);\n const globalAnimation = renderer.globalAnimation;\n chart.oldChartHeight = chart.chartHeight;\n chart.oldChartWidth = chart.chartWidth;\n if (typeof width !== 'undefined') {\n chart.options.chart.width = width;\n }\n if (typeof height !== 'undefined') {\n chart.options.chart.height = height;\n }\n chart.getChartSize();\n const { chartWidth, chartHeight, scrollablePixelsX = 0, scrollablePixelsY = 0 } = chart;\n // Avoid expensive redrawing if the computed size didn't change\n if (chart.isDirtyBox ||\n chartWidth !== chart.oldChartWidth ||\n chartHeight !== chart.oldChartHeight) {\n // Resize the container with the global animation applied if enabled\n // (#2503)\n if (!chart.styledMode) {\n (globalAnimation ? animate : css)(chart.container, {\n width: `${chartWidth + scrollablePixelsX}px`,\n height: `${chartHeight + scrollablePixelsY}px`\n }, globalAnimation);\n }\n chart.setChartSize(true);\n renderer.setSize(chartWidth, chartHeight, globalAnimation);\n // Handle axes\n chart.axes.forEach(function (axis) {\n axis.isDirty = true;\n axis.setScale();\n });\n chart.isDirtyLegend = true; // Force legend redraw\n chart.isDirtyBox = true; // Force redraw of plot and chart border\n chart.layOutTitles(); // #2857\n chart.getMargins();\n chart.redraw(globalAnimation);\n chart.oldChartHeight = void 0;\n fireEvent(chart, 'resize');\n // Fire endResize and set isResizing back. If animation is disabled,\n // fire without delay, but in a new thread to avoid triggering the\n // resize observer (#19027).\n setTimeout(() => {\n if (chart) {\n fireEvent(chart, 'endResize', void 0, () => {\n chart.isResizing -= 1;\n });\n }\n }, animObject(globalAnimation).duration);\n }\n }\n /**\n * Set the public chart properties. This is done before and after the\n * pre-render to determine margin sizes.\n *\n * @private\n * @function Highcharts.Chart#setChartSize\n * @emits Highcharts.Chart#event:afterSetChartSize\n */\n setChartSize(skipAxes) {\n const chart = this, inverted = chart.inverted, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, optionsChart = chart.options.chart, spacing = chart.spacing, clipOffset = chart.clipOffset;\n let plotLeft, plotTop, plotWidth, plotHeight;\n /**\n * The current left position of the plot area in pixels.\n *\n * @name Highcharts.Chart#plotLeft\n * @type {number}\n */\n chart.plotLeft = plotLeft = Math.round(chart.plotLeft);\n /**\n * The current top position of the plot area in pixels.\n *\n * @name Highcharts.Chart#plotTop\n * @type {number}\n */\n chart.plotTop = plotTop = Math.round(chart.plotTop);\n /**\n * The current width of the plot area in pixels.\n *\n * @name Highcharts.Chart#plotWidth\n * @type {number}\n */\n chart.plotWidth = plotWidth = Math.max(0, Math.round(chartWidth - plotLeft - chart.marginRight));\n /**\n * The current height of the plot area in pixels.\n *\n * @name Highcharts.Chart#plotHeight\n * @type {number}\n */\n chart.plotHeight = plotHeight = Math.max(0, Math.round(chartHeight - plotTop - chart.marginBottom));\n chart.plotSizeX = inverted ? plotHeight : plotWidth;\n chart.plotSizeY = inverted ? plotWidth : plotHeight;\n chart.plotBorderWidth = optionsChart.plotBorderWidth || 0;\n // Set boxes used for alignment\n chart.spacingBox = renderer.spacingBox = {\n x: spacing[3],\n y: spacing[0],\n width: chartWidth - spacing[3] - spacing[1],\n height: chartHeight - spacing[0] - spacing[2]\n };\n chart.plotBox = renderer.plotBox = {\n x: plotLeft,\n y: plotTop,\n width: plotWidth,\n height: plotHeight\n };\n const plotBorderWidth = 2 * Math.floor(chart.plotBorderWidth / 2), clipX = Math.ceil(Math.max(plotBorderWidth, clipOffset[3]) / 2), clipY = Math.ceil(Math.max(plotBorderWidth, clipOffset[0]) / 2);\n chart.clipBox = {\n x: clipX,\n y: clipY,\n width: Math.floor(chart.plotSizeX -\n Math.max(plotBorderWidth, clipOffset[1]) / 2 -\n clipX),\n height: Math.max(0, Math.floor(chart.plotSizeY -\n Math.max(plotBorderWidth, clipOffset[2]) / 2 -\n clipY))\n };\n if (!skipAxes) {\n chart.axes.forEach(function (axis) {\n axis.setAxisSize();\n axis.setAxisTranslation();\n });\n renderer.alignElements();\n }\n fireEvent(chart, 'afterSetChartSize', { skipAxes: skipAxes });\n }\n /**\n * Initial margins before auto size margins are applied.\n *\n * @private\n * @function Highcharts.Chart#resetMargins\n */\n resetMargins() {\n fireEvent(this, 'resetMargins');\n const chart = this, chartOptions = chart.options.chart;\n // Create margin and spacing array\n ['margin', 'spacing'].forEach(function splashArrays(target) {\n const value = chartOptions[target], values = isObject(value) ? value : [value, value, value, value];\n [\n 'Top',\n 'Right',\n 'Bottom',\n 'Left'\n ].forEach(function (sideName, side) {\n chart[target][side] = pick(chartOptions[target + sideName], values[side]);\n });\n });\n // Set margin names like chart.plotTop, chart.plotLeft,\n // chart.marginRight, chart.marginBottom.\n marginNames.forEach(function (m, side) {\n chart[m] = pick(chart.margin[side], chart.spacing[side]);\n });\n chart.axisOffset = [0, 0, 0, 0]; // top, right, bottom, left\n chart.clipOffset = [0, 0, 0, 0];\n }\n /**\n * Internal function to draw or redraw the borders and backgrounds for chart\n * and plot area.\n *\n * @private\n * @function Highcharts.Chart#drawChartBox\n * @emits Highcharts.Chart#event:afterDrawChartBox\n */\n drawChartBox() {\n const chart = this, optionsChart = chart.options.chart, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, styledMode = chart.styledMode, plotBGImage = chart.plotBGImage, chartBackgroundColor = optionsChart.backgroundColor, plotBackgroundColor = optionsChart.plotBackgroundColor, plotBackgroundImage = optionsChart.plotBackgroundImage, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, plotBox = chart.plotBox, clipRect = chart.clipRect, clipBox = chart.clipBox;\n let chartBackground = chart.chartBackground, plotBackground = chart.plotBackground, plotBorder = chart.plotBorder, chartBorderWidth, mgn, bgAttr, verb = 'animate';\n // Chart area\n if (!chartBackground) {\n chart.chartBackground = chartBackground = renderer.rect()\n .addClass('highcharts-background')\n .add();\n verb = 'attr';\n }\n if (!styledMode) {\n // Presentational\n chartBorderWidth = optionsChart.borderWidth || 0;\n mgn = chartBorderWidth + (optionsChart.shadow ? 8 : 0);\n bgAttr = {\n fill: chartBackgroundColor || 'none'\n };\n if (chartBorderWidth || chartBackground['stroke-width']) { // #980\n bgAttr.stroke = optionsChart.borderColor;\n bgAttr['stroke-width'] = chartBorderWidth;\n }\n chartBackground\n .attr(bgAttr)\n .shadow(optionsChart.shadow);\n }\n else {\n chartBorderWidth = mgn = chartBackground.strokeWidth();\n }\n chartBackground[verb]({\n x: mgn / 2,\n y: mgn / 2,\n width: chartWidth - mgn - chartBorderWidth % 2,\n height: chartHeight - mgn - chartBorderWidth % 2,\n r: optionsChart.borderRadius\n });\n // Plot background\n verb = 'animate';\n if (!plotBackground) {\n verb = 'attr';\n chart.plotBackground = plotBackground = renderer.rect()\n .addClass('highcharts-plot-background')\n .add();\n }\n plotBackground[verb](plotBox);\n if (!styledMode) {\n // Presentational attributes for the background\n plotBackground\n .attr({\n fill: plotBackgroundColor || 'none'\n })\n .shadow(optionsChart.plotShadow);\n // Create the background image\n if (plotBackgroundImage) {\n if (!plotBGImage) {\n chart.plotBGImage = renderer.image(plotBackgroundImage, plotLeft, plotTop, plotWidth, plotHeight).add();\n }\n else {\n if (plotBackgroundImage !== plotBGImage.attr('href')) {\n plotBGImage.attr('href', plotBackgroundImage);\n }\n plotBGImage.animate(plotBox);\n }\n }\n }\n // Plot clip\n if (!clipRect) {\n chart.clipRect = renderer.clipRect(clipBox);\n }\n else {\n clipRect.animate({\n width: clipBox.width,\n height: clipBox.height\n });\n }\n // Plot area border\n verb = 'animate';\n if (!plotBorder) {\n verb = 'attr';\n chart.plotBorder = plotBorder = renderer.rect()\n .addClass('highcharts-plot-border')\n .attr({\n zIndex: 1 // Above the grid\n })\n .add();\n }\n if (!styledMode) {\n // Presentational\n plotBorder.attr({\n stroke: optionsChart.plotBorderColor,\n 'stroke-width': optionsChart.plotBorderWidth || 0,\n fill: 'none'\n });\n }\n plotBorder[verb](plotBorder.crisp({\n x: plotLeft,\n y: plotTop,\n width: plotWidth,\n height: plotHeight\n }, -plotBorder.strokeWidth())); // #3282 plotBorder should be negative;\n // reset\n chart.isDirtyBox = false;\n fireEvent(this, 'afterDrawChartBox');\n }\n /**\n * Detect whether a certain chart property is needed based on inspecting its\n * options and series. This mainly applies to the chart.inverted property,\n * and in extensions to the chart.angular and chart.polar properties.\n *\n * @private\n * @function Highcharts.Chart#propFromSeries\n */\n propFromSeries() {\n const chart = this, optionsChart = chart.options.chart, seriesOptions = chart.options.series;\n let i, klass, value;\n /**\n * The flag is set to `true` if a series of the chart is inverted.\n *\n * @name Highcharts.Chart#inverted\n * @type {boolean|undefined}\n */\n ['inverted', 'angular', 'polar'].forEach(function (key) {\n // The default series type's class\n klass = seriesTypes[optionsChart.type];\n // Get the value from available chart-wide properties\n value =\n // It is set in the options:\n optionsChart[key] ||\n // The default series class:\n (klass && klass.prototype[key]);\n // requires it\n // 4. Check if any the chart's series require it\n i = seriesOptions && seriesOptions.length;\n while (!value && i--) {\n klass = seriesTypes[seriesOptions[i].type];\n if (klass && klass.prototype[key]) {\n value = true;\n }\n }\n // Set the chart property\n chart[key] = value;\n });\n }\n /**\n * Internal function to link two or more series together, based on the\n * `linkedTo` option. This is done from `Chart.render`, and after\n * `Chart.addSeries` and `Series.remove`.\n *\n * @private\n * @function Highcharts.Chart#linkSeries\n * @emits Highcharts.Chart#event:afterLinkSeries\n */\n linkSeries(isUpdating) {\n const chart = this, chartSeries = chart.series;\n // Reset links\n chartSeries.forEach(function (series) {\n series.linkedSeries.length = 0;\n });\n // Apply new links\n chartSeries.forEach(function (series) {\n const { linkedTo } = series.options;\n if (isString(linkedTo)) {\n let linkedParent;\n if (linkedTo === ':previous') {\n linkedParent = chart.series[series.index - 1];\n }\n else {\n linkedParent = chart.get(linkedTo);\n }\n // #3341 avoid mutual linking\n if (linkedParent &&\n linkedParent.linkedParent !== series) {\n linkedParent.linkedSeries.push(series);\n /**\n * The parent series of the current series, if the current\n * series has a [linkedTo](https://api.highcharts.com/highcharts/series.line.linkedTo)\n * setting.\n *\n * @name Highcharts.Series#linkedParent\n * @type {Highcharts.Series}\n * @readonly\n */\n series.linkedParent = linkedParent;\n if (linkedParent.enabledDataSorting) {\n series.setDataSortingOptions();\n }\n series.visible = pick(series.options.visible, linkedParent.options.visible, series.visible); // #3879\n }\n }\n });\n fireEvent(this, 'afterLinkSeries', { isUpdating });\n }\n /**\n * Render series for the chart.\n *\n * @private\n * @function Highcharts.Chart#renderSeries\n */\n renderSeries() {\n this.series.forEach(function (serie) {\n serie.translate();\n serie.render();\n });\n }\n /**\n * Render all graphics for the chart. Runs internally on initialization.\n *\n * @private\n * @function Highcharts.Chart#render\n */\n render() {\n const chart = this, axes = chart.axes, colorAxis = chart.colorAxis, renderer = chart.renderer, axisLayoutRuns = chart.options.chart.axisLayoutRuns || 2, renderAxes = (axes) => {\n axes.forEach((axis) => {\n if (axis.visible) {\n axis.render();\n }\n });\n };\n let expectedSpace = 0, // Correction for X axis labels\n // If the plot area size has changed significantly, calculate tick\n // positions again\n redoHorizontal = true, redoVertical, run = 0;\n // Title\n chart.setTitle();\n // Fire an event before the margins are computed. This is where the\n // legend is assigned.\n fireEvent(chart, 'beforeMargins');\n // Get stacks\n chart.getStacks?.();\n // Get chart margins\n chart.getMargins(true);\n chart.setChartSize();\n for (const axis of axes) {\n const { options } = axis, { labels } = options;\n if (axis.horiz &&\n axis.visible &&\n labels.enabled &&\n axis.series.length &&\n axis.coll !== 'colorAxis' &&\n !chart.polar) {\n expectedSpace = options.tickLength;\n axis.createGroups();\n // Calculate expected space based on dummy tick\n const mockTick = new Tick(axis, 0, '', true), label = mockTick.createLabel('x', labels);\n mockTick.destroy();\n if (label &&\n pick(labels.reserveSpace, !isNumber(options.crossing))) {\n expectedSpace = label.getBBox().height +\n labels.distance +\n Math.max(options.offset || 0, 0);\n }\n if (expectedSpace) {\n label?.destroy();\n break;\n }\n }\n }\n // Use Math.max to prevent negative plotHeight\n chart.plotHeight = Math.max(chart.plotHeight - expectedSpace, 0);\n while ((redoHorizontal || redoVertical || axisLayoutRuns > 1) &&\n run < axisLayoutRuns // #19794\n ) {\n const tempWidth = chart.plotWidth, tempHeight = chart.plotHeight;\n for (const axis of axes) {\n if (run === 0) {\n // Get margins by pre-rendering axes\n axis.setScale();\n }\n else if ((axis.horiz && redoHorizontal) ||\n (!axis.horiz && redoVertical)) {\n // Update to reflect the new margins\n axis.setTickInterval(true);\n }\n }\n if (run === 0) {\n chart.getAxisMargins();\n }\n else {\n // Check again for new, rotated or moved labels\n chart.getMargins();\n }\n redoHorizontal = (tempWidth / chart.plotWidth) > (run ? 1 : 1.1);\n redoVertical = (tempHeight / chart.plotHeight) > (run ? 1 : 1.05);\n run++;\n }\n // Draw the borders and backgrounds\n chart.drawChartBox();\n // Axes\n if (chart.hasCartesianSeries) {\n renderAxes(axes);\n }\n else if (colorAxis && colorAxis.length) {\n renderAxes(colorAxis);\n }\n // The series\n if (!chart.seriesGroup) {\n chart.seriesGroup = renderer.g('series-group')\n .attr({ zIndex: 3 })\n .shadow(chart.options.chart.seriesGroupShadow)\n .add();\n }\n chart.renderSeries();\n // Credits\n chart.addCredits();\n // Handle responsiveness\n if (chart.setResponsive) {\n chart.setResponsive();\n }\n // Set flag\n chart.hasRendered = true;\n }\n /**\n * Set a new credits label for the chart.\n *\n * @sample highcharts/credits/credits-update/\n * Add and update credits\n *\n * @function Highcharts.Chart#addCredits\n *\n * @param {Highcharts.CreditsOptions} [credits]\n * A configuration object for the new credits.\n */\n addCredits(credits) {\n const chart = this, creds = merge(true, this.options.credits, credits);\n if (creds.enabled && !this.credits) {\n /**\n * The chart's credits label. The label has an `update` method that\n * allows setting new options as per the\n * [credits options set](https://api.highcharts.com/highcharts/credits).\n *\n * @name Highcharts.Chart#credits\n * @type {Highcharts.SVGElement}\n */\n this.credits = this.renderer.text(creds.text + (this.mapCredits || ''), 0, 0)\n .addClass('highcharts-credits')\n .on('click', function () {\n if (creds.href) {\n win.location.href = creds.href;\n }\n })\n .attr({\n align: creds.position.align,\n zIndex: 8\n });\n if (!chart.styledMode) {\n this.credits.css(creds.style);\n }\n this.credits\n .add()\n .align(creds.position);\n // Dynamically update\n this.credits.update = function (options) {\n chart.credits = chart.credits.destroy();\n chart.addCredits(options);\n };\n }\n }\n /**\n * Remove the chart and purge memory. This method is called internally\n * before adding a second chart into the same container, as well as on\n * window unload to prevent leaks.\n *\n * @sample highcharts/members/chart-destroy/\n * Destroy the chart from a button\n * @sample stock/members/chart-destroy/\n * Destroy with Highcharts Stock\n *\n * @function Highcharts.Chart#destroy\n *\n * @emits Highcharts.Chart#event:destroy\n */\n destroy() {\n const chart = this, axes = chart.axes, series = chart.series, container = chart.container, parentNode = container && container.parentNode;\n let i;\n // fire the chart.destroy event\n fireEvent(chart, 'destroy');\n // Delete the chart from charts lookup array\n if (chart.renderer.forExport) {\n erase(charts, chart); // #6569\n }\n else {\n charts[chart.index] = void 0;\n }\n H.chartCount--;\n chart.renderTo.removeAttribute('data-highcharts-chart');\n // remove events\n removeEvent(chart);\n // ==== Destroy collections:\n // Destroy axes\n i = axes.length;\n while (i--) {\n axes[i] = axes[i].destroy();\n }\n // Destroy scroller & scroller series before destroying base series\n if (this.scroller && this.scroller.destroy) {\n this.scroller.destroy();\n }\n // Destroy each series\n i = series.length;\n while (i--) {\n series[i] = series[i].destroy();\n }\n // ==== Destroy chart properties:\n [\n 'title', 'subtitle', 'chartBackground', 'plotBackground',\n 'plotBGImage', 'plotBorder', 'seriesGroup', 'clipRect', 'credits',\n 'pointer', 'rangeSelector', 'legend', 'resetZoomButton', 'tooltip',\n 'renderer'\n ].forEach(function (name) {\n const prop = chart[name];\n if (prop && prop.destroy) {\n chart[name] = prop.destroy();\n }\n });\n // Remove container and all SVG, check container as it can break in IE\n // when destroyed before finished loading\n if (container) {\n container.innerHTML = AST.emptyHTML;\n removeEvent(container);\n if (parentNode) {\n discardElement(container);\n }\n }\n // clean it all up\n objectEach(chart, function (val, key) {\n delete chart[key];\n });\n }\n /**\n * Prepare for first rendering after all data are loaded.\n *\n * @private\n * @function Highcharts.Chart#firstRender\n * @emits Highcharts.Chart#event:beforeRender\n */\n firstRender() {\n const chart = this, options = chart.options;\n // Create the container\n chart.getContainer();\n chart.resetMargins();\n chart.setChartSize();\n // Set the common chart properties (mainly invert) from the given series\n chart.propFromSeries();\n // get axes\n chart.getAxes();\n // Initialize the series\n const series = isArray(options.series) ? options.series : [];\n options.series = []; // Avoid mutation\n series.forEach(\n // #9680\n function (serieOptions) {\n chart.initSeries(serieOptions);\n });\n chart.linkSeries();\n chart.setSortedData();\n // Run an event after axes and series are initialized, but before\n // render. At this stage, the series data is indexed and cached in the\n // xData and yData arrays, so we can access those before rendering. Used\n // in Highcharts Stock.\n fireEvent(chart, 'beforeRender');\n chart.render();\n chart.pointer?.getChartPosition(); // #14973\n // Fire the load event if there are no external images\n if (!chart.renderer.imgCount && !chart.hasLoaded) {\n chart.onload();\n }\n // If the chart was rendered outside the top container, put it back in\n // (#3679)\n chart.temporaryDisplay(true);\n }\n /**\n * Internal function that runs on chart load, async if any images are loaded\n * in the chart. Runs the callbacks and triggers the `load` and `render`\n * events.\n *\n * @private\n * @function Highcharts.Chart#onload\n * @emits Highcharts.Chart#event:load\n * @emits Highcharts.Chart#event:render\n */\n onload() {\n // Run callbacks, first the ones registered by modules, then user's one\n this.callbacks.concat([this.callback]).forEach(function (fn) {\n // Chart destroyed in its own callback (#3600)\n if (fn && typeof this.index !== 'undefined') {\n fn.apply(this, [this]);\n }\n }, this);\n fireEvent(this, 'load');\n fireEvent(this, 'render');\n // Set up auto resize, check for not destroyed (#6068)\n if (defined(this.index)) {\n this.setReflow();\n }\n this.warnIfA11yModuleNotLoaded();\n // Don't run again\n this.hasLoaded = true;\n }\n /**\n * Emit console warning if the a11y module is not loaded.\n */\n warnIfA11yModuleNotLoaded() {\n const { options, title } = this;\n if (options && !this.accessibility) {\n // Make chart behave as an image with the title as alt text\n this.renderer.boxWrapper.attr({\n role: 'img',\n 'aria-label': ((title && title.element.textContent) || ''\n // #17753, < is not allowed in SVG attributes\n ).replace(/} [animation]\n * Whether to apply animation, and optionally animation\n * configuration. When `undefined`, it applies the animation that is\n * set in the `chart.animation` option.\n *\n * @return {Highcharts.Series}\n * The newly created series object.\n *\n * @emits Highcharts.Chart#event:addSeries\n * @emits Highcharts.Chart#event:afterAddSeries\n */\n addSeries(options, redraw, animation) {\n const chart = this;\n let series;\n if (options) { // <- not necessary\n redraw = pick(redraw, true); // defaults to true\n fireEvent(chart, 'addSeries', { options: options }, function () {\n series = chart.initSeries(options);\n chart.isDirtyLegend = true;\n chart.linkSeries();\n if (series.enabledDataSorting) {\n // We need to call `setData` after `linkSeries`\n series.setData(options.data, false);\n }\n fireEvent(chart, 'afterAddSeries', { series: series });\n if (redraw) {\n chart.redraw(animation);\n }\n });\n }\n return series;\n }\n /**\n * Add an axis to the chart after render time. Note that this method should\n * never be used when adding data synchronously at chart render time, as it\n * adds expense to the calculations and rendering. When adding data at the\n * same time as the chart is initialized, add the axis as a configuration\n * option instead.\n *\n * @sample highcharts/members/chart-addaxis/\n * Add and remove axes\n *\n * @function Highcharts.Chart#addAxis\n *\n * @param {Highcharts.AxisOptions} options\n * The axis options.\n *\n * @param {boolean} [isX=false]\n * Whether it is an X axis or a value axis.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after adding.\n *\n * @param {boolean|Partial} [animation]\n * Whether and how to apply animation in the redraw. When\n * `undefined`, it applies the animation that is set in the\n * `chart.animation` option.\n *\n * @return {Highcharts.Axis}\n * The newly generated Axis object.\n */\n addAxis(options, isX, redraw, animation) {\n return this.createAxis(isX ? 'xAxis' : 'yAxis', { axis: options, redraw: redraw, animation: animation });\n }\n /**\n * Add a color axis to the chart after render time. Note that this method\n * should never be used when adding data synchronously at chart render time,\n * as it adds expense to the calculations and rendering. When adding data at\n * the same time as the chart is initialized, add the axis as a\n * configuration option instead.\n *\n * @sample highcharts/members/chart-addaxis/\n * Add and remove axes\n *\n * @function Highcharts.Chart#addColorAxis\n *\n * @param {Highcharts.ColorAxisOptions} options\n * The axis options.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart after adding.\n *\n * @param {boolean|Partial} [animation]\n * Whether and how to apply animation in the redraw. When\n * `undefined`, it applies the animation that is set in the\n * `chart.animation` option.\n *\n * @return {Highcharts.Axis}\n * The newly generated Axis object.\n */\n addColorAxis(options, redraw, animation) {\n return this.createAxis('colorAxis', { axis: options, redraw: redraw, animation: animation });\n }\n /**\n * Factory for creating different axis types.\n *\n * @private\n * @function Highcharts.Chart#createAxis\n *\n * @param {string} coll\n * An axis type.\n *\n * @param {...Array<*>} arguments\n * All arguments for the constructor.\n *\n * @return {Highcharts.Axis}\n * The newly generated Axis object.\n */\n createAxis(coll, options) {\n const axis = new Axis(this, options.axis, coll);\n if (pick(options.redraw, true)) {\n this.redraw(options.animation);\n }\n return axis;\n }\n /**\n * Dim the chart and show a loading text or symbol. Options for the loading\n * screen are defined in {@link\n * https://api.highcharts.com/highcharts/loading|the loading options}.\n *\n * @sample highcharts/members/chart-hideloading/\n * Show and hide loading from a button\n * @sample highcharts/members/chart-showloading/\n * Apply different text labels\n * @sample stock/members/chart-show-hide-loading/\n * Toggle loading in Highcharts Stock\n *\n * @function Highcharts.Chart#showLoading\n *\n * @param {string} [str]\n * An optional text to show in the loading label instead of the\n * default one. The default text is set in\n * [lang.loading](https://api.highcharts.com/highcharts/lang.loading).\n */\n showLoading(str) {\n const chart = this, options = chart.options, loadingOptions = options.loading, setLoadingSize = function () {\n if (loadingDiv) {\n css(loadingDiv, {\n left: chart.plotLeft + 'px',\n top: chart.plotTop + 'px',\n width: chart.plotWidth + 'px',\n height: chart.plotHeight + 'px'\n });\n }\n };\n let loadingDiv = chart.loadingDiv, loadingSpan = chart.loadingSpan;\n // create the layer at the first call\n if (!loadingDiv) {\n chart.loadingDiv = loadingDiv = createElement('div', {\n className: 'highcharts-loading highcharts-loading-hidden'\n }, null, chart.container);\n }\n if (!loadingSpan) {\n chart.loadingSpan = loadingSpan = createElement('span', { className: 'highcharts-loading-inner' }, null, loadingDiv);\n addEvent(chart, 'redraw', setLoadingSize); // #1080\n }\n loadingDiv.className = 'highcharts-loading';\n // Update text\n AST.setElementHTML(loadingSpan, pick(str, options.lang.loading, ''));\n if (!chart.styledMode) {\n // Update visuals\n css(loadingDiv, extend(loadingOptions.style, {\n zIndex: 10\n }));\n css(loadingSpan, loadingOptions.labelStyle);\n // Show it\n if (!chart.loadingShown) {\n css(loadingDiv, {\n opacity: 0,\n display: ''\n });\n animate(loadingDiv, {\n opacity: loadingOptions.style.opacity || 0.5\n }, {\n duration: loadingOptions.showDuration || 0\n });\n }\n }\n chart.loadingShown = true;\n setLoadingSize();\n }\n /**\n * Hide the loading layer.\n *\n * @see Highcharts.Chart#showLoading\n *\n * @sample highcharts/members/chart-hideloading/\n * Show and hide loading from a button\n * @sample stock/members/chart-show-hide-loading/\n * Toggle loading in Highcharts Stock\n *\n * @function Highcharts.Chart#hideLoading\n */\n hideLoading() {\n const options = this.options, loadingDiv = this.loadingDiv;\n if (loadingDiv) {\n loadingDiv.className =\n 'highcharts-loading highcharts-loading-hidden';\n if (!this.styledMode) {\n animate(loadingDiv, {\n opacity: 0\n }, {\n duration: options.loading.hideDuration || 100,\n complete: function () {\n css(loadingDiv, { display: 'none' });\n }\n });\n }\n }\n this.loadingShown = false;\n }\n /**\n * A generic function to update any element of the chart. Elements can be\n * enabled and disabled, moved, re-styled, re-formatted etc.\n *\n * A special case is configuration objects that take arrays, for example\n * [xAxis](https://api.highcharts.com/highcharts/xAxis),\n * [yAxis](https://api.highcharts.com/highcharts/yAxis) or\n * [series](https://api.highcharts.com/highcharts/series). For these\n * collections, an `id` option is used to map the new option set to an\n * existing object. If an existing object of the same id is not found, the\n * corresponding item is updated. So for example, running `chart.update`\n * with a series item without an id, will cause the existing chart's series\n * with the same index in the series array to be updated. When the\n * `oneToOne` parameter is true, `chart.update` will also take care of\n * adding and removing items from the collection. Read more under the\n * parameter description below.\n *\n * Note that when changing series data, `chart.update` may mutate the passed\n * data options.\n *\n * See also the\n * [responsive option set](https://api.highcharts.com/highcharts/responsive).\n * Switching between `responsive.rules` basically runs `chart.update` under\n * the hood.\n *\n * @sample highcharts/members/chart-update/\n * Update chart geometry\n *\n * @function Highcharts.Chart#update\n *\n * @param {Highcharts.Options} options\n * A configuration object for the new chart options.\n *\n * @param {boolean} [redraw=true]\n * Whether to redraw the chart.\n *\n * @param {boolean} [oneToOne=false]\n * When `true`, the `series`, `xAxis`, `yAxis` and `annotations`\n * collections will be updated one to one, and items will be either\n * added or removed to match the new updated options. For example,\n * if the chart has two series and we call `chart.update` with a\n * configuration containing three series, one will be added. If we\n * call `chart.update` with one series, one will be removed. Setting\n * an empty `series` array will remove all series, but leaving out\n * the`series` property will leave all series untouched. If the\n * series have id's, the new series options will be matched by id,\n * and the remaining ones removed.\n *\n * @param {boolean|Partial} [animation]\n * Whether to apply animation, and optionally animation\n * configuration. When `undefined`, it applies the animation that is\n * set in the `chart.animation` option.\n *\n * @emits Highcharts.Chart#event:update\n * @emits Highcharts.Chart#event:afterUpdate\n */\n update(options, redraw, oneToOne, animation) {\n const chart = this, adders = {\n credits: 'addCredits',\n title: 'setTitle',\n subtitle: 'setSubtitle',\n caption: 'setCaption'\n }, isResponsiveOptions = options.isResponsiveOptions, itemsForRemoval = [];\n let updateAllAxes, updateAllSeries, runSetSize;\n fireEvent(chart, 'update', { options: options });\n // If there are responsive rules in action, undo the responsive rules\n // before we apply the updated options and replay the responsive rules\n // on top from the chart.redraw function (#9617).\n if (!isResponsiveOptions) {\n chart.setResponsive(false, true);\n }\n options = diffObjects(options, chart.options);\n chart.userOptions = merge(chart.userOptions, options);\n // If the top-level chart option is present, some special updates are\n // required\n const optionsChart = options.chart;\n if (optionsChart) {\n merge(true, chart.options.chart, optionsChart);\n // Add support for deprecated zooming options like zoomType, #17861\n this.setZoomOptions();\n // Setter function\n if ('className' in optionsChart) {\n chart.setClassName(optionsChart.className);\n }\n if ('inverted' in optionsChart ||\n 'polar' in optionsChart ||\n 'type' in optionsChart) {\n // Parse options.chart.inverted and options.chart.polar together\n // with the available series.\n chart.propFromSeries();\n updateAllAxes = true;\n }\n if ('alignTicks' in optionsChart) { // #6452\n updateAllAxes = true;\n }\n if ('events' in optionsChart) {\n // Chart event handlers\n registerEventOptions(this, optionsChart);\n }\n objectEach(optionsChart, function (val, key) {\n if (chart.propsRequireUpdateSeries.indexOf('chart.' + key) !==\n -1) {\n updateAllSeries = true;\n }\n // Only dirty box\n if (chart.propsRequireDirtyBox.indexOf(key) !== -1) {\n chart.isDirtyBox = true;\n }\n // Chart setSize\n if (chart.propsRequireReflow.indexOf(key) !== -1) {\n chart.isDirtyBox = true;\n if (!isResponsiveOptions) {\n runSetSize = true;\n }\n }\n });\n if (!chart.styledMode && optionsChart.style) {\n chart.renderer.setStyle(chart.options.chart.style || {});\n }\n }\n // Moved up, because tooltip needs updated plotOptions (#6218)\n if (!chart.styledMode && options.colors) {\n this.options.colors = options.colors;\n }\n if (options.time) {\n // Maintaining legacy global time. If the chart is instantiated\n // first with global time, then updated with time options, we need\n // to create a new Time instance to avoid mutating the global time\n // (#10536).\n if (this.time === defaultTime) {\n this.time = new Time(options.time);\n }\n // If we're updating, the time class is different from other chart\n // classes (chart.legend, chart.tooltip etc) in that it doesn't know\n // about the chart. The other chart[something].update functions also\n // set the chart.options[something]. For the time class however we\n // need to update the chart options separately. #14230.\n merge(true, chart.options.time, options.time);\n }\n // Some option structures correspond one-to-one to chart objects that\n // have update methods, for example\n // options.credits => chart.credits\n // options.legend => chart.legend\n // options.title => chart.title\n // options.tooltip => chart.tooltip\n // options.subtitle => chart.subtitle\n // options.mapNavigation => chart.mapNavigation\n // options.navigator => chart.navigator\n // options.scrollbar => chart.scrollbar\n objectEach(options, function (val, key) {\n if (chart[key] &&\n typeof chart[key].update === 'function') {\n chart[key].update(val, false);\n // If a one-to-one object does not exist, look for an adder function\n }\n else if (typeof chart[adders[key]] === 'function') {\n chart[adders[key]](val);\n // Else, just merge the options. For nodes like loading, noData,\n // plotOptions\n }\n else if (key !== 'colors' &&\n chart.collectionsWithUpdate.indexOf(key) === -1) {\n merge(true, chart.options[key], options[key]);\n }\n if (key !== 'chart' &&\n chart.propsRequireUpdateSeries.indexOf(key) !== -1) {\n updateAllSeries = true;\n }\n });\n // Setters for collections. For axes and series, each item is referred\n // by an id. If the id is not found, it defaults to the corresponding\n // item in the collection, so setting one series without an id, will\n // update the first series in the chart. Setting two series without\n // an id will update the first and the second respectively (#6019)\n // chart.update and responsive.\n this.collectionsWithUpdate.forEach(function (coll) {\n if (options[coll]) {\n splat(options[coll]).forEach(function (newOptions, i) {\n const hasId = defined(newOptions.id);\n let item;\n // Match by id\n if (hasId) {\n item = chart.get(newOptions.id);\n }\n // No match by id found, match by index instead\n if (!item && chart[coll]) {\n item = chart[coll][pick(newOptions.index, i)];\n // Check if we grabbed an item with an existing but\n // different id (#13541). Check that the item in this\n // position is not internal (navigator).\n if (item && ((hasId && defined(item.options.id)) ||\n item.options.isInternal)) {\n item = void 0;\n }\n }\n if (item && item.coll === coll) {\n item.update(newOptions, false);\n if (oneToOne) {\n item.touched = true;\n }\n }\n // If oneToOne and no matching item is found, add one\n if (!item && oneToOne && chart.collectionsWithInit[coll]) {\n chart.collectionsWithInit[coll][0].apply(chart, \n // [newOptions, ...extraArguments, redraw=false]\n [\n newOptions\n ].concat(\n // Not all initializers require extra args\n chart.collectionsWithInit[coll][1] || []).concat([\n false\n ])).touched = true;\n }\n });\n // Add items for removal\n if (oneToOne) {\n chart[coll].forEach(function (item) {\n if (!item.touched && !item.options.isInternal) {\n itemsForRemoval.push(item);\n }\n else {\n delete item.touched;\n }\n });\n }\n }\n });\n itemsForRemoval.forEach(function (item) {\n if (item.chart && item.remove) { // #9097, avoid removing twice\n item.remove(false);\n }\n });\n if (updateAllAxes) {\n chart.axes.forEach(function (axis) {\n axis.update({}, false);\n });\n }\n // Certain options require the whole series structure to be thrown away\n // and rebuilt\n if (updateAllSeries) {\n chart.getSeriesOrderByLinks().forEach(function (series) {\n // Avoid removed navigator series\n if (series.chart) {\n series.update({}, false);\n }\n }, this);\n }\n // Update size. Redraw is forced.\n const newWidth = optionsChart && optionsChart.width;\n const newHeight = optionsChart && (isString(optionsChart.height) ?\n relativeLength(optionsChart.height, newWidth || chart.chartWidth) :\n optionsChart.height);\n if (\n // In this case, run chart.setSize with newWidth and newHeight which\n // are undefined, only for reflowing chart elements because margin\n // or spacing has been set (#8190)\n runSetSize ||\n // In this case, the size is actually set\n (isNumber(newWidth) && newWidth !== chart.chartWidth) ||\n (isNumber(newHeight) && newHeight !== chart.chartHeight)) {\n chart.setSize(newWidth, newHeight, animation);\n }\n else if (pick(redraw, true)) {\n chart.redraw(animation);\n }\n fireEvent(chart, 'afterUpdate', {\n options: options,\n redraw: redraw,\n animation: animation\n });\n }\n /**\n * Shortcut to set the subtitle options. This can also be done from {@link\n * Chart#update} or {@link Chart#setTitle}.\n *\n * @function Highcharts.Chart#setSubtitle\n *\n * @param {Highcharts.SubtitleOptions} options\n * New subtitle options. The subtitle text itself is set by the\n * `options.text` property.\n */\n setSubtitle(options, redraw) {\n this.applyDescription('subtitle', options);\n this.layOutTitles(redraw);\n }\n /**\n * Set the caption options. This can also be done from {@link\n * Chart#update}.\n *\n * @function Highcharts.Chart#setCaption\n *\n * @param {Highcharts.CaptionOptions} options\n * New caption options. The caption text itself is set by the\n * `options.text` property.\n */\n setCaption(options, redraw) {\n this.applyDescription('caption', options);\n this.layOutTitles(redraw);\n }\n /**\n * Display the zoom button, so users can reset zoom to the default view\n * settings.\n *\n * @function Highcharts.Chart#showResetZoom\n *\n * @emits Highcharts.Chart#event:afterShowResetZoom\n * @emits Highcharts.Chart#event:beforeShowResetZoom\n */\n showResetZoom() {\n const chart = this, lang = defaultOptions.lang, btnOptions = chart.zooming.resetButton, theme = btnOptions.theme, alignTo = (btnOptions.relativeTo === 'chart' ||\n btnOptions.relativeTo === 'spacingBox' ?\n null :\n 'plotBox');\n /**\n * @private\n */\n function zoomOut() {\n chart.zoomOut();\n }\n fireEvent(this, 'beforeShowResetZoom', null, function () {\n chart.resetZoomButton = chart.renderer\n .button(lang.resetZoom, null, null, zoomOut, theme)\n .attr({\n align: btnOptions.position.align,\n title: lang.resetZoomTitle\n })\n .addClass('highcharts-reset-zoom')\n .add()\n .align(btnOptions.position, false, alignTo);\n });\n fireEvent(this, 'afterShowResetZoom');\n }\n /**\n * Zoom the chart out after a user has zoomed in. See also\n * [Axis.setExtremes](/class-reference/Highcharts.Axis#setExtremes).\n *\n * @function Highcharts.Chart#zoomOut\n *\n * @emits Highcharts.Chart#event:selection\n */\n zoomOut() {\n fireEvent(this, 'selection', { resetSelection: true }, () => this.transform({ reset: true, trigger: 'zoom' }));\n }\n /**\n * Pan the chart by dragging the mouse across the pane. This function is\n * called on mouse move, and the distance to pan is computed from chartX\n * compared to the first chartX position in the dragging operation.\n *\n * @private\n * @function Highcharts.Chart#pan\n * @param {Highcharts.PointerEventObject} event\n * @param {string} panning\n */\n pan(event, panning) {\n const chart = this, panningOptions = (typeof panning === 'object' ?\n panning :\n {\n enabled: panning,\n type: 'x'\n }), type = panningOptions.type, axes = type && chart[{\n x: 'xAxis',\n xy: 'axes',\n y: 'yAxis'\n }[type]]\n .filter((axis) => axis.options.panningEnabled && !axis.options.isInternal), chartOptions = chart.options.chart;\n if (chartOptions?.panning) {\n chartOptions.panning = panningOptions;\n }\n fireEvent(this, 'pan', { originalEvent: event }, () => {\n chart.transform({\n axes,\n event,\n to: {\n x: event.chartX - (chart.mouseDownX || 0),\n y: event.chartY - (chart.mouseDownY || 0)\n },\n trigger: 'pan'\n });\n css(chart.container, { cursor: 'move' });\n });\n }\n /**\n * Pan and scale the chart. Used internally by mouse-pan, touch-pan,\n * touch-zoom, and mousewheel zoom.\n *\n * The main positioning logic is created around two imaginary boxes. What is\n * currently within the `from` rectangle, should be transformed to fill up\n * the `to` rectangle.\n * - In a mouse zoom, the `from` rectangle is the selection, while the `to`\n * rectangle is the full plot area.\n * - In a touch zoom, the `from` rectangle is made up of the last two-finger\n * touch, while the `to`` rectangle is the current touch.\n * - In a mousewheel zoom, the `to` rectangle is a 10x10 px square,\n * while the `to` rectangle reflects the scale around that.\n *\n * @private\n * @function Highcharts.Chart#transform\n */\n transform(params) {\n const { axes = this.axes, event, from = {}, reset, selection, to = {}, trigger } = params, { inverted, resetZoomButton } = this;\n let hasZoomed = false, displayButton;\n // Remove active points for shared tooltip\n this.hoverPoints?.forEach((point) => point.setState());\n for (const axis of axes) {\n const { horiz, len, minPointOffset = 0, options, reversed } = axis, wh = horiz ? 'width' : 'height', xy = horiz ? 'x' : 'y', toLength = to[wh] || axis.len, fromLength = from[wh] || axis.len, \n // If fingers pinched very close on this axis, treat as pan\n scale = Math.abs(toLength) < 10 ?\n 1 :\n toLength / fromLength, fromCenter = (from[xy] || 0) + fromLength / 2 - axis.pos, toCenter = (to[xy] ?? axis.pos) +\n toLength / 2 - axis.pos, move = fromCenter - toCenter / scale, pointRangeDirection = (reversed && !inverted) ||\n (!reversed && inverted) ?\n -1 :\n 1, minPx = move;\n // Zooming in multiple panes, zoom only in the pane that receives\n // the input\n if (!reset && (fromCenter < 0 || fromCenter > axis.len)) {\n continue;\n }\n let newMin = axis.toValue(minPx, true) +\n minPointOffset * pointRangeDirection, newMax = axis.toValue(minPx + len / scale, true) -\n ((minPointOffset * pointRangeDirection) ||\n // Polar zoom tests failed when this was not commented:\n // (axis.isXAxis && axis.pointRangePadding) ||\n 0), allExtremes = axis.allExtremes;\n if (newMin > newMax) {\n [newMin, newMax] = [newMax, newMin];\n }\n // General calculations of the full data extremes. It is calculated\n // on the first call to transform, then reused for subsequent\n // touch/pan calls. (#11315).\n if (scale === 1 &&\n !reset &&\n axis.coll === 'yAxis' &&\n !allExtremes) {\n for (const series of axis.series) {\n const seriesExtremes = series.getExtremes(series.getProcessedData(true).yData, true);\n allExtremes ?? (allExtremes = {\n dataMin: Number.MAX_VALUE,\n dataMax: -Number.MAX_VALUE\n });\n if (isNumber(seriesExtremes.dataMin) &&\n isNumber(seriesExtremes.dataMax)) {\n allExtremes.dataMin = Math.min(seriesExtremes.dataMin, allExtremes.dataMin);\n allExtremes.dataMax = Math.max(seriesExtremes.dataMax, allExtremes.dataMax);\n }\n }\n axis.allExtremes = allExtremes;\n }\n const { dataMin, dataMax, min, max } = extend(axis.getExtremes(), allExtremes || {}), \n // For boosted chart where data extremes are skipped\n safeDataMin = dataMin ?? options.min, safeDataMax = dataMax ?? options.max, range = newMax - newMin, padRange = axis.categories ? 0 : Math.min(range, safeDataMax - safeDataMin), paddedMin = safeDataMin - padRange * (defined(options.min) ? 0 : options.minPadding), paddedMax = safeDataMax + padRange * (defined(options.max) ? 0 : options.maxPadding), \n // We're allowed to zoom outside the data extremes if we're\n // dealing with a bubble chart, if we're panning, or if we're\n // pinching or mousewheeling in.\n allowZoomOutside = axis.allowZoomOutside ||\n scale === 1 ||\n (trigger !== 'zoom' && scale > 1), \n // Calculate the floor and the ceiling\n floor = Math.min(options.min ?? paddedMin, paddedMin, allowZoomOutside ? min : paddedMin), ceiling = Math.max(options.max ?? paddedMax, paddedMax, allowZoomOutside ? max : paddedMax);\n // It is not necessary to calculate extremes on ordinal axis,\n // because they are already calculated, so we don't want to override\n // them.\n if (!axis.isOrdinal || scale !== 1 || reset) {\n // If the new range spills over, either to the min or max,\n // adjust it.\n if (newMin < floor) {\n newMin = floor;\n if (scale >= 1) {\n newMax = newMin + range;\n }\n }\n if (newMax > ceiling) {\n newMax = ceiling;\n if (scale >= 1) {\n newMin = newMax - range;\n }\n }\n // Set new extremes if they are actually new\n if (reset || (axis.series.length &&\n (newMin !== min || newMax !== max) &&\n newMin >= floor &&\n newMax <= ceiling)) {\n if (selection) {\n selection[axis.coll].push({\n axis,\n min: newMin,\n max: newMax\n });\n }\n else {\n // Temporarily flag the axis as `isPanning` in order to\n // disallow certain axis padding options that would make\n // panning/zooming hard. Reset and redraw after the\n // operation has finished.\n axis.isPanning = trigger !== 'zoom';\n axis.setExtremes(reset ? void 0 : newMin, reset ? void 0 : newMax, false, false, { move, trigger, scale });\n if (!reset &&\n (newMin > floor || newMax < ceiling) &&\n trigger !== 'mousewheel') {\n displayButton = true;\n }\n }\n hasZoomed = true;\n }\n if (event) {\n this[horiz ? 'mouseDownX' : 'mouseDownY'] =\n event[horiz ? 'chartX' : 'chartY'];\n }\n }\n }\n if (hasZoomed) {\n if (selection) {\n fireEvent(this, 'selection', selection, \n // Run transform again, this time without the selection data\n // so that the transform is applied.\n () => {\n delete params.selection;\n params.trigger = 'zoom';\n this.transform(params);\n });\n }\n else {\n // Show or hide the Reset zoom button\n if (displayButton && !resetZoomButton) {\n this.showResetZoom();\n }\n else if (!displayButton && resetZoomButton) {\n this.resetZoomButton = resetZoomButton.destroy();\n }\n this.redraw(trigger === 'zoom' &&\n (this.options.chart.animation ?? this.pointCount < 100));\n }\n }\n return hasZoomed;\n }\n}\nextend(Chart.prototype, {\n // Hook for adding callbacks in modules\n callbacks: [],\n /**\n * These collections (arrays) implement `Chart.addSomething` method used in\n * chart.update() to create new object in the collection. Equivalent for\n * deleting is resolved by simple `Something.remove()`.\n *\n * Note: We need to define these references after initializers are bound to\n * chart's prototype.\n *\n * @private\n */\n collectionsWithInit: {\n // collectionName: [ initializingMethod, [extraArguments] ]\n xAxis: [Chart.prototype.addAxis, [true]],\n yAxis: [Chart.prototype.addAxis, [false]],\n series: [Chart.prototype.addSeries]\n },\n /**\n * These collections (arrays) implement update() methods with support for\n * one-to-one option.\n * @private\n */\n collectionsWithUpdate: [\n 'xAxis',\n 'yAxis',\n 'series'\n ],\n /**\n * These properties cause isDirtyBox to be set to true when updating. Can be\n * extended from plugins.\n * @private\n */\n propsRequireDirtyBox: [\n 'backgroundColor',\n 'borderColor',\n 'borderWidth',\n 'borderRadius',\n 'plotBackgroundColor',\n 'plotBackgroundImage',\n 'plotBorderColor',\n 'plotBorderWidth',\n 'plotShadow',\n 'shadow'\n ],\n /**\n * These properties require a full reflow of chart elements, best\n * implemented through running `Chart.setSize` internally (#8190).\n * @private\n */\n propsRequireReflow: [\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'spacing',\n 'spacingTop',\n 'spacingRight',\n 'spacingBottom',\n 'spacingLeft'\n ],\n /**\n * These properties cause all series to be updated when updating. Can be\n * extended from plugins.\n * @private\n */\n propsRequireUpdateSeries: [\n 'chart.inverted',\n 'chart.polar',\n 'chart.ignoreHiddenSeries',\n 'chart.type',\n 'colors',\n 'plotOptions',\n 'time',\n 'tooltip'\n ]\n});\n/* *\n *\n * Default Export\n *\n * */\nexport default Chart;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Callback for chart constructors.\n *\n * @callback Highcharts.ChartCallbackFunction\n *\n * @param {Highcharts.Chart} chart\n * Created chart.\n */\n/**\n * Format a number and return a string based on input settings.\n *\n * @callback Highcharts.NumberFormatterCallbackFunction\n *\n * @param {number} number\n * The input number to format.\n *\n * @param {number} decimals\n * The amount of decimals. A value of -1 preserves the amount in the\n * input number.\n *\n * @param {string} [decimalPoint]\n * The decimal point, defaults to the one given in the lang options, or\n * a dot.\n *\n * @param {string} [thousandsSep]\n * The thousands separator, defaults to the one given in the lang\n * options, or a space character.\n *\n * @return {string} The formatted number.\n */\n/**\n * The chart title. The title has an `update` method that allows modifying the\n * options directly or indirectly via `chart.update`.\n *\n * @interface Highcharts.TitleObject\n * @extends Highcharts.SVGElement\n */ /**\n* Modify options for the title.\n*\n* @function Highcharts.TitleObject#update\n*\n* @param {Highcharts.TitleOptions} titleOptions\n* Options to modify.\n*\n* @param {boolean} [redraw=true]\n* Whether to redraw the chart after the title is altered. If doing more\n* operations on the chart, it is a good idea to set redraw to false and\n* call {@link Chart#redraw} after.\n*/\n/**\n * The chart subtitle. The subtitle has an `update` method that\n * allows modifying the options directly or indirectly via\n * `chart.update`.\n *\n * @interface Highcharts.SubtitleObject\n * @extends Highcharts.SVGElement\n */ /**\n* Modify options for the subtitle.\n*\n* @function Highcharts.SubtitleObject#update\n*\n* @param {Highcharts.SubtitleOptions} subtitleOptions\n* Options to modify.\n*\n* @param {boolean} [redraw=true]\n* Whether to redraw the chart after the subtitle is altered. If doing\n* more operations on the chart, it is a good idea to set redraw to false\n* and call {@link Chart#redraw} after.\n*/\n/**\n * The chart caption. The caption has an `update` method that\n * allows modifying the options directly or indirectly via\n * `chart.update`.\n *\n * @interface Highcharts.CaptionObject\n * @extends Highcharts.SVGElement\n */ /**\n* Modify options for the caption.\n*\n* @function Highcharts.CaptionObject#update\n*\n* @param {Highcharts.CaptionOptions} captionOptions\n* Options to modify.\n*\n* @param {boolean} [redraw=true]\n* Whether to redraw the chart after the caption is altered. If doing\n* more operations on the chart, it is a good idea to set redraw to false\n* and call {@link Chart#redraw} after.\n*/\n/**\n * @interface Highcharts.ChartIsInsideOptionsObject\n */ /**\n* @name Highcharts.ChartIsInsideOptionsObject#axis\n* @type {Highcharts.Axis|undefined}\n*/ /**\n* @name Highcharts.ChartIsInsideOptionsObject#ignoreX\n* @type {boolean|undefined}\n*/ /**\n* @name Highcharts.ChartIsInsideOptionsObject#ignoreY\n* @type {boolean|undefined}\n*/ /**\n* @name Highcharts.ChartIsInsideOptionsObject#inverted\n* @type {boolean|undefined}\n*/ /**\n* @name Highcharts.ChartIsInsideOptionsObject#paneCoordinates\n* @type {boolean|undefined}\n*/ /**\n* @name Highcharts.ChartIsInsideOptionsObject#series\n* @type {Highcharts.Series|undefined}\n*/ /**\n* @name Highcharts.ChartIsInsideOptionsObject#visiblePlotOnly\n* @type {boolean|undefined}\n*/\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * Highcharts feature to make the Y axis stay fixed when scrolling the chart\n * horizontally on mobile devices. Supports left and right side axes.\n */\n'use strict';\nimport A from '../Core/Animation/AnimationUtilities.js';\nconst { stop } = A;\nimport H from '../Core/Globals.js';\nconst { composed } = H;\nimport RendererRegistry from '../Core/Renderer/RendererRegistry.js';\nimport U from '../Core/Utilities.js';\nconst { addEvent, createElement, css, defined, merge, pushUnique } = U;\n/* *\n *\n * Functions\n *\n * */\n/** @private */\nfunction onChartRender() {\n let scrollablePlotArea = this.scrollablePlotArea;\n if ((this.scrollablePixelsX || this.scrollablePixelsY) &&\n !scrollablePlotArea) {\n this.scrollablePlotArea = scrollablePlotArea = new ScrollablePlotArea(this);\n }\n scrollablePlotArea?.applyFixed();\n}\n/** @private */\nfunction markDirty() {\n if (this.chart.scrollablePlotArea) {\n this.chart.scrollablePlotArea.isDirty = true;\n }\n}\nclass ScrollablePlotArea {\n static compose(AxisClass, ChartClass, SeriesClass) {\n if (pushUnique(composed, this.compose)) {\n addEvent(AxisClass, 'afterInit', markDirty);\n addEvent(ChartClass, 'afterSetChartSize', (e) => this.afterSetSize(e.target, e));\n addEvent(ChartClass, 'render', onChartRender);\n addEvent(SeriesClass, 'show', markDirty);\n }\n }\n static afterSetSize(chart, e) {\n const { minWidth, minHeight } = chart.options.chart.scrollablePlotArea || {}, { clipBox, plotBox, inverted, renderer } = chart;\n let scrollablePixelsX, scrollablePixelsY, recalculateHoriz;\n if (!renderer.forExport) {\n // The amount of pixels to scroll, the difference between chart\n // width and scrollable width\n if (minWidth) {\n chart.scrollablePixelsX = scrollablePixelsX = Math.max(0, minWidth - chart.chartWidth);\n if (scrollablePixelsX) {\n chart.scrollablePlotBox = merge(chart.plotBox);\n plotBox.width = chart.plotWidth += scrollablePixelsX;\n clipBox[inverted ? 'height' : 'width'] += scrollablePixelsX;\n recalculateHoriz = true;\n }\n // Currently we can only do either X or Y\n }\n else if (minHeight) {\n chart.scrollablePixelsY = scrollablePixelsY = Math.max(0, minHeight - chart.chartHeight);\n if (defined(scrollablePixelsY)) {\n chart.scrollablePlotBox = merge(chart.plotBox);\n plotBox.height = chart.plotHeight += scrollablePixelsY;\n clipBox[inverted ? 'width' : 'height'] += scrollablePixelsY;\n recalculateHoriz = false;\n }\n }\n if (defined(recalculateHoriz) && !e.skipAxes) {\n for (const axis of chart.axes) {\n // Apply the corrected plot size to the axes of the other\n // orientation than the scrolling direction\n if (axis.horiz === recalculateHoriz) {\n axis.setAxisSize();\n axis.setAxisTranslation();\n }\n }\n }\n }\n }\n constructor(chart) {\n const chartOptions = chart.options.chart, Renderer = RendererRegistry.getRendererType(), scrollableOptions = chartOptions.scrollablePlotArea || {}, moveFixedElements = this.moveFixedElements.bind(this), styles = {\n WebkitOverflowScrolling: 'touch',\n overflowX: 'hidden',\n overflowY: 'hidden'\n };\n if (chart.scrollablePixelsX) {\n styles.overflowX = 'auto';\n }\n if (chart.scrollablePixelsY) {\n styles.overflowY = 'auto';\n }\n this.chart = chart;\n // Insert a container with relative position that scrolling and fixed\n // container renders to (#10555)\n const parentDiv = this.parentDiv = createElement('div', {\n className: 'highcharts-scrolling-parent'\n }, {\n position: 'relative'\n }, chart.renderTo), \n // Add the necessary divs to provide scrolling\n scrollingContainer = this.scrollingContainer = createElement('div', {\n 'className': 'highcharts-scrolling'\n }, styles, parentDiv), innerContainer = this.innerContainer = createElement('div', {\n 'className': 'highcharts-inner-container'\n }, void 0, scrollingContainer), fixedDiv = this.fixedDiv = createElement('div', {\n className: 'highcharts-fixed'\n }, {\n position: 'absolute',\n overflow: 'hidden',\n pointerEvents: 'none',\n zIndex: (chartOptions.style?.zIndex || 0) + 2,\n top: 0\n }, void 0, true), fixedRenderer = this.fixedRenderer = new Renderer(fixedDiv, chart.chartWidth, chart.chartHeight, chartOptions.style);\n // Mask\n this.mask = fixedRenderer\n .path()\n .attr({\n fill: chartOptions.backgroundColor || '#fff',\n 'fill-opacity': scrollableOptions.opacity ?? 0.85,\n zIndex: -1\n })\n .addClass('highcharts-scrollable-mask')\n .add();\n scrollingContainer.parentNode.insertBefore(fixedDiv, scrollingContainer);\n css(chart.renderTo, { overflow: 'visible' });\n addEvent(chart, 'afterShowResetZoom', moveFixedElements);\n addEvent(chart, 'afterApplyDrilldown', moveFixedElements);\n addEvent(chart, 'afterLayOutTitles', moveFixedElements);\n // On scroll, reset the chart position because it applies to the\n // scrolled container\n let lastHoverPoint;\n addEvent(scrollingContainer, 'scroll', () => {\n const { pointer, hoverPoint } = chart;\n if (pointer) {\n delete pointer.chartPosition;\n if (hoverPoint) {\n lastHoverPoint = hoverPoint;\n }\n pointer.runPointActions(void 0, lastHoverPoint, true);\n }\n });\n // Now move the container inside\n innerContainer.appendChild(chart.container);\n }\n applyFixed() {\n const { chart, fixedRenderer, isDirty, scrollingContainer } = this, { axisOffset, chartWidth, chartHeight, container, plotHeight, plotLeft, plotTop, plotWidth, scrollablePixelsX = 0, scrollablePixelsY = 0 } = chart, chartOptions = chart.options.chart, scrollableOptions = chartOptions.scrollablePlotArea || {}, { scrollPositionX = 0, scrollPositionY = 0 } = scrollableOptions, scrollableWidth = chartWidth + scrollablePixelsX, scrollableHeight = chartHeight + scrollablePixelsY;\n // Set the size of the fixed renderer to the visible width\n fixedRenderer.setSize(chartWidth, chartHeight);\n if (isDirty ?? true) {\n this.isDirty = false;\n this.moveFixedElements();\n }\n // Increase the size of the scrollable renderer and background\n stop(chart.container);\n css(container, {\n width: `${scrollableWidth}px`,\n height: `${scrollableHeight}px`\n });\n chart.renderer.boxWrapper.attr({\n width: scrollableWidth,\n height: scrollableHeight,\n viewBox: [0, 0, scrollableWidth, scrollableHeight].join(' ')\n });\n chart.chartBackground?.attr({\n width: scrollableWidth,\n height: scrollableHeight\n });\n css(scrollingContainer, {\n width: `${chartWidth}px`,\n height: `${chartHeight}px`\n });\n // Set scroll position the first time (this.isDirty was undefined at\n // the top of this function)\n if (!defined(isDirty)) {\n scrollingContainer.scrollLeft = scrollablePixelsX * scrollPositionX;\n scrollingContainer.scrollTop = scrollablePixelsY * scrollPositionY;\n }\n // Mask behind the left and right side\n const maskTop = plotTop - axisOffset[0] - 1, maskLeft = plotLeft - axisOffset[3] - 1, maskBottom = plotTop + plotHeight + axisOffset[2] + 1, maskRight = plotLeft + plotWidth + axisOffset[1] + 1, maskPlotRight = plotLeft + plotWidth - scrollablePixelsX, maskPlotBottom = plotTop + plotHeight - scrollablePixelsY;\n let d = [['M', 0, 0]];\n if (scrollablePixelsX) {\n d = [\n // Left side\n ['M', 0, maskTop],\n ['L', plotLeft - 1, maskTop],\n ['L', plotLeft - 1, maskBottom],\n ['L', 0, maskBottom],\n ['Z'],\n // Right side\n ['M', maskPlotRight, maskTop],\n ['L', chartWidth, maskTop],\n ['L', chartWidth, maskBottom],\n ['L', maskPlotRight, maskBottom],\n ['Z']\n ];\n }\n else if (scrollablePixelsY) {\n d = [\n // Top side\n ['M', maskLeft, 0],\n ['L', maskLeft, plotTop - 1],\n ['L', maskRight, plotTop - 1],\n ['L', maskRight, 0],\n ['Z'],\n // Bottom side\n ['M', maskLeft, maskPlotBottom],\n ['L', maskLeft, chartHeight],\n ['L', maskRight, chartHeight],\n ['L', maskRight, maskPlotBottom],\n ['Z']\n ];\n }\n if (chart.redrawTrigger !== 'adjustHeight') {\n this.mask.attr({ d });\n }\n }\n /**\n * These elements are moved over to the fixed renderer and stay fixed when\n * the user scrolls the chart\n * @private\n */\n moveFixedElements() {\n const { container, inverted, scrollablePixelsX, scrollablePixelsY } = this.chart, fixedRenderer = this.fixedRenderer, fixedSelectors = [\n '.highcharts-breadcrumbs-group',\n '.highcharts-contextbutton',\n '.highcharts-caption',\n '.highcharts-credits',\n '.highcharts-legend',\n '.highcharts-legend-checkbox',\n '.highcharts-navigator-series',\n '.highcharts-navigator-xaxis',\n '.highcharts-navigator-yaxis',\n '.highcharts-navigator',\n '.highcharts-reset-zoom',\n '.highcharts-drillup-button',\n '.highcharts-scrollbar',\n '.highcharts-subtitle',\n '.highcharts-title'\n ];\n let axisClass;\n if (scrollablePixelsX && !inverted) {\n axisClass = '.highcharts-yaxis';\n }\n else if (scrollablePixelsX && inverted) {\n axisClass = '.highcharts-xaxis';\n }\n else if (scrollablePixelsY && !inverted) {\n axisClass = '.highcharts-xaxis';\n }\n else if (scrollablePixelsY && inverted) {\n axisClass = '.highcharts-yaxis';\n }\n if (axisClass) {\n fixedSelectors.push(`${axisClass}:not(.highcharts-radial-axis)`, `${axisClass}-labels:not(.highcharts-radial-axis-labels)`);\n }\n for (const className of fixedSelectors) {\n [].forEach.call(container.querySelectorAll(className), (elem) => {\n (elem.namespaceURI === fixedRenderer.SVG_NS ?\n fixedRenderer.box :\n fixedRenderer.box.parentNode).appendChild(elem);\n elem.style.pointerEvents = 'auto';\n });\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default ScrollablePlotArea;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Options for a scrollable plot area. This feature provides a minimum size for\n * the plot area of the chart. If the size gets smaller than this, typically\n * on mobile devices, a native browser scrollbar is presented. This scrollbar\n * provides smooth scrolling for the contents of the plot area, whereas the\n * title, legend and unaffected axes are fixed.\n *\n * Since v7.1.2, a scrollable plot area can be defined for either horizontal or\n * vertical scrolling, depending on whether the `minWidth` or `minHeight`\n * option is set.\n *\n * @sample highcharts/chart/scrollable-plotarea\n * Scrollable plot area\n * @sample highcharts/chart/scrollable-plotarea-vertical\n * Vertically scrollable plot area\n * @sample {gantt} gantt/chart/scrollable-plotarea-vertical\n * Gantt chart with vertically scrollable plot area\n *\n * @since 6.1.0\n * @product highcharts gantt\n * @apioption chart.scrollablePlotArea\n */\n/**\n * The minimum height for the plot area. If it gets smaller than this, the plot\n * area will become scrollable.\n *\n * @type {number}\n * @since 7.1.2\n * @apioption chart.scrollablePlotArea.minHeight\n */\n/**\n * The minimum width for the plot area. If it gets smaller than this, the plot\n * area will become scrollable.\n *\n * @type {number}\n * @since 6.1.0\n * @apioption chart.scrollablePlotArea.minWidth\n */\n/**\n * The initial scrolling position of the scrollable plot area. Ranges from 0 to\n * 1, where 0 aligns the plot area to the left and 1 aligns it to the right.\n * Typically we would use 1 if the chart has right aligned Y axes.\n *\n * @type {number}\n * @since 6.1.0\n * @apioption chart.scrollablePlotArea.scrollPositionX\n */\n/**\n * The initial scrolling position of the scrollable plot area. Ranges from 0 to\n * 1, where 0 aligns the plot area to the top and 1 aligns it to the bottom.\n *\n * @type {number}\n * @since 7.1.2\n * @apioption chart.scrollablePlotArea.scrollPositionY\n */\n/**\n * The opacity of mask applied on one of the sides of the plot\n * area.\n *\n * @sample {highcharts} highcharts/chart/scrollable-plotarea-opacity\n * Disabled opacity for the mask\n *\n * @type {number}\n * @default 0.85\n * @since 7.1.1\n * @apioption chart.scrollablePlotArea.opacity\n */\n(''); // Keep doclets above in transpiled file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport T from '../../Templating.js';\nconst { format } = T;\nimport SeriesRegistry from '../../Series/SeriesRegistry.js';\nconst { series: Series } = SeriesRegistry;\nimport U from '../../Utilities.js';\nconst { destroyObjectProperties, fireEvent, isNumber, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The class for stacks. Each stack, on a specific X value and either negative\n * or positive, has its own stack item.\n * @private\n */\nclass StackItem {\n /* *\n *\n * Constructor\n *\n * */\n constructor(axis, options, negativeValue, x, stackOption) {\n const inverted = axis.chart.inverted, reversed = axis.reversed;\n this.axis = axis;\n // The stack goes to the left either if the stack has negative value\n // or when axis is reversed. XOR operator.\n const isNegative = (this.isNegative = !!negativeValue !== !!reversed);\n // Save the options to be able to style the label\n this.options = options = options || {};\n // Save the x value to be able to position the label later\n this.x = x;\n // Initialize total value\n this.total = null;\n this.cumulative = null;\n // This will keep each points' extremes stored by series.index and point\n // index\n this.points = {};\n this.hasValidPoints = false;\n // Save the stack option on the series configuration object,\n // and whether to treat it as percent\n this.stack = stackOption;\n this.leftCliff = 0;\n this.rightCliff = 0;\n // The align options and text align varies on whether the stack is\n // negative and if the chart is inverted or not.\n // First test the user supplied value, then use the dynamic.\n this.alignOptions = {\n align: options.align ||\n (inverted ? (isNegative ? 'left' : 'right') : 'center'),\n verticalAlign: options.verticalAlign ||\n (inverted ? 'middle' : isNegative ? 'bottom' : 'top'),\n y: options.y,\n x: options.x\n };\n this.textAlign =\n options.textAlign ||\n (inverted ? (!isNegative ? 'left' : 'right') : 'center');\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n destroy() {\n destroyObjectProperties(this, this.axis);\n }\n /**\n * Renders the stack total label and adds it to the stack label group.\n * @private\n */\n render(group) {\n const chart = this.axis.chart, options = this.options, formatOption = options.format, \n // Format the text in the label.\n str = formatOption ?\n format(formatOption, this, chart) :\n options.formatter.call(this);\n // Change the text to reflect the new total and set visibility to hidden\n // in case the series is hidden\n if (this.label) {\n this.label.attr({ text: str, visibility: 'hidden' });\n }\n else {\n // Create new label\n this.label = chart.renderer.label(str, null, void 0, options.shape, void 0, void 0, options.useHTML, false, 'stack-labels');\n const attr = {\n r: options.borderRadius || 0,\n text: str,\n // set default padding to 5 as it is in datalabels #12308\n padding: pick(options.padding, 5),\n visibility: 'hidden' // hidden until setOffset is called\n };\n if (!chart.styledMode) {\n attr.fill = options.backgroundColor;\n attr.stroke = options.borderColor;\n attr['stroke-width'] = options.borderWidth;\n this.label.css(options.style || {});\n }\n this.label.attr(attr);\n if (!this.label.added) {\n this.label.add(group); // add to the labels-group\n }\n }\n // Rank it higher than data labels (#8742)\n this.label.labelrank = chart.plotSizeY;\n fireEvent(this, 'afterRender');\n }\n /**\n * Sets the offset that the stack has from the x value and repositions the\n * label.\n * @private\n */\n setOffset(xOffset, width, boxBottom, boxTop, defaultX, xAxis) {\n const { alignOptions, axis, label, options, textAlign } = this, chart = axis.chart, stackBox = this.getStackBox({\n xOffset,\n width,\n boxBottom,\n boxTop,\n defaultX,\n xAxis\n }), { verticalAlign } = alignOptions;\n if (label && stackBox) {\n const labelBox = label.getBBox(void 0, 0), padding = label.padding;\n let isJustify = pick(options.overflow, 'justify') === 'justify', visible;\n // Reset alignOptions property after justify #12337\n alignOptions.x = options.x || 0;\n alignOptions.y = options.y || 0;\n // Calculate the adjusted Stack position, to take into consideration\n // The size if the labelBox and vertical alignment as\n // well as the text alignment. It's need to be done to work with\n // default SVGLabel.align/justify methods.\n const { x, y } = this.adjustStackPosition({\n labelBox,\n verticalAlign,\n textAlign\n });\n stackBox.x -= x;\n stackBox.y -= y;\n // Align the label to the adjusted box.\n label.align(alignOptions, false, stackBox);\n // Check if label is inside the plotArea #12294\n visible = chart.isInsidePlot(label.alignAttr.x + alignOptions.x + x, label.alignAttr.y + alignOptions.y + y);\n if (!visible) {\n isJustify = false;\n }\n if (isJustify) {\n // Justify stackLabel into the alignBox\n Series.prototype.justifyDataLabel.call(axis, label, alignOptions, label.alignAttr, labelBox, stackBox);\n }\n // Add attr to avoid the default animation of justifyDataLabel.\n // Also add correct rotation with its rotation origin. #15129\n label.attr({\n x: label.alignAttr.x,\n y: label.alignAttr.y,\n rotation: options.rotation,\n rotationOriginX: labelBox.width * {\n left: 0,\n center: 0.5,\n right: 1\n }[options.textAlign || 'center'],\n rotationOriginY: labelBox.height / 2\n });\n // Check if the dataLabel should be visible.\n if (pick(!isJustify && options.crop, true)) {\n visible =\n isNumber(label.x) &&\n isNumber(label.y) &&\n chart.isInsidePlot(label.x - padding + (label.width || 0), label.y) &&\n chart.isInsidePlot(label.x + padding, label.y);\n }\n label[visible ? 'show' : 'hide']();\n }\n fireEvent(this, 'afterSetOffset', { xOffset, width });\n }\n /**\n * Adjust the stack BBox position, to take into consideration the alignment\n * of the dataLabel. This is necessary to make the stackDataLabel work with\n * core methods like `SVGLabel.adjust` and `Series.justifyDataLabel`.\n * @param AdjustStackPositionProps\n * @return {{x: number, y: number}} Adjusted BBox position of the stack.\n */\n adjustStackPosition({ labelBox, verticalAlign, textAlign }) {\n const factorMap = {\n bottom: 0,\n middle: 1,\n top: 2,\n right: 1,\n center: 0,\n left: -1\n }, verticalAlignFactor = factorMap[verticalAlign], textAlignFactor = factorMap[textAlign];\n return {\n x: labelBox.width / 2 + (labelBox.width / 2) * textAlignFactor,\n y: (labelBox.height / 2) * verticalAlignFactor\n };\n }\n /**\n * Get the bbox of the stack.\n * @private\n * @function Highcharts.StackItem#getStackBox\n * @return {BBoxObject} The x, y, height, width of the stack.\n */\n getStackBox(stackBoxProps) {\n const stackItem = this, axis = this.axis, chart = axis.chart, { boxTop, defaultX, xOffset, width, boxBottom } = stackBoxProps, totalStackValue = axis.stacking.usePercentage ?\n 100 :\n pick(boxTop, this.total, 0), y = axis.toPixels(totalStackValue), xAxis = stackBoxProps.xAxis || chart.xAxis[0], x = pick(defaultX, xAxis.translate(this.x)) + xOffset, yZero = axis.toPixels(boxBottom ||\n (isNumber(axis.min) &&\n axis.logarithmic &&\n axis.logarithmic.lin2log(axis.min)) ||\n 0), height = Math.abs(y - yZero), inverted = chart.inverted, neg = stackItem.isNegative;\n return inverted ?\n {\n x: (neg ? y : y - height) - chart.plotLeft,\n y: xAxis.height - x - width,\n width: height,\n height: width\n } : {\n x: x + xAxis.transB - chart.plotLeft,\n y: (neg ? y - height : y) - chart.plotTop,\n width: width,\n height: height\n };\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default StackItem;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Stack of data points\n *\n * @product highcharts\n *\n * @interface Highcharts.StackItemObject\n */ /**\n* Alignment settings\n* @name Highcharts.StackItemObject#alignOptions\n* @type {Highcharts.AlignObject}\n*/ /**\n* Related axis\n* @name Highcharts.StackItemObject#axis\n* @type {Highcharts.Axis}\n*/ /**\n* Cumulative value of the stacked data points\n* @name Highcharts.StackItemObject#cumulative\n* @type {number}\n*/ /**\n* True if on the negative side\n* @name Highcharts.StackItemObject#isNegative\n* @type {boolean}\n*/ /**\n* Related SVG element\n* @name Highcharts.StackItemObject#label\n* @type {Highcharts.SVGElement}\n*/ /**\n* Related stack options\n* @name Highcharts.StackItemObject#options\n* @type {Highcharts.YAxisStackLabelsOptions}\n*/ /**\n* Total value of the stacked data points\n* @name Highcharts.StackItemObject#total\n* @type {number}\n*/ /**\n* Shared x value of the stack\n* @name Highcharts.StackItemObject#x\n* @type {number}\n*/\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../../Animation/AnimationUtilities.js';\nconst { getDeferredAnimation } = A;\nimport Axis from '../Axis.js';\nimport SeriesRegistry from '../../Series/SeriesRegistry.js';\nconst { series: { prototype: seriesProto } } = SeriesRegistry;\nimport StackItem from './StackItem.js';\nimport U from '../../Utilities.js';\nconst { addEvent, correctFloat, defined, destroyObjectProperties, fireEvent, isArray, isNumber, objectEach, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Generate stacks for each series and calculate stacks total values\n *\n * @private\n * @function Highcharts.Chart#getStacks\n */\nfunction chartGetStacks() {\n const chart = this, inverted = chart.inverted;\n // Reset stacks for each axis\n chart.axes.forEach((axis) => {\n if (axis.stacking && axis.stacking.stacks && axis.hasVisibleSeries) {\n axis.stacking.oldStacks = axis.stacking.stacks;\n }\n });\n chart.series.forEach((series) => {\n const xAxisOptions = series.xAxis && series.xAxis.options || {};\n if (series.options.stacking && series.reserveSpace()) {\n series.stackKey = [\n series.type,\n pick(series.options.stack, ''),\n inverted ? xAxisOptions.top : xAxisOptions.left,\n inverted ? xAxisOptions.height : xAxisOptions.width\n ].join(',');\n }\n });\n}\n/**\n * @private\n */\nfunction onAxisDestroy() {\n const stacking = this.stacking;\n if (stacking) {\n const stacks = stacking.stacks;\n // Destroy each stack total\n objectEach(stacks, (stack, stackKey) => {\n destroyObjectProperties(stack);\n delete stacks[stackKey];\n });\n stacking.stackTotalGroup?.destroy();\n }\n}\n/**\n * @private\n */\nfunction onAxisInit() {\n if (!this.stacking) {\n this.stacking = new AxisAdditions(this);\n }\n}\n/**\n * Get stack indicator, according to it's x-value, to determine points with the\n * same x-value\n *\n * @private\n * @function Highcharts.Series#getStackIndicator\n */\nfunction seriesGetStackIndicator(stackIndicator, x, index, key) {\n // Update stack indicator, when:\n // first point in a stack || x changed || stack type (negative vs positive)\n // changed:\n if (!defined(stackIndicator) ||\n stackIndicator.x !== x ||\n (key && stackIndicator.stackKey !== key)) {\n stackIndicator = {\n x: x,\n index: 0,\n key,\n stackKey: key\n };\n }\n else {\n stackIndicator.index++;\n }\n stackIndicator.key = [index, x, stackIndicator.index].join(',');\n return stackIndicator;\n}\n/**\n * Iterate over all stacks and compute the absolute values to percent\n *\n * @private\n * @function Highcharts.Series#modifyStacks\n */\nfunction seriesModifyStacks() {\n const series = this, yAxis = series.yAxis, stackKey = series.stackKey || '', stacks = yAxis.stacking.stacks, processedXData = series.processedXData, stacking = series.options.stacking, stacker = series[stacking + 'Stacker'];\n let stackIndicator;\n if (stacker) { // Modifier function exists (Series.percentStacker etc.)\n [stackKey, '-' + stackKey].forEach((key) => {\n let i = processedXData.length, x, stackItem, pointExtremes;\n while (i--) {\n x = processedXData[i];\n stackIndicator = series.getStackIndicator(stackIndicator, x, series.index, key);\n stackItem = stacks[key]?.[x];\n pointExtremes = stackItem?.points[stackIndicator.key || ''];\n if (pointExtremes) {\n stacker.call(series, pointExtremes, stackItem, i);\n }\n }\n });\n }\n}\n/**\n * Modifier function for percent stacks. Blows up the stack to 100%.\n *\n * @private\n * @function Highcharts.Series#percentStacker\n */\nfunction seriesPercentStacker(pointExtremes, stack, i) {\n const totalFactor = stack.total ? 100 / stack.total : 0;\n // Y bottom value\n pointExtremes[0] = correctFloat(pointExtremes[0] * totalFactor);\n // Y value\n pointExtremes[1] = correctFloat(pointExtremes[1] * totalFactor);\n this.stackedYData[i] = pointExtremes[1];\n}\n/**\n * Set grouped points in a stack-like object. When `centerInCategory` is true,\n * and `stacking` is not enabled, we need a pseudo (horizontal) stack in order\n * to handle grouping of points within the same category.\n *\n * @private\n * @function Highcharts.Series#setGroupedPoints\n * @return {void}\n */\nfunction seriesSetGroupedPoints(axis) {\n // Only series types supporting centerInCategory need to do this. That also\n // applies to resetting (#20221).\n if (this.is('column') || this.is('columnrange')) {\n if (this.options.centerInCategory &&\n // With stacking enabled, we already have stacks that we can compute\n // from\n !this.options.stacking &&\n // With only one series, we don't need to consider centerInCategory\n this.chart.series.length > 1) {\n seriesProto.setStackedPoints.call(this, axis, 'group');\n // After updating, if we now have proper stacks, we must delete the\n // group pseudo stacks (#14980)\n }\n else {\n axis.stacking.resetStacks();\n }\n }\n}\n/**\n * Adds series' points value to corresponding stack\n *\n * @private\n * @function Highcharts.Series#setStackedPoints\n */\nfunction seriesSetStackedPoints(axis, stackingParam) {\n const type = stackingParam || this.options.stacking;\n if (!type ||\n !this.reserveSpace() ||\n // Group stacks (centerInCategory) belong on the x-axis, other stacks on\n // the y-axis.\n ({ group: 'xAxis' }[type] || 'yAxis') !== axis.coll) {\n return;\n }\n const series = this, xData = series.processedXData, yData = series.processedYData, stackedYData = [], yDataLength = yData.length, seriesOptions = series.options, threshold = seriesOptions.threshold || 0, stackThreshold = seriesOptions.startFromThreshold ? threshold : 0, stackOption = seriesOptions.stack, stackKey = stackingParam ?\n `${series.type},${type}` : (series.stackKey || ''), negKey = '-' + stackKey, negStacks = series.negStacks, stacking = axis.stacking, stacks = stacking.stacks, oldStacks = stacking.oldStacks;\n let stackIndicator, isNegative, stack, other, key, pointKey, i, x, y;\n stacking.stacksTouched += 1;\n // Loop over the non-null y values and read them into a local array\n for (i = 0; i < yDataLength; i++) {\n x = xData[i];\n y = yData[i];\n stackIndicator = series.getStackIndicator(stackIndicator, x, series.index);\n pointKey = stackIndicator.key || '';\n // Read stacked values into a stack based on the x value,\n // the sign of y and the stack key. Stacking is also handled for null\n // values (#739)\n isNegative = negStacks && y < (stackThreshold ? 0 : threshold);\n key = isNegative ? negKey : stackKey;\n // Create empty object for this stack if it doesn't exist yet\n if (!stacks[key]) {\n stacks[key] = {};\n }\n // Initialize StackItem for this x\n if (!stacks[key][x]) {\n if (oldStacks[key]?.[x]) {\n stacks[key][x] = oldStacks[key][x];\n stacks[key][x].total = null;\n }\n else {\n stacks[key][x] = new StackItem(axis, axis.options.stackLabels, !!isNegative, x, stackOption);\n }\n }\n // If the StackItem doesn't exist, create it first\n stack = stacks[key][x];\n if (y !== null) {\n stack.points[pointKey] = stack.points[series.index] = [\n pick(stack.cumulative, stackThreshold)\n ];\n // Record the base of the stack\n if (!defined(stack.cumulative)) {\n stack.base = pointKey;\n }\n stack.touched = stacking.stacksTouched;\n // In area charts, if there are multiple points on the same X value,\n // let the area fill the full span of those points\n if (stackIndicator.index > 0 && series.singleStacks === false) {\n stack.points[pointKey][0] = stack.points[series.index + ',' + x + ',0'][0];\n }\n // When updating to null, reset the point stack (#7493)\n }\n else {\n delete stack.points[pointKey];\n delete stack.points[series.index];\n }\n // Add value to the stack total\n let total = stack.total || 0;\n if (type === 'percent') {\n // Percent stacked column, totals are the same for the positive and\n // negative stacks\n other = isNegative ? stackKey : negKey;\n if (negStacks && stacks[other]?.[x]) {\n other = stacks[other][x];\n total = other.total =\n Math.max(other.total || 0, total) +\n Math.abs(y) || 0;\n // Percent stacked areas\n }\n else {\n total = correctFloat(total + (Math.abs(y) || 0));\n }\n }\n else if (type === 'group') {\n if (isArray(y)) {\n y = y[0];\n }\n // In this stack, the total is the number of valid points\n if (y !== null) {\n total++;\n }\n }\n else {\n total = correctFloat(total + (y || 0));\n }\n if (type === 'group') {\n // This point's index within the stack, pushed to stack.points[1]\n stack.cumulative = (total || 1) - 1;\n }\n else {\n stack.cumulative = correctFloat(pick(stack.cumulative, stackThreshold) +\n (y || 0));\n }\n stack.total = total;\n if (y !== null) {\n stack.points[pointKey].push(stack.cumulative);\n stackedYData[i] = stack.cumulative;\n stack.hasValidPoints = true;\n }\n }\n if (type === 'percent') {\n stacking.usePercentage = true;\n }\n if (type !== 'group') {\n this.stackedYData = stackedYData; // To be used in getExtremes\n }\n // Reset old stacks\n stacking.oldStacks = {};\n}\n/* *\n *\n * Classes\n *\n * */\n/**\n * Adds stacking support to axes.\n * @private\n * @class\n */\nclass AxisAdditions {\n /* *\n *\n * Constructors\n *\n * */\n constructor(axis) {\n this.oldStacks = {};\n this.stacks = {};\n this.stacksTouched = 0;\n this.axis = axis;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Build the stacks from top down\n * @private\n */\n buildStacks() {\n const stacking = this, axis = stacking.axis, axisSeries = axis.series, isXAxis = axis.coll === 'xAxis', reversedStacks = axis.options.reversedStacks, len = axisSeries.length;\n let actualSeries, i;\n this.resetStacks();\n stacking.usePercentage = false;\n i = len;\n while (i--) {\n actualSeries = axisSeries[reversedStacks ? i : len - i - 1];\n if (isXAxis) {\n actualSeries.setGroupedPoints(axis);\n }\n actualSeries.setStackedPoints(axis);\n }\n // Loop up again to compute percent and stream stack\n if (!isXAxis) {\n for (i = 0; i < len; i++) {\n axisSeries[i].modifyStacks();\n }\n }\n fireEvent(axis, 'afterBuildStacks');\n }\n /**\n * @private\n */\n cleanStacks() {\n if (this.oldStacks) {\n this.stacks = this.oldStacks;\n // Reset stacks\n objectEach(this.stacks, (type) => {\n objectEach(type, (stack) => {\n stack.cumulative = stack.total;\n });\n });\n }\n }\n /**\n * Set all the stacks to initial states and destroy unused ones.\n * @private\n */\n resetStacks() {\n objectEach(this.stacks, (type) => {\n objectEach(type, (stack, x) => {\n // Clean up memory after point deletion (#1044, #4320)\n if (isNumber(stack.touched) &&\n stack.touched < this.stacksTouched) {\n stack.destroy();\n delete type[x];\n // Reset stacks\n }\n else {\n stack.total = null;\n stack.cumulative = null;\n }\n });\n });\n }\n /**\n * @private\n */\n renderStackTotals() {\n const stacking = this, axis = stacking.axis, chart = axis.chart, renderer = chart.renderer, stacks = stacking.stacks, stackLabelsAnim = axis.options.stackLabels?.animation, animationConfig = getDeferredAnimation(chart, stackLabelsAnim || false), stackTotalGroup = stacking.stackTotalGroup = (stacking.stackTotalGroup ||\n renderer\n .g('stack-labels')\n .attr({\n zIndex: 6,\n opacity: 0\n })\n .add());\n // The plotLeft/Top will change when y axis gets wider so we need to\n // translate the stackTotalGroup at every render call. See bug #506\n // and #516\n stackTotalGroup.translate(chart.plotLeft, chart.plotTop);\n // Render each stack total\n objectEach(stacks, (type) => {\n objectEach(type, (stack) => {\n stack.render(stackTotalGroup);\n });\n });\n stackTotalGroup.animate({\n opacity: 1\n }, animationConfig);\n }\n}\n/* *\n *\n * Composition\n *\n * */\nvar StackingAxis;\n(function (StackingAxis) {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Extends axis with stacking support.\n * @private\n */\n function compose(AxisClass, ChartClass, SeriesClass) {\n const chartProto = ChartClass.prototype, seriesProto = SeriesClass.prototype;\n if (!chartProto.getStacks) {\n addEvent(AxisClass, 'init', onAxisInit);\n addEvent(AxisClass, 'destroy', onAxisDestroy);\n chartProto.getStacks = chartGetStacks;\n seriesProto.getStackIndicator = seriesGetStackIndicator;\n seriesProto.modifyStacks = seriesModifyStacks;\n seriesProto.percentStacker = seriesPercentStacker;\n seriesProto.setGroupedPoints = seriesSetGroupedPoints;\n seriesProto.setStackedPoints = seriesSetStackedPoints;\n }\n }\n StackingAxis.compose = compose;\n})(StackingAxis || (StackingAxis = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default StackingAxis;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Series from '../../Core/Series/Series.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nimport U from '../../Core/Utilities.js';\nconst { defined, merge, isObject } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The line series is the base type and is therefor the series base prototype.\n *\n * @private\n */\nclass LineSeries extends Series {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Draw the graph. Called internally when rendering line-like series\n * types. The first time it generates the `series.graph` item and\n * optionally other series-wide items like `series.area` for area\n * charts. On subsequent calls these items are updated with new\n * positions and attributes.\n *\n * @function Highcharts.Series#drawGraph\n */\n drawGraph() {\n const options = this.options, graphPath = (this.gappedPath || this.getGraphPath).call(this), styledMode = this.chart.styledMode;\n // Draw the graph\n [this, ...this.zones].forEach((owner, i) => {\n let attribs, graph = owner.graph;\n const verb = graph ? 'animate' : 'attr', dashStyle = owner.dashStyle ||\n options.dashStyle;\n if (graph) {\n graph.endX = this.preventGraphAnimation ?\n null :\n graphPath.xMap;\n graph.animate({ d: graphPath });\n }\n else if (graphPath.length) { // #1487\n /**\n * SVG element of line-based charts. Can be used for styling\n * purposes. If zones are configured, this element will be\n * hidden and replaced by multiple zone lines, accessible\n * via `series.zones[i].graph`.\n *\n * @name Highcharts.Series#graph\n * @type {Highcharts.SVGElement|undefined}\n */\n owner.graph = graph = this.chart.renderer\n .path(graphPath)\n .addClass('highcharts-graph' +\n (i ? ` highcharts-zone-graph-${i - 1} ` : ' ') +\n ((i && owner.className) || ''))\n .attr({ zIndex: 1 }) // #1069\n .add(this.group);\n }\n if (graph && !styledMode) {\n attribs = {\n 'stroke': ((!i && options.lineColor) || // Series only\n owner.color ||\n this.color ||\n \"#cccccc\" /* Palette.neutralColor20 */),\n 'stroke-width': options.lineWidth || 0,\n // Polygon series use filled graph\n 'fill': (this.fillGraph && this.color) || 'none'\n };\n // Apply dash style\n if (dashStyle) {\n attribs.dashstyle = dashStyle;\n // The reason for the `else if` is that linecaps don't mix well\n // with dashstyle. The gaps get partially filled by the\n // linecap.\n }\n else if (options.linecap !== 'square') {\n attribs['stroke-linecap'] =\n attribs['stroke-linejoin'] = 'round';\n }\n graph[verb](attribs)\n // Add shadow to normal series (0) or to first\n // zone (1) #3932\n .shadow((i < 2) &&\n options.shadow &&\n // If shadow is defined, call function with\n // `filterUnits: 'userSpaceOnUse'` to avoid known\n // SVG filter bug (#19093)\n merge({ filterUnits: 'userSpaceOnUse' }, isObject(options.shadow) ? options.shadow : {}));\n }\n // Helpers for animation\n if (graph) {\n graph.startX = graphPath.xMap;\n graph.isArea = graphPath.isArea; // For arearange animation\n }\n });\n }\n // eslint-disable-next-line valid-jsdoc\n /**\n * Get the graph path.\n *\n * @private\n */\n getGraphPath(points, nullsAsZeroes, connectCliffs) {\n const series = this, options = series.options, graphPath = [], xMap = [];\n let gap, step = options.step;\n points = points || series.points;\n // Bottom of a stack is reversed\n const reversed = points.reversed;\n if (reversed) {\n points.reverse();\n }\n // Reverse the steps (#5004)\n step = {\n right: 1,\n center: 2\n }[step] || (step && 3);\n if (step && reversed) {\n step = 4 - step;\n }\n // Remove invalid points, especially in spline (#5015)\n points = this.getValidPoints(points, false, !(options.connectNulls && !nullsAsZeroes && !connectCliffs));\n // Build the line\n points.forEach(function (point, i) {\n const plotX = point.plotX, plotY = point.plotY, lastPoint = points[i - 1], isNull = point.isNull || typeof plotY !== 'number';\n // the path to this point from the previous\n let pathToPoint;\n if ((point.leftCliff || (lastPoint && lastPoint.rightCliff)) &&\n !connectCliffs) {\n gap = true; // ... and continue\n }\n // Line series, nullsAsZeroes is not handled\n if (isNull && !defined(nullsAsZeroes) && i > 0) {\n gap = !options.connectNulls;\n // Area series, nullsAsZeroes is set\n }\n else if (isNull && !nullsAsZeroes) {\n gap = true;\n }\n else {\n if (i === 0 || gap) {\n pathToPoint = [[\n 'M',\n point.plotX,\n point.plotY\n ]];\n // Generate the spline as defined in the SplineSeries object\n }\n else if (series.getPointSpline) {\n pathToPoint = [series.getPointSpline(points, point, i)];\n }\n else if (step) {\n if (step === 1) { // right\n pathToPoint = [[\n 'L',\n lastPoint.plotX,\n plotY\n ]];\n }\n else if (step === 2) { // center\n pathToPoint = [[\n 'L',\n (lastPoint.plotX + plotX) / 2,\n lastPoint.plotY\n ], [\n 'L',\n (lastPoint.plotX + plotX) / 2,\n plotY\n ]];\n }\n else {\n pathToPoint = [[\n 'L',\n plotX,\n lastPoint.plotY\n ]];\n }\n pathToPoint.push([\n 'L',\n plotX,\n plotY\n ]);\n }\n else {\n // normal line to next point\n pathToPoint = [[\n 'L',\n plotX,\n plotY\n ]];\n }\n // Prepare for animation. When step is enabled, there are\n // two path nodes for each x value.\n xMap.push(point.x);\n if (step) {\n xMap.push(point.x);\n if (step === 2) { // step = center (#8073)\n xMap.push(point.x);\n }\n }\n graphPath.push.apply(graphPath, pathToPoint);\n gap = false;\n }\n });\n graphPath.xMap = xMap;\n series.graphPath = graphPath;\n return graphPath;\n }\n}\n/* *\n *\n * Static Functions\n *\n * */\nLineSeries.defaultOptions = merge(Series.defaultOptions, \n/**\n * General options for all series types.\n *\n * @optionparent plotOptions.series\n */\n{\n legendSymbol: 'lineMarker'\n});\nSeriesRegistry.registerSeriesType('line', LineSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default LineSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * A line series displays information as a series of data points connected by\n * straight line segments.\n *\n * @sample {highcharts} highcharts/demo/line-chart/\n * Line chart\n * @sample {highstock} stock/demo/basic-line/\n * Line chart\n *\n * @extends plotOptions.series\n * @product highcharts highstock\n * @apioption plotOptions.line\n */\n/**\n * The SVG value used for the `stroke-linecap` and `stroke-linejoin`\n * of a line graph. Round means that lines are rounded in the ends and\n * bends.\n *\n * @type {Highcharts.SeriesLinecapValue}\n * @default round\n * @since 3.0.7\n * @apioption plotOptions.line.linecap\n */\n/**\n * A `line` series. If the [type](#series.line.type) option is not\n * specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.line\n * @excluding dataParser,dataURL\n * @product highcharts highstock\n * @apioption series.line\n */\n/**\n * An array of data points for the series. For the `line` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 1],\n * [1, 2],\n * [2, 8]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.line.turboThreshold),\n * this option is not available.\n * ```js\n * data: [{\n * x: 1,\n * y: 9,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 6,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * **Note:** In TypeScript you have to extend `PointOptionsObject` with an\n * additional declaration to allow custom data types:\n * ```ts\n * declare module `highcharts` {\n * interface PointOptionsObject {\n * custom: Record;\n * }\n * }\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @declare Highcharts.PointOptionsObject\n * @type {Array|null|*>}\n * @apioption series.line.data\n */\n/**\n * An additional, individual class name for the data point's graphic\n * representation. Changes to a point's color will also be reflected in a\n * chart's legend and tooltip.\n *\n * @sample {highcharts} highcharts/css/point-series-classname\n * Series and point class name\n *\n * @type {string}\n * @since 5.0.0\n * @product highcharts gantt\n * @apioption series.line.data.className\n */\n/**\n * Individual color for the point. By default the color is pulled from\n * the global `colors` array.\n *\n * In styled mode, the `color` option doesn't take effect. Instead, use\n * `colorIndex`.\n *\n * @sample {highcharts} highcharts/point/color/\n * Mark the highest point\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @product highcharts highstock gantt\n * @apioption series.line.data.color\n */\n/**\n * A specific color index to use for the point, so its graphic representations\n * are given the class name `highcharts-color-{n}`. In styled mode this will\n * change the color of the graphic. In non-styled mode, the color is set by the\n * `fill` attribute, so the change in class name won't have a visual effect by\n * default.\n *\n * Since v11, CSS variables on the form `--highcharts-color-{n}` make changing\n * the color scheme very convenient.\n *\n * @sample {highcharts} highcharts/css/colorindex/\n * Series and point color index\n *\n * @type {number}\n * @since 5.0.0\n * @product highcharts gantt\n * @apioption series.line.data.colorIndex\n */\n/**\n * A reserved subspace to store options and values for customized functionality.\n * Here you can add additional data for your own event callbacks and formatter\n * callbacks.\n *\n * @sample {highcharts} highcharts/point/custom/\n * Point and series with custom data\n *\n * @type {Highcharts.Dictionary<*>}\n * @apioption series.line.data.custom\n */\n/**\n * Individual data label for each point. The options are the same as\n * the ones for [plotOptions.series.dataLabels](\n * #plotOptions.series.dataLabels).\n *\n * @sample highcharts/point/datalabels/\n * Show a label for the last value\n *\n * @type {*|Array<*>}\n * @declare Highcharts.DataLabelsOptions\n * @extends plotOptions.line.dataLabels\n * @product highcharts highstock gantt\n * @apioption series.line.data.dataLabels\n */\n/**\n * A description of the point to add to the screen reader information\n * about the point.\n *\n * @type {string}\n * @since 5.0.0\n * @requires modules/accessibility\n * @apioption series.line.data.description\n */\n/**\n * An id for the point. This can be used after render time to get a\n * pointer to the point object through `chart.get()`.\n *\n * @sample {highcharts} highcharts/point/id/\n * Remove an id'd point\n *\n * @type {string}\n * @since 1.2.0\n * @product highcharts highstock gantt\n * @apioption series.line.data.id\n */\n/**\n * The rank for this point's data label in case of collision. If two\n * data labels are about to overlap, only the one with the highest `labelrank`\n * will be drawn.\n *\n * @type {number}\n * @apioption series.line.data.labelrank\n */\n/**\n * The name of the point as shown in the legend, tooltip, dataLabels, etc.\n *\n * @see [xAxis.uniqueNames](#xAxis.uniqueNames)\n *\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Point names\n *\n * @type {string}\n * @apioption series.line.data.name\n */\n/**\n * Whether the data point is selected initially.\n *\n * @type {boolean}\n * @default false\n * @product highcharts highstock gantt\n * @apioption series.line.data.selected\n */\n/**\n * The x value of the point. For datetime axes, the X value is the timestamp\n * in milliseconds since 1970.\n *\n * @type {number}\n * @product highcharts highstock\n * @apioption series.line.data.x\n */\n/**\n * The y value of the point.\n *\n * @type {number|null}\n * @product highcharts highstock\n * @apioption series.line.data.y\n */\n/**\n * The individual point events.\n *\n * @extends plotOptions.series.point.events\n * @product highcharts highstock gantt\n * @apioption series.line.data.events\n */\n/**\n * Options for the point markers of line-like series.\n *\n * @declare Highcharts.PointMarkerOptionsObject\n * @extends plotOptions.series.marker\n * @product highcharts highstock\n * @apioption series.line.data.marker\n */\n''; // include precedent doclets in transpiled\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { seriesTypes: { line: LineSeries } } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { extend, merge, objectEach, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * Area series type.\n *\n * @private\n * @class\n * @name AreaSeries\n *\n * @augments LineSeries\n */\nclass AreaSeries extends LineSeries {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Draw the graph and the underlying area. This method calls the Series\n * base function and adds the area. The areaPath is calculated in the\n * getSegmentPath method called from Series.prototype.drawGraph.\n * @private\n */\n drawGraph() {\n // Define or reset areaPath\n this.areaPath = [];\n // Call the base method\n super.drawGraph.apply(this);\n // Define local variables\n const { areaPath, options } = this;\n [this, ...this.zones].forEach((owner, i) => {\n const attribs = {}, fillColor = owner.fillColor || options.fillColor;\n let area = owner.area;\n const verb = area ? 'animate' : 'attr';\n // Create or update the area\n if (area) { // Update\n area.endX = this.preventGraphAnimation ?\n null :\n areaPath.xMap;\n area.animate({ d: areaPath });\n }\n else { // Create\n attribs.zIndex = 0; // #1069\n /**\n * SVG element of area-based charts. Can be used for styling\n * purposes. If zones are configured, this element will be\n * hidden and replaced by multiple zone areas, accessible\n * via `series.zones[i].area`.\n *\n * @name Highcharts.Series#area\n * @type {Highcharts.SVGElement|undefined}\n */\n area = owner.area = this.chart.renderer\n .path(areaPath)\n .addClass('highcharts-area' +\n (i ? ` highcharts-zone-area-${i - 1} ` : ' ') +\n ((i && owner.className) || ''))\n .add(this.group);\n area.isArea = true;\n }\n if (!this.chart.styledMode) {\n // If there is fillColor defined for the area, set it.\n // Otherwise, we set it to the zone/series color and add\n // fill-opacity (#18939).\n attribs.fill = fillColor || owner.color || this.color;\n attribs['fill-opacity'] = fillColor ?\n 1 : (options.fillOpacity ?? 0.75);\n // Allow clicking through the area if sticky tracking is true\n // (#18744)\n area.css({\n pointerEvents: this.stickyTracking ? 'none' : 'auto'\n });\n }\n area[verb](attribs);\n area.startX = areaPath.xMap;\n area.shiftUnit = options.step ? 2 : 1;\n });\n }\n /**\n * @private\n */\n getGraphPath(points) {\n const getGraphPath = LineSeries.prototype.getGraphPath, options = this.options, stacking = options.stacking, yAxis = this.yAxis, bottomPoints = [], graphPoints = [], seriesIndex = this.index, stacks = yAxis.stacking.stacks[this.stackKey], threshold = options.threshold, translatedThreshold = Math.round(// #10909\n yAxis.getThreshold(options.threshold)), connectNulls = pick(// #10574\n options.connectNulls, stacking === 'percent'), \n // To display null points in underlying stacked series, this\n // series graph must be broken, and the area also fall down to\n // fill the gap left by the null point. #2069\n addDummyPoints = function (i, otherI, side) {\n const point = points[i], stackedValues = stacking &&\n stacks[point.x].points[seriesIndex], nullVal = point[side + 'Null'] || 0, cliffVal = point[side + 'Cliff'] || 0;\n let top, bottom, isNull = true;\n if (cliffVal || nullVal) {\n top = (nullVal ?\n stackedValues[0] :\n stackedValues[1]) + cliffVal;\n bottom = stackedValues[0] + cliffVal;\n isNull = !!nullVal;\n }\n else if (!stacking &&\n points[otherI] &&\n points[otherI].isNull) {\n top = bottom = threshold;\n }\n // Add to the top and bottom line of the area\n if (typeof top !== 'undefined') {\n graphPoints.push({\n plotX: plotX,\n plotY: top === null ?\n translatedThreshold :\n yAxis.getThreshold(top),\n isNull: isNull,\n isCliff: true\n });\n bottomPoints.push({\n plotX: plotX,\n plotY: bottom === null ?\n translatedThreshold :\n yAxis.getThreshold(bottom),\n doCurve: false // #1041, gaps in areaspline areas\n });\n }\n };\n let plotX, isNull, yBottom;\n // Find what points to use\n points = points || this.points;\n // Fill in missing points\n if (stacking) {\n points = this.getStackPoints(points);\n }\n for (let i = 0, iEnd = points.length; i < iEnd; ++i) {\n // Reset after series.update of stacking property (#12033)\n if (!stacking) {\n points[i].leftCliff = points[i].rightCliff =\n points[i].leftNull = points[i].rightNull = void 0;\n }\n isNull = points[i].isNull;\n plotX = pick(points[i].rectPlotX, points[i].plotX);\n yBottom = stacking ?\n pick(points[i].yBottom, translatedThreshold) :\n translatedThreshold;\n if (!isNull || connectNulls) {\n if (!connectNulls) {\n addDummyPoints(i, i - 1, 'left');\n }\n // Skip null point when stacking is false and connectNulls\n // true\n if (!(isNull && !stacking && connectNulls)) {\n graphPoints.push(points[i]);\n bottomPoints.push({\n x: i,\n plotX: plotX,\n plotY: yBottom\n });\n }\n if (!connectNulls) {\n addDummyPoints(i, i + 1, 'right');\n }\n }\n }\n const topPath = getGraphPath.call(this, graphPoints, true, true);\n bottomPoints.reversed = true;\n const bottomPath = getGraphPath.call(this, bottomPoints, true, true);\n const firstBottomPoint = bottomPath[0];\n if (firstBottomPoint && firstBottomPoint[0] === 'M') {\n bottomPath[0] = ['L', firstBottomPoint[1], firstBottomPoint[2]];\n }\n const areaPath = topPath.concat(bottomPath);\n if (areaPath.length) {\n areaPath.push(['Z']);\n }\n // TODO: don't set leftCliff and rightCliff when connectNulls?\n const graphPath = getGraphPath\n .call(this, graphPoints, false, connectNulls);\n areaPath.xMap = topPath.xMap;\n this.areaPath = areaPath;\n return graphPath;\n }\n /**\n * Return an array of stacked points, where null and missing points are\n * replaced by dummy points in order for gaps to be drawn correctly in\n * stacks.\n * @private\n */\n getStackPoints(points) {\n const series = this, segment = [], keys = [], xAxis = this.xAxis, yAxis = this.yAxis, stack = yAxis.stacking.stacks[this.stackKey], pointMap = {}, yAxisSeries = yAxis.series, seriesLength = yAxisSeries.length, upOrDown = yAxis.options.reversedStacks ? 1 : -1, seriesIndex = yAxisSeries.indexOf(series);\n points = points || this.points;\n if (this.options.stacking) {\n for (let i = 0; i < points.length; i++) {\n // Reset after point update (#7326)\n points[i].leftNull = points[i].rightNull = void 0;\n // Create a map where we can quickly look up the points by\n // their X values.\n pointMap[points[i].x] = points[i];\n }\n // Sort the keys (#1651)\n objectEach(stack, function (stackX, x) {\n // nulled after switching between\n // grouping and not (#1651, #2336)\n if (stackX.total !== null) {\n keys.push(x);\n }\n });\n keys.sort(function (a, b) {\n return a - b;\n });\n const visibleSeries = yAxisSeries.map((s) => s.visible);\n keys.forEach(function (x, idx) {\n let y = 0, stackPoint, stackedValues;\n if (pointMap[x] && !pointMap[x].isNull) {\n segment.push(pointMap[x]);\n // Find left and right cliff. -1 goes left, 1 goes\n // right.\n [-1, 1].forEach(function (direction) {\n const nullName = direction === 1 ?\n 'rightNull' :\n 'leftNull', cliffName = direction === 1 ?\n 'rightCliff' :\n 'leftCliff', otherStack = stack[keys[idx + direction]];\n let cliff = 0;\n // If there is a stack next to this one,\n // to the left or to the right...\n if (otherStack) {\n let i = seriesIndex;\n // Can go either up or down,\n // depending on reversedStacks\n while (i >= 0 && i < seriesLength) {\n const si = yAxisSeries[i].index;\n stackPoint = otherStack.points[si];\n if (!stackPoint) {\n // If the next point in this series is\n // missing, mark the point with\n // point.leftNull or point.rightNull = true.\n if (si === series.index) {\n pointMap[x][nullName] = true;\n // If there are missing points in the next\n // stack in any of the series below this\n // one, we need to subtract the missing\n // values and add a hiatus to the left or\n // right.\n }\n else if (visibleSeries[i]) {\n stackedValues = stack[x].points[si];\n if (stackedValues) {\n cliff -= (stackedValues[1] -\n stackedValues[0]);\n }\n }\n }\n // When reversedStacks is true, loop up,\n // else loop down\n i += upOrDown;\n }\n }\n pointMap[x][cliffName] = cliff;\n });\n // There is no point for this X value in this series, so we\n // insert a dummy point in order for the areas to be drawn\n // correctly.\n }\n else {\n // Loop down the stack to find the series below this\n // one that has a value (#1991)\n let i = seriesIndex;\n while (i >= 0 && i < seriesLength) {\n const si = yAxisSeries[i].index;\n stackPoint = stack[x].points[si];\n if (stackPoint) {\n y = stackPoint[1];\n break;\n }\n // When reversedStacks is true, loop up, else loop\n // down\n i += upOrDown;\n }\n y = pick(y, 0);\n y = yAxis.translate(// #6272\n y, 0, 1, 0, 1);\n segment.push({\n isNull: true,\n plotX: xAxis.translate(// #6272\n x, 0, 0, 0, 1),\n x: x,\n plotY: y,\n yBottom: y\n });\n }\n });\n }\n return segment;\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\n/**\n * The area series type.\n *\n * @sample {highcharts} highcharts/demo/area-basic/\n * Area chart\n * @sample {highstock} stock/demo/area/\n * Area chart\n *\n * @extends plotOptions.line\n * @excluding useOhlcData\n * @product highcharts highstock\n * @optionparent plotOptions.area\n */\nAreaSeries.defaultOptions = merge(LineSeries.defaultOptions, {\n /**\n * @see [fillColor](#plotOptions.area.fillColor)\n * @see [fillOpacity](#plotOptions.area.fillOpacity)\n *\n * @apioption plotOptions.area.color\n */\n /**\n * Fill color or gradient for the area. When `undefined`, the series'\n * `color` is used with the series' `fillOpacity`.\n *\n * In styled mode, the fill color can be set with the `.highcharts-area`\n * class name.\n *\n * @see [color](#plotOptions.area.color)\n * @see [fillOpacity](#plotOptions.area.fillOpacity)\n *\n * @sample {highcharts} highcharts/plotoptions/area-fillcolor-default/\n * Undefined by default\n * @sample {highcharts} highcharts/plotoptions/area-fillcolor-gradient/\n * Gradient\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @product highcharts highstock\n * @apioption plotOptions.area.fillColor\n */\n /**\n * Fill opacity for the area. When you set an explicit `fillColor`,\n * the `fillOpacity` is not applied. Instead, you should define the\n * opacity in the `fillColor` with an rgba color definition. The\n * `fillOpacity` setting, also the default setting, overrides the alpha\n * component of the `color` setting.\n *\n * In styled mode, the fill opacity can be set with the\n * `.highcharts-area` class name.\n *\n * @see [color](#plotOptions.area.color)\n * @see [fillColor](#plotOptions.area.fillColor)\n *\n * @sample {highcharts} highcharts/plotoptions/area-fillopacity/\n * Automatic fill color and fill opacity of 0.1\n *\n * @type {number}\n * @default {highcharts} 0.75\n * @default {highstock} 0.75\n * @product highcharts highstock\n * @apioption plotOptions.area.fillOpacity\n */\n /**\n * A separate color for the graph line. By default the line takes the\n * `color` of the series, but the lineColor setting allows setting a\n * separate color for the line without altering the `fillColor`.\n *\n * In styled mode, the line stroke can be set with the\n * `.highcharts-graph` class name.\n *\n * @sample {highcharts} highcharts/plotoptions/area-linecolor/\n * Dark gray line\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @product highcharts highstock\n * @apioption plotOptions.area.lineColor\n */\n /**\n * A separate color for the negative part of the area.\n *\n * In styled mode, a negative color is set with the\n * `.highcharts-negative` class name.\n *\n * @see [negativeColor](#plotOptions.area.negativeColor)\n *\n * @sample {highcharts} highcharts/css/series-negative-color/\n * Negative color in styled mode\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.area.negativeFillColor\n */\n /**\n * Whether the whole area or just the line should respond to mouseover\n * tooltips and other mouse or touch events.\n *\n * @sample {highcharts|highstock} highcharts/plotoptions/area-trackbyarea/\n * Display the tooltip when the area is hovered\n *\n * @type {boolean}\n * @default false\n * @since 1.1.6\n * @product highcharts highstock\n * @apioption plotOptions.area.trackByArea\n */\n /**\n * The Y axis value to serve as the base for the area, for\n * distinguishing between values above and below a threshold. The area\n * between the graph and the threshold is filled.\n *\n * * If a number is given, the Y axis will scale to the threshold.\n * * If `null`, the scaling behaves like a line series with fill between\n * the graph and the Y axis minimum.\n * * If `Infinity` or `-Infinity`, the area between the graph and the\n * corresponding Y axis extreme is filled (since v6.1.0).\n *\n * @sample {highcharts} highcharts/plotoptions/area-threshold/\n * A threshold of 100\n * @sample {highcharts} highcharts/plotoptions/area-threshold-infinity/\n * A threshold of Infinity\n *\n * @type {number|null}\n * @since 2.0\n * @product highcharts highstock\n */\n threshold: 0,\n legendSymbol: 'areaMarker'\n});\nextend(AreaSeries.prototype, {\n singleStacks: false\n});\nSeriesRegistry.registerSeriesType('area', AreaSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default AreaSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * A `area` series. If the [type](#series.area.type) option is not\n * specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.area\n * @excluding dataParser, dataURL, useOhlcData\n * @product highcharts highstock\n * @apioption series.area\n */\n/**\n * @see [fillColor](#series.area.fillColor)\n * @see [fillOpacity](#series.area.fillOpacity)\n *\n * @apioption series.area.color\n */\n/**\n * An array of data points for the series. For the `area` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` * and `pointInterval` given in the series options. If the\n * axis has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 9],\n * [1, 7],\n * [2, 6]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.area.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 9,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 6,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @product highcharts highstock\n * @apioption series.area.data\n */\n/**\n * @see [color](#series.area.color)\n * @see [fillOpacity](#series.area.fillOpacity)\n *\n * @apioption series.area.fillColor\n */\n/**\n * @see [color](#series.area.color)\n * @see [fillColor](#series.area.fillColor)\n *\n * @default {highcharts} 0.75\n * @default {highstock} 0.75\n * @apioption series.area.fillOpacity\n */\n''; // adds doclets above to transpiled\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { line: LineSeries } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { merge, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * Spline series type.\n *\n * @private\n */\nclass SplineSeries extends LineSeries {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Get the spline segment from a given point's previous neighbour to the\n * given point.\n *\n * @private\n * @function Highcharts.seriesTypes.spline#getPointSpline\n */\n getPointSpline(points, point, i) {\n const \n // 1 means control points midway between points, 2 means 1/3\n // from the point, 3 is 1/4 etc\n smoothing = 1.5, denom = smoothing + 1, plotX = point.plotX || 0, plotY = point.plotY || 0, lastPoint = points[i - 1], nextPoint = points[i + 1];\n let leftContX, leftContY, rightContX, rightContY;\n /**\n * @private\n */\n function doCurve(otherPoint) {\n return otherPoint &&\n !otherPoint.isNull &&\n otherPoint.doCurve !== false &&\n // #6387, area splines next to null:\n !point.isCliff;\n }\n // Find control points\n if (doCurve(lastPoint) && doCurve(nextPoint)) {\n const lastX = lastPoint.plotX || 0, lastY = lastPoint.plotY || 0, nextX = nextPoint.plotX || 0, nextY = nextPoint.plotY || 0;\n let correction = 0;\n leftContX = (smoothing * plotX + lastX) / denom;\n leftContY = (smoothing * plotY + lastY) / denom;\n rightContX = (smoothing * plotX + nextX) / denom;\n rightContY = (smoothing * plotY + nextY) / denom;\n // Have the two control points make a straight line through main\n // point\n if (rightContX !== leftContX) { // #5016, division by zero\n correction = (((rightContY - leftContY) *\n (rightContX - plotX)) /\n (rightContX - leftContX) + plotY - rightContY);\n }\n leftContY += correction;\n rightContY += correction;\n // to prevent false extremes, check that control points are\n // between neighbouring points' y values\n if (leftContY > lastY && leftContY > plotY) {\n leftContY = Math.max(lastY, plotY);\n // mirror of left control point\n rightContY = 2 * plotY - leftContY;\n }\n else if (leftContY < lastY && leftContY < plotY) {\n leftContY = Math.min(lastY, plotY);\n rightContY = 2 * plotY - leftContY;\n }\n if (rightContY > nextY && rightContY > plotY) {\n rightContY = Math.max(nextY, plotY);\n leftContY = 2 * plotY - rightContY;\n }\n else if (rightContY < nextY && rightContY < plotY) {\n rightContY = Math.min(nextY, plotY);\n leftContY = 2 * plotY - rightContY;\n }\n // record for drawing in next point\n point.rightContX = rightContX;\n point.rightContY = rightContY;\n // Visualize control points for debugging\n /*\n if (leftContX) {\n this.chart.renderer\n .circle(\n leftContX + this.chart.plotLeft,\n leftContY + this.chart.plotTop,\n 2\n )\n .attr({\n stroke: 'red',\n 'stroke-width': 2,\n fill: 'none',\n zIndex: 9\n })\n .add();\n this.chart.renderer\n .path([['M', leftContX + this.chart.plotLeft,\n leftContY + this.chart.plotTop\n ], ['L', plotX + this.chart.plotLeft,\n plotY + this.chart.plotTop\n ]])\n .attr({\n stroke: 'red',\n 'stroke-width': 2,\n zIndex: 9\n })\n .add();\n }\n if (rightContX) {\n this.chart.renderer\n .circle(\n rightContX + this.chart.plotLeft,\n rightContY + this.chart.plotTop,\n 2\n )\n .attr({\n stroke: 'green',\n 'stroke-width': 2,\n fill: 'none',\n zIndex: 9\n })\n .add();\n this.chart.renderer\n .path([[\n 'M', rightContX + this.chart.plotLeft,\n rightContY + this.chart.plotTop\n ], [\n 'L', plotX + this.chart.plotLeft,\n plotY + this.chart.plotTop\n ]])\n .attr({\n stroke: 'green',\n 'stroke-width': 2,\n zIndex: 9\n })\n .add();\n }\n // */\n point.controlPoints = {\n low: [leftContX, leftContY],\n high: [rightContX, rightContY]\n };\n }\n const ret = [\n 'C',\n pick(lastPoint.rightContX, lastPoint.plotX, 0),\n pick(lastPoint.rightContY, lastPoint.plotY, 0),\n pick(leftContX, plotX, 0),\n pick(leftContY, plotY, 0),\n plotX,\n plotY\n ];\n // reset for updating series later\n lastPoint.rightContX = lastPoint.rightContY = void 0;\n return ret;\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\n/**\n * A spline series is a special type of line series, where the segments\n * between the data points are smoothed.\n *\n * @sample {highcharts} highcharts/demo/spline-irregular-time/\n * Spline chart\n * @sample {highstock} stock/demo/spline/\n * Spline chart\n *\n * @extends plotOptions.series\n * @excluding step, boostThreshold, boostBlending\n * @product highcharts highstock\n * @optionparent plotOptions.spline\n */\nSplineSeries.defaultOptions = merge(LineSeries.defaultOptions);\nSeriesRegistry.registerSeriesType('spline', SplineSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default SplineSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * A `spline` series. If the [type](#series.spline.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.spline\n * @excluding dataParser, dataURL, step, boostThreshold, boostBlending\n * @product highcharts highstock\n * @apioption series.spline\n */\n/**\n * An array of data points for the series. For the `spline` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 9],\n * [1, 2],\n * [2, 8]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.spline.turboThreshold),\n * this option is not available.\n * ```js\n * data: [{\n * x: 1,\n * y: 9,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 0,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @product highcharts highstock\n * @apioption series.spline.data\n */\n''; // adds doclets above intro transpiled\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport SplineSeries from '../Spline/SplineSeries.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { area: AreaSeries, area: { prototype: areaProto } } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { extend, merge } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * AreaSpline series type.\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.areaspline\n *\n * @augments Highcharts.Series\n */\nclass AreaSplineSeries extends SplineSeries {\n}\n/* *\n *\n * Static Properties\n *\n * */\nAreaSplineSeries.defaultOptions = merge(SplineSeries.defaultOptions, AreaSeries.defaultOptions);\nextend(AreaSplineSeries.prototype, {\n getGraphPath: areaProto.getGraphPath,\n getStackPoints: areaProto.getStackPoints,\n drawGraph: areaProto.drawGraph\n});\nSeriesRegistry.registerSeriesType('areaspline', AreaSplineSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default AreaSplineSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * The area spline series is an area series where the graph between the\n * points is smoothed into a spline.\n *\n * @sample {highcharts} highcharts/demo/areaspline/\n * Area spline chart\n * @sample {highstock} stock/demo/areaspline/\n * Area spline chart\n *\n * @extends plotOptions.area\n * @excluding step, boostThreshold, boostBlending\n * @product highcharts highstock\n * @apioption plotOptions.areaspline\n */\n/**\n * @see [fillColor](#plotOptions.areaspline.fillColor)\n * @see [fillOpacity](#plotOptions.areaspline.fillOpacity)\n *\n * @apioption plotOptions.areaspline.color\n */\n/**\n * @see [color](#plotOptions.areaspline.color)\n * @see [fillOpacity](#plotOptions.areaspline.fillOpacity)\n *\n * @apioption plotOptions.areaspline.fillColor\n */\n/**\n * @see [color](#plotOptions.areaspline.color)\n * @see [fillColor](#plotOptions.areaspline.fillColor)\n *\n * @default 0.75\n * @apioption plotOptions.areaspline.fillOpacity\n */\n/**\n * A `areaspline` series. If the [type](#series.areaspline.type) option\n * is not specified, it is inherited from [chart.type](#chart.type).\n *\n *\n * @extends series,plotOptions.areaspline\n * @excluding dataParser, dataURL, step, boostThreshold, boostBlending\n * @product highcharts highstock\n * @apioption series.areaspline\n */\n/**\n * @see [fillColor](#series.areaspline.fillColor)\n * @see [fillOpacity](#series.areaspline.fillOpacity)\n *\n * @apioption series.areaspline.color\n */\n/**\n * An array of data points for the series. For the `areaspline` series\n * type, points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 10],\n * [1, 9],\n * [2, 3]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.areaspline.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 4,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 4,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @product highcharts highstock\n * @apioption series.areaspline.data\n */\n/**\n * @see [color](#series.areaspline.color)\n * @see [fillOpacity](#series.areaspline.fillOpacity)\n *\n * @apioption series.areaspline.fillColor\n */\n/**\n * @see [color](#series.areaspline.color)\n * @see [fillColor](#series.areaspline.fillColor)\n *\n * @default 0.75\n * @apioption series.areaspline.fillOpacity\n */\n''; // adds doclets above into transpiled\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * Column series display one column per value along an X axis.\n *\n * @sample {highcharts} highcharts/demo/column-basic/\n * Column chart\n * @sample {highstock} stock/demo/column/\n * Column chart\n *\n * @extends plotOptions.line\n * @excluding connectEnds, connectNulls, gapSize, gapUnit, linecap,\n * lineWidth, marker, step, useOhlcData\n * @product highcharts highstock\n * @optionparent plotOptions.column\n */\nconst ColumnSeriesDefaults = {\n /**\n * The corner radius of the border surrounding each column or bar. A number\n * signifies pixels. A percentage string, like for example `50%`, signifies\n * a relative size. For columns this is relative to the column width, for\n * pies it is relative to the radius and the inner radius.\n *\n * @sample {highcharts} highcharts/plotoptions/column-borderradius/\n * Rounded columns\n * @sample highcharts/plotoptions/series-border-radius\n * Column and pie with rounded border\n *\n * @type {number|string|Highcharts.BorderRadiusOptionsObject}\n * @product highcharts highstock gantt\n */\n borderRadius: 3,\n /**\n * When using automatic point colors pulled from the global\n * [colors](colors) or series-specific\n * [plotOptions.column.colors](series.colors) collections, this option\n * determines whether the chart should receive one color per series or\n * one color per point.\n *\n * In styled mode, the `colors` or `series.colors` arrays are not\n * supported, and instead this option gives the points individual color\n * class names on the form `highcharts-color-{n}`.\n *\n * @see [series colors](#plotOptions.column.colors)\n *\n * @sample {highcharts} highcharts/plotoptions/column-colorbypoint-false/\n * False by default\n * @sample {highcharts} highcharts/plotoptions/column-colorbypoint-true/\n * True\n *\n * @type {boolean}\n * @default false\n * @since 2.0\n * @product highcharts highstock gantt\n * @apioption plotOptions.column.colorByPoint\n */\n /**\n * A series specific or series type specific color set to apply instead\n * of the global [colors](#colors) when [colorByPoint](\n * #plotOptions.column.colorByPoint) is true.\n *\n * @type {Array}\n * @since 3.0\n * @product highcharts highstock gantt\n * @apioption plotOptions.column.colors\n */\n /**\n * When `true`, the columns will center in the category, ignoring null\n * or missing points. When `false`, space will be reserved for null or\n * missing points.\n *\n * @sample {highcharts} highcharts/series-column/centerincategory/\n * Center in category\n *\n * @since 8.0.1\n * @product highcharts highstock gantt\n */\n centerInCategory: false,\n /**\n * Padding between each value groups, in x axis units.\n *\n * @sample {highcharts} highcharts/plotoptions/column-grouppadding-default/\n * 0.2 by default\n * @sample {highcharts} highcharts/plotoptions/column-grouppadding-none/\n * No group padding - all columns are evenly spaced\n *\n * @product highcharts highstock gantt\n */\n groupPadding: 0.2,\n /**\n * Whether to group non-stacked columns or to let them render\n * independent of each other. Non-grouped columns will be laid out\n * individually and overlap each other.\n *\n * @sample {highcharts} highcharts/plotoptions/column-grouping-false/\n * Grouping disabled\n * @sample {highstock} highcharts/plotoptions/column-grouping-false/\n * Grouping disabled\n *\n * @type {boolean}\n * @default true\n * @since 2.3.0\n * @product highcharts highstock gantt\n * @apioption plotOptions.column.grouping\n */\n /** @ignore-option */\n marker: null,\n /**\n * The maximum allowed pixel width for a column, translated to the\n * height of a bar in a bar chart. This prevents the columns from\n * becoming too wide when there is a small number of points in the\n * chart.\n *\n * @see [pointWidth](#plotOptions.column.pointWidth)\n *\n * @sample {highcharts} highcharts/plotoptions/column-maxpointwidth-20/\n * Limited to 50\n * @sample {highstock} highcharts/plotoptions/column-maxpointwidth-20/\n * Limited to 50\n *\n * @type {number}\n * @since 4.1.8\n * @product highcharts highstock gantt\n * @apioption plotOptions.column.maxPointWidth\n */\n /**\n * Padding between each column or bar, in x axis units.\n *\n * @sample {highcharts} highcharts/plotoptions/column-pointpadding-default/\n * 0.1 by default\n * @sample {highcharts} highcharts/plotoptions/column-pointpadding-025/\n * 0.25\n * @sample {highcharts} highcharts/plotoptions/column-pointpadding-none/\n * 0 for tightly packed columns\n *\n * @product highcharts highstock gantt\n */\n pointPadding: 0.1,\n /**\n * A pixel value specifying a fixed width for each column or bar point.\n * When set to `undefined`, the width is calculated from the\n * `pointPadding` and `groupPadding`. The width effects the dimension\n * that is not based on the point value. For column series it is the\n * horizontal length and for bar series it is the vertical length.\n *\n * @see [maxPointWidth](#plotOptions.column.maxPointWidth)\n *\n * @sample {highcharts} highcharts/plotoptions/column-pointwidth-20/\n * 20px wide columns regardless of chart width or the amount of\n * data points\n *\n * @type {number}\n * @since 1.2.5\n * @product highcharts highstock gantt\n * @apioption plotOptions.column.pointWidth\n */\n /**\n * A pixel value specifying a fixed width for the column or bar.\n * Overrides pointWidth on the series.\n *\n * @see [series.pointWidth](#plotOptions.column.pointWidth)\n *\n * @type {number}\n * @default undefined\n * @since 7.0.0\n * @product highcharts highstock gantt\n * @apioption series.column.data.pointWidth\n */\n /**\n * The minimal height for a column or width for a bar. By default,\n * 0 values are not shown. To visualize a 0 (or close to zero) point,\n * set the minimal point length to a pixel value like 3\\. In stacked\n * column charts, minPointLength might not be respected for tightly\n * packed values.\n *\n * @sample {highcharts} highcharts/plotoptions/column-minpointlength/\n * Zero base value\n * @sample {highcharts} highcharts/plotoptions/column-minpointlength-pos-and-neg/\n * Positive and negative close to zero values\n *\n * @product highcharts highstock gantt\n */\n minPointLength: 0,\n /**\n * When the series contains less points than the crop threshold, all\n * points are drawn, event if the points fall outside the visible plot\n * area at the current zoom. The advantage of drawing all points\n * (including markers and columns), is that animation is performed on\n * updates. On the other hand, when the series contains more points than\n * the crop threshold, the series data is cropped to only contain points\n * that fall within the plot area. The advantage of cropping away\n * invisible points is to increase performance on large series.\n *\n * @product highcharts highstock gantt\n */\n cropThreshold: 50,\n /**\n * The X axis range that each point is valid for. This determines the\n * width of the column. On a categorized axis, the range will be 1\n * by default (one category unit). On linear and datetime axes, the\n * range will be computed as the distance between the two closest data\n * points.\n *\n * The default `null` means it is computed automatically, but this\n * option can be used to override the automatic value.\n *\n * This option is set by default to 1 if data sorting is enabled.\n *\n * @sample {highcharts} highcharts/plotoptions/column-pointrange/\n * Set the point range to one day on a data set with one week\n * between the points\n *\n * @type {number|null}\n * @since 2.3\n * @product highcharts highstock gantt\n */\n pointRange: null,\n states: {\n /**\n * Options for the hovered point. These settings override the normal\n * state options when a point is moused over or touched.\n *\n * @extends plotOptions.series.states.hover\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock gantt\n */\n hover: {\n /** @ignore-option */\n halo: false,\n /**\n * A specific border color for the hovered point. Defaults to\n * inherit the normal state border color.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @product highcharts gantt\n * @apioption plotOptions.column.states.hover.borderColor\n */\n /**\n * A specific color for the hovered point.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @product highcharts gantt\n * @apioption plotOptions.column.states.hover.color\n */\n /**\n * How much to brighten the point on interaction. Requires the\n * main color to be defined in hex or rgb(a) format.\n *\n * In styled mode, the hover brightening is by default replaced\n * with a fill-opacity set in the `.highcharts-point:hover`\n * rule.\n *\n * @sample {highcharts} highcharts/plotoptions/column-states-hover-brightness/\n * Brighten by 0.5\n *\n * @product highcharts highstock gantt\n */\n brightness: 0.1\n },\n /**\n * Options for the selected point. These settings override the\n * normal state options when a point is selected.\n *\n * @extends plotOptions.series.states.select\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock gantt\n */\n select: {\n /**\n * A specific color for the selected point.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #cccccc\n * @product highcharts highstock gantt\n */\n color: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * A specific border color for the selected point.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #000000\n * @product highcharts highstock gantt\n */\n borderColor: \"#000000\" /* Palette.neutralColor100 */\n }\n },\n dataLabels: {\n align: void 0,\n verticalAlign: void 0,\n /**\n * The y position offset of the label relative to the point in\n * pixels.\n *\n * @type {number}\n */\n y: void 0\n },\n // false doesn't work well: https://jsfiddle.net/highcharts/hz8fopan/14/\n /** @ignore-option */\n startFromThreshold: true,\n stickyTracking: false,\n tooltip: {\n distance: 6\n },\n /**\n * The Y axis value to serve as the base for the columns, for\n * distinguishing between values above and below a threshold. If `null`,\n * the columns extend from the padding Y axis minimum.\n *\n * @type {number|null}\n * @since 2.0\n * @product highcharts\n */\n threshold: 0,\n /**\n * The width of the border surrounding each column or bar. Defaults to\n * `1` when there is room for a border, but to `0` when the columns are\n * so dense that a border would cover the next column.\n *\n * In styled mode, the stroke width can be set with the\n * `.highcharts-point` rule.\n *\n * @sample {highcharts} highcharts/plotoptions/column-borderwidth/\n * 2px black border\n *\n * @type {number}\n * @default undefined\n * @product highcharts highstock gantt\n * @apioption plotOptions.column.borderWidth\n */\n /**\n * The color of the border surrounding each column or bar.\n *\n * In styled mode, the border stroke can be set with the\n * `.highcharts-point` rule.\n *\n * @sample {highcharts} highcharts/plotoptions/column-bordercolor/\n * Dark gray border\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #ffffff\n * @product highcharts highstock gantt\n */\n borderColor: \"#ffffff\" /* Palette.backgroundColor */\n};\n/**\n * A `column` series. If the [type](#series.column.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.column\n * @excluding connectNulls, dataParser, dataURL, gapSize, gapUnit, linecap,\n * lineWidth, marker, connectEnds, step\n * @product highcharts highstock\n * @apioption series.column\n */\n/**\n * An array of data points for the series. For the `column` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 6],\n * [1, 2],\n * [2, 6]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.column.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 9,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 6,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @excluding marker\n * @product highcharts highstock\n * @apioption series.column.data\n */\n/**\n * The color of the border surrounding the column or bar.\n *\n * In styled mode, the border stroke can be set with the `.highcharts-point`\n * rule.\n *\n * @sample {highcharts} highcharts/plotoptions/column-bordercolor/\n * Dark gray border\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @product highcharts highstock\n * @apioption series.column.data.borderColor\n */\n/**\n * The width of the border surrounding the column or bar.\n *\n * In styled mode, the stroke width can be set with the `.highcharts-point`\n * rule.\n *\n * @sample {highcharts} highcharts/plotoptions/column-borderwidth/\n * 2px black border\n *\n * @type {number}\n * @product highcharts highstock\n * @apioption series.column.data.borderWidth\n */\n/**\n * A name for the dash style to use for the column or bar. Overrides\n * dashStyle on the series.\n *\n * In styled mode, the stroke dash-array can be set with the same classes as\n * listed under [data.color](#series.column.data.color).\n *\n * @see [series.pointWidth](#plotOptions.column.dashStyle)\n *\n * @type {Highcharts.DashStyleValue}\n * @apioption series.column.data.dashStyle\n */\n/**\n * A pixel value specifying a fixed width for the column or bar. Overrides\n * pointWidth on the series. The width effects the dimension that is not based\n * on the point value.\n *\n * @see [series.pointWidth](#plotOptions.column.pointWidth)\n *\n * @type {number}\n * @apioption series.column.data.pointWidth\n */\n/**\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock\n * @apioption series.column.states.hover\n */\n/**\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock\n * @apioption series.column.states.select\n */\n''; // keeps doclets above in JS file\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../../Core/Animation/AnimationUtilities.js';\nconst { animObject } = A;\nimport Color from '../../Core/Color/Color.js';\nconst { parse: color } = Color;\nimport ColumnSeriesDefaults from './ColumnSeriesDefaults.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport Series from '../../Core/Series/Series.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nimport U from '../../Core/Utilities.js';\nconst { clamp, defined, extend, fireEvent, isArray, isNumber, merge, pick, objectEach } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The column series type.\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.column\n *\n * @augments Highcharts.Series\n */\nclass ColumnSeries extends Series {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Animate the column heights one by one from zero.\n *\n * @private\n * @function Highcharts.seriesTypes.column#animate\n *\n * @param {boolean} init\n * Whether to initialize the animation or run it\n */\n animate(init) {\n const series = this, yAxis = this.yAxis, yAxisPos = yAxis.pos, options = series.options, inverted = this.chart.inverted, attr = {}, translateProp = inverted ?\n 'translateX' :\n 'translateY';\n let translateStart, translatedThreshold;\n if (init) {\n attr.scaleY = 0.001;\n translatedThreshold = clamp(yAxis.toPixels(options.threshold), yAxisPos, yAxisPos + yAxis.len);\n if (inverted) {\n attr.translateX = translatedThreshold - yAxis.len;\n }\n else {\n attr.translateY = translatedThreshold;\n }\n // apply final clipping (used in Highcharts Stock) (#7083)\n // animation is done by scaleY, so clipping is for panes\n if (series.clipBox) {\n series.setClip();\n }\n series.group.attr(attr);\n }\n else { // run the animation\n translateStart = Number(series.group.attr(translateProp));\n series.group.animate({ scaleY: 1 }, extend(animObject(series.options.animation), {\n // Do the scale synchronously to ensure smooth\n // updating (#5030, #7228)\n step: function (val, fx) {\n if (series.group) {\n attr[translateProp] = translateStart +\n fx.pos * (yAxisPos - translateStart);\n series.group.attr(attr);\n }\n }\n }));\n }\n }\n /**\n * Initialize the series. Extends the basic Series.init method by\n * marking other series of the same type as dirty.\n *\n * @private\n * @function Highcharts.seriesTypes.column#init\n */\n init(chart, \n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n options) {\n super.init.apply(this, arguments);\n const series = this;\n chart = series.chart;\n // if the series is added dynamically, force redraw of other\n // series affected by a new column\n if (chart.hasRendered) {\n chart.series.forEach(function (otherSeries) {\n if (otherSeries.type === series.type) {\n otherSeries.isDirty = true;\n }\n });\n }\n }\n /**\n * Return the width and x offset of the columns adjusted for grouping,\n * groupPadding, pointPadding, pointWidth etc.\n *\n * @private\n * @function Highcharts.seriesTypes.column#getColumnMetrics\n */\n getColumnMetrics() {\n const series = this, options = series.options, xAxis = series.xAxis, yAxis = series.yAxis, reversedStacks = xAxis.options.reversedStacks, \n // Keep backward compatibility: reversed xAxis had reversed\n // stacks\n reverseStacks = (xAxis.reversed && !reversedStacks) ||\n (!xAxis.reversed && reversedStacks), stackGroups = {};\n let stackKey, columnCount = 0;\n // Get the total number of column type series. This is called on\n // every series. Consider moving this logic to a chart.orderStacks()\n // function and call it on init, addSeries and removeSeries\n if (options.grouping === false) {\n columnCount = 1;\n }\n else {\n series.chart.series.forEach(function (otherSeries) {\n const otherYAxis = otherSeries.yAxis, otherOptions = otherSeries.options;\n let columnIndex;\n if (otherSeries.type === series.type &&\n otherSeries.reserveSpace() &&\n yAxis.len === otherYAxis.len &&\n yAxis.pos === otherYAxis.pos) { // #642, #2086\n if (otherOptions.stacking &&\n otherOptions.stacking !== 'group') {\n stackKey = otherSeries.stackKey;\n if (typeof stackGroups[stackKey] ===\n 'undefined') {\n stackGroups[stackKey] = columnCount++;\n }\n columnIndex = stackGroups[stackKey];\n }\n else if (otherOptions.grouping !== false) { // #1162\n columnIndex = columnCount++;\n }\n otherSeries.columnIndex = columnIndex;\n }\n });\n }\n const categoryWidth = Math.min(Math.abs(xAxis.transA) * ((!xAxis.brokenAxis?.hasBreaks && xAxis.ordinal?.slope) ||\n options.pointRange ||\n xAxis.closestPointRange ||\n xAxis.tickInterval ||\n 1), // #2610\n xAxis.len // #1535\n ), groupPadding = categoryWidth * options.groupPadding, groupWidth = categoryWidth - 2 * groupPadding, pointOffsetWidth = groupWidth / (columnCount || 1), pointWidth = Math.min(options.maxPointWidth || xAxis.len, pick(options.pointWidth, pointOffsetWidth * (1 - 2 * options.pointPadding))), pointPadding = (pointOffsetWidth - pointWidth) / 2, \n // #1251, #3737\n colIndex = (series.columnIndex || 0) + (reverseStacks ? 1 : 0), pointXOffset = pointPadding +\n (groupPadding +\n colIndex * pointOffsetWidth -\n (categoryWidth / 2)) * (reverseStacks ? -1 : 1);\n // Save it for reading in linked series (Error bars particularly)\n series.columnMetrics = {\n width: pointWidth,\n offset: pointXOffset,\n paddedWidth: pointOffsetWidth,\n columnCount\n };\n return series.columnMetrics;\n }\n /**\n * Make the columns crisp. The edges are rounded to the nearest full\n * pixel.\n *\n * @private\n * @function Highcharts.seriesTypes.column#crispCol\n */\n crispCol(x, y, w, h) {\n const borderWidth = this.borderWidth, xCrisp = -(borderWidth % 2 ? 0.5 : 0);\n let right, yCrisp = borderWidth % 2 ? 0.5 : 1;\n // Horizontal. We need to first compute the exact right edge, then\n // round it and compute the width from there.\n if (this.options.crisp) {\n right = Math.round(x + w) + xCrisp;\n x = Math.round(x) + xCrisp;\n w = right - x;\n }\n // Vertical\n const bottom = Math.round(y + h) + yCrisp, fromTop = Math.abs(y) <= 0.5 && bottom > 0.5; // #4504, #4656\n y = Math.round(y) + yCrisp;\n h = bottom - y;\n // Top edges are exceptions\n if (fromTop && h) { // #5146\n y -= 1;\n h += 1;\n }\n return {\n x: x,\n y: y,\n width: w,\n height: h\n };\n }\n /**\n * Adjust for missing columns, according to the `centerInCategory`\n * option. Missing columns are either single points or stacks where the\n * point or points are either missing or null.\n *\n * @private\n * @function Highcharts.seriesTypes.column#adjustForMissingColumns\n * @param {number} x\n * The x coordinate of the column, left side\n *\n * @param {number} pointWidth\n * The pointWidth, already computed upstream\n *\n * @param {Highcharts.ColumnPoint} point\n * The point instance\n *\n * @param {Highcharts.ColumnMetricsObject} metrics\n * The series-wide column metrics\n *\n * @return {number}\n * The adjusted x position, or the original if not adjusted\n */\n adjustForMissingColumns(x, pointWidth, point, metrics) {\n if (!point.isNull && metrics.columnCount > 1) {\n const visibleSeries = this.xAxis.series\n .filter((s) => s.visible)\n .map((s) => s.index);\n let indexInCategory = 0, totalInCategory = 0;\n // Loop over all the stacks on the Y axis. When stacking is enabled,\n // these are real point stacks. When stacking is not enabled, but\n // `centerInCategory` is true, there is one stack handling the\n // grouping of points in each category. This is done in the\n // `setGroupedPoints` function.\n objectEach(this.xAxis.stacking?.stacks, (stack) => {\n if (typeof point.x === 'number') {\n const stackItem = stack[point.x.toString()];\n if (stackItem) {\n const pointValues = stackItem.points[this.index];\n // Look for the index\n if (isArray(pointValues)) {\n // If there are multiple points with the same X\n // then gather all series in category, and\n // assign index\n const seriesIndexes = Object\n .keys(stackItem.points)\n .filter((pointKey) => \n // Filter out duplicate X's\n !pointKey.match(',') &&\n // Filter out null points\n stackItem.points[pointKey] &&\n stackItem.points[pointKey].length > 1)\n .map(parseFloat)\n .filter((index) => visibleSeries.indexOf(index) !== -1)\n .sort((a, b) => b - a);\n indexInCategory = seriesIndexes.indexOf(this.index);\n totalInCategory = seriesIndexes.length;\n }\n }\n }\n });\n indexInCategory = this.xAxis.reversed ?\n totalInCategory - 1 - indexInCategory : indexInCategory;\n // Compute the adjusted x position\n const boxWidth = (totalInCategory - 1) * metrics.paddedWidth +\n pointWidth;\n x = (point.plotX || 0) + boxWidth / 2 - pointWidth -\n indexInCategory * metrics.paddedWidth;\n }\n return x;\n }\n /**\n * Translate each point to the plot area coordinate system and find\n * shape positions\n *\n * @private\n * @function Highcharts.seriesTypes.column#translate\n */\n translate() {\n const series = this, chart = series.chart, options = series.options, dense = series.dense =\n series.closestPointRange * series.xAxis.transA < 2, borderWidth = series.borderWidth = pick(options.borderWidth, dense ? 0 : 1 // #3635\n ), xAxis = series.xAxis, yAxis = series.yAxis, threshold = options.threshold, minPointLength = pick(options.minPointLength, 5), metrics = series.getColumnMetrics(), seriesPointWidth = metrics.width, seriesXOffset = series.pointXOffset = metrics.offset, dataMin = series.dataMin, dataMax = series.dataMax;\n // postprocessed for border width\n let seriesBarW = series.barW =\n Math.max(seriesPointWidth, 1 + 2 * borderWidth), translatedThreshold = series.translatedThreshold =\n yAxis.getThreshold(threshold);\n if (chart.inverted) {\n translatedThreshold -= 0.5; // #3355\n }\n // When the pointPadding is 0, we want the columns to be packed\n // tightly, so we allow individual columns to have individual sizes.\n // When pointPadding is greater, we strive for equal-width columns\n // (#2694).\n if (options.pointPadding) {\n seriesBarW = Math.ceil(seriesBarW);\n }\n Series.prototype.translate.apply(series);\n // Record the new values\n series.points.forEach(function (point) {\n const yBottom = pick(point.yBottom, translatedThreshold), safeDistance = 999 + Math.abs(yBottom), plotX = point.plotX || 0, \n // Don't draw too far outside plot area (#1303, #2241,\n // #4264)\n plotY = clamp(point.plotY, -safeDistance, yAxis.len + safeDistance);\n let up, barY = Math.min(plotY, yBottom), barH = Math.max(plotY, yBottom) - barY, pointWidth = seriesPointWidth, barX = plotX + seriesXOffset, barW = seriesBarW;\n // Handle options.minPointLength\n if (minPointLength && Math.abs(barH) < minPointLength) {\n barH = minPointLength;\n up = (!yAxis.reversed && !point.negative) ||\n (yAxis.reversed && point.negative);\n // Reverse zeros if there's no positive value in the series\n // in visible range (#7046)\n if (isNumber(threshold) &&\n isNumber(dataMax) &&\n point.y === threshold &&\n dataMax <= threshold &&\n // and if there's room for it (#7311)\n (yAxis.min || 0) < threshold &&\n // if all points are the same value (i.e zero) not draw\n // as negative points (#10646), but only if there's room\n // for it (#14876)\n (dataMin !== dataMax || (yAxis.max || 0) <= threshold)) {\n up = !up;\n point.negative = !point.negative;\n }\n // If stacked...\n barY = (Math.abs(barY - translatedThreshold) > minPointLength ?\n // ...keep position\n yBottom - minPointLength :\n // #1485, #4051\n translatedThreshold -\n (up ? minPointLength : 0));\n }\n // Handle point.options.pointWidth\n // @todo Handle grouping/stacking too. Calculate offset properly\n if (defined(point.options.pointWidth)) {\n pointWidth = barW =\n Math.ceil(point.options.pointWidth);\n barX -= Math.round((pointWidth - seriesPointWidth) / 2);\n }\n // Adjust for null or missing points\n if (options.centerInCategory && !options.stacking) {\n barX = series.adjustForMissingColumns(barX, pointWidth, point, metrics);\n }\n // Cache for access in polar\n point.barX = barX;\n point.pointWidth = pointWidth;\n // Fix the tooltip on center of grouped columns (#1216, #424,\n // #3648)\n point.tooltipPos = chart.inverted ?\n [\n clamp(yAxis.len + yAxis.pos - chart.plotLeft - plotY, yAxis.pos - chart.plotLeft, yAxis.len + yAxis.pos - chart.plotLeft),\n xAxis.len + xAxis.pos - chart.plotTop - barX - barW / 2,\n barH\n ] :\n [\n xAxis.left - chart.plotLeft + barX + barW / 2,\n clamp(plotY + yAxis.pos -\n chart.plotTop, yAxis.pos - chart.plotTop, yAxis.len + yAxis.pos - chart.plotTop),\n barH\n ];\n // Register shape type and arguments to be used in drawPoints. Allow\n // `shapeType` defined on `pointClass` level.\n point.shapeType = series.pointClass.prototype.shapeType ||\n 'roundedRect';\n point.shapeArgs = series.crispCol(barX, \n // #3169, drilldown from null must have a position to work from.\n // #6585, dataLabel should be placed on xAxis, not floating in\n // the middle of the chart.\n point.isNull ? translatedThreshold : barY, barW, point.isNull ? 0 : barH);\n });\n // Fire a specific event after column translate. We could instead apply\n // all the column logic in an `afterTranslate` event handler, but there\n // are so many other series types that use the column translation, that\n // it is more convenient to have a specific event for it.\n fireEvent(this, 'afterColumnTranslate');\n }\n /**\n * Columns have no graph\n *\n * @private\n * @function Highcharts.seriesTypes.column#drawGraph\n */\n drawGraph() {\n this.group[this.dense ? 'addClass' : 'removeClass']('highcharts-dense-data');\n }\n /**\n * Get presentational attributes\n *\n * @private\n * @function Highcharts.seriesTypes.column#pointAttribs\n */\n pointAttribs(point, state) {\n const options = this.options, p2o = this.pointAttrToOptions || {}, strokeOption = p2o.stroke || 'borderColor', strokeWidthOption = p2o['stroke-width'] || 'borderWidth';\n let stateOptions, zone, brightness, fill = (point && point.color) || this.color, \n // set to fill when borderColor null:\n stroke = ((point && point[strokeOption]) ||\n options[strokeOption] ||\n fill), dashstyle = (point && point.options.dashStyle) || options.dashStyle, strokeWidth = (point && point[strokeWidthOption]) ||\n options[strokeWidthOption] ||\n this[strokeWidthOption] || 0, opacity = pick(point && point.opacity, options.opacity, 1);\n // Handle zone colors\n if (point && this.zones.length) {\n zone = point.getZone();\n // When zones are present, don't use point.color (#4267).\n // Changed order (#6527), added support for colorAxis (#10670)\n fill = (point.options.color ||\n (zone && (zone.color || point.nonZonedColor)) ||\n this.color);\n if (zone) {\n stroke = zone.borderColor || stroke;\n dashstyle = zone.dashStyle || dashstyle;\n strokeWidth = zone.borderWidth || strokeWidth;\n }\n }\n // Select or hover states\n if (state && point) {\n stateOptions = merge(options.states[state], \n // #6401\n point.options.states &&\n point.options.states[state] ||\n {});\n brightness = stateOptions.brightness;\n fill =\n stateOptions.color || (typeof brightness !== 'undefined' &&\n color(fill)\n .brighten(stateOptions.brightness)\n .get()) || fill;\n stroke = stateOptions[strokeOption] || stroke;\n strokeWidth =\n stateOptions[strokeWidthOption] || strokeWidth;\n dashstyle = stateOptions.dashStyle || dashstyle;\n opacity = pick(stateOptions.opacity, opacity);\n }\n const ret = {\n fill: fill,\n stroke: stroke,\n 'stroke-width': strokeWidth,\n opacity: opacity\n };\n if (dashstyle) {\n ret.dashstyle = dashstyle;\n }\n return ret;\n }\n /**\n * Draw the columns. For bars, the series.group is rotated, so the same\n * coordinates apply for columns and bars. This method is inherited by\n * scatter series.\n *\n * @private\n * @function Highcharts.seriesTypes.column#drawPoints\n */\n drawPoints(points = this.points) {\n const series = this, chart = this.chart, options = series.options, renderer = chart.renderer, animationLimit = options.animationLimit || 250;\n let shapeArgs;\n // draw the columns\n points.forEach(function (point) {\n const plotY = point.plotY;\n let graphic = point.graphic, hasGraphic = !!graphic, verb = graphic && chart.pointCount < animationLimit ?\n 'animate' : 'attr';\n if (isNumber(plotY) && point.y !== null) {\n shapeArgs = point.shapeArgs;\n // When updating a series between 2d and 3d or cartesian and\n // polar, the shape type changes.\n if (graphic && point.hasNewShapeType()) {\n graphic = graphic.destroy();\n }\n // Set starting position for point sliding animation.\n if (series.enabledDataSorting) {\n point.startXPos = series.xAxis.reversed ?\n -(shapeArgs ? (shapeArgs.width || 0) : 0) :\n series.xAxis.width;\n }\n if (!graphic) {\n point.graphic = graphic =\n renderer[point.shapeType](shapeArgs)\n .add(point.group || series.group);\n if (graphic &&\n series.enabledDataSorting &&\n chart.hasRendered &&\n chart.pointCount < animationLimit) {\n graphic.attr({\n x: point.startXPos\n });\n hasGraphic = true;\n verb = 'animate';\n }\n }\n if (graphic && hasGraphic) { // update\n graphic[verb](merge(shapeArgs));\n }\n // Presentational\n if (!chart.styledMode) {\n graphic[verb](series.pointAttribs(point, (point.selected && 'select')))\n .shadow(point.allowShadow !== false && options.shadow);\n }\n if (graphic) {\n graphic.addClass(point.getClassName(), true);\n graphic.attr({\n visibility: point.visible ? 'inherit' : 'hidden'\n });\n }\n }\n else if (graphic) {\n point.graphic = graphic.destroy(); // #1269\n }\n });\n }\n /**\n * Draw the tracker for a point.\n * @private\n */\n drawTracker(points = this.points) {\n const series = this, chart = series.chart, pointer = chart.pointer, onMouseOver = function (e) {\n const point = pointer?.getPointFromEvent(e);\n // Undefined on graph in scatterchart\n if (pointer &&\n point &&\n series.options.enableMouseTracking) {\n pointer.isDirectTouch = true;\n point.onMouseOver(e);\n }\n };\n let dataLabels;\n // Add reference to the point\n points.forEach(function (point) {\n dataLabels = (isArray(point.dataLabels) ?\n point.dataLabels :\n (point.dataLabel ? [point.dataLabel] : []));\n if (point.graphic) {\n point.graphic.element.point = point;\n }\n dataLabels.forEach(function (dataLabel) {\n (dataLabel.div || dataLabel.element).point = point;\n });\n });\n // Add the event listeners, we need to do this only once\n if (!series._hasTracking) {\n series.trackerGroups.forEach(function (key) {\n if (series[key]) {\n // we don't always have dataLabelsGroup\n series[key]\n .addClass('highcharts-tracker')\n .on('mouseover', onMouseOver)\n .on('mouseout', function (e) {\n pointer?.onTrackerMouseOut(e);\n })\n .on('touchstart', onMouseOver);\n if (!chart.styledMode && series.options.cursor) {\n series[key]\n .css({ cursor: series.options.cursor });\n }\n }\n });\n series._hasTracking = true;\n }\n fireEvent(this, 'afterDrawTracker');\n }\n /**\n * Remove this series from the chart\n *\n * @private\n * @function Highcharts.seriesTypes.column#remove\n */\n remove() {\n const series = this, chart = series.chart;\n // column and bar series affects other series of the same type\n // as they are either stacked or grouped\n if (chart.hasRendered) {\n chart.series.forEach(function (otherSeries) {\n if (otherSeries.type === series.type) {\n otherSeries.isDirty = true;\n }\n });\n }\n Series.prototype.remove.apply(series, arguments);\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nColumnSeries.defaultOptions = merge(Series.defaultOptions, ColumnSeriesDefaults);\nextend(ColumnSeries.prototype, {\n // When tooltip is not shared, this series (and derivatives) requires\n // direct touch/hover. KD-tree does not apply.\n directTouch: true,\n getSymbol: noop,\n // Use separate negative stacks, unlike area stacks where a negative\n // point is subtracted from previous (#1910)\n negStacks: true,\n trackerGroups: ['group', 'dataLabelsGroup']\n});\nSeriesRegistry.registerSeriesType('column', ColumnSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnSeries;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Adjusted width and x offset of the columns for grouping.\n *\n * @private\n * @interface Highcharts.ColumnMetricsObject\n */ /**\n* Width of the columns.\n* @name Highcharts.ColumnMetricsObject#width\n* @type {number}\n*/ /**\n* Offset of the columns.\n* @name Highcharts.ColumnMetricsObject#offset\n* @type {number}\n*/\n''; // detach doclets above\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../Animation/AnimationUtilities.js';\nconst { getDeferredAnimation } = A;\nimport F from '../Templating.js';\nconst { format } = F;\nimport U from '../Utilities.js';\nconst { defined, extend, fireEvent, isArray, isString, merge, objectEach, pick, pInt, splat } = U;\n/* *\n *\n * Composition\n *\n * */\nvar DataLabel;\n(function (DataLabel) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Check if this series has data labels, either a series-level setting, or\n * individual. In case of individual point labels, this method is overridden\n * to always return true.\n * @private\n */\n function hasDataLabels() {\n return mergedDataLabelOptions(this)\n .some((o) => o?.enabled);\n }\n /**\n * Align each individual data label.\n * @private\n */\n function alignDataLabel(point, dataLabel, options, alignTo, isNew) {\n const series = this, chart = this.chart, inverted = this.isCartesian && chart.inverted, enabledDataSorting = this.enabledDataSorting, plotX = point.plotX, plotY = point.plotY, rotation = options.rotation || 0, isInsidePlot = defined(plotX) &&\n defined(plotY) &&\n chart.isInsidePlot(plotX, Math.round(plotY), {\n inverted,\n paneCoordinates: true,\n series\n }), setStartPos = (alignOptions) => {\n if (enabledDataSorting && series.xAxis && !justify) {\n series.setDataLabelStartPos(point, dataLabel, isNew, isInsidePlot, alignOptions);\n }\n }, justify = rotation === 0 ? pick(options.overflow, (enabledDataSorting ? 'none' : 'justify')) === 'justify' : false;\n // Math.round for rounding errors (#2683), alignTo to allow column\n // labels (#2700)\n let visible = this.visible &&\n point.visible !== false &&\n defined(plotX) &&\n (point.series.forceDL ||\n (enabledDataSorting && !justify) ||\n isInsidePlot ||\n (\n // If the data label is inside the align box, it is\n // enough that parts of the align box is inside the\n // plot area (#12370). When stacking, it is always\n // inside regardless of the option (#15148).\n pick(options.inside, !!this.options.stacking) &&\n alignTo &&\n chart.isInsidePlot(plotX, inverted ?\n alignTo.x + 1 :\n alignTo.y + alignTo.height - 1, {\n inverted,\n paneCoordinates: true,\n series\n })));\n const pos = point.pos();\n if (visible && pos) {\n const bBox = dataLabel.getBBox(), unrotatedbBox = dataLabel.getBBox(void 0, 0), alignFactor = {\n 'right': 1,\n 'center': 0.5\n }[options.align || 0] || 0, verticalAlignFactor = {\n 'bottom': 1,\n 'middle': 0.5\n }[options.verticalAlign || 0] || 0;\n // The alignment box is a singular point\n alignTo = extend({\n x: pos[0],\n y: Math.round(pos[1]),\n width: 0,\n height: 0\n }, alignTo || {});\n // Add the text size for alignment calculation\n extend(options, {\n width: bBox.width,\n height: bBox.height\n });\n setStartPos(alignTo); // Data sorting\n // Align the label to the adjusted box with for unrotated bBox due\n // to rotationOrigin, which is based on unrotated label\n dataLabel.align(merge(options, {\n width: unrotatedbBox.width,\n height: unrotatedbBox.height\n }), false, alignTo, false);\n dataLabel.alignAttr.x += alignFactor *\n (unrotatedbBox.width - bBox.width);\n dataLabel.alignAttr.y += verticalAlignFactor *\n (unrotatedbBox.height - bBox.height);\n dataLabel[dataLabel.placed ? 'animate' : 'attr']({\n x: dataLabel.alignAttr.x +\n (bBox.width - unrotatedbBox.width) / 2,\n y: dataLabel.alignAttr.y +\n (bBox.height - unrotatedbBox.height) / 2,\n rotationOriginX: (dataLabel.width || 0) / 2,\n rotationOriginY: (dataLabel.height || 0) / 2\n });\n // Uncomment this block to visualize the bounding boxes used for\n // determining visibility\n // chart.renderer.rect(\n // (dataLabel.alignAttr.x || 0) + chart.plotLeft,\n // (dataLabel.alignAttr.y || 0) + chart.plotTop,\n // bBox.width,\n // bBox.height\n // ).attr({\n // stroke: 'rgba(0, 0, 0, 0.3)',\n // 'stroke-width': 1,\n // zIndex: 20\n // }).add();\n // chart.renderer.circle(\n // chart.plotLeft + pick(dataLabel.alignAttr.x, 0),\n // chart.plotTop + pick(dataLabel.alignAttr.y, 0),\n // 2\n // ).attr({\n // fill: 'red',\n // zIndex: 20\n // }).add();\n if (justify && alignTo.height >= 0) { // #8830\n this.justifyDataLabel(dataLabel, options, dataLabel.alignAttr, bBox, alignTo, isNew);\n }\n else if (pick(options.crop, true)) {\n const { x, y } = dataLabel.alignAttr, correction = 1;\n // Check if the dataLabel should be visible.\n visible =\n chart.isInsidePlot(x, y, {\n paneCoordinates: true,\n series\n }) &&\n chart.isInsidePlot(x + bBox.width - correction, y + bBox.height - correction, {\n paneCoordinates: true,\n series\n });\n }\n // When we're using a shape, make it possible with a connector or an\n // arrow pointing to this point\n if (options.shape && !rotation) {\n dataLabel[isNew ? 'attr' : 'animate']({\n anchorX: pos[0],\n anchorY: pos[1]\n });\n }\n }\n // To use alignAttr property in hideOverlappingLabels\n if (isNew && enabledDataSorting) {\n dataLabel.placed = false;\n }\n // Show or hide based on the final aligned position\n if (!visible && (!enabledDataSorting || justify)) {\n dataLabel.hide();\n dataLabel.placed = false; // Don't animate back in\n }\n else {\n dataLabel.show();\n dataLabel.placed = true; // Flag for overlapping logic\n }\n }\n /**\n * Handle the dataLabels.filter option.\n * @private\n */\n function applyFilter(point, options) {\n const filter = options.filter;\n if (filter) {\n const op = filter.operator, prop = point[filter.property], val = filter.value;\n if ((op === '>' && prop > val) ||\n (op === '<' && prop < val) ||\n (op === '>=' && prop >= val) ||\n (op === '<=' && prop <= val) ||\n (op === '==' && prop == val) || // eslint-disable-line eqeqeq\n (op === '===' && prop === val) ||\n (op === '!=' && prop != val) || // eslint-disable-line eqeqeq\n (op === '!==' && prop !== val)) {\n return true;\n }\n return false;\n }\n return true;\n }\n /**\n * @private\n */\n function compose(SeriesClass) {\n const seriesProto = SeriesClass.prototype;\n if (!seriesProto.initDataLabels) {\n seriesProto.initDataLabels = initDataLabels;\n seriesProto.initDataLabelsGroup = initDataLabelsGroup;\n seriesProto.alignDataLabel = alignDataLabel;\n seriesProto.drawDataLabels = drawDataLabels;\n seriesProto.justifyDataLabel = justifyDataLabel;\n seriesProto.setDataLabelStartPos = setDataLabelStartPos;\n seriesProto.hasDataLabels = hasDataLabels;\n }\n }\n DataLabel.compose = compose;\n /**\n * Create the SVGElement group for dataLabels\n * @private\n */\n function initDataLabelsGroup() {\n return this.plotGroup('dataLabelsGroup', 'data-labels', this.hasRendered ? 'inherit' : 'hidden', // #5133, #10220\n this.options.dataLabels.zIndex || 6);\n }\n /**\n * Init the data labels with the correct animation\n * @private\n */\n function initDataLabels(animationConfig) {\n const series = this, hasRendered = series.hasRendered || 0;\n // Create a separate group for the data labels to avoid rotation\n const dataLabelsGroup = this.initDataLabelsGroup()\n .attr({ opacity: +hasRendered }); // #3300\n if (!hasRendered && dataLabelsGroup) {\n if (series.visible) { // #2597, #3023, #3024\n dataLabelsGroup.show();\n }\n if (series.options.animation) {\n dataLabelsGroup.animate({ opacity: 1 }, animationConfig);\n }\n else {\n dataLabelsGroup.attr({ opacity: 1 });\n }\n }\n return dataLabelsGroup;\n }\n /**\n * Draw the data labels\n * @private\n */\n function drawDataLabels(points) {\n points = points || this.points;\n const series = this, chart = series.chart, seriesOptions = series.options, renderer = chart.renderer, { backgroundColor, plotBackgroundColor } = chart.options.chart, contrastColor = renderer.getContrast((isString(plotBackgroundColor) && plotBackgroundColor) ||\n (isString(backgroundColor) && backgroundColor) ||\n \"#000000\" /* Palette.neutralColor100 */), seriesDlOptions = mergedDataLabelOptions(series);\n let pointOptions, dataLabelsGroup;\n // Resolve the animation\n const { animation, defer } = seriesDlOptions[0], animationConfig = defer ?\n getDeferredAnimation(chart, animation, series) :\n { defer: 0, duration: 0 };\n fireEvent(this, 'drawDataLabels');\n if (series.hasDataLabels?.()) {\n dataLabelsGroup = this.initDataLabels(animationConfig);\n // Make the labels for each point\n points.forEach((point) => {\n const dataLabels = point.dataLabels || [];\n // Merge in series options for the point.\n // @note dataLabelAttribs (like pointAttribs) would eradicate\n // the need for dlOptions, and simplify the section below.\n pointOptions = splat(mergeArrays(seriesDlOptions, \n // The dlOptions prop is used in treemaps\n point.dlOptions || point.options?.dataLabels));\n // Handle each individual data label for this point\n pointOptions.forEach((labelOptions, i) => {\n // Options for one datalabel\n const labelEnabled = (labelOptions.enabled &&\n (point.visible || point.dataLabelOnHidden) &&\n // #2282, #4641, #7112, #10049\n (!point.isNull || point.dataLabelOnNull) &&\n applyFilter(point, labelOptions)), { backgroundColor, borderColor, distance, style = {} } = labelOptions;\n let labelConfig, formatString, labelText, rotation, attr = {}, dataLabel = dataLabels[i], isNew = !dataLabel, labelBgColor;\n if (labelEnabled) {\n // Create individual options structure that can be\n // extended without affecting others\n formatString = pick(labelOptions[point.formatPrefix + 'Format'], labelOptions.format);\n labelConfig = point.getLabelConfig();\n labelText = defined(formatString) ?\n format(formatString, labelConfig, chart) :\n (labelOptions[point.formatPrefix + 'Formatter'] ||\n labelOptions.formatter).call(labelConfig, labelOptions);\n rotation = labelOptions.rotation;\n if (!chart.styledMode) {\n // Determine the color\n style.color = pick(labelOptions.color, style.color, isString(series.color) ? series.color : void 0, \"#000000\" /* Palette.neutralColor100 */);\n // Get automated contrast color\n if (style.color === 'contrast') {\n if (backgroundColor !== 'none') {\n labelBgColor = backgroundColor;\n }\n point.contrastColor = renderer.getContrast(labelBgColor !== 'auto' && labelBgColor ||\n (point.color || series.color));\n style.color = (labelBgColor || // #20007\n (!defined(distance) &&\n labelOptions.inside) ||\n pInt(distance || 0) < 0 ||\n seriesOptions.stacking) ?\n point.contrastColor :\n contrastColor;\n }\n else {\n delete point.contrastColor;\n }\n if (seriesOptions.cursor) {\n style.cursor = seriesOptions.cursor;\n }\n }\n attr = {\n r: labelOptions.borderRadius || 0,\n rotation,\n padding: labelOptions.padding,\n zIndex: 1\n };\n if (!chart.styledMode) {\n attr.fill = backgroundColor === 'auto' ?\n point.color :\n backgroundColor;\n attr.stroke = borderColor === 'auto' ?\n point.color :\n borderColor;\n attr['stroke-width'] = labelOptions.borderWidth;\n }\n // Remove unused attributes (#947)\n objectEach(attr, (val, name) => {\n if (typeof val === 'undefined') {\n delete attr[name];\n }\n });\n }\n // If the point is outside the plot area, or the label\n // changes properties that we cannot change, destroy it and\n // build a new one below. #678, #820.\n if (dataLabel && (!labelEnabled ||\n !defined(labelText) ||\n !!dataLabel.div !== !!labelOptions.useHTML ||\n (\n // Change from no rotation to rotation and\n // vice versa. Don't use defined() because\n // rotation = 0 means also rotation = undefined\n (!dataLabel.rotation ||\n !labelOptions.rotation) &&\n dataLabel.rotation !== labelOptions.rotation))) {\n dataLabel = void 0;\n isNew = true;\n }\n // Individual labels are disabled if the are explicitly\n // disabled in the point options, or if they fall outside\n // the plot area.\n if (labelEnabled && defined(labelText)) {\n if (!dataLabel) {\n // Create new label element\n dataLabel = renderer.label(labelText, 0, 0, labelOptions.shape, void 0, void 0, labelOptions.useHTML, void 0, 'data-label');\n dataLabel.addClass(' highcharts-data-label-color-' +\n point.colorIndex +\n ' ' + (labelOptions.className || '') +\n ( // #3398\n labelOptions.useHTML ?\n ' highcharts-tracker' :\n ''));\n }\n else {\n // Use old element and just update text\n attr.text = labelText;\n }\n // Store data label options for later access\n if (dataLabel) {\n dataLabel.options = labelOptions;\n dataLabel.attr(attr);\n if (!chart.styledMode) {\n // Styles must be applied before add in order to\n // read text bounding box\n dataLabel.css(style).shadow(labelOptions.shadow);\n }\n const textPathOptions = labelOptions[point.formatPrefix + 'TextPath'] || labelOptions.textPath;\n if (textPathOptions && !labelOptions.useHTML) {\n dataLabel.setTextPath(point.getDataLabelPath?.(dataLabel) ||\n point.graphic, textPathOptions);\n if (point.dataLabelPath &&\n !textPathOptions.enabled) {\n // clean the DOM\n point.dataLabelPath = (point.dataLabelPath.destroy());\n }\n }\n if (!dataLabel.added) {\n dataLabel.add(dataLabelsGroup);\n }\n // Now the data label is created and placed at 0,0,\n // so we need to align it\n series.alignDataLabel(point, dataLabel, labelOptions, void 0, isNew);\n dataLabel.isActive = true;\n if (dataLabels[i] && dataLabels[i] !== dataLabel) {\n dataLabels[i].destroy();\n }\n dataLabels[i] = dataLabel;\n }\n }\n });\n // Destroy and remove the inactive ones\n let j = dataLabels.length;\n while (j--) {\n // The item can be undefined if a disabled data label is\n // succeeded by an enabled one (#19457)\n if (!dataLabels[j] || !dataLabels[j].isActive) {\n dataLabels[j]?.destroy();\n dataLabels.splice(j, 1);\n }\n else {\n dataLabels[j].isActive = false;\n }\n }\n // Write back\n point.dataLabel = dataLabels[0];\n point.dataLabels = dataLabels;\n });\n }\n fireEvent(this, 'afterDrawDataLabels');\n }\n /**\n * If data labels fall partly outside the plot area, align them back in, in\n * a way that doesn't hide the point.\n * @private\n */\n function justifyDataLabel(dataLabel, options, alignAttr, bBox, alignTo, isNew) {\n const chart = this.chart, align = options.align, verticalAlign = options.verticalAlign, padding = dataLabel.box ? 0 : (dataLabel.padding || 0);\n let { x = 0, y = 0 } = options, off, justified;\n // Off left\n off = (alignAttr.x || 0) + padding;\n if (off < 0) {\n if (align === 'right' && x >= 0) {\n options.align = 'left';\n options.inside = true;\n }\n else {\n x -= off;\n }\n justified = true;\n }\n // Off right\n off = (alignAttr.x || 0) + bBox.width - padding;\n if (off > chart.plotWidth) {\n if (align === 'left' && x <= 0) {\n options.align = 'right';\n options.inside = true;\n }\n else {\n x += chart.plotWidth - off;\n }\n justified = true;\n }\n // Off top\n off = alignAttr.y + padding;\n if (off < 0) {\n if (verticalAlign === 'bottom' && y >= 0) {\n options.verticalAlign = 'top';\n options.inside = true;\n }\n else {\n y -= off;\n }\n justified = true;\n }\n // Off bottom\n off = (alignAttr.y || 0) + bBox.height - padding;\n if (off > chart.plotHeight) {\n if (verticalAlign === 'top' && y <= 0) {\n options.verticalAlign = 'bottom';\n options.inside = true;\n }\n else {\n y += chart.plotHeight - off;\n }\n justified = true;\n }\n if (justified) {\n options.x = x;\n options.y = y;\n dataLabel.placed = !isNew;\n dataLabel.align(options, void 0, alignTo);\n }\n return justified;\n }\n /**\n * Merge two objects that can be arrays. If one of them is an array, the\n * other is merged into each element. If both are arrays, each element is\n * merged by index. If neither are arrays, we use normal merge.\n * @private\n */\n function mergeArrays(one, two) {\n let res = [], i;\n if (isArray(one) && !isArray(two)) {\n res = one.map(function (el) {\n return merge(el, two);\n });\n }\n else if (isArray(two) && !isArray(one)) {\n res = two.map(function (el) {\n return merge(one, el);\n });\n }\n else if (!isArray(one) && !isArray(two)) {\n res = merge(one, two);\n }\n else if (isArray(one) && isArray(two)) {\n i = Math.max(one.length, two.length);\n while (i--) {\n res[i] = merge(one[i], two[i]);\n }\n }\n return res;\n }\n /**\n * Merge plotOptions and series options for dataLabels.\n * @private\n */\n function mergedDataLabelOptions(series) {\n const plotOptions = series.chart.options.plotOptions;\n return splat(mergeArrays(mergeArrays(plotOptions?.series?.dataLabels, plotOptions?.[series.type]?.dataLabels), series.options.dataLabels));\n }\n /**\n * Set starting position for data label sorting animation.\n * @private\n */\n function setDataLabelStartPos(point, dataLabel, isNew, isInside, alignOptions) {\n const chart = this.chart, inverted = chart.inverted, xAxis = this.xAxis, reversed = xAxis.reversed, labelCenter = ((inverted ? dataLabel.height : dataLabel.width) || 0) / 2, pointWidth = point.pointWidth, halfWidth = pointWidth ? pointWidth / 2 : 0;\n dataLabel.startXPos = inverted ?\n alignOptions.x :\n (reversed ?\n -labelCenter - halfWidth :\n xAxis.width - labelCenter + halfWidth);\n dataLabel.startYPos = inverted ?\n (reversed ?\n this.yAxis.height - labelCenter + halfWidth :\n -labelCenter - halfWidth) : alignOptions.y;\n // We need to handle visibility in case of sorting point outside plot\n // area\n if (!isInside) {\n dataLabel\n .attr({ opacity: 1 })\n .animate({ opacity: 0 }, void 0, dataLabel.hide);\n }\n else if (dataLabel.visibility === 'hidden') {\n dataLabel.show();\n dataLabel\n .attr({ opacity: 0 })\n .animate({ opacity: 1 });\n }\n // Save start position on first render, but do not change position\n if (!chart.hasRendered) {\n return;\n }\n // Set start position\n if (isNew) {\n dataLabel.attr({ x: dataLabel.startXPos, y: dataLabel.startYPos });\n }\n dataLabel.placed = true;\n }\n})(DataLabel || (DataLabel = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default DataLabel;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Callback JavaScript function to format the data label as a string. Note that\n * if a `format` is defined, the format takes precedence and the formatter is\n * ignored.\n *\n * @callback Highcharts.DataLabelsFormatterCallbackFunction\n *\n * @param {Highcharts.PointLabelObject} this\n * Data label context to format\n *\n * @param {Highcharts.DataLabelsOptions} options\n * [API options](/highcharts/plotOptions.series.dataLabels) of the data label\n *\n * @return {number|string|null|undefined}\n * Formatted data label text\n */\n/**\n * Values for handling data labels that flow outside the plot area.\n *\n * @typedef {\"allow\"|\"justify\"} Highcharts.DataLabelsOverflowValue\n */\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport DataLabel from '../../Core/Series/DataLabel.js';\nimport H from '../../Core/Globals.js';\nconst { composed } = H;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { series: Series } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { merge, pick, pushUnique } = U;\n/* *\n *\n * Composition\n *\n * */\nvar ColumnDataLabel;\n(function (ColumnDataLabel) {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Override the basic data label alignment by adjusting for the position of\n * the column.\n * @private\n */\n function alignDataLabel(point, dataLabel, options, alignTo, isNew) {\n const inverted = this.chart.inverted, series = point.series, xLen = (series.xAxis ? series.xAxis.len : this.chart.plotSizeX) || 0, yLen = (series.yAxis ? series.yAxis.len : this.chart.plotSizeY) || 0, \n // Data label box for alignment\n dlBox = point.dlBox || point.shapeArgs, below = pick(point.below, // Range series\n point.plotY >\n pick(this.translatedThreshold, yLen)), \n // Draw it inside the box?\n inside = pick(options.inside, !!this.options.stacking);\n // Align to the column itself, or the top of it\n if (dlBox) { // Area range uses this method but not alignTo\n alignTo = merge(dlBox);\n // Check for specific overflow and crop conditions (#13240)\n if (!(options.overflow === 'allow' && options.crop === false)) {\n if (alignTo.y < 0) {\n alignTo.height += alignTo.y;\n alignTo.y = 0;\n }\n // If parts of the box overshoots outside the plot area, modify\n // the box to center the label inside\n const overshoot = alignTo.y + alignTo.height - yLen;\n if (overshoot > 0 && overshoot < alignTo.height) {\n alignTo.height -= overshoot;\n }\n }\n if (inverted) {\n alignTo = {\n x: yLen - alignTo.y - alignTo.height,\n y: xLen - alignTo.x - alignTo.width,\n width: alignTo.height,\n height: alignTo.width\n };\n }\n // Compute the alignment box\n if (!inside) {\n if (inverted) {\n alignTo.x += below ? 0 : alignTo.width;\n alignTo.width = 0;\n }\n else {\n alignTo.y += below ? alignTo.height : 0;\n alignTo.height = 0;\n }\n }\n }\n // When alignment is undefined (typically columns and bars), display the\n // individual point below or above the point depending on the threshold\n options.align = pick(options.align, !inverted || inside ? 'center' : below ? 'right' : 'left');\n options.verticalAlign = pick(options.verticalAlign, inverted || inside ? 'middle' : below ? 'top' : 'bottom');\n // Call the parent method\n Series.prototype.alignDataLabel.call(this, point, dataLabel, options, alignTo, isNew);\n // If label was justified and we have contrast, set it:\n if (options.inside && point.contrastColor) {\n dataLabel.css({\n color: point.contrastColor\n });\n }\n }\n /** @private */\n function compose(ColumnSeriesClass) {\n DataLabel.compose(Series);\n if (pushUnique(composed, 'ColumnDataLabel')) {\n ColumnSeriesClass.prototype.alignDataLabel = alignDataLabel;\n }\n }\n ColumnDataLabel.compose = compose;\n})(ColumnDataLabel || (ColumnDataLabel = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnDataLabel;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport ColumnSeries from '../Column/ColumnSeries.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nimport U from '../../Core/Utilities.js';\nconst { extend, merge } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * Bar series type.\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.bar\n *\n * @augments Highcharts.Series\n */\nclass BarSeries extends ColumnSeries {\n}\n/* *\n *\n * Static Properties\n *\n * */\n/**\n * A bar series is a special type of column series where the columns are\n * horizontal.\n *\n * @sample highcharts/demo/bar-basic/\n * Bar chart\n *\n * @extends plotOptions.column\n * @product highcharts\n * @optionparent plotOptions.bar\n */\nBarSeries.defaultOptions = merge(ColumnSeries.defaultOptions, {\n// nothing here yet\n});\nextend(BarSeries.prototype, {\n inverted: true\n});\nSeriesRegistry.registerSeriesType('bar', BarSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default BarSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * A `bar` series. If the [type](#series.bar.type) option is not specified,\n * it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.bar\n * @excluding connectNulls, dashStyle, dataParser, dataURL, gapSize, gapUnit,\n * linecap, lineWidth, marker, connectEnds, step\n * @product highcharts\n * @apioption series.bar\n */\n/**\n * An array of data points for the series. For the `bar` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 5],\n * [1, 10],\n * [2, 3]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.bar.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 1,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 10,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.column.data\n * @product highcharts\n * @apioption series.bar.data\n */\n/**\n * @excluding halo,lineWidth,lineWidthPlus,marker\n * @product highcharts highstock\n * @apioption series.bar.states.hover\n */\n/**\n * @excluding halo,lineWidth,lineWidthPlus,marker\n * @product highcharts highstock\n * @apioption series.bar.states.select\n */\n''; // gets doclets above into transpiled\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * A scatter plot uses cartesian coordinates to display values for two\n * variables for a set of data.\n *\n * @sample {highcharts} highcharts/demo/scatter/\n * Scatter plot\n *\n * @extends plotOptions.line\n * @excluding cropThreshold, pointPlacement, shadow, useOhlcData\n * @product highcharts highstock\n * @optionparent plotOptions.scatter\n */\nconst ScatterSeriesDefaults = {\n /**\n * The width of the line connecting the data points.\n *\n * @sample {highcharts} highcharts/plotoptions/scatter-linewidth-none/\n * 0 by default\n * @sample {highcharts} highcharts/plotoptions/scatter-linewidth-1/\n * 1px\n *\n * @product highcharts highstock\n */\n lineWidth: 0,\n findNearestPointBy: 'xy',\n /**\n * Apply a jitter effect for the rendered markers. When plotting\n * discrete values, a little random noise may help telling the points\n * apart. The jitter setting applies a random displacement of up to `n`\n * axis units in either direction. So for example on a horizontal X\n * axis, setting the `jitter.x` to 0.24 will render the point in a\n * random position between 0.24 units to the left and 0.24 units to the\n * right of the true axis position. On a category axis, setting it to\n * 0.5 will fill up the bin and make the data appear continuous.\n *\n * When rendered on top of a box plot or a column series, a jitter value\n * of 0.24 will correspond to the underlying series' default\n * [groupPadding](\n * https://api.highcharts.com/highcharts/plotOptions.column.groupPadding)\n * and [pointPadding](\n * https://api.highcharts.com/highcharts/plotOptions.column.pointPadding)\n * settings.\n *\n * **Note:** With boost mode enabled, the jitter effect is not supported.\n *\n * @sample {highcharts} highcharts/demo/scatter-jitter\n * Jitter on a scatter plot\n *\n * @sample {highcharts} highcharts/series-scatter/jitter-boxplot\n * Jittered scatter plot on top of a box plot\n *\n * @product highcharts highstock\n * @since 7.0.2\n */\n jitter: {\n /**\n * The maximal X offset for the random jitter effect.\n */\n x: 0,\n /**\n * The maximal Y offset for the random jitter effect.\n */\n y: 0\n },\n marker: {\n enabled: true // Overrides auto-enabling in line series (#3647)\n },\n /**\n * Sticky tracking of mouse events. When true, the `mouseOut` event\n * on a series isn't triggered until the mouse moves over another\n * series, or out of the plot area. When false, the `mouseOut` event on\n * a series is triggered when the mouse leaves the area around the\n * series' graph or markers. This also implies the tooltip. When\n * `stickyTracking` is false and `tooltip.shared` is false, the tooltip\n * will be hidden when moving the mouse between series.\n *\n * @type {boolean}\n * @default false\n * @product highcharts highstock highmaps\n * @apioption plotOptions.scatter.stickyTracking\n */\n /**\n * A configuration object for the tooltip rendering of each single\n * series. Properties are inherited from [tooltip](#tooltip).\n * Overridable properties are `headerFormat`, `pointFormat`,\n * `yDecimals`, `xDateFormat`, `yPrefix` and `ySuffix`. Unlike other\n * series, in a scatter plot the series.name by default shows in the\n * headerFormat and point.x and point.y in the pointFormat.\n *\n * @product highcharts highstock highmaps\n */\n tooltip: {\n /**\n * @product highcharts highstock\n */\n headerFormat: '\\u25CF ' +\n ' {series.name}
',\n pointFormat: 'x: {point.x}
y: {point.y}
'\n }\n};\n/**\n * A `scatter` series. If the [type](#series.scatter.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.scatter\n * @excluding cropThreshold, dataParser, dataURL, useOhlcData\n * @product highcharts highstock\n * @apioption series.scatter\n */\n/**\n * An array of data points for the series. For the `scatter` series\n * type, points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 0],\n * [1, 8],\n * [2, 9]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.scatter.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 2,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 4,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @product highcharts highstock\n * @apioption series.scatter.data\n */\n''; // keeps doclets above in JS file\n/* *\n *\n * Default Export\n *\n * */\nexport default ScatterSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport ScatterSeriesDefaults from './ScatterSeriesDefaults.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { column: ColumnSeries, line: LineSeries } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, extend, merge } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * Scatter series type.\n *\n * @private\n */\nclass ScatterSeries extends LineSeries {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Optionally add the jitter effect.\n * @private\n */\n applyJitter() {\n const series = this, jitter = this.options.jitter, len = this.points.length;\n /**\n * Return a repeatable, pseudo-random number based on an integer\n * seed.\n * @private\n */\n function unrandom(seed) {\n const rand = Math.sin(seed) * 10000;\n return rand - Math.floor(rand);\n }\n if (jitter) {\n this.points.forEach(function (point, i) {\n ['x', 'y'].forEach(function (dim, j) {\n let axis, plotProp = 'plot' + dim.toUpperCase(), min, max, translatedJitter;\n if (jitter[dim] && !point.isNull) {\n axis = series[dim + 'Axis'];\n translatedJitter =\n jitter[dim] * axis.transA;\n if (axis && !axis.isLog) {\n // Identify the outer bounds of the jitter range\n min = Math.max(0, point[plotProp] - translatedJitter);\n max = Math.min(axis.len, point[plotProp] + translatedJitter);\n // Find a random position within this range\n point[plotProp] = min +\n (max - min) * unrandom(i + j * len);\n // Update clientX for the tooltip k-d-tree\n if (dim === 'x') {\n point.clientX = point.plotX;\n }\n }\n }\n });\n });\n }\n }\n /**\n * @private\n */\n drawGraph() {\n if (this.options.lineWidth) {\n super.drawGraph();\n }\n else if (this.graph) {\n this.graph = this.graph.destroy();\n }\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nScatterSeries.defaultOptions = merge(LineSeries.defaultOptions, ScatterSeriesDefaults);\nextend(ScatterSeries.prototype, {\n drawTracker: ColumnSeries.prototype.drawTracker,\n sorted: false,\n requireSorting: false,\n noSharedTooltip: true,\n trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup']\n});\n/* *\n *\n * Events\n *\n * */\n/* eslint-disable no-invalid-this */\naddEvent(ScatterSeries, 'afterTranslate', function () {\n this.applyJitter();\n});\nSeriesRegistry.registerSeriesType('scatter', ScatterSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default ScatterSeries;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Core/Globals.js';\nconst { deg2rad } = H;\nimport Series from '../Core/Series/Series.js';\nimport U from '../Core/Utilities.js';\nconst { fireEvent, isNumber, pick, relativeLength } = U;\n/**\n * @private\n */\nvar CenteredUtilities;\n(function (CenteredUtilities) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Get the center of the pie based on the size and center options relative\n * to the plot area. Borrowed by the polar and gauge series types.\n *\n * @private\n * @function Highcharts.CenteredSeriesMixin.getCenter\n */\n function getCenter() {\n const options = this.options, chart = this.chart, slicingRoom = 2 * (options.slicedOffset || 0), plotWidth = chart.plotWidth - 2 * slicingRoom, plotHeight = chart.plotHeight - 2 * slicingRoom, centerOption = options.center, smallestSize = Math.min(plotWidth, plotHeight), thickness = options.thickness;\n let handleSlicingRoom, size = options.size, innerSize = options.innerSize || 0, i, value;\n if (typeof size === 'string') {\n size = parseFloat(size);\n }\n if (typeof innerSize === 'string') {\n innerSize = parseFloat(innerSize);\n }\n const positions = [\n pick(centerOption[0], '50%'),\n pick(centerOption[1], '50%'),\n // Prevent from negative values\n pick(size && size < 0 ? void 0 : options.size, '100%'),\n pick(innerSize && innerSize < 0 ? void 0 : options.innerSize || 0, '0%')\n ];\n // No need for inner size in angular (gauges) series but still required\n // for pie series\n if (chart.angular && !(this instanceof Series)) {\n positions[3] = 0;\n }\n for (i = 0; i < 4; ++i) {\n value = positions[i];\n handleSlicingRoom = i < 2 || (i === 2 && /%$/.test(value));\n // i == 0: centerX, relative to width\n // i == 1: centerY, relative to height\n // i == 2: size, relative to smallestSize\n // i == 3: innerSize, relative to size\n positions[i] = relativeLength(value, [plotWidth, plotHeight, smallestSize, positions[2]][i]) + (handleSlicingRoom ? slicingRoom : 0);\n }\n // innerSize cannot be larger than size (#3632)\n if (positions[3] > positions[2]) {\n positions[3] = positions[2];\n }\n // thickness overrides innerSize, need to be less than pie size (#6647)\n if (isNumber(thickness) &&\n thickness * 2 < positions[2] && thickness > 0) {\n positions[3] = positions[2] - thickness * 2;\n }\n fireEvent(this, 'afterGetCenter', { positions });\n return positions;\n }\n CenteredUtilities.getCenter = getCenter;\n /**\n * getStartAndEndRadians - Calculates start and end angles in radians.\n * Used in series types such as pie and sunburst.\n *\n * @private\n * @function Highcharts.CenteredSeriesMixin.getStartAndEndRadians\n *\n * @param {number} [start]\n * Start angle in degrees.\n *\n * @param {number} [end]\n * Start angle in degrees.\n *\n * @return {Highcharts.RadianAngles}\n * Returns an object containing start and end angles as radians.\n */\n function getStartAndEndRadians(start, end) {\n const startAngle = isNumber(start) ? start : 0, // must be a number\n endAngle = ((isNumber(end) && // must be a number\n end > startAngle && // must be larger than the start angle\n // difference must be less than 360 degrees\n (end - startAngle) < 360) ?\n end :\n startAngle + 360), correction = -90;\n return {\n start: deg2rad * (startAngle + correction),\n end: deg2rad * (endAngle + correction)\n };\n }\n CenteredUtilities.getStartAndEndRadians = getStartAndEndRadians;\n})(CenteredUtilities || (CenteredUtilities = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default CenteredUtilities;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * @private\n * @interface Highcharts.RadianAngles\n */ /**\n* @name Highcharts.RadianAngles#end\n* @type {number}\n*/ /**\n* @name Highcharts.RadianAngles#start\n* @type {number}\n*/\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../../Core/Animation/AnimationUtilities.js';\nconst { setAnimation } = A;\nimport Point from '../../Core/Series/Point.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, defined, extend, isNumber, pick, relativeLength } = U;\n/* *\n *\n * Class\n *\n * */\nclass PiePoint extends Point {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Extendable method for getting the path of the connector between the\n * data label and the pie slice.\n * @private\n */\n getConnectorPath(dataLabel) {\n const labelPosition = dataLabel.dataLabelPosition, options = (dataLabel.options || {}), connectorShape = options.connectorShape, shapeFunc = (this.connectorShapes[connectorShape] || connectorShape);\n return labelPosition && shapeFunc.call(this, {\n // Pass simplified label position object for user's convenience\n ...labelPosition.computed,\n alignment: labelPosition.alignment\n }, labelPosition.connectorPosition, options) || [];\n }\n /**\n * @private\n */\n getTranslate() {\n return this.sliced && this.slicedTranslation || {\n translateX: 0,\n translateY: 0\n };\n }\n /**\n * @private\n */\n haloPath(size) {\n const shapeArgs = this.shapeArgs;\n return this.sliced || !this.visible ?\n [] :\n this.series.chart.renderer.symbols.arc(shapeArgs.x, shapeArgs.y, shapeArgs.r + size, shapeArgs.r + size, {\n // Substract 1px to ensure the background is not bleeding\n // through between the halo and the slice (#7495).\n innerR: shapeArgs.r - 1,\n start: shapeArgs.start,\n end: shapeArgs.end,\n borderRadius: shapeArgs.borderRadius\n });\n }\n /**\n * Initialize the pie slice.\n * @private\n */\n constructor(series, options, x) {\n super(series, options, x);\n this.half = 0;\n this.name ?? (this.name = 'Slice');\n // Add event listener for select\n const toggleSlice = (e) => {\n this.slice(e.type === 'select');\n };\n addEvent(this, 'select', toggleSlice);\n addEvent(this, 'unselect', toggleSlice);\n }\n /**\n * Negative points are not valid (#1530, #3623, #5322)\n * @private\n */\n isValid() {\n return isNumber(this.y) && this.y >= 0;\n }\n /**\n * Toggle the visibility of a pie slice or other data point. Note that this\n * method is available only for some series, like pie, treemap and sunburst.\n *\n * @function Highcharts.Point#setVisible\n *\n * @param {boolean} [vis]\n * True to show the pie slice or other data point, false to hide. If\n * undefined, the visibility is toggled.\n *\n * @param {boolean} [redraw] Whether to redraw the chart after the point is\n * altered. If doing more operations on the chart, it is a good idea to set\n * redraw to false and call {@link Chart#redraw|chart.redraw()} after.\n *\n */\n setVisible(vis, redraw = true) {\n if (vis !== this.visible) {\n // If called without an argument, toggle visibility\n this.update({\n visible: vis ?? !this.visible\n }, redraw, void 0, false);\n }\n }\n /**\n * Set or toggle whether the slice is cut out from the pie.\n * @private\n *\n * @param {boolean} sliced\n * When undefined, the slice state is toggled.\n *\n * @param {boolean} [redraw]\n * Whether to redraw the chart. True by default.\n *\n * @param {boolean|Partial} [animation]\n * Animation options.\n */\n slice(sliced, redraw, animation) {\n const series = this.series, chart = series.chart;\n setAnimation(animation, chart);\n // redraw is true by default\n redraw = pick(redraw, true);\n /**\n * Pie series only. Whether to display a slice offset from the\n * center.\n * @name Highcharts.Point#sliced\n * @type {boolean|undefined}\n */\n // if called without an argument, toggle\n this.sliced = this.options.sliced = sliced =\n defined(sliced) ? sliced : !this.sliced;\n // update userOptions.data\n series.options.data[series.data.indexOf(this)] =\n this.options;\n if (this.graphic) {\n this.graphic.animate(this.getTranslate());\n }\n }\n}\nextend(PiePoint.prototype, {\n connectorShapes: {\n // only one available before v7.0.0\n fixedOffset: function (labelPosition, connectorPosition, options) {\n const breakAt = connectorPosition.breakAt, touchingSliceAt = connectorPosition.touchingSliceAt, lineSegment = options.softConnector ? [\n 'C',\n // 1st control point (of the curve)\n labelPosition.x +\n // 5 gives the connector a little horizontal bend\n (labelPosition.alignment === 'left' ? -5 : 5),\n labelPosition.y,\n 2 * breakAt.x - touchingSliceAt.x,\n 2 * breakAt.y - touchingSliceAt.y,\n breakAt.x,\n breakAt.y //\n ] : [\n 'L',\n breakAt.x,\n breakAt.y\n ];\n // assemble the path\n return ([\n ['M', labelPosition.x, labelPosition.y],\n lineSegment,\n ['L', touchingSliceAt.x, touchingSliceAt.y]\n ]);\n },\n straight: function (labelPosition, connectorPosition) {\n const touchingSliceAt = connectorPosition.touchingSliceAt;\n // direct line to the slice\n return [\n ['M', labelPosition.x, labelPosition.y],\n ['L', touchingSliceAt.x, touchingSliceAt.y]\n ];\n },\n crookedLine: function (labelPosition, connectorPosition, options) {\n const { breakAt, touchingSliceAt } = connectorPosition, { series } = this, [cx, cy, diameter] = series.center, r = diameter / 2, { plotLeft, plotWidth } = series.chart, leftAligned = labelPosition.alignment === 'left', { x, y } = labelPosition;\n let crookX = breakAt.x;\n if (options.crookDistance) {\n const crookDistance = relativeLength(// % to fraction\n options.crookDistance, 1);\n crookX = leftAligned ?\n cx +\n r +\n (plotWidth + plotLeft - cx - r) * (1 - crookDistance) :\n plotLeft + (cx - r) * crookDistance;\n // When the crookDistance option is undefined, make the bend in the\n // intersection between the radial line in the middle of the slice,\n // and the extension of the label position.\n }\n else {\n crookX = cx + (cy - y) * Math.tan((this.angle || 0) - Math.PI / 2);\n }\n const path = [['M', x, y]];\n // The crookedLine formula doesn't make sense if the path overlaps\n // the label - use straight line instead in that case\n if (leftAligned ?\n (crookX <= x && crookX >= breakAt.x) :\n (crookX >= x && crookX <= breakAt.x)) {\n path.push(['L', crookX, y]);\n }\n path.push(['L', breakAt.x, breakAt.y], ['L', touchingSliceAt.x, touchingSliceAt.y]);\n return path;\n }\n }\n});\n/* *\n *\n * Default Export\n *\n * */\nexport default PiePoint;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * A pie chart is a circular graphic which is divided into slices to\n * illustrate numerical proportion.\n *\n * @sample highcharts/demo/pie-chart/\n * Pie chart\n *\n * @extends plotOptions.line\n * @excluding animationLimit, boostThreshold, connectEnds, connectNulls,\n * cropThreshold, dashStyle, dataSorting, dragDrop,\n * findNearestPointBy, getExtremesFromAll, label, lineWidth,\n * linkedTo, marker, negativeColor, pointInterval,\n * pointIntervalUnit, pointPlacement, pointStart,\n * softThreshold, stacking, step, threshold, turboThreshold,\n * zoneAxis, zones, dataSorting, boostBlending\n * @product highcharts highmaps\n * @optionparent plotOptions.pie\n *\n * @private\n */\nconst PieSeriesDefaults = {\n /**\n * The corner radius of the border surrounding each slice. A number\n * signifies pixels. A percentage string, like for example `50%`, signifies\n * a size relative to the radius and the inner radius.\n *\n * @sample highcharts/plotoptions/series-border-radius\n * Column and pie with rounded border\n *\n * @since 11.0.0\n *\n * @type {number|string|Highcharts.BorderRadiusOptionsObject}\n */\n borderRadius: 3,\n /**\n * @excluding legendItemClick\n * @apioption plotOptions.pie.events\n */\n /**\n * Fires when the checkbox next to the point name in the legend is\n * clicked. One parameter, event, is passed to the function. The state\n * of the checkbox is found by event.checked. The checked item is found\n * by event.item. Return false to prevent the default action which is to\n * toggle the select state of the series.\n *\n * @sample {highcharts} highcharts/plotoptions/series-events-checkboxclick/\n * Alert checkbox status\n *\n * @type {Function}\n * @since 1.2.0\n * @product highcharts highmaps\n * @context Highcharts.Point\n * @apioption plotOptions.pie.events.checkboxClick\n */\n /**\n * Fires when the legend item belonging to the pie point (slice) is\n * clicked. The `this` keyword refers to the point itself. One\n * parameter, `event`, is passed to the function, containing common\n * event information. The default action is to toggle the visibility of\n * the point. This can be prevented by calling `event.preventDefault()`.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-point-events-legenditemclick/\n * Confirm toggle visibility\n *\n * @type {Highcharts.PointLegendItemClickCallbackFunction}\n * @since 1.2.0\n * @product highcharts highmaps\n * @apioption plotOptions.pie.point.events.legendItemClick\n */\n /**\n * The center of the pie chart relative to the plot area. Can be\n * percentages or pixel values. The default behaviour (as of 3.0) is to\n * center the pie so that all slices and data labels are within the plot\n * area. As a consequence, the pie may actually jump around in a chart\n * with dynamic values, as the data labels move. In that case, the\n * center should be explicitly set, for example to `[\"50%\", \"50%\"]`.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-center/\n * Centered at 100, 100\n *\n * @type {Array<(number|string|null),(number|string|null)>}\n * @default [null, null]\n * @product highcharts highmaps\n *\n * @private\n */\n center: [null, null],\n /**\n * The color of the pie series. A pie series is represented as an empty\n * circle if the total sum of its values is 0. Use this property to\n * define the color of its border.\n *\n * In styled mode, the color can be defined by the\n * [colorIndex](#plotOptions.series.colorIndex) option. Also, the series\n * color can be set with the `.highcharts-series`,\n * `.highcharts-color-{n}`, `.highcharts-{type}-series` or\n * `.highcharts-series-{n}` class, or individual classes given by the\n * `className` option.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-emptyseries/\n * Empty pie series\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default ${palette.neutralColor20}\n * @apioption plotOptions.pie.color\n */\n /**\n * @product highcharts\n *\n * @private\n */\n clip: false,\n /**\n * @ignore-option\n *\n * @private\n */\n colorByPoint: true,\n /**\n * A series specific or series type specific color set to use instead\n * of the global [colors](#colors).\n *\n * @sample {highcharts} highcharts/demo/pie-monochrome/\n * Set default colors for all pies\n *\n * @type {Array}\n * @since 3.0\n * @product highcharts highmaps\n * @apioption plotOptions.pie.colors\n */\n /**\n * @declare Highcharts.SeriesPieDataLabelsOptionsObject\n * @extends plotOptions.series.dataLabels\n * @excluding align, allowOverlap, inside, staggerLines, step\n * @private\n */\n dataLabels: {\n /**\n * Alignment method for data labels. Possible values are:\n *\n * - `plotEdges`: Each label touches the nearest vertical edge of\n * the plot area.\n *\n * - `connectors`: Connectors have the same x position and the\n * widest label of each half (left & right) touches the nearest\n * vertical edge of the plot area.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-alignto-connectors/\n * alignTo: connectors\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-alignto-plotedges/\n * alignTo: plotEdges\n *\n * @type {string}\n * @since 7.0.0\n * @product highcharts highmaps\n * @apioption plotOptions.pie.dataLabels.alignTo\n */\n /**\n * The color of the line connecting the data label to the pie slice.\n * The default color is the same as the point's color.\n *\n * In styled mode, the connector stroke is given in the\n * `.highcharts-data-label-connector` class.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorcolor/\n * Blue connectors\n * @sample {highcharts} highcharts/css/pie-point/\n * Styled connectors\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 2.1\n * @product highcharts highmaps\n * @apioption plotOptions.pie.dataLabels.connectorColor\n */\n /**\n * The distance from the data label to the connector. Note that\n * data labels also have a default `padding`, so in order for the\n * connector to touch the text, the `padding` must also be 0.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorpadding/\n * No padding\n *\n * @since 2.1\n * @product highcharts highmaps\n */\n connectorPadding: 5,\n /**\n * Specifies the method that is used to generate the connector path.\n * Highcharts provides 3 built-in connector shapes: `'crookedLine'`\n * (default since v11), `'fixedOffset'` and `'straight'`.\n *\n * Users can provide their own method by passing a function instead of a\n * string. Three arguments are passed to the callback:\n *\n * - An object that holds the information about the coordinates of the\n * label (`x` & `y` properties) and how the label is located in\n * relation to the pie (`alignment` property). `alignment` can by one\n * of the following: `'left'` (pie on the left side of the data\n * label), `'right'` (pie on the right side of the data label) or\n * `'center'` (data label overlaps the pie).\n *\n * - An object that holds the information about the position of the\n * connector. Its `touchingSliceAt` porperty tells the position of\n * the place where the connector touches the slice.\n *\n * - Data label options\n *\n * The function has to return an SVG path definition in array form (see\n * the example).\n *\n * @sample {highcharts}\n * highcharts/plotoptions/pie-datalabels-connectorshape-string/\n * connectorShape is a String\n * @sample {highcharts}\n * highcharts/plotoptions/pie-datalabels-connectorshape-function/\n * connectorShape is a function\n *\n * @type {string|Function}\n * @since 7.0.0\n * @product highcharts highmaps\n */\n connectorShape: 'crookedLine',\n /**\n * The width of the line connecting the data label to the pie slice.\n *\n * In styled mode, the connector stroke width is given in the\n * `.highcharts-data-label-connector` class.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorwidth-disabled/\n * Disable the connector\n * @sample {highcharts} highcharts/css/pie-point/\n * Styled connectors\n *\n * @type {number}\n * @default 1\n * @since 2.1\n * @product highcharts highmaps\n * @apioption plotOptions.pie.dataLabels.connectorWidth\n */\n /**\n * Works only if `connectorShape` is `'crookedLine'`. It defines how\n * far from the vertical plot edge the coonnector path should be\n * crooked. With the default, `undefined`, the crook is placed so that\n * the horizontal line from the label intersects with the radial line\n * extending through the center of the pie slice.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-crookdistance/\n * crookDistance set to 90%\n *\n * @since 7.0.0\n * @product highcharts highmaps\n */\n crookDistance: void 0,\n /**\n * The distance of the data label from the pie's edge. Negative\n * numbers put the data label on top of the pie slices. Can also be\n * defined as a percentage of pie's radius. Connectors are only\n * shown for data labels outside the pie.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-distance/\n * Data labels on top of the pie\n *\n * @type {number|string}\n * @since 2.1\n * @product highcharts highmaps\n */\n distance: 30,\n enabled: true,\n /**\n * A\n * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)\n * for the data label. Available variables are the same as for\n * `formatter`.\n *\n * @sample {highcharts} highcharts/plotoptions/series-datalabels-format/\n * Add a unit\n *\n * @type {string}\n * @default undefined\n * @since 3.0\n * @apioption plotOptions.pie.dataLabels.format\n */\n // eslint-disable-next-line valid-jsdoc\n /**\n * Callback JavaScript function to format the data label. Note that\n * if a `format` is defined, the format takes precedence and the\n * formatter is ignored.\n *\n * @type {Highcharts.DataLabelsFormatterCallbackFunction}\n * @default function () { return this.point.isNull ? void 0 : this.point.name; }\n */\n formatter: function () {\n return this.point.isNull ? void 0 : this.point.name;\n },\n /**\n * Whether to render the connector as a soft arc or a line with a sharp\n * break. Works only if `connectorShape` equals to `fixedOffset`.\n *\n * @sample {highcharts}\n * highcharts/plotoptions/pie-datalabels-softconnector-true/\n * Soft\n * @sample {highcharts}\n * highcharts/plotoptions/pie-datalabels-softconnector-false/\n * Non soft\n *\n * @since 2.1.7\n * @product highcharts highmaps\n */\n softConnector: true,\n /**\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-overflow\n * Long labels truncated with an ellipsis\n * @sample {highcharts} highcharts/plotoptions/pie-datalabels-overflow-wrap\n * Long labels are wrapped\n *\n * @type {Highcharts.CSSObject}\n * @apioption plotOptions.pie.dataLabels.style\n */\n x: 0\n },\n /**\n * If the total sum of the pie's values is 0, the series is represented\n * as an empty circle . The `fillColor` option defines the color of that\n * circle. Use [pie.borderWidth](#plotOptions.pie.borderWidth) to set\n * the border thickness.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-emptyseries/\n * Empty pie series\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @private\n */\n fillColor: void 0,\n /**\n * The end angle of the pie in degrees where 0 is top and 90 is right.\n * Defaults to `startAngle` plus 360.\n *\n * @sample {highcharts} highcharts/demo/pie-semi-circle/\n * Semi-circle donut\n *\n * @type {number}\n * @since 1.3.6\n * @product highcharts highmaps\n * @apioption plotOptions.pie.endAngle\n */\n /**\n * Thickness describing the ring size for a donut type chart,\n * overriding [innerSize](#plotOptions.pie.innerSize).\n *\n * @type {number}\n * @default undefined\n * @product highcharts\n * @since 10.1.0\n * @apioption plotOptions.pie.thickness\n * @private\n */\n /**\n * Equivalent to [chart.ignoreHiddenSeries](#chart.ignoreHiddenSeries),\n * this option tells whether the series shall be redrawn as if the\n * hidden point were `null`.\n *\n * The default value changed from `false` to `true` with Highcharts\n * 3.0.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-ignorehiddenpoint/\n * True, the hiddden point is ignored\n *\n * @since 2.3.0\n * @product highcharts highmaps\n *\n * @private\n */\n ignoreHiddenPoint: true,\n /**\n * @default true\n * @extends plotOptions.series.inactiveOtherPoints\n * @private\n */\n inactiveOtherPoints: true,\n /**\n * The size of the inner diameter for the pie. A size greater than 0\n * renders a donut chart. Can be a percentage or pixel value.\n * Percentages are relative to the pie size. Pixel values are given as\n * integers. Setting overridden by thickness.\n *\n *\n * Note: in Highcharts < 4.1.2, the percentage was relative to the plot\n * area, not the pie size.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-innersize-80px/\n * 80px inner size\n * @sample {highcharts} highcharts/plotoptions/pie-innersize-50percent/\n * 50% of the plot area\n * @sample {highcharts} highcharts/demo/3d-pie-donut/\n * 3D donut\n *\n * @type {number|string}\n * @default 0\n * @since 2.0\n * @product highcharts highmaps\n * @apioption plotOptions.pie.innerSize\n */\n /**\n * @ignore-option\n *\n * @private\n */\n legendType: 'point',\n /**\n * @ignore-option\n *\n * @private\n */\n marker: null,\n /**\n * The minimum size for a pie in response to auto margins. The pie will\n * try to shrink to make room for data labels in side the plot area,\n * but only to this size.\n *\n * @type {number|string}\n * @default 80\n * @since 3.0\n * @product highcharts highmaps\n * @apioption plotOptions.pie.minSize\n */\n /**\n * The diameter of the pie relative to the plot area. Can be a\n * percentage or pixel value. Pixel values are given as integers. The\n * default behaviour (as of 3.0) is to scale to the plot area and give\n * room for data labels within the plot area.\n * [slicedOffset](#plotOptions.pie.slicedOffset) is also included in the\n * default size calculation. As a consequence, the size of the pie may\n * vary when points are updated and data labels more around. In that\n * case it is best to set a fixed value, for example `\"75%\"`.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-size/\n * Smaller pie\n *\n * @type {number|string|null}\n * @product highcharts highmaps\n *\n * @private\n */\n size: null,\n /**\n * Whether to display this particular series or series type in the\n * legend. Since 2.1, pies are not shown in the legend by default.\n *\n * @sample {highcharts} highcharts/plotoptions/series-showinlegend/\n * One series in the legend, one hidden\n *\n * @product highcharts highmaps\n *\n * @private\n */\n showInLegend: false,\n /**\n * If a point is sliced, moved out from the center, how many pixels\n * should it be moved?.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-slicedoffset-20/\n * 20px offset\n *\n * @product highcharts highmaps\n *\n * @private\n */\n slicedOffset: 10,\n /**\n * The start angle of the pie slices in degrees where 0 is top and 90\n * right.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-startangle-90/\n * Start from right\n *\n * @type {number}\n * @default 0\n * @since 2.3.4\n * @product highcharts highmaps\n * @apioption plotOptions.pie.startAngle\n */\n /**\n * Sticky tracking of mouse events. When true, the `mouseOut` event\n * on a series isn't triggered until the mouse moves over another\n * series, or out of the plot area. When false, the `mouseOut` event on\n * a series is triggered when the mouse leaves the area around the\n * series' graph or markers. This also implies the tooltip. When\n * `stickyTracking` is false and `tooltip.shared` is false, the tooltip\n * will be hidden when moving the mouse between series.\n *\n * @product highcharts highmaps\n *\n * @private\n */\n stickyTracking: false,\n tooltip: {\n followPointer: true\n },\n /**\n * The color of the border surrounding each slice. When `null`, the\n * border takes the same color as the slice fill. This can be used\n * together with a `borderWidth` to fill drawing gaps created by\n * antialiazing artefacts in borderless pies.\n *\n * In styled mode, the border stroke is given in the `.highcharts-point`\n * class.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-bordercolor-black/\n * Black border\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #ffffff\n * @product highcharts highmaps\n *\n * @private\n */\n borderColor: \"#ffffff\" /* Palette.backgroundColor */,\n /**\n * The width of the border surrounding each slice.\n *\n * When setting the border width to 0, there may be small gaps between\n * the slices due to SVG antialiasing artefacts. To work around this,\n * keep the border width at 0.5 or 1, but set the `borderColor` to\n * `null` instead.\n *\n * In styled mode, the border stroke width is given in the\n * `.highcharts-point` class.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-borderwidth/\n * 3px border\n *\n * @product highcharts highmaps\n *\n * @private\n */\n borderWidth: 1,\n /**\n * @ignore-option\n * @private\n */\n lineWidth: void 0,\n states: {\n /**\n * @extends plotOptions.series.states.hover\n * @excluding marker, lineWidth, lineWidthPlus\n * @product highcharts highmaps\n */\n hover: {\n /**\n * How much to brighten the point on interaction. Requires the\n * main color to be defined in hex or rgb(a) format.\n *\n * In styled mode, the hover brightness is by default replaced\n * by a fill-opacity given in the `.highcharts-point-hover`\n * class.\n *\n * @sample {highcharts} highcharts/plotoptions/pie-states-hover-brightness/\n * Brightened by 0.5\n *\n * @product highcharts highmaps\n */\n brightness: 0.1\n }\n }\n};\n/**\n * A `pie` series. If the [type](#series.pie.type) option is not specified,\n * it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.pie\n * @excluding cropThreshold, dataParser, dataURL, linkedTo, stack, xAxis, yAxis,\n * dataSorting, step, boostThreshold, boostBlending\n * @product highcharts highmaps\n * @apioption series.pie\n */\n/**\n * An array of data points for the series. For the `pie` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.pie.turboThreshold),\n * this option is not available.\n * ```js\n * data: [{\n * y: 1,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * y: 7,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @excluding marker, x\n * @product highcharts highmaps\n * @apioption series.pie.data\n */\n/**\n * @type {Highcharts.SeriesPieDataLabelsOptionsObject}\n * @product highcharts highmaps\n * @apioption series.pie.data.dataLabels\n */\n/**\n * The sequential index of the data point in the legend.\n *\n * @type {number}\n * @product highcharts highmaps\n * @apioption series.pie.data.legendIndex\n */\n/**\n * Whether to display a slice offset from the center.\n *\n * @sample {highcharts} highcharts/point/sliced/\n * One sliced point\n *\n * @type {boolean}\n * @product highcharts highmaps\n * @apioption series.pie.data.sliced\n */\n/**\n * @extends plotOptions.pie.dataLabels\n * @excluding align, allowOverlap, inside, staggerLines, step\n * @product highcharts highmaps\n * @apioption series.pie.dataLabels\n */\n/**\n * @excluding legendItemClick\n * @product highcharts highmaps\n * @apioption series.pie.events\n */\n''; // placeholder for transpiled doclets above\n/* *\n *\n * Default Export\n *\n * */\nexport default PieSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport CU from '../CenteredUtilities.js';\nconst { getStartAndEndRadians } = CU;\nimport ColumnSeries from '../Column/ColumnSeries.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport PiePoint from './PiePoint.js';\nimport PieSeriesDefaults from './PieSeriesDefaults.js';\nimport Series from '../../Core/Series/Series.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nimport Symbols from '../../Core/Renderer/SVG/Symbols.js';\nimport U from '../../Core/Utilities.js';\nconst { clamp, extend, fireEvent, merge, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * Pie series type.\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.pie\n *\n * @augments Highcharts.Series\n */\nclass PieSeries extends Series {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Animates the pies in.\n * @private\n */\n animate(init) {\n const series = this, points = series.points, startAngleRad = series.startAngleRad;\n if (!init) {\n points.forEach(function (point) {\n const graphic = point.graphic, args = point.shapeArgs;\n if (graphic && args) {\n // start values\n graphic.attr({\n // animate from inner radius (#779)\n r: pick(point.startR, (series.center && series.center[3] / 2)),\n start: startAngleRad,\n end: startAngleRad\n });\n // animate\n graphic.animate({\n r: args.r,\n start: args.start,\n end: args.end\n }, series.options.animation);\n }\n });\n }\n }\n /**\n * Called internally to draw auxiliary graph in pie-like series in\n * situtation when the default graph is not sufficient enough to present\n * the data well. Auxiliary graph is saved in the same object as\n * regular graph.\n * @private\n */\n drawEmpty() {\n const start = this.startAngleRad, end = this.endAngleRad, options = this.options;\n let centerX, centerY;\n // Draw auxiliary graph if there're no visible points.\n if (this.total === 0 && this.center) {\n centerX = this.center[0];\n centerY = this.center[1];\n if (!this.graph) {\n this.graph = this.chart.renderer\n .arc(centerX, centerY, this.center[1] / 2, 0, start, end)\n .addClass('highcharts-empty-series')\n .add(this.group);\n }\n this.graph.attr({\n d: Symbols.arc(centerX, centerY, this.center[2] / 2, 0, {\n start,\n end,\n innerR: this.center[3] / 2\n })\n });\n if (!this.chart.styledMode) {\n this.graph.attr({\n 'stroke-width': options.borderWidth,\n fill: options.fillColor || 'none',\n stroke: options.color || \"#cccccc\" /* Palette.neutralColor20 */\n });\n }\n }\n else if (this.graph) { // Destroy the graph object.\n this.graph = this.graph.destroy();\n }\n }\n /**\n * Slices in pie chart are initialized in DOM, but it's shapes and\n * animations are normally run in `drawPoints()`.\n * @private\n */\n drawPoints() {\n const renderer = this.chart.renderer;\n this.points.forEach(function (point) {\n // When updating a series between 2d and 3d or cartesian and\n // polar, the shape type changes.\n if (point.graphic && point.hasNewShapeType()) {\n point.graphic = point.graphic.destroy();\n }\n if (!point.graphic) {\n point.graphic = renderer[point.shapeType](point.shapeArgs)\n .add(point.series.group);\n point.delayedRendering = true;\n }\n });\n }\n /**\n * Extend the generatePoints method by adding total and percentage\n * properties to each point\n * @private\n */\n generatePoints() {\n super.generatePoints();\n this.updateTotals();\n }\n /**\n * Utility for getting the x value from a given y, used for anticollision\n * logic in data labels.\n * @private\n */\n getX(y, left, point, dataLabel) {\n const center = this.center, \n // Variable pie has individual radius\n radius = this.radii ?\n this.radii[point.index] || 0 :\n center[2] / 2, labelPosition = dataLabel.dataLabelPosition, distance = labelPosition?.distance || 0;\n const angle = Math.asin(clamp((y - center[1]) / (radius + distance), -1, 1));\n const x = center[0] +\n (left ? -1 : 1) *\n (Math.cos(angle) * (radius + distance)) +\n (distance > 0 ?\n (left ? -1 : 1) * (dataLabel.padding || 0) :\n 0);\n return x;\n }\n /**\n * Define hasData function for non-cartesian series. Returns true if the\n * series has points at all.\n * @private\n */\n hasData() {\n return !!this.processedXData.length; // != 0\n }\n /**\n * Draw the data points\n * @private\n */\n redrawPoints() {\n const series = this, chart = series.chart;\n let groupTranslation, graphic, pointAttr, shapeArgs;\n this.drawEmpty();\n // Apply the drop-shadow to the group because otherwise each element\n // would cast a shadow on others\n if (series.group && !chart.styledMode) {\n series.group.shadow(series.options.shadow);\n }\n // draw the slices\n series.points.forEach(function (point) {\n const animateTo = {};\n graphic = point.graphic;\n if (!point.isNull && graphic) {\n shapeArgs = point.shapeArgs;\n // If the point is sliced, use special translation, else use\n // plot area translation\n groupTranslation = point.getTranslate();\n if (!chart.styledMode) {\n pointAttr = series.pointAttribs(point, (point.selected && 'select'));\n }\n // Draw the slice\n if (!point.delayedRendering) {\n graphic\n .setRadialReference(series.center);\n if (!chart.styledMode) {\n merge(true, animateTo, pointAttr);\n }\n merge(true, animateTo, shapeArgs, groupTranslation);\n graphic.animate(animateTo);\n }\n else {\n graphic\n .setRadialReference(series.center)\n .attr(shapeArgs)\n .attr(groupTranslation);\n if (!chart.styledMode) {\n graphic\n .attr(pointAttr)\n .attr({ 'stroke-linejoin': 'round' });\n }\n point.delayedRendering = false;\n }\n graphic\n .attr({\n visibility: point.visible ? 'inherit' : 'hidden'\n });\n graphic.addClass(point.getClassName(), true);\n }\n else if (graphic) {\n point.graphic = graphic.destroy();\n }\n });\n }\n /**\n * Utility for sorting data labels.\n * @private\n */\n sortByAngle(points, sign) {\n points.sort(function (a, b) {\n return ((typeof a.angle !== 'undefined') &&\n (b.angle - a.angle) * sign);\n });\n }\n /**\n * Do translation for pie slices\n * @private\n */\n translate(positions) {\n fireEvent(this, 'translate');\n this.generatePoints();\n const series = this, precision = 1000, // issue #172\n options = series.options, slicedOffset = options.slicedOffset, radians = getStartAndEndRadians(options.startAngle, options.endAngle), startAngleRad = series.startAngleRad = radians.start, endAngleRad = series.endAngleRad = radians.end, circ = endAngleRad - startAngleRad, // 2 * Math.PI,\n points = series.points, ignoreHiddenPoint = options.ignoreHiddenPoint, len = points.length;\n let start, end, angle, \n // The x component of the radius vector for a given point\n radiusX, radiusY, i, point, cumulative = 0;\n // Get positions - either an integer or a percentage string must be\n // given. If positions are passed as a parameter, we're in a\n // recursive loop for adjusting space for data labels.\n if (!positions) {\n /**\n * The series center position, read only. This applies only to\n * circular chart types like pie and sunburst. It is an array of\n * `[centerX, centerY, diameter, innerDiameter]`.\n *\n * @name Highcharts.Series#center\n * @type {Array}\n */\n series.center = positions = series.getCenter();\n }\n // Calculate the geometry for each point\n for (i = 0; i < len; i++) {\n point = points[i];\n // Set start and end angle\n start = startAngleRad + (cumulative * circ);\n if (point.isValid() &&\n (!ignoreHiddenPoint || point.visible)) {\n cumulative += point.percentage / 100;\n }\n end = startAngleRad + (cumulative * circ);\n // Set the shape\n const shapeArgs = {\n x: positions[0],\n y: positions[1],\n r: positions[2] / 2,\n innerR: positions[3] / 2,\n start: Math.round(start * precision) / precision,\n end: Math.round(end * precision) / precision\n };\n point.shapeType = 'arc';\n point.shapeArgs = shapeArgs;\n // The angle must stay within -90 and 270 (#2645)\n angle = (end + start) / 2;\n if (angle > 1.5 * Math.PI) {\n angle -= 2 * Math.PI;\n }\n else if (angle < -Math.PI / 2) {\n angle += 2 * Math.PI;\n }\n // Center for the sliced out slice\n point.slicedTranslation = {\n translateX: Math.round(Math.cos(angle) * slicedOffset),\n translateY: Math.round(Math.sin(angle) * slicedOffset)\n };\n // Set the anchor point for tooltips\n radiusX = Math.cos(angle) * positions[2] / 2;\n radiusY = Math.sin(angle) * positions[2] / 2;\n point.tooltipPos = [\n positions[0] + radiusX * 0.7,\n positions[1] + radiusY * 0.7\n ];\n point.half = angle < -Math.PI / 2 || angle > Math.PI / 2 ?\n 1 :\n 0;\n point.angle = angle;\n }\n fireEvent(series, 'afterTranslate');\n }\n /**\n * Recompute total chart sum and update percentages of points.\n * @private\n */\n updateTotals() {\n const points = this.points, len = points.length, ignoreHiddenPoint = this.options.ignoreHiddenPoint;\n let i, point, total = 0;\n // Get the total sum\n for (i = 0; i < len; i++) {\n point = points[i];\n if (point.isValid() &&\n (!ignoreHiddenPoint || point.visible)) {\n total += point.y;\n }\n }\n this.total = total;\n // Set each point's properties\n for (i = 0; i < len; i++) {\n point = points[i];\n point.percentage =\n (total > 0 && (point.visible || !ignoreHiddenPoint)) ?\n point.y / total * 100 :\n 0;\n point.total = total;\n }\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nPieSeries.defaultOptions = merge(Series.defaultOptions, PieSeriesDefaults);\nextend(PieSeries.prototype, {\n axisTypes: [],\n directTouch: true,\n drawGraph: void 0,\n drawTracker: ColumnSeries.prototype.drawTracker,\n getCenter: CU.getCenter,\n getSymbol: noop,\n invertible: false,\n isCartesian: false,\n noSharedTooltip: true,\n pointAttribs: ColumnSeries.prototype.pointAttribs,\n pointClass: PiePoint,\n requireSorting: false,\n searchPoint: noop,\n trackerGroups: ['group', 'dataLabelsGroup']\n});\nSeriesRegistry.registerSeriesType('pie', PieSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default PieSeries;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport DataLabel from '../../Core/Series/DataLabel.js';\nimport H from '../../Core/Globals.js';\nconst { composed, noop } = H;\nimport R from '../../Core/Renderer/RendererUtilities.js';\nconst { distribute } = R;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { series: Series } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { arrayMax, clamp, defined, pick, pushUnique, relativeLength } = U;\n/* *\n *\n * Composition\n *\n * */\nvar ColumnDataLabel;\n(function (ColumnDataLabel) {\n /* *\n *\n * Constants\n *\n * */\n const dataLabelPositioners = {\n // Based on the value computed in Highcharts' distribute algorithm.\n radialDistributionY: function (point, dataLabel) {\n return (dataLabel.dataLabelPosition?.top || 0) +\n point.distributeBox.pos;\n },\n // Get the x - use the natural x position for labels near the top and\n // bottom, to prevent the top and botton slice connectors from touching\n // each other on either side. Based on the value computed in Highcharts'\n // distribute algorithm.\n radialDistributionX: function (series, point, y, naturalY, dataLabel) {\n const pos = dataLabel.dataLabelPosition;\n return series.getX(y < (pos?.top || 0) + 2 || y > (pos?.bottom || 0) - 2 ?\n naturalY :\n y, point.half, point, dataLabel);\n },\n // The dataLabels.distance determines the x position of the label\n justify: function (point, dataLabel, radius, seriesCenter) {\n return seriesCenter[0] + (point.half ? -1 : 1) *\n (radius + (dataLabel.dataLabelPosition?.distance || 0));\n },\n // Left edges of the left-half labels touch the left edge of the plot\n // area. Right edges of the right-half labels touch the right edge of\n // the plot area.\n alignToPlotEdges: function (dataLabel, half, plotWidth, plotLeft) {\n const dataLabelWidth = dataLabel.getBBox().width;\n return half ? dataLabelWidth + plotLeft :\n plotWidth - dataLabelWidth - plotLeft;\n },\n // Connectors of each side end in the same x position. Labels are\n // aligned to them. Left edge of the widest left-half label touches the\n // left edge of the plot area. Right edge of the widest right-half label\n // touches the right edge of the plot area.\n alignToConnectors: function (points, half, plotWidth, plotLeft) {\n let maxDataLabelWidth = 0, dataLabelWidth;\n // find widest data label\n points.forEach(function (point) {\n dataLabelWidth = point.dataLabel.getBBox().width;\n if (dataLabelWidth > maxDataLabelWidth) {\n maxDataLabelWidth = dataLabelWidth;\n }\n });\n return half ? maxDataLabelWidth + plotLeft :\n plotWidth - maxDataLabelWidth - plotLeft;\n }\n };\n /* *\n *\n * Functions\n *\n * */\n /** @private */\n function compose(PieSeriesClass) {\n DataLabel.compose(Series);\n if (pushUnique(composed, 'PieDataLabel')) {\n const pieProto = PieSeriesClass.prototype;\n pieProto.dataLabelPositioners = dataLabelPositioners;\n pieProto.alignDataLabel = noop;\n pieProto.drawDataLabels = drawDataLabels;\n pieProto.getDataLabelPosition = getDataLabelPosition;\n pieProto.placeDataLabels = placeDataLabels;\n pieProto.verifyDataLabelOverflow = verifyDataLabelOverflow;\n }\n }\n ColumnDataLabel.compose = compose;\n /** @private */\n function getDataLabelPosition(point, distance) {\n const { center, options } = this, r = center[2] / 2, angle = point.angle || 0, cosAngle = Math.cos(angle), sinAngle = Math.sin(angle), x = center[0] + cosAngle * r, y = center[1] + sinAngle * r, finalConnectorOffset = Math.min((options.slicedOffset || 0) + (options.borderWidth || 0), distance / 5); // #1678\n return {\n natural: {\n // Initial position of the data label - it's utilized for\n // finding the final position for the label\n x: x + cosAngle * distance,\n y: y + sinAngle * distance\n },\n computed: {\n // Used for generating connector path - initialized later in\n // drawDataLabels function x: undefined, y: undefined\n },\n // Left - pie on the left side of the data label\n // Right - pie on the right side of the data label\n // Center - data label overlaps the pie\n alignment: distance < 0 ? 'center' : point.half ? 'right' : 'left',\n connectorPosition: {\n breakAt: {\n x: x + cosAngle * finalConnectorOffset,\n y: y + sinAngle * finalConnectorOffset\n },\n touchingSliceAt: {\n x,\n y\n }\n },\n distance\n };\n }\n /**\n * Override the base drawDataLabels method by pie specific functionality\n * @private\n */\n function drawDataLabels() {\n const series = this, points = series.points, chart = series.chart, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, plotLeft = chart.plotLeft, maxWidth = Math.round(chart.chartWidth / 3), seriesCenter = series.center, radius = seriesCenter[2] / 2, centerY = seriesCenter[1], halves = [\n [],\n [] // Left\n ], overflow = [0, 0, 0, 0], // Top, right, bottom, left\n dataLabelPositioners = series.dataLabelPositioners;\n let connector, dataLabelWidth, labelHeight, maxLabelDistance = 0;\n // Get out if not enabled\n if (!series.visible || !series.hasDataLabels?.()) {\n return;\n }\n // Reset all labels that have been shortened\n points.forEach((point) => {\n (point.dataLabels || []).forEach((dataLabel) => {\n if (dataLabel.shortened) {\n dataLabel\n .attr({\n width: 'auto'\n }).css({\n width: 'auto',\n textOverflow: 'clip'\n });\n dataLabel.shortened = false;\n }\n });\n });\n // Run parent method\n Series.prototype.drawDataLabels.apply(series);\n points.forEach((point) => {\n (point.dataLabels || []).forEach((dataLabel, i) => {\n const r = seriesCenter[2] / 2, dataLabelOptions = dataLabel.options, distance = relativeLength(dataLabelOptions?.distance || 0, r);\n // Arrange points for collision detection\n if (i === 0) {\n halves[point.half].push(point);\n }\n // Avoid long labels squeezing the pie size too far down\n if (!defined(dataLabelOptions?.style?.width)) {\n if (dataLabel.getBBox().width > maxWidth) {\n dataLabel.css({\n // Use a fraction of the maxWidth to avoid wrapping\n // close to the end of the string.\n width: Math.round(maxWidth * 0.7) + 'px'\n });\n dataLabel.shortened = true;\n }\n }\n dataLabel.dataLabelPosition = this.getDataLabelPosition(point, distance);\n maxLabelDistance = Math.max(maxLabelDistance, distance);\n });\n });\n /* Loop over the points in each half, starting from the top and bottom\n * of the pie to detect overlapping labels.\n */\n halves.forEach((points, halfIdx) => {\n const length = points.length, positions = [];\n let top, bottom, size = 0, distributionLength;\n if (!length) {\n return;\n }\n // Sort by angle\n series.sortByAngle(points, halfIdx - 0.5);\n // Only do anti-collision when we have dataLabels outside the pie\n // and have connectors. (#856)\n if (maxLabelDistance > 0) {\n top = Math.max(0, centerY - radius - maxLabelDistance);\n bottom = Math.min(centerY + radius + maxLabelDistance, chart.plotHeight);\n points.forEach((point) => {\n // Check if specific points' label is outside the pie\n (point.dataLabels || []).forEach((dataLabel) => {\n const labelPosition = dataLabel.dataLabelPosition;\n if (labelPosition &&\n labelPosition.distance > 0) {\n // The point.top depends on point.labelDistance\n // value. Used for calculation of y value in getX\n // method\n labelPosition.top = Math.max(0, centerY - radius - labelPosition.distance);\n labelPosition.bottom = Math.min(centerY + radius + labelPosition.distance, chart.plotHeight);\n size = dataLabel.getBBox().height || 21;\n point.distributeBox = {\n target: ((dataLabel.dataLabelPosition\n ?.natural.y || 0) -\n labelPosition.top +\n size / 2),\n size,\n rank: point.y\n };\n positions.push(point.distributeBox);\n }\n });\n });\n distributionLength = bottom + size - top;\n distribute(positions, distributionLength, distributionLength / 5);\n }\n // Now the used slots are sorted, fill them up sequentially\n points.forEach((point) => {\n (point.dataLabels || []).forEach((dataLabel) => {\n const dataLabelOptions = (dataLabel.options || {}), distributeBox = point.distributeBox, labelPosition = dataLabel.dataLabelPosition, naturalY = labelPosition?.natural.y || 0, connectorPadding = dataLabelOptions\n .connectorPadding || 0;\n let x = 0, y = naturalY, visibility = 'inherit';\n if (labelPosition) {\n if (positions &&\n defined(distributeBox) &&\n labelPosition.distance > 0) {\n if (typeof distributeBox.pos === 'undefined') {\n visibility = 'hidden';\n }\n else {\n labelHeight = distributeBox.size;\n // Find label's y position\n y = dataLabelPositioners\n .radialDistributionY(point, dataLabel);\n }\n }\n // Find label's x position. The justify option is\n // undocumented in the API - preserve support for it\n if (dataLabelOptions.justify) {\n x = dataLabelPositioners.justify(point, dataLabel, radius, seriesCenter);\n }\n else {\n switch (dataLabelOptions.alignTo) {\n case 'connectors':\n x = dataLabelPositioners.alignToConnectors(points, halfIdx, plotWidth, plotLeft);\n break;\n case 'plotEdges':\n x = dataLabelPositioners.alignToPlotEdges(dataLabel, halfIdx, plotWidth, plotLeft);\n break;\n default:\n x = dataLabelPositioners.radialDistributionX(series, point, y, naturalY, dataLabel);\n }\n }\n // Record the placement and visibility\n labelPosition.attribs = {\n visibility,\n align: labelPosition.alignment\n };\n labelPosition.posAttribs = {\n x: x +\n (dataLabelOptions.x || 0) + // (#12985)\n ({\n left: connectorPadding,\n right: -connectorPadding\n }[labelPosition.alignment] || 0),\n y: y +\n (dataLabelOptions.y || 0) - // (#12985)\n // Vertically center\n dataLabel.getBBox().height / 2\n };\n labelPosition.computed.x = x;\n labelPosition.computed.y = y;\n // Detect overflowing data labels\n if (pick(dataLabelOptions.crop, true)) {\n dataLabelWidth = dataLabel.getBBox().width;\n let sideOverflow;\n // Overflow left\n if (x - dataLabelWidth < connectorPadding &&\n halfIdx === 1 // Left half\n ) {\n sideOverflow = Math.round(dataLabelWidth - x + connectorPadding);\n overflow[3] = Math.max(sideOverflow, overflow[3]);\n // Overflow right\n }\n else if (x + dataLabelWidth >\n plotWidth - connectorPadding &&\n halfIdx === 0 // Right half\n ) {\n sideOverflow = Math.round(x +\n dataLabelWidth -\n plotWidth +\n connectorPadding);\n overflow[1] = Math.max(sideOverflow, overflow[1]);\n }\n // Overflow top\n if (y - labelHeight / 2 < 0) {\n overflow[0] = Math.max(Math.round(-y + labelHeight / 2), overflow[0]);\n // Overflow left\n }\n else if (y + labelHeight / 2 > plotHeight) {\n overflow[2] = Math.max(Math.round(y + labelHeight / 2 - plotHeight), overflow[2]);\n }\n labelPosition.sideOverflow = sideOverflow;\n }\n }\n }); // For each data label of the point\n }); // For each point\n }); // For each half\n // Do not apply the final placement and draw the connectors until we\n // have verified that labels are not spilling over.\n if (arrayMax(overflow) === 0 ||\n this.verifyDataLabelOverflow(overflow)) {\n // Place the labels in the final position\n this.placeDataLabels();\n this.points.forEach((point) => {\n (point.dataLabels || []).forEach((dataLabel) => {\n // #8864: every connector can have individual options\n const { connectorColor, connectorWidth = 1 } = (dataLabel.options || {}), labelPosition = dataLabel.dataLabelPosition;\n // Draw the connector\n if (connectorWidth) {\n let isNew;\n connector = dataLabel.connector;\n if (labelPosition && labelPosition.distance > 0) {\n isNew = !connector;\n if (!connector) {\n dataLabel.connector = connector = chart.renderer\n .path()\n .addClass('highcharts-data-label-connector ' +\n ' highcharts-color-' +\n point.colorIndex +\n (point.className ?\n ' ' + point.className :\n ''))\n .add(series.dataLabelsGroup);\n }\n if (!chart.styledMode) {\n connector.attr({\n 'stroke-width': connectorWidth,\n 'stroke': (connectorColor ||\n point.color ||\n \"#666666\" /* Palette.neutralColor60 */)\n });\n }\n connector[isNew ? 'attr' : 'animate']({\n d: point.getConnectorPath(dataLabel)\n });\n connector.attr({\n visibility: labelPosition.attribs?.visibility\n });\n }\n else if (connector) {\n dataLabel.connector = connector.destroy();\n }\n }\n });\n });\n }\n }\n /**\n * Perform the final placement of the data labels after we have verified\n * that they fall within the plot area.\n * @private\n */\n function placeDataLabels() {\n this.points.forEach((point) => {\n (point.dataLabels || []).forEach((dataLabel) => {\n const labelPosition = dataLabel.dataLabelPosition;\n if (labelPosition) {\n // Shorten data labels with ellipsis if they still overflow\n // after the pie has reached minSize (#223).\n if (labelPosition.sideOverflow) {\n dataLabel.css({\n width: (Math.max(dataLabel.getBBox().width -\n labelPosition.sideOverflow, 0)) + 'px',\n textOverflow: ((dataLabel.options?.style || {})\n .textOverflow ||\n 'ellipsis')\n });\n dataLabel.shortened = true;\n }\n dataLabel.attr(labelPosition.attribs);\n dataLabel[dataLabel.moved ? 'animate' : 'attr'](labelPosition.posAttribs);\n dataLabel.moved = true;\n }\n else if (dataLabel) {\n dataLabel.attr({ y: -9999 });\n }\n });\n // Clear for update\n delete point.distributeBox;\n }, this);\n }\n /**\n * Verify whether the data labels are allowed to draw, or we should run more\n * translation and data label positioning to keep them inside the plot area.\n * Returns true when data labels are ready to draw.\n * @private\n */\n function verifyDataLabelOverflow(overflow) {\n let center = this.center, options = this.options, centerOption = options.center, minSize = options.minSize || 80, newSize = minSize, \n // If a size is set, return true and don't try to shrink the pie\n // to fit the labels.\n ret = options.size !== null;\n if (!ret) {\n // Handle horizontal size and center\n if (centerOption[0] !== null) { // Fixed center\n newSize = Math.max(center[2] -\n Math.max(overflow[1], overflow[3]), minSize);\n }\n else { // Auto center\n newSize = Math.max(\n // horizontal overflow\n center[2] - overflow[1] - overflow[3], minSize);\n // horizontal center\n center[0] += (overflow[3] - overflow[1]) / 2;\n }\n // Handle vertical size and center\n if (centerOption[1] !== null) { // Fixed center\n newSize = clamp(newSize, minSize, center[2] - Math.max(overflow[0], overflow[2]));\n }\n else { // Auto center\n newSize = clamp(newSize, minSize, \n // vertical overflow\n center[2] - overflow[0] - overflow[2]);\n // vertical center\n center[1] += (overflow[0] - overflow[2]) / 2;\n }\n // If the size must be decreased, we need to run translate and\n // drawDataLabels again\n if (newSize < center[2]) {\n center[2] = newSize;\n center[3] = Math.min(// #3632\n options.thickness ?\n Math.max(0, newSize - options.thickness * 2) :\n Math.max(0, relativeLength(options.innerSize || 0, newSize)), newSize); // #6647\n this.translate(center);\n if (this.drawDataLabels) {\n this.drawDataLabels();\n }\n // Else, return true to indicate that the pie and its labels is\n // within the plot area\n }\n else {\n ret = true;\n }\n }\n return ret;\n }\n})(ColumnDataLabel || (ColumnDataLabel = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnDataLabel;\n", "/* *\n *\n * Highcharts module to hide overlapping data labels.\n * This module is included in Highcharts.\n *\n * (c) 2009-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../Core/Utilities.js';\nconst { addEvent, fireEvent, objectEach, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Hide overlapping labels. Labels are moved and faded in and out on zoom to\n * provide a smooth visual impression.\n *\n * @requires modules/overlapping-datalabels\n *\n * @private\n * @function Highcharts.Chart#hideOverlappingLabels\n * @param {Array} labels\n * Rendered data labels\n */\nfunction chartHideOverlappingLabels(labels) {\n const chart = this, len = labels.length, isIntersectRect = (box1, box2) => !(box2.x >= box1.x + box1.width ||\n box2.x + box2.width <= box1.x ||\n box2.y >= box1.y + box1.height ||\n box2.y + box2.height <= box1.y);\n /**\n * Get the box with its position inside the chart, as opposed to getBBox\n * that only reports the position relative to the parent.\n */\n function getAbsoluteBox(label) {\n if (label && (!label.alignAttr || label.placed)) {\n const padding = label.box ? 0 : (label.padding || 0), pos = label.alignAttr || {\n x: label.attr('x'),\n y: label.attr('y')\n }, bBox = label.getBBox();\n label.width = bBox.width;\n label.height = bBox.height;\n return {\n x: pos.x + (label.parentGroup?.translateX || 0) + padding,\n y: pos.y + (label.parentGroup?.translateY || 0) + padding,\n width: (label.width || 0) - 2 * padding,\n height: (label.height || 0) - 2 * padding\n };\n }\n }\n let label, label1, label2, box1, box2, isLabelAffected = false;\n for (let i = 0; i < len; i++) {\n label = labels[i];\n if (label) {\n // Mark with initial opacity\n label.oldOpacity = label.opacity;\n label.newOpacity = 1;\n label.absoluteBox = getAbsoluteBox(label);\n }\n }\n // Prevent a situation in a gradually rising slope, that each label will\n // hide the previous one because the previous one always has lower rank.\n labels.sort((a, b) => (b.labelrank || 0) - (a.labelrank || 0));\n // Detect overlapping labels\n for (let i = 0; i < len; ++i) {\n label1 = labels[i];\n box1 = label1 && label1.absoluteBox;\n for (let j = i + 1; j < len; ++j) {\n label2 = labels[j];\n box2 = label2 && label2.absoluteBox;\n if (box1 &&\n box2 &&\n label1 !== label2 && // #6465, polar chart with connectEnds\n label1.newOpacity !== 0 &&\n label2.newOpacity !== 0 &&\n // #15863 dataLabels are no longer hidden by translation\n label1.visibility !== 'hidden' &&\n label2.visibility !== 'hidden') {\n if (isIntersectRect(box1, box2)) {\n (label1.labelrank < label2.labelrank ? label1 : label2)\n .newOpacity = 0;\n }\n }\n }\n }\n // Hide or show\n for (const label of labels) {\n if (hideOrShow(label, chart)) {\n isLabelAffected = true;\n }\n }\n if (isLabelAffected) {\n fireEvent(chart, 'afterHideAllOverlappingLabels');\n }\n}\n/** @private */\nfunction compose(ChartClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.hideOverlappingLabels) {\n chartProto.hideOverlappingLabels = chartHideOverlappingLabels;\n addEvent(ChartClass, 'render', onChartRender);\n }\n}\n/**\n * Hide or show labels based on opacity.\n *\n * @private\n * @function hideOrShow\n * @param {Highcharts.SVGElement} label\n * The label.\n * @param {Highcharts.Chart} chart\n * The chart that contains the label.\n * @return {boolean}\n * Whether label is affected\n */\nfunction hideOrShow(label, chart) {\n let complete, newOpacity, isLabelAffected = false;\n if (label) {\n newOpacity = label.newOpacity;\n if (label.oldOpacity !== newOpacity) {\n // Toggle data labels\n if (label.hasClass('highcharts-data-label')) {\n // Make sure the label is completely hidden to avoid catching\n // clicks (#4362)\n label[newOpacity ? 'removeClass' : 'addClass']('highcharts-data-label-hidden');\n complete = function () {\n if (!chart.styledMode) {\n label.css({\n pointerEvents: newOpacity ? 'auto' : 'none'\n });\n }\n };\n isLabelAffected = true;\n // Animate or set the opacity\n label[label.isOld ? 'animate' : 'attr']({ opacity: newOpacity }, void 0, complete);\n fireEvent(chart, 'afterHideOverlappingLabel');\n // Toggle other labels, tick labels\n }\n else {\n label.attr({\n opacity: newOpacity\n });\n }\n }\n label.isOld = true;\n }\n return isLabelAffected;\n}\n/**\n * Collect potential overlapping data labels. Stack labels probably don't need\n * to be considered because they are usually accompanied by data labels that lie\n * inside the columns.\n * @private\n */\nfunction onChartRender() {\n const chart = this;\n let labels = [];\n // Consider external label collectors\n for (const collector of (chart.labelCollectors || [])) {\n labels = labels.concat(collector());\n }\n for (const yAxis of (chart.yAxis || [])) {\n if (yAxis.stacking &&\n yAxis.options.stackLabels &&\n !yAxis.options.stackLabels.allowOverlap) {\n objectEach(yAxis.stacking.stacks, (stack) => {\n objectEach(stack, (stackItem) => {\n if (stackItem.label) {\n labels.push(stackItem.label);\n }\n });\n });\n }\n }\n for (const series of (chart.series || [])) {\n if (series.visible && series.hasDataLabels?.()) { // #3866\n const push = (points) => {\n for (const point of points) {\n if (point.visible) {\n (point.dataLabels || []).forEach((label) => {\n const options = label.options || {};\n label.labelrank = pick(options.labelrank, point.labelrank, point.shapeArgs?.height); // #4118\n // Allow overlap if the option is explicitly true\n if (\n // #13449\n options.allowOverlap ??\n // Pie labels outside have a separate placement\n // logic, skip the overlap logic\n Number(options.distance) > 0) {\n label.oldOpacity = label.opacity;\n label.newOpacity = 1;\n hideOrShow(label, chart);\n // Do not allow overlap\n }\n else {\n labels.push(label);\n }\n });\n }\n }\n };\n push(series.nodes || []);\n push(series.points);\n }\n }\n this.hideOverlappingLabels(labels);\n}\n/* *\n *\n * Default Export\n *\n * */\nconst OverlappingDataLabels = {\n compose\n};\nexport default OverlappingDataLabels;\n", "/* *\n *\n * Highcharts Border Radius module\n *\n * Author: Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport D from '../Core/Defaults.js';\nconst { defaultOptions } = D;\nimport H from '../Core/Globals.js';\nconst { noop } = H;\nimport U from '../Core/Utilities.js';\nconst { addEvent, extend, isObject, merge, relativeLength } = U;\n/* *\n *\n * Constants\n *\n * */\nconst defaultBorderRadiusOptions = {\n radius: 0,\n scope: 'stack',\n where: void 0\n};\n/* *\n *\n * Variables\n *\n * */\nlet oldArc = noop;\nlet oldRoundedRect = noop;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction applyBorderRadius(path, i, r) {\n const a = path[i];\n let b = path[i + 1];\n if (b[0] === 'Z') {\n b = path[0];\n }\n let line, arc, fromLineToArc;\n // From straight line to arc\n if ((a[0] === 'M' || a[0] === 'L') && b[0] === 'A') {\n line = a;\n arc = b;\n fromLineToArc = true;\n // From arc to straight line\n }\n else if (a[0] === 'A' && (b[0] === 'M' || b[0] === 'L')) {\n line = b;\n arc = a;\n }\n if (line && arc && arc.params) {\n const bigR = arc[1], \n // In our use cases, outer pie slice arcs are clockwise and inner\n // arcs (donut/sunburst etc) are anti-clockwise\n clockwise = arc[5], params = arc.params, { start, end, cx, cy } = params;\n // Some geometric constants\n const relativeR = clockwise ? (bigR - r) : (bigR + r), \n // The angle, on the big arc, that the border radius arc takes up\n angleOfBorderRadius = relativeR ? Math.asin(r / relativeR) : 0, angleOffset = clockwise ?\n angleOfBorderRadius :\n -angleOfBorderRadius, \n // The distance along the radius of the big arc to the starting\n // point of the small border radius arc\n distanceBigCenterToStartArc = (Math.cos(angleOfBorderRadius) *\n relativeR);\n // From line to arc\n if (fromLineToArc) {\n // Update the cache\n params.start = start + angleOffset;\n // First move to the start position at the radial line. We want to\n // start one borderRadius closer to the center.\n line[1] = cx + distanceBigCenterToStartArc * Math.cos(start);\n line[2] = cy + distanceBigCenterToStartArc * Math.sin(start);\n // Now draw an arc towards the point where the small circle touches\n // the great circle.\n path.splice(i + 1, 0, [\n 'A',\n r,\n r,\n 0,\n 0,\n 1,\n cx + bigR * Math.cos(params.start),\n cy + bigR * Math.sin(params.start)\n ]);\n // From arc to line\n }\n else {\n // Update the cache\n params.end = end - angleOffset;\n // End the big arc a bit earlier\n arc[6] = cx + bigR * Math.cos(params.end);\n arc[7] = cy + bigR * Math.sin(params.end);\n // Draw a small arc towards a point on the end angle, but one\n // borderRadius closer to the center relative to the perimeter.\n path.splice(i + 1, 0, [\n 'A',\n r,\n r,\n 0,\n 0,\n 1,\n cx + distanceBigCenterToStartArc * Math.cos(end),\n cy + distanceBigCenterToStartArc * Math.sin(end)\n ]);\n }\n // Long or short arc must be reconsidered because we have modified the\n // start and end points\n arc[4] = Math.abs(params.end - params.start) < Math.PI ? 0 : 1;\n }\n}\n/**\n * Extend arc with borderRadius.\n * @private\n */\nfunction arc(x, y, w, h, options = {}) {\n const path = oldArc(x, y, w, h, options), { innerR = 0, r = w, start = 0, end = 0 } = options;\n if (options.open || !options.borderRadius) {\n return path;\n }\n const alpha = end - start, sinHalfAlpha = Math.sin(alpha / 2), borderRadius = Math.max(Math.min(relativeLength(options.borderRadius || 0, r - innerR), \n // Cap to half the sector radius\n (r - innerR) / 2, \n // For smaller pie slices, cap to the largest small circle that\n // can be fitted within the sector\n (r * sinHalfAlpha) / (1 + sinHalfAlpha)), 0), \n // For the inner radius, we need an extra cap because the inner arc\n // is shorter than the outer arc\n innerBorderRadius = Math.min(borderRadius, 2 * (alpha / Math.PI) * innerR);\n // Apply turn-by-turn border radius. Start at the end since we're\n // splicing in arc segments.\n let i = path.length - 1;\n while (i--) {\n applyBorderRadius(path, i, i > 1 ? innerBorderRadius : borderRadius);\n }\n return path;\n}\n/** @private */\nfunction seriesOnAfterColumnTranslate() {\n if (this.options.borderRadius &&\n !(this.chart.is3d && this.chart.is3d())) {\n const { options, yAxis } = this, percent = options.stacking === 'percent', seriesDefault = defaultOptions.plotOptions?.[this.type]\n ?.borderRadius, borderRadius = optionsToObject(options.borderRadius, isObject(seriesDefault) ? seriesDefault : {}), reversed = yAxis.options.reversed;\n for (const point of this.points) {\n const { shapeArgs } = point;\n if (point.shapeType === 'roundedRect' && shapeArgs) {\n const { width = 0, height = 0, y = 0 } = shapeArgs;\n let brBoxY = y, brBoxHeight = height;\n // It would be nice to refactor StackItem.getStackBox/\n // setOffset so that we could get a reliable box out of\n // it. Currently it is close if we remove the label\n // offset, but we still need to run crispCol and also\n // flip it if inverted, so atm it is simpler to do it\n // like the below.\n if (borderRadius.scope === 'stack' &&\n point.stackTotal) {\n const stackEnd = yAxis.translate(percent ? 100 : point.stackTotal, false, true, false, true), stackThreshold = yAxis.translate(options.threshold || 0, false, true, false, true), box = this.crispCol(0, Math.min(stackEnd, stackThreshold), 0, Math.abs(stackEnd - stackThreshold));\n brBoxY = box.y;\n brBoxHeight = box.height;\n }\n const flip = (point.negative ? -1 : 1) *\n (reversed ? -1 : 1) === -1;\n // Handle the where option\n let where = borderRadius.where;\n // Waterfall, hanging columns should have rounding on\n // all sides\n if (!where &&\n this.is('waterfall') &&\n Math.abs((point.yBottom || 0) -\n (this.translatedThreshold || 0)) > this.borderWidth) {\n where = 'all';\n }\n if (!where) {\n where = 'end';\n }\n // Get the radius\n const r = Math.min(relativeLength(borderRadius.radius, width), width / 2, \n // Cap to the height, but not if where is `end`\n where === 'all' ? height / 2 : Infinity) || 0;\n // If the `where` option is 'end', cut off the\n // rectangles by making the border-radius box one r\n // greater, so that the imaginary radius falls outside\n // the rectangle.\n if (where === 'end') {\n if (flip) {\n brBoxY -= r;\n brBoxHeight += r;\n }\n else {\n brBoxHeight += r;\n }\n }\n extend(shapeArgs, { brBoxHeight, brBoxY, r });\n }\n }\n }\n}\n/** @private */\nfunction compose(SeriesClass, SVGElementClass, SVGRendererClass) {\n const PieSeriesClass = SeriesClass.types.pie;\n if (!SVGElementClass.symbolCustomAttribs.includes('borderRadius')) {\n const symbols = SVGRendererClass.prototype.symbols;\n addEvent(SeriesClass, 'afterColumnTranslate', seriesOnAfterColumnTranslate, {\n // After columnrange and polar column modifications\n order: 9\n });\n addEvent(PieSeriesClass, 'afterTranslate', pieSeriesOnAfterTranslate);\n SVGElementClass.symbolCustomAttribs.push('borderRadius', 'brBoxHeight', 'brBoxY');\n oldArc = symbols.arc;\n oldRoundedRect = symbols.roundedRect;\n symbols.arc = arc;\n symbols.roundedRect = roundedRect;\n }\n}\n/** @private */\nfunction optionsToObject(options, seriesBROptions) {\n if (!isObject(options)) {\n options = { radius: options || 0 };\n }\n return merge(defaultBorderRadiusOptions, seriesBROptions, options);\n}\n/** @private */\nfunction pieSeriesOnAfterTranslate() {\n const borderRadius = optionsToObject(this.options.borderRadius);\n for (const point of this.points) {\n const shapeArgs = point.shapeArgs;\n if (shapeArgs) {\n shapeArgs.borderRadius = relativeLength(borderRadius.radius, (shapeArgs.r || 0) - ((shapeArgs.innerR) || 0));\n }\n }\n}\n/**\n * Extend roundedRect with individual cutting through rOffset.\n * @private\n */\nfunction roundedRect(x, y, width, height, options = {}) {\n const path = oldRoundedRect(x, y, width, height, options), { r = 0, brBoxHeight = height, brBoxY = y } = options, brOffsetTop = y - brBoxY, brOffsetBtm = (brBoxY + brBoxHeight) - (y + height), \n // When the distance to the border-radius box is greater than the r\n // itself, it means no border radius. The -0.1 accounts for float\n // rounding errors.\n rTop = (brOffsetTop - r) > -0.1 ? 0 : r, rBtm = (brOffsetBtm - r) > -0.1 ? 0 : r, cutTop = Math.max(rTop && brOffsetTop, 0), cutBtm = Math.max(rBtm && brOffsetBtm, 0);\n /*\n\n The naming of control points:\n\n / a -------- b \\\n / \\\n h c\n | |\n | |\n | |\n g d\n \\ /\n \\ f -------- e /\n\n */\n const a = [x + rTop, y], b = [x + width - rTop, y], c = [x + width, y + rTop], d = [\n x + width, y + height - rBtm\n ], e = [\n x + width - rBtm,\n y + height\n ], f = [x + rBtm, y + height], g = [x, y + height - rBtm], h = [x, y + rTop];\n const applyPythagoras = (r, altitude) => Math.sqrt(Math.pow(r, 2) - Math.pow(altitude, 2));\n // Inside stacks, cut off part of the top\n if (cutTop) {\n const base = applyPythagoras(rTop, rTop - cutTop);\n a[0] -= base;\n b[0] += base;\n c[1] = h[1] = y + rTop - cutTop;\n }\n // Column is lower than the radius. Cut off bottom inside the top\n // radius.\n if (height < rTop - cutTop) {\n const base = applyPythagoras(rTop, rTop - cutTop - height);\n c[0] = d[0] = x + width - rTop + base;\n e[0] = Math.min(c[0], e[0]);\n f[0] = Math.max(d[0], f[0]);\n g[0] = h[0] = x + rTop - base;\n c[1] = h[1] = y + height;\n }\n // Inside stacks, cut off part of the bottom\n if (cutBtm) {\n const base = applyPythagoras(rBtm, rBtm - cutBtm);\n e[0] += base;\n f[0] -= base;\n d[1] = g[1] = y + height - rBtm + cutBtm;\n }\n // Cut off top inside the bottom radius\n if (height < rBtm - cutBtm) {\n const base = applyPythagoras(rBtm, rBtm - cutBtm - height);\n c[0] = d[0] = x + width - rBtm + base;\n b[0] = Math.min(c[0], b[0]);\n a[0] = Math.max(d[0], a[0]);\n g[0] = h[0] = x + rBtm - base;\n d[1] = g[1] = y;\n }\n // Preserve the box for data labels\n path.length = 0;\n path.push(['M', ...a], \n // top side\n ['L', ...b], \n // top right corner\n ['A', rTop, rTop, 0, 0, 1, ...c], \n // right side\n ['L', ...d], \n // bottom right corner\n ['A', rBtm, rBtm, 0, 0, 1, ...e], \n // bottom side\n ['L', ...f], \n // bottom left corner\n ['A', rBtm, rBtm, 0, 0, 1, ...g], \n // left side\n ['L', ...h], \n // top left corner\n ['A', rTop, rTop, 0, 0, 1, ...a], ['Z']);\n return path;\n}\n/* *\n *\n * Default Export\n *\n * */\nconst BorderRadius = {\n compose,\n optionsToObject\n};\nexport default BorderRadius;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Detailed options for border radius.\n *\n * @sample {highcharts} highcharts/plotoptions/column-borderradius/\n * Rounded columns\n * @sample highcharts/plotoptions/series-border-radius\n * Column and pie with rounded border\n *\n * @interface Highcharts.BorderRadiusOptionsObject\n */ /**\n* The border radius. A number signifies pixels. A percentage string, like for\n* example `50%`, signifies a relative size. For columns this is relative to the\n* column width, for pies it is relative to the radius and the inner radius.\n*\n* @name Highcharts.BorderRadiusOptionsObject#radius\n* @type {string|number}\n*/ /**\n* The scope of the rounding for column charts. In a stacked column chart, the\n* value `point` means each single point will get rounded corners. The value\n* `stack` means the rounding will apply to the full stack, so that only points\n* close to the top or bottom will receive rounding.\n*\n* @name Highcharts.BorderRadiusOptionsObject#scope\n* @validvalue [\"point\", \"stack\"]\n* @type {string}\n*/ /**\n* For column charts, where in the point or stack to apply rounding. The `end`\n* value means only those corners at the point value will be rounded, leaving\n* the corners at the base or threshold unrounded. This is the most intuitive\n* behaviour. The `all` value means also the base will be rounded.\n*\n* @name Highcharts.BorderRadiusOptionsObject#where\n* @validvalue [\"all\", \"end\"]\n* @type {string}\n* @default end\n*/\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from './Utilities.js';\nconst { diffObjects, extend, find, merge, pick, uniqueKey } = U;\n/* *\n *\n * Composition\n *\n * */\nvar Responsive;\n(function (Responsive) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(ChartClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.matchResponsiveRule) {\n extend(chartProto, {\n matchResponsiveRule,\n setResponsive\n });\n }\n return ChartClass;\n }\n Responsive.compose = compose;\n /**\n * Handle a single responsiveness rule.\n *\n * @private\n * @function Highcharts.Chart#matchResponsiveRule\n * @param {Highcharts.ResponsiveRulesOptions} rule\n * @param {Array} matches\n */\n function matchResponsiveRule(rule, matches) {\n const condition = rule.condition, fn = condition.callback || function () {\n return (this.chartWidth <= pick(condition.maxWidth, Number.MAX_VALUE) &&\n this.chartHeight <= pick(condition.maxHeight, Number.MAX_VALUE) &&\n this.chartWidth >= pick(condition.minWidth, 0) &&\n this.chartHeight >= pick(condition.minHeight, 0));\n };\n if (fn.call(this)) {\n matches.push(rule._id);\n }\n }\n /**\n * Update the chart based on the current chart/document size and options\n * for responsiveness.\n *\n * @private\n * @function Highcharts.Chart#setResponsive\n * @param {boolean} [redraw=true]\n * @param {boolean} [reset=false]\n * Reset by un-applying all rules. Chart.update resets all rules before\n * applying updated options.\n */\n function setResponsive(redraw, reset) {\n const options = this.options.responsive, currentResponsive = this.currentResponsive;\n let ruleIds = [], undoOptions;\n if (!reset && options && options.rules) {\n options.rules.forEach((rule) => {\n if (typeof rule._id === 'undefined') {\n rule._id = uniqueKey();\n }\n this.matchResponsiveRule(rule, ruleIds /* , redraw */);\n }, this);\n }\n // Merge matching rules\n const mergedOptions = merge(...ruleIds\n .map((ruleId) => find((options || {}).rules || [], (rule) => (rule._id === ruleId)))\n .map((rule) => (rule && rule.chartOptions)));\n mergedOptions.isResponsiveOptions = true;\n // Stringified key for the rules that currently apply.\n ruleIds = (ruleIds.toString() || void 0);\n const currentRuleIds = (currentResponsive && currentResponsive.ruleIds);\n // Changes in what rules apply\n if (ruleIds !== currentRuleIds) {\n // Undo previous rules. Before we apply a new set of rules, we\n // need to roll back completely to base options (#6291).\n if (currentResponsive) {\n this.update(currentResponsive.undoOptions, redraw, true);\n }\n if (ruleIds) {\n // Get undo-options for matching rules. The `undoOptions``\n // hold the current values before they are changed by the\n // `mergedOptions`.\n undoOptions = diffObjects(mergedOptions, this.options, true, this.collectionsWithUpdate);\n undoOptions.isResponsiveOptions = true;\n this.currentResponsive = {\n ruleIds: ruleIds,\n mergedOptions: mergedOptions,\n undoOptions: undoOptions\n };\n this.update(mergedOptions, redraw, true);\n }\n else {\n this.currentResponsive = void 0;\n }\n }\n }\n})(Responsive || (Responsive = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default Responsive;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * A callback function to gain complete control on when the responsive rule\n * applies.\n *\n * @callback Highcharts.ResponsiveCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * Chart context.\n *\n * @return {boolean}\n * Return `true` if it applies.\n */\n(''); // keeps doclets above in JS file\n/* *\n *\n * API Options\n *\n * */\n/**\n * Allows setting a set of rules to apply for different screen or chart\n * sizes. Each rule specifies additional chart options.\n *\n * @sample {highstock} stock/demo/responsive/\n * Stock chart\n * @sample highcharts/responsive/axis/\n * Axis\n * @sample highcharts/responsive/legend/\n * Legend\n * @sample highcharts/responsive/classname/\n * Class name\n *\n * @since 5.0.0\n * @apioption responsive\n */\n/**\n * A set of rules for responsive settings. The rules are executed from\n * the top down.\n *\n * @sample {highcharts} highcharts/responsive/axis/\n * Axis changes\n * @sample {highstock} highcharts/responsive/axis/\n * Axis changes\n * @sample {highmaps} highcharts/responsive/axis/\n * Axis changes\n *\n * @type {Array<*>}\n * @since 5.0.0\n * @apioption responsive.rules\n */\n/**\n * A full set of chart options to apply as overrides to the general\n * chart options. The chart options are applied when the given rule\n * is active.\n *\n * A special case is configuration objects that take arrays, for example\n * [xAxis](#xAxis), [yAxis](#yAxis) or [series](#series). For these\n * collections, an `id` option is used to map the new option set to\n * an existing object. If an existing object of the same id is not found,\n * the item of the same index updated. So for example, setting `chartOptions`\n * with two series items without an `id`, will cause the existing chart's\n * two series to be updated with respective options.\n *\n * @sample {highstock} stock/demo/responsive/\n * Stock chart\n * @sample highcharts/responsive/axis/\n * Axis\n * @sample highcharts/responsive/legend/\n * Legend\n * @sample highcharts/responsive/classname/\n * Class name\n *\n * @type {Highcharts.Options}\n * @since 5.0.0\n * @apioption responsive.rules.chartOptions\n */\n/**\n * Under which conditions the rule applies.\n *\n * @since 5.0.0\n * @apioption responsive.rules.condition\n */\n/**\n * A callback function to gain complete control on when the responsive\n * rule applies. Return `true` if it applies. This opens for checking\n * against other metrics than the chart size, for example the document\n * size or other elements.\n *\n * @type {Highcharts.ResponsiveCallbackFunction}\n * @since 5.0.0\n * @context Highcharts.Chart\n * @apioption responsive.rules.condition.callback\n */\n/**\n * The responsive rule applies if the chart height is less than this.\n *\n * @type {number}\n * @since 5.0.0\n * @apioption responsive.rules.condition.maxHeight\n */\n/**\n * The responsive rule applies if the chart width is less than this.\n *\n * @sample highcharts/responsive/axis/\n * Max width is 500\n *\n * @type {number}\n * @since 5.0.0\n * @apioption responsive.rules.condition.maxWidth\n */\n/**\n * The responsive rule applies if the chart height is greater than this.\n *\n * @type {number}\n * @default 0\n * @since 5.0.0\n * @apioption responsive.rules.condition.minHeight\n */\n/**\n * The responsive rule applies if the chart width is greater than this.\n *\n * @type {number}\n * @default 0\n * @since 5.0.0\n * @apioption responsive.rules.condition.minWidth\n */\n(''); // keeps doclets above in JS file\n", "/**\n * @license Highcharts JS v@product.version@ (@product.date@)\n * @module highcharts/highcharts\n *\n * (c) 2009-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */\n'use strict';\nimport Highcharts from '../Core/Globals.js';\nimport Utilities from '../Core/Utilities.js';\nimport Defaults from '../Core/Defaults.js';\nimport Fx from '../Core/Animation/Fx.js';\nimport Animation from '../Core/Animation/AnimationUtilities.js';\nimport AST from '../Core/Renderer/HTML/AST.js';\nimport Templating from '../Core/Templating.js';\nimport RendererRegistry from '../Core/Renderer/RendererRegistry.js';\nimport RendererUtilities from '../Core/Renderer/RendererUtilities.js';\nimport SVGElement from '../Core/Renderer/SVG/SVGElement.js';\nimport SVGRenderer from '../Core/Renderer/SVG/SVGRenderer.js';\nimport HTMLElement from '../Core/Renderer/HTML/HTMLElement.js';\nimport Axis from '../Core/Axis/Axis.js';\nimport DateTimeAxis from '../Core/Axis/DateTimeAxis.js';\nimport LogarithmicAxis from '../Core/Axis/LogarithmicAxis.js';\nimport PlotLineOrBand from '../Core/Axis/PlotLineOrBand/PlotLineOrBand.js';\nimport Tick from '../Core/Axis/Tick.js';\nimport Tooltip from '../Core/Tooltip.js';\nimport Point from '../Core/Series/Point.js';\nimport Pointer from '../Core/Pointer.js';\nimport Legend from '../Core/Legend/Legend.js';\nimport LegendSymbol from '../Core/Legend/LegendSymbol.js';\nimport Chart from '../Core/Chart/Chart.js';\nimport ScrollablePlotArea from '../Extensions/ScrollablePlotArea.js';\nimport StackingAxis from '../Core/Axis/Stacking/StackingAxis.js';\nimport StackItem from '../Core/Axis/Stacking/StackItem.js';\nimport Series from '../Core/Series/Series.js';\nimport SeriesRegistry from '../Core/Series/SeriesRegistry.js';\nimport '../Series/Line/LineSeries.js';\nimport '../Series/Area/AreaSeries.js';\nimport '../Series/Spline/SplineSeries.js';\nimport '../Series/AreaSpline/AreaSplineSeries.js';\nimport '../Series/Column/ColumnSeries.js';\nimport ColumnDataLabel from '../Series/Column/ColumnDataLabel.js';\nimport '../Series/Bar/BarSeries.js';\nimport '../Series/Scatter/ScatterSeries.js';\nimport '../Series/Pie/PieSeries.js';\nimport PieDataLabel from '../Series/Pie/PieDataLabel.js';\nimport DataLabel from '../Core/Series/DataLabel.js';\nimport OverlappingDataLabels from '../Extensions/OverlappingDataLabels.js';\nimport BorderRadius from '../Extensions/BorderRadius.js';\nimport Responsive from '../Core/Responsive.js';\nimport Color from '../Core/Color/Color.js';\nimport Time from '../Core/Time.js';\nconst G = Highcharts;\n// Classes\nG.AST = AST;\nG.Axis = Axis;\nG.Chart = Chart;\nG.Color = Color;\nG.DataLabel = DataLabel;\nG.Fx = Fx;\nG.HTMLElement = HTMLElement;\nG.Legend = Legend;\nG.LegendSymbol = LegendSymbol;\nG.OverlappingDataLabels = G.OverlappingDataLabels || OverlappingDataLabels;\nG.PlotLineOrBand = PlotLineOrBand;\nG.Point = Point;\nG.Pointer = Pointer;\nG.RendererRegistry = RendererRegistry;\nG.Series = Series;\nG.SeriesRegistry = SeriesRegistry;\nG.StackItem = StackItem;\nG.SVGElement = SVGElement;\nG.SVGRenderer = SVGRenderer;\nG.Templating = Templating;\nG.Tick = Tick;\nG.Time = Time;\nG.Tooltip = Tooltip;\n// Utilities\nG.animate = Animation.animate;\nG.animObject = Animation.animObject;\nG.chart = Chart.chart;\nG.color = Color.parse;\nG.dateFormat = Templating.dateFormat;\nG.defaultOptions = Defaults.defaultOptions;\nG.distribute = RendererUtilities.distribute;\nG.format = Templating.format;\nG.getDeferredAnimation = Animation.getDeferredAnimation;\nG.getOptions = Defaults.getOptions;\nG.numberFormat = Templating.numberFormat;\nG.seriesType = SeriesRegistry.seriesType;\nG.setAnimation = Animation.setAnimation;\nG.setOptions = Defaults.setOptions;\nG.stop = Animation.stop;\nG.time = Defaults.defaultTime;\nG.timers = Fx.timers;\n// Compositions\nBorderRadius.compose(G.Series, G.SVGElement, G.SVGRenderer);\nColumnDataLabel.compose(G.Series.types.column);\nDataLabel.compose(G.Series);\nDateTimeAxis.compose(G.Axis);\nHTMLElement.compose(G.SVGRenderer);\nLegend.compose(G.Chart);\nLogarithmicAxis.compose(G.Axis);\nOverlappingDataLabels.compose(G.Chart);\nPieDataLabel.compose(G.Series.types.pie);\nPlotLineOrBand.compose(G.Axis);\nPointer.compose(G.Chart);\nResponsive.compose(G.Chart);\nScrollablePlotArea.compose(G.Axis, G.Chart, G.Series);\nStackingAxis.compose(G.Axis, G.Chart, G.Series);\nTooltip.compose(G.Pointer);\nUtilities.extend(G, Utilities);\n// Default Export\nexport default G;\n", "/* *\n *\n * Imports\n *\n * */\nimport U from '../../Core/Utilities.js';\nconst { addEvent, correctFloat, defined, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/** @private */\nfunction chartGetHoverPane(eventArgs) {\n const chart = this;\n let hoverPane;\n if (eventArgs) {\n chart.pane.forEach((pane) => {\n const x = eventArgs.chartX - chart.plotLeft, y = eventArgs.chartY - chart.plotTop;\n if (isInsidePane(x, y, pane.center)) {\n hoverPane = pane;\n }\n });\n }\n return hoverPane;\n}\n/** @private */\nfunction compose(ChartClass, PointerClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.getHoverPane) {\n chartProto.collectionsWithUpdate.push('pane');\n chartProto.getHoverPane = chartGetHoverPane;\n addEvent(ChartClass, 'afterIsInsidePlot', onChartAfterIsInsiderPlot);\n addEvent(PointerClass, 'afterGetHoverData', onPointerAfterGetHoverData);\n addEvent(PointerClass, 'beforeGetHoverData', onPointerBeforeGetHoverData);\n }\n}\n/**\n * Check whether element is inside or outside pane.\n * @private\n * @param {number} x\n * Element's x coordinate\n * @param {number} y\n * Element's y coordinate\n * @param {Array} center\n * Pane's center (x, y) and diameter\n * @param {number} startAngle\n * Pane's normalized start angle in radians (<-PI, PI>)\n * @param {number} endAngle\n * Pane's normalized end angle in radians (<-PI, PI>)\n */\nfunction isInsidePane(x, y, center, startAngle, endAngle) {\n let insideSlice = true;\n const cx = center[0], cy = center[1];\n const distance = Math.sqrt(Math.pow(x - cx, 2) + Math.pow(y - cy, 2));\n if (defined(startAngle) && defined(endAngle)) {\n // Round angle to N-decimals to avoid numeric errors\n const angle = Math.atan2(correctFloat(y - cy, 8), correctFloat(x - cx, 8));\n // Ignore full circle panes:\n if (endAngle !== startAngle) {\n // If normalized start angle is bigger than normalized end,\n // it means angles have different signs. In such situation we\n // check the <-PI, startAngle> and ranges.\n if (startAngle > endAngle) {\n insideSlice = (angle >= startAngle &&\n angle <= Math.PI) || (angle <= endAngle &&\n angle >= -Math.PI);\n }\n else {\n // In this case, we simple check if angle is within the\n // range\n insideSlice = angle >= startAngle &&\n angle <= correctFloat(endAngle, 8);\n }\n }\n }\n // Round up radius because x and y values are rounded\n return distance <= Math.ceil(center[2] / 2) && insideSlice;\n}\n/**\n * Check if (x, y) position is within pane for polar.\n * @private\n */\nfunction onChartAfterIsInsiderPlot(e) {\n const chart = this;\n if (chart.polar) {\n if (e.options.inverted) {\n [e.x, e.y] = [e.y, e.x];\n }\n e.isInsidePlot = chart.pane.some((pane) => isInsidePane(e.x, e.y, pane.center, pane.axis && pane.axis.normalizedStartAngleRad, pane.axis && pane.axis.normalizedEndAngleRad));\n }\n}\nfunction onPointerAfterGetHoverData(eventArgs) {\n const chart = this.chart;\n if (eventArgs.hoverPoint &&\n eventArgs.hoverPoint.plotX &&\n eventArgs.hoverPoint.plotY &&\n chart.hoverPane &&\n !isInsidePane(eventArgs.hoverPoint.plotX, eventArgs.hoverPoint.plotY, chart.hoverPane.center)) {\n eventArgs.hoverPoint = void 0;\n }\n}\n/** @private */\nfunction onPointerBeforeGetHoverData(eventArgs) {\n const chart = this.chart;\n if (chart.polar) {\n // Find pane we are currently hovering over.\n chart.hoverPane = chart.getHoverPane(eventArgs);\n // Edit filter method to handle polar\n eventArgs.filter = function (s) {\n return (s.visible &&\n !(!eventArgs.shared && s.directTouch) && // #3821\n pick(s.options.enableMouseTracking, true) &&\n (!chart.hoverPane || s.xAxis.pane === chart.hoverPane));\n };\n }\n else {\n chart.hoverPane = void 0;\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst PaneComposition = {\n compose\n};\nexport default PaneComposition;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * An array of background items for the pane.\n *\n * @sample {highcharts} highcharts/demo/gauge-speedometer/\n * Speedometer gauge with multiple backgrounds\n *\n * @type {Array<*>}\n * @optionparent pane.background\n */\nconst background = {\n /**\n * The class name for this background.\n *\n * @sample {highcharts} highcharts/css/pane/\n * Panes styled by CSS\n * @sample {highstock} highcharts/css/pane/\n * Panes styled by CSS\n * @sample {highmaps} highcharts/css/pane/\n * Panes styled by CSS\n *\n * @type {string}\n * @default highcharts-pane\n * @since 5.0.0\n * @apioption pane.background.className\n */\n /**\n * The shape of the pane background. When `solid`, the background\n * is circular. When `arc`, the background extends only from the min\n * to the max of the value axis.\n *\n * @type {Highcharts.PaneBackgroundShapeValue}\n * @since 2.3.0\n * @product highcharts\n */\n shape: 'circle',\n /**\n * The pixel border width of the pane background.\n *\n * @since 2.3.0\n * @product highcharts\n */\n borderWidth: 1,\n /**\n * The pane background border color.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 2.3.0\n * @product highcharts\n */\n borderColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The background color or gradient for the pane.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [[0, #ffffff], [1, #e6e6e6]] }\n * @since 2.3.0\n * @product highcharts\n */\n backgroundColor: {\n /** @ignore-option */\n linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },\n /** @ignore-option */\n stops: [\n [0, \"#ffffff\" /* Palette.backgroundColor */],\n [1, \"#e6e6e6\" /* Palette.neutralColor10 */]\n ]\n },\n /** @ignore-option */\n from: -Number.MAX_VALUE,\n /**\n * The inner radius of the pane background. Can be either numeric\n * (pixels) or a percentage string.\n *\n * @type {number|string}\n * @since 2.3.0\n * @product highcharts\n */\n innerRadius: 0,\n /** @ignore-option */\n to: Number.MAX_VALUE,\n /**\n * The outer radius of the circular pane background. Can be either\n * numeric (pixels) or a percentage string.\n *\n * @type {number|string}\n * @since 2.3.0\n * @product highcharts\n */\n outerRadius: '105%'\n};\n/**\n * The pane serves as a container for axes and backgrounds for circular\n * gauges and polar charts.\n *\n * @since 2.3.0\n * @product highcharts\n * @requires highcharts-more\n * @optionparent pane\n */\nconst pane = {\n /**\n * The end angle of the polar X axis or gauge value axis, given in\n * degrees where 0 is north. Defaults to [startAngle](#pane.startAngle)\n * + 360.\n *\n * @sample {highcharts} highcharts/demo/gauge-vu-meter/\n * VU-meter with custom start and end angle\n *\n * @type {number}\n * @since 2.3.0\n * @product highcharts\n * @apioption pane.endAngle\n */\n /**\n * The center of a polar chart or angular gauge, given as an array\n * of [x, y] positions. Positions can be given as integers that\n * transform to pixels, or as percentages of the plot area size.\n *\n * @sample {highcharts} highcharts/demo/gauge-vu-meter/\n * Two gauges with different center\n *\n * @type {Array}\n * @default [\"50%\", \"50%\"]\n * @since 2.3.0\n * @product highcharts\n */\n center: ['50%', '50%'],\n /**\n * The size of the pane, either as a number defining pixels, or a\n * percentage defining a percentage of the available plot area (the\n * smallest of the plot height or plot width).\n *\n * @sample {highcharts} highcharts/demo/gauge-vu-meter/\n * Smaller size\n *\n * @type {number|string}\n * @product highcharts\n */\n size: '85%',\n /**\n * The inner size of the pane, either as a number defining pixels, or a\n * percentage defining a percentage of the pane's size.\n *\n * @sample {highcharts} highcharts/series-polar/column-inverted-inner\n * The inner size set to 20%\n *\n * @type {number|string}\n * @product highcharts\n */\n innerSize: '0%',\n /**\n * The start angle of the polar X axis or gauge axis, given in degrees\n * where 0 is north. Defaults to 0.\n *\n * @sample {highcharts} highcharts/demo/gauge-vu-meter/\n * VU-meter with custom start and end angle\n *\n * @since 2.3.0\n * @product highcharts\n */\n startAngle: 0\n};\n/* *\n *\n * Default Export\n *\n * */\nconst PaneDefaults = {\n pane,\n background\n};\nexport default PaneDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport CU from '../../Series/CenteredUtilities.js';\nimport PaneComposition from './PaneComposition.js';\nimport PaneDefaults from './PaneDefaults.js';\nimport U from '../../Core/Utilities.js';\nconst { extend, merge, splat } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The Pane object allows options that are common to a set of X and Y axes.\n *\n * In the future, this can be extended to basic Highcharts and Highcharts Stock.\n *\n * @private\n * @class\n * @name Highcharts.Pane\n * @param {Highcharts.PaneOptions} options\n * @param {Highcharts.Chart} chart\n */\nclass Pane {\n /* *\n *\n * Constructor\n *\n * */\n constructor(options, chart) {\n this.coll = 'pane'; // Member of chart.pane\n this.init(options, chart);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Initialize the Pane object\n *\n * @private\n * @function Highcharts.Pane#init\n *\n * @param {Highcharts.PaneOptions} options\n *\n * @param {Highcharts.Chart} chart\n */\n init(options, chart) {\n this.chart = chart;\n this.background = [];\n chart.pane.push(this);\n this.setOptions(options);\n }\n /**\n * @private\n * @function Highcharts.Pane#setOptions\n *\n * @param {Highcharts.PaneOptions} options\n */\n setOptions(options) {\n // Set options. Angular charts have a default background (#3318)\n this.options = options = merge(PaneDefaults.pane, this.chart.angular ? { background: {} } : void 0, options);\n }\n /**\n * Render the pane with its backgrounds.\n *\n * @private\n * @function Highcharts.Pane#render\n */\n render() {\n const options = this.options, renderer = this.chart.renderer;\n if (!this.group) {\n this.group = renderer.g('pane-group')\n .attr({ zIndex: options.zIndex || 0 })\n .add();\n }\n this.updateCenter();\n let backgroundOption = this.options.background;\n // Render the backgrounds\n if (backgroundOption) {\n backgroundOption = splat(backgroundOption);\n const len = Math.max(backgroundOption.length, this.background.length || 0);\n for (let i = 0; i < len; i++) {\n // #6641 - if axis exists, chart is circular and apply\n // background\n if (backgroundOption[i] && this.axis) {\n this.renderBackground(merge(PaneDefaults.background, backgroundOption[i]), i);\n }\n else if (this.background[i]) {\n this.background[i] = this.background[i].destroy();\n this.background.splice(i, 1);\n }\n }\n }\n }\n /**\n * Render an individual pane background.\n *\n * @private\n * @function Highcharts.Pane#renderBackground\n *\n * @param {Highcharts.PaneBackgroundOptions} backgroundOptions\n * Background options\n *\n * @param {number} i\n * The index of the background in this.backgrounds\n */\n renderBackground(backgroundOptions, i) {\n const attribs = {\n 'class': 'highcharts-pane ' + (backgroundOptions.className || '')\n };\n let method = 'animate';\n if (!this.chart.styledMode) {\n extend(attribs, {\n 'fill': backgroundOptions.backgroundColor,\n 'stroke': backgroundOptions.borderColor,\n 'stroke-width': backgroundOptions.borderWidth\n });\n }\n if (!this.background[i]) {\n this.background[i] = this.chart.renderer\n .path()\n .add(this.group);\n method = 'attr';\n }\n this.background[i][method]({\n 'd': this.axis.getPlotBandPath(backgroundOptions.from, backgroundOptions.to, backgroundOptions)\n }).attr(attribs);\n }\n /**\n * Gets the center for the pane and its axis.\n *\n * @private\n * @function Highcharts.Pane#updateCenter\n * @param {Highcharts.Axis} [axis]\n */\n updateCenter(axis) {\n this.center = (axis ||\n this.axis ||\n {}).center = CU.getCenter.call(this);\n }\n /**\n * Destroy the pane item\n *\n * @ignore\n * @private\n * @function Highcharts.Pane#destroy\n * /\n destroy: function () {\n erase(this.chart.pane, this);\n this.background.forEach(function (background) {\n background.destroy();\n });\n this.background.length = 0;\n this.group = this.group.destroy();\n },\n */\n /**\n * Update the pane item with new options\n *\n * @private\n * @function Highcharts.Pane#update\n * @param {Highcharts.PaneOptions} options\n * New pane options\n * @param {boolean} [redraw]\n */\n update(options, redraw) {\n merge(true, this.options, options);\n this.setOptions(this.options);\n this.render();\n this.chart.axes.forEach(function (axis) {\n if (axis.pane === this) {\n axis.pane = null;\n axis.update({}, redraw);\n }\n }, this);\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nPane.compose = PaneComposition.compose;\n/* *\n *\n * Default Export\n *\n * */\nexport default Pane;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * @typedef {\"arc\"|\"circle\"|\"solid\"} Highcharts.PaneBackgroundShapeValue\n */\n''; // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { area: { prototype: { pointClass: AreaPoint, pointClass: { prototype: areaProto } } } } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { defined, isNumber } = U;\n/* *\n *\n * Class\n *\n * */\nclass AreaRangePoint extends AreaPoint {\n /**\n * Range series only. The high or maximum value for each data point.\n * @name Highcharts.Point#high\n * @type {number|undefined}\n */\n /**\n * Range series only. The low or minimum value for each data point.\n * @name Highcharts.Point#low\n * @type {number|undefined}\n */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n setState() {\n const prevState = this.state, series = this.series, isPolar = series.chart.polar;\n if (!defined(this.plotHigh)) {\n // Boost doesn't calculate plotHigh\n this.plotHigh = series.yAxis.toPixels(this.high, true);\n }\n if (!defined(this.plotLow)) {\n // Boost doesn't calculate plotLow\n this.plotLow = this.plotY = series.yAxis.toPixels(this.low, true);\n }\n series.lowerStateMarkerGraphic = series.stateMarkerGraphic;\n series.stateMarkerGraphic = series.upperStateMarkerGraphic;\n // Change state also for the top marker\n this.graphic = this.graphics && this.graphics[1];\n this.plotY = this.plotHigh;\n if (isPolar && isNumber(this.plotHighX)) {\n this.plotX = this.plotHighX;\n }\n // Top state:\n areaProto.setState.apply(this, arguments);\n this.state = prevState;\n // Now restore defaults\n this.plotY = this.plotLow;\n this.graphic = this.graphics && this.graphics[0];\n if (isPolar && isNumber(this.plotLowX)) {\n this.plotX = this.plotLowX;\n }\n series.upperStateMarkerGraphic = series.stateMarkerGraphic;\n series.stateMarkerGraphic = series.lowerStateMarkerGraphic;\n // Lower marker is stored at stateMarkerGraphic\n // to avoid reference duplication (#7021)\n series.lowerStateMarkerGraphic = void 0;\n const originalSettings = series.modifyMarkerSettings();\n // Bottom state\n areaProto.setState.apply(this, arguments);\n // Restore previous state\n series.restoreMarkerSettings(originalSettings);\n }\n haloPath() {\n const isPolar = this.series.chart.polar;\n let path = [];\n // Bottom halo\n this.plotY = this.plotLow;\n if (isPolar && isNumber(this.plotLowX)) {\n this.plotX = this.plotLowX;\n }\n if (this.isInside) {\n path = areaProto.haloPath.apply(this, arguments);\n }\n // Top halo\n this.plotY = this.plotHigh;\n if (isPolar && isNumber(this.plotHighX)) {\n this.plotX = this.plotHighX;\n }\n if (this.isTopInside) {\n path = path.concat(areaProto.haloPath.apply(this, arguments));\n }\n return path;\n }\n isValid() {\n return isNumber(this.low) && isNumber(this.high);\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default AreaRangePoint;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AreaRangePoint from './AreaRangePoint.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { area: AreaSeries, area: { prototype: areaProto }, column: { prototype: columnProto } } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, defined, extend, isArray, isNumber, pick, merge } = U;\n/* *\n *\n * Constants\n *\n * */\n/**\n * The area range series is a carteseian series with higher and lower values for\n * each point along an X axis, where the area between the values is shaded.\n *\n * @sample {highcharts} highcharts/demo/arearange/\n * Area range chart\n * @sample {highstock} stock/demo/arearange/\n * Area range chart\n *\n * @extends plotOptions.area\n * @product highcharts highstock\n * @excluding stack, stacking\n * @requires highcharts-more\n * @optionparent plotOptions.arearange\n *\n * @private\n */\nconst areaRangeSeriesOptions = {\n /**\n * @see [fillColor](#plotOptions.arearange.fillColor)\n * @see [fillOpacity](#plotOptions.arearange.fillOpacity)\n *\n * @apioption plotOptions.arearange.color\n */\n /**\n * @default low\n * @apioption plotOptions.arearange.colorKey\n */\n /**\n * @see [color](#plotOptions.arearange.color)\n * @see [fillOpacity](#plotOptions.arearange.fillOpacity)\n *\n * @apioption plotOptions.arearange.fillColor\n */\n /**\n * @see [color](#plotOptions.arearange.color)\n * @see [fillColor](#plotOptions.arearange.fillColor)\n *\n * @default {highcharts} 0.75\n * @default {highstock} 0.75\n * @apioption plotOptions.arearange.fillOpacity\n */\n /**\n * Whether to apply a drop shadow to the graph line. Since 2.3 the\n * shadow can be an object configuration containing `color`, `offsetX`,\n * `offsetY`, `opacity` and `width`.\n *\n * @type {boolean|Highcharts.ShadowOptionsObject}\n * @product highcharts\n * @apioption plotOptions.arearange.shadow\n */\n /**\n * Pixel width of the arearange graph line.\n *\n * @since 2.3.0\n *\n * @private\n */\n lineWidth: 1,\n /**\n * @type {number|null}\n */\n threshold: null,\n tooltip: {\n pointFormat: '\\u25CF ' +\n '{series.name}: {point.low} - {point.high}
'\n },\n /**\n * Whether the whole area or just the line should respond to mouseover\n * tooltips and other mouse or touch events.\n *\n * @since 2.3.0\n *\n * @private\n */\n trackByArea: true,\n /**\n * Extended data labels for range series types. Range series data\n * labels use no `x` and `y` options. Instead, they have `xLow`,\n * `xHigh`, `yLow` and `yHigh` options to allow the higher and lower\n * data label sets individually.\n *\n * @declare Highcharts.SeriesAreaRangeDataLabelsOptionsObject\n * @exclude x, y\n * @since 2.3.0\n * @product highcharts highstock\n *\n * @private\n */\n dataLabels: {\n align: void 0,\n verticalAlign: void 0,\n /**\n * X offset of the lower data labels relative to the point value.\n *\n * @sample highcharts/plotoptions/arearange-datalabels/\n * Data labels on range series\n * @sample highcharts/plotoptions/arearange-datalabels/\n * Data labels on range series\n */\n xLow: 0,\n /**\n * X offset of the higher data labels relative to the point value.\n *\n * @sample highcharts/plotoptions/arearange-datalabels/\n * Data labels on range series\n */\n xHigh: 0,\n /**\n * Y offset of the lower data labels relative to the point value.\n *\n * @sample highcharts/plotoptions/arearange-datalabels/\n * Data labels on range series\n */\n yLow: 0,\n /**\n * Y offset of the higher data labels relative to the point value.\n *\n * @sample highcharts/plotoptions/arearange-datalabels/\n * Data labels on range series\n */\n yHigh: 0\n }\n};\n/* *\n *\n * Class\n *\n * */\n/**\n * The AreaRange series type.\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.arearange\n *\n * @augments Highcharts.Series\n */\nclass AreaRangeSeries extends AreaSeries {\n /* *\n *\n * Functions\n *\n * */\n toYData(point) {\n return [point.low, point.high];\n }\n /**\n * Translate a point's plotHigh from the internal angle and radius measures\n * to true plotHigh coordinates. This is an addition of the toXY method\n * found in Polar.js, because it runs too early for arearanges to be\n * considered (#3419).\n * @private\n */\n highToXY(point) {\n // Find the polar plotX and plotY\n const chart = this.chart, xy = this.xAxis.postTranslate(point.rectPlotX || 0, this.yAxis.len - (point.plotHigh || 0));\n point.plotHighX = xy.x - chart.plotLeft;\n point.plotHigh = xy.y - chart.plotTop;\n point.plotLowX = point.plotX;\n }\n /**\n * Extend the line series' getSegmentPath method by applying the segment\n * path to both lower and higher values of the range.\n * @private\n */\n getGraphPath(points) {\n const highPoints = [], highAreaPoints = [], getGraphPath = areaProto.getGraphPath, options = this.options, polar = this.chart.polar, connectEnds = polar && options.connectEnds !== false, connectNulls = options.connectNulls;\n let i, point, pointShim, step = options.step;\n points = points || this.points;\n // Create the top line and the top part of the area fill. The area fill\n // compensates for null points by drawing down to the lower graph,\n // moving across the null gap and starting again at the lower graph.\n i = points.length;\n while (i--) {\n point = points[i];\n // Support for polar\n const highAreaPoint = polar ? {\n plotX: point.rectPlotX,\n plotY: point.yBottom,\n doCurve: false // #5186, gaps in areasplinerange fill\n } : {\n plotX: point.plotX,\n plotY: point.plotY,\n doCurve: false // #5186, gaps in areasplinerange fill\n };\n if (!point.isNull &&\n !connectEnds &&\n !connectNulls &&\n (!points[i + 1] || points[i + 1].isNull)) {\n highAreaPoints.push(highAreaPoint);\n }\n pointShim = {\n polarPlotY: point.polarPlotY,\n rectPlotX: point.rectPlotX,\n yBottom: point.yBottom,\n // plotHighX is for polar charts\n plotX: pick(point.plotHighX, point.plotX),\n plotY: point.plotHigh,\n isNull: point.isNull\n };\n highAreaPoints.push(pointShim);\n highPoints.push(pointShim);\n if (!point.isNull &&\n !connectEnds &&\n !connectNulls &&\n (!points[i - 1] || points[i - 1].isNull)) {\n highAreaPoints.push(highAreaPoint);\n }\n }\n // Get the paths\n const lowerPath = getGraphPath.call(this, points);\n if (step) {\n if (step === true) {\n step = 'left';\n }\n options.step = {\n left: 'right',\n center: 'center',\n right: 'left'\n }[step]; // swap for reading in getGraphPath\n }\n const higherPath = getGraphPath.call(this, highPoints);\n const higherAreaPath = getGraphPath.call(this, highAreaPoints);\n options.step = step;\n // Create a line on both top and bottom of the range\n const linePath = [].concat(lowerPath, higherPath);\n // For the area path, we need to change the 'move' statement into\n // 'lineTo'\n if (!this.chart.polar &&\n higherAreaPath[0] &&\n higherAreaPath[0][0] === 'M') {\n // This probably doesn't work for spline\n higherAreaPath[0] = [\n 'L',\n higherAreaPath[0][1],\n higherAreaPath[0][2]\n ];\n }\n this.graphPath = linePath;\n this.areaPath = lowerPath.concat(higherAreaPath);\n // Prepare for sideways animation\n linePath.isArea = true;\n linePath.xMap = lowerPath.xMap;\n this.areaPath.xMap = lowerPath.xMap;\n return linePath;\n }\n /**\n * Extend the basic drawDataLabels method by running it for both lower and\n * higher values.\n * @private\n */\n drawDataLabels() {\n const data = this.points, length = data.length, originalDataLabels = [], dataLabelOptions = this.options.dataLabels, inverted = this.chart.inverted;\n let i, point, up, upperDataLabelOptions, lowerDataLabelOptions;\n if (dataLabelOptions) {\n // Split into upper and lower options. If data labels is an array,\n // the first element is the upper label, the second is the lower.\n //\n // TODO: We want to change this and allow multiple labels for both\n // upper and lower values in the future - introducing some options\n // for which point value to use as Y for the dataLabel, so that this\n // could be handled in Series.drawDataLabels. This would also\n // improve performance since we now have to loop over all the points\n // multiple times to work around the data label logic.\n if (isArray(dataLabelOptions)) {\n upperDataLabelOptions = dataLabelOptions[0] || {\n enabled: false\n };\n lowerDataLabelOptions = dataLabelOptions[1] || {\n enabled: false\n };\n }\n else {\n // Make copies\n upperDataLabelOptions = extend({}, dataLabelOptions);\n upperDataLabelOptions.x = dataLabelOptions.xHigh;\n upperDataLabelOptions.y = dataLabelOptions.yHigh;\n lowerDataLabelOptions = extend({}, dataLabelOptions);\n lowerDataLabelOptions.x = dataLabelOptions.xLow;\n lowerDataLabelOptions.y = dataLabelOptions.yLow;\n }\n // Draw upper labels\n if (upperDataLabelOptions.enabled || this.hasDataLabels?.()) {\n // Set preliminary values for plotY and dataLabel\n // and draw the upper labels\n i = length;\n while (i--) {\n point = data[i];\n if (point) {\n const { plotHigh = 0, plotLow = 0 } = point;\n up = upperDataLabelOptions.inside ?\n plotHigh < plotLow :\n plotHigh > plotLow;\n point.y = point.high;\n point._plotY = point.plotY;\n point.plotY = plotHigh;\n // Store original data labels and set preliminary label\n // objects to be picked up in the uber method\n originalDataLabels[i] = point.dataLabel;\n point.dataLabel = point.dataLabelUpper;\n // Set the default offset\n point.below = up;\n if (inverted) {\n if (!upperDataLabelOptions.align) {\n upperDataLabelOptions.align = up ?\n 'right' : 'left';\n }\n }\n else {\n if (!upperDataLabelOptions.verticalAlign) {\n upperDataLabelOptions.verticalAlign = up ?\n 'top' :\n 'bottom';\n }\n }\n }\n }\n this.options.dataLabels = upperDataLabelOptions;\n if (areaProto.drawDataLabels) {\n // #1209:\n areaProto.drawDataLabels.apply(this, arguments);\n }\n // Reset state after the upper labels were created. Move\n // it to point.dataLabelUpper and reassign the originals.\n // We do this here to support not drawing a lower label.\n i = length;\n while (i--) {\n point = data[i];\n if (point) {\n point.dataLabelUpper = point.dataLabel;\n point.dataLabel = originalDataLabels[i];\n delete point.dataLabels;\n point.y = point.low;\n point.plotY = point._plotY;\n }\n }\n }\n // Draw lower labels\n if (lowerDataLabelOptions.enabled || this.hasDataLabels?.()) {\n i = length;\n while (i--) {\n point = data[i];\n if (point) {\n const { plotHigh = 0, plotLow = 0 } = point;\n up = lowerDataLabelOptions.inside ?\n plotHigh < plotLow :\n plotHigh > plotLow;\n // Set the default offset\n point.below = !up;\n if (inverted) {\n if (!lowerDataLabelOptions.align) {\n lowerDataLabelOptions.align = up ?\n 'left' : 'right';\n }\n }\n else {\n if (!lowerDataLabelOptions.verticalAlign) {\n lowerDataLabelOptions.verticalAlign = up ?\n 'bottom' :\n 'top';\n }\n }\n }\n }\n this.options.dataLabels = lowerDataLabelOptions;\n if (areaProto.drawDataLabels) {\n areaProto.drawDataLabels.apply(this, arguments);\n }\n }\n // Merge upper and lower into point.dataLabels for later destroying\n if (upperDataLabelOptions.enabled) {\n i = length;\n while (i--) {\n point = data[i];\n if (point) {\n point.dataLabels = [\n point.dataLabelUpper,\n point.dataLabel\n ].filter(function (label) {\n return !!label;\n });\n }\n }\n }\n // Reset options\n this.options.dataLabels = dataLabelOptions;\n }\n }\n alignDataLabel() {\n columnProto.alignDataLabel.apply(this, arguments);\n }\n modifyMarkerSettings() {\n const series = this, originalMarkerSettings = {\n marker: series.options.marker,\n symbol: series.symbol\n };\n if (series.options.lowMarker) {\n const { options: { marker, lowMarker } } = series;\n series.options.marker = merge(marker, lowMarker);\n if (lowMarker.symbol) {\n series.symbol = lowMarker.symbol;\n }\n }\n return originalMarkerSettings;\n }\n restoreMarkerSettings(originalSettings) {\n const series = this;\n series.options.marker = originalSettings.marker;\n series.symbol = originalSettings.symbol;\n }\n drawPoints() {\n const series = this, pointLength = series.points.length;\n let i, point;\n const originalSettings = series.modifyMarkerSettings();\n // Draw bottom points\n areaProto.drawPoints.apply(series, arguments);\n // Restore previous state\n series.restoreMarkerSettings(originalSettings);\n // Prepare drawing top points\n i = 0;\n while (i < pointLength) {\n point = series.points[i];\n /**\n * Array for multiple SVG graphics representing the point in the\n * chart. Only used in cases where the point can not be represented\n * by a single graphic.\n *\n * @see Highcharts.Point#graphic\n *\n * @name Highcharts.Point#graphics\n * @type {Array|undefined}\n */\n point.graphics = point.graphics || [];\n // Save original props to be overridden by temporary props for top\n // points\n point.origProps = {\n plotY: point.plotY,\n plotX: point.plotX,\n isInside: point.isInside,\n negative: point.negative,\n zone: point.zone,\n y: point.y\n };\n if (point.graphic || point.graphics[0]) {\n point.graphics[0] = point.graphic;\n }\n point.graphic = point.graphics[1];\n point.plotY = point.plotHigh;\n if (defined(point.plotHighX)) {\n point.plotX = point.plotHighX;\n }\n point.y = pick(point.high, point.origProps.y); // #15523\n point.negative = point.y < (series.options.threshold || 0);\n if (series.zones.length) {\n point.zone = point.getZone();\n }\n if (!series.chart.polar) {\n point.isInside = point.isTopInside = (typeof point.plotY !== 'undefined' &&\n point.plotY >= 0 &&\n point.plotY <= series.yAxis.len && // #3519\n point.plotX >= 0 &&\n point.plotX <= series.xAxis.len);\n }\n i++;\n }\n // Draw top points\n areaProto.drawPoints.apply(series, arguments);\n // Reset top points preliminary modifications\n i = 0;\n while (i < pointLength) {\n point = series.points[i];\n point.graphics = point.graphics || [];\n if (point.graphic || point.graphics[1]) {\n point.graphics[1] = point.graphic;\n }\n point.graphic = point.graphics[0];\n if (point.origProps) {\n extend(point, point.origProps);\n delete point.origProps;\n }\n i++;\n }\n }\n hasMarkerChanged(options, oldOptions) {\n const lowMarker = options.lowMarker, oldMarker = oldOptions.lowMarker || {};\n return (lowMarker && (lowMarker.enabled === false ||\n oldMarker.symbol !== lowMarker.symbol || // #10870, #15946\n oldMarker.height !== lowMarker.height || // #16274\n oldMarker.width !== lowMarker.width // #16274\n )) || super.hasMarkerChanged(options, oldOptions);\n }\n}\n/**\n *\n * Static Properties\n *\n */\nAreaRangeSeries.defaultOptions = merge(AreaSeries.defaultOptions, areaRangeSeriesOptions);\naddEvent(AreaRangeSeries, 'afterTranslate', function () {\n // Set plotLow and plotHigh\n // Rules out lollipop, but lollipop should not inherit range series in the\n // first place\n if (this.pointArrayMap.join(',') === 'low,high') {\n this.points.forEach((point) => {\n const high = point.high, plotY = point.plotY;\n if (point.isNull) {\n point.plotY = void 0;\n }\n else {\n point.plotLow = plotY;\n // Calculate plotHigh value based on each yAxis scale (#15752)\n point.plotHigh = isNumber(high) ? this.yAxis.translate(this.dataModify ?\n this.dataModify.modifyValue(high) : high, false, true, void 0, true) : void 0;\n if (this.dataModify) {\n point.yBottom = point.plotHigh;\n }\n }\n });\n }\n}, { order: 0 });\naddEvent(AreaRangeSeries, 'afterTranslate', function () {\n this.points.forEach((point) => {\n // Postprocessing after the PolarComposition's afterTranslate\n if (this.chart.polar) {\n this.highToXY(point);\n point.plotLow = point.plotY;\n point.tooltipPos = [\n ((point.plotHighX || 0) + (point.plotLowX || 0)) / 2,\n ((point.plotHigh || 0) + (point.plotLow || 0)) / 2\n ];\n // Put the tooltip in the middle of the range\n }\n else {\n const tooltipPos = point.pos(false, point.plotLow), posHigh = point.pos(false, point.plotHigh);\n if (tooltipPos && posHigh) {\n tooltipPos[0] = (tooltipPos[0] + posHigh[0]) / 2;\n tooltipPos[1] = (tooltipPos[1] + posHigh[1]) / 2;\n }\n point.tooltipPos = tooltipPos;\n }\n });\n}, { order: 3 });\nextend(AreaRangeSeries.prototype, {\n deferTranslatePolar: true,\n pointArrayMap: ['low', 'high'],\n pointClass: AreaRangePoint,\n pointValKey: 'low',\n setStackedPoints: noop\n});\nSeriesRegistry.registerSeriesType('arearange', AreaRangeSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default AreaRangeSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * A `arearange` series. If the [type](#series.arearange.type) option is not\n * specified, it is inherited from [chart.type](#chart.type).\n *\n *\n * @extends series,plotOptions.arearange\n * @excluding dataParser, dataURL, stack, stacking\n * @product highcharts highstock\n * @requires highcharts-more\n * @apioption series.arearange\n */\n/**\n * @see [fillColor](#series.arearange.fillColor)\n * @see [fillOpacity](#series.arearange.fillOpacity)\n *\n * @apioption series.arearange.color\n */\n/**\n * An array of data points for the series. For the `arearange` series type,\n * points can be given in the following ways:\n *\n * 1. An array of arrays with 3 or 2 values. In this case, the values\n * correspond to `x,low,high`. If the first value is a string, it is\n * applied as the name of the point, and the `x` value is inferred.\n * The `x` value can also be omitted, in which case the inner arrays\n * should be of length 2\\. Then the `x` value is automatically calculated,\n * either starting at 0 and incremented by 1, or from `pointStart`\n * and `pointInterval` given in the series options.\n * ```js\n * data: [\n * [0, 8, 3],\n * [1, 1, 1],\n * [2, 6, 8]\n * ]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.arearange.turboThreshold),\n * this option is not available.\n * ```js\n * data: [{\n * x: 1,\n * low: 9,\n * high: 0,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * low: 3,\n * high: 4,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|Array<(number|string),number,number>|*>}\n * @extends series.line.data\n * @excluding marker, y\n * @product highcharts highstock\n * @apioption series.arearange.data\n */\n/**\n * @extends series.arearange.dataLabels\n * @product highcharts highstock\n * @apioption series.arearange.data.dataLabels\n */\n/**\n * @see [color](#series.arearange.color)\n * @see [fillOpacity](#series.arearange.fillOpacity)\n *\n * @apioption series.arearange.fillColor\n */\n/**\n * @see [color](#series.arearange.color)\n * @see [fillColor](#series.arearange.fillColor)\n *\n * @default {highcharts} 0.75\n * @default {highstock} 0.75\n * @apioption series.arearange.fillOpacity\n */\n/**\n * Options for the lower markers of the arearange-like series. When `lowMarker`\n * is not defined, options inherit form the marker.\n *\n * @see [marker](#series.arearange.marker)\n *\n * @declare Highcharts.PointMarkerOptionsObject\n * @extends plotOptions.series.marker\n * @default undefined\n * @product highcharts highstock\n * @apioption plotOptions.arearange.lowMarker\n */\n/**\n *\n * @sample {highcharts} highcharts/series-arearange/lowmarker/\n * Area range chart with `lowMarker` option\n *\n * @declare Highcharts.PointMarkerOptionsObject\n * @extends plotOptions.series.marker.symbol\n * @product highcharts highstock\n * @apioption plotOptions.arearange.lowMarker.symbol\n */\n/**\n * The high or maximum value for each data point.\n *\n * @type {number}\n * @product highcharts highstock\n * @apioption series.arearange.data.high\n */\n/**\n * The low or minimum value for each data point.\n *\n * @type {number}\n * @product highcharts highstock\n * @apioption series.arearange.data.low\n */\n''; // adds doclets above to transpiled file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AreaRangeSeries from '../AreaRange/AreaRangeSeries.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { spline: { prototype: splineProto } } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { merge, extend } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The areasplinerange series type.\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.areasplinerange\n *\n * @augments Highcharts.Series\n */\nclass AreaSplineRangeSeries extends AreaRangeSeries {\n}\n/* *\n *\n * Static Properties\n *\n * */\nAreaSplineRangeSeries.defaultOptions = merge(AreaRangeSeries.defaultOptions);\nextend(AreaSplineRangeSeries.prototype, {\n getPointSpline: splineProto.getPointSpline\n});\nSeriesRegistry.registerSeriesType('areasplinerange', AreaSplineRangeSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default AreaSplineRangeSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * The area spline range is a cartesian series type with higher and\n * lower Y values along an X axis. The area inside the range is colored, and\n * the graph outlining the area is a smoothed spline.\n *\n * @sample {highstock|highstock} stock/demo/areasplinerange/\n * Area spline range\n *\n * @extends plotOptions.arearange\n * @since 2.3.0\n * @excluding step, boostThreshold, boostBlending\n * @product highcharts highstock\n * @requires highcharts-more\n * @apioption plotOptions.areasplinerange\n */\n/**\n * @see [fillColor](#plotOptions.areasplinerange.fillColor)\n * @see [fillOpacity](#plotOptions.areasplinerange.fillOpacity)\n *\n * @apioption plotOptions.areasplinerange.color\n */\n/**\n * @see [color](#plotOptions.areasplinerange.color)\n * @see [fillOpacity](#plotOptions.areasplinerange.fillOpacity)\n *\n * @apioption plotOptions.areasplinerange.fillColor\n */\n/**\n * @see [color](#plotOptions.areasplinerange.color)\n * @see [fillColor](#plotOptions.areasplinerange.fillColor)\n *\n * @default 0.75\n * @apioption plotOptions.areasplinerange.fillOpacity\n */\n/**\n * A `areasplinerange` series. If the [type](#series.areasplinerange.type)\n * option is not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.areasplinerange\n * @excluding dataParser, dataURL, stack, step, boostThreshold, boostBlending\n * @product highcharts highstock\n * @requires highcharts-more\n * @apioption series.areasplinerange\n */\n/**\n * @see [fillColor](#series.areasplinerange.fillColor)\n * @see [fillOpacity](#series.areasplinerange.fillOpacity)\n *\n * @apioption series.areasplinerange.color\n */\n/**\n * An array of data points for the series. For the `areasplinerange`\n * series type, points can be given in the following ways:\n *\n * 1. An array of arrays with 3 or 2 values. In this case, the values correspond\n * to `x,low,high`. If the first value is a string, it is applied as the name\n * of the point, and the `x` value is inferred. The `x` value can also be\n * omitted, in which case the inner arrays should be of length 2\\. Then the\n * `x` value is automatically calculated, either starting at 0 and\n * incremented by 1, or from `pointStart` and `pointInterval` given in the\n * series options.\n * ```js\n * data: [\n * [0, 0, 5],\n * [1, 9, 1],\n * [2, 5, 2]\n * ]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.areasplinerange.turboThreshold), this option is\n * not available.\n * ```js\n * data: [{\n * x: 1,\n * low: 5,\n * high: 0,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * low: 4,\n * high: 1,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|Array<(number|string),number,number>|*>}\n * @extends series.arearange.data\n * @product highcharts highstock\n * @apioption series.areasplinerange.data\n */\n/**\n * @see [color](#series.areasplinerange.color)\n * @see [fillOpacity](#series.areasplinerange.fillOpacity)\n *\n * @apioption series.areasplinerange.fillColor\n */\n/**\n * @see [color](#series.areasplinerange.color)\n * @see [fillColor](#series.areasplinerange.fillColor)\n *\n * @default 0.75\n * @apioption series.areasplinerange.fillOpacity\n */\n''; // adds doclets above to transpiled file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * A box plot is a convenient way of depicting groups of data through their\n * five-number summaries: the smallest observation (sample minimum), lower\n * quartile (Q1), median (Q2), upper quartile (Q3), and largest observation\n * (sample maximum).\n *\n * @sample highcharts/demo/box-plot/\n * Box plot\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n * @sample {highcharts} highcharts/series-scatter/jitter-boxplot\n * Jittered scatter plot on top of a box plot\n *\n * @extends plotOptions.column\n * @excluding borderColor, borderRadius, borderWidth, groupZPadding,\n * states, boostThreshold, boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @optionparent plotOptions.boxplot\n */\nconst BoxPlotSeriesDefaults = {\n /**\n * @type {number|null}\n */\n threshold: null,\n tooltip: {\n pointFormat: '\\u25CF ' +\n '{series.name}
' +\n 'Maximum: {point.high}
' +\n 'Upper quartile: {point.q3}
' +\n 'Median: {point.median}
' +\n 'Lower quartile: {point.q1}
' +\n 'Minimum: {point.low}
'\n },\n /**\n * The length of the whiskers, the horizontal lines marking low and\n * high values. It can be a numerical pixel value, or a percentage\n * value of the box width. Set `0` to disable whiskers.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * True by default\n *\n * @type {number|string}\n * @since 3.0\n * @product highcharts\n */\n whiskerLength: '50%',\n /**\n * The fill color of the box.\n *\n * In styled mode, the fill color can be set with the\n * `.highcharts-boxplot-box` class.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #ffffff\n * @since 3.0\n * @product highcharts\n */\n fillColor: \"#ffffff\" /* Palette.backgroundColor */,\n /**\n * The width of the line surrounding the box. If any of\n * [stemWidth](#plotOptions.boxplot.stemWidth),\n * [medianWidth](#plotOptions.boxplot.medianWidth)\n * or [whiskerWidth](#plotOptions.boxplot.whiskerWidth) are `null`,\n * the lineWidth also applies to these lines.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/plotoptions/error-bar-styling/\n * Error bar styling\n *\n * @since 3.0\n * @product highcharts\n */\n lineWidth: 1,\n /**\n * The color of the median line. If `undefined`, the general series\n * color applies.\n *\n * In styled mode, the median stroke width can be set with the\n * `.highcharts-boxplot-median` class.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n * @sample {highcharts} highcharts/plotoptions/error-bar-styling/\n * Error bar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject}\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.boxplot.medianColor\n */\n /**\n * The pixel width of the median line. If `null`, the\n * [lineWidth](#plotOptions.boxplot.lineWidth) is used.\n *\n * In styled mode, the median stroke width can be set with the\n * `.highcharts-boxplot-median` class.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {number|null}\n * @since 3.0\n * @product highcharts\n */\n medianWidth: 2,\n /*\n // States are not working and are removed from docs.\n // Refer to: #2340\n states: {\n hover: {\n brightness: -0.3\n }\n },\n */\n /**\n * The color of the stem, the vertical line extending from the box to\n * the whiskers. If `undefined`, the series color is used.\n *\n * In styled mode, the stem stroke can be set with the\n * `.highcharts-boxplot-stem` class.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n * @sample {highcharts} highcharts/plotoptions/error-bar-styling/\n * Error bar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.boxplot.stemColor\n */\n /**\n * The dash style of the box.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 8.1.0\n * @product highcharts\n * @apioption plotOptions.boxplot.boxDashStyle\n */\n /**\n * The dash style of the median.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 8.1.0\n * @product highcharts\n * @apioption plotOptions.boxplot.medianDashStyle\n */\n /**\n * The dash style of the stem, the vertical line extending from the\n * box to the whiskers.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n * @sample {highcharts} highcharts/plotoptions/error-bar-styling/\n * Error bar styling\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.boxplot.stemDashStyle\n */\n /**\n * The dash style of the whiskers.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 8.1.0\n * @product highcharts\n * @apioption plotOptions.boxplot.whiskerDashStyle\n */\n /**\n * The width of the stem, the vertical line extending from the box to\n * the whiskers. If `undefined`, the width is inherited from the\n * [lineWidth](#plotOptions.boxplot.lineWidth) option.\n *\n * In styled mode, the stem stroke width can be set with the\n * `.highcharts-boxplot-stem` class.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n * @sample {highcharts} highcharts/plotoptions/error-bar-styling/\n * Error bar styling\n *\n * @type {number}\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.boxplot.stemWidth\n */\n /**\n * @default high\n * @apioption plotOptions.boxplot.colorKey\n */\n /**\n * The color of the whiskers, the horizontal lines marking low and high\n * values. When `undefined`, the general series color is used.\n *\n * In styled mode, the whisker stroke can be set with the\n * `.highcharts-boxplot-whisker` class .\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.boxplot.whiskerColor\n */\n /**\n * The line width of the whiskers, the horizontal lines marking low and\n * high values. When `undefined`, the general\n * [lineWidth](#plotOptions.boxplot.lineWidth) applies.\n *\n * In styled mode, the whisker stroke width can be set with the\n * `.highcharts-boxplot-whisker` class.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @since 3.0\n * @product highcharts\n */\n whiskerWidth: 2\n};\n/**\n * A `boxplot` series. If the [type](#series.boxplot.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.boxplot\n * @excluding dataParser, dataURL, marker, stack, stacking, states,\n * boostThreshold, boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @apioption series.boxplot\n */\n/**\n * An array of data points for the series. For the `boxplot` series\n * type, points can be given in the following ways:\n *\n * 1. An array of arrays with 6 or 5 values. In this case, the values correspond\n * to `x,low,q1,median,q3,high`. If the first value is a string, it is\n * applied as the name of the point, and the `x` value is inferred. The `x`\n * value can also be omitted, in which case the inner arrays should be of\n * length 5. Then the `x` value is automatically calculated, either starting\n * at 0 and incremented by 1, or from `pointStart` and `pointInterval` given\n * in the series options.\n * ```js\n * data: [\n * [0, 3, 0, 10, 3, 5],\n * [1, 7, 8, 7, 2, 9],\n * [2, 6, 9, 5, 1, 3]\n * ]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.boxplot.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * low: 4,\n * q1: 9,\n * median: 9,\n * q3: 1,\n * high: 10,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * low: 5,\n * q1: 7,\n * median: 3,\n * q3: 6,\n * high: 2,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|Array<(number|string),number,number,number,number,number>|*>}\n * @extends series.line.data\n * @excluding marker\n * @product highcharts\n * @apioption series.boxplot.data\n */\n/**\n * The `high` value for each data point, signifying the highest value\n * in the sample set. The top whisker is drawn here.\n *\n * @type {number}\n * @product highcharts\n * @apioption series.boxplot.data.high\n */\n/**\n * The `low` value for each data point, signifying the lowest value\n * in the sample set. The bottom whisker is drawn here.\n *\n * @type {number}\n * @product highcharts\n * @apioption series.boxplot.data.low\n */\n/**\n * The median for each data point. This is drawn as a line through the\n * middle area of the box.\n *\n * @type {number}\n * @product highcharts\n * @apioption series.boxplot.data.median\n */\n/**\n * The lower quartile for each data point. This is the bottom of the\n * box.\n *\n * @type {number}\n * @product highcharts\n * @apioption series.boxplot.data.q1\n */\n/**\n * The higher quartile for each data point. This is the top of the box.\n *\n * @type {number}\n * @product highcharts\n * @apioption series.boxplot.data.q3\n */\n/**\n * The dash style of the box.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 8.1.0\n * @product highcharts\n * @apioption series.boxplot.data.boxDashStyle\n */\n/**\n * The dash style of the median.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 8.1.0\n * @product highcharts\n * @apioption series.boxplot.data.medianDashStyle\n */\n/**\n * The dash style of the stem.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 8.1.0\n * @product highcharts\n * @apioption series.boxplot.data.stemDashStyle\n */\n/**\n * The dash style of the whiskers.\n *\n * @sample {highcharts} highcharts/plotoptions/box-plot-styling/\n * Box plot styling\n * @sample {highcharts} highcharts/css/boxplot/\n * Box plot in styled mode\n *\n * @type {Highcharts.DashStyleValue}\n * @default Solid\n * @since 8.1.0\n * @product highcharts\n * @apioption series.boxplot.data.whiskerDashStyle\n */\n''; // keeps doclets above separate\n/* *\n *\n * Default Export\n *\n * */\nexport default BoxPlotSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport BoxPlotSeriesDefaults from './BoxPlotSeriesDefaults.js';\nimport ColumnSeries from '../Column/ColumnSeries.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nimport U from '../../Core/Utilities.js';\nconst { extend, merge, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The boxplot series type.\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes#boxplot\n *\n * @augments Highcharts.Series\n */\nclass BoxPlotSeries extends ColumnSeries {\n /* *\n *\n * Functions\n *\n * */\n // Get presentational attributes\n pointAttribs() {\n // No attributes should be set on point.graphic which is the group\n return {};\n }\n // Translate data points from raw values x and y to plotX and plotY\n translate() {\n const series = this, yAxis = series.yAxis, pointArrayMap = series.pointArrayMap;\n super.translate.apply(series);\n // do the translation on each point dimension\n series.points.forEach(function (point) {\n pointArrayMap.forEach(function (key) {\n if (point[key] !== null) {\n point[key + 'Plot'] = yAxis.translate(point[key], 0, 1, 0, 1);\n }\n });\n point.plotHigh = point.highPlot; // For data label validation\n });\n }\n /**\n * Draw the data points\n * @private\n */\n drawPoints() {\n const series = this, points = series.points, options = series.options, chart = series.chart, renderer = chart.renderer, \n // error bar inherits this series type but doesn't do quartiles\n doQuartiles = series.doQuartiles !== false, whiskerLength = series.options.whiskerLength;\n let q1Plot, q3Plot, highPlot, lowPlot, medianPlot, medianPath, crispCorr, crispX = 0, boxPath, graphic, width, left, right, halfWidth, pointWiskerLength;\n for (const point of points) {\n graphic = point.graphic;\n const verb = graphic ? 'animate' : 'attr', shapeArgs = point.shapeArgs, boxAttr = {}, stemAttr = {}, whiskersAttr = {}, medianAttr = {}, color = point.color || series.color;\n if (typeof point.plotY !== 'undefined') {\n // crisp vector coordinates\n width = Math.round(shapeArgs.width);\n left = Math.floor(shapeArgs.x);\n right = left + width;\n halfWidth = Math.round(width / 2);\n q1Plot = Math.floor(doQuartiles ? point.q1Plot : point.lowPlot);\n q3Plot = Math.floor(doQuartiles ? point.q3Plot : point.lowPlot);\n highPlot = Math.floor(point.highPlot);\n lowPlot = Math.floor(point.lowPlot);\n if (!graphic) {\n point.graphic = graphic = renderer.g('point')\n .add(series.group);\n point.stem = renderer.path()\n .addClass('highcharts-boxplot-stem')\n .add(graphic);\n if (whiskerLength) {\n point.whiskers = renderer.path()\n .addClass('highcharts-boxplot-whisker')\n .add(graphic);\n }\n if (doQuartiles) {\n point.box = renderer.path(boxPath)\n .addClass('highcharts-boxplot-box')\n .add(graphic);\n }\n point.medianShape = renderer.path(medianPath)\n .addClass('highcharts-boxplot-median')\n .add(graphic);\n }\n if (!chart.styledMode) {\n // Stem attributes\n stemAttr.stroke =\n point.stemColor || options.stemColor || color;\n stemAttr['stroke-width'] = pick(point.stemWidth, options.stemWidth, options.lineWidth);\n stemAttr.dashstyle = (point.stemDashStyle ||\n options.stemDashStyle ||\n options.dashStyle);\n point.stem.attr(stemAttr);\n // Whiskers attributes\n if (whiskerLength) {\n whiskersAttr.stroke = (point.whiskerColor ||\n options.whiskerColor ||\n color);\n whiskersAttr['stroke-width'] = pick(point.whiskerWidth, options.whiskerWidth, options.lineWidth);\n whiskersAttr.dashstyle = (point.whiskerDashStyle ||\n options.whiskerDashStyle ||\n options.dashStyle);\n point.whiskers.attr(whiskersAttr);\n }\n if (doQuartiles) {\n boxAttr.fill = (point.fillColor ||\n options.fillColor ||\n color);\n boxAttr.stroke = options.lineColor || color;\n boxAttr['stroke-width'] = options.lineWidth || 0;\n boxAttr.dashstyle = (point.boxDashStyle ||\n options.boxDashStyle ||\n options.dashStyle);\n point.box.attr(boxAttr);\n }\n // Median attributes\n medianAttr.stroke = (point.medianColor ||\n options.medianColor ||\n color);\n medianAttr['stroke-width'] = pick(point.medianWidth, options.medianWidth, options.lineWidth);\n medianAttr.dashstyle = (point.medianDashStyle ||\n options.medianDashStyle ||\n options.dashStyle);\n point.medianShape.attr(medianAttr);\n }\n let d;\n // The stem\n crispCorr = (point.stem.strokeWidth() % 2) / 2;\n crispX = left + halfWidth + crispCorr;\n d = [\n // stem up\n ['M', crispX, q3Plot],\n ['L', crispX, highPlot],\n // stem down\n ['M', crispX, q1Plot],\n ['L', crispX, lowPlot]\n ];\n point.stem[verb]({ d });\n // The box\n if (doQuartiles) {\n crispCorr = (point.box.strokeWidth() % 2) / 2;\n q1Plot = Math.floor(q1Plot) + crispCorr;\n q3Plot = Math.floor(q3Plot) + crispCorr;\n left += crispCorr;\n right += crispCorr;\n d = [\n ['M', left, q3Plot],\n ['L', left, q1Plot],\n ['L', right, q1Plot],\n ['L', right, q3Plot],\n ['L', left, q3Plot],\n ['Z']\n ];\n point.box[verb]({ d });\n }\n // The whiskers\n if (whiskerLength) {\n crispCorr = (point.whiskers.strokeWidth() % 2) / 2;\n highPlot = highPlot + crispCorr;\n lowPlot = lowPlot + crispCorr;\n pointWiskerLength = (/%$/).test(whiskerLength) ?\n halfWidth * parseFloat(whiskerLength) / 100 :\n whiskerLength / 2;\n d = [\n // High whisker\n ['M', crispX - pointWiskerLength, highPlot],\n ['L', crispX + pointWiskerLength, highPlot],\n // Low whisker\n ['M', crispX - pointWiskerLength, lowPlot],\n ['L', crispX + pointWiskerLength, lowPlot]\n ];\n point.whiskers[verb]({ d });\n }\n // The median\n medianPlot = Math.round(point.medianPlot);\n crispCorr = (point.medianShape.strokeWidth() % 2) / 2;\n medianPlot = medianPlot + crispCorr;\n d = [\n ['M', left, medianPlot],\n ['L', right, medianPlot]\n ];\n point.medianShape[verb]({ d });\n }\n }\n }\n // return a plain array for speedy calculation\n toYData(point) {\n return [point.low, point.q1, point.median, point.q3, point.high];\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nBoxPlotSeries.defaultOptions = merge(ColumnSeries.defaultOptions, BoxPlotSeriesDefaults);\nextend(BoxPlotSeries.prototype, {\n // array point configs are mapped to this\n pointArrayMap: ['low', 'q1', 'median', 'q3', 'high'],\n // defines the top of the tracker\n pointValKey: 'high',\n // Disable data labels for box plot\n drawDataLabels: noop,\n setStackedPoints: noop // #3890\n});\nSeriesRegistry.registerSeriesType('boxplot', BoxPlotSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default BoxPlotSeries;\n", "/* *\n *\n * (c) 2010-2024 Highsoft AS\n *\n * Author: Pawe\u0142 Potaczek\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Constants\n *\n * */\n/**\n * The bubble legend is an additional element in legend which\n * presents the scale of the bubble series. Individual bubble ranges\n * can be defined by user or calculated from series. In the case of\n * automatically calculated ranges, a 1px margin of error is\n * permitted.\n *\n * @since 7.0.0\n * @product highcharts highstock highmaps\n * @requires highcharts-more\n * @optionparent legend.bubbleLegend\n */\nconst BubbleLegendDefaults = {\n /**\n * The color of the ranges borders, can be also defined for an\n * individual range.\n *\n * @sample highcharts/bubble-legend/similartoseries/\n * Similar look to the bubble series\n * @sample highcharts/bubble-legend/bordercolor/\n * Individual bubble border color\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n borderColor: void 0,\n /**\n * The width of the ranges borders in pixels, can be also\n * defined for an individual range.\n */\n borderWidth: 2,\n /**\n * An additional class name to apply to the bubble legend'\n * circle graphical elements. This option does not replace\n * default class names of the graphical element.\n *\n * @sample {highcharts} highcharts/css/bubble-legend/\n * Styling by CSS\n *\n * @type {string}\n */\n className: void 0,\n /**\n * The main color of the bubble legend. Applies to ranges, if\n * individual color is not defined.\n *\n * @sample highcharts/bubble-legend/similartoseries/\n * Similar look to the bubble series\n * @sample highcharts/bubble-legend/color/\n * Individual bubble color\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n color: void 0,\n /**\n * An additional class name to apply to the bubble legend's\n * connector graphical elements. This option does not replace\n * default class names of the graphical element.\n *\n * @sample {highcharts} highcharts/css/bubble-legend/\n * Styling by CSS\n *\n * @type {string}\n */\n connectorClassName: void 0,\n /**\n * The color of the connector, can be also defined\n * for an individual range.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n connectorColor: void 0,\n /**\n * The length of the connectors in pixels. If labels are\n * centered, the distance is reduced to 0.\n *\n * @sample highcharts/bubble-legend/connectorandlabels/\n * Increased connector length\n */\n connectorDistance: 60,\n /**\n * The width of the connectors in pixels.\n *\n * @sample highcharts/bubble-legend/connectorandlabels/\n * Increased connector width\n */\n connectorWidth: 1,\n /**\n * Enable or disable the bubble legend.\n */\n enabled: false,\n /**\n * Options for the bubble legend labels.\n */\n labels: {\n /**\n * An additional class name to apply to the bubble legend\n * label graphical elements. This option does not replace\n * default class names of the graphical element.\n *\n * @sample {highcharts} highcharts/css/bubble-legend/\n * Styling by CSS\n *\n * @type {string}\n */\n className: void 0,\n /**\n * Whether to allow data labels to overlap.\n */\n allowOverlap: false,\n /**\n * A format string for the bubble legend labels. Available\n * variables are the same as for `formatter`.\n *\n * @sample highcharts/bubble-legend/format/\n * Add a unit\n *\n * @type {string}\n */\n format: '',\n /**\n * Available `this` properties are:\n *\n * - `this.value`: The bubble value.\n *\n * - `this.radius`: The radius of the bubble range.\n *\n * - `this.center`: The center y position of the range.\n *\n * @type {Highcharts.FormatterCallbackFunction}\n */\n formatter: void 0,\n /**\n * The alignment of the labels compared to the bubble\n * legend. Can be one of `left`, `center` or `right`.\n *\n * @sample highcharts/bubble-legend/connectorandlabels/\n * Labels on left\n *\n * @type {Highcharts.AlignValue}\n */\n align: 'right',\n /**\n * CSS styles for the labels.\n *\n * @type {Highcharts.CSSObject}\n */\n style: {\n /** @ignore-option */\n fontSize: '0.9em',\n /** @ignore-option */\n color: \"#000000\" /* Palette.neutralColor100 */\n },\n /**\n * The x position offset of the label relative to the\n * connector.\n */\n x: 0,\n /**\n * The y position offset of the label relative to the\n * connector.\n */\n y: 0\n },\n /**\n * Maximum bubble legend range size. If values for ranges are\n * not specified, the `minSize` and the `maxSize` are calculated\n * from bubble series.\n */\n maxSize: 60,\n /**\n * Minimum bubble legend range size. If values for ranges are\n * not specified, the `minSize` and the `maxSize` are calculated\n * from bubble series.\n */\n minSize: 10,\n /**\n * The position of the bubble legend in the legend.\n * @sample highcharts/bubble-legend/connectorandlabels/\n * Bubble legend as last item in legend\n */\n legendIndex: 0,\n /**\n * Options for specific range. One range consists of bubble,\n * label and connector.\n *\n * @sample highcharts/bubble-legend/ranges/\n * Manually defined ranges\n * @sample highcharts/bubble-legend/autoranges/\n * Auto calculated ranges\n *\n * @type {Array<*>}\n */\n ranges: {\n /**\n * Range size value, similar to bubble Z data.\n * @type {number}\n */\n value: void 0,\n /**\n * The color of the border for individual range.\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n borderColor: void 0,\n /**\n * The color of the bubble for individual range.\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n color: void 0,\n /**\n * The color of the connector for individual range.\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n connectorColor: void 0\n },\n /**\n * Whether the bubble legend range value should be represented\n * by the area or the width of the bubble. The default, area,\n * corresponds best to the human perception of the size of each\n * bubble.\n *\n * @sample highcharts/bubble-legend/ranges/\n * Size by width\n *\n * @type {Highcharts.BubbleSizeByValue}\n */\n sizeBy: 'area',\n /**\n * When this is true, the absolute value of z determines the\n * size of the bubble. This means that with the default\n * zThreshold of 0, a bubble of value -1 will have the same size\n * as a bubble of value 1, while a bubble of value 0 will have a\n * smaller size according to minSize.\n */\n sizeByAbsoluteValue: false,\n /**\n * Define the visual z index of the bubble legend.\n */\n zIndex: 1,\n /**\n * Ranges with lower value than zThreshold are skipped.\n */\n zThreshold: 0\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default BubbleLegendDefaults;\n", "/* *\n *\n * (c) 2010-2024 Highsoft AS\n *\n * Author: Pawe\u0142 Potaczek\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Color from '../../Core/Color/Color.js';\nconst { parse: color } = Color;\nimport F from '../../Core/Templating.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport U from '../../Core/Utilities.js';\nconst { arrayMax, arrayMin, isNumber, merge, pick, stableSort } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * BubbleLegend class.\n *\n * @private\n * @class\n * @name Highcharts.BubbleLegend\n * @param {Highcharts.LegendBubbleLegendOptions} options\n * Options of BubbleLegendItem.\n *\n * @param {Highcharts.Legend} legend\n * Legend of item.\n */\nclass BubbleLegendItem {\n /* *\n *\n * Constructor\n *\n * */\n constructor(options, legend) {\n this.setState = noop;\n this.init(options, legend);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Create basic bubbleLegend properties similar to item in legend.\n * @private\n */\n init(options, legend) {\n this.options = options;\n this.visible = true;\n this.chart = legend.chart;\n this.legend = legend;\n }\n /**\n * Depending on the position option, add bubbleLegend to legend items.\n *\n * @private\n *\n * @param {Array<(Highcharts.Point|Highcharts.Series)>} items\n * All legend items\n */\n addToLegend(items) {\n // Insert bubbleLegend into legend items\n items.splice(this.options.legendIndex, 0, this);\n }\n /**\n * Calculate ranges, sizes and call the next steps of bubbleLegend\n * creation.\n *\n * @private\n *\n * @param {Highcharts.Legend} legend\n * Legend instance\n */\n drawLegendSymbol(legend) {\n const itemDistance = pick(legend.options.itemDistance, 20), legendItem = this.legendItem || {}, options = this.options, ranges = options.ranges, connectorDistance = options.connectorDistance;\n let connectorSpace;\n // Do not create bubbleLegend now if ranges or ranges values are not\n // specified or if are empty array.\n if (!ranges || !ranges.length || !isNumber(ranges[0].value)) {\n legend.options.bubbleLegend.autoRanges = true;\n return;\n }\n // Sort ranges to right render order\n stableSort(ranges, function (a, b) {\n return b.value - a.value;\n });\n this.ranges = ranges;\n this.setOptions();\n this.render();\n // Get max label size\n const maxLabel = this.getMaxLabelSize(), radius = this.ranges[0].radius, size = radius * 2;\n // Space for connectors and labels.\n connectorSpace =\n connectorDistance - radius + maxLabel.width;\n connectorSpace = connectorSpace > 0 ? connectorSpace : 0;\n this.maxLabel = maxLabel;\n this.movementX = options.labels.align === 'left' ?\n connectorSpace : 0;\n legendItem.labelWidth = size + connectorSpace + itemDistance;\n legendItem.labelHeight = size + maxLabel.height / 2;\n }\n /**\n * Set style options for each bubbleLegend range.\n * @private\n */\n setOptions() {\n const ranges = this.ranges, options = this.options, series = this.chart.series[options.seriesIndex], baseline = this.legend.baseline, bubbleAttribs = {\n zIndex: options.zIndex,\n 'stroke-width': options.borderWidth\n }, connectorAttribs = {\n zIndex: options.zIndex,\n 'stroke-width': options.connectorWidth\n }, labelAttribs = {\n align: (this.legend.options.rtl ||\n options.labels.align === 'left') ? 'right' : 'left',\n zIndex: options.zIndex\n }, fillOpacity = series.options.marker.fillOpacity, styledMode = this.chart.styledMode;\n // Allow to parts of styles be used individually for range\n ranges.forEach(function (range, i) {\n if (!styledMode) {\n bubbleAttribs.stroke = pick(range.borderColor, options.borderColor, series.color);\n bubbleAttribs.fill = pick(range.color, options.color, fillOpacity !== 1 ?\n color(series.color).setOpacity(fillOpacity)\n .get('rgba') :\n series.color);\n connectorAttribs.stroke = pick(range.connectorColor, options.connectorColor, series.color);\n }\n // Set options needed for rendering each range\n ranges[i].radius = this.getRangeRadius(range.value);\n ranges[i] = merge(ranges[i], {\n center: (ranges[0].radius - ranges[i].radius +\n baseline)\n });\n if (!styledMode) {\n merge(true, ranges[i], {\n bubbleAttribs: merge(bubbleAttribs),\n connectorAttribs: merge(connectorAttribs),\n labelAttribs: labelAttribs\n });\n }\n }, this);\n }\n /**\n * Calculate radius for each bubble range,\n * used code from BubbleSeries.js 'getRadius' method.\n *\n * @private\n *\n * @param {number} value\n * Range value\n *\n * @return {number|null}\n * Radius for one range\n */\n getRangeRadius(value) {\n const options = this.options, seriesIndex = this.options.seriesIndex, bubbleSeries = this.chart.series[seriesIndex], zMax = options.ranges[0].value, zMin = options.ranges[options.ranges.length - 1].value, minSize = options.minSize, maxSize = options.maxSize;\n return bubbleSeries.getRadius.call(this, zMin, zMax, minSize, maxSize, value);\n }\n /**\n * Render the legendItem group.\n * @private\n */\n render() {\n const legendItem = this.legendItem || {}, renderer = this.chart.renderer, zThreshold = this.options.zThreshold;\n if (!this.symbols) {\n this.symbols = {\n connectors: [],\n bubbleItems: [],\n labels: []\n };\n }\n // Nesting SVG groups to enable handleOverflow\n legendItem.symbol = renderer.g('bubble-legend');\n legendItem.label = renderer.g('bubble-legend-item')\n .css(this.legend.itemStyle || {});\n // To enable default 'hideOverlappingLabels' method\n legendItem.symbol.translateX = 0;\n legendItem.symbol.translateY = 0;\n // To use handleOverflow method\n legendItem.symbol.add(legendItem.label);\n legendItem.label.add(legendItem.group);\n for (const range of this.ranges) {\n if (range.value >= zThreshold) {\n this.renderRange(range);\n }\n }\n this.hideOverlappingLabels();\n }\n /**\n * Render one range, consisting of bubble symbol, connector and label.\n *\n * @private\n *\n * @param {Highcharts.LegendBubbleLegendRangesOptions} range\n * Range options\n */\n renderRange(range) {\n const mainRange = this.ranges[0], legend = this.legend, options = this.options, labelsOptions = options.labels, chart = this.chart, bubbleSeries = chart.series[options.seriesIndex], renderer = chart.renderer, symbols = this.symbols, labels = symbols.labels, elementCenter = range.center, absoluteRadius = Math.abs(range.radius), connectorDistance = options.connectorDistance || 0, labelsAlign = labelsOptions.align, rtl = legend.options.rtl, borderWidth = options.borderWidth, connectorWidth = options.connectorWidth, posX = mainRange.radius || 0, posY = elementCenter - absoluteRadius -\n borderWidth / 2 + connectorWidth / 2, crispMovement = (posY % 1 ? 1 : 0.5) -\n (connectorWidth % 2 ? 0 : 0.5), styledMode = renderer.styledMode;\n let connectorLength = rtl || labelsAlign === 'left' ?\n -connectorDistance : connectorDistance;\n // Set options for centered labels\n if (labelsAlign === 'center') {\n connectorLength = 0; // do not use connector\n options.connectorDistance = 0;\n range.labelAttribs.align = 'center';\n }\n // Render bubble symbol\n symbols.bubbleItems.push(renderer\n .circle(posX, elementCenter + crispMovement, absoluteRadius)\n .attr(styledMode ? {} : range.bubbleAttribs)\n .addClass((styledMode ?\n 'highcharts-color-' +\n bubbleSeries.colorIndex + ' ' :\n '') +\n 'highcharts-bubble-legend-symbol ' +\n (options.className || '')).add(this.legendItem.symbol));\n // Render connector\n symbols.connectors.push(renderer\n .path(renderer.crispLine([\n ['M', posX, posY],\n ['L', posX + connectorLength, posY]\n ], options.connectorWidth))\n .attr((styledMode ? {} : range.connectorAttribs))\n .addClass((styledMode ?\n 'highcharts-color-' +\n this.options.seriesIndex + ' ' : '') +\n 'highcharts-bubble-legend-connectors ' +\n (options.connectorClassName || '')).add(this.legendItem.symbol));\n // Render label\n const label = renderer\n .text(this.formatLabel(range))\n .attr((styledMode ? {} : range.labelAttribs))\n .css(styledMode ? {} : labelsOptions.style)\n .addClass('highcharts-bubble-legend-labels ' +\n (options.labels.className || '')).add(this.legendItem.symbol);\n // Now that the label is added we can read the bounding box and\n // vertically align\n const position = {\n x: posX + connectorLength + options.labels.x,\n y: posY + options.labels.y + label.getBBox().height * 0.4\n };\n label.attr(position);\n labels.push(label);\n // To enable default 'hideOverlappingLabels' method\n label.placed = true;\n label.alignAttr = position;\n }\n /**\n * Get the label which takes up the most space.\n * @private\n */\n getMaxLabelSize() {\n const labels = this.symbols.labels;\n let maxLabel, labelSize;\n labels.forEach(function (label) {\n labelSize = label.getBBox(true);\n if (maxLabel) {\n maxLabel = labelSize.width > maxLabel.width ?\n labelSize : maxLabel;\n }\n else {\n maxLabel = labelSize;\n }\n });\n return maxLabel || {};\n }\n /**\n * Get formatted label for range.\n *\n * @private\n *\n * @param {Highcharts.LegendBubbleLegendRangesOptions} range\n * Range options\n *\n * @return {string}\n * Range label text\n */\n formatLabel(range) {\n const options = this.options, formatter = options.labels.formatter, format = options.labels.format;\n const { numberFormatter } = this.chart;\n return format ? F.format(format, range) :\n formatter ? formatter.call(range) :\n numberFormatter(range.value, 1);\n }\n /**\n * By using default chart 'hideOverlappingLabels' method, hide or show\n * labels and connectors.\n * @private\n */\n hideOverlappingLabels() {\n const chart = this.chart, allowOverlap = this.options.labels.allowOverlap, symbols = this.symbols;\n if (!allowOverlap && symbols) {\n chart.hideOverlappingLabels(symbols.labels);\n // Hide or show connectors\n symbols.labels.forEach(function (label, index) {\n if (!label.newOpacity) {\n symbols.connectors[index].hide();\n }\n else if (label.newOpacity !== label.oldOpacity) {\n symbols.connectors[index].show();\n }\n });\n }\n }\n /**\n * Calculate ranges from created series.\n *\n * @private\n *\n * @return {Array}\n * Array of range objects\n */\n getRanges() {\n const bubbleLegend = this.legend.bubbleLegend, series = bubbleLegend.chart.series, rangesOptions = bubbleLegend.options.ranges;\n let ranges, zData, minZ = Number.MAX_VALUE, maxZ = -Number.MAX_VALUE;\n series.forEach(function (s) {\n // Find the min and max Z, like in bubble series\n if (s.isBubble && !s.ignoreSeries) {\n zData = s.zData.filter(isNumber);\n if (zData.length) {\n minZ = pick(s.options.zMin, Math.min(minZ, Math.max(arrayMin(zData), s.options.displayNegative === false ?\n s.options.zThreshold :\n -Number.MAX_VALUE)));\n maxZ = pick(s.options.zMax, Math.max(maxZ, arrayMax(zData)));\n }\n }\n });\n // Set values for ranges\n if (minZ === maxZ) {\n // Only one range if min and max values are the same.\n ranges = [{ value: maxZ }];\n }\n else {\n ranges = [\n { value: minZ },\n { value: (minZ + maxZ) / 2 },\n { value: maxZ, autoRanges: true }\n ];\n }\n // Prevent reverse order of ranges after redraw\n if (rangesOptions.length && rangesOptions[0].radius) {\n ranges.reverse();\n }\n // Merge ranges values with user options\n ranges.forEach(function (range, i) {\n if (rangesOptions && rangesOptions[i]) {\n ranges[i] = merge(rangesOptions[i], range);\n }\n });\n return ranges;\n }\n /**\n * Calculate bubble legend sizes from rendered series.\n *\n * @private\n *\n * @return {Array}\n * Calculated min and max bubble sizes\n */\n predictBubbleSizes() {\n const chart = this.chart, legendOptions = chart.legend.options, floating = legendOptions.floating, horizontal = legendOptions.layout === 'horizontal', lastLineHeight = horizontal ? chart.legend.lastLineHeight : 0, plotSizeX = chart.plotSizeX, plotSizeY = chart.plotSizeY, bubbleSeries = chart.series[this.options.seriesIndex], pxSizes = bubbleSeries.getPxExtremes(), minSize = Math.ceil(pxSizes.minPxSize), maxPxSize = Math.ceil(pxSizes.maxPxSize), plotSize = Math.min(plotSizeY, plotSizeX);\n let calculatedSize, maxSize = bubbleSeries.options.maxSize;\n // Calculate predicted max size of bubble\n if (floating || !(/%$/.test(maxSize))) {\n calculatedSize = maxPxSize;\n }\n else {\n maxSize = parseFloat(maxSize);\n calculatedSize = ((plotSize + lastLineHeight) * maxSize / 100) /\n (maxSize / 100 + 1);\n // Get maxPxSize from bubble series if calculated bubble legend\n // size will not affect to bubbles series.\n if ((horizontal && plotSizeY - calculatedSize >=\n plotSizeX) || (!horizontal && plotSizeX -\n calculatedSize >= plotSizeY)) {\n calculatedSize = maxPxSize;\n }\n }\n return [minSize, Math.ceil(calculatedSize)];\n }\n /**\n * Correct ranges with calculated sizes.\n * @private\n */\n updateRanges(min, max) {\n const bubbleLegendOptions = this.legend.options.bubbleLegend;\n bubbleLegendOptions.minSize = min;\n bubbleLegendOptions.maxSize = max;\n bubbleLegendOptions.ranges = this.getRanges();\n }\n /**\n * Because of the possibility of creating another legend line, predicted\n * bubble legend sizes may differ by a few pixels, so it is necessary to\n * correct them.\n * @private\n */\n correctSizes() {\n const legend = this.legend, chart = this.chart, bubbleSeries = chart.series[this.options.seriesIndex], pxSizes = bubbleSeries.getPxExtremes(), bubbleSeriesSize = pxSizes.maxPxSize, bubbleLegendSize = this.options.maxSize;\n if (Math.abs(Math.ceil(bubbleSeriesSize) - bubbleLegendSize) >\n 1) {\n this.updateRanges(this.options.minSize, pxSizes.maxPxSize);\n legend.render();\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default BubbleLegendItem;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * @interface Highcharts.BubbleLegendFormatterContextObject\n */ /**\n* The center y position of the range.\n* @name Highcharts.BubbleLegendFormatterContextObject#center\n* @type {number}\n*/ /**\n* The radius of the bubble range.\n* @name Highcharts.BubbleLegendFormatterContextObject#radius\n* @type {number}\n*/ /**\n* The bubble value.\n* @name Highcharts.BubbleLegendFormatterContextObject#value\n* @type {number}\n*/\n''; // detach doclets above\n", "/* *\n *\n * (c) 2010-2024 Highsoft AS\n *\n * Author: Pawe\u0142 Potaczek\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport BubbleLegendDefaults from './BubbleLegendDefaults.js';\nimport BubbleLegendItem from './BubbleLegendItem.js';\nimport D from '../../Core/Defaults.js';\nconst { setOptions } = D;\nimport H from '../../Core/Globals.js';\nconst { composed } = H;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, objectEach, pushUnique, wrap } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * If ranges are not specified, determine ranges from rendered bubble series\n * and render legend again.\n */\nfunction chartDrawChartBox(proceed, options, callback) {\n const chart = this, legend = chart.legend, bubbleSeries = getVisibleBubbleSeriesIndex(chart) >= 0;\n let bubbleLegendOptions, bubbleSizes, legendItem;\n if (legend && legend.options.enabled && legend.bubbleLegend &&\n legend.options.bubbleLegend.autoRanges && bubbleSeries) {\n bubbleLegendOptions = legend.bubbleLegend.options;\n bubbleSizes = legend.bubbleLegend.predictBubbleSizes();\n legend.bubbleLegend.updateRanges(bubbleSizes[0], bubbleSizes[1]);\n // Disable animation on init\n if (!bubbleLegendOptions.placed) {\n legend.group.placed = false;\n legend.allItems.forEach((item) => {\n legendItem = item.legendItem || {};\n if (legendItem.group) {\n legendItem.group.translateY = void 0;\n }\n });\n }\n // Create legend with bubbleLegend\n legend.render();\n chart.getMargins();\n chart.axes.forEach(function (axis) {\n if (axis.visible) { // #11448\n axis.render();\n }\n if (!bubbleLegendOptions.placed) {\n axis.setScale();\n axis.updateNames();\n // Disable axis animation on init\n objectEach(axis.ticks, function (tick) {\n tick.isNew = true;\n tick.isNewLabel = true;\n });\n }\n });\n bubbleLegendOptions.placed = true;\n // After recalculate axes, calculate margins again.\n chart.getMargins();\n // Call default 'drawChartBox' method.\n proceed.call(chart, options, callback);\n // Check bubble legend sizes and correct them if necessary.\n legend.bubbleLegend.correctSizes();\n // Correct items positions with different dimensions in legend.\n retranslateItems(legend, getLinesHeights(legend));\n }\n else {\n proceed.call(chart, options, callback);\n // Allow color change on static bubble legend after click on legend\n if (legend && legend.options.enabled && legend.bubbleLegend) {\n legend.render();\n retranslateItems(legend, getLinesHeights(legend));\n }\n }\n}\n/**\n * Compose classes for use with Bubble series.\n * @private\n *\n * @param {Highcharts.Chart} ChartClass\n * Core chart class to use with Bubble series.\n *\n * @param {Highcharts.Legend} LegendClass\n * Core legend class to use with Bubble series.\n *\n * @param {Highcharts.Series} SeriesClass\n * Core series class to use with Bubble series.\n */\nfunction compose(ChartClass, LegendClass, SeriesClass) {\n if (pushUnique(composed, 'Series.BubbleLegend')) {\n setOptions({\n // Set default bubble legend options\n legend: {\n bubbleLegend: BubbleLegendDefaults\n }\n });\n wrap(ChartClass.prototype, 'drawChartBox', chartDrawChartBox);\n addEvent(LegendClass, 'afterGetAllItems', onLegendAfterGetAllItems);\n addEvent(SeriesClass, 'legendItemClick', onSeriesLegendItemClick);\n }\n}\n/**\n * Check if there is at least one visible bubble series.\n *\n * @private\n * @function getVisibleBubbleSeriesIndex\n * @param {Highcharts.Chart} chart\n * Chart to check.\n * @return {number}\n * First visible bubble series index\n */\nfunction getVisibleBubbleSeriesIndex(chart) {\n const series = chart.series;\n let i = 0;\n while (i < series.length) {\n if (series[i] &&\n series[i].isBubble &&\n series[i].visible &&\n series[i].zData.length) {\n return i;\n }\n i++;\n }\n return -1;\n}\n/**\n * Calculate height for each row in legend.\n *\n * @private\n * @function getLinesHeights\n *\n * @param {Highcharts.Legend} legend\n * Legend to calculate from.\n *\n * @return {Array>}\n * Informations about line height and items amount\n */\nfunction getLinesHeights(legend) {\n const items = legend.allItems, lines = [], length = items.length;\n let lastLine, legendItem, legendItem2, i = 0, j = 0;\n for (i = 0; i < length; i++) {\n legendItem = items[i].legendItem || {};\n legendItem2 = (items[i + 1] || {}).legendItem || {};\n if (legendItem.labelHeight) {\n // for bubbleLegend\n items[i].itemHeight = legendItem.labelHeight;\n }\n if ( // Line break\n items[i] === items[length - 1] ||\n legendItem.y !== legendItem2.y) {\n lines.push({ height: 0 });\n lastLine = lines[lines.length - 1];\n // Find the highest item in line\n for (j; j <= i; j++) {\n if (items[j].itemHeight > lastLine.height) {\n lastLine.height = items[j].itemHeight;\n }\n }\n lastLine.step = i;\n }\n }\n return lines;\n}\n/**\n * Start the bubble legend creation process.\n */\nfunction onLegendAfterGetAllItems(e) {\n const legend = this, bubbleLegend = legend.bubbleLegend, legendOptions = legend.options, options = legendOptions.bubbleLegend, bubbleSeriesIndex = getVisibleBubbleSeriesIndex(legend.chart);\n // Remove unnecessary element\n if (bubbleLegend && bubbleLegend.ranges && bubbleLegend.ranges.length) {\n // Allow change the way of calculating ranges in update\n if (options.ranges.length) {\n options.autoRanges =\n !!options.ranges[0].autoRanges;\n }\n // Update bubbleLegend dimensions in each redraw\n legend.destroyItem(bubbleLegend);\n }\n // Create bubble legend\n if (bubbleSeriesIndex >= 0 &&\n legendOptions.enabled &&\n options.enabled) {\n options.seriesIndex = bubbleSeriesIndex;\n legend.bubbleLegend = new BubbleLegendItem(options, legend);\n legend.bubbleLegend.addToLegend(e.allItems);\n }\n}\n/**\n * Toggle bubble legend depending on the visible status of bubble series.\n */\nfunction onSeriesLegendItemClick(e) {\n // #14080 don't fire this code if click function is prevented\n if (e.defaultPrevented) {\n return false;\n }\n const series = this, chart = series.chart, visible = series.visible, legend = series.chart.legend;\n let status;\n if (legend && legend.bubbleLegend) {\n // Temporary correct 'visible' property\n series.visible = !visible;\n // Save future status for getRanges method\n series.ignoreSeries = visible;\n // Check if at lest one bubble series is visible\n status = getVisibleBubbleSeriesIndex(chart) >= 0;\n // Hide bubble legend if all bubble series are disabled\n if (legend.bubbleLegend.visible !== status) {\n // Show or hide bubble legend\n legend.update({\n bubbleLegend: { enabled: status }\n });\n legend.bubbleLegend.visible = status; // Restore default status\n }\n series.visible = visible;\n }\n}\n/**\n * Correct legend items translation in case of different elements heights.\n *\n * @private\n * @function Highcharts.Legend#retranslateItems\n *\n * @param {Highcharts.Legend} legend\n * Legend to translate in.\n *\n * @param {Array>} lines\n * Informations about line height and items amount\n */\nfunction retranslateItems(legend, lines) {\n const items = legend.allItems, rtl = legend.options.rtl;\n let orgTranslateX, orgTranslateY, movementX, legendItem, actualLine = 0;\n items.forEach((item, index) => {\n legendItem = item.legendItem || {};\n if (!legendItem.group) {\n return;\n }\n orgTranslateX = legendItem.group.translateX || 0;\n orgTranslateY = legendItem.y || 0;\n movementX = item.movementX;\n if (movementX || (rtl && item.ranges)) {\n movementX = rtl ?\n orgTranslateX - item.options.maxSize / 2 :\n orgTranslateX + movementX;\n legendItem.group.attr({ translateX: movementX });\n }\n if (index > lines[actualLine].step) {\n actualLine++;\n }\n legendItem.group.attr({\n translateY: Math.round(orgTranslateY + lines[actualLine].height / 2)\n });\n legendItem.y = orgTranslateY + lines[actualLine].height / 2;\n });\n}\n/* *\n *\n * Default Export\n *\n * */\nconst BubbleLegendComposition = {\n compose\n};\nexport default BubbleLegendComposition;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Point from '../../Core/Series/Point.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { seriesTypes: { scatter: { prototype: { pointClass: ScatterPoint } } } } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { extend } = U;\n/* *\n *\n * Class\n *\n * */\nclass BubblePoint extends ScatterPoint {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * @private\n */\n haloPath(size) {\n return Point.prototype.haloPath.call(this, \n // #6067\n size === 0 ? 0 : (this.marker ? this.marker.radius || 0 : 0) + size);\n }\n}\n/* *\n *\n * Class Prototype\n *\n * */\nextend(BubblePoint.prototype, {\n ttBelow: false\n});\n/* *\n *\n * Default Export\n *\n * */\nexport default BubblePoint;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport BubbleLegendComposition from './BubbleLegendComposition.js';\nimport BubblePoint from './BubblePoint.js';\nimport Color from '../../Core/Color/Color.js';\nconst { parse: color } = Color;\nimport H from '../../Core/Globals.js';\nconst { composed, noop } = H;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { series: Series, seriesTypes: { column: { prototype: columnProto }, scatter: ScatterSeries } } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, arrayMax, arrayMin, clamp, extend, isNumber, merge, pick, pushUnique } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Add logic to pad each axis with the amount of pixels necessary to avoid the\n * bubbles to overflow.\n */\nfunction onAxisFoundExtremes() {\n const axisLength = this.len, { coll, isXAxis, min } = this, dataKey = isXAxis ? 'xData' : 'yData', range = (this.max || 0) - (min || 0);\n let pxMin = 0, pxMax = axisLength, transA = axisLength / range, hasActiveSeries;\n if (coll !== 'xAxis' && coll !== 'yAxis') {\n return;\n }\n // Handle padding on the second pass, or on redraw\n this.series.forEach((series) => {\n if (series.bubblePadding && series.reserveSpace()) {\n // Correction for #1673\n this.allowZoomOutside = true;\n hasActiveSeries = true;\n const data = series[dataKey];\n if (isXAxis) {\n (series.onPoint || series).getRadii(0, 0, series);\n if (series.onPoint) {\n series.radii = series.onPoint.radii;\n }\n }\n if (range > 0) {\n let i = data.length;\n while (i--) {\n if (isNumber(data[i]) &&\n this.dataMin <= data[i] &&\n data[i] <= this.max) {\n const radius = series.radii && series.radii[i] || 0;\n pxMin = Math.min(((data[i] - min) * transA) - radius, pxMin);\n pxMax = Math.max(((data[i] - min) * transA) + radius, pxMax);\n }\n }\n }\n }\n });\n // Apply the padding to the min and max properties\n if (hasActiveSeries && range > 0 && !this.logarithmic) {\n pxMax -= axisLength;\n transA *= (axisLength +\n Math.max(0, pxMin) - // #8901\n Math.min(pxMax, axisLength)) / axisLength;\n [\n ['min', 'userMin', pxMin],\n ['max', 'userMax', pxMax]\n ].forEach((keys) => {\n if (typeof pick(this.options[keys[0]], this[keys[1]]) === 'undefined') {\n this[keys[0]] += keys[2] / transA;\n }\n });\n }\n}\n/* *\n *\n * Class\n *\n * */\nclass BubbleSeries extends ScatterSeries {\n /* *\n *\n * Static Functions\n *\n * */\n static compose(AxisClass, ChartClass, LegendClass, SeriesClass) {\n BubbleLegendComposition.compose(ChartClass, LegendClass, SeriesClass);\n if (pushUnique(composed, 'Series.Bubble')) {\n addEvent(AxisClass, 'foundExtremes', onAxisFoundExtremes);\n }\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Perform animation on the bubbles\n * @private\n */\n animate(init) {\n if (!init &&\n this.points.length < this.options.animationLimit // #8099\n ) {\n this.points.forEach(function (point) {\n const { graphic } = point;\n if (graphic && graphic.width) { // URL symbols don't have width\n // Start values\n if (!this.hasRendered) {\n graphic.attr({\n x: point.plotX,\n y: point.plotY,\n width: 1,\n height: 1\n });\n }\n // Run animation\n graphic.animate(this.markerAttribs(point), this.options.animation);\n }\n }, this);\n }\n }\n /**\n * Get the radius for each point based on the minSize, maxSize and each\n * point's Z value. This must be done prior to Series.translate because\n * the axis needs to add padding in accordance with the point sizes.\n * @private\n */\n getRadii() {\n const zData = this.zData, yData = this.yData, radii = [];\n let len, i, value, zExtremes = this.chart.bubbleZExtremes;\n const { minPxSize, maxPxSize } = this.getPxExtremes();\n // Get the collective Z extremes of all bubblish series. The chart-level\n // `bubbleZExtremes` are only computed once, and reset on `updatedData`\n // in any member series.\n if (!zExtremes) {\n let zMin = Number.MAX_VALUE;\n let zMax = -Number.MAX_VALUE;\n let valid;\n this.chart.series.forEach((otherSeries) => {\n if (otherSeries.bubblePadding && otherSeries.reserveSpace()) {\n const zExtremes = (otherSeries.onPoint || otherSeries).getZExtremes();\n if (zExtremes) {\n // Changed '||' to 'pick' because min or max can be 0.\n // #17280\n zMin = Math.min(pick(zMin, zExtremes.zMin), zExtremes.zMin);\n zMax = Math.max(pick(zMax, zExtremes.zMax), zExtremes.zMax);\n valid = true;\n }\n }\n });\n if (valid) {\n zExtremes = { zMin, zMax };\n this.chart.bubbleZExtremes = zExtremes;\n }\n else {\n zExtremes = { zMin: 0, zMax: 0 };\n }\n }\n // Set the shape type and arguments to be picked up in drawPoints\n for (i = 0, len = zData.length; i < len; i++) {\n value = zData[i];\n // Separate method to get individual radius for bubbleLegend\n radii.push(this.getRadius(zExtremes.zMin, zExtremes.zMax, minPxSize, maxPxSize, value, yData && yData[i]));\n }\n this.radii = radii;\n }\n /**\n * Get the individual radius for one point.\n * @private\n */\n getRadius(zMin, zMax, minSize, maxSize, value, yValue) {\n const options = this.options, sizeByArea = options.sizeBy !== 'width', zThreshold = options.zThreshold;\n let zRange = zMax - zMin, pos = 0.5;\n // #8608 - bubble should be visible when z is undefined\n if (yValue === null || value === null) {\n return null;\n }\n if (isNumber(value)) {\n // When sizing by threshold, the absolute value of z determines\n // the size of the bubble.\n if (options.sizeByAbsoluteValue) {\n value = Math.abs(value - zThreshold);\n zMax = zRange = Math.max(zMax - zThreshold, Math.abs(zMin - zThreshold));\n zMin = 0;\n }\n // Issue #4419 - if value is less than zMin, push a radius that's\n // always smaller than the minimum size\n if (value < zMin) {\n return minSize / 2 - 1;\n }\n // Relative size, a number between 0 and 1\n if (zRange > 0) {\n pos = (value - zMin) / zRange;\n }\n }\n if (sizeByArea && pos >= 0) {\n pos = Math.sqrt(pos);\n }\n return Math.ceil(minSize + pos * (maxSize - minSize)) / 2;\n }\n /**\n * Define hasData function for non-cartesian series.\n * Returns true if the series has points at all.\n * @private\n */\n hasData() {\n return !!this.processedXData.length; // != 0\n }\n /**\n * @private\n */\n pointAttribs(point, state) {\n const markerOptions = this.options.marker, fillOpacity = markerOptions.fillOpacity, attr = Series.prototype.pointAttribs.call(this, point, state);\n if (fillOpacity !== 1) {\n attr.fill = color(attr.fill)\n .setOpacity(fillOpacity)\n .get('rgba');\n }\n return attr;\n }\n /**\n * Extend the base translate method to handle bubble size\n * @private\n */\n translate() {\n // Run the parent method\n super.translate.call(this);\n this.getRadii();\n this.translateBubble();\n }\n translateBubble() {\n const { data, options, radii } = this, { minPxSize } = this.getPxExtremes();\n // Set the shape type and arguments to be picked up in drawPoints\n let i = data.length;\n while (i--) {\n const point = data[i];\n const radius = radii ? radii[i] : 0; // #1737\n // Negative points means negative z values (#9728)\n if (this.zoneAxis === 'z') {\n point.negative = (point.z || 0) < (options.zThreshold || 0);\n }\n if (isNumber(radius) && radius >= minPxSize / 2) {\n // Shape arguments\n point.marker = extend(point.marker, {\n radius,\n width: 2 * radius,\n height: 2 * radius\n });\n // Alignment box for the data label\n point.dlBox = {\n x: point.plotX - radius,\n y: point.plotY - radius,\n width: 2 * radius,\n height: 2 * radius\n };\n }\n else { // below zThreshold\n // #1691\n point.shapeArgs = point.plotY = point.dlBox = void 0;\n point.isInside = false; // #17281\n }\n }\n }\n getPxExtremes() {\n const smallestSize = Math.min(this.chart.plotWidth, this.chart.plotHeight);\n const getPxSize = (length) => {\n let isPercent;\n if (typeof length === 'string') {\n isPercent = /%$/.test(length);\n length = parseInt(length, 10);\n }\n return isPercent ? smallestSize * length / 100 : length;\n };\n const minPxSize = getPxSize(pick(this.options.minSize, 8));\n // Prioritize min size if conflict to make sure bubbles are\n // always visible. #5873\n const maxPxSize = Math.max(getPxSize(pick(this.options.maxSize, '20%')), minPxSize);\n return { minPxSize, maxPxSize };\n }\n getZExtremes() {\n const options = this.options, zData = (this.zData || []).filter(isNumber);\n if (zData.length) {\n const zMin = pick(options.zMin, clamp(arrayMin(zData), options.displayNegative === false ?\n (options.zThreshold || 0) :\n -Number.MAX_VALUE, Number.MAX_VALUE));\n const zMax = pick(options.zMax, arrayMax(zData));\n if (isNumber(zMin) && isNumber(zMax)) {\n return { zMin, zMax };\n }\n }\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\n/**\n * A bubble series is a three dimensional series type where each point\n * renders an X, Y and Z value. Each points is drawn as a bubble where the\n * position along the X and Y axes mark the X and Y values, and the size of\n * the bubble relates to the Z value.\n *\n * @sample {highcharts} highcharts/demo/bubble/\n * Bubble chart\n *\n * @extends plotOptions.scatter\n * @excluding cluster\n * @product highcharts highstock\n * @requires highcharts-more\n * @optionparent plotOptions.bubble\n */\nBubbleSeries.defaultOptions = merge(ScatterSeries.defaultOptions, {\n dataLabels: {\n formatter: function () {\n const { numberFormatter } = this.series.chart;\n const { z } = this.point;\n return isNumber(z) ? numberFormatter(z, -1) : '';\n },\n inside: true,\n verticalAlign: 'middle'\n },\n /**\n * If there are more points in the series than the `animationLimit`, the\n * animation won't run. Animation affects overall performance and\n * doesn't work well with heavy data series.\n *\n * @since 6.1.0\n */\n animationLimit: 250,\n /**\n * Whether to display negative sized bubbles. The threshold is given\n * by the [zThreshold](#plotOptions.bubble.zThreshold) option, and negative\n * bubbles can be visualized by setting\n * [negativeColor](#plotOptions.bubble.negativeColor).\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-negative/\n * Negative bubbles\n *\n * @type {boolean}\n * @default true\n * @since 3.0\n * @apioption plotOptions.bubble.displayNegative\n */\n /**\n * @extends plotOptions.series.marker\n * @excluding enabled, enabledThreshold, height, radius, width\n */\n marker: {\n lineColor: null,\n lineWidth: 1,\n /**\n * The fill opacity of the bubble markers.\n */\n fillOpacity: 0.5,\n /**\n * In bubble charts, the radius is overridden and determined based\n * on the point's data value.\n *\n * @ignore-option\n */\n radius: null,\n states: {\n hover: {\n radiusPlus: 0\n }\n },\n /**\n * A predefined shape or symbol for the marker. Possible values are\n * \"circle\", \"square\", \"diamond\", \"triangle\" and \"triangle-down\".\n *\n * Additionally, the URL to a graphic can be given on the form\n * `url(graphic.png)`. Note that for the image to be applied to\n * exported charts, its URL needs to be accessible by the export\n * server.\n *\n * Custom callbacks for symbol path generation can also be added to\n * `Highcharts.SVGRenderer.prototype.symbols`. The callback is then\n * used by its method name, as shown in the demo.\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-symbol/\n * Bubble chart with various symbols\n * @sample {highcharts} highcharts/plotoptions/series-marker-symbol/\n * General chart with predefined, graphic and custom markers\n *\n * @type {Highcharts.SymbolKeyValue|string}\n * @since 5.0.11\n */\n symbol: 'circle'\n },\n /**\n * Minimum bubble size. Bubbles will automatically size between the\n * `minSize` and `maxSize` to reflect the `z` value of each bubble.\n * Can be either pixels (when no unit is given), or a percentage of\n * the smallest one of the plot width and height.\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-size/\n * Bubble size\n *\n * @type {number|string}\n * @since 3.0\n * @product highcharts highstock\n */\n minSize: 8,\n /**\n * Maximum bubble size. Bubbles will automatically size between the\n * `minSize` and `maxSize` to reflect the `z` value of each bubble.\n * Can be either pixels (when no unit is given), or a percentage of\n * the smallest one of the plot width and height.\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-size/\n * Bubble size\n *\n * @type {number|string}\n * @since 3.0\n * @product highcharts highstock\n */\n maxSize: '20%',\n /**\n * When a point's Z value is below the\n * [zThreshold](#plotOptions.bubble.zThreshold)\n * setting, this color is used.\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-negative/\n * Negative bubbles\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.bubble.negativeColor\n */\n /**\n * Whether the bubble's value should be represented by the area or the\n * width of the bubble. The default, `area`, corresponds best to the\n * human perception of the size of each bubble.\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-sizeby/\n * Comparison of area and size\n *\n * @type {Highcharts.BubbleSizeByValue}\n * @default area\n * @since 3.0.7\n * @apioption plotOptions.bubble.sizeBy\n */\n /**\n * When this is true, the absolute value of z determines the size of\n * the bubble. This means that with the default `zThreshold` of 0, a\n * bubble of value -1 will have the same size as a bubble of value 1,\n * while a bubble of value 0 will have a smaller size according to\n * `minSize`.\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-sizebyabsolutevalue/\n * Size by absolute value, various thresholds\n *\n * @type {boolean}\n * @default false\n * @since 4.1.9\n * @product highcharts\n * @apioption plotOptions.bubble.sizeByAbsoluteValue\n */\n /**\n * When this is true, the series will not cause the Y axis to cross\n * the zero plane (or [threshold](#plotOptions.series.threshold) option)\n * unless the data actually crosses the plane.\n *\n * For example, if `softThreshold` is `false`, a series of 0, 1, 2,\n * 3 will make the Y axis show negative values according to the\n * `minPadding` option. If `softThreshold` is `true`, the Y axis starts\n * at 0.\n *\n * @since 4.1.9\n * @product highcharts\n */\n softThreshold: false,\n states: {\n hover: {\n halo: {\n size: 5\n }\n }\n },\n tooltip: {\n pointFormat: '({point.x}, {point.y}), Size: {point.z}'\n },\n turboThreshold: 0,\n /**\n * The minimum for the Z value range. Defaults to the highest Z value\n * in the data.\n *\n * @see [zMin](#plotOptions.bubble.zMin)\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-zmin-zmax/\n * Z has a possible range of 0-100\n *\n * @type {number}\n * @since 4.0.3\n * @product highcharts\n * @apioption plotOptions.bubble.zMax\n */\n /**\n * @default z\n * @apioption plotOptions.bubble.colorKey\n */\n /**\n * The minimum for the Z value range. Defaults to the lowest Z value\n * in the data.\n *\n * @see [zMax](#plotOptions.bubble.zMax)\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-zmin-zmax/\n * Z has a possible range of 0-100\n *\n * @type {number}\n * @since 4.0.3\n * @product highcharts\n * @apioption plotOptions.bubble.zMin\n */\n /**\n * When [displayNegative](#plotOptions.bubble.displayNegative) is `false`,\n * bubbles with lower Z values are skipped. When `displayNegative`\n * is `true` and a [negativeColor](#plotOptions.bubble.negativeColor)\n * is given, points with lower Z is colored.\n *\n * @sample {highcharts} highcharts/plotoptions/bubble-negative/\n * Negative bubbles\n *\n * @since 3.0\n * @product highcharts\n */\n zThreshold: 0,\n zoneAxis: 'z'\n});\nextend(BubbleSeries.prototype, {\n alignDataLabel: columnProto.alignDataLabel,\n applyZones: noop,\n bubblePadding: true,\n isBubble: true,\n pointArrayMap: ['y', 'z'],\n pointClass: BubblePoint,\n parallelArrays: ['x', 'y', 'z'],\n trackerGroups: ['group', 'dataLabelsGroup'],\n specialGroup: 'group',\n zoneAxis: 'z'\n});\n// On updated data in any series, delete the chart-level Z extremes cache\naddEvent(BubbleSeries, 'updatedData', (e) => {\n delete e.target.chart.bubbleZExtremes;\n});\n// After removing series, delete the chart-level Z extremes cache, #17502.\naddEvent(BubbleSeries, 'remove', (e) => {\n delete e.target.chart.bubbleZExtremes;\n});\nSeriesRegistry.registerSeriesType('bubble', BubbleSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default BubbleSeries;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * @typedef {\"area\"|\"width\"} Highcharts.BubbleSizeByValue\n */\n''; // detach doclets above\n/* *\n *\n * API Options\n *\n * */\n/**\n * A `bubble` series. If the [type](#series.bubble.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.bubble\n * @excluding dataParser, dataURL, stack\n * @product highcharts highstock\n * @requires highcharts-more\n * @apioption series.bubble\n */\n/**\n * An array of data points for the series. For the `bubble` series type,\n * points can be given in the following ways:\n *\n * 1. An array of arrays with 3 or 2 values. In this case, the values correspond\n * to `x,y,z`. If the first value is a string, it is applied as the name of\n * the point, and the `x` value is inferred. The `x` value can also be\n * omitted, in which case the inner arrays should be of length 2\\. Then the\n * `x` value is automatically calculated, either starting at 0 and\n * incremented by 1, or from `pointStart` and `pointInterval` given in the\n * series options.\n * ```js\n * data: [\n * [0, 1, 2],\n * [1, 5, 5],\n * [2, 0, 2]\n * ]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.bubble.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 1,\n * z: 1,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 5,\n * z: 4,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|Array<(number|string),number,number>|*>}\n * @extends series.line.data\n * @product highcharts\n * @apioption series.bubble.data\n */\n/**\n * @extends series.line.data.marker\n * @excluding enabledThreshold, height, radius, width\n * @product highcharts\n * @apioption series.bubble.data.marker\n */\n/**\n * The size value for each bubble. The bubbles' diameters are computed\n * based on the `z`, and controlled by series options like `minSize`,\n * `maxSize`, `sizeBy`, `zMin` and `zMax`.\n *\n * @type {number|null}\n * @product highcharts\n * @apioption series.bubble.data.z\n */\n/**\n * @excluding enabled, enabledThreshold, height, radius, width\n * @apioption series.bubble.marker\n */\n''; // adds doclets above to transpiled file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { seriesTypes: { column: { prototype: { pointClass: { prototype: columnProto } } }, arearange: { prototype: { pointClass: AreaRangePoint } } } } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { extend, isNumber } = U;\n/* *\n *\n * Class\n *\n * */\nclass ColumnRangePoint extends AreaRangePoint {\n /* *\n *\n * Functions\n *\n * */\n isValid() {\n return isNumber(this.low);\n }\n}\nextend(ColumnRangePoint.prototype, {\n setState: columnProto.setState\n});\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnRangePoint;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport ColumnRangePoint from './ColumnRangePoint.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { seriesTypes: { arearange: AreaRangeSeries, column: ColumnSeries, column: { prototype: columnProto } } } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, clamp, extend, isNumber, merge, pick } = U;\n/* *\n *\n * Constants\n *\n * */\n/**\n * The column range is a cartesian series type with higher and lower\n * Y values along an X axis. To display horizontal bars, set\n * [chart.inverted](#chart.inverted) to `true`.\n *\n * @sample {highcharts|highstock} highcharts/demo/columnrange/\n * Inverted column range\n *\n * @extends plotOptions.column\n * @since 2.3.0\n * @excluding negativeColor, stacking, softThreshold, threshold\n * @product highcharts highstock\n * @requires highcharts-more\n * @optionparent plotOptions.columnrange\n */\nconst columnRangeOptions = {\n borderRadius: {\n where: 'all'\n },\n /**\n * Extended data labels for range series types. Range series data labels\n * have no `x` and `y` options. Instead, they have `xLow`, `xHigh`,\n * `yLow` and `yHigh` options to allow the higher and lower data label\n * sets individually.\n *\n * @declare Highcharts.SeriesAreaRangeDataLabelsOptionsObject\n * @extends plotOptions.arearange.dataLabels\n * @since 2.3.0\n * @product highcharts highstock\n * @apioption plotOptions.columnrange.dataLabels\n */\n pointRange: null,\n legendSymbol: 'rectangle',\n /** @ignore-option */\n marker: null,\n states: {\n hover: {\n /** @ignore-option */\n halo: false\n }\n }\n};\n/* *\n *\n * Class\n *\n * */\n/**\n * The ColumnRangeSeries class\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.columnrange\n *\n * @augments Highcharts.Series\n */\nclass ColumnRangeSeries extends AreaRangeSeries {\n /* *\n *\n * Functions\n *\n * */\n setOptions() {\n // #14359 Prevent side-effect from stacking.\n merge(true, arguments[0], { stacking: void 0 });\n return AreaRangeSeries.prototype.setOptions.apply(this, arguments);\n }\n // Overrides from modules that may be loaded after this module\n // @todo move to compositions\n translate() {\n return columnProto.translate.apply(this);\n }\n // public crispCol(): BBoxObject {\n // return columnProto.crispCol.apply(this, arguments as any);\n // }\n // public drawPoints(): void {\n // return columnProto.drawPoints.apply(this, arguments as any);\n // }\n // public drawTracker(): void {\n // return columnProto.drawTracker.apply(this, arguments as any);\n // }\n // public getColumnMetrics(): ColumnMetricsObject {\n // return columnProto.getColumnMetrics.apply(this, arguments as any);\n // }\n pointAttribs() {\n return columnProto.pointAttribs.apply(this, arguments);\n }\n // public adjustForMissingColumns(): number {\n // return columnProto.adjustForMissingColumns.apply(this, arguments);\n // }\n // public animate(): void {\n // return columnProto.animate.apply(this, arguments as any);\n // }\n translate3dPoints() {\n return columnProto.translate3dPoints.apply(this, arguments);\n }\n translate3dShapes() {\n return columnProto.translate3dShapes.apply(this, arguments);\n }\n afterColumnTranslate() {\n /**\n * Translate data points from raw values x and y to plotX and plotY\n * @private\n */\n const yAxis = this.yAxis, xAxis = this.xAxis, startAngleRad = xAxis.startAngleRad, chart = this.chart, isRadial = this.xAxis.isRadial, safeDistance = Math.max(chart.chartWidth, chart.chartHeight) + 999;\n let height, heightDifference, start, y;\n // eslint-disable-next-line valid-jsdoc\n /**\n * Don't draw too far outside plot area (#6835)\n * @private\n */\n function safeBounds(pixelPos) {\n return clamp(pixelPos, -safeDistance, safeDistance);\n }\n // Set plotLow and plotHigh\n this.points.forEach((point) => {\n const shapeArgs = point.shapeArgs || {}, minPointLength = this.options.minPointLength, plotY = point.plotY, plotHigh = yAxis.translate(point.high, 0, 1, 0, 1);\n if (isNumber(plotHigh) && isNumber(plotY)) {\n point.plotHigh = safeBounds(plotHigh);\n point.plotLow = safeBounds(plotY);\n // adjust shape\n y = point.plotHigh;\n height = pick(point.rectPlotY, point.plotY) - point.plotHigh;\n // Adjust for minPointLength\n if (Math.abs(height) < minPointLength) {\n heightDifference = (minPointLength - height);\n height += heightDifference;\n y -= heightDifference / 2;\n // Adjust for negative ranges or reversed Y axis (#1457)\n }\n else if (height < 0) {\n height *= -1;\n y -= height;\n }\n if (isRadial && this.polar) {\n start = point.barX + startAngleRad;\n point.shapeType = 'arc';\n point.shapeArgs = this.polar.arc(y + height, y, start, start + point.pointWidth);\n }\n else {\n shapeArgs.height = height;\n shapeArgs.y = y;\n const { x = 0, width = 0 } = shapeArgs;\n // #17912, aligning column range points\n // merge if shapeArgs contains more properties e.g. for 3d\n point.shapeArgs = merge(point.shapeArgs, this.crispCol(x, y, width, height));\n point.tooltipPos = chart.inverted ?\n [\n yAxis.len + yAxis.pos - chart.plotLeft - y -\n height / 2,\n xAxis.len + xAxis.pos - chart.plotTop - x -\n width / 2,\n height\n ] : [\n xAxis.left - chart.plotLeft + x + width / 2,\n yAxis.pos - chart.plotTop + y + height / 2,\n height\n ]; // don't inherit from column tooltip position - #3372\n }\n }\n });\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nColumnRangeSeries.defaultOptions = merge(ColumnSeries.defaultOptions, AreaRangeSeries.defaultOptions, columnRangeOptions);\naddEvent(ColumnRangeSeries, 'afterColumnTranslate', function () {\n ColumnRangeSeries.prototype.afterColumnTranslate.apply(this);\n}, { order: 5 });\nextend(ColumnRangeSeries.prototype, {\n directTouch: true,\n pointClass: ColumnRangePoint,\n trackerGroups: ['group', 'dataLabelsGroup'],\n adjustForMissingColumns: columnProto.adjustForMissingColumns,\n animate: columnProto.animate,\n crispCol: columnProto.crispCol,\n drawGraph: noop,\n drawPoints: columnProto.drawPoints,\n getSymbol: noop,\n drawTracker: columnProto.drawTracker,\n getColumnMetrics: columnProto.getColumnMetrics\n // pointAttribs: columnProto.pointAttribs,\n // polarArc: columnProto.polarArc\n // translate3dPoints: columnProto.translate3dPoints,\n // translate3dShapes: columnProto.translate3dShapes\n});\nSeriesRegistry.registerSeriesType('columnrange', ColumnRangeSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnRangeSeries;\n/* *\n *\n * API Options\n *\n * */\n/**\n * A `columnrange` series. If the [type](#series.columnrange.type)\n * option is not specified, it is inherited from\n * [chart.type](#chart.type).\n *\n * @extends series,plotOptions.columnrange\n * @excluding dataParser, dataURL, stack, stacking\n * @product highcharts highstock\n * @requires highcharts-more\n * @apioption series.columnrange\n */\n/**\n * An array of data points for the series. For the `columnrange` series\n * type, points can be given in the following ways:\n *\n * 1. An array of arrays with 3 or 2 values. In this case, the values correspond\n * to `x,low,high`. If the first value is a string, it is applied as the name\n * of the point, and the `x` value is inferred. The `x` value can also be\n * omitted, in which case the inner arrays should be of length 2\\. Then the\n * `x` value is automatically calculated, either starting at 0 and\n * incremented by 1, or from `pointStart` and `pointInterval` given in the\n * series options.\n * ```js\n * data: [\n * [0, 4, 2],\n * [1, 2, 1],\n * [2, 9, 10]\n * ]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.columnrange.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * low: 0,\n * high: 4,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * low: 5,\n * high: 3,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|Array<(number|string),number,number>|*>}\n * @extends series.arearange.data\n * @excluding marker\n * @product highcharts highstock\n * @apioption series.columnrange.data\n */\n/**\n * @extends series.columnrange.dataLabels\n * @product highcharts highstock\n * @apioption series.columnrange.data.dataLabels\n */\n/**\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock\n * @apioption series.columnrange.states.hover\n */\n/**\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock\n * @apioption series.columnrange.states.select\n */\n''; // adds doclets above into transpiled\n", "/* *\n *\n * (c) 2010-2024 Sebastian Bochan\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * Column pyramid series display one pyramid per value along an X axis.\n * To display horizontal pyramids, set [chart.inverted](#chart.inverted) to\n * `true`.\n *\n * @sample {highcharts|highstock} highcharts/demo/column-pyramid/\n * Column pyramid\n * @sample {highcharts|highstock} highcharts/plotoptions/columnpyramid-stacked/\n * Column pyramid stacked\n * @sample {highcharts|highstock} highcharts/plotoptions/columnpyramid-inverted/\n * Column pyramid inverted\n *\n * @extends plotOptions.column\n * @since 7.0.0\n * @product highcharts highstock\n * @excluding boostThreshold, borderRadius, crisp, depth, edgeColor,\n * edgeWidth, groupZPadding, negativeColor, softThreshold,\n * threshold, zoneAxis, zones, boostBlending\n * @requires highcharts-more\n * @optionparent plotOptions.columnpyramid\n */\nconst ColumnPyramidSeriesDefaults = {};\n/**\n * A `columnpyramid` series. If the [type](#series.columnpyramid.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.columnpyramid\n * @excluding connectEnds, connectNulls, dashStyle, dataParser, dataURL,\n * gapSize, gapUnit, linecap, lineWidth, marker, step,\n * boostThreshold, boostBlending\n * @product highcharts highstock\n * @requires highcharts-more\n * @apioption series.columnpyramid\n */\n/**\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock\n * @apioption series.columnpyramid.states.hover\n */\n/**\n * @excluding halo, lineWidth, lineWidthPlus, marker\n * @product highcharts highstock\n * @apioption series.columnpyramid.states.select\n */\n/**\n * An array of data points for the series. For the `columnpyramid` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 6],\n * [1, 2],\n * [2, 6]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The objects are point configuration\n * objects as seen below. If the total number of data points exceeds the\n * series' [turboThreshold](#series.columnpyramid.turboThreshold), this\n * option is not available.\n * ```js\n * data: [{\n * x: 1,\n * y: 9,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 6,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @excluding marker\n * @product highcharts highstock\n * @apioption series.columnpyramid.data\n */\n''; // keeps doclets above separate\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnPyramidSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Sebastian Bochan\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport ColumnPyramidSeriesDefaults from './ColumnPyramidSeriesDefaults.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { column: ColumnSeries } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { clamp, merge, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The ColumnPyramidSeries class\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.columnpyramid\n *\n * @augments Highcharts.Series\n */\nclass ColumnPyramidSeries extends ColumnSeries {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Overrides the column translate method\n * @private\n */\n translate() {\n const series = this, chart = series.chart, options = series.options, dense = series.dense =\n series.closestPointRange * series.xAxis.transA < 2, borderWidth = series.borderWidth = pick(options.borderWidth, dense ? 0 : 1 // #3635\n ), yAxis = series.yAxis, threshold = options.threshold, minPointLength = pick(options.minPointLength, 5), metrics = series.getColumnMetrics(), pointWidth = metrics.width, pointXOffset = series.pointXOffset = metrics.offset;\n let translatedThreshold = series.translatedThreshold =\n yAxis.getThreshold(threshold), \n // postprocessed for border width\n seriesBarW = series.barW =\n Math.max(pointWidth, 1 + 2 * borderWidth);\n if (chart.inverted) {\n translatedThreshold -= 0.5; // #3355\n }\n // When the pointPadding is 0,\n // we want the pyramids to be packed tightly,\n // so we allow individual pyramids to have individual sizes.\n // When pointPadding is greater,\n // we strive for equal-width columns (#2694).\n if (options.pointPadding) {\n seriesBarW = Math.ceil(seriesBarW);\n }\n super.translate();\n // Record the new values\n for (const point of series.points) {\n const yBottom = pick(point.yBottom, translatedThreshold), safeDistance = 999 + Math.abs(yBottom), plotY = clamp(point.plotY, -safeDistance, yAxis.len + safeDistance), \n // Don't draw too far outside plot area\n // (#1303, #2241, #4264)\n barW = seriesBarW / 2, barY = Math.min(plotY, yBottom), barH = Math.max(plotY, yBottom) - barY;\n let barX = point.plotX + pointXOffset, stackTotal, stackHeight, topPointY, topXwidth, bottomXwidth, invBarPos, x1, x2, x3, x4, y1, y2;\n // Adjust for null or missing points\n if (options.centerInCategory) {\n barX = series.adjustForMissingColumns(barX, pointWidth, point, metrics);\n }\n point.barX = barX;\n point.pointWidth = pointWidth;\n // Fix the tooltip on center of grouped pyramids\n // (#1216, #424, #3648)\n point.tooltipPos = chart.inverted ?\n [\n yAxis.len + yAxis.pos - chart.plotLeft - plotY,\n series.xAxis.len - barX - barW,\n barH\n ] :\n [\n barX + barW,\n plotY + yAxis.pos - chart.plotTop,\n barH\n ];\n stackTotal =\n threshold + (point.total || point.y);\n // overwrite stacktotal (always 100 / -100)\n if (options.stacking === 'percent') {\n stackTotal =\n threshold + (point.y < 0) ?\n -100 :\n 100;\n }\n // get the highest point (if stack, extract from total)\n topPointY = yAxis.toPixels((stackTotal), true);\n // calculate height of stack (in pixels)\n stackHeight =\n chart.plotHeight - topPointY -\n (chart.plotHeight - translatedThreshold);\n // topXwidth and bottomXwidth = width of lines from the center\n // calculated from tanges proportion.\n // Cannot be a NaN #12514\n topXwidth = stackHeight ?\n (barW * (barY - topPointY)) / stackHeight : 0;\n // like topXwidth, but with height of point\n bottomXwidth = stackHeight ?\n (barW * (barY + barH - topPointY)) / stackHeight :\n 0;\n /*\n /\\\n / \\\n x1,y1,------ x2,y1\n / \\\n -----------\n x4,y2 x3,y2\n */\n x1 = barX - topXwidth + barW;\n x2 = barX + topXwidth + barW;\n x3 = barX + bottomXwidth + barW;\n x4 = barX - bottomXwidth + barW;\n y1 = barY - minPointLength;\n y2 = barY + barH;\n if (point.y < 0) {\n y1 = barY;\n y2 = barY + barH + minPointLength;\n }\n // inverted chart\n if (chart.inverted) {\n invBarPos = yAxis.width - barY;\n stackHeight =\n topPointY - (yAxis.width - translatedThreshold);\n // proportion tanges\n topXwidth = (barW *\n (topPointY - invBarPos)) / stackHeight;\n bottomXwidth = (barW *\n (topPointY - (invBarPos - barH))) / stackHeight;\n x1 = barX + barW + topXwidth; // top bottom\n x2 = x1 - 2 * topXwidth; // top top\n x3 = barX - bottomXwidth + barW; // bottom top\n x4 = barX + bottomXwidth + barW; // bottom bottom\n y1 = barY;\n y2 = barY + barH - minPointLength;\n if (point.y < 0) {\n y2 = barY + barH + minPointLength;\n }\n }\n // Register shape type and arguments to be used in drawPoints\n point.shapeType = 'path';\n point.shapeArgs = {\n x: x1,\n y: y1,\n width: x2 - x1,\n height: barH,\n // path of pyramid\n d: [\n ['M', x1, y1],\n ['L', x2, y1],\n ['L', x3, y2],\n ['L', x4, y2],\n ['Z']\n ]\n };\n }\n }\n}\n/* *\n *\n * Static properties\n *\n * */\nColumnPyramidSeries.defaultOptions = merge(ColumnSeries.defaultOptions, ColumnPyramidSeriesDefaults);\nSeriesRegistry.registerSeriesType('columnpyramid', ColumnPyramidSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default ColumnPyramidSeries;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * Error bars are a graphical representation of the variability of data and\n * are used on graphs to indicate the error, or uncertainty in a reported\n * measurement.\n *\n * @sample highcharts/demo/error-bar/\n * Error bars on a column series\n * @sample highcharts/series-errorbar/on-scatter/\n * Error bars on a scatter series\n * @sample highcharts/series-errorbar/datalabels/\n * Error bars with data labels\n *\n * @extends plotOptions.boxplot\n * @excluding boostBlending, boostThreshold\n * @product highcharts\n * @requires highcharts-more\n * @optionparent plotOptions.errorbar\n */\nconst ErrorBarSeriesDefaults = {\n /**\n * The main color of the bars. This can be overridden by\n * [stemColor](#plotOptions.errorbar.stemColor) and\n * [whiskerColor](#plotOptions.errorbar.whiskerColor) individually.\n *\n * @sample {highcharts} highcharts/plotoptions/error-bar-styling/\n * Error bar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #000000\n * @since 3.0\n * @product highcharts\n */\n color: \"#000000\" /* Palette.neutralColor100 */,\n grouping: false,\n /**\n * The parent series of the error bar. The default value links it to\n * the previous series. Otherwise, use the id of the parent series.\n *\n * @since 3.0\n * @product highcharts\n */\n linkedTo: ':previous',\n tooltip: {\n pointFormat: '\\u25CF {series.name}: {point.low} - {point.high}
'\n },\n /**\n * The line width of the whiskers, the horizontal lines marking\n * low and high values. When `null`, the general\n * [lineWidth](#plotOptions.errorbar.lineWidth) applies.\n *\n * @sample {highcharts} highcharts/plotoptions/error-bar-styling/\n * Error bar styling\n *\n * @type {number}\n * @since 3.0\n * @product highcharts\n */\n whiskerWidth: null\n};\n/**\n * A `errorbar` series. If the [type](#series.errorbar.type) option\n * is not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.errorbar\n * @excluding dataParser, dataURL, stack, stacking, boostThreshold,\n * boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @apioption series.errorbar\n */\n/**\n * An array of data points for the series. For the `errorbar` series\n * type, points can be given in the following ways:\n *\n * 1. An array of arrays with 3 or 2 values. In this case, the values correspond\n * to `x,low,high`. If the first value is a string, it is applied as the name\n * of the point, and the `x` value is inferred. The `x` value can also be\n * omitted, in which case the inner arrays should be of length 2\\. Then the\n * `x` value is automatically calculated, either starting at 0 and\n * incremented by 1, or from `pointStart` and `pointInterval` given in the\n * series options.\n * ```js\n * data: [\n * [0, 10, 2],\n * [1, 1, 8],\n * [2, 4, 5]\n * ]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.errorbar.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * low: 0,\n * high: 0,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * low: 5,\n * high: 5,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|Array<(number|string),number,number>|*>}\n * @extends series.arearange.data\n * @excluding dataLabels, drilldown, marker, states\n * @product highcharts\n * @apioption series.errorbar.data\n */\n''; // adds doclets above to transpiled file\n/* *\n *\n * Default Export\n *\n * */\nexport default ErrorBarSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport BoxPlotSeries from '../BoxPlot/BoxPlotSeries.js';\nimport ColumnSeries from '../Column/ColumnSeries.js';\nimport ErrorBarSeriesDefaults from './ErrorBarSeriesDefaults.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { arearange: AreaRangeSeries } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, merge, extend } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * Errorbar series type\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.errorbar\n *\n * @augments Highcharts.Series\n */\nclass ErrorBarSeries extends BoxPlotSeries {\n /* *\n *\n * Functions\n *\n * */\n getColumnMetrics() {\n const series = this;\n // Get the width and X offset, either on top of the linked series\n // column or standalone\n return ((series.linkedParent && series.linkedParent.columnMetrics) ||\n ColumnSeries.prototype.getColumnMetrics.call(series));\n }\n drawDataLabels() {\n const series = this, valKey = series.pointValKey;\n if (AreaRangeSeries) {\n AreaRangeSeries.prototype.drawDataLabels.call(series);\n // Arearange drawDataLabels does not reset point.y to high,\n // but to low after drawing (#4133)\n for (const point of series.points) {\n point.y = point[valKey];\n }\n }\n }\n toYData(point) {\n // return a plain array for speedy calculation\n return [point.low, point.high];\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nErrorBarSeries.defaultOptions = merge(BoxPlotSeries.defaultOptions, ErrorBarSeriesDefaults);\naddEvent(ErrorBarSeries, 'afterTranslate', function () {\n for (const point of this.points) {\n point.plotLow = point.plotY;\n }\n}, { order: 0 });\nextend(ErrorBarSeries.prototype, {\n // pointClass: ErrorBarPoint, // just a declaration\n pointArrayMap: ['low', 'high'],\n pointValKey: 'high',\n doQuartiles: false\n});\nSeriesRegistry.registerSeriesType('errorbar', ErrorBarSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default ErrorBarSeries;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { series: { prototype: { pointClass: Point } } } = SeriesRegistry;\n/* *\n *\n * Class\n *\n * */\nclass GaugePoint extends Point {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Don't do any hover colors or anything\n * @private\n */\n setState(state) {\n this.state = state;\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default GaugePoint;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport GaugePoint from './GaugePoint.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { series: Series, seriesTypes: { column: ColumnSeries } } = SeriesRegistry;\nimport U from '../../Core/Utilities.js';\nconst { clamp, isNumber, extend, merge, pick, pInt, defined } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n *\n * The `gauge` series type\n *\n * @private\n * @class\n * @name Highcharts.seriesTypes.map\n *\n * @augments Highcharts.Series\n */\nclass GaugeSeries extends Series {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Calculate paths etc\n * @private\n */\n translate() {\n const series = this, yAxis = series.yAxis, options = series.options, center = yAxis.center;\n series.generatePoints();\n series.points.forEach((point) => {\n const dialOptions = merge(options.dial, point.dial), radius = (pInt(dialOptions.radius) * center[2]) / 200, baseLength = (pInt(dialOptions.baseLength) * radius) / 100, rearLength = (pInt(dialOptions.rearLength) * radius) / 100, baseWidth = dialOptions.baseWidth, topWidth = dialOptions.topWidth;\n let overshoot = options.overshoot, rotation = yAxis.startAngleRad + yAxis.translate(point.y, void 0, void 0, void 0, true);\n // Handle the wrap and overshoot options\n if (isNumber(overshoot) || options.wrap === false) {\n overshoot = isNumber(overshoot) ?\n (overshoot / 180 * Math.PI) : 0;\n rotation = clamp(rotation, yAxis.startAngleRad - overshoot, yAxis.endAngleRad + overshoot);\n }\n rotation = rotation * 180 / Math.PI;\n point.shapeType = 'path';\n const d = dialOptions.path || [\n ['M', -rearLength, -baseWidth / 2],\n ['L', baseLength, -baseWidth / 2],\n ['L', radius, -topWidth / 2],\n ['L', radius, topWidth / 2],\n ['L', baseLength, baseWidth / 2],\n ['L', -rearLength, baseWidth / 2],\n ['Z']\n ];\n point.shapeArgs = {\n d,\n translateX: center[0],\n translateY: center[1],\n rotation: rotation\n };\n // Positions for data label\n point.plotX = center[0];\n point.plotY = center[1];\n if (defined(point.y) && yAxis.max - yAxis.min) {\n point.percentage =\n (point.y - yAxis.min) / (yAxis.max - yAxis.min) * 100;\n }\n });\n }\n /**\n * Draw the points where each point is one needle\n * @private\n */\n drawPoints() {\n const series = this, chart = series.chart, center = series.yAxis.center, pivot = series.pivot, options = series.options, pivotOptions = options.pivot, renderer = chart.renderer;\n series.points.forEach((point) => {\n const graphic = point.graphic, shapeArgs = point.shapeArgs, d = shapeArgs.d, dialOptions = merge(options.dial, point.dial); // #1233\n if (graphic) {\n graphic.animate(shapeArgs);\n shapeArgs.d = d; // animate alters it\n }\n else {\n point.graphic =\n renderer[point.shapeType](shapeArgs)\n .addClass('highcharts-dial')\n .add(series.group);\n }\n // Presentational attributes\n if (!chart.styledMode) {\n point.graphic[graphic ? 'animate' : 'attr']({\n stroke: dialOptions.borderColor,\n 'stroke-width': dialOptions.borderWidth,\n fill: dialOptions.backgroundColor\n });\n }\n });\n // Add or move the pivot\n if (pivot) {\n pivot.animate({\n translateX: center[0],\n translateY: center[1]\n });\n }\n else if (pivotOptions) {\n series.pivot =\n renderer.circle(0, 0, pivotOptions.radius)\n .attr({\n zIndex: 2\n })\n .addClass('highcharts-pivot')\n .translate(center[0], center[1])\n .add(series.group);\n // Presentational attributes\n if (!chart.styledMode) {\n series.pivot.attr({\n fill: pivotOptions.backgroundColor,\n stroke: pivotOptions.borderColor,\n 'stroke-width': pivotOptions.borderWidth\n });\n }\n }\n }\n /**\n * Animate the arrow up from startAngle\n * @private\n */\n animate(init) {\n const series = this;\n if (!init) {\n series.points.forEach((point) => {\n const graphic = point.graphic;\n if (graphic) {\n // start value\n graphic.attr({\n rotation: series.yAxis.startAngleRad * 180 / Math.PI\n });\n // animate\n graphic.animate({\n rotation: point.shapeArgs.rotation\n }, series.options.animation);\n }\n });\n }\n }\n /**\n * @private\n */\n render() {\n this.group = this.plotGroup('group', 'series', this.visible ? 'inherit' : 'hidden', this.options.zIndex, this.chart.seriesGroup);\n Series.prototype.render.call(this);\n this.group.clip(this.chart.clipRect);\n }\n /**\n * Extend the basic setData method by running processData and generatePoints\n * immediately, in order to access the points from the legend.\n * @private\n */\n setData(data, redraw) {\n Series.prototype.setData.call(this, data, false);\n this.processData();\n this.generatePoints();\n if (pick(redraw, true)) {\n this.chart.redraw();\n }\n }\n /**\n * Define hasData function for non-cartesian series.\n * Returns true if the series has points at all.\n * @private\n */\n hasData() {\n return !!this.points.length; // != 0\n }\n}\n/* *\n *\n * Static properties\n *\n * */\n/**\n * Gauges are circular plots displaying one or more values with a dial\n * pointing to values along the perimeter.\n *\n * @sample highcharts/demo/gauge-speedometer/\n * Gauge chart\n *\n * @extends plotOptions.line\n * @excluding animationLimit, boostThreshold, colorAxis, colorKey,\n * connectEnds, connectNulls, cropThreshold, dashStyle,\n * dragDrop, findNearestPointBy, getExtremesFromAll, marker,\n * negativeColor, pointPlacement, shadow, softThreshold,\n * stacking, states, step, threshold, turboThreshold, xAxis,\n * zoneAxis, zones, dataSorting, boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @optionparent plotOptions.gauge\n */\nGaugeSeries.defaultOptions = merge(Series.defaultOptions, {\n /**\n * When this option is `true`, the dial will wrap around the axes.\n * For instance, in a full-range gauge going from 0 to 360, a value\n * of 400 will point to 40\\. When `wrap` is `false`, the dial stops\n * at 360.\n *\n * @see [overshoot](#plotOptions.gauge.overshoot)\n *\n * @type {boolean}\n * @default true\n * @since 3.0\n * @product highcharts\n * @apioption plotOptions.gauge.wrap\n */\n /**\n * Data labels for the gauge. For gauges, the data labels are\n * enabled by default and shown in a bordered box below the point.\n *\n * @since 2.3.0\n * @product highcharts\n */\n dataLabels: {\n borderColor: \"#cccccc\" /* Palette.neutralColor20 */,\n borderRadius: 3,\n borderWidth: 1,\n crop: false,\n defer: false,\n enabled: true,\n verticalAlign: 'top',\n y: 15,\n zIndex: 2\n },\n /**\n * Options for the dial or arrow pointer of the gauge.\n *\n * In styled mode, the dial is styled with the\n * `.highcharts-gauge-series .highcharts-dial` rule.\n *\n * @sample {highcharts} highcharts/css/gauge/\n * Styled mode\n *\n * @type {*}\n * @since 2.3.0\n * @product highcharts\n */\n dial: {\n /**\n * The background or fill color of the gauge's dial.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #000000\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.backgroundColor\n */\n backgroundColor: \"#000000\" /* Palette.neutralColor100 */,\n /**\n * The length of the dial's base part, relative to the total\n * radius or length of the dial.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {string}\n * @default 70%\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.baseLength\n */\n baseLength: '70%',\n /**\n * The pixel width of the base of the gauge dial. The base is\n * the part closest to the pivot, defined by baseLength.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {number}\n * @default 3\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.baseWidth\n */\n baseWidth: 3,\n /**\n * The border color or stroke of the gauge's dial. By default,\n * the borderWidth is 0, so this must be set in addition to a\n * custom border color.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #cccccc\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.borderColor\n */\n borderColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The width of the gauge dial border in pixels.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {number}\n * @default 0\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.borderWidth\n */\n borderWidth: 0,\n /**\n * An array with an SVG path for the custom dial.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-path/\n * Dial options demonstrated\n *\n * @type {Highcharts.SVGPathArray}\n * @since 10.2.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.path\n */\n /**\n * The radius or length of the dial, in percentages relative to\n * the radius of the gauge itself.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {string}\n * @default 80%\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.radius\n */\n radius: '80%',\n /**\n * The length of the dial's rear end, the part that extends out\n * on the other side of the pivot. Relative to the dial's\n * length.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {string}\n * @default 10%\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.rearLength\n */\n rearLength: '10%',\n /**\n * The width of the top of the dial, closest to the perimeter.\n * The pivot narrows in from the base to the top.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-dial/\n * Dial options demonstrated\n *\n * @type {number}\n * @default 1\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.dial.topWidth\n */\n topWidth: 1\n },\n /**\n * Allow the dial to overshoot the end of the perimeter axis by\n * this many degrees. Say if the gauge axis goes from 0 to 60, a\n * value of 100, or 1000, will show 5 degrees beyond the end of the\n * axis when this option is set to 5.\n *\n * @see [wrap](#plotOptions.gauge.wrap)\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-overshoot/\n * Allow 5 degrees overshoot\n *\n * @type {number}\n * @since 3.0.10\n * @product highcharts\n * @apioption plotOptions.gauge.overshoot\n */\n /**\n * Options for the pivot or the center point of the gauge.\n *\n * In styled mode, the pivot is styled with the\n * `.highcharts-gauge-series .highcharts-pivot` rule.\n *\n * @sample {highcharts} highcharts/css/gauge/\n * Styled mode\n *\n * @type {*}\n * @since 2.3.0\n * @product highcharts\n */\n pivot: {\n /**\n * The pixel radius of the pivot.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-pivot/\n * Pivot options demonstrated\n *\n * @type {number}\n * @default 5\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.pivot.radius\n */\n radius: 5,\n /**\n * The border or stroke width of the pivot.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-pivot/\n * Pivot options demonstrated\n *\n * @type {number}\n * @default 0\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.pivot.borderWidth\n */\n borderWidth: 0,\n /**\n * The border or stroke color of the pivot. In able to change\n * this, the borderWidth must also be set to something other\n * than the default 0.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-pivot/\n * Pivot options demonstrated\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #cccccc\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.pivot.borderColor\n */\n borderColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The background color or fill of the pivot.\n *\n * @sample {highcharts} highcharts/plotoptions/gauge-pivot/\n * Pivot options demonstrated\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #000000\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.gauge.pivot.backgroundColor\n */\n backgroundColor: \"#000000\" /* Palette.neutralColor100 */\n },\n tooltip: {\n headerFormat: ''\n },\n /**\n * Whether to display this particular series or series type in the\n * legend. Defaults to false for gauge series.\n *\n * @since 2.3.0\n * @product highcharts\n */\n showInLegend: false\n // Prototype members\n});\nextend(GaugeSeries.prototype, {\n // chart.angular will be set to true when a gauge series is present,\n // and this will be used on the axes\n angular: true,\n directTouch: true,\n drawGraph: noop,\n drawTracker: ColumnSeries.prototype.drawTracker,\n fixedBox: true,\n forceDL: true,\n noSharedTooltip: true,\n pointClass: GaugePoint,\n trackerGroups: ['group', 'dataLabelsGroup']\n});\nSeriesRegistry.registerSeriesType('gauge', GaugeSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default GaugeSeries;\n/* *\n *\n * API options\n *\n * */\n/**\n * A `gauge` series. If the [type](#series.gauge.type) option is not\n * specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.gauge\n * @excluding animationLimit, boostThreshold, connectEnds, connectNulls,\n * cropThreshold, dashStyle, dataParser, dataURL, findNearestPointBy,\n * getExtremesFromAll, marker, negativeColor, pointPlacement, shadow,\n * softThreshold, stack, stacking, states, step, threshold,\n * turboThreshold, zoneAxis, zones, dataSorting, boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @apioption series.gauge\n */\n/**\n * An array of data points for the series. For the `gauge` series type,\n * points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.gauge.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * y: 6,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * y: 8,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * The typical gauge only contains a single data value.\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array}\n * @extends series.line.data\n * @excluding drilldown, marker, x\n * @product highcharts\n * @apioption series.gauge.data\n */\n''; // adds the doclets above in the transpiled file\n", "/* *\n *\n * Networkgraph series\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Core/Globals.js';\nconst { composed } = H;\nimport U from '../Core/Utilities.js';\nconst { addEvent, pushUnique } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction compose(ChartClass) {\n if (pushUnique(composed, 'DragNodes')) {\n addEvent(ChartClass, 'load', onChartLoad);\n }\n}\n/**\n * Draggable mode:\n * @private\n */\nfunction onChartLoad() {\n const chart = this;\n let mousedownUnbinder, mousemoveUnbinder, mouseupUnbinder;\n if (chart.container) {\n mousedownUnbinder = addEvent(chart.container, 'mousedown', (event) => {\n const point = chart.hoverPoint;\n if (point &&\n point.series &&\n point.series.hasDraggableNodes &&\n point.series.options.draggable) {\n point.series.onMouseDown(point, event);\n mousemoveUnbinder = addEvent(chart.container, 'mousemove', (e) => (point &&\n point.series &&\n point.series.onMouseMove(point, e)));\n mouseupUnbinder = addEvent(chart.container.ownerDocument, 'mouseup', (e) => {\n mousemoveUnbinder();\n mouseupUnbinder();\n return point &&\n point.series &&\n point.series.onMouseUp(point, e);\n });\n }\n });\n }\n addEvent(chart, 'destroy', function () {\n mousedownUnbinder();\n });\n}\n/**\n * Mouse down action, initializing drag&drop mode.\n *\n * @private\n * @param {Highcharts.Point} point\n * The point that event occurred.\n * @param {Highcharts.PointerEventObject} event\n * Browser event, before normalization.\n */\nfunction onMouseDown(point, event) {\n const normalizedEvent = this.chart.pointer?.normalize(event) || event;\n point.fixedPosition = {\n chartX: normalizedEvent.chartX,\n chartY: normalizedEvent.chartY,\n plotX: point.plotX,\n plotY: point.plotY\n };\n point.inDragMode = true;\n}\n/**\n * Mouse move action during drag&drop.\n *\n * @private\n *\n * @param {global.Event} event\n * Browser event, before normalization.\n * @param {Highcharts.Point} point\n * The point that event occurred.\n *\n */\nfunction onMouseMove(point, event) {\n if (point.fixedPosition && point.inDragMode) {\n const series = this, chart = series.chart, normalizedEvent = chart.pointer?.normalize(event) || event, diffX = point.fixedPosition.chartX - normalizedEvent.chartX, diffY = point.fixedPosition.chartY - normalizedEvent.chartY, graphLayoutsLookup = chart.graphLayoutsLookup;\n let newPlotX, newPlotY;\n // At least 5px to apply change (avoids simple click):\n if (Math.abs(diffX) > 5 || Math.abs(diffY) > 5) {\n newPlotX = point.fixedPosition.plotX - diffX;\n newPlotY = point.fixedPosition.plotY - diffY;\n if (chart.isInsidePlot(newPlotX, newPlotY)) {\n point.plotX = newPlotX;\n point.plotY = newPlotY;\n point.hasDragged = true;\n this.redrawHalo(point);\n graphLayoutsLookup.forEach((layout) => {\n layout.restartSimulation();\n });\n }\n }\n }\n}\n/**\n * Mouse up action, finalizing drag&drop.\n *\n * @private\n * @param {Highcharts.Point} point\n * The point that event occurred.\n */\nfunction onMouseUp(point) {\n if (point.fixedPosition) {\n if (point.hasDragged) {\n if (this.layout.enableSimulation) {\n this.layout.start();\n }\n else {\n this.chart.redraw();\n }\n }\n point.inDragMode = point.hasDragged = false;\n if (!this.options.fixedDraggable) {\n delete point.fixedPosition;\n }\n }\n}\n/**\n * Redraw halo on mousemove during the drag&drop action.\n *\n * @private\n * @param {Highcharts.Point} point\n * The point that should show halo.\n */\nfunction redrawHalo(point) {\n if (point && this.halo) {\n this.halo.attr({\n d: point.haloPath(this.options.states.hover.halo.size)\n });\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst DragNodesComposition = {\n compose,\n onMouseDown,\n onMouseMove,\n onMouseUp,\n redrawHalo\n};\nexport default DragNodesComposition;\n", "/* *\n *\n * Networkgraph series\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../Core/Animation/AnimationUtilities.js';\nconst { setAnimation } = A;\nimport H from '../Core/Globals.js';\nconst { composed } = H;\nimport U from '../Core/Utilities.js';\nconst { addEvent, pushUnique } = U;\n/* *\n *\n * Constants\n *\n * */\nconst integrations = {};\nconst layouts = {};\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction compose(ChartClass) {\n if (pushUnique(composed, 'GraphLayout')) {\n addEvent(ChartClass, 'afterPrint', onChartAfterPrint);\n addEvent(ChartClass, 'beforePrint', onChartBeforePrint);\n addEvent(ChartClass, 'predraw', onChartPredraw);\n addEvent(ChartClass, 'render', onChartRender);\n }\n}\n/**\n * Re-enable simulation after print.\n * @private\n */\nfunction onChartAfterPrint() {\n if (this.graphLayoutsLookup) {\n this.graphLayoutsLookup.forEach((layout) => {\n // return to default simulation\n layout.updateSimulation();\n });\n this.redraw();\n }\n}\n/**\n * Disable simulation before print if enabled.\n * @private\n */\nfunction onChartBeforePrint() {\n if (this.graphLayoutsLookup) {\n this.graphLayoutsLookup.forEach((layout) => {\n layout.updateSimulation(false);\n });\n this.redraw();\n }\n}\n/**\n * Clear previous layouts.\n * @private\n */\nfunction onChartPredraw() {\n if (this.graphLayoutsLookup) {\n this.graphLayoutsLookup.forEach((layout) => {\n layout.stop();\n });\n }\n}\n/**\n * @private\n */\nfunction onChartRender() {\n let systemsStable, afterRender = false;\n const layoutStep = (layout) => {\n if (layout.maxIterations-- &&\n isFinite(layout.temperature) &&\n !layout.isStable() &&\n !layout.enableSimulation) {\n // Hook similar to build-in addEvent, but instead of\n // creating whole events logic, use just a function.\n // It's faster which is important for rAF code.\n // Used e.g. in packed-bubble series for bubble radius\n // calculations\n if (layout.beforeStep) {\n layout.beforeStep();\n }\n layout.step();\n systemsStable = false;\n afterRender = true;\n }\n };\n if (this.graphLayoutsLookup) {\n setAnimation(false, this);\n // Start simulation\n this.graphLayoutsLookup.forEach((layout) => layout.start());\n // Just one sync step, to run different layouts similar to\n // async mode.\n while (!systemsStable) {\n systemsStable = true;\n this.graphLayoutsLookup.forEach(layoutStep);\n }\n if (afterRender) {\n this.series.forEach((series) => {\n if (series && series.layout) {\n series.render();\n }\n });\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst GraphLayoutComposition = {\n compose,\n integrations,\n layouts\n};\nexport default GraphLayoutComposition;\n", "/* *\n *\n * (c) 2010-2024 Grzegorz Blachlinski, Sebastian Bochan\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Chart from '../../Core/Chart/Chart.js';\nimport Point from '../../Core/Series/Point.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { seriesTypes: { bubble: { prototype: { pointClass: BubblePoint } } } } = SeriesRegistry;\n/* *\n *\n * Class\n *\n * */\nclass PackedBubblePoint extends BubblePoint {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Destroy point.\n * Then remove point from the layout.\n * @private\n */\n destroy() {\n if (this.series.layout) {\n this.series.layout.removeElementFromCollection(this, this.series.layout.nodes);\n }\n return Point.prototype.destroy.apply(this, arguments);\n }\n firePointEvent() {\n const series = this.series, seriesOptions = series.options;\n if (this.isParentNode && seriesOptions.parentNode) {\n const temp = seriesOptions.allowPointSelect;\n seriesOptions.allowPointSelect = (seriesOptions.parentNode.allowPointSelect);\n Point.prototype.firePointEvent.apply(this, arguments);\n seriesOptions.allowPointSelect = temp;\n }\n else {\n Point.prototype.firePointEvent.apply(this, arguments);\n }\n }\n select() {\n const point = this, series = this.series, chart = series.chart;\n if (point.isParentNode) {\n chart.getSelectedPoints = chart.getSelectedParentNodes;\n Point.prototype.select.apply(this, arguments);\n chart.getSelectedPoints = Chart.prototype.getSelectedPoints;\n }\n else {\n Point.prototype.select.apply(this, arguments);\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default PackedBubblePoint;\n", "/* *\n *\n * Imports\n *\n * */\nimport U from '../../Core/Utilities.js';\nconst { isNumber } = U;\n/* *\n *\n * Constants\n *\n * */\n/**\n * A packed bubble series is a two dimensional series type, where each point\n * renders a value in X, Y position. Each point is drawn as a bubble\n * where the bubbles don't overlap with each other and the radius\n * of the bubble relates to the value.\n *\n * @sample highcharts/demo/packed-bubble/\n * Packed bubble chart\n * @sample highcharts/demo/packed-bubble-split/\n * Split packed bubble chart\n *\n * @extends plotOptions.bubble\n * @excluding connectEnds, connectNulls, cropThreshold, dragDrop, jitter,\n * keys, pointPlacement, sizeByAbsoluteValue, step, xAxis,\n * yAxis, zMax, zMin, dataSorting, boostThreshold,\n * boostBlending\n * @product highcharts\n * @since 7.0.0\n * @requires highcharts-more\n * @optionparent plotOptions.packedbubble\n *\n * @private\n */\nconst PackedBubbleSeriesDefaults = {\n /**\n * Minimum bubble size. Bubbles will automatically size between the\n * `minSize` and `maxSize` to reflect the value of each bubble.\n * Can be either pixels (when no unit is given), or a percentage of\n * the smallest one of the plot width and height, divided by the square\n * root of total number of points.\n *\n * @sample highcharts/plotoptions/bubble-size/\n * Bubble size\n *\n * @type {number|string}\n *\n * @private\n */\n minSize: '10%',\n /**\n * Maximum bubble size. Bubbles will automatically size between the\n * `minSize` and `maxSize` to reflect the value of each bubble.\n * Can be either pixels (when no unit is given), or a percentage of\n * the smallest one of the plot width and height, divided by the square\n * root of total number of points.\n *\n * @sample highcharts/plotoptions/bubble-size/\n * Bubble size\n *\n * @type {number|string}\n *\n * @private\n */\n maxSize: '50%',\n sizeBy: 'area',\n zoneAxis: 'y',\n crisp: false,\n tooltip: {\n pointFormat: 'Value: {point.value}'\n },\n /**\n * Flag to determine if nodes are draggable or not. Available for\n * graph with useSimulation set to true only.\n *\n * @since 7.1.0\n *\n * @private\n */\n draggable: true,\n /**\n * An option is giving a possibility to choose between using simulation\n * for calculating bubble positions. These reflects in both animation\n * and final position of bubbles. Simulation is also adding options to\n * the series graph based on used layout. In case of big data sets, with\n * any performance issues, it is possible to disable animation and pack\n * bubble in a simple circular way.\n *\n * @sample highcharts/series-packedbubble/spiral/\n * useSimulation set to false\n *\n * @since 7.1.0\n *\n * @private\n */\n useSimulation: true,\n /**\n * Series options for parent nodes.\n *\n * @since 8.1.1\n *\n * @private\n */\n parentNode: {\n /**\n * Allow this series' parent nodes to be selected\n * by clicking on the graph.\n *\n * @since 8.1.1\n */\n allowPointSelect: false\n },\n /**\n /**\n *\n * @declare Highcharts.SeriesPackedBubbleDataLabelsOptionsObject\n *\n * @private\n */\n dataLabels: {\n /**\n * The\n * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)\n * specifying what to show for _node_ in the networkgraph. In v7.0\n * defaults to `{key}`, since v7.1 defaults to `undefined` and\n * `formatter` is used instead.\n *\n * @type {string}\n * @since 7.0.0\n * @apioption plotOptions.packedbubble.dataLabels.format\n */\n // eslint-disable-next-line valid-jsdoc\n /**\n * Callback JavaScript function to format the data label for a node.\n * Note that if a `format` is defined, the format takes precedence\n * and the formatter is ignored.\n *\n * @type {Highcharts.SeriesPackedBubbleDataLabelsFormatterCallbackFunction}\n * @since 7.0.0\n */\n formatter: function () {\n const { numberFormatter } = this.series.chart;\n const { value } = this.point;\n return isNumber(value) ? numberFormatter(value, -1) : '';\n },\n /**\n * @type {string}\n * @since 7.1.0\n * @apioption plotOptions.packedbubble.dataLabels.parentNodeFormat\n */\n // eslint-disable-next-line valid-jsdoc\n /**\n * @type {Highcharts.SeriesPackedBubbleDataLabelsFormatterCallbackFunction}\n * @since 7.1.0\n */\n parentNodeFormatter: function () {\n return this.name;\n },\n /**\n * @sample {highcharts} highcharts/series-packedbubble/packed-dashboard\n * Dashboard with dataLabels on parentNodes\n *\n * @declare Highcharts.SeriesPackedBubbleDataLabelsTextPathOptionsObject\n * @since 7.1.0\n */\n parentNodeTextPath: {\n /**\n * Presentation attributes for the text path.\n *\n * @type {Highcharts.SVGAttributes}\n * @since 7.1.0\n * @apioption plotOptions.packedbubble.dataLabels.attributes\n */\n /**\n * Enable or disable `textPath` option for link's or marker's\n * data labels.\n *\n * @since 7.1.0\n */\n enabled: true\n },\n /**\n * Options for a _node_ label text which should follow marker's\n * shape.\n *\n * **Note:** Only SVG-based renderer supports this option.\n *\n * @extends plotOptions.series.dataLabels.textPath\n * @apioption plotOptions.packedbubble.dataLabels.textPath\n */\n padding: 0,\n style: {\n transition: 'opacity 2000ms'\n }\n },\n /**\n * Options for layout algorithm when simulation is enabled. Inside there\n * are options to change the speed, padding, initial bubbles positions\n * and more.\n *\n * @extends plotOptions.networkgraph.layoutAlgorithm\n * @excluding approximation, attractiveForce, repulsiveForce, theta\n * @since 7.1.0\n *\n * @private\n */\n layoutAlgorithm: {\n /**\n * Initial layout algorithm for positioning nodes. Can be one of\n * the built-in options (\"circle\", \"random\") or a function where\n * positions should be set on each node (`this.nodes`) as\n * `node.plotX` and `node.plotY`.\n *\n * @sample highcharts/series-networkgraph/initial-positions/\n * Initial positions with callback\n *\n * @type {\"circle\"|\"random\"|Function}\n */\n initialPositions: 'circle',\n /**\n * @sample highcharts/series-packedbubble/initial-radius/\n * Initial radius set to 200\n *\n * @extends plotOptions.networkgraph.layoutAlgorithm.initialPositionRadius\n * @excluding states\n */\n initialPositionRadius: 20,\n /**\n * The distance between two bubbles, when the algorithm starts to\n * treat two bubbles as overlapping. The `bubblePadding` is also the\n * expected distance between all the bubbles on simulation end.\n */\n bubblePadding: 5,\n /**\n * Whether bubbles should interact with their parentNode to keep\n * them inside.\n */\n parentNodeLimit: false,\n /**\n * Whether series should interact with each other or not. When\n * `parentNodeLimit` is set to true, thi option should be set to\n * false to avoid sticking points in wrong series parentNode.\n */\n seriesInteraction: true,\n /**\n * In case of split series, this option allows user to drag and\n * drop points between series, for changing point related series.\n *\n * @sample highcharts/series-packedbubble/packed-dashboard/\n * Example of drag'n drop bubbles for bubble kanban\n */\n dragBetweenSeries: false,\n /**\n * Layout algorithm options for parent nodes.\n *\n * @extends plotOptions.networkgraph.layoutAlgorithm\n * @excluding approximation, attractiveForce, enableSimulation,\n * repulsiveForce, theta\n */\n parentNodeOptions: {\n maxIterations: 400,\n gravitationalConstant: 0.03,\n maxSpeed: 50,\n initialPositionRadius: 100,\n seriesInteraction: true,\n /**\n * Styling options for parentNodes markers. Similar to\n * line.marker options.\n *\n * @sample highcharts/series-packedbubble/parentnode-style/\n * Bubble size\n *\n * @extends plotOptions.series.marker\n * @excluding states\n */\n marker: {\n fillColor: null,\n fillOpacity: 1,\n lineWidth: null,\n lineColor: null,\n symbol: 'circle'\n }\n },\n enableSimulation: true,\n /**\n * Type of the algorithm used when positioning bubbles.\n * @ignore-option\n */\n type: 'packedbubble',\n /**\n * Integration type. Integration determines how forces are applied\n * on particles. The `packedbubble` integration is based on\n * the networkgraph `verlet` integration, where the new position\n * is based on a previous position without velocity:\n * `newPosition += previousPosition - newPosition`.\n *\n * @sample highcharts/series-networkgraph/forces/\n *\n * @ignore-option\n */\n integration: 'packedbubble',\n maxIterations: 1000,\n /**\n * Whether to split series into individual groups or to mix all\n * series together.\n *\n * @since 7.1.0\n * @default false\n */\n splitSeries: false,\n /**\n * Max speed that node can get in one iteration. In terms of\n * simulation, it's a maximum translation (in pixels) that a node\n * can move (in both, x and y, dimensions). While `friction` is\n * applied on all nodes, max speed is applied only for nodes that\n * move very fast, for example small or disconnected ones.\n *\n * @see [layoutAlgorithm.integration](#series.networkgraph.layoutAlgorithm.integration)\n *\n * @see [layoutAlgorithm.friction](#series.networkgraph.layoutAlgorithm.friction)\n */\n maxSpeed: 5,\n gravitationalConstant: 0.01,\n friction: -0.981\n }\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default PackedBubbleSeriesDefaults;\n/* *\n *\n * API Options\n *\n * */\n/**\n * A `packedbubble` series. If the [type](#series.packedbubble.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @type {Object}\n * @extends series,plotOptions.packedbubble\n * @excluding cropThreshold, dataParser, dataSorting, dataURL, dragDrop, stack,\n * boostThreshold, boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @apioption series.packedbubble\n */\n/**\n * An array of data points for the series. For the `packedbubble` series type,\n * points can be given in the following ways:\n *\n * 1. An array of `values`.\n *\n * ```js\n * data: [5, 1, 20]\n * ```\n *\n * 2. An array of objects with named values. The objects are point\n * configuration objects as seen below. If the total number of data points\n * exceeds the series' [turboThreshold](#series.packedbubble.turboThreshold),\n * this option is not available.\n *\n * ```js\n * data: [{\n * value: 1,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * value: 5,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @type {Array}\n * @extends series.line.data\n * @excluding marker, x, y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n * @product highcharts\n * @apioption series.packedbubble.data\n */\n/**\n * @type {Highcharts.SeriesPackedBubbleDataLabelsOptionsObject|Array}\n * @product highcharts\n * @apioption series.packedbubble.data.dataLabels\n */\n/**\n * @excluding enabled,enabledThreshold,height,radius,width\n * @product highcharts\n * @apioption series.packedbubble.marker\n */\n''; // adds doclets above to transpiled file\n", "/* *\n *\n * Networkgraph series\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Functions\n *\n * */\n/**\n * Attractive force.\n *\n * In Verlet integration, force is applied on a node immediately to it's\n * `plotX` and `plotY` position.\n *\n * @private\n * @param {Highcharts.Point} link\n * Link that connects two nodes\n * @param {number} force\n * Force calculated in `repulsiveForceFunction`\n * @param {Highcharts.PositionObject} distance\n * Distance between two nodes e.g. `{x, y}`\n */\nfunction attractive(link, force, distanceXY) {\n const massFactor = link.getMass(), translatedX = -distanceXY.x * force * this.diffTemperature, translatedY = -distanceXY.y * force * this.diffTemperature;\n if (!link.fromNode.fixedPosition) {\n link.fromNode.plotX -=\n translatedX * massFactor.fromNode / link.fromNode.degree;\n link.fromNode.plotY -=\n translatedY * massFactor.fromNode / link.fromNode.degree;\n }\n if (!link.toNode.fixedPosition) {\n link.toNode.plotX +=\n translatedX * massFactor.toNode / link.toNode.degree;\n link.toNode.plotY +=\n translatedY * massFactor.toNode / link.toNode.degree;\n }\n}\n/**\n * Attractive force function. Can be replaced by API's\n * `layoutAlgorithm.attractiveForce`\n *\n * @private\n * @param {number} d current distance between two nodes\n * @param {number} k expected distance between two nodes\n * @return {number} force\n */\nfunction attractiveForceFunction(d, k) {\n // Used in API:\n return (k - d) / d;\n}\n/**\n * Barycenter force. Calculate and applys barycenter forces on the\n * nodes. Making them closer to the center of their barycenter point.\n *\n * In Verlet integration, force is applied on a node immediately to it's\n * `plotX` and `plotY` position.\n *\n * @private\n */\nfunction barycenter() {\n let gravitationalConstant = this.options.gravitationalConstant, xFactor = this.barycenter.xFactor, yFactor = this.barycenter.yFactor;\n // To consider:\n xFactor = (xFactor - (this.box.left + this.box.width) / 2) *\n gravitationalConstant;\n yFactor = (yFactor - (this.box.top + this.box.height) / 2) *\n gravitationalConstant;\n this.nodes.forEach(function (node) {\n if (!node.fixedPosition) {\n node.plotX -=\n xFactor / node.mass / node.degree;\n node.plotY -=\n yFactor / node.mass / node.degree;\n }\n });\n}\n/**\n * Estiamte the best possible distance between two nodes, making graph\n * readable.\n * @private\n */\nfunction getK(layout) {\n return Math.pow(layout.box.width * layout.box.height / layout.nodes.length, 0.5);\n}\n/**\n * Integration method.\n *\n * In Verlet integration, forces are applied on node immediately to it's\n * `plotX` and `plotY` position.\n *\n * Verlet without velocity:\n *\n * x(n+1) = 2 * x(n) - x(n-1) + A(T) * deltaT ^ 2\n *\n * where:\n * - x(n+1) - new position\n * - x(n) - current position\n * - x(n-1) - previous position\n *\n * Assuming A(t) = 0 (no acceleration) and (deltaT = 1) we get:\n *\n * x(n+1) = x(n) + (x(n) - x(n-1))\n *\n * where:\n * - (x(n) - x(n-1)) - position change\n *\n * TO DO:\n * Consider Verlet with velocity to support additional\n * forces. Or even Time-Corrected Verlet by Jonathan\n * \"lonesock\" Dummer\n *\n * @private\n * @param {Highcharts.NetworkgraphLayout} layout layout object\n * @param {Highcharts.Point} node node that should be translated\n */\nfunction integrate(layout, node) {\n let friction = -layout.options.friction, maxSpeed = layout.options.maxSpeed, prevX = node.prevX, prevY = node.prevY, \n // Apply friction:\n diffX = ((node.plotX + node.dispX -\n prevX) * friction), diffY = ((node.plotY + node.dispY -\n prevY) * friction), abs = Math.abs, signX = abs(diffX) / (diffX || 1), // need to deal with 0\n signY = abs(diffY) / (diffY || 1);\n // Apply max speed:\n diffX = signX * Math.min(maxSpeed, Math.abs(diffX));\n diffY = signY * Math.min(maxSpeed, Math.abs(diffY));\n // Store for the next iteration:\n node.prevX = node.plotX + node.dispX;\n node.prevY = node.plotY + node.dispY;\n // Update positions:\n node.plotX += diffX;\n node.plotY += diffY;\n node.temperature = layout.vectorLength({\n x: diffX,\n y: diffY\n });\n}\n/**\n * Repulsive force.\n *\n * In Verlet integration, force is applied on a node immediately to it's\n * `plotX` and `plotY` position.\n *\n * @private\n * @param {Highcharts.Point} node\n * Node that should be translated by force.\n * @param {number} force\n * Force calculated in `repulsiveForceFunction`\n * @param {Highcharts.PositionObject} distance\n * Distance between two nodes e.g. `{x, y}`\n */\nfunction repulsive(node, force, distanceXY) {\n const factor = force * this.diffTemperature / node.mass / node.degree;\n if (!node.fixedPosition) {\n node.plotX += distanceXY.x * factor;\n node.plotY += distanceXY.y * factor;\n }\n}\n/**\n * Repulsive force function. Can be replaced by API's\n * `layoutAlgorithm.repulsiveForce`\n *\n * @private\n * @param {number} d current distance between two nodes\n * @param {number} k expected distance between two nodes\n * @return {number} force\n */\nfunction repulsiveForceFunction(d, k) {\n // Used in API:\n return (k - d) / d * (k > d ? 1 : 0); // Force only for close nodes\n}\n/* *\n *\n * Default Export\n *\n * */\nconst VerletIntegration = {\n attractive,\n attractiveForceFunction,\n barycenter,\n getK,\n integrate,\n repulsive,\n repulsiveForceFunction\n};\nexport default VerletIntegration;\n", "/* *\n *\n * (c) 2010-2024 Grzegorz Blachlinski, Sebastian Bochan\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport VerletIntegration from '../Networkgraph/VerletIntegration.js';\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction barycenter() {\n const layout = this, gravitationalConstant = layout.options.gravitationalConstant, box = layout.box, nodes = layout.nodes;\n let centerX, centerY;\n for (const node of nodes) {\n if (layout.options.splitSeries && !node.isParentNode) {\n centerX = node.series.parentNode.plotX;\n centerY = node.series.parentNode.plotY;\n }\n else {\n centerX = box.width / 2;\n centerY = box.height / 2;\n }\n if (!node.fixedPosition) {\n node.plotX -=\n (node.plotX - centerX) *\n gravitationalConstant /\n (node.mass * Math.sqrt(nodes.length));\n node.plotY -=\n (node.plotY - centerY) *\n gravitationalConstant /\n (node.mass * Math.sqrt(nodes.length));\n }\n }\n}\n/**\n * @private\n */\nfunction repulsive(node, force, distanceXY, repNode) {\n const factor = (force * this.diffTemperature / node.mass /\n node.degree), x = distanceXY.x * factor, y = distanceXY.y * factor;\n if (!node.fixedPosition) {\n node.plotX += x;\n node.plotY += y;\n }\n if (!repNode.fixedPosition) {\n repNode.plotX -= x;\n repNode.plotY -= y;\n }\n}\n/**\n * @private\n */\nfunction repulsiveForceFunction(d, k, node, repNode) {\n return Math.min(d, (node.marker.radius +\n repNode.marker.radius) / 2);\n}\n/* *\n *\n * Default Export\n *\n * */\nconst PackedBubbleIntegration = {\n barycenter,\n getK: noop,\n integrate: VerletIntegration.integrate,\n repulsive,\n repulsiveForceFunction\n};\nexport default PackedBubbleIntegration;\n", "/* *\n *\n * Networkgraph series\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Functions\n *\n * */\n/**\n * Attractive force.\n *\n * In Euler integration, force is stored in a node, not changing it's\n * position. Later, in `integrate()` forces are applied on nodes.\n *\n * @private\n * @param {Highcharts.Point} link\n * Link that connects two nodes\n * @param {number} force\n * Force calculated in `repulsiveForceFunction`\n * @param {Highcharts.PositionObject} distanceXY\n * Distance between two nodes e.g. `{x, y}`\n * @param {number} distanceR\n */\nfunction attractive(link, force, distanceXY, distanceR) {\n const massFactor = link.getMass(), translatedX = (distanceXY.x / distanceR) * force, translatedY = (distanceXY.y / distanceR) * force;\n if (!link.fromNode.fixedPosition) {\n link.fromNode.dispX -=\n translatedX * massFactor.fromNode / link.fromNode.degree;\n link.fromNode.dispY -=\n translatedY * massFactor.fromNode / link.fromNode.degree;\n }\n if (!link.toNode.fixedPosition) {\n link.toNode.dispX +=\n translatedX * massFactor.toNode / link.toNode.degree;\n link.toNode.dispY +=\n translatedY * massFactor.toNode / link.toNode.degree;\n }\n}\n/**\n * Attractive force function. Can be replaced by API's\n * `layoutAlgorithm.attractiveForce`\n *\n * Other forces that can be used:\n *\n * basic, not recommended:\n * `function (d, k) { return d / k }`\n *\n * @private\n * @param {number} d current distance between two nodes\n * @param {number} k expected distance between two nodes\n * @return {number} force\n */\nfunction attractiveForceFunction(d, k) {\n return d * d / k;\n}\n/**\n * Barycenter force. Calculate and applys barycenter forces on the\n * nodes. Making them closer to the center of their barycenter point.\n *\n * In Euler integration, force is stored in a node, not changing it's\n * position. Later, in `integrate()` forces are applied on nodes.\n *\n * @private\n */\nfunction barycenter() {\n const gravitationalConstant = this.options.gravitationalConstant, xFactor = this.barycenter.xFactor, yFactor = this.barycenter.yFactor;\n this.nodes.forEach(function (node) {\n if (!node.fixedPosition) {\n const degree = node.getDegree(), phi = degree * (1 + degree / 2);\n node.dispX += ((xFactor - node.plotX) *\n gravitationalConstant *\n phi / node.degree);\n node.dispY += ((yFactor - node.plotY) *\n gravitationalConstant *\n phi / node.degree);\n }\n });\n}\n/**\n * Estimate the best possible distance between two nodes, making graph\n * readable.\n * @private\n */\nfunction getK(layout) {\n return Math.pow(layout.box.width * layout.box.height / layout.nodes.length, 0.3);\n}\n/**\n * Integration method.\n *\n * In Euler integration, force were stored in a node, not changing it's\n * position. Now, in the integrator method, we apply changes.\n *\n * Euler:\n *\n * Basic form: `x(n+1) = x(n) + v(n)`\n *\n * With Rengoild-Fruchterman we get:\n * `x(n+1) = x(n) + v(n) / length(v(n)) * min(v(n), temperature(n))`\n * where:\n * - `x(n+1)`: next position\n * - `x(n)`: current position\n * - `v(n)`: velocity (comes from net force)\n * - `temperature(n)`: current temperature\n *\n * Known issues:\n * Oscillations when force vector has the same magnitude but opposite\n * direction in the next step. Potentially solved by decreasing force by\n * `v * (1 / node.degree)`\n *\n * Note:\n * Actually `min(v(n), temperature(n))` replaces simulated annealing.\n *\n * @private\n * @param {Highcharts.NetworkgraphLayout} layout\n * Layout object\n * @param {Highcharts.Point} node\n * Node that should be translated\n */\nfunction integrate(layout, node) {\n let distanceR;\n node.dispX +=\n node.dispX * layout.options.friction;\n node.dispY +=\n node.dispY * layout.options.friction;\n distanceR = node.temperature = layout.vectorLength({\n x: node.dispX,\n y: node.dispY\n });\n if (distanceR !== 0) {\n node.plotX += (node.dispX / distanceR *\n Math.min(Math.abs(node.dispX), layout.temperature));\n node.plotY += (node.dispY / distanceR *\n Math.min(Math.abs(node.dispY), layout.temperature));\n }\n}\n/**\n * Repulsive force.\n *\n * @private\n * @param {Highcharts.Point} node\n * Node that should be translated by force.\n * @param {number} force\n * Force calculated in `repulsiveForceFunction`\n * @param {Highcharts.PositionObject} distanceXY\n * Distance between two nodes e.g. `{x, y}`\n */\nfunction repulsive(node, force, distanceXY, distanceR) {\n node.dispX +=\n (distanceXY.x / distanceR) * force / node.degree;\n node.dispY +=\n (distanceXY.y / distanceR) * force / node.degree;\n}\n/**\n * Repulsive force function. Can be replaced by API's\n * `layoutAlgorithm.repulsiveForce`.\n *\n * Other forces that can be used:\n *\n * basic, not recommended:\n * `function (d, k) { return k / d }`\n *\n * standard:\n * `function (d, k) { return k * k / d }`\n *\n * grid-variant:\n * `function (d, k) { return k * k / d * (2 * k - d > 0 ? 1 : 0) }`\n *\n * @private\n * @param {number} d current distance between two nodes\n * @param {number} k expected distance between two nodes\n * @return {number} force\n */\nfunction repulsiveForceFunction(d, k) {\n return k * k / d;\n}\n/* *\n *\n * Default Export\n *\n * */\nconst EulerIntegration = {\n attractive,\n attractiveForceFunction,\n barycenter,\n getK,\n integrate,\n repulsive,\n repulsiveForceFunction\n};\nexport default EulerIntegration;\n", "/* *\n *\n * Networkgraph series\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Class\n *\n * */\n/**\n * The QuadTree node class. Used in Networkgraph chart as a base for Barnes-Hut\n * approximation.\n *\n * @private\n * @class\n * @name Highcharts.QuadTreeNode\n *\n * @param {Highcharts.Dictionary} box\n * Available space for the node\n */\nclass QuadTreeNode {\n /* *\n *\n * Constructor\n *\n * */\n constructor(box) {\n /* *\n *\n * Properties\n *\n * */\n /**\n * Read only. If QuadTreeNode is an external node, Point is stored in\n * `this.body`.\n *\n * @name Highcharts.QuadTreeNode#body\n * @type {boolean|Highcharts.Point}\n */\n this.body = false;\n /**\n * Read only. Internal nodes when created are empty to reserve the\n * space. If Point is added to this QuadTreeNode, QuadTreeNode is no\n * longer empty.\n *\n * @name Highcharts.QuadTreeNode#isEmpty\n * @type {boolean}\n */\n this.isEmpty = false;\n /**\n * Read only. Flag to determine if QuadTreeNode is internal (and has\n * subnodes with mass and central position) or external (bound to\n * Point).\n *\n * @name Highcharts.QuadTreeNode#isInternal\n * @type {boolean}\n */\n this.isInternal = false;\n /**\n * Read only. Array of subnodes. Empty if QuadTreeNode has just one\n * Point. When added another Point to this QuadTreeNode, array is\n * filled with four subnodes.\n *\n * @name Highcharts.QuadTreeNode#nodes\n * @type {Array}\n */\n this.nodes = [];\n /**\n * Read only. The available space for node.\n *\n * @name Highcharts.QuadTreeNode#box\n * @type {Highcharts.Dictionary}\n */\n this.box = box;\n /**\n * Read only. The minium of width and height values.\n *\n * @name Highcharts.QuadTreeNode#boxSize\n * @type {number}\n */\n this.boxSize = Math.min(box.width, box.height);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * When inserting another node into the box, that already hove one node,\n * divide the available space into another four quadrants.\n *\n * Indexes of quadrants are:\n * ```\n * ------------- -------------\n * | | | | |\n * | | | 0 | 1 |\n * | | divide() | | |\n * | 1 | -----------> -------------\n * | | | | |\n * | | | 3 | 2 |\n * | | | | |\n * ------------- -------------\n * ```\n */\n divideBox() {\n const halfWidth = this.box.width / 2, halfHeight = this.box.height / 2;\n // Top left\n this.nodes[0] = new QuadTreeNode({\n left: this.box.left,\n top: this.box.top,\n width: halfWidth,\n height: halfHeight\n });\n // Top right\n this.nodes[1] = new QuadTreeNode({\n left: this.box.left + halfWidth,\n top: this.box.top,\n width: halfWidth,\n height: halfHeight\n });\n // Bottom right\n this.nodes[2] = new QuadTreeNode({\n left: this.box.left + halfWidth,\n top: this.box.top + halfHeight,\n width: halfWidth,\n height: halfHeight\n });\n // Bottom left\n this.nodes[3] = new QuadTreeNode({\n left: this.box.left,\n top: this.box.top + halfHeight,\n width: halfWidth,\n height: halfHeight\n });\n }\n /**\n * Determine which of the quadrants should be used when placing node in\n * the QuadTree. Returned index is always in range `< 0 , 3 >`.\n * @private\n */\n getBoxPosition(point) {\n const left = point.plotX < this.box.left + this.box.width / 2, top = point.plotY < this.box.top + this.box.height / 2;\n let index;\n if (left) {\n if (top) {\n // Top left\n index = 0;\n }\n else {\n // Bottom left\n index = 3;\n }\n }\n else {\n if (top) {\n // Top right\n index = 1;\n }\n else {\n // Bottom right\n index = 2;\n }\n }\n return index;\n }\n /**\n * Insert recursively point(node) into the QuadTree. If the given\n * quadrant is already occupied, divide it into smaller quadrants.\n *\n * @param {Highcharts.Point} point\n * Point/node to be inserted\n * @param {number} depth\n * Max depth of the QuadTree\n */\n insert(point, depth) {\n let newQuadTreeNode;\n if (this.isInternal) {\n // Internal node:\n this.nodes[this.getBoxPosition(point)].insert(point, depth - 1);\n }\n else {\n this.isEmpty = false;\n if (!this.body) {\n // First body in a quadrant:\n this.isInternal = false;\n this.body = point;\n }\n else {\n if (depth) {\n // Every other body in a quadrant:\n this.isInternal = true;\n this.divideBox();\n // Reinsert main body only once:\n if (this.body !== true) {\n this.nodes[this.getBoxPosition(this.body)]\n .insert(this.body, depth - 1);\n this.body = true;\n }\n // Add second body:\n this.nodes[this.getBoxPosition(point)]\n .insert(point, depth - 1);\n }\n else {\n // We are below max allowed depth. That means either:\n // - really huge number of points\n // - falling two points into exactly the same position\n // In this case, create another node in the QuadTree.\n //\n // Alternatively we could add some noise to the\n // position, but that could result in different\n // rendered chart in exporting.\n newQuadTreeNode = new QuadTreeNode({\n top: point.plotX || NaN,\n left: point.plotY || NaN,\n // Width/height below 1px\n width: 0.1,\n height: 0.1\n });\n newQuadTreeNode.body = point;\n newQuadTreeNode.isInternal = false;\n this.nodes.push(newQuadTreeNode);\n }\n }\n }\n }\n /**\n * Each quad node requires it's mass and center position. That mass and\n * position is used to imitate real node in the layout by approximation.\n */\n updateMassAndCenter() {\n let mass = 0, plotX = 0, plotY = 0;\n if (this.isInternal) {\n // Calculate weightened mass of the quad node:\n for (const pointMass of this.nodes) {\n if (!pointMass.isEmpty) {\n mass += pointMass.mass;\n plotX += pointMass.plotX * pointMass.mass;\n plotY += pointMass.plotY * pointMass.mass;\n }\n }\n plotX /= mass;\n plotY /= mass;\n }\n else if (this.body) {\n // Just one node, use coordinates directly:\n mass = this.body.mass;\n plotX = this.body.plotX;\n plotY = this.body.plotY;\n }\n // Store details:\n this.mass = mass;\n this.plotX = plotX;\n this.plotY = plotY;\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default QuadTreeNode;\n", "/* *\n *\n * Networkgraph series\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport QuadTreeNode from './QuadTreeNode.js';\n/* *\n *\n * Class\n *\n * */\n/**\n * The QuadTree class. Used in Networkgraph chart as a base for Barnes-Hut\n * approximation.\n *\n * @private\n * @class\n * @name Highcharts.QuadTree\n *\n * @param {number} x\n * Left position of the plotting area\n * @param {number} y\n * Top position of the plotting area\n * @param {number} width\n * Width of the plotting area\n * @param {number} height\n * Height of the plotting area\n */\nclass QuadTree {\n /* *\n *\n * Constructor\n *\n * */\n constructor(x, y, width, height) {\n // Boundary rectangle:\n this.box = {\n left: x,\n top: y,\n width: width,\n height: height\n };\n this.maxDepth = 25;\n this.root = new QuadTreeNode(this.box);\n this.root.isInternal = true;\n this.root.isRoot = true;\n this.root.divideBox();\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Calculate mass of the each QuadNode in the tree.\n */\n calculateMassAndCenter() {\n this.visitNodeRecursive(null, null, function (node) {\n node.updateMassAndCenter();\n });\n }\n /**\n * Insert nodes into the QuadTree\n *\n * @param {Array} points\n * Points as nodes\n */\n insertNodes(points) {\n for (const point of points) {\n this.root.insert(point, this.maxDepth);\n }\n }\n /**\n * Depth first treversal (DFS). Using `before` and `after` callbacks,\n * we can get two results: preorder and postorder traversals, reminder:\n *\n * ```\n * (a)\n * / \\\n * (b) (c)\n * / \\\n * (d) (e)\n * ```\n *\n * DFS (preorder): `a -> b -> d -> e -> c`\n *\n * DFS (postorder): `d -> e -> b -> c -> a`\n *\n * @param {Highcharts.QuadTreeNode|null} node\n * QuadTree node\n * @param {Function} [beforeCallback]\n * Function to be called before visiting children nodes.\n * @param {Function} [afterCallback]\n * Function to be called after visiting children nodes.\n */\n visitNodeRecursive(node, beforeCallback, afterCallback) {\n let goFurther;\n if (!node) {\n node = this.root;\n }\n if (node === this.root && beforeCallback) {\n goFurther = beforeCallback(node);\n }\n if (goFurther === false) {\n return;\n }\n for (const qtNode of node.nodes) {\n if (qtNode.isInternal) {\n if (beforeCallback) {\n goFurther = beforeCallback(qtNode);\n }\n if (goFurther === false) {\n continue;\n }\n this.visitNodeRecursive(qtNode, beforeCallback, afterCallback);\n }\n else if (qtNode.body) {\n if (beforeCallback) {\n beforeCallback(qtNode.body);\n }\n }\n if (afterCallback) {\n afterCallback(qtNode);\n }\n }\n if (node === this.root && afterCallback) {\n afterCallback(node);\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default QuadTree;\n", "/* *\n *\n * Networkgraph series\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport EulerIntegration from './EulerIntegration.js';\nimport H from '../../Core/Globals.js';\nconst { win } = H;\nimport GraphLayout from '../GraphLayoutComposition.js';\nimport QuadTree from './QuadTree.js';\nimport U from '../../Core/Utilities.js';\nconst { clamp, defined, isFunction, fireEvent, pick } = U;\nimport VerletIntegration from './VerletIntegration.js';\n/* *\n *\n * Class\n *\n * */\n/**\n * Reingold-Fruchterman algorithm from\n * \"Graph Drawing by Force-directed Placement\" paper.\n * @private\n */\nclass ReingoldFruchtermanLayout {\n constructor() {\n /* *\n *\n * Static Functions\n *\n * */\n this.box = {};\n this.currentStep = 0;\n this.initialRendering = true;\n this.links = [];\n this.nodes = [];\n this.series = [];\n this.simulation = false;\n }\n static compose(ChartClass) {\n GraphLayout.compose(ChartClass);\n GraphLayout.integrations.euler = EulerIntegration;\n GraphLayout.integrations.verlet = VerletIntegration;\n GraphLayout.layouts['reingold-fruchterman'] =\n ReingoldFruchtermanLayout;\n }\n init(options) {\n this.options = options;\n this.nodes = [];\n this.links = [];\n this.series = [];\n this.box = {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n this.setInitialRendering(true);\n this.integration =\n GraphLayout.integrations[options.integration];\n this.enableSimulation = options.enableSimulation;\n this.attractiveForce = pick(options.attractiveForce, this.integration.attractiveForceFunction);\n this.repulsiveForce = pick(options.repulsiveForce, this.integration.repulsiveForceFunction);\n this.approximation = options.approximation;\n }\n updateSimulation(enable) {\n this.enableSimulation = pick(enable, this.options.enableSimulation);\n }\n start() {\n const layout = this, series = this.series, options = this.options;\n layout.currentStep = 0;\n layout.forces = series[0] && series[0].forces || [];\n layout.chart = series[0] && series[0].chart;\n if (layout.initialRendering) {\n layout.initPositions();\n // Render elements in initial positions:\n series.forEach(function (s) {\n s.finishedAnimating = true; // #13169\n s.render();\n });\n }\n layout.setK();\n layout.resetSimulation(options);\n if (layout.enableSimulation) {\n layout.step();\n }\n }\n step() {\n const anyLayout = this, allSeries = this.series;\n // Algorithm:\n this.currentStep++;\n if (this.approximation === 'barnes-hut') {\n this.createQuadTree();\n this.quadTree.calculateMassAndCenter();\n }\n for (const forceName of this.forces || []) {\n anyLayout[forceName + 'Forces'](this.temperature);\n }\n // Limit to the plotting area and cool down:\n this.applyLimits();\n // Cool down the system:\n this.temperature = this.coolDown(this.startTemperature, this.diffTemperature, this.currentStep);\n this.prevSystemTemperature = this.systemTemperature;\n this.systemTemperature = this.getSystemTemperature();\n if (this.enableSimulation) {\n for (const series of allSeries) {\n // Chart could be destroyed during the simulation\n if (series.chart) {\n series.render();\n }\n }\n if (this.maxIterations-- &&\n isFinite(this.temperature) &&\n !this.isStable()) {\n if (this.simulation) {\n win.cancelAnimationFrame(this.simulation);\n }\n this.simulation = win.requestAnimationFrame(() => this.step());\n }\n else {\n this.simulation = false;\n this.series.forEach((s) => {\n fireEvent(s, 'afterSimulation');\n });\n }\n }\n }\n stop() {\n if (this.simulation) {\n win.cancelAnimationFrame(this.simulation);\n }\n }\n setArea(x, y, w, h) {\n this.box = {\n left: x,\n top: y,\n width: w,\n height: h\n };\n }\n setK() {\n // Optimal distance between nodes,\n // available space around the node:\n this.k = this.options.linkLength || this.integration.getK(this);\n }\n addElementsToCollection(elements, collection) {\n for (const element of elements) {\n if (collection.indexOf(element) === -1) {\n collection.push(element);\n }\n }\n }\n removeElementFromCollection(element, collection) {\n const index = collection.indexOf(element);\n if (index !== -1) {\n collection.splice(index, 1);\n }\n }\n clear() {\n this.nodes.length = 0;\n this.links.length = 0;\n this.series.length = 0;\n this.resetSimulation();\n }\n resetSimulation() {\n this.forcedStop = false;\n this.systemTemperature = 0;\n this.setMaxIterations();\n this.setTemperature();\n this.setDiffTemperature();\n }\n restartSimulation() {\n if (!this.simulation) {\n // When dragging nodes, we don't need to calculate\n // initial positions and rendering nodes:\n this.setInitialRendering(false);\n // Start new simulation:\n if (!this.enableSimulation) {\n // Run only one iteration to speed things up:\n this.setMaxIterations(1);\n }\n else {\n this.start();\n }\n if (this.chart) {\n this.chart.redraw();\n }\n // Restore defaults:\n this.setInitialRendering(true);\n }\n else {\n // Extend current simulation:\n this.resetSimulation();\n }\n }\n setMaxIterations(maxIterations) {\n this.maxIterations = pick(maxIterations, this.options.maxIterations);\n }\n setTemperature() {\n this.temperature = this.startTemperature =\n Math.sqrt(this.nodes.length);\n }\n setDiffTemperature() {\n this.diffTemperature = this.startTemperature /\n (this.options.maxIterations + 1);\n }\n setInitialRendering(enable) {\n this.initialRendering = enable;\n }\n createQuadTree() {\n this.quadTree = new QuadTree(this.box.left, this.box.top, this.box.width, this.box.height);\n this.quadTree.insertNodes(this.nodes);\n }\n initPositions() {\n const initialPositions = this.options.initialPositions;\n if (isFunction(initialPositions)) {\n initialPositions.call(this);\n for (const node of this.nodes) {\n if (!defined(node.prevX)) {\n node.prevX = node.plotX;\n }\n if (!defined(node.prevY)) {\n node.prevY = node.plotY;\n }\n node.dispX = 0;\n node.dispY = 0;\n }\n }\n else if (initialPositions === 'circle') {\n this.setCircularPositions();\n }\n else {\n this.setRandomPositions();\n }\n }\n setCircularPositions() {\n const box = this.box, nodes = this.nodes, nodesLength = nodes.length + 1, angle = 2 * Math.PI / nodesLength, rootNodes = nodes.filter(function (node) {\n return node.linksTo.length === 0;\n }), visitedNodes = {}, radius = this.options.initialPositionRadius, addToNodes = (node) => {\n for (const link of node.linksFrom || []) {\n if (!visitedNodes[link.toNode.id]) {\n visitedNodes[link.toNode.id] = true;\n sortedNodes.push(link.toNode);\n addToNodes(link.toNode);\n }\n }\n };\n let sortedNodes = [];\n // Start with identified root nodes an sort the nodes by their\n // hierarchy. In trees, this ensures that branches don't cross\n // eachother.\n for (const rootNode of rootNodes) {\n sortedNodes.push(rootNode);\n addToNodes(rootNode);\n }\n // Cyclic tree, no root node found\n if (!sortedNodes.length) {\n sortedNodes = nodes;\n // Dangling, cyclic trees\n }\n else {\n for (const node of nodes) {\n if (sortedNodes.indexOf(node) === -1) {\n sortedNodes.push(node);\n }\n }\n }\n let node;\n // Initial positions are laid out along a small circle, appearing\n // as a cluster in the middle\n for (let i = 0, iEnd = sortedNodes.length; i < iEnd; ++i) {\n node = sortedNodes[i];\n node.plotX = node.prevX = pick(node.plotX, box.width / 2 + radius * Math.cos(i * angle));\n node.plotY = node.prevY = pick(node.plotY, box.height / 2 + radius * Math.sin(i * angle));\n node.dispX = 0;\n node.dispY = 0;\n }\n }\n setRandomPositions() {\n const box = this.box, nodes = this.nodes, nodesLength = nodes.length + 1, \n /**\n * Return a repeatable, quasi-random number based on an integer\n * input. For the initial positions\n * @private\n */\n unrandom = (n) => {\n let rand = n * n / Math.PI;\n rand = rand - Math.floor(rand);\n return rand;\n };\n let node;\n // Initial positions:\n for (let i = 0, iEnd = nodes.length; i < iEnd; ++i) {\n node = nodes[i];\n node.plotX = node.prevX = pick(node.plotX, box.width * unrandom(i));\n node.plotY = node.prevY = pick(node.plotY, box.height * unrandom(nodesLength + i));\n node.dispX = 0;\n node.dispY = 0;\n }\n }\n force(name, ...args) {\n this.integration[name].apply(this, args);\n }\n barycenterForces() {\n this.getBarycenter();\n this.force('barycenter');\n }\n getBarycenter() {\n let systemMass = 0, cx = 0, cy = 0;\n for (const node of this.nodes) {\n cx += node.plotX * node.mass;\n cy += node.plotY * node.mass;\n systemMass += node.mass;\n }\n this.barycenter = {\n x: cx,\n y: cy,\n xFactor: cx / systemMass,\n yFactor: cy / systemMass\n };\n return this.barycenter;\n }\n barnesHutApproximation(node, quadNode) {\n const distanceXY = this.getDistXY(node, quadNode), distanceR = this.vectorLength(distanceXY);\n let goDeeper, force;\n if (node !== quadNode && distanceR !== 0) {\n if (quadNode.isInternal) {\n // Internal node:\n if (quadNode.boxSize / distanceR <\n this.options.theta &&\n distanceR !== 0) {\n // Treat as an external node:\n force = this.repulsiveForce(distanceR, this.k);\n this.force('repulsive', node, force * quadNode.mass, distanceXY, distanceR);\n goDeeper = false;\n }\n else {\n // Go deeper:\n goDeeper = true;\n }\n }\n else {\n // External node, direct force:\n force = this.repulsiveForce(distanceR, this.k);\n this.force('repulsive', node, force * quadNode.mass, distanceXY, distanceR);\n }\n }\n return goDeeper;\n }\n repulsiveForces() {\n if (this.approximation === 'barnes-hut') {\n for (const node of this.nodes) {\n this.quadTree.visitNodeRecursive(null, (quadNode) => (this.barnesHutApproximation(node, quadNode)));\n }\n }\n else {\n let force, distanceR, distanceXY;\n for (const node of this.nodes) {\n for (const repNode of this.nodes) {\n if (\n // Node cannot repulse itself:\n node !== repNode &&\n // Only close nodes affect each other:\n // layout.getDistR(node, repNode) < 2 * k &&\n // Not dragged:\n !node.fixedPosition) {\n distanceXY = this.getDistXY(node, repNode);\n distanceR = this.vectorLength(distanceXY);\n if (distanceR !== 0) {\n force = this.repulsiveForce(distanceR, this.k);\n this.force('repulsive', node, force * repNode.mass, distanceXY, distanceR);\n }\n }\n }\n }\n }\n }\n attractiveForces() {\n let distanceXY, distanceR, force;\n for (const link of this.links) {\n if (link.fromNode && link.toNode) {\n distanceXY = this.getDistXY(link.fromNode, link.toNode);\n distanceR = this.vectorLength(distanceXY);\n if (distanceR !== 0) {\n force = this.attractiveForce(distanceR, this.k);\n this.force('attractive', link, force, distanceXY, distanceR);\n }\n }\n }\n }\n applyLimits() {\n const nodes = this.nodes;\n for (const node of nodes) {\n if (node.fixedPosition) {\n return;\n }\n this.integration.integrate(this, node);\n this.applyLimitBox(node, this.box);\n // Reset displacement:\n node.dispX = 0;\n node.dispY = 0;\n }\n }\n /**\n * External box that nodes should fall. When hitting an edge, node\n * should stop or bounce.\n * @private\n */\n applyLimitBox(node, box) {\n const radius = node.radius;\n /*\n TO DO: Consider elastic collision instead of stopping.\n o' means end position when hitting plotting area edge:\n\n - \"inelastic\":\n o\n \\\n ______\n | o'\n | \\\n | \\\n\n - \"elastic\"/\"bounced\":\n o\n \\\n ______\n | ^\n | / \\\n |o' \\\n\n Euler sample:\n if (plotX < 0) {\n plotX = 0;\n dispX *= -1;\n }\n\n if (plotX > box.width) {\n plotX = box.width;\n dispX *= -1;\n }\n\n */\n // Limit X-coordinates:\n node.plotX = clamp(node.plotX, box.left + radius, box.width - radius);\n // Limit Y-coordinates:\n node.plotY = clamp(node.plotY, box.top + radius, box.height - radius);\n }\n /**\n * From \"A comparison of simulated annealing cooling strategies\" by\n * Nourani and Andresen work.\n * @private\n */\n coolDown(temperature, temperatureStep, currentStep) {\n // Logarithmic:\n /*\n return Math.sqrt(this.nodes.length) -\n Math.log(\n currentStep * layout.diffTemperature\n );\n */\n // Exponential:\n /*\n let alpha = 0.1;\n layout.temperature = Math.sqrt(layout.nodes.length) *\n Math.pow(alpha, layout.diffTemperature);\n */\n // Linear:\n return temperature - temperatureStep * currentStep;\n }\n isStable() {\n return Math.abs(this.systemTemperature -\n this.prevSystemTemperature) < 0.00001 || this.temperature <= 0;\n }\n getSystemTemperature() {\n let value = 0;\n for (const node of this.nodes) {\n value += node.temperature;\n }\n return value;\n }\n vectorLength(vector) {\n return Math.sqrt(vector.x * vector.x + vector.y * vector.y);\n }\n getDistR(nodeA, nodeB) {\n const distance = this.getDistXY(nodeA, nodeB);\n return this.vectorLength(distance);\n }\n getDistXY(nodeA, nodeB) {\n const xDist = nodeA.plotX - nodeB.plotX, yDist = nodeA.plotY - nodeB.plotY;\n return {\n x: xDist,\n y: yDist,\n absX: Math.abs(xDist),\n absY: Math.abs(yDist)\n };\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default ReingoldFruchtermanLayout;\n", "/* *\n *\n * (c) 2010-2024 Grzegorz Blachlinski, Sebastian Bochan\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport GraphLayout from '../GraphLayoutComposition.js';\nimport PackedBubbleIntegration from './PackedBubbleIntegration.js';\nimport ReingoldFruchtermanLayout from '../Networkgraph/ReingoldFruchtermanLayout.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction chartGetSelectedParentNodes() {\n const allSeries = this.series, selectedParentsNodes = [];\n allSeries.forEach((series) => {\n if (series.parentNode && series.parentNode.selected) {\n selectedParentsNodes.push(series.parentNode);\n }\n });\n return selectedParentsNodes;\n}\n/**\n * Remove accumulated data points to redistribute all of them again\n * (i.e after hiding series by legend)\n * @private\n */\nfunction onChartBeforeRedraw() {\n if (this.allDataPoints) {\n delete this.allDataPoints;\n }\n}\n/* *\n *\n * Class\n *\n * */\nclass PackedBubbleLayout extends ReingoldFruchtermanLayout {\n constructor() {\n /* *\n *\n * Static Functions\n *\n * */\n super(...arguments);\n this.index = NaN;\n this.nodes = [];\n this.series = [];\n }\n static compose(ChartClass) {\n ReingoldFruchtermanLayout.compose(ChartClass);\n GraphLayout.integrations.packedbubble = PackedBubbleIntegration;\n GraphLayout.layouts.packedbubble = PackedBubbleLayout;\n const chartProto = ChartClass.prototype;\n if (!chartProto.getSelectedParentNodes) {\n addEvent(ChartClass, 'beforeRedraw', onChartBeforeRedraw);\n chartProto.getSelectedParentNodes = chartGetSelectedParentNodes;\n }\n }\n /* *\n *\n * Functions\n *\n * */\n beforeStep() {\n if (this.options.marker) {\n this.series.forEach((series) => {\n if (series) {\n series.calculateParentRadius();\n }\n });\n }\n }\n // #14439, new stable check.\n isStable() {\n const tempDiff = Math.abs(this.prevSystemTemperature -\n this.systemTemperature);\n const upScaledTemperature = 10 * this.systemTemperature /\n Math.sqrt(this.nodes.length);\n return Math.abs(upScaledTemperature) < 1 &&\n tempDiff < 0.00001 ||\n this.temperature <= 0;\n }\n setCircularPositions() {\n const layout = this, box = layout.box, nodes = layout.nodes, nodesLength = nodes.length + 1, angle = 2 * Math.PI / nodesLength, radius = layout.options.initialPositionRadius;\n let centerX, centerY, index = 0;\n for (const node of nodes) {\n if (layout.options.splitSeries &&\n !node.isParentNode) {\n centerX = node.series.parentNode.plotX;\n centerY = node.series.parentNode.plotY;\n }\n else {\n centerX = box.width / 2;\n centerY = box.height / 2;\n }\n node.plotX = node.prevX = pick(node.plotX, centerX +\n radius * Math.cos(node.index || index * angle));\n node.plotY = node.prevY = pick(node.plotY, centerY +\n radius * Math.sin(node.index || index * angle));\n node.dispX = 0;\n node.dispY = 0;\n index++;\n }\n }\n repulsiveForces() {\n const layout = this, bubblePadding = layout.options.bubblePadding;\n let force, distanceR, distanceXY;\n layout.nodes.forEach((node) => {\n node.degree = node.mass;\n node.neighbours = 0;\n layout.nodes.forEach((repNode) => {\n force = 0;\n if (\n // Node cannot repulse itself:\n node !== repNode &&\n // Only close nodes affect each other:\n // Not dragged:\n !node.fixedPosition &&\n (layout.options.seriesInteraction ||\n node.series === repNode.series)) {\n distanceXY = layout.getDistXY(node, repNode);\n distanceR = (layout.vectorLength(distanceXY) -\n (node.marker.radius +\n repNode.marker.radius +\n bubblePadding));\n // TODO padding configurable\n if (distanceR < 0) {\n node.degree += 0.01;\n node.neighbours++;\n force = layout.repulsiveForce(-distanceR / Math.sqrt(node.neighbours), layout.k, node, repNode);\n }\n layout.force('repulsive', node, force * repNode.mass, distanceXY, repNode, distanceR);\n }\n });\n });\n }\n applyLimitBox(node, box) {\n const layout = this, factor = 0.01;\n let distanceXY, distanceR;\n // parentNodeLimit should be used together\n // with seriesInteraction: false\n if (layout.options.splitSeries &&\n !node.isParentNode &&\n layout.options.parentNodeLimit) {\n distanceXY = layout.getDistXY(node, node.series.parentNode);\n distanceR = (node.series.parentNodeRadius -\n node.marker.radius -\n layout.vectorLength(distanceXY));\n if (distanceR < 0 &&\n distanceR > -2 * node.marker.radius) {\n node.plotX -= distanceXY.x * factor;\n node.plotY -= distanceXY.y * factor;\n }\n }\n super.applyLimitBox(node, box);\n }\n}\n/* *\n *\n * Registry\n *\n * */\nGraphLayout.layouts.packedbubble = PackedBubbleLayout;\n/* *\n *\n * Default Export\n *\n * */\nexport default PackedBubbleLayout;\n", "/* *\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../Core/Utilities.js';\nconst { merge, syncTimeout } = U;\nimport A from '../Core/Animation/AnimationUtilities.js';\nconst { animObject } = A;\n/**\n * Create a setTimeout for the first drawDataLabels()\n * based on the dataLabels.animation.defer value\n * for series which have enabled simulation.\n * @private\n */\nfunction initDataLabelsDefer() {\n const dlOptions = this.options.dataLabels;\n // Method drawDataLabels() fires for the first time after\n // dataLabels.animation.defer time unless\n // the dataLabels.animation = false or dataLabels.defer = false\n // or if the simulation is disabled\n if (!dlOptions?.defer ||\n !this.options.layoutAlgorithm?.enableSimulation) {\n this.deferDataLabels = false;\n }\n else {\n syncTimeout(() => {\n this.deferDataLabels = false;\n }, dlOptions ? animObject(dlOptions.animation).defer : 0);\n }\n}\n/**\n * Initialize the SVG group for the DataLabels with correct opacities\n * and correct styles so that the animation for the series that have\n * simulation enabled works fine.\n * @private\n */\nfunction initDataLabels() {\n const series = this, dlOptions = series.options.dataLabels;\n if (!series.dataLabelsGroup) {\n const dataLabelsGroup = this.initDataLabelsGroup();\n // Apply the dataLabels.style not only to the\n // individual dataLabels but also to the entire group\n if (!series.chart.styledMode && dlOptions?.style) {\n dataLabelsGroup.css(dlOptions.style);\n }\n // Initialize the opacity of the group to 0 (start of animation)\n dataLabelsGroup.attr({ opacity: 0 });\n if (series.visible) { // #2597, #3023, #3024\n dataLabelsGroup.show();\n }\n return dataLabelsGroup;\n }\n // Place it on first and subsequent (redraw) calls\n series.dataLabelsGroup.attr(merge({ opacity: 1 }, this.getPlotBox('data-labels')));\n return series.dataLabelsGroup;\n}\nconst DataLabelsDeferUtils = {\n initDataLabels,\n initDataLabelsDefer\n};\nexport default DataLabelsDeferUtils;\n", "/* *\n *\n * (c) 2010-2024 Grzegorz Blachlinski, Sebastian Bochan\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Color from '../../Core/Color/Color.js';\nconst { parse: color } = Color;\nimport DragNodesComposition from '../DragNodesComposition.js';\nimport GraphLayout from '../GraphLayoutComposition.js';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport PackedBubblePoint from './PackedBubblePoint.js';\nimport PackedBubbleSeriesDefaults from './PackedBubbleSeriesDefaults.js';\nimport PackedBubbleLayout from './PackedBubbleLayout.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { series: { prototype: seriesProto }, seriesTypes: { bubble: BubbleSeries } } = SeriesRegistry;\nimport D from '../SimulationSeriesUtilities.js';\nconst { initDataLabels, initDataLabelsDefer } = D;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, clamp, defined, extend, fireEvent, isArray, isNumber, merge, pick } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * @private\n * @class\n * @name Highcharts.seriesTypes.packedbubble\n *\n * @extends Highcharts.Series\n */\nclass PackedBubbleSeries extends BubbleSeries {\n constructor() {\n /* *\n *\n * Static Properties\n *\n * */\n super(...arguments);\n this.parentNodeMass = 0;\n this.deferDataLabels = true;\n /* eslint-enable valid-jsdoc */\n }\n /* *\n *\n * Static Functions\n *\n * */\n static compose(AxisClass, ChartClass, LegendClass, SeriesClass) {\n BubbleSeries.compose(AxisClass, ChartClass, LegendClass, SeriesClass);\n DragNodesComposition.compose(ChartClass);\n PackedBubbleLayout.compose(ChartClass);\n }\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Create a single array of all points from all series\n * @private\n */\n accumulateAllPoints() {\n const chart = this.chart, allDataPoints = [];\n let yData;\n for (const series of chart.series) {\n if (series.is('packedbubble') && // #13574\n series.reserveSpace()) {\n yData = series.yData || [];\n // add data to array only if series is visible\n for (let j = 0; j < yData.length; j++) {\n allDataPoints.push([\n null, null,\n yData[j],\n series.index,\n j,\n {\n id: j,\n marker: {\n radius: 0\n }\n }\n ]);\n }\n }\n }\n return allDataPoints;\n }\n /**\n * Adding the basic layout to series points.\n * @private\n */\n addLayout() {\n const layoutOptions = this.options.layoutAlgorithm =\n this.options.layoutAlgorithm || {}, layoutType = layoutOptions.type || 'packedbubble', chartOptions = this.chart.options.chart;\n let graphLayoutsStorage = this.chart.graphLayoutsStorage, graphLayoutsLookup = this.chart.graphLayoutsLookup, layout;\n if (!graphLayoutsStorage) {\n this.chart.graphLayoutsStorage = graphLayoutsStorage = {};\n this.chart.graphLayoutsLookup = graphLayoutsLookup = [];\n }\n layout = graphLayoutsStorage[layoutType];\n if (!layout) {\n layoutOptions.enableSimulation =\n !defined(chartOptions.forExport) ?\n layoutOptions.enableSimulation :\n !chartOptions.forExport;\n graphLayoutsStorage[layoutType] = layout =\n new GraphLayout.layouts[layoutType]();\n layout.init(layoutOptions);\n graphLayoutsLookup.splice(layout.index, 0, layout);\n }\n this.layout = layout;\n this.points.forEach((node) => {\n node.mass = 2;\n node.degree = 1;\n node.collisionNmb = 1;\n });\n layout.setArea(0, 0, this.chart.plotWidth, this.chart.plotHeight);\n layout.addElementsToCollection([this], layout.series);\n layout.addElementsToCollection(this.points, layout.nodes);\n }\n /**\n * Function responsible for adding series layout, used for parent nodes.\n * @private\n */\n addSeriesLayout() {\n const layoutOptions = this.options.layoutAlgorithm =\n this.options.layoutAlgorithm || {}, layoutType = (layoutOptions.type || 'packedbubble'), graphLayoutsStorage = this.chart.graphLayoutsStorage, graphLayoutsLookup = this.chart.graphLayoutsLookup, parentNodeOptions = merge(layoutOptions, layoutOptions.parentNodeOptions, {\n enableSimulation: this.layout.options.enableSimulation\n });\n let seriesLayout = graphLayoutsStorage[layoutType + '-series'];\n if (!seriesLayout) {\n graphLayoutsStorage[layoutType + '-series'] = seriesLayout =\n new GraphLayout.layouts[layoutType]();\n seriesLayout.init(parentNodeOptions);\n graphLayoutsLookup.splice(seriesLayout.index, 0, seriesLayout);\n }\n this.parentNodeLayout = seriesLayout;\n this.createParentNodes();\n }\n /**\n * The function responsible for calculating the parent node radius\n * based on the total surface of inside-bubbles and the group BBox\n * @private\n */\n calculateParentRadius() {\n const bBox = this.seriesBox(), parentPadding = 20, minParentRadius = 20;\n this.parentNodeRadius = clamp(Math.sqrt(2 * this.parentNodeMass / Math.PI) + parentPadding, minParentRadius, bBox ?\n Math.max(Math.sqrt(Math.pow(bBox.width, 2) +\n Math.pow(bBox.height, 2)) / 2 + parentPadding, minParentRadius) :\n Math.sqrt(2 * this.parentNodeMass / Math.PI) + parentPadding);\n if (this.parentNode) {\n this.parentNode.marker.radius =\n this.parentNode.radius = this.parentNodeRadius;\n }\n }\n /**\n * Calculate min and max bubble value for radius calculation.\n * @private\n */\n calculateZExtremes() {\n const chart = this.chart, allSeries = chart.series;\n let zMin = this.options.zMin, zMax = this.options.zMax, valMin = Infinity, valMax = -Infinity;\n if (zMin && zMax) {\n return [zMin, zMax];\n }\n // it is needed to deal with null\n // and undefined values\n allSeries.forEach((series) => {\n series.yData.forEach((y) => {\n if (defined(y)) {\n if (y > valMax) {\n valMax = y;\n }\n if (y < valMin) {\n valMin = y;\n }\n }\n });\n });\n zMin = pick(zMin, valMin);\n zMax = pick(zMax, valMax);\n return [zMin, zMax];\n }\n /**\n * Check if two bubbles overlaps.\n * @private\n */\n checkOverlap(bubble1, bubble2) {\n const diffX = bubble1[0] - bubble2[0], // diff of X center values\n diffY = bubble1[1] - bubble2[1], // diff of Y center values\n sumRad = bubble1[2] + bubble2[2]; // sum of bubble radius\n return (Math.sqrt(diffX * diffX + diffY * diffY) -\n Math.abs(sumRad)) < -0.001;\n }\n /**\n * Creating parent nodes for split series, in which all the bubbles\n * are rendered.\n * @private\n */\n createParentNodes() {\n const PackedBubblePoint = this.pointClass, chart = this.chart, parentNodeLayout = this.parentNodeLayout, layoutOptions = this.layout.options;\n let nodeAdded, parentNode = this.parentNode, parentMarkerOptions = {\n radius: this.parentNodeRadius,\n lineColor: this.color,\n fillColor: color(this.color).brighten(0.4).get()\n };\n if (layoutOptions.parentNodeOptions) {\n parentMarkerOptions = merge(layoutOptions.parentNodeOptions.marker || {}, parentMarkerOptions);\n }\n this.parentNodeMass = 0;\n this.points.forEach((p) => {\n this.parentNodeMass +=\n Math.PI * Math.pow(p.marker.radius, 2);\n });\n this.calculateParentRadius();\n parentNodeLayout.nodes.forEach((node) => {\n if (node.seriesIndex === this.index) {\n nodeAdded = true;\n }\n });\n parentNodeLayout.setArea(0, 0, chart.plotWidth, chart.plotHeight);\n if (!nodeAdded) {\n if (!parentNode) {\n parentNode = new PackedBubblePoint(this, {\n mass: this.parentNodeRadius / 2,\n marker: parentMarkerOptions,\n dataLabels: {\n inside: false\n },\n states: {\n normal: {\n marker: parentMarkerOptions\n },\n hover: {\n marker: parentMarkerOptions\n }\n },\n dataLabelOnNull: true,\n degree: this.parentNodeRadius,\n isParentNode: true,\n seriesIndex: this.index\n });\n }\n if (this.parentNode) {\n parentNode.plotX = this.parentNode.plotX;\n parentNode.plotY = this.parentNode.plotY;\n }\n this.parentNode = parentNode;\n parentNodeLayout.addElementsToCollection([this], parentNodeLayout.series);\n parentNodeLayout.addElementsToCollection([parentNode], parentNodeLayout.nodes);\n }\n }\n /**\n * Function responsible for adding all the layouts to the chart.\n * @private\n */\n deferLayout() {\n // TODO split layouts to independent methods\n const layoutOptions = this.options.layoutAlgorithm;\n if (!this.visible) {\n return;\n }\n // layout is using nodes for position calculation\n this.addLayout();\n if (layoutOptions.splitSeries) {\n this.addSeriesLayout();\n }\n }\n destroy() {\n // Remove the series from all layouts series collections #11469\n if (this.chart.graphLayoutsLookup) {\n this.chart.graphLayoutsLookup.forEach((layout) => {\n layout.removeElementFromCollection(this, layout.series);\n }, this);\n }\n if (this.parentNode &&\n this.parentNodeLayout) {\n this.parentNodeLayout.removeElementFromCollection(this.parentNode, this.parentNodeLayout.nodes);\n if (this.parentNode.dataLabel) {\n this.parentNode.dataLabel =\n this.parentNode.dataLabel.destroy();\n }\n }\n seriesProto.destroy.apply(this, arguments);\n }\n /**\n * Packedbubble has two separate collections of nodes if split, render\n * dataLabels for both sets:\n * @private\n */\n drawDataLabels() {\n // We defer drawing the dataLabels\n // until dataLabels.animation.defer time passes\n if (this.deferDataLabels) {\n return;\n }\n seriesProto.drawDataLabels.call(this, this.points);\n // Render parentNode labels:\n if (this.parentNode) {\n this.parentNode.formatPrefix = 'parentNode';\n seriesProto.drawDataLabels.call(this, [this.parentNode]);\n }\n }\n /**\n * Create Background/Parent Nodes for split series.\n * @private\n */\n drawGraph() {\n // if the series is not using layout, don't add parent nodes\n if (!this.layout || !this.layout.options.splitSeries) {\n return;\n }\n const chart = this.chart, nodeMarker = this.layout.options.parentNodeOptions.marker, parentOptions = {\n fill: (nodeMarker.fillColor ||\n color(this.color).brighten(0.4).get()),\n opacity: nodeMarker.fillOpacity,\n stroke: nodeMarker.lineColor || this.color,\n 'stroke-width': pick(nodeMarker.lineWidth, this.options.lineWidth)\n };\n let parentAttribs = {};\n // Create the group for parent Nodes if doesn't exist\n // If exists it will only be adjusted to the updated plot size (#12063)\n this.parentNodesGroup = this.plotGroup('parentNodesGroup', 'parentNode', this.visible ? 'inherit' : 'hidden', 0.1, chart.seriesGroup);\n this.group?.attr({\n zIndex: 2\n });\n this.calculateParentRadius();\n if (this.parentNode &&\n defined(this.parentNode.plotX) &&\n defined(this.parentNode.plotY) &&\n defined(this.parentNodeRadius)) {\n parentAttribs = merge({\n x: this.parentNode.plotX -\n this.parentNodeRadius,\n y: this.parentNode.plotY -\n this.parentNodeRadius,\n width: this.parentNodeRadius * 2,\n height: this.parentNodeRadius * 2\n }, parentOptions);\n if (!this.parentNode.graphic) {\n this.graph = this.parentNode.graphic =\n chart.renderer.symbol(parentOptions.symbol)\n .add(this.parentNodesGroup);\n }\n this.parentNode.graphic.attr(parentAttribs);\n }\n }\n drawTracker() {\n const parentNode = this.parentNode;\n // chart = series.chart,\n // pointer = chart.pointer,\n // onMouseOver = function (e: PointerEvent): void {\n // const point = pointer.getPointFromEvent(e);\n // // undefined on graph in scatterchart\n // if (typeof point !== 'undefined') {\n // pointer.isDirectTouch = true;\n // point.onMouseOver(e);\n // }\n // };\n let dataLabels;\n super.drawTracker();\n // Add reference to the point\n if (parentNode) {\n dataLabels = (isArray(parentNode.dataLabels) ?\n parentNode.dataLabels :\n (parentNode.dataLabel ? [parentNode.dataLabel] : []));\n if (parentNode.graphic) {\n parentNode.graphic.element.point = parentNode;\n }\n dataLabels.forEach((dataLabel) => {\n (dataLabel.div || dataLabel.element).point = parentNode;\n });\n }\n }\n /**\n * Calculate radius of bubbles in series.\n * @private\n */\n getPointRadius() {\n const chart = this.chart, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, seriesOptions = this.options, useSimulation = seriesOptions.useSimulation, smallestSize = Math.min(plotWidth, plotHeight), extremes = {}, radii = [], allDataPoints = chart.allDataPoints || [], allDataPointsLength = allDataPoints.length;\n let minSize, maxSize, value, radius;\n ['minSize', 'maxSize'].forEach((prop) => {\n const length = parseInt(seriesOptions[prop], 10), isPercent = /%$/.test(seriesOptions[prop]);\n extremes[prop] = isPercent ?\n smallestSize * length / 100 :\n length * Math.sqrt(allDataPointsLength);\n });\n chart.minRadius = minSize = extremes.minSize /\n Math.sqrt(allDataPointsLength);\n chart.maxRadius = maxSize = extremes.maxSize /\n Math.sqrt(allDataPointsLength);\n const zExtremes = useSimulation ?\n this.calculateZExtremes() :\n [minSize, maxSize];\n allDataPoints.forEach((point, i) => {\n value = useSimulation ?\n clamp(point[2], zExtremes[0], zExtremes[1]) :\n point[2];\n radius = this.getRadius(zExtremes[0], zExtremes[1], minSize, maxSize, value);\n if (radius === 0) {\n radius = null;\n }\n allDataPoints[i][2] = radius;\n radii.push(radius);\n });\n this.radii = radii;\n }\n init() {\n seriesProto.init.apply(this, arguments);\n initDataLabelsDefer.call(this);\n /* eslint-disable no-invalid-this */\n // When one series is modified, the others need to be recomputed\n this.eventsToUnbind.push(addEvent(this, 'updatedData', function () {\n this.chart.series.forEach((s) => {\n if (s.type === this.type) {\n s.isDirty = true;\n }\n }, this);\n }));\n /* eslint-enable no-invalid-this */\n return this;\n }\n /**\n * Mouse up action, finalizing drag&drop.\n * @private\n * @param {Highcharts.Point} point The point that event occurred.\n */\n onMouseUp(dnPoint) {\n const point = dnPoint;\n if (point.fixedPosition && !point.removed) {\n const layout = this.layout, parentNodeLayout = this.parentNodeLayout;\n let distanceXY, distanceR;\n if (parentNodeLayout && layout.options.dragBetweenSeries) {\n parentNodeLayout.nodes.forEach((node) => {\n if (point && point.marker &&\n node !== point.series.parentNode) {\n distanceXY = layout.getDistXY(point, node);\n distanceR = (layout.vectorLength(distanceXY) -\n node.marker.radius -\n point.marker.radius);\n if (distanceR < 0) {\n node.series.addPoint(merge(point.options, {\n plotX: point.plotX,\n plotY: point.plotY\n }), false);\n layout.removeElementFromCollection(point, layout.nodes);\n point.remove();\n }\n }\n });\n }\n DragNodesComposition.onMouseUp.apply(this, arguments);\n }\n }\n /**\n * This is the main function responsible\n * for positioning all of the bubbles\n * allDataPoints - bubble array, in format [pixel x value,\n * pixel y value, radius,\n * related series index, related point index]\n * @private\n * @param {Array} allDataPoints All points from all series\n * @return {Array} Positions of all bubbles\n */\n placeBubbles(allDataPoints) {\n const checkOverlap = this.checkOverlap, positionBubble = this.positionBubble, bubblePos = [];\n let stage = 1, j = 0, k = 0, calculatedBubble, arr = [], i;\n // sort all points\n const sortedArr = allDataPoints.sort((a, b) => b[2] - a[2]);\n if (sortedArr.length) {\n // create first bubble in the middle of the chart\n bubblePos.push([\n [\n 0,\n 0,\n sortedArr[0][2],\n sortedArr[0][3],\n sortedArr[0][4]\n ] // point index\n ]); // 0 level bubble\n if (sortedArr.length > 1) {\n bubblePos.push([\n [\n 0,\n (0 - sortedArr[1][2] -\n sortedArr[0][2]),\n // move bubble above first one\n sortedArr[1][2],\n sortedArr[1][3],\n sortedArr[1][4]\n ]\n ]); // 1 level 1st bubble\n // first two already positioned so starting from 2\n for (i = 2; i < sortedArr.length; i++) {\n sortedArr[i][2] = sortedArr[i][2] || 1;\n // in case if radius is calculated as 0.\n calculatedBubble = positionBubble(bubblePos[stage][j], bubblePos[stage - 1][k], sortedArr[i]); // calculate initial bubble position\n if (checkOverlap(calculatedBubble, bubblePos[stage][0])) {\n /* if new bubble is overlapping with first bubble\n * in current level (stage)\n */\n bubblePos.push([]);\n k = 0;\n /* reset index of bubble, used for\n * positioning the bubbles around it,\n * we are starting from first bubble in next\n * stage because we are changing level to higher\n */\n bubblePos[stage + 1].push(positionBubble(bubblePos[stage][j], bubblePos[stage][0], sortedArr[i]));\n // (last bubble, 1. from curr stage, new bubble)\n stage++; // the new level is created, above current\n j = 0; // set the index of bubble in curr level to 0\n }\n else if (stage > 1 &&\n bubblePos[stage - 1][k + 1] &&\n checkOverlap(calculatedBubble, bubblePos[stage - 1][k + 1])) {\n /* if new bubble is overlapping with one of the prev\n * stage bubbles, it means that - bubble, used for\n * positioning the bubbles around it has changed\n * so we need to recalculate it\n */\n k++;\n bubblePos[stage].push(positionBubble(bubblePos[stage][j], bubblePos[stage - 1][k], sortedArr[i]));\n // (last bubble, prev stage bubble, new bubble)\n j++;\n }\n else { // simply add calculated bubble\n j++;\n bubblePos[stage].push(calculatedBubble);\n }\n }\n }\n this.chart.stages = bubblePos;\n // it may not be necessary but adding it just in case -\n // it is containing all of the bubble levels\n this.chart.rawPositions =\n []\n .concat.apply([], bubblePos);\n // bubble positions merged into one array\n this.resizeRadius();\n arr = this.chart.rawPositions;\n }\n return arr;\n }\n /**\n * Function that checks for a parentMarker and sets the correct opacity.\n * @private\n * @param {Highcharts.Pack} point\n * Candidate point for opacity correction.\n * @param {string} [state]\n * The point state, can be either `hover`, `select` or 'normal'. If\n * undefined, normal state is assumed.\n *\n * @return {Highcharts.SVGAttributes}\n * The presentational attributes to be set on the point.\n */\n pointAttribs(point, state) {\n const options = this.options, hasParentMarker = point && point.isParentNode;\n let markerOptions = options.marker;\n if (hasParentMarker &&\n options.layoutAlgorithm &&\n options.layoutAlgorithm.parentNodeOptions) {\n markerOptions = options.layoutAlgorithm.parentNodeOptions.marker;\n }\n const fillOpacity = markerOptions.fillOpacity, attr = seriesProto.pointAttribs.call(this, point, state);\n if (fillOpacity !== 1) {\n attr['fill-opacity'] = fillOpacity;\n }\n return attr;\n }\n /**\n * Function that is adding one bubble based on positions and sizes of\n * two other bubbles, lastBubble is the last added bubble, newOrigin is\n * the bubble for positioning new bubbles. nextBubble is the currently\n * added bubble for which we are calculating positions\n * @private\n * @param {Array} lastBubble The closest last bubble\n * @param {Array} newOrigin New bubble\n * @param {Array} nextBubble The closest next bubble\n * @return {Array} Bubble with correct positions\n */\n positionBubble(lastBubble, newOrigin, nextBubble) {\n const sqrt = Math.sqrt, asin = Math.asin, acos = Math.acos, pow = Math.pow, abs = Math.abs, distance = sqrt(// dist between lastBubble and newOrigin\n pow((lastBubble[0] - newOrigin[0]), 2) +\n pow((lastBubble[1] - newOrigin[1]), 2)), alfa = acos(\n // from cosinus theorem: alfa is an angle used for\n // calculating correct position\n (pow(distance, 2) +\n pow(nextBubble[2] + newOrigin[2], 2) -\n pow(nextBubble[2] + lastBubble[2], 2)) / (2 * (nextBubble[2] + newOrigin[2]) * distance)), beta = asin(// from sinus theorem.\n abs(lastBubble[0] - newOrigin[0]) /\n distance), \n // providing helping variables, related to angle between\n // lastBubble and newOrigin\n gamma = (lastBubble[1] - newOrigin[1]) < 0 ? 0 : Math.PI, \n // if new origin y is smaller than last bubble y value\n // (2 and 3 quarter),\n // add Math.PI to final angle\n delta = (lastBubble[0] - newOrigin[0]) *\n (lastBubble[1] - newOrigin[1]) < 0 ?\n 1 : -1, // (1st and 3rd quarter)\n finalAngle = gamma + alfa + beta * delta, cosA = Math.cos(finalAngle), sinA = Math.sin(finalAngle), posX = newOrigin[0] + (newOrigin[2] + nextBubble[2]) * sinA, \n // center of new origin + (radius1 + radius2) * sinus A\n posY = newOrigin[1] - (newOrigin[2] + nextBubble[2]) * cosA;\n return [\n posX,\n posY,\n nextBubble[2],\n nextBubble[3],\n nextBubble[4]\n ]; // the same as described before\n }\n render() {\n const dataLabels = [];\n seriesProto.render.apply(this, arguments);\n // #10823 - dataLabels should stay visible\n // when enabled allowOverlap.\n if (!this.options.dataLabels.allowOverlap) {\n this.data.forEach((point) => {\n if (isArray(point.dataLabels)) {\n point.dataLabels.forEach((dataLabel) => {\n dataLabels.push(dataLabel);\n });\n }\n });\n // Only hide overlapping dataLabels for layouts that\n // use simulation. Spiral packedbubble don't need\n // additional dataLabel hiding on every simulation step\n if (this.options.useSimulation) {\n this.chart.hideOverlappingLabels(dataLabels);\n }\n }\n }\n /**\n * The function responsible for resizing the bubble radius.\n * In shortcut: it is taking the initially\n * calculated positions of bubbles. Then it is calculating the min max\n * of both dimensions, creating something in shape of bBox.\n * The comparison of bBox and the size of plotArea\n * (later it may be also the size set by customer) is giving the\n * value how to recalculate the radius so it will match the size\n * @private\n */\n resizeRadius() {\n const chart = this.chart, positions = chart.rawPositions, min = Math.min, max = Math.max, plotLeft = chart.plotLeft, plotTop = chart.plotTop, chartHeight = chart.plotHeight, chartWidth = chart.plotWidth;\n let minX, maxX, minY, maxY, radius;\n minX = minY = Number.POSITIVE_INFINITY; // set initial values\n maxX = maxY = Number.NEGATIVE_INFINITY;\n for (const position of positions) {\n radius = position[2];\n minX = min(minX, position[0] - radius);\n // (x center-radius) is the min x value used by specific bubble\n maxX = max(maxX, position[0] + radius);\n minY = min(minY, position[1] - radius);\n maxY = max(maxY, position[1] + radius);\n }\n const bBox = [maxX - minX, maxY - minY], spaceRatio = [\n (chartWidth - plotLeft) / bBox[0],\n (chartHeight - plotTop) / bBox[1]\n ], smallerDimension = min.apply([], spaceRatio);\n if (Math.abs(smallerDimension - 1) > 1e-10) {\n // if bBox is considered not the same width as possible size\n for (const position of positions) {\n position[2] *= smallerDimension;\n }\n this.placeBubbles(positions);\n }\n else {\n /** if no radius recalculation is needed, we need to position\n * the whole bubbles in center of chart plotarea\n * for this, we are adding two parameters,\n * diffY and diffX, that are related to differences\n * between the initial center and the bounding box\n */\n chart.diffY = chartHeight / 2 +\n plotTop - minY - (maxY - minY) / 2;\n chart.diffX = chartWidth / 2 +\n plotLeft - minX - (maxX - minX) / 2;\n }\n }\n /**\n * The function responsible for calculating series bubble' s bBox.\n * Needed because of exporting failure when useSimulation\n * is set to false\n * @private\n */\n seriesBox() {\n const chart = this.chart, data = this.data, max = Math.max, min = Math.min, \n // bBox = [xMin, xMax, yMin, yMax]\n bBox = [\n chart.plotLeft,\n chart.plotLeft + chart.plotWidth,\n chart.plotTop,\n chart.plotTop + chart.plotHeight\n ];\n let radius;\n data.forEach((p) => {\n if (defined(p.plotX) &&\n defined(p.plotY) &&\n p.marker.radius) {\n radius = p.marker.radius;\n bBox[0] = min(bBox[0], p.plotX - radius);\n bBox[1] = max(bBox[1], p.plotX + radius);\n bBox[2] = min(bBox[2], p.plotY - radius);\n bBox[3] = max(bBox[3], p.plotY + radius);\n }\n });\n return isNumber(bBox.width / bBox.height) ?\n bBox :\n null;\n }\n /**\n * Needed because of z-indexing issue if point is added in series.group\n * @private\n */\n setVisible() {\n const series = this;\n seriesProto.setVisible.apply(series, arguments);\n if (series.parentNodeLayout && series.graph) {\n if (series.visible) {\n series.graph.show();\n if (series.parentNode.dataLabel) {\n series.parentNode.dataLabel.show();\n }\n }\n else {\n series.graph.hide();\n series.parentNodeLayout\n .removeElementFromCollection(series.parentNode, series.parentNodeLayout.nodes);\n if (series.parentNode.dataLabel) {\n series.parentNode.dataLabel.hide();\n }\n }\n }\n else if (series.layout) {\n if (series.visible) {\n series.layout.addElementsToCollection(series.points, series.layout.nodes);\n }\n else {\n series.points.forEach((node) => {\n series.layout.removeElementFromCollection(node, series.layout.nodes);\n });\n }\n }\n }\n /**\n * Extend the base translate method to handle bubble size,\n * and correct positioning them.\n * @private\n */\n translate() {\n const chart = this.chart, data = this.data, index = this.index, useSimulation = this.options.useSimulation;\n let point, radius, positions;\n this.processedXData = this.xData;\n this.generatePoints();\n // merged data is an array with all of the data from all series\n if (!defined(chart.allDataPoints)) {\n chart.allDataPoints = this.accumulateAllPoints();\n // calculate radius for all added data\n this.getPointRadius();\n }\n // after getting initial radius, calculate bubble positions\n if (useSimulation) {\n positions = chart.allDataPoints;\n }\n else {\n positions = this.placeBubbles(chart.allDataPoints);\n this.options.draggable = false;\n }\n // Set the shape and arguments to be picked up in drawPoints\n for (const position of positions) {\n if (position[3] === index) {\n // update the series points with the val from positions\n // array\n point = data[position[4]];\n radius = pick(position[2], void 0);\n if (!useSimulation) {\n point.plotX = (position[0] - chart.plotLeft +\n chart.diffX);\n point.plotY = (position[1] - chart.plotTop +\n chart.diffY);\n }\n if (isNumber(radius)) {\n point.marker = extend(point.marker, {\n radius,\n width: 2 * radius,\n height: 2 * radius\n });\n point.radius = radius;\n }\n }\n }\n if (useSimulation) {\n this.deferLayout();\n }\n fireEvent(this, 'afterTranslate');\n }\n}\nPackedBubbleSeries.defaultOptions = merge(BubbleSeries.defaultOptions, PackedBubbleSeriesDefaults);\nextend(PackedBubbleSeries.prototype, {\n pointClass: PackedBubblePoint,\n axisTypes: [],\n directTouch: true,\n forces: ['barycenter', 'repulsive'],\n hasDraggableNodes: true,\n invertible: false,\n isCartesian: false,\n noSharedTooltip: true,\n pointArrayMap: ['value'],\n pointValKey: 'value',\n requireSorting: false,\n trackerGroups: ['group', 'dataLabelsGroup', 'parentNodesGroup'],\n initDataLabels: initDataLabels,\n alignDataLabel: seriesProto.alignDataLabel,\n indexateNodes: noop,\n onMouseDown: DragNodesComposition.onMouseDown,\n onMouseMove: DragNodesComposition.onMouseMove,\n redrawHalo: DragNodesComposition.redrawHalo,\n searchPoint: noop // solving #12287\n});\nSeriesRegistry.registerSeriesType('packedbubble', PackedBubbleSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default PackedBubbleSeries;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Formatter callback function.\n *\n * @callback Highcharts.SeriesPackedBubbleDataLabelsFormatterCallbackFunction\n *\n * @param {Highcharts.SeriesPackedBubbleDataLabelsFormatterContextObject} this\n * Data label context to format\n *\n * @return {string}\n * Formatted data label text\n */\n/**\n * Context for the formatter function.\n *\n * @interface Highcharts.SeriesPackedBubbleDataLabelsFormatterContextObject\n * @extends Highcharts.PointLabelObject\n * @since 7.0.0\n */ /**\n* The color of the node.\n* @name Highcharts.SeriesPackedBubbleDataLabelsFormatterContextObject#color\n* @type {Highcharts.ColorString}\n* @since 7.0.0\n*/ /**\n* The point (node) object. The node name, if defined, is available through\n* `this.point.name`. Arrays: `this.point.linksFrom` and `this.point.linksTo`\n* contains all nodes connected to this point.\n* @name Highcharts.SeriesPackedBubbleDataLabelsFormatterContextObject#point\n* @type {Highcharts.Point}\n* @since 7.0.0\n*/ /**\n* The ID of the node.\n* @name Highcharts.SeriesPackedBubbleDataLabelsFormatterContextObject#key\n* @type {string}\n* @since 7.0.0\n*/\n''; // detach doclets above\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * A polygon series can be used to draw any freeform shape in the cartesian\n * coordinate system. A fill is applied with the `color` option, and\n * stroke is applied through `lineWidth` and `lineColor` options.\n *\n * @sample {highcharts} highcharts/demo/polygon/\n * Polygon\n * @sample {highstock} highcharts/demo/polygon/\n * Polygon\n *\n * @extends plotOptions.scatter\n * @since 4.1.0\n * @excluding jitter, softThreshold, threshold, cluster, boostThreshold,\n * boostBlending\n * @product highcharts highstock\n * @requires highcharts-more\n * @optionparent plotOptions.polygon\n */\nconst PolygonSeriesDefaults = {\n marker: {\n enabled: false,\n states: {\n hover: {\n enabled: false\n }\n }\n },\n stickyTracking: false,\n tooltip: {\n followPointer: true,\n pointFormat: ''\n },\n trackByArea: true,\n legendSymbol: 'rectangle'\n};\n/**\n * A `polygon` series. If the [type](#series.polygon.type) option is\n * not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.polygon\n * @excluding dataParser, dataURL, stack, boostThreshold, boostBlending\n * @product highcharts highstock\n * @requires highcharts-more\n * @apioption series.polygon\n */\n/**\n * An array of data points for the series. For the `polygon` series\n * type, points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 10],\n * [1, 3],\n * [2, 1]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.polygon.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 1,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 8,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @product highcharts highstock\n * @apioption series.polygon.data\n */\n''; // keeps doclets above separate\n/* *\n *\n * Default Export\n *\n * */\nexport default PolygonSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nconst { noop } = H;\nimport PolygonSeriesDefaults from './PolygonSeriesDefaults.js';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { area: AreaSeries, line: LineSeries, scatter: ScatterSeries } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { extend, merge } = U;\n/* *\n *\n * Class\n *\n * */\nclass PolygonSeries extends ScatterSeries {\n /* *\n *\n * Functions\n *\n * */\n getGraphPath() {\n const graphPath = LineSeries.prototype.getGraphPath.call(this);\n let i = graphPath.length + 1;\n // Close all segments\n while (i--) {\n if ((i === graphPath.length || graphPath[i][0] === 'M') && i > 0) {\n graphPath.splice(i, 0, ['Z']);\n }\n }\n this.areaPath = graphPath;\n return graphPath;\n }\n drawGraph() {\n // Hack into the fill logic in area.drawGraph\n this.options.fillColor = this.color;\n AreaSeries.prototype.drawGraph.call(this);\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nPolygonSeries.defaultOptions = merge(ScatterSeries.defaultOptions, PolygonSeriesDefaults);\nextend(PolygonSeries.prototype, {\n type: 'polygon',\n drawTracker: LineSeries.prototype.drawTracker,\n setStackedPoints: noop // No stacking points on polygons (#5310)\n});\nSeriesRegistry.registerSeriesType('polygon', PolygonSeries);\n/* *\n *\n * Default Export\n *\n * */\nexport default PolygonSeries;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport D from '../Defaults.js';\nconst { defaultOptions } = D;\nimport H from '../Globals.js';\nconst { composed, noop } = H;\nimport U from '../Utilities.js';\nconst { addEvent, correctFloat, defined, extend, fireEvent, isObject, merge, pick, pushUnique, relativeLength, wrap } = U;\n/* *\n *\n * Composition\n *\n * */\nvar RadialAxis;\n(function (RadialAxis) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Constants\n *\n * */\n /**\n * Circular axis around the perimeter of a polar chart.\n * @private\n */\n const defaultCircularOptions = {\n gridLineWidth: 1,\n labels: {\n align: void 0,\n x: 0,\n y: void 0,\n style: {\n textOverflow: 'none' // wrap lines by default (#7248)\n }\n },\n maxPadding: 0,\n minPadding: 0,\n showLastLabel: false,\n tickLength: 0\n };\n /**\n * The default options extend defaultYAxisOptions.\n * @private\n */\n const defaultRadialGaugeOptions = {\n endOnTick: false,\n gridLineWidth: 0,\n labels: {\n align: 'center',\n distance: -25,\n x: 0,\n y: void 0 // Auto\n },\n lineWidth: 1,\n minorGridLineWidth: 0,\n minorTickInterval: 'auto',\n minorTickLength: 10,\n minorTickPosition: 'inside',\n minorTickWidth: 1,\n startOnTick: false,\n tickLength: 10,\n tickPixelInterval: 100,\n tickPosition: 'inside',\n tickWidth: 2,\n title: {\n rotation: 0,\n text: ''\n },\n zIndex: 2 // Behind dials, points in the series group\n };\n /**\n * Radial axis, like a spoke in a polar chart.\n * @private\n */\n const defaultRadialOptions = {\n /**\n * In a polar chart, this is the angle of the Y axis in degrees, where\n * 0 is up and 90 is right. The angle determines the position of the\n * axis line and the labels, though the coordinate system is unaffected.\n * Since v8.0.0 this option is also applicable for X axis (inverted\n * polar).\n *\n * @sample {highcharts} highcharts/xaxis/angle/\n * Custom X axis' angle on inverted polar chart\n * @sample {highcharts} highcharts/yaxis/angle/\n * Dual axis polar chart\n *\n * @type {number}\n * @default 0\n * @since 4.2.7\n * @product highcharts\n * @apioption xAxis.angle\n */\n /**\n * Polar charts only. Whether the grid lines should draw as a polygon\n * with straight lines between categories, or as circles. Can be either\n * `circle` or `polygon`. Since v8.0.0 this option is also applicable\n * for X axis (inverted polar).\n *\n * @sample {highcharts} highcharts/demo/polar-spider/\n * Polygon grid lines\n * @sample {highcharts} highcharts/xaxis/gridlineinterpolation/\n * Circle and polygon on inverted polar\n * @sample {highcharts} highcharts/yaxis/gridlineinterpolation/\n * Circle and polygon\n *\n * @type {string}\n * @product highcharts\n * @validvalue [\"circle\", \"polygon\"]\n * @apioption xAxis.gridLineInterpolation\n */\n gridLineInterpolation: 'circle',\n gridLineWidth: 1,\n labels: {\n align: 'right',\n x: -3,\n y: -2\n },\n showLastLabel: false,\n title: {\n x: 4,\n text: null,\n rotation: 90\n }\n };\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * In case of auto connect, add one closestPointRange to the max value\n * right before tickPositions are computed, so that ticks will extend\n * passed the real max.\n * @private\n */\n function beforeSetTickPositions() {\n // If autoConnect is true, polygonal grid lines are connected, and\n // one closestPointRange is added to the X axis to prevent the last\n // point from overlapping the first.\n this.autoConnect = (this.isCircular &&\n typeof pick(this.userMax, this.options.max) === 'undefined' &&\n correctFloat(this.endAngleRad - this.startAngleRad) ===\n correctFloat(2 * Math.PI));\n // This will lead to add an extra tick to xAxis in order to display\n // a correct range on inverted polar\n if (!this.isCircular && this.chart.inverted) {\n this.max++;\n }\n if (this.autoConnect) {\n this.max += ((this.categories && 1) ||\n this.pointRange ||\n this.closestPointRange ||\n 0); // #1197, #2260\n }\n }\n /**\n * Augments methods for the value axis.\n *\n * @private\n *\n * @param {Highcharts.Axis} AxisClass\n * Axis class to extend.\n *\n * @param {Highcharts.Tick} TickClass\n * Tick class to use.\n *\n * @return {Highcharts.Axis}\n * Axis composition.\n */\n function compose(AxisClass, TickClass) {\n if (pushUnique(composed, 'Axis.Radial')) {\n addEvent(AxisClass, 'afterInit', onAxisAfterInit);\n addEvent(AxisClass, 'autoLabelAlign', onAxisAutoLabelAlign);\n addEvent(AxisClass, 'destroy', onAxisDestroy);\n addEvent(AxisClass, 'init', onAxisInit);\n addEvent(AxisClass, 'initialAxisTranslation', onAxisInitialAxisTranslation);\n addEvent(TickClass, 'afterGetLabelPosition', onTickAfterGetLabelPosition);\n addEvent(TickClass, 'afterGetPosition', onTickAfterGetPosition);\n wrap(TickClass.prototype, 'getMarkPath', wrapTickGetMarkPath);\n }\n return AxisClass;\n }\n RadialAxis.compose = compose;\n /**\n * Attach and return collecting function for labels in radial axis for\n * anti-collision.\n *\n * @private\n */\n function createLabelCollector() {\n return () => {\n if (this.isRadial &&\n this.tickPositions &&\n // undocumented option for now, but working\n this.options.labels &&\n this.options.labels.allowOverlap !== true) {\n return this.tickPositions\n .map((pos) => this.ticks[pos] && this.ticks[pos].label)\n .filter((label) => Boolean(label));\n }\n };\n }\n /**\n * Creates an empty collector function.\n * @private\n */\n function createLabelCollectorHidden() {\n return noop;\n }\n /**\n * Find the correct end values of crosshair in polar.\n * @private\n */\n function getCrosshairPosition(options, x1, y1) {\n const center = this.pane.center;\n let value = options.value, shapeArgs, end, x2, y2;\n if (this.isCircular) {\n if (!defined(value)) {\n // When the snap is set to false\n x2 = options.chartX || 0;\n y2 = options.chartY || 0;\n value = this.translate(Math.atan2(y2 - y1, x2 - x1) - this.startAngleRad, true);\n }\n else if (options.point) {\n // When the snap is set to true\n shapeArgs = options.point.shapeArgs || {};\n if (shapeArgs.start) {\n // Find a true value of the point based on the\n // angle\n value = this.chart.inverted ?\n this.translate(options.point.rectPlotY, true) :\n options.point.x;\n }\n }\n end = this.getPosition(value);\n x2 = end.x;\n y2 = end.y;\n }\n else {\n if (!defined(value)) {\n x2 = options.chartX;\n y2 = options.chartY;\n }\n if (defined(x2) && defined(y2)) {\n // Calculate radius of non-circular axis' crosshair\n y1 = center[1] + this.chart.plotTop;\n value = this.translate(Math.min(Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), center[2] / 2) - center[3] / 2, true);\n }\n }\n return [value, x2 || 0, y2 || 0];\n }\n /**\n * Get the path for the axis line. This method is also referenced in the\n * getPlotLinePath method.\n *\n * @private\n * @param {number} _lineWidth\n * Line width is not used.\n * @param {number} [radius]\n * Radius of radial path.\n * @param {number} [innerRadius]\n * Inner radius of radial path.\n */\n function getLinePath(_lineWidth, radius, innerRadius) {\n const center = this.pane.center, chart = this.chart, left = this.left || 0, top = this.top || 0;\n let end, r = pick(radius, center[2] / 2 - this.offset), path;\n if (typeof innerRadius === 'undefined') {\n innerRadius = this.horiz ? 0 : this.center && -this.center[3] / 2;\n }\n // In case when innerSize of pane is set, it must be included\n if (innerRadius) {\n r += innerRadius;\n }\n if (this.isCircular || typeof radius !== 'undefined') {\n path = this.chart.renderer.symbols.arc(left + center[0], top + center[1], r, r, {\n start: this.startAngleRad,\n end: this.endAngleRad,\n open: true,\n innerR: 0\n });\n // Bounds used to position the plotLine label next to the line\n // (#7117)\n path.xBounds = [left + center[0]];\n path.yBounds = [top + center[1] - r];\n }\n else {\n end = this.postTranslate(this.angleRad, r);\n path = [\n [\n 'M',\n this.center[0] + chart.plotLeft,\n this.center[1] + chart.plotTop\n ],\n ['L', end.x, end.y]\n ];\n }\n return path;\n }\n /**\n * Wrap the getOffset method to return zero offset for title or labels\n * in a radial axis.\n */\n function getOffset() {\n const axisProto = this.constructor.prototype;\n // Call the Axis prototype method (the method we're in now is on the\n // instance)\n axisProto.getOffset.call(this);\n // Title or label offsets are not counted\n this.chart.axisOffset[this.side] = 0;\n }\n /**\n * Find the path for plot bands along the radial axis.\n *\n * @private\n */\n function getPlotBandPath(from, to, options) {\n const chart = this.chart, radiusToPixels = (radius) => {\n if (typeof radius === 'string') {\n let r = parseInt(radius, 10);\n if (percentRegex.test(radius)) {\n r = (r * fullRadius) / 100;\n }\n return r;\n }\n return radius;\n }, center = this.center, startAngleRad = this.startAngleRad, fullRadius = center[2] / 2, offset = Math.min(this.offset, 0), left = this.left || 0, top = this.top || 0, percentRegex = /%$/, isCircular = this.isCircular; // X axis in a polar chart\n let start, end, angle, xOnPerimeter, open, path, outerRadius = pick(radiusToPixels(options.outerRadius), fullRadius), innerRadius = radiusToPixels(options.innerRadius), thickness = pick(radiusToPixels(options.thickness), 10);\n // Polygonal plot bands\n if (this.options.gridLineInterpolation === 'polygon') {\n path = this.getPlotLinePath({ value: from }).concat(this.getPlotLinePath({ value: to, reverse: true }));\n // Circular grid bands\n }\n else {\n // Keep within bounds\n from = Math.max(from, this.min);\n to = Math.min(to, this.max);\n const transFrom = this.translate(from), transTo = this.translate(to);\n // Plot bands on Y axis (radial axis) - inner and outer\n // radius depend on to and from\n if (!isCircular) {\n outerRadius = transFrom || 0;\n innerRadius = transTo || 0;\n }\n // Handle full circle\n if (options.shape === 'circle' || !isCircular) {\n start = -Math.PI / 2;\n end = Math.PI * 1.5;\n open = true;\n }\n else {\n start = startAngleRad + (transFrom || 0);\n end = startAngleRad + (transTo || 0);\n }\n outerRadius -= offset; // #5283\n thickness -= offset; // #5283\n path = chart.renderer.symbols.arc(left + center[0], top + center[1], outerRadius, outerRadius, {\n // Math is for reversed yAxis (#3606)\n start: Math.min(start, end),\n end: Math.max(start, end),\n innerR: pick(innerRadius, outerRadius - thickness),\n open\n });\n // Provide positioning boxes for the label (#6406)\n if (isCircular) {\n angle = (end + start) / 2;\n xOnPerimeter = (left +\n center[0] +\n (center[2] / 2) * Math.cos(angle));\n path.xBounds = angle > -Math.PI / 2 && angle < Math.PI / 2 ?\n // Right hemisphere\n [xOnPerimeter, chart.plotWidth] :\n // Left hemisphere\n [0, xOnPerimeter];\n path.yBounds = [\n top + center[1] + (center[2] / 2) * Math.sin(angle)\n ];\n // Shift up or down to get the label clear of the perimeter\n path.yBounds[0] += ((angle > -Math.PI && angle < 0) ||\n (angle > Math.PI)) ? -10 : 10;\n }\n }\n return path;\n }\n /**\n * Find the path for plot lines perpendicular to the radial axis.\n */\n function getPlotLinePath(options) {\n const center = this.pane.center, chart = this.chart, inverted = chart.inverted, reverse = options.reverse, background = this.pane.options.background ?\n (this.pane.options.background[0] ||\n this.pane.options.background) :\n {}, innerRadius = background.innerRadius || '0%', outerRadius = background.outerRadius || '100%', x1 = center[0] + chart.plotLeft, y1 = center[1] + chart.plotTop, height = this.height, isCrosshair = options.isCrosshair, paneInnerR = center[3] / 2;\n let value = options.value, innerRatio, distance, a, b, otherAxis, xy, tickPositions, crossPos, path;\n const end = this.getPosition(value);\n let x2 = end.x, y2 = end.y;\n // Crosshair logic\n if (isCrosshair) {\n // Find crosshair's position and perform destructuring\n // assignment\n crossPos = this.getCrosshairPosition(options, x1, y1);\n value = crossPos[0];\n x2 = crossPos[1];\n y2 = crossPos[2];\n }\n // Spokes\n if (this.isCircular) {\n distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n a = (typeof innerRadius === 'string') ?\n relativeLength(innerRadius, 1) :\n (innerRadius / distance);\n b = (typeof outerRadius === 'string') ?\n relativeLength(outerRadius, 1) :\n (outerRadius / distance);\n // To ensure that gridlines won't be displayed in area\n // defined by innerSize in case of custom radiuses of pane's\n // background\n if (center && paneInnerR) {\n innerRatio = paneInnerR / distance;\n if (a < innerRatio) {\n a = innerRatio;\n }\n if (b < innerRatio) {\n b = innerRatio;\n }\n }\n path = [\n ['M', x1 + a * (x2 - x1), y1 - a * (y1 - y2)],\n ['L', x2 - (1 - b) * (x2 - x1), y2 + (1 - b) * (y1 - y2)]\n ];\n // Concentric circles\n }\n else {\n // Pick the right values depending if it is grid line or\n // crosshair\n value = this.translate(value);\n // This is required in case when xAxis is non-circular to\n // prevent grid lines (or crosshairs, if enabled) from\n // rendering above the center after they supposed to be\n // displayed below the center point\n if (value) {\n if (value < 0 || value > height) {\n value = 0;\n }\n }\n if (this.options.gridLineInterpolation === 'circle') {\n // A value of 0 is in the center, so it won't be\n // visible, but draw it anyway for update and animation\n // (#2366)\n path = this.getLinePath(0, value, paneInnerR);\n // Concentric polygons\n }\n else {\n path = [];\n // Find the other axis (a circular one) in the same pane\n chart[inverted ? 'yAxis' : 'xAxis'].forEach((a) => {\n if (a.pane === this.pane) {\n otherAxis = a;\n }\n });\n if (otherAxis) {\n tickPositions = otherAxis.tickPositions;\n if (otherAxis.autoConnect) {\n tickPositions =\n tickPositions.concat([tickPositions[0]]);\n }\n // Reverse the positions for concatenation of polygonal\n // plot bands\n if (reverse) {\n tickPositions = tickPositions.slice().reverse();\n }\n if (value) {\n value += paneInnerR;\n }\n for (let i = 0; i < tickPositions.length; i++) {\n xy = otherAxis.getPosition(tickPositions[i], value);\n path.push(i ? ['L', xy.x, xy.y] : ['M', xy.x, xy.y]);\n }\n }\n }\n }\n return path;\n }\n /**\n * Returns the x, y coordinate of a point given by a value and a pixel\n * distance from center.\n *\n * @private\n * @param {number} value\n * Point value.\n * @param {number} [length]\n * Distance from center.\n */\n function getPosition(value, length) {\n const translatedVal = this.translate(value);\n return this.postTranslate(this.isCircular ? translatedVal : this.angleRad, // #2848\n // In case when translatedVal is negative, the 0 value must be\n // used instead, in order to deal with lines and labels that\n // fall out of the visible range near the center of a pane\n pick(this.isCircular ?\n length :\n (translatedVal < 0 ? 0 : translatedVal), this.center[2] / 2) - this.offset);\n }\n /**\n * Find the position for the axis title, by default inside the gauge.\n */\n function getTitlePosition() {\n const center = this.center, chart = this.chart, titleOptions = this.options.title;\n return {\n x: chart.plotLeft + center[0] + (titleOptions.x || 0),\n y: (chart.plotTop +\n center[1] -\n ({\n high: 0.5,\n middle: 0.25,\n low: 0\n }[titleOptions.align] *\n center[2]) +\n (titleOptions.y || 0))\n };\n }\n /**\n * Modify radial axis.\n * @private\n *\n * @param {Highcharts.Axis} radialAxis\n * Radial axis to modify.\n */\n function modify(axis) {\n axis.beforeSetTickPositions = beforeSetTickPositions;\n axis.createLabelCollector = createLabelCollector;\n axis.getCrosshairPosition = getCrosshairPosition;\n axis.getLinePath = getLinePath;\n axis.getOffset = getOffset;\n axis.getPlotBandPath = getPlotBandPath;\n axis.getPlotLinePath = getPlotLinePath;\n axis.getPosition = getPosition;\n axis.getTitlePosition = getTitlePosition;\n axis.postTranslate = postTranslate;\n axis.setAxisSize = setAxisSize;\n axis.setAxisTranslation = setAxisTranslation;\n axis.setOptions = setOptions;\n }\n /**\n * Modify radial axis as hidden.\n * @private\n *\n * @param {Highcharts.Axis} radialAxis\n * Radial axis to modify.\n */\n function modifyAsHidden(radialAxis) {\n radialAxis.isHidden = true;\n radialAxis.createLabelCollector = createLabelCollectorHidden;\n radialAxis.getOffset = noop;\n radialAxis.redraw = renderHidden;\n radialAxis.render = renderHidden;\n radialAxis.setScale = noop;\n radialAxis.setCategories = noop;\n radialAxis.setTitle = noop;\n }\n /**\n * Finalize modification of axis instance with radial logic.\n */\n function onAxisAfterInit() {\n const chart = this.chart, options = this.options, isHidden = chart.angular && this.isXAxis, pane = this.pane, paneOptions = pane && pane.options;\n if (!isHidden && pane && (chart.angular || chart.polar)) {\n const fullCircle = Math.PI * 2, \n // Start and end angle options are given in degrees relative to\n // top, while internal computations are in radians relative to\n // right (like SVG).\n start = (pick(paneOptions.startAngle, 0) - 90) * Math.PI / 180, end = (pick(paneOptions.endAngle, pick(paneOptions.startAngle, 0) + 360) - 90) * Math.PI / 180;\n // Y axis in polar charts\n this.angleRad = (options.angle || 0) * Math.PI / 180;\n // Gauges\n this.startAngleRad = start;\n this.endAngleRad = end;\n this.offset = options.offset || 0;\n // Normalize Start and End to <0, 2*PI> range\n // (in degrees: <0,360>)\n let normalizedStart = (start % fullCircle + fullCircle) %\n fullCircle, normalizedEnd = (end % fullCircle + fullCircle) % fullCircle;\n // Move normalized angles to <-PI, PI> range (<-180, 180>)\n // to match values returned by Math.atan2()\n if (normalizedStart > Math.PI) {\n normalizedStart -= fullCircle;\n }\n if (normalizedEnd > Math.PI) {\n normalizedEnd -= fullCircle;\n }\n this.normalizedStartAngleRad = normalizedStart;\n this.normalizedEndAngleRad = normalizedEnd;\n }\n }\n /**\n * Wrap auto label align to avoid setting axis-wide rotation on radial axes.\n * (#4920)\n */\n function onAxisAutoLabelAlign(e) {\n if (this.isRadial) {\n e.align = void 0;\n e.preventDefault();\n }\n }\n /**\n * Remove label collector function on axis remove/update.\n */\n function onAxisDestroy() {\n if (this.chart &&\n this.chart.labelCollectors) {\n const index = (this.labelCollector ?\n this.chart.labelCollectors.indexOf(this.labelCollector) :\n -1);\n if (index >= 0) {\n this.chart.labelCollectors.splice(index, 1);\n }\n }\n }\n /**\n * Modify axis instance with radial logic before common axis init.\n */\n function onAxisInit(e) {\n const chart = this.chart, angular = chart.angular, polar = chart.polar, isX = this.isXAxis, coll = this.coll, isHidden = angular && isX, paneIndex = e.userOptions.pane || 0, pane = this.pane = chart.pane && chart.pane[paneIndex];\n let isCircular;\n // Prevent changes for colorAxis\n if (coll === 'colorAxis') {\n this.isRadial = false;\n return;\n }\n // Before prototype.init\n if (angular) {\n if (isHidden) {\n modifyAsHidden(this);\n }\n else {\n modify(this);\n }\n isCircular = !isX;\n }\n else if (polar) {\n modify(this);\n // Check which axis is circular\n isCircular = this.horiz;\n }\n // Disable certain features on angular and polar axes\n if (angular || polar) {\n this.isRadial = true;\n if (!this.labelCollector) {\n this.labelCollector = this.createLabelCollector();\n }\n if (this.labelCollector) {\n // Prevent overlapping axis labels (#9761)\n chart.labelCollectors.push(this.labelCollector);\n }\n }\n else {\n this.isRadial = false;\n }\n // A pointer back to this axis to borrow geometry\n if (pane && isCircular) {\n pane.axis = this;\n }\n this.isCircular = isCircular;\n }\n /**\n * Prepare axis translation.\n */\n function onAxisInitialAxisTranslation() {\n if (this.isRadial) {\n this.beforeSetTickPositions();\n }\n }\n /**\n * Find the center position of the label based on the distance option.\n */\n function onTickAfterGetLabelPosition(e) {\n const label = this.label;\n if (!label) {\n return;\n }\n const axis = this.axis, labelBBox = label.getBBox(), labelOptions = axis.options.labels, angle = ((axis.translate(this.pos) + axis.startAngleRad +\n Math.PI / 2) / Math.PI * 180) % 360, correctAngle = Math.round(angle), labelYPosCorrection = !defined(labelOptions.y) ? -labelBBox.height * 0.3 : 0;\n let optionsY = labelOptions.y, ret, centerSlot = 20, // 20 degrees to each side at the top and bottom\n align = labelOptions.align, labelDir = 'end', // Direction of the label 'start' or 'end'\n reducedAngle1 = correctAngle < 0 ?\n correctAngle + 360 : correctAngle, reducedAngle2 = reducedAngle1, translateY = 0, translateX = 0;\n if (axis.isRadial) { // Both X and Y axes in a polar chart\n ret = axis.getPosition(this.pos, (axis.center[2] / 2) +\n relativeLength(pick(labelOptions.distance, -25), axis.center[2] / 2, -axis.center[2] / 2));\n // Automatically rotated\n if (labelOptions.rotation === 'auto') {\n label.attr({\n rotation: angle\n });\n // Vertically centered\n }\n else if (!defined(optionsY)) {\n optionsY = (axis.chart.renderer.fontMetrics(label).b -\n labelBBox.height / 2);\n }\n // Automatic alignment\n if (!defined(align)) {\n if (axis.isCircular) { // Y axis\n if (labelBBox.width >\n axis.len * axis.tickInterval / (axis.max - axis.min)) { // #3506\n centerSlot = 0;\n }\n if (angle > centerSlot && angle < 180 - centerSlot) {\n align = 'left'; // right hemisphere\n }\n else if (angle > 180 + centerSlot &&\n angle < 360 - centerSlot) {\n align = 'right'; // left hemisphere\n }\n else {\n align = 'center'; // top or bottom\n }\n }\n else {\n align = 'center';\n }\n label.attr({\n align: align\n });\n }\n // Auto alignment for solid-gauges with two labels (#10635)\n if (align === 'auto' &&\n axis.tickPositions.length === 2 &&\n axis.isCircular) {\n // Angles reduced to 0 - 90 or 180 - 270\n if (reducedAngle1 > 90 && reducedAngle1 < 180) {\n reducedAngle1 = 180 - reducedAngle1;\n }\n else if (reducedAngle1 > 270 && reducedAngle1 <= 360) {\n reducedAngle1 = 540 - reducedAngle1;\n }\n // Angles reduced to 0 - 180\n if (reducedAngle2 > 180 && reducedAngle2 <= 360) {\n reducedAngle2 = 360 - reducedAngle2;\n }\n if ((axis.pane.options.startAngle === correctAngle) ||\n (axis.pane.options.startAngle === correctAngle + 360) ||\n (axis.pane.options.startAngle === correctAngle - 360)) {\n labelDir = 'start';\n }\n if ((correctAngle >= -90 && correctAngle <= 90) ||\n (correctAngle >= -360 && correctAngle <= -270) ||\n (correctAngle >= 270 && correctAngle <= 360)) {\n align = (labelDir === 'start') ? 'right' : 'left';\n }\n else {\n align = (labelDir === 'start') ? 'left' : 'right';\n }\n // For angles between (90 + n * 180) +- 20\n if (reducedAngle2 > 70 && reducedAngle2 < 110) {\n align = 'center';\n }\n // auto Y translation\n if (reducedAngle1 < 15 ||\n (reducedAngle1 >= 180 && reducedAngle1 < 195)) {\n translateY = labelBBox.height * 0.3;\n }\n else if (reducedAngle1 >= 15 && reducedAngle1 <= 35) {\n translateY = labelDir === 'start' ?\n 0 : labelBBox.height * 0.75;\n }\n else if (reducedAngle1 >= 195 && reducedAngle1 <= 215) {\n translateY = labelDir === 'start' ?\n labelBBox.height * 0.75 : 0;\n }\n else if (reducedAngle1 > 35 && reducedAngle1 <= 90) {\n translateY = labelDir === 'start' ?\n -labelBBox.height * 0.25 : labelBBox.height;\n }\n else if (reducedAngle1 > 215 && reducedAngle1 <= 270) {\n translateY = labelDir === 'start' ?\n labelBBox.height : -labelBBox.height * 0.25;\n }\n // auto X translation\n if (reducedAngle2 < 15) {\n translateX = labelDir === 'start' ?\n -labelBBox.height * 0.15 : labelBBox.height * 0.15;\n }\n else if (reducedAngle2 > 165 && reducedAngle2 <= 180) {\n translateX = labelDir === 'start' ?\n labelBBox.height * 0.15 : -labelBBox.height * 0.15;\n }\n label.attr({ align: align });\n label.translate(translateX, translateY + labelYPosCorrection);\n }\n e.pos.x = ret.x + (labelOptions.x || 0);\n e.pos.y = ret.y + (optionsY || 0);\n }\n }\n /**\n * Add special cases within the Tick class' methods for radial axes.\n */\n function onTickAfterGetPosition(e) {\n if (this.axis.getPosition) {\n extend(e.pos, this.axis.getPosition(this.pos));\n }\n }\n /**\n * Translate from intermediate plotX (angle), plotY (axis.len - radius)\n * to final chart coordinates.\n *\n * @private\n * @param {number} angle\n * Translation angle.\n * @param {number} radius\n * Translation radius.\n */\n function postTranslate(angle, radius) {\n const chart = this.chart, center = this.center;\n angle = this.startAngleRad + angle;\n return {\n x: chart.plotLeft + center[0] + Math.cos(angle) * radius,\n y: chart.plotTop + center[1] + Math.sin(angle) * radius\n };\n }\n /**\n * Prevent setting Y axis dirty.\n */\n function renderHidden() {\n this.isDirty = false;\n }\n /**\n * Override the setAxisSize method to use the arc's circumference as\n * length. This allows tickPixelInterval to apply to pixel lengths along\n * the perimeter.\n * @private\n */\n function setAxisSize() {\n const axisProto = this.constructor.prototype;\n let center, start;\n axisProto.setAxisSize.call(this);\n if (this.isRadial) {\n // Set the center array\n this.pane.updateCenter(this);\n // In case when the innerSize is set in a polar chart, the axis'\n // center cannot be a reference to pane's center\n center = this.center = this.pane.center.slice();\n // The sector is used in Axis.translate to compute the\n // translation of reversed axis points (#2570)\n if (this.isCircular) {\n this.sector = this.endAngleRad - this.startAngleRad;\n }\n else {\n // When the pane's startAngle or the axis' angle is set then\n // new x and y values for vertical axis' center must be\n // calculated\n start = this.postTranslate(this.angleRad, center[3] / 2);\n center[0] = start.x - this.chart.plotLeft;\n center[1] = start.y - this.chart.plotTop;\n }\n // Axis len is used to lay out the ticks\n this.len = this.width = this.height =\n (center[2] - center[3]) * pick(this.sector, 1) / 2;\n }\n }\n /**\n * Override setAxisTranslation by setting the translation to the\n * difference in rotation. This allows the translate method to return\n * angle for any given value.\n *\n * @private\n */\n function setAxisTranslation() {\n const axisProto = this.constructor.prototype;\n // Call uber method\n axisProto.setAxisTranslation.call(this);\n // Set transA and minPixelPadding\n if (this.center) { // it's not defined the first time\n if (this.isCircular) {\n this.transA = (this.endAngleRad - this.startAngleRad) /\n ((this.max - this.min) || 1);\n }\n else {\n // The transA here is the length of the axis, so in case\n // of inner radius, the length must be decreased by it\n this.transA = ((this.center[2] - this.center[3]) / 2) /\n ((this.max - this.min) || 1);\n }\n if (this.isXAxis) {\n this.minPixelPadding = this.transA * this.minPointOffset;\n }\n else {\n // This is a workaround for regression #2593, but categories\n // still don't position correctly.\n this.minPixelPadding = 0;\n }\n }\n }\n /**\n * Merge and set options.\n */\n function setOptions(userOptions) {\n const { coll } = this;\n const { angular, inverted, polar } = this.chart;\n let defaultPolarOptions = {};\n if (angular) {\n if (!this.isXAxis) {\n defaultPolarOptions = merge(defaultOptions.yAxis, defaultRadialGaugeOptions);\n }\n }\n else if (polar) {\n defaultPolarOptions = this.horiz ?\n merge(defaultOptions.xAxis, defaultCircularOptions) :\n merge(coll === 'xAxis' ?\n defaultOptions.xAxis :\n defaultOptions.yAxis, defaultRadialOptions);\n }\n if (inverted && coll === 'yAxis') {\n defaultPolarOptions.stackLabels = isObject(defaultOptions.yAxis, true) ? defaultOptions.yAxis.stackLabels : {};\n defaultPolarOptions.reversedStacks = true;\n }\n const options = this.options = merge(defaultPolarOptions, userOptions);\n // Make sure the plotBands array is instantiated for each Axis\n // (#2649)\n if (!options.plotBands) {\n options.plotBands = [];\n }\n fireEvent(this, 'afterSetOptions');\n }\n /**\n * Wrap the getMarkPath function to return the path of the radial marker.\n */\n function wrapTickGetMarkPath(proceed, x, y, tickLength, tickWidth, horiz, renderer) {\n const axis = this.axis;\n let endPoint, ret;\n if (axis.isRadial) {\n endPoint = axis.getPosition(this.pos, axis.center[2] / 2 + tickLength);\n ret = [\n 'M',\n x,\n y,\n 'L',\n endPoint.x,\n endPoint.y\n ];\n }\n else {\n ret = proceed.call(this, x, y, tickLength, tickWidth, horiz, renderer);\n }\n return ret;\n }\n /* eslint-enable valid-jsdoc */\n})(RadialAxis || (RadialAxis = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default RadialAxis;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../Core/Animation/AnimationUtilities.js';\nconst { animObject } = A;\nimport H from '../Core/Globals.js';\nconst { composed } = H;\nimport Series from '../Core/Series/Series.js';\nimport Pane from '../Extensions/Pane/Pane.js';\nimport RadialAxis from '../Core/Axis/RadialAxis.js';\nimport U from '../Core/Utilities.js';\nconst { addEvent, defined, find, isNumber, merge, pick, pushUnique, relativeLength, splat, uniqueKey, wrap } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction clipCircle(renderer, x, y, r, innerR) {\n const id = uniqueKey(), clipPath = renderer.createElement('clipPath').attr({\n id: id\n }).add(renderer.defs), wrapper = innerR ?\n renderer.arc(x, y, r, innerR, 0, 2 * Math.PI).add(clipPath) :\n renderer.circle(x, y, r).add(clipPath);\n wrapper.id = id;\n wrapper.clipPath = clipPath;\n return wrapper;\n}\n/**\n * Find correct align and vertical align based on an angle in polar chart\n * @private\n */\nfunction findAlignments(angle, options) {\n let align, verticalAlign;\n if (options.align === null) {\n if (angle > 20 && angle < 160) {\n align = 'left'; // right hemisphere\n }\n else if (angle > 200 && angle < 340) {\n align = 'right'; // left hemisphere\n }\n else {\n align = 'center'; // top or bottom\n }\n options.align = align;\n }\n if (options.verticalAlign === null) {\n if (angle < 45 || angle > 315) {\n verticalAlign = 'bottom'; // top part\n }\n else if (angle > 135 && angle < 225) {\n verticalAlign = 'top'; // bottom part\n }\n else {\n verticalAlign = 'middle'; // left or right\n }\n options.verticalAlign = verticalAlign;\n }\n return options;\n}\n/**\n * #6212 Calculate connectors for spline series in polar chart.\n * @private\n * @param {boolean} calculateNeighbours\n * Check if connectors should be calculated for neighbour points as\n * well allows short recurrence\n */\nfunction getConnectors(segment, index, calculateNeighbours, connectEnds) {\n const smoothing = 1.5, denom = smoothing + 1, addedNumber = connectEnds ? 1 : 0;\n let i, leftContX, leftContY, rightContX, rightContY, jointAngle;\n // Calculate final index of points depending on the initial index value.\n // Because of calculating neighbours, index may be outside segment\n // array.\n if (index >= 0 && index <= segment.length - 1) {\n i = index;\n }\n else if (index < 0) {\n i = segment.length - 1 + index;\n }\n else {\n i = 0;\n }\n // 1 means control points midway between points, 2 means 1/3 from\n // the point, 3 is 1/4 etc;\n const prevPointInd = ((i - 1 < 0) ? segment.length - (1 + addedNumber) : i - 1), nextPointInd = (i + 1 > segment.length - 1) ? addedNumber : i + 1, previousPoint = segment[prevPointInd], nextPoint = segment[nextPointInd], previousX = previousPoint.plotX, previousY = previousPoint.plotY, nextX = nextPoint.plotX, nextY = nextPoint.plotY, plotX = segment[i].plotX, // actual point\n plotY = segment[i].plotY;\n leftContX = (smoothing * plotX + previousX) / denom;\n leftContY = (smoothing * plotY + previousY) / denom;\n rightContX = (smoothing * plotX + nextX) / denom;\n rightContY = (smoothing * plotY + nextY) / denom;\n // distance left control point\n const dLControlPoint = Math.sqrt(Math.pow(leftContX - plotX, 2) + Math.pow(leftContY - plotY, 2)), dRControlPoint = Math.sqrt(Math.pow(rightContX - plotX, 2) + Math.pow(rightContY - plotY, 2)), leftContAngle = Math.atan2(leftContY - plotY, leftContX - plotX), rightContAngle = Math.atan2(rightContY - plotY, rightContX - plotX);\n jointAngle = (Math.PI / 2) + ((leftContAngle + rightContAngle) / 2);\n // Ensure the right direction, jointAngle should be in the same quadrant\n // as leftContAngle\n if (Math.abs(leftContAngle - jointAngle) > Math.PI / 2) {\n jointAngle -= Math.PI;\n }\n // Find the corrected control points for a spline straight through the\n // point\n leftContX = plotX + Math.cos(jointAngle) * dLControlPoint;\n leftContY = plotY + Math.sin(jointAngle) * dLControlPoint;\n rightContX = plotX + Math.cos(Math.PI + jointAngle) * dRControlPoint;\n rightContY = plotY + Math.sin(Math.PI + jointAngle) * dRControlPoint;\n // push current point's connectors into returned object\n const ret = {\n rightContX: rightContX,\n rightContY: rightContY,\n leftContX: leftContX,\n leftContY: leftContY,\n plotX: plotX,\n plotY: plotY\n };\n // calculate connectors for previous and next point and push them inside\n // returned object\n if (calculateNeighbours) {\n ret.prevPointCont = getConnectors(segment, prevPointInd, false, connectEnds);\n }\n return ret;\n}\nfunction onChartAfterDrawChartBox() {\n (this.pane || []).forEach((pane) => {\n pane.render();\n });\n}\n/**\n * If polar has polygonal grid lines, force start and endOnTick on radial axis\n * @private\n */\nfunction onChartAfterInit(event) {\n const xAxis = event.args[0].xAxis, yAxis = event.args[0].yAxis, chart = event.args[0].chart;\n if (xAxis && yAxis) {\n if (yAxis.gridLineInterpolation === 'polygon') {\n xAxis.startOnTick = true;\n xAxis.endOnTick = true;\n }\n else if (xAxis.gridLineInterpolation === 'polygon' &&\n chart.inverted) {\n yAxis.startOnTick = true;\n yAxis.endOnTick = true;\n }\n }\n}\nfunction onChartGetAxes() {\n if (!this.pane) {\n this.pane = [];\n }\n this.options.pane = splat(this.options.pane);\n this.options.pane.forEach((paneOptions) => {\n new Pane(// eslint-disable-line no-new\n paneOptions, this);\n }, this);\n}\n/**\n * Get selection dimensions\n * @private\n */\nfunction onPointerGetSelectionBox(event) {\n const marker = event.args.marker, xAxis = this.chart.xAxis[0], yAxis = this.chart.yAxis[0], inverted = this.chart.inverted, radialAxis = inverted ? yAxis : xAxis, linearAxis = inverted ? xAxis : yAxis;\n if (this.chart.polar) {\n event.preventDefault();\n const start = (marker.attr ? marker.attr('start') : marker.start) - radialAxis.startAngleRad, r = (marker.attr ? marker.attr('r') : marker.r), end = (marker.attr ? marker.attr('end') : marker.end) - radialAxis.startAngleRad, innerR = (marker.attr ? marker.attr('innerR') : marker.innerR);\n event.result.x = start + radialAxis.pos;\n event.result.width = end - start;\n // `innerR` goes from pane's center but `toValue` computes values from\n // top\n event.result.y = linearAxis.len + linearAxis.pos - r;\n event.result.height = r - innerR;\n }\n}\n/**\n * Get attrs for Polar selection marker\n * @private\n */\nfunction onPointerGetSelectionMarkerAttrs(event) {\n const chart = this.chart;\n if (chart.polar && chart.hoverPane && chart.hoverPane.axis) {\n event.preventDefault();\n const center = chart.hoverPane.center, mouseDownX = chart.mouseDownX || 0, mouseDownY = chart.mouseDownY || 0, chartY = event.args.chartY, chartX = event.args.chartX, fullCircle = Math.PI * 2, startAngleRad = chart.hoverPane.axis.startAngleRad, endAngleRad = chart.hoverPane.axis.endAngleRad, linearAxis = chart.inverted ? chart.xAxis[0] : chart.yAxis[0], attrs = {};\n let shapeType = 'arc';\n attrs.x = center[0] + chart.plotLeft;\n attrs.y = center[1] + chart.plotTop;\n // Adjust the width of the selection marker\n if (this.zoomHor) {\n const paneRadRange = startAngleRad > 0 ?\n endAngleRad - startAngleRad :\n Math.abs(startAngleRad) + Math.abs(endAngleRad);\n let startAngle = Math.atan2(mouseDownY - chart.plotTop - center[1], mouseDownX - chart.plotLeft - center[0]) - startAngleRad, endAngle = Math.atan2(chartY - chart.plotTop - center[1], chartX - chart.plotLeft - center[0]) - startAngleRad;\n attrs.r = center[2] / 2;\n attrs.innerR = center[3] / 2;\n if (startAngle <= 0) {\n startAngle += fullCircle;\n }\n if (endAngle <= 0) {\n endAngle += fullCircle;\n }\n if (endAngle < startAngle) {\n // Swapping angles\n endAngle = [startAngle, startAngle = endAngle][0];\n }\n // If pane is not a full circle we need to let users zoom to the min\n // We do this by swapping angles after pointer crosses\n // middle angle (swapAngle) of the missing slice of the pane\n if (paneRadRange < fullCircle) {\n const swapAngle = endAngleRad + (fullCircle - paneRadRange) / 2;\n if (startAngleRad + endAngle > swapAngle) {\n endAngle = startAngle;\n startAngle = startAngleRad <= 0 ? startAngleRad : 0;\n }\n }\n const start = attrs.start =\n Math.max(startAngle + startAngleRad, startAngleRad), end = attrs.end =\n Math.min(endAngle + startAngleRad, endAngleRad);\n // Adjust the selection shape for polygon grid lines\n if (linearAxis.options.gridLineInterpolation === 'polygon') {\n const radialAxis = chart.hoverPane.axis, min = start - radialAxis.startAngleRad + radialAxis.pos, max = end - start;\n let path = linearAxis.getPlotLinePath({\n value: linearAxis.max\n }), pathStart = radialAxis.toValue(min), pathEnd = radialAxis.toValue(min + max);\n if (pathStart < radialAxis.getExtremes().min) {\n const { min, max } = radialAxis.getExtremes();\n pathStart = max - (min - pathStart);\n }\n if (pathEnd < radialAxis.getExtremes().min) {\n const { min, max } = radialAxis.getExtremes();\n pathEnd = max - (min - pathEnd);\n }\n if (pathEnd < pathStart) {\n // Swapping angles\n pathEnd = [pathStart, pathStart = pathEnd][0];\n }\n // Get trimmed path\n path = trimPath(path, pathStart, pathEnd, radialAxis);\n // Add center to the path\n path.push([\n 'L', center[0] + chart.plotLeft,\n chart.plotTop + center[1]\n ]);\n attrs.d = path;\n shapeType = 'path';\n }\n }\n // Adjust the height of the selection marker\n if (this.zoomVert) {\n const linearAxis = chart.inverted ? chart.xAxis[0] : chart.yAxis[0];\n let innerR = Math.sqrt(Math.pow(mouseDownX - chart.plotLeft - center[0], 2) +\n Math.pow(mouseDownY - chart.plotTop - center[1], 2)), r = Math.sqrt(Math.pow(chartX - chart.plotLeft - center[0], 2) +\n Math.pow(chartY - chart.plotTop - center[1], 2));\n if (r < innerR) {\n // Swapping angles\n innerR = [r, r = innerR][0];\n }\n if (r > center[2] / 2) {\n r = center[2] / 2;\n }\n if (innerR < center[3] / 2) {\n innerR = center[3] / 2;\n }\n if (!this.zoomHor) {\n attrs.start = startAngleRad;\n attrs.end = endAngleRad;\n }\n attrs.r = r;\n attrs.innerR = innerR;\n if (linearAxis.options.gridLineInterpolation === 'polygon') {\n const end = linearAxis.toValue(linearAxis.len + linearAxis.pos - innerR), start = linearAxis.toValue(linearAxis.len + linearAxis.pos - r), path = linearAxis.getPlotLinePath({\n value: start\n }).concat(linearAxis.getPlotLinePath({\n value: end,\n reverse: true\n }));\n attrs.d = path;\n shapeType = 'path';\n }\n }\n if (this.zoomHor &&\n this.zoomVert &&\n linearAxis.options.gridLineInterpolation === 'polygon') {\n const radialAxis = chart.hoverPane.axis, start = attrs.start || 0, end = attrs.end || 0, min = start - radialAxis.startAngleRad + radialAxis.pos, max = end - start, pathStart = radialAxis.toValue(min), pathEnd = radialAxis.toValue(min + max);\n // Trim path\n if (attrs.d instanceof Array) {\n let innerPath = attrs.d.slice(0, attrs.d.length / 2), outerPath = attrs.d.slice(attrs.d.length / 2, attrs.d.length);\n outerPath = [...outerPath].reverse();\n const radialAxis = chart.hoverPane.axis;\n innerPath = trimPath(innerPath, pathStart, pathEnd, radialAxis);\n outerPath = trimPath(outerPath, pathStart, pathEnd, radialAxis);\n if (outerPath) {\n (outerPath[0][0]) = 'L';\n }\n outerPath = [...outerPath].reverse();\n attrs.d = innerPath.concat(outerPath);\n shapeType = 'path';\n }\n }\n event.attrs = attrs;\n event.shapeType = shapeType;\n }\n}\n/**\n * @private\n */\nfunction onSeriesAfterInit() {\n const chart = this.chart;\n if (chart.polar) {\n this.polar = new PolarAdditions(this);\n // Add flags that identifies radial inverted series\n if (chart.inverted) {\n this.isRadialSeries = true;\n if (this.is('column')) {\n this.isRadialBar = true;\n }\n }\n }\n}\n/**\n * Extend translate. The plotX and plotY values are computed as if the polar\n * chart were a cartesian plane, where plotX denotes the angle in radians\n * and (yAxis.len - plotY) is the pixel distance from center.\n * @private\n */\nfunction onSeriesAfterTranslate() {\n if (this.chart.polar && this.xAxis) {\n const series = this, { xAxis, yAxis } = series, chart = series.chart;\n // Prepare k-d-tree handling. It searches by angle (clientX) in\n // case of shared tooltip, and by two dimensional distance in case\n // of non-shared.\n series.kdByAngle = chart.tooltip && chart.tooltip.shared;\n if (series.kdByAngle || chart.inverted) {\n series.searchPoint = searchPointByAngleOrInverted;\n }\n else {\n series.options.findNearestPointBy = 'xy';\n }\n const points = series.points;\n let i = points.length;\n while (i--) {\n // Translate plotX, plotY from angle and radius to true plot\n // coordinates\n if (!series.is('column') && !series.is('columnrange')) {\n series.polar.toXY(points[i]);\n }\n // Treat points below Y axis min as null (#10082)\n if (!chart.hasParallelCoordinates &&\n !series.yAxis.reversed) {\n if (pick(points[i].y, Number.MIN_VALUE) < yAxis.min ||\n points[i].x < xAxis.min ||\n points[i].x > xAxis.max) {\n // Destroy markers\n points[i].isNull = true;\n // Destroy column's graphic\n points[i].plotY = NaN;\n }\n else {\n // Restore isNull flag\n points[i].isNull =\n points[i].isValid && !points[i].isValid();\n }\n }\n }\n // Perform clip after render\n if (!this.hasClipCircleSetter) {\n this.hasClipCircleSetter = !!series.eventsToUnbind.push(addEvent(series, 'afterRender', function () {\n let circ;\n if (chart.polar && this.options.clip !== false) {\n // For clipping purposes there is a need for\n // coordinates from the absolute center\n circ = this.yAxis.pane.center;\n if (!this.clipCircle) {\n this.clipCircle = clipCircle(chart.renderer, circ[0], circ[1], circ[2] / 2, circ[3] / 2);\n }\n else {\n this.clipCircle.animate({\n x: circ[0],\n y: circ[1],\n r: circ[2] / 2,\n innerR: circ[3] / 2\n });\n }\n this.group.clip(this.clipCircle);\n this.setClip = H.noop;\n }\n }));\n }\n }\n}\n/**\n * Search a k-d tree by the point angle (used for shared tooltips in polar) or\n * the inverted point.\n * charts\n * @private\n */\nfunction searchPointByAngleOrInverted(e) {\n const series = this, chart = series.chart, xAxis = series.xAxis, yAxis = series.yAxis, center = xAxis.pane && xAxis.pane.center, plotX = e.chartX - (center && center[0] || 0) - chart.plotLeft, plotY = e.chartY - (center && center[1] || 0) - chart.plotTop;\n const searchKDTreePoint = chart.inverted ? {\n clientX: e.chartX - yAxis.pos,\n plotY: e.chartY - xAxis.pos\n } : {\n clientX: 180 + (Math.atan2(plotX, plotY) * (-180 / Math.PI))\n };\n return series.searchKDTree(searchKDTreePoint);\n}\n/**\n * Trim polygonal path\n * @private\n */\nfunction trimPath(path, start, end, radialAxis) {\n const tickInterval = radialAxis.tickInterval, ticks = radialAxis.tickPositions;\n let lastTick = find(ticks, (tick) => tick >= end), firstTick = find([...ticks].reverse(), (tick) => tick <= start);\n if (!defined(lastTick)) {\n lastTick = ticks[ticks.length - 1];\n }\n if (!defined(firstTick)) {\n firstTick = ticks[0];\n lastTick += tickInterval;\n path[0][0] = 'L';\n // To do: figure out why -3 or -2\n path.unshift(path[path.length - 3]);\n }\n path = path.slice(ticks.indexOf(firstTick), ticks.indexOf(lastTick) + 1);\n path[0][0] = 'M';\n return path;\n}\n/**\n * Extend chart.get to also search in panes. Used internally in\n * responsiveness and chart.update.\n * @private\n */\nfunction wrapChartGet(proceed, id) {\n return find(this.pane || [], (pane) => (\n // @todo remove id or define id type:\n pane.options.id === id)) || proceed.call(this, id);\n}\n/**\n * Align column data labels outside the columns. #1199.\n * @private\n */\nfunction wrapColumnSeriesAlignDataLabel(proceed, point, dataLabel, options, alignTo, isNew) {\n const chart = this.chart, inside = pick(options.inside, !!this.options.stacking);\n let angle, shapeArgs, labelPos;\n if (chart.polar) {\n angle = point.rectPlotX / Math.PI * 180;\n if (!chart.inverted) {\n // Align nicely outside the perimeter of the columns\n options = findAlignments(angle, options);\n }\n else { // Required corrections for data labels of inverted bars\n // The plotX and plotY are correctly set therefore they\n // don't need to be swapped (inverted argument is false)\n this.forceDL = chart.isInsidePlot(point.plotX, point.plotY);\n // Checks if labels should be positioned inside\n if (inside && point.shapeArgs) {\n shapeArgs = point.shapeArgs;\n // Calculates pixel positions for a data label to be\n // inside\n labelPos =\n this.yAxis.postTranslate(\n // angle\n ((shapeArgs.start || 0) + (shapeArgs.end || 0)) / 2 -\n this\n .xAxis.startAngleRad, \n // radius\n point.barX +\n point.pointWidth / 2);\n alignTo = merge(alignTo, {\n x: labelPos.x - chart.plotLeft,\n y: labelPos.y - chart.plotTop\n });\n }\n else if (point.tooltipPos) {\n alignTo = merge(alignTo, {\n x: point.tooltipPos[0],\n y: point.tooltipPos[1]\n });\n }\n options.align = pick(options.align, 'center');\n options.verticalAlign =\n pick(options.verticalAlign, 'middle');\n }\n Series.prototype.alignDataLabel.call(this, point, dataLabel, options, alignTo, isNew);\n // Hide label of a point (only inverted) that is outside the\n // visible y range\n if (this.isRadialBar && point.shapeArgs &&\n point.shapeArgs.start === point.shapeArgs.end) {\n dataLabel.hide();\n }\n else {\n dataLabel.show();\n }\n }\n else {\n proceed.call(this, point, dataLabel, options, alignTo, isNew);\n }\n}\n/**\n * Extend the column prototype's translate method\n * @private\n */\nfunction onAfterColumnTranslate() {\n const series = this, options = series.options, stacking = options.stacking, chart = series.chart, xAxis = series.xAxis, yAxis = series.yAxis, reversed = yAxis.reversed, center = yAxis.center, startAngleRad = xAxis.startAngleRad, endAngleRad = xAxis.endAngleRad, visibleRange = endAngleRad - startAngleRad;\n let threshold = options.threshold, thresholdAngleRad = 0, points, point, i, yMin, yMax, start = 0, end = 0, tooltipPos, pointX, pointY, stackValues, stack, barX, innerR, r;\n // Postprocess plot coordinates\n if (xAxis.isRadial) {\n points = series.points;\n i = points.length;\n yMin = yAxis.translate(yAxis.min);\n yMax = yAxis.translate(yAxis.max);\n threshold = options.threshold || 0;\n if (chart.inverted) {\n // Finding a correct threshold\n if (isNumber(threshold)) {\n thresholdAngleRad = yAxis.translate(threshold);\n // Checks if threshold is outside the visible range\n if (defined(thresholdAngleRad)) {\n if (thresholdAngleRad < 0) {\n thresholdAngleRad = 0;\n }\n else if (thresholdAngleRad > visibleRange) {\n thresholdAngleRad = visibleRange;\n }\n // Adding start angle offset\n series.translatedThreshold =\n thresholdAngleRad + startAngleRad;\n }\n }\n }\n while (i--) {\n point = points[i];\n barX = point.barX;\n pointX = point.x;\n pointY = point.y;\n point.shapeType = 'arc';\n if (chart.inverted) {\n point.plotY = yAxis.translate(pointY);\n if (stacking && yAxis.stacking) {\n stack = yAxis.stacking.stacks[(pointY < 0 ? '-' : '') +\n series.stackKey];\n if (series.visible && stack && stack[pointX]) {\n if (!point.isNull) {\n stackValues = stack[pointX].points[series.getStackIndicator(void 0, pointX, series.index).key];\n // Translating to radial values\n start = yAxis.translate(stackValues[0]);\n end = yAxis.translate(stackValues[1]);\n // If starting point is beyond the\n // range, set it to 0\n if (defined(start)) {\n start = U.clamp(start, 0, visibleRange);\n }\n }\n }\n }\n else {\n // Initial start and end angles for radial bar\n start = thresholdAngleRad;\n end = point.plotY;\n }\n if (start > end) {\n // Swapping start and end\n end = [start, start = end][0];\n }\n // Prevent from rendering point outside the\n // acceptable circular range\n if (!reversed) {\n if (start < yMin) {\n start = yMin;\n }\n else if (end > yMax) {\n end = yMax;\n }\n else if (end < yMin || start > yMax) {\n start = end = 0;\n }\n }\n else {\n if (end > yMin) {\n end = yMin;\n }\n else if (start < yMax) {\n start = yMax;\n }\n else if (start > yMin || end < yMax) {\n start = end = visibleRange;\n }\n }\n if (yAxis.min > yAxis.max) {\n start = end = reversed ? visibleRange : 0;\n }\n start += startAngleRad;\n end += startAngleRad;\n if (center) {\n point.barX = barX += center[3] / 2;\n }\n // In case when radius, inner radius or both are negative, a\n // point is rendered but partially or as a center point\n innerR = Math.max(barX, 0);\n r = Math.max(barX + point.pointWidth, 0);\n // Handle border radius\n const brOption = options.borderRadius, brValue = typeof brOption === 'object' ?\n brOption.radius : brOption, borderRadius = relativeLength(brValue || 0, r - innerR);\n point.shapeArgs = {\n x: center[0],\n y: center[1],\n r,\n innerR,\n start,\n end,\n borderRadius\n };\n // Fade out the points if not inside the polar \"plot area\"\n point.opacity = start === end ? 0 : void 0;\n // A correct value for stacked or not fully visible\n // point\n point.plotY = (defined(series.translatedThreshold) &&\n (start < series.translatedThreshold ? start : end)) -\n startAngleRad;\n // Non-inverted polar columns\n }\n else {\n start = barX + startAngleRad;\n point.shapeArgs = series.polar.arc(point.yBottom, point.plotY, start, start + point.pointWidth);\n // Disallow border radius on polar columns for now. It would\n // take some refactoring to work with the `scope` and the\n // `where` options. Those options would require that only\n // individual corners be rounded, in practice individual calls\n // to applyBorderRadius from the extended `arc` function. That\n // would be a viable solution, though it would not be perfect\n // until we implemented rounding that included the lower points\n // in the stack, like we have for cartesian column.\n point.shapeArgs.borderRadius = 0;\n }\n // Provided a correct coordinates for the tooltip\n series.polar.toXY(point);\n if (chart.inverted) {\n tooltipPos = yAxis.postTranslate(point.rectPlotY, barX + point.pointWidth / 2);\n point.tooltipPos = [\n tooltipPos.x - chart.plotLeft,\n tooltipPos.y - chart.plotTop\n ];\n }\n else {\n point.tooltipPos = [point.plotX, point.plotY];\n }\n if (center) {\n point.ttBelow = point.plotY > center[1];\n }\n }\n }\n}\n/**\n * Extend getSegmentPath to allow connecting ends across 0 to provide a\n * closed circle in line-like series.\n * @private\n */\nfunction wrapLineSeriesGetGraphPath(proceed, points) {\n const series = this;\n let firstValid, popLastPoint;\n // Connect the path\n if (this.chart.polar) {\n points = points || this.points;\n // Append first valid point in order to connect the ends\n for (let i = 0; i < points.length; i++) {\n if (!points[i].isNull) {\n firstValid = i;\n break;\n }\n }\n /**\n * Polar charts only. Whether to connect the ends of a line series\n * plot across the extremes.\n *\n * @sample {highcharts} highcharts/plotoptions/line-connectends-false/\n * Do not connect\n *\n * @type {boolean}\n * @since 2.3.0\n * @product highcharts\n * @apioption plotOptions.series.connectEnds\n */\n if (this.options.connectEnds !== false &&\n typeof firstValid !== 'undefined') {\n this.connectEnds = true; // re-used in splines\n points.splice(points.length, 0, points[firstValid]);\n popLastPoint = true;\n }\n // For area charts, pseudo points are added to the graph, now we\n // need to translate these\n points.forEach((point) => {\n if (typeof point.polarPlotY === 'undefined') {\n series.polar.toXY(point);\n }\n });\n }\n // Run uber method\n const ret = proceed.apply(this, [].slice.call(arguments, 1));\n // #6212 points.splice method is adding points to an array. In case of\n // areaspline getGraphPath method is used two times and in both times\n // points are added to an array. That is why points.pop is used, to get\n // unmodified points.\n if (popLastPoint) {\n points.pop();\n }\n return ret;\n}\n/**\n * Extend getCoordinates to prepare for polar axis values\n * @private\n */\nfunction wrapPointerGetCoordinates(proceed, e) {\n const chart = this.chart;\n let ret = {\n xAxis: [],\n yAxis: []\n };\n if (chart.polar) {\n chart.axes.forEach((axis) => {\n // Skip colorAxis\n if (axis.coll === 'colorAxis') {\n return;\n }\n const isXAxis = axis.isXAxis, center = axis.center, x = e.chartX - center[0] - chart.plotLeft, y = e.chartY - center[1] - chart.plotTop;\n ret[isXAxis ? 'xAxis' : 'yAxis'].push({\n axis: axis,\n value: axis.translate(isXAxis ?\n Math.PI - Math.atan2(x, y) : // angle\n // distance from center\n Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)), true)\n });\n });\n }\n else {\n ret = proceed.call(this, e);\n }\n return ret;\n}\n/**\n * Prevent zooming on mobile devices\n * @private\n */\nfunction wrapPointerPinch(proceed, e) {\n if (this.chart.polar) {\n return;\n }\n proceed.call(this, e);\n}\n/**\n * Define the animate method for regular series\n * @private\n */\nfunction wrapSeriesAnimate(proceed, init) {\n const series = this, chart = this.chart, group = this.group, markerGroup = this.markerGroup, center = this.xAxis && this.xAxis.center, plotLeft = chart.plotLeft, plotTop = chart.plotTop;\n let animation = this.options.animation, attribs, paneInnerR, graphic, shapeArgs, r, innerR;\n // Specific animation for polar charts\n if (chart.polar) {\n if (series.isRadialBar) {\n if (!init) {\n // Run the pie animation for radial bars\n series.startAngleRad = pick(series.translatedThreshold, series.xAxis.startAngleRad);\n H.seriesTypes.pie.prototype.animate.call(series, init);\n }\n }\n else {\n animation = animObject(animation);\n // A different animation needed for column like series\n if (series.is('column')) {\n if (!init) {\n paneInnerR = center[3] / 2;\n series.points.forEach((point) => {\n graphic = point.graphic;\n shapeArgs = point.shapeArgs;\n r = shapeArgs && shapeArgs.r;\n innerR = shapeArgs && shapeArgs.innerR;\n if (graphic && shapeArgs) {\n // start values\n graphic.attr({\n r: paneInnerR,\n innerR: paneInnerR\n });\n // animate\n graphic.animate({\n r: r,\n innerR: innerR\n }, series.options.animation);\n }\n });\n }\n }\n else {\n // Initialize the animation\n if (init) {\n // Scale down the group and place it in the center\n attribs = {\n translateX: center[0] + plotLeft,\n translateY: center[1] + plotTop,\n scaleX: 0.001,\n scaleY: 0.001\n };\n group.attr(attribs);\n if (markerGroup) {\n markerGroup.attr(attribs);\n }\n // Run the animation\n }\n else {\n attribs = {\n translateX: plotLeft,\n translateY: plotTop,\n scaleX: 1,\n scaleY: 1\n };\n group.animate(attribs, animation);\n if (markerGroup) {\n markerGroup.animate(attribs, animation);\n }\n }\n }\n }\n // For non-polar charts, revert to the basic animation\n }\n else {\n proceed.call(this, init);\n }\n}\n/**\n * Overridden method for calculating a spline from one point to the next\n * @private\n */\nfunction wrapSplineSeriesGetPointSpline(proceed, segment, point, i) {\n let ret, connectors;\n if (this.chart.polar) {\n // moveTo or lineTo\n if (!i) {\n ret = ['M', point.plotX, point.plotY];\n }\n else { // curve from last point to this\n connectors = getConnectors(segment, i, true, this.connectEnds);\n const rightContX = connectors.prevPointCont &&\n connectors.prevPointCont.rightContX;\n const rightContY = connectors.prevPointCont &&\n connectors.prevPointCont.rightContY;\n ret = [\n 'C',\n isNumber(rightContX) ? rightContX : connectors.plotX,\n isNumber(rightContY) ? rightContY : connectors.plotY,\n isNumber(connectors.leftContX) ?\n connectors.leftContX :\n connectors.plotX,\n isNumber(connectors.leftContY) ?\n connectors.leftContY :\n connectors.plotY,\n connectors.plotX,\n connectors.plotY\n ];\n }\n }\n else {\n ret = proceed.call(this, segment, point, i);\n }\n return ret;\n}\n/**\n * Extend the point pos method to calculate point positions for the polar chart.\n * @private\n */\nfunction wrapPointPos(proceed, chartCoordinates, plotY = this.plotY) {\n if (!this.destroyed) {\n const { plotX, series } = this, { chart } = series;\n if (chart.polar &&\n isNumber(plotX) &&\n isNumber(plotY)) {\n return [\n plotX + (chartCoordinates ? chart.plotLeft : 0),\n plotY + (chartCoordinates ? chart.plotTop : 0)\n ];\n }\n return proceed.call(this, chartCoordinates, plotY);\n }\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * Extensions for polar charts. Additionally, much of the geometry required\n * for polar charts is gathered in RadialAxes.js.\n * @private\n */\nclass PolarAdditions {\n /* *\n *\n * Static Functions\n *\n * */\n static compose(AxisClass, ChartClass, PointerClass, SeriesClass, TickClass, PointClass, AreaSplineRangeSeriesClass, ColumnSeriesClass, LineSeriesClass, SplineSeriesClass) {\n Pane.compose(ChartClass, PointerClass);\n RadialAxis.compose(AxisClass, TickClass);\n if (pushUnique(composed, 'Polar')) {\n const chartProto = ChartClass.prototype, pointProto = PointClass.prototype, pointerProto = PointerClass.prototype, seriesProto = SeriesClass.prototype;\n addEvent(ChartClass, 'afterDrawChartBox', onChartAfterDrawChartBox);\n addEvent(ChartClass, 'getAxes', onChartGetAxes);\n addEvent(ChartClass, 'init', onChartAfterInit);\n wrap(chartProto, 'get', wrapChartGet);\n wrap(pointerProto, 'getCoordinates', wrapPointerGetCoordinates);\n wrap(pointerProto, 'pinch', wrapPointerPinch);\n addEvent(PointerClass, 'getSelectionMarkerAttrs', onPointerGetSelectionMarkerAttrs);\n addEvent(PointerClass, 'getSelectionBox', onPointerGetSelectionBox);\n addEvent(SeriesClass, 'afterInit', onSeriesAfterInit);\n addEvent(SeriesClass, 'afterTranslate', onSeriesAfterTranslate, { order: 2 } // Run after translation of ||-coords\n );\n addEvent(SeriesClass, 'afterColumnTranslate', onAfterColumnTranslate, { order: 4 });\n wrap(seriesProto, 'animate', wrapSeriesAnimate);\n wrap(pointProto, 'pos', wrapPointPos);\n if (ColumnSeriesClass) {\n const columnProto = ColumnSeriesClass.prototype;\n wrap(columnProto, 'alignDataLabel', wrapColumnSeriesAlignDataLabel);\n wrap(columnProto, 'animate', wrapSeriesAnimate);\n }\n if (LineSeriesClass) {\n const lineProto = LineSeriesClass.prototype;\n wrap(lineProto, 'getGraphPath', wrapLineSeriesGetGraphPath);\n }\n if (SplineSeriesClass) {\n const splineProto = SplineSeriesClass.prototype;\n wrap(splineProto, 'getPointSpline', wrapSplineSeriesGetPointSpline);\n if (AreaSplineRangeSeriesClass) {\n const areaSplineRangeProto = AreaSplineRangeSeriesClass.prototype;\n // #6430 Areasplinerange series use unwrapped getPointSpline\n // method, so we need to set this method again.\n areaSplineRangeProto.getPointSpline =\n splineProto.getPointSpline;\n }\n }\n }\n }\n /* *\n *\n * Constructor\n *\n * */\n constructor(series) {\n this.series = series;\n }\n /* *\n *\n * Functions\n *\n * */\n arc(low, high, start, end) {\n const series = this.series, center = series.xAxis.center, len = series.yAxis.len, paneInnerR = center[3] / 2;\n let r = len - high + paneInnerR, innerR = len - pick(low, len) + paneInnerR;\n // Prevent columns from shooting through the pane's center\n if (series.yAxis.reversed) {\n if (r < 0) {\n r = paneInnerR;\n }\n if (innerR < 0) {\n innerR = paneInnerR;\n }\n }\n // Return a new shapeArgs\n return {\n x: center[0],\n y: center[1],\n r: r,\n innerR: innerR,\n start: start,\n end: end\n };\n }\n /**\n * Translate a point's plotX and plotY from the internal angle and radius\n * measures to true plotX, plotY coordinates\n * @private\n */\n toXY(point) {\n const series = this.series, chart = series.chart, xAxis = series.xAxis, yAxis = series.yAxis, plotX = point.plotX, inverted = chart.inverted, pointY = point.y;\n let plotY = point.plotY, radius = inverted ? plotX : yAxis.len - plotY, clientX;\n // Corrected y position of inverted series other than column\n if (inverted && series && !series.isRadialBar) {\n point.plotY = plotY =\n isNumber(pointY) ? yAxis.translate(pointY) : 0;\n }\n // Save rectangular plotX, plotY for later computation\n point.rectPlotX = plotX;\n point.rectPlotY = plotY;\n if (yAxis.center) {\n radius += yAxis.center[3] / 2;\n }\n // Find the polar plotX and plotY. Avoid setting plotX and plotY to NaN\n // when plotY is undefined (#15438)\n if (isNumber(plotY)) {\n const xy = inverted ? yAxis.postTranslate(plotY, radius) :\n xAxis.postTranslate(plotX, radius);\n point.plotX = point.polarPlotX = xy.x - chart.plotLeft;\n point.plotY = point.polarPlotY = xy.y - chart.plotTop;\n }\n // If shared tooltip, record the angle in degrees in order to align X\n // points. Otherwise, use a standard k-d tree to get the nearest point\n // in two dimensions.\n if (series.kdByAngle) {\n clientX = ((plotX / Math.PI * 180) + xAxis.pane.options.startAngle) % 360;\n if (clientX < 0) { // #2665\n clientX += 360;\n }\n point.clientX = clientX;\n }\n else {\n point.clientX = point.plotX;\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default PolarAdditions;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Globals.js';\nconst { composed } = H;\nimport StackItem from './Stacking/StackItem.js';\nimport U from '../Utilities.js';\nconst { addEvent, objectEach, pushUnique } = U;\n/* *\n *\n * Namespace\n *\n * */\nvar WaterfallAxis;\n(function (WaterfallAxis) {\n /* *\n *\n * Interfaces\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(AxisClass, ChartClass) {\n if (pushUnique(composed, 'Axis.Waterfall')) {\n addEvent(AxisClass, 'init', onAxisInit);\n addEvent(AxisClass, 'afterBuildStacks', onAxisAfterBuildStacks);\n addEvent(AxisClass, 'afterRender', onAxisAfterRender);\n addEvent(ChartClass, 'beforeRedraw', onChartBeforeRedraw);\n }\n }\n WaterfallAxis.compose = compose;\n /**\n * @private\n */\n function onAxisAfterBuildStacks() {\n const axis = this, stacks = axis.waterfall.stacks;\n if (stacks) {\n stacks.changed = false;\n delete stacks.alreadyChanged;\n }\n }\n /**\n * @private\n */\n function onAxisAfterRender() {\n const axis = this, stackLabelOptions = axis.options.stackLabels;\n if (stackLabelOptions && stackLabelOptions.enabled &&\n axis.waterfall.stacks) {\n axis.waterfall.renderStackTotals();\n }\n }\n /**\n * @private\n */\n function onAxisInit() {\n const axis = this;\n if (!axis.waterfall) {\n axis.waterfall = new Composition(axis);\n }\n }\n /**\n * @private\n */\n function onChartBeforeRedraw() {\n const axes = this.axes, series = this.series;\n for (const serie of series) {\n if (serie.options.stacking) {\n for (const axis of axes) {\n if (!axis.isXAxis) {\n axis.waterfall.stacks.changed = true;\n }\n }\n break;\n }\n }\n }\n /* *\n *\n * Classes\n *\n * */\n class Composition {\n /* *\n *\n * Constructors\n *\n * */\n constructor(axis) {\n this.axis = axis;\n this.stacks = {\n changed: false\n };\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Calls StackItem.prototype.render function that creates and renders\n * stack total label for each waterfall stack item.\n *\n * @private\n * @function Highcharts.Axis#renderWaterfallStackTotals\n */\n renderStackTotals() {\n const yAxis = this.axis, waterfallStacks = yAxis.waterfall.stacks, stackTotalGroup = (yAxis.stacking && yAxis.stacking.stackTotalGroup), dummyStackItem = new StackItem(yAxis, yAxis.options.stackLabels || {}, false, 0, void 0);\n this.dummyStackItem = dummyStackItem;\n // Render each waterfall stack total\n if (stackTotalGroup) {\n objectEach(waterfallStacks, (type) => {\n objectEach(type, (stackItem, key) => {\n dummyStackItem.total = stackItem.stackTotal;\n dummyStackItem.x = +key;\n if (stackItem.label) {\n dummyStackItem.label = stackItem.label;\n }\n StackItem.prototype.render.call(dummyStackItem, stackTotalGroup);\n stackItem.label = dummyStackItem.label;\n delete dummyStackItem.label;\n });\n });\n }\n dummyStackItem.total = null;\n }\n }\n WaterfallAxis.Composition = Composition;\n})(WaterfallAxis || (WaterfallAxis = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default WaterfallAxis;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\nimport ColumnSeries from '../Column/ColumnSeries.js';\nimport Point from '../../Core/Series/Point.js';\nimport U from '../../Core/Utilities.js';\nconst { isNumber } = U;\n/* *\n *\n * Class\n *\n * */\nclass WaterfallPoint extends ColumnSeries.prototype.pointClass {\n /* *\n *\n * Functions\n *\n * */\n getClassName() {\n let className = Point.prototype.getClassName.call(this);\n if (this.isSum) {\n className += ' highcharts-sum';\n }\n else if (this.isIntermediateSum) {\n className += ' highcharts-intermediate-sum';\n }\n return className;\n }\n // Pass the null test in ColumnSeries.translate.\n isValid() {\n return (isNumber(this.y) ||\n this.isSum ||\n Boolean(this.isIntermediateSum));\n }\n}\n/* *\n *\n * Export\n *\n * */\nexport default WaterfallPoint;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * A waterfall chart displays sequentially introduced positive or negative\n * values in cumulative columns.\n *\n * @sample highcharts/demo/waterfall/\n * Waterfall chart\n * @sample highcharts/plotoptions/waterfall-inverted/\n * Horizontal (inverted) waterfall\n * @sample highcharts/plotoptions/waterfall-stacked/\n * Stacked waterfall chart\n *\n * @extends plotOptions.column\n * @excluding boostThreshold, boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @optionparent plotOptions.waterfall\n */\nconst WaterfallSeriesDefaults = {\n /**\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption plotOptions.waterfall.color\n */\n /**\n * The color used specifically for positive point columns. When not\n * specified, the general series color is used.\n *\n * In styled mode, the waterfall colors can be set with the\n * `.highcharts-point-negative`, `.highcharts-sum` and\n * `.highcharts-intermediate-sum` classes.\n *\n * @sample {highcharts} highcharts/demo/waterfall/\n * Waterfall\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @product highcharts\n * @apioption plotOptions.waterfall.upColor\n */\n dataLabels: {\n inside: true\n },\n /**\n * The width of the line connecting waterfall columns.\n *\n * @product highcharts\n */\n lineWidth: 1,\n /**\n * The color of the line that connects columns in a waterfall series.\n *\n * In styled mode, the stroke can be set with the `.highcharts-graph`\n * class.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 3.0\n * @product highcharts\n */\n lineColor: \"#333333\" /* Palette.neutralColor80 */,\n /**\n * A name for the dash style to use for the line connecting the columns\n * of the waterfall series. Possible values: Dash, DashDot, Dot,\n * LongDash, LongDashDot, LongDashDotDot, ShortDash, ShortDashDot,\n * ShortDashDotDot, ShortDot, Solid\n *\n * In styled mode, the stroke dash-array can be set with the\n * `.highcharts-graph` class.\n *\n * @type {Highcharts.DashStyleValue}\n * @since 3.0\n * @product highcharts\n */\n dashStyle: 'Dot',\n /**\n * The color of the border of each waterfall column.\n *\n * In styled mode, the border stroke can be set with the\n * `.highcharts-point` class.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 3.0\n * @product highcharts\n */\n borderColor: \"#333333\" /* Palette.neutralColor80 */,\n states: {\n hover: {\n lineWidthPlus: 0 // #3126\n }\n }\n};\n/**\n * A `waterfall` series. If the [type](#series.waterfall.type) option\n * is not specified, it is inherited from [chart.type](#chart.type).\n *\n * @extends series,plotOptions.waterfall\n * @excluding dataParser, dataURL, boostThreshold, boostBlending\n * @product highcharts\n * @requires highcharts-more\n * @apioption series.waterfall\n */\n/**\n * An array of data points for the series. For the `waterfall` series\n * type, points can be given in the following ways:\n *\n * 1. An array of numerical values. In this case, the numerical values will be\n * interpreted as `y` options. The `x` values will be automatically\n * calculated, either starting at 0 and incremented by 1, or from\n * `pointStart` and `pointInterval` given in the series options. If the axis\n * has categories, these will be used. Example:\n * ```js\n * data: [0, 5, 3, 5]\n * ```\n *\n * 2. An array of arrays with 2 values. In this case, the values correspond to\n * `x,y`. If the first value is a string, it is applied as the name of the\n * point, and the `x` value is inferred.\n * ```js\n * data: [\n * [0, 7],\n * [1, 8],\n * [2, 3]\n * ]\n * ```\n *\n * 3. An array of objects with named values. The following snippet shows only a\n * few settings, see the complete options set below. If the total number of\n * data points exceeds the series'\n * [turboThreshold](#series.waterfall.turboThreshold), this option is not\n * available.\n * ```js\n * data: [{\n * x: 1,\n * y: 8,\n * name: \"Point2\",\n * color: \"#00FF00\"\n * }, {\n * x: 1,\n * y: 8,\n * name: \"Point1\",\n * color: \"#FF00FF\"\n * }]\n * ```\n *\n * @sample {highcharts} highcharts/chart/reflow-true/\n * Numerical values\n * @sample {highcharts} highcharts/series/data-array-of-arrays/\n * Arrays of numeric x and y\n * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/\n * Arrays of datetime x and y\n * @sample {highcharts} highcharts/series/data-array-of-name-value/\n * Arrays of point.name and y\n * @sample {highcharts} highcharts/series/data-array-of-objects/\n * Config objects\n *\n * @type {Array|null|*>}\n * @extends series.line.data\n * @excluding marker\n * @product highcharts\n * @apioption series.waterfall.data\n */\n/**\n * When this property is true, the points acts as a summary column for\n * the values added or subtracted since the last intermediate sum,\n * or since the start of the series. The `y` value is ignored.\n *\n * @sample {highcharts} highcharts/demo/waterfall/\n * Waterfall\n *\n * @type {boolean}\n * @default false\n * @product highcharts\n * @apioption series.waterfall.data.isIntermediateSum\n */\n/**\n * When this property is true, the point display the total sum across\n * the entire series. The `y` value is ignored.\n *\n * @sample {highcharts} highcharts/demo/waterfall/\n * Waterfall\n *\n * @type {boolean}\n * @default false\n * @product highcharts\n * @apioption series.waterfall.data.isSum\n */\n''; // adds doclets above to transpiled file\n/* *\n *\n * Default Export\n *\n * */\nexport default WaterfallSeriesDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { column: ColumnSeries, line: LineSeries } = SeriesRegistry.seriesTypes;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, arrayMax, arrayMin, correctFloat, extend, isNumber, merge, objectEach, pick } = U;\nimport WaterfallAxis from '../../Core/Axis/WaterfallAxis.js';\nimport WaterfallPoint from './WaterfallPoint.js';\nimport WaterfallSeriesDefaults from './WaterfallSeriesDefaults.js';\n/* *\n *\n * Functions\n *\n * */\n/**\n * Returns true if the key is a direct property of the object.\n * @private\n * @param {*} obj\n * Object with property to test\n * @param {string} key\n * Property key to test\n * @return {boolean}\n * Whether it is a direct property\n */\nfunction ownProp(obj, key) {\n return Object.hasOwnProperty.call(obj, key);\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * Waterfall series type.\n *\n * @private\n */\nclass WaterfallSeries extends ColumnSeries {\n /* *\n *\n * Functions\n *\n * */\n // After generating points, set y-values for all sums.\n generatePoints() {\n // Parent call:\n ColumnSeries.prototype.generatePoints.apply(this);\n for (let i = 0, len = this.points.length; i < len; i++) {\n const point = this.points[i], y = this.processedYData[i];\n // Override point value for sums. #3710 Update point does not\n // propagate to sum\n if (isNumber(y) && (point.isIntermediateSum || point.isSum)) {\n point.y = correctFloat(y);\n }\n }\n }\n // Call default processData then override yData to reflect waterfall's\n // extremes on yAxis\n processData(force) {\n const series = this, options = series.options, yData = series.yData, \n // #3710 Update point does not propagate to sum\n points = options.data, dataLength = yData.length, threshold = options.threshold || 0;\n let point, subSum, sum, dataMin, dataMax, y;\n sum = subSum = dataMin = dataMax = 0;\n for (let i = 0; i < dataLength; i++) {\n y = yData[i];\n point = points && points[i] ? points[i] : {};\n if (y === 'sum' || point.isSum) {\n yData[i] = correctFloat(sum);\n }\n else if (y === 'intermediateSum' ||\n point.isIntermediateSum) {\n yData[i] = correctFloat(subSum);\n subSum = 0;\n }\n else {\n sum += y;\n subSum += y;\n }\n dataMin = Math.min(sum, dataMin);\n dataMax = Math.max(sum, dataMax);\n }\n super.processData.call(this, force);\n // Record extremes only if stacking was not set:\n if (!options.stacking) {\n series.dataMin = dataMin + threshold;\n series.dataMax = dataMax;\n }\n return;\n }\n // Return y value or string if point is sum\n toYData(pt) {\n if (pt.isSum) {\n return 'sum';\n }\n if (pt.isIntermediateSum) {\n return 'intermediateSum';\n }\n return pt.y;\n }\n updateParallelArrays(point, i) {\n super.updateParallelArrays.call(this, point, i);\n // Prevent initial sums from triggering an error (#3245, #7559)\n if (this.yData[0] === 'sum' || this.yData[0] === 'intermediateSum') {\n this.yData[0] = null;\n }\n }\n // Postprocess mapping between options and SVG attributes\n pointAttribs(point, state) {\n const upColor = this.options.upColor;\n // Set or reset up color (#3710, update to negative)\n if (upColor && !point.options.color && isNumber(point.y)) {\n point.color = point.y > 0 ? upColor : void 0;\n }\n const attr = ColumnSeries.prototype.pointAttribs.call(this, point, state);\n // The dashStyle option in waterfall applies to the graph, not\n // the points\n delete attr.dashstyle;\n return attr;\n }\n // Return an empty path initially, because we need to know the stroke-width\n // in order to set the final path.\n getGraphPath() {\n return [['M', 0, 0]];\n }\n // Draw columns' connector lines\n getCrispPath() {\n const // Skip points where Y is not a number (#18636)\n data = this.data.filter((d) => isNumber(d.y)), yAxis = this.yAxis, length = data.length, graphNormalizer = Math.round(this.graph.strokeWidth()) % 2 / 2, borderNormalizer = Math.round(this.borderWidth) % 2 / 2, reversedXAxis = this.xAxis.reversed, reversedYAxis = this.yAxis.reversed, stacking = this.options.stacking, path = [];\n for (let i = 1; i < length; i++) {\n if (!( // Skip lines that would pass over the null point (#18636)\n this.options.connectNulls ||\n isNumber(this.data[data[i].index - 1].y))) {\n continue;\n }\n const box = data[i].box, prevPoint = data[i - 1], prevY = prevPoint.y || 0, prevBox = data[i - 1].box;\n if (!box || !prevBox) {\n continue;\n }\n const prevStack = yAxis.waterfall.stacks[this.stackKey], isPos = prevY > 0 ? -prevBox.height : 0;\n if (prevStack && prevBox && box) {\n const prevStackX = prevStack[i - 1];\n // y position of the connector is different when series are\n // stacked, yAxis is reversed and it also depends on point's\n // value\n let yPos;\n if (stacking) {\n const connectorThreshold = prevStackX.connectorThreshold;\n yPos = Math.round((yAxis.translate(connectorThreshold, false, true, false, true) +\n (reversedYAxis ? isPos : 0))) - graphNormalizer;\n }\n else {\n yPos =\n prevBox.y + prevPoint.minPointLengthOffset +\n borderNormalizer - graphNormalizer;\n }\n path.push([\n 'M',\n (prevBox.x || 0) + (reversedXAxis ?\n 0 :\n (prevBox.width || 0)),\n yPos\n ], [\n 'L',\n (box.x || 0) + (reversedXAxis ?\n (box.width || 0) :\n 0),\n yPos\n ]);\n }\n if (prevBox &&\n path.length &&\n ((!stacking && prevY < 0 && !reversedYAxis) ||\n (prevY > 0 && reversedYAxis))) {\n const nextLast = path[path.length - 2];\n if (nextLast && typeof nextLast[2] === 'number') {\n nextLast[2] += prevBox.height || 0;\n }\n const last = path[path.length - 1];\n if (last && typeof last[2] === 'number') {\n last[2] += prevBox.height || 0;\n }\n }\n }\n return path;\n }\n // The graph is initially drawn with an empty definition, then updated with\n // crisp rendering.\n drawGraph() {\n LineSeries.prototype.drawGraph.call(this);\n if (this.graph) {\n this.graph.attr({\n d: this.getCrispPath()\n });\n }\n }\n // Waterfall has stacking along the x-values too.\n setStackedPoints(axis) {\n const series = this, options = series.options, waterfallStacks = axis.waterfall?.stacks, seriesThreshold = options.threshold || 0, stackKey = series.stackKey, xData = series.xData, xLength = xData.length;\n let stackThreshold = seriesThreshold, interSum = stackThreshold, actualStackX, totalYVal = 0, actualSum = 0, prevSum = 0, statesLen, posTotal, negTotal, xPoint, yVal, x, alreadyChanged, changed;\n // Function responsible for calculating correct values for stackState\n // array of each stack item. The arguments are: firstS - the value for\n // the first state, nextS - the difference between the previous and the\n // newest state, sInx - counter used in the for that updates each state\n // when necessary, sOff - offset that must be added to each state when\n // they need to be updated (if point isn't a total sum)\n // eslint-disable-next-line require-jsdoc\n const calculateStackState = (firstS, nextS, sInx, sOff) => {\n if (actualStackX) {\n if (!statesLen) {\n actualStackX.stackState[0] = firstS;\n statesLen = actualStackX.stackState.length;\n }\n else {\n for (sInx; sInx < statesLen; sInx++) {\n actualStackX.stackState[sInx] += sOff;\n }\n }\n actualStackX.stackState.push(actualStackX.stackState[statesLen - 1] + nextS);\n }\n };\n if (axis.stacking && waterfallStacks) {\n // Code responsible for creating stacks for waterfall series\n if (series.reserveSpace()) {\n changed = waterfallStacks.changed;\n alreadyChanged = waterfallStacks.alreadyChanged;\n // In case of a redraw, stack for each x value must be emptied\n // (only for the first series in a specific stack) and\n // recalculated once more\n if (alreadyChanged &&\n alreadyChanged.indexOf(stackKey) < 0) {\n changed = true;\n }\n if (!waterfallStacks[stackKey]) {\n waterfallStacks[stackKey] = {};\n }\n const actualStack = waterfallStacks[stackKey];\n if (actualStack) {\n for (let i = 0; i < xLength; i++) {\n x = xData[i];\n if (!actualStack[x] || changed) {\n actualStack[x] = {\n negTotal: 0,\n posTotal: 0,\n stackTotal: 0,\n threshold: 0,\n stateIndex: 0,\n stackState: [],\n label: ((changed &&\n actualStack[x]) ?\n actualStack[x].label :\n void 0)\n };\n }\n actualStackX = actualStack[x];\n yVal = series.yData[i];\n if (yVal >= 0) {\n actualStackX.posTotal += yVal;\n }\n else {\n actualStackX.negTotal += yVal;\n }\n // Points do not exist yet, so raw data is used\n xPoint = options.data[i];\n posTotal = actualStackX.absolutePos =\n actualStackX.posTotal;\n negTotal = actualStackX.absoluteNeg =\n actualStackX.negTotal;\n actualStackX.stackTotal = posTotal + negTotal;\n statesLen = actualStackX.stackState.length;\n if (xPoint && xPoint.isIntermediateSum) {\n calculateStackState(prevSum, actualSum, 0, prevSum);\n prevSum = actualSum;\n actualSum = seriesThreshold;\n // Swapping values\n stackThreshold ^= interSum;\n interSum ^= stackThreshold;\n stackThreshold ^= interSum;\n }\n else if (xPoint && xPoint.isSum) {\n calculateStackState(seriesThreshold, totalYVal, statesLen, 0);\n stackThreshold = seriesThreshold;\n }\n else {\n calculateStackState(stackThreshold, yVal, 0, totalYVal);\n if (xPoint) {\n totalYVal += yVal;\n actualSum += yVal;\n }\n }\n actualStackX.stateIndex++;\n actualStackX.threshold = stackThreshold;\n stackThreshold += actualStackX.stackTotal;\n }\n }\n waterfallStacks.changed = false;\n if (!waterfallStacks.alreadyChanged) {\n waterfallStacks.alreadyChanged = [];\n }\n waterfallStacks.alreadyChanged.push(stackKey);\n }\n }\n }\n // Extremes for a non-stacked series are recorded in processData.\n // In case of stacking, use Series.stackedYData to calculate extremes.\n getExtremes() {\n const stacking = this.options.stacking;\n let yAxis, waterfallStacks, stackedYNeg, stackedYPos;\n if (stacking) {\n yAxis = this.yAxis;\n waterfallStacks = yAxis.waterfall.stacks;\n stackedYNeg = this.stackedYNeg = [];\n stackedYPos = this.stackedYPos = [];\n // the visible y range can be different when stacking is set to\n // overlap and different when it's set to normal\n if (stacking === 'overlap') {\n objectEach(waterfallStacks[this.stackKey], function (stackX) {\n stackedYNeg.push(arrayMin(stackX.stackState));\n stackedYPos.push(arrayMax(stackX.stackState));\n });\n }\n else {\n objectEach(waterfallStacks[this.stackKey], function (stackX) {\n stackedYNeg.push(stackX.negTotal + stackX.threshold);\n stackedYPos.push(stackX.posTotal + stackX.threshold);\n });\n }\n return {\n dataMin: arrayMin(stackedYNeg),\n dataMax: arrayMax(stackedYPos)\n };\n }\n // When not stacking, data extremes have already been computed in the\n // processData function.\n return {\n dataMin: this.dataMin,\n dataMax: this.dataMax\n };\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nWaterfallSeries.defaultOptions = merge(ColumnSeries.defaultOptions, WaterfallSeriesDefaults);\nWaterfallSeries.compose = WaterfallAxis.compose;\nextend(WaterfallSeries.prototype, {\n pointValKey: 'y',\n // Property needed to prevent lines between the columns from disappearing\n // when negativeColor is used.\n showLine: true,\n pointClass: WaterfallPoint\n});\n// Translate data points from raw values\naddEvent(WaterfallSeries, 'afterColumnTranslate', function () {\n const series = this, { options, points, yAxis } = series, minPointLength = pick(options.minPointLength, 5), halfMinPointLength = minPointLength / 2, threshold = options.threshold || 0, stacking = options.stacking, actualStack = yAxis.waterfall.stacks[series.stackKey];\n let previousIntermediate = threshold, previousY = threshold, y, total, yPos, hPos;\n for (let i = 0; i < points.length; i++) {\n const point = points[i], yValue = series.processedYData[i], shapeArgs = point.shapeArgs, box = extend({\n x: 0,\n y: 0,\n width: 0,\n height: 0\n }, shapeArgs || {});\n point.box = box;\n const range = [0, yValue], pointY = point.y || 0;\n // code responsible for correct positions of stacked points\n // starts here\n if (stacking) {\n if (actualStack) {\n const actualStackX = actualStack[i];\n if (stacking === 'overlap') {\n total =\n actualStackX.stackState[actualStackX.stateIndex--];\n y = pointY >= 0 ? total : total - pointY;\n if (ownProp(actualStackX, 'absolutePos')) {\n delete actualStackX.absolutePos;\n }\n if (ownProp(actualStackX, 'absoluteNeg')) {\n delete actualStackX.absoluteNeg;\n }\n }\n else {\n if (pointY >= 0) {\n total = actualStackX.threshold +\n actualStackX.posTotal;\n actualStackX.posTotal -= pointY;\n y = total;\n }\n else {\n total = actualStackX.threshold +\n actualStackX.negTotal;\n actualStackX.negTotal -= pointY;\n y = total - pointY;\n }\n if (!actualStackX.posTotal) {\n if (isNumber(actualStackX.absolutePos) &&\n ownProp(actualStackX, 'absolutePos')) {\n actualStackX.posTotal =\n actualStackX.absolutePos;\n delete actualStackX.absolutePos;\n }\n }\n if (!actualStackX.negTotal) {\n if (isNumber(actualStackX.absoluteNeg) &&\n ownProp(actualStackX, 'absoluteNeg')) {\n actualStackX.negTotal =\n actualStackX.absoluteNeg;\n delete actualStackX.absoluteNeg;\n }\n }\n }\n if (!point.isSum) {\n // the connectorThreshold property is later used in\n // getCrispPath function to draw a connector line in a\n // correct place\n actualStackX.connectorThreshold =\n actualStackX.threshold + actualStackX.stackTotal;\n }\n if (yAxis.reversed) {\n yPos = (pointY >= 0) ? (y - pointY) : (y + pointY);\n hPos = y;\n }\n else {\n yPos = y;\n hPos = y - pointY;\n }\n point.below = yPos <= threshold;\n box.y = yAxis.translate(yPos, false, true, false, true);\n box.height = Math.abs(box.y -\n yAxis.translate(hPos, false, true, false, true));\n const dummyStackItem = yAxis.waterfall.dummyStackItem;\n if (dummyStackItem) {\n dummyStackItem.x = i;\n dummyStackItem.label = actualStack[i].label;\n dummyStackItem.setOffset(series.pointXOffset || 0, series.barW || 0, series.stackedYNeg[i], series.stackedYPos[i], void 0, this.xAxis);\n }\n }\n }\n else {\n // up points\n y = Math.max(previousY, previousY + pointY) + range[0];\n box.y = yAxis.translate(y, false, true, false, true);\n // sum points\n if (point.isSum) {\n box.y = yAxis.translate(range[1], false, true, false, true);\n box.height = Math.min(yAxis.translate(range[0], false, true, false, true), yAxis.len) - box.y; // #4256\n point.below = range[1] <= threshold;\n }\n else if (point.isIntermediateSum) {\n if (pointY >= 0) {\n yPos = range[1] + previousIntermediate;\n hPos = previousIntermediate;\n }\n else {\n yPos = previousIntermediate;\n hPos = range[1] + previousIntermediate;\n }\n if (yAxis.reversed) {\n // swapping values\n yPos ^= hPos;\n hPos ^= yPos;\n yPos ^= hPos;\n }\n box.y = yAxis.translate(yPos, false, true, false, true);\n box.height = Math.abs(box.y -\n Math.min(yAxis.translate(hPos, false, true, false, true), yAxis.len));\n previousIntermediate += range[1];\n point.below = yPos <= threshold;\n // If it's not the sum point, update previous stack end position\n // and get shape height (#3886)\n }\n else {\n box.height = yValue > 0 ?\n yAxis.translate(previousY, false, true, false, true) - box.y :\n yAxis.translate(previousY, false, true, false, true) - yAxis.translate(previousY - yValue, false, true, false, true);\n previousY += yValue;\n point.below = previousY < threshold;\n }\n // #3952 Negative sum or intermediate sum not rendered correctly\n if (box.height < 0) {\n box.y += box.height;\n box.height *= -1;\n }\n }\n point.plotY = box.y =\n Math.round(box.y || 0) - (series.borderWidth % 2) / 2;\n // #3151\n box.height =\n Math.max(Math.round(box.height || 0), 0.001);\n point.yBottom = box.y + box.height;\n if (box.height <= minPointLength && !point.isNull) {\n box.height = minPointLength;\n box.y -= halfMinPointLength;\n point.plotY = box.y;\n if (pointY < 0) {\n point.minPointLengthOffset = -halfMinPointLength;\n }\n else {\n point.minPointLengthOffset = halfMinPointLength;\n }\n }\n else {\n // #8024, empty gaps in the line for null data\n if (point.isNull) {\n box.width = 0;\n }\n point.minPointLengthOffset = 0;\n }\n // Correct tooltip placement (#3014)\n const tooltipY = point.plotY + (point.negative ? box.height : 0);\n if (point.below) { // #15334\n point.plotY += box.height;\n }\n if (point.tooltipPos) {\n if (series.chart.inverted) {\n point.tooltipPos[0] = yAxis.len - tooltipY;\n }\n else {\n point.tooltipPos[1] = tooltipY;\n }\n }\n // Check point position after recalculation (#16788)\n point.isInside = this.isPointInside(point);\n merge(true, point.shapeArgs, box);\n }\n}, { order: 2 });\nSeriesRegistry.registerSeriesType('waterfall', WaterfallSeries);\n/* *\n *\n * Export\n *\n * */\nexport default WaterfallSeries;\n", "/**\n * @license Highcharts JS v@product.version@ (@product.date@)\n * @module highcharts/highcharts-more\n * @requires highcharts\n *\n * (c) 2009-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */\n'use strict';\nimport Highcharts from '../Core/Globals.js';\nimport SeriesRegistry from '../Core/Series/SeriesRegistry.js';\nimport Pane from '../Extensions/Pane/Pane.js';\nimport '../Series/AreaRange/AreaRangeSeries.js';\nimport '../Series/AreaSplineRange/AreaSplineRangeSeries.js';\nimport '../Series/BoxPlot/BoxPlotSeries.js';\nimport BubbleSeries from '../Series/Bubble/BubbleSeries.js';\nimport '../Series/ColumnRange/ColumnRangeSeries.js';\nimport '../Series/ColumnPyramid/ColumnPyramidSeries.js';\nimport '../Series/ErrorBar/ErrorBarSeries.js';\nimport '../Series/Gauge/GaugeSeries.js';\nimport PackedBubbleSeries from '../Series/PackedBubble/PackedBubbleSeries.js';\nimport '../Series/Polygon/PolygonSeries.js';\nimport PolarAdditions from '../Series/PolarComposition.js';\nimport WaterfallSeries from '../Series/Waterfall/WaterfallSeries.js';\nconst G = Highcharts;\nBubbleSeries.compose(G.Axis, G.Chart, G.Legend, G.Series);\nPackedBubbleSeries.compose(G.Axis, G.Chart, G.Legend, G.Series);\nPane.compose(G.Chart, G.Pointer);\nPolarAdditions.compose(G.Axis, G.Chart, G.Pointer, G.Series, G.Tick, G.Point, SeriesRegistry.seriesTypes.areasplinerange, SeriesRegistry.seriesTypes.column, SeriesRegistry.seriesTypes.line, SeriesRegistry.seriesTypes.spline);\nWaterfallSeries.compose(G.Axis, G.Chart);\nexport default G;\n", "/* *\n *\n * (c) 2010-2024 Christer Vasseng, Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport G from '../Core/Globals.js';\nconst { win } = G;\nimport U from '../Core/Utilities.js';\nconst { discardElement, objectEach } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Perform an Ajax call.\n *\n * @function Highcharts.ajax\n *\n * @param {Highcharts.AjaxSettingsObject} settings\n * The Ajax settings to use.\n *\n * @return {false|undefined}\n * Returns false, if error occurred.\n */\nfunction ajax(settings) {\n const headers = {\n json: 'application/json',\n xml: 'application/xml',\n text: 'text/plain',\n octet: 'application/octet-stream'\n }, r = new XMLHttpRequest();\n /**\n * Private error handler.\n * @private\n * @param {XMLHttpRequest} xhr\n * Internal request object.\n * @param {string|Error} err\n * Occurred error.\n */\n function handleError(xhr, err) {\n if (settings.error) {\n settings.error(xhr, err);\n }\n else {\n // @todo Maybe emit a highcharts error event here\n }\n }\n if (!settings.url) {\n return false;\n }\n r.open((settings.type || 'get').toUpperCase(), settings.url, true);\n if (!settings.headers || !settings.headers['Content-Type']) {\n r.setRequestHeader('Content-Type', headers[settings.dataType || 'json'] || headers.text);\n }\n objectEach(settings.headers, function (val, key) {\n r.setRequestHeader(key, val);\n });\n if (settings.responseType) {\n r.responseType = settings.responseType;\n }\n // @todo lacking timeout handling\n r.onreadystatechange = function () {\n let res;\n if (r.readyState === 4) {\n if (r.status === 200) {\n if (settings.responseType !== 'blob') {\n res = r.responseText;\n if (settings.dataType === 'json') {\n try {\n res = JSON.parse(res);\n }\n catch (e) {\n if (e instanceof Error) {\n return handleError(r, e);\n }\n }\n }\n }\n return settings.success && settings.success(res, r);\n }\n handleError(r, r.responseText);\n }\n };\n if (settings.data && typeof settings.data !== 'string') {\n settings.data = JSON.stringify(settings.data);\n }\n r.send(settings.data);\n}\n/**\n * Get a JSON resource over XHR, also supporting CORS without preflight.\n *\n * @function Highcharts.getJSON\n * @param {string} url\n * The URL to load.\n * @param {Function} success\n * The success callback. For error handling, use the `Highcharts.ajax`\n * function instead.\n */\nfunction getJSON(url, success) {\n HttpUtilities.ajax({\n url: url,\n success: success,\n dataType: 'json',\n headers: {\n // Override the Content-Type to avoid preflight problems with CORS\n // in the Highcharts demos\n 'Content-Type': 'text/plain'\n }\n });\n}\n/**\n * The post utility\n *\n * @private\n * @function Highcharts.post\n *\n * @param {string} url\n * Post URL\n *\n * @param {Object} data\n * Post data\n *\n * @param {RequestInit} [fetchOptions]\n * Additional attributes for the post request\n */\nfunction post(url, data, fetchOptions) {\n const formData = new win.FormData();\n // add the data\n objectEach(data, function (val, name) {\n formData.append(name, val);\n });\n formData.append('b64', 'true');\n const { filename, type } = data;\n return win.fetch(url, {\n method: 'POST',\n body: formData,\n ...fetchOptions\n }).then((res) => {\n if (res.ok) {\n res.text().then((text) => {\n const link = document.createElement('a');\n link.href = `data:${type};base64,${text}`;\n link.download = filename;\n link.click();\n discardElement(link);\n });\n }\n });\n}\n/* *\n *\n * Default Export\n *\n * */\nconst HttpUtilities = {\n ajax,\n getJSON,\n post\n};\nexport default HttpUtilities;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * @interface Highcharts.AjaxSettingsObject\n */ /**\n* The payload to send.\n*\n* @name Highcharts.AjaxSettingsObject#data\n* @type {string|Highcharts.Dictionary|undefined}\n*/ /**\n* The data type expected.\n* @name Highcharts.AjaxSettingsObject#dataType\n* @type {\"json\"|\"xml\"|\"text\"|\"octet\"|undefined}\n*/ /**\n* Function to call on error.\n* @name Highcharts.AjaxSettingsObject#error\n* @type {Function|undefined}\n*/ /**\n* The headers; keyed on header name.\n* @name Highcharts.AjaxSettingsObject#headers\n* @type {Highcharts.Dictionary|undefined}\n*/ /**\n* Function to call on success.\n* @name Highcharts.AjaxSettingsObject#success\n* @type {Function|undefined}\n*/ /**\n* The HTTP method to use. For example GET or POST.\n* @name Highcharts.AjaxSettingsObject#type\n* @type {string|undefined}\n*/ /**\n* The URL to call.\n* @name Highcharts.AjaxSettingsObject#url\n* @type {string}\n*/\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * Data module\n *\n * (c) 2012-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Chart from '../Core/Chart/Chart.js';\nimport D from '../Core/Defaults.js';\nconst { getOptions } = D;\nimport G from '../Core/Globals.js';\nconst { doc } = G;\nimport HU from '../Core/HttpUtilities.js';\nconst { ajax } = HU;\nimport Point from '../Core/Series/Point.js';\nimport SeriesRegistry from '../Core/Series/SeriesRegistry.js';\nconst { seriesTypes } = SeriesRegistry;\nimport U from '../Core/Utilities.js';\nconst { addEvent, defined, extend, fireEvent, isNumber, merge, objectEach, pick, splat } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction getFreeIndexes(numberOfColumns, seriesBuilders) {\n const freeIndexes = [], freeIndexValues = [];\n let s, i, referencedIndexes;\n // Add all columns as free\n for (i = 0; i < numberOfColumns; i = i + 1) {\n freeIndexes.push(true);\n }\n // Loop all defined builders and remove their referenced columns\n for (s = 0; s < seriesBuilders.length; s = s + 1) {\n referencedIndexes = seriesBuilders[s].getReferencedColumnIndexes();\n for (i = 0; i < referencedIndexes.length; i = i + 1) {\n freeIndexes[referencedIndexes[i]] = false;\n }\n }\n // Collect the values for the free indexes\n for (i = 0; i < freeIndexes.length; i = i + 1) {\n if (freeIndexes[i]) {\n freeIndexValues.push(i);\n }\n }\n return freeIndexValues;\n}\nfunction hasURLOption(options) {\n return Boolean(options &&\n (options.rowsURL || options.csvURL || options.columnsURL));\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * The Data class\n *\n * @requires module:modules/data\n *\n * @class\n * @name Highcharts.Data\n *\n * @param {Highcharts.DataOptions} dataOptions\n *\n * @param {Highcharts.Options} [chartOptions]\n *\n * @param {Highcharts.Chart} [chart]\n */\nclass Data {\n /* *\n *\n * Static Properties\n *\n * */\n /**\n * Creates a data object to parse data for a chart.\n *\n * @function Highcharts.data\n */\n static data(dataOptions, chartOptions = {}, chart) {\n return new Data(dataOptions, chartOptions, chart);\n }\n /**\n * Reorganize rows into columns.\n *\n * @function Highcharts.Data.rowsToColumns\n */\n static rowsToColumns(rows) {\n let row, rowsLength, col, colsLength, columns;\n if (rows) {\n columns = [];\n rowsLength = rows.length;\n for (row = 0; row < rowsLength; row++) {\n colsLength = rows[row].length;\n for (col = 0; col < colsLength; col++) {\n if (!columns[col]) {\n columns[col] = [];\n }\n columns[col][row] = rows[row][col];\n }\n }\n }\n return columns;\n }\n /* *\n *\n * Constructors\n *\n * */\n constructor(dataOptions, chartOptions = {}, chart) {\n this.rowsToColumns = Data.rowsToColumns; // backwards compatibility\n /**\n * A collection of available date formats, extendable from the outside to\n * support custom date formats.\n *\n * @name Highcharts.Data#dateFormats\n * @type {Highcharts.Dictionary}\n */\n this.dateFormats = {\n 'YYYY/mm/dd': {\n regex: /^([0-9]{4})[\\-\\/\\.]([0-9]{1,2})[\\-\\/\\.]([0-9]{1,2})$/,\n parser: function (match) {\n return (match ?\n Date.UTC(+match[1], match[2] - 1, +match[3]) :\n NaN);\n }\n },\n 'dd/mm/YYYY': {\n regex: /^([0-9]{1,2})[\\-\\/\\.]([0-9]{1,2})[\\-\\/\\.]([0-9]{4})$/,\n parser: function (match) {\n return (match ?\n Date.UTC(+match[3], match[2] - 1, +match[1]) :\n NaN);\n },\n alternative: 'mm/dd/YYYY' // different format with the same regex\n },\n 'mm/dd/YYYY': {\n regex: /^([0-9]{1,2})[\\-\\/\\.]([0-9]{1,2})[\\-\\/\\.]([0-9]{4})$/,\n parser: function (match) {\n return (match ?\n Date.UTC(+match[3], match[1] - 1, +match[2]) :\n NaN);\n }\n },\n 'dd/mm/YY': {\n regex: /^([0-9]{1,2})[\\-\\/\\.]([0-9]{1,2})[\\-\\/\\.]([0-9]{2})$/,\n parser: function (match) {\n if (!match) {\n return NaN;\n }\n const d = new Date();\n let year = +match[3];\n if (year > (d.getFullYear() - 2000)) {\n year += 1900;\n }\n else {\n year += 2000;\n }\n return Date.UTC(year, match[2] - 1, +match[1]);\n },\n alternative: 'mm/dd/YY' // different format with the same regex\n },\n 'mm/dd/YY': {\n regex: /^([0-9]{1,2})[\\-\\/\\.]([0-9]{1,2})[\\-\\/\\.]([0-9]{2})$/,\n parser: function (match) {\n return (match ?\n Date.UTC(+match[3] + 2000, match[1] - 1, +match[2]) :\n NaN);\n }\n }\n };\n this.chart = chart;\n this.chartOptions = chartOptions;\n this.options = dataOptions;\n this.rawColumns = [];\n this.init(dataOptions, chartOptions, chart);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Initialize the Data object with the given options\n *\n * @private\n * @function Highcharts.Data#init\n */\n init(dataOptions, chartOptions, chart) {\n let decimalPoint = dataOptions.decimalPoint, hasData;\n if (chartOptions) {\n this.chartOptions = chartOptions;\n }\n if (chart) {\n this.chart = chart;\n }\n if (decimalPoint !== '.' && decimalPoint !== ',') {\n decimalPoint = void 0;\n }\n this.options = dataOptions;\n this.columns = (dataOptions.columns ||\n this.rowsToColumns(dataOptions.rows) ||\n []);\n this.firstRowAsNames = pick(dataOptions.firstRowAsNames, this.firstRowAsNames, true);\n this.decimalRegex = (decimalPoint &&\n new RegExp('^(-?[0-9]+)' + decimalPoint + '([0-9]+)$'));\n // Always stop old polling when we have new options\n if (this.liveDataTimeout !== void 0) {\n clearTimeout(this.liveDataTimeout);\n }\n // This is a two-dimensional array holding the raw, trimmed string\n // values with the same organisation as the columns array. It makes it\n // possible for example to revert from interpreted timestamps to\n // string-based categories.\n this.rawColumns = [];\n // No need to parse or interpret anything\n if (this.columns.length) {\n this.dataFound();\n hasData = !hasURLOption(dataOptions);\n }\n if (!hasData) {\n // Fetch live data\n hasData = this.fetchLiveData();\n }\n if (!hasData) {\n // Parse a CSV string if options.csv is given. The parseCSV function\n // returns a columns array, if it has no length, we have no data\n hasData = Boolean(this.parseCSV().length);\n }\n if (!hasData) {\n // Parse a HTML table if options.table is given\n hasData = Boolean(this.parseTable().length);\n }\n if (!hasData) {\n // Parse a Google Spreadsheet\n hasData = this.parseGoogleSpreadsheet();\n }\n if (!hasData && dataOptions.afterComplete) {\n dataOptions.afterComplete();\n }\n }\n /**\n * Get the column distribution. For example, a line series takes a single\n * column for Y values. A range series takes two columns for low and high\n * values respectively, and an OHLC series takes four columns.\n *\n * @function Highcharts.Data#getColumnDistribution\n */\n getColumnDistribution() {\n const chartOptions = this.chartOptions, options = this.options, xColumns = [], getValueCount = function (type) {\n return (seriesTypes[type || 'line'].prototype.pointArrayMap || [0]).length;\n }, getPointArrayMap = function (type) {\n return seriesTypes[type || 'line'].prototype.pointArrayMap;\n }, globalType = (chartOptions &&\n chartOptions.chart &&\n chartOptions.chart.type), individualCounts = [], seriesBuilders = [], \n // If no series mapping is defined, check if the series array is\n // defined with types.\n seriesMapping = ((options && options.seriesMapping) ||\n (chartOptions &&\n chartOptions.series &&\n chartOptions.series.map(function () {\n return { x: 0 };\n })) ||\n []);\n let seriesIndex = 0, i;\n ((chartOptions && chartOptions.series) || []).forEach((series) => {\n individualCounts.push(getValueCount(series.type || globalType));\n });\n // Collect the x-column indexes from seriesMapping\n seriesMapping.forEach((mapping) => {\n xColumns.push(mapping.x || 0);\n });\n // If there are no defined series with x-columns, use the first column\n // as x column\n if (xColumns.length === 0) {\n xColumns.push(0);\n }\n // Loop all seriesMappings and constructs SeriesBuilders from\n // the mapping options.\n seriesMapping.forEach((mapping) => {\n const builder = new SeriesBuilder(), numberOfValueColumnsNeeded = individualCounts[seriesIndex] ||\n getValueCount(globalType), seriesArr = (chartOptions && chartOptions.series) || [], series = seriesArr[seriesIndex] || {}, defaultPointArrayMap = getPointArrayMap(series.type || globalType), pointArrayMap = defaultPointArrayMap || ['y'];\n if (\n // User-defined x.mapping\n defined(mapping.x) ||\n // All non cartesian don't need 'x'\n series.isCartesian ||\n // Except pie series:\n !defaultPointArrayMap) {\n // Add an x reader from the x property or from an undefined\n // column if the property is not set. It will then be auto\n // populated later.\n builder.addColumnReader(mapping.x, 'x');\n }\n // Add all column mappings\n objectEach(mapping, function (val, name) {\n if (name !== 'x') {\n builder.addColumnReader(val, name);\n }\n });\n // Add missing columns\n for (i = 0; i < numberOfValueColumnsNeeded; i++) {\n if (!builder.hasReader(pointArrayMap[i])) {\n // Create and add a column reader for the next free column\n // index\n builder.addColumnReader(void 0, pointArrayMap[i]);\n }\n }\n seriesBuilders.push(builder);\n seriesIndex++;\n });\n let globalPointArrayMap = getPointArrayMap(globalType);\n if (typeof globalPointArrayMap === 'undefined') {\n globalPointArrayMap = ['y'];\n }\n this.valueCount = {\n global: getValueCount(globalType),\n xColumns: xColumns,\n individual: individualCounts,\n seriesBuilders: seriesBuilders,\n globalPointArrayMap: globalPointArrayMap\n };\n }\n /**\n * When the data is parsed into columns, either by CSV, table, GS or direct\n * input, continue with other operations.\n *\n * @private\n * @function Highcharts.Data#dataFound\n */\n dataFound() {\n if (this.options.switchRowsAndColumns) {\n this.columns = this.rowsToColumns(this.columns);\n }\n // Interpret the info about series and columns\n this.getColumnDistribution();\n // Interpret the values into right types\n this.parseTypes();\n // Handle columns if a handleColumns callback is given\n if (this.parsed() !== false) {\n // Complete if a complete callback is given\n this.complete();\n }\n }\n /**\n * Parse a CSV input string\n *\n * @function Highcharts.Data#parseCSV\n */\n parseCSV(inOptions) {\n const self = this, columns = this.columns = [], options = inOptions || this.options, startColumn = (typeof options.startColumn !== 'undefined' &&\n options.startColumn) ? options.startColumn : 0, endColumn = options.endColumn || Number.MAX_VALUE, dataTypes = [], \n // We count potential delimiters in the prepass, and use the\n // result as the basis of half-intelligent guesses.\n potDelimiters = {\n ',': 0,\n ';': 0,\n '\\t': 0\n };\n let csv = options.csv, startRow = (typeof options.startRow !== 'undefined' && options.startRow ?\n options.startRow :\n 0), endRow = options.endRow || Number.MAX_VALUE, itemDelimiter, lines, \n // activeRowNo = 0,\n rowIt = 0;\n /*\n This implementation is quite verbose. It will be shortened once\n it's stable and passes all the test.\n\n It's also not written with speed in mind, instead everything is\n very segregated, and there a several redundant loops.\n This is to make it easier to stabilize the code initially.\n\n We do a pre-pass on the first 4 rows to make some intelligent\n guesses on the set. Guessed delimiters are in this pass counted.\n\n Auto detecting delimiters\n - If we meet a quoted string, the next symbol afterwards\n (that's not \\s, \\t) is the delimiter\n - If we meet a date, the next symbol afterwards is the delimiter\n\n Date formats\n - If we meet a column with date formats, check all of them to\n see if one of the potential months crossing 12. If it does,\n we now know the format\n\n It would make things easier to guess the delimiter before\n doing the actual parsing.\n\n General rules:\n - Quoting is allowed, e.g: \"Col 1\",123,321\n - Quoting is optional, e.g.: Col1,123,321\n - Double quoting is escaping, e.g. \"Col \"\"Hello world\"\"\",123\n - Spaces are considered part of the data: Col1 ,123\n - New line is always the row delimiter\n - Potential column delimiters are , ; \\t\n - First row may optionally contain headers\n - The last row may or may not have a row delimiter\n - Comments are optionally supported, in which case the comment\n must start at the first column, and the rest of the line will\n be ignored\n */\n /**\n * Parse a single row.\n * @private\n */\n function parseRow(columnStr, rowNumber, noAdd, callbacks) {\n let i = 0, c = '', cl = '', cn = '', token = '', actualColumn = 0, column = 0;\n /**\n * @private\n */\n function read(j) {\n c = columnStr[j];\n cl = columnStr[j - 1];\n cn = columnStr[j + 1];\n }\n /**\n * @private\n */\n function pushType(type) {\n if (dataTypes.length < column + 1) {\n dataTypes.push([type]);\n }\n if (dataTypes[column][dataTypes[column].length - 1] !== type) {\n dataTypes[column].push(type);\n }\n }\n /**\n * @private\n */\n function push() {\n if (startColumn > actualColumn || actualColumn > endColumn) {\n // Skip this column, but increment the column count (#7272)\n ++actualColumn;\n token = '';\n return;\n }\n if (!options.columnTypes) {\n if (!isNaN(parseFloat(token)) && isFinite(token)) {\n token = parseFloat(token);\n pushType('number');\n }\n else if (!isNaN(Date.parse(token))) {\n token = token.replace(/\\//g, '-');\n pushType('date');\n }\n else {\n pushType('string');\n }\n }\n if (columns.length < column + 1) {\n columns.push([]);\n }\n if (!noAdd) {\n // Don't push - if there's a varying amount of columns\n // for each row, pushing will skew everything down n slots\n columns[column][rowNumber] = token;\n }\n token = '';\n ++column;\n ++actualColumn;\n }\n if (!columnStr.trim().length) {\n return;\n }\n if (columnStr.trim()[0] === '#') {\n return;\n }\n for (; i < columnStr.length; i++) {\n read(i);\n if (c === '\"') {\n read(++i);\n while (i < columnStr.length) {\n if (c === '\"' && cl !== '\"' && cn !== '\"') {\n break;\n }\n if (c !== '\"' || (c === '\"' && cl !== '\"')) {\n token += c;\n }\n read(++i);\n }\n // Perform \"plugin\" handling\n }\n else if (callbacks && callbacks[c]) {\n if (callbacks[c](c, token)) {\n push();\n }\n // Delimiter - push current token\n }\n else if (c === itemDelimiter) {\n push();\n // Actual column data\n }\n else {\n token += c;\n }\n }\n push();\n }\n /**\n * Attempt to guess the delimiter. We do a separate parse pass here\n * because we need to count potential delimiters softly without making\n * any assumptions.\n * @private\n */\n function guessDelimiter(lines) {\n let points = 0, commas = 0, guessed = false;\n lines.some(function (columnStr, i) {\n let inStr = false, c, cn, cl, token = '';\n // We should be able to detect dateformats within 13 rows\n if (i > 13) {\n return true;\n }\n for (let j = 0; j < columnStr.length; j++) {\n c = columnStr[j];\n cn = columnStr[j + 1];\n cl = columnStr[j - 1];\n if (c === '#') {\n // Skip the rest of the line - it's a comment\n return;\n }\n if (c === '\"') {\n if (inStr) {\n if (cl !== '\"' && cn !== '\"') {\n while (cn === ' ' && j < columnStr.length) {\n cn = columnStr[++j];\n }\n // After parsing a string, the next non-blank\n // should be a delimiter if the CSV is properly\n // formed.\n if (typeof potDelimiters[cn] !== 'undefined') {\n potDelimiters[cn]++;\n }\n inStr = false;\n }\n }\n else {\n inStr = true;\n }\n }\n else if (typeof potDelimiters[c] !== 'undefined') {\n token = token.trim();\n if (!isNaN(Date.parse(token))) {\n potDelimiters[c]++;\n }\n else if (isNaN(token) ||\n !isFinite(token)) {\n potDelimiters[c]++;\n }\n token = '';\n }\n else {\n token += c;\n }\n if (c === ',') {\n commas++;\n }\n if (c === '.') {\n points++;\n }\n }\n });\n // Count the potential delimiters.\n // This could be improved by checking if the number of delimiters\n // equals the number of columns - 1\n if (potDelimiters[';'] > potDelimiters[',']) {\n guessed = ';';\n }\n else if (potDelimiters[','] > potDelimiters[';']) {\n guessed = ',';\n }\n else {\n // No good guess could be made..\n guessed = ',';\n }\n // Try to deduce the decimal point if it's not explicitly set.\n // If both commas or points is > 0 there is likely an issue\n if (!options.decimalPoint) {\n if (points > commas) {\n options.decimalPoint = '.';\n }\n else {\n options.decimalPoint = ',';\n }\n // Apply a new decimal regex based on the presumed decimal sep.\n self.decimalRegex = new RegExp('^(-?[0-9]+)' +\n options.decimalPoint +\n '([0-9]+)$');\n }\n return guessed;\n }\n /**\n * Tries to guess the date format\n * - Check if either month candidate exceeds 12\n * - Check if year is missing (use current year)\n * - Check if a shortened year format is used (e.g. 1/1/99)\n * - If no guess can be made, the user must be prompted\n * data is the data to deduce a format based on\n * @private\n */\n function deduceDateFormat(data, limit) {\n const format = 'YYYY/mm/dd', stable = [], max = [];\n let thing, guessedFormat = [], calculatedFormat, i = 0, madeDeduction = false, \n // candidates = {},\n j;\n if (!limit || limit > data.length) {\n limit = data.length;\n }\n for (; i < limit; i++) {\n if (typeof data[i] !== 'undefined' &&\n data[i] && data[i].length) {\n thing = data[i]\n .trim()\n .replace(/\\//g, ' ')\n .replace(/\\-/g, ' ')\n .replace(/\\./g, ' ')\n .split(' ');\n guessedFormat = [\n '',\n '',\n ''\n ];\n for (j = 0; j < thing.length; j++) {\n if (j < guessedFormat.length) {\n thing[j] = parseInt(thing[j], 10);\n if (thing[j]) {\n max[j] = (!max[j] || max[j] < thing[j]) ?\n thing[j] :\n max[j];\n if (typeof stable[j] !== 'undefined') {\n if (stable[j] !== thing[j]) {\n stable[j] = false;\n }\n }\n else {\n stable[j] = thing[j];\n }\n if (thing[j] > 31) {\n if (thing[j] < 100) {\n guessedFormat[j] = 'YY';\n }\n else {\n guessedFormat[j] = 'YYYY';\n }\n // madeDeduction = true;\n }\n else if (thing[j] > 12 &&\n thing[j] <= 31) {\n guessedFormat[j] = 'dd';\n madeDeduction = true;\n }\n else if (!guessedFormat[j].length) {\n guessedFormat[j] = 'mm';\n }\n }\n }\n }\n }\n }\n if (madeDeduction) {\n // This handles a few edge cases with hard to guess dates\n for (j = 0; j < stable.length; j++) {\n if (stable[j] !== false) {\n if (max[j] > 12 &&\n guessedFormat[j] !== 'YY' &&\n guessedFormat[j] !== 'YYYY') {\n guessedFormat[j] = 'YY';\n }\n }\n else if (max[j] > 12 && guessedFormat[j] === 'mm') {\n guessedFormat[j] = 'dd';\n }\n }\n // If the middle one is dd, and the last one is dd,\n // the last should likely be year.\n if (guessedFormat.length === 3 &&\n guessedFormat[1] === 'dd' &&\n guessedFormat[2] === 'dd') {\n guessedFormat[2] = 'YY';\n }\n calculatedFormat = guessedFormat.join('/');\n // If the calculated format is not valid, we need to present an\n // error.\n if (!(options.dateFormats || self.dateFormats)[calculatedFormat]) {\n // This should emit an event instead\n fireEvent('deduceDateFailed');\n return format;\n }\n return calculatedFormat;\n }\n return format;\n }\n /**\n * @todo\n * Figure out the best axis types for the data\n * - If the first column is a number, we're good\n * - If the first column is a date, set to date/time\n * - If the first column is a string, set to categories\n * @private\n */\n function deduceAxisTypes() {\n }\n if (csv && options.beforeParse) {\n csv = options.beforeParse.call(this, csv);\n }\n if (csv) {\n lines = csv\n .replace(/\\r\\n/g, '\\n') // Unix\n .replace(/\\r/g, '\\n') // Mac\n .split(options.lineDelimiter || '\\n');\n if (!startRow || startRow < 0) {\n startRow = 0;\n }\n if (!endRow || endRow >= lines.length) {\n endRow = lines.length - 1;\n }\n if (options.itemDelimiter) {\n itemDelimiter = options.itemDelimiter;\n }\n else {\n itemDelimiter = null;\n itemDelimiter = guessDelimiter(lines);\n }\n let offset = 0;\n for (rowIt = startRow; rowIt <= endRow; rowIt++) {\n if (lines[rowIt][0] === '#') {\n offset++;\n }\n else {\n parseRow(lines[rowIt], rowIt - startRow - offset);\n }\n }\n // //Make sure that there's header columns for everything\n // columns.forEach(function (col) {\n // });\n deduceAxisTypes();\n if ((!options.columnTypes || options.columnTypes.length === 0) &&\n dataTypes.length &&\n dataTypes[0].length &&\n dataTypes[0][1] === 'date' &&\n !options.dateFormat) {\n options.dateFormat = deduceDateFormat(columns[0]);\n }\n // lines.forEach(function (line, rowNo) {\n // let trimmed = self.trim(line),\n // isComment = trimmed.indexOf('#') === 0,\n // isBlank = trimmed === '',\n // items;\n // if (\n // rowNo >= startRow &&\n // rowNo <= endRow &&\n // !isComment && !isBlank\n // ) {\n // items = line.split(itemDelimiter);\n // items.forEach(function (item, colNo) {\n // if (colNo >= startColumn && colNo <= endColumn) {\n // if (!columns[colNo - startColumn]) {\n // columns[colNo - startColumn] = [];\n // }\n // columns[colNo - startColumn][activeRowNo] = item;\n // }\n // });\n // activeRowNo += 1;\n // }\n // });\n //\n this.dataFound();\n }\n return columns;\n }\n /**\n * Parse a HTML table\n *\n * @function Highcharts.Data#parseTable\n */\n parseTable() {\n const options = this.options, columns = this.columns || [], startRow = options.startRow || 0, endRow = options.endRow || Number.MAX_VALUE, startColumn = options.startColumn || 0, endColumn = options.endColumn || Number.MAX_VALUE;\n if (options.table) {\n let table = options.table;\n if (typeof table === 'string') {\n table = doc.getElementById(table);\n }\n [].forEach.call(table.getElementsByTagName('tr'), (tr, rowNo) => {\n if (rowNo >= startRow && rowNo <= endRow) {\n [].forEach.call(tr.children, (item, colNo) => {\n const row = columns[colNo - startColumn];\n let i = 1;\n if ((item.tagName === 'TD' ||\n item.tagName === 'TH') &&\n colNo >= startColumn &&\n colNo <= endColumn) {\n if (!columns[colNo - startColumn]) {\n columns[colNo - startColumn] = [];\n }\n columns[colNo - startColumn][rowNo - startRow] = item.innerHTML;\n // Loop over all previous indices and make sure\n // they are nulls, not undefined.\n while (rowNo - startRow >= i &&\n row[rowNo - startRow - i] === void 0) {\n row[rowNo - startRow - i] = null;\n i++;\n }\n }\n });\n }\n });\n this.dataFound(); // continue\n }\n return columns;\n }\n /**\n * Fetch or refetch live data\n *\n * @function Highcharts.Data#fetchLiveData\n *\n * @return {boolean}\n * The URLs that were tried can be found in the options\n */\n fetchLiveData() {\n const data = this, chart = this.chart, options = this.options, maxRetries = 3, pollingEnabled = options.enablePolling, originalOptions = merge(options);\n let currentRetries = 0, updateIntervalMs = (options.dataRefreshRate || 2) * 1000;\n if (!hasURLOption(options)) {\n return false;\n }\n // Do not allow polling more than once a second\n if (updateIntervalMs < 1000) {\n updateIntervalMs = 1000;\n }\n delete options.csvURL;\n delete options.rowsURL;\n delete options.columnsURL;\n /**\n * @private\n */\n function performFetch(initialFetch) {\n /**\n * Helper function for doing the data fetch + polling.\n * @private\n */\n function request(url, done, tp) {\n if (!url ||\n !/^(http|\\/|\\.\\/|\\.\\.\\/)/.test(url)) {\n if (url && options.error) {\n options.error('Invalid URL');\n }\n return false;\n }\n if (initialFetch) {\n clearTimeout(data.liveDataTimeout);\n chart.liveDataURL = url;\n }\n /**\n * @private\n */\n function poll() {\n // Poll\n if (pollingEnabled && chart.liveDataURL === url) {\n // We need to stop doing this if the URL has changed\n data.liveDataTimeout =\n setTimeout(performFetch, updateIntervalMs);\n }\n }\n ajax({\n url: url,\n dataType: tp || 'json',\n success: function (res) {\n if (chart && chart.series) {\n done(res);\n }\n poll();\n },\n error: function (xhr, text) {\n if (++currentRetries < maxRetries) {\n poll();\n }\n return options.error && options.error(text, xhr);\n }\n });\n return true;\n }\n if (!request(originalOptions.csvURL, function (res) {\n chart.update({\n data: {\n csv: res\n }\n });\n }, 'text')) {\n if (!request(originalOptions.rowsURL, function (res) {\n chart.update({\n data: {\n rows: res\n }\n });\n })) {\n request(originalOptions.columnsURL, function (res) {\n chart.update({\n data: {\n columns: res\n }\n });\n });\n }\n }\n }\n performFetch(true);\n return hasURLOption(options);\n }\n /**\n * Parse a Google spreadsheet.\n *\n * @function Highcharts.Data#parseGoogleSpreadsheet\n *\n * @return {boolean}\n * Always returns false, because it is an intermediate fetch.\n */\n parseGoogleSpreadsheet() {\n const data = this, options = this.options, googleSpreadsheetKey = options.googleSpreadsheetKey, chart = this.chart, refreshRate = Math.max((options.dataRefreshRate || 2) * 1000, 4000);\n /**\n * Form the `values` field after range settings, unless the\n * googleSpreadsheetRange option is set.\n */\n const getRange = () => {\n if (options.googleSpreadsheetRange) {\n return options.googleSpreadsheetRange;\n }\n const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n const start = (alphabet.charAt(options.startColumn || 0) || 'A') +\n ((options.startRow || 0) + 1);\n let end = alphabet.charAt(pick(options.endColumn, -1)) || 'ZZ';\n if (defined(options.endRow)) {\n end += options.endRow + 1;\n }\n return `${start}:${end}`;\n };\n /**\n * Fetch the actual spreadsheet using XMLHttpRequest.\n * @private\n */\n function fetchSheet(fn) {\n const url = [\n 'https://sheets.googleapis.com/v4/spreadsheets',\n googleSpreadsheetKey,\n 'values',\n getRange(),\n '?alt=json&' +\n 'majorDimension=COLUMNS&' +\n 'valueRenderOption=UNFORMATTED_VALUE&' +\n 'dateTimeRenderOption=FORMATTED_STRING&' +\n 'key=' + options.googleAPIKey\n ].join('/');\n ajax({\n url,\n dataType: 'json',\n success: function (json) {\n fn(json);\n if (options.enablePolling) {\n data.liveDataTimeout = setTimeout(function () {\n fetchSheet(fn);\n }, refreshRate);\n }\n },\n error: function (xhr, text) {\n return options.error && options.error(text, xhr);\n }\n });\n }\n if (googleSpreadsheetKey) {\n delete options.googleSpreadsheetKey;\n fetchSheet(function (json) {\n // Prepare the data from the spreadsheet\n const columns = json.values;\n if (!columns || columns.length === 0) {\n return false;\n }\n // Find the maximum row count in order to extend shorter columns\n const rowCount = columns.reduce((rowCount, column) => Math.max(rowCount, column.length), 0);\n // Insert null for empty spreadsheet cells (#5298)\n columns.forEach((column) => {\n for (let i = 0; i < rowCount; i++) {\n if (typeof column[i] === 'undefined') {\n column[i] = null;\n }\n }\n });\n if (chart && chart.series) {\n chart.update({\n data: {\n columns: columns\n }\n });\n }\n else { // #8245\n data.columns = columns;\n data.dataFound();\n }\n });\n }\n // This is an intermediate fetch, so always return false.\n return false;\n }\n /**\n * Trim a string from whitespaces.\n *\n * @function Highcharts.Data#trim\n *\n * @param {string} str\n * String to trim\n *\n * @param {boolean} [inside=false]\n * Remove all spaces between numbers.\n *\n * @return {string}\n * Trimed string\n */\n trim(str, inside) {\n if (typeof str === 'string') {\n str = str.replace(/^\\s+|\\s+$/g, '');\n // Clear white space inside the string, like thousands separators\n if (inside && /^-?[0-9\\s]+$/.test(str)) {\n str = str.replace(/\\s/g, '');\n }\n if (this.decimalRegex) {\n str = str.replace(this.decimalRegex, '$1.$2');\n }\n }\n return str;\n }\n /**\n * Parse numeric cells in to number types and date types in to true dates.\n *\n * @function Highcharts.Data#parseTypes\n */\n parseTypes() {\n const columns = this.columns || [];\n let col = columns.length;\n while (col--) {\n this.parseColumn(columns[col], col);\n }\n }\n /**\n * Parse a single column. Set properties like .isDatetime and .isNumeric.\n *\n * @function Highcharts.Data#parseColumn\n *\n * @param {Array} column\n * Column to parse\n *\n * @param {number} col\n * Column index\n */\n parseColumn(column, col) {\n const rawColumns = this.rawColumns, columns = this.columns, firstRowAsNames = this.firstRowAsNames, isXColumn = this.valueCount.xColumns.indexOf(col) !== -1, backup = [], chartOptions = this.chartOptions, columnTypes = this.options.columnTypes || [], columnType = columnTypes[col], forceCategory = (isXColumn &&\n (chartOptions &&\n chartOptions.xAxis &&\n splat(chartOptions.xAxis)[0].type === 'category')) || columnType === 'string', columnHasName = defined(column.name);\n let row = column.length, val, floatVal, trimVal, trimInsideVal, dateVal, diff, descending;\n if (!rawColumns[col]) {\n rawColumns[col] = [];\n }\n while (row--) {\n val = backup[row] || column[row];\n trimVal = this.trim(val);\n trimInsideVal = this.trim(val, true);\n floatVal = parseFloat(trimInsideVal);\n // Set it the first time\n if (typeof rawColumns[col][row] === 'undefined') {\n rawColumns[col][row] = trimVal;\n }\n // Disable number or date parsing by setting the X axis type to\n // category\n if (forceCategory ||\n (row === 0 && firstRowAsNames && !columnHasName)) {\n column[row] = '' + trimVal;\n }\n else if (+trimInsideVal === floatVal) { // is numeric\n column[row] = floatVal;\n // If the number is greater than milliseconds in a year, assume\n // datetime\n if (floatVal > 365 * 24 * 3600 * 1000 &&\n columnType !== 'float') {\n column.isDatetime = true;\n }\n else {\n column.isNumeric = true;\n }\n if (typeof column[row + 1] !== 'undefined') {\n descending = floatVal > column[row + 1];\n }\n // String, continue to determine if it is a date string or really a\n // string\n }\n else {\n if (trimVal && trimVal.length) {\n dateVal = this.parseDate(val);\n }\n // Only allow parsing of dates if this column is an x-column\n if (isXColumn && isNumber(dateVal) && columnType !== 'float') {\n backup[row] = val;\n column[row] = dateVal;\n column.isDatetime = true;\n // Check if the dates are uniformly descending or ascending.\n // If they are not, chances are that they are a different\n // time format, so check for alternative.\n if (typeof column[row + 1] !== 'undefined') {\n diff = dateVal > column[row + 1];\n if (diff !== descending &&\n typeof descending !== 'undefined') {\n if (this.alternativeFormat) {\n this.dateFormat = this.alternativeFormat;\n row = column.length;\n this.alternativeFormat =\n this.dateFormats[this.dateFormat]\n .alternative;\n }\n else {\n column.unsorted = true;\n }\n }\n descending = diff;\n }\n }\n else { // string\n column[row] = trimVal === '' ? null : trimVal;\n if (row !== 0 &&\n (column.isDatetime ||\n column.isNumeric)) {\n column.mixed = true;\n }\n }\n }\n }\n // If strings are intermixed with numbers or dates in a parsed column,\n // it is an indication that parsing went wrong or the data was not\n // intended to display as numbers or dates and parsing is too\n // aggressive. Fall back to categories. Demonstrated in the\n // highcharts/demo/column-drilldown sample.\n if (isXColumn && column.mixed) {\n columns[col] = rawColumns[col];\n }\n // If the 0 column is date or number and descending, reverse all\n // columns.\n if (isXColumn && descending && this.options.sort) {\n for (col = 0; col < columns.length; col++) {\n columns[col].reverse();\n if (firstRowAsNames) {\n columns[col].unshift(columns[col].pop());\n }\n }\n }\n }\n /**\n * Parse a date and return it as a number. Overridable through\n * `options.parseDate`.\n *\n * @function Highcharts.Data#parseDate\n */\n parseDate(val) {\n const parseDate = this.options.parseDate;\n let ret, key, format, dateFormat = this.options.dateFormat || this.dateFormat, match;\n if (parseDate) {\n ret = parseDate(val);\n }\n else if (typeof val === 'string') {\n // Auto-detect the date format the first time\n if (!dateFormat) {\n for (key in this.dateFormats) { // eslint-disable-line guard-for-in\n format = this.dateFormats[key];\n match = val.match(format.regex);\n if (match) {\n this.dateFormat = dateFormat = key;\n this.alternativeFormat = format.alternative;\n ret = format.parser(match);\n break;\n }\n }\n // Next time, use the one previously found\n }\n else {\n format = this.dateFormats[dateFormat];\n if (!format) {\n // The selected format is invalid\n format = this.dateFormats['YYYY/mm/dd'];\n }\n match = val.match(format.regex);\n if (match) {\n ret = format.parser(match);\n }\n }\n // Fall back to Date.parse\n if (!match) {\n if (val.match(/:.+(GMT|UTC|[Z+-])/)) {\n val = val\n .replace(/\\s*(?:GMT|UTC)?([+-])(\\d\\d)(\\d\\d)$/, '$1$2:$3')\n .replace(/(?:\\s+|GMT|UTC)([+-])/, '$1')\n .replace(/(\\d)\\s*(?:GMT|UTC|Z)$/, '$1+00:00');\n }\n match = Date.parse(val);\n // External tools like Date.js and MooTools extend Date object\n // and return a date.\n if (typeof match === 'object' &&\n match !== null &&\n match.getTime) {\n ret = (match.getTime() -\n match.getTimezoneOffset() *\n 60000);\n // Timestamp\n }\n else if (isNumber(match)) {\n ret = match - (new Date(match)).getTimezoneOffset() * 60000;\n }\n }\n }\n return ret;\n }\n /**\n * Get the parsed data in a form that we can apply directly to the\n * `series.data` config. Array positions can be mapped using the\n * `series.keys` option.\n *\n * @example\n * const data = Highcharts.data({\n * csv: document.getElementById('data').innerHTML\n * }).getData();\n *\n * @function Highcharts.Data#getData\n *\n * @return {Array>|undefined} Data rows\n */\n getData() {\n if (this.columns) {\n return this.rowsToColumns(this.columns).slice(1);\n }\n }\n /**\n * A hook for working directly on the parsed columns\n *\n * @function Highcharts.Data#parsed\n */\n parsed() {\n if (this.options.parsed) {\n return this.options.parsed.call(this, this.columns);\n }\n }\n /**\n * If a complete callback function is provided in the options, interpret the\n * columns into a Highcharts options object.\n *\n * @function Highcharts.Data#complete\n */\n complete() {\n const columns = this.columns, xColumns = [], options = this.options, allSeriesBuilders = [];\n let type, series, data, i, j, r, seriesIndex, chartOptions, builder, freeIndexes, typeCol, index;\n xColumns.length = columns.length;\n if (options.complete || options.afterComplete) {\n // Get the names and shift the top row\n if (this.firstRowAsNames) {\n for (i = 0; i < columns.length; i++) {\n const curCol = columns[i];\n if (!defined(curCol.name)) {\n curCol.name = pick(curCol.shift(), '').toString();\n }\n }\n }\n // Use the next columns for series\n series = [];\n freeIndexes = getFreeIndexes(columns.length, this.valueCount.seriesBuilders);\n // Populate defined series\n for (seriesIndex = 0; seriesIndex < this.valueCount.seriesBuilders.length; seriesIndex++) {\n builder = this.valueCount.seriesBuilders[seriesIndex];\n // If the builder can be populated with remaining columns, then\n // add it to allBuilders\n if (builder.populateColumns(freeIndexes)) {\n allSeriesBuilders.push(builder);\n }\n }\n // Populate dynamic series\n while (freeIndexes.length > 0) {\n builder = new SeriesBuilder();\n builder.addColumnReader(0, 'x');\n // Mark index as used (not free)\n index = freeIndexes.indexOf(0);\n if (index !== -1) {\n freeIndexes.splice(index, 1);\n }\n for (i = 0; i < this.valueCount.global; i++) {\n // Create and add a column reader for the next free column\n // index\n builder.addColumnReader(void 0, this.valueCount.globalPointArrayMap[i]);\n }\n // If the builder can be populated with remaining columns, then\n // add it to allBuilders\n if (builder.populateColumns(freeIndexes)) {\n allSeriesBuilders.push(builder);\n }\n }\n // Get the data-type from the first series x column\n if (allSeriesBuilders.length > 0 &&\n allSeriesBuilders[0].readers.length > 0) {\n typeCol = columns[allSeriesBuilders[0].readers[0].columnIndex];\n if (typeof typeCol !== 'undefined') {\n if (typeCol.isDatetime) {\n type = 'datetime';\n }\n else if (!typeCol.isNumeric) {\n type = 'category';\n }\n }\n }\n // Axis type is category, then the \"x\" column should be called\n // \"name\"\n if (type === 'category') {\n for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) {\n builder = allSeriesBuilders[seriesIndex];\n for (r = 0; r < builder.readers.length; r++) {\n if (builder.readers[r].configName === 'x') {\n builder.readers[r].configName = 'name';\n }\n }\n }\n }\n // Read data for all builders\n for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) {\n builder = allSeriesBuilders[seriesIndex];\n // Iterate down the cells of each column and add data to the\n // series\n data = [];\n for (j = 0; j < columns[0].length; j++) {\n data[j] = builder.read(columns, j);\n }\n // Add the series\n series[seriesIndex] = {\n data: data\n };\n if (builder.name) {\n series[seriesIndex].name = builder.name;\n }\n if (type === 'category') {\n series[seriesIndex].turboThreshold = 0;\n }\n }\n // Do the callback\n chartOptions = {\n series: series\n };\n if (type) {\n chartOptions.xAxis = {\n type: type\n };\n if (type === 'category') {\n chartOptions.xAxis.uniqueNames = false;\n }\n }\n if (options.complete) {\n options.complete(chartOptions);\n }\n // The afterComplete hook is used internally to avoid conflict with\n // the externally available complete option.\n if (options.afterComplete) {\n options.afterComplete(chartOptions);\n }\n }\n }\n /**\n * Updates the chart with new data options.\n *\n * @function Highcharts.Data#update\n *\n * @param {Highcharts.DataOptions} options\n *\n * @param {boolean} [redraw=true]\n */\n update(options, redraw) {\n const chart = this.chart, chartOptions = chart.options;\n if (options) {\n // Set the complete handler\n options.afterComplete = function (dataOptions) {\n // Avoid setting axis options unless the type changes. Running\n // Axis.update will cause the whole structure to be destroyed\n // and rebuilt, and animation is lost.\n if (dataOptions) {\n if (dataOptions.xAxis &&\n chart.xAxis[0] &&\n dataOptions.xAxis.type ===\n chart.xAxis[0].options.type) {\n delete dataOptions.xAxis;\n }\n // @todo looks not right:\n chart.update(dataOptions, redraw, true);\n }\n };\n // Apply it\n merge(true, chartOptions.data, options);\n // Reset columns if fetching spreadsheet, to force a re-fetch\n if (chartOptions.data && chartOptions.data.googleSpreadsheetKey &&\n !options.columns) {\n delete chartOptions.data.columns;\n }\n this.init(chartOptions.data);\n }\n }\n}\n// Extend Chart.init so that the Chart constructor accepts a new configuration\n// option group, data.\naddEvent(Chart, 'init', function (e) {\n const chart = this, callback = e.args[1], defaultDataOptions = getOptions().data;\n let userOptions = (e.args[0] || {});\n if ((defaultDataOptions || userOptions && userOptions.data) &&\n !chart.hasDataDef) {\n chart.hasDataDef = true;\n /**\n * The data parser for this chart.\n *\n * @name Highcharts.Chart#data\n * @type {Highcharts.Data|undefined}\n */\n const dataOptions = merge(defaultDataOptions, userOptions.data);\n chart.data = new Data(extend(dataOptions, {\n afterComplete: function (dataOptions) {\n let i, series;\n // Merge series configs\n if (Object.hasOwnProperty.call(userOptions, 'series')) {\n if (typeof userOptions.series === 'object') {\n i = Math.max(userOptions.series.length, dataOptions && dataOptions.series ?\n dataOptions.series.length :\n 0);\n while (i--) {\n series = userOptions.series[i] || {};\n userOptions.series[i] = merge(series, dataOptions && dataOptions.series ?\n dataOptions.series[i] :\n {});\n }\n }\n else { // Allow merging in dataOptions.series (#2856)\n delete userOptions.series;\n }\n }\n // Do the merge\n userOptions = merge(dataOptions, userOptions);\n // Run chart.init again\n chart.init(userOptions, callback);\n }\n }), userOptions, chart);\n e.preventDefault();\n }\n});\n/**\n * Creates a new SeriesBuilder. A SeriesBuilder consists of a number\n * of ColumnReaders that reads columns and give them a name.\n * Ex: A series builder can be constructed to read column 3 as 'x' and\n * column 7 and 8 as 'y1' and 'y2'.\n * The output would then be points/rows of the form {x: 11, y1: 22, y2: 33}\n *\n * The name of the builder is taken from the second column. In the above\n * example it would be the column with index 7.\n *\n * @private\n * @class\n * @name SeriesBuilder\n */\nclass SeriesBuilder {\n constructor() {\n /* eslint-disable no-invalid-this */\n this.readers = [];\n this.pointIsArray = true;\n }\n /**\n * Populates readers with column indexes. A reader can be added without\n * a specific index and for those readers the index is taken sequentially\n * from the free columns (this is handled by the ColumnCursor instance).\n *\n * @function SeriesBuilder#populateColumns\n */\n populateColumns(freeIndexes) {\n const builder = this;\n let enoughColumns = true;\n // Loop each reader and give it an index if its missing.\n // The freeIndexes.shift() will return undefined if there\n // are no more columns.\n builder.readers.forEach((reader) => {\n if (typeof reader.columnIndex === 'undefined') {\n reader.columnIndex = freeIndexes.shift();\n }\n });\n // Now, all readers should have columns mapped. If not\n // then return false to signal that this series should\n // not be added.\n builder.readers.forEach((reader) => {\n if (typeof reader.columnIndex === 'undefined') {\n enoughColumns = false;\n }\n });\n return enoughColumns;\n }\n /**\n * Reads a row from the dataset and returns a point or array depending\n * on the names of the readers.\n *\n * @function SeriesBuilder#read\n */\n read(columns, rowIndex) {\n const builder = this, pointIsArray = builder.pointIsArray, point = pointIsArray ? [] : {};\n // Loop each reader and ask it to read its value.\n // Then, build an array or point based on the readers names.\n builder.readers.forEach((reader) => {\n const value = columns[reader.columnIndex][rowIndex];\n if (pointIsArray) {\n point.push(value);\n }\n else {\n if (reader.configName.indexOf('.') > 0) {\n // Handle nested property names\n Point.prototype.setNestedProperty(point, value, reader.configName);\n }\n else {\n point[reader.configName] = value;\n }\n }\n });\n // The name comes from the first column (excluding the x column)\n if (typeof this.name === 'undefined' && builder.readers.length >= 2) {\n const columnIndexes = [];\n builder.readers.forEach(function (reader) {\n if (reader.configName === 'x' ||\n reader.configName === 'name' ||\n reader.configName === 'y') {\n if (typeof reader.columnIndex !== 'undefined') {\n columnIndexes.push(reader.columnIndex);\n }\n }\n });\n if (columnIndexes.length >= 2) {\n // Remove the first one (x col)\n columnIndexes.shift();\n // Sort the remaining\n columnIndexes.sort(function (a, b) {\n return a - b;\n });\n }\n // Now use the lowest index as name column\n this.name = columns[pick(columnIndexes.shift(), 0)].name;\n }\n return point;\n }\n /**\n * Creates and adds ColumnReader from the given columnIndex and configName.\n * ColumnIndex can be undefined and in that case the reader will be given\n * an index when columns are populated.\n *\n * @function SeriesBuilder#addColumnReader\n */\n addColumnReader(columnIndex, configName) {\n this.readers.push({\n columnIndex: columnIndex,\n configName: configName\n });\n if (!(configName === 'x' ||\n configName === 'y' ||\n typeof configName === 'undefined')) {\n this.pointIsArray = false;\n }\n }\n /**\n * Returns an array of column indexes that the builder will use when\n * reading data.\n *\n * @function SeriesBuilder#getReferencedColumnIndexes\n */\n getReferencedColumnIndexes() {\n const referencedColumnIndexes = [];\n let i, columnReader;\n for (i = 0; i < this.readers.length; i = i + 1) {\n columnReader = this.readers[i];\n if (typeof columnReader.columnIndex !== 'undefined') {\n referencedColumnIndexes.push(columnReader.columnIndex);\n }\n }\n return referencedColumnIndexes;\n }\n /**\n * Returns true if the builder has a reader for the given configName.\n *\n * @function SeriesBuilder#hasReader\n */\n hasReader(configName) {\n let i, columnReader;\n for (i = 0; i < this.readers.length; i = i + 1) {\n columnReader = this.readers[i];\n if (columnReader.configName === configName) {\n return true;\n }\n }\n // Else return undefined\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default Data;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Callback function to modify the CSV before parsing it by the data module.\n *\n * @callback Highcharts.DataBeforeParseCallbackFunction\n *\n * @param {string} csv\n * The CSV to modify.\n *\n * @return {string}\n * The CSV to parse.\n */\n/**\n * Callback function that gets called after parsing data.\n *\n * @callback Highcharts.DataCompleteCallbackFunction\n *\n * @param {Highcharts.Options} chartOptions\n * The chart options that were used.\n */\n/**\n * Callback function that returns the corresponding Date object to a match.\n *\n * @callback Highcharts.DataDateFormatCallbackFunction\n *\n * @param {Array} match\n *\n * @return {number}\n */\n/**\n * Structure for alternative date formats to parse.\n *\n * @interface Highcharts.DataDateFormatObject\n */ /**\n* @name Highcharts.DataDateFormatObject#alternative\n* @type {string|undefined}\n*/ /**\n* @name Highcharts.DataDateFormatObject#parser\n* @type {Highcharts.DataDateFormatCallbackFunction}\n*/ /**\n* @name Highcharts.DataDateFormatObject#regex\n* @type {global.RegExp}\n*/\n/**\n * Possible types for a data item in a column or row.\n *\n * @typedef {number|string|null} Highcharts.DataValueType\n */\n/**\n * Callback function to parse string representations of dates into\n * JavaScript timestamps (milliseconds since 1.1.1970).\n *\n * @callback Highcharts.DataParseDateCallbackFunction\n *\n * @param {string} dateValue\n *\n * @return {number}\n * Timestamp (milliseconds since 1.1.1970) as integer for Date class.\n */\n/**\n * Callback function to access the parsed columns, the two-dimensional\n * input data array directly, before they are interpreted into series\n * data and categories.\n *\n * @callback Highcharts.DataParsedCallbackFunction\n *\n * @param {Array>} columns\n * The parsed columns by the data module.\n *\n * @return {boolean|undefined}\n * Return `false` to stop completion, or call `this.complete()` to\n * continue async.\n */\n/* *\n *\n * API Options\n *\n * */\n/**\n * The Data module provides a simplified interface for adding data to\n * a chart from sources like CVS, HTML tables or grid views. See also\n * the [tutorial article on the Data module](\n * https://www.highcharts.com/docs/working-with-data/data-module).\n *\n * It requires the `modules/data.js` file to be loaded.\n *\n * Please note that the default way of adding data in Highcharts, without\n * the need of a module, is through the [series._type_.data](#series.line.data)\n * option.\n *\n * @sample {highcharts} highcharts/demo/column-parsed/\n * HTML table\n * @sample {highcharts} highcharts/data/csv/\n * CSV\n *\n * @since 4.0\n * @requires modules/data\n * @apioption data\n */\n/**\n * A callback function to modify the CSV before parsing it. Return the modified\n * string.\n *\n * @sample {highcharts} highcharts/demo/line-ajax/\n * Modify CSV before parse\n *\n * @type {Highcharts.DataBeforeParseCallbackFunction}\n * @since 6.1\n * @apioption data.beforeParse\n */\n/**\n * A two-dimensional array representing the input data on tabular form.\n * This input can be used when the data is already parsed, for example\n * from a grid view component. Each cell can be a string or number.\n * If not switchRowsAndColumns is set, the columns are interpreted as\n * series.\n *\n * @see [data.rows](#data.rows)\n *\n * @sample {highcharts} highcharts/data/columns/\n * Columns\n *\n * @type {Array>}\n * @since 4.0\n * @apioption data.columns\n */\n/**\n * An array option that specifies the data type for each column in the series\n * loaded within the data module.\n *\n * Possible values: `\"string\"`, `\"number\"`, `\"float\"`, `\"date\"`.\n *\n * @sample {highcharts|highstock} highcharts/data/column-types/\n * X-axis categories based on CSV data\n * @sample {highmaps} highcharts/data/column-types-map/\n * Map chart created with fips from CSV\n *\n * @type {Array<'string'|'number'|'float'|'date'>}\n * @since @next\n * @validvalue [\"string\", \"number\", \"float\", \"date\"]\n * @apioption data.columnTypes\n */\n/**\n * The callback that is evaluated when the data is finished loading,\n * optionally from an external source, and parsed. The first argument\n * passed is a finished chart options object, containing the series.\n * These options can be extended with additional options and passed\n * directly to the chart constructor.\n *\n * @see [data.parsed](#data.parsed)\n *\n * @sample {highcharts} highcharts/data/complete/\n * Modify data on complete\n *\n * @type {Highcharts.DataCompleteCallbackFunction}\n * @since 4.0\n * @apioption data.complete\n */\n/**\n * A comma delimited string to be parsed. Related options are [startRow](\n * #data.startRow), [endRow](#data.endRow), [startColumn](#data.startColumn)\n * and [endColumn](#data.endColumn) to delimit what part of the table\n * is used. The [lineDelimiter](#data.lineDelimiter) and [itemDelimiter](\n * #data.itemDelimiter) options define the CSV delimiter formats.\n *\n * The built-in CSV parser doesn't support all flavours of CSV, so in\n * some cases it may be necessary to use an external CSV parser. See\n * [this example](https://jsfiddle.net/highcharts/u59176h4/) of parsing\n * CSV through the MIT licensed [Papa Parse](http://papaparse.com/)\n * library.\n *\n * @sample {highcharts} highcharts/data/csv/\n * Data from CSV\n *\n * @type {string}\n * @since 4.0\n * @apioption data.csv\n */\n/**\n * Which of the predefined date formats in Date.prototype.dateFormats\n * to use to parse date values. Defaults to a best guess based on what\n * format gives valid and ordered dates. Valid options include: `YYYY/mm/dd`,\n * `dd/mm/YYYY`, `mm/dd/YYYY`, `dd/mm/YY`, `mm/dd/YY`.\n *\n * @see [data.parseDate](#data.parseDate)\n *\n * @sample {highcharts} highcharts/data/dateformat-auto/\n * Best guess date format\n *\n * @type {string}\n * @since 4.0\n * @validvalue [\"YYYY/mm/dd\", \"dd/mm/YYYY\", \"mm/dd/YYYY\", \"dd/mm/YYYY\",\n * \"dd/mm/YY\", \"mm/dd/YY\"]\n * @apioption data.dateFormat\n */\n/**\n * The decimal point used for parsing numbers in the CSV.\n *\n * If both this and data.delimiter is set to `undefined`, the parser will\n * attempt to deduce the decimal point automatically.\n *\n * @sample {highcharts} highcharts/data/delimiters/\n * Comma as decimal point\n *\n * @type {string}\n * @default .\n * @since 4.1.0\n * @apioption data.decimalPoint\n */\n/**\n * In tabular input data, the last column (indexed by 0) to use. Defaults\n * to the last column containing data.\n *\n * @sample {highcharts} highcharts/data/start-end/\n * Limited data\n *\n * @type {number}\n * @since 4.0\n * @apioption data.endColumn\n */\n/**\n * In tabular input data, the last row (indexed by 0) to use. Defaults\n * to the last row containing data.\n *\n * @sample {highcharts} highcharts/data/start-end/\n * Limited data\n *\n * @type {number}\n * @since 4.0.4\n * @apioption data.endRow\n */\n/**\n * Whether to use the first row in the data set as series names.\n *\n * @sample {highcharts} highcharts/data/start-end/\n * Don't get series names from the CSV\n * @sample {highstock} highcharts/data/start-end/\n * Don't get series names from the CSV\n *\n * @type {boolean}\n * @default true\n * @since 4.1.0\n * @product highcharts highstock gantt\n * @apioption data.firstRowAsNames\n */\n/**\n * The Google Spreadsheet API key required for access generated at [API Services\n * / Credentials](https://console.cloud.google.com/apis/credentials). See a\n * comprehensive tutorial for setting up the key at the\n * [Hands-On Data Visualization](https://handsondataviz.org/google-sheets-api-key.html)\n * book website.\n *\n * @sample {highcharts} highcharts/data/google-spreadsheet/\n * Load a Google Spreadsheet\n *\n * @type {string}\n * @since 9.2.2\n * @apioption data.googleAPIKey\n */\n/**\n * The key or `spreadsheetId` value for a Google Spreadsheet to load. See\n * [developers.google.com](https://developers.google.com/sheets/api/guides/concepts)\n * for how to find the `spreadsheetId`.\n *\n * In order for Google Sheets to load, a valid [googleAPIKey](#data.googleAPIKey)\n * must also be given.\n *\n * @sample {highcharts} highcharts/data/google-spreadsheet/\n * Load a Google Spreadsheet\n *\n * @type {string}\n * @since 4.0\n * @apioption data.googleSpreadsheetKey\n */\n/**\n * The Google Spreadsheet `range` to use in combination with\n * [googleSpreadsheetKey](#data.googleSpreadsheetKey). See\n * [developers.google.com](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get)\n * for details.\n *\n * If given, it takes precedence over `startColumn`, `endColumn`, `startRow` and\n * `endRow`.\n *\n * @example\n * googleSpreadsheetRange: 'Fruit Consumption' // Load a named worksheet\n * googleSpreadsheetRange: 'A:Z' // Load columns A to Z\n *\n * @sample {highcharts} highcharts/data/google-spreadsheet/\n * Load a Google Spreadsheet\n *\n * @type {string|undefined}\n * @since 9.2.2\n * @apioption data.googleSpreadsheetRange\n */\n/**\n * No longer works since v9.2.2, that uses Google Sheets API v4. Instead, use\n * the [googleSpreadsheetRange](#data.googleSpreadsheetRange) option to load a\n * specific sheet.\n *\n * @deprecated\n * @type {string}\n * @since 4.0\n * @apioption data.googleSpreadsheetWorksheet\n */\n/**\n * Item or cell delimiter for parsing CSV. Defaults to the tab character\n * `\\t` if a tab character is found in the CSV string, if not it defaults\n * to `,`.\n *\n * If this is set to false or undefined, the parser will attempt to deduce\n * the delimiter automatically.\n *\n * @sample {highcharts} highcharts/data/delimiters/\n * Delimiters\n *\n * @type {string}\n * @since 4.0\n * @apioption data.itemDelimiter\n */\n/**\n * Line delimiter for parsing CSV.\n *\n * @sample {highcharts} highcharts/data/delimiters/\n * Delimiters\n *\n * @type {string}\n * @default \\n\n * @since 4.0\n * @apioption data.lineDelimiter\n */\n/**\n * A callback function to access the parsed columns, the two-dimensional\n * input data array directly, before they are interpreted into series\n * data and categories. Return `false` to stop completion, or call\n * `this.complete()` to continue async.\n *\n * @see [data.complete](#data.complete)\n *\n * @sample {highcharts} highcharts/data/parsed/\n * Modify data after parse\n *\n * @type {Highcharts.DataParsedCallbackFunction}\n * @since 4.0\n * @apioption data.parsed\n */\n/**\n * A callback function to parse string representations of dates into\n * JavaScript timestamps. Should return an integer timestamp on success.\n *\n * @see [dateFormat](#data.dateFormat)\n *\n * @type {Highcharts.DataParseDateCallbackFunction}\n * @since 4.0\n * @apioption data.parseDate\n */\n/**\n * The same as the columns input option, but defining rows instead of\n * columns.\n *\n * @see [data.columns](#data.columns)\n *\n * @sample {highcharts} highcharts/data/rows/\n * Data in rows\n *\n * @type {Array>}\n * @since 4.0\n * @apioption data.rows\n */\n/**\n * An array containing dictionaries for each series. A dictionary exists of\n * Point property names as the key and the CSV column index as the value.\n *\n * @sample {highcharts} highcharts/data/seriesmapping-label/\n * Label from data set\n *\n * @type {Array>}\n * @since 4.0.4\n * @apioption data.seriesMapping\n */\n/**\n * In tabular input data, the first column (indexed by 0) to use.\n *\n * @sample {highcharts} highcharts/data/start-end/\n * Limited data\n *\n * @type {number}\n * @default 0\n * @since 4.0\n * @apioption data.startColumn\n */\n/**\n * In tabular input data, the first row (indexed by 0) to use.\n *\n * @sample {highcharts} highcharts/data/start-end/\n * Limited data\n *\n * @type {number}\n * @default 0\n * @since 4.0\n * @apioption data.startRow\n */\n/**\n * Switch rows and columns of the input data, so that `this.columns`\n * effectively becomes the rows of the data set, and the rows are interpreted\n * as series.\n *\n * @sample {highcharts} highcharts/data/switchrowsandcolumns/\n * Switch rows and columns\n *\n * @type {boolean}\n * @default false\n * @since 4.0\n * @apioption data.switchRowsAndColumns\n */\n/**\n * An HTML table or the id of such to be parsed as input data. Related\n * options are `startRow`, `endRow`, `startColumn` and `endColumn` to\n * delimit what part of the table is used.\n *\n * @sample {highcharts} highcharts/demo/column-parsed/\n * Parsed table\n *\n * @type {string|global.HTMLElement}\n * @since 4.0\n * @apioption data.table\n */\n/**\n * An URL to a remote CSV dataset. Will be fetched when the chart is created\n * using Ajax.\n *\n * @sample highcharts/data/livedata-columns\n * Categorized bar chart with CSV and live polling\n * @sample highcharts/data/livedata-csv\n * Time based line chart with CSV and live polling\n *\n * @type {string}\n * @apioption data.csvURL\n */\n/**\n * A URL to a remote JSON dataset, structured as a row array.\n * Will be fetched when the chart is created using Ajax.\n *\n * @sample highcharts/data/livedata-rows\n * Rows with live polling\n *\n * @type {string}\n * @apioption data.rowsURL\n */\n/**\n * A URL to a remote JSON dataset, structured as a column array.\n * Will be fetched when the chart is created using Ajax.\n *\n * @sample highcharts/data/livedata-columns\n * Columns with live polling\n *\n * @type {string}\n * @apioption data.columnsURL\n */\n/**\n * Sets the refresh rate for data polling when importing remote dataset by\n * setting [data.csvURL](data.csvURL), [data.rowsURL](data.rowsURL),\n * [data.columnsURL](data.columnsURL), or\n * [data.googleSpreadsheetKey](data.googleSpreadsheetKey).\n *\n * Note that polling must be enabled by setting\n * [data.enablePolling](data.enablePolling) to true.\n *\n * The value is the number of seconds between pollings.\n * It cannot be set to less than 1 second.\n *\n * @sample highcharts/demo/live-data\n * Live data with user set refresh rate\n *\n * @default 1\n * @type {number}\n * @apioption data.dataRefreshRate\n */\n/**\n * Enables automatic refetching of remote datasets every _n_ seconds (defined by\n * setting [data.dataRefreshRate](data.dataRefreshRate)).\n *\n * Only works when either [data.csvURL](data.csvURL),\n * [data.rowsURL](data.rowsURL), [data.columnsURL](data.columnsURL), or\n * [data.googleSpreadsheetKey](data.googleSpreadsheetKey).\n *\n * @sample highcharts/demo/live-data\n * Live data\n * @sample highcharts/data/livedata-columns\n * Categorized bar chart with CSV and live polling\n *\n * @type {boolean}\n * @default false\n * @apioption data.enablePolling\n */\n(''); // keeps doclets above in JS file\n", "/**\n * @license Highcharts JS v@product.version@ (@product.date@)\n * @module highcharts/modules/data\n * @requires highcharts\n *\n * Data module\n *\n * (c) 2012-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */\n'use strict';\nimport Highcharts from '../../Core/Globals.js';\nimport HttpUtilities from '../../Core/HttpUtilities.js';\nimport Data from '../../Extensions/Data.js';\nconst G = Highcharts;\n// Classes\nG.Data = G.Data || Data;\nG.HttpUtilities = G.HttpUtilities || HttpUtilities;\n// Functions\nG.ajax = G.HttpUtilities.ajax;\nG.data = G.Data.data;\nG.getJSON = G.HttpUtilities.getJSON;\nG.post = G.HttpUtilities.post;\nexport default Highcharts;\n", "/**\n *\n * (c) 2010-2024 Pawe\u0142 Fus\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Composition\n *\n * */\nvar ChartNavigationComposition;\n(function (ChartNavigationComposition) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * @private\n */\n function compose(chart) {\n if (!chart.navigation) {\n chart.navigation = new Additions(chart);\n }\n return chart;\n }\n ChartNavigationComposition.compose = compose;\n /* *\n *\n * Class\n *\n * */\n /**\n * Initializes `chart.navigation` object which delegates `update()` methods\n * to all other common classes (used in exporting and navigationBindings).\n * @private\n */\n class Additions {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart) {\n this.updates = [];\n this.chart = chart;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Registers an `update()` method in the `chart.navigation` object.\n *\n * @private\n * @param {UpdateFunction} updateFn\n * The `update()` method that will be called in `chart.update()`.\n */\n addUpdate(updateFn) {\n this.chart.navigation.updates.push(updateFn);\n }\n /**\n * @private\n */\n update(options, redraw) {\n this.updates.forEach((updateFn) => {\n updateFn.call(this.chart, options, redraw);\n });\n }\n }\n ChartNavigationComposition.Additions = Additions;\n})(ChartNavigationComposition || (ChartNavigationComposition = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default ChartNavigationComposition;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nconst { isTouchDevice } = H;\n/* *\n *\n * API Options\n *\n * */\n// Add the export related options\n/**\n * Options for the exporting module. For an overview on the matter, see\n * [the docs](https://www.highcharts.com/docs/export-module/export-module-overview).\n *\n * @requires modules/exporting\n * @optionparent exporting\n */\nconst exporting = {\n /**\n * Experimental setting to allow HTML inside the chart (added through\n * the `useHTML` options), directly in the exported image. This allows\n * you to preserve complicated HTML structures like tables or bi-directional\n * text in exported charts.\n *\n * Disclaimer: The HTML is rendered in a `foreignObject` tag in the\n * generated SVG. The official export server is based on PhantomJS,\n * which supports this, but other SVG clients, like Batik, does not\n * support it. This also applies to downloaded SVG that you want to\n * open in a desktop client.\n *\n * @type {boolean}\n * @default false\n * @since 4.1.8\n * @apioption exporting.allowHTML\n */\n /**\n * Allows the end user to sort the data table by clicking on column headers.\n *\n * @since 10.3.3\n * @apioption exporting.allowTableSorting\n */\n allowTableSorting: true,\n /**\n * Additional chart options to be merged into the chart before exporting to\n * an image format. This does not apply to printing the chart via the export\n * menu.\n *\n * For example, a common use case is to add data labels to improve\n * readability of the exported chart, or to add a printer-friendly color\n * scheme to exported PDFs.\n *\n * @sample {highcharts} highcharts/exporting/chartoptions-data-labels/\n * Added data labels\n * @sample {highstock} highcharts/exporting/chartoptions-data-labels/\n * Added data labels\n *\n * @type {Highcharts.Options}\n * @apioption exporting.chartOptions\n */\n /**\n * Whether to enable the exporting module. Disabling the module will\n * hide the context button, but API methods will still be available.\n *\n * @sample {highcharts} highcharts/exporting/enabled-false/\n * Exporting module is loaded but disabled\n * @sample {highstock} highcharts/exporting/enabled-false/\n * Exporting module is loaded but disabled\n *\n * @type {boolean}\n * @default true\n * @since 2.0\n * @apioption exporting.enabled\n */\n /**\n * Function to call if the offline-exporting module fails to export\n * a chart on the client side, and [fallbackToExportServer](\n * #exporting.fallbackToExportServer) is disabled. If left undefined, an\n * exception is thrown instead. Receives two parameters, the exporting\n * options, and the error from the module.\n *\n * @see [fallbackToExportServer](#exporting.fallbackToExportServer)\n *\n * @type {Highcharts.ExportingErrorCallbackFunction}\n * @since 5.0.0\n * @requires modules/exporting\n * @requires modules/offline-exporting\n * @apioption exporting.error\n */\n /**\n * Whether or not to fall back to the export server if the offline-exporting\n * module is unable to export the chart on the client side. This happens for\n * certain browsers, and certain features (e.g.\n * [allowHTML](#exporting.allowHTML)), depending on the image type exporting\n * to. For very complex charts, it is possible that export can fail in\n * browsers that don't support Blob objects, due to data URL length limits.\n * It is recommended to define the [exporting.error](#exporting.error)\n * handler if disabling fallback, in order to notify users in case export\n * fails.\n *\n * @type {boolean}\n * @default true\n * @since 4.1.8\n * @requires modules/exporting\n * @requires modules/offline-exporting\n * @apioption exporting.fallbackToExportServer\n */\n /**\n * The filename, without extension, to use for the exported chart.\n *\n * @sample {highcharts} highcharts/exporting/filename/\n * Custom file name\n * @sample {highstock} highcharts/exporting/filename/\n * Custom file name\n *\n * @type {string}\n * @default chart\n * @since 2.0\n * @apioption exporting.filename\n */\n /**\n * Highcharts v11.2.0 and older. An object containing additional key value\n * data for the POST form that sends the SVG to the export server. For\n * example, a `target` can be set to make sure the generated image is\n * received in another frame, or a custom `enctype` or `encoding` can be\n * set.\n *\n * With Highcharts v11.3.0, the `fetch` API replaced the old HTML form. To\n * modify the request, now use [fetchOptions](#exporting.fetchOptions)\n * instead.\n *\n * @deprecated\n * @type {Highcharts.HTMLAttributes}\n * @since 3.0.8\n * @apioption exporting.formAttributes\n */\n /**\n * Options for the fetch request used when sending the SVG to the export\n * server.\n *\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/fetch)\n * for more information\n *\n * @type {Object}\n * @since 11.3.0\n * @apioption exporting.fetchOptions\n */\n /**\n * Path where Highcharts will look for export module dependencies to\n * load on demand if they don't already exist on `window`. Should currently\n * point to location of [CanVG](https://github.com/canvg/canvg) library,\n * [jsPDF](https://github.com/parallax/jsPDF) and\n * [svg2pdf.js](https://github.com/yWorks/svg2pdf.js), required for client\n * side export in certain browsers.\n *\n * @type {string}\n * @default https://code.highcharts.com/{version}/lib\n * @since 5.0.0\n * @apioption exporting.libURL\n */\n /**\n * Analogous to [sourceWidth](#exporting.sourceWidth).\n *\n * @type {number}\n * @since 3.0\n * @apioption exporting.sourceHeight\n */\n /**\n * The width of the original chart when exported, unless an explicit\n * [chart.width](#chart.width) is set, or a pixel width is set on the\n * container. The width exported raster image is then multiplied by\n * [scale](#exporting.scale).\n *\n * @sample {highcharts} highcharts/exporting/sourcewidth/\n * Source size demo\n * @sample {highstock} highcharts/exporting/sourcewidth/\n * Source size demo\n * @sample {highmaps} maps/exporting/sourcewidth/\n * Source size demo\n *\n * @type {number}\n * @since 3.0\n * @apioption exporting.sourceWidth\n */\n /**\n * The pixel width of charts exported to PNG or JPG. As of Highcharts\n * 3.0, the default pixel width is a function of the [chart.width](\n * #chart.width) or [exporting.sourceWidth](#exporting.sourceWidth) and the\n * [exporting.scale](#exporting.scale).\n *\n * @sample {highcharts} highcharts/exporting/width/\n * Export to 200px wide images\n * @sample {highstock} highcharts/exporting/width/\n * Export to 200px wide images\n *\n * @type {number}\n * @since 2.0\n * @apioption exporting.width\n */\n /**\n * Default MIME type for exporting if `chart.exportChart()` is called\n * without specifying a `type` option. Possible values are `image/png`,\n * `image/jpeg`, `application/pdf` and `image/svg+xml`.\n *\n * @type {Highcharts.ExportingMimeTypeValue}\n * @since 2.0\n */\n type: 'image/png',\n /**\n * The URL for the server module converting the SVG string to an image\n * format. By default this points to Highchart's free web service.\n *\n * @since 2.0\n */\n url: 'https://export.highcharts.com/',\n /**\n * Settings for a custom font for the exported PDF, when using the\n * `offline-exporting` module. This is used for languages containing\n * non-ASCII characters, like Chinese, Russian, Japanese etc.\n *\n * As described in the [jsPDF\n * docs](https://github.com/parallax/jsPDF#use-of-unicode-characters--utf-8),\n * the 14 standard fonts in PDF are limited to the ASCII-codepage.\n * Therefore, in order to support other text in the exported PDF, one or\n * more TTF font files have to be passed on to the exporting module.\n *\n * See more in [the\n * docs](https://www.highcharts.com/docs/export-module/client-side-export).\n *\n * @sample {highcharts} highcharts/exporting/offline-download-pdffont/\n * Download PDF in a language containing non-Latin characters.\n *\n * @since 10.0.0\n * @requires modules/offline-exporting\n */\n pdfFont: {\n /**\n * The TTF font file for normal `font-style`. If font variations like\n * `bold` or `italic` are not defined, the `normal` font will be used\n * for those too.\n *\n * @type string|undefined\n */\n normal: void 0,\n /**\n * The TTF font file for bold text.\n *\n * @type string|undefined\n */\n bold: void 0,\n /**\n * The TTF font file for bold and italic text.\n *\n * @type string|undefined\n */\n bolditalic: void 0,\n /**\n * The TTF font file for italic text.\n *\n * @type string|undefined\n */\n italic: void 0\n },\n /**\n * When printing the chart from the menu item in the burger menu, if\n * the on-screen chart exceeds this width, it is resized. After printing\n * or cancelled, it is restored. The default width makes the chart\n * fit into typical paper format. Note that this does not affect the\n * chart when printing the web page as a whole.\n *\n * @since 4.2.5\n */\n printMaxWidth: 780,\n /**\n * Defines the scale or zoom factor for the exported image compared\n * to the on-screen display. While for instance a 600px wide chart\n * may look good on a website, it will look bad in print. The default\n * scale of 2 makes this chart export to a 1200px PNG or JPG.\n *\n * @see [chart.width](#chart.width)\n * @see [exporting.sourceWidth](#exporting.sourceWidth)\n *\n * @sample {highcharts} highcharts/exporting/scale/\n * Scale demonstrated\n * @sample {highstock} highcharts/exporting/scale/\n * Scale demonstrated\n * @sample {highmaps} maps/exporting/scale/\n * Scale demonstrated\n *\n * @since 3.0\n */\n scale: 2,\n /**\n * Options for the export related buttons, print and export. In addition\n * to the default buttons listed here, custom buttons can be added.\n * See [navigation.buttonOptions](#navigation.buttonOptions) for general\n * options.\n *\n * @type {Highcharts.Dictionary<*>}\n * @requires modules/exporting\n */\n buttons: {\n /**\n * Options for the export button.\n *\n * In styled mode, export button styles can be applied with the\n * `.highcharts-contextbutton` class.\n *\n * @declare Highcharts.ExportingButtonsOptionsObject\n * @extends navigation.buttonOptions\n * @requires modules/exporting\n */\n contextButton: {\n /**\n * A click handler callback to use on the button directly instead of\n * the popup menu.\n *\n * @sample highcharts/exporting/buttons-contextbutton-onclick/\n * Skip the menu and export the chart directly\n *\n * @type {Function}\n * @since 2.0\n * @apioption exporting.buttons.contextButton.onclick\n */\n /**\n * See [navigation.buttonOptions.symbolFill](\n * #navigation.buttonOptions.symbolFill).\n *\n * @type {Highcharts.ColorString}\n * @default #666666\n * @since 2.0\n * @apioption exporting.buttons.contextButton.symbolFill\n */\n /**\n * The horizontal position of the button relative to the `align`\n * option.\n *\n * @type {number}\n * @default -10\n * @since 2.0\n * @apioption exporting.buttons.contextButton.x\n */\n /**\n * The class name of the context button.\n */\n className: 'highcharts-contextbutton',\n /**\n * The class name of the menu appearing from the button.\n */\n menuClassName: 'highcharts-contextmenu',\n /**\n * The symbol for the button. Points to a definition function in\n * the `Highcharts.Renderer.symbols` collection. The default\n * `menu` function is part of the exporting module. Possible\n * values are \"circle\", \"square\", \"diamond\", \"triangle\",\n * \"triangle-down\", \"menu\", \"menuball\" or custom shape.\n *\n * @sample highcharts/exporting/buttons-contextbutton-symbol/\n * Use a circle for symbol\n * @sample highcharts/exporting/buttons-contextbutton-symbol-custom/\n * Custom shape as symbol\n *\n * @type {Highcharts.SymbolKeyValue|\"menu\"|\"menuball\"|string}\n * @since 2.0\n */\n symbol: 'menu',\n /**\n * The key to a [lang](#lang) option setting that is used for the\n * button's title tooltip. When the key is `contextButtonTitle`, it\n * refers to [lang.contextButtonTitle](#lang.contextButtonTitle)\n * that defaults to \"Chart context menu\".\n *\n * @since 6.1.4\n */\n titleKey: 'contextButtonTitle',\n /**\n * This option is deprecated, use\n * [titleKey](#exporting.buttons.contextButton.titleKey) instead.\n *\n * @deprecated\n * @type {string}\n * @apioption exporting.buttons.contextButton._titleKey\n */\n /**\n * A collection of strings pointing to config options for the menu\n * items. The config options are defined in the\n * `menuItemDefinitions` option.\n *\n * By default, there is the \"View in full screen\" and \"Print\" menu\n * items, plus one menu item for each of the available export types.\n *\n * @sample {highcharts} highcharts/exporting/menuitemdefinitions/\n * Menu item definitions\n * @sample {highstock} highcharts/exporting/menuitemdefinitions/\n * Menu item definitions\n * @sample {highmaps} highcharts/exporting/menuitemdefinitions/\n * Menu item definitions\n *\n * @type {Array}\n * @default [\"viewFullscreen\", \"printChart\", \"separator\", \"downloadPNG\", \"downloadJPEG\", \"downloadPDF\", \"downloadSVG\"]\n * @since 2.0\n */\n menuItems: [\n 'viewFullscreen',\n 'printChart',\n 'separator',\n 'downloadPNG',\n 'downloadJPEG',\n 'downloadPDF',\n 'downloadSVG'\n ]\n }\n },\n /**\n * An object consisting of definitions for the menu items in the context\n * menu. Each key value pair has a `key` that is referenced in the\n * [menuItems](#exporting.buttons.contextButton.menuItems) setting,\n * and a `value`, which is an object with the following properties:\n *\n * - **onclick:** The click handler for the menu item\n *\n * - **text:** The text for the menu item\n *\n * - **textKey:** If internationalization is required, the key to a language\n * string\n *\n * Custom text for the \"exitFullScreen\" can be set only in lang options\n * (it is not a separate button).\n *\n * @sample {highcharts} highcharts/exporting/menuitemdefinitions/\n * Menu item definitions\n * @sample {highstock} highcharts/exporting/menuitemdefinitions/\n * Menu item definitions\n * @sample {highmaps} highcharts/exporting/menuitemdefinitions/\n * Menu item definitions\n *\n *\n * @type {Highcharts.Dictionary}\n * @default {\"viewFullscreen\": {}, \"printChart\": {}, \"separator\": {}, \"downloadPNG\": {}, \"downloadJPEG\": {}, \"downloadPDF\": {}, \"downloadSVG\": {}}\n * @since 5.0.13\n */\n menuItemDefinitions: {\n /**\n * @ignore\n */\n viewFullscreen: {\n textKey: 'viewFullscreen',\n onclick: function () {\n if (this.fullscreen) {\n this.fullscreen.toggle();\n }\n }\n },\n /**\n * @ignore\n */\n printChart: {\n textKey: 'printChart',\n onclick: function () {\n this.print();\n }\n },\n /**\n * @ignore\n */\n separator: {\n separator: true\n },\n /**\n * @ignore\n */\n downloadPNG: {\n textKey: 'downloadPNG',\n onclick: function () {\n this.exportChart();\n }\n },\n /**\n * @ignore\n */\n downloadJPEG: {\n textKey: 'downloadJPEG',\n onclick: function () {\n this.exportChart({\n type: 'image/jpeg'\n });\n }\n },\n /**\n * @ignore\n */\n downloadPDF: {\n textKey: 'downloadPDF',\n onclick: function () {\n this.exportChart({\n type: 'application/pdf'\n });\n }\n },\n /**\n * @ignore\n */\n downloadSVG: {\n textKey: 'downloadSVG',\n onclick: function () {\n this.exportChart({\n type: 'image/svg+xml'\n });\n }\n }\n }\n};\n// Add language\n/**\n * @optionparent lang\n */\nconst lang = {\n /**\n * Exporting module only. The text for the menu item to view the chart\n * in full screen.\n *\n * @since 8.0.1\n */\n viewFullscreen: 'View in full screen',\n /**\n * Exporting module only. The text for the menu item to exit the chart\n * from full screen.\n *\n * @since 8.0.1\n */\n exitFullscreen: 'Exit from full screen',\n /**\n * Exporting module only. The text for the menu item to print the chart.\n *\n * @since 3.0.1\n * @requires modules/exporting\n */\n printChart: 'Print chart',\n /**\n * Exporting module only. The text for the PNG download menu item.\n *\n * @since 2.0\n * @requires modules/exporting\n */\n downloadPNG: 'Download PNG image',\n /**\n * Exporting module only. The text for the JPEG download menu item.\n *\n * @since 2.0\n * @requires modules/exporting\n */\n downloadJPEG: 'Download JPEG image',\n /**\n * Exporting module only. The text for the PDF download menu item.\n *\n * @since 2.0\n * @requires modules/exporting\n */\n downloadPDF: 'Download PDF document',\n /**\n * Exporting module only. The text for the SVG download menu item.\n *\n * @since 2.0\n * @requires modules/exporting\n */\n downloadSVG: 'Download SVG vector image',\n /**\n * Exporting module menu. The tooltip title for the context menu holding\n * print and export menu items.\n *\n * @since 3.0\n * @requires modules/exporting\n */\n contextButtonTitle: 'Chart context menu'\n};\n/**\n * A collection of options for buttons and menus appearing in the exporting\n * module or in Stock Tools.\n *\n * @requires modules/exporting\n * @optionparent navigation\n */\nconst navigation = {\n /**\n * A collection of options for buttons appearing in the exporting\n * module.\n *\n * In styled mode, the buttons are styled with the\n * `.highcharts-contextbutton` and `.highcharts-button-symbol` classes.\n *\n * @requires modules/exporting\n */\n buttonOptions: {\n /**\n * Whether to enable buttons.\n *\n * @sample highcharts/navigation/buttonoptions-enabled/\n * Exporting module loaded but buttons disabled\n *\n * @type {boolean}\n * @default true\n * @since 2.0\n * @apioption navigation.buttonOptions.enabled\n */\n /**\n * The pixel size of the symbol on the button.\n *\n * @sample highcharts/navigation/buttonoptions-height/\n * Bigger buttons\n *\n * @since 2.0\n */\n symbolSize: 14,\n /**\n * The x position of the center of the symbol inside the button.\n *\n * @sample highcharts/navigation/buttonoptions-height/\n * Bigger buttons\n *\n * @since 2.0\n */\n symbolX: 14.5,\n /**\n * The y position of the center of the symbol inside the button.\n *\n * @sample highcharts/navigation/buttonoptions-height/\n * Bigger buttons\n *\n * @since 2.0\n */\n symbolY: 13.5,\n /**\n * Alignment for the buttons.\n *\n * @sample highcharts/navigation/buttonoptions-align/\n * Center aligned\n *\n * @type {Highcharts.AlignValue}\n * @since 2.0\n */\n align: 'right',\n /**\n * The pixel spacing between buttons.\n *\n * @since 2.0\n */\n buttonSpacing: 3,\n /**\n * Pixel height of the buttons.\n *\n * @sample highcharts/navigation/buttonoptions-height/\n * Bigger buttons\n *\n * @since 2.0\n */\n height: 28,\n /**\n * A text string to add to the individual button.\n *\n * @sample highcharts/exporting/buttons-text/\n * Full text button\n * @sample highcharts/exporting/buttons-text-usehtml/\n * Icon using CSS font in text\n * @sample highcharts/exporting/buttons-text-symbol/\n * Combined symbol and text\n *\n * @type {string}\n * @default null\n * @since 3.0\n * @apioption navigation.buttonOptions.text\n */\n /**\n * Whether to use HTML for rendering the button. HTML allows for things\n * like inline CSS or image-based icons.\n *\n * @sample highcharts/exporting/buttons-text-usehtml/\n * Icon using CSS font in text\n *\n * @type boolean\n * @default false\n * @since 10.3.0\n * @apioption navigation.buttonOptions.useHTML\n */\n /**\n * The vertical offset of the button's position relative to its\n * `verticalAlign`.\n *\n * @sample highcharts/navigation/buttonoptions-verticalalign/\n * Buttons at lower right\n *\n * @type {number}\n * @default 0\n * @since 2.0\n * @apioption navigation.buttonOptions.y\n */\n /**\n * The vertical alignment of the buttons. Can be one of `\"top\"`,\n * `\"middle\"` or `\"bottom\"`.\n *\n * @sample highcharts/navigation/buttonoptions-verticalalign/\n * Buttons at lower right\n *\n * @type {Highcharts.VerticalAlignValue}\n * @since 2.0\n */\n verticalAlign: 'top',\n /**\n * The pixel width of the button.\n *\n * @sample highcharts/navigation/buttonoptions-height/\n * Bigger buttons\n *\n * @since 2.0\n */\n width: 28,\n /**\n * Fill color for the symbol within the button.\n *\n * @sample highcharts/navigation/buttonoptions-symbolfill/\n * Blue symbol stroke for one of the buttons\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @since 2.0\n */\n symbolFill: \"#666666\" /* Palette.neutralColor60 */,\n /**\n * The color of the symbol's stroke or line.\n *\n * @sample highcharts/navigation/buttonoptions-symbolstroke/\n * Blue symbol stroke\n *\n * @type {Highcharts.ColorString}\n * @since 2.0\n */\n symbolStroke: \"#666666\" /* Palette.neutralColor60 */,\n /**\n * The pixel stroke width of the symbol on the button.\n *\n * @sample highcharts/navigation/buttonoptions-height/\n * Bigger buttons\n *\n * @since 2.0\n */\n symbolStrokeWidth: 3,\n /**\n * A configuration object for the button theme. The object accepts\n * SVG properties like `stroke-width`, `stroke` and `fill`.\n * Tri-state button styles are supported by the `states.hover` and\n * `states.select` objects.\n *\n * @sample highcharts/navigation/buttonoptions-theme/\n * Theming the buttons\n *\n * @requires modules/exporting\n *\n * @since 3.0\n */\n theme: {\n /**\n * The default fill exists only to capture hover events.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default ${palette.backgroundColor}\n * @apioption navigation.buttonOptions.theme.fill\n */\n /**\n * Default stroke for the buttons.\n *\n * @type {Highcharts.ColorString}\n * @default none\n * @apioption navigation.buttonOptions.theme.stroke\n */\n /**\n * Padding for the button.\n */\n padding: 5\n }\n },\n /**\n * CSS styles for the popup menu appearing by default when the export\n * icon is clicked. This menu is rendered in HTML.\n *\n * @see In styled mode, the menu is styled with the `.highcharts-menu`\n * class.\n *\n * @sample highcharts/navigation/menustyle/\n * Light gray menu background\n *\n * @type {Highcharts.CSSObject}\n * @default {\"background\": \"#ffffff\", \"borderRadius\": \"3px\", \"padding\": \"0.5em\"}\n * @since 2.0\n */\n menuStyle: {\n /** @ignore-option */\n border: 'none',\n /** @ignore-option */\n borderRadius: '3px',\n /** @ignore-option */\n background: \"#ffffff\" /* Palette.backgroundColor */,\n /** @ignore-option */\n padding: '0.5em'\n },\n /**\n * CSS styles for the individual items within the popup menu appearing\n * by default when the export icon is clicked. The menu items are\n * rendered in HTML. Font size defaults to `11px` on desktop and `14px`\n * on touch devices.\n *\n * @see In styled mode, the menu items are styled with the\n * `.highcharts-menu-item` class.\n *\n * @sample {highcharts} highcharts/navigation/menuitemstyle/\n * Add a grey stripe to the left\n *\n * @type {Highcharts.CSSObject}\n * @default {\"padding\": \"0.5em\", \"color\": \"#333333\", \"background\": \"none\", \"borderRadius\": \"3px\", \"fontSize\": \"0.8em\", \"transition\": \"background 250ms, color 250ms\"}\n * @since 2.0\n */\n menuItemStyle: {\n /** @ignore-option */\n background: 'none',\n /** @ignore-option */\n borderRadius: '3px',\n /** @ignore-option */\n color: \"#333333\" /* Palette.neutralColor80 */,\n /** @ignore-option */\n padding: '0.5em',\n /** @ignore-option */\n fontSize: isTouchDevice ? '0.9em' : '0.8em',\n /** @ignore-option */\n transition: 'background 250ms, color 250ms'\n },\n /**\n * CSS styles for the hover state of the individual items within the\n * popup menu appearing by default when the export icon is clicked. The\n * menu items are rendered in HTML.\n *\n * @see In styled mode, the menu items are styled with the\n * `.highcharts-menu-item` class.\n *\n * @sample highcharts/navigation/menuitemhoverstyle/\n * Bold text on hover\n *\n * @type {Highcharts.CSSObject}\n * @default {\"background\": \"#f2f2f2\" }\n * @since 2.0\n */\n menuItemHoverStyle: {\n /** @ignore-option */\n background: \"#f2f2f2\" /* Palette.neutralColor5 */\n }\n};\n/* *\n *\n * Default Export\n *\n * */\nconst ExportingDefaults = {\n exporting,\n lang,\n navigation\n};\nexport default ExportingDefaults;\n", "/* *\n *\n * Exporting module\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Composition\n *\n * */\nvar ExportingSymbols;\n(function (ExportingSymbols) {\n /* *\n *\n * Constants\n *\n * */\n const modifiedClasses = [];\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * @private\n */\n function compose(SVGRendererClass) {\n if (modifiedClasses.indexOf(SVGRendererClass) === -1) {\n modifiedClasses.push(SVGRendererClass);\n const symbols = SVGRendererClass.prototype.symbols;\n symbols.menu = menu;\n symbols.menuball = menuball.bind(symbols);\n }\n }\n ExportingSymbols.compose = compose;\n /**\n * @private\n */\n function menu(x, y, width, height) {\n const arr = [\n ['M', x, y + 2.5],\n ['L', x + width, y + 2.5],\n ['M', x, y + height / 2 + 0.5],\n ['L', x + width, y + height / 2 + 0.5],\n ['M', x, y + height - 1.5],\n ['L', x + width, y + height - 1.5]\n ];\n return arr;\n }\n /**\n * @private\n */\n function menuball(x, y, width, height) {\n const h = (height / 3) - 2;\n let path = [];\n path = path.concat(this.circle(width - h, y, h, h), this.circle(width - h, y + h + 4, h, h), this.circle(width - h, y + 2 * (h + 4), h, h));\n return path;\n }\n})(ExportingSymbols || (ExportingSymbols = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default ExportingSymbols;\n", "/* *\n *\n * (c) 2009-2024 Rafal Sebestjanski\n *\n * Full screen for Highcharts\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n/**\n * The module allows user to enable display chart in full screen mode.\n * Used in StockTools too.\n * Based on default solutions in browsers.\n */\n'use strict';\nimport AST from '../../Core/Renderer/HTML/AST.js';\nimport H from '../../Core/Globals.js';\nconst { composed } = H;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, fireEvent, pushUnique } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction onChartBeforeRender() {\n /**\n * @name Highcharts.Chart#fullscreen\n * @type {Highcharts.Fullscreen}\n * @requires modules/full-screen\n */\n this.fullscreen = new Fullscreen(this);\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * Handles displaying chart's container in the fullscreen mode.\n *\n * **Note**: Fullscreen is not supported on iPhone due to iOS limitations.\n *\n * @class\n * @name Highcharts.Fullscreen\n *\n * @requires modules/exporting\n */\nclass Fullscreen {\n /* *\n *\n * Static Functions\n *\n * */\n /**\n * Prepares the chart class to support fullscreen.\n *\n * @param {typeof_Highcharts.Chart} ChartClass\n * The chart class to decorate with fullscreen support.\n */\n static compose(ChartClass) {\n if (pushUnique(composed, 'Fullscreen')) {\n // Initialize fullscreen\n addEvent(ChartClass, 'beforeRender', onChartBeforeRender);\n }\n }\n /* *\n *\n * Constructors\n *\n * */\n constructor(chart) {\n /**\n * Chart managed by the fullscreen controller.\n * @name Highcharts.Fullscreen#chart\n * @type {Highcharts.Chart}\n */\n this.chart = chart;\n /**\n * The flag is set to `true` when the chart is displayed in\n * the fullscreen mode.\n *\n * @name Highcharts.Fullscreen#isOpen\n * @type {boolean|undefined}\n * @since 8.0.1\n */\n this.isOpen = false;\n const container = chart.renderTo;\n // Hold event and methods available only for a current browser.\n if (!this.browserProps) {\n if (typeof container.requestFullscreen === 'function') {\n this.browserProps = {\n fullscreenChange: 'fullscreenchange',\n requestFullscreen: 'requestFullscreen',\n exitFullscreen: 'exitFullscreen'\n };\n }\n else if (container.mozRequestFullScreen) {\n this.browserProps = {\n fullscreenChange: 'mozfullscreenchange',\n requestFullscreen: 'mozRequestFullScreen',\n exitFullscreen: 'mozCancelFullScreen'\n };\n }\n else if (container.webkitRequestFullScreen) {\n this.browserProps = {\n fullscreenChange: 'webkitfullscreenchange',\n requestFullscreen: 'webkitRequestFullScreen',\n exitFullscreen: 'webkitExitFullscreen'\n };\n }\n else if (container.msRequestFullscreen) {\n this.browserProps = {\n fullscreenChange: 'MSFullscreenChange',\n requestFullscreen: 'msRequestFullscreen',\n exitFullscreen: 'msExitFullscreen'\n };\n }\n }\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Stops displaying the chart in fullscreen mode.\n * Exporting module required.\n *\n * @since 8.0.1\n *\n * @function Highcharts.Fullscreen#close\n * @return {void}\n * @requires modules/full-screen\n */\n close() {\n const fullscreen = this, chart = fullscreen.chart, optionsChart = chart.options.chart;\n fireEvent(chart, 'fullscreenClose', null, function () {\n // Don't fire exitFullscreen() when user exited\n // using 'Escape' button.\n if (fullscreen.isOpen &&\n fullscreen.browserProps &&\n chart.container.ownerDocument instanceof Document) {\n chart.container.ownerDocument[fullscreen.browserProps.exitFullscreen]();\n }\n // Unbind event as it's necessary only before exiting\n // from fullscreen.\n if (fullscreen.unbindFullscreenEvent) {\n fullscreen.unbindFullscreenEvent = fullscreen\n .unbindFullscreenEvent();\n }\n chart.setSize(fullscreen.origWidth, fullscreen.origHeight, false);\n fullscreen.origWidth = void 0;\n fullscreen.origHeight = void 0;\n optionsChart.width = fullscreen.origWidthOption;\n optionsChart.height = fullscreen.origHeightOption;\n fullscreen.origWidthOption = void 0;\n fullscreen.origHeightOption = void 0;\n fullscreen.isOpen = false;\n fullscreen.setButtonText();\n });\n }\n /**\n * Displays the chart in fullscreen mode.\n * When fired customly by user before exporting context button is created,\n * button's text will not be replaced - it's on the user side.\n * Exporting module required.\n *\n * @since 8.0.1\n *\n * @function Highcharts.Fullscreen#open\n * @return {void}\n * @requires modules/full-screen\n */\n open() {\n const fullscreen = this, chart = fullscreen.chart, optionsChart = chart.options.chart;\n fireEvent(chart, 'fullscreenOpen', null, function () {\n if (optionsChart) {\n fullscreen.origWidthOption = optionsChart.width;\n fullscreen.origHeightOption = optionsChart.height;\n }\n fullscreen.origWidth = chart.chartWidth;\n fullscreen.origHeight = chart.chartHeight;\n // Handle exitFullscreen() method when user clicks 'Escape' button.\n if (fullscreen.browserProps) {\n const unbindChange = addEvent(chart.container.ownerDocument, // chart's document\n fullscreen.browserProps.fullscreenChange, function () {\n // Handle lack of async of browser's\n // fullScreenChange event.\n if (fullscreen.isOpen) {\n fullscreen.isOpen = false;\n fullscreen.close();\n }\n else {\n chart.setSize(null, null, false);\n fullscreen.isOpen = true;\n fullscreen.setButtonText();\n }\n });\n const unbindDestroy = addEvent(chart, 'destroy', unbindChange);\n fullscreen.unbindFullscreenEvent = () => {\n unbindChange();\n unbindDestroy();\n };\n const promise = chart.renderTo[fullscreen.browserProps.requestFullscreen]();\n if (promise) {\n promise['catch'](function () {\n alert(// eslint-disable-line no-alert\n 'Full screen is not supported inside a frame.');\n });\n }\n }\n });\n }\n /**\n * Replaces the exporting context button's text when toogling the\n * fullscreen mode.\n *\n * @private\n *\n * @since 8.0.1\n *\n * @requires modules/full-screen\n */\n setButtonText() {\n const chart = this.chart, exportDivElements = chart.exportDivElements, exportingOptions = chart.options.exporting, menuItems = (exportingOptions &&\n exportingOptions.buttons &&\n exportingOptions.buttons.contextButton.menuItems), lang = chart.options.lang;\n if (exportingOptions &&\n exportingOptions.menuItemDefinitions &&\n lang &&\n lang.exitFullscreen &&\n lang.viewFullscreen &&\n menuItems &&\n exportDivElements) {\n const exportDivElement = exportDivElements[menuItems.indexOf('viewFullscreen')];\n if (exportDivElement) {\n AST.setElementHTML(exportDivElement, !this.isOpen ?\n (exportingOptions.menuItemDefinitions.viewFullscreen\n .text ||\n lang.viewFullscreen) : lang.exitFullscreen);\n }\n }\n }\n /**\n * Toggles displaying the chart in fullscreen mode.\n * By default, when the exporting module is enabled, a context button with\n * a drop down menu in the upper right corner accesses this function.\n * Exporting module required.\n *\n * @since 8.0.1\n *\n * @sample highcharts/members/chart-togglefullscreen/\n * Toggle fullscreen mode from a HTML button\n *\n * @function Highcharts.Fullscreen#toggle\n * @requires modules/full-screen\n */\n toggle() {\n const fullscreen = this;\n if (!fullscreen.isOpen) {\n fullscreen.open();\n }\n else {\n fullscreen.close();\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default Fullscreen;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Gets fired when closing the fullscreen\n *\n * @callback Highcharts.FullScreenfullscreenCloseCallbackFunction\n *\n * @param {Highcharts.Chart} chart\n * The chart on which the event occurred.\n *\n * @param {global.Event} event\n * The event that occurred.\n */\n/**\n * Gets fired when opening the fullscreen\n *\n * @callback Highcharts.FullScreenfullscreenOpenCallbackFunction\n *\n * @param {Highcharts.Chart} chart\n * The chart on which the event occurred.\n *\n * @param {global.Event} event\n * The event that occurred.\n */\n(''); // keeps doclets above separated from following code\n/* *\n *\n * API Options\n *\n * */\n/**\n * Fires when a fullscreen is closed through the context menu item,\n * or a fullscreen is closed on the `Escape` button click,\n * or the `Chart.fullscreen.close` method.\n *\n * @sample highcharts/chart/events-fullscreen\n * Title size change on fullscreen open\n *\n * @type {Highcharts.FullScreenfullscreenCloseCallbackFunction}\n * @since 10.1.0\n * @context Highcharts.Chart\n * @requires modules/full-screen\n * @apioption chart.events.fullscreenClose\n */\n/**\n * Fires when a fullscreen is opened through the context menu item,\n * or the `Chart.fullscreen.open` method.\n *\n * @sample highcharts/chart/events-fullscreen\n * Title size change on fullscreen open\n *\n * @type {Highcharts.FullScreenfullscreenOpenCallbackFunction}\n * @since 10.1.0\n * @context Highcharts.Chart\n * @requires modules/full-screen\n * @apioption chart.events.fullscreenOpen\n */\n(''); // keeps doclets above in transpiled file\n", "/* *\n *\n * Exporting module\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AST from '../../Core/Renderer/HTML/AST.js';\nimport Chart from '../../Core/Chart/Chart.js';\nimport ChartNavigationComposition from '../../Core/Chart/ChartNavigationComposition.js';\nimport D from '../../Core/Defaults.js';\nconst { defaultOptions } = D;\nimport ExportingDefaults from './ExportingDefaults.js';\nimport ExportingSymbols from './ExportingSymbols.js';\nimport Fullscreen from './Fullscreen.js';\nimport G from '../../Core/Globals.js';\nconst { doc, SVG_NS, win } = G;\nimport HU from '../../Core/HttpUtilities.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, css, createElement, discardElement, extend, find, fireEvent, isObject, merge, objectEach, pick, removeEvent, uniqueKey } = U;\n/* *\n *\n * Composition\n *\n * */\nvar Exporting;\n(function (Exporting) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Constants\n *\n * */\n // These CSS properties are not inlined. Remember camelCase.\n const inlineDenylist = [\n /-/,\n /^(clipPath|cssText|d|height|width)$/,\n /^font$/,\n /[lL]ogical(Width|Height)$/,\n /^parentRule$/,\n /^(cssRules|ownerRules)$/,\n /perspective/,\n /TapHighlightColor/,\n /^transition/,\n /^length$/,\n /^[0-9]+$/ // #17538\n ];\n // These ones are translated to attributes rather than styles\n const inlineToAttributes = [\n 'fill',\n 'stroke',\n 'strokeLinecap',\n 'strokeLinejoin',\n 'strokeWidth',\n 'textAnchor',\n 'x',\n 'y'\n ];\n Exporting.inlineAllowlist = [];\n const unstyledElements = [\n 'clipPath',\n 'defs',\n 'desc'\n ];\n /* *\n *\n * Variables\n *\n * */\n let printingChart;\n /* *\n *\n * Functions\n *\n * */\n /**\n * Add the export button to the chart, with options.\n *\n * @private\n * @function Highcharts.Chart#addButton\n * @param {Highcharts.NavigationButtonOptions} options\n * @requires modules/exporting\n */\n function addButton(options) {\n const chart = this, renderer = chart.renderer, btnOptions = merge(chart.options.navigation.buttonOptions, options), onclick = btnOptions.onclick, menuItems = btnOptions.menuItems, symbolSize = btnOptions.symbolSize || 12;\n let symbol;\n if (!chart.btnCount) {\n chart.btnCount = 0;\n }\n // Keeps references to the button elements\n if (!chart.exportDivElements) {\n chart.exportDivElements = [];\n chart.exportSVGElements = [];\n }\n if (btnOptions.enabled === false || !btnOptions.theme) {\n return;\n }\n const attr = btnOptions.theme;\n let callback;\n if (!chart.styledMode) {\n attr.fill = pick(attr.fill, \"#ffffff\" /* Palette.backgroundColor */);\n attr.stroke = pick(attr.stroke, 'none');\n }\n if (onclick) {\n callback = function (e) {\n if (e) {\n e.stopPropagation();\n }\n onclick.call(chart, e);\n };\n }\n else if (menuItems) {\n callback = function (e) {\n // Consistent with onclick call (#3495)\n if (e) {\n e.stopPropagation();\n }\n chart.contextMenu(button.menuClassName, menuItems, button.translateX || 0, button.translateY || 0, button.width || 0, button.height || 0, button);\n button.setState(2);\n };\n }\n if (btnOptions.text && btnOptions.symbol) {\n attr.paddingLeft = pick(attr.paddingLeft, 30);\n }\n else if (!btnOptions.text) {\n extend(attr, {\n width: btnOptions.width,\n height: btnOptions.height,\n padding: 0\n });\n }\n if (!chart.styledMode) {\n attr['stroke-linecap'] = 'round';\n attr.fill = pick(attr.fill, \"#ffffff\" /* Palette.backgroundColor */);\n attr.stroke = pick(attr.stroke, 'none');\n }\n const button = renderer\n .button(btnOptions.text, 0, 0, callback, attr, void 0, void 0, void 0, void 0, btnOptions.useHTML)\n .addClass(options.className)\n .attr({\n title: pick(chart.options.lang[btnOptions._titleKey || btnOptions.titleKey], '')\n });\n button.menuClassName = (options.menuClassName ||\n 'highcharts-menu-' + chart.btnCount++);\n if (btnOptions.symbol) {\n symbol = renderer\n .symbol(btnOptions.symbol, btnOptions.symbolX - (symbolSize / 2), btnOptions.symbolY - (symbolSize / 2), symbolSize, symbolSize\n // If symbol is an image, scale it (#7957)\n , {\n width: symbolSize,\n height: symbolSize\n })\n .addClass('highcharts-button-symbol')\n .attr({\n zIndex: 1\n })\n .add(button);\n if (!chart.styledMode) {\n symbol.attr({\n stroke: btnOptions.symbolStroke,\n fill: btnOptions.symbolFill,\n 'stroke-width': btnOptions.symbolStrokeWidth || 1\n });\n }\n }\n button\n .add(chart.exportingGroup)\n .align(extend(btnOptions, {\n width: button.width,\n x: pick(btnOptions.x, chart.buttonOffset) // #1654\n }), true, 'spacingBox');\n chart.buttonOffset += (((button.width || 0) + btnOptions.buttonSpacing) *\n (btnOptions.align === 'right' ? -1 : 1));\n chart.exportSVGElements.push(button, symbol);\n }\n /**\n * Clean up after printing a chart.\n *\n * @function Highcharts#afterPrint\n *\n * @private\n *\n * @param {Highcharts.Chart} chart\n * Chart that was (or suppose to be) printed\n *\n * @emits Highcharts.Chart#event:afterPrint\n */\n function afterPrint() {\n const chart = this;\n if (!chart.printReverseInfo) {\n return void 0;\n }\n const { childNodes, origDisplay, resetParams } = chart.printReverseInfo;\n // put the chart back in\n chart.moveContainers(chart.renderTo);\n // restore all body content\n [].forEach.call(childNodes, function (node, i) {\n if (node.nodeType === 1) {\n node.style.display = (origDisplay[i] || '');\n }\n });\n chart.isPrinting = false;\n // Reset printMaxWidth\n if (resetParams) {\n chart.setSize.apply(chart, resetParams);\n }\n delete chart.printReverseInfo;\n printingChart = void 0;\n fireEvent(chart, 'afterPrint');\n }\n /**\n * Prepare chart and document before printing a chart.\n *\n * @function Highcharts#beforePrint\n *\n * @private\n *\n *\n * @emits Highcharts.Chart#event:beforePrint\n */\n function beforePrint() {\n const chart = this, body = doc.body, printMaxWidth = chart.options.exporting.printMaxWidth, printReverseInfo = {\n childNodes: body.childNodes,\n origDisplay: [],\n resetParams: void 0\n };\n chart.isPrinting = true;\n chart.pointer?.reset(void 0, 0);\n fireEvent(chart, 'beforePrint');\n // Handle printMaxWidth\n const handleMaxWidth = printMaxWidth &&\n chart.chartWidth > printMaxWidth;\n if (handleMaxWidth) {\n printReverseInfo.resetParams = [\n chart.options.chart.width,\n void 0,\n false\n ];\n chart.setSize(printMaxWidth, void 0, false);\n }\n // hide all body content\n [].forEach.call(printReverseInfo.childNodes, function (node, i) {\n if (node.nodeType === 1) {\n printReverseInfo.origDisplay[i] = node.style.display;\n node.style.display = 'none';\n }\n });\n // pull out the chart\n chart.moveContainers(body);\n // Storage details for undo action after printing\n chart.printReverseInfo = printReverseInfo;\n }\n /**\n * @private\n */\n function chartCallback(chart) {\n const composition = chart;\n composition.renderExporting();\n addEvent(chart, 'redraw', composition.renderExporting);\n // Destroy the export elements at chart destroy\n addEvent(chart, 'destroy', composition.destroyExport);\n // Uncomment this to see a button directly below the chart, for quick\n // testing of export\n /*\n let button, viewImage, viewSource;\n if (!chart.renderer.forExport) {\n viewImage = function () {\n let div = doc.createElement('div');\n div.innerHTML = chart.getSVGForExport();\n chart.renderTo.parentNode.appendChild(div);\n };\n\n viewSource = function () {\n let pre = doc.createElement('pre');\n pre.innerHTML = chart.getSVGForExport()\n .replace(//g, '>');\n chart.renderTo.parentNode.appendChild(pre);\n };\n\n viewImage();\n\n // View SVG Image\n button = doc.createElement('button');\n button.innerHTML = 'View SVG Image';\n chart.renderTo.parentNode.appendChild(button);\n button.onclick = viewImage;\n\n // View SVG Source\n button = doc.createElement('button');\n button.innerHTML = 'View SVG Source';\n chart.renderTo.parentNode.appendChild(button);\n button.onclick = viewSource;\n }\n //*/\n }\n /**\n * @private\n */\n function compose(ChartClass, SVGRendererClass) {\n ExportingSymbols.compose(SVGRendererClass);\n Fullscreen.compose(ChartClass);\n const chartProto = ChartClass.prototype;\n if (!chartProto.exportChart) {\n chartProto.afterPrint = afterPrint;\n chartProto.exportChart = exportChart;\n chartProto.inlineStyles = inlineStyles;\n chartProto.print = print;\n chartProto.sanitizeSVG = sanitizeSVG;\n chartProto.getChartHTML = getChartHTML;\n chartProto.getSVG = getSVG;\n chartProto.getSVGForExport = getSVGForExport;\n chartProto.getFilename = getFilename;\n chartProto.moveContainers = moveContainers;\n chartProto.beforePrint = beforePrint;\n chartProto.contextMenu = contextMenu;\n chartProto.addButton = addButton;\n chartProto.destroyExport = destroyExport;\n chartProto.renderExporting = renderExporting;\n chartProto.callbacks.push(chartCallback);\n addEvent(ChartClass, 'init', onChartInit);\n if (G.isSafari) {\n win.matchMedia('print').addListener(function (mqlEvent) {\n if (!printingChart) {\n return void 0;\n }\n if (mqlEvent.matches) {\n printingChart.beforePrint();\n }\n else {\n printingChart.afterPrint();\n }\n });\n }\n defaultOptions.exporting = merge(ExportingDefaults.exporting, defaultOptions.exporting);\n defaultOptions.lang = merge(ExportingDefaults.lang, defaultOptions.lang);\n // Buttons and menus are collected in a separate config option set\n // called 'navigation'. This can be extended later to add control\n // buttons like zoom and pan right click menus.\n defaultOptions.navigation = merge(ExportingDefaults.navigation, defaultOptions.navigation);\n }\n }\n Exporting.compose = compose;\n /**\n * Display a popup menu for choosing the export type.\n *\n * @private\n * @function Highcharts.Chart#contextMenu\n * @param {string} className\n * An identifier for the menu.\n * @param {Array} items\n * A collection with text and onclicks for the items.\n * @param {number} x\n * The x position of the opener button\n * @param {number} y\n * The y position of the opener button\n * @param {number} width\n * The width of the opener button\n * @param {number} height\n * The height of the opener button\n * @requires modules/exporting\n */\n function contextMenu(className, items, x, y, width, height, button) {\n const chart = this, navOptions = chart.options.navigation, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, cacheName = 'cache-' + className, \n // For mouse leave detection\n menuPadding = Math.max(width, height);\n let innerMenu, menu = chart[cacheName];\n // Create the menu only the first time\n if (!menu) {\n // Create a HTML element above the SVG\n chart.exportContextMenu = chart[cacheName] = menu =\n createElement('div', {\n className: className\n }, {\n position: 'absolute',\n zIndex: 1000,\n padding: menuPadding + 'px',\n pointerEvents: 'auto',\n ...chart.renderer.style\n }, chart.scrollablePlotArea?.fixedDiv || chart.container);\n innerMenu = createElement('ul', { className: 'highcharts-menu' }, chart.styledMode ? {} : {\n listStyle: 'none',\n margin: 0,\n padding: 0\n }, menu);\n // Presentational CSS\n if (!chart.styledMode) {\n css(innerMenu, extend({\n MozBoxShadow: '3px 3px 10px #888',\n WebkitBoxShadow: '3px 3px 10px #888',\n boxShadow: '3px 3px 10px #888'\n }, navOptions.menuStyle));\n }\n // hide on mouse out\n menu.hideMenu = function () {\n css(menu, { display: 'none' });\n if (button) {\n button.setState(0);\n }\n chart.openMenu = false;\n // #10361, #9998\n css(chart.renderTo, { overflow: 'hidden' });\n css(chart.container, { overflow: 'hidden' });\n U.clearTimeout(menu.hideTimer);\n fireEvent(chart, 'exportMenuHidden');\n };\n // Hide the menu some time after mouse leave (#1357)\n chart.exportEvents.push(addEvent(menu, 'mouseleave', function () {\n menu.hideTimer = win.setTimeout(menu.hideMenu, 500);\n }), addEvent(menu, 'mouseenter', function () {\n U.clearTimeout(menu.hideTimer);\n }), \n // Hide it on clicking or touching outside the menu (#2258,\n // #2335, #2407)\n addEvent(doc, 'mouseup', function (e) {\n if (!chart.pointer?.inClass(e.target, className)) {\n menu.hideMenu();\n }\n }), addEvent(menu, 'click', function () {\n if (chart.openMenu) {\n menu.hideMenu();\n }\n }));\n // create the items\n items.forEach(function (item) {\n if (typeof item === 'string') {\n item = chart.options.exporting\n .menuItemDefinitions[item];\n }\n if (isObject(item, true)) {\n let element;\n if (item.separator) {\n element = createElement('hr', void 0, void 0, innerMenu);\n }\n else {\n // When chart initialized with the table, wrong button\n // text displayed, #14352.\n if (item.textKey === 'viewData' &&\n chart.isDataTableVisible) {\n item.textKey = 'hideData';\n }\n element = createElement('li', {\n className: 'highcharts-menu-item',\n onclick: function (e) {\n if (e) { // IE7\n e.stopPropagation();\n }\n menu.hideMenu();\n if (typeof item !== 'string' && item.onclick) {\n item.onclick.apply(chart, arguments);\n }\n }\n }, void 0, innerMenu);\n AST.setElementHTML(element, item.text ||\n chart.options.lang[item.textKey]);\n if (!chart.styledMode) {\n element.onmouseover = function () {\n css(this, navOptions.menuItemHoverStyle);\n };\n element.onmouseout = function () {\n css(this, navOptions.menuItemStyle);\n };\n css(element, extend({\n cursor: 'pointer'\n }, navOptions.menuItemStyle || {}));\n }\n }\n // Keep references to menu divs to be able to destroy them\n chart.exportDivElements.push(element);\n }\n });\n // Keep references to menu and innerMenu div to be able to destroy\n // them\n chart.exportDivElements.push(innerMenu, menu);\n chart.exportMenuWidth = menu.offsetWidth;\n chart.exportMenuHeight = menu.offsetHeight;\n }\n const menuStyle = { display: 'block' };\n // if outside right, right align it\n if (x + chart.exportMenuWidth > chartWidth) {\n menuStyle.right = (chartWidth - x - width - menuPadding) + 'px';\n }\n else {\n menuStyle.left = (x - menuPadding) + 'px';\n }\n // if outside bottom, bottom align it\n if (y + height + chart.exportMenuHeight > chartHeight &&\n button.alignOptions.verticalAlign !== 'top') {\n menuStyle.bottom = (chartHeight - y - menuPadding) + 'px';\n }\n else {\n menuStyle.top = (y + height - menuPadding) + 'px';\n }\n css(menu, menuStyle);\n // #10361, #9998\n css(chart.renderTo, { overflow: '' });\n css(chart.container, { overflow: '' });\n chart.openMenu = true;\n fireEvent(chart, 'exportMenuShown');\n }\n /**\n * Destroy the export buttons.\n * @private\n * @function Highcharts.Chart#destroyExport\n * @param {global.Event} [e]\n * @requires modules/exporting\n */\n function destroyExport(e) {\n const chart = e ? e.target : this, exportSVGElements = chart.exportSVGElements, exportDivElements = chart.exportDivElements, exportEvents = chart.exportEvents;\n let cacheName;\n // Destroy the extra buttons added\n if (exportSVGElements) {\n exportSVGElements.forEach((elem, i) => {\n // Destroy and null the svg elements\n if (elem) { // #1822\n elem.onclick = elem.ontouchstart = null;\n cacheName = 'cache-' + elem.menuClassName;\n if (chart[cacheName]) {\n delete chart[cacheName];\n }\n exportSVGElements[i] = elem.destroy();\n }\n });\n exportSVGElements.length = 0;\n }\n // Destroy the exporting group\n if (chart.exportingGroup) {\n chart.exportingGroup.destroy();\n delete chart.exportingGroup;\n }\n // Destroy the divs for the menu\n if (exportDivElements) {\n exportDivElements.forEach(function (elem, i) {\n if (elem) {\n // Remove the event handler\n U.clearTimeout(elem.hideTimer); // #5427\n removeEvent(elem, 'mouseleave');\n // Remove inline events\n // (chart.exportDivElements as any)[i] =\n exportDivElements[i] =\n elem.onmouseout =\n elem.onmouseover =\n elem.ontouchstart =\n elem.onclick = null;\n // Destroy the div by moving to garbage bin\n discardElement(elem);\n }\n });\n exportDivElements.length = 0;\n }\n if (exportEvents) {\n exportEvents.forEach(function (unbind) {\n unbind();\n });\n exportEvents.length = 0;\n }\n }\n /**\n * Exporting module required. Submit an SVG version of the chart to a server\n * along with some parameters for conversion.\n *\n * @sample highcharts/members/chart-exportchart/\n * Export with no options\n * @sample highcharts/members/chart-exportchart-filename/\n * PDF type and custom filename\n * @sample highcharts/members/chart-exportchart-custom-background/\n * Different chart background in export\n * @sample stock/members/chart-exportchart/\n * Export with Highcharts Stock\n *\n * @function Highcharts.Chart#exportChart\n *\n * @param {Highcharts.ExportingOptions} exportingOptions\n * Exporting options in addition to those defined in\n * [exporting](https://api.highcharts.com/highcharts/exporting).\n *\n * @param {Highcharts.Options} chartOptions\n * Additional chart options for the exported chart. For example a\n * different background color can be added here, or `dataLabels` for\n * export only.\n *\n * @requires modules/exporting\n */\n function exportChart(exportingOptions, chartOptions) {\n const svg = this.getSVGForExport(exportingOptions, chartOptions);\n // merge the options\n exportingOptions = merge(this.options.exporting, exportingOptions);\n // do the post\n HU.post(exportingOptions.url, {\n filename: exportingOptions.filename ?\n exportingOptions.filename.replace(/\\//g, '-') :\n this.getFilename(),\n type: exportingOptions.type,\n width: exportingOptions.width,\n scale: exportingOptions.scale,\n svg: svg\n }, exportingOptions.fetchOptions);\n }\n /**\n * Return the unfiltered innerHTML of the chart container. Used as hook for\n * plugins. In styled mode, it also takes care of inlining CSS style rules.\n *\n * @see Chart#getSVG\n *\n * @function Highcharts.Chart#getChartHTML\n *\n * @return {string}\n * The unfiltered SVG of the chart.\n *\n * @requires modules/exporting\n */\n function getChartHTML() {\n if (this.styledMode) {\n this.inlineStyles();\n }\n return this.container.innerHTML;\n }\n /**\n * Get the default file name used for exported charts. By default it creates\n * a file name based on the chart title.\n *\n * @function Highcharts.Chart#getFilename\n *\n * @return {string} A file name without extension.\n *\n * @requires modules/exporting\n */\n function getFilename() {\n const s = this.userOptions.title && this.userOptions.title.text;\n let filename = this.options.exporting.filename;\n if (filename) {\n return filename.replace(/\\//g, '-');\n }\n if (typeof s === 'string') {\n filename = s\n .toLowerCase()\n .replace(/<\\/?[^>]+(>|$)/g, '') // strip HTML tags\n .replace(/[\\s_]+/g, '-')\n .replace(/[^a-z0-9\\-]/g, '') // preserve only latin\n .replace(/^[\\-]+/g, '') // dashes in the start\n .replace(/[\\-]+/g, '-') // dashes in a row\n .substr(0, 24)\n .replace(/[\\-]+$/g, ''); // dashes in the end;\n }\n if (!filename || filename.length < 5) {\n filename = 'chart';\n }\n return filename;\n }\n /**\n * Return an SVG representation of the chart.\n *\n * @sample highcharts/members/chart-getsvg/\n * View the SVG from a button\n *\n * @function Highcharts.Chart#getSVG\n *\n * @param {Highcharts.Options} [chartOptions]\n * Additional chart options for the generated SVG representation. For\n * collections like `xAxis`, `yAxis` or `series`, the additional\n * options is either merged in to the original item of the same\n * `id`, or to the first item if a common id is not found.\n *\n * @return {string}\n * The SVG representation of the rendered chart.\n *\n * @emits Highcharts.Chart#event:getSVG\n *\n * @requires modules/exporting\n */\n function getSVG(chartOptions) {\n const chart = this;\n let svg, seriesOptions, \n // Copy the options and add extra options\n options = merge(chart.options, chartOptions);\n // Use userOptions to make the options chain in series right (#3881)\n options.plotOptions = merge(chart.userOptions.plotOptions, chartOptions && chartOptions.plotOptions);\n // ... and likewise with time, avoid that undefined time properties are\n // merged over legacy global time options\n options.time = merge(chart.userOptions.time, chartOptions && chartOptions.time);\n // create a sandbox where a new chart will be generated\n const sandbox = createElement('div', null, {\n position: 'absolute',\n top: '-9999em',\n width: chart.chartWidth + 'px',\n height: chart.chartHeight + 'px'\n }, doc.body);\n // get the source size\n const cssWidth = chart.renderTo.style.width, cssHeight = chart.renderTo.style.height, sourceWidth = options.exporting.sourceWidth ||\n options.chart.width ||\n (/px$/.test(cssWidth) && parseInt(cssWidth, 10)) ||\n (options.isGantt ? 800 : 600), sourceHeight = options.exporting.sourceHeight ||\n options.chart.height ||\n (/px$/.test(cssHeight) && parseInt(cssHeight, 10)) ||\n 400;\n // override some options\n extend(options.chart, {\n animation: false,\n renderTo: sandbox,\n forExport: true,\n renderer: 'SVGRenderer',\n width: sourceWidth,\n height: sourceHeight\n });\n options.exporting.enabled = false; // hide buttons in print\n delete options.data; // #3004\n // prepare for replicating the chart\n options.series = [];\n chart.series.forEach(function (serie) {\n seriesOptions = merge(serie.userOptions, {\n animation: false,\n enableMouseTracking: false,\n showCheckbox: false,\n visible: serie.visible\n });\n // Used for the navigator series that has its own option set\n if (!seriesOptions.isInternal) {\n options.series.push(seriesOptions);\n }\n });\n const colls = {};\n chart.axes.forEach(function (axis) {\n // Assign an internal key to ensure a one-to-one mapping (#5924)\n if (!axis.userOptions.internalKey) { // #6444\n axis.userOptions.internalKey = uniqueKey();\n }\n if (!axis.options.isInternal) {\n if (!colls[axis.coll]) {\n colls[axis.coll] = true;\n options[axis.coll] = [];\n }\n options[axis.coll].push(merge(axis.userOptions, {\n visible: axis.visible\n }));\n }\n });\n // Make sure the `colorAxis` object of the `defaultOptions` isn't used\n // in the chart copy's user options, because a color axis should only be\n // added when the user actually applies it.\n options.colorAxis = chart.userOptions.colorAxis;\n // Generate the chart copy\n const chartCopy = new chart.constructor(options, chart.callback);\n // Axis options and series options (#2022, #3900, #5982)\n if (chartOptions) {\n ['xAxis', 'yAxis', 'series'].forEach(function (coll) {\n const collOptions = {};\n if (chartOptions[coll]) {\n collOptions[coll] = chartOptions[coll];\n chartCopy.update(collOptions);\n }\n });\n }\n // Reflect axis extremes in the export (#5924)\n chart.axes.forEach(function (axis) {\n const axisCopy = find(chartCopy.axes, function (copy) {\n return copy.options.internalKey ===\n axis.userOptions.internalKey;\n }), extremes = axis.getExtremes(), userMin = extremes.userMin, userMax = extremes.userMax;\n if (axisCopy &&\n ((typeof userMin !== 'undefined' &&\n userMin !== axisCopy.min) || (typeof userMax !== 'undefined' &&\n userMax !== axisCopy.max))) {\n axisCopy.setExtremes(userMin, userMax, true, false);\n }\n });\n // Get the SVG from the container's innerHTML\n svg = chartCopy.getChartHTML();\n fireEvent(this, 'getSVG', { chartCopy: chartCopy });\n svg = chart.sanitizeSVG(svg, options);\n // free up memory\n options = null;\n chartCopy.destroy();\n discardElement(sandbox);\n return svg;\n }\n /**\n * @private\n * @function Highcharts.Chart#getSVGForExport\n */\n function getSVGForExport(options, chartOptions) {\n const chartExportingOptions = this.options.exporting;\n return this.getSVG(merge({ chart: { borderRadius: 0 } }, chartExportingOptions.chartOptions, chartOptions, {\n exporting: {\n sourceWidth: ((options && options.sourceWidth) ||\n chartExportingOptions.sourceWidth),\n sourceHeight: ((options && options.sourceHeight) ||\n chartExportingOptions.sourceHeight)\n }\n }));\n }\n /**\n * Make hyphenated property names out of camelCase\n * @private\n * @param {string} prop\n * Property name in camelCase\n * @return {string}\n * Hyphenated property name\n */\n function hyphenate(prop) {\n return prop.replace(/([A-Z])/g, function (a, b) {\n return '-' + b.toLowerCase();\n });\n }\n /**\n * Analyze inherited styles from stylesheets and add them inline\n *\n * @private\n * @function Highcharts.Chart#inlineStyles\n *\n * @todo What are the border styles for text about? In general, text has a\n * lot of properties.\n *\n * @todo Make it work with IE9 and IE10.\n *\n * @requires modules/exporting\n */\n function inlineStyles() {\n const denylist = inlineDenylist, allowlist = Exporting.inlineAllowlist, // For IE\n defaultStyles = {};\n let dummySVG;\n // Create an iframe where we read default styles without pollution from\n // this body\n const iframe = doc.createElement('iframe');\n css(iframe, {\n width: '1px',\n height: '1px',\n visibility: 'hidden'\n });\n doc.body.appendChild(iframe);\n const iframeDoc = (iframe.contentWindow && iframe.contentWindow.document);\n if (iframeDoc) {\n iframeDoc.body.appendChild(iframeDoc.createElementNS(SVG_NS, 'svg'));\n }\n /**\n * Call this on all elements and recurse to children\n * @private\n * @param {Highcharts.HTMLDOMElement} node\n * Element child\n */\n function recurse(node) {\n const filteredStyles = {};\n let styles, parentStyles, dummy, denylisted, allowlisted, i;\n /**\n * Check computed styles and whether they are in the allow/denylist\n * for styles or attributes.\n * @private\n * @param {string} val\n * Style value\n * @param {string} prop\n * Style property name\n */\n function filterStyles(val, prop) {\n // Check against allowlist & denylist\n denylisted = allowlisted = false;\n if (allowlist.length) {\n // Styled mode in IE has a allowlist instead. Exclude all\n // props not in this list.\n i = allowlist.length;\n while (i-- && !allowlisted) {\n allowlisted = allowlist[i].test(prop);\n }\n denylisted = !allowlisted;\n }\n // Explicitly remove empty transforms\n if (prop === 'transform' && val === 'none') {\n denylisted = true;\n }\n i = denylist.length;\n while (i-- && !denylisted) {\n denylisted = (denylist[i].test(prop) ||\n typeof val === 'function');\n }\n if (!denylisted) {\n // If parent node has the same style, it gets inherited, no\n // need to inline it. Top-level props should be diffed\n // against parent (#7687).\n if ((parentStyles[prop] !== val ||\n node.nodeName === 'svg') &&\n defaultStyles[node.nodeName][prop] !== val) {\n // Attributes\n if (!inlineToAttributes ||\n inlineToAttributes.indexOf(prop) !== -1) {\n if (val) {\n node.setAttribute(hyphenate(prop), val);\n }\n // Styles\n }\n else {\n filteredStyles[prop] = val;\n }\n }\n }\n }\n if (iframeDoc &&\n node.nodeType === 1 &&\n unstyledElements.indexOf(node.nodeName) === -1) {\n styles = win.getComputedStyle(node, null);\n parentStyles = node.nodeName === 'svg' ?\n {} :\n win.getComputedStyle(node.parentNode, null);\n // Get default styles from the browser so that we don't have to\n // add these\n if (!defaultStyles[node.nodeName]) {\n /*\n if (!dummySVG) {\n dummySVG = doc.createElementNS(H.SVG_NS, 'svg');\n dummySVG.setAttribute('version', '1.1');\n doc.body.appendChild(dummySVG);\n }\n */\n dummySVG = iframeDoc.getElementsByTagName('svg')[0];\n dummy = iframeDoc.createElementNS(node.namespaceURI, node.nodeName);\n dummySVG.appendChild(dummy);\n // Get the defaults into a standard object (simple merge\n // won't do)\n const s = win.getComputedStyle(dummy, null), defaults = {};\n for (const key in s) {\n if (typeof s[key] === 'string' &&\n !/^[0-9]+$/.test(key)) {\n defaults[key] = s[key];\n }\n }\n defaultStyles[node.nodeName] = defaults;\n // Remove default fill, otherwise text disappears when\n // exported\n if (node.nodeName === 'text') {\n delete defaultStyles.text.fill;\n }\n dummySVG.removeChild(dummy);\n }\n // Loop through all styles and add them inline if they are ok\n for (const p in styles) {\n if (\n // Some browsers put lots of styles on the prototype...\n G.isFirefox ||\n G.isMS ||\n G.isSafari || // #16902\n // ... Chrome puts them on the instance\n Object.hasOwnProperty.call(styles, p)) {\n filterStyles(styles[p], p);\n }\n }\n // Apply styles\n css(node, filteredStyles);\n // Set default stroke width (needed at least for IE)\n if (node.nodeName === 'svg') {\n node.setAttribute('stroke-width', '1px');\n }\n if (node.nodeName === 'text') {\n return;\n }\n // Recurse\n [].forEach.call(node.children || node.childNodes, recurse);\n }\n }\n /**\n * Remove the dummy objects used to get defaults\n * @private\n */\n function tearDown() {\n dummySVG.parentNode.removeChild(dummySVG);\n // Remove trash from DOM that stayed after each exporting\n iframe.parentNode.removeChild(iframe);\n }\n recurse(this.container.querySelector('svg'));\n tearDown();\n }\n /**\n * Move the chart container(s) to another div.\n *\n * @function Highcharts#moveContainers\n *\n * @private\n *\n * @param {Highcharts.HTMLDOMElement} moveTo\n * Move target\n */\n function moveContainers(moveTo) {\n const { scrollablePlotArea } = this;\n (\n // When scrollablePlotArea is active (#9533)\n scrollablePlotArea ?\n [\n scrollablePlotArea.fixedDiv,\n scrollablePlotArea.scrollingContainer\n ] :\n [this.container]).forEach(function (div) {\n moveTo.appendChild(div);\n });\n }\n /**\n * Add update methods to handle chart.update and chart.exporting.update and\n * chart.navigation.update. These must be added to the chart instance rather\n * than the Chart prototype in order to use the chart instance inside the\n * update function.\n * @private\n */\n function onChartInit() {\n const chart = this, \n /**\n * @private\n * @param {\"exporting\"|\"navigation\"} prop\n * Property name in option root\n * @param {Highcharts.ExportingOptions|Highcharts.NavigationOptions} options\n * Options to update\n * @param {boolean} [redraw=true]\n * Whether to redraw\n */\n update = (prop, options, redraw) => {\n chart.isDirtyExporting = true;\n merge(true, chart.options[prop], options);\n if (pick(redraw, true)) {\n chart.redraw();\n }\n };\n chart.exporting = {\n update: function (options, redraw) {\n update('exporting', options, redraw);\n }\n };\n // Register update() method for navigation. Cannot be set the same way\n // as for exporting, because navigation options are shared with bindings\n // which has separate update() logic.\n ChartNavigationComposition\n .compose(chart).navigation\n .addUpdate((options, redraw) => {\n update('navigation', options, redraw);\n });\n }\n /**\n * Exporting module required. Clears away other elements in the page and\n * prints the chart as it is displayed. By default, when the exporting\n * module is enabled, a context button with a drop down menu in the upper\n * right corner accesses this function.\n *\n * @sample highcharts/members/chart-print/\n * Print from a HTML button\n *\n * @function Highcharts.Chart#print\n *\n *\n * @emits Highcharts.Chart#event:beforePrint\n * @emits Highcharts.Chart#event:afterPrint\n *\n * @requires modules/exporting\n */\n function print() {\n const chart = this;\n if (chart.isPrinting) { // block the button while in printing mode\n return;\n }\n printingChart = chart;\n if (!G.isSafari) {\n chart.beforePrint();\n }\n // Give the browser time to draw WebGL content, an issue that randomly\n // appears (at least) in Chrome ~67 on the Mac (#8708).\n setTimeout(() => {\n win.focus(); // #1510\n win.print();\n // allow the browser to prepare before reverting\n if (!G.isSafari) {\n setTimeout(() => {\n chart.afterPrint();\n }, 1000);\n }\n }, 1);\n }\n /**\n * Add the buttons on chart load\n * @private\n * @function Highcharts.Chart#renderExporting\n * @requires modules/exporting\n */\n function renderExporting() {\n const chart = this, exportingOptions = chart.options.exporting, buttons = exportingOptions.buttons, isDirty = chart.isDirtyExporting || !chart.exportSVGElements;\n chart.buttonOffset = 0;\n if (chart.isDirtyExporting) {\n chart.destroyExport();\n }\n if (isDirty && exportingOptions.enabled !== false) {\n chart.exportEvents = [];\n chart.exportingGroup = chart.exportingGroup ||\n chart.renderer.g('exporting-group').attr({\n zIndex: 3 // #4955, // #8392\n }).add();\n objectEach(buttons, function (button) {\n chart.addButton(button);\n });\n chart.isDirtyExporting = false;\n }\n }\n /**\n * Exporting module only. A collection of fixes on the produced SVG to\n * account for expand properties, browser bugs.\n * Returns a cleaned SVG.\n *\n * @private\n * @function Highcharts.Chart#sanitizeSVG\n * @param {string} svg\n * SVG code to sanitize\n * @param {Highcharts.Options} options\n * Chart options to apply\n * @return {string}\n * Sanitized SVG code\n * @requires modules/exporting\n */\n function sanitizeSVG(svg, options) {\n const split = svg.indexOf('') + 6;\n let html = svg.substr(split);\n // Remove any HTML added to the container after the SVG (#894, #9087)\n svg = svg.substr(0, split);\n // Move HTML into a foreignObject\n if (options && options.exporting && options.exporting.allowHTML) {\n if (html) {\n html = '' +\n '' +\n // Some tags needs to be closed in xhtml (#13726)\n html.replace(/(<(?:img|br).*?(?=\\>))>/g, '$1 />') +\n '' +\n '';\n svg = svg.replace('', html + '');\n }\n }\n svg = svg\n .replace(/zIndex=\"[^\"]+\"/g, '')\n .replace(/symbolName=\"[^\"]+\"/g, '')\n .replace(/jQuery[0-9]+=\"[^\"]+\"/g, '')\n .replace(/url\\((\"|")(.*?)(\"|")\\;?\\)/g, 'url($2)')\n .replace(/url\\([^#]+#/g, 'url(#')\n .replace(/|undefined}\n*/ /**\n* Indicates a separator line instead of an item.\n*\n* @name Highcharts.ExportingMenuObject#separator\n* @type {boolean|undefined}\n*/\n/**\n * Possible MIME types for exporting.\n *\n * @typedef {\"image/png\"|\"image/jpeg\"|\"application/pdf\"|\"image/svg+xml\"} Highcharts.ExportingMimeTypeValue\n */\n(''); // keeps doclets above in transpiled file\n/* *\n *\n * API Options\n *\n * */\n/**\n * Fires after a chart is printed through the context menu item or the\n * `Chart.print` method.\n *\n * @sample highcharts/chart/events-beforeprint-afterprint/\n * Rescale the chart to print\n *\n * @type {Highcharts.ExportingAfterPrintCallbackFunction}\n * @since 4.1.0\n * @context Highcharts.Chart\n * @requires modules/exporting\n * @apioption chart.events.afterPrint\n */\n/**\n * Fires before a chart is printed through the context menu item or\n * the `Chart.print` method.\n *\n * @sample highcharts/chart/events-beforeprint-afterprint/\n * Rescale the chart to print\n *\n * @type {Highcharts.ExportingBeforePrintCallbackFunction}\n * @since 4.1.0\n * @context Highcharts.Chart\n * @requires modules/exporting\n * @apioption chart.events.beforePrint\n */\n(''); // keeps doclets above in transpiled file\n", "/**\n * @license Highcharts JS v@product.version@ (@product.date@)\n * @module highcharts/modules/exporting\n * @requires highcharts\n *\n * Exporting module\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */\n'use strict';\nimport Highcharts from '../../Core/Globals.js';\nimport Exporting from '../../Extensions/Exporting/Exporting.js';\nimport HttpUtilities from '../../Core/HttpUtilities.js';\nconst G = Highcharts;\nG.HttpUtilities = G.HttpUtilities || HttpUtilities;\nG.ajax = G.HttpUtilities.ajax;\nG.getJSON = G.HttpUtilities.getJSON;\nG.post = G.HttpUtilities.post;\nExporting.compose(G.Chart, G.Renderer);\nexport default Highcharts;\n", "/* *\n *\n * (c) 2015-2024 Oystein Moseng\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * Mixin for downloading content in the browser\n *\n * */\n'use strict';\n/* *\n *\n * Imports\n *\n * */\nimport H from '../Core/Globals.js';\nconst { isSafari, win, win: { document: doc } } = H;\n/* *\n *\n * Constants\n *\n * */\nconst domurl = win.URL || win.webkitURL || win;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Convert base64 dataURL to Blob if supported, otherwise returns undefined.\n * @private\n * @function Highcharts.dataURLtoBlob\n * @param {string} dataURL\n * URL to convert\n * @return {string|undefined}\n * Blob\n */\nfunction dataURLtoBlob(dataURL) {\n const parts = dataURL\n .replace(/filename=.*;/, '')\n .match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/);\n if (parts &&\n parts.length > 3 &&\n (win.atob) &&\n win.ArrayBuffer &&\n win.Uint8Array &&\n win.Blob &&\n (domurl.createObjectURL)) {\n // Try to convert data URL to Blob\n const binStr = win.atob(parts[3]), buf = new win.ArrayBuffer(binStr.length), binary = new win.Uint8Array(buf);\n for (let i = 0; i < binary.length; ++i) {\n binary[i] = binStr.charCodeAt(i);\n }\n return domurl\n .createObjectURL(new win.Blob([binary], { 'type': parts[1] }));\n }\n}\n/**\n * Download a data URL in the browser. Can also take a blob as first param.\n *\n * @private\n * @function Highcharts.downloadURL\n * @param {string|global.URL} dataURL\n * The dataURL/Blob to download\n * @param {string} filename\n * The name of the resulting file (w/extension)\n * @return {void}\n */\nfunction downloadURL(dataURL, filename) {\n const nav = win.navigator, a = doc.createElement('a');\n // IE specific blob implementation\n // Don't use for normal dataURLs\n if (typeof dataURL !== 'string' &&\n !(dataURL instanceof String) &&\n nav.msSaveOrOpenBlob) {\n nav.msSaveOrOpenBlob(dataURL, filename);\n return;\n }\n dataURL = '' + dataURL;\n const // Some browsers have limitations for data URL lengths. Try to convert\n // to Blob or fall back. Edge always needs that blob.\n isOldEdgeBrowser = /Edge\\/\\d+/.test(nav.userAgent), \n // Safari on iOS needs Blob in order to download PDF\n safariBlob = (isSafari &&\n typeof dataURL === 'string' &&\n dataURL.indexOf('data:application/pdf') === 0);\n if (safariBlob || isOldEdgeBrowser || dataURL.length > 2000000) {\n dataURL = dataURLtoBlob(dataURL) || '';\n if (!dataURL) {\n throw new Error('Failed to convert to blob');\n }\n }\n // Try HTML5 download attr if supported\n if (typeof a.download !== 'undefined') {\n a.href = dataURL;\n a.download = filename; // HTML5 download attribute\n doc.body.appendChild(a);\n a.click();\n doc.body.removeChild(a);\n }\n else {\n // No download attr, just opening data URI\n try {\n if (!win.open(dataURL, 'chart')) {\n throw new Error('Failed to open window');\n }\n }\n catch {\n // If window.open failed, try location.href\n win.location.href = dataURL;\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst DownloadURL = {\n dataURLtoBlob,\n downloadURL\n};\nexport default DownloadURL;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Declarations\n *\n * */\nconst OfflineExportingDefaults = {\n libURL: 'https://code.highcharts.com/@product.version@/lib/',\n // When offline-exporting is loaded, redefine the menu item definitions\n // related to download.\n menuItemDefinitions: {\n downloadPNG: {\n textKey: 'downloadPNG',\n onclick: function () {\n this.exportChartLocal();\n }\n },\n downloadJPEG: {\n textKey: 'downloadJPEG',\n onclick: function () {\n this.exportChartLocal({\n type: 'image/jpeg'\n });\n }\n },\n downloadSVG: {\n textKey: 'downloadSVG',\n onclick: function () {\n this.exportChartLocal({\n type: 'image/svg+xml'\n });\n }\n },\n downloadPDF: {\n textKey: 'downloadPDF',\n onclick: function () {\n this.exportChartLocal({\n type: 'application/pdf'\n });\n }\n }\n }\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default OfflineExportingDefaults;\n", "/* *\n *\n * Client side exporting module\n *\n * (c) 2015 Torstein Honsi / Oystein Moseng\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AST from '../../Core/Renderer/HTML/AST.js';\nimport Chart from '../../Core/Chart/Chart.js';\nimport D from '../../Core/Defaults.js';\nconst { defaultOptions } = D;\nimport DownloadURL from '../DownloadURL.js';\nconst { downloadURL } = DownloadURL;\nimport Exporting from '../Exporting/Exporting.js';\nimport H from '../../Core/Globals.js';\nconst { doc, win } = H;\nimport HU from '../../Core/HttpUtilities.js';\nconst { ajax } = HU;\nimport OfflineExportingDefaults from './OfflineExportingDefaults.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, error, extend, fireEvent, merge } = U;\nAST.allowedAttributes.push('data-z-index', 'fill-opacity', 'filter', 'rx', 'ry', 'stroke-dasharray', 'stroke-linejoin', 'stroke-opacity', 'text-anchor', 'transform', 'version', 'viewBox', 'visibility', 'xmlns', 'xmlns:xlink');\nAST.allowedTags.push('desc', 'clippath', 'g');\n/* *\n *\n * Composition\n *\n * */\nvar OfflineExporting;\n(function (OfflineExporting) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Constants\n *\n * */\n // Dummy object so we can reuse our canvas-tools.js without errors\n OfflineExporting.CanVGRenderer = {}, OfflineExporting.domurl = win.URL || win.webkitURL || win, \n // Milliseconds to defer image load event handlers to offset IE bug\n OfflineExporting.loadEventDeferDelay = H.isMS ? 150 : 0;\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Extends OfflineExporting with Chart.\n * @private\n */\n function compose(ChartClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.exportChartLocal) {\n chartProto.getSVGForLocalExport = getSVGForLocalExport;\n chartProto.exportChartLocal = exportChartLocal;\n // Extend the default options to use the local exporter logic\n merge(true, defaultOptions.exporting, OfflineExportingDefaults);\n }\n return ChartClass;\n }\n OfflineExporting.compose = compose;\n /**\n * Get data URL to an image of an SVG and call download on it options\n * object:\n * - **filename:** Name of resulting downloaded file without extension.\n * Default is `chart`.\n *\n * - **type:** File type of resulting download. Default is `image/png`.\n *\n * - **scale:** Scaling factor of downloaded image compared to source.\n * Default is `1`.\n *\n * - **libURL:** URL pointing to location of dependency scripts to download\n * on demand. Default is the exporting.libURL option of the global\n * Highcharts options pointing to our server.\n *\n * @function Highcharts.downloadSVGLocal\n *\n * @param {string} svg\n * The generated SVG\n *\n * @param {Highcharts.ExportingOptions} options\n * The exporting options\n *\n * @param {Function} failCallback\n * The callback function in case of errors\n *\n * @param {Function} [successCallback]\n * The callback function in case of success\n *\n */\n function downloadSVGLocal(svg, options, failCallback, successCallback) {\n const dummySVGContainer = doc.createElement('div'), imageType = options.type || 'image/png', filename = ((options.filename || 'chart') +\n '.' +\n (imageType === 'image/svg+xml' ?\n 'svg' : imageType.split('/')[1])), scale = options.scale || 1;\n let svgurl, blob, finallyHandler, libURL = (options.libURL || defaultOptions.exporting.libURL), objectURLRevoke = true, pdfFont = options.pdfFont;\n // Allow libURL to end with or without fordward slash\n libURL = libURL.slice(-1) !== '/' ? libURL + '/' : libURL;\n /*\n * Detect if we need to load TTF fonts for the PDF, then load them and\n * proceed.\n *\n * @private\n */\n const loadPdfFonts = (svgElement, callback) => {\n const hasNonASCII = (s) => (\n // eslint-disable-next-line no-control-regex\n /[^\\u0000-\\u007F\\u200B]+/.test(s));\n // Register an event in order to add the font once jsPDF is\n // initialized\n const addFont = (variant, base64) => {\n win.jspdf.jsPDF.API.events.push([\n 'initialized',\n function () {\n this.addFileToVFS(variant, base64);\n this.addFont(variant, 'HighchartsFont', variant);\n if (!this.getFontList().HighchartsFont) {\n this.setFont('HighchartsFont');\n }\n }\n ]);\n };\n // If there are no non-ASCII characters in the SVG, do not use\n // bother downloading the font files\n if (pdfFont && !hasNonASCII(svgElement.textContent || '')) {\n pdfFont = void 0;\n }\n // Add new font if the URL is declared, #6417.\n const variants = ['normal', 'italic', 'bold', 'bolditalic'];\n // Shift the first element off the variants and add as a font.\n // Then asynchronously trigger the next variant until calling the\n // callback when the variants are empty.\n let normalBase64;\n const shiftAndLoadVariant = () => {\n const variant = variants.shift();\n // All variants shifted and possibly loaded, proceed\n if (!variant) {\n return callback();\n }\n const url = pdfFont && pdfFont[variant];\n if (url) {\n ajax({\n url,\n responseType: 'blob',\n success: (data, xhr) => {\n const reader = new FileReader();\n reader.onloadend = function () {\n if (typeof this.result === 'string') {\n const base64 = this.result.split(',')[1];\n addFont(variant, base64);\n if (variant === 'normal') {\n normalBase64 = base64;\n }\n }\n shiftAndLoadVariant();\n };\n reader.readAsDataURL(xhr.response);\n },\n error: shiftAndLoadVariant\n });\n }\n else {\n // For other variants, fall back to normal text weight/style\n if (normalBase64) {\n addFont(variant, normalBase64);\n }\n shiftAndLoadVariant();\n }\n };\n shiftAndLoadVariant();\n };\n /*\n * @private\n */\n const downloadPDF = () => {\n AST.setElementHTML(dummySVGContainer, svg);\n const textElements = dummySVGContainer.getElementsByTagName('text'), \n // Copy style property to element from parents if it's not\n // there. Searches up hierarchy until it finds prop, or hits the\n // chart container.\n setStylePropertyFromParents = function (el, propName) {\n let curParent = el;\n while (curParent && curParent !== dummySVGContainer) {\n if (curParent.style[propName]) {\n let value = curParent.style[propName];\n if (propName === 'fontSize' && /em$/.test(value)) {\n value = Math.round(parseFloat(value) * 16) + 'px';\n }\n el.style[propName] = value;\n break;\n }\n curParent = curParent.parentNode;\n }\n };\n let titleElements, outlineElements;\n // Workaround for the text styling. Making sure it does pick up\n // settings for parent elements.\n [].forEach.call(textElements, function (el) {\n // Workaround for the text styling. making sure it does pick up\n // the root element\n ['fontFamily', 'fontSize']\n .forEach((property) => {\n setStylePropertyFromParents(el, property);\n });\n el.style.fontFamily = pdfFont && pdfFont.normal ?\n // Custom PDF font\n 'HighchartsFont' :\n // Generic font (serif, sans-serif etc)\n String(el.style.fontFamily &&\n el.style.fontFamily.split(' ').splice(-1));\n // Workaround for plotband with width, removing title from text\n // nodes\n titleElements = el.getElementsByTagName('title');\n [].forEach.call(titleElements, function (titleElement) {\n el.removeChild(titleElement);\n });\n // Remove all .highcharts-text-outline elements, #17170\n outlineElements =\n el.getElementsByClassName('highcharts-text-outline');\n while (outlineElements.length > 0) {\n el.removeChild(outlineElements[0]);\n }\n });\n const svgNode = dummySVGContainer.querySelector('svg');\n if (svgNode) {\n loadPdfFonts(svgNode, () => {\n svgToPdf(svgNode, 0, scale, (pdfData) => {\n try {\n downloadURL(pdfData, filename);\n if (successCallback) {\n successCallback();\n }\n }\n catch (e) {\n failCallback(e);\n }\n });\n });\n }\n };\n // Initiate download depending on file type\n if (imageType === 'image/svg+xml') {\n // SVG download. In this case, we want to use Microsoft specific\n // Blob if available\n try {\n if (typeof win.MSBlobBuilder !== 'undefined') {\n blob = new win.MSBlobBuilder();\n blob.append(svg);\n svgurl = blob.getBlob('image/svg+xml');\n }\n else {\n svgurl = svgToDataUrl(svg);\n }\n downloadURL(svgurl, filename);\n if (successCallback) {\n successCallback();\n }\n }\n catch (e) {\n failCallback(e);\n }\n }\n else if (imageType === 'application/pdf') {\n if (win.jspdf && win.jspdf.jsPDF) {\n downloadPDF();\n }\n else {\n // Must load pdf libraries first. // Don't destroy the object\n // URL yet since we are doing things asynchronously. A cleaner\n // solution would be nice, but this will do for now.\n objectURLRevoke = true;\n getScript(libURL + 'jspdf.js', function () {\n getScript(libURL + 'svg2pdf.js', downloadPDF);\n });\n }\n }\n else {\n // PNG/JPEG download - create bitmap from SVG\n svgurl = svgToDataUrl(svg);\n finallyHandler = function () {\n try {\n OfflineExporting.domurl.revokeObjectURL(svgurl);\n }\n catch (e) {\n // Ignore\n }\n };\n // First, try to get PNG by rendering on canvas\n imageToDataUrl(svgurl, imageType, {}, scale, function (imageURL) {\n // Success\n try {\n downloadURL(imageURL, filename);\n if (successCallback) {\n successCallback();\n }\n }\n catch (e) {\n failCallback(e);\n }\n }, function () {\n // Failed due to tainted canvas\n // Create new and untainted canvas\n const canvas = doc.createElement('canvas'), ctx = canvas.getContext('2d'), imageWidth = svg.match(/^]*width\\s*=\\s*\\\"?(\\d+)\\\"?[^>]*>/)[1] * scale, imageHeight = svg.match(/^]*height\\s*=\\s*\\\"?(\\d+)\\\"?[^>]*>/)[1] * scale, downloadWithCanVG = function () {\n const v = win.canvg.Canvg.fromString(ctx, svg);\n v.start();\n try {\n downloadURL(win.navigator.msSaveOrOpenBlob ?\n canvas.msToBlob() :\n canvas.toDataURL(imageType), filename);\n if (successCallback) {\n successCallback();\n }\n }\n catch (e) {\n failCallback(e);\n }\n finally {\n finallyHandler();\n }\n };\n canvas.width = imageWidth;\n canvas.height = imageHeight;\n if (win.canvg) {\n // Use preloaded canvg\n downloadWithCanVG();\n }\n else {\n // Must load canVG first. // Don't destroy the object\n // URL yet since we are doing things asynchronously. A\n // cleaner solution would be nice, but this will do for\n // now.\n objectURLRevoke = true;\n getScript(libURL + 'canvg.js', function () {\n downloadWithCanVG();\n });\n }\n }, \n // No canvas support\n failCallback, \n // Failed to load image\n failCallback, \n // Finally\n function () {\n if (objectURLRevoke) {\n finallyHandler();\n }\n });\n }\n }\n OfflineExporting.downloadSVGLocal = downloadSVGLocal;\n /* eslint-disable valid-jsdoc */\n /**\n * Exporting and offline-exporting modules required. Export a chart to\n * an image locally in the user's browser.\n *\n * @function Highcharts.Chart#exportChartLocal\n *\n * @param {Highcharts.ExportingOptions} [exportingOptions]\n * Exporting options, the same as in\n * {@link Highcharts.Chart#exportChart}.\n *\n * @param {Highcharts.Options} [chartOptions]\n * Additional chart options for the exported chart. For example\n * a different background color can be added here, or\n * `dataLabels` for export only.\n *\n *\n * @requires modules/exporting\n * @requires modules/offline-exporting\n */\n function exportChartLocal(exportingOptions, chartOptions) {\n const chart = this, options = merge(chart.options.exporting, exportingOptions), fallbackToExportServer = function (err) {\n if (options.fallbackToExportServer === false) {\n if (options.error) {\n options.error(options, err);\n }\n else {\n error(28, true); // Fallback disabled\n }\n }\n else {\n chart.exportChart(options);\n }\n }, svgSuccess = function (svg) {\n // If SVG contains foreignObjects PDF fails in all browsers\n // and all exports except SVG will fail in IE, as both CanVG\n // and svg2pdf choke on this. Gracefully fall back.\n if (svg.indexOf(' -1 &&\n options.type !== 'image/svg+xml' &&\n (H.isMS || options.type === 'application/pdf')) {\n fallbackToExportServer(new Error('Image type not supported for charts with embedded HTML'));\n }\n else {\n OfflineExporting.downloadSVGLocal(svg, extend({ filename: chart.getFilename() }, options), fallbackToExportServer, () => fireEvent(chart, 'exportChartLocalSuccess'));\n }\n }, \n // Return true if the SVG contains images with external data. With\n // the boost module there are `image` elements with encoded PNGs,\n // these are supported by svg2pdf and should pass (#10243).\n hasExternalImages = function () {\n return [].some.call(chart.container.getElementsByTagName('image'), function (image) {\n const href = image.getAttribute('href');\n return (href !== '' &&\n typeof href === 'string' &&\n href.indexOf('data:') !== 0);\n });\n };\n // If we are on IE and in styled mode, add an allowlist to the renderer\n // for inline styles that we want to pass through. There are so many\n // styles by default in IE that we don't want to denylist them all.\n if (H.isMS && chart.styledMode && !Exporting.inlineAllowlist.length) {\n Exporting.inlineAllowlist.push(/^blockSize/, /^border/, /^caretColor/, /^color/, /^columnRule/, /^columnRuleColor/, /^cssFloat/, /^cursor/, /^fill$/, /^fillOpacity/, /^font/, /^inlineSize/, /^length/, /^lineHeight/, /^opacity/, /^outline/, /^parentRule/, /^rx$/, /^ry$/, /^stroke/, /^textAlign/, /^textAnchor/, /^textDecoration/, /^transform/, /^vectorEffect/, /^visibility/, /^x$/, /^y$/);\n }\n // Always fall back on:\n // - MS browsers: Embedded images JPEG/PNG, or any PDF\n // - Embedded images and PDF\n if ((H.isMS &&\n (options.type === 'application/pdf' ||\n chart.container.getElementsByTagName('image').length &&\n options.type !== 'image/svg+xml')) || (options.type === 'application/pdf' &&\n hasExternalImages())) {\n fallbackToExportServer(new Error('Image type not supported for this chart/browser.'));\n return;\n }\n chart.getSVGForLocalExport(options, chartOptions || {}, fallbackToExportServer, svgSuccess);\n }\n /**\n * Downloads a script and executes a callback when done.\n *\n * @private\n * @function getScript\n * @param {string} scriptLocation\n * @param {Function} callback\n */\n function getScript(scriptLocation, callback) {\n const head = doc.getElementsByTagName('head')[0], script = doc.createElement('script');\n script.type = 'text/javascript';\n script.src = scriptLocation;\n script.onload = callback;\n script.onerror = function () {\n error('Error loading script ' + scriptLocation);\n };\n head.appendChild(script);\n }\n OfflineExporting.getScript = getScript;\n /**\n * Get SVG of chart prepared for client side export. This converts\n * embedded images in the SVG to data URIs. It requires the regular\n * exporting module. The options and chartOptions arguments are passed\n * to the getSVGForExport function.\n *\n * @private\n * @function Highcharts.Chart#getSVGForLocalExport\n * @param {Highcharts.ExportingOptions} options\n * @param {Highcharts.Options} chartOptions\n * @param {Function} failCallback\n * @param {Function} successCallback\n */\n function getSVGForLocalExport(options, chartOptions, failCallback, successCallback) {\n const chart = this, \n // After grabbing the SVG of the chart's copy container we need\n // to do sanitation on the SVG\n sanitize = (svg) => chart.sanitizeSVG(svg, chartCopyOptions), \n // When done with last image we have our SVG\n checkDone = () => {\n if (images && imagesEmbedded === imagesLength) {\n successCallback(sanitize(chartCopyContainer.innerHTML));\n }\n }, \n // Success handler, we converted image to base64!\n embeddedSuccess = (imageURL, imageType, callbackArgs) => {\n ++imagesEmbedded;\n // Change image href in chart copy\n callbackArgs.imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageURL);\n checkDone();\n };\n let el, chartCopyContainer, chartCopyOptions, href = null, images, imagesLength = 0, imagesEmbedded = 0;\n // Hook into getSVG to get a copy of the chart copy's\n // container (#8273)\n chart.unbindGetSVG = addEvent(chart, 'getSVG', (e) => {\n chartCopyOptions = e.chartCopy.options;\n chartCopyContainer = e.chartCopy.container.cloneNode(true);\n images = chartCopyContainer && chartCopyContainer\n .getElementsByTagName('image') || [];\n imagesLength = images.length;\n });\n // Trigger hook to get chart copy\n chart.getSVGForExport(options, chartOptions);\n try {\n // If there are no images to embed, the SVG is okay now.\n if (!images || !images.length) {\n // Use SVG of chart copy\n successCallback(sanitize(chartCopyContainer.innerHTML));\n return;\n }\n // Go through the images we want to embed\n for (let i = 0; i < images.length; i++) {\n el = images[i];\n href = el.getAttributeNS('http://www.w3.org/1999/xlink', 'href');\n if (href) {\n OfflineExporting.imageToDataUrl(href, 'image/png', { imageElement: el }, options.scale, embeddedSuccess, \n // Tainted canvas\n failCallback, \n // No canvas support\n failCallback, \n // Failed to load source\n failCallback);\n // Hidden, boosted series have blank href (#10243)\n }\n else {\n imagesEmbedded++;\n el.parentNode.removeChild(el);\n i--;\n checkDone();\n }\n }\n }\n catch (e) {\n failCallback(e);\n }\n // Clean up\n chart.unbindGetSVG();\n }\n /**\n * Get data:URL from image URL. Pass in callbacks to handle results.\n *\n * @private\n * @function Highcharts.imageToDataUrl\n *\n * @param {string} imageURL\n *\n * @param {string} imageType\n *\n * @param {*} callbackArgs\n * callbackArgs is used only by callbacks.\n *\n * @param {number} scale\n *\n * @param {Function} successCallback\n * Receives four arguments: imageURL, imageType, callbackArgs,\n * and scale.\n *\n * @param {Function} taintedCallback\n * Receives four arguments: imageURL, imageType, callbackArgs,\n * and scale.\n *\n * @param {Function} noCanvasSupportCallback\n * Receives four arguments: imageURL, imageType, callbackArgs,\n * and scale.\n *\n * @param {Function} failedLoadCallback\n * Receives four arguments: imageURL, imageType, callbackArgs,\n * and scale.\n *\n * @param {Function} [finallyCallback]\n * finallyCallback is always called at the end of the process. All\n * callbacks receive four arguments: imageURL, imageType,\n * callbackArgs, and scale.\n */\n function imageToDataUrl(imageURL, imageType, callbackArgs, scale, successCallback, taintedCallback, noCanvasSupportCallback, failedLoadCallback, finallyCallback) {\n let img = new win.Image(), taintedHandler;\n const loadHandler = () => {\n setTimeout(function () {\n const canvas = doc.createElement('canvas'), ctx = canvas.getContext && canvas.getContext('2d');\n let dataURL;\n try {\n if (!ctx) {\n noCanvasSupportCallback(imageURL, imageType, callbackArgs, scale);\n }\n else {\n canvas.height = img.height * scale;\n canvas.width = img.width * scale;\n ctx.drawImage(img, 0, 0, canvas.width, canvas.height);\n // Now we try to get the contents of the canvas.\n try {\n dataURL = canvas.toDataURL(imageType);\n successCallback(dataURL, imageType, callbackArgs, scale);\n }\n catch (e) {\n taintedHandler(imageURL, imageType, callbackArgs, scale);\n }\n }\n }\n finally {\n if (finallyCallback) {\n finallyCallback(imageURL, imageType, callbackArgs, scale);\n }\n }\n // IE bug where image is not always ready despite calling load\n // event.\n }, OfflineExporting.loadEventDeferDelay);\n }, \n // Image load failed (e.g. invalid URL)\n errorHandler = () => {\n failedLoadCallback(imageURL, imageType, callbackArgs, scale);\n if (finallyCallback) {\n finallyCallback(imageURL, imageType, callbackArgs, scale);\n }\n };\n // This is called on load if the image drawing to canvas failed with a\n // security error. We retry the drawing with crossOrigin set to\n // Anonymous.\n taintedHandler = () => {\n img = new win.Image();\n taintedHandler = taintedCallback;\n // Must be set prior to loading image source\n img.crossOrigin = 'Anonymous';\n img.onload = loadHandler;\n img.onerror = errorHandler;\n img.src = imageURL;\n };\n img.onload = loadHandler;\n img.onerror = errorHandler;\n img.src = imageURL;\n }\n OfflineExporting.imageToDataUrl = imageToDataUrl;\n /**\n * Get blob URL from SVG code. Falls back to normal data URI.\n *\n * @private\n * @function Highcharts.svgToDataURL\n */\n function svgToDataUrl(svg) {\n // Webkit and not chrome\n const userAgent = win.navigator.userAgent;\n const webKit = (userAgent.indexOf('WebKit') > -1 &&\n userAgent.indexOf('Chrome') < 0);\n try {\n // Safari requires data URI since it doesn't allow navigation to\n // blob URLs. ForeignObjects also don't work well in Blobs in Chrome\n // (#14780).\n if (!webKit && svg.indexOf(' width ? 'p' : 'l', 'pt', [width, height]);\n // Workaround for #7090, hidden elements were drawn anyway. It comes\n // down to https://github.com/yWorks/svg2pdf.js/issues/28. Check this\n // later.\n [].forEach.call(svgElement.querySelectorAll('*[visibility=\"hidden\"]'), function (node) {\n node.parentNode.removeChild(node);\n });\n // Workaround for #13948, multiple stops in linear gradient set to 0\n // causing error in Acrobat\n const gradients = svgElement.querySelectorAll('linearGradient');\n for (let index = 0; index < gradients.length; index++) {\n const gradient = gradients[index];\n const stops = gradient.querySelectorAll('stop');\n let i = 0;\n while (i < stops.length &&\n stops[i].getAttribute('offset') === '0' &&\n stops[i + 1].getAttribute('offset') === '0') {\n stops[i].remove();\n i++;\n }\n }\n // Workaround for #15135, zero width spaces, which Highcharts uses\n // to break lines, are not correctly rendered in PDF. Replace it\n // with a regular space and offset by some pixels to compensate.\n [].forEach.call(svgElement.querySelectorAll('tspan'), (tspan) => {\n if (tspan.textContent === '\\u200B') {\n tspan.textContent = ' ';\n tspan.setAttribute('dx', -5);\n }\n });\n pdfDoc.svg(svgElement, {\n x: 0,\n y: 0,\n width,\n height,\n removeInvalid: true\n }).then(() => callback(pdfDoc.output('datauristring')));\n }\n OfflineExporting.svgToPdf = svgToPdf;\n})(OfflineExporting || (OfflineExporting = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default OfflineExporting;\n", "/**\n * @license Highcharts JS v@product.version@ (@product.date@)\n * @module highcharts/modules/offline-exporting\n * @requires highcharts\n * @requires highcharts/modules/exporting\n *\n * Client side exporting module\n *\n * (c) 2015-2024 Torstein Honsi / Oystein Moseng\n *\n * License: www.highcharts.com/license\n */\n'use strict';\nimport Highcharts from '../../Core/Globals.js';\nimport DownloadURL from '../../Extensions/DownloadURL.js';\nimport OfflineExporting from '../../Extensions/OfflineExporting/OfflineExporting.js';\nconst G = Highcharts;\n// Compatibility\nG.dataURLtoBlob = G.dataURLtoBlob || DownloadURL.dataURLtoBlob;\nG.downloadSVGLocal = OfflineExporting.downloadSVGLocal;\nG.downloadURL = G.downloadURL || DownloadURL.downloadURL;\n// Compose\nOfflineExporting.compose(G.Chart);\nexport default Highcharts;\n", "/* *\n *\n * Experimental data export module for Highcharts\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Constants\n *\n * */\n/**\n * @optionparent exporting\n * @private\n */\nconst exporting = {\n /**\n * Caption for the data table. Same as chart title by default. Set to\n * `false` to disable.\n *\n * @sample highcharts/export-data/multilevel-table\n * Multiple table headers\n *\n * @type {boolean|string}\n * @since 6.0.4\n * @requires modules/export-data\n * @apioption exporting.tableCaption\n */\n /**\n * Options for exporting data to CSV or ExCel, or displaying the data\n * in a HTML table or a JavaScript structure.\n *\n * This module adds data export options to the export menu and provides\n * functions like `Chart.getCSV`, `Chart.getTable`, `Chart.getDataRows`\n * and `Chart.viewData`.\n *\n * The XLS converter is limited and only creates a HTML string that is\n * passed for download, which works but creates a warning before\n * opening. The workaround for this is to use a third party XLSX\n * converter, as demonstrated in the sample below.\n *\n * @sample highcharts/export-data/categorized/ Categorized data\n * @sample highcharts/export-data/stock-timeaxis/ Highcharts Stock time axis\n * @sample highcharts/export-data/xlsx/\n * Using a third party XLSX converter\n *\n * @since 6.0.0\n * @requires modules/export-data\n */\n csv: {\n /**\n *\n * Options for annotations in the export-data table.\n *\n * @since 8.2.0\n * @requires modules/export-data\n * @requires modules/annotations\n *\n *\n */\n annotations: {\n /**\n * The way to mark the separator for annotations\n * combined in one export-data table cell.\n *\n * @since 8.2.0\n * @requires modules/annotations\n */\n itemDelimiter: '; ',\n /**\n * When several labels are assigned to a specific point,\n * they will be displayed in one field in the table.\n *\n * @sample highcharts/export-data/join-annotations/\n * Concatenate point annotations with itemDelimiter set.\n *\n * @since 8.2.0\n * @requires modules/annotations\n */\n join: false\n },\n /**\n * Formatter callback for the column headers. Parameters are:\n * - `item` - The series or axis object)\n * - `key` - The point key, for example y or z\n * - `keyLength` - The amount of value keys for this item, for\n * example a range series has the keys `low` and `high` so the\n * key length is 2.\n *\n * If [useMultiLevelHeaders](#exporting.useMultiLevelHeaders) is\n * true, columnHeaderFormatter by default returns an object with\n * columnTitle and topLevelColumnTitle for each key. Columns with\n * the same topLevelColumnTitle have their titles merged into a\n * single cell with colspan for table/Excel export.\n *\n * If `useMultiLevelHeaders` is false, or for CSV export, it returns\n * the series name, followed by the key if there is more than one\n * key.\n *\n * For the axis it returns the axis title or \"Category\" or\n * \"DateTime\" by default.\n *\n * Return `false` to use Highcharts' proposed header.\n *\n * @sample highcharts/export-data/multilevel-table\n * Multiple table headers\n *\n * @type {Function|null}\n */\n columnHeaderFormatter: null,\n /**\n * Which date format to use for exported dates on a datetime X axis.\n * See `Highcharts.dateFormat`.\n */\n dateFormat: '%Y-%m-%d %H:%M:%S',\n /**\n * Which decimal point to use for exported CSV. Defaults to the same\n * as the browser locale, typically `.` (English) or `,` (German,\n * French etc).\n *\n * @type {string|null}\n * @since 6.0.4\n */\n decimalPoint: null,\n /**\n * The item delimiter in the exported data. Use `;` for direct\n * exporting to Excel. Defaults to a best guess based on the browser\n * locale. If the locale _decimal point_ is `,`, the `itemDelimiter`\n * defaults to `;`, otherwise the `itemDelimiter` defaults to `,`.\n *\n * @type {string|null}\n */\n itemDelimiter: null,\n /**\n * The line delimiter in the exported data, defaults to a newline.\n */\n lineDelimiter: '\\n'\n },\n /**\n * Show a HTML table below the chart with the chart's current data.\n *\n * @sample highcharts/export-data/showtable/\n * Show the table\n * @sample highcharts/studies/exporting-table-html\n * Experiment with putting the table inside the subtitle to\n * allow exporting it.\n *\n * @since 6.0.0\n * @requires modules/export-data\n */\n showTable: false,\n /**\n * Use multi level headers in data table. If [csv.columnHeaderFormatter\n * ](#exporting.csv.columnHeaderFormatter) is defined, it has to return\n * objects in order for multi level headers to work.\n *\n * @sample highcharts/export-data/multilevel-table\n * Multiple table headers\n *\n * @since 6.0.4\n * @requires modules/export-data\n */\n useMultiLevelHeaders: true,\n /**\n * If using multi level table headers, use rowspans for headers that\n * have only one level.\n *\n * @sample highcharts/export-data/multilevel-table\n * Multiple table headers\n *\n * @since 6.0.4\n * @requires modules/export-data\n */\n useRowspanHeaders: true,\n /**\n * Display a message when export is in progress.\n * Uses [Chart.setLoading()](/class-reference/Highcharts.Chart#setLoading)\n *\n * The message can be altered by changing [](#lang.exporting.exportInProgress)\n *\n * @since 11.3.0\n * @requires modules/export-data\n */\n showExportInProgress: true\n};\n/**\n * @optionparent lang\n * @private\n */\nconst lang = {\n /**\n * The text for the menu item.\n *\n * @since 6.0.0\n * @requires modules/export-data\n */\n downloadCSV: 'Download CSV',\n /**\n * The text for the menu item.\n *\n * @since 6.0.0\n * @requires modules/export-data\n */\n downloadXLS: 'Download XLS',\n /**\n * The text for exported table.\n *\n * @since 8.1.0\n * @requires modules/export-data\n */\n exportData: {\n /**\n * The annotation column title.\n */\n annotationHeader: 'Annotations',\n /**\n * The category column title.\n */\n categoryHeader: 'Category',\n /**\n * The category column title when axis type set to \"datetime\".\n */\n categoryDatetimeHeader: 'DateTime'\n },\n /**\n * The text for the menu item.\n *\n * @since 6.0.0\n * @requires modules/export-data\n */\n viewData: 'View data table',\n /**\n * The text for the menu item.\n *\n * @since 8.2.0\n * @requires modules/export-data\n */\n hideData: 'Hide data table',\n /**\n * Text to show when export is in progress.\n *\n * @since 11.3.0\n * @requires modules/export-data\n */\n exportInProgress: 'Exporting...'\n};\n/* *\n *\n * Default Export\n *\n * */\nconst ExportDataDefaults = {\n exporting,\n lang\n};\nexport default ExportDataDefaults;\n/* *\n *\n * API Options\n *\n * */\n/**\n * Callback that fires while exporting data. This allows the modification of\n * data rows before processed into the final format.\n *\n * @type {Highcharts.ExportDataCallbackFunction}\n * @context Highcharts.Chart\n * @requires modules/export-data\n * @apioption chart.events.exportData\n */\n/**\n * When set to `false` will prevent the series data from being included in\n * any form of data export.\n *\n * Since version 6.0.0 until 7.1.0 the option was existing undocumented\n * as `includeInCSVExport`.\n *\n * @type {boolean}\n * @since 7.1.0\n * @requires modules/export-data\n * @apioption plotOptions.series.includeInDataExport\n */\n(''); // keep doclets above in JS file\n", "/* *\n *\n * Experimental data export module for Highcharts\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n// @todo\n// - Set up systematic tests for all series types, paired with tests of the data\n// module importing the same data.\n'use strict';\nimport AST from '../../Core/Renderer/HTML/AST.js';\nimport D from '../../Core/Defaults.js';\nconst { getOptions, setOptions } = D;\nimport DownloadURL from '../DownloadURL.js';\nconst { downloadURL } = DownloadURL;\nimport ExportDataDefaults from './ExportDataDefaults.js';\nimport H from '../../Core/Globals.js';\nconst { doc, win } = H;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, defined, extend, find, fireEvent, isNumber, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Wrapper function for the download functions, which handles showing and hiding\n * the loading message\n *\n * @private\n *\n */\nfunction wrapLoading(fn) {\n const showMessage = Boolean(this.options.exporting?.showExportInProgress);\n // Prefer requestAnimationFrame if available\n const timeoutFn = win.requestAnimationFrame || setTimeout;\n // Outer timeout avoids menu freezing on click\n timeoutFn(() => {\n showMessage && this.showLoading(this.options.lang.exportInProgress);\n timeoutFn(() => {\n try {\n fn.call(this);\n }\n finally {\n showMessage && this.hideLoading();\n }\n });\n });\n}\n/**\n * Generates a data URL of CSV for local download in the browser. This is the\n * default action for a click on the 'Download CSV' button.\n *\n * See {@link Highcharts.Chart#getCSV} to get the CSV data itself.\n *\n * @function Highcharts.Chart#downloadCSV\n *\n * @requires modules/exporting\n */\nfunction chartDownloadCSV() {\n wrapLoading.call(this, () => {\n const csv = this.getCSV(true);\n downloadURL(getBlobFromContent(csv, 'text/csv') ||\n 'data:text/csv,\\uFEFF' + encodeURIComponent(csv), this.getFilename() + '.csv');\n });\n}\n/**\n * Generates a data URL of an XLS document for local download in the browser.\n * This is the default action for a click on the 'Download XLS' button.\n *\n * See {@link Highcharts.Chart#getTable} to get the table data itself.\n *\n * @function Highcharts.Chart#downloadXLS\n *\n * @requires modules/exporting\n */\nfunction chartDownloadXLS() {\n wrapLoading.call(this, () => {\n const uri = 'data:application/vnd.ms-excel;base64,', template = '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n this.getTable(true) +\n '', base64 = function (s) {\n return win.btoa(unescape(encodeURIComponent(s))); // #50\n };\n downloadURL(getBlobFromContent(template, 'application/vnd.ms-excel') ||\n uri + base64(template), this.getFilename() + '.xls');\n });\n}\n/**\n * Export-data module required. Returns the current chart data as a CSV string.\n *\n * @function Highcharts.Chart#getCSV\n *\n * @param {boolean} [useLocalDecimalPoint]\n * Whether to use the local decimal point as detected from the browser.\n * This makes it easier to export data to Excel in the same locale as the\n * user is.\n *\n * @return {string}\n * CSV representation of the data\n */\nfunction chartGetCSV(useLocalDecimalPoint) {\n let csv = '';\n const rows = this.getDataRows(), csvOptions = this.options.exporting.csv, decimalPoint = pick(csvOptions.decimalPoint, csvOptions.itemDelimiter !== ',' && useLocalDecimalPoint ?\n (1.1).toLocaleString()[1] :\n '.'), \n // Use ';' for direct to Excel\n itemDelimiter = pick(csvOptions.itemDelimiter, decimalPoint === ',' ? ';' : ','), \n // '\\n' isn't working with the js csv data extraction\n lineDelimiter = csvOptions.lineDelimiter;\n // Transform the rows to CSV\n rows.forEach((row, i) => {\n let val = '', j = row.length;\n while (j--) {\n val = row[j];\n if (typeof val === 'string') {\n val = `\"${val}\"`;\n }\n if (typeof val === 'number') {\n if (decimalPoint !== '.') {\n val = val.toString().replace('.', decimalPoint);\n }\n }\n row[j] = val;\n }\n // The first row is the header - it defines the number of columns.\n // Empty columns between not-empty cells are covered in the getDataRows\n // method.\n // Now add empty values only to the end of the row so all rows have\n // the same number of columns, #17186\n row.length = rows.length ? rows[0].length : 0;\n // Add the values\n csv += row.join(itemDelimiter);\n // Add the line delimiter\n if (i < rows.length - 1) {\n csv += lineDelimiter;\n }\n });\n return csv;\n}\n/**\n * Export-data module required. Returns a two-dimensional array containing the\n * current chart data.\n *\n * @function Highcharts.Chart#getDataRows\n *\n * @param {boolean} [multiLevelHeaders]\n * Use multilevel headers for the rows by default. Adds an extra row with\n * top level headers. If a custom columnHeaderFormatter is defined, this\n * can override the behavior.\n *\n * @return {Array>}\n * The current chart data\n *\n * @emits Highcharts.Chart#event:exportData\n */\nfunction chartGetDataRows(multiLevelHeaders) {\n const hasParallelCoords = this.hasParallelCoordinates, time = this.time, csvOptions = ((this.options.exporting && this.options.exporting.csv) || {}), xAxes = this.xAxis, rows = {}, rowArr = [], topLevelColumnTitles = [], columnTitles = [], langOptions = this.options.lang, exportDataOptions = langOptions.exportData, categoryHeader = exportDataOptions.categoryHeader, categoryDatetimeHeader = exportDataOptions.categoryDatetimeHeader, \n // Options\n columnHeaderFormatter = function (item, key, keyLength) {\n if (csvOptions.columnHeaderFormatter) {\n const s = csvOptions.columnHeaderFormatter(item, key, keyLength);\n if (s !== false) {\n return s;\n }\n }\n if (!item) {\n return categoryHeader;\n }\n if (!item.bindAxes) {\n return (item.options.title &&\n item.options.title.text) || (item.dateTime ?\n categoryDatetimeHeader :\n categoryHeader);\n }\n if (multiLevelHeaders) {\n return {\n columnTitle: keyLength > 1 ?\n key :\n item.name,\n topLevelColumnTitle: item.name\n };\n }\n return item.name + (keyLength > 1 ? ' (' + key + ')' : '');\n }, \n // Map the categories for value axes\n getCategoryAndDateTimeMap = function (series, pointArrayMap, pIdx) {\n const categoryMap = {}, dateTimeValueAxisMap = {};\n pointArrayMap.forEach(function (prop) {\n const axisName = ((series.keyToAxis && series.keyToAxis[prop]) ||\n prop) + 'Axis', \n // Points in parallel coordinates refers to all yAxis\n // not only `series.yAxis`\n axis = isNumber(pIdx) ?\n series.chart[axisName][pIdx] :\n series[axisName];\n categoryMap[prop] = (axis && axis.categories) || [];\n dateTimeValueAxisMap[prop] = (axis && axis.dateTime);\n });\n return {\n categoryMap: categoryMap,\n dateTimeValueAxisMap: dateTimeValueAxisMap\n };\n }, \n // Create point array depends if xAxis is category\n // or point.name is defined #13293\n getPointArray = function (series, xAxis) {\n const pointArrayMap = series.pointArrayMap || ['y'], namedPoints = series.data.some((d) => (typeof d.y !== 'undefined') && d.name);\n // If there are points with a name, we also want the x value in the\n // table\n if (namedPoints &&\n xAxis &&\n !xAxis.categories &&\n series.exportKey !== 'name') {\n return ['x', ...pointArrayMap];\n }\n return pointArrayMap;\n }, xAxisIndices = [];\n let xAxis, dataRows, columnTitleObj, i = 0, // Loop the series and index values\n x, xTitle;\n this.series.forEach(function (series) {\n const keys = series.options.keys, xAxis = series.xAxis, pointArrayMap = keys || getPointArray(series, xAxis), valueCount = pointArrayMap.length, xTaken = !series.requireSorting && {}, xAxisIndex = xAxes.indexOf(xAxis);\n let categoryAndDatetimeMap = getCategoryAndDateTimeMap(series, pointArrayMap), mockSeries, j;\n if (series.options.includeInDataExport !== false &&\n !series.options.isInternal &&\n series.visible !== false // #55\n ) {\n // Build a lookup for X axis index and the position of the first\n // series that belongs to that X axis. Includes -1 for non-axis\n // series types like pies.\n if (!find(xAxisIndices, function (index) {\n return index[0] === xAxisIndex;\n })) {\n xAxisIndices.push([xAxisIndex, i]);\n }\n // Compute the column headers and top level headers, usually the\n // same as series names\n j = 0;\n while (j < valueCount) {\n columnTitleObj = columnHeaderFormatter(series, pointArrayMap[j], pointArrayMap.length);\n columnTitles.push(columnTitleObj.columnTitle || columnTitleObj);\n if (multiLevelHeaders) {\n topLevelColumnTitles.push(columnTitleObj.topLevelColumnTitle ||\n columnTitleObj);\n }\n j++;\n }\n mockSeries = {\n chart: series.chart,\n autoIncrement: series.autoIncrement,\n options: series.options,\n pointArrayMap: series.pointArrayMap,\n index: series.index\n };\n // Export directly from options.data because we need the uncropped\n // data (#7913), and we need to support Boost (#7026).\n series.options.data.forEach(function eachData(options, pIdx) {\n const mockPoint = { series: mockSeries };\n let key, prop, val;\n // In parallel coordinates chart, each data point is connected\n // to a separate yAxis, conform this\n if (hasParallelCoords) {\n categoryAndDatetimeMap = getCategoryAndDateTimeMap(series, pointArrayMap, pIdx);\n }\n series.pointClass.prototype.applyOptions.apply(mockPoint, [options]);\n const name = series.data[pIdx] && series.data[pIdx].name;\n key = (mockPoint.x ?? '') + ',' + name;\n j = 0;\n // Pies, funnels, geo maps etc. use point name in X row\n if (!xAxis ||\n series.exportKey === 'name' ||\n (!hasParallelCoords && xAxis && xAxis.hasNames) && name) {\n key = name;\n }\n if (xTaken) {\n if (xTaken[key]) {\n key += '|' + pIdx;\n }\n xTaken[key] = true;\n }\n if (!rows[key]) {\n rows[key] = [];\n rows[key].xValues = [];\n // ES5 replacement for Array.from / fill.\n const arr = [];\n for (let i = 0; i < series.chart.series.length; i++) {\n arr[i] = 0;\n }\n // Create pointers array, holding information how many\n // duplicates of specific x occurs in each series.\n // Used for creating rows with duplicates.\n rows[key].pointers = arr;\n rows[key].pointers[series.index] = 1;\n }\n else {\n // Handle duplicates (points with the same x), by creating\n // extra rows based on pointers for better performance.\n const modifiedKey = `${key},${rows[key].pointers[series.index]}`, originalKey = key;\n if (rows[key].pointers[series.index]) {\n if (!rows[modifiedKey]) {\n rows[modifiedKey] = [];\n rows[modifiedKey].xValues = [];\n rows[modifiedKey].pointers = [];\n }\n key = modifiedKey;\n }\n rows[originalKey].pointers[series.index] += 1;\n }\n rows[key].x = mockPoint.x;\n rows[key].name = name;\n rows[key].xValues[xAxisIndex] = mockPoint.x;\n while (j < valueCount) {\n prop = pointArrayMap[j]; // `y`, `z` etc\n val = mockPoint[prop];\n rows[key][i + j] = pick(\n // Y axis category if present\n categoryAndDatetimeMap.categoryMap[prop][val], \n // Datetime yAxis\n categoryAndDatetimeMap.dateTimeValueAxisMap[prop] ?\n time.dateFormat(csvOptions.dateFormat, val) :\n null, \n // Linear/log yAxis\n val);\n j++;\n }\n });\n i = i + j;\n }\n });\n // Make a sortable array\n for (x in rows) {\n if (Object.hasOwnProperty.call(rows, x)) {\n rowArr.push(rows[x]);\n }\n }\n let xAxisIndex, column;\n // Add computed column headers and top level headers to final row set\n dataRows = multiLevelHeaders ? [topLevelColumnTitles, columnTitles] :\n [columnTitles];\n i = xAxisIndices.length;\n while (i--) { // Start from end to splice in\n xAxisIndex = xAxisIndices[i][0];\n column = xAxisIndices[i][1];\n xAxis = xAxes[xAxisIndex];\n // Sort it by X values\n rowArr.sort(function (// eslint-disable-line no-loop-func\n a, b) {\n return a.xValues[xAxisIndex] - b.xValues[xAxisIndex];\n });\n // Add header row\n xTitle = columnHeaderFormatter(xAxis);\n dataRows[0].splice(column, 0, xTitle);\n if (multiLevelHeaders && dataRows[1]) {\n // If using multi level headers, we just added top level header.\n // Also add for sub level\n dataRows[1].splice(column, 0, xTitle);\n }\n // Add the category column\n rowArr.forEach(function (// eslint-disable-line no-loop-func\n row) {\n let category = row.name;\n if (xAxis && !defined(category)) {\n if (xAxis.dateTime) {\n if (row.x instanceof Date) {\n row.x = row.x.getTime();\n }\n category = time.dateFormat(csvOptions.dateFormat, row.x);\n }\n else if (xAxis.categories) {\n category = pick(xAxis.names[row.x], xAxis.categories[row.x], row.x);\n }\n else {\n category = row.x;\n }\n }\n // Add the X/date/category\n row.splice(column, 0, category);\n });\n }\n dataRows = dataRows.concat(rowArr);\n fireEvent(this, 'exportData', { dataRows: dataRows });\n return dataRows;\n}\n/**\n * Export-data module required. Build a HTML table with the chart's current\n * data.\n *\n * @sample highcharts/export-data/viewdata/\n * View the data from the export menu\n *\n * @function Highcharts.Chart#getTable\n *\n * @param {boolean} [useLocalDecimalPoint]\n * Whether to use the local decimal point as detected from the browser.\n * This makes it easier to export data to Excel in the same locale as the\n * user is.\n *\n * @return {string}\n * HTML representation of the data.\n *\n * @emits Highcharts.Chart#event:afterGetTable\n */\nfunction chartGetTable(useLocalDecimalPoint) {\n const serialize = (node) => {\n if (!node.tagName || node.tagName === '#text') {\n // Text node\n return node.textContent || '';\n }\n const attributes = node.attributes;\n let html = `<${node.tagName}`;\n if (attributes) {\n Object.keys(attributes)\n .forEach((key) => {\n const value = attributes[key];\n html += ` ${key}=\"${value}\"`;\n });\n }\n html += '>';\n html += node.textContent || '';\n (node.children || []).forEach((child) => {\n html += serialize(child);\n });\n html += ``;\n return html;\n };\n const tree = this.getTableAST(useLocalDecimalPoint);\n return serialize(tree);\n}\n/**\n * Get the AST of a HTML table representing the chart data.\n *\n * @private\n *\n * @function Highcharts.Chart#getTableAST\n *\n * @param {boolean} [useLocalDecimalPoint]\n * Whether to use the local decimal point as detected from the browser.\n * This makes it easier to export data to Excel in the same locale as the\n * user is.\n *\n * @return {Highcharts.ASTNode}\n * The abstract syntax tree\n */\nfunction chartGetTableAST(useLocalDecimalPoint) {\n let rowLength = 0;\n const treeChildren = [];\n const options = this.options, decimalPoint = useLocalDecimalPoint ? (1.1).toLocaleString()[1] : '.', useMultiLevelHeaders = pick(options.exporting.useMultiLevelHeaders, true), rows = this.getDataRows(useMultiLevelHeaders), topHeaders = useMultiLevelHeaders ? rows.shift() : null, subHeaders = rows.shift(), \n // Compare two rows for equality\n isRowEqual = function (row1, row2) {\n let i = row1.length;\n if (row2.length === i) {\n while (i--) {\n if (row1[i] !== row2[i]) {\n return false;\n }\n }\n }\n else {\n return false;\n }\n return true;\n }, \n // Get table cell HTML from value\n getCellHTMLFromValue = function (tagName, classes, attributes, value) {\n let textContent = pick(value, ''), className = 'highcharts-text' + (classes ? ' ' + classes : '');\n // Convert to string if number\n if (typeof textContent === 'number') {\n textContent = textContent.toString();\n if (decimalPoint === ',') {\n textContent = textContent.replace('.', decimalPoint);\n }\n className = 'highcharts-number';\n }\n else if (!value) {\n className = 'highcharts-empty';\n }\n attributes = extend({ 'class': className }, attributes);\n return {\n tagName,\n attributes,\n textContent\n };\n }, \n // Get table header markup from row data\n getTableHeaderHTML = function (topheaders, subheaders, rowLength) {\n const theadChildren = [];\n let i = 0, len = rowLength || subheaders && subheaders.length, next, cur, curColspan = 0, rowspan;\n // Clean up multiple table headers. Chart.getDataRows() returns two\n // levels of headers when using multilevel, not merged. We need to\n // merge identical headers, remove redundant headers, and keep it\n // all marked up nicely.\n if (useMultiLevelHeaders &&\n topheaders &&\n subheaders &&\n !isRowEqual(topheaders, subheaders)) {\n const trChildren = [];\n for (; i < len; ++i) {\n cur = topheaders[i];\n next = topheaders[i + 1];\n if (cur === next) {\n ++curColspan;\n }\n else if (curColspan) {\n // Ended colspan\n // Add cur to HTML with colspan.\n trChildren.push(getCellHTMLFromValue('th', 'highcharts-table-topheading', {\n scope: 'col',\n colspan: curColspan + 1\n }, cur));\n curColspan = 0;\n }\n else {\n // Cur is standalone. If it is same as sublevel,\n // remove sublevel and add just toplevel.\n if (cur === subheaders[i]) {\n if (options.exporting.useRowspanHeaders) {\n rowspan = 2;\n delete subheaders[i];\n }\n else {\n rowspan = 1;\n subheaders[i] = '';\n }\n }\n else {\n rowspan = 1;\n }\n const cell = getCellHTMLFromValue('th', 'highcharts-table-topheading', { scope: 'col' }, cur);\n if (rowspan > 1 && cell.attributes) {\n cell.attributes.valign = 'top';\n cell.attributes.rowspan = rowspan;\n }\n trChildren.push(cell);\n }\n }\n theadChildren.push({\n tagName: 'tr',\n children: trChildren\n });\n }\n // Add the subheaders (the only headers if not using multilevels)\n if (subheaders) {\n const trChildren = [];\n for (i = 0, len = subheaders.length; i < len; ++i) {\n if (typeof subheaders[i] !== 'undefined') {\n trChildren.push(getCellHTMLFromValue('th', null, { scope: 'col' }, subheaders[i]));\n }\n }\n theadChildren.push({\n tagName: 'tr',\n children: trChildren\n });\n }\n return {\n tagName: 'thead',\n children: theadChildren\n };\n };\n // Add table caption\n if (options.exporting.tableCaption !== false) {\n treeChildren.push({\n tagName: 'caption',\n attributes: {\n 'class': 'highcharts-table-caption'\n },\n textContent: pick(options.exporting.tableCaption, (options.title.text ?\n options.title.text :\n 'Chart'))\n });\n }\n // Find longest row\n for (let i = 0, len = rows.length; i < len; ++i) {\n if (rows[i].length > rowLength) {\n rowLength = rows[i].length;\n }\n }\n // Add header\n treeChildren.push(getTableHeaderHTML(topHeaders, subHeaders, Math.max(rowLength, subHeaders.length)));\n // Transform the rows to HTML\n const trs = [];\n rows.forEach(function (row) {\n const trChildren = [];\n for (let j = 0; j < rowLength; j++) {\n // Make first column a header too. Especially important for\n // category axes, but also might make sense for datetime? Should\n // await user feedback on this.\n trChildren.push(getCellHTMLFromValue(j ? 'td' : 'th', null, j ? {} : { scope: 'row' }, row[j]));\n }\n trs.push({\n tagName: 'tr',\n children: trChildren\n });\n });\n treeChildren.push({\n tagName: 'tbody',\n children: trs\n });\n const e = {\n tree: {\n tagName: 'table',\n id: `highcharts-data-table-${this.index}`,\n children: treeChildren\n }\n };\n fireEvent(this, 'aftergetTableAST', e);\n return e.tree;\n}\n/**\n * Export-data module required. Hide the data table when visible.\n *\n * @function Highcharts.Chart#hideData\n */\nfunction chartHideData() {\n this.toggleDataTable(false);\n}\n/**\n * @private\n */\nfunction chartToggleDataTable(show) {\n show = pick(show, !this.isDataTableVisible);\n // Create the div\n const createContainer = show && !this.dataTableDiv;\n if (createContainer) {\n this.dataTableDiv = doc.createElement('div');\n this.dataTableDiv.className = 'highcharts-data-table';\n // Insert after the chart container\n this.renderTo.parentNode.insertBefore(this.dataTableDiv, this.renderTo.nextSibling);\n }\n // Toggle the visibility\n if (this.dataTableDiv) {\n const style = this.dataTableDiv.style, oldDisplay = style.display;\n style.display = show ? 'block' : 'none';\n // Generate the data table\n if (show) {\n this.dataTableDiv.innerHTML = AST.emptyHTML;\n const ast = new AST([this.getTableAST()]);\n ast.addToDOM(this.dataTableDiv);\n fireEvent(this, 'afterViewData', {\n element: this.dataTableDiv,\n wasHidden: createContainer || oldDisplay !== style.display\n });\n }\n else {\n fireEvent(this, 'afterHideData');\n }\n }\n // Set the flag\n this.isDataTableVisible = show;\n // Change the menu item text\n const exportDivElements = this.exportDivElements, options = this.options.exporting, menuItems = options &&\n options.buttons &&\n options.buttons.contextButton.menuItems, lang = this.options.lang;\n if (options &&\n options.menuItemDefinitions &&\n lang &&\n lang.viewData &&\n lang.hideData &&\n menuItems &&\n exportDivElements) {\n const exportDivElement = exportDivElements[menuItems.indexOf('viewData')];\n if (exportDivElement) {\n AST.setElementHTML(exportDivElement, this.isDataTableVisible ? lang.hideData : lang.viewData);\n }\n }\n}\n/**\n * Export-data module required. View the data in a table below the chart.\n *\n * @function Highcharts.Chart#viewData\n *\n * @emits Highcharts.Chart#event:afterViewData\n */\nfunction chartViewData() {\n this.toggleDataTable(true);\n}\n/**\n * @private\n */\nfunction compose(ChartClass, SeriesClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.getCSV) {\n const exportingOptions = getOptions().exporting;\n // Add an event listener to handle the showTable option\n addEvent(ChartClass, 'afterViewData', onChartAfterViewData);\n addEvent(ChartClass, 'render', onChartRenderer);\n addEvent(ChartClass, 'destroy', onChartDestroy);\n chartProto.downloadCSV = chartDownloadCSV;\n chartProto.downloadXLS = chartDownloadXLS;\n chartProto.getCSV = chartGetCSV;\n chartProto.getDataRows = chartGetDataRows;\n chartProto.getTable = chartGetTable;\n chartProto.getTableAST = chartGetTableAST;\n chartProto.hideData = chartHideData;\n chartProto.toggleDataTable = chartToggleDataTable;\n chartProto.viewData = chartViewData;\n // Add \"Download CSV\" to the exporting menu.\n // @todo consider move to defaults\n if (exportingOptions) {\n extend(exportingOptions.menuItemDefinitions, {\n downloadCSV: {\n textKey: 'downloadCSV',\n onclick: function () {\n this.downloadCSV();\n }\n },\n downloadXLS: {\n textKey: 'downloadXLS',\n onclick: function () {\n this.downloadXLS();\n }\n },\n viewData: {\n textKey: 'viewData',\n onclick: function () {\n wrapLoading.call(this, this.toggleDataTable);\n }\n }\n });\n if (exportingOptions.buttons &&\n exportingOptions.buttons.contextButton.menuItems) {\n exportingOptions.buttons.contextButton.menuItems.push('separator', 'downloadCSV', 'downloadXLS', 'viewData');\n }\n }\n setOptions(ExportDataDefaults);\n const { arearange: AreaRangeSeries, gantt: GanttSeries, map: MapSeries, mapbubble: MapBubbleSeries, treemap: TreemapSeries, xrange: XRangeSeries } = SeriesClass.types;\n if (AreaRangeSeries) {\n AreaRangeSeries.prototype.keyToAxis = {\n low: 'y',\n high: 'y'\n };\n }\n if (GanttSeries) {\n GanttSeries.prototype.exportKey = 'name';\n GanttSeries.prototype.keyToAxis = {\n start: 'x',\n end: 'x'\n };\n }\n if (MapSeries) {\n MapSeries.prototype.exportKey = 'name';\n }\n if (MapBubbleSeries) {\n MapBubbleSeries.prototype.exportKey = 'name';\n }\n if (TreemapSeries) {\n TreemapSeries.prototype.exportKey = 'name';\n }\n if (XRangeSeries) {\n XRangeSeries.prototype.keyToAxis = {\n x2: 'x'\n };\n }\n }\n}\n/**\n * Get a blob object from content, if blob is supported\n *\n * @private\n * @param {string} content\n * The content to create the blob from.\n * @param {string} type\n * The type of the content.\n * @return {string|undefined}\n * The blob object, or undefined if not supported.\n */\nfunction getBlobFromContent(content, type) {\n const nav = win.navigator, domurl = win.URL || win.webkitURL || win;\n try {\n // MS specific\n if ((nav.msSaveOrOpenBlob) && win.MSBlobBuilder) {\n const blob = new win.MSBlobBuilder();\n blob.append(content);\n return blob.getBlob('image/svg+xml');\n }\n return domurl.createObjectURL(new win.Blob(['\\uFEFF' + content], // #7084\n { type: type }));\n }\n catch (e) {\n // Ignore\n }\n}\n/**\n * @private\n */\nfunction onChartAfterViewData() {\n const chart = this, dataTableDiv = chart.dataTableDiv, getCellValue = (tr, index) => tr.children[index].textContent, comparer = (index, ascending) => (a, b) => {\n const sort = (v1, v2) => (v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ?\n v1 - v2 :\n v1.toString().localeCompare(v2));\n return sort(getCellValue(ascending ? a : b, index), getCellValue(ascending ? b : a, index));\n };\n if (dataTableDiv &&\n chart.options.exporting &&\n chart.options.exporting.allowTableSorting) {\n const row = dataTableDiv.querySelector('thead tr');\n if (row) {\n row.childNodes.forEach((th) => {\n const table = th.closest('table');\n th.addEventListener('click', function () {\n const rows = [...dataTableDiv.querySelectorAll('tr:not(thead tr)')], headers = [...th.parentNode.children];\n rows.sort(comparer(headers.indexOf(th), chart.ascendingOrderInTable =\n !chart.ascendingOrderInTable)).forEach((tr) => {\n table.appendChild(tr);\n });\n headers.forEach((th) => {\n [\n 'highcharts-sort-ascending',\n 'highcharts-sort-descending'\n ].forEach((className) => {\n if (th.classList.contains(className)) {\n th.classList.remove(className);\n }\n });\n });\n th.classList.add(chart.ascendingOrderInTable ?\n 'highcharts-sort-ascending' :\n 'highcharts-sort-descending');\n });\n });\n }\n }\n}\n/**\n * Handle the showTable option\n * @private\n */\nfunction onChartRenderer() {\n if (this.options &&\n this.options.exporting &&\n this.options.exporting.showTable &&\n !this.options.chart.forExport) {\n this.viewData();\n }\n}\n/**\n * Clean up\n * @private\n */\nfunction onChartDestroy() {\n this.dataTableDiv?.remove();\n}\n/* *\n *\n * Default Export\n *\n * */\nconst ExportData = {\n compose\n};\nexport default ExportData;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Function callback to execute while data rows are processed for exporting.\n * This allows the modification of data rows before processed into the final\n * format.\n *\n * @callback Highcharts.ExportDataCallbackFunction\n * @extends Highcharts.EventCallbackFunction\n *\n * @param {Highcharts.Chart} this\n * Chart context where the event occurred.\n *\n * @param {Highcharts.ExportDataEventObject} event\n * Event object with data rows that can be modified.\n */\n/**\n * Contains information about the export data event.\n *\n * @interface Highcharts.ExportDataEventObject\n */ /**\n* Contains the data rows for the current export task and can be modified.\n* @name Highcharts.ExportDataEventObject#dataRows\n* @type {Array>}\n*/\n(''); // Keeps doclets above in JS file\n", "/**\n * @license Highcharts JS v@product.version@ (@product.date@)\n * @module highcharts/modules/export-data\n * @requires highcharts\n * @requires highcharts/modules/exporting\n *\n * Exporting module\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */\n'use strict';\nimport Highcharts from '../../Core/Globals.js';\nimport DownloadURL from '../../Extensions/DownloadURL.js';\nimport ExportData from '../../Extensions/ExportData/ExportData.js';\nconst G = Highcharts;\n// Compatibility\nG.dataURLtoBlob = G.dataURLtoBlob || DownloadURL.dataURLtoBlob;\nG.downloadURL = G.downloadURL || DownloadURL.downloadURL;\n// Compose\nExportData.compose(G.Chart, G.Series);\nexport default Highcharts;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Utility functions for accessibility module.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nconst { doc, win } = H;\nimport U from '../../Core/Utilities.js';\nconst { css } = U;\n/* *\n *\n * Constants\n *\n * */\nconst simulatedEventTarget = win.EventTarget && new win.EventTarget() || 'none';\n/* *\n *\n * Functions\n *\n * */\n/* eslint-disable valid-jsdoc */\n/**\n * @private\n * @param {Highcharts.HTMLDOMElement} el\n * @param {string} className\n * @return {void}\n */\nfunction addClass(el, className) {\n if (el.classList) {\n el.classList.add(className);\n }\n else if (el.className.indexOf(className) < 0) {\n // Note: Dumb check for class name exists, should be fine for practical\n // use cases, but will return false positives if the element has a class\n // that contains the className.\n el.className += ' ' + className;\n }\n}\n/**\n * @private\n * @param {Highcharts.HTMLDOMElement} el\n * @param {string} className\n * @return {void}\n */\nfunction removeClass(el, className) {\n if (el.classList) {\n el.classList.remove(className);\n }\n else {\n // Note: Dumb logic that will break if the element has a class name that\n // consists of className plus something else.\n el.className = el.className.replace(new RegExp(className, 'g'), '');\n }\n}\n/**\n * Utility function to clone a mouse event for re-dispatching.\n * @private\n */\nfunction cloneMouseEvent(e) {\n if (typeof win.MouseEvent === 'function') {\n return new win.MouseEvent(e.type, e);\n }\n // No MouseEvent support, try using initMouseEvent\n if (doc.createEvent) {\n const evt = doc.createEvent('MouseEvent');\n if (evt.initMouseEvent) {\n evt.initMouseEvent(e.type, e.bubbles, // #10561, #12161\n e.cancelable, e.view || win, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);\n return evt;\n }\n }\n return getFakeMouseEvent(e.type);\n}\n/**\n * Utility function to clone a touch event for re-dispatching.\n * @private\n */\nfunction cloneTouchEvent(e) {\n const touchListToTouchArray = (l) => {\n const touchArray = [];\n for (let i = 0; i < l.length; ++i) {\n const item = l.item(i);\n if (item) {\n touchArray.push(item);\n }\n }\n return touchArray;\n };\n if (typeof win.TouchEvent === 'function') {\n const newEvent = new win.TouchEvent(e.type, {\n touches: touchListToTouchArray(e.touches),\n targetTouches: touchListToTouchArray(e.targetTouches),\n changedTouches: touchListToTouchArray(e.changedTouches),\n ctrlKey: e.ctrlKey,\n shiftKey: e.shiftKey,\n altKey: e.altKey,\n metaKey: e.metaKey,\n bubbles: e.bubbles,\n cancelable: e.cancelable,\n composed: e.composed,\n detail: e.detail,\n view: e.view\n });\n if (e.defaultPrevented) {\n newEvent.preventDefault();\n }\n return newEvent;\n }\n const fakeEvt = cloneMouseEvent(e);\n fakeEvt.touches = e.touches;\n fakeEvt.changedTouches = e.changedTouches;\n fakeEvt.targetTouches = e.targetTouches;\n return fakeEvt;\n}\n/**\n * @private\n */\nfunction escapeStringForHTML(str) {\n return str\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''')\n .replace(/\\//g, '/');\n}\n/**\n * Get an element by ID\n * @private\n */\nfunction getElement(id) {\n return doc.getElementById(id);\n}\n/**\n * Get a fake mouse event of a given type. If relatedTarget is not given,\n * it will point to simulatedEventTarget, as an indicator that the event\n * is fake.\n * @private\n */\nfunction getFakeMouseEvent(type, position, relatedTarget) {\n const pos = position || {\n x: 0,\n y: 0\n };\n if (typeof win.MouseEvent === 'function') {\n return new win.MouseEvent(type, {\n bubbles: true,\n cancelable: true,\n composed: true,\n button: 0,\n buttons: 1,\n relatedTarget: relatedTarget || simulatedEventTarget,\n view: win,\n detail: type === 'click' ? 1 : 0,\n screenX: pos.x,\n screenY: pos.y,\n clientX: pos.x,\n clientY: pos.y\n });\n }\n // No MouseEvent support, try using initMouseEvent\n if (doc.createEvent) {\n const evt = doc.createEvent('MouseEvent');\n if (evt.initMouseEvent) {\n evt.initMouseEvent(type, true, // Bubble\n true, // Cancel\n win, // View\n type === 'click' ? 1 : 0, // Detail\n // Coords\n pos.x, pos.y, pos.x, pos.y, \n // Pressed keys\n false, false, false, false, 0, // button\n null // related target\n );\n return evt;\n }\n }\n return { type: type };\n}\n/**\n * Get an appropriate heading level for an element. Corresponds to the\n * heading level below the previous heading in the DOM.\n *\n * Note: Only detects previous headings in the DOM that are siblings,\n * ancestors, or previous siblings of ancestors. Headings that are nested below\n * siblings of ancestors (cousins et.al) are not picked up. This is because it\n * is ambiguous whether or not the nesting is for layout purposes or indicates a\n * separate section.\n *\n * @private\n * @param {Highcharts.HTMLDOMElement} [element]\n * @return {string} The heading tag name (h1, h2 etc).\n * If no nearest heading is found, \"p\" is returned.\n */\nfunction getHeadingTagNameForElement(element) {\n const getIncreasedHeadingLevel = (tagName) => {\n const headingLevel = parseInt(tagName.slice(1), 10), newLevel = Math.min(6, headingLevel + 1);\n return 'h' + newLevel;\n };\n const isHeading = (tagName) => /H[1-6]/.test(tagName);\n const getPreviousSiblingsHeading = (el) => {\n let sibling = el;\n while (sibling = sibling.previousSibling) { // eslint-disable-line\n const tagName = sibling.tagName || '';\n if (isHeading(tagName)) {\n return tagName;\n }\n }\n return '';\n };\n const getHeadingRecursive = (el) => {\n const prevSiblingsHeading = getPreviousSiblingsHeading(el);\n if (prevSiblingsHeading) {\n return getIncreasedHeadingLevel(prevSiblingsHeading);\n }\n // No previous siblings are headings, try parent node\n const parent = el.parentElement;\n if (!parent) {\n return 'p';\n }\n const parentTagName = parent.tagName;\n if (isHeading(parentTagName)) {\n return getIncreasedHeadingLevel(parentTagName);\n }\n return getHeadingRecursive(parent);\n };\n return getHeadingRecursive(element);\n}\n/**\n * Remove an element from the DOM.\n * @private\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} [element]\n * @return {void}\n */\nfunction removeElement(element) {\n if (element && element.parentNode) {\n element.parentNode.removeChild(element);\n }\n}\n/**\n * Remove all child nodes from an element.\n * @private\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} [element]\n * @return {void}\n */\nfunction removeChildNodes(element) {\n while (element.lastChild) {\n element.removeChild(element.lastChild);\n }\n}\n/**\n * Utility function. Reverses child nodes of a DOM element.\n * @private\n */\nfunction reverseChildNodes(node) {\n let i = node.childNodes.length;\n while (i--) {\n node.appendChild(node.childNodes[i]);\n }\n}\n/**\n * Used for aria-label attributes, painting on a canvas will fail if the\n * text contains tags.\n * @private\n */\nfunction stripHTMLTagsFromString(str, isForExport = false) {\n return (typeof str === 'string') ?\n (isForExport ?\n str.replace(/<\\/?[^>]+(>|$)/g, '') :\n str.replace(/<\\/?(?!\\s)[^>]+(>|$)/g, '')) : str;\n}\n/**\n * Utility function for hiding an element visually, but still keeping it\n * available to screen reader users.\n * @private\n */\nfunction visuallyHideElement(element) {\n css(element, {\n position: 'absolute',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n clip: 'rect(1px, 1px, 1px, 1px)',\n marginTop: '-3px',\n '-ms-filter': 'progid:DXImageTransform.Microsoft.Alpha(Opacity=1)',\n filter: 'alpha(opacity=1)',\n opacity: 0.01\n });\n}\n/* *\n *\n * Default Export\n *\n * */\nconst HTMLUtilities = {\n addClass,\n cloneMouseEvent,\n cloneTouchEvent,\n escapeStringForHTML,\n getElement,\n getFakeMouseEvent,\n getHeadingTagNameForElement,\n removeChildNodes,\n removeClass,\n removeElement,\n reverseChildNodes,\n simulatedEventTarget,\n stripHTMLTagsFromString,\n visuallyHideElement\n};\nexport default HTMLUtilities;\n", "/* *\n *\n * Accessibility module - internationalization support\n *\n * (c) 2010-2024 Highsoft AS\n * Author: \u00D8ystein Moseng\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport F from '../Core/Templating.js';\nconst { format } = F;\nimport U from '../Core/Utilities.js';\nconst { getNestedProperty, pick } = U;\n/* *\n *\n * Composition\n *\n * */\nvar A11yI18nComposition;\n(function (A11yI18nComposition) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(ChartClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.langFormat) {\n chartProto.langFormat = langFormat;\n }\n }\n A11yI18nComposition.compose = compose;\n /**\n * i18n utility function. Format a single array or plural statement in a\n * format string. If the statement is not an array or plural statement,\n * returns the statement within brackets. Invalid array statements return\n * an empty string.\n *\n * @private\n * @function formatExtendedStatement\n * @param {string} statement\n * @param {Highcharts.Dictionary<*>} ctx\n * Context to apply to the format string.\n */\n function formatExtendedStatement(statement, ctx) {\n const eachStart = statement.indexOf('#each('), pluralStart = statement.indexOf('#plural('), indexStart = statement.indexOf('['), indexEnd = statement.indexOf(']');\n let arr, result;\n // Dealing with an each-function?\n if (eachStart > -1) {\n const eachEnd = statement.slice(eachStart).indexOf(')') + eachStart, preEach = statement.substring(0, eachStart), postEach = statement.substring(eachEnd + 1), eachStatement = statement.substring(eachStart + 6, eachEnd), eachArguments = eachStatement.split(',');\n let lenArg = Number(eachArguments[1]), len;\n result = '';\n arr = getNestedProperty(eachArguments[0], ctx);\n if (arr) {\n lenArg = isNaN(lenArg) ? arr.length : lenArg;\n len = lenArg < 0 ?\n arr.length + lenArg :\n Math.min(lenArg, arr.length); // Overshoot\n // Run through the array for the specified length\n for (let i = 0; i < len; ++i) {\n result += preEach + arr[i] + postEach;\n }\n }\n return result.length ? result : '';\n }\n // Dealing with a plural-function?\n if (pluralStart > -1) {\n const pluralEnd = (statement.slice(pluralStart).indexOf(')') + pluralStart), pluralStatement = statement.substring(pluralStart + 8, pluralEnd), pluralArguments = pluralStatement.split(','), num = Number(getNestedProperty(pluralArguments[0], ctx));\n switch (num) {\n case 0:\n result = pick(pluralArguments[4], pluralArguments[1]);\n break;\n case 1:\n result = pick(pluralArguments[2], pluralArguments[1]);\n break;\n case 2:\n result = pick(pluralArguments[3], pluralArguments[1]);\n break;\n default:\n result = pluralArguments[1];\n }\n return result ? stringTrim(result) : '';\n }\n // Array index\n if (indexStart > -1) {\n const arrayName = statement.substring(0, indexStart), ix = Number(statement.substring(indexStart + 1, indexEnd));\n let val;\n arr = getNestedProperty(arrayName, ctx);\n if (!isNaN(ix) && arr) {\n if (ix < 0) {\n val = arr[arr.length + ix];\n // Handle negative overshoot\n if (typeof val === 'undefined') {\n val = arr[0];\n }\n }\n else {\n val = arr[ix];\n // Handle positive overshoot\n if (typeof val === 'undefined') {\n val = arr[arr.length - 1];\n }\n }\n }\n return typeof val !== 'undefined' ? val : '';\n }\n // Standard substitution, delegate to format or similar\n return '{' + statement + '}';\n }\n /* eslint-disable max-len */\n /**\n * i18n formatting function. Extends Highcharts.format() functionality by\n * also handling arrays and plural conditionals. Arrays can be indexed as\n * follows:\n *\n * - Format: 'This is the first index: {myArray[0]}. The last: {myArray[-1]}.'\n *\n * - Context: { myArray: [0, 1, 2, 3, 4, 5] }\n *\n * - Result: 'This is the first index: 0. The last: 5.'\n *\n *\n * They can also be iterated using the #each() function. This will repeat\n * the contents of the bracket expression for each element. Example:\n *\n * - Format: 'List contains: {#each(myArray)cm }'\n *\n * - Context: { myArray: [0, 1, 2] }\n *\n * - Result: 'List contains: 0cm 1cm 2cm '\n *\n *\n * The #each() function optionally takes a length parameter. If positive,\n * this parameter specifies the max number of elements to iterate through.\n * If negative, the function will subtract the number from the length of the\n * array. Use this to stop iterating before the array ends. Example:\n *\n * - Format: 'List contains: {#each(myArray, -1), }and {myArray[-1]}.'\n *\n * - Context: { myArray: [0, 1, 2, 3] }\n *\n * - Result: 'List contains: 0, 1, 2, and 3.'\n *\n *\n * Use the #plural() function to pick a string depending on whether or not a\n * context object is 1. Arguments are #plural(obj, plural, singular).\n * Example:\n *\n * - Format: 'Has {numPoints} {#plural(numPoints, points, point}.'\n *\n * - Context: { numPoints: 5 }\n *\n * - Result: 'Has 5 points.'\n *\n *\n * Optionally there are additional parameters for dual and none:\n * #plural(obj, plural, singular, dual, none). Example:\n *\n * - Format: 'Has {#plural(numPoints, many points, one point, two points,\n * none}.'\n *\n * - Context: { numPoints: 2 }\n *\n * - Result: 'Has two points.'\n *\n *\n * The dual or none parameters will take precedence if they are supplied.\n *\n * @requires modules/accessibility\n *\n * @function Highcharts.i18nFormat\n *\n * @param {string} formatString\n * The string to format.\n *\n * @param {Highcharts.Dictionary<*>} context\n * Context to apply to the format string.\n *\n * @param {Highcharts.Chart} chart\n * A `Chart` instance with a time object and numberFormatter, passed on to\n * format().\n *\n * @deprecated\n *\n * @return {string}\n * The formatted string.\n */\n function i18nFormat(formatString, context, chart) {\n const getFirstBracketStatement = (sourceStr, offset) => {\n const str = sourceStr.slice(offset || 0), startBracket = str.indexOf('{'), endBracket = str.indexOf('}');\n if (startBracket > -1 && endBracket > startBracket) {\n return {\n statement: str.substring(startBracket + 1, endBracket),\n begin: offset + startBracket + 1,\n end: offset + endBracket\n };\n }\n }, tokens = [];\n let bracketRes, constRes, cursor = 0;\n // Tokenize format string into bracket statements and constants\n do {\n bracketRes = getFirstBracketStatement(formatString, cursor);\n constRes = formatString.substring(cursor, bracketRes && bracketRes.begin - 1);\n // If we have constant content before this bracket statement, add it\n if (constRes.length) {\n tokens.push({\n value: constRes,\n type: 'constant'\n });\n }\n // Add the bracket statement\n if (bracketRes) {\n tokens.push({\n value: bracketRes.statement,\n type: 'statement'\n });\n }\n cursor = bracketRes ? bracketRes.end + 1 : cursor + 1;\n } while (bracketRes);\n // Perform the formatting. The formatArrayStatement function returns\n // the statement in brackets if it is not an array statement, which\n // means it gets picked up by format below.\n tokens.forEach((token) => {\n if (token.type === 'statement') {\n token.value = formatExtendedStatement(token.value, context);\n }\n });\n // Join string back together and pass to format to pick up non-array\n // statements.\n return format(tokens.reduce((acc, cur) => acc + cur.value, ''), context, chart);\n }\n A11yI18nComposition.i18nFormat = i18nFormat;\n /* eslint-enable max-len */\n /**\n * Apply context to a format string from lang options of the chart.\n *\n * @requires modules/accessibility\n *\n * @function Highcharts.Chart#langFormat\n *\n * @param {string} langKey\n * Key (using dot notation) into lang option structure.\n *\n * @param {Highcharts.Dictionary<*>} context\n * Context to apply to the format string.\n *\n * @return {string}\n * The formatted string.\n */\n function langFormat(langKey, context) {\n const keys = langKey.split('.');\n let formatString = this.options.lang, i = 0;\n for (; i < keys.length; ++i) {\n formatString = formatString && formatString[keys[i]];\n }\n return typeof formatString === 'string' ?\n i18nFormat(formatString, context, this) : '';\n }\n /**\n * @private\n * @function stringTrim\n *\n * @param {string} str\n * The input string\n *\n * @return {string}\n * The trimmed string\n */\n function stringTrim(str) {\n return str.trim && str.trim() || str.replace(/^\\s+|\\s+$/g, '');\n }\n})(A11yI18nComposition || (A11yI18nComposition = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default A11yI18nComposition;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Utils for dealing with charts.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nconst { doc } = H;\nimport HU from './HTMLUtilities.js';\nconst { stripHTMLTagsFromString: stripHTMLTags } = HU;\nimport U from '../../Core/Utilities.js';\nconst { defined, find, fireEvent } = U;\n/* *\n *\n * Functions\n *\n * */\n/* eslint-disable valid-jsdoc */\n/**\n * Fire an event on an element that is either wrapped by Highcharts,\n * or a DOM element.\n * @private\n */\nfunction fireEventOnWrappedOrUnwrappedElement(el, eventObject) {\n const type = eventObject.type;\n const hcEvents = el.hcEvents;\n if (!!doc.createEvent &&\n (el.dispatchEvent || el.fireEvent)) {\n if (el.dispatchEvent) {\n el.dispatchEvent(eventObject);\n }\n else {\n el.fireEvent(type, eventObject);\n }\n }\n else if (hcEvents && hcEvents[type]) {\n fireEvent(el, type, eventObject);\n }\n else if (el.element) {\n fireEventOnWrappedOrUnwrappedElement(el.element, eventObject);\n }\n}\n/**\n * @private\n */\nfunction getChartTitle(chart) {\n return stripHTMLTags(chart.options.title.text ||\n chart.langFormat('accessibility.defaultChartTitle', { chart: chart }), chart.renderer.forExport);\n}\n/**\n * Return string with the axis name/title.\n * @private\n */\nfunction getAxisDescription(axis) {\n return axis && (axis.options.accessibility?.description ||\n axis.axisTitle?.textStr ||\n axis.options.id ||\n axis.categories && 'categories' ||\n axis.dateTime && 'Time' ||\n 'values');\n}\n/**\n * Return string with text description of the axis range.\n * @private\n * @param {Highcharts.Axis} axis\n * The axis to get range desc of.\n * @return {string}\n * A string with the range description for the axis.\n */\nfunction getAxisRangeDescription(axis) {\n const axisOptions = axis.options || {};\n // Handle overridden range description\n if (axisOptions.accessibility &&\n typeof axisOptions.accessibility.rangeDescription !== 'undefined') {\n return axisOptions.accessibility.rangeDescription;\n }\n // Handle category axes\n if (axis.categories) {\n return getCategoryAxisRangeDesc(axis);\n }\n // Use time range, not from-to?\n if (axis.dateTime && (axis.min === 0 || axis.dataMin === 0)) {\n return getAxisTimeLengthDesc(axis);\n }\n // Just use from and to.\n // We have the range and the unit to use, find the desc format\n return getAxisFromToDescription(axis);\n}\n/**\n * Describe the range of a category axis.\n * @private\n */\nfunction getCategoryAxisRangeDesc(axis) {\n const chart = axis.chart;\n if (axis.dataMax && axis.dataMin) {\n return chart.langFormat('accessibility.axis.rangeCategories', {\n chart: chart,\n axis: axis,\n numCategories: axis.dataMax - axis.dataMin + 1\n });\n }\n return '';\n}\n/**\n * Describe the length of the time window shown on an axis.\n * @private\n */\nfunction getAxisTimeLengthDesc(axis) {\n const chart = axis.chart, range = {}, min = axis.dataMin || axis.min || 0, max = axis.dataMax || axis.max || 0;\n let rangeUnit = 'Seconds';\n range.Seconds = (max - min) / 1000;\n range.Minutes = range.Seconds / 60;\n range.Hours = range.Minutes / 60;\n range.Days = range.Hours / 24;\n ['Minutes', 'Hours', 'Days'].forEach(function (unit) {\n if (range[unit] > 2) {\n rangeUnit = unit;\n }\n });\n const rangeValue = range[rangeUnit].toFixed(rangeUnit !== 'Seconds' &&\n rangeUnit !== 'Minutes' ? 1 : 0 // Use decimals for days/hours\n );\n // We have the range and the unit to use, find the desc format\n return chart.langFormat('accessibility.axis.timeRange' + rangeUnit, {\n chart: chart,\n axis: axis,\n range: rangeValue.replace('.0', '')\n });\n}\n/**\n * Describe an axis from-to range.\n * @private\n */\nfunction getAxisFromToDescription(axis) {\n const chart = axis.chart, options = chart.options, dateRangeFormat = (options &&\n options.accessibility &&\n options.accessibility.screenReaderSection.axisRangeDateFormat ||\n ''), extremes = {\n min: axis.dataMin || axis.min || 0,\n max: axis.dataMax || axis.max || 0\n }, format = function (key) {\n return axis.dateTime ?\n chart.time.dateFormat(dateRangeFormat, extremes[key]) :\n extremes[key].toString();\n };\n return chart.langFormat('accessibility.axis.rangeFromTo', {\n chart: chart,\n axis: axis,\n rangeFrom: format('min'),\n rangeTo: format('max')\n });\n}\n/**\n * Get the DOM element for the first point in the series.\n * @private\n * @param {Highcharts.Series} series\n * The series to get element for.\n * @return {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement|undefined}\n * The DOM element for the point.\n */\nfunction getSeriesFirstPointElement(series) {\n if (series.points && series.points.length) {\n const firstPointWithGraphic = find(series.points, (p) => !!p.graphic);\n return (firstPointWithGraphic &&\n firstPointWithGraphic.graphic &&\n firstPointWithGraphic.graphic.element);\n }\n}\n/**\n * Get the DOM element for the series that we put accessibility info on.\n * @private\n * @param {Highcharts.Series} series\n * The series to get element for.\n * @return {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement|undefined}\n * The DOM element for the series\n */\nfunction getSeriesA11yElement(series) {\n const firstPointEl = getSeriesFirstPointElement(series);\n return (firstPointEl &&\n firstPointEl.parentNode || series.graph &&\n series.graph.element || series.group &&\n series.group.element); // Could be tracker series depending on series type\n}\n/**\n * Remove aria-hidden from element. Also unhides parents of the element, and\n * hides siblings that are not explicitly unhidden.\n * @private\n */\nfunction unhideChartElementFromAT(chart, element) {\n element.setAttribute('aria-hidden', false);\n if (element === chart.renderTo ||\n !element.parentNode ||\n element.parentNode === doc.body // #16126: Full screen printing\n ) {\n return;\n }\n // Hide siblings unless their hidden state is already explicitly set\n Array.prototype.forEach.call(element.parentNode.childNodes, function (node) {\n if (!node.hasAttribute('aria-hidden')) {\n node.setAttribute('aria-hidden', true);\n }\n });\n // Repeat for parent\n unhideChartElementFromAT(chart, element.parentNode);\n}\n/**\n * Hide series from screen readers.\n * @private\n */\nfunction hideSeriesFromAT(series) {\n const seriesEl = getSeriesA11yElement(series);\n if (seriesEl) {\n seriesEl.setAttribute('aria-hidden', true);\n }\n}\n/**\n * Get series objects by series name.\n * @private\n */\nfunction getSeriesFromName(chart, name) {\n if (!name) {\n return chart.series;\n }\n return (chart.series || []).filter(function (s) {\n return s.name === name;\n });\n}\n/**\n * Get point in a series from x/y values.\n * @private\n */\nfunction getPointFromXY(series, x, y) {\n let i = series.length, res;\n while (i--) {\n res = find(series[i].points || [], function (p) {\n return p.x === x && p.y === y;\n });\n if (res) {\n return res;\n }\n }\n}\n/**\n * Get relative position of point on an x/y axis from 0 to 1.\n * @private\n */\nfunction getRelativePointAxisPosition(axis, point) {\n if (!defined(axis.dataMin) || !defined(axis.dataMax)) {\n return 0;\n }\n const axisStart = axis.toPixels(axis.dataMin), axisEnd = axis.toPixels(axis.dataMax), \n // We have to use pixel position because of axis breaks, log axis etc.\n positionProp = axis.coll === 'xAxis' ? 'x' : 'y', pointPos = axis.toPixels(point[positionProp] || 0);\n return (pointPos - axisStart) / (axisEnd - axisStart);\n}\n/**\n * Get relative position of point on an x/y axis from 0 to 1.\n * @private\n */\nfunction scrollAxisToPoint(point) {\n const xAxis = point.series.xAxis, yAxis = point.series.yAxis, axis = (xAxis && xAxis.scrollbar ? xAxis : yAxis), scrollbar = (axis && axis.scrollbar);\n if (scrollbar && defined(scrollbar.to) && defined(scrollbar.from)) {\n const range = scrollbar.to - scrollbar.from;\n const pos = getRelativePointAxisPosition(axis, point);\n scrollbar.updatePosition(pos - range / 2, pos + range / 2);\n fireEvent(scrollbar, 'changed', {\n from: scrollbar.from,\n to: scrollbar.to,\n trigger: 'scrollbar',\n DOMEvent: null\n });\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst ChartUtilities = {\n fireEventOnWrappedOrUnwrappedElement,\n getChartTitle,\n getAxisDescription,\n getAxisRangeDescription,\n getPointFromXY,\n getSeriesFirstPointElement,\n getSeriesFromName,\n getSeriesA11yElement,\n unhideChartElementFromAT,\n hideSeriesFromAT,\n scrollAxisToPoint\n};\nexport default ChartUtilities;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Class that can keep track of elements added to DOM and clean them up on\n * destroy.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nconst { doc } = H;\nimport HU from './HTMLUtilities.js';\nconst { removeElement } = HU;\n/* *\n *\n * Class\n *\n * */\n/**\n * @private\n */\nclass DOMElementProvider {\n /* *\n *\n * Constructor\n *\n * */\n constructor() {\n this.elements = [];\n }\n /**\n * Create an element and keep track of it for later removal.\n * Same args as document.createElement\n * @private\n */\n createElement() {\n const el = doc.createElement.apply(doc, arguments);\n this.elements.push(el);\n return el;\n }\n /**\n * Destroy created element, removing it from the DOM.\n * @private\n */\n removeElement(element) {\n removeElement(element);\n this.elements.splice(this.elements.indexOf(element), 1);\n }\n /**\n * Destroy all created elements, removing them from the DOM.\n * @private\n */\n destroyCreatedElements() {\n this.elements.forEach(function (element) {\n removeElement(element);\n });\n this.elements = [];\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default DOMElementProvider;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Class that can keep track of events added, and clean them up on destroy.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * @private\n */\nclass EventProvider {\n /* *\n *\n * Constructor\n *\n * */\n constructor() {\n this.eventRemovers = [];\n }\n /**\n * Add an event to an element and keep track of it for later removal.\n * Same args as Highcharts.addEvent.\n * @private\n */\n addEvent() {\n const remover = addEvent.apply(H, arguments);\n this.eventRemovers.push(remover);\n return remover;\n }\n /**\n * Remove added event.\n * @private\n */\n removeEvent(event) {\n const pos = this.eventRemovers.indexOf(event);\n this.eventRemovers[pos]();\n this.eventRemovers.splice(pos, 1);\n }\n /**\n * Remove all added events.\n * @private\n */\n removeAddedEvents() {\n this.eventRemovers.forEach((remover) => remover());\n this.eventRemovers = [];\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default EventProvider;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component class definition\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport CU from './Utils/ChartUtilities.js';\nconst { fireEventOnWrappedOrUnwrappedElement } = CU;\nimport DOMElementProvider from './Utils/DOMElementProvider.js';\nimport EventProvider from './Utils/EventProvider.js';\nimport HU from './Utils/HTMLUtilities.js';\nconst { getFakeMouseEvent } = HU;\nimport U from '../Core/Utilities.js';\nconst { extend } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * The AccessibilityComponent base class, representing a part of the chart that\n * has accessibility logic connected to it. This class can be inherited from to\n * create a custom accessibility component for a chart.\n *\n * Components should take care to destroy added elements and unregister event\n * handlers on destroy. This is handled automatically if using this.addEvent and\n * this.createElement.\n *\n * @sample highcharts/accessibility/custom-component\n * Custom accessibility component\n *\n * @requires module:modules/accessibility\n * @class\n * @name Highcharts.AccessibilityComponent\n */\nclass AccessibilityComponent {\n /* *\n *\n * Functions\n *\n * */\n /**\n * Initialize the class\n * @private\n * @param {Highcharts.Chart} chart The chart object\n * @param {Highcharts.ProxyProvider} proxyProvider The proxy provider of the accessibility module\n */\n initBase(chart, proxyProvider) {\n this.chart = chart;\n this.eventProvider = new EventProvider();\n this.domElementProvider = new DOMElementProvider();\n this.proxyProvider = proxyProvider;\n // Key code enum for common keys\n this.keyCodes = {\n left: 37,\n right: 39,\n up: 38,\n down: 40,\n enter: 13,\n space: 32,\n esc: 27,\n tab: 9,\n pageUp: 33,\n pageDown: 34,\n end: 35,\n home: 36\n };\n }\n /**\n * Add an event to an element and keep track of it for later removal.\n * See EventProvider for details.\n * @private\n */\n addEvent(el, type, fn, options) {\n return this.eventProvider.addEvent(el, type, fn, options);\n }\n /**\n * Create an element and keep track of it for later removal.\n * See DOMElementProvider for details.\n * @private\n */\n createElement(tagName, options) {\n return this.domElementProvider.createElement(tagName, options);\n }\n /**\n * Fire a fake click event on an element. It is useful to have this on\n * AccessibilityComponent for users of custom components.\n */\n fakeClickEvent(el) {\n const fakeEvent = getFakeMouseEvent('click');\n fireEventOnWrappedOrUnwrappedElement(el, fakeEvent);\n }\n /**\n * Remove traces of the component.\n * @private\n */\n destroyBase() {\n this.domElementProvider.destroyCreatedElements();\n this.eventProvider.removeAddedEvents();\n }\n}\nextend(AccessibilityComponent.prototype, \n/** @lends Highcharts.AccessibilityComponent */\n{\n /**\n * Called on component initialization.\n */\n init() { },\n /**\n * Get keyboard navigation handler for this component.\n * @private\n */\n getKeyboardNavigation: function () { },\n /**\n * Called on updates to the chart, including options changes.\n * Note that this is also called on first render of chart.\n */\n onChartUpdate() { },\n /**\n * Called on every chart render.\n */\n onChartRender() { },\n /**\n * Called when accessibility is disabled or chart is destroyed.\n */\n destroy() { }\n});\n/* *\n *\n * Default Export\n *\n * */\nexport default AccessibilityComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Keyboard navigation handler base class definition\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../Core/Utilities.js';\nconst { find } = U;\n/* *\n *\n * Class\n *\n * */\n/**\n * Define a keyboard navigation handler for use with a\n * Highcharts.AccessibilityComponent instance. This functions as an abstraction\n * layer for keyboard navigation, and defines a map of keyCodes to handler\n * functions.\n *\n * @requires module:modules/accessibility\n *\n * @sample highcharts/accessibility/custom-component\n * Custom accessibility component\n *\n * @class\n * @name Highcharts.KeyboardNavigationHandler\n *\n * @param {Highcharts.Chart} chart\n * The chart this module should act on.\n *\n * @param {Highcharts.KeyboardNavigationHandlerOptionsObject} options\n * Options for the keyboard navigation handler.\n */\nclass KeyboardNavigationHandler {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart, options) {\n this.chart = chart;\n this.keyCodeMap = options.keyCodeMap || [];\n this.validate = options.validate;\n this.init = options.init;\n this.terminate = options.terminate;\n // Response enum\n this.response = {\n success: 1,\n prev: 2,\n next: 3,\n noHandler: 4,\n fail: 5 // Handler failed\n };\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Find handler function(s) for key code in the keyCodeMap and run it.\n *\n * @function KeyboardNavigationHandler#run\n * @param {global.KeyboardEvent} e\n * @return {number} Returns a response code indicating whether the run was\n * a success/fail/unhandled, or if we should move to next/prev module.\n */\n run(e) {\n const keyCode = e.which || e.keyCode;\n let response = this.response.noHandler;\n const handlerCodeSet = find(this.keyCodeMap, function (codeSet) {\n return codeSet[0].indexOf(keyCode) > -1;\n });\n if (handlerCodeSet) {\n response = handlerCodeSet[1].call(this, keyCode, e);\n }\n else if (keyCode === 9) {\n // Default tab handler, move to next/prev module\n response = this.response[e.shiftKey ? 'prev' : 'next'];\n }\n return response;\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default KeyboardNavigationHandler;\n/* *\n *\n * API Declarations\n *\n * */\n/**\n * Options for the keyboard navigation handler.\n *\n * @interface Highcharts.KeyboardNavigationHandlerOptionsObject\n */ /**\n* An array containing pairs of an array of keycodes, mapped to a handler\n* function. When the keycode is received, the handler is called with the\n* keycode as parameter.\n* @name Highcharts.KeyboardNavigationHandlerOptionsObject#keyCodeMap\n* @type {Array, Function>>}\n*/ /**\n* Function to run on initialization of module.\n* @name Highcharts.KeyboardNavigationHandlerOptionsObject#init\n* @type {Function}\n*/ /**\n* Function to run before moving to next/prev module. Receives moving direction\n* as parameter: +1 for next, -1 for previous.\n* @name Highcharts.KeyboardNavigationHandlerOptionsObject#terminate\n* @type {Function|undefined}\n*/ /**\n* Function to run to validate module. Should return false if module should not\n* run, true otherwise. Receives chart as parameter.\n* @name Highcharts.KeyboardNavigationHandlerOptionsObject#validate\n* @type {Function|undefined}\n*/\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component for chart container.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AccessibilityComponent from '../AccessibilityComponent.js';\nimport KeyboardNavigationHandler from '../KeyboardNavigationHandler.js';\nimport CU from '../Utils/ChartUtilities.js';\nconst { unhideChartElementFromAT, getChartTitle } = CU;\nimport H from '../../Core/Globals.js';\nconst { doc } = H;\nimport HU from '../Utils/HTMLUtilities.js';\nconst { stripHTMLTagsFromString: stripHTMLTags } = HU;\n/**\n * The ContainerComponent class\n *\n * @private\n * @class\n * @name Highcharts.ContainerComponent\n */\nclass ContainerComponent extends AccessibilityComponent {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Called on first render/updates to the chart, including options changes.\n */\n onChartUpdate() {\n this.handleSVGTitleElement();\n this.setSVGContainerLabel();\n this.setGraphicContainerAttrs();\n this.setRenderToAttrs();\n this.makeCreditsAccessible();\n }\n /**\n * @private\n */\n handleSVGTitleElement() {\n const chart = this.chart, titleId = 'highcharts-title-' + chart.index, titleContents = stripHTMLTags(chart.langFormat('accessibility.svgContainerTitle', {\n chartTitle: getChartTitle(chart)\n }));\n if (titleContents.length) {\n const titleElement = this.svgTitleElement =\n this.svgTitleElement || doc.createElementNS('http://www.w3.org/2000/svg', 'title');\n titleElement.textContent = titleContents;\n titleElement.id = titleId;\n chart.renderTo.insertBefore(titleElement, chart.renderTo.firstChild);\n }\n }\n /**\n * @private\n */\n setSVGContainerLabel() {\n const chart = this.chart, svgContainerLabel = chart.langFormat('accessibility.svgContainerLabel', {\n chartTitle: getChartTitle(chart)\n });\n if (chart.renderer.box && svgContainerLabel.length) {\n chart.renderer.box.setAttribute('aria-label', svgContainerLabel);\n }\n }\n /**\n * @private\n */\n setGraphicContainerAttrs() {\n const chart = this.chart, label = chart.langFormat('accessibility.graphicContainerLabel', {\n chartTitle: getChartTitle(chart)\n });\n if (label.length) {\n chart.container.setAttribute('aria-label', label);\n }\n }\n /**\n * Set attributes on the chart container element.\n * @private\n */\n setRenderToAttrs() {\n const chart = this.chart, shouldHaveLandmark = chart.options.accessibility\n .landmarkVerbosity !== 'disabled', containerLabel = chart.langFormat('accessibility.chartContainerLabel', {\n title: getChartTitle(chart),\n chart: chart\n });\n if (containerLabel) {\n chart.renderTo.setAttribute('role', shouldHaveLandmark ? 'region' : 'group');\n chart.renderTo.setAttribute('aria-label', containerLabel);\n }\n }\n /**\n * @private\n */\n makeCreditsAccessible() {\n const chart = this.chart, credits = chart.credits;\n if (credits) {\n if (credits.textStr) {\n credits.element.setAttribute('aria-label', chart.langFormat('accessibility.credits', {\n creditsStr: stripHTMLTags(credits.textStr, chart.renderer.forExport)\n }));\n }\n unhideChartElementFromAT(chart, credits.element);\n }\n }\n /**\n * Empty handler to just set focus on chart\n * @private\n */\n getKeyboardNavigation() {\n const chart = this.chart;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [],\n validate: function () {\n return true;\n },\n init: function () {\n const a11y = chart.accessibility;\n if (a11y) {\n a11y.keyboardNavigation.tabindexContainer.focus();\n }\n }\n });\n }\n /**\n * Accessibility disabled/chart destroyed.\n */\n destroy() {\n this.chart.renderTo.setAttribute('aria-hidden', true);\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default ContainerComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Extend SVG and Chart classes with focus border capabilities.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../Core/Utilities.js';\nconst { addEvent, pick } = U;\n/* *\n *\n * Composition\n *\n * */\nvar FocusBorderComposition;\n(function (FocusBorderComposition) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Constants\n *\n * */\n // Attributes that trigger a focus border update\n const svgElementBorderUpdateTriggers = [\n 'x', 'y', 'transform', 'width', 'height', 'r', 'd', 'stroke-width'\n ];\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(ChartClass, SVGElementClass) {\n const chartProto = ChartClass.prototype, svgElementProto = SVGElementClass.prototype;\n if (!chartProto.renderFocusBorder) {\n chartProto.renderFocusBorder = chartRenderFocusBorder;\n chartProto.setFocusToElement = chartSetFocusToElement;\n }\n if (!svgElementProto.addFocusBorder) {\n svgElementProto.addFocusBorder = svgElementAddFocusBorder;\n svgElementProto.removeFocusBorder = svgElementRemoveFocusBorder;\n }\n }\n FocusBorderComposition.compose = compose;\n /**\n * Redraws the focus border on the currently focused element.\n *\n * @private\n * @function Highcharts.Chart#renderFocusBorder\n */\n function chartRenderFocusBorder() {\n const focusElement = this.focusElement, focusBorderOptions = this.options.accessibility.keyboardNavigation.focusBorder;\n if (focusElement) {\n focusElement.removeFocusBorder();\n if (focusBorderOptions.enabled) {\n focusElement.addFocusBorder(focusBorderOptions.margin, {\n stroke: focusBorderOptions.style.color,\n strokeWidth: focusBorderOptions.style.lineWidth,\n r: focusBorderOptions.style.borderRadius\n });\n }\n }\n }\n /**\n * Set chart's focus to an SVGElement. Calls focus() on it, and draws the\n * focus border. This is used by multiple components.\n *\n * @private\n * @function Highcharts.Chart#setFocusToElement\n *\n * @param {Highcharts.SVGElement} svgElement\n * Element to draw the border around.\n *\n * @param {SVGDOMElement|HTMLDOMElement} [focusElement]\n * If supplied, it draws the border around svgElement and sets the focus to\n * focusElement.\n */\n function chartSetFocusToElement(svgElement, focusElement) {\n const focusBorderOptions = this.options.accessibility.keyboardNavigation.focusBorder, browserFocusElement = focusElement || svgElement.element;\n // Set browser focus if possible\n if (browserFocusElement &&\n browserFocusElement.focus) {\n // If there is no focusin-listener, add one to work around Edge\n // where Narrator is not reading out points despite calling focus().\n if (!(browserFocusElement.hcEvents &&\n browserFocusElement.hcEvents.focusin)) {\n addEvent(browserFocusElement, 'focusin', function () { });\n }\n browserFocusElement.focus();\n // Hide default focus ring\n if (focusBorderOptions.hideBrowserFocusOutline) {\n browserFocusElement.style.outline = 'none';\n }\n }\n if (this.focusElement) {\n this.focusElement.removeFocusBorder();\n }\n this.focusElement = svgElement;\n this.renderFocusBorder();\n }\n /**\n * Add hook to destroy focus border if SVG element is destroyed, unless\n * hook already exists.\n * @private\n * @param el Element to add destroy hook to\n */\n function svgElementAddDestroyFocusBorderHook(el) {\n if (el.focusBorderDestroyHook) {\n return;\n }\n const origDestroy = el.destroy;\n el.destroy = function () {\n if (el.focusBorder && el.focusBorder.destroy) {\n el.focusBorder.destroy();\n }\n return origDestroy.apply(el, arguments);\n };\n el.focusBorderDestroyHook = origDestroy;\n }\n /**\n * Add focus border functionality to SVGElements. Draws a new rect on top of\n * element around its bounding box. This is used by multiple components.\n *\n * @private\n * @function Highcharts.SVGElement#addFocusBorder\n *\n * @param {number} margin\n *\n * @param {SVGAttributes} attribs\n */\n function svgElementAddFocusBorder(margin, attribs) {\n // Allow updating by just adding new border\n if (this.focusBorder) {\n this.removeFocusBorder();\n }\n // Add the border rect\n const bb = this.getBBox(), pad = pick(margin, 3), parent = this.parentGroup, scaleX = this.scaleX || parent && parent.scaleX, scaleY = this.scaleY || parent && parent.scaleY, oneDefined = scaleX ? !scaleY : scaleY, scaleBoth = oneDefined ? Math.abs(scaleX || scaleY || 1) :\n (Math.abs(scaleX || 1) + Math.abs(scaleY || 1)) / 2;\n bb.x += this.translateX ? this.translateX : 0;\n bb.y += this.translateY ? this.translateY : 0;\n let borderPosX = bb.x - pad, borderPosY = bb.y - pad, borderWidth = bb.width + 2 * pad, borderHeight = bb.height + 2 * pad;\n /**\n * For text elements, apply x and y offset, #11397.\n * @private\n */\n function getTextAnchorCorrection(text) {\n let posXCorrection = 0, posYCorrection = 0;\n if (text.attr('text-anchor') === 'middle') {\n posXCorrection = posYCorrection = 0.5;\n }\n else if (!text.rotation) {\n posYCorrection = 0.75;\n }\n else {\n posXCorrection = 0.25;\n }\n return {\n x: posXCorrection,\n y: posYCorrection\n };\n }\n const isLabel = !!this.text;\n if (this.element.nodeName === 'text' || isLabel) {\n const isRotated = !!this.rotation;\n const correction = !isLabel ? getTextAnchorCorrection(this) :\n {\n x: isRotated ? 1 : 0,\n y: 0\n };\n const attrX = +this.attr('x');\n const attrY = +this.attr('y');\n if (!isNaN(attrX)) {\n borderPosX = attrX - (bb.width * correction.x) - pad;\n }\n if (!isNaN(attrY)) {\n borderPosY = attrY - (bb.height * correction.y) - pad;\n }\n if (isLabel && isRotated) {\n const temp = borderWidth;\n borderWidth = borderHeight;\n borderHeight = temp;\n if (!isNaN(attrX)) {\n borderPosX = attrX - (bb.height * correction.x) - pad;\n }\n if (!isNaN(attrY)) {\n borderPosY = attrY - (bb.width * correction.y) - pad;\n }\n }\n }\n this.focusBorder = this.renderer.rect(borderPosX, borderPosY, borderWidth, borderHeight, parseInt((attribs && attribs.r || 0).toString(), 10) / scaleBoth)\n .addClass('highcharts-focus-border')\n .attr({\n zIndex: 99\n })\n .add(parent);\n if (!this.renderer.styledMode) {\n this.focusBorder.attr({\n stroke: attribs && attribs.stroke,\n 'stroke-width': (attribs && attribs.strokeWidth || 0) / scaleBoth\n });\n }\n avgElementAddUpdateFocusBorderHooks(this, margin, attribs);\n svgElementAddDestroyFocusBorderHook(this);\n }\n /**\n * Add hooks to update the focus border of an element when the element\n * size/position is updated, unless already added.\n * @private\n * @param el Element to add update hooks to\n * @param updateParams Parameters to pass through to addFocusBorder when updating.\n */\n function avgElementAddUpdateFocusBorderHooks(el, ...updateParams) {\n if (el.focusBorderUpdateHooks) {\n return;\n }\n el.focusBorderUpdateHooks = {};\n svgElementBorderUpdateTriggers.forEach((trigger) => {\n const setterKey = trigger + 'Setter';\n const origSetter = el[setterKey] || el._defaultSetter;\n el.focusBorderUpdateHooks[setterKey] = origSetter;\n el[setterKey] = function () {\n const ret = origSetter.apply(el, arguments);\n el.addFocusBorder.apply(el, updateParams);\n return ret;\n };\n });\n }\n /**\n * Remove hook from SVG element added by addDestroyFocusBorderHook, if\n * existing.\n * @private\n * @param el Element to remove destroy hook from\n */\n function svgElementRemoveDestroyFocusBorderHook(el) {\n if (!el.focusBorderDestroyHook) {\n return;\n }\n el.destroy = el.focusBorderDestroyHook;\n delete el.focusBorderDestroyHook;\n }\n /**\n * Add focus border functionality to SVGElements. Draws a new rect on top of\n * element around its bounding box. This is used by multiple components.\n * @private\n * @function Highcharts.SVGElement#removeFocusBorder\n */\n function svgElementRemoveFocusBorder() {\n svgElementRemoveUpdateFocusBorderHooks(this);\n svgElementRemoveDestroyFocusBorderHook(this);\n if (this.focusBorder) {\n this.focusBorder.destroy();\n delete this.focusBorder;\n }\n }\n /**\n * Remove hooks from SVG element added by addUpdateFocusBorderHooks, if\n * existing.\n * @private\n * @param el Element to remove update hooks from\n */\n function svgElementRemoveUpdateFocusBorderHooks(el) {\n if (!el.focusBorderUpdateHooks) {\n return;\n }\n Object.keys(el.focusBorderUpdateHooks).forEach((setterKey) => {\n const origSetter = el.focusBorderUpdateHooks[setterKey];\n if (origSetter === el._defaultSetter) {\n delete el[setterKey];\n }\n else {\n el[setterKey] = origSetter;\n }\n });\n delete el.focusBorderUpdateHooks;\n }\n})(FocusBorderComposition || (FocusBorderComposition = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default FocusBorderComposition;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Create announcer to speak messages to screen readers and other AT.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AST from '../../Core/Renderer/HTML/AST.js';\nimport DOMElementProvider from './DOMElementProvider.js';\nimport H from '../../Core/Globals.js';\nconst { doc } = H;\nimport HU from './HTMLUtilities.js';\nconst { addClass, visuallyHideElement } = HU;\nimport U from '../../Core/Utilities.js';\nconst { attr } = U;\n/* *\n *\n * Class\n *\n * */\nclass Announcer {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart, type) {\n this.chart = chart;\n this.domElementProvider = new DOMElementProvider();\n this.announceRegion = this.addAnnounceRegion(type);\n }\n /* *\n *\n * Functions\n *\n * */\n destroy() {\n this.domElementProvider.destroyCreatedElements();\n }\n announce(message) {\n AST.setElementHTML(this.announceRegion, message);\n // Delete contents after a little while to avoid user finding the live\n // region in the DOM.\n if (this.clearAnnouncementRegionTimer) {\n clearTimeout(this.clearAnnouncementRegionTimer);\n }\n this.clearAnnouncementRegionTimer = setTimeout(() => {\n this.announceRegion.innerHTML = AST.emptyHTML;\n delete this.clearAnnouncementRegionTimer;\n }, 3000);\n }\n addAnnounceRegion(type) {\n const chartContainer = (this.chart.announcerContainer || this.createAnnouncerContainer()), div = this.domElementProvider.createElement('div');\n attr(div, {\n 'aria-hidden': false,\n 'aria-live': type,\n 'aria-atomic': true\n });\n if (this.chart.styledMode) {\n addClass(div, 'highcharts-visually-hidden');\n }\n else {\n visuallyHideElement(div);\n }\n chartContainer.appendChild(div);\n return div;\n }\n createAnnouncerContainer() {\n const chart = this.chart, container = doc.createElement('div');\n attr(container, {\n 'aria-hidden': false,\n 'class': 'highcharts-announcer-container'\n });\n container.style.position = 'relative';\n chart.renderTo.insertBefore(container, chart.renderTo.firstChild);\n chart.announcerContainer = container;\n return container;\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default Announcer;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Annotations accessibility code.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport HTMLUtilities from '../Utils/HTMLUtilities.js';\nconst { escapeStringForHTML, stripHTMLTagsFromString } = HTMLUtilities;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Get list of all annotation labels in the chart.\n *\n * @private\n * @param {Highcharts.Chart} chart The chart to get annotation info on.\n * @return {Array} The labels, or empty array if none.\n */\nfunction getChartAnnotationLabels(chart) {\n const annotations = chart.annotations || [];\n return annotations.reduce((acc, cur) => {\n if (cur.options &&\n cur.options.visible !== false) {\n acc = acc.concat(cur.labels);\n }\n return acc;\n }, []);\n}\n/**\n * Get the text of an annotation label.\n *\n * @private\n * @param {Object} label The annotation label object\n * @return {string} The text in the label.\n */\nfunction getLabelText(label) {\n return ((label.options &&\n label.options.accessibility &&\n label.options.accessibility.description) ||\n (label.graphic &&\n label.graphic.text &&\n label.graphic.text.textStr) ||\n '');\n}\n/**\n * Describe an annotation label.\n *\n * @private\n * @param {Object} label The annotation label object to describe\n * @return {string} The description for the label.\n */\nfunction getAnnotationLabelDescription(label) {\n const a11yDesc = (label.options &&\n label.options.accessibility &&\n label.options.accessibility.description);\n if (a11yDesc) {\n return a11yDesc;\n }\n const chart = label.chart;\n const labelText = getLabelText(label);\n const points = label.points;\n const getAriaLabel = (point) => (point.graphic &&\n point.graphic.element &&\n point.graphic.element.getAttribute('aria-label') ||\n '');\n const getValueDesc = (point) => {\n const valDesc = (point.accessibility &&\n point.accessibility.valueDescription ||\n getAriaLabel(point));\n const seriesName = (point &&\n point.series.name ||\n '');\n return (seriesName ? seriesName + ', ' : '') + 'data point ' + valDesc;\n };\n const pointValueDescriptions = points\n .filter((p) => !!p.graphic) // Filter out mock points\n .map(getValueDesc)\n // Filter out points we can't describe\n .filter((desc) => !!desc);\n const numPoints = pointValueDescriptions.length;\n const pointsSelector = numPoints > 1 ?\n 'MultiplePoints' : numPoints ?\n 'SinglePoint' : 'NoPoints';\n const langFormatStr = ('accessibility.screenReaderSection.annotations.description' +\n pointsSelector);\n const context = {\n annotationText: labelText,\n annotation: label,\n numPoints: numPoints,\n annotationPoint: pointValueDescriptions[0],\n additionalAnnotationPoints: pointValueDescriptions.slice(1)\n };\n return chart.langFormat(langFormatStr, context);\n}\n/**\n * Return array of HTML strings for each annotation label in the chart.\n *\n * @private\n * @param {Highcharts.Chart} chart The chart to get annotation info on.\n * @return {Array} Array of strings with HTML content for each annotation label.\n */\nfunction getAnnotationListItems(chart) {\n const labels = getChartAnnotationLabels(chart);\n return labels.map((label) => {\n const desc = escapeStringForHTML(stripHTMLTagsFromString(getAnnotationLabelDescription(label), chart.renderer.forExport));\n return desc ? `
  • ${desc}
  • ` : '';\n });\n}\n/**\n * Return the annotation info for a chart as string.\n *\n * @private\n * @param {Highcharts.Chart} chart The chart to get annotation info on.\n * @return {string} String with HTML content or empty string if no annotations.\n */\nfunction getAnnotationsInfoHTML(chart) {\n const annotations = chart.annotations;\n if (!(annotations && annotations.length)) {\n return '';\n }\n const annotationItems = getAnnotationListItems(chart);\n return `
      ${annotationItems.join(' ')}
    `;\n}\n/**\n * Return the texts for the annotation(s) connected to a point, or empty array\n * if none.\n *\n * @private\n * @param {Highcharts.Point} point The data point to get the annotation info from.\n * @return {Array} Annotation texts\n */\nfunction getPointAnnotationTexts(point) {\n const labels = getChartAnnotationLabels(point.series.chart);\n const pointLabels = labels\n .filter((label) => label.points.indexOf(point) > -1);\n if (!pointLabels.length) {\n return [];\n }\n return pointLabels.map((label) => `${getLabelText(label)}`);\n}\n/* *\n *\n * Default Export\n *\n * */\nconst AnnotationsA11y = {\n getAnnotationsInfoHTML,\n getAnnotationLabelDescription,\n getAnnotationListItems,\n getPointAnnotationTexts\n};\nexport default AnnotationsA11y;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component for chart info region and table.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A11yI18n from '../A11yI18n.js';\nimport AccessibilityComponent from '../AccessibilityComponent.js';\nimport Announcer from '../Utils/Announcer.js';\nimport AnnotationsA11y from './AnnotationsA11y.js';\nconst { getAnnotationsInfoHTML } = AnnotationsA11y;\nimport AST from '../../Core/Renderer/HTML/AST.js';\nimport CU from '../Utils/ChartUtilities.js';\nconst { getAxisDescription, getAxisRangeDescription, getChartTitle, unhideChartElementFromAT } = CU;\nimport F from '../../Core/Templating.js';\nconst { format } = F;\nimport H from '../../Core/Globals.js';\nconst { doc } = H;\nimport HU from '../Utils/HTMLUtilities.js';\nconst { addClass, getElement, getHeadingTagNameForElement, stripHTMLTagsFromString, visuallyHideElement } = HU;\nimport U from '../../Core/Utilities.js';\nconst { attr, pick, replaceNested } = U;\n/* *\n *\n * Functions\n *\n * */\n/* eslint-disable valid-jsdoc */\n/**\n * @private\n */\nfunction getTableSummary(chart) {\n return chart.langFormat('accessibility.table.tableSummary', { chart: chart });\n}\n/**\n * @private\n */\nfunction getTypeDescForMapChart(chart, formatContext) {\n return formatContext.mapTitle ?\n chart.langFormat('accessibility.chartTypes.mapTypeDescription', formatContext) :\n chart.langFormat('accessibility.chartTypes.unknownMap', formatContext);\n}\n/**\n * @private\n */\nfunction getTypeDescForCombinationChart(chart, formatContext) {\n return chart.langFormat('accessibility.chartTypes.combinationChart', formatContext);\n}\n/**\n * @private\n */\nfunction getTypeDescForEmptyChart(chart, formatContext) {\n return chart.langFormat('accessibility.chartTypes.emptyChart', formatContext);\n}\n/**\n * @private\n */\nfunction buildTypeDescriptionFromSeries(chart, types, context) {\n const firstType = types[0], typeExplanation = chart.langFormat('accessibility.seriesTypeDescriptions.' + firstType, context), multi = chart.series && chart.series.length < 2 ? 'Single' : 'Multiple';\n return (chart.langFormat('accessibility.chartTypes.' + firstType + multi, context) ||\n chart.langFormat('accessibility.chartTypes.default' + multi, context)) + (typeExplanation ? ' ' + typeExplanation : '');\n}\n/**\n * Return simplified explanation of chart type. Some types will not be\n * familiar to most users, but in those cases we try to add an explanation\n * of the type.\n *\n * @private\n * @function Highcharts.Chart#getTypeDescription\n * @param {Array} types The series types in this chart.\n * @return {string} The text description of the chart type.\n */\nfunction getTypeDescription(chart, types) {\n const firstType = types[0], firstSeries = chart.series && chart.series[0] || {}, mapTitle = chart.mapView && chart.mapView.geoMap &&\n chart.mapView.geoMap.title, formatContext = {\n numSeries: chart.series.length,\n numPoints: firstSeries.points && firstSeries.points.length,\n chart,\n mapTitle\n };\n if (!firstType) {\n return getTypeDescForEmptyChart(chart, formatContext);\n }\n if (firstType === 'map' || firstType === 'tiledwebmap') {\n return getTypeDescForMapChart(chart, formatContext);\n }\n if (chart.types.length > 1) {\n return getTypeDescForCombinationChart(chart, formatContext);\n }\n return buildTypeDescriptionFromSeries(chart, types, formatContext);\n}\n/**\n * @private\n */\nfunction stripEmptyHTMLTags(str) {\n // Scan alert #[71]: Loop for nested patterns\n return replaceNested(str, [/<([\\w\\-.:!]+)\\b[^<>]*>\\s*<\\/\\1>/g, '']);\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * The InfoRegionsComponent class\n *\n * @private\n * @class\n * @name Highcharts.InfoRegionsComponent\n */\nclass InfoRegionsComponent extends AccessibilityComponent {\n constructor() {\n /* *\n *\n * Properties\n *\n * */\n super(...arguments);\n this.screenReaderSections = {};\n }\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Init the component\n * @private\n */\n init() {\n const chart = this.chart;\n const component = this;\n this.initRegionsDefinitions();\n this.addEvent(chart, 'aftergetTableAST', function (e) {\n component.onDataTableCreated(e);\n });\n this.addEvent(chart, 'afterViewData', function (e) {\n if (e.wasHidden) {\n component.dataTableDiv = e.element;\n // Use a small delay to give browsers & AT time to\n // register the new table.\n setTimeout(function () {\n component.focusDataTable();\n }, 300);\n }\n });\n this.addEvent(chart, 'afterHideData', function () {\n if (component.viewDataTableButton) {\n component.viewDataTableButton\n .setAttribute('aria-expanded', 'false');\n }\n });\n this.announcer = new Announcer(chart, 'assertive');\n }\n /**\n * @private\n */\n initRegionsDefinitions() {\n const component = this, accessibilityOptions = this.chart.options.accessibility;\n this.screenReaderSections = {\n before: {\n element: null,\n buildContent: function (chart) {\n const formatter = accessibilityOptions.screenReaderSection\n .beforeChartFormatter;\n return formatter ? formatter(chart) :\n component.defaultBeforeChartFormatter(chart);\n },\n insertIntoDOM: function (el, chart) {\n chart.renderTo.insertBefore(el, chart.renderTo.firstChild);\n },\n afterInserted: function () {\n if (typeof component.sonifyButtonId !== 'undefined') {\n component.initSonifyButton(component.sonifyButtonId);\n }\n if (typeof component.dataTableButtonId !== 'undefined') {\n component.initDataTableButton(component.dataTableButtonId);\n }\n }\n },\n after: {\n element: null,\n buildContent: function (chart) {\n const formatter = accessibilityOptions.screenReaderSection\n .afterChartFormatter;\n return formatter ? formatter(chart) :\n component.defaultAfterChartFormatter();\n },\n insertIntoDOM: function (el, chart) {\n chart.renderTo.insertBefore(el, chart.container.nextSibling);\n },\n afterInserted: function () {\n if (component.chart.accessibility &&\n accessibilityOptions.keyboardNavigation.enabled) {\n component.chart.accessibility\n .keyboardNavigation.updateExitAnchor(); // #15986\n }\n }\n }\n };\n }\n /**\n * Called on chart render. Have to update the sections on render, in order\n * to get a11y info from series.\n */\n onChartRender() {\n const component = this;\n this.linkedDescriptionElement = this.getLinkedDescriptionElement();\n this.setLinkedDescriptionAttrs();\n Object.keys(this.screenReaderSections).forEach(function (regionKey) {\n component.updateScreenReaderSection(regionKey);\n });\n }\n /**\n * @private\n */\n getLinkedDescriptionElement() {\n const chartOptions = this.chart.options, linkedDescOption = chartOptions.accessibility.linkedDescription;\n if (!linkedDescOption) {\n return;\n }\n if (typeof linkedDescOption !== 'string') {\n return linkedDescOption;\n }\n const query = format(linkedDescOption, this.chart), queryMatch = doc.querySelectorAll(query);\n if (queryMatch.length === 1) {\n return queryMatch[0];\n }\n }\n /**\n * @private\n */\n setLinkedDescriptionAttrs() {\n const el = this.linkedDescriptionElement;\n if (el) {\n el.setAttribute('aria-hidden', 'true');\n addClass(el, 'highcharts-linked-description');\n }\n }\n /**\n * @private\n * @param {string} regionKey\n * The name/key of the region to update\n */\n updateScreenReaderSection(regionKey) {\n const chart = this.chart;\n const region = this.screenReaderSections[regionKey];\n const content = region.buildContent(chart);\n const sectionDiv = region.element = (region.element || this.createElement('div'));\n const hiddenDiv = (sectionDiv.firstChild || this.createElement('div'));\n if (content) {\n this.setScreenReaderSectionAttribs(sectionDiv, regionKey);\n AST.setElementHTML(hiddenDiv, content);\n sectionDiv.appendChild(hiddenDiv);\n region.insertIntoDOM(sectionDiv, chart);\n if (chart.styledMode) {\n addClass(hiddenDiv, 'highcharts-visually-hidden');\n }\n else {\n visuallyHideElement(hiddenDiv);\n }\n unhideChartElementFromAT(chart, hiddenDiv);\n if (region.afterInserted) {\n region.afterInserted();\n }\n }\n else {\n if (sectionDiv.parentNode) {\n sectionDiv.parentNode.removeChild(sectionDiv);\n }\n region.element = null;\n }\n }\n /**\n * Apply a11y attributes to a screen reader info section\n * @private\n * @param {Highcharts.HTMLDOMElement} sectionDiv The section element\n * @param {string} regionKey Name/key of the region we are setting attrs for\n */\n setScreenReaderSectionAttribs(sectionDiv, regionKey) {\n const chart = this.chart, labelText = chart.langFormat('accessibility.screenReaderSection.' + regionKey +\n 'RegionLabel', { chart: chart, chartTitle: getChartTitle(chart) }), sectionId = `highcharts-screen-reader-region-${regionKey}-${chart.index}`;\n attr(sectionDiv, {\n id: sectionId,\n 'aria-label': labelText || void 0\n });\n // Sections are wrapped to be positioned relatively to chart in case\n // elements inside are tabbed to.\n sectionDiv.style.position = 'relative';\n if (labelText) {\n sectionDiv.setAttribute('role', chart.options.accessibility.landmarkVerbosity === 'all' ?\n 'region' : 'group');\n }\n }\n /**\n * @private\n */\n defaultBeforeChartFormatter() {\n const chart = this.chart, format = chart.options.accessibility.screenReaderSection\n .beforeChartFormat;\n if (!format) {\n return '';\n }\n const axesDesc = this.getAxesDescription(), shouldHaveSonifyBtn = (chart.sonify &&\n chart.options.sonification &&\n chart.options.sonification.enabled), sonifyButtonId = 'highcharts-a11y-sonify-data-btn-' +\n chart.index, dataTableButtonId = 'hc-linkto-highcharts-data-table-' +\n chart.index, annotationsList = getAnnotationsInfoHTML(chart), annotationsTitleStr = chart.langFormat('accessibility.screenReaderSection.annotations.heading', { chart: chart }), context = {\n headingTagName: getHeadingTagNameForElement(chart.renderTo),\n chartTitle: getChartTitle(chart),\n typeDescription: this.getTypeDescriptionText(),\n chartSubtitle: this.getSubtitleText(),\n chartLongdesc: this.getLongdescText(),\n xAxisDescription: axesDesc.xAxis,\n yAxisDescription: axesDesc.yAxis,\n playAsSoundButton: shouldHaveSonifyBtn ?\n this.getSonifyButtonText(sonifyButtonId) : '',\n viewTableButton: chart.getCSV ?\n this.getDataTableButtonText(dataTableButtonId) : '',\n annotationsTitle: annotationsList ? annotationsTitleStr : '',\n annotationsList: annotationsList\n }, formattedString = A11yI18n.i18nFormat(format, context, chart);\n this.dataTableButtonId = dataTableButtonId;\n this.sonifyButtonId = sonifyButtonId;\n return stripEmptyHTMLTags(formattedString);\n }\n /**\n * @private\n */\n defaultAfterChartFormatter() {\n const chart = this.chart;\n const format = chart.options.accessibility.screenReaderSection\n .afterChartFormat;\n if (!format) {\n return '';\n }\n const context = { endOfChartMarker: this.getEndOfChartMarkerText() };\n const formattedString = A11yI18n.i18nFormat(format, context, chart);\n return stripEmptyHTMLTags(formattedString);\n }\n /**\n * @private\n */\n getLinkedDescription() {\n const el = this.linkedDescriptionElement, content = el && el.innerHTML || '';\n return stripHTMLTagsFromString(content, this.chart.renderer.forExport);\n }\n /**\n * @private\n */\n getLongdescText() {\n const chartOptions = this.chart.options, captionOptions = chartOptions.caption, captionText = captionOptions && captionOptions.text, linkedDescription = this.getLinkedDescription();\n return (chartOptions.accessibility.description ||\n linkedDescription ||\n captionText ||\n '');\n }\n /**\n * @private\n */\n getTypeDescriptionText() {\n const chart = this.chart;\n return chart.types ?\n chart.options.accessibility.typeDescription ||\n getTypeDescription(chart, chart.types) : '';\n }\n /**\n * @private\n */\n getDataTableButtonText(buttonId) {\n const chart = this.chart, buttonText = chart.langFormat('accessibility.table.viewAsDataTableButtonText', { chart: chart, chartTitle: getChartTitle(chart) });\n return '';\n }\n /**\n * @private\n */\n getSonifyButtonText(buttonId) {\n const chart = this.chart;\n if (chart.options.sonification &&\n chart.options.sonification.enabled === false) {\n return '';\n }\n const buttonText = chart.langFormat('accessibility.sonification.playAsSoundButtonText', { chart: chart, chartTitle: getChartTitle(chart) });\n return '';\n }\n /**\n * @private\n */\n getSubtitleText() {\n const subtitle = (this.chart.options.subtitle);\n return stripHTMLTagsFromString(subtitle && subtitle.text || '', this.chart.renderer.forExport);\n }\n /**\n * @private\n */\n getEndOfChartMarkerText() {\n const endMarkerId = `highcharts-end-of-chart-marker-${this.chart.index}`, endMarker = getElement(endMarkerId);\n if (endMarker) {\n return endMarker.outerHTML;\n }\n const chart = this.chart, markerText = chart.langFormat('accessibility.screenReaderSection.endOfChartMarker', { chart: chart }), id = 'highcharts-end-of-chart-marker-' + chart.index;\n return '
    ' + markerText + '
    ';\n }\n /**\n * @private\n * @param {Highcharts.Dictionary} e\n */\n onDataTableCreated(e) {\n const chart = this.chart;\n if (chart.options.accessibility.enabled) {\n if (this.viewDataTableButton) {\n this.viewDataTableButton.setAttribute('aria-expanded', 'true');\n }\n const attributes = e.tree.attributes || {};\n attributes.tabindex = -1;\n attributes.summary = getTableSummary(chart);\n e.tree.attributes = attributes;\n }\n }\n /**\n * @private\n */\n focusDataTable() {\n const tableDiv = this.dataTableDiv, table = tableDiv && tableDiv.getElementsByTagName('table')[0];\n if (table && table.focus) {\n table.focus();\n }\n }\n /**\n * @private\n * @param {string} sonifyButtonId\n */\n initSonifyButton(sonifyButtonId) {\n const el = this.sonifyButton = getElement(sonifyButtonId);\n const chart = this.chart;\n const defaultHandler = (e) => {\n if (el) {\n el.setAttribute('aria-hidden', 'true');\n el.setAttribute('aria-label', '');\n }\n e.preventDefault();\n e.stopPropagation();\n const announceMsg = chart.langFormat('accessibility.sonification.playAsSoundClickAnnouncement', { chart: chart });\n this.announcer.announce(announceMsg);\n setTimeout(() => {\n if (el) {\n el.removeAttribute('aria-hidden');\n el.removeAttribute('aria-label');\n }\n if (chart.sonify) {\n chart.sonify();\n }\n }, 1000); // Delay to let screen reader speak the button press\n };\n if (el && chart) {\n el.setAttribute('tabindex', -1);\n el.onclick = function (e) {\n const onPlayAsSoundClick = (chart.options.accessibility &&\n chart.options.accessibility.screenReaderSection\n .onPlayAsSoundClick);\n (onPlayAsSoundClick || defaultHandler).call(this, e, chart);\n };\n }\n }\n /**\n * Set attribs and handlers for default viewAsDataTable button if exists.\n * @private\n * @param {string} tableButtonId\n */\n initDataTableButton(tableButtonId) {\n const el = this.viewDataTableButton = getElement(tableButtonId), chart = this.chart, tableId = tableButtonId.replace('hc-linkto-', '');\n if (el) {\n attr(el, {\n tabindex: -1,\n 'aria-expanded': !!getElement(tableId)\n });\n el.onclick = chart.options.accessibility\n .screenReaderSection.onViewDataTableClick ||\n function () {\n chart.viewData();\n };\n }\n }\n /**\n * Return object with text description of each of the chart's axes.\n * @private\n */\n getAxesDescription() {\n const chart = this.chart, shouldDescribeColl = function (collectionKey, defaultCondition) {\n const axes = chart[collectionKey];\n return axes.length > 1 || axes[0] &&\n pick(axes[0].options.accessibility &&\n axes[0].options.accessibility.enabled, defaultCondition);\n }, hasNoMap = !!chart.types &&\n chart.types.indexOf('map') < 0 &&\n chart.types.indexOf('treemap') < 0 &&\n chart.types.indexOf('tilemap') < 0, hasCartesian = !!chart.hasCartesianSeries, showXAxes = shouldDescribeColl('xAxis', !chart.angular && hasCartesian && hasNoMap), showYAxes = shouldDescribeColl('yAxis', hasCartesian && hasNoMap), desc = {};\n if (showXAxes) {\n desc.xAxis = this.getAxisDescriptionText('xAxis');\n }\n if (showYAxes) {\n desc.yAxis = this.getAxisDescriptionText('yAxis');\n }\n return desc;\n }\n /**\n * @private\n */\n getAxisDescriptionText(collectionKey) {\n const chart = this.chart;\n const axes = chart[collectionKey];\n return chart.langFormat('accessibility.axis.' + collectionKey + 'Description' + (axes.length > 1 ? 'Plural' : 'Singular'), {\n chart: chart,\n names: axes.map(function (axis) {\n return getAxisDescription(axis);\n }),\n ranges: axes.map(function (axis) {\n return getAxisRangeDescription(axis);\n }),\n numAxes: axes.length\n });\n }\n /**\n * Remove component traces\n */\n destroy() {\n if (this.announcer) {\n this.announcer.destroy();\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default InfoRegionsComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component for exporting menu.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../../Core/Utilities.js';\nconst { attr } = U;\nimport AccessibilityComponent from '../AccessibilityComponent.js';\nimport KeyboardNavigationHandler from '../KeyboardNavigationHandler.js';\nimport ChartUtilities from '../Utils/ChartUtilities.js';\nconst { getChartTitle, unhideChartElementFromAT } = ChartUtilities;\nimport HTMLUtilities from '../Utils/HTMLUtilities.js';\nconst { getFakeMouseEvent } = HTMLUtilities;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Get the wrapped export button element of a chart.\n * @private\n */\nfunction getExportMenuButtonElement(chart) {\n return chart.exportSVGElements && chart.exportSVGElements[0];\n}\n/**\n * @private\n */\nfunction exportingShouldHaveA11y(chart) {\n const exportingOpts = chart.options.exporting, exportButton = getExportMenuButtonElement(chart);\n return !!(exportingOpts &&\n exportingOpts.enabled !== false &&\n exportingOpts.accessibility &&\n exportingOpts.accessibility.enabled &&\n exportButton &&\n exportButton.element);\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * The MenuComponent class\n *\n * @private\n * @class\n * @name Highcharts.MenuComponent\n */\nclass MenuComponent extends AccessibilityComponent {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Init the component\n */\n init() {\n const chart = this.chart, component = this;\n this.addEvent(chart, 'exportMenuShown', function () {\n component.onMenuShown();\n });\n this.addEvent(chart, 'exportMenuHidden', function () {\n component.onMenuHidden();\n });\n this.createProxyGroup();\n }\n /**\n * @private\n */\n onMenuHidden() {\n const menu = this.chart.exportContextMenu;\n if (menu) {\n menu.setAttribute('aria-hidden', 'true');\n }\n this.setExportButtonExpandedState('false');\n }\n /**\n * @private\n */\n onMenuShown() {\n const chart = this.chart, menu = chart.exportContextMenu;\n if (menu) {\n this.addAccessibleContextMenuAttribs();\n unhideChartElementFromAT(chart, menu);\n }\n this.setExportButtonExpandedState('true');\n }\n /**\n * @private\n * @param {string} stateStr\n */\n setExportButtonExpandedState(stateStr) {\n if (this.exportButtonProxy) {\n this.exportButtonProxy.innerElement.setAttribute('aria-expanded', stateStr);\n }\n }\n /**\n * Called on each render of the chart. We need to update positioning of the\n * proxy overlay.\n */\n onChartRender() {\n const chart = this.chart, focusEl = chart.focusElement, a11y = chart.accessibility;\n this.proxyProvider.clearGroup('chartMenu');\n this.proxyMenuButton();\n if (this.exportButtonProxy &&\n focusEl &&\n focusEl === chart.exportingGroup) {\n if (focusEl.focusBorder) {\n chart.setFocusToElement(focusEl, this.exportButtonProxy.innerElement);\n }\n else if (a11y) {\n a11y.keyboardNavigation.tabindexContainer.focus();\n }\n }\n }\n /**\n * @private\n */\n proxyMenuButton() {\n const chart = this.chart;\n const proxyProvider = this.proxyProvider;\n const buttonEl = getExportMenuButtonElement(chart);\n if (exportingShouldHaveA11y(chart) && buttonEl) {\n this.exportButtonProxy = proxyProvider.addProxyElement('chartMenu', { click: buttonEl }, 'button', {\n 'aria-label': chart.langFormat('accessibility.exporting.menuButtonLabel', {\n chart: chart,\n chartTitle: getChartTitle(chart)\n }),\n 'aria-expanded': false,\n title: chart.options.lang.contextButtonTitle || null\n });\n }\n }\n /**\n * @private\n */\n createProxyGroup() {\n const chart = this.chart;\n if (chart && this.proxyProvider) {\n this.proxyProvider.addGroup('chartMenu');\n }\n }\n /**\n * @private\n */\n addAccessibleContextMenuAttribs() {\n const chart = this.chart, exportList = chart.exportDivElements;\n if (exportList && exportList.length) {\n // Set tabindex on the menu items to allow focusing by script\n // Set role to give screen readers a chance to pick up the contents\n exportList.forEach((item) => {\n if (item) {\n if (item.tagName === 'LI' &&\n !(item.children && item.children.length)) {\n item.setAttribute('tabindex', -1);\n }\n else {\n item.setAttribute('aria-hidden', 'true');\n }\n }\n });\n // Set accessibility properties on parent div\n const parentDiv = (exportList[0] && exportList[0].parentNode);\n if (parentDiv) {\n attr(parentDiv, {\n 'aria-hidden': void 0,\n 'aria-label': chart.langFormat('accessibility.exporting.chartMenuLabel', { chart }),\n role: 'list' // Needed for webkit/VO\n });\n }\n }\n }\n /**\n * Get keyboard navigation handler for this component.\n * @private\n */\n getKeyboardNavigation() {\n const keys = this.keyCodes, chart = this.chart, component = this;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [\n // Arrow prev handler\n [\n [keys.left, keys.up],\n function () {\n return component.onKbdPrevious(this);\n }\n ],\n // Arrow next handler\n [\n [keys.right, keys.down],\n function () {\n return component.onKbdNext(this);\n }\n ],\n // Click handler\n [\n [keys.enter, keys.space],\n function () {\n return component.onKbdClick(this);\n }\n ]\n ],\n // Only run exporting navigation if exporting support exists and is\n // enabled on chart\n validate: function () {\n return !!chart.exporting &&\n chart.options.exporting.enabled !== false &&\n chart.options.exporting.accessibility.enabled !==\n false;\n },\n // Focus export menu button\n init: function () {\n const proxy = component.exportButtonProxy;\n const svgEl = component.chart.exportingGroup;\n if (proxy && svgEl) {\n chart.setFocusToElement(svgEl, proxy.innerElement);\n }\n },\n // Hide the menu\n terminate: function () {\n chart.hideExportMenu();\n }\n });\n }\n /**\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler\n * @return {number} Response code\n */\n onKbdPrevious(keyboardNavigationHandler) {\n const chart = this.chart;\n const a11yOptions = chart.options.accessibility;\n const response = keyboardNavigationHandler.response;\n // Try to highlight prev item in list. Highlighting e.g.\n // separators will fail.\n let i = chart.highlightedExportItemIx || 0;\n while (i--) {\n if (chart.highlightExportItem(i)) {\n return response.success;\n }\n }\n // We failed, so wrap around or move to prev module\n if (a11yOptions.keyboardNavigation.wrapAround) {\n chart.highlightLastExportItem();\n return response.success;\n }\n return response.prev;\n }\n /**\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler\n * @return {number} Response code\n */\n onKbdNext(keyboardNavigationHandler) {\n const chart = this.chart;\n const a11yOptions = chart.options.accessibility;\n const response = keyboardNavigationHandler.response;\n // Try to highlight next item in list. Highlighting e.g.\n // separators will fail.\n for (let i = (chart.highlightedExportItemIx || 0) + 1; i < chart.exportDivElements.length; ++i) {\n if (chart.highlightExportItem(i)) {\n return response.success;\n }\n }\n // We failed, so wrap around or move to next module\n if (a11yOptions.keyboardNavigation.wrapAround) {\n chart.highlightExportItem(0);\n return response.success;\n }\n return response.next;\n }\n /**\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler\n * @return {number} Response code\n */\n onKbdClick(keyboardNavigationHandler) {\n const chart = this.chart;\n const curHighlightedItem = chart.exportDivElements[chart.highlightedExportItemIx];\n const exportButtonElement = getExportMenuButtonElement(chart).element;\n if (chart.openMenu) {\n this.fakeClickEvent(curHighlightedItem);\n }\n else {\n this.fakeClickEvent(exportButtonElement);\n chart.highlightExportItem(0);\n }\n return keyboardNavigationHandler.response.success;\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (MenuComponent) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(ChartClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.hideExportMenu) {\n chartProto.hideExportMenu = chartHideExportMenu;\n chartProto.highlightExportItem = chartHighlightExportItem;\n chartProto.highlightLastExportItem = chartHighlightLastExportItem;\n chartProto.showExportMenu = chartShowExportMenu;\n }\n }\n MenuComponent.compose = compose;\n /**\n * Show the export menu and focus the first item (if exists).\n *\n * @private\n * @function Highcharts.Chart#showExportMenu\n */\n function chartShowExportMenu() {\n const exportButton = getExportMenuButtonElement(this);\n if (exportButton) {\n const el = exportButton.element;\n if (el.onclick) {\n el.onclick(getFakeMouseEvent('click'));\n }\n }\n }\n /**\n * @private\n * @function Highcharts.Chart#hideExportMenu\n */\n function chartHideExportMenu() {\n const chart = this, exportList = chart.exportDivElements;\n if (exportList && chart.exportContextMenu && chart.openMenu) {\n // Reset hover states etc.\n exportList.forEach((el) => {\n if (el &&\n el.className === 'highcharts-menu-item' &&\n el.onmouseout) {\n el.onmouseout(getFakeMouseEvent('mouseout'));\n }\n });\n chart.highlightedExportItemIx = 0;\n // Hide the menu div\n chart.exportContextMenu.hideMenu();\n // Make sure the chart has focus and can capture keyboard events\n chart.container.focus();\n }\n }\n /**\n * Highlight export menu item by index.\n *\n * @private\n * @function Highcharts.Chart#highlightExportItem\n */\n function chartHighlightExportItem(ix) {\n const listItem = this.exportDivElements && this.exportDivElements[ix];\n const curHighlighted = this.exportDivElements &&\n this.exportDivElements[this.highlightedExportItemIx];\n if (listItem &&\n listItem.tagName === 'LI' &&\n !(listItem.children && listItem.children.length)) {\n // Test if we have focus support for SVG elements\n const hasSVGFocusSupport = !!(this.renderTo.getElementsByTagName('g')[0] || {}).focus;\n // Only focus if we can set focus back to the elements after\n // destroying the menu (#7422)\n if (listItem.focus && hasSVGFocusSupport) {\n listItem.focus();\n }\n if (curHighlighted && curHighlighted.onmouseout) {\n curHighlighted.onmouseout(getFakeMouseEvent('mouseout'));\n }\n if (listItem.onmouseover) {\n listItem.onmouseover(getFakeMouseEvent('mouseover'));\n }\n this.highlightedExportItemIx = ix;\n return true;\n }\n return false;\n }\n /**\n * Try to highlight the last valid export menu item.\n *\n * @private\n * @function Highcharts.Chart#highlightLastExportItem\n */\n function chartHighlightLastExportItem() {\n const chart = this;\n if (chart.exportDivElements) {\n let i = chart.exportDivElements.length;\n while (i--) {\n if (chart.highlightExportItem(i)) {\n return true;\n }\n }\n }\n return false;\n }\n})(MenuComponent || (MenuComponent = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default MenuComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Main keyboard navigation handling.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Core/Globals.js';\nconst { doc, win } = H;\nimport MenuComponent from './Components/MenuComponent.js';\nimport U from '../Core/Utilities.js';\nconst { addEvent, defined, fireEvent } = U;\nimport EventProvider from './Utils/EventProvider.js';\nimport HTMLUtilities from './Utils/HTMLUtilities.js';\nconst { getElement, simulatedEventTarget } = HTMLUtilities;\n/* *\n *\n * Class\n *\n * */\n/**\n * The KeyboardNavigation class, containing the overall keyboard navigation\n * logic for the chart.\n *\n * @requires module:modules/accessibility\n *\n * @private\n * @class\n * @param {Highcharts.Chart} chart\n * Chart object\n * @param {Object} components\n * Map of component names to AccessibilityComponent objects.\n * @name Highcharts.KeyboardNavigation\n */\nclass KeyboardNavigation {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart, components) {\n this.currentModuleIx = NaN;\n this.modules = [];\n this.init(chart, components);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Initialize the class\n * @private\n * @param {Highcharts.Chart} chart\n * Chart object\n * @param {Object} components\n * Map of component names to AccessibilityComponent objects.\n */\n init(chart, components) {\n const ep = this.eventProvider = new EventProvider();\n this.chart = chart;\n this.components = components;\n this.modules = [];\n this.currentModuleIx = 0;\n this.update();\n ep.addEvent(this.tabindexContainer, 'keydown', (e) => this.onKeydown(e));\n ep.addEvent(this.tabindexContainer, 'focus', (e) => this.onFocus(e));\n ['mouseup', 'touchend'].forEach((eventName) => ep.addEvent(doc, eventName, (e) => this.onMouseUp(e)));\n ['mousedown', 'touchstart'].forEach((eventName) => ep.addEvent(chart.renderTo, eventName, () => {\n this.isClickingChart = true;\n }));\n }\n /**\n * Update the modules for the keyboard navigation.\n * @param {Array} [order]\n * Array specifying the tab order of the components.\n */\n update(order) {\n const a11yOptions = this.chart.options.accessibility, keyboardOptions = a11yOptions && a11yOptions.keyboardNavigation, components = this.components;\n this.updateContainerTabindex();\n if (keyboardOptions &&\n keyboardOptions.enabled &&\n order &&\n order.length) {\n // We (still) have keyboard navigation. Update module list\n this.modules = order.reduce(function (modules, componentName) {\n const navModules = components[componentName]\n .getKeyboardNavigation();\n return modules.concat(navModules);\n }, []);\n this.updateExitAnchor();\n }\n else {\n this.modules = [];\n this.currentModuleIx = 0;\n this.removeExitAnchor();\n }\n }\n /**\n * We use an exit anchor to move focus out of chart whenever we want, by\n * setting focus to this div and not preventing the default tab action. We\n * also use this when users come back into the chart by tabbing back, in\n * order to navigate from the end of the chart.\n * @private\n */\n updateExitAnchor() {\n const endMarkerId = `highcharts-end-of-chart-marker-${this.chart.index}`, endMarker = getElement(endMarkerId);\n this.removeExitAnchor();\n if (endMarker) {\n this.makeElementAnExitAnchor(endMarker);\n this.exitAnchor = endMarker;\n }\n else {\n this.createExitAnchor();\n }\n }\n /**\n * Move to prev/next module.\n * @private\n * @param {number} direction\n * Direction to move. +1 for next, -1 for prev.\n * @return {boolean}\n * True if there was a valid module in direction.\n */\n move(direction) {\n const curModule = this.modules && this.modules[this.currentModuleIx];\n if (curModule && curModule.terminate) {\n curModule.terminate(direction);\n }\n // Remove existing focus border if any\n if (this.chart.focusElement) {\n this.chart.focusElement.removeFocusBorder();\n }\n this.currentModuleIx += direction;\n const newModule = this.modules && this.modules[this.currentModuleIx];\n if (newModule) {\n if (newModule.validate && !newModule.validate()) {\n return this.move(direction); // Invalid module, recurse\n }\n if (newModule.init) {\n newModule.init(direction); // Valid module, init it\n return true;\n }\n }\n // No module\n this.currentModuleIx = 0; // Reset counter\n // Set focus to chart or exit anchor depending on direction\n this.exiting = true;\n if (direction > 0) {\n this.exitAnchor && this.exitAnchor.focus();\n }\n else {\n this.tabindexContainer.focus();\n }\n return false;\n }\n /**\n * Function to run on container focus\n * @private\n * @param {global.FocusEvent} e Browser focus event.\n */\n onFocus(e) {\n const chart = this.chart, focusComesFromChart = (e.relatedTarget &&\n chart.container.contains(e.relatedTarget)), a11yOptions = chart.options.accessibility, keyboardOptions = a11yOptions && a11yOptions.keyboardNavigation, enabled = keyboardOptions && keyboardOptions.enabled;\n // Init keyboard nav if tabbing into chart\n if (enabled &&\n !this.exiting &&\n !this.tabbingInBackwards &&\n !this.isClickingChart &&\n !focusComesFromChart) {\n const ix = this.getFirstValidModuleIx();\n if (ix !== null) {\n this.currentModuleIx = ix;\n this.modules[ix].init(1);\n }\n }\n this.keyboardReset = false;\n this.exiting = false;\n }\n /**\n * Reset chart navigation state if we mouse click and it's not already\n * reset. Reset fully if outside the chart, otherwise just hide focus\n * indicator.\n * @private\n */\n onMouseUp(e) {\n delete this.isClickingChart;\n if (!this.keyboardReset &&\n e.relatedTarget !== simulatedEventTarget) {\n const chart = this.chart;\n if (!e.target ||\n !chart.container.contains(e.target)) {\n const curMod = this.modules &&\n this.modules[this.currentModuleIx || 0];\n if (curMod && curMod.terminate) {\n curMod.terminate();\n }\n this.currentModuleIx = 0;\n }\n if (chart.focusElement) {\n chart.focusElement.removeFocusBorder();\n delete chart.focusElement;\n }\n this.keyboardReset = true;\n }\n }\n /**\n * Function to run on keydown\n * @private\n * @param {global.KeyboardEvent} ev Browser keydown event.\n */\n onKeydown(ev) {\n const e = ev || win.event, curNavModule = (this.modules &&\n this.modules.length &&\n this.modules[this.currentModuleIx]);\n let preventDefault;\n const target = e.target;\n if (target &&\n target.nodeName === 'INPUT' &&\n !target.classList.contains('highcharts-a11y-proxy-element')) {\n return;\n }\n // Used for resetting nav state when clicking outside chart\n this.keyboardReset = false;\n // Used for sending focus out of the chart by the modules.\n this.exiting = false;\n // If there is a nav module for the current index, run it.\n // Otherwise, we are outside of the chart in some direction.\n if (curNavModule) {\n const response = curNavModule.run(e);\n if (response === curNavModule.response.success) {\n preventDefault = true;\n }\n else if (response === curNavModule.response.prev) {\n preventDefault = this.move(-1);\n }\n else if (response === curNavModule.response.next) {\n preventDefault = this.move(1);\n }\n if (preventDefault) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n }\n /**\n * Chart container should have tabindex if navigation is enabled.\n * @private\n */\n updateContainerTabindex() {\n const a11yOptions = this.chart.options.accessibility, keyboardOptions = a11yOptions && a11yOptions.keyboardNavigation, shouldHaveTabindex = !(keyboardOptions && keyboardOptions.enabled === false), chart = this.chart, container = chart.container;\n let tabindexContainer;\n if (chart.renderTo.hasAttribute('tabindex')) {\n container.removeAttribute('tabindex');\n tabindexContainer = chart.renderTo;\n }\n else {\n tabindexContainer = container;\n }\n this.tabindexContainer = tabindexContainer;\n const curTabindex = tabindexContainer.getAttribute('tabindex');\n if (shouldHaveTabindex && !curTabindex) {\n tabindexContainer.setAttribute('tabindex', '0');\n }\n else if (!shouldHaveTabindex) {\n chart.container.removeAttribute('tabindex');\n }\n }\n /**\n * Add new exit anchor to the chart.\n * @private\n */\n createExitAnchor() {\n const chart = this.chart, exitAnchor = this.exitAnchor = doc.createElement('div');\n chart.renderTo.appendChild(exitAnchor);\n this.makeElementAnExitAnchor(exitAnchor);\n }\n /**\n * Add attributes and events to an element to make it function as an\n * exit anchor.\n * @private\n */\n makeElementAnExitAnchor(el) {\n const chartTabindex = this.tabindexContainer.getAttribute('tabindex') || 0;\n el.setAttribute('class', 'highcharts-exit-anchor');\n el.setAttribute('tabindex', chartTabindex);\n el.setAttribute('aria-hidden', false);\n // Handle focus\n this.addExitAnchorEventsToEl(el);\n }\n /**\n * Destroy the exit anchor and remove from DOM.\n * @private\n */\n removeExitAnchor() {\n // Remove event from element and from eventRemovers array to prevent\n // memory leak (#20329).\n if (this.exitAnchor) {\n if (defined(this.exitAnchor.focusEventRemover)) {\n this.eventProvider.removeEvent(this.exitAnchor.focusEventRemover);\n delete this.exitAnchor.focusEventRemover;\n }\n if (this.exitAnchor.parentNode) {\n this.exitAnchor.parentNode.removeChild(this.exitAnchor);\n }\n delete this.exitAnchor;\n }\n }\n /**\n * Add focus handler to exit anchor element.\n * @private\n */\n addExitAnchorEventsToEl(element) {\n const chart = this.chart, keyboardNavigation = this;\n element.focusEventRemover = this.eventProvider.addEvent(element, 'focus', function (ev) {\n const e = ev || win.event, focusComesFromChart = (e.relatedTarget &&\n chart.container.contains(e.relatedTarget)), comingInBackwards = !(focusComesFromChart || keyboardNavigation.exiting);\n if (chart.focusElement) {\n delete chart.focusElement;\n }\n if (comingInBackwards) {\n // Focus the container instead\n keyboardNavigation.tabbingInBackwards = true;\n keyboardNavigation.tabindexContainer.focus();\n delete keyboardNavigation.tabbingInBackwards;\n e.preventDefault();\n // Move to last valid keyboard nav module\n // Note the we don't run it, just set the index\n if (keyboardNavigation.modules &&\n keyboardNavigation.modules.length) {\n keyboardNavigation.currentModuleIx =\n keyboardNavigation.modules.length - 1;\n const curModule = keyboardNavigation.modules[keyboardNavigation.currentModuleIx];\n // Validate the module\n if (curModule &&\n curModule.validate && !curModule.validate()) {\n // Invalid.\n // Try moving backwards to find next valid.\n keyboardNavigation.move(-1);\n }\n else if (curModule) {\n // We have a valid module, init it\n curModule.init(-1);\n }\n }\n }\n else {\n // Don't skip the next focus, we only skip once.\n keyboardNavigation.exiting = false;\n }\n });\n }\n /**\n * Get the ix of the first module that either does not require validation or\n * validates positively.\n * @private\n */\n getFirstValidModuleIx() {\n const len = this.modules.length;\n for (let i = 0; i < len; ++i) {\n const mod = this.modules[i];\n if (!mod.validate || mod.validate()) {\n return i;\n }\n }\n return null;\n }\n /**\n * Remove all traces of keyboard navigation.\n * @private\n */\n destroy() {\n this.removeExitAnchor();\n this.eventProvider.removeAddedEvents();\n this.chart.container.removeAttribute('tabindex');\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (KeyboardNavigation) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Composition function.\n * @private\n */\n function compose(ChartClass) {\n MenuComponent.compose(ChartClass);\n const chartProto = ChartClass.prototype;\n if (!chartProto.dismissPopupContent) {\n chartProto.dismissPopupContent = chartDismissPopupContent;\n addEvent(doc, 'keydown', documentOnKeydown);\n }\n return ChartClass;\n }\n KeyboardNavigation.compose = compose;\n /**\n * Dismiss popup content in chart, including export menu and tooltip.\n * @private\n */\n function chartDismissPopupContent() {\n const chart = this;\n fireEvent(this, 'dismissPopupContent', {}, function () {\n if (chart.tooltip) {\n chart.tooltip.hide(0);\n }\n chart.hideExportMenu();\n });\n }\n /**\n * Add event listener to document to detect ESC key press and dismiss\n * hover/popup content.\n * @private\n */\n function documentOnKeydown(e) {\n const keycode = e.which || e.keyCode;\n const esc = 27;\n if (keycode === esc && H.charts) {\n H.charts.forEach((chart) => {\n if (chart && chart.dismissPopupContent) {\n chart.dismissPopupContent();\n }\n });\n }\n }\n})(KeyboardNavigation || (KeyboardNavigation = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default KeyboardNavigation;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component for chart legend.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport A from '../../Core/Animation/AnimationUtilities.js';\nconst { animObject } = A;\nimport H from '../../Core/Globals.js';\nconst { doc } = H;\nimport Legend from '../../Core/Legend/Legend.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, fireEvent, isNumber, pick, syncTimeout } = U;\nimport AccessibilityComponent from '../AccessibilityComponent.js';\nimport KeyboardNavigationHandler from '../KeyboardNavigationHandler.js';\nimport CU from '../Utils/ChartUtilities.js';\nconst { getChartTitle } = CU;\nimport HU from '../Utils/HTMLUtilities.js';\nconst { stripHTMLTagsFromString: stripHTMLTags, addClass, removeClass } = HU;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction scrollLegendToItem(legend, itemIx) {\n const itemPage = (legend.allItems[itemIx].legendItem || {}).pageIx, curPage = legend.currentPage;\n if (typeof itemPage !== 'undefined' && itemPage + 1 !== curPage) {\n legend.scroll(1 + itemPage - curPage);\n }\n}\n/**\n * @private\n */\nfunction shouldDoLegendA11y(chart) {\n const items = chart.legend && chart.legend.allItems, legendA11yOptions = (chart.options.legend.accessibility || {}), unsupportedColorAxis = chart.colorAxis && chart.colorAxis.some((c) => !c.dataClasses || !c.dataClasses.length);\n return !!(items && items.length &&\n !unsupportedColorAxis &&\n legendA11yOptions.enabled !== false);\n}\n/**\n * @private\n */\nfunction setLegendItemHoverState(hoverActive, item) {\n const legendItem = item.legendItem || {};\n item.setState(hoverActive ? 'hover' : '', true);\n for (const key of ['group', 'label', 'symbol']) {\n const svgElement = legendItem[key];\n const element = svgElement && svgElement.element || svgElement;\n if (element) {\n fireEvent(element, hoverActive ? 'mouseover' : 'mouseout');\n }\n }\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * The LegendComponent class\n *\n * @private\n * @class\n * @name Highcharts.LegendComponent\n */\nclass LegendComponent extends AccessibilityComponent {\n constructor() {\n /* *\n *\n * Properties\n *\n * */\n super(...arguments);\n this.highlightedLegendItemIx = NaN;\n this.proxyGroup = null;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Init the component\n * @private\n */\n init() {\n const component = this;\n this.recreateProxies();\n // Note: Chart could create legend dynamically, so events cannot be\n // tied to the component's chart's current legend.\n // @todo 1. attach component to created legends\n // @todo 2. move listeners to composition and access `this.component`\n this.addEvent(Legend, 'afterScroll', function () {\n if (this.chart === component.chart) {\n component.proxyProvider.updateGroupProxyElementPositions('legend');\n component.updateLegendItemProxyVisibility();\n if (component.highlightedLegendItemIx > -1) {\n this.chart.highlightLegendItem(component.highlightedLegendItemIx);\n }\n }\n });\n this.addEvent(Legend, 'afterPositionItem', function (e) {\n if (this.chart === component.chart && this.chart.renderer) {\n component.updateProxyPositionForItem(e.item);\n }\n });\n this.addEvent(Legend, 'afterRender', function () {\n if (this.chart === component.chart &&\n this.chart.renderer &&\n component.recreateProxies()) {\n syncTimeout(() => component.proxyProvider\n .updateGroupProxyElementPositions('legend'), animObject(pick(this.chart.renderer.globalAnimation, true)).duration);\n }\n });\n }\n /**\n * Update visibility of legend items when using paged legend\n * @private\n */\n updateLegendItemProxyVisibility() {\n const chart = this.chart;\n const legend = chart.legend;\n const items = legend.allItems || [];\n const curPage = legend.currentPage || 1;\n const clipHeight = legend.clipHeight || 0;\n let legendItem;\n items.forEach((item) => {\n if (item.a11yProxyElement) {\n const hasPages = legend.pages && legend.pages.length;\n const proxyEl = item.a11yProxyElement.element;\n let hide = false;\n legendItem = item.legendItem || {};\n if (hasPages) {\n const itemPage = legendItem.pageIx || 0;\n const y = legendItem.y || 0;\n const h = legendItem.label ?\n Math.round(legendItem.label.getBBox().height) :\n 0;\n hide = y + h - legend.pages[itemPage] > clipHeight ||\n itemPage !== curPage - 1;\n }\n if (hide) {\n if (chart.styledMode) {\n addClass(proxyEl, 'highcharts-a11y-invisible');\n }\n else {\n proxyEl.style.visibility = 'hidden';\n }\n }\n else {\n removeClass(proxyEl, 'highcharts-a11y-invisible');\n proxyEl.style.visibility = '';\n }\n }\n });\n }\n /**\n * @private\n */\n onChartRender() {\n if (!shouldDoLegendA11y(this.chart)) {\n this.removeProxies();\n }\n }\n /**\n * @private\n */\n highlightAdjacentLegendPage(direction) {\n const chart = this.chart;\n const legend = chart.legend;\n const curPageIx = legend.currentPage || 1;\n const newPageIx = curPageIx + direction;\n const pages = legend.pages || [];\n if (newPageIx > 0 && newPageIx <= pages.length) {\n let i = 0, res;\n for (const item of legend.allItems) {\n if (((item.legendItem || {}).pageIx || 0) + 1 === newPageIx) {\n res = chart.highlightLegendItem(i);\n if (res) {\n this.highlightedLegendItemIx = i;\n }\n }\n ++i;\n }\n }\n }\n /**\n * @private\n */\n updateProxyPositionForItem(item) {\n if (item.a11yProxyElement) {\n item.a11yProxyElement.refreshPosition();\n }\n }\n /**\n * Returns false if legend a11y is disabled and proxies were not created,\n * true otherwise.\n * @private\n */\n recreateProxies() {\n const focusedElement = doc.activeElement;\n const proxyGroup = this.proxyGroup;\n const shouldRestoreFocus = focusedElement && proxyGroup &&\n proxyGroup.contains(focusedElement);\n this.removeProxies();\n if (shouldDoLegendA11y(this.chart)) {\n this.addLegendProxyGroup();\n this.proxyLegendItems();\n this.updateLegendItemProxyVisibility();\n this.updateLegendTitle();\n if (shouldRestoreFocus) {\n this.chart.highlightLegendItem(this.highlightedLegendItemIx);\n }\n return true;\n }\n return false;\n }\n /**\n * @private\n */\n removeProxies() {\n this.proxyProvider.removeGroup('legend');\n }\n /**\n * @private\n */\n updateLegendTitle() {\n const chart = this.chart;\n const legendTitle = stripHTMLTags((chart.legend &&\n chart.legend.options.title &&\n chart.legend.options.title.text ||\n '').replace(/
    /g, ' '), chart.renderer.forExport);\n const legendLabel = chart.langFormat('accessibility.legend.legendLabel' + (legendTitle ? '' : 'NoTitle'), {\n chart,\n legendTitle,\n chartTitle: getChartTitle(chart)\n });\n this.proxyProvider.updateGroupAttrs('legend', {\n 'aria-label': legendLabel\n });\n }\n /**\n * @private\n */\n addLegendProxyGroup() {\n const a11yOptions = this.chart.options.accessibility;\n const groupRole = a11yOptions.landmarkVerbosity === 'all' ?\n 'region' : null;\n this.proxyGroup = this.proxyProvider.addGroup('legend', 'ul', {\n // Filled by updateLegendTitle, to keep up to date without\n // recreating group\n 'aria-label': '_placeholder_',\n role: groupRole\n });\n }\n /**\n * @private\n */\n proxyLegendItems() {\n const component = this, items = (this.chart.legend || {}).allItems || [];\n let legendItem;\n items.forEach((item) => {\n legendItem = item.legendItem || {};\n if (legendItem.label && legendItem.label.element) {\n component.proxyLegendItem(item);\n }\n });\n }\n /**\n * @private\n * @param {Highcharts.BubbleLegendItem|Point|Highcharts.Series} item\n */\n proxyLegendItem(item) {\n const legendItem = item.legendItem || {};\n if (!legendItem.label || !legendItem.group) {\n return;\n }\n const itemLabel = this.chart.langFormat('accessibility.legend.legendItem', {\n chart: this.chart,\n itemName: stripHTMLTags(item.name, this.chart.renderer.forExport),\n item\n });\n const attribs = {\n tabindex: -1,\n 'aria-pressed': item.visible,\n 'aria-label': itemLabel\n };\n // Considers useHTML\n const proxyPositioningElement = legendItem.group.div ?\n legendItem.label :\n legendItem.group;\n item.a11yProxyElement = this.proxyProvider.addProxyElement('legend', {\n click: legendItem.label,\n visual: proxyPositioningElement.element\n }, 'button', attribs);\n }\n /**\n * Get keyboard navigation handler for this component.\n * @private\n */\n getKeyboardNavigation() {\n const keys = this.keyCodes, component = this, chart = this.chart;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [\n [\n [keys.left, keys.right, keys.up, keys.down],\n function (keyCode) {\n return component.onKbdArrowKey(this, keyCode);\n }\n ],\n [\n [keys.enter, keys.space],\n function () {\n return component.onKbdClick(this);\n }\n ],\n [\n [keys.pageDown, keys.pageUp],\n function (keyCode) {\n const direction = keyCode === keys.pageDown ? 1 : -1;\n component.highlightAdjacentLegendPage(direction);\n return this.response.success;\n }\n ]\n ],\n validate: function () {\n return component.shouldHaveLegendNavigation();\n },\n init: function () {\n chart.highlightLegendItem(0);\n component.highlightedLegendItemIx = 0;\n },\n terminate: function () {\n component.highlightedLegendItemIx = -1;\n chart.legend.allItems.forEach((item) => setLegendItemHoverState(false, item));\n }\n });\n }\n /**\n * Arrow key navigation\n * @private\n */\n onKbdArrowKey(keyboardNavigationHandler, key) {\n const { keyCodes: { left, up }, highlightedLegendItemIx, chart } = this, numItems = chart.legend.allItems.length, wrapAround = chart.options.accessibility\n .keyboardNavigation.wrapAround, direction = (key === left || key === up) ? -1 : 1, res = chart.highlightLegendItem(highlightedLegendItemIx + direction);\n if (res) {\n this.highlightedLegendItemIx += direction;\n }\n else if (wrapAround && numItems > 1) {\n this.highlightedLegendItemIx = direction > 0 ?\n 0 : numItems - 1;\n chart.highlightLegendItem(this.highlightedLegendItemIx);\n }\n return keyboardNavigationHandler.response.success;\n }\n /**\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler\n * @return {number} Response code\n */\n onKbdClick(keyboardNavigationHandler) {\n const legendItem = this.chart.legend.allItems[this.highlightedLegendItemIx];\n if (legendItem && legendItem.a11yProxyElement) {\n legendItem.a11yProxyElement.click();\n }\n return keyboardNavigationHandler.response.success;\n }\n /**\n * @private\n */\n shouldHaveLegendNavigation() {\n if (!shouldDoLegendA11y(this.chart)) {\n return false;\n }\n const chart = this.chart, legendOptions = chart.options.legend || {}, legendA11yOptions = (legendOptions.accessibility || {});\n return !!(chart.legend.display &&\n legendA11yOptions.keyboardNavigation &&\n legendA11yOptions.keyboardNavigation.enabled);\n }\n /**\n * Clean up\n * @private\n */\n destroy() {\n this.removeProxies();\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (LegendComponent) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Highlight legend item by index.\n * @private\n */\n function chartHighlightLegendItem(ix) {\n const items = this.legend.allItems;\n const oldIx = this.accessibility &&\n this.accessibility.components.legend.highlightedLegendItemIx;\n const itemToHighlight = items[ix], legendItem = itemToHighlight?.legendItem || {};\n if (itemToHighlight) {\n if (isNumber(oldIx) && items[oldIx]) {\n setLegendItemHoverState(false, items[oldIx]);\n }\n scrollLegendToItem(this.legend, ix);\n const legendItemProp = legendItem.label;\n const proxyBtn = itemToHighlight.a11yProxyElement &&\n itemToHighlight.a11yProxyElement.element;\n if (legendItemProp && legendItemProp.element && proxyBtn) {\n this.setFocusToElement(legendItemProp, proxyBtn);\n }\n setLegendItemHoverState(true, itemToHighlight);\n return true;\n }\n return false;\n }\n /**\n * @private\n */\n function compose(ChartClass, LegendClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.highlightLegendItem) {\n chartProto.highlightLegendItem = chartHighlightLegendItem;\n addEvent(LegendClass, 'afterColorizeItem', legendOnAfterColorizeItem);\n }\n }\n LegendComponent.compose = compose;\n /**\n * Keep track of pressed state for legend items.\n * @private\n */\n function legendOnAfterColorizeItem(e) {\n const chart = this.chart, a11yOptions = chart.options.accessibility, legendItem = e.item;\n if (a11yOptions.enabled && legendItem && legendItem.a11yProxyElement) {\n legendItem.a11yProxyElement.innerElement.setAttribute('aria-pressed', e.visible ? 'true' : 'false');\n }\n }\n})(LegendComponent || (LegendComponent = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default LegendComponent;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../Core/Globals.js';\nconst { isTouchDevice } = H;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, merge, pick } = U;\n/* *\n *\n * Constants\n *\n * */\nconst composedMembers = [];\n/* *\n *\n * Variables\n *\n * */\nlet NavigatorConstructor;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction compose(ChartClass, NavigatorClass) {\n if (U.pushUnique(composedMembers, ChartClass)) {\n const chartProto = ChartClass.prototype;\n NavigatorConstructor = NavigatorClass;\n chartProto.callbacks.push(onChartCallback);\n addEvent(ChartClass, 'afterAddSeries', onChartAfterAddSeries);\n addEvent(ChartClass, 'afterSetChartSize', onChartAfterSetChartSize);\n addEvent(ChartClass, 'afterUpdate', onChartAfterUpdate);\n addEvent(ChartClass, 'beforeRender', onChartBeforeRender);\n addEvent(ChartClass, 'beforeShowResetZoom', onChartBeforeShowResetZoom);\n addEvent(ChartClass, 'update', onChartUpdate);\n }\n}\n/**\n * Handle adding new series.\n * @private\n */\nfunction onChartAfterAddSeries() {\n if (this.navigator) {\n // Recompute which series should be shown in navigator, and add them\n this.navigator.setBaseSeries(null, false);\n }\n}\n/**\n * For stock charts, extend the Chart.setChartSize method so that we can set the\n * final top position of the navigator once the height of the chart, including\n * the legend, is determined. #367. We can't use Chart.getMargins, because\n * labels offsets are not calculated yet.\n * @private\n */\nfunction onChartAfterSetChartSize() {\n const legend = this.legend, navigator = this.navigator;\n let legendOptions, xAxis, yAxis;\n if (navigator) {\n legendOptions = legend && legend.options;\n xAxis = navigator.xAxis;\n yAxis = navigator.yAxis;\n const { scrollbarHeight, scrollButtonSize } = navigator;\n // Compute the top position\n if (this.inverted) {\n navigator.left = navigator.opposite ?\n this.chartWidth - scrollbarHeight -\n navigator.height :\n this.spacing[3] + scrollbarHeight;\n navigator.top = this.plotTop + scrollButtonSize;\n }\n else {\n navigator.left = pick(xAxis.left, this.plotLeft + scrollButtonSize);\n navigator.top = navigator.navigatorOptions.top ||\n this.chartHeight -\n navigator.height -\n scrollbarHeight -\n (this.scrollbar?.options.margin || 0) -\n this.spacing[2] -\n (this.rangeSelector && this.extraBottomMargin ?\n this.rangeSelector.getHeight() :\n 0) -\n ((legendOptions &&\n legendOptions.verticalAlign === 'bottom' &&\n legendOptions.layout !== 'proximate' && // #13392\n legendOptions.enabled &&\n !legendOptions.floating) ?\n legend.legendHeight +\n pick(legendOptions.margin, 10) :\n 0) -\n (this.titleOffset ? this.titleOffset[2] : 0);\n }\n if (xAxis && yAxis) { // false if navigator is disabled (#904)\n if (this.inverted) {\n xAxis.options.left = yAxis.options.left = navigator.left;\n }\n else {\n xAxis.options.top = yAxis.options.top = navigator.top;\n }\n xAxis.setAxisSize();\n yAxis.setAxisSize();\n }\n }\n}\n/**\n * Initialize navigator, if no scrolling exists yet.\n * @private\n */\nfunction onChartAfterUpdate(event) {\n if (!this.navigator && !this.scroller &&\n (this.options.navigator.enabled ||\n this.options.scrollbar.enabled)) {\n this.scroller = this.navigator = new NavigatorConstructor(this);\n if (pick(event.redraw, true)) {\n this.redraw(event.animation); // #7067\n }\n }\n}\n/**\n * Initialize navigator for stock charts\n * @private\n */\nfunction onChartBeforeRender() {\n const options = this.options;\n if (options.navigator.enabled ||\n options.scrollbar.enabled) {\n this.scroller = this.navigator = new NavigatorConstructor(this);\n }\n}\n/**\n * For Stock charts. For x only zooming, do not to create the zoom button\n * because X axis zooming is already allowed by the Navigator and Range\n * selector. (#9285)\n * @private\n */\nfunction onChartBeforeShowResetZoom() {\n const chartOptions = this.options, navigator = chartOptions.navigator, rangeSelector = chartOptions.rangeSelector;\n if (((navigator && navigator.enabled) ||\n (rangeSelector && rangeSelector.enabled)) &&\n ((!isTouchDevice &&\n this.zooming.type === 'x') ||\n (isTouchDevice && this.zooming.pinchType === 'x'))) {\n return false;\n }\n}\n/**\n * @private\n */\nfunction onChartCallback(chart) {\n const navigator = chart.navigator;\n // Initialize the navigator\n if (navigator && chart.xAxis[0]) {\n const extremes = chart.xAxis[0].getExtremes();\n navigator.render(extremes.min, extremes.max);\n }\n}\n/**\n * Merge options, if no scrolling exists yet\n * @private\n */\nfunction onChartUpdate(e) {\n const navigatorOptions = (e.options.navigator || {}), scrollbarOptions = (e.options.scrollbar || {});\n if (!this.navigator && !this.scroller &&\n (navigatorOptions.enabled || scrollbarOptions.enabled)) {\n merge(true, this.options.navigator, navigatorOptions);\n merge(true, this.options.scrollbar, scrollbarOptions);\n delete e.options.navigator;\n delete e.options.scrollbar;\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst ChartNavigatorComposition = {\n compose\n};\nexport default ChartNavigatorComposition;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Globals.js';\nconst { isTouchDevice } = H;\nimport U from '../Utilities.js';\nconst { addEvent, correctFloat, defined, isNumber, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction onAxisInit() {\n const axis = this;\n if (!axis.navigatorAxis) {\n axis.navigatorAxis = new NavigatorAxisAdditions(axis);\n }\n}\n/**\n * For Stock charts, override selection zooming with some special features\n * because X axis zooming is already allowed by the Navigator and Range\n * selector.\n * @private\n */\nfunction onAxisSetExtremes(e) {\n const axis = this, chart = axis.chart, chartOptions = chart.options, navigator = chartOptions.navigator, navigatorAxis = axis.navigatorAxis, pinchType = chart.zooming.pinchType, rangeSelector = chartOptions.rangeSelector, zoomType = chart.zooming.type;\n let zoomed;\n if (axis.isXAxis &&\n (navigator?.enabled || rangeSelector?.enabled)) {\n // For y only zooming, ignore the X axis completely\n if (zoomType === 'y' && e.trigger === 'zoom') {\n zoomed = false;\n // For xy zooming, record the state of the zoom before zoom selection,\n // then when the reset button is pressed, revert to this state. This\n // should apply only if the chart is initialized with a range (#6612),\n // otherwise zoom all the way out.\n }\n else if (((e.trigger === 'zoom' && zoomType === 'xy') ||\n (isTouchDevice && pinchType === 'xy')) &&\n axis.options.range) {\n const previousZoom = navigatorAxis.previousZoom;\n // Minimum defined, zooming in\n if (defined(e.min)) {\n navigatorAxis.previousZoom = [axis.min, axis.max];\n // Minimum undefined, resetting zoom\n }\n else if (previousZoom) {\n e.min = previousZoom[0];\n e.max = previousZoom[1];\n navigatorAxis.previousZoom = void 0;\n }\n }\n }\n if (typeof zoomed !== 'undefined') {\n e.preventDefault();\n }\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * @private\n * @class\n */\nclass NavigatorAxisAdditions {\n /* *\n *\n * Static Functions\n *\n * */\n /**\n * @private\n */\n static compose(AxisClass) {\n if (!AxisClass.keepProps.includes('navigatorAxis')) {\n AxisClass.keepProps.push('navigatorAxis');\n addEvent(AxisClass, 'init', onAxisInit);\n addEvent(AxisClass, 'setExtremes', onAxisSetExtremes);\n }\n }\n /* *\n *\n * Constructors\n *\n * */\n constructor(axis) {\n this.axis = axis;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n destroy() {\n this.axis = void 0;\n }\n /**\n * Add logic to normalize the zoomed range in order to preserve the pressed\n * state of range selector buttons\n *\n * @private\n * @function Highcharts.Axis#toFixedRange\n */\n toFixedRange(pxMin, pxMax, fixedMin, fixedMax) {\n const axis = this.axis, chart = axis.chart, overscroll = pick(axis.ordinal?.convertOverscroll(axis.options.overscroll), 0);\n let newMin = pick(fixedMin, axis.translate(pxMin, true, !axis.horiz)), newMax = pick(fixedMax, axis.translate(pxMax, true, !axis.horiz));\n const fixedRange = chart && chart.fixedRange, halfPointRange = (axis.pointRange || 0) / 2;\n // Add/remove half point range to/from the extremes (#1172)\n if (!defined(fixedMin)) {\n newMin = correctFloat(newMin + halfPointRange);\n }\n if (!defined(fixedMax)) {\n newMax = correctFloat(newMax - halfPointRange);\n }\n // Make sure panning to the edges does not decrease the zoomed range\n if (fixedRange && axis.dataMin && axis.dataMax) {\n const maxWithOverscroll = axis.dataMax + overscroll;\n if (newMax >= maxWithOverscroll) {\n newMin = correctFloat(maxWithOverscroll - fixedRange);\n newMax = correctFloat(maxWithOverscroll);\n }\n if (newMin <= axis.dataMin) {\n newMax = correctFloat(axis.dataMin + fixedRange);\n }\n }\n if (!isNumber(newMin) || !isNumber(newMax)) { // #1195, #7411\n newMin = newMax = void 0;\n }\n return {\n min: newMin,\n max: newMax\n };\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default NavigatorAxisAdditions;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Color from '../../Core/Color/Color.js';\nconst { parse: color } = Color;\nimport SeriesRegistry from '../../Core/Series/SeriesRegistry.js';\nconst { seriesTypes } = SeriesRegistry;\n/* *\n *\n * Constants\n *\n * */\n/**\n * The navigator is a small series below the main series, displaying\n * a view of the entire data set. It provides tools to zoom in and\n * out on parts of the data as well as panning across the dataset.\n *\n * @product highstock gantt\n * @optionparent navigator\n */\nconst NavigatorDefaults = {\n /**\n * Whether the navigator and scrollbar should adapt to updated data\n * in the base X axis. When loading data async, as in the demo below,\n * this should be `false`. Otherwise new data will trigger navigator\n * redraw, which will cause unwanted looping. In the demo below, the\n * data in the navigator is set only once. On navigating, only the main\n * chart content is updated.\n *\n * @sample {highstock} stock/demo/lazy-loading/\n * Set to false with async data loading\n *\n * @type {boolean}\n * @default true\n * @apioption navigator.adaptToUpdatedData\n */\n /**\n * An integer identifying the index to use for the base series, or a\n * string representing the id of the series.\n *\n * **Note**: As of Highcharts 5.0, this is now a deprecated option.\n * Prefer [series.showInNavigator](#plotOptions.series.showInNavigator).\n *\n * @see [series.showInNavigator](#plotOptions.series.showInNavigator)\n *\n * @deprecated\n * @type {number|string}\n * @default 0\n * @apioption navigator.baseSeries\n */\n /**\n * Enable or disable the navigator.\n *\n * @sample {highstock} stock/navigator/enabled/\n * Disable the navigator\n *\n * @type {boolean}\n * @default true\n * @apioption navigator.enabled\n */\n /**\n * When the chart is inverted, whether to draw the navigator on the\n * opposite side.\n *\n * @type {boolean}\n * @default false\n * @since 5.0.8\n * @apioption navigator.opposite\n */\n /**\n * The height of the navigator.\n *\n * @sample {highstock} stock/navigator/height/\n * A higher navigator\n */\n height: 40,\n /**\n * The distance from the nearest element, the X axis or X axis labels.\n *\n * @sample {highstock} stock/navigator/margin/\n * A margin of 2 draws the navigator closer to the X axis labels\n */\n margin: 25,\n /**\n * Whether the mask should be inside the range marking the zoomed\n * range, or outside. In Highcharts Stock 1.x it was always `false`.\n *\n * @sample {highstock} stock/demo/maskinside-false/\n * False, mask outside\n *\n * @since 2.0\n */\n maskInside: true,\n /**\n * Options for the handles for dragging the zoomed area.\n *\n * @sample {highstock} stock/navigator/handles/\n * Colored handles\n */\n handles: {\n /**\n * Width for handles.\n *\n * @sample {highstock} stock/navigator/styled-handles/\n * Styled handles\n *\n * @since 6.0.0\n */\n width: 7,\n /**\n * Height for handles.\n *\n * @sample {highstock} stock/navigator/styled-handles/\n * Styled handles\n *\n * @since 6.0.0\n */\n height: 15,\n /**\n * Array to define shapes of handles. 0-index for left, 1-index for\n * right.\n *\n * Additionally, the URL to a graphic can be given on this form:\n * `url(graphic.png)`. Note that for the image to be applied to\n * exported charts, its URL needs to be accessible by the export\n * server.\n *\n * Custom callbacks for symbol path generation can also be added to\n * `Highcharts.SVGRenderer.prototype.symbols`. The callback is then\n * used by its method name, as shown in the demo.\n *\n * @sample {highstock} stock/navigator/styled-handles/\n * Styled handles\n *\n * @type {Array}\n * @default [\"navigator-handle\", \"navigator-handle\"]\n * @since 6.0.0\n */\n symbols: ['navigator-handle', 'navigator-handle'],\n /**\n * Allows to enable/disable handles.\n *\n * @since 6.0.0\n */\n enabled: true,\n /**\n * The width for the handle border and the stripes inside.\n *\n * @sample {highstock} stock/navigator/styled-handles/\n * Styled handles\n *\n * @since 6.0.0\n * @apioption navigator.handles.lineWidth\n */\n lineWidth: 1,\n /**\n * The fill for the handle.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n backgroundColor: \"#f2f2f2\" /* Palette.neutralColor5 */,\n /**\n * The stroke for the handle border and the stripes inside.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n borderColor: \"#999999\" /* Palette.neutralColor40 */\n },\n /**\n * The color of the mask covering the areas of the navigator series\n * that are currently not visible in the main series. The default\n * color is bluish with an opacity of 0.3 to see the series below.\n *\n * @see In styled mode, the mask is styled with the\n * `.highcharts-navigator-mask` and\n * `.highcharts-navigator-mask-inside` classes.\n *\n * @sample {highstock} stock/navigator/maskfill/\n * Blue, semi transparent mask\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default rgba(102,133,194,0.3)\n */\n maskFill: color(\"#667aff\" /* Palette.highlightColor60 */).setOpacity(0.3).get(),\n /**\n * The color of the line marking the currently zoomed area in the\n * navigator.\n *\n * @sample {highstock} stock/navigator/outline/\n * 2px blue outline\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @default #cccccc\n */\n outlineColor: \"#999999\" /* Palette.neutralColor40 */,\n /**\n * The width of the line marking the currently zoomed area in the\n * navigator.\n *\n * @see In styled mode, the outline stroke width is set with the\n * `.highcharts-navigator-outline` class.\n *\n * @sample {highstock} stock/navigator/outline/\n * 2px blue outline\n *\n * @type {number}\n */\n outlineWidth: 1,\n /**\n * Options for the navigator series. Available options are the same\n * as any series, documented at [plotOptions](#plotOptions.series)\n * and [series](#series).\n *\n * Unless data is explicitly defined on navigator.series, the data\n * is borrowed from the first series in the chart.\n *\n * Default series options for the navigator series are:\n * ```js\n * series: {\n * type: 'areaspline',\n * fillOpacity: 0.05,\n * dataGrouping: {\n * smoothed: true\n * },\n * lineWidth: 1,\n * marker: {\n * enabled: false\n * }\n * }\n * ```\n *\n * @see In styled mode, the navigator series is styled with the\n * `.highcharts-navigator-series` class.\n *\n * @sample {highstock} stock/navigator/series-data/\n * Using a separate data set for the navigator\n * @sample {highstock} stock/navigator/series/\n * A green navigator series\n *\n * @type {*|Array<*>|Highcharts.SeriesOptionsType|Array}\n */\n series: {\n /**\n * The type of the navigator series.\n *\n * Heads up:\n * In column-type navigator, zooming is limited to at least one\n * point with its `pointRange`.\n *\n * @sample {highstock} stock/navigator/column/\n * Column type navigator\n *\n * @type {string}\n * @default {highstock} `areaspline` if defined, otherwise `line`\n * @default {gantt} gantt\n */\n type: (typeof seriesTypes.areaspline === 'undefined' ?\n 'line' :\n 'areaspline'),\n /**\n * The fill opacity of the navigator series.\n */\n fillOpacity: 0.05,\n /**\n * The pixel line width of the navigator series.\n */\n lineWidth: 1,\n /**\n * @ignore-option\n */\n compare: null,\n /**\n * @ignore-option\n */\n sonification: {\n enabled: false\n },\n /**\n * Unless data is explicitly defined, the data is borrowed from the\n * first series in the chart.\n *\n * @type {Array|object|null>}\n * @product highstock\n * @apioption navigator.series.data\n */\n /**\n * Data grouping options for the navigator series.\n *\n * @extends plotOptions.series.dataGrouping\n */\n dataGrouping: {\n approximation: 'average',\n enabled: true,\n groupPixelWidth: 2,\n // Replace smoothed property by anchors, #12455.\n firstAnchor: 'firstPoint',\n anchor: 'middle',\n lastAnchor: 'lastPoint',\n // Day and week differs from plotOptions.series.dataGrouping\n units: [\n ['millisecond', [1, 2, 5, 10, 20, 25, 50, 100, 200, 500]],\n ['second', [1, 2, 5, 10, 15, 30]],\n ['minute', [1, 2, 5, 10, 15, 30]],\n ['hour', [1, 2, 3, 4, 6, 8, 12]],\n ['day', [1, 2, 3, 4]],\n ['week', [1, 2, 3]],\n ['month', [1, 3, 6]],\n ['year', null]\n ]\n },\n /**\n * Data label options for the navigator series. Data labels are\n * disabled by default on the navigator series.\n *\n * @extends plotOptions.series.dataLabels\n */\n dataLabels: {\n enabled: false,\n zIndex: 2 // #1839\n },\n id: 'highcharts-navigator-series',\n className: 'highcharts-navigator-series',\n /**\n * Sets the fill color of the navigator series.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n * @apioption navigator.series.color\n */\n /**\n * Line color for the navigator series. Allows setting the color\n * while disallowing the default candlestick setting.\n *\n * @type {Highcharts.ColorString|null}\n */\n lineColor: null,\n marker: {\n enabled: false\n },\n /**\n * Since Highcharts Stock v8, default value is the same as default\n * `pointRange` defined for a specific type (e.g. `null` for\n * column type).\n *\n * In Highcharts Stock version < 8, defaults to 0.\n *\n * @extends plotOptions.series.pointRange\n * @type {number|null}\n * @apioption navigator.series.pointRange\n */\n /**\n * The threshold option. Setting it to 0 will make the default\n * navigator area series draw its area from the 0 value and up.\n *\n * @type {number|null}\n */\n threshold: null\n },\n /**\n * Enable or disable navigator sticking to right, while adding new\n * points. If `undefined`, the navigator sticks to the axis maximum only\n * if it was already at the maximum prior to adding points.\n *\n * @type {boolean}\n * @default undefined\n * @since 10.2.1\n * @sample {highstock} stock/navigator/sticktomax-false/\n * stickToMax set to false\n * @apioption navigator.stickToMax\n */\n /**\n * Options for the navigator X axis. Default series options for the\n * navigator xAxis are:\n * ```js\n * xAxis: {\n * tickWidth: 0,\n * lineWidth: 0,\n * gridLineWidth: 1,\n * tickPixelInterval: 200,\n * labels: {\n * align: 'left',\n * style: {\n * color: '#888'\n * },\n * x: 3,\n * y: -4\n * }\n * }\n * ```\n *\n * @extends xAxis\n * @excluding linkedTo, maxZoom, minRange, opposite, range, scrollbar,\n * showEmpty, maxRange\n */\n xAxis: {\n /**\n * Additional range on the right side of the xAxis. Works similar to\n * `xAxis.maxPadding`, but the value is set in terms of axis values,\n * percentage or pixels.\n *\n * If it's a number, it is interpreted as axis values, which in a\n * datetime axis equals milliseconds.\n *\n * If it's a percentage string, is interpreted as percentages of the\n * axis length. An overscroll of 50% will make a 100px axis 50px longer.\n *\n * If it's a pixel string, it is interpreted as a fixed pixel value, but\n * limited to 90% of the axis length.\n *\n * If it's undefined, the value is inherited from `xAxis.overscroll`.\n *\n * Can be set for both, main xAxis and navigator's xAxis.\n *\n * @type {number | string | undefined}\n * @since 6.0.0\n * @apioption navigator.xAxis.overscroll\n */\n className: 'highcharts-navigator-xaxis',\n tickLength: 0,\n lineWidth: 0,\n gridLineColor: \"#e6e6e6\" /* Palette.neutralColor10 */,\n gridLineWidth: 1,\n tickPixelInterval: 200,\n labels: {\n align: 'left',\n /**\n * @type {Highcharts.CSSObject}\n */\n style: {\n /** @ignore */\n color: \"#000000\" /* Palette.neutralColor100 */,\n /** @ignore */\n fontSize: '0.7em',\n /** @ignore */\n opacity: 0.6,\n /** @ignore */\n textOutline: '2px contrast'\n },\n x: 3,\n y: -4\n },\n crosshair: false\n },\n /**\n * Options for the navigator Y axis. Default series options for the\n * navigator yAxis are:\n * ```js\n * yAxis: {\n * gridLineWidth: 0,\n * startOnTick: false,\n * endOnTick: false,\n * minPadding: 0.1,\n * maxPadding: 0.1,\n * labels: {\n * enabled: false\n * },\n * title: {\n * text: null\n * },\n * tickWidth: 0\n * }\n * ```\n *\n * @extends yAxis\n * @excluding height, linkedTo, maxZoom, minRange, ordinal, range,\n * showEmpty, scrollbar, top, units, maxRange, minLength,\n * maxLength, resize\n */\n yAxis: {\n className: 'highcharts-navigator-yaxis',\n gridLineWidth: 0,\n startOnTick: false,\n endOnTick: false,\n minPadding: 0.1,\n maxPadding: 0.1,\n labels: {\n enabled: false\n },\n crosshair: false,\n title: {\n text: null\n },\n tickLength: 0,\n tickWidth: 0\n }\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default NavigatorDefaults;\n/* *\n *\n * API Options\n *\n * */\n/**\n * Maximum range which can be set using the navigator's handles.\n * Opposite of [xAxis.minRange](#xAxis.minRange).\n *\n * @sample {highstock} stock/navigator/maxrange/\n * Defined max and min range\n *\n * @type {number}\n * @since 6.0.0\n * @product highstock gantt\n * @apioption xAxis.maxRange\n */\n(''); // keeps doclets above in JS file\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Constants\n *\n * */\n/**\n * Draw one of the handles on the side of the zoomed range in the navigator.\n * @private\n */\nfunction navigatorHandle(_x, _y, width, height, options = {}) {\n const halfWidth = options.width ? options.width / 2 : width, markerPosition = Math.round(halfWidth / 3) + 0.5;\n height = options.height || height;\n return [\n ['M', -halfWidth - 1, 0.5],\n ['L', halfWidth, 0.5],\n ['L', halfWidth, height + 0.5],\n ['L', -halfWidth - 1, height + 0.5],\n ['L', -halfWidth - 1, 0.5],\n ['M', -markerPosition, 4],\n ['L', -markerPosition, height - 3],\n ['M', markerPosition - 1, 4],\n ['L', markerPosition - 1, height - 3]\n ];\n}\n/* *\n *\n * Default Export\n *\n * */\nconst NavigatorSymbols = {\n 'navigator-handle': navigatorHandle\n};\nexport default NavigatorSymbols;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport U from '../../Core/Utilities.js';\nconst { defined } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Sets the chart.fixedRange to the specified value. If the value is larger\n * than actual range, sets it to the maximum possible range. (#20327)\n *\n * @private\n * @function Highcharts.StockChart#setFixedRange\n * @param {number|undefined} range\n * Range to set in axis units.\n */\nfunction setFixedRange(range) {\n const xAxis = this.xAxis[0];\n if (defined(xAxis.dataMax) &&\n defined(xAxis.dataMin) &&\n range) {\n this.fixedRange = Math.min(range, xAxis.dataMax - xAxis.dataMin);\n }\n else {\n this.fixedRange = range;\n }\n}\nconst StockUtilities = {\n setFixedRange\n};\nexport default StockUtilities;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport D from '../../Core/Defaults.js';\nconst { setOptions } = D;\nimport H from '../../Core/Globals.js';\nconst { composed } = H;\nimport NavigatorAxisAdditions from '../../Core/Axis/NavigatorAxisComposition.js';\nimport NavigatorDefaults from './NavigatorDefaults.js';\nimport NavigatorSymbols from './NavigatorSymbols.js';\nimport RendererRegistry from '../../Core/Renderer/RendererRegistry.js';\nconst { getRendererType } = RendererRegistry;\nimport StockUtilities from '../../Stock/Utilities/StockUtilities.js';\nconst { setFixedRange } = StockUtilities;\nimport U from '../../Core/Utilities.js';\nconst { addEvent, extend, pushUnique } = U;\n/* *\n *\n * Variables\n *\n * */\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction compose(ChartClass, AxisClass, SeriesClass) {\n NavigatorAxisAdditions.compose(AxisClass);\n if (pushUnique(composed, 'Navigator')) {\n ChartClass.prototype.setFixedRange = setFixedRange;\n extend(getRendererType().prototype.symbols, NavigatorSymbols);\n addEvent(SeriesClass, 'afterUpdate', onSeriesAfterUpdate);\n setOptions({ navigator: NavigatorDefaults });\n }\n}\n/**\n * Handle updating series\n * @private\n */\nfunction onSeriesAfterUpdate() {\n if (this.chart.navigator && !this.options.isInternal) {\n this.chart.navigator.setBaseSeries(null, false);\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst NavigatorComposition = {\n compose\n};\nexport default NavigatorComposition;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Globals.js';\nconst { composed } = H;\nimport U from '../Utilities.js';\nconst { addEvent, defined, pick, pushUnique } = U;\n/* *\n *\n * Composition\n *\n * */\nvar ScrollbarAxis;\n(function (ScrollbarAxis) {\n /* *\n *\n * Variables\n *\n * */\n let Scrollbar;\n /* *\n *\n * Functions\n *\n * */\n /**\n * Attaches to axis events to create scrollbars if enabled.\n *\n * @private\n *\n * @param {Highcharts.Axis} AxisClass\n * Axis class to extend.\n *\n * @param {Highcharts.Scrollbar} ScrollbarClass\n * Scrollbar class to use.\n */\n function compose(AxisClass, ScrollbarClass) {\n if (pushUnique(composed, 'Axis.Scrollbar')) {\n Scrollbar = ScrollbarClass;\n addEvent(AxisClass, 'afterGetOffset', onAxisAfterGetOffset);\n addEvent(AxisClass, 'afterInit', onAxisAfterInit);\n addEvent(AxisClass, 'afterRender', onAxisAfterRender);\n }\n }\n ScrollbarAxis.compose = compose;\n /** @private */\n function getExtremes(axis) {\n const axisMin = pick(axis.options && axis.options.min, axis.min);\n const axisMax = pick(axis.options && axis.options.max, axis.max);\n return {\n axisMin,\n axisMax,\n scrollMin: defined(axis.dataMin) ?\n Math.min(axisMin, axis.min, axis.dataMin, pick(axis.threshold, Infinity)) : axisMin,\n scrollMax: defined(axis.dataMax) ?\n Math.max(axisMax, axis.max, axis.dataMax, pick(axis.threshold, -Infinity)) : axisMax\n };\n }\n /**\n * Make space for a scrollbar.\n * @private\n */\n function onAxisAfterGetOffset() {\n const axis = this, scrollbar = axis.scrollbar, opposite = scrollbar && !scrollbar.options.opposite, index = axis.horiz ? 2 : opposite ? 3 : 1;\n if (scrollbar) {\n // Reset scrollbars offsets\n axis.chart.scrollbarsOffsets = [0, 0];\n axis.chart.axisOffset[index] +=\n scrollbar.size + (scrollbar.options.margin || 0);\n }\n }\n /**\n * Wrap axis initialization and create scrollbar if enabled.\n * @private\n */\n function onAxisAfterInit() {\n const axis = this;\n if (axis.options &&\n axis.options.scrollbar &&\n axis.options.scrollbar.enabled) {\n // Predefined options:\n axis.options.scrollbar.vertical = !axis.horiz;\n axis.options.startOnTick = axis.options.endOnTick = false;\n axis.scrollbar = new Scrollbar(axis.chart.renderer, axis.options.scrollbar, axis.chart);\n addEvent(axis.scrollbar, 'changed', function (e) {\n const { axisMin, axisMax, scrollMin: unitedMin, scrollMax: unitedMax } = getExtremes(axis), range = unitedMax - unitedMin;\n let to, from;\n // #12834, scroll when show/hide series, wrong extremes\n if (!defined(axisMin) || !defined(axisMax)) {\n return;\n }\n if ((axis.horiz && !axis.reversed) ||\n (!axis.horiz && axis.reversed)) {\n to = unitedMin + range * this.to;\n from = unitedMin + range * this.from;\n }\n else {\n // Y-values in browser are reversed, but this also\n // applies for reversed horizontal axis:\n to = unitedMin + range * (1 - this.from);\n from = unitedMin + range * (1 - this.to);\n }\n if (this.shouldUpdateExtremes(e.DOMType)) {\n // #17977, set animation to undefined instead of true\n const animate = e.DOMType === 'mousemove' ||\n e.DOMType === 'touchmove' ? false : void 0;\n axis.setExtremes(from, to, true, animate, e);\n }\n else {\n // When live redraw is disabled, don't change extremes\n // Only change the position of the scrollbar thumb\n this.setRange(this.from, this.to);\n }\n });\n }\n }\n /**\n * Wrap rendering axis, and update scrollbar if one is created.\n * @private\n */\n function onAxisAfterRender() {\n const axis = this, { scrollMin, scrollMax } = getExtremes(axis), scrollbar = axis.scrollbar, offset = (axis.axisTitleMargin + (axis.titleOffset || 0)), scrollbarsOffsets = axis.chart.scrollbarsOffsets, axisMargin = axis.options.margin || 0;\n let offsetsIndex, from, to;\n if (scrollbar && scrollbarsOffsets) {\n if (axis.horiz) {\n // Reserve space for labels/title\n if (!axis.opposite) {\n scrollbarsOffsets[1] += offset;\n }\n scrollbar.position(axis.left, (axis.top +\n axis.height +\n 2 +\n scrollbarsOffsets[1] -\n (axis.opposite ? axisMargin : 0)), axis.width, axis.height);\n // Next scrollbar should reserve space for margin (if set)\n if (!axis.opposite) {\n scrollbarsOffsets[1] += axisMargin;\n }\n offsetsIndex = 1;\n }\n else {\n // Reserve space for labels/title\n if (axis.opposite) {\n scrollbarsOffsets[0] += offset;\n }\n let xPosition;\n if (!scrollbar.options.opposite) {\n xPosition = axis.opposite ? 0 : axisMargin;\n }\n else {\n xPosition = axis.left +\n axis.width +\n 2 +\n scrollbarsOffsets[0] -\n (axis.opposite ? 0 : axisMargin);\n }\n scrollbar.position(xPosition, axis.top, axis.width, axis.height);\n // Next scrollbar should reserve space for margin (if set)\n if (axis.opposite) {\n scrollbarsOffsets[0] += axisMargin;\n }\n offsetsIndex = 0;\n }\n scrollbarsOffsets[offsetsIndex] += scrollbar.size +\n (scrollbar.options.margin || 0);\n if (isNaN(scrollMin) ||\n isNaN(scrollMax) ||\n !defined(axis.min) ||\n !defined(axis.max) ||\n axis.min === axis.max // #10733\n ) {\n // Default action: when extremes are the same or there is\n // not extremes on the axis, but scrollbar exists, make it\n // full size\n scrollbar.setRange(0, 1);\n }\n else {\n from = ((axis.min - scrollMin) /\n (scrollMax - scrollMin));\n to = ((axis.max - scrollMin) /\n (scrollMax - scrollMin));\n if ((axis.horiz && !axis.reversed) ||\n (!axis.horiz && axis.reversed)) {\n scrollbar.setRange(from, to);\n }\n else {\n // Inverse vertical axis\n scrollbar.setRange(1 - to, 1 - from);\n }\n }\n }\n }\n})(ScrollbarAxis || (ScrollbarAxis = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default ScrollbarAxis;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Constant\n *\n * */\n/**\n *\n * The scrollbar is a means of panning over the X axis of a stock chart.\n * Scrollbars can also be applied to other types of axes.\n *\n * Another approach to scrollable charts is the [chart.scrollablePlotArea](\n * https://api.highcharts.com/highcharts/chart.scrollablePlotArea) option that\n * is especially suitable for simpler cartesian charts on mobile.\n *\n * In styled mode, all the presentational options for the\n * scrollbar are replaced by the classes `.highcharts-scrollbar-thumb`,\n * `.highcharts-scrollbar-arrow`, `.highcharts-scrollbar-button`,\n * `.highcharts-scrollbar-rifles` and `.highcharts-scrollbar-track`.\n *\n * @sample stock/yaxis/inverted-bar-scrollbar/\n * A scrollbar on a simple bar chart\n *\n * @product highstock gantt\n * @optionparent scrollbar\n *\n * @private\n */\nconst ScrollbarDefaults = {\n /**\n * The height of the scrollbar. If `buttonsEnabled` is true , the height\n * also applies to the width of the scroll arrows so that they are always\n * squares.\n *\n * @sample stock/scrollbar/style/\n * Non-default height\n *\n * @type {number}\n */\n height: 10,\n /**\n * The border rounding radius of the bar.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n */\n barBorderRadius: 5,\n /**\n * The corner radius of the scrollbar buttons.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n */\n buttonBorderRadius: 0,\n /**\n * Enable or disable the buttons at the end of the scrollbar.\n *\n * @since 11.0.0\n */\n buttonsEnabled: false,\n /**\n * Enable or disable the scrollbar.\n *\n * @sample stock/scrollbar/enabled/\n * Disable the scrollbar, only use navigator\n *\n * @type {boolean}\n * @default true\n * @apioption scrollbar.enabled\n */\n /**\n * Whether to redraw the main chart as the scrollbar or the navigator\n * zoomed window is moved. Defaults to `true` for modern browsers and\n * `false` for legacy IE browsers as well as mobile devices.\n *\n * @sample stock/scrollbar/liveredraw\n * Setting live redraw to false\n *\n * @type {boolean}\n * @since 1.3\n */\n liveRedraw: void 0,\n /**\n * The margin between the scrollbar and its axis when the scrollbar is\n * applied directly to an axis, or the navigator in case that is enabled.\n * Defaults to 10 for axis, 0 for navigator.\n *\n * @type {number|undefined}\n */\n margin: void 0,\n /**\n * The minimum width of the scrollbar.\n *\n * @since 1.2.5\n */\n minWidth: 6,\n /** @ignore-option */\n opposite: true,\n /**\n * Whether to show or hide the scrollbar when the scrolled content is\n * zoomed out to it full extent.\n *\n * @type {boolean}\n * @default true\n * @apioption scrollbar.showFull\n */\n step: 0.2,\n /**\n * The z index of the scrollbar group.\n */\n zIndex: 3,\n /**\n * The background color of the scrollbar itself.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n barBackgroundColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The width of the bar's border.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n */\n barBorderWidth: 0,\n /**\n * The color of the scrollbar's border.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n barBorderColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The color of the small arrow inside the scrollbar buttons.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n buttonArrowColor: \"#333333\" /* Palette.neutralColor80 */,\n /**\n * The color of scrollbar buttons.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n buttonBackgroundColor: \"#e6e6e6\" /* Palette.neutralColor10 */,\n /**\n * The color of the border of the scrollbar buttons.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n buttonBorderColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The border width of the scrollbar buttons.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n */\n buttonBorderWidth: 1,\n /**\n * The color of the small rifles in the middle of the scrollbar.\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n rifleColor: 'none',\n /**\n * The color of the track background.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n trackBackgroundColor: 'rgba(255, 255, 255, 0.001)',\n /**\n * The color of the border of the scrollbar track.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n *\n * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}\n */\n trackBorderColor: \"#cccccc\" /* Palette.neutralColor20 */,\n /**\n * The corner radius of the border of the scrollbar track.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n */\n trackBorderRadius: 5,\n /**\n * The width of the border of the scrollbar track.\n *\n * @sample stock/scrollbar/style/\n * Scrollbar styling\n */\n trackBorderWidth: 1\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default ScrollbarDefaults;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport D from '../../Core/Defaults.js';\nconst { defaultOptions } = D;\nimport H from '../../Core/Globals.js';\nimport ScrollbarAxis from '../../Core/Axis/ScrollbarAxis.js';\nimport ScrollbarDefaults from './ScrollbarDefaults.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, correctFloat, defined, destroyObjectProperties, fireEvent, merge, pick, removeEvent } = U;\n/* *\n *\n * Constants\n *\n * */\n/* eslint-disable no-invalid-this, valid-jsdoc */\n/**\n * A reusable scrollbar, internally used in Highcharts Stock's\n * navigator and optionally on individual axes.\n *\n * @private\n * @class\n * @name Highcharts.Scrollbar\n * @param {Highcharts.SVGRenderer} renderer\n * @param {Highcharts.ScrollbarOptions} options\n * @param {Highcharts.Chart} chart\n */\nclass Scrollbar {\n /* *\n *\n * Static Functions\n *\n * */\n static compose(AxisClass) {\n ScrollbarAxis.compose(AxisClass, Scrollbar);\n }\n /**\n * When we have vertical scrollbar, rifles and arrow in buttons should be\n * rotated. The same method is used in Navigator's handles, to rotate them.\n *\n * @function Highcharts.swapXY\n *\n * @param {Highcharts.SVGPathArray} path\n * Path to be rotated.\n *\n * @param {boolean} [vertical]\n * If vertical scrollbar, swap x-y values.\n *\n * @return {Highcharts.SVGPathArray}\n * Rotated path.\n *\n * @requires modules/stock\n */\n static swapXY(path, vertical) {\n if (vertical) {\n path.forEach((seg) => {\n const len = seg.length;\n let temp;\n for (let i = 0; i < len; i += 2) {\n temp = seg[i + 1];\n if (typeof temp === 'number') {\n seg[i + 1] = seg[i + 2];\n seg[i + 2] = temp;\n }\n }\n });\n }\n return path;\n }\n /* *\n *\n * Constructors\n *\n * */\n constructor(renderer, options, chart) {\n /* *\n *\n * Properties\n *\n * */\n this._events = [];\n this.chartX = 0;\n this.chartY = 0;\n this.from = 0;\n this.scrollbarButtons = [];\n this.scrollbarLeft = 0;\n this.scrollbarStrokeWidth = 1;\n this.scrollbarTop = 0;\n this.size = 0;\n this.to = 0;\n this.trackBorderWidth = 1;\n this.x = 0;\n this.y = 0;\n this.init(renderer, options, chart);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Set up the mouse and touch events for the Scrollbar\n *\n * @private\n * @function Highcharts.Scrollbar#addEvents\n */\n addEvents() {\n const buttonsOrder = this.options.inverted ? [1, 0] : [0, 1], buttons = this.scrollbarButtons, bar = this.scrollbarGroup.element, track = this.track.element, mouseDownHandler = this.mouseDownHandler.bind(this), mouseMoveHandler = this.mouseMoveHandler.bind(this), mouseUpHandler = this.mouseUpHandler.bind(this);\n const _events = [\n // Mouse events\n [\n buttons[buttonsOrder[0]].element,\n 'click',\n this.buttonToMinClick.bind(this)\n ],\n [\n buttons[buttonsOrder[1]].element,\n 'click',\n this.buttonToMaxClick.bind(this)\n ],\n [track, 'click', this.trackClick.bind(this)],\n [bar, 'mousedown', mouseDownHandler],\n [bar.ownerDocument, 'mousemove', mouseMoveHandler],\n [bar.ownerDocument, 'mouseup', mouseUpHandler],\n // Touch events\n [bar, 'touchstart', mouseDownHandler],\n [bar.ownerDocument, 'touchmove', mouseMoveHandler],\n [bar.ownerDocument, 'touchend', mouseUpHandler]\n ];\n // Add them all\n _events.forEach(function (args) {\n addEvent.apply(null, args);\n });\n this._events = _events;\n }\n buttonToMaxClick(e) {\n const scroller = this;\n const range = ((scroller.to - scroller.from) *\n pick(scroller.options.step, 0.2));\n scroller.updatePosition(scroller.from + range, scroller.to + range);\n fireEvent(scroller, 'changed', {\n from: scroller.from,\n to: scroller.to,\n trigger: 'scrollbar',\n DOMEvent: e\n });\n }\n buttonToMinClick(e) {\n const scroller = this;\n const range = correctFloat(scroller.to - scroller.from) *\n pick(scroller.options.step, 0.2);\n scroller.updatePosition(correctFloat(scroller.from - range), correctFloat(scroller.to - range));\n fireEvent(scroller, 'changed', {\n from: scroller.from,\n to: scroller.to,\n trigger: 'scrollbar',\n DOMEvent: e\n });\n }\n /**\n * Get normalized (0-1) cursor position over the scrollbar\n *\n * @private\n * @function Highcharts.Scrollbar#cursorToScrollbarPosition\n *\n * @param {*} normalizedEvent\n * normalized event, with chartX and chartY values\n *\n * @return {Highcharts.Dictionary}\n * Local position {chartX, chartY}\n */\n cursorToScrollbarPosition(normalizedEvent) {\n const scroller = this, options = scroller.options, minWidthDifference = options.minWidth > scroller.calculatedWidth ?\n options.minWidth :\n 0; // minWidth distorts translation\n return {\n chartX: (normalizedEvent.chartX - scroller.x -\n scroller.xOffset) /\n (scroller.barWidth - minWidthDifference),\n chartY: (normalizedEvent.chartY - scroller.y -\n scroller.yOffset) /\n (scroller.barWidth - minWidthDifference)\n };\n }\n /**\n * Destroys allocated elements.\n *\n * @private\n * @function Highcharts.Scrollbar#destroy\n */\n destroy() {\n const scroller = this, navigator = scroller.chart.scroller;\n // Disconnect events added in addEvents\n scroller.removeEvents();\n // Destroy properties\n [\n 'track',\n 'scrollbarRifles',\n 'scrollbar',\n 'scrollbarGroup',\n 'group'\n ].forEach(function (prop) {\n if (scroller[prop] && scroller[prop].destroy) {\n scroller[prop] = scroller[prop].destroy();\n }\n });\n // #6421, chart may have more scrollbars\n if (navigator && scroller === navigator.scrollbar) {\n navigator.scrollbar = null;\n // Destroy elements in collection\n destroyObjectProperties(navigator.scrollbarButtons);\n }\n }\n /**\n * Draw the scrollbar buttons with arrows\n *\n * @private\n * @function Highcharts.Scrollbar#drawScrollbarButton\n * @param {number} index\n * 0 is left, 1 is right\n */\n drawScrollbarButton(index) {\n const scroller = this, renderer = scroller.renderer, scrollbarButtons = scroller.scrollbarButtons, options = scroller.options, size = scroller.size, group = renderer.g().add(scroller.group);\n scrollbarButtons.push(group);\n if (options.buttonsEnabled) {\n // Create a rectangle for the scrollbar button\n const rect = renderer.rect()\n .addClass('highcharts-scrollbar-button')\n .add(group);\n // Presentational attributes\n if (!scroller.chart.styledMode) {\n rect.attr({\n stroke: options.buttonBorderColor,\n 'stroke-width': options.buttonBorderWidth,\n fill: options.buttonBackgroundColor\n });\n }\n // Place the rectangle based on the rendered stroke width\n rect.attr(rect.crisp({\n x: -0.5,\n y: -0.5,\n // +1 to compensate for crispifying in rect method\n width: size + 1,\n height: size + 1,\n r: options.buttonBorderRadius\n }, rect.strokeWidth()));\n // Button arrow\n const arrow = renderer\n .path(Scrollbar.swapXY([[\n 'M',\n size / 2 + (index ? -1 : 1),\n size / 2 - 3\n ], [\n 'L',\n size / 2 + (index ? -1 : 1),\n size / 2 + 3\n ], [\n 'L',\n size / 2 + (index ? 2 : -2),\n size / 2\n ]], options.vertical))\n .addClass('highcharts-scrollbar-arrow')\n .add(scrollbarButtons[index]);\n if (!scroller.chart.styledMode) {\n arrow.attr({\n fill: options.buttonArrowColor\n });\n }\n }\n }\n /**\n * @private\n * @function Highcharts.Scrollbar#init\n * @param {Highcharts.SVGRenderer} renderer\n * @param {Highcharts.ScrollbarOptions} options\n * @param {Highcharts.Chart} chart\n */\n init(renderer, options, chart) {\n const scroller = this;\n scroller.scrollbarButtons = [];\n scroller.renderer = renderer;\n scroller.userOptions = options;\n scroller.options = merge(ScrollbarDefaults, defaultOptions.scrollbar, options);\n scroller.options.margin = pick(scroller.options.margin, 10);\n scroller.chart = chart;\n // backward compatibility\n scroller.size = pick(scroller.options.size, scroller.options.height);\n // Init\n if (options.enabled) {\n scroller.render();\n scroller.addEvents();\n }\n }\n mouseDownHandler(e) {\n const scroller = this, normalizedEvent = scroller.chart.pointer?.normalize(e) || e, mousePosition = scroller.cursorToScrollbarPosition(normalizedEvent);\n scroller.chartX = mousePosition.chartX;\n scroller.chartY = mousePosition.chartY;\n scroller.initPositions = [scroller.from, scroller.to];\n scroller.grabbedCenter = true;\n }\n /**\n * Event handler for the mouse move event.\n * @private\n */\n mouseMoveHandler(e) {\n const scroller = this, normalizedEvent = scroller.chart.pointer?.normalize(e) || e, options = scroller.options, direction = options.vertical ?\n 'chartY' : 'chartX', initPositions = scroller.initPositions || [];\n let scrollPosition, chartPosition, change;\n // In iOS, a mousemove event with e.pageX === 0 is fired when\n // holding the finger down in the center of the scrollbar. This\n // should be ignored.\n if (scroller.grabbedCenter &&\n // #4696, scrollbar failed on Android\n (!e.touches || e.touches[0][direction] !== 0)) {\n chartPosition = scroller.cursorToScrollbarPosition(normalizedEvent)[direction];\n scrollPosition = scroller[direction];\n change = chartPosition - scrollPosition;\n scroller.hasDragged = true;\n scroller.updatePosition(initPositions[0] + change, initPositions[1] + change);\n if (scroller.hasDragged) {\n fireEvent(scroller, 'changed', {\n from: scroller.from,\n to: scroller.to,\n trigger: 'scrollbar',\n DOMType: e.type,\n DOMEvent: e\n });\n }\n }\n }\n /**\n * Event handler for the mouse up event.\n * @private\n */\n mouseUpHandler(e) {\n const scroller = this;\n if (scroller.hasDragged) {\n fireEvent(scroller, 'changed', {\n from: scroller.from,\n to: scroller.to,\n trigger: 'scrollbar',\n DOMType: e.type,\n DOMEvent: e\n });\n }\n scroller.grabbedCenter =\n scroller.hasDragged =\n scroller.chartX =\n scroller.chartY = null;\n }\n /**\n * Position the scrollbar, method called from a parent with defined\n * dimensions.\n *\n * @private\n * @function Highcharts.Scrollbar#position\n * @param {number} x\n * x-position on the chart\n * @param {number} y\n * y-position on the chart\n * @param {number} width\n * width of the scrollbar\n * @param {number} height\n * height of the scrollbar\n */\n position(x, y, width, height) {\n const scroller = this, options = scroller.options, { buttonsEnabled, margin = 0, vertical } = options, method = scroller.rendered ? 'animate' : 'attr';\n let xOffset = height, yOffset = 0;\n // Make the scrollbar visible when it is repositioned, #15763.\n scroller.group.show();\n scroller.x = x;\n scroller.y = y + this.trackBorderWidth;\n scroller.width = width; // width with buttons\n scroller.height = height;\n scroller.xOffset = xOffset;\n scroller.yOffset = yOffset;\n // If Scrollbar is a vertical type, swap options:\n if (vertical) {\n scroller.width = scroller.yOffset = width = yOffset = scroller.size;\n scroller.xOffset = xOffset = 0;\n scroller.yOffset = yOffset = buttonsEnabled ? scroller.size : 0;\n // width without buttons\n scroller.barWidth = height - (buttonsEnabled ? width * 2 : 0);\n scroller.x = x = x + margin;\n }\n else {\n scroller.height = height = scroller.size;\n scroller.xOffset = xOffset = buttonsEnabled ? scroller.size : 0;\n // width without buttons\n scroller.barWidth = width - (buttonsEnabled ? height * 2 : 0);\n scroller.y = scroller.y + margin;\n }\n // Set general position for a group:\n scroller.group[method]({\n translateX: x,\n translateY: scroller.y\n });\n // Resize background/track:\n scroller.track[method]({\n width: width,\n height: height\n });\n // Move right/bottom button to its place:\n scroller.scrollbarButtons[1][method]({\n translateX: vertical ? 0 : width - xOffset,\n translateY: vertical ? height - yOffset : 0\n });\n }\n /**\n * Removes the event handlers attached previously with addEvents.\n *\n * @private\n * @function Highcharts.Scrollbar#removeEvents\n */\n removeEvents() {\n this._events.forEach(function (args) {\n removeEvent.apply(null, args);\n });\n this._events.length = 0;\n }\n /**\n * Render scrollbar with all required items.\n *\n * @private\n * @function Highcharts.Scrollbar#render\n */\n render() {\n const scroller = this, renderer = scroller.renderer, options = scroller.options, size = scroller.size, styledMode = scroller.chart.styledMode, group = renderer.g('scrollbar')\n .attr({\n zIndex: options.zIndex\n })\n .hide() // initially hide the scrollbar #15863\n .add();\n // Draw the scrollbar group\n scroller.group = group;\n // Draw the scrollbar track:\n scroller.track = renderer.rect()\n .addClass('highcharts-scrollbar-track')\n .attr({\n r: options.trackBorderRadius || 0,\n height: size,\n width: size\n }).add(group);\n if (!styledMode) {\n scroller.track.attr({\n fill: options.trackBackgroundColor,\n stroke: options.trackBorderColor,\n 'stroke-width': options.trackBorderWidth\n });\n }\n const trackBorderWidth = scroller.trackBorderWidth =\n scroller.track.strokeWidth();\n scroller.track.attr({\n x: -trackBorderWidth % 2 / 2,\n y: -trackBorderWidth % 2 / 2\n });\n // Draw the scrollbar itself\n scroller.scrollbarGroup = renderer.g().add(group);\n scroller.scrollbar = renderer.rect()\n .addClass('highcharts-scrollbar-thumb')\n .attr({\n height: size - trackBorderWidth,\n width: size - trackBorderWidth,\n r: options.barBorderRadius || 0\n }).add(scroller.scrollbarGroup);\n scroller.scrollbarRifles = renderer\n .path(Scrollbar.swapXY([\n ['M', -3, size / 4],\n ['L', -3, 2 * size / 3],\n ['M', 0, size / 4],\n ['L', 0, 2 * size / 3],\n ['M', 3, size / 4],\n ['L', 3, 2 * size / 3]\n ], options.vertical))\n .addClass('highcharts-scrollbar-rifles')\n .add(scroller.scrollbarGroup);\n if (!styledMode) {\n scroller.scrollbar.attr({\n fill: options.barBackgroundColor,\n stroke: options.barBorderColor,\n 'stroke-width': options.barBorderWidth\n });\n scroller.scrollbarRifles.attr({\n stroke: options.rifleColor,\n 'stroke-width': 1\n });\n }\n scroller.scrollbarStrokeWidth = scroller.scrollbar.strokeWidth();\n scroller.scrollbarGroup.translate(-scroller.scrollbarStrokeWidth % 2 / 2, -scroller.scrollbarStrokeWidth % 2 / 2);\n // Draw the buttons:\n scroller.drawScrollbarButton(0);\n scroller.drawScrollbarButton(1);\n }\n /**\n * Set scrollbar size, with a given scale.\n *\n * @private\n * @function Highcharts.Scrollbar#setRange\n * @param {number} from\n * scale (0-1) where bar should start\n * @param {number} to\n * scale (0-1) where bar should end\n */\n setRange(from, to) {\n const scroller = this, options = scroller.options, vertical = options.vertical, minWidth = options.minWidth, fullWidth = scroller.barWidth, method = (this.rendered &&\n !this.hasDragged &&\n !(this.chart.navigator && this.chart.navigator.hasDragged)) ? 'animate' : 'attr';\n if (!defined(fullWidth)) {\n return;\n }\n const toPX = fullWidth * Math.min(to, 1);\n let fromPX, newSize;\n from = Math.max(from, 0);\n fromPX = Math.ceil(fullWidth * from);\n scroller.calculatedWidth = newSize = correctFloat(toPX - fromPX);\n // We need to recalculate position, if minWidth is used\n if (newSize < minWidth) {\n fromPX = (fullWidth - minWidth + newSize) * from;\n newSize = minWidth;\n }\n const newPos = Math.floor(fromPX + scroller.xOffset + scroller.yOffset);\n const newRiflesPos = newSize / 2 - 0.5; // -0.5 -> rifle line width / 2\n // Store current position:\n scroller.from = from;\n scroller.to = to;\n if (!vertical) {\n scroller.scrollbarGroup[method]({\n translateX: newPos\n });\n scroller.scrollbar[method]({\n width: newSize\n });\n scroller.scrollbarRifles[method]({\n translateX: newRiflesPos\n });\n scroller.scrollbarLeft = newPos;\n scroller.scrollbarTop = 0;\n }\n else {\n scroller.scrollbarGroup[method]({\n translateY: newPos\n });\n scroller.scrollbar[method]({\n height: newSize\n });\n scroller.scrollbarRifles[method]({\n translateY: newRiflesPos\n });\n scroller.scrollbarTop = newPos;\n scroller.scrollbarLeft = 0;\n }\n if (newSize <= 12) {\n scroller.scrollbarRifles.hide();\n }\n else {\n scroller.scrollbarRifles.show();\n }\n // Show or hide the scrollbar based on the showFull setting\n if (options.showFull === false) {\n if (from <= 0 && to >= 1) {\n scroller.group.hide();\n }\n else {\n scroller.group.show();\n }\n }\n scroller.rendered = true;\n }\n /**\n * Checks if the extremes should be updated in response to a scrollbar\n * change event.\n *\n * @private\n * @function Highcharts.Scrollbar#shouldUpdateExtremes\n */\n shouldUpdateExtremes(eventType) {\n return (pick(this.options.liveRedraw, H.svg &&\n !H.isTouchDevice &&\n !this.chart.boosted) ||\n // Mouseup always should change extremes\n eventType === 'mouseup' ||\n eventType === 'touchend' ||\n // Internal events\n !defined(eventType));\n }\n trackClick(e) {\n const scroller = this;\n const normalizedEvent = scroller.chart.pointer?.normalize(e) || e, range = scroller.to - scroller.from, top = scroller.y + scroller.scrollbarTop, left = scroller.x + scroller.scrollbarLeft;\n if ((scroller.options.vertical && normalizedEvent.chartY > top) ||\n (!scroller.options.vertical && normalizedEvent.chartX > left)) {\n // On the top or on the left side of the track:\n scroller.updatePosition(scroller.from + range, scroller.to + range);\n }\n else {\n // On the bottom or the right side of the track:\n scroller.updatePosition(scroller.from - range, scroller.to - range);\n }\n fireEvent(scroller, 'changed', {\n from: scroller.from,\n to: scroller.to,\n trigger: 'scrollbar',\n DOMEvent: e\n });\n }\n /**\n * Update the scrollbar with new options\n *\n * @private\n * @function Highcharts.Scrollbar#update\n * @param {Highcharts.ScrollbarOptions} options\n */\n update(options) {\n this.destroy();\n this.init(this.chart.renderer, merge(true, this.options, options), this.chart);\n }\n /**\n * Update position option in the Scrollbar, with normalized 0-1 scale\n *\n * @private\n * @function Highcharts.Scrollbar#updatePosition\n * @param {number} from\n * @param {number} to\n */\n updatePosition(from, to) {\n if (to > 1) {\n from = correctFloat(1 - correctFloat(to - from));\n to = 1;\n }\n if (from < 0) {\n to = correctFloat(to - from);\n from = 0;\n }\n this.from = from;\n this.to = to;\n }\n}\n/* *\n *\n * Static Properties\n *\n * */\nScrollbar.defaultOptions = ScrollbarDefaults;\n/* *\n *\n * Registry\n *\n * */\ndefaultOptions.scrollbar = merge(true, Scrollbar.defaultOptions, defaultOptions.scrollbar);\n/* *\n *\n * Default Export\n *\n * */\nexport default Scrollbar;\n", "/* *\n *\n * (c) 2010-2024 Torstein Honsi\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Axis from '../../Core/Axis/Axis.js';\nimport ChartNavigatorComposition from './ChartNavigatorComposition.js';\nimport D from '../../Core/Defaults.js';\nconst { defaultOptions } = D;\nimport H from '../../Core/Globals.js';\nconst { isTouchDevice } = H;\nimport NavigatorAxisAdditions from '../../Core/Axis/NavigatorAxisComposition.js';\nimport NavigatorComposition from './NavigatorComposition.js';\nimport Scrollbar from '../Scrollbar/Scrollbar.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, clamp, correctFloat, defined, destroyObjectProperties, erase, extend, find, fireEvent, isArray, isNumber, merge, pick, removeEvent, splat } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Finding the min or max of a set of variables where we don't know if they are\n * defined, is a pattern that is repeated several places in Highcharts. Consider\n * making this a global utility method.\n * @private\n */\nfunction numExt(extreme, ...args) {\n const numbers = [].filter.call(args, isNumber);\n if (numbers.length) {\n return Math[extreme].apply(0, numbers);\n }\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * The Navigator class\n *\n * @private\n * @class\n * @name Highcharts.Navigator\n *\n * @param {Highcharts.Chart} chart\n * Chart object\n */\nclass Navigator {\n /* *\n *\n * Static Properties\n *\n * */\n static compose(ChartClass, AxisClass, SeriesClass) {\n ChartNavigatorComposition.compose(ChartClass, Navigator);\n NavigatorComposition.compose(ChartClass, AxisClass, SeriesClass);\n }\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart) {\n this.scrollbarHeight = 0;\n this.init(chart);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Draw one of the handles on the side of the zoomed range in the navigator.\n *\n * @private\n * @function Highcharts.Navigator#drawHandle\n *\n * @param {number} x\n * The x center for the handle\n *\n * @param {number} index\n * 0 for left and 1 for right\n *\n * @param {boolean|undefined} inverted\n * Flag for chart.inverted\n *\n * @param {string} verb\n * Use 'animate' or 'attr'\n */\n drawHandle(x, index, inverted, verb) {\n const navigator = this, height = navigator.navigatorOptions.handles.height;\n // Place it\n navigator.handles[index][verb](inverted ? {\n translateX: Math.round(navigator.left + navigator.height / 2),\n translateY: Math.round(navigator.top + parseInt(x, 10) + 0.5 - height)\n } : {\n translateX: Math.round(navigator.left + parseInt(x, 10)),\n translateY: Math.round(navigator.top + navigator.height / 2 - height / 2 - 1)\n });\n }\n /**\n * Render outline around the zoomed range\n *\n * @private\n * @function Highcharts.Navigator#drawOutline\n *\n * @param {number} zoomedMin\n * in pixels position where zoomed range starts\n *\n * @param {number} zoomedMax\n * in pixels position where zoomed range ends\n *\n * @param {boolean|undefined} inverted\n * flag if chart is inverted\n *\n * @param {string} verb\n * use 'animate' or 'attr'\n */\n drawOutline(zoomedMin, zoomedMax, inverted, verb) {\n const navigator = this, maskInside = navigator.navigatorOptions.maskInside, outlineWidth = navigator.outline.strokeWidth(), halfOutline = outlineWidth / 2, outlineCorrection = (outlineWidth % 2) / 2, // #5800\n scrollButtonSize = navigator.scrollButtonSize, navigatorSize = navigator.size, navigatorTop = navigator.top, height = navigator.height, lineTop = navigatorTop - halfOutline, lineBtm = navigatorTop + height;\n let left = navigator.left, verticalMin, path;\n if (inverted) {\n verticalMin = navigatorTop + zoomedMax + outlineCorrection;\n zoomedMax = navigatorTop + zoomedMin + outlineCorrection;\n path = [\n [\n 'M',\n left + height,\n navigatorTop - scrollButtonSize - outlineCorrection\n ],\n // top right of zoomed range\n ['L', left + height, verticalMin],\n ['L', left, verticalMin],\n ['M', left, zoomedMax],\n ['L', left + height, zoomedMax],\n [\n 'L',\n left + height,\n navigatorTop + navigatorSize + scrollButtonSize\n ]\n ];\n if (maskInside) {\n path.push(\n // upper left of zoomed range\n ['M', left + height, verticalMin - halfOutline], \n // upper right of z.r.\n [\n 'L',\n left + height,\n zoomedMax + halfOutline\n ]);\n }\n }\n else {\n left -= scrollButtonSize;\n zoomedMin += left + scrollButtonSize - outlineCorrection;\n zoomedMax += left + scrollButtonSize - outlineCorrection;\n path = [\n // left\n ['M', left, lineTop],\n // upper left of zoomed range\n ['L', zoomedMin, lineTop],\n // lower left of z.r.\n ['L', zoomedMin, lineBtm],\n // lower right of z.r.\n ['M', zoomedMax, lineBtm],\n // upper right of z.r.\n ['L', zoomedMax, lineTop],\n // right\n [\n 'L',\n left + navigatorSize + scrollButtonSize * 2,\n navigatorTop + halfOutline\n ]\n ];\n if (maskInside) {\n path.push(\n // upper left of zoomed range\n ['M', zoomedMin - halfOutline, lineTop], \n // upper right of z.r.\n ['L', zoomedMax + halfOutline, lineTop]);\n }\n }\n navigator.outline[verb]({\n d: path\n });\n }\n /**\n * Render outline around the zoomed range\n *\n * @private\n * @function Highcharts.Navigator#drawMasks\n *\n * @param {number} zoomedMin\n * in pixels position where zoomed range starts\n *\n * @param {number} zoomedMax\n * in pixels position where zoomed range ends\n *\n * @param {boolean|undefined} inverted\n * flag if chart is inverted\n *\n * @param {string} verb\n * use 'animate' or 'attr'\n */\n drawMasks(zoomedMin, zoomedMax, inverted, verb) {\n const navigator = this, left = navigator.left, top = navigator.top, navigatorHeight = navigator.height;\n let height, width, x, y;\n // Determine rectangle position & size\n // According to (non)inverted position:\n if (inverted) {\n x = [left, left, left];\n y = [top, top + zoomedMin, top + zoomedMax];\n width = [navigatorHeight, navigatorHeight, navigatorHeight];\n height = [\n zoomedMin,\n zoomedMax - zoomedMin,\n navigator.size - zoomedMax\n ];\n }\n else {\n x = [left, left + zoomedMin, left + zoomedMax];\n y = [top, top, top];\n width = [\n zoomedMin,\n zoomedMax - zoomedMin,\n navigator.size - zoomedMax\n ];\n height = [navigatorHeight, navigatorHeight, navigatorHeight];\n }\n navigator.shades.forEach((shade, i) => {\n shade[verb]({\n x: x[i],\n y: y[i],\n width: width[i],\n height: height[i]\n });\n });\n }\n /**\n * Generate DOM elements for a navigator:\n *\n * - main navigator group\n *\n * - all shades\n *\n * - outline\n *\n * - handles\n *\n * @private\n * @function Highcharts.Navigator#renderElements\n */\n renderElements() {\n const navigator = this, navigatorOptions = navigator.navigatorOptions, maskInside = navigatorOptions.maskInside, chart = navigator.chart, inverted = chart.inverted, renderer = chart.renderer, mouseCursor = {\n cursor: inverted ? 'ns-resize' : 'ew-resize'\n }, \n // Create the main navigator group\n navigatorGroup = navigator.navigatorGroup = renderer\n .g('navigator')\n .attr({\n zIndex: 8,\n visibility: 'hidden'\n })\n .add();\n // Create masks, each mask will get events and fill:\n [\n !maskInside,\n maskInside,\n !maskInside\n ].forEach((hasMask, index) => {\n const shade = renderer.rect()\n .addClass('highcharts-navigator-mask' +\n (index === 1 ? '-inside' : '-outside'))\n .add(navigatorGroup);\n if (!chart.styledMode) {\n shade.attr({\n fill: hasMask ?\n navigatorOptions.maskFill :\n 'rgba(0,0,0,0)'\n });\n if (index === 1) {\n shade.css(mouseCursor);\n }\n }\n navigator.shades[index] = shade;\n });\n // Create the outline:\n navigator.outline = renderer.path()\n .addClass('highcharts-navigator-outline')\n .add(navigatorGroup);\n if (!chart.styledMode) {\n navigator.outline.attr({\n 'stroke-width': navigatorOptions.outlineWidth,\n stroke: navigatorOptions.outlineColor\n });\n }\n // Create the handlers:\n if (navigatorOptions.handles && navigatorOptions.handles.enabled) {\n const handlesOptions = navigatorOptions.handles, { height, width } = handlesOptions;\n [0, 1].forEach((index) => {\n navigator.handles[index] = renderer.symbol(handlesOptions.symbols[index], -width / 2 - 1, 0, width, height, handlesOptions);\n if (chart.inverted) {\n navigator.handles[index].attr({\n rotation: 90,\n rotationOriginX: Math.floor(-width / 2),\n rotationOriginY: (height + width) / 2\n });\n }\n // zIndex = 6 for right handle, 7 for left.\n // Can't be 10, because of the tooltip in inverted chart #2908\n navigator.handles[index].attr({ zIndex: 7 - index })\n .addClass('highcharts-navigator-handle ' +\n 'highcharts-navigator-handle-' +\n ['left', 'right'][index]).add(navigatorGroup);\n if (!chart.styledMode) {\n navigator.handles[index]\n .attr({\n fill: handlesOptions.backgroundColor,\n stroke: handlesOptions.borderColor,\n 'stroke-width': handlesOptions.lineWidth\n })\n .css(mouseCursor);\n }\n });\n }\n }\n /**\n * Update navigator\n *\n * @private\n * @function Highcharts.Navigator#update\n *\n * @param {Highcharts.NavigatorOptions} options\n * Options to merge in when updating navigator\n */\n update(options) {\n // Remove references to old navigator series in base series\n (this.series || []).forEach((series) => {\n if (series.baseSeries) {\n delete series.baseSeries.navigatorSeries;\n }\n });\n // Destroy and rebuild navigator\n this.destroy();\n const chartOptions = this.chart.options;\n merge(true, chartOptions.navigator, options);\n this.init(this.chart);\n }\n /**\n * Render the navigator\n *\n * @private\n * @function Highcharts.Navigator#render\n * @param {number} min\n * X axis value minimum\n * @param {number} max\n * X axis value maximum\n * @param {number} [pxMin]\n * Pixel value minimum\n * @param {number} [pxMax]\n * Pixel value maximum\n */\n render(min, max, pxMin, pxMax) {\n const navigator = this, chart = navigator.chart, xAxis = navigator.xAxis, pointRange = xAxis.pointRange || 0, scrollbarXAxis = xAxis.navigatorAxis.fake ? chart.xAxis[0] : xAxis, navigatorEnabled = navigator.navigatorEnabled, rendered = navigator.rendered, inverted = chart.inverted, minRange = chart.xAxis[0].minRange, maxRange = chart.xAxis[0].options.maxRange, scrollButtonSize = navigator.scrollButtonSize;\n let navigatorWidth, scrollbarLeft, scrollbarTop, scrollbarHeight = navigator.scrollbarHeight, navigatorSize, verb;\n // Don't redraw while moving the handles (#4703).\n if (this.hasDragged && !defined(pxMin)) {\n return;\n }\n min = correctFloat(min - pointRange / 2);\n max = correctFloat(max + pointRange / 2);\n // Don't render the navigator until we have data (#486, #4202, #5172).\n if (!isNumber(min) || !isNumber(max)) {\n // However, if navigator was already rendered, we may need to resize\n // it. For example hidden series, but visible navigator (#6022).\n if (rendered) {\n pxMin = 0;\n pxMax = pick(xAxis.width, scrollbarXAxis.width);\n }\n else {\n return;\n }\n }\n navigator.left = pick(xAxis.left, \n // in case of scrollbar only, without navigator\n chart.plotLeft + scrollButtonSize +\n (inverted ? chart.plotWidth : 0));\n let zoomedMax = navigator.size = navigatorSize = pick(xAxis.len, (inverted ? chart.plotHeight : chart.plotWidth) -\n 2 * scrollButtonSize);\n if (inverted) {\n navigatorWidth = scrollbarHeight;\n }\n else {\n navigatorWidth = navigatorSize + 2 * scrollButtonSize;\n }\n // Get the pixel position of the handles\n pxMin = pick(pxMin, xAxis.toPixels(min, true));\n pxMax = pick(pxMax, xAxis.toPixels(max, true));\n // Verify (#1851, #2238)\n if (!isNumber(pxMin) || Math.abs(pxMin) === Infinity) {\n pxMin = 0;\n pxMax = navigatorWidth;\n }\n // Are we below the minRange? (#2618, #6191)\n const newMin = xAxis.toValue(pxMin, true), newMax = xAxis.toValue(pxMax, true), currentRange = Math.abs(correctFloat(newMax - newMin));\n if (currentRange < minRange) {\n if (this.grabbedLeft) {\n pxMin = xAxis.toPixels(newMax - minRange - pointRange, true);\n }\n else if (this.grabbedRight) {\n pxMax = xAxis.toPixels(newMin + minRange + pointRange, true);\n }\n }\n else if (defined(maxRange) &&\n correctFloat(currentRange - pointRange) > maxRange) {\n if (this.grabbedLeft) {\n pxMin = xAxis.toPixels(newMax - maxRange - pointRange, true);\n }\n else if (this.grabbedRight) {\n pxMax = xAxis.toPixels(newMin + maxRange + pointRange, true);\n }\n }\n // Handles are allowed to cross, but never exceed the plot area\n navigator.zoomedMax = clamp(Math.max(pxMin, pxMax), 0, zoomedMax);\n navigator.zoomedMin = clamp(navigator.fixedWidth ?\n navigator.zoomedMax - navigator.fixedWidth :\n Math.min(pxMin, pxMax), 0, zoomedMax);\n navigator.range = navigator.zoomedMax - navigator.zoomedMin;\n zoomedMax = Math.round(navigator.zoomedMax);\n const zoomedMin = Math.round(navigator.zoomedMin);\n if (navigatorEnabled) {\n navigator.navigatorGroup.attr({\n visibility: 'inherit'\n });\n // Place elements\n verb = rendered && !navigator.hasDragged ? 'animate' : 'attr';\n navigator.drawMasks(zoomedMin, zoomedMax, inverted, verb);\n navigator.drawOutline(zoomedMin, zoomedMax, inverted, verb);\n if (navigator.navigatorOptions.handles.enabled) {\n navigator.drawHandle(zoomedMin, 0, inverted, verb);\n navigator.drawHandle(zoomedMax, 1, inverted, verb);\n }\n }\n if (navigator.scrollbar) {\n if (inverted) {\n scrollbarTop = navigator.top - scrollButtonSize;\n scrollbarLeft = navigator.left - scrollbarHeight +\n (navigatorEnabled || !scrollbarXAxis.opposite ? 0 :\n // Multiple axes has offsets:\n (scrollbarXAxis.titleOffset || 0) +\n // Self margin from the axis.title\n scrollbarXAxis.axisTitleMargin);\n scrollbarHeight = navigatorSize + 2 * scrollButtonSize;\n }\n else {\n scrollbarTop = navigator.top + (navigatorEnabled ?\n navigator.height :\n -scrollbarHeight);\n scrollbarLeft = navigator.left - scrollButtonSize;\n }\n // Reposition scrollbar\n navigator.scrollbar.position(scrollbarLeft, scrollbarTop, navigatorWidth, scrollbarHeight);\n // Keep scale 0-1\n navigator.scrollbar.setRange(\n // Use real value, not rounded because range can be very small\n // (#1716)\n navigator.zoomedMin / (navigatorSize || 1), navigator.zoomedMax / (navigatorSize || 1));\n }\n navigator.rendered = true;\n fireEvent(this, 'afterRender');\n }\n /**\n * Set up the mouse and touch events for the navigator\n *\n * @private\n * @function Highcharts.Navigator#addMouseEvents\n */\n addMouseEvents() {\n const navigator = this, chart = navigator.chart, container = chart.container;\n let eventsToUnbind = [], mouseMoveHandler, mouseUpHandler;\n /**\n * Create mouse events' handlers.\n * Make them as separate functions to enable wrapping them:\n */\n navigator.mouseMoveHandler = mouseMoveHandler = function (e) {\n navigator.onMouseMove(e);\n };\n navigator.mouseUpHandler = mouseUpHandler = function (e) {\n navigator.onMouseUp(e);\n };\n // Add shades and handles mousedown events\n eventsToUnbind = navigator.getPartsEvents('mousedown');\n eventsToUnbind.push(\n // Add mouse move and mouseup events. These are bind to doc/div,\n // because Navigator.grabbedSomething flags are stored in mousedown\n // events\n addEvent(chart.renderTo, 'mousemove', mouseMoveHandler), addEvent(container.ownerDocument, 'mouseup', mouseUpHandler), \n // Touch events\n addEvent(chart.renderTo, 'touchmove', mouseMoveHandler), addEvent(container.ownerDocument, 'touchend', mouseUpHandler));\n eventsToUnbind.concat(navigator.getPartsEvents('touchstart'));\n navigator.eventsToUnbind = eventsToUnbind;\n // Data events\n if (navigator.series && navigator.series[0]) {\n eventsToUnbind.push(addEvent(navigator.series[0].xAxis, 'foundExtremes', function () {\n chart.navigator.modifyNavigatorAxisExtremes();\n }));\n }\n }\n /**\n * Generate events for handles and masks\n *\n * @private\n * @function Highcharts.Navigator#getPartsEvents\n *\n * @param {string} eventName\n * Event name handler, 'mousedown' or 'touchstart'\n *\n * @return {Array}\n * An array of functions to remove navigator functions from the\n * events again.\n */\n getPartsEvents(eventName) {\n const navigator = this, events = [];\n ['shades', 'handles'].forEach(function (name) {\n navigator[name].forEach(function (navigatorItem, index) {\n events.push(addEvent(navigatorItem.element, eventName, function (e) {\n navigator[name + 'Mousedown'](e, index);\n }));\n });\n });\n return events;\n }\n /**\n * Mousedown on a shaded mask, either:\n *\n * - will be stored for future drag&drop\n *\n * - will directly shift to a new range\n *\n * @private\n * @function Highcharts.Navigator#shadesMousedown\n *\n * @param {Highcharts.PointerEventObject} e\n * Mouse event\n *\n * @param {number} index\n * Index of a mask in Navigator.shades array\n */\n shadesMousedown(e, index) {\n e = this.chart.pointer?.normalize(e) || e;\n const navigator = this, chart = navigator.chart, xAxis = navigator.xAxis, zoomedMin = navigator.zoomedMin, navigatorSize = navigator.size, range = navigator.range;\n let navigatorPosition = navigator.left, chartX = e.chartX, fixedMax, fixedMin, ext, left;\n // For inverted chart, swap some options:\n if (chart.inverted) {\n chartX = e.chartY;\n navigatorPosition = navigator.top;\n }\n if (index === 1) {\n // Store information for drag&drop\n navigator.grabbedCenter = chartX;\n navigator.fixedWidth = range;\n navigator.dragOffset = chartX - zoomedMin;\n }\n else {\n // Shift the range by clicking on shaded areas\n left = chartX - navigatorPosition - range / 2;\n if (index === 0) {\n left = Math.max(0, left);\n }\n else if (index === 2 && left + range >= navigatorSize) {\n left = navigatorSize - range;\n if (navigator.reversedExtremes) {\n // #7713\n left -= range;\n fixedMin = navigator.getUnionExtremes().dataMin;\n }\n else {\n // #2293, #3543\n fixedMax = navigator.getUnionExtremes().dataMax;\n }\n }\n if (left !== zoomedMin) { // it has actually moved\n navigator.fixedWidth = range; // #1370\n ext = xAxis.navigatorAxis.toFixedRange(left, left + range, fixedMin, fixedMax);\n if (defined(ext.min)) { // #7411\n fireEvent(this, 'setRange', {\n min: Math.min(ext.min, ext.max),\n max: Math.max(ext.min, ext.max),\n redraw: true,\n eventArguments: {\n trigger: 'navigator'\n }\n });\n }\n }\n }\n }\n /**\n * Mousedown on a handle mask.\n * Will store necessary information for drag&drop.\n *\n * @private\n * @function Highcharts.Navigator#handlesMousedown\n * @param {Highcharts.PointerEventObject} e\n * Mouse event\n * @param {number} index\n * Index of a handle in Navigator.handles array\n */\n handlesMousedown(e, index) {\n e = this.chart.pointer?.normalize(e) || e;\n const navigator = this, chart = navigator.chart, baseXAxis = chart.xAxis[0], \n // For reversed axes, min and max are changed,\n // so the other extreme should be stored\n reverse = navigator.reversedExtremes;\n if (index === 0) {\n // Grab the left handle\n navigator.grabbedLeft = true;\n navigator.otherHandlePos = navigator.zoomedMax;\n navigator.fixedExtreme = reverse ? baseXAxis.min : baseXAxis.max;\n }\n else {\n // Grab the right handle\n navigator.grabbedRight = true;\n navigator.otherHandlePos = navigator.zoomedMin;\n navigator.fixedExtreme = reverse ? baseXAxis.max : baseXAxis.min;\n }\n chart.setFixedRange(void 0);\n }\n /**\n * Mouse move event based on x/y mouse position.\n *\n * @private\n * @function Highcharts.Navigator#onMouseMove\n *\n * @param {Highcharts.PointerEventObject} e\n * Mouse event\n */\n onMouseMove(e) {\n const navigator = this, chart = navigator.chart, navigatorSize = navigator.navigatorSize, range = navigator.range, dragOffset = navigator.dragOffset, inverted = chart.inverted;\n let left = navigator.left, chartX;\n // In iOS, a mousemove event with e.pageX === 0 is fired when holding\n // the finger down in the center of the scrollbar. This should be\n // ignored.\n if (!e.touches || e.touches[0].pageX !== 0) { // #4696\n e = chart.pointer?.normalize(e) || e;\n chartX = e.chartX;\n // Swap some options for inverted chart\n if (inverted) {\n left = navigator.top;\n chartX = e.chartY;\n }\n // Drag left handle or top handle\n if (navigator.grabbedLeft) {\n navigator.hasDragged = true;\n navigator.render(0, 0, chartX - left, navigator.otherHandlePos);\n // Drag right handle or bottom handle\n }\n else if (navigator.grabbedRight) {\n navigator.hasDragged = true;\n navigator.render(0, 0, navigator.otherHandlePos, chartX - left);\n // Drag scrollbar or open area in navigator\n }\n else if (navigator.grabbedCenter) {\n navigator.hasDragged = true;\n if (chartX < dragOffset) { // outside left\n chartX = dragOffset;\n // outside right\n }\n else if (chartX >\n navigatorSize + dragOffset - range) {\n chartX = navigatorSize + dragOffset - range;\n }\n navigator.render(0, 0, chartX - dragOffset, chartX - dragOffset + range);\n }\n if (navigator.hasDragged &&\n navigator.scrollbar &&\n pick(navigator.scrollbar.options.liveRedraw, \n // By default, don't run live redraw on touch\n // devices or if the chart is in boost.\n !isTouchDevice &&\n !this.chart.boosted)) {\n e.DOMType = e.type;\n setTimeout(function () {\n navigator.onMouseUp(e);\n }, 0);\n }\n }\n }\n /**\n * Mouse up event based on x/y mouse position.\n *\n * @private\n * @function Highcharts.Navigator#onMouseUp\n * @param {Highcharts.PointerEventObject} e\n * Mouse event\n */\n onMouseUp(e) {\n const navigator = this, chart = navigator.chart, xAxis = navigator.xAxis, scrollbar = navigator.scrollbar, DOMEvent = e.DOMEvent || e, inverted = chart.inverted, verb = navigator.rendered && !navigator.hasDragged ?\n 'animate' : 'attr';\n let zoomedMax, zoomedMin, unionExtremes, fixedMin, fixedMax, ext;\n if (\n // MouseUp is called for both, navigator and scrollbar (that order),\n // which causes calling afterSetExtremes twice. Prevent first call\n // by checking if scrollbar is going to set new extremes (#6334)\n (navigator.hasDragged && (!scrollbar || !scrollbar.hasDragged)) ||\n e.trigger === 'scrollbar') {\n unionExtremes = navigator.getUnionExtremes();\n // When dragging one handle, make sure the other one doesn't change\n if (navigator.zoomedMin === navigator.otherHandlePos) {\n fixedMin = navigator.fixedExtreme;\n }\n else if (navigator.zoomedMax === navigator.otherHandlePos) {\n fixedMax = navigator.fixedExtreme;\n }\n // Snap to right edge (#4076)\n if (navigator.zoomedMax === navigator.size) {\n fixedMax = navigator.reversedExtremes ?\n unionExtremes.dataMin :\n unionExtremes.dataMax;\n }\n // Snap to left edge (#7576)\n if (navigator.zoomedMin === 0) {\n fixedMin = navigator.reversedExtremes ?\n unionExtremes.dataMax :\n unionExtremes.dataMin;\n }\n ext = xAxis.navigatorAxis.toFixedRange(navigator.zoomedMin, navigator.zoomedMax, fixedMin, fixedMax);\n if (defined(ext.min)) {\n fireEvent(this, 'setRange', {\n min: Math.min(ext.min, ext.max),\n max: Math.max(ext.min, ext.max),\n redraw: true,\n animation: navigator.hasDragged ? false : null,\n eventArguments: {\n trigger: 'navigator',\n triggerOp: 'navigator-drag',\n DOMEvent: DOMEvent // #1838\n }\n });\n }\n }\n if (e.DOMType !== 'mousemove' &&\n e.DOMType !== 'touchmove') {\n navigator.grabbedLeft = navigator.grabbedRight =\n navigator.grabbedCenter = navigator.fixedWidth =\n navigator.fixedExtreme = navigator.otherHandlePos =\n navigator.hasDragged = navigator.dragOffset = null;\n }\n // Update position of navigator shades, outline and handles (#12573)\n if (navigator.navigatorEnabled &&\n isNumber(navigator.zoomedMin) &&\n isNumber(navigator.zoomedMax)) {\n zoomedMin = Math.round(navigator.zoomedMin);\n zoomedMax = Math.round(navigator.zoomedMax);\n if (navigator.shades) {\n navigator.drawMasks(zoomedMin, zoomedMax, inverted, verb);\n }\n if (navigator.outline) {\n navigator.drawOutline(zoomedMin, zoomedMax, inverted, verb);\n }\n if (navigator.navigatorOptions.handles.enabled &&\n Object.keys(navigator.handles).length ===\n navigator.handles.length) {\n navigator.drawHandle(zoomedMin, 0, inverted, verb);\n navigator.drawHandle(zoomedMax, 1, inverted, verb);\n }\n }\n }\n /**\n * Removes the event handlers attached previously with addEvents.\n *\n * @private\n * @function Highcharts.Navigator#removeEvents\n */\n removeEvents() {\n if (this.eventsToUnbind) {\n this.eventsToUnbind.forEach(function (unbind) {\n unbind();\n });\n this.eventsToUnbind = void 0;\n }\n this.removeBaseSeriesEvents();\n }\n /**\n * Remove data events.\n *\n * @private\n * @function Highcharts.Navigator#removeBaseSeriesEvents\n */\n removeBaseSeriesEvents() {\n const baseSeries = this.baseSeries || [];\n if (this.navigatorEnabled && baseSeries[0]) {\n if (this.navigatorOptions.adaptToUpdatedData !== false) {\n baseSeries.forEach(function (series) {\n removeEvent(series, 'updatedData', this.updatedDataHandler);\n }, this);\n }\n // We only listen for extremes-events on the first baseSeries\n if (baseSeries[0].xAxis) {\n removeEvent(baseSeries[0].xAxis, 'foundExtremes', this.modifyBaseAxisExtremes);\n }\n }\n }\n /**\n * Initialize the Navigator object\n *\n * @private\n * @function Highcharts.Navigator#init\n */\n init(chart) {\n const chartOptions = chart.options, navigatorOptions = chartOptions.navigator || {}, navigatorEnabled = navigatorOptions.enabled, scrollbarOptions = chartOptions.scrollbar || {}, scrollbarEnabled = scrollbarOptions.enabled, height = navigatorEnabled && navigatorOptions.height || 0, scrollbarHeight = scrollbarEnabled && scrollbarOptions.height || 0, scrollButtonSize = scrollbarOptions.buttonsEnabled && scrollbarHeight || 0;\n this.handles = [];\n this.shades = [];\n this.chart = chart;\n this.setBaseSeries();\n this.height = height;\n this.scrollbarHeight = scrollbarHeight;\n this.scrollButtonSize = scrollButtonSize;\n this.scrollbarEnabled = scrollbarEnabled;\n this.navigatorEnabled = navigatorEnabled;\n this.navigatorOptions = navigatorOptions;\n this.scrollbarOptions = scrollbarOptions;\n this.opposite = pick(navigatorOptions.opposite, Boolean(!navigatorEnabled && chart.inverted)); // #6262\n const navigator = this, baseSeries = navigator.baseSeries, xAxisIndex = chart.xAxis.length, yAxisIndex = chart.yAxis.length, baseXaxis = baseSeries && baseSeries[0] && baseSeries[0].xAxis ||\n chart.xAxis[0] || { options: {} };\n chart.isDirtyBox = true;\n if (navigator.navigatorEnabled) {\n // an x axis is required for scrollbar also\n navigator.xAxis = new Axis(chart, merge({\n // inherit base xAxis' break, ordinal options and overscroll\n breaks: baseXaxis.options.breaks,\n ordinal: baseXaxis.options.ordinal,\n overscroll: baseXaxis.options.overscroll\n }, navigatorOptions.xAxis, {\n id: 'navigator-x-axis',\n yAxis: 'navigator-y-axis',\n type: 'datetime',\n index: xAxisIndex,\n isInternal: true,\n offset: 0,\n keepOrdinalPadding: true,\n startOnTick: false,\n endOnTick: false,\n minPadding: 0,\n maxPadding: 0,\n zoomEnabled: false\n }, chart.inverted ? {\n offsets: [scrollButtonSize, 0, -scrollButtonSize, 0],\n width: height\n } : {\n offsets: [0, -scrollButtonSize, 0, scrollButtonSize],\n height: height\n }), 'xAxis');\n navigator.yAxis = new Axis(chart, merge(navigatorOptions.yAxis, {\n id: 'navigator-y-axis',\n alignTicks: false,\n offset: 0,\n index: yAxisIndex,\n isInternal: true,\n reversed: pick((navigatorOptions.yAxis &&\n navigatorOptions.yAxis.reversed), (chart.yAxis[0] && chart.yAxis[0].reversed), false),\n zoomEnabled: false\n }, chart.inverted ? {\n width: height\n } : {\n height: height\n }), 'yAxis');\n // If we have a base series, initialize the navigator series\n if (baseSeries || navigatorOptions.series.data) {\n navigator.updateNavigatorSeries(false);\n // If not, set up an event to listen for added series\n }\n else if (chart.series.length === 0) {\n navigator.unbindRedraw = addEvent(chart, 'beforeRedraw', function () {\n // We've got one, now add it as base\n if (chart.series.length > 0 && !navigator.series) {\n navigator.setBaseSeries();\n navigator.unbindRedraw(); // reset\n }\n });\n }\n navigator.reversedExtremes = (chart.inverted && !navigator.xAxis.reversed) || (!chart.inverted && navigator.xAxis.reversed);\n // Render items, so we can bind events to them:\n navigator.renderElements();\n // Add mouse events\n navigator.addMouseEvents();\n // in case of scrollbar only, fake an x axis to get translation\n }\n else {\n navigator.xAxis = {\n chart,\n navigatorAxis: {\n fake: true\n },\n translate: function (value, reverse) {\n const axis = chart.xAxis[0], ext = axis.getExtremes(), scrollTrackWidth = axis.len - 2 * scrollButtonSize, min = numExt('min', axis.options.min, ext.dataMin), valueRange = numExt('max', axis.options.max, ext.dataMax) - min;\n return reverse ?\n // from pixel to value\n (value * valueRange / scrollTrackWidth) + min :\n // from value to pixel\n scrollTrackWidth * (value - min) / valueRange;\n },\n toPixels: function (value) {\n return this.translate(value);\n },\n toValue: function (value) {\n return this.translate(value, true);\n }\n };\n navigator.xAxis.navigatorAxis.axis = navigator.xAxis;\n navigator.xAxis.navigatorAxis.toFixedRange = (NavigatorAxisAdditions.prototype.toFixedRange.bind(navigator.xAxis.navigatorAxis));\n }\n // Initialize the scrollbar\n if (chart.options.scrollbar.enabled) {\n const options = merge(chart.options.scrollbar, { vertical: chart.inverted });\n if (!isNumber(options.margin) && navigator.navigatorEnabled) {\n options.margin = chart.inverted ? -3 : 3;\n }\n chart.scrollbar = navigator.scrollbar = new Scrollbar(chart.renderer, options, chart);\n addEvent(navigator.scrollbar, 'changed', function (e) {\n const range = navigator.size, to = range * this.to, from = range * this.from;\n navigator.hasDragged = navigator.scrollbar.hasDragged;\n navigator.render(0, 0, from, to);\n if (this.shouldUpdateExtremes(e.DOMType)) {\n setTimeout(function () {\n navigator.onMouseUp(e);\n });\n }\n });\n }\n // Add data events\n navigator.addBaseSeriesEvents();\n // Add redraw events\n navigator.addChartEvents();\n }\n /**\n * Get the union data extremes of the chart - the outer data extremes of the\n * base X axis and the navigator axis.\n *\n * @private\n * @function Highcharts.Navigator#getUnionExtremes\n */\n getUnionExtremes(returnFalseOnNoBaseSeries) {\n const baseAxis = this.chart.xAxis[0], navAxis = this.xAxis, navAxisOptions = navAxis.options, baseAxisOptions = baseAxis.options;\n let ret;\n if (!returnFalseOnNoBaseSeries || baseAxis.dataMin !== null) {\n ret = {\n dataMin: pick(// #4053\n navAxisOptions && navAxisOptions.min, numExt('min', baseAxisOptions.min, baseAxis.dataMin, navAxis.dataMin, navAxis.min)),\n dataMax: pick(navAxisOptions && navAxisOptions.max, numExt('max', baseAxisOptions.max, baseAxis.dataMax, navAxis.dataMax, navAxis.max))\n };\n }\n return ret;\n }\n /**\n * Set the base series and update the navigator series from this. With a bit\n * of modification we should be able to make this an API method to be called\n * from the outside\n *\n * @private\n * @function Highcharts.Navigator#setBaseSeries\n * @param {Highcharts.SeriesOptionsType} [baseSeriesOptions]\n * Additional series options for a navigator\n * @param {boolean} [redraw]\n * Whether to redraw after update.\n */\n setBaseSeries(baseSeriesOptions, redraw) {\n const chart = this.chart, baseSeries = this.baseSeries = [];\n baseSeriesOptions = (baseSeriesOptions ||\n chart.options && chart.options.navigator.baseSeries ||\n (chart.series.length ?\n // Find the first non-navigator series (#8430)\n find(chart.series, (s) => (!s.options.isInternal)).index :\n 0));\n // Iterate through series and add the ones that should be shown in\n // navigator.\n (chart.series || []).forEach((series, i) => {\n if (\n // Don't include existing nav series\n !series.options.isInternal &&\n (series.options.showInNavigator ||\n (i === baseSeriesOptions ||\n series.options.id === baseSeriesOptions) &&\n series.options.showInNavigator !== false)) {\n baseSeries.push(series);\n }\n });\n // When run after render, this.xAxis already exists\n if (this.xAxis && !this.xAxis.navigatorAxis.fake) {\n this.updateNavigatorSeries(true, redraw);\n }\n }\n /**\n * Update series in the navigator from baseSeries, adding new if does not\n * exist.\n *\n * @private\n * @function Highcharts.Navigator.updateNavigatorSeries\n */\n updateNavigatorSeries(addEvents, redraw) {\n const navigator = this, chart = navigator.chart, baseSeries = navigator.baseSeries, navSeriesMixin = {\n enableMouseTracking: false,\n index: null,\n linkedTo: null,\n group: 'nav',\n padXAxis: false,\n xAxis: 'navigator-x-axis',\n yAxis: 'navigator-y-axis',\n showInLegend: false,\n stacking: void 0,\n isInternal: true,\n states: {\n inactive: {\n opacity: 1\n }\n }\n }, \n // Remove navigator series that are no longer in the baseSeries\n navigatorSeries = navigator.series =\n (navigator.series || []).filter((navSeries) => {\n const base = navSeries.baseSeries;\n if (baseSeries.indexOf(base) < 0) { // Not in array\n // If there is still a base series connected to this\n // series, remove event handler and reference.\n if (base) {\n removeEvent(base, 'updatedData', navigator.updatedDataHandler);\n delete base.navigatorSeries;\n }\n // Kill the nav series. It may already have been\n // destroyed (#8715).\n if (navSeries.chart) {\n navSeries.destroy();\n }\n return false;\n }\n return true;\n });\n let baseOptions, mergedNavSeriesOptions, chartNavigatorSeriesOptions = navigator.navigatorOptions.series, baseNavigatorOptions;\n // Go through each base series and merge the options to create new\n // series\n if (baseSeries && baseSeries.length) {\n baseSeries.forEach((base) => {\n const linkedNavSeries = base.navigatorSeries, userNavOptions = extend(\n // Grab color and visibility from base as default\n {\n color: base.color,\n visible: base.visible\n }, !isArray(chartNavigatorSeriesOptions) ?\n chartNavigatorSeriesOptions :\n defaultOptions.navigator.series);\n // Don't update if the series exists in nav and we have disabled\n // adaptToUpdatedData.\n if (linkedNavSeries &&\n navigator.navigatorOptions.adaptToUpdatedData === false) {\n return;\n }\n navSeriesMixin.name = 'Navigator ' + baseSeries.length;\n baseOptions = base.options || {};\n baseNavigatorOptions = baseOptions.navigatorOptions || {};\n // The dataLabels options are not merged correctly\n // if the settings are an array, #13847.\n userNavOptions.dataLabels = splat(userNavOptions.dataLabels);\n mergedNavSeriesOptions = merge(baseOptions, navSeriesMixin, userNavOptions, baseNavigatorOptions);\n // Once nav series type is resolved, pick correct pointRange\n mergedNavSeriesOptions.pointRange = pick(\n // Stricte set pointRange in options\n userNavOptions.pointRange, baseNavigatorOptions.pointRange, \n // Fallback to default values, e.g. `null` for column\n defaultOptions.plotOptions[mergedNavSeriesOptions.type || 'line'].pointRange);\n // Merge data separately. Do a slice to avoid mutating the\n // navigator options from base series (#4923).\n const navigatorSeriesData = baseNavigatorOptions.data || userNavOptions.data;\n navigator.hasNavigatorData =\n navigator.hasNavigatorData || !!navigatorSeriesData;\n mergedNavSeriesOptions.data =\n navigatorSeriesData ||\n baseOptions.data && baseOptions.data.slice(0);\n // Update or add the series\n if (linkedNavSeries && linkedNavSeries.options) {\n linkedNavSeries.update(mergedNavSeriesOptions, redraw);\n }\n else {\n base.navigatorSeries = chart.initSeries(mergedNavSeriesOptions);\n // Set data on initial run with dataSorting enabled (#20318)\n chart.setSortedData();\n base.navigatorSeries.baseSeries = base; // Store ref\n navigatorSeries.push(base.navigatorSeries);\n }\n });\n }\n // If user has defined data (and no base series) or explicitly defined\n // navigator.series as an array, we create these series on top of any\n // base series.\n if (chartNavigatorSeriesOptions.data &&\n !(baseSeries && baseSeries.length) ||\n isArray(chartNavigatorSeriesOptions)) {\n navigator.hasNavigatorData = false;\n // Allow navigator.series to be an array\n chartNavigatorSeriesOptions =\n splat(chartNavigatorSeriesOptions);\n chartNavigatorSeriesOptions.forEach((userSeriesOptions, i) => {\n navSeriesMixin.name =\n 'Navigator ' + (navigatorSeries.length + 1);\n mergedNavSeriesOptions = merge(defaultOptions.navigator.series, {\n // Since we don't have a base series to pull color from,\n // try to fake it by using color from series with same\n // index. Otherwise pull from the colors array. We need\n // an explicit color as otherwise updates will increment\n // color counter and we'll get a new color for each\n // update of the nav series.\n color: chart.series[i] &&\n !chart.series[i].options.isInternal &&\n chart.series[i].color ||\n chart.options.colors[i] ||\n chart.options.colors[0]\n }, navSeriesMixin, userSeriesOptions);\n mergedNavSeriesOptions.data = userSeriesOptions.data;\n if (mergedNavSeriesOptions.data) {\n navigator.hasNavigatorData = true;\n navigatorSeries.push(chart.initSeries(mergedNavSeriesOptions));\n }\n });\n }\n if (addEvents) {\n this.addBaseSeriesEvents();\n }\n }\n /**\n * Add data events.\n * For example when main series is updated we need to recalculate extremes\n *\n * @private\n * @function Highcharts.Navigator#addBaseSeriesEvent\n */\n addBaseSeriesEvents() {\n const navigator = this, baseSeries = navigator.baseSeries || [];\n // Bind modified extremes event to first base's xAxis only.\n // In event of > 1 base-xAxes, the navigator will ignore those.\n // Adding this multiple times to the same axis is no problem, as\n // duplicates should be discarded by the browser.\n if (baseSeries[0] && baseSeries[0].xAxis) {\n baseSeries[0].eventsToUnbind.push(addEvent(baseSeries[0].xAxis, 'foundExtremes', this.modifyBaseAxisExtremes));\n }\n baseSeries.forEach((base) => {\n // Link base series show/hide to navigator series visibility\n base.eventsToUnbind.push(addEvent(base, 'show', function () {\n if (this.navigatorSeries) {\n this.navigatorSeries.setVisible(true, false);\n }\n }));\n base.eventsToUnbind.push(addEvent(base, 'hide', function () {\n if (this.navigatorSeries) {\n this.navigatorSeries.setVisible(false, false);\n }\n }));\n // Respond to updated data in the base series, unless explicitly\n // not adapting to data changes.\n if (this.navigatorOptions.adaptToUpdatedData !== false) {\n if (base.xAxis) {\n base.eventsToUnbind.push(addEvent(base, 'updatedData', this.updatedDataHandler));\n }\n }\n // Handle series removal\n base.eventsToUnbind.push(addEvent(base, 'remove', function () {\n if (this.navigatorSeries) {\n erase(navigator.series, this.navigatorSeries);\n if (defined(this.navigatorSeries.options)) {\n this.navigatorSeries.remove(false);\n }\n delete this.navigatorSeries;\n }\n }));\n });\n }\n /**\n * Get minimum from all base series connected to the navigator\n * @private\n * @param {number} currentSeriesMin\n * Minium from the current series\n * @return {number}\n * Minimum from all series\n */\n getBaseSeriesMin(currentSeriesMin) {\n return this.baseSeries.reduce(function (min, series) {\n // (#10193)\n return Math.min(min, series.xData && series.xData.length ?\n series.xData[0] : min);\n }, currentSeriesMin);\n }\n /**\n * Set the navigator x axis extremes to reflect the total. The navigator\n * extremes should always be the extremes of the union of all series in the\n * chart as well as the navigator series.\n *\n * @private\n * @function Highcharts.Navigator#modifyNavigatorAxisExtremes\n */\n modifyNavigatorAxisExtremes() {\n const xAxis = this.xAxis;\n if (typeof xAxis.getExtremes !== 'undefined') {\n const unionExtremes = this.getUnionExtremes(true);\n if (unionExtremes &&\n (unionExtremes.dataMin !== xAxis.min ||\n unionExtremes.dataMax !== xAxis.max)) {\n xAxis.min = unionExtremes.dataMin;\n xAxis.max = unionExtremes.dataMax;\n }\n }\n }\n /**\n * Hook to modify the base axis extremes with information from the Navigator\n *\n * @private\n * @function Highcharts.Navigator#modifyBaseAxisExtremes\n */\n modifyBaseAxisExtremes() {\n const baseXAxis = this, navigator = baseXAxis.chart.navigator, baseExtremes = baseXAxis.getExtremes(), baseMin = baseExtremes.min, baseMax = baseExtremes.max, baseDataMin = baseExtremes.dataMin, baseDataMax = baseExtremes.dataMax, range = baseMax - baseMin, stickToMin = navigator.stickToMin, stickToMax = navigator.stickToMax, overscroll = pick(baseXAxis.ordinal?.convertOverscroll(baseXAxis.options.overscroll), 0), navigatorSeries = navigator.series && navigator.series[0], hasSetExtremes = !!baseXAxis.setExtremes, \n // When the extremes have been set by range selector button, don't\n // stick to min or max. The range selector buttons will handle the\n // extremes. (#5489)\n unmutable = baseXAxis.eventArgs &&\n baseXAxis.eventArgs.trigger === 'rangeSelectorButton';\n let newMax, newMin;\n if (!unmutable) {\n // If the zoomed range is already at the min, move it to the right\n // as new data comes in\n if (stickToMin) {\n newMin = baseDataMin;\n newMax = newMin + range;\n }\n // If the zoomed range is already at the max, move it to the right\n // as new data comes in\n if (stickToMax) {\n newMax = baseDataMax + overscroll;\n // If stickToMin is true, the new min value is set above\n if (!stickToMin) {\n newMin = Math.max(baseDataMin, // don't go below data extremes (#13184)\n newMax - range, navigator.getBaseSeriesMin(navigatorSeries && navigatorSeries.xData ?\n navigatorSeries.xData[0] :\n -Number.MAX_VALUE));\n }\n }\n // Update the extremes\n if (hasSetExtremes && (stickToMin || stickToMax)) {\n if (isNumber(newMin)) {\n baseXAxis.min = baseXAxis.userMin = newMin;\n baseXAxis.max = baseXAxis.userMax = newMax;\n }\n }\n }\n // Reset\n navigator.stickToMin =\n navigator.stickToMax = null;\n }\n /**\n * Handler for updated data on the base series. When data is modified, the\n * navigator series must reflect it. This is called from the Chart.redraw\n * function before axis and series extremes are computed.\n *\n * @private\n * @function Highcharts.Navigator#updateDataHandler\n */\n updatedDataHandler() {\n const navigator = this.chart.navigator, baseSeries = this, navigatorSeries = this.navigatorSeries, shouldStickToMax = navigator.reversedExtremes ?\n Math.round(navigator.zoomedMin) === 0 :\n Math.round(navigator.zoomedMax) >= Math.round(navigator.size);\n // If the scrollbar is scrolled all the way to the right, keep right as\n // new data comes in, unless user set navigator.stickToMax to false.\n navigator.stickToMax = pick(this.chart.options.navigator &&\n this.chart.options.navigator.stickToMax, shouldStickToMax);\n navigator.stickToMin = navigator.shouldStickToMin(baseSeries, navigator);\n // Set the navigator series data to the new data of the base series\n if (navigatorSeries && !navigator.hasNavigatorData) {\n navigatorSeries.options.pointStart = baseSeries.xData[0];\n navigatorSeries.setData(baseSeries.options.data, false, null, false); // #5414\n }\n }\n /**\n * Detect if the zoomed area should stick to the minimum, #14742.\n *\n * @private\n * @function Highcharts.Navigator#shouldStickToMin\n */\n shouldStickToMin(baseSeries, navigator) {\n const xDataMin = navigator.getBaseSeriesMin(baseSeries.xData[0]), xAxis = baseSeries.xAxis, max = xAxis.max, min = xAxis.min, range = xAxis.options.range;\n let stickToMin = true;\n if (isNumber(max) && isNumber(min)) {\n // If range declared, stick to the minimum only if the range\n // is smaller than the data set range.\n if (range && max - xDataMin > 0) {\n stickToMin = max - xDataMin < range;\n }\n else {\n // If the current axis minimum falls outside the new\n // updated dataset, we must adjust.\n stickToMin = min <= xDataMin;\n }\n }\n else {\n stickToMin = false; // #15864\n }\n return stickToMin;\n }\n /**\n * Add chart events, like redrawing navigator, when chart requires that.\n *\n * @private\n * @function Highcharts.Navigator#addChartEvents\n */\n addChartEvents() {\n if (!this.eventsToUnbind) {\n this.eventsToUnbind = [];\n }\n this.eventsToUnbind.push(\n // Move the scrollbar after redraw, like after data updata even if\n // axes don't redraw\n addEvent(this.chart, 'redraw', function () {\n const navigator = this.navigator, xAxis = navigator && (navigator.baseSeries &&\n navigator.baseSeries[0] &&\n navigator.baseSeries[0].xAxis ||\n this.xAxis[0]); // #5709, #13114\n if (xAxis) {\n navigator.render(xAxis.min, xAxis.max);\n }\n }), \n // Make room for the navigator, can be placed around the chart:\n addEvent(this.chart, 'getMargins', function () {\n let chart = this, navigator = chart.navigator, marginName = navigator.opposite ?\n 'plotTop' : 'marginBottom';\n if (chart.inverted) {\n marginName = navigator.opposite ?\n 'marginRight' : 'plotLeft';\n }\n chart[marginName] =\n (chart[marginName] || 0) + (navigator.navigatorEnabled || !chart.inverted ?\n navigator.height + navigator.scrollbarHeight :\n 0) + navigator.navigatorOptions.margin;\n }), addEvent(Navigator, 'setRange', function (e) {\n this.chart.xAxis[0].setExtremes(e.min, e.max, e.redraw, e.animation, e.eventArguments);\n }));\n }\n /**\n * Destroys allocated elements.\n *\n * @private\n * @function Highcharts.Navigator#destroy\n */\n destroy() {\n // Disconnect events added in addEvents\n this.removeEvents();\n if (this.xAxis) {\n erase(this.chart.xAxis, this.xAxis);\n erase(this.chart.axes, this.xAxis);\n }\n if (this.yAxis) {\n erase(this.chart.yAxis, this.yAxis);\n erase(this.chart.axes, this.yAxis);\n }\n // Destroy series\n (this.series || []).forEach((s) => {\n if (s.destroy) {\n s.destroy();\n }\n });\n // Destroy properties\n [\n 'series', 'xAxis', 'yAxis', 'shades', 'outline', 'scrollbarTrack',\n 'scrollbarRifles', 'scrollbarGroup', 'scrollbar', 'navigatorGroup',\n 'rendered'\n ].forEach((prop) => {\n if (this[prop] && this[prop].destroy) {\n this[prop].destroy();\n }\n this[prop] = null;\n });\n // Destroy elements in collection\n [this.handles].forEach((coll) => {\n destroyObjectProperties(coll);\n });\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default Navigator;\n", "/* *\n *\n * (c) 2009-2024 Highsoft AS\n *\n * Accessibility component for the navigator.\n *\n * Author: \u00D8ystein Moseng\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * Imports\n *\n * */\nimport AccessibilityComponent from '../AccessibilityComponent.js';\nimport Announcer from '../Utils/Announcer.js';\nimport KeyboardNavigationHandler from '../KeyboardNavigationHandler.js';\nimport Navigator from '../../Stock/Navigator/Navigator.js';\nimport A from '../../Core/Animation/AnimationUtilities.js';\nconst { animObject } = A;\nimport T from '../../Core/Templating.js';\nconst { format } = T;\nimport U from '../../Core/Utilities.js';\nconst { clamp, pick, syncTimeout } = U;\nimport HU from '../Utils/HTMLUtilities.js';\nconst { getFakeMouseEvent } = HU;\nimport CU from '../Utils/ChartUtilities.js';\nconst { getAxisRangeDescription, fireEventOnWrappedOrUnwrappedElement } = CU;\n/**\n * The NavigatorComponent class\n *\n * @private\n * @class\n * @name Highcharts.NavigatorComponent\n */\nclass NavigatorComponent extends AccessibilityComponent {\n /**\n * Init the component\n * @private\n */\n init() {\n const chart = this.chart, component = this;\n this.announcer = new Announcer(chart, 'polite');\n // Update positions after render\n this.addEvent(Navigator, 'afterRender', function () {\n if (this.chart === component.chart &&\n this.chart.renderer) {\n syncTimeout(() => {\n component.proxyProvider\n .updateGroupProxyElementPositions('navigator');\n component.updateHandleValues();\n }, animObject(pick(this.chart.renderer.globalAnimation, true)).duration);\n }\n });\n }\n /**\n * Called on updates\n * @private\n */\n onChartUpdate() {\n const chart = this.chart, options = chart.options;\n if (options.navigator.accessibility?.enabled) {\n const verbosity = options.accessibility.landmarkVerbosity, groupFormatStr = options.lang\n .accessibility?.navigator.groupLabel;\n // We just recreate the group for simplicity. Could consider\n // updating the existing group if the verbosity has not changed.\n this.proxyProvider.removeGroup('navigator');\n this.proxyProvider.addGroup('navigator', 'div', {\n role: verbosity === 'all' ? 'region' : 'group',\n 'aria-label': format(groupFormatStr, { chart }, chart)\n });\n const handleFormatStr = options.lang\n .accessibility?.navigator.handleLabel;\n [0, 1].forEach((n) => {\n const handle = this.getHandleByIx(n);\n if (handle) {\n const proxyEl = this.proxyProvider.addProxyElement('navigator', {\n click: handle\n }, 'input', {\n type: 'range',\n 'aria-label': format(handleFormatStr, { handleIx: n, chart }, chart)\n });\n this[n ? 'maxHandleProxy' : 'minHandleProxy'] =\n proxyEl.innerElement;\n proxyEl.innerElement.style.pointerEvents = 'none';\n proxyEl.innerElement.oninput =\n () => this.updateNavigator();\n }\n });\n this.updateHandleValues();\n }\n else {\n this.proxyProvider.removeGroup('navigator');\n }\n }\n /**\n * Get navigation for a navigator handle.\n * @private\n * @return {Highcharts.KeyboardNavigationHandler} The module object.\n */\n getNavigatorHandleNavigation(handleIx) {\n const component = this, chart = this.chart, proxyEl = handleIx ? this.maxHandleProxy : this.minHandleProxy, keys = this.keyCodes;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [[\n [keys.left, keys.right, keys.up, keys.down],\n function (keyCode) {\n if (proxyEl) {\n const delta = keyCode === keys.left ||\n keyCode === keys.up ? -1 : 1;\n proxyEl.value = '' + clamp(parseFloat(proxyEl.value) + delta, 0, 100);\n component.updateNavigator(() => {\n const handle = component.getHandleByIx(handleIx);\n if (handle) {\n chart.setFocusToElement(handle, proxyEl);\n }\n });\n }\n return this.response.success;\n }\n ]],\n init: () => {\n chart.setFocusToElement(this.getHandleByIx(handleIx), proxyEl);\n },\n validate: () => !!(this.getHandleByIx(handleIx) && proxyEl &&\n chart.options.navigator.accessibility?.enabled)\n });\n }\n /**\n * Get keyboard navigation handlers for this component.\n * @return {Array}\n * List of module objects.\n */\n getKeyboardNavigation() {\n return [\n this.getNavigatorHandleNavigation(0),\n this.getNavigatorHandleNavigation(1)\n ];\n }\n /**\n * Remove component traces\n */\n destroy() {\n if (this.updateNavigatorThrottleTimer) {\n clearTimeout(this.updateNavigatorThrottleTimer);\n }\n this.proxyProvider.removeGroup('navigator');\n if (this.announcer) {\n this.announcer.destroy();\n }\n }\n /**\n * Update the value of the handles to match current navigator pos.\n * @private\n */\n updateHandleValues() {\n const navigator = this.chart.navigator;\n if (navigator && this.minHandleProxy && this.maxHandleProxy) {\n const length = navigator.size;\n this.minHandleProxy.value =\n '' + Math.round(navigator.zoomedMin / length * 100);\n this.maxHandleProxy.value =\n '' + Math.round(navigator.zoomedMax / length * 100);\n }\n }\n /**\n * Get a navigator handle by its index\n * @private\n */\n getHandleByIx(ix) {\n const navigator = this.chart.navigator;\n return navigator && navigator.handles &&\n navigator.handles[ix];\n }\n /**\n * Update navigator to match changed proxy values.\n * @private\n */\n updateNavigator(beforeAnnounce) {\n const performUpdate = (beforeAnnounce) => {\n const chart = this.chart, { navigator, pointer } = chart;\n if (navigator &&\n pointer &&\n this.minHandleProxy &&\n this.maxHandleProxy) {\n const chartPos = pointer.getChartPosition(), minNewX = parseFloat(this.minHandleProxy.value) /\n 100 * navigator.size, maxNewX = parseFloat(this.maxHandleProxy.value) /\n 100 * navigator.size;\n // Fire fake events in order for each handle.\n [\n [0, 'mousedown', navigator.zoomedMin],\n [0, 'mousemove', minNewX],\n [0, 'mouseup', minNewX],\n [1, 'mousedown', navigator.zoomedMax],\n [1, 'mousemove', maxNewX],\n [1, 'mouseup', maxNewX]\n ].forEach(([handleIx, type, x]) => {\n const handle = this.getHandleByIx(handleIx)?.element;\n if (handle) {\n fireEventOnWrappedOrUnwrappedElement(handle, getFakeMouseEvent(type, {\n x: chartPos.left + navigator.left + x,\n y: chartPos.top + navigator.top\n }, handle));\n }\n });\n if (beforeAnnounce) {\n beforeAnnounce();\n }\n // Announce the update\n const announceFormatStr = chart.options.lang\n .accessibility?.navigator.changeAnnouncement, axisRangeDescription = getAxisRangeDescription(chart.xAxis[0]);\n this.announcer.announce(format(announceFormatStr, { axisRangeDescription, chart }, chart));\n }\n };\n // Throttle updates so as not to reduce performance with\n // continuous keypress.\n if (this.updateNavigatorThrottleTimer) {\n clearTimeout(this.updateNavigatorThrottleTimer);\n }\n this.updateNavigatorThrottleTimer = setTimeout(performUpdate.bind(this, beforeAnnounce), 20);\n }\n}\n/* *\n *\n * Export Default\n *\n * */\nexport default NavigatorComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Place desriptions on a series and its points.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AnnotationsA11y from '../AnnotationsA11y.js';\nconst { getPointAnnotationTexts } = AnnotationsA11y;\nimport ChartUtilities from '../../Utils/ChartUtilities.js';\nconst { getAxisDescription, getSeriesFirstPointElement, getSeriesA11yElement, unhideChartElementFromAT } = ChartUtilities;\nimport F from '../../../Core/Templating.js';\nconst { format, numberFormat } = F;\nimport HTMLUtilities from '../../Utils/HTMLUtilities.js';\nconst { reverseChildNodes, stripHTMLTagsFromString: stripHTMLTags } = HTMLUtilities;\nimport U from '../../../Core/Utilities.js';\nconst { find, isNumber, isString, pick, defined } = U;\n/* *\n *\n * Functions\n *\n * */\n/* eslint-disable valid-jsdoc */\n/**\n * @private\n */\nfunction findFirstPointWithGraphic(point) {\n const sourcePointIndex = point.index;\n if (!point.series || !point.series.data || !defined(sourcePointIndex)) {\n return null;\n }\n return find(point.series.data, function (p) {\n return !!(p &&\n typeof p.index !== 'undefined' &&\n p.index > sourcePointIndex &&\n p.graphic &&\n p.graphic.element);\n }) || null;\n}\n/**\n * Whether or not we should add a mock point element in\n * order to describe a point that has no graphic.\n * @private\n */\nfunction shouldAddMockPoint(point) {\n // Note: Sunburst series use isNull for hidden points on drilldown.\n // Ignore these.\n const series = point.series, chart = series && series.chart, isSunburst = series && series.is('sunburst'), isNull = point.isNull, shouldDescribeNull = chart &&\n chart\n .options.accessibility.point.describeNull;\n return isNull && !isSunburst && shouldDescribeNull;\n}\n/**\n * @private\n */\nfunction makeMockElement(point, pos) {\n const renderer = point.series.chart.renderer, mock = renderer.rect(pos.x, pos.y, 1, 1);\n mock.attr({\n 'class': 'highcharts-a11y-mock-point',\n fill: 'none',\n opacity: 0,\n 'fill-opacity': 0,\n 'stroke-opacity': 0\n });\n return mock;\n}\n/**\n * @private\n */\nfunction addMockPointElement(point) {\n const series = point.series, firstPointWithGraphic = findFirstPointWithGraphic(point), firstGraphic = firstPointWithGraphic && firstPointWithGraphic.graphic, parentGroup = firstGraphic ?\n firstGraphic.parentGroup :\n series.graph || series.group, mockPos = firstPointWithGraphic ? {\n x: pick(point.plotX, firstPointWithGraphic.plotX, 0),\n y: pick(point.plotY, firstPointWithGraphic.plotY, 0)\n } : {\n x: pick(point.plotX, 0),\n y: pick(point.plotY, 0)\n }, mockElement = makeMockElement(point, mockPos);\n if (parentGroup && parentGroup.element) {\n point.graphic = mockElement;\n point.hasMockGraphic = true;\n mockElement.add(parentGroup);\n // Move to correct pos in DOM\n parentGroup.element.insertBefore(mockElement.element, firstGraphic ? firstGraphic.element : null);\n return mockElement.element;\n }\n}\n/**\n * @private\n */\nfunction hasMorePointsThanDescriptionThreshold(series) {\n const chartA11yOptions = series.chart.options.accessibility, threshold = (chartA11yOptions.series.pointDescriptionEnabledThreshold);\n return !!(threshold !== false &&\n series.points &&\n series.points.length >= +threshold);\n}\n/**\n * @private\n */\nfunction shouldSetScreenReaderPropsOnPoints(series) {\n const seriesA11yOptions = series.options.accessibility || {};\n return !hasMorePointsThanDescriptionThreshold(series) &&\n !seriesA11yOptions.exposeAsGroupOnly;\n}\n/**\n * @private\n */\nfunction shouldSetKeyboardNavPropsOnPoints(series) {\n const chartA11yOptions = series.chart.options.accessibility, seriesNavOptions = chartA11yOptions.keyboardNavigation.seriesNavigation;\n return !!(series.points && (series.points.length <\n +seriesNavOptions.pointNavigationEnabledThreshold ||\n seriesNavOptions.pointNavigationEnabledThreshold === false));\n}\n/**\n * @private\n */\nfunction shouldDescribeSeriesElement(series) {\n const chart = series.chart, chartOptions = chart.options.chart, chartHas3d = chartOptions.options3d && chartOptions.options3d.enabled, hasMultipleSeries = chart.series.length > 1, describeSingleSeriesOption = chart.options.accessibility.series.describeSingleSeries, exposeAsGroupOnlyOption = (series.options.accessibility || {}).exposeAsGroupOnly, noDescribe3D = chartHas3d && hasMultipleSeries;\n return !noDescribe3D && (hasMultipleSeries || describeSingleSeriesOption ||\n exposeAsGroupOnlyOption || hasMorePointsThanDescriptionThreshold(series));\n}\n/**\n * @private\n */\nfunction pointNumberToString(point, value) {\n const series = point.series, chart = series.chart, a11yPointOptions = chart.options.accessibility.point || {}, seriesA11yPointOptions = series.options.accessibility &&\n series.options.accessibility.point || {}, tooltipOptions = series.tooltipOptions || {}, lang = chart.options.lang;\n if (isNumber(value)) {\n return numberFormat(value, seriesA11yPointOptions.valueDecimals ||\n a11yPointOptions.valueDecimals ||\n tooltipOptions.valueDecimals ||\n -1, lang.decimalPoint, lang.accessibility.thousandsSep || lang.thousandsSep);\n }\n return value;\n}\n/**\n * @private\n */\nfunction getSeriesDescriptionText(series) {\n const seriesA11yOptions = series.options.accessibility || {}, descOpt = seriesA11yOptions.description;\n return descOpt && series.chart.langFormat('accessibility.series.description', {\n description: descOpt,\n series: series\n }) || '';\n}\n/**\n * @private\n */\nfunction getSeriesAxisDescriptionText(series, axisCollection) {\n const axis = series[axisCollection];\n return series.chart.langFormat('accessibility.series.' + axisCollection + 'Description', {\n name: getAxisDescription(axis),\n series: series\n });\n}\n/**\n * Get accessible time description for a point on a datetime axis.\n *\n * @private\n */\nfunction getPointA11yTimeDescription(point) {\n const series = point.series, chart = series.chart, seriesA11yOptions = series.options.accessibility &&\n series.options.accessibility.point || {}, a11yOptions = chart.options.accessibility.point || {}, dateXAxis = series.xAxis && series.xAxis.dateTime;\n if (dateXAxis) {\n const tooltipDateFormat = dateXAxis.getXDateFormat(point.x || 0, chart.options.tooltip.dateTimeLabelFormats), dateFormat = seriesA11yOptions.dateFormatter &&\n seriesA11yOptions.dateFormatter(point) ||\n a11yOptions.dateFormatter && a11yOptions.dateFormatter(point) ||\n seriesA11yOptions.dateFormat ||\n a11yOptions.dateFormat ||\n tooltipDateFormat;\n return chart.time.dateFormat(dateFormat, point.x || 0, void 0);\n }\n}\n/**\n * @private\n */\nfunction getPointXDescription(point) {\n const timeDesc = getPointA11yTimeDescription(point), xAxis = point.series.xAxis || {}, pointCategory = xAxis.categories && defined(point.category) &&\n ('' + point.category).replace('
    ', ' '), canUseId = defined(point.id) &&\n ('' + point.id).indexOf('highcharts-') < 0, fallback = 'x, ' + point.x;\n return point.name || timeDesc || pointCategory ||\n (canUseId ? point.id : fallback);\n}\n/**\n * @private\n */\nfunction getPointArrayMapValueDescription(point, prefix, suffix) {\n const pre = prefix || '', suf = suffix || '', keyToValStr = function (key) {\n const num = pointNumberToString(point, pick(point[key], point.options[key]));\n return num !== void 0 ?\n key + ': ' + pre + num + suf :\n num;\n }, pointArrayMap = point.series.pointArrayMap;\n return pointArrayMap.reduce(function (desc, key) {\n const propDesc = keyToValStr(key);\n return propDesc ?\n (desc + (desc.length ? ', ' : '') + propDesc) :\n desc;\n }, '');\n}\n/**\n * @private\n */\nfunction getPointValue(point) {\n const series = point.series, a11yPointOpts = series.chart.options.accessibility.point || {}, seriesA11yPointOpts = series.chart.options.accessibility &&\n series.chart.options.accessibility.point || {}, tooltipOptions = series.tooltipOptions || {}, valuePrefix = seriesA11yPointOpts.valuePrefix ||\n a11yPointOpts.valuePrefix ||\n tooltipOptions.valuePrefix ||\n '', valueSuffix = seriesA11yPointOpts.valueSuffix ||\n a11yPointOpts.valueSuffix ||\n tooltipOptions.valueSuffix ||\n '', fallbackKey = (typeof point.value !==\n 'undefined' ?\n 'value' : 'y'), fallbackDesc = pointNumberToString(point, point[fallbackKey]);\n if (point.isNull) {\n return series.chart.langFormat('accessibility.series.nullPointValue', {\n point: point\n });\n }\n if (series.pointArrayMap) {\n return getPointArrayMapValueDescription(point, valuePrefix, valueSuffix);\n }\n return valuePrefix + fallbackDesc + valueSuffix;\n}\n/**\n * Return the description for the annotation(s) connected to a point, or\n * empty string if none.\n *\n * @private\n * @param {Highcharts.Point} point\n * The data point to get the annotation info from.\n * @return {string}\n * Annotation description\n */\nfunction getPointAnnotationDescription(point) {\n const chart = point.series.chart;\n const langKey = 'accessibility.series.pointAnnotationsDescription';\n const annotations = getPointAnnotationTexts(point);\n const context = { point, annotations };\n return annotations.length ? chart.langFormat(langKey, context) : '';\n}\n/**\n * Return string with information about point.\n * @private\n */\nfunction getPointValueDescription(point) {\n const series = point.series, chart = series.chart, seriesA11yOptions = series.options.accessibility, seriesValueDescFormat = seriesA11yOptions && seriesA11yOptions.point &&\n seriesA11yOptions.point.valueDescriptionFormat, pointValueDescriptionFormat = seriesValueDescFormat ||\n chart.options.accessibility.point.valueDescriptionFormat, showXDescription = pick(series.xAxis &&\n series.xAxis.options.accessibility &&\n series.xAxis.options.accessibility.enabled, !chart.angular && series.type !== 'flowmap'), xDesc = showXDescription ? getPointXDescription(point) : '', context = {\n point: point,\n index: defined(point.index) ? (point.index + 1) : '',\n xDescription: xDesc,\n value: getPointValue(point),\n separator: showXDescription ? ', ' : ''\n };\n return format(pointValueDescriptionFormat, context, chart);\n}\n/**\n * Return string with information about point.\n * @private\n */\nfunction defaultPointDescriptionFormatter(point) {\n const series = point.series, shouldExposeSeriesName = series.chart.series.length > 1 ||\n series.options.name, valText = getPointValueDescription(point), description = point.options && point.options.accessibility &&\n point.options.accessibility.description, userDescText = description ? ' ' + description : '', seriesNameText = shouldExposeSeriesName ? ' ' + series.name + '.' : '', annotationsDesc = getPointAnnotationDescription(point), pointAnnotationsText = annotationsDesc ? ' ' + annotationsDesc : '';\n point.accessibility = point.accessibility || {};\n point.accessibility.valueDescription = valText;\n return valText + userDescText + seriesNameText + pointAnnotationsText;\n}\n/**\n * Set a11y props on a point element\n * @private\n * @param {Highcharts.Point} point\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} pointElement\n */\nfunction setPointScreenReaderAttribs(point, pointElement) {\n const series = point.series, seriesPointA11yOptions = series.options.accessibility?.point || {}, a11yPointOptions = series.chart.options.accessibility.point || {}, label = stripHTMLTags((isString(seriesPointA11yOptions.descriptionFormat) &&\n format(seriesPointA11yOptions.descriptionFormat, point, series.chart)) ||\n seriesPointA11yOptions.descriptionFormatter?.(point) ||\n (isString(a11yPointOptions.descriptionFormat) &&\n format(a11yPointOptions.descriptionFormat, point, series.chart)) ||\n a11yPointOptions.descriptionFormatter?.(point) ||\n defaultPointDescriptionFormatter(point), series.chart.renderer.forExport);\n pointElement.setAttribute('role', 'img');\n pointElement.setAttribute('aria-label', label);\n}\n/**\n * Add accessible info to individual point elements of a series\n * @private\n * @param {Highcharts.Series} series\n */\nfunction describePointsInSeries(series) {\n const setScreenReaderProps = shouldSetScreenReaderPropsOnPoints(series), setKeyboardProps = shouldSetKeyboardNavPropsOnPoints(series), shouldDescribeNullPoints = series.chart.options.accessibility\n .point.describeNull;\n if (setScreenReaderProps || setKeyboardProps) {\n series.points.forEach((point) => {\n const pointEl = point.graphic && point.graphic.element ||\n shouldAddMockPoint(point) && addMockPointElement(point), pointA11yDisabled = (point.options &&\n point.options.accessibility &&\n point.options.accessibility.enabled === false);\n if (pointEl) {\n if (point.isNull && !shouldDescribeNullPoints) {\n pointEl.setAttribute('aria-hidden', true);\n return;\n }\n // We always set tabindex, as long as we are setting props.\n // When setting tabindex, also remove default outline to\n // avoid ugly border on click.\n pointEl.setAttribute('tabindex', '-1');\n if (!series.chart.styledMode) {\n pointEl.style.outline = 'none';\n }\n if (setScreenReaderProps && !pointA11yDisabled) {\n setPointScreenReaderAttribs(point, pointEl);\n }\n else {\n pointEl.setAttribute('aria-hidden', true);\n }\n }\n });\n }\n}\n/**\n * Return string with information about series.\n * @private\n */\nfunction defaultSeriesDescriptionFormatter(series) {\n const chart = series.chart, chartTypes = chart.types || [], description = getSeriesDescriptionText(series), shouldDescribeAxis = function (coll) {\n return chart[coll] && chart[coll].length > 1 && series[coll];\n }, seriesNumber = series.index + 1, xAxisInfo = getSeriesAxisDescriptionText(series, 'xAxis'), yAxisInfo = getSeriesAxisDescriptionText(series, 'yAxis'), summaryContext = {\n seriesNumber,\n series,\n chart\n }, combinationSuffix = chartTypes.length > 1 ? 'Combination' : '', summary = chart.langFormat('accessibility.series.summary.' + series.type + combinationSuffix, summaryContext) || chart.langFormat('accessibility.series.summary.default' + combinationSuffix, summaryContext), axisDescription = (shouldDescribeAxis('yAxis') ? ' ' + yAxisInfo + '.' : '') + (shouldDescribeAxis('xAxis') ? ' ' + xAxisInfo + '.' : ''), formatStr = pick(series.options.accessibility &&\n series.options.accessibility.descriptionFormat, chart.options.accessibility.series.descriptionFormat, '');\n return format(formatStr, {\n seriesDescription: summary,\n authorDescription: (description ? ' ' + description : ''),\n axisDescription,\n series,\n chart,\n seriesNumber\n }, void 0);\n}\n/**\n * Set a11y props on a series element\n * @private\n * @param {Highcharts.Series} series\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} seriesElement\n */\nfunction describeSeriesElement(series, seriesElement) {\n const seriesA11yOptions = series.options.accessibility || {}, a11yOptions = series.chart.options.accessibility, landmarkVerbosity = a11yOptions.landmarkVerbosity;\n // Handle role attribute\n if (seriesA11yOptions.exposeAsGroupOnly) {\n seriesElement.setAttribute('role', 'img');\n }\n else if (landmarkVerbosity === 'all') {\n seriesElement.setAttribute('role', 'region');\n }\n else {\n seriesElement.setAttribute('role', 'group');\n }\n seriesElement.setAttribute('tabindex', '-1');\n if (!series.chart.styledMode) {\n // Don't show browser outline on click, despite tabindex\n seriesElement.style.outline = 'none';\n }\n seriesElement.setAttribute('aria-label', stripHTMLTags(a11yOptions.series.descriptionFormatter &&\n a11yOptions.series.descriptionFormatter(series) ||\n defaultSeriesDescriptionFormatter(series), series.chart.renderer.forExport));\n}\n/**\n * Put accessible info on series and points of a series.\n * @param {Highcharts.Series} series The series to add info on.\n */\nfunction describeSeries(series) {\n const chart = series.chart, firstPointEl = getSeriesFirstPointElement(series), seriesEl = getSeriesA11yElement(series), is3d = chart.is3d && chart.is3d();\n if (seriesEl) {\n // For some series types the order of elements do not match the\n // order of points in series. In that case we have to reverse them\n // in order for AT to read them out in an understandable order.\n // Due to z-index issues we cannot do this for 3D charts.\n if (seriesEl.lastChild === firstPointEl && !is3d) {\n reverseChildNodes(seriesEl);\n }\n describePointsInSeries(series);\n unhideChartElementFromAT(chart, seriesEl);\n if (shouldDescribeSeriesElement(series)) {\n describeSeriesElement(series, seriesEl);\n }\n else {\n seriesEl.removeAttribute('aria-label');\n }\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nconst SeriesDescriber = {\n defaultPointDescriptionFormatter,\n defaultSeriesDescriptionFormatter,\n describeSeries\n};\nexport default SeriesDescriber;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Handle announcing new data for a chart.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../../Core/Globals.js';\nconst { composed } = H;\nimport U from '../../../Core/Utilities.js';\nconst { addEvent, defined, pushUnique } = U;\nimport Announcer from '../../Utils/Announcer.js';\nimport ChartUtilities from '../../Utils/ChartUtilities.js';\nconst { getChartTitle } = ChartUtilities;\nimport EventProvider from '../../Utils/EventProvider.js';\nimport SeriesDescriber from './SeriesDescriber.js';\nconst { defaultPointDescriptionFormatter, defaultSeriesDescriptionFormatter } = SeriesDescriber;\n/* *\n *\n * Functions\n *\n * */\n/* eslint-disable valid-jsdoc */\n/**\n * @private\n */\nfunction chartHasAnnounceEnabled(chart) {\n return !!chart.options.accessibility.announceNewData.enabled;\n}\n/**\n * @private\n */\nfunction findPointInDataArray(point) {\n const candidates = point.series.data.filter((candidate) => (point.x === candidate.x && point.y === candidate.y));\n return candidates.length === 1 ? candidates[0] : point;\n}\n/**\n * Get array of unique series from two arrays\n * @private\n */\nfunction getUniqueSeries(arrayA, arrayB) {\n const uniqueSeries = (arrayA || []).concat(arrayB || []).reduce((acc, cur) => {\n acc[cur.name + cur.index] = cur;\n return acc;\n }, {});\n return Object\n .keys(uniqueSeries)\n .map((ix) => uniqueSeries[ix]);\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * @private\n * @class\n */\nclass NewDataAnnouncer {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart) {\n this.dirty = {\n allSeries: {}\n };\n this.lastAnnouncementTime = 0;\n this.chart = chart;\n }\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Initialize the new data announcer.\n * @private\n */\n init() {\n const chart = this.chart;\n const announceOptions = (chart.options.accessibility.announceNewData);\n const announceType = announceOptions.interruptUser ?\n 'assertive' : 'polite';\n this.lastAnnouncementTime = 0;\n this.dirty = {\n allSeries: {}\n };\n this.eventProvider = new EventProvider();\n this.announcer = new Announcer(chart, announceType);\n this.addEventListeners();\n }\n /**\n * Remove traces of announcer.\n * @private\n */\n destroy() {\n this.eventProvider.removeAddedEvents();\n this.announcer.destroy();\n }\n /**\n * Add event listeners for the announcer\n * @private\n */\n addEventListeners() {\n const announcer = this, chart = this.chart, e = this.eventProvider;\n e.addEvent(chart, 'afterApplyDrilldown', function () {\n announcer.lastAnnouncementTime = 0;\n });\n e.addEvent(chart, 'afterAddSeries', function (e) {\n announcer.onSeriesAdded(e.series);\n });\n e.addEvent(chart, 'redraw', function () {\n announcer.announceDirtyData();\n });\n }\n /**\n * On new data series added, update dirty list.\n * @private\n * @param {Highcharts.Series} series\n */\n onSeriesAdded(series) {\n if (chartHasAnnounceEnabled(this.chart)) {\n this.dirty.hasDirty = true;\n this.dirty.allSeries[series.name + series.index] = series;\n // Add it to newSeries storage unless we already have one\n this.dirty.newSeries = defined(this.dirty.newSeries) ?\n void 0 : series;\n }\n }\n /**\n * Gather what we know and announce the data to user.\n * @private\n */\n announceDirtyData() {\n const chart = this.chart, announcer = this;\n if (chart.options.accessibility.announceNewData &&\n this.dirty.hasDirty) {\n let newPoint = this.dirty.newPoint;\n // If we have a single new point, see if we can find it in the\n // data array. Otherwise we can only pass through options to\n // the description builder, and it is a bit sparse in info.\n if (newPoint) {\n newPoint = findPointInDataArray(newPoint);\n }\n this.queueAnnouncement(Object\n .keys(this.dirty.allSeries)\n .map((ix) => announcer.dirty.allSeries[ix]), this.dirty.newSeries, newPoint);\n // Reset\n this.dirty = {\n allSeries: {}\n };\n }\n }\n /**\n * Announce to user that there is new data.\n * @private\n * @param {Array} dirtySeries\n * Array of series with new data.\n * @param {Highcharts.Series} [newSeries]\n * If a single new series was added, a reference to this series.\n * @param {Highcharts.Point} [newPoint]\n * If a single point was added, a reference to this point.\n */\n queueAnnouncement(dirtySeries, newSeries, newPoint) {\n const chart = this.chart;\n const annOptions = chart.options.accessibility.announceNewData;\n if (annOptions.enabled) {\n const now = +new Date();\n const dTime = now - this.lastAnnouncementTime;\n const time = Math.max(0, annOptions.minAnnounceInterval - dTime);\n // Add series from previously queued announcement.\n const allSeries = getUniqueSeries(this.queuedAnnouncement && this.queuedAnnouncement.series, dirtySeries);\n // Build message and announce\n const message = this.buildAnnouncementMessage(allSeries, newSeries, newPoint);\n if (message) {\n // Is there already one queued?\n if (this.queuedAnnouncement) {\n clearTimeout(this.queuedAnnouncementTimer);\n }\n // Build the announcement\n this.queuedAnnouncement = {\n time: now,\n message: message,\n series: allSeries\n };\n // Queue the announcement\n this.queuedAnnouncementTimer = setTimeout(() => {\n if (this && this.announcer) {\n this.lastAnnouncementTime = +new Date();\n this.announcer.announce(this.queuedAnnouncement.message);\n delete this.queuedAnnouncement;\n delete this.queuedAnnouncementTimer;\n }\n }, time);\n }\n }\n }\n /**\n * Get announcement message for new data.\n * @private\n * @param {Array} dirtySeries\n * Array of series with new data.\n * @param {Highcharts.Series} [newSeries]\n * If a single new series was added, a reference to this series.\n * @param {Highcharts.Point} [newPoint]\n * If a single point was added, a reference to this point.\n *\n * @return {string|null}\n * The announcement message to give to user.\n */\n buildAnnouncementMessage(dirtySeries, newSeries, newPoint) {\n const chart = this.chart, annOptions = chart.options.accessibility.announceNewData;\n // User supplied formatter?\n if (annOptions.announcementFormatter) {\n const formatterRes = annOptions.announcementFormatter(dirtySeries, newSeries, newPoint);\n if (formatterRes !== false) {\n return formatterRes.length ? formatterRes : null;\n }\n }\n // Default formatter - use lang options\n const multiple = H.charts && H.charts.length > 1 ?\n 'Multiple' : 'Single', langKey = newSeries ? 'newSeriesAnnounce' + multiple :\n newPoint ? 'newPointAnnounce' + multiple : 'newDataAnnounce', chartTitle = getChartTitle(chart);\n return chart.langFormat('accessibility.announceNewData.' + langKey, {\n chartTitle: chartTitle,\n seriesDesc: newSeries ?\n defaultSeriesDescriptionFormatter(newSeries) :\n null,\n pointDesc: newPoint ?\n defaultPointDescriptionFormatter(newPoint) :\n null,\n point: newPoint,\n series: newSeries\n });\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (NewDataAnnouncer) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Static Functions\n *\n * */\n /**\n * @private\n */\n function compose(SeriesClass) {\n if (pushUnique(composed, 'A11y.NDA')) {\n addEvent(SeriesClass, 'addPoint', seriesOnAddPoint);\n addEvent(SeriesClass, 'updatedData', seriesOnUpdatedData);\n }\n }\n NewDataAnnouncer.compose = compose;\n /**\n * On new point added, update dirty list.\n * @private\n * @param {Highcharts.Point} point\n */\n function seriesOnAddPoint(e) {\n const chart = this.chart, newDataAnnouncer = chart.accessibility?.components\n .series.newDataAnnouncer;\n if (newDataAnnouncer &&\n newDataAnnouncer.chart === chart &&\n chartHasAnnounceEnabled(chart)) {\n // Add it to newPoint storage unless we already have one\n newDataAnnouncer.dirty.newPoint = (defined(newDataAnnouncer.dirty.newPoint) ?\n void 0 :\n e.point);\n }\n }\n /**\n * On new data in the series, make sure we add it to the dirty list.\n * @private\n * @param {Highcharts.Series} series\n */\n function seriesOnUpdatedData() {\n const chart = this.chart, newDataAnnouncer = chart.accessibility?.components\n .series.newDataAnnouncer;\n if (newDataAnnouncer &&\n newDataAnnouncer.chart === chart &&\n chartHasAnnounceEnabled(chart)) {\n newDataAnnouncer.dirty.hasDirty = true;\n newDataAnnouncer.dirty.allSeries[this.name + this.index] = this;\n }\n }\n})(NewDataAnnouncer || (NewDataAnnouncer = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default NewDataAnnouncer;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Proxy elements are used to shadow SVG elements in HTML for assistive\n * technology, such as screen readers or voice input software.\n *\n * The ProxyElement class represents such an element, and deals with\n * overlay positioning and mirroring events for the target.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Core/Globals.js';\nconst { doc } = H;\nimport U from '../Core/Utilities.js';\nconst { attr, css, merge } = U;\nimport EventProvider from './Utils/EventProvider.js';\nimport ChartUtilities from './Utils/ChartUtilities.js';\nconst { fireEventOnWrappedOrUnwrappedElement } = ChartUtilities;\nimport HTMLUtilities from './Utils/HTMLUtilities.js';\nconst { cloneMouseEvent, cloneTouchEvent, getFakeMouseEvent, removeElement } = HTMLUtilities;\n/* *\n *\n * Class\n *\n * */\n/**\n * Represents a proxy element that overlays a target and relays events\n * to its target.\n *\n * @private\n * @class\n */\nclass ProxyElement {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart, target, proxyElementType = 'button', wrapperElementType, attributes) {\n this.chart = chart;\n this.target = target;\n this.eventProvider = new EventProvider();\n const innerEl = this.innerElement =\n doc.createElement(proxyElementType), wrapperEl = this.element = wrapperElementType ?\n doc.createElement(wrapperElementType) : innerEl;\n if (!chart.styledMode) {\n this.hideElementVisually(innerEl);\n }\n if (wrapperElementType) {\n if (wrapperElementType === 'li' && !chart.styledMode) {\n wrapperEl.style.listStyle = 'none';\n }\n wrapperEl.appendChild(innerEl);\n this.element = wrapperEl;\n }\n this.updateTarget(target, attributes);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Fake a click event on the target.\n */\n click() {\n const pos = this.getTargetPosition();\n pos.x += pos.width / 2;\n pos.y += pos.height / 2;\n const fakeEventObject = getFakeMouseEvent('click', pos);\n fireEventOnWrappedOrUnwrappedElement(this.target.click, fakeEventObject);\n }\n /**\n * Update the target to be proxied. The position and events are updated to\n * match the new target.\n * @param target The new target definition\n * @param attributes New HTML attributes to apply to the proxy. Set an\n * attribute to null to remove.\n */\n updateTarget(target, attributes) {\n this.target = target;\n this.updateCSSClassName();\n const attrs = attributes || {};\n Object.keys(attrs).forEach((a) => {\n if (attrs[a] === null) {\n delete attrs[a];\n }\n });\n const targetAriaLabel = this.getTargetAttr(target.click, 'aria-label');\n attr(this.innerElement, merge(targetAriaLabel ? {\n 'aria-label': targetAriaLabel\n } : {}, attrs));\n this.eventProvider.removeAddedEvents();\n this.addProxyEventsToElement(this.innerElement, target.click);\n this.refreshPosition();\n }\n /**\n * Refresh the position of the proxy element to match the current target\n */\n refreshPosition() {\n const bBox = this.getTargetPosition();\n css(this.innerElement, {\n width: (bBox.width || 1) + 'px',\n height: (bBox.height || 1) + 'px',\n left: (Math.round(bBox.x) || 0) + 'px',\n top: (Math.round(bBox.y) || 0) + 'px'\n });\n }\n /**\n * Remove button from DOM, and clear events.\n */\n remove() {\n this.eventProvider.removeAddedEvents();\n removeElement(this.element);\n }\n // -------------------------- private ------------------------------------\n /**\n * Update the CSS class name to match target\n */\n updateCSSClassName() {\n const stringHasNoTooltip = (s) => (s.indexOf('highcharts-no-tooltip') > -1);\n const legend = this.chart.legend;\n const groupDiv = legend.group && legend.group.div;\n const noTooltipOnGroup = stringHasNoTooltip(groupDiv && groupDiv.className || '');\n const targetClassName = this.getTargetAttr(this.target.click, 'class') || '';\n const noTooltipOnTarget = stringHasNoTooltip(targetClassName);\n this.innerElement.className = noTooltipOnGroup || noTooltipOnTarget ?\n 'highcharts-a11y-proxy-element highcharts-no-tooltip' :\n 'highcharts-a11y-proxy-element';\n }\n /**\n * Mirror events for a proxy element to a target\n */\n addProxyEventsToElement(element, target) {\n [\n 'click', 'touchstart', 'touchend', 'touchcancel', 'touchmove',\n 'mouseover', 'mouseenter', 'mouseleave', 'mouseout'\n ].forEach((evtType) => {\n const isTouchEvent = evtType.indexOf('touch') === 0;\n this.eventProvider.addEvent(element, evtType, (e) => {\n const clonedEvent = isTouchEvent ?\n cloneTouchEvent(e) :\n cloneMouseEvent(e);\n if (target) {\n fireEventOnWrappedOrUnwrappedElement(target, clonedEvent);\n }\n e.stopPropagation();\n // #9682, #15318: Touch scrolling didn't work when touching\n // proxy\n if (!isTouchEvent) {\n e.preventDefault();\n }\n }, { passive: false });\n });\n }\n /**\n * Set visually hidden style on a proxy element\n */\n hideElementVisually(el) {\n css(el, {\n borderWidth: 0,\n backgroundColor: 'transparent',\n cursor: 'pointer',\n outline: 'none',\n opacity: 0.001,\n filter: 'alpha(opacity=1)',\n zIndex: 999,\n overflow: 'hidden',\n padding: 0,\n margin: 0,\n display: 'block',\n position: 'absolute',\n '-ms-filter': 'progid:DXImageTransform.Microsoft.Alpha(Opacity=1)'\n });\n }\n /**\n * Get the position relative to chart container for the target\n */\n getTargetPosition() {\n const clickTarget = this.target.click;\n // We accept both DOM elements and wrapped elements as click targets.\n const clickTargetElement = clickTarget.element ?\n clickTarget.element :\n clickTarget;\n const posElement = this.target.visual || clickTargetElement;\n const chartDiv = this.chart.renderTo, pointer = this.chart.pointer;\n if (chartDiv && posElement?.getBoundingClientRect && pointer) {\n const rectEl = posElement.getBoundingClientRect(), chartPos = pointer.getChartPosition();\n return {\n x: (rectEl.left - chartPos.left) / chartPos.scaleX,\n y: (rectEl.top - chartPos.top) / chartPos.scaleY,\n width: rectEl.right / chartPos.scaleX -\n rectEl.left / chartPos.scaleX,\n height: rectEl.bottom / chartPos.scaleY -\n rectEl.top / chartPos.scaleY\n };\n }\n return { x: 0, y: 0, width: 1, height: 1 };\n }\n /**\n * Get an attribute value of a target\n */\n getTargetAttr(target, key) {\n if (target.element) {\n return target.element.getAttribute(key);\n }\n return target.getAttribute(key);\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default ProxyElement;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Proxy elements are used to shadow SVG elements in HTML for assistive\n * technology, such as screen readers or voice input software.\n *\n * The ProxyProvider keeps track of all proxy elements of the a11y module,\n * and updating their order and positioning.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Core/Globals.js';\nconst { doc } = H;\nimport U from '../Core/Utilities.js';\nconst { attr, css } = U;\nimport CU from './Utils/ChartUtilities.js';\nconst { unhideChartElementFromAT } = CU;\nimport DOMElementProvider from './Utils/DOMElementProvider.js';\nimport HU from './Utils/HTMLUtilities.js';\nconst { removeChildNodes } = HU;\nimport ProxyElement from './ProxyElement.js';\n/* *\n *\n * Class\n *\n * */\n/**\n * Keeps track of all proxy elements and proxy groups.\n *\n * @private\n * @class\n */\nclass ProxyProvider {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart) {\n this.chart = chart;\n this.domElementProvider = new DOMElementProvider();\n this.groups = {};\n this.groupOrder = [];\n this.beforeChartProxyPosContainer = this.createProxyPosContainer('before');\n this.afterChartProxyPosContainer = this.createProxyPosContainer('after');\n this.update();\n }\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable */\n /**\n * Add a new proxy element to a group, proxying a target control.\n */\n addProxyElement(groupKey, target, proxyElementType = 'button', attributes) {\n const group = this.groups[groupKey];\n if (!group) {\n throw new Error('ProxyProvider.addProxyElement: Invalid group key ' + groupKey);\n }\n const wrapperElementType = group.type === 'ul' || group.type === 'ol' ?\n 'li' : void 0, proxy = new ProxyElement(this.chart, target, proxyElementType, wrapperElementType, attributes);\n group.proxyContainerElement.appendChild(proxy.element);\n group.proxyElements.push(proxy);\n return proxy;\n }\n /**\n * Create a group that will contain proxy elements. The group order is\n * automatically updated according to the last group order keys.\n *\n * Returns the added group.\n */\n addGroup(groupKey, groupElementType = 'div', attributes) {\n const existingGroup = this.groups[groupKey];\n if (existingGroup) {\n return existingGroup.groupElement;\n }\n const proxyContainer = this.domElementProvider\n .createElement(groupElementType);\n // If we want to add a role to the group, and still use e.g.\n // a list group, we need a wrapper div around the proxyContainer.\n // Used for setting region role on legend.\n let groupElement;\n if (attributes && attributes.role && groupElementType !== 'div') {\n groupElement = this.domElementProvider.createElement('div');\n groupElement.appendChild(proxyContainer);\n }\n else {\n groupElement = proxyContainer;\n }\n groupElement.className = 'highcharts-a11y-proxy-group highcharts-a11y-proxy-group-' +\n groupKey.replace(/\\W/g, '-');\n this.groups[groupKey] = {\n proxyContainerElement: proxyContainer,\n groupElement,\n type: groupElementType,\n proxyElements: []\n };\n attr(groupElement, attributes || {});\n if (groupElementType === 'ul') {\n proxyContainer.setAttribute('role', 'list'); // Needed for webkit\n }\n // Add the group to the end by default, and perhaps then we\n // won't have to reorder the whole set of groups.\n this.afterChartProxyPosContainer.appendChild(groupElement);\n this.updateGroupOrder(this.groupOrder);\n return groupElement;\n }\n /**\n * Update HTML attributes of a group.\n */\n updateGroupAttrs(groupKey, attributes) {\n const group = this.groups[groupKey];\n if (!group) {\n throw new Error('ProxyProvider.updateGroupAttrs: Invalid group key ' + groupKey);\n }\n attr(group.groupElement, attributes);\n }\n /**\n * Reorder the proxy groups.\n *\n * The group key \"series\" refers to the chart's data points / element.\n * This is so that the keyboardNavigation.order option can be used to\n * determine the proxy group order.\n */\n updateGroupOrder(groupKeys) {\n // Store so that we can update order when a new group is created\n this.groupOrder = groupKeys.slice();\n // Don't unnecessarily reorder, because keyboard focus is lost\n if (this.isDOMOrderGroupOrder()) {\n return;\n }\n const seriesIx = groupKeys.indexOf('series');\n const beforeKeys = seriesIx > -1 ? groupKeys.slice(0, seriesIx) : groupKeys;\n const afterKeys = seriesIx > -1 ? groupKeys.slice(seriesIx + 1) : [];\n // Store focused element since it will be lost when reordering\n const activeElement = doc.activeElement;\n // Add groups to correct container\n ['before', 'after'].forEach((pos) => {\n const posContainer = this[pos === 'before' ?\n 'beforeChartProxyPosContainer' :\n 'afterChartProxyPosContainer'];\n const keys = pos === 'before' ? beforeKeys : afterKeys;\n removeChildNodes(posContainer);\n keys.forEach((groupKey) => {\n const group = this.groups[groupKey];\n if (group) {\n posContainer.appendChild(group.groupElement);\n }\n });\n });\n // Attempt to restore focus after reordering, but note that this may\n // cause screen readers re-announcing the button.\n if ((this.beforeChartProxyPosContainer.contains(activeElement) ||\n this.afterChartProxyPosContainer.contains(activeElement)) &&\n activeElement && activeElement.focus) {\n activeElement.focus();\n }\n }\n /**\n * Remove all proxy elements in a group\n */\n clearGroup(groupKey) {\n const group = this.groups[groupKey];\n if (!group) {\n throw new Error('ProxyProvider.clearGroup: Invalid group key ' + groupKey);\n }\n removeChildNodes(group.proxyContainerElement);\n }\n /**\n * Remove a group from the DOM and from the proxy provider's group list.\n * All child elements are removed.\n * If the group does not exist, nothing happens.\n */\n removeGroup(groupKey) {\n const group = this.groups[groupKey];\n if (group) {\n // Remove detached HTML elements to prevent memory leak (#20329).\n this.domElementProvider.removeElement(group.groupElement);\n // Sometimes groupElement is a wrapper around the proxyContainer, so\n // the real one proxyContainer needs to be removed also.\n if (group.groupElement !== group.proxyContainerElement) {\n this.domElementProvider.removeElement(group.proxyContainerElement);\n }\n delete this.groups[groupKey];\n }\n }\n /**\n * Update the position and order of all proxy groups and elements\n */\n update() {\n this.updatePosContainerPositions();\n this.updateGroupOrder(this.groupOrder);\n this.updateProxyElementPositions();\n }\n /**\n * Update all proxy element positions\n */\n updateProxyElementPositions() {\n Object.keys(this.groups).forEach(this.updateGroupProxyElementPositions.bind(this));\n }\n /**\n * Update a group's proxy elements' positions.\n * If the group does not exist, nothing happens.\n */\n updateGroupProxyElementPositions(groupKey) {\n const group = this.groups[groupKey];\n if (group) {\n group.proxyElements.forEach((el) => el.refreshPosition());\n }\n }\n /**\n * Remove all added elements\n */\n destroy() {\n this.domElementProvider.destroyCreatedElements();\n }\n // -------------------------- private ------------------------------------\n /**\n * Create and return a pos container element (the overall containers for\n * the proxy groups).\n */\n createProxyPosContainer(classNamePostfix) {\n const el = this.domElementProvider.createElement('div');\n el.setAttribute('aria-hidden', 'false');\n el.className = 'highcharts-a11y-proxy-container' + (classNamePostfix ? '-' + classNamePostfix : '');\n css(el, {\n top: '0',\n left: '0'\n });\n if (!this.chart.styledMode) {\n el.style.whiteSpace = 'nowrap';\n el.style.position = 'absolute';\n }\n return el;\n }\n /**\n * Get an array of group keys that corresponds to the current group order\n * in the DOM.\n */\n getCurrentGroupOrderInDOM() {\n const getGroupKeyFromElement = (el) => {\n const allGroups = Object.keys(this.groups);\n let i = allGroups.length;\n while (i--) {\n const groupKey = allGroups[i];\n const group = this.groups[groupKey];\n if (group && el === group.groupElement) {\n return groupKey;\n }\n }\n };\n const getChildrenGroupOrder = (el) => {\n const childrenOrder = [];\n const children = el.children;\n for (let i = 0; i < children.length; ++i) {\n const groupKey = getGroupKeyFromElement(children[i]);\n if (groupKey) {\n childrenOrder.push(groupKey);\n }\n }\n return childrenOrder;\n };\n const before = getChildrenGroupOrder(this.beforeChartProxyPosContainer);\n const after = getChildrenGroupOrder(this.afterChartProxyPosContainer);\n before.push('series');\n return before.concat(after);\n }\n /**\n * Check if the current DOM order matches the current group order, so that\n * a reordering/update is unnecessary.\n */\n isDOMOrderGroupOrder() {\n const domOrder = this.getCurrentGroupOrderInDOM();\n const groupOrderWithGroups = this.groupOrder.filter((x) => x === 'series' || !!this.groups[x]);\n let i = domOrder.length;\n if (i !== groupOrderWithGroups.length) {\n return false;\n }\n while (i--) {\n if (domOrder[i] !== groupOrderWithGroups[i]) {\n return false;\n }\n }\n return true;\n }\n /**\n * Update the DOM positions of the before/after proxy\n * positioning containers for the groups.\n */\n updatePosContainerPositions() {\n const chart = this.chart;\n // If exporting, don't add these containers to the DOM.\n if (chart.renderer.forExport) {\n return;\n }\n const rendererSVGEl = chart.renderer.box;\n chart.container.insertBefore(this.afterChartProxyPosContainer, rendererSVGEl.nextSibling);\n chart.container.insertBefore(this.beforeChartProxyPosContainer, rendererSVGEl);\n unhideChartElementFromAT(this.chart, this.afterChartProxyPosContainer);\n unhideChartElementFromAT(this.chart, this.beforeChartProxyPosContainer);\n }\n}\n/* *\n *\n * Export Default\n *\n * */\nexport default ProxyProvider;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component for the range selector.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AccessibilityComponent from '../AccessibilityComponent.js';\nimport Announcer from '../Utils/Announcer.js';\nimport ChartUtilities from '../Utils/ChartUtilities.js';\nconst { unhideChartElementFromAT, getAxisRangeDescription } = ChartUtilities;\nimport KeyboardNavigationHandler from '../KeyboardNavigationHandler.js';\nimport U from '../../Core/Utilities.js';\nconst { addEvent, attr } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Do we want date input navigation\n * @private\n */\nfunction shouldRunInputNavigation(chart) {\n return Boolean(chart.rangeSelector &&\n chart.rangeSelector.inputGroup &&\n chart.rangeSelector.inputGroup.element.style.visibility !== 'hidden' &&\n chart.options.rangeSelector.inputEnabled !== false &&\n chart.rangeSelector.minInput &&\n chart.rangeSelector.maxInput);\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * The RangeSelectorComponent class\n *\n * @private\n * @class\n * @name Highcharts.RangeSelectorComponent\n */\nclass RangeSelectorComponent extends AccessibilityComponent {\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Init the component\n * @private\n */\n init() {\n const chart = this.chart;\n this.announcer = new Announcer(chart, 'polite');\n }\n /**\n * Called on first render/updates to the chart, including options changes.\n */\n onChartUpdate() {\n const chart = this.chart, component = this, rangeSelector = chart.rangeSelector;\n if (!rangeSelector) {\n return;\n }\n this.updateSelectorVisibility();\n this.setDropdownAttrs();\n if (rangeSelector.buttons &&\n rangeSelector.buttons.length) {\n rangeSelector.buttons.forEach((button) => {\n component.setRangeButtonAttrs(button);\n });\n }\n // Make sure input boxes are accessible and focusable\n if (rangeSelector.maxInput && rangeSelector.minInput) {\n ['minInput', 'maxInput'].forEach(function (key, i) {\n const input = rangeSelector[key];\n if (input) {\n unhideChartElementFromAT(chart, input);\n component.setRangeInputAttrs(input, 'accessibility.rangeSelector.' + (i ? 'max' : 'min') +\n 'InputLabel');\n }\n });\n }\n }\n /**\n * Hide buttons from AT when showing dropdown, and vice versa.\n * @private\n */\n updateSelectorVisibility() {\n const chart = this.chart;\n const rangeSelector = chart.rangeSelector;\n const dropdown = (rangeSelector &&\n rangeSelector.dropdown);\n const buttons = (rangeSelector &&\n rangeSelector.buttons ||\n []);\n const hideFromAT = (el) => el.setAttribute('aria-hidden', true);\n if (rangeSelector &&\n rangeSelector.hasVisibleDropdown &&\n dropdown) {\n unhideChartElementFromAT(chart, dropdown);\n buttons.forEach((btn) => hideFromAT(btn.element));\n }\n else {\n if (dropdown) {\n hideFromAT(dropdown);\n }\n buttons.forEach((btn) => unhideChartElementFromAT(chart, btn.element));\n }\n }\n /**\n * Set accessibility related attributes on dropdown element.\n * @private\n */\n setDropdownAttrs() {\n const chart = this.chart;\n const dropdown = (chart.rangeSelector &&\n chart.rangeSelector.dropdown);\n if (dropdown) {\n const label = chart.langFormat('accessibility.rangeSelector.dropdownLabel', { rangeTitle: chart.options.lang.rangeSelectorZoom });\n dropdown.setAttribute('aria-label', label);\n dropdown.setAttribute('tabindex', -1);\n }\n }\n /**\n * Set attrs for a range button\n * @private\n */\n setRangeButtonAttrs(button) {\n attr(button.element, {\n tabindex: -1,\n role: 'button'\n });\n }\n /**\n * Set attrs for a date input\n * @private\n */\n setRangeInputAttrs(input, langKey) {\n const chart = this.chart;\n attr(input, {\n tabindex: -1,\n 'aria-label': chart.langFormat(langKey, { chart: chart })\n });\n }\n /**\n * Handle arrow key nav\n * @private\n */\n onButtonNavKbdArrowKey(keyboardNavigationHandler, keyCode) {\n const response = keyboardNavigationHandler.response, keys = this.keyCodes, chart = this.chart, wrapAround = chart.options.accessibility\n .keyboardNavigation.wrapAround, direction = (keyCode === keys.left || keyCode === keys.up) ? -1 : 1, didHighlight = chart.highlightRangeSelectorButton(chart.highlightedRangeSelectorItemIx + direction);\n if (!didHighlight) {\n if (wrapAround) {\n keyboardNavigationHandler.init(direction);\n return response.success;\n }\n return response[direction > 0 ? 'next' : 'prev'];\n }\n return response.success;\n }\n /**\n * Handle keyboard click\n * @private\n */\n onButtonNavKbdClick(keyboardNavigationHandler) {\n const response = keyboardNavigationHandler.response, chart = this.chart, wasDisabled = chart.oldRangeSelectorItemState === 3;\n if (!wasDisabled) {\n this.fakeClickEvent(chart.rangeSelector.buttons[chart.highlightedRangeSelectorItemIx].element);\n }\n return response.success;\n }\n /**\n * Called whenever a range selector button has been clicked, either by\n * mouse, touch, or kbd/voice/other.\n * @private\n */\n onAfterBtnClick() {\n const chart = this.chart;\n const axisRangeDescription = getAxisRangeDescription(chart.xAxis[0]);\n const announcement = chart.langFormat('accessibility.rangeSelector.clickButtonAnnouncement', { chart, axisRangeDescription });\n if (announcement) {\n this.announcer.announce(announcement);\n }\n }\n /**\n * Handle move between input elements with Tab key\n * @private\n */\n onInputKbdMove(direction) {\n const chart = this.chart;\n const rangeSel = chart.rangeSelector;\n const newIx = chart.highlightedInputRangeIx = (chart.highlightedInputRangeIx || 0) + direction;\n const newIxOutOfRange = newIx > 1 || newIx < 0;\n if (newIxOutOfRange) {\n if (chart.accessibility) {\n // Ignore focus\n chart.accessibility.keyboardNavigation.exiting = true;\n chart.accessibility.keyboardNavigation.tabindexContainer\n .focus();\n return chart.accessibility.keyboardNavigation.move(direction);\n }\n }\n else if (rangeSel) {\n const svgEl = rangeSel[newIx ? 'maxDateBox' : 'minDateBox'];\n const inputEl = rangeSel[newIx ? 'maxInput' : 'minInput'];\n if (svgEl && inputEl) {\n chart.setFocusToElement(svgEl, inputEl);\n }\n }\n return true;\n }\n /**\n * Init date input navigation\n * @private\n */\n onInputNavInit(direction) {\n const component = this;\n const chart = this.chart;\n const buttonIxToHighlight = direction > 0 ? 0 : 1;\n const rangeSel = chart.rangeSelector;\n const svgEl = (rangeSel &&\n rangeSel[buttonIxToHighlight ? 'maxDateBox' : 'minDateBox']);\n const minInput = (rangeSel && rangeSel.minInput);\n const maxInput = (rangeSel && rangeSel.maxInput);\n const inputEl = buttonIxToHighlight ? maxInput : minInput;\n chart.highlightedInputRangeIx = buttonIxToHighlight;\n if (svgEl && minInput && maxInput) {\n chart.setFocusToElement(svgEl, inputEl);\n // Tab-press with the input focused does not propagate to chart\n // automatically, so we manually catch and handle it when relevant.\n if (this.removeInputKeydownHandler) {\n this.removeInputKeydownHandler();\n }\n const keydownHandler = (e) => {\n const isTab = (e.which || e.keyCode) === this.keyCodes.tab;\n if (isTab &&\n component.onInputKbdMove(e.shiftKey ? -1 : 1)) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n const minRemover = addEvent(minInput, 'keydown', keydownHandler);\n const maxRemover = addEvent(maxInput, 'keydown', keydownHandler);\n this.removeInputKeydownHandler = () => {\n minRemover();\n maxRemover();\n };\n }\n }\n /**\n * Terminate date input nav\n * @private\n */\n onInputNavTerminate() {\n const rangeSel = (this.chart.rangeSelector || {});\n if (rangeSel.maxInput) {\n rangeSel.hideInput('max');\n }\n if (rangeSel.minInput) {\n rangeSel.hideInput('min');\n }\n if (this.removeInputKeydownHandler) {\n this.removeInputKeydownHandler();\n delete this.removeInputKeydownHandler;\n }\n }\n /**\n * Init range selector dropdown nav\n * @private\n */\n initDropdownNav() {\n const chart = this.chart;\n const rangeSelector = chart.rangeSelector;\n const dropdown = (rangeSelector && rangeSelector.dropdown);\n if (rangeSelector && dropdown) {\n chart.setFocusToElement(rangeSelector.buttonGroup, dropdown);\n if (this.removeDropdownKeydownHandler) {\n this.removeDropdownKeydownHandler();\n }\n // Tab-press with dropdown focused does not propagate to chart\n // automatically, so we manually catch and handle it when relevant.\n this.removeDropdownKeydownHandler = addEvent(dropdown, 'keydown', (e) => {\n const isTab = (e.which || e.keyCode) === this.keyCodes.tab, a11y = chart.accessibility;\n if (isTab) {\n e.preventDefault();\n e.stopPropagation();\n if (a11y) {\n a11y.keyboardNavigation.tabindexContainer.focus();\n a11y.keyboardNavigation.move(e.shiftKey ? -1 : 1);\n }\n }\n });\n }\n }\n /**\n * Get navigation for the range selector buttons.\n * @private\n * @return {Highcharts.KeyboardNavigationHandler} The module object.\n */\n getRangeSelectorButtonNavigation() {\n const chart = this.chart;\n const keys = this.keyCodes;\n const component = this;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [\n [\n [keys.left, keys.right, keys.up, keys.down],\n function (keyCode) {\n return component.onButtonNavKbdArrowKey(this, keyCode);\n }\n ],\n [\n [keys.enter, keys.space],\n function () {\n return component.onButtonNavKbdClick(this);\n }\n ]\n ],\n validate: function () {\n return !!(chart.rangeSelector &&\n chart.rangeSelector.buttons &&\n chart.rangeSelector.buttons.length);\n },\n init: function (direction) {\n const rangeSelector = chart.rangeSelector;\n if (rangeSelector && rangeSelector.hasVisibleDropdown) {\n component.initDropdownNav();\n }\n else if (rangeSelector) {\n const lastButtonIx = rangeSelector.buttons.length - 1;\n chart.highlightRangeSelectorButton(direction > 0 ? 0 : lastButtonIx);\n }\n },\n terminate: function () {\n if (component.removeDropdownKeydownHandler) {\n component.removeDropdownKeydownHandler();\n delete component.removeDropdownKeydownHandler;\n }\n }\n });\n }\n /**\n * Get navigation for the range selector input boxes.\n * @private\n * @return {Highcharts.KeyboardNavigationHandler}\n * The module object.\n */\n getRangeSelectorInputNavigation() {\n const chart = this.chart;\n const component = this;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [],\n validate: function () {\n return shouldRunInputNavigation(chart);\n },\n init: function (direction) {\n component.onInputNavInit(direction);\n },\n terminate: function () {\n component.onInputNavTerminate();\n }\n });\n }\n /**\n * Get keyboard navigation handlers for this component.\n * @return {Array}\n * List of module objects.\n */\n getKeyboardNavigation() {\n return [\n this.getRangeSelectorButtonNavigation(),\n this.getRangeSelectorInputNavigation()\n ];\n }\n /**\n * Remove component traces\n */\n destroy() {\n if (this.removeDropdownKeydownHandler) {\n this.removeDropdownKeydownHandler();\n }\n if (this.removeInputKeydownHandler) {\n this.removeInputKeydownHandler();\n }\n if (this.announcer) {\n this.announcer.destroy();\n }\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (RangeSelectorComponent) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Highlight range selector button by index.\n *\n * @private\n * @function Highcharts.Chart#highlightRangeSelectorButton\n */\n function chartHighlightRangeSelectorButton(ix) {\n const buttons = (this.rangeSelector &&\n this.rangeSelector.buttons ||\n []);\n const curHighlightedIx = this.highlightedRangeSelectorItemIx;\n const curSelectedIx = (this.rangeSelector &&\n this.rangeSelector.selected);\n // Deselect old\n if (typeof curHighlightedIx !== 'undefined' &&\n buttons[curHighlightedIx] &&\n curHighlightedIx !== curSelectedIx) {\n buttons[curHighlightedIx].setState(this.oldRangeSelectorItemState || 0);\n }\n // Select new\n this.highlightedRangeSelectorItemIx = ix;\n if (buttons[ix]) {\n this.setFocusToElement(buttons[ix].box, buttons[ix].element);\n if (ix !== curSelectedIx) {\n this.oldRangeSelectorItemState = buttons[ix].state;\n buttons[ix].setState(1);\n }\n return true;\n }\n return false;\n }\n /**\n * Build compositions\n * @private\n */\n function compose(ChartClass, RangeSelectorClass) {\n const chartProto = ChartClass.prototype;\n if (!chartProto.highlightRangeSelectorButton) {\n chartProto.highlightRangeSelectorButton = (chartHighlightRangeSelectorButton);\n addEvent(RangeSelectorClass, 'afterBtnClick', rangeSelectorAfterBtnClick);\n }\n }\n RangeSelectorComponent.compose = compose;\n /**\n * Range selector does not have destroy-setup for class instance events - so\n * we set it on the class and call the component from here.\n * @private\n */\n function rangeSelectorAfterBtnClick() {\n const a11y = this.chart.accessibility;\n if (a11y && a11y.components.rangeSelector) {\n return a11y.components.rangeSelector.onAfterBtnClick();\n }\n }\n})(RangeSelectorComponent || (RangeSelectorComponent = {}));\n/* *\n *\n * Export Default\n *\n * */\nexport default RangeSelectorComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Handle forcing series markers.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../../../Core/Globals.js';\nconst { composed } = H;\nimport U from '../../../Core/Utilities.js';\nconst { addEvent, merge, pushUnique } = U;\n/* *\n *\n * Composition\n *\n * */\nvar ForcedMarkersComposition;\n(function (ForcedMarkersComposition) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * @private\n */\n function compose(SeriesClass) {\n if (pushUnique(composed, 'A11y.FM')) {\n addEvent(SeriesClass, 'afterSetOptions', seriesOnAfterSetOptions);\n addEvent(SeriesClass, 'render', seriesOnRender);\n addEvent(SeriesClass, 'afterRender', seriesOnAfterRender);\n addEvent(SeriesClass, 'renderCanvas', seriesOnRenderCanvas);\n }\n }\n ForcedMarkersComposition.compose = compose;\n /**\n * @private\n */\n function forceZeroOpacityMarkerOptions(options) {\n merge(true, options, {\n marker: {\n enabled: true,\n states: {\n normal: {\n opacity: 0\n }\n }\n }\n });\n }\n /**\n * @private\n */\n function getPointMarkerOpacity(pointOptions) {\n return pointOptions.marker.states &&\n pointOptions.marker.states.normal &&\n pointOptions.marker.states.normal.opacity;\n }\n /**\n * @private\n */\n function handleForcePointMarkers(series) {\n let i = series.points.length;\n while (i--) {\n const point = series.points[i];\n const pointOptions = point.options;\n const hadForcedMarker = point.hasForcedA11yMarker;\n delete point.hasForcedA11yMarker;\n if (pointOptions.marker) {\n const isStillForcedMarker = hadForcedMarker &&\n getPointMarkerOpacity(pointOptions) === 0;\n if (pointOptions.marker.enabled && !isStillForcedMarker) {\n unforcePointMarkerOptions(pointOptions);\n point.hasForcedA11yMarker = false;\n }\n else if (pointOptions.marker.enabled === false) {\n forceZeroOpacityMarkerOptions(pointOptions);\n point.hasForcedA11yMarker = true;\n }\n }\n }\n }\n /**\n * @private\n */\n function hasIndividualPointMarkerOptions(series) {\n return !!(series._hasPointMarkers &&\n series.points &&\n series.points.length);\n }\n /**\n * @private\n */\n function isWithinDescriptionThreshold(series) {\n const a11yOptions = series.chart.options.accessibility;\n return series.points.length <\n a11yOptions.series.pointDescriptionEnabledThreshold ||\n a11yOptions.series\n .pointDescriptionEnabledThreshold === false;\n }\n /**\n * Process marker graphics after render\n * @private\n */\n function seriesOnAfterRender() {\n const series = this;\n // For styled mode the rendered graphic does not reflect the style\n // options, and we need to add/remove classes to achieve the same.\n if (series.chart.styledMode) {\n if (series.markerGroup) {\n series.markerGroup[series.a11yMarkersForced ? 'addClass' : 'removeClass']('highcharts-a11y-markers-hidden');\n }\n // Do we need to handle individual points?\n if (hasIndividualPointMarkerOptions(series)) {\n series.points.forEach((point) => {\n if (point.graphic) {\n point.graphic[point.hasForcedA11yMarker ?\n 'addClass' : 'removeClass']('highcharts-a11y-marker-hidden');\n point.graphic[point.hasForcedA11yMarker === false ?\n 'addClass' :\n 'removeClass']('highcharts-a11y-marker-visible');\n }\n });\n }\n }\n }\n /**\n * Keep track of options to reset markers to if no longer forced.\n * @private\n */\n function seriesOnAfterSetOptions(e) {\n this.resetA11yMarkerOptions = merge(e.options.marker || {}, this.userOptions.marker || {});\n }\n /**\n * Keep track of forcing markers.\n * @private\n */\n function seriesOnRender() {\n const series = this, options = series.options;\n if (shouldForceMarkers(series)) {\n if (options.marker && options.marker.enabled === false) {\n series.a11yMarkersForced = true;\n forceZeroOpacityMarkerOptions(series.options);\n }\n if (hasIndividualPointMarkerOptions(series)) {\n handleForcePointMarkers(series);\n }\n }\n else if (series.a11yMarkersForced) {\n delete series.a11yMarkersForced;\n unforceSeriesMarkerOptions(series);\n delete series.resetA11yMarkerOptions;\n }\n }\n /**\n * @private\n */\n function shouldForceMarkers(series) {\n const chart = series.chart, chartA11yEnabled = chart.options.accessibility.enabled, seriesA11yEnabled = (series.options.accessibility &&\n series.options.accessibility.enabled) !== false;\n return (chartA11yEnabled &&\n seriesA11yEnabled &&\n isWithinDescriptionThreshold(series));\n }\n /**\n * @private\n */\n function unforcePointMarkerOptions(pointOptions) {\n merge(true, pointOptions.marker, {\n states: {\n normal: {\n opacity: getPointMarkerOpacity(pointOptions) || 1\n }\n }\n });\n }\n /**\n * Reset markers to normal\n * @private\n */\n function unforceSeriesMarkerOptions(series) {\n const resetMarkerOptions = series.resetA11yMarkerOptions;\n if (resetMarkerOptions) {\n const originalOpacity = resetMarkerOptions.states &&\n resetMarkerOptions.states.normal &&\n resetMarkerOptions.states.normal.opacity;\n // Temporarily set the old marker options to enabled in order to\n // trigger destruction of the markers in Series.update.\n if (series.userOptions && series.userOptions.marker) {\n series.userOptions.marker.enabled = true;\n }\n series.update({\n marker: {\n enabled: resetMarkerOptions.enabled,\n states: {\n normal: { opacity: originalOpacity }\n }\n }\n });\n }\n }\n /**\n * Reset markers if series is boosted and had forced markers (#17320).\n * @private\n */\n function seriesOnRenderCanvas() {\n if (this.boosted && this.a11yMarkersForced) {\n merge(true, this.options, {\n marker: {\n enabled: false\n }\n });\n delete this.a11yMarkersForced;\n }\n }\n})(ForcedMarkersComposition || (ForcedMarkersComposition = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default ForcedMarkersComposition;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Handle keyboard navigation for series.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport Point from '../../../Core/Series/Point.js';\nimport Series from '../../../Core/Series/Series.js';\nimport SeriesRegistry from '../../../Core/Series/SeriesRegistry.js';\nconst { seriesTypes } = SeriesRegistry;\nimport H from '../../../Core/Globals.js';\nconst { doc } = H;\nimport U from '../../../Core/Utilities.js';\nconst { defined, fireEvent } = U;\nimport KeyboardNavigationHandler from '../../KeyboardNavigationHandler.js';\nimport EventProvider from '../../Utils/EventProvider.js';\nimport ChartUtilities from '../../Utils/ChartUtilities.js';\nconst { getPointFromXY, getSeriesFromName, scrollAxisToPoint } = ChartUtilities;\n/* *\n *\n * Functions\n *\n * */\n/* eslint-disable valid-jsdoc */\n/**\n * Get the index of a point in a series. This is needed when using e.g. data\n * grouping.\n *\n * @private\n * @function getPointIndex\n * @param {Highcharts.AccessibilityPoint} point\n * The point to find index of.\n * @return {number|undefined}\n * The index in the series.points array of the point.\n */\nfunction getPointIndex(point) {\n const index = point.index, points = point.series.points;\n let i = points.length;\n if (points[index] !== point) {\n while (i--) {\n if (points[i] === point) {\n return i;\n }\n }\n }\n else {\n return index;\n }\n}\n/**\n * Determine if series navigation should be skipped\n * @private\n */\nfunction isSkipSeries(series) {\n const a11yOptions = series.chart.options.accessibility, seriesNavOptions = a11yOptions.keyboardNavigation.seriesNavigation, seriesA11yOptions = series.options.accessibility || {}, seriesKbdNavOptions = seriesA11yOptions.keyboardNavigation;\n return seriesKbdNavOptions && seriesKbdNavOptions.enabled === false ||\n seriesA11yOptions.enabled === false ||\n series.options.enableMouseTracking === false || // #8440\n !series.visible ||\n // Skip all points in a series where pointNavigationEnabledThreshold is\n // reached\n (seriesNavOptions.pointNavigationEnabledThreshold &&\n +seriesNavOptions.pointNavigationEnabledThreshold <=\n series.points.length);\n}\n/**\n * Determine if navigation for a point should be skipped\n * @private\n */\nfunction isSkipPoint(point) {\n const a11yOptions = point.series.chart.options.accessibility;\n const pointA11yDisabled = (point.options.accessibility &&\n point.options.accessibility.enabled === false);\n return point.isNull &&\n a11yOptions.keyboardNavigation.seriesNavigation.skipNullPoints ||\n point.visible === false ||\n point.isInside === false ||\n pointA11yDisabled ||\n isSkipSeries(point.series);\n}\n/**\n * Get the first point that is not a skip point in this series.\n * @private\n */\nfunction getFirstValidPointInSeries(series) {\n const points = series.points || [], len = points.length;\n for (let i = 0; i < len; ++i) {\n if (!isSkipPoint(points[i])) {\n return points[i];\n }\n }\n return null;\n}\n/**\n * Get the first point that is not a skip point in this chart.\n * @private\n */\nfunction getFirstValidPointInChart(chart) {\n const series = chart.series || [], len = series.length;\n for (let i = 0; i < len; ++i) {\n if (!isSkipSeries(series[i])) {\n const point = getFirstValidPointInSeries(series[i]);\n if (point) {\n return point;\n }\n }\n }\n return null;\n}\n/**\n * @private\n */\nfunction highlightLastValidPointInChart(chart) {\n const numSeries = chart.series.length;\n let i = numSeries, res = false;\n while (i--) {\n chart.highlightedPoint = chart.series[i].points[chart.series[i].points.length - 1];\n // Highlight first valid point in the series will also\n // look backwards. It always starts from currently\n // highlighted point.\n res = chart.series[i].highlightNextValidPoint();\n if (res) {\n break;\n }\n }\n return res;\n}\n/**\n * After drilling down/up, we need to set focus to the first point for\n * screen readers and keyboard nav.\n * @private\n */\nfunction updateChartFocusAfterDrilling(chart) {\n const point = getFirstValidPointInChart(chart);\n if (point) {\n point.highlight(false); // Do not visually highlight\n }\n}\n/**\n * Highlight the first point in chart that is not a skip point\n * @private\n */\nfunction highlightFirstValidPointInChart(chart) {\n delete chart.highlightedPoint;\n const point = getFirstValidPointInChart(chart);\n return point ? point.highlight() : false;\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * @private\n * @class\n * @name Highcharts.SeriesKeyboardNavigation\n */\nclass SeriesKeyboardNavigation {\n /* *\n *\n * Constructor\n *\n * */\n constructor(chart, keyCodes) {\n this.keyCodes = keyCodes;\n this.chart = chart;\n }\n /* *\n *\n * Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * Init the keyboard navigation\n */\n init() {\n const keyboardNavigation = this, chart = this.chart, e = this.eventProvider = new EventProvider();\n e.addEvent(Series, 'destroy', function () {\n return keyboardNavigation.onSeriesDestroy(this);\n });\n e.addEvent(chart, 'afterApplyDrilldown', function () {\n updateChartFocusAfterDrilling(this);\n });\n e.addEvent(chart, 'drilldown', function (e) {\n const point = e.point, series = point.series;\n keyboardNavigation.lastDrilledDownPoint = {\n x: point.x,\n y: point.y,\n seriesName: series ? series.name : ''\n };\n });\n e.addEvent(chart, 'drillupall', function () {\n setTimeout(function () {\n keyboardNavigation.onDrillupAll();\n }, 10);\n });\n // Heatmaps et al. alter z-index in setState, causing elements\n // to lose focus\n e.addEvent(Point, 'afterSetState', function () {\n const point = this;\n const pointEl = point.graphic && point.graphic.element;\n const focusedElement = doc.activeElement;\n // VO brings focus with it to container, causing series nav to run.\n // If then navigating with virtual cursor, it is possible to leave\n // keyboard nav module state on the data points and still activate\n // proxy buttons.\n const focusedElClassName = (focusedElement && focusedElement.getAttribute('class'));\n const isProxyFocused = focusedElClassName &&\n focusedElClassName.indexOf('highcharts-a11y-proxy-element') > -1;\n if (chart.highlightedPoint === point &&\n focusedElement !== pointEl &&\n !isProxyFocused &&\n pointEl &&\n pointEl.focus) {\n pointEl.focus();\n }\n });\n }\n /**\n * After drillup we want to find the point that was drilled down to and\n * highlight it.\n * @private\n */\n onDrillupAll() {\n const last = this.lastDrilledDownPoint, chart = this.chart, series = last && getSeriesFromName(chart, last.seriesName);\n let point;\n if (last && series && defined(last.x) && defined(last.y)) {\n point = getPointFromXY(series, last.x, last.y);\n }\n point = point || getFirstValidPointInChart(chart);\n // Container focus can be lost on drillup due to deleted elements.\n if (chart.container) {\n chart.container.focus();\n }\n if (point && point.highlight) {\n point.highlight(false); // Do not visually highlight\n }\n }\n /**\n * @private\n */\n getKeyboardNavigationHandler() {\n const keyboardNavigation = this, keys = this.keyCodes, chart = this.chart, inverted = chart.inverted;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [\n [inverted ? [keys.up, keys.down] : [keys.left, keys.right],\n function (keyCode) {\n return keyboardNavigation.onKbdSideways(this, keyCode);\n }],\n [inverted ? [keys.left, keys.right] : [keys.up, keys.down],\n function (keyCode) {\n return keyboardNavigation.onKbdVertical(this, keyCode);\n }],\n [[keys.enter, keys.space],\n function (keyCode, event) {\n const point = chart.highlightedPoint;\n if (point) {\n event.point = point;\n fireEvent(point.series, 'click', event);\n point.firePointEvent('click');\n }\n return this.response.success;\n }],\n [[keys.home],\n function () {\n highlightFirstValidPointInChart(chart);\n return this.response.success;\n }],\n [[keys.end],\n function () {\n highlightLastValidPointInChart(chart);\n return this.response.success;\n }],\n [[keys.pageDown, keys.pageUp],\n function (keyCode) {\n chart.highlightAdjacentSeries(keyCode === keys.pageDown);\n return this.response.success;\n }]\n ],\n init: function () {\n return keyboardNavigation.onHandlerInit(this);\n },\n validate: function () {\n return !!getFirstValidPointInChart(chart);\n },\n terminate: function () {\n return keyboardNavigation.onHandlerTerminate();\n }\n });\n }\n /**\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} handler\n * @param {number} keyCode\n * @return {number}\n * response\n */\n onKbdSideways(handler, keyCode) {\n const keys = this.keyCodes, isNext = keyCode === keys.right || keyCode === keys.down;\n return this.attemptHighlightAdjacentPoint(handler, isNext);\n }\n /**\n * When keyboard navigation inits.\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} handler The handler object\n * @return {number}\n * response\n */\n onHandlerInit(handler) {\n const chart = this.chart, kbdNavOptions = chart.options.accessibility.keyboardNavigation;\n if (kbdNavOptions.seriesNavigation.rememberPointFocus &&\n chart.highlightedPoint) {\n chart.highlightedPoint.highlight();\n }\n else {\n highlightFirstValidPointInChart(chart);\n }\n return handler.response.success;\n }\n /**\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} handler\n * @param {number} keyCode\n * @return {number}\n * response\n */\n onKbdVertical(handler, keyCode) {\n const chart = this.chart, keys = this.keyCodes, isNext = keyCode === keys.down || keyCode === keys.right, navOptions = chart.options.accessibility.keyboardNavigation\n .seriesNavigation;\n // Handle serialized mode, act like left/right\n if (navOptions.mode && navOptions.mode === 'serialize') {\n return this.attemptHighlightAdjacentPoint(handler, isNext);\n }\n // Normal mode, move between series\n const highlightMethod = (chart.highlightedPoint &&\n chart.highlightedPoint.series.keyboardMoveVertical) ?\n 'highlightAdjacentPointVertical' :\n 'highlightAdjacentSeries';\n chart[highlightMethod](isNext);\n return handler.response.success;\n }\n /**\n * @private\n */\n onHandlerTerminate() {\n const chart = this.chart, kbdNavOptions = chart.options.accessibility.keyboardNavigation;\n if (chart.tooltip) {\n chart.tooltip.hide(0);\n }\n const hoverSeries = (chart.highlightedPoint && chart.highlightedPoint.series);\n if (hoverSeries && hoverSeries.onMouseOut) {\n hoverSeries.onMouseOut();\n }\n if (chart.highlightedPoint && chart.highlightedPoint.onMouseOut) {\n chart.highlightedPoint.onMouseOut();\n }\n if (!kbdNavOptions.seriesNavigation.rememberPointFocus) {\n delete chart.highlightedPoint;\n }\n }\n /**\n * Function that attempts to highlight next/prev point. Handles wrap around.\n * @private\n */\n attemptHighlightAdjacentPoint(handler, directionIsNext) {\n const chart = this.chart, wrapAround = chart.options.accessibility.keyboardNavigation\n .wrapAround, highlightSuccessful = chart.highlightAdjacentPoint(directionIsNext);\n if (!highlightSuccessful) {\n if (wrapAround && (directionIsNext ?\n highlightFirstValidPointInChart(chart) :\n highlightLastValidPointInChart(chart))) {\n return handler.response.success;\n }\n return handler.response[directionIsNext ? 'next' : 'prev'];\n }\n return handler.response.success;\n }\n /**\n * @private\n */\n onSeriesDestroy(series) {\n const chart = this.chart, currentHighlightedPointDestroyed = chart.highlightedPoint &&\n chart.highlightedPoint.series === series;\n if (currentHighlightedPointDestroyed) {\n delete chart.highlightedPoint;\n if (chart.focusElement) {\n chart.focusElement.removeFocusBorder();\n }\n }\n }\n /**\n * @private\n */\n destroy() {\n this.eventProvider.removeAddedEvents();\n }\n}\n/* *\n *\n * Class Namespace\n *\n * */\n(function (SeriesKeyboardNavigation) {\n /* *\n *\n * Declarations\n *\n * */\n /* *\n *\n * Functions\n *\n * */\n /**\n * Function to highlight next/previous point in chart.\n *\n * @private\n * @function Highcharts.Chart#highlightAdjacentPoint\n *\n * @param {boolean} next\n * Flag for the direction.\n *\n * @return {Highcharts.Point|boolean}\n * Returns highlighted point on success, false on failure (no adjacent point\n * to highlight in chosen direction).\n */\n function chartHighlightAdjacentPoint(next) {\n const chart = this, series = chart.series, curPoint = chart.highlightedPoint, curPointIndex = curPoint && getPointIndex(curPoint) || 0, curPoints = curPoint && curPoint.series.points || [], lastSeries = chart.series && chart.series[chart.series.length - 1], lastPoint = lastSeries &&\n lastSeries.points &&\n lastSeries.points[lastSeries.points.length - 1];\n let newSeries, newPoint;\n // If no points, return false\n if (!series[0] || !series[0].points) {\n return false;\n }\n if (!curPoint) {\n // No point is highlighted yet. Try first/last point depending on\n // move direction\n newPoint = next ? series[0].points[0] : lastPoint;\n }\n else {\n // We have a highlighted point. Grab next/prev point & series.\n newSeries = series[curPoint.series.index + (next ? 1 : -1)];\n newPoint = curPoints[curPointIndex + (next ? 1 : -1)];\n if (!newPoint && newSeries) {\n // Done with this series, try next one\n newPoint = newSeries.points[next ? 0 : newSeries.points.length - 1];\n }\n // If there is no adjacent point, we return false\n if (!newPoint) {\n return false;\n }\n }\n // Recursively skip points\n if (isSkipPoint(newPoint)) {\n // If we skip this whole series, move to the end of the series\n // before we recurse, just to optimize\n newSeries = newPoint.series;\n if (isSkipSeries(newSeries)) {\n chart.highlightedPoint = next ?\n newSeries.points[newSeries.points.length - 1] :\n newSeries.points[0];\n }\n else {\n // Otherwise, just move one point\n chart.highlightedPoint = newPoint;\n }\n // Retry\n return chart.highlightAdjacentPoint(next);\n }\n // There is an adjacent point, highlight it\n return newPoint.highlight();\n }\n /**\n * Highlight the closest point vertically.\n * @private\n */\n function chartHighlightAdjacentPointVertical(down) {\n const curPoint = this.highlightedPoint;\n let minDistance = Infinity, bestPoint;\n if (!defined(curPoint.plotX) || !defined(curPoint.plotY)) {\n return false;\n }\n this.series.forEach((series) => {\n if (isSkipSeries(series)) {\n return;\n }\n series.points.forEach((point) => {\n if (!defined(point.plotY) || !defined(point.plotX) ||\n point === curPoint) {\n return;\n }\n let yDistance = point.plotY - curPoint.plotY;\n const width = Math.abs(point.plotX - curPoint.plotX), distance = Math.abs(yDistance) * Math.abs(yDistance) +\n width * width * 4; // Weigh horizontal distance highly\n // Reverse distance number if axis is reversed\n if (series.yAxis && series.yAxis.reversed) {\n yDistance *= -1;\n }\n if (yDistance <= 0 && down || yDistance >= 0 && !down ||\n distance < 5 || // Points in same spot => infinite loop\n isSkipPoint(point)) {\n return;\n }\n if (distance < minDistance) {\n minDistance = distance;\n bestPoint = point;\n }\n });\n });\n return bestPoint ? bestPoint.highlight() : false;\n }\n /**\n * Highlight next/previous series in chart. Returns false if no adjacent\n * series in the direction, otherwise returns new highlighted point.\n * @private\n */\n function chartHighlightAdjacentSeries(down) {\n const chart = this, curPoint = chart.highlightedPoint, lastSeries = chart.series && chart.series[chart.series.length - 1], lastPoint = lastSeries && lastSeries.points &&\n lastSeries.points[lastSeries.points.length - 1];\n let newSeries, newPoint, adjacentNewPoint;\n // If no point is highlighted, highlight the first/last point\n if (!chart.highlightedPoint) {\n newSeries = down ? (chart.series && chart.series[0]) : lastSeries;\n newPoint = down ?\n (newSeries && newSeries.points && newSeries.points[0]) :\n lastPoint;\n return newPoint ? newPoint.highlight() : false;\n }\n newSeries = (chart.series[curPoint.series.index + (down ? -1 : 1)]);\n if (!newSeries) {\n return false;\n }\n // We have a new series in this direction, find the right point\n // Weigh xDistance as counting much higher than Y distance\n newPoint = getClosestPoint(curPoint, newSeries, 4);\n if (!newPoint) {\n return false;\n }\n // New series and point exists, but we might want to skip it\n if (isSkipSeries(newSeries)) {\n // Skip the series\n newPoint.highlight();\n // Try recurse\n adjacentNewPoint = chart.highlightAdjacentSeries(down);\n if (!adjacentNewPoint) {\n // Recurse failed\n curPoint.highlight();\n return false;\n }\n // Recurse succeeded\n return adjacentNewPoint;\n }\n // Highlight the new point or any first valid point back or forwards\n // from it\n newPoint.highlight();\n return newPoint.series.highlightNextValidPoint();\n }\n /**\n * @private\n */\n function compose(ChartClass, PointClass, SeriesClass) {\n const chartProto = ChartClass.prototype, pointProto = PointClass.prototype, seriesProto = SeriesClass.prototype;\n if (!chartProto.highlightAdjacentPoint) {\n chartProto.highlightAdjacentPoint = chartHighlightAdjacentPoint;\n chartProto.highlightAdjacentPointVertical = (chartHighlightAdjacentPointVertical);\n chartProto.highlightAdjacentSeries = chartHighlightAdjacentSeries;\n pointProto.highlight = pointHighlight;\n /**\n * Set for which series types it makes sense to move to the closest\n * point with up/down arrows, and which series types should just\n * move to next series.\n * @private\n */\n seriesProto.keyboardMoveVertical = true;\n [\n 'column',\n 'gantt',\n 'pie'\n ].forEach((type) => {\n if (seriesTypes[type]) {\n seriesTypes[type].prototype.keyboardMoveVertical = false;\n }\n });\n seriesProto.highlightNextValidPoint = (seriesHighlightNextValidPoint);\n }\n }\n SeriesKeyboardNavigation.compose = compose;\n /**\n * Get the point in a series that is closest (in pixel distance) to a\n * reference point. Optionally supply weight factors for x and y directions.\n * @private\n */\n function getClosestPoint(point, series, xWeight, yWeight) {\n let minDistance = Infinity, dPoint, minIx, distance, i = series.points.length;\n const hasUndefinedPosition = (point) => (!(defined(point.plotX) && defined(point.plotY)));\n if (hasUndefinedPosition(point)) {\n return;\n }\n while (i--) {\n dPoint = series.points[i];\n if (hasUndefinedPosition(dPoint)) {\n continue;\n }\n distance = (point.plotX - dPoint.plotX) *\n (point.plotX - dPoint.plotX) *\n (xWeight || 1) +\n (point.plotY - dPoint.plotY) *\n (point.plotY - dPoint.plotY) *\n (yWeight || 1);\n if (distance < minDistance) {\n minDistance = distance;\n minIx = i;\n }\n }\n return defined(minIx) ? series.points[minIx] : void 0;\n }\n /**\n * Highlights a point (show tooltip, display hover state, focus element).\n *\n * @private\n * @function Highcharts.Point#highlight\n *\n * @return {Highcharts.Point}\n * This highlighted point.\n */\n function pointHighlight(highlightVisually = true) {\n const chart = this.series.chart, tooltipElement = chart.tooltip?.label?.element;\n if (!this.isNull && highlightVisually) {\n this.onMouseOver(); // Show the hover marker and tooltip\n }\n else {\n if (chart.tooltip) {\n chart.tooltip.hide(0);\n }\n // Do not call blur on the element, as it messes up the focus of the\n // div element of the chart\n }\n scrollAxisToPoint(this);\n // We focus only after calling onMouseOver because the state change can\n // change z-index and mess up the element.\n if (this.graphic) {\n chart.setFocusToElement(this.graphic);\n if (!highlightVisually && chart.focusElement) {\n chart.focusElement.removeFocusBorder();\n }\n }\n chart.highlightedPoint = this;\n // Get position of the tooltip.\n const tooltipTop = tooltipElement?.getBoundingClientRect().top;\n if (tooltipElement && tooltipTop && tooltipTop < 0) {\n // Calculate scroll position.\n const scrollTop = window.scrollY, newScrollTop = scrollTop + tooltipTop;\n // Scroll window to new position.\n window.scrollTo({\n behavior: 'smooth',\n top: newScrollTop\n });\n }\n return this;\n }\n /**\n * Highlight first valid point in a series. Returns the point if\n * successfully highlighted, otherwise false. If there is a highlighted\n * point in the series, use that as starting point.\n *\n * @private\n * @function Highcharts.Series#highlightNextValidPoint\n */\n function seriesHighlightNextValidPoint() {\n const curPoint = this.chart.highlightedPoint, start = (curPoint && curPoint.series) === this ?\n getPointIndex(curPoint) :\n 0, points = this.points, len = points.length;\n if (points && len) {\n for (let i = start; i < len; ++i) {\n if (!isSkipPoint(points[i])) {\n return points[i].highlight();\n }\n }\n for (let j = start; j >= 0; --j) {\n if (!isSkipPoint(points[j])) {\n return points[j].highlight();\n }\n }\n }\n return false;\n }\n})(SeriesKeyboardNavigation || (SeriesKeyboardNavigation = {}));\n/* *\n *\n * Default Export\n *\n * */\nexport default SeriesKeyboardNavigation;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component for series and points.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AccessibilityComponent from '../../AccessibilityComponent.js';\nimport ChartUtilities from '../../Utils/ChartUtilities.js';\nconst { hideSeriesFromAT } = ChartUtilities;\nimport ForcedMarkers from './ForcedMarkers.js';\nimport NewDataAnnouncer from './NewDataAnnouncer.js';\nimport SeriesDescriber from './SeriesDescriber.js';\nconst { describeSeries } = SeriesDescriber;\nimport SeriesKeyboardNavigation from './SeriesKeyboardNavigation.js';\n/* *\n *\n * Class\n *\n * */\n/**\n * The SeriesComponent class\n *\n * @private\n * @class\n * @name Highcharts.SeriesComponent\n */\nclass SeriesComponent extends AccessibilityComponent {\n /* *\n *\n * Static Functions\n *\n * */\n /* eslint-disable valid-jsdoc */\n /**\n * @private\n */\n static compose(ChartClass, PointClass, SeriesClass) {\n NewDataAnnouncer.compose(SeriesClass);\n ForcedMarkers.compose(SeriesClass);\n SeriesKeyboardNavigation.compose(ChartClass, PointClass, SeriesClass);\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Init the component.\n */\n init() {\n this.newDataAnnouncer = new NewDataAnnouncer(this.chart);\n this.newDataAnnouncer.init();\n this.keyboardNavigation = new SeriesKeyboardNavigation(this.chart, this.keyCodes);\n this.keyboardNavigation.init();\n this.hideTooltipFromATWhenShown();\n this.hideSeriesLabelsFromATWhenShown();\n }\n /**\n * @private\n */\n hideTooltipFromATWhenShown() {\n const component = this;\n if (this.chart.tooltip) {\n this.addEvent(this.chart.tooltip.constructor, 'refresh', function () {\n if (this.chart === component.chart &&\n this.label &&\n this.label.element) {\n this.label.element.setAttribute('aria-hidden', true);\n }\n });\n }\n }\n /**\n * @private\n */\n hideSeriesLabelsFromATWhenShown() {\n this.addEvent(this.chart, 'afterDrawSeriesLabels', function () {\n this.series.forEach(function (series) {\n if (series.labelBySeries) {\n series.labelBySeries.attr('aria-hidden', true);\n }\n });\n });\n }\n /**\n * Called on chart render. It is necessary to do this for render in case\n * markers change on zoom/pixel density.\n */\n onChartRender() {\n const chart = this.chart;\n chart.series.forEach(function (series) {\n const shouldDescribeSeries = (series.options.accessibility &&\n series.options.accessibility.enabled) !== false &&\n series.visible && series.data.length !== 0;\n if (shouldDescribeSeries) {\n describeSeries(series);\n }\n else {\n hideSeriesFromAT(series);\n }\n });\n }\n /**\n * Get keyboard navigation handler for this component.\n * @private\n */\n getKeyboardNavigation() {\n return this.keyboardNavigation.getKeyboardNavigationHandler();\n }\n /**\n * Remove traces\n * @private\n */\n destroy() {\n this.newDataAnnouncer.destroy();\n this.keyboardNavigation.destroy();\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default SeriesComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Accessibility component for chart zoom.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport AccessibilityComponent from '../AccessibilityComponent.js';\nimport CU from '../Utils/ChartUtilities.js';\nconst { unhideChartElementFromAT } = CU;\nimport HU from '../Utils/HTMLUtilities.js';\nconst { getFakeMouseEvent } = HU;\nimport KeyboardNavigationHandler from '../KeyboardNavigationHandler.js';\nimport U from '../../Core/Utilities.js';\nconst { attr, pick } = U;\n/* *\n *\n * Functions\n *\n * */\n/**\n * @private\n */\nfunction chartHasMapZoom(chart) {\n return !!((chart.mapView) &&\n chart.mapNavigation &&\n chart.mapNavigation.navButtons.length);\n}\n/* *\n *\n * Class\n *\n * */\n/**\n * The ZoomComponent class\n *\n * @private\n * @class\n * @name Highcharts.ZoomComponent\n */\nclass ZoomComponent extends AccessibilityComponent {\n constructor() {\n /* *\n *\n * Properties\n *\n * */\n super(...arguments);\n this.focusedMapNavButtonIx = -1;\n }\n /* *\n *\n * Functions\n *\n * */\n /**\n * Initialize the component\n */\n init() {\n const component = this, chart = this.chart;\n this.proxyProvider.addGroup('zoom', 'div');\n [\n 'afterShowResetZoom', 'afterApplyDrilldown', 'drillupall'\n ].forEach((eventType) => {\n component.addEvent(chart, eventType, function () {\n component.updateProxyOverlays();\n });\n });\n }\n /**\n * Called when chart is updated\n */\n onChartUpdate() {\n const chart = this.chart, component = this;\n // Make map zoom buttons accessible\n if (chart.mapNavigation) {\n chart.mapNavigation.navButtons.forEach((button, i) => {\n unhideChartElementFromAT(chart, button.element);\n component.setMapNavButtonAttrs(button.element, 'accessibility.zoom.mapZoom' + (i ? 'Out' : 'In'));\n });\n }\n }\n /**\n * @private\n * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} button\n * @param {string} labelFormatKey\n */\n setMapNavButtonAttrs(button, labelFormatKey) {\n const chart = this.chart, label = chart.langFormat(labelFormatKey, { chart: chart });\n attr(button, {\n tabindex: -1,\n role: 'button',\n 'aria-label': label\n });\n }\n /**\n * Update the proxy overlays on every new render to ensure positions are\n * correct.\n */\n onChartRender() {\n this.updateProxyOverlays();\n }\n /**\n * Update proxy overlays, recreating the buttons.\n */\n updateProxyOverlays() {\n const chart = this.chart;\n // Always start with a clean slate\n this.proxyProvider.clearGroup('zoom');\n if (chart.resetZoomButton) {\n this.createZoomProxyButton(chart.resetZoomButton, 'resetZoomProxyButton', chart.langFormat('accessibility.zoom.resetZoomButton', { chart: chart }));\n }\n if (chart.drillUpButton &&\n chart.breadcrumbs &&\n chart.breadcrumbs.list) {\n const lastBreadcrumb = chart.breadcrumbs.list[chart.breadcrumbs.list.length - 1];\n this.createZoomProxyButton(chart.drillUpButton, 'drillUpProxyButton', chart.langFormat('accessibility.drillUpButton', {\n chart: chart,\n buttonText: chart.breadcrumbs.getButtonText(lastBreadcrumb)\n }));\n }\n }\n /**\n * @private\n * @param {Highcharts.SVGElement} buttonEl\n * @param {string} buttonProp\n * @param {string} label\n */\n createZoomProxyButton(buttonEl, buttonProp, label) {\n this[buttonProp] = this.proxyProvider.addProxyElement('zoom', {\n click: buttonEl\n }, 'button', {\n 'aria-label': label,\n tabindex: -1\n });\n }\n /**\n * Get keyboard navigation handler for map zoom.\n * @private\n * @return {Highcharts.KeyboardNavigationHandler} The module object\n */\n getMapZoomNavigation() {\n const keys = this.keyCodes, chart = this.chart, component = this;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [\n [\n [keys.up, keys.down, keys.left, keys.right],\n function (keyCode) {\n return component.onMapKbdArrow(this, keyCode);\n }\n ],\n [\n [keys.tab],\n function (_keyCode, e) {\n return component.onMapKbdTab(this, e);\n }\n ],\n [\n [keys.space, keys.enter],\n function () {\n return component.onMapKbdClick(this);\n }\n ]\n ],\n validate: function () {\n return chartHasMapZoom(chart);\n },\n init: function (direction) {\n return component.onMapNavInit(direction);\n }\n });\n }\n /**\n * Arrow key panning for maps.\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler The handler context.\n * @param {number} keyCode Key pressed.\n * @return {number} Response code\n */\n onMapKbdArrow(keyboardNavigationHandler, keyCode) {\n const chart = this.chart, keys = this.keyCodes, target = chart.container, isY = keyCode === keys.up || keyCode === keys.down, stepDirection = (keyCode === keys.left || keyCode === keys.up) ?\n 1 : -1, granularity = 10, diff = (isY ? chart.plotHeight : chart.plotWidth) /\n granularity * stepDirection, \n // Randomize since same mousedown coords twice is ignored in MapView\n r = Math.random() * 10, startPos = {\n x: target.offsetLeft + chart.plotLeft + chart.plotWidth / 2 + r,\n y: target.offsetTop + chart.plotTop + chart.plotHeight / 2 + r\n }, endPos = isY ? { x: startPos.x, y: startPos.y + diff } :\n { x: startPos.x + diff, y: startPos.y };\n [\n getFakeMouseEvent('mousedown', startPos),\n getFakeMouseEvent('mousemove', endPos),\n getFakeMouseEvent('mouseup', endPos)\n ].forEach((e) => target.dispatchEvent(e));\n return keyboardNavigationHandler.response.success;\n }\n /**\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler\n * @param {global.KeyboardEvent} event\n * @return {number} Response code\n */\n onMapKbdTab(keyboardNavigationHandler, event) {\n const chart = this.chart;\n const response = keyboardNavigationHandler.response;\n const isBackwards = event.shiftKey;\n const isMoveOutOfRange = isBackwards && !this.focusedMapNavButtonIx ||\n !isBackwards && this.focusedMapNavButtonIx;\n // Deselect old\n chart.mapNavigation.navButtons[this.focusedMapNavButtonIx].setState(0);\n if (isMoveOutOfRange) {\n if (chart.mapView) {\n chart.mapView.zoomBy(); // Reset zoom\n }\n return response[isBackwards ? 'prev' : 'next'];\n }\n // Select other button\n this.focusedMapNavButtonIx += isBackwards ? -1 : 1;\n const button = chart.mapNavigation.navButtons[this.focusedMapNavButtonIx];\n chart.setFocusToElement(button.box, button.element);\n button.setState(2);\n return response.success;\n }\n /**\n * Called on map button click.\n * @private\n * @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler The handler context object\n * @return {number} Response code\n */\n onMapKbdClick(keyboardNavigationHandler) {\n const el = this.chart.mapNavigation.navButtons[this.focusedMapNavButtonIx].element;\n this.fakeClickEvent(el);\n return keyboardNavigationHandler.response.success;\n }\n /**\n * @private\n * @param {number} direction\n */\n onMapNavInit(direction) {\n const chart = this.chart, zoomIn = chart.mapNavigation.navButtons[0], zoomOut = chart.mapNavigation.navButtons[1], initialButton = direction > 0 ? zoomIn : zoomOut;\n chart.setFocusToElement(initialButton.box, initialButton.element);\n initialButton.setState(2);\n this.focusedMapNavButtonIx = direction > 0 ? 0 : 1;\n }\n /**\n * Get keyboard navigation handler for a simple chart button. Provide the\n * button reference for the chart, and a function to call on click.\n *\n * @private\n * @param {string} buttonProp The property on chart referencing the button.\n * @return {Highcharts.KeyboardNavigationHandler} The module object\n */\n simpleButtonNavigation(buttonProp, proxyProp, onClick) {\n const keys = this.keyCodes, component = this, chart = this.chart;\n return new KeyboardNavigationHandler(chart, {\n keyCodeMap: [\n [\n [keys.tab, keys.up, keys.down, keys.left, keys.right],\n function (keyCode, e) {\n const isBackwards = (keyCode === keys.tab && e.shiftKey ||\n keyCode === keys.left ||\n keyCode === keys.up);\n // Arrow/tab => just move\n return this.response[isBackwards ? 'prev' : 'next'];\n }\n ],\n [\n [keys.space, keys.enter],\n function () {\n const res = onClick(this, chart);\n return pick(res, this.response.success);\n }\n ]\n ],\n validate: function () {\n const hasButton = (chart[buttonProp] &&\n chart[buttonProp].box &&\n component[proxyProp].innerElement);\n return hasButton;\n },\n init: function () {\n chart.setFocusToElement(chart[buttonProp].box, component[proxyProp].innerElement);\n }\n });\n }\n /**\n * Get keyboard navigation handlers for this component.\n * @return {Array}\n * List of module objects\n */\n getKeyboardNavigation() {\n return [\n this.simpleButtonNavigation('resetZoomButton', 'resetZoomProxyButton', function (_handler, chart) {\n chart.zoomOut();\n }),\n this.simpleButtonNavigation('drillUpButton', 'drillUpProxyButton', function (handler, chart) {\n chart.drillUp();\n return handler.response.prev;\n }),\n this.getMapZoomNavigation()\n ];\n }\n}\n/* *\n *\n * Default Export\n *\n * */\nexport default ZoomComponent;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Handling for Windows High Contrast Mode.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nimport H from '../Core/Globals.js';\nconst { doc, isMS, win } = H;\n/* *\n *\n * Functions\n *\n * */\n/**\n * Detect WHCM in the browser.\n *\n * @function Highcharts#isHighContrastModeActive\n * @private\n * @return {boolean} Returns true if the browser is in High Contrast mode.\n */\nfunction isHighContrastModeActive() {\n // Use media query on Edge, but not on IE\n const isEdge = /(Edg)/.test(win.navigator.userAgent);\n if (win.matchMedia && isEdge) {\n return win.matchMedia('(-ms-high-contrast: active)').matches;\n }\n // Test BG image for IE\n if (isMS && win.getComputedStyle) {\n const testDiv = doc.createElement('div');\n const imageSrc = 'data:image/gif;base64,' +\n 'R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';\n testDiv.style.backgroundImage = `url(${imageSrc})`; // #13071\n doc.body.appendChild(testDiv);\n const bi = (testDiv.currentStyle ||\n win.getComputedStyle(testDiv)).backgroundImage;\n doc.body.removeChild(testDiv);\n return bi === 'none';\n }\n // Other browsers use the forced-colors standard\n return win.matchMedia && win.matchMedia('(forced-colors: active)').matches;\n}\n/**\n * Force high contrast theme for the chart. The default theme is defined in\n * a separate file.\n *\n * @function Highcharts#setHighContrastTheme\n * @private\n * @param {Highcharts.AccessibilityChart} chart The chart to set the theme of.\n * @return {void}\n */\nfunction setHighContrastTheme(chart) {\n // We might want to add additional functionality here in the future for\n // storing the old state so that we can reset the theme if HC mode is\n // disabled. For now, the user will have to reload the page.\n chart.highContrastModeActive = true;\n // Apply theme to chart\n const theme = (chart.options.accessibility.highContrastTheme);\n chart.update(theme, false);\n const hasCustomColors = theme.colors?.length > 1;\n // Force series colors (plotOptions is not enough)\n chart.series.forEach(function (s) {\n const plotOpts = theme.plotOptions[s.type] || {};\n const fillColor = hasCustomColors && s.colorIndex !== void 0 ?\n theme.colors[s.colorIndex] :\n plotOpts.color || 'window';\n const seriesOptions = {\n color: plotOpts.color || 'windowText',\n colors: hasCustomColors ?\n theme.colors : [plotOpts.color || 'windowText'],\n borderColor: plotOpts.borderColor || 'window',\n fillColor\n };\n s.update(seriesOptions, false);\n if (s.points) {\n // Force point colors if existing\n s.points.forEach(function (p) {\n if (p.options && p.options.color) {\n p.update({\n color: plotOpts.color || 'windowText',\n borderColor: plotOpts.borderColor || 'window'\n }, false);\n }\n });\n }\n });\n // The redraw for each series and after is required for 3D pie\n // (workaround)\n chart.redraw();\n}\n/* *\n *\n * Default Export\n *\n * */\nconst whcm = {\n isHighContrastModeActive,\n setHighContrastTheme\n};\nexport default whcm;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Default theme for Windows High Contrast Mode.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\nconst theme = {\n chart: {\n backgroundColor: 'window'\n },\n title: {\n style: {\n color: 'windowText'\n }\n },\n subtitle: {\n style: {\n color: 'windowText'\n }\n },\n colorAxis: {\n minColor: 'windowText',\n maxColor: 'windowText',\n stops: [],\n dataClasses: []\n },\n colors: ['windowText'],\n xAxis: {\n gridLineColor: 'windowText',\n labels: {\n style: {\n color: 'windowText'\n }\n },\n lineColor: 'windowText',\n minorGridLineColor: 'windowText',\n tickColor: 'windowText',\n title: {\n style: {\n color: 'windowText'\n }\n }\n },\n yAxis: {\n gridLineColor: 'windowText',\n labels: {\n style: {\n color: 'windowText'\n }\n },\n lineColor: 'windowText',\n minorGridLineColor: 'windowText',\n tickColor: 'windowText',\n title: {\n style: {\n color: 'windowText'\n }\n }\n },\n tooltip: {\n backgroundColor: 'window',\n borderColor: 'windowText',\n style: {\n color: 'windowText'\n }\n },\n plotOptions: {\n series: {\n lineColor: 'windowText',\n fillColor: 'window',\n borderColor: 'windowText',\n edgeColor: 'windowText',\n borderWidth: 1,\n dataLabels: {\n connectorColor: 'windowText',\n color: 'windowText',\n style: {\n color: 'windowText',\n textOutline: 'none'\n }\n },\n marker: {\n lineColor: 'windowText',\n fillColor: 'windowText'\n }\n },\n pie: {\n color: 'window',\n colors: ['window'],\n borderColor: 'windowText',\n borderWidth: 1\n },\n boxplot: {\n fillColor: 'window'\n },\n candlestick: {\n lineColor: 'windowText',\n fillColor: 'window'\n },\n errorbar: {\n fillColor: 'window'\n }\n },\n legend: {\n backgroundColor: 'window',\n itemStyle: {\n color: 'windowText'\n },\n itemHoverStyle: {\n color: 'windowText'\n },\n itemHiddenStyle: {\n color: '#555'\n },\n title: {\n style: {\n color: 'windowText'\n }\n }\n },\n credits: {\n style: {\n color: 'windowText'\n }\n },\n drilldown: {\n activeAxisLabelStyle: {\n color: 'windowText'\n },\n activeDataLabelStyle: {\n color: 'windowText'\n }\n },\n navigation: {\n buttonOptions: {\n symbolStroke: 'windowText',\n theme: {\n fill: 'window'\n }\n }\n },\n rangeSelector: {\n buttonTheme: {\n fill: 'window',\n stroke: 'windowText',\n style: {\n color: 'windowText'\n },\n states: {\n hover: {\n fill: 'window',\n stroke: 'windowText',\n style: {\n color: 'windowText'\n }\n },\n select: {\n fill: '#444',\n stroke: 'windowText',\n style: {\n color: 'windowText'\n }\n }\n }\n },\n inputBoxBorderColor: 'windowText',\n inputStyle: {\n backgroundColor: 'window',\n color: 'windowText'\n },\n labelStyle: {\n color: 'windowText'\n }\n },\n navigator: {\n handles: {\n backgroundColor: 'window',\n borderColor: 'windowText'\n },\n outlineColor: 'windowText',\n maskFill: 'transparent',\n series: {\n color: 'windowText',\n lineColor: 'windowText'\n },\n xAxis: {\n gridLineColor: 'windowText'\n }\n },\n scrollbar: {\n barBackgroundColor: '#444',\n barBorderColor: 'windowText',\n buttonArrowColor: 'windowText',\n buttonBackgroundColor: 'window',\n buttonBorderColor: 'windowText',\n rifleColor: 'windowText',\n trackBackgroundColor: 'window',\n trackBorderColor: 'windowText'\n }\n};\n/* *\n *\n * Default Export\n *\n * */\nexport default theme;\n", "/* *\n *\n * (c) 2009-2024 \u00D8ystein Moseng\n *\n * Default options for accessibility.\n *\n * License: www.highcharts.com/license\n *\n * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!\n *\n * */\n'use strict';\n/* *\n *\n * API Options\n *\n * */\n/**\n * Formatter callback for the accessibility announcement.\n *\n * @callback Highcharts.AccessibilityAnnouncementFormatter\n *\n * @param {Array} updatedSeries\n * Array of all series that received updates. If an announcement is already\n * queued, the series that received updates for that announcement are also\n * included in this array.\n *\n * @param {Highcharts.Series} [addedSeries]\n * This is provided if {@link Highcharts.Chart#addSeries} was called, and there\n * is a new series. In that case, this argument is a reference to the new\n * series.\n *\n * @param {Highcharts.Point} [addedPoint]\n * This is provided if {@link Highcharts.Series#addPoint} was called, and there\n * is a new point. In that case, this argument is a reference to the new point.\n *\n * @return {false|string}\n * The function should return a string with the text to announce to the user.\n * Return empty string to not announce anything. Return `false` to use the\n * default announcement format.\n */\n/**\n * @interface Highcharts.PointAccessibilityOptionsObject\n */ /**\n* Provide a description of the data point, announced to screen readers.\n* @name Highcharts.PointAccessibilityOptionsObject#description\n* @type {string|undefined}\n* @requires modules/accessibility\n* @since 7.1.0\n*/ /**\n* Enable or disable exposing the point to assistive technology\n* @name Highcharts.PointAccessibilityOptionsObject#enabled\n* @type {boolean|undefined}\n* @requires modules/accessibility\n* @since 9.0.1\n*/\n/* *\n * @interface Highcharts.PointOptionsObject in parts/Point.ts\n */ /**\n* @name Highcharts.PointOptionsObject#accessibility\n* @type {Highcharts.PointAccessibilityOptionsObject|undefined}\n* @requires modules/accessibility\n* @since 7.1.0\n*/\n/**\n * @callback Highcharts.ScreenReaderClickCallbackFunction\n *\n * @param {global.MouseEvent} evt\n * Mouse click event\n *\n * @return {void}\n */\n/**\n * Creates a formatted string for the screen reader module.\n *\n * @callback Highcharts.ScreenReaderFormatterCallbackFunction\n *\n * @param {T} context\n * Context to format\n *\n * @return {string}\n * Formatted string for the screen reader module.\n */\nconst Options = {\n /**\n * Options for configuring accessibility for the chart. Requires the\n * [accessibility module](https://code.highcharts.com/modules/accessibility.js)\n * to be loaded. For a description of the module and information\n * on its features, see\n * [Highcharts Accessibility](https://www.highcharts.com/docs/accessibility/accessibility-module).\n *\n * @since 5.0.0\n * @requires modules/accessibility\n * @optionparent accessibility\n */\n accessibility: {\n /**\n * Enable accessibility functionality for the chart. For more\n * information on how to include these features, and why this is\n * recommended, see [Highcharts Accessibility](https://www.highcharts.com/docs/accessibility/accessibility-module).\n *\n * Highcharts will by default emit a warning to the console if\n * the [accessibility module](https://code.highcharts.com/modules/accessibility.js)\n * is not loaded. Setting this option to `false` will override\n * and silence the warning.\n *\n * Once the module is loaded, setting this option to `false`\n * will disable the module for this chart.\n *\n * @since 5.0.0\n */\n enabled: true,\n /**\n * Accessibility options for the screen reader information sections\n * added before and after the chart.\n *\n * @since 8.0.0\n */\n screenReaderSection: {\n /**\n * Function to run upon clicking the \"View as Data Table\" link in\n * the screen reader region.\n *\n * By default Highcharts will insert and set focus to a data table\n * representation of the chart.\n *\n * @type {Highcharts.ScreenReaderClickCallbackFunction}\n * @since 8.0.0\n * @apioption accessibility.screenReaderSection.onViewDataTableClick\n */\n /**\n * Function to run upon clicking the \"Play as sound\" button in\n * the screen reader region.\n *\n * By default Highcharts will call the `chart.sonify` function.\n *\n * @type {Highcharts.ScreenReaderClickCallbackFunction}\n * @since 8.0.1\n * @apioption accessibility.screenReaderSection.onPlayAsSoundClick\n */\n /**\n * A formatter function to create the HTML contents of the hidden\n * screen reader information region before the chart. Receives one\n * argument, `chart`, referring to the chart object. Should return a\n * string with the HTML content of the region. By default this\n * returns an automatic description of the chart based on\n * [beforeChartFormat](#accessibility.screenReaderSection.beforeChartFormat).\n *\n * @type {Highcharts.ScreenReaderFormatterCallbackFunction}\n * @since 8.0.0\n * @apioption accessibility.screenReaderSection.beforeChartFormatter\n */\n /**\n * Format for the screen reader information region before the chart.\n * Supported HTML tags are ``, `

    `, `

    `, ``, `