@kepler.gl/schemas 3.3.0-alpha.2 → 3.3.0-alpha.21

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 (53) hide show
  1. package/dist/cjs/dataset-schema.js +307 -0
  2. package/dist/cjs/dataset-schema.js.map +1 -0
  3. package/dist/cjs/index.js +225 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/map-state-schema.js +46 -0
  6. package/dist/cjs/map-state-schema.js.map +1 -0
  7. package/dist/cjs/map-style-schema.js +90 -0
  8. package/dist/cjs/map-style-schema.js.map +1 -0
  9. package/dist/cjs/schema-manager.js +249 -0
  10. package/dist/cjs/schema-manager.js.map +1 -0
  11. package/dist/cjs/schema.js +111 -0
  12. package/dist/cjs/schema.js.map +1 -0
  13. package/dist/cjs/ui-state-schema.js +79 -0
  14. package/dist/cjs/ui-state-schema.js.map +1 -0
  15. package/dist/cjs/versions.js +17 -0
  16. package/dist/cjs/versions.js.map +1 -0
  17. package/dist/cjs/vis-state-schema.js +1221 -0
  18. package/dist/cjs/vis-state-schema.js.map +1 -0
  19. package/dist/esm/dataset-schema.js +300 -0
  20. package/dist/esm/dataset-schema.js.map +1 -0
  21. package/dist/esm/index.js +18 -0
  22. package/dist/esm/index.js.map +1 -0
  23. package/dist/esm/map-state-schema.js +42 -0
  24. package/dist/esm/map-state-schema.js.map +1 -0
  25. package/dist/esm/map-style-schema.js +87 -0
  26. package/dist/esm/map-style-schema.js.map +1 -0
  27. package/dist/esm/schema-manager.js +245 -0
  28. package/dist/esm/schema-manager.js.map +1 -0
  29. package/dist/esm/schema.js +107 -0
  30. package/dist/esm/schema.js.map +1 -0
  31. package/dist/esm/ui-state-schema.js +72 -0
  32. package/dist/esm/ui-state-schema.js.map +1 -0
  33. package/dist/esm/versions.js +10 -0
  34. package/dist/esm/versions.js.map +1 -0
  35. package/dist/esm/vis-state-schema.js +1216 -0
  36. package/dist/esm/vis-state-schema.js.map +1 -0
  37. package/dist/index.d.ts +1 -1
  38. package/dist/map-state-schema.d.ts +2 -0
  39. package/dist/schema-manager.d.ts +36 -2
  40. package/dist/ui-state-schema.d.ts +1 -0
  41. package/dist/vis-state-schema.d.ts +76 -2
  42. package/package.json +25 -19
  43. package/dist/dataset-schema.js +0 -222
  44. package/dist/index.js +0 -219
  45. package/dist/map-state-schema.js +0 -42
  46. package/dist/map-style-schema.js +0 -90
  47. package/dist/schema-manager.js +0 -248
  48. package/dist/schema-utils.d.ts +0 -11
  49. package/dist/schema-utils.js +0 -41
  50. package/dist/schema.js +0 -111
  51. package/dist/ui-state-schema.js +0 -48
  52. package/dist/versions.js +0 -17
  53. package/dist/vis-state-schema.js +0 -1066
