@splunk/visualizations 24.2.0 → 24.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureFillerGauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureFillerGauge_Too_Small_to_Render.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Dark.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Hover.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Light.png +0 -0
  6. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_base_map_light.png +0 -0
  7. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
  8. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_dynamic_color.png +0 -0
  9. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_geostats_by.png +0 -0
  10. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color.png +0 -0
  11. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_static_color_with_no_seriesColors.png +0 -0
  12. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_center_seattle.png +0 -0
  13. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_dynamic_color.png +0 -0
  14. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color.png +0 -0
  15. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_marker_layer_static_color_with_no_seriesColors.png +0 -0
  16. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
  17. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
  18. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_zoom_9.png +0 -0
  19. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_from.png +0 -0
  20. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_duplicate_entries_to.png +0 -0
  21. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_discontinuous_ranges.png +0 -0
  22. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_equals_to_to.png +0 -0
  23. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_invalid_entries_from_is_larger_than_to.png +0 -0
  24. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Invalid_ranges_missing_entries.png +0 -0
  25. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Orientation_horizontal_width_150_show_placeholder.png +0 -0
  26. package/.loki/reference/chrome_docker_PureVisualizations_PureMarkerGauge_Too_Small_to_Render.png +0 -0
  27. package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_dimensions_less_than_minWidth_300_and_minHeight_200.png +0 -0
  28. package/.loki/reference/chrome_docker_PureVisualizations_PureSankey_invalid_columns_data.png +0 -0
  29. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  30. package/.loki/reference/chrome_docker_Visualizations_Choropleth_Svg_Choropleth_Svg_Missing_Props_Message_When_No_Svg.png +0 -0
  31. package/.loki/reference/chrome_docker_Visualizations_Filler_Gauge_Filler_Gauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
  32. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Basic_Map.png +0 -0
  33. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer.png +0 -0
  34. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET.png +0 -0
  35. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_GET_Dynamic_Coloring.png +0 -0
  36. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Static_Coloring.png +0 -0
  37. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_Dynamic_Coloring.png +0 -0
  38. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer.png +0 -0
  39. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Dynamic_coloring.png +0 -0
  40. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_Result_Limit_Set_To_3.png +0 -0
  41. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Marker_layer_with_geostats_data_No_render.png +0 -0
  42. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
  43. package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Markdown_with_number_as_DSL.png +0 -0
  44. package/.loki/reference/chrome_docker_Visualizations_Pie_Pie_Missing_Column.png +0 -0
  45. package/.loki/reference/chrome_docker_Visualizations_Sankey_Sankey_Dimension_Too_Small.png +0 -0
  46. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_By_Type_Custom.png +0 -0
  47. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Default.png +0 -0
  48. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Kitchen_Sink.png +0 -0
  49. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
  50. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Single_Column.png +0 -0
  51. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Color_light_blue.png +0 -0
  52. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_No_Stripe.png +0 -0
  53. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Stripe.png +0 -0
  54. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table.png +0 -0
  55. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table_With_No_Click.png +0 -0
  56. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Cell_Types.png +0 -0
  57. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Gradient.png +0 -0
  58. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Override.png +0 -0
  59. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Width.png +0 -0
  60. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Count_2.png +0 -0
  61. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Header_Colors.png +0 -0
  62. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Row_Colors.png +0 -0
  63. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Stripe.png +0 -0
  64. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_No_Stripe.png +0 -0
  65. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_Stripe.png +0 -0
  66. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number.png +0 -0
  67. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
  68. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_fixed.png +0 -0
  69. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_none.png +0 -0
  70. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage.png +0 -0
  71. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage_100_no_paginator.png +0 -0
  72. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Invalid_Background_Color.png +0 -0
  73. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Value_Field.png +0 -0
  74. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes.png +0 -0
  75. package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes_Row_Numbers.png +0 -0
  76. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_false.png +0 -0
  77. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Internal_Fields_true_default.png +0 -0
  78. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Row_Numbers_true.png +0 -0
  79. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline.png +0 -0
  80. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Custom.png +0 -0
  81. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Width.png +0 -0
  82. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparklines_Adv.png +0 -0
  83. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Formatting.png +0 -0
  84. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Gradient.png +0 -0
  85. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
  86. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Height.png +0 -0
  87. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Percentage.png +0 -0
  88. package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Px.png +0 -0
  89. package/Area.config.js +15 -15
  90. package/Area.config.js.map +1 -1
  91. package/Area.js +108 -121
  92. package/Area.js.map +1 -1
  93. package/Bar.config.js +15 -15
  94. package/Bar.config.js.map +1 -1
  95. package/Bar.js +101 -114
  96. package/Bar.js.map +1 -1
  97. package/Bubble.config.js +8 -8
  98. package/Bubble.config.js.map +1 -1
  99. package/Bubble.js +94 -107
  100. package/Bubble.js.map +1 -1
  101. package/ChoroplethSvg.config.js +11 -9
  102. package/ChoroplethSvg.config.js.map +1 -1
  103. package/ChoroplethSvg.js +123 -134
  104. package/ChoroplethSvg.js.map +1 -1
  105. package/Column.config.js +15 -15
  106. package/Column.config.js.map +1 -1
  107. package/Column.js +101 -114
  108. package/Column.js.map +1 -1
  109. package/Ellipse.config.js +22 -2
  110. package/Ellipse.config.js.map +1 -1
  111. package/Ellipse.js +109 -102
  112. package/Ellipse.js.map +1 -1
  113. package/FillerGauge.config.js +8 -8
  114. package/FillerGauge.config.js.map +1 -1
  115. package/FillerGauge.js +110 -123
  116. package/FillerGauge.js.map +1 -1
  117. package/Image.js +81 -97
  118. package/Image.js.map +1 -1
  119. package/Line.config.js +8 -8
  120. package/Line.config.js.map +1 -1
  121. package/Line.js +101 -114
  122. package/Line.js.map +1 -1
  123. package/LinkGraph.config.js +4 -4
  124. package/LinkGraph.js +128 -141
  125. package/LinkGraph.js.map +1 -1
  126. package/Map.config.js +740 -0
  127. package/Map.config.js.map +1 -0
  128. package/Map.js +3141 -0
  129. package/Map.js.map +1 -0
  130. package/Markdown.config.js +12 -12
  131. package/Markdown.config.js.map +1 -1
  132. package/Markdown.js +104 -118
  133. package/Markdown.js.map +1 -1
  134. package/MarkerGauge.config.js +6 -6
  135. package/MarkerGauge.config.js.map +1 -1
  136. package/MarkerGauge.js +2953 -3060
  137. package/MarkerGauge.js.map +1 -1
  138. package/ParallelCoordinates.config.js +11 -11
  139. package/ParallelCoordinates.config.js.map +1 -1
  140. package/ParallelCoordinates.js +137 -139
  141. package/ParallelCoordinates.js.map +1 -1
  142. package/Pie.config.js +13 -13
  143. package/Pie.config.js.map +1 -1
  144. package/Pie.js +912 -1019
  145. package/Pie.js.map +1 -1
  146. package/Punchcard.config.js +11 -11
  147. package/Punchcard.config.js.map +1 -1
  148. package/Punchcard.js +153 -155
  149. package/Punchcard.js.map +1 -1
  150. package/README.internal.md +36 -3
  151. package/README.md +7 -9
  152. package/Rectangle.config.js +32 -12
  153. package/Rectangle.config.js.map +1 -1
  154. package/Rectangle.js +189 -185
  155. package/Rectangle.js.map +1 -1
  156. package/Sankey.config.js +35 -25
  157. package/Sankey.config.js.map +1 -1
  158. package/Sankey.js +2963 -3078
  159. package/Sankey.js.map +1 -1
  160. package/Scatter.config.js +11 -11
  161. package/Scatter.config.js.map +1 -1
  162. package/Scatter.js +231 -247
  163. package/Scatter.js.map +1 -1
  164. package/SingleValue.config.js +23 -22
  165. package/SingleValue.config.js.map +1 -1
  166. package/SingleValue.js +425 -441
  167. package/SingleValue.js.map +1 -1
  168. package/SingleValueBasic.js +20 -20
  169. package/SingleValueBasic.js.map +1 -1
  170. package/SingleValueIcon.config.js +33 -34
  171. package/SingleValueIcon.config.js.map +1 -1
  172. package/SingleValueIcon.js +179 -184
  173. package/SingleValueIcon.js.map +1 -1
  174. package/SingleValueRadial.config.js +22 -22
  175. package/SingleValueRadial.config.js.map +1 -1
  176. package/SingleValueRadial.js +391 -407
  177. package/SingleValueRadial.js.map +1 -1
  178. package/Table.config.js +17 -6
  179. package/Table.config.js.map +1 -1
  180. package/Table.js +358 -321
  181. package/Table.js.map +1 -1
  182. package/common/Charting.js +21 -22
  183. package/common/Charting.js.map +1 -1
  184. package/common/ChartingApi.js +2 -2
  185. package/common/ChartingApi.js.map +1 -1
  186. package/common/EventsDoc.js +14 -15
  187. package/common/EventsDoc.js.map +1 -1
  188. package/common/GaugeMajorTicks.js +2 -2
  189. package/common/GaugeMajorTicks.js.map +1 -1
  190. package/common/GaugeValueMarker.js +2 -2
  191. package/common/GaugeValueMarker.js.map +1 -1
  192. package/common/OptionsDoc.js +7 -8
  193. package/common/OptionsDoc.js.map +1 -1
  194. package/common/OverviewDoc.js +22 -22
  195. package/common/OverviewDoc.js.map +1 -1
  196. package/common/SplunkVisualization.js +4 -4
  197. package/common/SplunkVisualization.js.map +1 -1
  198. package/common/SplunkVisualizationApi.js +2 -2
  199. package/common/SplunkVisualizationApi.js.map +1 -1
  200. package/common/ThemesDoc.js +16 -16
  201. package/common/ThemesDoc.js.map +1 -1
  202. package/common/chartingUtils.js +4 -4
  203. package/common/chartingUtils.js.map +1 -1
  204. package/common/docUtils.js +4 -4
  205. package/common/docUtils.js.map +1 -1
  206. package/common/gaugeUtils.js +13 -13
  207. package/common/gaugeUtils.js.map +1 -1
  208. package/common/shapeUtils.js +8 -8
  209. package/common/shapeUtils.js.map +1 -1
  210. package/common/withDashboardViz.js +53 -68
  211. package/common/withDashboardViz.js.map +1 -1
  212. package/loki.config.js +2 -0
  213. package/package.json +19 -15
  214. package/common/version.js +0 -110
  215. package/common/version.js.map +0 -1
  216. package/scripts/generateVersion.js +0 -13
package/Map.js ADDED
@@ -0,0 +1,3141 @@
1
+ /*!
2
+ * Copyright © 2018 Splunk Inc.
3
+ * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
4
+ * in part without a valid written license from Splunk Inc. is PROHIBITED.
5
+ */
6
+ module.exports =
7
+ /******/ (function(modules) { // webpackBootstrap
8
+ /******/ // The module cache
9
+ /******/ var installedModules = {};
10
+ /******/
11
+ /******/ // The require function
12
+ /******/ function __webpack_require__(moduleId) {
13
+ /******/
14
+ /******/ // Check if module is in cache
15
+ /******/ if(installedModules[moduleId]) {
16
+ /******/ return installedModules[moduleId].exports;
17
+ /******/ }
18
+ /******/ // Create a new module (and put it into the cache)
19
+ /******/ var module = installedModules[moduleId] = {
20
+ /******/ i: moduleId,
21
+ /******/ l: false,
22
+ /******/ exports: {}
23
+ /******/ };
24
+ /******/
25
+ /******/ // Execute the module function
26
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
27
+ /******/
28
+ /******/ // Flag the module as loaded
29
+ /******/ module.l = true;
30
+ /******/
31
+ /******/ // Return the exports of the module
32
+ /******/ return module.exports;
33
+ /******/ }
34
+ /******/
35
+ /******/
36
+ /******/ // expose the modules object (__webpack_modules__)
37
+ /******/ __webpack_require__.m = modules;
38
+ /******/
39
+ /******/ // expose the module cache
40
+ /******/ __webpack_require__.c = installedModules;
41
+ /******/
42
+ /******/ // define getter function for harmony exports
43
+ /******/ __webpack_require__.d = function(exports, name, getter) {
44
+ /******/ if(!__webpack_require__.o(exports, name)) {
45
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
46
+ /******/ }
47
+ /******/ };
48
+ /******/
49
+ /******/ // define __esModule on exports
50
+ /******/ __webpack_require__.r = function(exports) {
51
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
52
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
53
+ /******/ }
54
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
55
+ /******/ };
56
+ /******/
57
+ /******/ // create a fake namespace object
58
+ /******/ // mode & 1: value is a module id, require it
59
+ /******/ // mode & 2: merge all properties of value into the ns
60
+ /******/ // mode & 4: return value when already ns object
61
+ /******/ // mode & 8|1: behave like require
62
+ /******/ __webpack_require__.t = function(value, mode) {
63
+ /******/ if(mode & 1) value = __webpack_require__(value);
64
+ /******/ if(mode & 8) return value;
65
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
66
+ /******/ var ns = Object.create(null);
67
+ /******/ __webpack_require__.r(ns);
68
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
69
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
70
+ /******/ return ns;
71
+ /******/ };
72
+ /******/
73
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
74
+ /******/ __webpack_require__.n = function(module) {
75
+ /******/ var getter = module && module.__esModule ?
76
+ /******/ function getDefault() { return module['default']; } :
77
+ /******/ function getModuleExports() { return module; };
78
+ /******/ __webpack_require__.d(getter, 'a', getter);
79
+ /******/ return getter;
80
+ /******/ };
81
+ /******/
82
+ /******/ // Object.prototype.hasOwnProperty.call
83
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
84
+ /******/
85
+ /******/ // __webpack_public_path__
86
+ /******/ __webpack_require__.p = "";
87
+ /******/
88
+ /******/
89
+ /******/ // Load entry module and return exports
90
+ /******/ return __webpack_require__(__webpack_require__.s = 189);
91
+ /******/ })
92
+ /************************************************************************/
93
+ /******/ ([
94
+ /* 0 */
95
+ /***/ (function(module, exports) {
96
+
97
+ module.exports = require("prop-types");
98
+
99
+ /***/ }),
100
+ /* 1 */
101
+ /***/ (function(module, exports) {
102
+
103
+ module.exports = require("react");
104
+
105
+ /***/ }),
106
+ /* 2 */
107
+ /***/ (function(module, exports) {
108
+
109
+ module.exports = require("lodash");
110
+
111
+ /***/ }),
112
+ /* 3 */
113
+ /***/ (function(module, exports) {
114
+
115
+ module.exports = require("@splunk/ui-utils/i18n");
116
+
117
+ /***/ }),
118
+ /* 4 */
119
+ /***/ (function(module, exports) {
120
+
121
+ module.exports = require("styled-components");
122
+
123
+ /***/ }),
124
+ /* 5 */
125
+ /***/ (function(module, exports, __webpack_require__) {
126
+
127
+ "use strict";
128
+
129
+
130
+ Object.defineProperty(exports, "__esModule", {
131
+ value: true
132
+ });
133
+ exports.VizBehavior = void 0;
134
+ var VizBehavior;
135
+
136
+ (function (VizBehavior) {
137
+ /**
138
+ * Dynamic Options Behavior.
139
+ * This allows visualization options to be powered by data
140
+ *
141
+ * **Example**
142
+ *
143
+ * sparklineValues: ">primary|seriesByIndex(0)"
144
+ * would configure sparklineValues with an array of data points
145
+ * coming from the first series in the primary datasource
146
+ *
147
+ */
148
+ VizBehavior["DYNAMIC_OPTIONS"] = "dynamic-options";
149
+ VizBehavior["EVENTS"] = "events";
150
+ /**
151
+ * Placeholder behavior: visualization will display a placeholder rather than fail if any of the `requiredProps` is
152
+ * missing.
153
+ * @type {string}
154
+ */
155
+
156
+ VizBehavior["PLACEHOLDER"] = "placeholder";
157
+ VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
158
+ })(VizBehavior = exports.VizBehavior || (exports.VizBehavior = {}));
159
+
160
+ /***/ }),
161
+ /* 6 */
162
+ /***/ (function(module, exports, __webpack_require__) {
163
+
164
+ "use strict";
165
+
166
+
167
+ var _defineProperty = __webpack_require__(8);
168
+
169
+ var __rest = this && this.__rest || function (s, e) {
170
+ var t = {};
171
+
172
+ for (var p in s) {
173
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
174
+ }
175
+
176
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
177
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
178
+ }
179
+ return t;
180
+ };
181
+
182
+ Object.defineProperty(exports, "__esModule", {
183
+ value: true
184
+ });
185
+ exports.generatePrecisionValues = exports.getInitialPreset = exports.isDynamicOption = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
186
+
187
+ var lodash_1 = __webpack_require__(2);
188
+
189
+ var schemaUtils_1 = __webpack_require__(14);
190
+
191
+ var VizBehavior_1 = __webpack_require__(5);
192
+
193
+ var dynamicOptionsDSLType = {
194
+ type: 'string',
195
+ pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
196
+ };
197
+ /**
198
+ * Helper function to extend an options schema with dynamic options DSL
199
+ * @param optionsSchema a visualization's options schema
200
+ * @returns an updated options schema that additionally allows strings starting with > for each option
201
+ */
202
+
203
+ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
204
+ var enhancedOptionsSchema = {};
205
+ Object.keys(optionsSchema).forEach(function (key) {
206
+ var _a = optionsSchema[key],
207
+ title = _a.title,
208
+ description = _a.description,
209
+ readOnly = _a.readOnly,
210
+ writeOnly = _a.writeOnly,
211
+ examples = _a.examples,
212
+ defaultValue = _a.default,
213
+ type = _a.type,
214
+ properties = _a.properties,
215
+ patternProperties = _a.patternProperties,
216
+ remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
217
+
218
+ var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
219
+ title: title
220
+ }), description !== undefined && {
221
+ description: description
222
+ }), readOnly !== undefined && {
223
+ readOnly: readOnly
224
+ }), writeOnly !== undefined && {
225
+ writeOnly: writeOnly
226
+ }), examples !== undefined && {
227
+ examples: examples
228
+ }), defaultValue !== undefined && {
229
+ default: defaultValue
230
+ });
231
+
232
+ if (type === 'object') {
233
+ enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
234
+ type: type
235
+ }), properties && {
236
+ properties: enhanceOptionsSchemaWithDynamicOptions(properties)
237
+ });
238
+
239
+ if (patternProperties) {
240
+ var enhancedPatternProperties = {};
241
+ Object.keys(patternProperties).forEach(function (opt) {
242
+ enhancedPatternProperties = Object.assign(Object.assign({}, enhancedPatternProperties), enhanceOptionsSchemaWithDynamicOptions(_defineProperty({}, opt, patternProperties[opt])));
243
+ });
244
+ enhancedOptionsSchema[key].patternProperties = enhancedPatternProperties;
245
+ }
246
+ } else {
247
+ enhancedOptionsSchema[key] = Object.assign(Object.assign({}, annotations), {
248
+ anyOf: [Object.assign(Object.assign({}, type !== undefined && {
249
+ type: type
250
+ }), remainingSchemaEntry), dynamicOptionsDSLType]
251
+ });
252
+ }
253
+ });
254
+ return enhancedOptionsSchema;
255
+ }
256
+
257
+ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
258
+ /**
259
+ * Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
260
+ * @param vizConfig a Visualization Config
261
+ * @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
262
+ */
263
+
264
+ function enhanceConfig(vizConfig) {
265
+ var enhancedConfig = vizConfig;
266
+
267
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
268
+ enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
269
+ }
270
+
271
+ return enhancedConfig;
272
+ }
273
+
274
+ exports.enhanceConfig = enhanceConfig;
275
+
276
+ function isDynamicOption(option) {
277
+ return option && typeof option === 'string' && option.trim().startsWith('>') || false;
278
+ }
279
+
280
+ exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
281
+ // this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
282
+
283
+ /**
284
+ * this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
285
+ * if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
286
+ * the inverse is true; if a preset has key is NOT undefined, it must also be NOT undefined in the corresponding vizContext
287
+ * the internal config contents are irrelevant (as the user could customize them in source), just as long as the presence of `undefined`s match up
288
+ *
289
+ * Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
290
+ */
291
+
292
+ function hasCompatibleContexts(vizContext, presetContext) {
293
+ var presetContextKeys = Object.keys(presetContext);
294
+ return presetContextKeys.every(function (contextKey) {
295
+ return presetContext[contextKey] === undefined && vizContext[contextKey] === undefined || presetContext[contextKey] !== undefined && vizContext[contextKey] !== undefined;
296
+ });
297
+ }
298
+ /**
299
+ * Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
300
+ */
301
+
302
+
303
+ function hasCompatibleOptions(vizOptions, presetOptions) {
304
+ var presetOptionKeys = Object.keys(presetOptions);
305
+ return presetOptionKeys.every(function (optionKey) {
306
+ return isDynamicOption(presetOptions[optionKey]) === isDynamicOption(vizOptions[optionKey]);
307
+ });
308
+ }
309
+ /**
310
+ * Evaluates whether there is an initialPreset that fits the current state of vizContext + vizOptions
311
+ * This function ignores extraneous vizOptions or vizContext keys, as they could be outside the scope of what the preset is intended to configure
312
+ *
313
+ * @param {Object} vizContext - the current vizContext definition
314
+ * @param {Object} vizOptions - the current vizOptions definition
315
+ * @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
316
+ */
317
+
318
+
319
+ function getInitialPreset(vizContext, vizOptions, presets) {
320
+ return presets.find(function (preset) {
321
+ var presetContext = lodash_1.get(preset, ['value', 'context'], {});
322
+ var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
323
+ var presetContextKeys = Object.keys(presetContext);
324
+ var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
325
+ // if not, then the preset is invalid in config.ts
326
+
327
+ if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
328
+ return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
329
+ });
330
+ }
331
+
332
+ exports.getInitialPreset = getInitialPreset;
333
+ /**
334
+ * generates number precision values for a Select editor
335
+ *
336
+ * @param {Number} numPrecisionValues - number of integer precision values to generate
337
+ * @returns {{ label: string; value; string }[]} array of { label, value } tuples
338
+ */
339
+
340
+ function generatePrecisionValues(numPrecisionValues) {
341
+ return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
342
+ return {
343
+ label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
344
+ value: i
345
+ };
346
+ });
347
+ }
348
+
349
+ exports.generatePrecisionValues = generatePrecisionValues;
350
+
351
+ /***/ }),
352
+ /* 7 */
353
+ /***/ (function(module, exports, __webpack_require__) {
354
+
355
+ "use strict";
356
+
357
+
358
+ var _typeof = __webpack_require__(20);
359
+
360
+ Object.defineProperty(exports, "__esModule", {
361
+ value: true
362
+ });
363
+ exports.deepMergeWithArrayOverrides = exports.extendStaticWrapperProps = void 0;
364
+
365
+ var lodash_1 = __webpack_require__(2);
366
+ /**
367
+ * @method extendStaticWrapperProps
368
+ * @param {Object} props
369
+ * @param {DashboardVizType} props.Wrapper
370
+ * @param {DashboardVizType} props.Visualization
371
+ */
372
+
373
+
374
+ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
375
+ var Wrapper = _ref.Wrapper,
376
+ Visualization = _ref.Visualization;
377
+ var extendProperties = ['propTypes', 'defaultProps', 'config'];
378
+ extendProperties.forEach(function (prop) {
379
+ if (Visualization[prop]) {
380
+ // eslint-disable-next-line no-param-reassign
381
+ Wrapper[prop] = Visualization[prop];
382
+ }
383
+ });
384
+ };
385
+
386
+ exports.extendStaticWrapperProps = extendStaticWrapperProps;
387
+ /**
388
+ * helper to deeply merge objects while preserving arrays in earlier source objects
389
+ * deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays will be preserved if already present in the resultant merged object
390
+ * this prevents default arrays from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one)
391
+ *
392
+ * @method deepMergeWithArrayOverrides
393
+ * @param {Object} initial - target object to merge values into
394
+ * @param {Object[]} sources - other default options to be merged into the resultant object if no explicit value is provided, with earlier args taking precedence over later ones
395
+ *
396
+ * @returns {Object}
397
+ */
398
+
399
+ var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial) {
400
+ var clone = lodash_1.cloneDeep(initial);
401
+
402
+ for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
403
+ sources[_key - 1] = arguments[_key];
404
+ }
405
+
406
+ sources.forEach(function (sourceToApply) {
407
+ Object.keys(sourceToApply).forEach(function (sourceKey) {
408
+ if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
409
+ clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
410
+ } // object merging excluding arrays
411
+
412
+
413
+ if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
414
+ clone[sourceKey] = exports.deepMergeWithArrayOverrides(clone[sourceKey], sourceToApply[sourceKey]);
415
+ }
416
+ });
417
+ });
418
+ return clone;
419
+ };
420
+
421
+ exports.deepMergeWithArrayOverrides = deepMergeWithArrayOverrides;
422
+
423
+ /***/ }),
424
+ /* 8 */
425
+ /***/ (function(module, exports) {
426
+
427
+ module.exports = require("@babel/runtime/helpers/defineProperty");
428
+
429
+ /***/ }),
430
+ /* 9 */
431
+ /***/ (function(module, exports) {
432
+
433
+ module.exports = require("@splunk/visualizations-shared/Message");
434
+
435
+ /***/ }),
436
+ /* 10 */
437
+ /***/ (function(module, exports) {
438
+
439
+ module.exports = require("@babel/runtime/helpers/classCallCheck");
440
+
441
+ /***/ }),
442
+ /* 11 */
443
+ /***/ (function(module, exports) {
444
+
445
+ module.exports = require("@splunk/visualizations-shared/colorUtils");
446
+
447
+ /***/ }),
448
+ /* 12 */
449
+ /***/ (function(module, exports, __webpack_require__) {
450
+
451
+ "use strict";
452
+
453
+
454
+ Object.defineProperty(exports, "__esModule", {
455
+ value: true
456
+ });
457
+
458
+ var React = __webpack_require__(1);
459
+
460
+ var styled_components_1 = __webpack_require__(4);
461
+
462
+ var SizeAwareWrapper_1 = __webpack_require__(16);
463
+
464
+ var style_1 = __webpack_require__(13);
465
+
466
+ var colorUtils_1 = __webpack_require__(11);
467
+
468
+ var Item = styled_components_1.default.div.attrs(function (_ref) {
469
+ var width = _ref.width;
470
+ return {
471
+ style: {
472
+ width: style_1.toPx(width)
473
+ }
474
+ };
475
+ }).withConfig({
476
+ displayName: "FixedSizeContainer__Item",
477
+ componentId: "sc-1yhgpod-0"
478
+ })(["position:relative;background-color:", "};"], function (props) {
479
+ return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
480
+ }); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
481
+
482
+ var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
483
+ var width = _ref2.width,
484
+ height = _ref2.height;
485
+ return {
486
+ style: Object.assign(Object.assign({}, width && {
487
+ width: style_1.toPx(width)
488
+ }), height && {
489
+ height: style_1.toPx(height)
490
+ })
491
+ };
492
+ }).withConfig({
493
+ displayName: "FixedSizeContainer__FixSizeItem",
494
+ componentId: "sc-1yhgpod-1"
495
+ })(["position:relative;flex-direction:column;flex:1;display:flex;background-color:", "};"], function (props) {
496
+ return colorUtils_1.isColor(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
497
+ });
498
+ var ItemContent = styled_components_1.default.div.withConfig({
499
+ displayName: "FixedSizeContainer__ItemContent",
500
+ componentId: "sc-1yhgpod-2"
501
+ })(["position:relative;min-height:100px;width:100%;"]);
502
+ var FixSizeItemContent = styled_components_1.default.div.withConfig({
503
+ displayName: "FixedSizeContainer__FixSizeItemContent",
504
+ componentId: "sc-1yhgpod-3"
505
+ })(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
506
+
507
+ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
508
+ var FixedSizeContainer = function FixedSizeContainer(props) {
509
+ var width = props.width,
510
+ height = props.height,
511
+ backgroundColor = props.backgroundColor;
512
+
513
+ if (!height) {
514
+ return React.createElement(Item, {
515
+ "data-test": "item",
516
+ width: width,
517
+ backgroundColor: backgroundColor
518
+ }, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
519
+ }
520
+
521
+ return React.createElement(FixSizeItem, {
522
+ "data-test": "fix-size-item",
523
+ "data-splunk-visualization-version": "24.3.2 - 1cf892b72",
524
+ width: width,
525
+ height: height,
526
+ backgroundColor: backgroundColor
527
+ }, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
528
+ var newWidth = _ref3.width,
529
+ newHeight = _ref3.height;
530
+ return React.createElement(Viz, Object.assign({}, props, {
531
+ width: newWidth,
532
+ height: newHeight
533
+ }));
534
+ })));
535
+ };
536
+
537
+ FixedSizeContainer.displayName = 'withFixedSizeContainer';
538
+ return FixedSizeContainer;
539
+ };
540
+
541
+ exports.default = withFixedSizeContainer;
542
+
543
+ /***/ }),
544
+ /* 13 */
545
+ /***/ (function(module, exports) {
546
+
547
+ module.exports = require("@splunk/visualizations-shared/style");
548
+
549
+ /***/ }),
550
+ /* 14 */
551
+ /***/ (function(module, exports) {
552
+
553
+ module.exports = require("@splunk/visualizations-shared/schemaUtils");
554
+
555
+ /***/ }),
556
+ /* 15 */
557
+ /***/ (function(module, exports) {
558
+
559
+ module.exports = require("@babel/runtime/helpers/createClass");
560
+
561
+ /***/ }),
562
+ /* 16 */
563
+ /***/ (function(module, exports) {
564
+
565
+ module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
566
+
567
+ /***/ }),
568
+ /* 17 */,
569
+ /* 18 */,
570
+ /* 19 */,
571
+ /* 20 */
572
+ /***/ (function(module, exports) {
573
+
574
+ module.exports = require("@babel/runtime/helpers/typeof");
575
+
576
+ /***/ }),
577
+ /* 21 */,
578
+ /* 22 */,
579
+ /* 23 */
580
+ /***/ (function(module, exports, __webpack_require__) {
581
+
582
+ "use strict";
583
+
584
+
585
+ var _defineProperty = __webpack_require__(8);
586
+
587
+ Object.defineProperty(exports, "__esModule", {
588
+ value: true
589
+ });
590
+ exports.getSortingParams = exports.SortParamsPropTypes = void 0;
591
+
592
+ var T = __webpack_require__(0);
593
+
594
+ var lodash_1 = __webpack_require__(2);
595
+
596
+ var DataSource_1 = __webpack_require__(33);
597
+
598
+ exports.SortParamsPropTypes = T.shape({
599
+ currentSortKey: T.string,
600
+ currentSortDir: T.oneOf(DataSource_1.validSortDirs),
601
+ onSort: T.func
602
+ });
603
+
604
+ var getSortingParams = function getSortingParams(_ref) {
605
+ var requestParams = _ref.requestParams,
606
+ onRequestParamsChange = _ref.onRequestParamsChange;
607
+ var currentSortKey;
608
+ var currentSortDir;
609
+ var nextSortDirMap = {
610
+ asc: 'desc',
611
+ desc: 'asc',
612
+ none: 'asc'
613
+ };
614
+ var onSort;
615
+
616
+ if (lodash_1.isFunction(onRequestParamsChange)) {
617
+ if (requestParams && lodash_1.has(requestParams, 'sort')) {
618
+ currentSortKey = Object.keys(requestParams.sort).shift();
619
+ currentSortDir = requestParams.sort[currentSortKey];
620
+ } // undid memoization since there is a dependency on requestParams, which is a deeply nested object
621
+
622
+
623
+ onSort = function onSort(e, _ref2) {
624
+ var sortKey = _ref2.sortKey,
625
+ sortDir = _ref2.sortDir;
626
+
627
+ if (typeof sortKey === 'string') {
628
+ var nextSortDir = lodash_1.has(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
629
+ onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
630
+ offset: 0,
631
+ sort: _defineProperty({}, sortKey, nextSortDir)
632
+ }));
633
+ } else {
634
+ onRequestParamsChange(requestParams);
635
+ }
636
+ };
637
+ }
638
+
639
+ return {
640
+ currentSortKey: currentSortKey,
641
+ currentSortDir: currentSortDir,
642
+ onSort: onSort
643
+ };
644
+ };
645
+
646
+ exports.getSortingParams = getSortingParams;
647
+
648
+ /***/ }),
649
+ /* 24 */
650
+ /***/ (function(module, exports, __webpack_require__) {
651
+
652
+ "use strict";
653
+
654
+
655
+ Object.defineProperty(exports, "__esModule", {
656
+ value: true
657
+ });
658
+ exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
659
+
660
+ var T = __webpack_require__(0);
661
+
662
+ var lodash_1 = __webpack_require__(2);
663
+
664
+ exports.PaginatorParamsPropTypes = T.shape({
665
+ isPaging: T.bool,
666
+ current: T.number,
667
+ totalPages: T.number,
668
+ onChange: T.func
669
+ });
670
+
671
+ var getPaginationParams = function getPaginationParams(_ref) {
672
+ var requestParams = _ref.requestParams,
673
+ meta = _ref.meta,
674
+ onRequestParamsChange = _ref.onRequestParamsChange;
675
+ var totalCount = meta && meta.totalCount || 0;
676
+ var offset = requestParams && requestParams.offset || 0;
677
+ var count = requestParams && requestParams.count;
678
+ var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
679
+ var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
680
+ var isPaging = totalPages > 1 && lodash_1.isFunction(onRequestParamsChange);
681
+
682
+ var onChangeHandler = function onChangeHandler(e, _ref2) {
683
+ var page = _ref2.page,
684
+ countArg = _ref2.count;
685
+ var newParams = lodash_1.cloneDeep(requestParams);
686
+
687
+ if (typeof countArg === 'number') {
688
+ newParams.count = countArg;
689
+ newParams.offset = 0;
690
+ }
691
+
692
+ var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
693
+
694
+ if (typeof page === 'number' && page > 0) {
695
+ newParams.count = pageCount;
696
+ newParams.offset = (page - 1) * pageCount;
697
+ }
698
+
699
+ onRequestParamsChange(newParams);
700
+ };
701
+
702
+ return {
703
+ isPaging: isPaging,
704
+ current: current,
705
+ totalPages: totalPages,
706
+ onChange: lodash_1.isFunction(onRequestParamsChange) ? onChangeHandler : lodash_1.noop
707
+ };
708
+ };
709
+
710
+ exports.getPaginationParams = getPaginationParams;
711
+
712
+ /***/ }),
713
+ /* 25 */
714
+ /***/ (function(module, exports, __webpack_require__) {
715
+
716
+ "use strict";
717
+
718
+
719
+ Object.defineProperty(exports, "__esModule", {
720
+ value: true
721
+ });
722
+ exports.shouldShowIconPlaceholder = void 0;
723
+
724
+ var React = __webpack_require__(1);
725
+
726
+ var T = __webpack_require__(0);
727
+
728
+ var lodash_1 = __webpack_require__(2);
729
+
730
+ var i18n_1 = __webpack_require__(3);
731
+
732
+ var Message_1 = __webpack_require__(9);
733
+
734
+ var FixedSizeContainer_1 = __webpack_require__(12);
735
+ /**
736
+ * @method shouldShowIconPlaceholder
737
+ * @param {object} dataSources
738
+ * @param {boolean} loading
739
+ * @returns {boolean}
740
+ */
741
+
742
+
743
+ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
744
+ var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
745
+ var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
746
+ var noData = data === undefined;
747
+ var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
748
+ var noFields = fields === undefined;
749
+ return loading || noData || noFields;
750
+ };
751
+
752
+ exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
753
+ var propTypes = {
754
+ icon: T.func,
755
+ width: T.oneOfType([T.string, T.number]),
756
+ height: T.oneOfType([T.string, T.number]),
757
+ // eslint-disable-next-line react/no-unused-prop-types
758
+ backgroundColor: T.string
759
+ };
760
+ /**
761
+ * @method IconPlaceholder
762
+ * @param {IconPlaceholderProps} props
763
+ * @returns {React.ReactElement}
764
+ */
765
+
766
+ var IconPlaceholder = function IconPlaceholder(props) {
767
+ var width = props.width,
768
+ height = props.height,
769
+ icon = props.icon;
770
+
771
+ if (icon) {
772
+ return React.createElement(icon, {
773
+ style: {
774
+ left: '50%',
775
+ top: '50%',
776
+ color: 'grey',
777
+ position: 'absolute',
778
+ transform: 'translate(-50%, -50%)'
779
+ },
780
+ width: '50%',
781
+ height: '50%'
782
+ });
783
+ }
784
+
785
+ return React.createElement(Message_1.default, {
786
+ width: width,
787
+ height: height,
788
+ level: "warning",
789
+ message: i18n_1._('No DataSource Connected')
790
+ });
791
+ };
792
+
793
+ IconPlaceholder.propTypes = propTypes;
794
+ IconPlaceholder.defaultProps = {
795
+ width: '100%',
796
+ height: 250
797
+ };
798
+ exports.default = FixedSizeContainer_1.default(IconPlaceholder);
799
+
800
+ /***/ }),
801
+ /* 26 */
802
+ /***/ (function(module, exports, __webpack_require__) {
803
+
804
+ "use strict";
805
+
806
+
807
+ Object.defineProperty(exports, "__esModule", {
808
+ value: true
809
+ });
810
+ exports.VizCategory = void 0;
811
+ var VizCategory;
812
+
813
+ (function (VizCategory) {
814
+ VizCategory["SINGLE_VALUE"] = "Single Value";
815
+ VizCategory["TRENDS"] = "Trends";
816
+ VizCategory["COMPARISONS"] = "Comparisons";
817
+ VizCategory["TABLE"] = "Table";
818
+ VizCategory["GAUGE"] = "Gauge";
819
+ VizCategory["DISTRIBUTIONS"] = "Distributions";
820
+ VizCategory["CHOROPLETH"] = "Choropleth Maps";
821
+ VizCategory["SHAPES"] = "Shapes";
822
+ VizCategory["MISC"] = "misc";
823
+ VizCategory["FLOW"] = "Flow";
824
+ VizCategory["CORRELATION"] = "Correlation";
825
+ VizCategory["SPATIAL"] = "Spatial";
826
+ })(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
827
+
828
+ /***/ }),
829
+ /* 27 */
830
+ /***/ (function(module, exports, __webpack_require__) {
831
+
832
+ "use strict";
833
+
834
+
835
+ Object.defineProperty(exports, "__esModule", {
836
+ value: true
837
+ });
838
+
839
+ var React = __webpack_require__(1);
840
+
841
+ var lodash_1 = __webpack_require__(2);
842
+
843
+ var getSettingsFromThemedProps_1 = __webpack_require__(28);
844
+
845
+ var Options_1 = __webpack_require__(29);
846
+
847
+ var SanitizeProps_1 = __webpack_require__(30);
848
+
849
+ var styled_components_1 = __webpack_require__(4);
850
+
851
+ var SplunkVisualization_1 = __webpack_require__(31);
852
+
853
+ var VizBehavior_1 = __webpack_require__(5);
854
+
855
+ var getSorting_1 = __webpack_require__(23);
856
+
857
+ var getPagination_1 = __webpack_require__(24);
858
+
859
+ var useDeepMemo_1 = __webpack_require__(34);
860
+
861
+ var JSONSchemaUtils_1 = __webpack_require__(35);
862
+
863
+ var MissingPropsMessage_1 = __webpack_require__(36);
864
+
865
+ var withEditModeCover_1 = __webpack_require__(37);
866
+
867
+ var withPlaceholder_1 = __webpack_require__(38);
868
+
869
+ var hocUtils_1 = __webpack_require__(7);
870
+ /**
871
+ * hoc that wraps a pure react visualization in a Dashboard visualization
872
+ * @param {DashboardVizOpts} opts
873
+ * @returns {HOC}
874
+ */
875
+
876
+
877
+ var withDashboardViz = function withDashboardViz(opts) {
878
+ var ReactViz = opts.ReactViz,
879
+ vizConfig = opts.vizConfig,
880
+ _opts$computeVizProps = opts.computeVizProps,
881
+ computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
882
+ disableEditModeCover = opts.disableEditModeCover,
883
+ useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
884
+
885
+ var SanitizedReactViz = SanitizeProps_1.withSanitizedProps(ReactViz);
886
+ var defaultOptions = JSONSchemaUtils_1.pickFieldFromJSONSchema(vizConfig.optionsSchema, 'default');
887
+
888
+ var DashboardViz = function DashboardViz(props) {
889
+ var mode = props.mode,
890
+ hasEventHandlers = props.hasEventHandlers,
891
+ dataSources = props.dataSources,
892
+ options = props.options,
893
+ _props$context = props.context,
894
+ context = _props$context === void 0 ? {} : _props$context,
895
+ width = props.width,
896
+ height = props.height,
897
+ onComputedProps = props.onComputedProps,
898
+ onEventTrigger = props.onEventTrigger,
899
+ theme = props.theme,
900
+ onRequestParamsChange = props.onRequestParamsChange;
901
+
902
+ var themeFunc = function themeFunc(themeVar) {
903
+ var _a, _b;
904
+
905
+ return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
906
+ };
907
+
908
+ var bgColorFromTheme = themeFunc('defaultBackgroundColor');
909
+
910
+ var _getSettingsFromTheme = getSettingsFromThemedProps_1.default({
911
+ theme: theme
912
+ }),
913
+ currentThemeFamily = _getSettingsFromTheme.family,
914
+ currentThemeColorScheme = _getSettingsFromTheme.colorScheme,
915
+ currentThemeDensity = _getSettingsFromTheme.density;
916
+
917
+ var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
918
+
919
+ evaluatedOptions = useDeepMemo_1.useDeepMemo(function () {
920
+ try {
921
+ return Options_1.Options.evaluate({
922
+ context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
923
+ options: hocUtils_1.deepMergeWithArrayOverrides({}, options, defaultOptions)
924
+ }, dataSources, themeFunc);
925
+ } catch (e) {
926
+ // eslint-disable-next-line no-console
927
+ console.error("unexpected error evaluating options: + ".concat(e.message));
928
+ return {};
929
+ }
930
+ }, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources]); // useEffect hook needs to be initialized before any early returns
931
+ // this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
932
+
933
+ React.useEffect(function () {
934
+ onComputedProps(evaluatedOptions);
935
+ }); // present warning message if any required props are missing
936
+
937
+ var _vizConfig$requiredPr = vizConfig.requiredProps,
938
+ requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
939
+ supports = vizConfig.supports;
940
+ var missing = MissingPropsMessage_1.missingKeys(requiredProps, evaluatedOptions);
941
+
942
+ if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER)) {
943
+ return React.createElement(MissingPropsMessage_1.default, {
944
+ "data-test": "missing-props-message",
945
+ width: width,
946
+ height: height,
947
+ missingProps: missing,
948
+ backgroundColor: bgColorFromTheme
949
+ });
950
+ } // events
951
+
952
+
953
+ var eventCallbackProps = {};
954
+
955
+ if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
956
+ var supportedEvents = vizConfig.events;
957
+ Object.keys(supportedEvents).forEach(function (eventName) {
958
+ var eventCallbackPropName = lodash_1.camelCase("on.".concat(eventName));
959
+ eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
960
+ // then remove these lines
961
+
962
+ var payloadKeys = supportedEvents[eventName].payloadKeys;
963
+ var payload = {};
964
+
965
+ if (Array.isArray(payloadKeys) && payloadKeys.length) {
966
+ payloadKeys.forEach(function (p) {
967
+ payload[p] = evaluatedOptions[p];
968
+ });
969
+ }
970
+
971
+ eventCallbackProps[eventCallbackPropName] = function (ev) {
972
+ if (ev && ev.payload) {
973
+ payload = ev.payload;
974
+ }
975
+
976
+ return onEventTrigger({
977
+ originalEvent: ev,
978
+ payload: payload,
979
+ type: eventName
980
+ });
981
+ };
982
+ });
983
+ } // compute pure viz props which are not from options
984
+
985
+
986
+ var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptions), eventCallbackProps), {
987
+ themeFunc: themeFunc
988
+ }));
989
+ /**
990
+ * PAGE_AND_SORT behavior
991
+ *
992
+ * Some visualizations, like table, requires metadata about the datasource,
993
+ * like total number of results, current count, offset, and sort, for rendering
994
+ * paginator and sorting direction. In this approach, the visualization
995
+ * allow users to set 'paginateDataSourceKey' to select which datasource
996
+ * should the visualization extract the metadata from. It defaults to 'primary' datasource.
997
+ * The visualization config should set the PAGE_AND_SORT behavior to receive
998
+ * 'requestParams', 'meta' and onRequestParams callback as props.
999
+ *
1000
+ * In future, we could automatically detect which all datasources are being used
1001
+ * and bind those magically to pagination/sorting behavior.
1002
+ */
1003
+
1004
+ var dataSourceMetadata = {};
1005
+ var OptionKey = 'paginateDataSourceKey';
1006
+ var paginateDataSourceKey = lodash_1.has(evaluatedOptions, OptionKey) && evaluatedOptions[OptionKey] || 'primary';
1007
+
1008
+ if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && lodash_1.has(dataSources, paginateDataSourceKey)) {
1009
+ var requestParams = lodash_1.get(dataSources, [paginateDataSourceKey, 'requestParams'], {});
1010
+ var meta = lodash_1.get(dataSources, [paginateDataSourceKey, 'meta'], {});
1011
+
1012
+ var handleRequestParamsChange = function handleRequestParamsChange(payload) {
1013
+ return onRequestParamsChange(paginateDataSourceKey, payload);
1014
+ };
1015
+
1016
+ var sortParams = getSorting_1.getSortingParams({
1017
+ requestParams: requestParams,
1018
+ meta: meta,
1019
+ onRequestParamsChange: handleRequestParamsChange
1020
+ });
1021
+ var paginatorParams = getPagination_1.getPaginationParams({
1022
+ requestParams: requestParams,
1023
+ meta: meta,
1024
+ onRequestParamsChange: handleRequestParamsChange
1025
+ });
1026
+ dataSourceMetadata = {
1027
+ sortParams: sortParams,
1028
+ paginatorParams: paginatorParams
1029
+ };
1030
+ }
1031
+
1032
+ return React.createElement(SanitizedReactViz, Object.assign({
1033
+ mode: mode,
1034
+ width: width,
1035
+ height: height
1036
+ }, evaluatedOptions, computedVizProps, eventCallbackProps, dataSourceMetadata));
1037
+ };
1038
+
1039
+ DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
1040
+ DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
1041
+ // using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
1042
+ theme: {}
1043
+ }); // attach viz config
1044
+
1045
+ DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
1046
+
1047
+ return styled_components_1.withTheme(withPlaceholder_1.default(withEditModeCover_1.default(DashboardViz, disableEditModeCover), useIconPlaceholder));
1048
+ };
1049
+
1050
+ exports.default = withDashboardViz;
1051
+
1052
+ /***/ }),
1053
+ /* 28 */
1054
+ /***/ (function(module, exports) {
1055
+
1056
+ module.exports = require("@splunk/themes/getSettingsFromThemedProps");
1057
+
1058
+ /***/ }),
1059
+ /* 29 */
1060
+ /***/ (function(module, exports) {
1061
+
1062
+ module.exports = require("@splunk/visualization-encoding/Options");
1063
+
1064
+ /***/ }),
1065
+ /* 30 */
1066
+ /***/ (function(module, exports) {
1067
+
1068
+ module.exports = require("@splunk/visualizations-shared/SanitizeProps");
1069
+
1070
+ /***/ }),
1071
+ /* 31 */
1072
+ /***/ (function(module, exports, __webpack_require__) {
1073
+
1074
+ "use strict";
1075
+
1076
+
1077
+ var _classCallCheck = __webpack_require__(10);
1078
+
1079
+ Object.defineProperty(exports, "__esModule", {
1080
+ value: true
1081
+ });
1082
+ exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
1083
+ /* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
1084
+
1085
+ var T = __webpack_require__(0);
1086
+
1087
+ var lodash_1 = __webpack_require__(2);
1088
+
1089
+ var VizActionHandler_1 = __webpack_require__(32); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
1090
+
1091
+
1092
+ exports.INITIAL_WIDTH = 250;
1093
+ exports.INITIAL_HEIGHT = 250;
1094
+ /**
1095
+ * A Splunk visualization
1096
+ */
1097
+
1098
+ var SplunkVisualization = function SplunkVisualization() {
1099
+ _classCallCheck(this, SplunkVisualization);
1100
+ };
1101
+
1102
+ SplunkVisualization.propTypes = {
1103
+ /**
1104
+ * display mode
1105
+ */
1106
+ mode: T.oneOf(['view', 'edit', 'export']).isRequired,
1107
+
1108
+ /**
1109
+ * width in pixel or string, defaults to 100%
1110
+ */
1111
+ width: T.oneOfType([T.string, T.number]).isRequired,
1112
+
1113
+ /**
1114
+ * height in pixel or string
1115
+ */
1116
+ height: T.oneOfType([T.string, T.number]).isRequired,
1117
+
1118
+ /**
1119
+ * visualization context used for dynamic option evaluation
1120
+ */
1121
+ context: T.object,
1122
+
1123
+ /**
1124
+ * visualization formatting options
1125
+ */
1126
+ options: T.object,
1127
+
1128
+ /**
1129
+ * A callback to update formatting options
1130
+ */
1131
+ onOptionsChange: T.func,
1132
+
1133
+ /**
1134
+ * datasource state which include data and request params, object key indicate the datasource type.
1135
+ */
1136
+ dataSources: T.objectOf(T.shape({
1137
+ /**
1138
+ * current request params
1139
+ */
1140
+ requestParams: T.object,
1141
+
1142
+ /**
1143
+ * current dataset
1144
+ */
1145
+ data: T.shape({
1146
+ fields: T.array,
1147
+ columns: T.array
1148
+ }),
1149
+
1150
+ /**
1151
+ * error
1152
+ */
1153
+ error: T.shape({
1154
+ level: T.string,
1155
+ message: T.string
1156
+ }),
1157
+
1158
+ /**
1159
+ * meta data that came with the dataset
1160
+ */
1161
+ meta: T.object
1162
+ })),
1163
+
1164
+ /**
1165
+ * A callback to trigger event
1166
+ */
1167
+ onEventTrigger: T.func,
1168
+
1169
+ /**
1170
+ * Inform viz if there are handlers listening to events
1171
+ */
1172
+ hasEventHandlers: T.bool,
1173
+
1174
+ /**
1175
+ * A callback to communicate computed props to a consumer
1176
+ */
1177
+ onComputedProps: T.func,
1178
+
1179
+ /**
1180
+ * A callback to obtain visualization api
1181
+ */
1182
+ vizActionHandlerRef: T.func,
1183
+ loading: T.bool,
1184
+ theme: T.object,
1185
+
1186
+ /**
1187
+ * A callback to request new data with updated request params
1188
+ */
1189
+ onRequestParamsChange: T.func
1190
+ };
1191
+ /**
1192
+ *
1193
+ */
1194
+
1195
+ SplunkVisualization.defaultProps = {
1196
+ // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
1197
+ width: '100%',
1198
+ height: exports.INITIAL_HEIGHT,
1199
+ dataSources: {},
1200
+ onEventTrigger: function onEventTrigger() {
1201
+ return {};
1202
+ },
1203
+ mode: 'view',
1204
+ hasEventHandlers: false,
1205
+ options: {},
1206
+ context: {},
1207
+ onOptionsChange: function onOptionsChange() {
1208
+ return {};
1209
+ },
1210
+ vizActionHandlerRef: function vizActionHandlerRef() {
1211
+ return new VizActionHandler_1.DefaultVizActionHandler();
1212
+ },
1213
+ onComputedProps: function onComputedProps() {
1214
+ return {};
1215
+ },
1216
+ loading: false,
1217
+ onRequestParamsChange: lodash_1.noop
1218
+ };
1219
+ exports.default = SplunkVisualization;
1220
+
1221
+ /***/ }),
1222
+ /* 32 */
1223
+ /***/ (function(module, exports, __webpack_require__) {
1224
+
1225
+ "use strict";
1226
+
1227
+
1228
+ var _classCallCheck = __webpack_require__(10);
1229
+
1230
+ var _createClass = __webpack_require__(15);
1231
+
1232
+ Object.defineProperty(exports, "__esModule", {
1233
+ value: true
1234
+ });
1235
+ exports.DefaultVizActionHandler = void 0;
1236
+
1237
+ var DefaultVizActionHandler = /*#__PURE__*/function () {
1238
+ function DefaultVizActionHandler() {
1239
+ _classCallCheck(this, DefaultVizActionHandler);
1240
+ }
1241
+
1242
+ _createClass(DefaultVizActionHandler, [{
1243
+ key: "focus",
1244
+ value: function focus() {// noop
1245
+ }
1246
+ }, {
1247
+ key: "snapshot",
1248
+ value: function snapshot() {
1249
+ return null; // noop
1250
+ }
1251
+ }]);
1252
+
1253
+ return DefaultVizActionHandler;
1254
+ }();
1255
+
1256
+ exports.DefaultVizActionHandler = DefaultVizActionHandler;
1257
+
1258
+ /***/ }),
1259
+ /* 33 */
1260
+ /***/ (function(module, exports, __webpack_require__) {
1261
+
1262
+ "use strict";
1263
+
1264
+
1265
+ Object.defineProperty(exports, "__esModule", {
1266
+ value: true
1267
+ });
1268
+ exports.validSortDirs = void 0;
1269
+ exports.validSortDirs = ['asc', 'desc', 'none'];
1270
+
1271
+ /***/ }),
1272
+ /* 34 */
1273
+ /***/ (function(module, exports, __webpack_require__) {
1274
+
1275
+ "use strict";
1276
+
1277
+
1278
+ Object.defineProperty(exports, "__esModule", {
1279
+ value: true
1280
+ });
1281
+ exports.useDeepMemo = void 0;
1282
+
1283
+ var react_1 = __webpack_require__(1);
1284
+
1285
+ var lodash_1 = __webpack_require__(2);
1286
+ /**
1287
+ * This hook evaluates and stores the result of a passed function and only
1288
+ * re-evaluates the function when passed dependencies change.
1289
+ *
1290
+ * It is different from the internal React useMemo in the following aspects:
1291
+ * - it only stores the last evaluated result
1292
+ * - it uses a deep equality check to determine if dependencies have changed
1293
+ *
1294
+ * Inspired by apollo-client's useDeepMemo
1295
+ *
1296
+ * @param fn the function to be executed and
1297
+ * @param dependencies an array of dependencies
1298
+ */
1299
+
1300
+
1301
+ var useDeepMemo = function useDeepMemo(fn, dependencies) {
1302
+ var ref = react_1.useRef();
1303
+
1304
+ if (!ref.current || !lodash_1.isEqual(dependencies, ref.current.dependencies)) {
1305
+ ref.current = {
1306
+ dependencies: dependencies,
1307
+ value: fn()
1308
+ };
1309
+ }
1310
+
1311
+ return ref.current.value;
1312
+ };
1313
+
1314
+ exports.useDeepMemo = useDeepMemo;
1315
+
1316
+ /***/ }),
1317
+ /* 35 */
1318
+ /***/ (function(module, exports, __webpack_require__) {
1319
+
1320
+ "use strict";
1321
+
1322
+
1323
+ Object.defineProperty(exports, "__esModule", {
1324
+ value: true
1325
+ });
1326
+ exports.pickFieldFromJSONSchema = void 0;
1327
+
1328
+ var lodash_1 = __webpack_require__(2);
1329
+
1330
+ var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
1331
+ var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
1332
+ return Object.keys(optionsSchema).reduce(function (accum, k) {
1333
+ if (lodash_1.has(optionsSchema[k], fieldName)) {
1334
+ accum[k] = optionsSchema[k][fieldName];
1335
+ } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
1336
+ var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
1337
+
1338
+ if (!lodash_1.isEmpty(nestedSchema)) {
1339
+ accum[k] = nestedSchema;
1340
+ }
1341
+ }
1342
+
1343
+ return accum;
1344
+ }, {});
1345
+ };
1346
+
1347
+ exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
1348
+
1349
+ /***/ }),
1350
+ /* 36 */
1351
+ /***/ (function(module, exports, __webpack_require__) {
1352
+
1353
+ "use strict";
1354
+
1355
+
1356
+ Object.defineProperty(exports, "__esModule", {
1357
+ value: true
1358
+ });
1359
+ exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
1360
+
1361
+ var React = __webpack_require__(1);
1362
+
1363
+ var T = __webpack_require__(0);
1364
+
1365
+ var i18n_1 = __webpack_require__(3);
1366
+
1367
+ var Message_1 = __webpack_require__(9);
1368
+
1369
+ var FixedSizeContainer_1 = __webpack_require__(12);
1370
+ /**
1371
+ * @method isMissing
1372
+ * @param {any} v
1373
+ * @returns {boolean} true if the input value === null or undefined
1374
+ */
1375
+
1376
+
1377
+ var isMissing = function isMissing(v) {
1378
+ return v === null || v === undefined;
1379
+ };
1380
+
1381
+ exports.isMissing = isMissing;
1382
+ /**
1383
+ * @method misskingKeys
1384
+ * @param {string[]} keys
1385
+ * @param {object} target
1386
+ * @returns {string[]} the keys of missing required props
1387
+ */
1388
+
1389
+ var missingKeys = function missingKeys(keys, target) {
1390
+ return keys.filter(function (k) {
1391
+ return exports.isMissing(target[k]);
1392
+ });
1393
+ };
1394
+
1395
+ exports.missingKeys = missingKeys;
1396
+ var propTypes = {
1397
+ width: T.oneOfType([T.string, T.number]),
1398
+ height: T.oneOfType([T.string, T.number]),
1399
+ // eslint-disable-next-line react/no-unused-prop-types
1400
+ backgroundColor: T.string,
1401
+ missingProps: T.arrayOf(T.string)
1402
+ };
1403
+ /**
1404
+ * @method MissingPropsMessage
1405
+ * @param {MissingPropsProps} props
1406
+ * @returns {React.ReactElement}
1407
+ */
1408
+
1409
+ var MissingPropsMessage = function MissingPropsMessage(props) {
1410
+ var width = props.width,
1411
+ height = props.height,
1412
+ missingProps = props.missingProps;
1413
+ return React.createElement(Message_1.default, {
1414
+ "data-test": "message",
1415
+ width: width,
1416
+ height: height,
1417
+ message: i18n_1._("Missing property: ".concat(missingProps.join(', ')))
1418
+ });
1419
+ };
1420
+
1421
+ exports.MissingPropsMessage = MissingPropsMessage;
1422
+ exports.MissingPropsMessage.propTypes = propTypes;
1423
+ exports.MissingPropsMessage.defaultProps = {
1424
+ width: '100%',
1425
+ height: 250
1426
+ };
1427
+ exports.default = FixedSizeContainer_1.default(exports.MissingPropsMessage);
1428
+
1429
+ /***/ }),
1430
+ /* 37 */
1431
+ /***/ (function(module, exports, __webpack_require__) {
1432
+
1433
+ "use strict";
1434
+
1435
+
1436
+ Object.defineProperty(exports, "__esModule", {
1437
+ value: true
1438
+ });
1439
+
1440
+ var React = __webpack_require__(1);
1441
+
1442
+ var styled_components_1 = __webpack_require__(4);
1443
+
1444
+ var hocUtils_1 = __webpack_require__(7);
1445
+
1446
+ var Cover = styled_components_1.default.div.withConfig({
1447
+ displayName: "withEditModeCover__Cover",
1448
+ componentId: "sc-1gsbnxb-0"
1449
+ })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
1450
+ var Blocker = styled_components_1.default.div.attrs({
1451
+ 'data-splunk-visualization-version': "24.3.2 - 1cf892b72"
1452
+ }).withConfig({
1453
+ displayName: "withEditModeCover__Blocker",
1454
+ componentId: "sc-1gsbnxb-1"
1455
+ })(["position:relative;width:100%;height:100%;"]);
1456
+ /**
1457
+ * HOC that renders a cover layer in edit mode
1458
+ * @method withEditModeCover
1459
+ * @param {ExtendedDashViz} Visualization
1460
+ * @returns {ExtendedDashViz} Wrapper
1461
+ */
1462
+
1463
+ var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
1464
+ var Wrapper = function Wrapper(props) {
1465
+ var mode = props.mode;
1466
+ var showEditCover = mode === 'edit' && !disableEditModeCover;
1467
+ return React.createElement(Blocker, null, React.createElement(Visualization, Object.assign({}, props)), showEditCover && React.createElement(Cover, {
1468
+ "data-test": "edit-mode-cover"
1469
+ }));
1470
+ };
1471
+
1472
+ hocUtils_1.extendStaticWrapperProps({
1473
+ Wrapper: Wrapper,
1474
+ Visualization: Visualization
1475
+ });
1476
+ return Wrapper;
1477
+ };
1478
+
1479
+ exports.default = withEditModeCover;
1480
+
1481
+ /***/ }),
1482
+ /* 38 */
1483
+ /***/ (function(module, exports, __webpack_require__) {
1484
+
1485
+ "use strict";
1486
+
1487
+
1488
+ Object.defineProperty(exports, "__esModule", {
1489
+ value: true
1490
+ });
1491
+
1492
+ var React = __webpack_require__(1);
1493
+
1494
+ var colorUtils_1 = __webpack_require__(11);
1495
+
1496
+ var IconPlaceholder_1 = __webpack_require__(25);
1497
+
1498
+ var VizBehavior_1 = __webpack_require__(5);
1499
+
1500
+ var hocUtils_1 = __webpack_require__(7);
1501
+
1502
+ var withPlaceholder = function withPlaceholder(Visualization) {
1503
+ var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
1504
+ var config = Visualization.config;
1505
+ var themes = config.themes;
1506
+
1507
+ var Wrapper = function Wrapper(props) {
1508
+ var _a;
1509
+
1510
+ var dataSources = props.dataSources,
1511
+ loading = props.loading,
1512
+ options = props.options,
1513
+ height = props.height,
1514
+ width = props.width;
1515
+ var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
1516
+ var bgColorFromTheme = colorUtils_1.isColor(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
1517
+
1518
+ if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
1519
+ return React.createElement(IconPlaceholder_1.default, {
1520
+ "data-test": "icon-placeholder",
1521
+ icon: config.icon,
1522
+ width: width,
1523
+ height: height,
1524
+ backgroundColor: bgColorFromTheme
1525
+ });
1526
+ }
1527
+
1528
+ return React.createElement(Visualization, Object.assign({}, props));
1529
+ };
1530
+
1531
+ hocUtils_1.extendStaticWrapperProps({
1532
+ Wrapper: Wrapper,
1533
+ Visualization: Visualization
1534
+ });
1535
+ return Wrapper;
1536
+ };
1537
+
1538
+ exports.default = withPlaceholder;
1539
+
1540
+ /***/ }),
1541
+ /* 39 */
1542
+ /***/ (function(module, exports) {
1543
+
1544
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
1545
+
1546
+ /***/ }),
1547
+ /* 40 */,
1548
+ /* 41 */
1549
+ /***/ (function(module, exports) {
1550
+
1551
+ module.exports = require("@splunk/visualization-color-palettes");
1552
+
1553
+ /***/ }),
1554
+ /* 42 */
1555
+ /***/ (function(module, exports) {
1556
+
1557
+ module.exports = require("@splunk/visualization-icons");
1558
+
1559
+ /***/ }),
1560
+ /* 43 */,
1561
+ /* 44 */,
1562
+ /* 45 */,
1563
+ /* 46 */,
1564
+ /* 47 */,
1565
+ /* 48 */,
1566
+ /* 49 */
1567
+ /***/ (function(module, exports) {
1568
+
1569
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
1570
+
1571
+ /***/ }),
1572
+ /* 50 */,
1573
+ /* 51 */,
1574
+ /* 52 */,
1575
+ /* 53 */,
1576
+ /* 54 */,
1577
+ /* 55 */,
1578
+ /* 56 */,
1579
+ /* 57 */,
1580
+ /* 58 */,
1581
+ /* 59 */,
1582
+ /* 60 */,
1583
+ /* 61 */,
1584
+ /* 62 */,
1585
+ /* 63 */,
1586
+ /* 64 */,
1587
+ /* 65 */,
1588
+ /* 66 */,
1589
+ /* 67 */,
1590
+ /* 68 */,
1591
+ /* 69 */
1592
+ /***/ (function(module, exports) {
1593
+
1594
+ module.exports = require("d3-scale");
1595
+
1596
+ /***/ }),
1597
+ /* 70 */
1598
+ /***/ (function(module, exports) {
1599
+
1600
+ module.exports = require("@splunk/themes");
1601
+
1602
+ /***/ }),
1603
+ /* 71 */,
1604
+ /* 72 */,
1605
+ /* 73 */,
1606
+ /* 74 */,
1607
+ /* 75 */,
1608
+ /* 76 */,
1609
+ /* 77 */,
1610
+ /* 78 */,
1611
+ /* 79 */,
1612
+ /* 80 */,
1613
+ /* 81 */,
1614
+ /* 82 */,
1615
+ /* 83 */,
1616
+ /* 84 */,
1617
+ /* 85 */,
1618
+ /* 86 */,
1619
+ /* 87 */,
1620
+ /* 88 */,
1621
+ /* 89 */,
1622
+ /* 90 */,
1623
+ /* 91 */,
1624
+ /* 92 */,
1625
+ /* 93 */,
1626
+ /* 94 */,
1627
+ /* 95 */,
1628
+ /* 96 */,
1629
+ /* 97 */,
1630
+ /* 98 */,
1631
+ /* 99 */,
1632
+ /* 100 */
1633
+ /***/ (function(module, exports) {
1634
+
1635
+ module.exports = require("@splunk/react-ui/Popover");
1636
+
1637
+ /***/ }),
1638
+ /* 101 */,
1639
+ /* 102 */,
1640
+ /* 103 */,
1641
+ /* 104 */,
1642
+ /* 105 */,
1643
+ /* 106 */,
1644
+ /* 107 */,
1645
+ /* 108 */,
1646
+ /* 109 */,
1647
+ /* 110 */,
1648
+ /* 111 */,
1649
+ /* 112 */,
1650
+ /* 113 */,
1651
+ /* 114 */,
1652
+ /* 115 */,
1653
+ /* 116 */,
1654
+ /* 117 */,
1655
+ /* 118 */,
1656
+ /* 119 */,
1657
+ /* 120 */,
1658
+ /* 121 */,
1659
+ /* 122 */,
1660
+ /* 123 */
1661
+ /***/ (function(module, exports) {
1662
+
1663
+ module.exports = require("maplibre-gl");
1664
+
1665
+ /***/ }),
1666
+ /* 124 */,
1667
+ /* 125 */,
1668
+ /* 126 */,
1669
+ /* 127 */,
1670
+ /* 128 */,
1671
+ /* 129 */,
1672
+ /* 130 */,
1673
+ /* 131 */,
1674
+ /* 132 */,
1675
+ /* 133 */,
1676
+ /* 134 */,
1677
+ /* 135 */,
1678
+ /* 136 */,
1679
+ /* 137 */,
1680
+ /* 138 */,
1681
+ /* 139 */,
1682
+ /* 140 */,
1683
+ /* 141 */,
1684
+ /* 142 */,
1685
+ /* 143 */,
1686
+ /* 144 */,
1687
+ /* 145 */,
1688
+ /* 146 */,
1689
+ /* 147 */,
1690
+ /* 148 */,
1691
+ /* 149 */,
1692
+ /* 150 */,
1693
+ /* 151 */,
1694
+ /* 152 */,
1695
+ /* 153 */,
1696
+ /* 154 */,
1697
+ /* 155 */,
1698
+ /* 156 */,
1699
+ /* 157 */,
1700
+ /* 158 */,
1701
+ /* 159 */,
1702
+ /* 160 */,
1703
+ /* 161 */,
1704
+ /* 162 */,
1705
+ /* 163 */,
1706
+ /* 164 */,
1707
+ /* 165 */,
1708
+ /* 166 */,
1709
+ /* 167 */,
1710
+ /* 168 */,
1711
+ /* 169 */,
1712
+ /* 170 */,
1713
+ /* 171 */,
1714
+ /* 172 */,
1715
+ /* 173 */,
1716
+ /* 174 */,
1717
+ /* 175 */,
1718
+ /* 176 */,
1719
+ /* 177 */,
1720
+ /* 178 */,
1721
+ /* 179 */,
1722
+ /* 180 */,
1723
+ /* 181 */,
1724
+ /* 182 */,
1725
+ /* 183 */,
1726
+ /* 184 */,
1727
+ /* 185 */,
1728
+ /* 186 */,
1729
+ /* 187 */,
1730
+ /* 188 */,
1731
+ /* 189 */
1732
+ /***/ (function(module, exports, __webpack_require__) {
1733
+
1734
+ "use strict";
1735
+
1736
+
1737
+ Object.defineProperty(exports, "__esModule", {
1738
+ value: true
1739
+ });
1740
+ exports.PureMap = exports.config = exports.themes = exports.computeVizProps = void 0;
1741
+
1742
+ var colorUtils_1 = __webpack_require__(11);
1743
+
1744
+ var types_1 = __webpack_require__(190);
1745
+
1746
+ var PureMap_1 = __webpack_require__(191);
1747
+
1748
+ exports.PureMap = PureMap_1.default;
1749
+
1750
+ var config_1 = __webpack_require__(199);
1751
+
1752
+ exports.config = config_1.default;
1753
+
1754
+ var withDashboardViz_1 = __webpack_require__(27);
1755
+
1756
+ var computeVizProps = function computeVizProps(_ref) {
1757
+ var themeFunc = _ref.themeFunc,
1758
+ theme = _ref.theme,
1759
+ layers = _ref.layers,
1760
+ dataSources = _ref.dataSources;
1761
+ var themeColorVariables = ['controlBackgroundColor', 'controlForegroundColor'];
1762
+ var themeColors = {};
1763
+ themeColorVariables.forEach(function (variable) {
1764
+ themeColors[variable] = themeFunc(variable);
1765
+ }); // Markers use different icons, Bubbles has different styles for light and dark theme
1766
+ // this prop is passed for that
1767
+
1768
+ var themeColorScheme = (theme === null || theme === void 0 ? void 0 : theme.splunkThemeV1) ? theme === null || theme === void 0 ? void 0 : theme.splunkThemeV1.colorScheme : 'dark';
1769
+ layers.forEach(function (l) {
1770
+ var _a, _b, _c, _d; // add key `geobin` to the layer object if the data is returned from geostats commands
1771
+ // to distinguish geostats commands from table commands
1772
+
1773
+
1774
+ var dataSourceData = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : {};
1775
+ var geobinIdx = ((_c = dataSourceData.fields) !== null && _c !== void 0 ? _c : []).map(function (field) {
1776
+ return typeof field === 'string' ? field : field.name;
1777
+ }).indexOf('geobin');
1778
+ var layer = l;
1779
+
1780
+ if (geobinIdx > -1) {
1781
+ layer.geobin = dataSourceData.columns[geobinIdx];
1782
+ }
1783
+
1784
+ layer.bubbleSizeFields = ((_d = dataSourceData.fields) !== null && _d !== void 0 ? _d : []).map(function (field) {
1785
+ return typeof field === 'string' ? field : field.name;
1786
+ }).filter(function (field, index) {
1787
+ var _a, _b;
1788
+
1789
+ return !['latitude', 'longitude', 'geobin'].includes(field) && types_1.inferDataTypeFromData((_b = (_a = dataSourceData.columns) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : []) === 'number';
1790
+ }); // Sanitize colors within layers
1791
+
1792
+ layer.seriesColors = Array.isArray(layer.seriesColors) ? colorUtils_1.sanitizeArrayOfColors(layer.seriesColors) : undefined;
1793
+ layer.dataColors = Array.isArray(layer.dataColors) ? colorUtils_1.sanitizeArrayOfColors(layer.dataColors) : undefined;
1794
+ });
1795
+ return Object.assign(Object.assign(Object.assign({}, themeColors), {
1796
+ themeColorScheme: themeColorScheme
1797
+ }), layers);
1798
+ };
1799
+
1800
+ exports.computeVizProps = computeVizProps;
1801
+ var Map = withDashboardViz_1.default({
1802
+ ReactViz: PureMap_1.default,
1803
+ vizConfig: config_1.default,
1804
+ computeVizProps: exports.computeVizProps,
1805
+ disableEditModeCover: true,
1806
+ useIconPlaceholder: function useIconPlaceholder() {
1807
+ return false;
1808
+ }
1809
+ });
1810
+ var themes = config_1.default.themes;
1811
+ exports.themes = themes;
1812
+ exports.default = Map;
1813
+
1814
+ /***/ }),
1815
+ /* 190 */
1816
+ /***/ (function(module, exports) {
1817
+
1818
+ module.exports = require("@splunk/visualization-encoding/utils/types");
1819
+
1820
+ /***/ }),
1821
+ /* 191 */
1822
+ /***/ (function(module, exports, __webpack_require__) {
1823
+
1824
+ "use strict";
1825
+
1826
+
1827
+ var _slicedToArray = __webpack_require__(49);
1828
+
1829
+ Object.defineProperty(exports, "__esModule", {
1830
+ value: true
1831
+ });
1832
+ exports.isLatLng = exports.formatColor = exports.DEFAULT_ZOOM = exports.DEFAULT_SHOW_SCALE = exports.DEFAULT_SCALE_UNIT = exports.DEFAULT_CONTROL_FOREGROUND_COLOR = exports.DEFAULT_CONTROL_BACKGROUND_COLOR = exports.DEFAULT_CENTER = void 0;
1833
+
1834
+ var React = __webpack_require__(1);
1835
+
1836
+ var lodash_1 = __webpack_require__(2);
1837
+
1838
+ var react_1 = __webpack_require__(1);
1839
+
1840
+ var T = __webpack_require__(0);
1841
+
1842
+ var chroma = __webpack_require__(192);
1843
+
1844
+ var maplibre_gl_1 = __webpack_require__(123);
1845
+
1846
+ var MapContext_1 = __webpack_require__(193);
1847
+
1848
+ var PureMapContainer_1 = __webpack_require__(194);
1849
+
1850
+ __webpack_require__(195);
1851
+
1852
+ var MapUtils_1 = __webpack_require__(196);
1853
+
1854
+ var Tooltip_1 = __webpack_require__(198);
1855
+
1856
+ exports.DEFAULT_CENTER = [0, 0];
1857
+ exports.DEFAULT_CONTROL_BACKGROUND_COLOR = '#2b3033';
1858
+ exports.DEFAULT_CONTROL_FOREGROUND_COLOR = '#B5B5B5';
1859
+ exports.DEFAULT_SCALE_UNIT = 'imperial';
1860
+ exports.DEFAULT_SHOW_SCALE = true;
1861
+ exports.DEFAULT_ZOOM = 0; // convert rgb/rgba/hex color to encoded color & opacity for SVG strings
1862
+
1863
+ var formatColor = function formatColor(color) {
1864
+ var chromaColor = chroma(color);
1865
+ return {
1866
+ color: chroma(chromaColor.rgb()).hex().replace('#', '%23'),
1867
+ opacity: chromaColor.alpha()
1868
+ };
1869
+ };
1870
+
1871
+ exports.formatColor = formatColor;
1872
+ PureMapContainer_1.default.displayName = 'PureMapContainer';
1873
+
1874
+ var PureMap = function PureMap(props) {
1875
+ var width = props.width,
1876
+ height = props.height,
1877
+ backgroundColor = props.backgroundColor,
1878
+ baseLayerTileServer = props.baseLayerTileServer,
1879
+ baseLayerTileServerType = props.baseLayerTileServerType,
1880
+ center = props.center,
1881
+ controlBackgroundColor = props.controlBackgroundColor,
1882
+ controlForegroundColor = props.controlForegroundColor,
1883
+ layers = props.layers,
1884
+ scaleUnit = props.scaleUnit,
1885
+ showScale = props.showScale,
1886
+ themeColorScheme = props.themeColorScheme,
1887
+ zoom = props.zoom,
1888
+ onMapLoad = props.onMapLoad;
1889
+
1890
+ var _react_1$useContext = react_1.useContext(MapContext_1.default),
1891
+ defaultTileConfig = _react_1$useContext.defaultTileConfig,
1892
+ customTileConfig = _react_1$useContext.customTileConfig;
1893
+
1894
+ var basemapContainer = react_1.useRef(null);
1895
+ var map = react_1.useRef(null);
1896
+ var scaleControl = react_1.useRef(null);
1897
+ var zoomControl = react_1.useRef(null);
1898
+
1899
+ var _react_1$useMemo = react_1.useMemo(function () {
1900
+ return MapUtils_1.getTilePreset({
1901
+ defaultTileConfig: defaultTileConfig,
1902
+ customTileConfig: customTileConfig
1903
+ });
1904
+ }, [defaultTileConfig, customTileConfig]),
1905
+ tilePreset = _react_1$useMemo.tilePreset,
1906
+ defaultTileLight = _react_1$useMemo.defaultTileLight,
1907
+ defaultTileDark = _react_1$useMemo.defaultTileDark;
1908
+
1909
+ var _React$useState = React.useState({}),
1910
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1911
+ tooltipProps = _React$useState2[0],
1912
+ setTooltipProps = _React$useState2[1];
1913
+
1914
+ var lngLatCenter = react_1.useMemo(function () {
1915
+ return [center[1], center[0]];
1916
+ }, [center]);
1917
+ var initializeMap = react_1.useCallback(function (mapStyle) {
1918
+ map.current = new maplibre_gl_1.Map({
1919
+ container: basemapContainer.current,
1920
+ style: mapStyle,
1921
+ center: lngLatCenter,
1922
+ zoom: zoom
1923
+ }); // Fired immediately after all necessary resources have been downloaded
1924
+ // and the first visually complete rendering of the map has occurred.
1925
+
1926
+ map.current.on('load', function () {
1927
+ onMapLoad();
1928
+ }); // zoom
1929
+
1930
+ zoomControl.current = new maplibre_gl_1.NavigationControl({
1931
+ showCompass: false
1932
+ });
1933
+ map.current.addControl(zoomControl.current, 'top-left');
1934
+ }, [lngLatCenter, zoom]);
1935
+ var initializeScale = react_1.useCallback(function () {
1936
+ scaleControl.current = new maplibre_gl_1.ScaleControl({
1937
+ maxWidth: 70,
1938
+ unit: scaleUnit
1939
+ });
1940
+ map.current.addControl(scaleControl.current);
1941
+ }, [scaleUnit]);
1942
+ var updateScale = react_1.useCallback(function () {
1943
+ var _a;
1944
+
1945
+ if (showScale) {
1946
+ (_a = scaleControl === null || scaleControl === void 0 ? void 0 : scaleControl.current) === null || _a === void 0 ? void 0 : _a.setUnit(scaleUnit);
1947
+ }
1948
+ }, [scaleUnit, showScale]);
1949
+ react_1.useEffect(function () {
1950
+ if (map.current) {
1951
+ map.current.resize();
1952
+ }
1953
+ }, [width, height]);
1954
+ react_1.useEffect(function () {
1955
+ // do not render when defaultTileConfig, customTileConfig and tileset are not configured
1956
+ if (Object.keys(tilePreset).length === 0 && (!baseLayerTileServer || !baseLayerTileServerType)) {
1957
+ // eslint-disable-next-line no-console
1958
+ console.warn('Map Tile Server configuration is missing or invalid. Please provide a valid configuration');
1959
+ return;
1960
+ }
1961
+
1962
+ var mapStyle = MapUtils_1.getMapStyle({
1963
+ baseLayerTileServer: baseLayerTileServer,
1964
+ baseLayerTileServerType: baseLayerTileServerType,
1965
+ tilePreset: tilePreset,
1966
+ colorScheme: themeColorScheme,
1967
+ defaultTileLight: defaultTileLight,
1968
+ defaultTileDark: defaultTileDark
1969
+ });
1970
+ mapStyle.version = MapUtils_1.MAP_STYLE_VERSION_NUMBER; // If the map has already been initialized, we update the styles
1971
+
1972
+ if (map.current) {
1973
+ // Refer to https://maplibre.org/maplibre-gl-js-docs/api/map/#setstyle-example for options.diff (default is true)
1974
+ map.current.setStyle(lodash_1.omit(mapStyle, ['theme', 'name', 'key']));
1975
+ updateScale();
1976
+ } else {
1977
+ // initialize the map only once with a constructed style from user configured options
1978
+ // or default configs from the map context
1979
+ initializeMap(lodash_1.omit(mapStyle, ['theme', 'name', 'key']));
1980
+ initializeScale();
1981
+ return;
1982
+ } // eslint-disable-next-line consistent-return
1983
+
1984
+
1985
+ return function () {
1986
+ // free resources
1987
+ map === null || map === void 0 ? void 0 : map.current.remove();
1988
+ map.current = undefined;
1989
+ };
1990
+ }, [tilePreset, initializeMap, initializeScale, updateScale, defaultTileLight, defaultTileDark, baseLayerTileServer, baseLayerTileServerType, themeColorScheme]);
1991
+ react_1.useEffect(function () {
1992
+ if (map.current) {
1993
+ map.current.flyTo({
1994
+ center: lngLatCenter,
1995
+ zoom: zoom
1996
+ });
1997
+ }
1998
+ }, [lngLatCenter, zoom]);
1999
+ react_1.useEffect(function () {
2000
+ var cleanupLayer = function cleanupLayer() {};
2001
+
2002
+ var markers = [];
2003
+ var bubbles = [];
2004
+
2005
+ if (map.current && layers && layers.length && map.current.isStyleLoaded) {
2006
+ try {
2007
+ if (layers[0].type === 'marker' && !('geobin' in layers[0])) {
2008
+ // support for only single layer
2009
+ var markerLayer = layers[0];
2010
+ markerLayer.seriesColors = markerLayer.seriesColors ? markerLayer.seriesColors : MapUtils_1.DEFAULT_SERIES_COLORS;
2011
+
2012
+ cleanupLayer = function cleanupLayer() {
2013
+ if (markers) {
2014
+ markers.forEach(function (marker) {
2015
+ return marker === null || marker === void 0 ? void 0 : marker.remove();
2016
+ });
2017
+ markers = [];
2018
+ }
2019
+ };
2020
+
2021
+ if (markerLayer) {
2022
+ // Remove any existing markers
2023
+ cleanupLayer();
2024
+ var renderedMarkerLayer = MapUtils_1.renderMarkerLayer(markerLayer, themeColorScheme, map, setTooltipProps);
2025
+ markers = renderedMarkerLayer && renderedMarkerLayer.markers;
2026
+ }
2027
+ }
2028
+
2029
+ if (layers[0].type === 'bubble') {
2030
+ // support for only single layer
2031
+ var bubbleLayer = layers[0];
2032
+ bubbleLayer.seriesColors = bubbleLayer.seriesColors ? bubbleLayer.seriesColors : MapUtils_1.DEFAULT_SERIES_COLORS; // update bubbles on events
2033
+
2034
+ cleanupLayer = function cleanupLayer() {
2035
+ if (bubbles && bubbles.length) {
2036
+ bubbles.forEach(function (bubble) {
2037
+ return bubble.remove();
2038
+ });
2039
+ bubbles = [];
2040
+ }
2041
+ }; // render bubbles with data returned from geostats cmds
2042
+
2043
+
2044
+ if (bubbleLayer.geobin && bubbleLayer.bubbleSize) {
2045
+ bubbleLayer.seriesColors = bubbleLayer.seriesColors ? bubbleLayer.seriesColors : MapUtils_1.DEFAULT_SERIES_COLORS;
2046
+ var data = MapUtils_1.bakeBubbleData(bubbleLayer);
2047
+ var staticColors = MapUtils_1.getStaticColors(bubbleLayer.bubbleSize.length, bubbleLayer.seriesColors);
2048
+
2049
+ if (data && staticColors && staticColors.length) {
2050
+ // render bubbles when layers options get update
2051
+ bubbles = MapUtils_1.updateBubbles(data, zoom, staticColors, bubbleLayer.dataColors, themeColorScheme, map, setTooltipProps); // render bubbles on zoom
2052
+
2053
+ map.current.on('zoomend', function () {
2054
+ cleanupLayer();
2055
+ bubbles = MapUtils_1.updateBubbles(data, map.current.getZoom(), staticColors, bubbleLayer.dataColors, themeColorScheme, map, setTooltipProps);
2056
+ });
2057
+ }
2058
+ }
2059
+ }
2060
+ } catch (err) {
2061
+ console.error(err);
2062
+ }
2063
+ }
2064
+
2065
+ return function () {
2066
+ cleanupLayer();
2067
+ };
2068
+ }, [layers, width, height, zoom, themeColorScheme]);
2069
+ var baseMapLayer = React.createElement(React.Fragment, null, React.createElement(PureMapContainer_1.default, {
2070
+ className: "puremap",
2071
+ width: width,
2072
+ height: height,
2073
+ backgroundColor: backgroundColor,
2074
+ controlBackgroundColor: controlBackgroundColor,
2075
+ controlForegroundColor: controlForegroundColor,
2076
+ controlIconColorEncoded: exports.formatColor(controlForegroundColor),
2077
+ ref: basemapContainer,
2078
+ showScale: showScale
2079
+ }), React.createElement(Tooltip_1.default, Object.assign({}, tooltipProps)));
2080
+ return baseMapLayer;
2081
+ };
2082
+
2083
+ var isLatLng = function isLatLng(props, propName, componentName) {
2084
+ if (props[propName][0] >= -180 && props[propName][0] <= 180 && props[propName][1] >= -90 && props[propName][1] <= 90) {
2085
+ throw new Error("".concat(componentName, " ").concat(propName, " may have reversed [lat, lon] ranges."));
2086
+ }
2087
+
2088
+ if (props[propName][0] < -90 || props[propName][0] > 90 || props[propName][1] < -180 || props[propName][1] > 180) {
2089
+ throw new Error("".concat(componentName, " ").concat(propName, " incorrect [lat, lon] ranges."));
2090
+ }
2091
+
2092
+ return null;
2093
+ };
2094
+
2095
+ exports.isLatLng = isLatLng;
2096
+ PureMap.propTypes = {
2097
+ // eslint-disable-next-line react/no-unused-prop-types
2098
+ mode: T.string,
2099
+ width: T.oneOfType([T.string, T.number]),
2100
+ height: T.oneOfType([T.string, T.number]),
2101
+ backgroundColor: T.string,
2102
+ baseLayerTileServer: T.string,
2103
+ baseLayerTileServerType: T.string,
2104
+ center: exports.isLatLng,
2105
+ controlBackgroundColor: T.string,
2106
+ controlForegroundColor: T.string,
2107
+ layers: T.arrayOf(T.shape({
2108
+ type: T.string,
2109
+ latitude: T.arrayOf(T.number),
2110
+ longitude: T.arrayOf(T.number),
2111
+ label: T.string,
2112
+ showInLegend: T.bool,
2113
+ dataColors: T.oneOfType([T.string, T.arrayOf(T.string)]),
2114
+ seriesColors: T.arrayOf(T.string),
2115
+ tooltipFields: T.arrayOf(T.string),
2116
+ resultLimit: T.number
2117
+ })),
2118
+ scaleUnit: T.string,
2119
+ showScale: T.bool,
2120
+ themeColorScheme: T.string,
2121
+ zoom: T.number,
2122
+ onMapLoad: T.func
2123
+ };
2124
+ PureMap.defaultProps = {
2125
+ mode: 'view',
2126
+ width: 800,
2127
+ height: 500,
2128
+ backgroundColor: '#0b0c0e',
2129
+ center: exports.DEFAULT_CENTER,
2130
+ controlBackgroundColor: exports.DEFAULT_CONTROL_BACKGROUND_COLOR,
2131
+ controlForegroundColor: exports.DEFAULT_CONTROL_FOREGROUND_COLOR,
2132
+ scaleUnit: exports.DEFAULT_SCALE_UNIT,
2133
+ showScale: exports.DEFAULT_SHOW_SCALE,
2134
+ layers: [],
2135
+ themeColorScheme: 'dark',
2136
+ zoom: exports.DEFAULT_ZOOM,
2137
+ onMapLoad: lodash_1.noop
2138
+ };
2139
+ exports.default = PureMap;
2140
+
2141
+ /***/ }),
2142
+ /* 192 */
2143
+ /***/ (function(module, exports) {
2144
+
2145
+ module.exports = require("chroma-js");
2146
+
2147
+ /***/ }),
2148
+ /* 193 */
2149
+ /***/ (function(module, exports) {
2150
+
2151
+ module.exports = require("@splunk/visualization-context/MapContext");
2152
+
2153
+ /***/ }),
2154
+ /* 194 */
2155
+ /***/ (function(module, exports, __webpack_require__) {
2156
+
2157
+ "use strict";
2158
+
2159
+
2160
+ Object.defineProperty(exports, "__esModule", {
2161
+ value: true
2162
+ });
2163
+
2164
+ var styled_components_1 = __webpack_require__(4);
2165
+
2166
+ var lodash_1 = __webpack_require__(2);
2167
+
2168
+ var style_1 = __webpack_require__(13);
2169
+
2170
+ var PureMapContainer = styled_components_1.default.div.withConfig({
2171
+ displayName: "PureMapContainer",
2172
+ componentId: "sc-1gjwxfv-0"
2173
+ })(["overflow:hidden;position:relative;z-index:0;background-color:", ";", ";.custom-marker{width:22px;height:28px;cursor:pointer;}.custom-bubble{cursor:pointer;}.maplibregl-ctrl-top-left{position:absolute;top:12px;left:16px;.maplibregl-ctrl-group{width:40px !important;height:87px !important;border-radius:4px;margin:8px 0px;background-color:", ";box-shadow:0px 26px 103px rgba(0,0,0,0.64),0px 11px 18px rgba(0,0,0,0.32),0px 3px 6px rgba(0,0,0,0.3);& button{width:40px;height:43px;border-top:0;}.mapboxgl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url('data:image/svg+xml;charset=UTF-8,<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M9 1C9 0.447715 8.55229 0 8 0C7.44772 0 7 0.447715 7 1V7H1C0.447715 7 0 7.44772 0 8C0 8.55229 0.447715 9 1 9H7V15C7 15.5523 7.44772 16 8 16C8.55229 16 9 15.5523 9 15V9H15C15.5523 9 16 8.55229 16 8C16 7.44772 15.5523 7 15 7H9V1Z\" fill=\"", "\" fill-opacity=\"", "\" /></svg>');}.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url('data:image/svg+xml;charset=UTF-8,<svg width=\"14\" height=\"3\" viewBox=\"0 0 14 3\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M0 1.99707C0 1.44479 0.447715 0.99707 1 0.99707H13C13.5523 0.99707 14 1.44479 14 1.99707C14 2.54936 13.5523 2.99707 13 2.99707H1C0.447715 2.99707 0 2.54936 0 1.99707Z\" fill=\"", "\" fill-opacity=\"", "\" /></svg>');}}}.maplibregl-ctrl-bottom-left{display:", ";position:absolute;z-index:0;bottom:16px;left:12px;width:86px;height:29px;border-radius:4px;margin:0;background-color:", ";box-shadow:0px 26px 103px rgba(0,0,0,0.13),0px 11px 18px rgba(0,0,0,0.06),0px 3px 6px rgba(0,0,0,0.06);.maplibregl-ctrl-scale{background-color:", ";color:", ";border:2px solid ", ";border-top:0;border-left:0;border-right:0;padding:0;margin:6px 8px 8px 8px;line-height:13px;letter-spacing:0.02em;font-family:sans-serif;font-size:10px;}}"], function (props) {
2174
+ return props.backgroundColor;
2175
+ }, function (props) {
2176
+ return style_1.toDimension(lodash_1.pick(props, ['width', 'height']));
2177
+ }, function (props) {
2178
+ return props.controlBackgroundColor;
2179
+ }, function (props) {
2180
+ return props.controlIconColorEncoded.color;
2181
+ }, function (props) {
2182
+ return props.controlIconColorEncoded.opacity;
2183
+ }, function (props) {
2184
+ return props.controlIconColorEncoded.color;
2185
+ }, function (props) {
2186
+ return props.controlIconColorEncoded.opacity;
2187
+ }, function (props) {
2188
+ return props.showScale ? 'inline' : 'none';
2189
+ }, function (props) {
2190
+ return props.controlBackgroundColor;
2191
+ }, function (props) {
2192
+ return props.controlBackgroundColor;
2193
+ }, function (props) {
2194
+ return props.controlForegroundColor;
2195
+ }, function (props) {
2196
+ return props.controlForegroundColor;
2197
+ });
2198
+ exports.default = PureMapContainer;
2199
+
2200
+ /***/ }),
2201
+ /* 195 */
2202
+ /***/ (function(module, exports) {
2203
+
2204
+ module.exports = require("maplibre-gl/dist/maplibre-gl.css");
2205
+
2206
+ /***/ }),
2207
+ /* 196 */
2208
+ /***/ (function(module, exports, __webpack_require__) {
2209
+
2210
+ "use strict";
2211
+
2212
+
2213
+ var _slicedToArray = __webpack_require__(49);
2214
+
2215
+ var _toConsumableArray = __webpack_require__(39);
2216
+
2217
+ Object.defineProperty(exports, "__esModule", {
2218
+ value: true
2219
+ });
2220
+ exports.pieSegment = exports.createPieChart = exports.updateBubbles = exports.bakeBubbleData = exports.transposeArray = exports.matchSize = exports.getStaticColors = exports.getZoomLevelFromGeobin = exports.getMapStyle = exports.getTilePreset = exports.renderMarkerLayer = exports.getMarkerSVGBackgroundImg = exports.MAX_BUBBLE_RADIUS = exports.MIN_BUBBLE_RADIUS = exports.MAP_STYLE_VERSION_NUMBER = exports.DEFAULT_SERIES_COLORS = exports.DEFAULT_CLUSTER_COLOR = exports.DEFAULT_RESULT_LIMIT = void 0;
2221
+
2222
+ var maplibre_gl_1 = __webpack_require__(123);
2223
+
2224
+ var lodash_1 = __webpack_require__(2);
2225
+
2226
+ var d3_scale_1 = __webpack_require__(69);
2227
+
2228
+ var colorUtils_1 = __webpack_require__(11);
2229
+
2230
+ var visualization_color_palettes_1 = __webpack_require__(41);
2231
+
2232
+ var MarkerIcons_1 = __webpack_require__(197);
2233
+
2234
+ exports.DEFAULT_RESULT_LIMIT = 1000;
2235
+ exports.DEFAULT_CLUSTER_COLOR = '#909090';
2236
+ exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
2237
+
2238
+ exports.MAP_STYLE_VERSION_NUMBER = 8;
2239
+ exports.MIN_BUBBLE_RADIUS = 4;
2240
+ exports.MAX_BUBBLE_RADIUS = 50; // 58
2241
+ // Returns marker background img with the requiref fillColor based on the theme
2242
+
2243
+ var getMarkerSVGBackgroundImg = function getMarkerSVGBackgroundImg(color, theme) {
2244
+ var fillColor = color.replace('#', '%23');
2245
+ return theme === 'light' ? MarkerIcons_1.defaultMarkerLightTheme(fillColor) : MarkerIcons_1.defaultMarkerDarkTheme(fillColor);
2246
+ };
2247
+
2248
+ exports.getMarkerSVGBackgroundImg = getMarkerSVGBackgroundImg; // Given a map instance and marker layer inputs, this method adds marker layers
2249
+ // Note :- Separated this as a util function for better testability
2250
+
2251
+ var renderMarkerLayer = function renderMarkerLayer(markerLayer, themeColorScheme, map, setTooltipProps) {
2252
+ if (!markerLayer || !map || !map.current || !Array.isArray(markerLayer.latitude) || !Array.isArray(markerLayer.longitude)) {
2253
+ return null;
2254
+ }
2255
+
2256
+ var lat = markerLayer.latitude;
2257
+ var lon = markerLayer.longitude;
2258
+ var isStaticColor = !markerLayer.dataColors;
2259
+ var limit = Math.min(lat.length, lon.length, markerLayer.resultLimit ? markerLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
2260
+ var markers = [];
2261
+ var colors = [];
2262
+
2263
+ var _loop = function _loop(i) {
2264
+ var staticColor = markerLayer.seriesColors && colorUtils_1.isColor(markerLayer.seriesColors[0]) ? markerLayer.seriesColors[0] : exports.DEFAULT_CLUSTER_COLOR;
2265
+ var dynamicColor = markerLayer.dataColors && colorUtils_1.isColor(markerLayer.dataColors[i]) ? markerLayer.dataColors[i] : exports.DEFAULT_CLUSTER_COLOR;
2266
+ var color = isStaticColor ? staticColor : dynamicColor;
2267
+ colors.push(color); // create a HTML element for each marker
2268
+
2269
+ var el = document.createElement('div');
2270
+ el.className = 'custom-marker';
2271
+ el.style.backgroundImage = "url('data:image/svg+xml;charset=UTF-8,".concat(exports.getMarkerSVGBackgroundImg(color, themeColorScheme), "')");
2272
+ el.addEventListener('mouseover', function () {
2273
+ setTooltipProps({
2274
+ anchor: el,
2275
+ longitude: lon[i],
2276
+ latitude: lat[i]
2277
+ });
2278
+ });
2279
+ el.addEventListener('mouseleave', function () {
2280
+ setTooltipProps({
2281
+ longitude: lon[i],
2282
+ latitude: lat[i]
2283
+ });
2284
+ }); // make a marker for each [lon,lat] and add to the map
2285
+
2286
+ markers.push(new maplibre_gl_1.Marker(el).setLngLat([lon[i], lat[i]]).addTo(map.current));
2287
+ };
2288
+
2289
+ for (var i = 0; i < limit; i += 1) {
2290
+ _loop(i);
2291
+ }
2292
+
2293
+ return {
2294
+ markers: markers,
2295
+ colors: colors
2296
+ };
2297
+ };
2298
+
2299
+ exports.renderMarkerLayer = renderMarkerLayer;
2300
+ /**
2301
+ * Construct a tile preset {key: config} by combining the default + custom tile configs
2302
+ * Also returns the default tile config for each theme - light/dark
2303
+ * @param {MapContextInterface} args
2304
+ * @param {BaseTileConfig[]} args.defaultTileConfig
2305
+ * @param {BaseTileConfig[]} args.customTileConfig
2306
+ * @returns {Object} tile preset
2307
+ */
2308
+
2309
+ var getTilePreset = function getTilePreset(_ref) {
2310
+ var _ref$defaultTileConfi = _ref.defaultTileConfig,
2311
+ defaultTileConfig = _ref$defaultTileConfi === void 0 ? [] : _ref$defaultTileConfi,
2312
+ _ref$customTileConfig = _ref.customTileConfig,
2313
+ customTileConfig = _ref$customTileConfig === void 0 ? [] : _ref$customTileConfig;
2314
+
2315
+ var _a, _b;
2316
+
2317
+ var tilePreset = {};
2318
+ var defaultTileLight = {};
2319
+ var defaultTileDark = {};
2320
+ var tileConfigs = [].concat(defaultTileConfig).concat(customTileConfig);
2321
+ lodash_1.forEach(tileConfigs, function (tileConfig) {
2322
+ var key = tileConfig === null || tileConfig === void 0 ? void 0 : tileConfig.key;
2323
+ var updatedConfig = Object.assign(Object.assign({
2324
+ theme: 'all'
2325
+ }, tileConfig), {
2326
+ version: exports.MAP_STYLE_VERSION_NUMBER
2327
+ });
2328
+ tilePreset[key] = updatedConfig;
2329
+ });
2330
+
2331
+ if (defaultTileConfig.length > 0) {
2332
+ defaultTileLight = (_a = defaultTileConfig.find(function (config) {
2333
+ return config.theme === 'light';
2334
+ })) !== null && _a !== void 0 ? _a : defaultTileConfig.find(function (config) {
2335
+ return config.theme === undefined;
2336
+ });
2337
+ defaultTileDark = (_b = defaultTileConfig.find(function (config) {
2338
+ return config.theme === 'dark';
2339
+ })) !== null && _b !== void 0 ? _b : defaultTileConfig.find(function (config) {
2340
+ return config.theme === undefined;
2341
+ });
2342
+ }
2343
+
2344
+ return {
2345
+ tilePreset: tilePreset,
2346
+ defaultTileLight: defaultTileLight,
2347
+ defaultTileDark: defaultTileDark
2348
+ };
2349
+ };
2350
+
2351
+ exports.getTilePreset = getTilePreset;
2352
+ /**
2353
+ * Check if baseLayerTileServer is in tilePreset and config matches current theme, if yes, return.
2354
+ * If no, construct a mapStyle with baseLayerTilerServer and baseLayerTileServerType
2355
+ * Else return default tile config based on current theme
2356
+ * @param {Object} args
2357
+ * @param {BaseTileConfig[]} args.tilePreset
2358
+ * @param {String} args.baseLayerTilerServer
2359
+ * @param {String} args.baseLayerTileServerType
2360
+ * @param {String} args.colorScheme
2361
+ * @param {BaseTileConfig} args.defaultTileDark
2362
+ * @param {BaseTileConfig} args.defaultTileLight
2363
+ * @returns {BaseTileConfig} mapStyle
2364
+ */
2365
+
2366
+ var getMapStyle = function getMapStyle(_ref2) {
2367
+ var _ref2$baseLayerTileSe = _ref2.baseLayerTileServer,
2368
+ baseLayerTileServer = _ref2$baseLayerTileSe === void 0 ? '' : _ref2$baseLayerTileSe,
2369
+ _ref2$baseLayerTileSe2 = _ref2.baseLayerTileServerType,
2370
+ baseLayerTileServerType = _ref2$baseLayerTileSe2 === void 0 ? '' : _ref2$baseLayerTileSe2,
2371
+ _ref2$tilePreset = _ref2.tilePreset,
2372
+ tilePreset = _ref2$tilePreset === void 0 ? {} : _ref2$tilePreset,
2373
+ _ref2$colorScheme = _ref2.colorScheme,
2374
+ colorScheme = _ref2$colorScheme === void 0 ? 'light' : _ref2$colorScheme,
2375
+ _ref2$defaultTileLigh = _ref2.defaultTileLight,
2376
+ defaultTileLight = _ref2$defaultTileLigh === void 0 ? {} : _ref2$defaultTileLigh,
2377
+ _ref2$defaultTileDark = _ref2.defaultTileDark,
2378
+ defaultTileDark = _ref2$defaultTileDark === void 0 ? {} : _ref2$defaultTileDark;
2379
+
2380
+ if (baseLayerTileServer && tilePreset[baseLayerTileServer] && (tilePreset[baseLayerTileServer].theme === colorScheme || tilePreset[baseLayerTileServer].theme === 'all')) {
2381
+ return tilePreset[baseLayerTileServer];
2382
+ }
2383
+
2384
+ if (baseLayerTileServer && baseLayerTileServerType) {
2385
+ var tiles = [];
2386
+ /**
2387
+ * Tile Server URLs (eg: http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png) can specify the variable {s} which refers to a subdomain
2388
+ * Subdomains are used to help with browser parallel requests per domain limitation. These subdomains are typically single letters 'a', 'b' and 'c'
2389
+ * Refer to https://leafletjs.com/SlavaUkraini/reference.html#tilelayer and https://wiki.openstreetmap.org/wiki/Tile_servers
2390
+ */
2391
+
2392
+ if (baseLayerTileServer.match(/^(https?):\/\/{(s|S)}\../)) {
2393
+ /**
2394
+ * sXML (Leaflet) allows users to define their own tile server URLs + list of available subdomains
2395
+ * In order to preserve this behavior during conversion to splunk.map,
2396
+ * if the variable {s} or {S} is detected, replace it with 'a', 'b' and 'c' - default values for subdomains
2397
+ * TODO: in the future, add an additional prop - baseLayerTileServerSubdomains: ['x', 'y', 'z'], default being ['a', 'b', 'c']
2398
+ */
2399
+ tiles = [baseLayerTileServer.replace(/{(s|S)}/, 'a'), baseLayerTileServer.replace(/{(s|S)}/, 'b'), baseLayerTileServer.replace(/{(s|S)}/, 'c')];
2400
+ } else {
2401
+ tiles = [baseLayerTileServer];
2402
+ } // TODO: remove hardcoded style when we allow users to pass in layer style through Viz options
2403
+
2404
+
2405
+ var mapStyle = {
2406
+ version: exports.MAP_STYLE_VERSION_NUMBER,
2407
+ sources: {
2408
+ 'base-tiles': {
2409
+ type: baseLayerTileServerType,
2410
+ tiles: tiles,
2411
+ tileSize: 256
2412
+ }
2413
+ },
2414
+ layers: [{
2415
+ id: 'base-layer',
2416
+ type: 'raster',
2417
+ source: 'base-tiles',
2418
+ minzoom: 0,
2419
+ maxzoom: 10
2420
+ }]
2421
+ };
2422
+ return mapStyle;
2423
+ } // if tile server is not present in the preset AND we can't construct a mapStyle, fall back on defaults
2424
+
2425
+
2426
+ return colorScheme === 'light' ? defaultTileLight : defaultTileDark;
2427
+ };
2428
+
2429
+ exports.getMapStyle = getMapStyle;
2430
+
2431
+ var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
2432
+ if (!geobinStr) {
2433
+ return null;
2434
+ } // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
2435
+
2436
+
2437
+ var geobinPattern = /(?<=bin_id_zl_).([0-9]{0,2})?(?=_y_)/g;
2438
+ var match = geobinStr.match(geobinPattern);
2439
+ return match && parseInt(match[0], 10);
2440
+ };
2441
+
2442
+ exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
2443
+
2444
+ var getStaticColors = function getStaticColors(colorCount, colorArray) {
2445
+ if (colorCount < 0 || !colorCount) {
2446
+ return [exports.DEFAULT_CLUSTER_COLOR];
2447
+ }
2448
+
2449
+ if (!colorArray || !colorArray.length) {
2450
+ return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
2451
+ return exports.DEFAULT_SERIES_COLORS[i];
2452
+ });
2453
+ } // loop through colorArray to pick the first $colorCount colors
2454
+ // start from begining again if colorCount > colorArray.length
2455
+
2456
+
2457
+ return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
2458
+ return colorUtils_1.isColor(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
2459
+ });
2460
+ };
2461
+
2462
+ exports.getStaticColors = getStaticColors; // Bubble size
2463
+
2464
+ var matchSize = function matchSize(dataRange, data) {
2465
+ var size = d3_scale_1.scalePow().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
2466
+
2467
+ if (size > exports.MAX_BUBBLE_RADIUS) {
2468
+ return exports.MAX_BUBBLE_RADIUS;
2469
+ }
2470
+
2471
+ if (size < exports.MIN_BUBBLE_RADIUS) {
2472
+ return exports.MIN_BUBBLE_RADIUS;
2473
+ }
2474
+
2475
+ return size;
2476
+ };
2477
+
2478
+ exports.matchSize = matchSize;
2479
+
2480
+ var transposeArray = function transposeArray(array) {
2481
+ if (!array || !array.length || !array[0] || !array[0].length) {
2482
+ return [];
2483
+ }
2484
+
2485
+ return array[0].map(function (_, i) {
2486
+ return array.map(function (row) {
2487
+ return row[i];
2488
+ });
2489
+ });
2490
+ };
2491
+
2492
+ exports.transposeArray = transposeArray;
2493
+
2494
+ var bakeBubbleData = function bakeBubbleData(layer) {
2495
+ var _a;
2496
+
2497
+ if (!layer || !((_a = layer.bubbleSize) === null || _a === void 0 ? void 0 : _a.length) || !layer.geobin || !layer.geobin.length || !layer.latitude || !layer.latitude.length || !layer.longitude || !layer.longitude.length) {
2498
+ return null;
2499
+ } // if bubbleSize is passed as an array of single number array (data series)
2500
+ // e.g. [value0, value1, ...]
2501
+ // format each value as an array to unify data operations for data series and frames
2502
+
2503
+
2504
+ var transposedBubbleSize = layer.bubbleSize.map(function (n) {
2505
+ return [n];
2506
+ });
2507
+ var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
2508
+
2509
+ if (typeof layer.bubbleSize[0] !== 'number') {
2510
+ // one-time array transpose,
2511
+ // e.g. from [column0data, column0data] (multi series)
2512
+ // to [[column0datum0, column1datum0], [column0datum1, column1data1], ...]
2513
+ // or e.g. from [column0data] (single series)
2514
+ // to [[column0data]]
2515
+ // for easy access of values at each geo location,
2516
+ // and min max pie size computation
2517
+ transposedBubbleSize = exports.transposeArray(layer.bubbleSize); // if multiple series in the dataframe, set isPie to true
2518
+
2519
+ if (layer.bubbleSize.length > 1) {
2520
+ isPie = true;
2521
+ }
2522
+ }
2523
+
2524
+ if (!transposedBubbleSize || !transposedBubbleSize.length) {
2525
+ return null;
2526
+ }
2527
+
2528
+ var data = layer.latitude.map(function (lat, i) {
2529
+ return {
2530
+ zoom: exports.getZoomLevelFromGeobin(layer.geobin[i]),
2531
+ values: transposedBubbleSize[i],
2532
+ coordinates: [layer.longitude[i], lat]
2533
+ };
2534
+ }); // compute the min/max value to encode min/max pie or bubble size
2535
+
2536
+ var min = lodash_1.sum(transposedBubbleSize[0]);
2537
+ var max = lodash_1.sum(transposedBubbleSize[1]);
2538
+ transposedBubbleSize.forEach(function (row) {
2539
+ var bubbleSize = lodash_1.sum(row);
2540
+ max = bubbleSize > max ? bubbleSize : max;
2541
+ min = bubbleSize < min ? bubbleSize : min;
2542
+ });
2543
+ return {
2544
+ data: data,
2545
+ dataRange: [min, max],
2546
+ isPie: isPie,
2547
+ resultLimit: layer.resultLimit,
2548
+ transposedBubbleSize: transposedBubbleSize,
2549
+ bubbleSizeFields: layer.bubbleSizeFields
2550
+ };
2551
+ };
2552
+
2553
+ exports.bakeBubbleData = bakeBubbleData; // Update bubbles on each zoom level
2554
+
2555
+ var updateBubbles = function updateBubbles(dataObj, zoomLevel, staticColors, dynamicColors, theme, map, setTooltipProps) {
2556
+ if (!dataObj || !dataObj.data.length || !map || !map.current) {
2557
+ return null;
2558
+ }
2559
+
2560
+ var data = dataObj.data,
2561
+ dataRange = dataObj.dataRange,
2562
+ resultLimit = dataObj.resultLimit,
2563
+ transposedBubbleSize = dataObj.transposedBubbleSize,
2564
+ bubbleSizeFields = dataObj.bubbleSizeFields,
2565
+ isPie = dataObj.isPie;
2566
+
2567
+ if (!data || !data.length || !dataRange || !dataRange.length) {
2568
+ return null;
2569
+ }
2570
+
2571
+ var roundedZoom = Math.round(zoomLevel);
2572
+ var themeColor = theme === 'light' ? '#ffffff' : '#1a1c20'; // filter data for the current zoom level and sort base on values
2573
+
2574
+ var dataToRender = data.reduce(function (acc, datum, i) {
2575
+ if (datum.zoom === roundedZoom) {
2576
+ acc.push({
2577
+ data: datum,
2578
+ idx: i
2579
+ });
2580
+ }
2581
+
2582
+ return acc;
2583
+ }, []).slice(0, resultLimit || exports.DEFAULT_RESULT_LIMIT).sort(function (a, b) {
2584
+ return lodash_1.sum(b.data.values) - lodash_1.sum(a.data.values);
2585
+ });
2586
+ return dataToRender.map(function (datum, i) {
2587
+ // create an HTML element for each bubble
2588
+ var colors = dynamicColors ? [dataToRender.map(function (obj) {
2589
+ return colorUtils_1.isColor(dynamicColors[obj.idx]) ? dynamicColors[obj.idx] : exports.DEFAULT_CLUSTER_COLOR;
2590
+ })[i]] : staticColors;
2591
+ var el = exports.createPieChart(datum.data.values, dataRange, colors, themeColor, isPie);
2592
+
2593
+ var _datum$data$coordinat = _slicedToArray(datum.data.coordinates, 2),
2594
+ longitude = _datum$data$coordinat[0],
2595
+ latitude = _datum$data$coordinat[1];
2596
+
2597
+ var bubbleSize = transposedBubbleSize[datum.idx].map(function (count, index) {
2598
+ return {
2599
+ name: bubbleSizeFields[index],
2600
+ count: count,
2601
+ color: colors[index]
2602
+ };
2603
+ });
2604
+ el.addEventListener('mouseover', function () {
2605
+ setTooltipProps({
2606
+ anchor: el,
2607
+ longitude: longitude,
2608
+ latitude: latitude,
2609
+ bubbleSize: bubbleSize
2610
+ });
2611
+ });
2612
+ el.addEventListener('mouseleave', function () {
2613
+ setTooltipProps({
2614
+ longitude: longitude,
2615
+ latitude: latitude,
2616
+ bubbleSize: bubbleSize
2617
+ });
2618
+ });
2619
+ return new maplibre_gl_1.Marker({
2620
+ element: el
2621
+ }).setLngLat(datum.data.coordinates).addTo(map.current);
2622
+ });
2623
+ };
2624
+
2625
+ exports.updateBubbles = updateBubbles; // Create an SVG pie from column values
2626
+
2627
+ var createPieChart = function createPieChart(values, valueRange, colors, themeColor, isPie) {
2628
+ var offsets = [];
2629
+ var total = 0;
2630
+ values.forEach(function (count) {
2631
+ offsets.push(total);
2632
+ total += count;
2633
+ });
2634
+ var radius = exports.matchSize(valueRange, total);
2635
+ var width = radius * 2; // create bubble svg
2636
+
2637
+ var html = "<div>\n <svg width=\"".concat(width, "\" height=\"").concat(width, "\" viewbox=\"-3 -3 ").concat(width + 6, " ").concat(width + 6, "\" >"); // add border for pie
2638
+
2639
+ if (isPie) {
2640
+ html += "<circle cx=".concat(radius, " cy=").concat(radius, " r=").concat(radius, " fill='none' stroke-width=\"2\" stroke=").concat(themeColor, " stroke-opacity=\"0.3\"/>");
2641
+ } // create pie segments
2642
+
2643
+
2644
+ values.forEach(function (v, i) {
2645
+ html += exports.pieSegment(offsets[i] / total, (offsets[i] + v) / total, radius, colors[i], themeColor);
2646
+ });
2647
+ html += "</svg>\n </div>";
2648
+ var el = document.createElement('div');
2649
+ el.className = 'custom-bubble';
2650
+ el.innerHTML = html;
2651
+ return el;
2652
+ };
2653
+
2654
+ exports.createPieChart = createPieChart; // Create a pie segment
2655
+
2656
+ var pieSegment = function pieSegment(start, end, radius, color, themeColor) {
2657
+ if (end - start === 1) {
2658
+ return "<circle cx=".concat(radius, " cy=").concat(radius, " r=").concat(radius - 1, " fill=").concat(color, " fill-opacity=\"0.5\" stroke-width=\"1.5\" stroke=").concat(color, " />");
2659
+ }
2660
+
2661
+ var a0 = 2 * Math.PI * (start - 0.25);
2662
+ var a1 = 2 * Math.PI * (end - 0.25);
2663
+ var x0 = Math.cos(a0);
2664
+ var y0 = Math.sin(a0);
2665
+ var x1 = Math.cos(a1);
2666
+ var y1 = Math.sin(a1);
2667
+ var arc = end - start > 0.5 ? 1 : 0;
2668
+ return "<path d=\"M ".concat(radius, " ").concat(radius, " L ").concat(radius + radius * x0, " ").concat(radius + radius * y0, " A ").concat(radius, " ").concat(radius, " 0 ").concat(arc, " 1 ").concat(radius + radius * x1, " ").concat(radius + radius * y1, " L ").concat(radius, " ").concat(radius, " A 0 0 0 ").concat(arc, " 0 ").concat(radius, " ").concat(radius, "\" fill=\"").concat(color, "\" fill-opacity=\"0.8\" stroke=\"").concat(themeColor, "\" stroke-width=\"2\" stroke-opacity=\"0.3\" />");
2669
+ };
2670
+
2671
+ exports.pieSegment = pieSegment;
2672
+
2673
+ /***/ }),
2674
+ /* 197 */
2675
+ /***/ (function(module, exports, __webpack_require__) {
2676
+
2677
+ "use strict";
2678
+
2679
+
2680
+ Object.defineProperty(exports, "__esModule", {
2681
+ value: true
2682
+ });
2683
+ exports.defaultMarkerDarkTheme = exports.defaultMarkerLightTheme = void 0;
2684
+
2685
+ var defaultMarkerLightTheme = function defaultMarkerLightTheme(fillColor) {
2686
+ return "<svg width=\"22\" height=\"28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" fill=\"".concat(fillColor, "\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"%2308090A\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"").concat(fillColor, "\" stroke-opacity=\".7\"/></svg>");
2687
+ };
2688
+
2689
+ exports.defaultMarkerLightTheme = defaultMarkerLightTheme;
2690
+
2691
+ var defaultMarkerDarkTheme = function defaultMarkerDarkTheme(fillColor) {
2692
+ return "<svg width=\"22\" height=\"28\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" fill=\"".concat(fillColor, "\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"%2308090A\"/><path d=\"M11 .5C5.201.5.5 5.201.5 11c0 3.136 1.376 5.952 3.555 7.875 2.839 2.506 4.144 4.58 4.893 6.02.183.35.334.665.469.946l.014.03c.136.285.263.548.387.766.235.412.571.863 1.182.863.61 0 .947-.45 1.182-.863.124-.218.25-.48.387-.765l.014-.03c.135-.282.286-.597.469-.947.75-1.44 2.054-3.514 4.893-6.02A10.476 10.476 0 0 0 21.5 11C21.5 5.201 16.799.5 11 .5Z\" stroke=\"").concat(fillColor, "\" stroke-opacity=\".15\"/></svg>");
2693
+ };
2694
+
2695
+ exports.defaultMarkerDarkTheme = defaultMarkerDarkTheme;
2696
+
2697
+ /***/ }),
2698
+ /* 198 */
2699
+ /***/ (function(module, exports, __webpack_require__) {
2700
+
2701
+ "use strict";
2702
+
2703
+
2704
+ Object.defineProperty(exports, "__esModule", {
2705
+ value: true
2706
+ });
2707
+ exports.convertDegToDMS = void 0;
2708
+
2709
+ var React = __webpack_require__(1);
2710
+
2711
+ var styled_components_1 = __webpack_require__(4);
2712
+
2713
+ var Popover_1 = __webpack_require__(100);
2714
+
2715
+ var i18n_1 = __webpack_require__(3);
2716
+
2717
+ var StyledPopover = styled_components_1.default(Popover_1.default).withConfig({
2718
+ displayName: "Tooltip__StyledPopover",
2719
+ componentId: "xwewsa-0"
2720
+ })(["width:250px;font-size:12px;"]);
2721
+ var StyledTable = styled_components_1.default.table.withConfig({
2722
+ displayName: "Tooltip__StyledTable",
2723
+ componentId: "xwewsa-1"
2724
+ })(["padding:2px 6px 2px 6px;width:100%;"]);
2725
+ var StyledTitleColumn = styled_components_1.default.td.withConfig({
2726
+ displayName: "Tooltip__StyledTitleColumn",
2727
+ componentId: "xwewsa-2"
2728
+ })(["opacity:0.85;"]);
2729
+ var StyledValueColumn = styled_components_1.default.td.withConfig({
2730
+ displayName: "Tooltip__StyledValueColumn",
2731
+ componentId: "xwewsa-3"
2732
+ })(["text-align:right;"]);
2733
+ var BubbleSizeColorBlock = styled_components_1.default.div.withConfig({
2734
+ displayName: "Tooltip__BubbleSizeColorBlock",
2735
+ componentId: "xwewsa-4"
2736
+ })(["background-color:", ";display:inline-block;margin-right:4px;border-radius:2px;width:6px;height:11px;transform:translateY(1px);"], function (props) {
2737
+ return props.color;
2738
+ });
2739
+
2740
+ var convertDegToDMS = function convertDegToDMS(deg, type) {
2741
+ var direction;
2742
+
2743
+ if (type === 'longitude') {
2744
+ direction = deg < 0 ? 'W' : 'E';
2745
+ } else if (type === 'latitude') {
2746
+ direction = deg < 0 ? 'S' : 'N';
2747
+ }
2748
+
2749
+ var degrees = Math.floor(deg);
2750
+ var minfloat = Math.abs((deg - degrees) * 60);
2751
+ var minutes = Math.floor(minfloat);
2752
+ var secfloat = (minfloat - minutes) * 60;
2753
+ var seconds = Math.round(secfloat);
2754
+ degrees = Math.abs(degrees);
2755
+
2756
+ if (seconds === 60) {
2757
+ minutes += 1;
2758
+ seconds = 0;
2759
+ }
2760
+
2761
+ if (minutes === 60) {
2762
+ degrees += 1;
2763
+ minutes = 0;
2764
+ }
2765
+
2766
+ return "".concat(degrees, "\xB0 ").concat(minutes, "' ").concat(seconds, "\" ").concat(direction);
2767
+ };
2768
+
2769
+ exports.convertDegToDMS = convertDegToDMS;
2770
+
2771
+ var Tooltip = function Tooltip(_ref) {
2772
+ var anchor = _ref.anchor,
2773
+ latitude = _ref.latitude,
2774
+ longitude = _ref.longitude,
2775
+ _ref$bubbleSize = _ref.bubbleSize,
2776
+ bubbleSize = _ref$bubbleSize === void 0 ? [] : _ref$bubbleSize;
2777
+ return React.createElement(StyledPopover, {
2778
+ open: !!anchor,
2779
+ anchor: anchor,
2780
+ "data-test": "map-marker-tooltip",
2781
+ defaultPlacement: "above"
2782
+ }, React.createElement(StyledTable, null, React.createElement("tbody", null, React.createElement("tr", null, React.createElement(StyledTitleColumn, null, i18n_1._('Latitude')), React.createElement(StyledValueColumn, {
2783
+ "data-test": "latitude"
2784
+ }, exports.convertDegToDMS(latitude, 'latitude'))), React.createElement("tr", null, React.createElement(StyledTitleColumn, null, i18n_1._('Longitude')), React.createElement(StyledValueColumn, {
2785
+ "data-test": "longitude"
2786
+ }, exports.convertDegToDMS(longitude, 'longitude'))), bubbleSize.map(function (_ref2) {
2787
+ var name = _ref2.name,
2788
+ count = _ref2.count,
2789
+ color = _ref2.color;
2790
+ return React.createElement("tr", {
2791
+ key: color
2792
+ }, React.createElement(StyledTitleColumn, {
2793
+ "data-test": "count-title"
2794
+ }, React.createElement(BubbleSizeColorBlock, {
2795
+ color: color
2796
+ }), name), React.createElement(StyledValueColumn, {
2797
+ "data-test": "count-value"
2798
+ }, count));
2799
+ }))));
2800
+ };
2801
+
2802
+ exports.default = Tooltip;
2803
+
2804
+ /***/ }),
2805
+ /* 199 */
2806
+ /***/ (function(module, exports, __webpack_require__) {
2807
+
2808
+ "use strict";
2809
+
2810
+
2811
+ Object.defineProperty(exports, "__esModule", {
2812
+ value: true
2813
+ });
2814
+
2815
+ var visualization_icons_1 = __webpack_require__(42);
2816
+
2817
+ var schemaUtils_1 = __webpack_require__(14);
2818
+
2819
+ var visualization_color_palettes_1 = __webpack_require__(41);
2820
+
2821
+ var themes_1 = __webpack_require__(70);
2822
+
2823
+ var i18n_1 = __webpack_require__(3);
2824
+
2825
+ var VizBehavior_1 = __webpack_require__(5);
2826
+
2827
+ var VizCategory_1 = __webpack_require__(26);
2828
+
2829
+ var configUtils_1 = __webpack_require__(6);
2830
+
2831
+ var defaultContext = {
2832
+ colorRangeConfig: [{
2833
+ to: 20,
2834
+ value: '#D41F1F'
2835
+ }, {
2836
+ from: 20,
2837
+ to: 40,
2838
+ value: '#D94E17'
2839
+ }, {
2840
+ from: 40,
2841
+ to: 60,
2842
+ value: '#CBA700'
2843
+ }, {
2844
+ from: 60,
2845
+ to: 80,
2846
+ value: '#669922'
2847
+ }, {
2848
+ from: 80,
2849
+ value: '#118832'
2850
+ }]
2851
+ };
2852
+ var dataContract = {
2853
+ requiredDataSources: [],
2854
+ optionalDataSources: [{
2855
+ name: 'primary',
2856
+ description: 'DataSource that powers the visualization.'
2857
+ }],
2858
+ initialRequestParams: {
2859
+ primary: {
2860
+ offset: 0,
2861
+ count: 10000
2862
+ }
2863
+ }
2864
+ };
2865
+ var size = {
2866
+ initialWidth: 800,
2867
+ initialHeight: 600
2868
+ };
2869
+ var optionsSchema = {
2870
+ backgroundColor: {
2871
+ default: '> themes.defaultBackgroundColor',
2872
+ description: 'Specify the color for the background. You may use a dataSource to apply the color. The default for enterprise light is "#ffffff". The default for enterprise dark is "#000000". The default for prisma dark is "#0b0c0e".',
2873
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA,
2874
+ type: 'string'
2875
+ },
2876
+ center: {
2877
+ default: [37.7749, -122.4194],
2878
+ type: 'array',
2879
+ description: 'Specify the center of the map in coordinates, in the form of [latitude, longitude]. When not provided, will automatically calculate map center based on available location data. When no location data available will fall back to [37.7749, -122.4194].',
2880
+ items: {
2881
+ type: 'number'
2882
+ }
2883
+ },
2884
+ layers: {
2885
+ default: [{
2886
+ type: 'bubble',
2887
+ latitude: '> primary | seriesByName("latitude")',
2888
+ longitude: '> primary | seriesByName("longitude")',
2889
+ seriesColors: visualization_color_palettes_1.VIZ_CATEGORICAL,
2890
+ bubbleSize: '> primary | frameWithoutSeriesNames("geobin", "latitude", "longitude") | frameBySeriesTypes("number")',
2891
+ tooltipFields: []
2892
+ }],
2893
+ type: 'array',
2894
+ description: 'Specify the data visualization layers on top of the base map. Can be empty to only show the base map.',
2895
+ items: {
2896
+ anyOf: [{
2897
+ type: 'object',
2898
+ properties: {
2899
+ type: {
2900
+ description: 'Specify the type of data layer method to display points on the map. For example, “bubble” or “marker”.',
2901
+ type: 'string',
2902
+ pattern: schemaUtils_1.getPattern(['marker']),
2903
+ default: 'marker'
2904
+ },
2905
+ latitude: {
2906
+ description: 'Specify a dataSource series to apply latitude coordinates for data points displayed on the map.',
2907
+ type: ['string', 'array'],
2908
+ default: '> primary | seriesByName("latitude")'
2909
+ },
2910
+ longitude: {
2911
+ description: 'Specify a dataSource series to apply longitude coordinates for data points displayed on the map.',
2912
+ type: ['string', 'array'],
2913
+ default: '> primary | seriesByName("longitude")'
2914
+ },
2915
+ dataColors: {
2916
+ description: 'Specify the colors used for data points. You may use an array of colors to be picked from, or you may use a dataSource to apply dynamic coloring. For example, “> primary | seriesByName("status") | matchValue(colorMatchConfig)”. ',
2917
+ type: ['string', 'array']
2918
+ },
2919
+ seriesColors: {
2920
+ default: visualization_color_palettes_1.VIZ_CATEGORICAL,
2921
+ description: 'Specify the colors used for data points.',
2922
+ type: 'array',
2923
+ items: {
2924
+ type: 'string',
2925
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
2926
+ }
2927
+ },
2928
+ tooltipFields: {
2929
+ description: 'Specify the fields to add to tooltips shown while hovering over data points. These fields and their corresponding values will be shown in addition to the ones displayed by default.',
2930
+ type: 'array',
2931
+ items: {
2932
+ type: 'string'
2933
+ },
2934
+ default: []
2935
+ },
2936
+ resultLimit: {
2937
+ description: 'Specify the maximum number of data points rendered on the map to improve performance.',
2938
+ type: 'number',
2939
+ default: 1000
2940
+ }
2941
+ }
2942
+ }, {
2943
+ type: 'object',
2944
+ properties: {
2945
+ type: {
2946
+ description: 'Specify the type of data layer method to display points on the map. For example, “bubble” or “marker”.',
2947
+ type: 'string',
2948
+ pattern: schemaUtils_1.getPattern(['bubble']),
2949
+ default: 'bubble'
2950
+ },
2951
+ bubbleSize: {
2952
+ description: 'Specify the data column to encode bubble size',
2953
+ type: ['string', 'array'],
2954
+ default: '> primary | frameWithoutSeriesNames("geobin", "latitude", "longitude") | frameBySeriesTypes("number")'
2955
+ },
2956
+ latitude: {
2957
+ description: 'Specify a dataSource series to apply latitude coordinates for data points displayed on the map.',
2958
+ type: ['string', 'array'],
2959
+ items: {
2960
+ type: 'number'
2961
+ },
2962
+ default: '> primary | seriesByName("latitude")'
2963
+ },
2964
+ longitude: {
2965
+ description: 'Specify a dataSource series to apply longitude coordinates for data points displayed on the map.',
2966
+ type: ['string', 'array'],
2967
+ items: {
2968
+ type: 'number'
2969
+ },
2970
+ default: '> primary | seriesByName("longitude")'
2971
+ },
2972
+ dataColors: {
2973
+ description: 'Specify the colors used for data points. You may use an array of colors to be picked from, or you may use a dataSource to apply dynamic coloring. For example, “> primary | seriesByName("status") | matchValue(colorMatchConfig)”. ',
2974
+ type: ['string', 'array']
2975
+ },
2976
+ seriesColors: {
2977
+ default: visualization_color_palettes_1.VIZ_CATEGORICAL,
2978
+ description: "Specify the colors used for data points. For example, [\"#FF0000\", \"#0000FF\", \"#008000\"].",
2979
+ type: 'array',
2980
+ items: {
2981
+ type: 'string',
2982
+ pattern: schemaUtils_1.COLOR_OR_TOKEN_PATTERN_WITH_RGBA
2983
+ }
2984
+ },
2985
+ tooltipFields: {
2986
+ description: 'Specify the fields to add to tooltips shown while hovering over data points. These fields and their corresponding values will be shown in addition to the ones displayed by default.',
2987
+ type: 'array',
2988
+ items: {
2989
+ type: 'string'
2990
+ },
2991
+ default: []
2992
+ },
2993
+ resultLimit: {
2994
+ description: 'Specify the maximum number of data points rendered on the map to improve performance.',
2995
+ type: 'number',
2996
+ default: 1000
2997
+ }
2998
+ }
2999
+ }]
3000
+ }
3001
+ },
3002
+ scaleUnit: {
3003
+ default: 'metric',
3004
+ type: 'string',
3005
+ description: 'Specify which scale unit to use.',
3006
+ pattern: schemaUtils_1.getPattern(['metric', 'imperial'])
3007
+ },
3008
+ // TODO: choropleth map retain old design
3009
+ // showBaseLayer: {
3010
+ // default: true,
3011
+ // type: 'boolean',
3012
+ // description: 'Specify if showing the base map.',
3013
+ // },
3014
+ showScale: {
3015
+ default: true,
3016
+ type: 'boolean',
3017
+ description: 'Specify whether the scale on the bottom left is shown.'
3018
+ },
3019
+ baseLayerTileServer: {
3020
+ type: 'string',
3021
+ description: 'Specify the tile set URL for the base map.'
3022
+ },
3023
+ baseLayerTileServerType: {
3024
+ type: 'string',
3025
+ description: 'Specify the type of tile set for the base map.',
3026
+ pattern: schemaUtils_1.getPattern(['vector', 'raster'])
3027
+ },
3028
+ zoom: {
3029
+ default: 5,
3030
+ description: 'Specify the zoom level of the map.',
3031
+ type: 'number'
3032
+ }
3033
+ };
3034
+ var themes = {
3035
+ defaultBackgroundColor: function defaultBackgroundColor(props) {
3036
+ return themes_1.pick({
3037
+ enterprise: {
3038
+ dark: themes_1.variables.black(props),
3039
+ light: themes_1.variables.backgroundColor(props)
3040
+ },
3041
+ prisma: themes_1.variables.backgroundColorSidebar(props)
3042
+ })(props);
3043
+ },
3044
+ controlBackgroundColor: function controlBackgroundColor(props) {
3045
+ return themes_1.pick({
3046
+ enterprise: {
3047
+ dark: themes_1.variables.gray22(props),
3048
+ light: themes_1.variables.white(props)
3049
+ },
3050
+ prisma: themes_1.variables.backgroundColorPopup(props)
3051
+ })(props);
3052
+ },
3053
+ controlForegroundColor: function controlForegroundColor(props) {
3054
+ return themes_1.pick({
3055
+ enterprise: themes_1.variables.textColor(props),
3056
+ prisma: themes_1.variables.contentColorDefault(props)
3057
+ })(props);
3058
+ }
3059
+ };
3060
+ var editorConfig = [{
3061
+ label: i18n_1._('Data Layer Formatting'),
3062
+ layout: [[{
3063
+ label: i18n_1._('Layer Type'),
3064
+ option: 'layers[0].type',
3065
+ editor: 'editor.select',
3066
+ editorProps: {
3067
+ values: [{
3068
+ label: i18n_1._('Marker'),
3069
+ value: 'marker'
3070
+ }, {
3071
+ label: i18n_1._('Bubble'),
3072
+ value: 'bubble'
3073
+ }]
3074
+ }
3075
+ }], [{
3076
+ label: i18n_1._('Latitude'),
3077
+ option: 'layers[0].latitude',
3078
+ editor: 'editor.columnSelector',
3079
+ editorProps: {
3080
+ dataSourceKey: 'primary'
3081
+ }
3082
+ }], [{
3083
+ label: i18n_1._('Longitude'),
3084
+ option: 'layers[0].longitude',
3085
+ editor: 'editor.columnSelector',
3086
+ editorProps: {
3087
+ dataSourceKey: 'primary'
3088
+ }
3089
+ }], [{
3090
+ label: i18n_1._('Size'),
3091
+ option: 'layers[0].bubbleSize',
3092
+ editor: 'editor.columnSelector',
3093
+ showEditor: function showEditor(_ref) {
3094
+ var options = _ref.options;
3095
+ return options.layers && options.layers.length && options.layers[0].type === 'bubble';
3096
+ },
3097
+ editorProps: {
3098
+ dataSourceKey: 'primary'
3099
+ }
3100
+ }]]
3101
+ }];
3102
+ /**
3103
+ * visualization configuration
3104
+ */
3105
+
3106
+ var config = {
3107
+ /**
3108
+ * unique viz key
3109
+ */
3110
+ key: 'splunk.map',
3111
+
3112
+ /**
3113
+ * viz name
3114
+ */
3115
+ name: 'Map',
3116
+ category: VizCategory_1.VizCategory.CHOROPLETH,
3117
+ status: 'preview',
3118
+
3119
+ /**
3120
+ * viz icon
3121
+ */
3122
+ icon: visualization_icons_1.Map,
3123
+ dataContract: dataContract,
3124
+ size: size,
3125
+ defaultContext: defaultContext,
3126
+ optionsSchema: optionsSchema,
3127
+ editorConfig: editorConfig,
3128
+ events: {
3129
+ 'map.load': {
3130
+ description: 'triggered when map is fully loaded'
3131
+ }
3132
+ },
3133
+ supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PLACEHOLDER],
3134
+ themes: themes,
3135
+ requiredProps: []
3136
+ };
3137
+ exports.default = configUtils_1.enhanceConfig(config);
3138
+
3139
+ /***/ })
3140
+ /******/ ]);
3141
+ //# sourceMappingURL=Map.js.map