@@ -0,0 +1,1216 @@
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
6
+ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
+ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
9
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
+ var _excluded = ["enlarged", "view"];
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
14
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
15
+ // SPDX-License-Identifier: MIT
16
+ // Copyright contributors to the kepler.gl project
17
+
18
+ import pick from 'es-toolkit/compat/pick';
19
+ import { VERSIONS } from './versions';
20
+ import { LAYER_VIS_CONFIGS, FILTER_VIEW_TYPES } from '@kepler.gl/constants';
21
+ import { migrateLegacyScenegraphVisConfig } from '@kepler.gl/layers';
22
+ import { colorRangeBackwardCompatibility, normalizeCameraBookmarks, normalizeCameraTour, isFilterValidToSave, findById, isPlainObject } from '@kepler.gl/utils';
23
+ import { notNullorUndefined } from '@kepler.gl/common-utils';
24
+ import Schema from './schema';
25
+ import cloneDeep from 'es-toolkit/compat/cloneDeep';
26
+ /**
27
+ * V0 Schema
28
+ */
29
+
30
+ export var dimensionPropsV0 = ['name', 'type'];
31
+ // in v0 geojson there is only sizeField
32
+
33
+ // in v1 geojson
34
+ // stroke base on -> sizeField
35
+ // height based on -> heightField
36
+ // radius based on -> radiusField
37
+ // here we make our wiredst guess on which channel sizeField belongs to
38
+ function geojsonSizeFieldV0ToV1(config) {
39
+ var defaultRaiuds = 10;
40
+ var defaultRadiusRange = [0, 50];
41
+
42
+ // if extruded, sizeField is most likely used for height
43
+ if (config.visConfig.extruded) {
44
+ return 'heightField';
45
+ }
46
+
47
+ // if show stroke enabled, sizeField is most likely used for stroke
48
+ if (config.visConfig.stroked) {
49
+ return 'sizeField';
50
+ }
51
+
52
+ // if radius changed, or radius Range Changed, sizeField is most likely used for radius
53
+ // this is the most unreliable guess, that's why we put it in the end
54
+ if (config.visConfig.radius !== defaultRaiuds || config.visConfig.radiusRange.some(function (d, i) {
55
+ return d !== defaultRadiusRange[i];
56
+ })) {
57
+ return 'radiusField';
58
+ }
59
+ return 'sizeField';
60
+ }
61
+
62
+ // convert v0 to v1 layer config
63
+ var DimensionFieldSchemaV0 = /*#__PURE__*/function (_Schema) {
64
+ function DimensionFieldSchemaV0() {
65
+ var _this;
66
+ _classCallCheck(this, DimensionFieldSchemaV0);
67
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
68
+ args[_key] = arguments[_key];
69
+ }
70
+ _this = _callSuper(this, DimensionFieldSchemaV0, [].concat(args));
71
+ _defineProperty(_this, "version", VERSIONS.v0);
72
+ return _this;
73
+ }
74
+ _inherits(DimensionFieldSchemaV0, _Schema);
75
+ return _createClass(DimensionFieldSchemaV0, [{
76
+ key: "save",
77
+ value: function save(field) {
78
+ // should not be called anymore
79
+ return _defineProperty({}, this.key, field !== null ? this.savePropertiesOrApplySchema(field)[this.key] : null);
80
+ }
81
+ }, {
82
+ key: "load",
83
+ value: function load(field, parents, accumulated) {
84
+ var _parents$slice = parents.slice(-1),
85
+ _parents$slice2 = _slicedToArray(_parents$slice, 1),
86
+ config = _parents$slice2[0];
87
+ var fieldName = this.key;
88
+ if (config.type === 'geojson' && this.key === 'sizeField' && field) {
89
+ fieldName = geojsonSizeFieldV0ToV1(config);
90
+ }
91
+ // fold into visualChannels to be load by VisualChannelSchemaV1
92
+ return {
93
+ visualChannels: _objectSpread(_objectSpread({}, accumulated.visualChannels || {}), {}, _defineProperty({}, fieldName, field))
94
+ };
95
+ }
96
+ }]);
97
+ }(Schema);
98
+ var DimensionScaleSchemaV0 = /*#__PURE__*/function (_Schema2) {
99
+ function DimensionScaleSchemaV0() {
100
+ var _this2;
101
+ _classCallCheck(this, DimensionScaleSchemaV0);
102
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
103
+ args[_key2] = arguments[_key2];
104
+ }
105
+ _this2 = _callSuper(this, DimensionScaleSchemaV0, [].concat(args));
106
+ _defineProperty(_this2, "version", VERSIONS.v0);
107
+ return _this2;
108
+ }
109
+ _inherits(DimensionScaleSchemaV0, _Schema2);
110
+ return _createClass(DimensionScaleSchemaV0, [{
111
+ key: "save",
112
+ value: function save(scale) {
113
+ return _defineProperty({}, this.key, scale);
114
+ }
115
+ }, {
116
+ key: "load",
117
+ value: function load(scale, parents, accumulated) {
118
+ var _parents$slice3 = parents.slice(-1),
119
+ _parents$slice4 = _slicedToArray(_parents$slice3, 1),
120
+ config = _parents$slice4[0];
121
+ // fold into visualChannels to be load by VisualChannelSchemaV1
122
+ if (this.key === 'sizeScale' && config.type === 'geojson') {
123
+ // sizeScale now split into radiusScale, heightScale
124
+ // no user customization, just use default
125
+ return {};
126
+ }
127
+ return {
128
+ visualChannels: _objectSpread(_objectSpread({}, accumulated.visualChannels || {}), {}, _defineProperty({}, this.key, scale))
129
+ };
130
+ }
131
+ }]);
132
+ }(Schema); // used to convert v0 to v1 layer config
133
+ var LayerConfigSchemaV0 = /*#__PURE__*/function (_Schema3) {
134
+ function LayerConfigSchemaV0() {
135
+ var _this3;
136
+ _classCallCheck(this, LayerConfigSchemaV0);
137
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
138
+ args[_key3] = arguments[_key3];
139
+ }
140
+ _this3 = _callSuper(this, LayerConfigSchemaV0, [].concat(args));
141
+ _defineProperty(_this3, "version", VERSIONS.v0);
142
+ return _this3;
143
+ }
144
+ _inherits(LayerConfigSchemaV0, _Schema3);
145
+ return _createClass(LayerConfigSchemaV0, [{
146
+ key: "load",
147
+ value: function load(saved, parents, accumulated) {
148
+ // fold v0 layer property into config.key
149
+ return {
150
+ config: _objectSpread(_objectSpread({}, accumulated.config || {}), {}, _defineProperty({}, this.key, saved))
151
+ };
152
+ }
153
+ }]);
154
+ }(Schema); // used to convert v0 to v1 layer columns
155
+ // only return column value for each column
156
+ var LayerColumnsSchemaV0 = /*#__PURE__*/function (_Schema4) {
157
+ function LayerColumnsSchemaV0() {
158
+ var _this4;
159
+ _classCallCheck(this, LayerColumnsSchemaV0);
160
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
161
+ args[_key4] = arguments[_key4];
162
+ }
163
+ _this4 = _callSuper(this, LayerColumnsSchemaV0, [].concat(args));
164
+ _defineProperty(_this4, "version", VERSIONS.v0);
165
+ return _this4;
166
+ }
167
+ _inherits(LayerColumnsSchemaV0, _Schema4);
168
+ return _createClass(LayerColumnsSchemaV0, [{
169
+ key: "load",
170
+ value: function load(saved, parents, accumulated) {
171
+ // fold v0 layer property into config.key, flatten columns
172
+ return {
173
+ config: _objectSpread(_objectSpread({}, accumulated.config || {}), {}, {
174
+ columns: Object.keys(saved).reduce(function (accu, key) {
175
+ return _objectSpread(_objectSpread({}, accu), {}, _defineProperty({}, key, saved[key].value));
176
+ }, {})
177
+ })
178
+ };
179
+ }
180
+ }]);
181
+ }(Schema); // used to convert v0 to v1 layer config.visConfig
182
+ var LayerConfigToVisConfigSchemaV0 = /*#__PURE__*/function (_Schema5) {
183
+ function LayerConfigToVisConfigSchemaV0() {
184
+ var _this5;
185
+ _classCallCheck(this, LayerConfigToVisConfigSchemaV0);
186
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
187
+ args[_key5] = arguments[_key5];
188
+ }
189
+ _this5 = _callSuper(this, LayerConfigToVisConfigSchemaV0, [].concat(args));
190
+ _defineProperty(_this5, "version", VERSIONS.v0);
191
+ return _this5;
192
+ }
193
+ _inherits(LayerConfigToVisConfigSchemaV0, _Schema5);
194
+ return _createClass(LayerConfigToVisConfigSchemaV0, [{
195
+ key: "load",
196
+ value: function load(saved, parents, accumulated) {
197
+ // fold v0 layer property into config.visConfig
198
+ var accumulatedConfig = accumulated.config || {};
199
+ return {
200
+ config: _objectSpread(_objectSpread({}, accumulatedConfig), {}, {
201
+ visConfig: _objectSpread(_objectSpread({}, accumulatedConfig.visConfig || {}), {}, _defineProperty({}, this.key, saved))
202
+ })
203
+ };
204
+ }
205
+ }]);
206
+ }(Schema);
207
+ var LayerVisConfigSchemaV0 = /*#__PURE__*/function (_Schema6) {
208
+ function LayerVisConfigSchemaV0() {
209
+ var _this6;
210
+ _classCallCheck(this, LayerVisConfigSchemaV0);
211
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
212
+ args[_key6] = arguments[_key6];
213
+ }
214
+ _this6 = _callSuper(this, LayerVisConfigSchemaV0, [].concat(args));
215
+ _defineProperty(_this6, "version", VERSIONS.v0);
216
+ _defineProperty(_this6, "key", 'visConfig');
217
+ return _this6;
218
+ }
219
+ _inherits(LayerVisConfigSchemaV0, _Schema6);
220
+ return _createClass(LayerVisConfigSchemaV0, [{
221
+ key: "load",
222
+ value: function load(visConfig, parents, accumulator) {
223
+ var _parents$slice5 = parents.slice(-1),
224
+ _parents$slice6 = _slicedToArray(_parents$slice5, 1),
225
+ config = _parents$slice6[0];
226
+ var rename = {
227
+ geojson: {
228
+ extruded: 'enable3d',
229
+ elevationRange: 'heightRange'
230
+ }
231
+ };
232
+ if (config.type in rename) {
233
+ var propToRename = rename[config.type];
234
+ return {
235
+ config: _objectSpread(_objectSpread({}, accumulator.config || {}), {}, {
236
+ visConfig: Object.keys(visConfig).reduce(function (accu, key) {
237
+ return _objectSpread(_objectSpread({}, accu), propToRename[key] ? _defineProperty({}, propToRename[key], visConfig[key]) : _defineProperty({}, key, visConfig[key]));
238
+ }, {})
239
+ })
240
+ };
241
+ }
242
+ return {
243
+ config: _objectSpread(_objectSpread({}, accumulator.config || {}), {}, {
244
+ visConfig: visConfig
245
+ })
246
+ };
247
+ }
248
+ }]);
249
+ }(Schema);
250
+ var LayerConfigSchemaDeleteV0 = /*#__PURE__*/function (_Schema7) {
251
+ function LayerConfigSchemaDeleteV0() {
252
+ var _this7;
253
+ _classCallCheck(this, LayerConfigSchemaDeleteV0);
254
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
255
+ args[_key7] = arguments[_key7];
256
+ }
257
+ _this7 = _callSuper(this, LayerConfigSchemaDeleteV0, [].concat(args));
258
+ _defineProperty(_this7, "version", VERSIONS.v0);
259
+ return _this7;
260
+ }
261
+ _inherits(LayerConfigSchemaDeleteV0, _Schema7);
262
+ return _createClass(LayerConfigSchemaDeleteV0, [{
263
+ key: "load",
264
+ value: function load() {
265
+ return {};
266
+ }
267
+ }]);
268
+ }(Schema);
269
+ /**
270
+ * V0 -> V1 Changes
271
+ * - layer is now a class
272
+ * - config saved in a config object
273
+ * - id, type, isAggregated is outside layer.config
274
+ * - visualChannels is outside config, it defines available visual channel and
275
+ * property names for field, scale, domain and range of each visual chanel.
276
+ * - enable3d, colorAggregation and sizeAggregation are moved into visConfig
277
+ * - GeojsonLayer - added height, radius specific properties
278
+ */
279
+ export var layerPropsV0 = {
280
+ id: null,
281
+ type: null,
282
+ // move into layer.config
283
+ dataId: new LayerConfigSchemaV0({
284
+ key: 'dataId'
285
+ }),
286
+ label: new LayerConfigSchemaV0({
287
+ key: 'label'
288
+ }),
289
+ color: new LayerConfigSchemaV0({
290
+ key: 'color'
291
+ }),
292
+ isVisible: new LayerConfigSchemaV0({
293
+ key: 'isVisible'
294
+ }),
295
+ hidden: new LayerConfigSchemaV0({
296
+ key: 'hidden'
297
+ }),
298
+ // convert visConfig
299
+ visConfig: new LayerVisConfigSchemaV0({
300
+ key: 'visConfig'
301
+ }),
302
+ // move into layer.config
303
+ // flatten
304
+ columns: new LayerColumnsSchemaV0(),
305
+ // save into visualChannels
306
+ colorField: new DimensionFieldSchemaV0({
307
+ properties: dimensionPropsV0,
308
+ key: 'colorField'
309
+ }),
310
+ colorScale: new DimensionScaleSchemaV0({
311
+ key: 'colorScale'
312
+ }),
313
+ sizeField: new DimensionFieldSchemaV0({
314
+ properties: dimensionPropsV0,
315
+ key: 'sizeField'
316
+ }),
317
+ sizeScale: new DimensionScaleSchemaV0({
318
+ key: 'sizeScale'
319
+ }),
320
+ // move into config.visConfig
321
+ enable3d: new LayerConfigToVisConfigSchemaV0({
322
+ key: 'enable3d'
323
+ }),
324
+ colorAggregation: new LayerConfigToVisConfigSchemaV0({
325
+ key: 'colorAggregation'
326
+ }),
327
+ sizeAggregation: new LayerConfigToVisConfigSchemaV0({
328
+ key: 'sizeAggregation'
329
+ }),
330
+ // delete
331
+ isAggregated: new LayerConfigSchemaDeleteV0()
332
+ };
333
+
334
+ /**
335
+ * V1 Schema
336
+ */
337
+ var ColumnSchemaV1 = /*#__PURE__*/function (_Schema8) {
338
+ function ColumnSchemaV1() {
339
+ _classCallCheck(this, ColumnSchemaV1);
340
+ return _callSuper(this, ColumnSchemaV1, arguments);
341
+ }
342
+ _inherits(ColumnSchemaV1, _Schema8);
343
+ return _createClass(ColumnSchemaV1, [{
344
+ key: "save",
345
+ value: function save(columns) {
346
+ // starting from v1, only save column value
347
+ // fieldIdx will be calculated during merge
348
+ return _defineProperty({}, this.key, Object.keys(columns).reduce(function (accu, ckey) {
349
+ var _columns$ckey;
350
+ return _objectSpread(_objectSpread({}, accu), (_columns$ckey = columns[ckey]) !== null && _columns$ckey !== void 0 && _columns$ckey.value ? _defineProperty({}, ckey, columns[ckey].value) : {});
351
+ }, {}));
352
+ }
353
+ }, {
354
+ key: "load",
355
+ value: function load(columns) {
356
+ return {
357
+ columns: columns
358
+ };
359
+ }
360
+ }]);
361
+ }(Schema);
362
+ var TextLabelSchemaV1 = /*#__PURE__*/function (_Schema9) {
363
+ function TextLabelSchemaV1() {
364
+ _classCallCheck(this, TextLabelSchemaV1);
365
+ return _callSuper(this, TextLabelSchemaV1, arguments);
366
+ }
367
+ _inherits(TextLabelSchemaV1, _Schema9);
368
+ return _createClass(TextLabelSchemaV1, [{
369
+ key: "save",
370
+ value: function save(textLabel) {
371
+ return _defineProperty({}, this.key, textLabel.map(function (tl) {
372
+ return _objectSpread(_objectSpread({}, tl), {}, {
373
+ field: tl.field ? pick(tl.field, ['name', 'type']) : null
374
+ });
375
+ }));
376
+ }
377
+ }, {
378
+ key: "load",
379
+ value: function load(textLabel) {
380
+ return {
381
+ textLabel: Array.isArray(textLabel) ? textLabel : [textLabel]
382
+ };
383
+ }
384
+ }]);
385
+ }(Schema);
386
+ var visualChannelModificationV1 = {
387
+ geojson: function geojson(vc, parents) {
388
+ var _LAYER_VIS_CONFIGS$ra;
389
+ var _parents$slice7 = parents.slice(-1),
390
+ _parents$slice8 = _slicedToArray(_parents$slice7, 1),
391
+ layer = _parents$slice8[0];
392
+ var isOld = !Object.prototype.hasOwnProperty.call(vc, 'strokeColorField');
393
+ // make our best guess if this geojson layer contains point
394
+ var isPoint = vc.radiusField || layer.config.visConfig.radius !== ((_LAYER_VIS_CONFIGS$ra = LAYER_VIS_CONFIGS.radius) === null || _LAYER_VIS_CONFIGS$ra === void 0 ? void 0 : _LAYER_VIS_CONFIGS$ra.defaultValue);
395
+ if (isOld && !isPoint && layer.config.visConfig.stroked) {
396
+ // if stroked is true, copy color config to stroke color config
397
+ return {
398
+ strokeColorField: vc.colorField,
399
+ strokeColorScale: vc.colorScale
400
+ };
401
+ }
402
+ return {};
403
+ }
404
+ };
405
+ /**
406
+ * V1: save [field]: {name, type}, [scale]: '' for each channel
407
+ */
408
+ var VisualChannelSchemaV1 = /*#__PURE__*/function (_Schema0) {
409
+ function VisualChannelSchemaV1() {
410
+ _classCallCheck(this, VisualChannelSchemaV1);
411
+ return _callSuper(this, VisualChannelSchemaV1, arguments);
412
+ }
413
+ _inherits(VisualChannelSchemaV1, _Schema0);
414
+ return _createClass(VisualChannelSchemaV1, [{
415
+ key: "save",
416
+ value: function save(visualChannels, parents) {
417
+ // only save field and scale of each channel
418
+ var _parents$slice9 = parents.slice(-1),
419
+ _parents$slice0 = _slicedToArray(_parents$slice9, 1),
420
+ layer = _parents$slice0[0];
421
+ return _defineProperty({}, this.key, Object.keys(visualChannels).reduce(
422
+ // save channel to null if didn't select any field
423
+ function (accu, key) {
424
+ return _objectSpread(_objectSpread({}, accu), {}, _defineProperty(_defineProperty({}, visualChannels[key].field, layer.config[visualChannels[key].field] ? pick(layer.config[visualChannels[key].field], ['name', 'type']) : null), visualChannels[key].scale, layer.config[visualChannels[key].scale]));
425
+ }, {}));
426
+ }
427
+ }, {
428
+ key: "load",
429
+ value: function load(vc, parents, accumulator) {
430
+ // fold channels into config
431
+ var _parents$slice1 = parents.slice(-1),
432
+ _parents$slice10 = _slicedToArray(_parents$slice1, 1),
433
+ layer = _parents$slice10[0];
434
+ var modified = visualChannelModificationV1[layer.type] ? visualChannelModificationV1[layer.type](vc, parents, accumulator) : {};
435
+ return _objectSpread(_objectSpread({}, accumulator), {}, {
436
+ config: _objectSpread(_objectSpread(_objectSpread({}, accumulator.config || {}), vc), modified)
437
+ });
438
+ }
439
+ }]);
440
+ }(Schema);
441
+ var visConfigModificationV1 = {
442
+ point: function point(visConfig, parents) {
443
+ var modified = {};
444
+ var _parents$slice11 = parents.slice(-2, -1),
445
+ _parents$slice12 = _slicedToArray(_parents$slice11, 1),
446
+ layer = _parents$slice12[0];
447
+ var isOld = !Object.prototype.hasOwnProperty.call(visConfig, 'filled') && !visConfig.strokeColor && !visConfig.strokeColorRange;
448
+ if (isOld) {
449
+ // color color & color range to stroke color
450
+ modified.strokeColor = layer.config.color;
451
+ modified.strokeColorRange = cloneDeep(visConfig.colorRange);
452
+ if (visConfig.outline) {
453
+ // point layer now supports both outline and fill
454
+ // for older schema where filled has not been added to point layer
455
+ // set it to false
456
+ modified.filled = false;
457
+ }
458
+ }
459
+ return modified;
460
+ },
461
+ geojson: function geojson(visConfig, parents) {
462
+ var _LAYER_VIS_CONFIGS$ra2;
463
+ // is points?
464
+ var modified = {};
465
+ var _parents$slice13 = parents.slice(-2, -1),
466
+ _parents$slice14 = _slicedToArray(_parents$slice13, 1),
467
+ layer = _parents$slice14[0];
468
+ var isOld = layer.visualChannels && !Object.prototype.hasOwnProperty.call(layer.visualChannels, 'strokeColorField') && !visConfig.strokeColor && !visConfig.strokeColorRange;
469
+ // make our best guess if this geojson layer contains point
470
+ var isPoint = layer.visualChannels && layer.visualChannels.radiusField || visConfig && visConfig.radius !== ((_LAYER_VIS_CONFIGS$ra2 = LAYER_VIS_CONFIGS.radius) === null || _LAYER_VIS_CONFIGS$ra2 === void 0 ? void 0 : _LAYER_VIS_CONFIGS$ra2.defaultValue);
471
+ if (isOld) {
472
+ // color color & color range to stroke color
473
+ modified.strokeColor = layer.config.color;
474
+ modified.strokeColorRange = cloneDeep(visConfig.colorRange);
475
+ if (isPoint) {
476
+ // if is point, set stroke to false
477
+ modified.filled = true;
478
+ modified.stroked = false;
479
+ }
480
+ }
481
+ return modified;
482
+ },
483
+ '3D': function D(visConfig) {
484
+ var migrated = migrateLegacyScenegraphVisConfig(visConfig);
485
+ if (!migrated || migrated.scenegraph === (visConfig === null || visConfig === void 0 ? void 0 : visConfig.scenegraph)) {
486
+ return {};
487
+ }
488
+ return {
489
+ scenegraph: migrated.scenegraph
490
+ };
491
+ }
492
+ };
493
+ var VisConfigSchemaV1 = /*#__PURE__*/function (_Schema1) {
494
+ function VisConfigSchemaV1() {
495
+ var _this8;
496
+ _classCallCheck(this, VisConfigSchemaV1);
497
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
498
+ args[_key8] = arguments[_key8];
499
+ }
500
+ _this8 = _callSuper(this, VisConfigSchemaV1, [].concat(args));
501
+ _defineProperty(_this8, "key", 'visConfig');
502
+ return _this8;
503
+ }
504
+ _inherits(VisConfigSchemaV1, _Schema1);
505
+ return _createClass(VisConfigSchemaV1, [{
506
+ key: "load",
507
+ value:
508
+ // layer.config.visConfig
509
+ // colorRange
510
+ function load(visConfig, parents, accumulated) {
511
+ var _parents$slice15 = parents.slice(-2, -1),
512
+ _parents$slice16 = _slicedToArray(_parents$slice15, 1),
513
+ layer = _parents$slice16[0];
514
+ var modified = visConfigModificationV1[layer.type] ? visConfigModificationV1[layer.type](visConfig, parents, accumulated) : {};
515
+ var loadedVisConfig = _objectSpread(_objectSpread({}, visConfig), modified);
516
+
517
+ // backward compatibility, load colorRange and change the name to match new color Palette
518
+ ['colorRange', 'strokeColorRange'].forEach(function (prop) {
519
+ if (loadedVisConfig !== null && loadedVisConfig !== void 0 && loadedVisConfig[prop]) {
520
+ loadedVisConfig[prop] = colorRangeBackwardCompatibility(loadedVisConfig[prop]);
521
+ }
522
+ });
523
+ return {
524
+ visConfig: loadedVisConfig
525
+ };
526
+ }
527
+ }]);
528
+ }(Schema);
529
+ export var layerPropsV1 = {
530
+ id: null,
531
+ type: null,
532
+ config: new Schema({
533
+ version: VERSIONS.v1,
534
+ key: 'config',
535
+ properties: {
536
+ dataId: null,
537
+ columnMode: null,
538
+ label: null,
539
+ color: null,
540
+ highlightColor: null,
541
+ uniqueIdField: null,
542
+ columns: new ColumnSchemaV1({
543
+ version: VERSIONS.v1,
544
+ key: 'columns'
545
+ }),
546
+ isVisible: null,
547
+ isIncludedInLegend: null,
548
+ visConfig: new VisConfigSchemaV1({
549
+ version: VERSIONS.v1
550
+ }),
551
+ hidden: null,
552
+ textLabel: new TextLabelSchemaV1({
553
+ version: VERSIONS.v1,
554
+ key: 'textLabel'
555
+ })
556
+ }
557
+ }),
558
+ visualChannels: new VisualChannelSchemaV1({
559
+ version: VERSIONS.v1,
560
+ key: 'visualChannels'
561
+ })
562
+ };
563
+ export var LayerSchemaV0 = /*#__PURE__*/function (_Schema10) {
564
+ function LayerSchemaV0() {
565
+ var _this9;
566
+ _classCallCheck(this, LayerSchemaV0);
567
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
568
+ args[_key9] = arguments[_key9];
569
+ }
570
+ _this9 = _callSuper(this, LayerSchemaV0, [].concat(args));
571
+ _defineProperty(_this9, "key", 'layers');
572
+ return _this9;
573
+ }
574
+ _inherits(LayerSchemaV0, _Schema10);
575
+ return _createClass(LayerSchemaV0, [{
576
+ key: "save",
577
+ value: function save(layers, parents) {
578
+ var _this0 = this;
579
+ var _parents$slice17 = parents.slice(-1),
580
+ _parents$slice18 = _slicedToArray(_parents$slice17, 1),
581
+ visState = _parents$slice18[0];
582
+ return _defineProperty({}, this.key, visState.layerOrder.reduce(function (saved, entry) {
583
+ if (isPlainObject(entry)) {
584
+ var group = entry;
585
+ var groupLayerOrder = group.layerOrder;
586
+ if (groupLayerOrder) {
587
+ groupLayerOrder.forEach(function (nestedEntry) {
588
+ if (typeof nestedEntry === 'string') {
589
+ var _layer = findById(nestedEntry)(layers);
590
+ if (_layer !== null && _layer !== void 0 && _layer.isValidToSave()) {
591
+ saved.push(_this0.savePropertiesOrApplySchema(_layer).layers);
592
+ }
593
+ }
594
+ });
595
+ }
596
+ return saved;
597
+ }
598
+ var layer = findById(entry)(layers);
599
+ if (layer !== null && layer !== void 0 && layer.isValidToSave()) {
600
+ saved.push(_this0.savePropertiesOrApplySchema(layer).layers);
601
+ }
602
+ return saved;
603
+ }, []));
604
+ }
605
+ }, {
606
+ key: "load",
607
+ value: function load(layers) {
608
+ var _this1 = this;
609
+ return _defineProperty({}, this.key, layers ? layers.map(function (layer) {
610
+ return _this1.loadPropertiesOrApplySchema(layer, layers).layers;
611
+ }) : []);
612
+ }
613
+ }]);
614
+ }(Schema);
615
+ export var FilterSchemaV0 = /*#__PURE__*/function (_Schema11) {
616
+ function FilterSchemaV0() {
617
+ var _this10;
618
+ _classCallCheck(this, FilterSchemaV0);
619
+ for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
620
+ args[_key0] = arguments[_key0];
621
+ }
622
+ _this10 = _callSuper(this, FilterSchemaV0, [].concat(args));
623
+ _defineProperty(_this10, "key", 'filters');
624
+ return _this10;
625
+ }
626
+ _inherits(FilterSchemaV0, _Schema11);
627
+ return _createClass(FilterSchemaV0, [{
628
+ key: "save",
629
+ value: function save(filters) {
630
+ var _this11 = this;
631
+ return {
632
+ filters: filters.filter(isFilterValidToSave).map(function (filter) {
633
+ return _this11.savePropertiesOrApplySchema(filter).filters;
634
+ })
635
+ };
636
+ }
637
+ }, {
638
+ key: "load",
639
+ value: function load(filters) {
640
+ var _this12 = this;
641
+ return {
642
+ filters: filters === null || filters === void 0 ? void 0 : filters.map(function (filter) {
643
+ return _this12.loadPropertiesOrApplySchema(filter).filters;
644
+ })
645
+ // backward compatible convert enlarged to view
646
+ .map(function (filter) {
647
+ var enlarged = filter.enlarged,
648
+ view = filter.view,
649
+ filterProps = _objectWithoutProperties(filter, _excluded);
650
+ var newFilter = _objectSpread(_objectSpread({}, filterProps), {}, {
651
+ // if view exist use it otherwise check for enlarged
652
+ view: view ? view : enlarged ? FILTER_VIEW_TYPES.enlarged : FILTER_VIEW_TYPES.side
653
+ });
654
+ return newFilter;
655
+ })
656
+ };
657
+ }
658
+ }]);
659
+ }(Schema);
660
+ var interactionPropsV0 = ['tooltip', 'brush'];
661
+ var InteractionSchemaV0 = /*#__PURE__*/function (_Schema12) {
662
+ function InteractionSchemaV0() {
663
+ var _this13;
664
+ _classCallCheck(this, InteractionSchemaV0);
665
+ for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
666
+ args[_key1] = arguments[_key1];
667
+ }
668
+ _this13 = _callSuper(this, InteractionSchemaV0, [].concat(args));
669
+ _defineProperty(_this13, "key", 'interactionConfig');
670
+ return _this13;
671
+ }
672
+ _inherits(InteractionSchemaV0, _Schema12);
673
+ return _createClass(InteractionSchemaV0, [{
674
+ key: "save",
675
+ value: function save(interactionConfig) {
676
+ return Array.isArray(this.properties) ? _defineProperty({}, this.key, this.properties.reduce(function (accu, key) {
677
+ return _objectSpread(_objectSpread({}, accu), interactionConfig[key].enabled ? _defineProperty({}, key, interactionConfig[key].config) : {});
678
+ }, {})) : {};
679
+ }
680
+ }, {
681
+ key: "load",
682
+ value: function load(interactionConfig) {
683
+ // convert v0 -> v1
684
+ // return enabled: false if disabled,
685
+ return Array.isArray(this.properties) ? _defineProperty({}, this.key, this.properties.reduce(function (accu, key) {
686
+ return _objectSpread(_objectSpread({}, accu), _defineProperty({}, key, _objectSpread(_objectSpread({}, interactionConfig[key] || {}), {}, {
687
+ enabled: Boolean(interactionConfig[key])
688
+ })));
689
+ }, {})) : {};
690
+ }
691
+ }]);
692
+ }(Schema);
693
+ var interactionPropsV1 = ['tooltip', 'legend', 'brush', 'geocoder', 'coordinate', 'annotation', 'zoomOpacity'];
694
+ export var InteractionSchemaV1 = /*#__PURE__*/function (_Schema13) {
695
+ function InteractionSchemaV1() {
696
+ var _this14;
697
+ _classCallCheck(this, InteractionSchemaV1);
698
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
699
+ args[_key10] = arguments[_key10];
700
+ }
701
+ _this14 = _callSuper(this, InteractionSchemaV1, [].concat(args));
702
+ _defineProperty(_this14, "key", 'interactionConfig');
703
+ return _this14;
704
+ }
705
+ _inherits(InteractionSchemaV1, _Schema13);
706
+ return _createClass(InteractionSchemaV1, [{
707
+ key: "save",
708
+ value: function save(interactionConfig) {
709
+ // save config even if disabled,
710
+ return Array.isArray(this.properties) ? _defineProperty({}, this.key, this.properties.reduce(function (accu, key) {
711
+ var interaction = interactionConfig[key];
712
+ // Older saved states may not have annotation or zoomOpacity.
713
+ if (!interaction) {
714
+ return accu;
715
+ }
716
+ var config = 'config' in interaction ? interaction.config : undefined;
717
+ return _objectSpread(_objectSpread({}, accu), {}, _defineProperty({}, key, _objectSpread(_objectSpread({}, config || {}), {}, {
718
+ enabled: interaction.enabled
719
+ })));
720
+ }, {})) : {};
721
+ }
722
+ }, {
723
+ key: "load",
724
+ value: function load(interactionConfig) {
725
+ var _this15 = this;
726
+ var modifiedConfig = cloneDeep(interactionConfig);
727
+ Object.keys(interactionConfig).forEach(function (configType) {
728
+ if (configType === 'tooltip') {
729
+ var fieldsToShow = modifiedConfig[configType].fieldsToShow;
730
+ if (!notNullorUndefined(fieldsToShow)) {
731
+ return _defineProperty({}, _this15.key, modifiedConfig);
732
+ }
733
+ Object.keys(fieldsToShow).forEach(function (key) {
734
+ // @ts-expect-error name: fieldData should be string
735
+ fieldsToShow[key] = fieldsToShow[key].map(function (fieldData) {
736
+ if (!fieldData.name) {
737
+ return {
738
+ name: fieldData,
739
+ format: null
740
+ };
741
+ }
742
+ return fieldData;
743
+ });
744
+ });
745
+ }
746
+ return;
747
+ });
748
+ return _defineProperty({}, this.key, modifiedConfig);
749
+ }
750
+ }]);
751
+ }(Schema);
752
+ export var filterPropsV0 = {
753
+ dataId: null,
754
+ id: null,
755
+ name: null,
756
+ type: null,
757
+ value: null,
758
+ // deprecated
759
+ enlarged: null
760
+ };
761
+ export var DimensionFieldSchema = /*#__PURE__*/function (_Schema14) {
762
+ function DimensionFieldSchema() {
763
+ _classCallCheck(this, DimensionFieldSchema);
764
+ return _callSuper(this, DimensionFieldSchema, arguments);
765
+ }
766
+ _inherits(DimensionFieldSchema, _Schema14);
767
+ return _createClass(DimensionFieldSchema, [{
768
+ key: "save",
769
+ value: function save(field) {
770
+ return _defineProperty({}, this.key, field ? this.savePropertiesOrApplySchema(field)[this.key] : null);
771
+ }
772
+ }, {
773
+ key: "load",
774
+ value: function load(field) {
775
+ return _defineProperty({}, this.key, field);
776
+ }
777
+ }]);
778
+ }(Schema);
779
+ export var SplitMapsSchema = /*#__PURE__*/function (_Schema15) {
780
+ function SplitMapsSchema() {
781
+ _classCallCheck(this, SplitMapsSchema);
782
+ return _callSuper(this, SplitMapsSchema, arguments);
783
+ }
784
+ _inherits(SplitMapsSchema, _Schema15);
785
+ return _createClass(SplitMapsSchema, [{
786
+ key: "convertLayerSettings",
787
+ value: function convertLayerSettings(accu, _ref17) {
788
+ var _ref18 = _slicedToArray(_ref17, 2),
789
+ key = _ref18[0],
790
+ value = _ref18[1];
791
+ if (typeof value === 'boolean') {
792
+ return _objectSpread(_objectSpread({}, accu), {}, _defineProperty({}, key, value));
793
+ } else if (value && _typeof(value) === 'object' && value.isAvailable) {
794
+ return _objectSpread(_objectSpread({}, accu), {}, _defineProperty({}, key, Boolean(value.isVisible)));
795
+ }
796
+ return accu;
797
+ }
798
+ }, {
799
+ key: "load",
800
+ value: function load(splitMaps) {
801
+ var _this16 = this;
802
+ // previous splitMaps Schema {layers: {layerId: {isVisible, isAvailable}}}
803
+
804
+ if (!Array.isArray(splitMaps) || !splitMaps.length) {
805
+ return {
806
+ splitMaps: []
807
+ };
808
+ }
809
+ return {
810
+ splitMaps: splitMaps.map(function (settings) {
811
+ return _objectSpread(_objectSpread({}, settings), {}, {
812
+ layers: Object.entries(settings.layers || {}).reduce(_this16.convertLayerSettings, {})
813
+ });
814
+ })
815
+ };
816
+ }
817
+ }]);
818
+ }(Schema);
819
+ export var PlotTypeSchema = /*#__PURE__*/function (_Schema16) {
820
+ function PlotTypeSchema() {
821
+ var _this17;
822
+ _classCallCheck(this, PlotTypeSchema);
823
+ for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
824
+ args[_key11] = arguments[_key11];
825
+ }
826
+ _this17 = _callSuper(this, PlotTypeSchema, [].concat(args));
827
+ _defineProperty(_this17, "key", 'plotType');
828
+ return _this17;
829
+ }
830
+ _inherits(PlotTypeSchema, _Schema16);
831
+ return _createClass(PlotTypeSchema, [{
832
+ key: "load",
833
+ value: function load(plotType) {
834
+ if (typeof plotType === 'string') {
835
+ return {
836
+ plotType: {
837
+ type: plotType
838
+ }
839
+ };
840
+ }
841
+ return {
842
+ plotType: plotType
843
+ };
844
+ }
845
+ }]);
846
+ }(Schema);
847
+ export var effectPropsV1 = {
848
+ id: null,
849
+ type: null,
850
+ isEnabled: null,
851
+ parameters: null
852
+ };
853
+ export var chartPropsV1 = {
854
+ id: null,
855
+ title: null,
856
+ type: null,
857
+ dataId: null,
858
+ applyFilters: null,
859
+ pinned: null,
860
+ display: null,
861
+ crossFilter: null,
862
+ xAxis: null,
863
+ yAxis: null,
864
+ groupBy: null,
865
+ value: null,
866
+ axis: null,
867
+ numGroups: null,
868
+ groupOthers: null,
869
+ colorBy: null,
870
+ chartDisplay: null,
871
+ layerId: null,
872
+ layerChartType: null
873
+ };
874
+ export var ChartsSchema = /*#__PURE__*/function (_Schema17) {
875
+ function ChartsSchema() {
876
+ var _this18;
877
+ _classCallCheck(this, ChartsSchema);
878
+ for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
879
+ args[_key12] = arguments[_key12];
880
+ }
881
+ _this18 = _callSuper(this, ChartsSchema, [].concat(args));
882
+ _defineProperty(_this18, "key", 'charts');
883
+ return _this18;
884
+ }
885
+ _inherits(ChartsSchema, _Schema17);
886
+ return _createClass(ChartsSchema, [{
887
+ key: "save",
888
+ value: function save(charts) {
889
+ var _this19 = this;
890
+ if (!Array.isArray(charts) || !charts.length) {
891
+ // Keep saved maps unchanged when the charts panel is unused.
892
+ return {};
893
+ }
894
+ return _defineProperty({}, this.key, charts.map(function (chart) {
895
+ return _this19.savePropertiesOrApplySchema(_objectSpread(_objectSpread({}, chart), {}, {
896
+ display: _objectSpread(_objectSpread({}, chart.display), {}, {
897
+ isConfigActive: false,
898
+ isJsonEditorActive: false
899
+ })
900
+ })).charts;
901
+ }));
902
+ }
903
+ }, {
904
+ key: "load",
905
+ value: function load(charts) {
906
+ var _this20 = this;
907
+ if (!Array.isArray(charts)) {
908
+ return _defineProperty({}, this.key, []);
909
+ }
910
+ return _defineProperty({}, this.key, charts.map(function (chart) {
911
+ var loaded = _this20.loadPropertiesOrApplySchema(chart, charts).charts;
912
+ // Older saved maps omit `pinned`; keep charts visible like the legend.
913
+ return _objectSpread(_objectSpread({}, loaded), {}, {
914
+ pinned: loaded.pinned !== false
915
+ });
916
+ }));
917
+ }
918
+ }]);
919
+ }(Schema);
920
+ export var EffectsSchema = /*#__PURE__*/function (_Schema18) {
921
+ function EffectsSchema() {
922
+ var _this21;
923
+ _classCallCheck(this, EffectsSchema);
924
+ for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
925
+ args[_key13] = arguments[_key13];
926
+ }
927
+ _this21 = _callSuper(this, EffectsSchema, [].concat(args));
928
+ _defineProperty(_this21, "key", 'effects');
929
+ return _this21;
930
+ }
931
+ _inherits(EffectsSchema, _Schema18);
932
+ return _createClass(EffectsSchema, [{
933
+ key: "save",
934
+ value: function save(effects, parents) {
935
+ var _this22 = this;
936
+ var _parents$slice19 = parents.slice(-1),
937
+ _parents$slice20 = _slicedToArray(_parents$slice19, 1),
938
+ visState = _parents$slice20[0];
939
+ return _defineProperty({}, this.key, visState.effectOrder.reduce(function (saved, effectId) {
940
+ // save effects according to their rendering order
941
+ /**
942
+ * @type {Effect | undefined}
943
+ */
944
+ var effect = findById(effectId)(effects);
945
+ if (effect !== null && effect !== void 0 && effect.isValidToSave()) {
946
+ saved.push(_this22.savePropertiesOrApplySchema(effect).effects);
947
+ }
948
+ return saved;
949
+ }, []));
950
+ }
951
+ }, {
952
+ key: "load",
953
+ value: function load(effects) {
954
+ var _this23 = this;
955
+ return _defineProperty({}, this.key, effects.map(function (effect) {
956
+ // handle older configs
957
+ var outEffect = effect.config ? _objectSpread(_objectSpread({
958
+ id: effect.id
959
+ }, effect.config), {}, {
960
+ parameters: _objectSpread({}, effect.config.params || {})
961
+ }) : effect;
962
+ return _this23.loadPropertiesOrApplySchema(outEffect, effects).effects;
963
+ }));
964
+ }
965
+ }]);
966
+ }(Schema);
967
+ var annotationPropsV1 = {
968
+ id: null,
969
+ kind: null,
970
+ isVisible: null,
971
+ autoSize: null,
972
+ autoSizeY: null,
973
+ anchorPoint: null,
974
+ label: null,
975
+ editorState: null,
976
+ mapIndex: null,
977
+ lineColor: null,
978
+ lineWidth: null,
979
+ textWidth: null,
980
+ textHeight: null,
981
+ textVerticalAlign: null,
982
+ textSide: null,
983
+ textVerticalPosition: null,
984
+ armLength: null,
985
+ angle: null,
986
+ radiusInMeters: null,
987
+ endPoint: null,
988
+ showCustomText: null,
989
+ showDistance: null
990
+ };
991
+ export var AnnotationsSchema = /*#__PURE__*/function (_Schema19) {
992
+ function AnnotationsSchema() {
993
+ var _this24;
994
+ _classCallCheck(this, AnnotationsSchema);
995
+ for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
996
+ args[_key14] = arguments[_key14];
997
+ }
998
+ _this24 = _callSuper(this, AnnotationsSchema, [].concat(args));
999
+ _defineProperty(_this24, "key", 'annotations');
1000
+ return _this24;
1001
+ }
1002
+ _inherits(AnnotationsSchema, _Schema19);
1003
+ return _createClass(AnnotationsSchema, [{
1004
+ key: "save",
1005
+ value: function save(annotations) {
1006
+ var _this25 = this;
1007
+ return _defineProperty({}, this.key, annotations.map(function (annotation) {
1008
+ return _this25.savePropertiesOrApplySchema(annotation).annotations;
1009
+ }));
1010
+ }
1011
+ }, {
1012
+ key: "load",
1013
+ value: function load(annotations) {
1014
+ var _this26 = this;
1015
+ return _defineProperty({}, this.key, annotations.map(function (annotation) {
1016
+ return _this26.loadPropertiesOrApplySchema(annotation).annotations;
1017
+ }));
1018
+ }
1019
+ }]);
1020
+ }(Schema);
1021
+ export var filterPropsV1 = _objectSpread(_objectSpread({}, filterPropsV0), {}, {
1022
+ plotType: new PlotTypeSchema({
1023
+ version: VERSIONS.v1
1024
+ }),
1025
+ animationWindow: null,
1026
+ yAxis: new DimensionFieldSchema({
1027
+ version: VERSIONS.v1,
1028
+ key: 'yAxis',
1029
+ properties: {
1030
+ name: null,
1031
+ type: null
1032
+ }
1033
+ }),
1034
+ // this replaced enlarged
1035
+ view: null,
1036
+ // polygon filter properties
1037
+ layerId: null,
1038
+ speed: null,
1039
+ // layer timeline
1040
+ syncedWithLayerTimeline: null,
1041
+ syncTimelineMode: null,
1042
+ enabled: null,
1043
+ inverted: null,
1044
+ invertTrendColor: null,
1045
+ timezone: null,
1046
+ // Optional end timestamp for duration-based time animation (#3198)
1047
+ endName: null
1048
+ });
1049
+ export var propertiesV0 = {
1050
+ filters: new FilterSchemaV0({
1051
+ version: VERSIONS.v0,
1052
+ properties: filterPropsV0
1053
+ }),
1054
+ layers: new LayerSchemaV0({
1055
+ version: VERSIONS.v0,
1056
+ properties: layerPropsV0
1057
+ }),
1058
+ interactionConfig: new InteractionSchemaV0({
1059
+ version: VERSIONS.v0,
1060
+ properties: interactionPropsV0
1061
+ }),
1062
+ layerBlending: null,
1063
+ overlayBlending: null
1064
+ };
1065
+ var CameraBookmarksSchema = /*#__PURE__*/function (_Schema20) {
1066
+ function CameraBookmarksSchema() {
1067
+ var _this27;
1068
+ _classCallCheck(this, CameraBookmarksSchema);
1069
+ for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
1070
+ args[_key15] = arguments[_key15];
1071
+ }
1072
+ _this27 = _callSuper(this, CameraBookmarksSchema, [].concat(args));
1073
+ _defineProperty(_this27, "key", 'cameraBookmarks');
1074
+ return _this27;
1075
+ }
1076
+ _inherits(CameraBookmarksSchema, _Schema20);
1077
+ return _createClass(CameraBookmarksSchema, [{
1078
+ key: "save",
1079
+ value: function save(value) {
1080
+ var bookmarks = normalizeCameraBookmarks(value);
1081
+ return bookmarks.length ? _defineProperty({}, this.key, bookmarks) : {};
1082
+ }
1083
+ }, {
1084
+ key: "load",
1085
+ value: function load(value) {
1086
+ return _defineProperty({}, this.key, normalizeCameraBookmarks(value));
1087
+ }
1088
+ }]);
1089
+ }(Schema);
1090
+ var CameraTourSchema = /*#__PURE__*/function (_Schema21) {
1091
+ function CameraTourSchema() {
1092
+ var _this28;
1093
+ _classCallCheck(this, CameraTourSchema);
1094
+ for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
1095
+ args[_key16] = arguments[_key16];
1096
+ }
1097
+ _this28 = _callSuper(this, CameraTourSchema, [].concat(args));
1098
+ _defineProperty(_this28, "key", 'cameraTour');
1099
+ return _this28;
1100
+ }
1101
+ _inherits(CameraTourSchema, _Schema21);
1102
+ return _createClass(CameraTourSchema, [{
1103
+ key: "save",
1104
+ value: function save(value) {
1105
+ var tour = normalizeCameraTour(value);
1106
+ return tour ? _defineProperty({}, this.key, tour) : {};
1107
+ }
1108
+ }, {
1109
+ key: "load",
1110
+ value: function load(value) {
1111
+ return _defineProperty({}, this.key, normalizeCameraTour(value));
1112
+ }
1113
+ }]);
1114
+ }(Schema);
1115
+ export var propertiesV1 = {
1116
+ cameraTour: new CameraTourSchema(),
1117
+ cameraBookmarks: new CameraBookmarksSchema(),
1118
+ filters: new FilterSchemaV0({
1119
+ version: VERSIONS.v1,
1120
+ properties: filterPropsV1
1121
+ }),
1122
+ layers: new LayerSchemaV0({
1123
+ version: VERSIONS.v1,
1124
+ properties: layerPropsV1
1125
+ }),
1126
+ effects: new EffectsSchema({
1127
+ version: VERSIONS.v1,
1128
+ properties: effectPropsV1
1129
+ }),
1130
+ charts: new ChartsSchema({
1131
+ version: VERSIONS.v1,
1132
+ properties: chartPropsV1
1133
+ }),
1134
+ annotations: new AnnotationsSchema({
1135
+ version: VERSIONS.v1,
1136
+ properties: annotationPropsV1
1137
+ }),
1138
+ interactionConfig: new InteractionSchemaV1({
1139
+ version: VERSIONS.v1,
1140
+ properties: interactionPropsV1
1141
+ }),
1142
+ layerBlending: null,
1143
+ overlayBlending: null,
1144
+ splitMaps: new SplitMapsSchema({
1145
+ key: 'splitMaps',
1146
+ version: VERSIONS.v1
1147
+ }),
1148
+ animationConfig: new Schema({
1149
+ version: VERSIONS.v1,
1150
+ properties: {
1151
+ currentTime: null,
1152
+ speed: null,
1153
+ timeFormat: null,
1154
+ timezone: null
1155
+ },
1156
+ key: 'animationConfig'
1157
+ }),
1158
+ editor: new Schema({
1159
+ version: VERSIONS.v1,
1160
+ properties: {
1161
+ features: null,
1162
+ visible: null
1163
+ },
1164
+ key: 'editor'
1165
+ }),
1166
+ layerOrder: null,
1167
+ groupBys: null,
1168
+ joins: null
1169
+ // suitabilities is intentionally absent: the op config is ephemeral and only the
1170
+ // derived dataset is persisted. A `null` entry here would write it to saved maps.
1171
+ };
1172
+ export var VisStateSchemaV1 = /*#__PURE__*/function (_Schema22) {
1173
+ function VisStateSchemaV1() {
1174
+ _classCallCheck(this, VisStateSchemaV1);
1175
+ return _callSuper(this, VisStateSchemaV1, arguments);
1176
+ }
1177
+ _inherits(VisStateSchemaV1, _Schema22);
1178
+ return _createClass(VisStateSchemaV1, [{
1179
+ key: "save",
1180
+ value: function save(node) {
1181
+ var parents = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1182
+ var accumulator = arguments.length > 2 ? arguments[2] : undefined;
1183
+ // @ts-expect-error
1184
+ return this.savePropertiesOrApplySchema(node, parents, accumulator);
1185
+ }
1186
+ }, {
1187
+ key: "load",
1188
+ value: function load(node) {
1189
+ // @ts-expect-error
1190
+ return this.loadPropertiesOrApplySchema(node);
1191
+ }
1192
+ }]);
1193
+ }(Schema);
1194
+ export var visStateSchemaV0 = new Schema({
1195
+ version: VERSIONS.v0,
1196
+ properties: propertiesV0,
1197
+ key: 'visState'
1198
+ });
1199
+ export var visStateSchemaV1 = new VisStateSchemaV1({
1200
+ version: VERSIONS.v1,
1201
+ properties: propertiesV1,
1202
+ key: 'visState'
1203
+ });
1204
+ export var visStateSchema = _defineProperty(_defineProperty({}, VERSIONS.v0, {
1205
+ save: function save(toSave) {
1206
+ return visStateSchemaV0.save(toSave);
1207
+ },
1208
+ load: function load(toLoad) {
1209
+ var _visStateSchemaV0$loa;
1210
+ return visStateSchemaV1.load((_visStateSchemaV0$loa = visStateSchemaV0.load(toLoad)) === null || _visStateSchemaV0$loa === void 0 ? void 0 : _visStateSchemaV0$loa.visState);
1211
+ }
1212
+ }), VERSIONS.v1, visStateSchemaV1);
1213
+
1214
+ // test load v0
1215
+ export default visStateSchema;
1216
+ //# sourceMappingURL=vis-state-schema.js.map