@carto/api-client 0.5.13 → 0.5.15-alpha.raster-0

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.
@@ -125,9 +125,14 @@ __export(src_exports, {
125
125
  WidgetSource: () => WidgetSource,
126
126
  WidgetTableSource: () => WidgetTableSource,
127
127
  WidgetTilesetSource: () => WidgetTilesetSource,
128
+ _ErrorCode: () => ErrorCode,
128
129
  _buildFeatureFilter: () => _buildFeatureFilter,
130
+ _createVecExprEvaluator: () => createVecExprEvaluator,
129
131
  _domainFromValues: () => domainFromValues,
132
+ _evaluateVecExpr: () => evaluateVecExpr,
130
133
  _getHexagonResolution: () => _getHexagonResolution,
134
+ _getRasterTileLayerStyleProps: () => getRasterTileLayerStyleProps,
135
+ _validateVecExprSyntax: () => validateVecExprSyntax,
131
136
  addFilter: () => addFilter,
132
137
  aggregate: () => aggregate,
133
138
  aggregationFunctions: () => aggregationFunctions,
@@ -140,9 +145,11 @@ __export(src_exports, {
140
145
  buildStatsUrl: () => buildStatsUrl,
141
146
  calculateClusterRadius: () => calculateClusterRadius,
142
147
  calculateClusterTextFontSize: () => calculateClusterTextFontSize,
148
+ calculateLayerScale: () => calculateLayerScale,
143
149
  clearDefaultRequestCache: () => clearDefaultRequestCache,
144
150
  clearFilters: () => clearFilters,
145
151
  configureSource: () => configureSource,
152
+ createColorScale: () => createColorScale,
146
153
  createPolygonSpatialFilter: () => createPolygonSpatialFilter,
147
154
  createViewportSpatialFilter: () => createViewportSpatialFilter,
148
155
  fetchBasemapProps: () => fetchBasemapProps,
@@ -157,6 +164,7 @@ __export(src_exports, {
157
164
  getDefaultAggregationExpColumnAliasForLayerType: () => getDefaultAggregationExpColumnAliasForLayerType,
158
165
  getFilter: () => getFilter,
159
166
  getIconUrlAccessor: () => getIconUrlAccessor,
167
+ getLayerDescriptor: () => getLayerDescriptor,
160
168
  getLayerProps: () => getLayerProps,
161
169
  getMaxMarkerSize: () => getMaxMarkerSize,
162
170
  getSizeAccessor: () => getSizeAccessor,
@@ -215,11 +223,11 @@ var FilterType = /* @__PURE__ */ ((FilterType2) => {
215
223
  FilterType2["STRING_SEARCH"] = "stringSearch";
216
224
  return FilterType2;
217
225
  })(FilterType || {});
218
- var ApiVersion = /* @__PURE__ */ ((ApiVersion3) => {
219
- ApiVersion3["V1"] = "v1";
220
- ApiVersion3["V2"] = "v2";
221
- ApiVersion3["V3"] = "v3";
222
- return ApiVersion3;
226
+ var ApiVersion = /* @__PURE__ */ ((ApiVersion2) => {
227
+ ApiVersion2["V1"] = "v1";
228
+ ApiVersion2["V2"] = "v2";
229
+ ApiVersion2["V3"] = "v3";
230
+ return ApiVersion2;
223
231
  })(ApiVersion || {});
224
232
  var DEFAULT_API_BASE_URL = "https://gcp-us-east1.api.carto.com";
225
233
  var TileFormat = /* @__PURE__ */ ((TileFormat2) => {
@@ -6861,6 +6869,48 @@ var WidgetRemoteSource = class extends WidgetSource {
6861
6869
  categories: res.metadata?.categories
6862
6870
  }));
6863
6871
  }
6872
+ /** @experimental */
6873
+ async getExtent(options = {}) {
6874
+ const { signal, filters = this.props.filters, filterOwner } = options;
6875
+ const {
6876
+ type,
6877
+ data,
6878
+ apiBaseUrl,
6879
+ apiVersion,
6880
+ connectionName,
6881
+ spatialDataColumn,
6882
+ spatialDataType,
6883
+ queryParameters
6884
+ } = this.getModelSource(filters, filterOwner);
6885
+ assert2(apiVersion === "v3" /* V3 */, "Stats API requires CARTO 3+");
6886
+ let url;
6887
+ const parameters = { filters, spatialDataType };
6888
+ if (type === "query") {
6889
+ url = `${apiBaseUrl}/${apiVersion}/stats/${connectionName}/${spatialDataColumn}`;
6890
+ parameters.q = data;
6891
+ parameters.queryParameters = queryParameters;
6892
+ } else {
6893
+ url = `${apiBaseUrl}/${apiVersion}/stats/${connectionName}/${data}/${spatialDataColumn}`;
6894
+ }
6895
+ const headers = {
6896
+ Authorization: `Bearer ${this.props.accessToken}`,
6897
+ ...this.props.headers
6898
+ };
6899
+ const errorContext = {
6900
+ requestType: "Tile stats",
6901
+ connection: connectionName,
6902
+ type
6903
+ };
6904
+ return requestWithParameters({
6905
+ baseUrl: url,
6906
+ headers,
6907
+ signal,
6908
+ errorContext,
6909
+ parameters
6910
+ }).then(({ extent: { xmin, ymin, xmax, ymax } }) => ({
6911
+ bbox: [xmin, ymin, xmax, ymax]
6912
+ }));
6913
+ }
6864
6914
  };
6865
6915
 
6866
6916
  // src/widget-sources/widget-query-source.ts
@@ -7839,6 +7889,10 @@ var WidgetTilesetSourceImpl = class extends WidgetSource {
7839
7889
  max: aggregationFunctions.max(filteredFeatures, column)
7840
7890
  };
7841
7891
  }
7892
+ /** @experimental */
7893
+ async getExtent() {
7894
+ return Promise.reject(new Error("not implemented"));
7895
+ }
7842
7896
  /****************************************************************************
7843
7897
  * INTERNAL
7844
7898
  */
@@ -8069,6 +8123,12 @@ var WidgetTilesetSource = class extends WidgetSource {
8069
8123
  }) {
8070
8124
  return this._executeWorkerMethod("getRange" /* GET_RANGE */, [options], signal);
8071
8125
  }
8126
+ /** @experimental */
8127
+ async getExtent() {
8128
+ return Promise.resolve({
8129
+ bbox: this.props.spatialDataBounds
8130
+ });
8131
+ }
8072
8132
  };
8073
8133
 
8074
8134
  // src/widget-sources/widget-raster-source.ts
@@ -8191,7 +8251,8 @@ var h3TilesetSource = async function(options) {
8191
8251
  ...options,
8192
8252
  tileFormat: getTileFormat(result),
8193
8253
  spatialDataColumn,
8194
- spatialDataType: "h3"
8254
+ spatialDataType: "h3",
8255
+ spatialDataBounds: result.bounds
8195
8256
  })
8196
8257
  })
8197
8258
  );
@@ -8213,6 +8274,7 @@ var rasterSource = async function(options) {
8213
8274
  tileFormat: getTileFormat(result),
8214
8275
  spatialDataColumn: "quadbin",
8215
8276
  spatialDataType: "quadbin",
8277
+ spatialDataBounds: result.bounds,
8216
8278
  rasterMetadata: result.raster_metadata
8217
8279
  })
8218
8280
  })
@@ -8315,7 +8377,8 @@ var quadbinTilesetSource = async function(options) {
8315
8377
  ...options,
8316
8378
  tileFormat: getTileFormat(result),
8317
8379
  spatialDataColumn,
8318
- spatialDataType: "quadbin"
8380
+ spatialDataType: "quadbin",
8381
+ spatialDataBounds: result.bounds
8319
8382
  })
8320
8383
  })
8321
8384
  );
@@ -8419,7 +8482,8 @@ var vectorTilesetSource = async function(options) {
8419
8482
  ...options,
8420
8483
  tileFormat: getTileFormat(result),
8421
8484
  spatialDataColumn,
8422
- spatialDataType: "geo"
8485
+ spatialDataType: "geo",
8486
+ spatialDataBounds: result.bounds
8423
8487
  })
8424
8488
  })
8425
8489
  );
@@ -8583,11 +8647,253 @@ var basemap_styles_default = {
8583
8647
  DARK_MATTER_NOLABELS: getStyleUrl("dark-matter-nolabels")
8584
8648
  };
8585
8649
 
8586
- // src/fetch-map/fetch-map.ts
8650
+ // src/fetch-map/raster-layer.ts
8587
8651
  init_cjs_shims();
8588
8652
 
8589
- // src/fetch-map/parse-map.ts
8653
+ // src/fetch-map/vec-expr-evaluator.ts
8590
8654
  init_cjs_shims();
8655
+ var import_jsep = __toESM(require("jsep"), 1);
8656
+ function createVecExprEvaluator(expression) {
8657
+ try {
8658
+ const parsed = compile(expression);
8659
+ const evalFun = (context) => evaluate(parsed, context);
8660
+ evalFun.symbols = getSymbols(parsed);
8661
+ return evalFun;
8662
+ } catch {
8663
+ return null;
8664
+ }
8665
+ }
8666
+ function evaluateVecExpr(expression, context) {
8667
+ try {
8668
+ return createVecExprEvaluator(expression)?.(context);
8669
+ } catch {
8670
+ return null;
8671
+ }
8672
+ }
8673
+ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
8674
+ ErrorCode2[ErrorCode2["InvalidSyntax"] = 0] = "InvalidSyntax";
8675
+ ErrorCode2[ErrorCode2["UnknownIdentifier"] = 1] = "UnknownIdentifier";
8676
+ return ErrorCode2;
8677
+ })(ErrorCode || {});
8678
+ function validateVecExprSyntax(expression, context) {
8679
+ let parsed;
8680
+ try {
8681
+ parsed = compile(expression);
8682
+ } catch (e) {
8683
+ return {
8684
+ valid: false,
8685
+ errorCode: 0 /* InvalidSyntax */,
8686
+ errorMessage: e && "message" in e ? String(e.message) : String(e)
8687
+ };
8688
+ }
8689
+ return validate(parsed, context);
8690
+ }
8691
+ function createResultArray(typeTemplate, length2 = typeTemplate.length) {
8692
+ return new Array(length2);
8693
+ }
8694
+ function isVecLike(a) {
8695
+ return Array.isArray(a) || ArrayBuffer.isView(a);
8696
+ }
8697
+ var createBinopVec = (scalarBinOp) => (left, right) => {
8698
+ const length2 = Math.min(left.length, right.length);
8699
+ const r = createResultArray(left, length2);
8700
+ for (let i = 0; i < length2; i++) {
8701
+ r[i] = scalarBinOp(left[i], right[i]);
8702
+ }
8703
+ return r;
8704
+ };
8705
+ var createBinopVecNum = (scalarBinOp) => (left, right) => {
8706
+ const length2 = left.length;
8707
+ const r = createResultArray(left, length2);
8708
+ for (let i = 0; i < length2; i++) {
8709
+ r[i] = scalarBinOp(left[i], right);
8710
+ }
8711
+ return r;
8712
+ };
8713
+ var createBinopNumVec = (scalarBinOp) => (left, right) => {
8714
+ const length2 = right.length;
8715
+ const r = createResultArray(right, length2);
8716
+ for (let i = 0; i < length2; i++) {
8717
+ r[i] = scalarBinOp(left, right[i]);
8718
+ }
8719
+ return r;
8720
+ };
8721
+ var createUnopVec = (scalarUnop) => (a) => {
8722
+ const length2 = a.length;
8723
+ const r = createResultArray(a, length2);
8724
+ for (let i = 0; i < length2; i++) {
8725
+ r[i] = scalarUnop(a[i]);
8726
+ }
8727
+ return r;
8728
+ };
8729
+ function mapDictValues(dict, fun) {
8730
+ return Object.keys(dict).reduce(
8731
+ (acc, key) => {
8732
+ acc[key] = fun(dict[key]);
8733
+ return acc;
8734
+ },
8735
+ {}
8736
+ );
8737
+ }
8738
+ var binopsNum = {
8739
+ "||": (a, b) => a || b,
8740
+ "&&": (a, b) => a && b,
8741
+ "|": (a, b) => a | b,
8742
+ "^": (a, b) => a ^ b,
8743
+ "&": (a, b) => a & b,
8744
+ "==": (a, b) => Number(a == b),
8745
+ "!=": (a, b) => Number(a != b),
8746
+ "===": (a, b) => Number(a === b),
8747
+ "!==": (a, b) => Number(a !== b),
8748
+ "<": (a, b) => Number(a < b),
8749
+ ">": (a, b) => Number(a > b),
8750
+ "<=": (a, b) => Number(a <= b),
8751
+ ">=": (a, b) => Number(a >= b),
8752
+ "<<": (a, b) => a << b,
8753
+ ">>": (a, b) => a >> b,
8754
+ ">>>": (a, b) => a >>> b,
8755
+ "+": (a, b) => a + b,
8756
+ "-": (a, b) => a - b,
8757
+ "*": (a, b) => a * b,
8758
+ "/": (a, b) => a / b,
8759
+ "%": (a, b) => a % b
8760
+ };
8761
+ var unopsNum = {
8762
+ "-": (a) => -a,
8763
+ "+": (a) => +a,
8764
+ "~": (a) => ~a,
8765
+ "!": (a) => Number(!a)
8766
+ };
8767
+ var binopsVector = mapDictValues(binopsNum, createBinopVec);
8768
+ var binopsNumVec = mapDictValues(binopsNum, createBinopNumVec);
8769
+ var binopsVecNum = mapDictValues(binopsNum, createBinopVecNum);
8770
+ var unopsVector = mapDictValues(unopsNum, createUnopVec);
8771
+ function getBinop(operator, left, right) {
8772
+ const isLeftVec = isVecLike(left);
8773
+ const isRightVec = isVecLike(right);
8774
+ if (isLeftVec && isRightVec) {
8775
+ return binopsVector[operator];
8776
+ } else if (isLeftVec) {
8777
+ return binopsVecNum[operator];
8778
+ } else if (isRightVec) {
8779
+ return binopsNumVec[operator];
8780
+ } else {
8781
+ return binopsNum[operator];
8782
+ }
8783
+ }
8784
+ function evaluate(_node, context) {
8785
+ const node = _node;
8786
+ switch (node.type) {
8787
+ case "BinaryExpression": {
8788
+ const left = evaluate(node.left, context);
8789
+ const right = evaluate(node.right, context);
8790
+ const binopFun = getBinop(node.operator, left, right);
8791
+ return binopFun(left, right);
8792
+ }
8793
+ case "ConditionalExpression": {
8794
+ const val = evaluate(node.test, context);
8795
+ if (isVecLike(val)) {
8796
+ const length2 = val.length;
8797
+ const consequentVal = evaluate(node.consequent, context);
8798
+ const alternateVal = evaluate(node.alternate, context);
8799
+ const r = createResultArray(val);
8800
+ for (let i = 0; i < length2; i++) {
8801
+ const entryVal = val[i] ? consequentVal : alternateVal;
8802
+ r[i] = isVecLike(entryVal) ? entryVal[i] ?? NaN : entryVal;
8803
+ }
8804
+ return r;
8805
+ } else {
8806
+ return val ? evaluate(node.consequent, context) : evaluate(node.alternate, context);
8807
+ }
8808
+ }
8809
+ case "Identifier":
8810
+ return context[node.name];
8811
+ case "Literal":
8812
+ return node.value;
8813
+ case "UnaryExpression": {
8814
+ const val = evaluate(node.argument, context);
8815
+ const unopFun = isVecLike(val) ? unopsVector[node.operator] : unopsNum[node.operator];
8816
+ return unopFun(val);
8817
+ }
8818
+ default:
8819
+ return void 0;
8820
+ }
8821
+ }
8822
+ var validResult = { valid: true };
8823
+ function visit(_node, visitor) {
8824
+ const node = _node;
8825
+ visitor(node);
8826
+ switch (node.type) {
8827
+ case "BinaryExpression": {
8828
+ visit(node.left, visitor);
8829
+ visit(node.right, visitor);
8830
+ break;
8831
+ }
8832
+ case "ConditionalExpression": {
8833
+ visit(node.test, visitor);
8834
+ visit(node.consequent, visitor);
8835
+ visit(node.alternate, visitor);
8836
+ break;
8837
+ }
8838
+ case "UnaryExpression": {
8839
+ visit(node.argument, visitor);
8840
+ break;
8841
+ }
8842
+ }
8843
+ }
8844
+ var supportedExpressionTypes = [
8845
+ "BinaryExpression",
8846
+ "UnaryExpression",
8847
+ "ConditionalExpression",
8848
+ "LogicalExpression",
8849
+ "Identifier",
8850
+ "Literal"
8851
+ ];
8852
+ function validate(_node, context) {
8853
+ const node = _node;
8854
+ const errors = [];
8855
+ visit(node, (node2) => {
8856
+ if (!supportedExpressionTypes.includes(node2.type)) {
8857
+ errors.push({
8858
+ valid: false,
8859
+ errorCode: 0 /* InvalidSyntax */,
8860
+ errorMessage: `Not allowed`
8861
+ });
8862
+ return;
8863
+ }
8864
+ if (node2.type === "Identifier") {
8865
+ if (!Object.prototype.hasOwnProperty.call(context, node2.name)) {
8866
+ return errors.push({
8867
+ valid: false,
8868
+ errorCode: 1 /* UnknownIdentifier */,
8869
+ errorMessage: `"${node2.name}" not found`
8870
+ });
8871
+ }
8872
+ }
8873
+ if (node2.type === "Literal") {
8874
+ if (typeof node2.value !== "number") {
8875
+ return errors.push({
8876
+ valid: false,
8877
+ errorCode: 0 /* InvalidSyntax */,
8878
+ errorMessage: `Only number literals are supported`
8879
+ });
8880
+ }
8881
+ }
8882
+ });
8883
+ return errors.length ? errors[0] : validResult;
8884
+ }
8885
+ function getSymbols(node) {
8886
+ const symbols = /* @__PURE__ */ new Set();
8887
+ visit(node, (node2) => {
8888
+ if (node2.type === "Identifier") {
8889
+ symbols.add(node2.name);
8890
+ }
8891
+ });
8892
+ return Array.from(symbols);
8893
+ }
8894
+ function compile(expression) {
8895
+ return (0, import_jsep.default)(expression);
8896
+ }
8591
8897
 
8592
8898
  // src/fetch-map/layer-map.ts
8593
8899
  init_cjs_shims();
@@ -9235,6 +9541,12 @@ var sharedPropMap = {
9235
9541
  wireframe: "wireframe"
9236
9542
  }
9237
9543
  };
9544
+ var rasterPropsMap = {
9545
+ isVisible: "visible",
9546
+ visConfig: {
9547
+ opacity: "opacity"
9548
+ }
9549
+ };
9238
9550
  var customMarkersPropsMap = {
9239
9551
  color: "getIconColor",
9240
9552
  visConfig: {
@@ -9278,6 +9590,12 @@ function getLayerProps(type, config2, dataset) {
9278
9590
  `Outdated layer type: ${type}. Please open map in CARTO Builder to automatically migrate.`
9279
9591
  );
9280
9592
  }
9593
+ if (type === "raster") {
9594
+ return {
9595
+ propMap: rasterPropsMap,
9596
+ defaultProps: {}
9597
+ };
9598
+ }
9281
9599
  let basePropMap = sharedPropMap;
9282
9600
  if (config2.visConfig?.customMarkers) {
9283
9601
  basePropMap = mergePropMaps(basePropMap, customMarkersPropsMap);
@@ -9298,6 +9616,9 @@ function getLayerProps(type, config2, dataset) {
9298
9616
  }
9299
9617
  function domainFromAttribute(attribute, scaleType, scaleLength) {
9300
9618
  if (scaleType === "ordinal" || scaleType === "point") {
9619
+ if (!attribute.categories) {
9620
+ return [0, 1];
9621
+ }
9301
9622
  return attribute.categories.map((c) => c.category).filter((c) => c !== void 0 && c !== null);
9302
9623
  }
9303
9624
  if (scaleType === "quantile" && attribute.quantiles) {
@@ -9333,7 +9654,7 @@ function calculateDomain(data, name, scaleType, scaleLength) {
9333
9654
  return [0, 1];
9334
9655
  }
9335
9656
  function normalizeAccessor(accessor, data) {
9336
- if (data.features || data.tilestats) {
9657
+ if (data.features || data.tilestats || data.raster_metadata) {
9337
9658
  return (object, info) => {
9338
9659
  if (object) {
9339
9660
  return accessor(object.properties || object.__source.object.properties);
@@ -9385,7 +9706,6 @@ function getColorAccessor({ name, colorColumn }, scaleType, { aggregation, range
9385
9706
  return { accessor: normalizeAccessor(accessor, data), scale: scale2 };
9386
9707
  }
9387
9708
  function calculateLayerScale(name, scaleType, range, data) {
9388
- const scale2 = SCALE_FUNCS[scaleType]();
9389
9709
  let domain = [];
9390
9710
  let scaleColor = [];
9391
9711
  if (scaleType !== "identity") {
@@ -9403,9 +9723,13 @@ function calculateLayerScale(name, scaleType, range, data) {
9403
9723
  domain = domain.slice(0, scaleColor.length);
9404
9724
  }
9405
9725
  }
9726
+ return createColorScale(scaleType, domain, scaleColor, UNKNOWN_COLOR);
9727
+ }
9728
+ function createColorScale(scaleType, domain, range, unknown) {
9729
+ const scale2 = SCALE_FUNCS[scaleType]();
9406
9730
  scale2.domain(domain);
9407
- scale2.range(scaleColor);
9408
- scale2.unknown(UNKNOWN_COLOR);
9731
+ scale2.range(range);
9732
+ scale2.unknown(unknown);
9409
9733
  return scale2;
9410
9734
  }
9411
9735
  var FALLBACK_ICON = "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz4NCjwvc3ZnPg==";
@@ -9520,13 +9844,423 @@ function calculateClusterTextFontSize(radius) {
9520
9844
  return 11;
9521
9845
  }
9522
9846
 
9847
+ // src/fetch-map/raster-layer.ts
9848
+ var UNKNOWN_COLOR2 = [134, 141, 145];
9849
+ var RASTER_COLOR_BANDS = ["red", "green", "blue"];
9850
+ function getHasDataPredicate(noData) {
9851
+ if (noData === "nan") {
9852
+ return (v2) => !isNaN(v2);
9853
+ }
9854
+ if (typeof noData === "string") {
9855
+ noData = parseFloat(noData);
9856
+ }
9857
+ if (typeof noData === "number") {
9858
+ return (v2) => v2 !== noData && !isNaN(v2);
9859
+ }
9860
+ return () => true;
9861
+ }
9862
+ function createRasterColumnLayerDataTransform(transform) {
9863
+ return (data) => {
9864
+ if (!data || !("data" in data) || !data?.data?.cells?.numericProps) {
9865
+ return data;
9866
+ }
9867
+ return transform(data);
9868
+ };
9869
+ }
9870
+ function createEvaluationContext(numericProps, noData) {
9871
+ const hasData = getHasDataPredicate(noData);
9872
+ const bands = Object.entries(numericProps).map(([bandName, { value }]) => ({
9873
+ bandName,
9874
+ values: value,
9875
+ copied: false
9876
+ }));
9877
+ const length2 = bands[0].values.length;
9878
+ for (let i = 0; i < length2; i++) {
9879
+ let hasSomeData = false;
9880
+ for (let j = 0; j < bands.length; j++) {
9881
+ hasSomeData = hasSomeData || hasData(bands[j].values[i]);
9882
+ }
9883
+ if (!hasSomeData) {
9884
+ for (let j = 0; j < bands.length; j++) {
9885
+ if (!bands[j].copied) {
9886
+ bands[j].copied = true;
9887
+ bands[j].values = Array.from(bands[j].values);
9888
+ }
9889
+ bands[j].values[i] = NaN;
9890
+ }
9891
+ }
9892
+ }
9893
+ const context = bands.reduce(
9894
+ (agg, { bandName, values }) => {
9895
+ agg[bandName] = values;
9896
+ return agg;
9897
+ },
9898
+ {}
9899
+ );
9900
+ return context;
9901
+ }
9902
+ function createExprDataTransform({
9903
+ colorBand,
9904
+ rasterMetadata,
9905
+ usedSymbols
9906
+ }) {
9907
+ if (!colorBand || !colorBand.type || colorBand.type === "none") {
9908
+ return void 0;
9909
+ }
9910
+ const expr = colorBand?.type === "expression" ? colorBand.value : void 0;
9911
+ const vecExprEvaluator = expr ? createVecExprEvaluator(expr) : void 0;
9912
+ const dataTransform = createRasterColumnLayerDataTransform(
9913
+ (dataWrapped) => {
9914
+ const data = dataWrapped.data;
9915
+ if (expr) {
9916
+ const cachedResult = dataWrapped.customExpressionResults?.[expr];
9917
+ if (cachedResult) {
9918
+ return dataWrapped;
9919
+ }
9920
+ }
9921
+ let context = dataWrapped.expressionEvalContext;
9922
+ if (!context) {
9923
+ const usedNumericProps = usedSymbols.reduce(
9924
+ (acc, symbol) => {
9925
+ acc[symbol] = data.cells.numericProps[symbol];
9926
+ return acc;
9927
+ },
9928
+ {}
9929
+ );
9930
+ context = createEvaluationContext(
9931
+ usedNumericProps,
9932
+ rasterMetadata.nodata
9933
+ );
9934
+ dataWrapped = {
9935
+ ...dataWrapped,
9936
+ expressionEvalContext: context
9937
+ };
9938
+ }
9939
+ if (!vecExprEvaluator || !expr) return dataWrapped;
9940
+ const evalResult = vecExprEvaluator(context);
9941
+ return {
9942
+ ...dataWrapped,
9943
+ customExpressionResults: {
9944
+ ...dataWrapped.customExpressionResults,
9945
+ [expr]: evalResult
9946
+ }
9947
+ };
9948
+ }
9949
+ );
9950
+ return dataTransform;
9951
+ }
9952
+ function combineDataTransforms(dataTransforms) {
9953
+ const actualTransforms = dataTransforms.filter((v2) => v2);
9954
+ if (actualTransforms.length === 0) return void 0;
9955
+ if (actualTransforms.length === 1) return actualTransforms[0];
9956
+ return (data) => actualTransforms.reduce(
9957
+ (aggData, transformFun) => transformFun(aggData),
9958
+ data
9959
+ );
9960
+ }
9961
+ function createRgbToColorBufferDataTransform({
9962
+ bandDefs,
9963
+ attribute
9964
+ }) {
9965
+ return createRasterColumnLayerDataTransform(
9966
+ (dataWrapped) => {
9967
+ const length2 = dataWrapped.length;
9968
+ const getBandBufferOrValue = (colorBand) => {
9969
+ if (colorBand?.type === "expression") {
9970
+ return dataWrapped.customExpressionResults?.[colorBand.value];
9971
+ }
9972
+ if (colorBand?.type === "band") {
9973
+ return dataWrapped.expressionEvalContext?.[colorBand.value];
9974
+ }
9975
+ return 0;
9976
+ };
9977
+ const red = getBandBufferOrValue(bandDefs.red);
9978
+ const green = getBandBufferOrValue(bandDefs.green);
9979
+ const blue = getBandBufferOrValue(bandDefs.blue);
9980
+ const colorBuffer = new Uint8Array(length2 * 4);
9981
+ for (let inputIndex = 0, outputIndex = 0; inputIndex < length2; inputIndex++, outputIndex += 4) {
9982
+ const redRaw = typeof red === "number" ? red : red ? red[inputIndex] : NaN;
9983
+ const greenRaw = typeof green === "number" ? green : green ? green[inputIndex] : NaN;
9984
+ const blueRaw = typeof blue === "number" ? blue : blue ? blue[inputIndex] : NaN;
9985
+ if (isNaN(redRaw) && isNaN(greenRaw) && isNaN(blueRaw)) {
9986
+ bufferSetRgba(colorBuffer, outputIndex, 0, 0, 0, 0);
9987
+ } else {
9988
+ bufferSetRgba(
9989
+ colorBuffer,
9990
+ outputIndex,
9991
+ redRaw,
9992
+ greenRaw,
9993
+ blueRaw,
9994
+ 255
9995
+ );
9996
+ }
9997
+ }
9998
+ dataWrapped.customExpressionResults = void 0;
9999
+ dataWrapped.expressionEvalContext = void 0;
10000
+ return {
10001
+ ...dataWrapped,
10002
+ attributes: {
10003
+ [attribute]: colorBuffer
10004
+ }
10005
+ };
10006
+ }
10007
+ );
10008
+ }
10009
+ function getUsedSymbols(colorBands) {
10010
+ return Array.from(
10011
+ colorBands.reduce((symbols, band) => {
10012
+ if (band.type === "expression") {
10013
+ const expressionSymbols = createVecExprEvaluator(band.value)?.symbols || [];
10014
+ expressionSymbols.forEach((symbol) => symbols.add(symbol));
10015
+ }
10016
+ if (band.type === "band") {
10017
+ symbols.add(band.value);
10018
+ }
10019
+ return symbols;
10020
+ }, /* @__PURE__ */ new Set())
10021
+ );
10022
+ }
10023
+ function getRasterTileLayerStylePropsRgb({
10024
+ layerConfig,
10025
+ rasterMetadata,
10026
+ visualChannels
10027
+ }) {
10028
+ const { visConfig } = layerConfig;
10029
+ const { colorBands } = visConfig;
10030
+ const bandDefs = {
10031
+ red: colorBands?.find((band) => band.band === "red"),
10032
+ green: colorBands?.find((band) => band.band === "green"),
10033
+ blue: colorBands?.find((band) => band.band === "blue")
10034
+ };
10035
+ const rgbToInstanceFillColorsDataTransform = createRgbToColorBufferDataTransform({
10036
+ bandDefs,
10037
+ attribute: "instanceFillColors"
10038
+ });
10039
+ const usedSymbols = colorBands ? getUsedSymbols(colorBands) : [];
10040
+ const bandTransforms = RASTER_COLOR_BANDS.map(
10041
+ (band) => createExprDataTransform({
10042
+ colorBand: bandDefs[band],
10043
+ rasterMetadata,
10044
+ usedSymbols
10045
+ })
10046
+ );
10047
+ const combinedDataTransform = combineDataTransforms([
10048
+ ...bandTransforms,
10049
+ rgbToInstanceFillColorsDataTransform
10050
+ ]);
10051
+ return {
10052
+ dataTransform: combinedDataTransform,
10053
+ updateTriggers: getRasterTileLayerUpdateTriggers({
10054
+ layerConfig,
10055
+ visualChannels
10056
+ })
10057
+ };
10058
+ }
10059
+ function createBandColorScaleDataTransform({
10060
+ bandName,
10061
+ scaleFun,
10062
+ nodata,
10063
+ attribute
10064
+ }) {
10065
+ const hasData = getHasDataPredicate(nodata);
10066
+ return createRasterColumnLayerDataTransform(
10067
+ (dataWrapped) => {
10068
+ const length2 = dataWrapped.length;
10069
+ const bandBuffer = dataWrapped.data.cells.numericProps[bandName].value;
10070
+ const colorBuffer = new Uint8Array(length2 * 4);
10071
+ for (let i = 0; i < length2; i++) {
10072
+ const rawValue = bandBuffer[i];
10073
+ if (!hasData(rawValue)) {
10074
+ bufferSetRgba(colorBuffer, i * 4, 0, 0, 0, 0);
10075
+ } else {
10076
+ const colorRgb = scaleFun(rawValue);
10077
+ bufferSetRgba(
10078
+ colorBuffer,
10079
+ i * 4,
10080
+ colorRgb[0],
10081
+ colorRgb[1],
10082
+ colorRgb[2],
10083
+ 255
10084
+ );
10085
+ }
10086
+ }
10087
+ return {
10088
+ ...dataWrapped,
10089
+ attributes: {
10090
+ [attribute]: colorBuffer
10091
+ }
10092
+ };
10093
+ }
10094
+ );
10095
+ }
10096
+ function domainFromRasterMetadataBand(band, scaleType, colorRange) {
10097
+ if (scaleType === "ordinal") {
10098
+ return colorRange.colorMap?.map(([value]) => value) || [];
10099
+ }
10100
+ if (scaleType === "custom") {
10101
+ if (colorRange.uiCustomScaleType === "logarithmic") {
10102
+ if (colorRange.colorMap) {
10103
+ return colorRange.colorMap?.map(([value]) => value) || [];
10104
+ }
10105
+ return [band.stats.min, band.stats.max];
10106
+ } else {
10107
+ return colorRange.colorMap?.map(([value]) => value) || [];
10108
+ }
10109
+ }
10110
+ const scaleLength = colorRange.colors.length;
10111
+ if (scaleType === "quantile") {
10112
+ const quantiles = band.stats.quantiles?.[scaleLength];
10113
+ if (!quantiles) {
10114
+ return [0, 1];
10115
+ }
10116
+ return [band.stats.min, ...quantiles, band.stats.max];
10117
+ }
10118
+ return [band.stats.min, band.stats.max];
10119
+ }
10120
+ function getRasterTileLayerStylePropsScaledBand({
10121
+ layerConfig,
10122
+ rasterMetadata,
10123
+ visualChannels
10124
+ }) {
10125
+ const { visConfig } = layerConfig;
10126
+ const { colorField } = visualChannels;
10127
+ const { rasterStyleType } = visConfig;
10128
+ const colorRange = rasterStyleType === "ColorRange" ? visConfig.colorRange : visConfig.uniqueValuesColorRange;
10129
+ const scaleType = rasterStyleType === "ColorRange" ? visualChannels.colorScale : "ordinal";
10130
+ const bandInfo = rasterMetadata.bands.find(
10131
+ (band) => band.name === colorField?.name
10132
+ );
10133
+ if (!colorField?.name || !scaleType || !colorRange || !bandInfo) {
10134
+ return {};
10135
+ }
10136
+ const domain = domainFromRasterMetadataBand(bandInfo, scaleType, colorRange);
10137
+ const scaleFun = createColorScale(
10138
+ scaleType,
10139
+ domain,
10140
+ colorRange.colors.map(hexToRGB),
10141
+ UNKNOWN_COLOR2
10142
+ );
10143
+ const bandColorScaleDataTransform = createBandColorScaleDataTransform({
10144
+ bandName: bandInfo.name,
10145
+ scaleFun,
10146
+ nodata: bandInfo?.nodata ?? rasterMetadata.nodata,
10147
+ attribute: "instanceFillColors"
10148
+ });
10149
+ return {
10150
+ dataTransform: bandColorScaleDataTransform,
10151
+ updateTriggers: getRasterTileLayerUpdateTriggers({
10152
+ layerConfig,
10153
+ visualChannels
10154
+ })
10155
+ };
10156
+ }
10157
+ function getRasterTileLayerStyleProps({
10158
+ layerConfig,
10159
+ visualChannels,
10160
+ rasterMetadata
10161
+ }) {
10162
+ const { visConfig } = layerConfig;
10163
+ const { rasterStyleType } = visConfig;
10164
+ if (rasterStyleType === "Rgb") {
10165
+ return getRasterTileLayerStylePropsRgb({
10166
+ layerConfig,
10167
+ rasterMetadata,
10168
+ visualChannels
10169
+ });
10170
+ } else {
10171
+ return getRasterTileLayerStylePropsScaledBand({
10172
+ layerConfig,
10173
+ rasterMetadata,
10174
+ visualChannels
10175
+ });
10176
+ }
10177
+ }
10178
+ function getRasterTileLayerUpdateTriggers({
10179
+ layerConfig,
10180
+ visualChannels
10181
+ }) {
10182
+ const { visConfig } = layerConfig;
10183
+ const { rasterStyleType } = visConfig;
10184
+ const getFillColorUpdateTriggers = {
10185
+ rasterStyleType
10186
+ };
10187
+ if (rasterStyleType === "ColorRange") {
10188
+ getFillColorUpdateTriggers.colorRange = visConfig.colorRange?.colors;
10189
+ getFillColorUpdateTriggers.colorMap = visConfig.colorRange?.colorMap;
10190
+ getFillColorUpdateTriggers.colorScale = visualChannels.colorScale;
10191
+ getFillColorUpdateTriggers.colorFieldId = visualChannels.colorField?.name;
10192
+ } else if (rasterStyleType === "UniqueValues") {
10193
+ getFillColorUpdateTriggers.colorMap = visConfig.uniqueValuesColorRange?.colorMap;
10194
+ getFillColorUpdateTriggers.colorFieldId = visualChannels.colorField?.name;
10195
+ } else if (rasterStyleType === "Rgb") {
10196
+ getFillColorUpdateTriggers.colorBands = visConfig.colorBands;
10197
+ }
10198
+ return {
10199
+ getFillColor: getFillColorUpdateTriggers
10200
+ };
10201
+ }
10202
+ function bufferSetRgba(target, index, r, g, b, a) {
10203
+ target[index + 0] = r;
10204
+ target[index + 1] = g;
10205
+ target[index + 2] = b;
10206
+ target[index + 3] = a;
10207
+ }
10208
+ function hexToRGB(hexColor) {
10209
+ const r = parseInt(hexColor.slice(1, 3), 16);
10210
+ const g = parseInt(hexColor.slice(3, 5), 16);
10211
+ const b = parseInt(hexColor.slice(5, 7), 16);
10212
+ return [r, g, b];
10213
+ }
10214
+
10215
+ // src/fetch-map/fetch-map.ts
10216
+ init_cjs_shims();
10217
+
9523
10218
  // src/fetch-map/parse-map.ts
10219
+ init_cjs_shims();
10220
+ function getLayerDescriptor({
10221
+ mapConfig,
10222
+ layer,
10223
+ dataset
10224
+ }) {
10225
+ const { filters, visState } = mapConfig;
10226
+ const { layerBlending, interactionConfig } = visState;
10227
+ const { id, type, config: config2, visualChannels } = layer;
10228
+ const { data, id: datasetId } = dataset;
10229
+ const { propMap, defaultProps: defaultProps2 } = getLayerProps(type, config2, dataset);
10230
+ const styleProps = createStyleProps(config2, propMap);
10231
+ const { channelProps, scales } = createChannelProps(
10232
+ id,
10233
+ type,
10234
+ config2,
10235
+ visualChannels,
10236
+ data,
10237
+ dataset
10238
+ );
10239
+ const layerDescriptor = {
10240
+ type,
10241
+ filters: isEmptyObject(filters) || isRemoteCalculationSupported(dataset) ? void 0 : filters[datasetId],
10242
+ props: {
10243
+ id,
10244
+ data,
10245
+ ...defaultProps2,
10246
+ ...createInteractionProps(interactionConfig),
10247
+ ...styleProps,
10248
+ ...channelProps,
10249
+ ...createParametersProp(layerBlending, styleProps.parameters || {}),
10250
+ // Must come after style
10251
+ ...createLoadOptions(data.accessToken)
10252
+ },
10253
+ scales
10254
+ };
10255
+ return layerDescriptor;
10256
+ }
9524
10257
  function parseMap(json) {
9525
10258
  const { keplerMapConfig, datasets, token } = json;
9526
10259
  assert2(keplerMapConfig.version === "v1", "Only support Kepler v1");
9527
- const config2 = keplerMapConfig.config;
9528
- const { filters, mapState, mapStyle, popupSettings, legendSettings } = config2;
9529
- const { layers, layerBlending, interactionConfig } = config2.visState;
10260
+ const mapConfig = keplerMapConfig.config;
10261
+ const { mapState, mapStyle, popupSettings, legendSettings, visState } = mapConfig;
10262
+ const { layers } = visState;
10263
+ const layersReverse = [...layers].reverse();
9530
10264
  return {
9531
10265
  id: json.id,
9532
10266
  title: json.title,
@@ -9539,45 +10273,19 @@ function parseMap(json) {
9539
10273
  popupSettings,
9540
10274
  legendSettings,
9541
10275
  token,
9542
- layers: layers.reverse().map(({ id, type, config: config3, visualChannels }) => {
10276
+ layers: layersReverse.map((layer) => {
9543
10277
  try {
9544
- const { dataId } = config3;
10278
+ const { dataId } = layer.config;
9545
10279
  const dataset = datasets.find(
9546
10280
  (d) => d.id === dataId
9547
10281
  );
9548
10282
  assert2(dataset, `No dataset matching dataId: ${dataId}`);
9549
- const { data } = dataset;
9550
- assert2(data, `No data loaded for dataId: ${dataId}`);
9551
- const { propMap, defaultProps: defaultProps2 } = getLayerProps(type, config3, dataset);
9552
- const styleProps = createStyleProps(config3, propMap);
9553
- const { channelProps, scales } = createChannelProps(
9554
- id,
9555
- type,
9556
- config3,
9557
- visualChannels,
9558
- data,
10283
+ const layerDescriptor = getLayerDescriptor({
10284
+ mapConfig,
10285
+ layer,
9559
10286
  dataset
9560
- );
9561
- const layer = {
9562
- type,
9563
- filters: isEmptyObject(filters) || isRemoteCalculationSupported(dataset) ? void 0 : filters[dataId],
9564
- props: {
9565
- id,
9566
- data,
9567
- ...defaultProps2,
9568
- ...createInteractionProps(interactionConfig),
9569
- ...styleProps,
9570
- ...channelProps,
9571
- ...createParametersProp(
9572
- layerBlending,
9573
- styleProps.parameters || {}
9574
- ),
9575
- // Must come after style
9576
- ...createLoadOptions(token)
9577
- },
9578
- scales
9579
- };
9580
- return layer;
10287
+ });
10288
+ return layerDescriptor;
9581
10289
  } catch (e) {
9582
10290
  console.error(e.message);
9583
10291
  return void 0;
@@ -9658,9 +10366,41 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9658
10366
  strokeColorScale,
9659
10367
  weightField
9660
10368
  } = visualChannels;
10369
+ if (layerType === "raster") {
10370
+ const rasterStyleType = config2.visConfig.rasterStyleType;
10371
+ if (rasterStyleType === "Rgb") {
10372
+ return {
10373
+ channelProps: getRasterTileLayerStylePropsRgb({
10374
+ layerConfig: config2,
10375
+ rasterMetadata: data.raster_metadata,
10376
+ visualChannels
10377
+ }),
10378
+ scales: {}
10379
+ };
10380
+ } else {
10381
+ return {
10382
+ channelProps: getRasterTileLayerStylePropsScaledBand({
10383
+ layerConfig: config2,
10384
+ visualChannels,
10385
+ rasterMetadata: data.raster_metadata
10386
+ }),
10387
+ scales: {
10388
+ ...colorField && {
10389
+ fillColor: {
10390
+ field: colorField,
10391
+ type: "ordinal",
10392
+ domain: [],
10393
+ range: []
10394
+ }
10395
+ }
10396
+ }
10397
+ };
10398
+ }
10399
+ }
9661
10400
  const { heightField, heightScale } = visualChannels;
9662
10401
  const { textLabel, visConfig } = config2;
9663
10402
  const result = {};
10403
+ const updateTriggers = {};
9664
10404
  const scales = {};
9665
10405
  if (colorField) {
9666
10406
  const { colorAggregation: aggregation, colorRange: range } = visConfig;
@@ -9672,7 +10412,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9672
10412
  data
9673
10413
  );
9674
10414
  result.getFillColor = accessor;
9675
- scales.fillColor = {
10415
+ scales.fillColor = updateTriggers.getFillColor = {
9676
10416
  field: colorField,
9677
10417
  type: colorScale,
9678
10418
  ...domainAndRangeFromScale(scale2)
@@ -9691,6 +10431,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9691
10431
  result.getWeight = (d) => {
9692
10432
  return d.properties[aggregationExpAlias];
9693
10433
  };
10434
+ updateTriggers.getWeight = aggregationExpAlias;
9694
10435
  result.getPointRadius = (d, info) => {
9695
10436
  return calculateClusterRadius(
9696
10437
  d.properties,
@@ -9699,11 +10440,16 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9699
10440
  aggregationExpAlias
9700
10441
  );
9701
10442
  };
10443
+ updateTriggers.getPointRadius = {
10444
+ aggregationExpAlias,
10445
+ radiusRange: visConfig.radiusRange
10446
+ };
9702
10447
  result.textCharacterSet = "auto";
9703
10448
  result.textFontFamily = "Inter, sans";
9704
10449
  result.textFontSettings = { sdf: true };
9705
10450
  result.textFontWeight = 600;
9706
10451
  result.getText = (d) => TEXT_NUMBER_FORMATTER.format(d.properties[aggregationExpAlias]);
10452
+ updateTriggers.getText = aggregationExpAlias;
9707
10453
  result.getTextColor = config2.textLabel[TEXT_LABEL_INDEX].color;
9708
10454
  result.textOutlineColor = [
9709
10455
  ...config2.textLabel[TEXT_LABEL_INDEX].outlineColor,
@@ -9720,6 +10466,10 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9720
10466
  );
9721
10467
  return calculateClusterTextFontSize(radius);
9722
10468
  };
10469
+ updateTriggers.getTextSize = {
10470
+ aggregationExpAlias,
10471
+ radiusRange: visConfig.radiusRange
10472
+ };
9723
10473
  }
9724
10474
  if (radiusField) {
9725
10475
  const { accessor, scale: scale2 } = getSizeAccessor(
@@ -9730,7 +10480,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9730
10480
  data
9731
10481
  );
9732
10482
  result.getPointRadius = accessor;
9733
- scales.pointRadius = {
10483
+ scales.pointRadius = updateTriggers.getPointRadius = {
9734
10484
  field: radiusField,
9735
10485
  type: radiusScale || "identity",
9736
10486
  ...domainAndRangeFromScale(scale2)
@@ -9747,7 +10497,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9747
10497
  data
9748
10498
  );
9749
10499
  result.getLineColor = accessor;
9750
- scales.lineColor = {
10500
+ scales.lineColor = updateTriggers.getLineColor = {
9751
10501
  field: strokeColorField,
9752
10502
  type: strokeColorScale,
9753
10503
  ...domainAndRangeFromScale(scale2)
@@ -9762,7 +10512,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9762
10512
  data
9763
10513
  );
9764
10514
  result.getElevation = accessor;
9765
- scales.elevation = {
10515
+ scales.elevation = updateTriggers.getElevation = {
9766
10516
  field: heightField,
9767
10517
  type: heightScale || "identity",
9768
10518
  ...domainAndRangeFromScale(scale2)
@@ -9777,7 +10527,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9777
10527
  data
9778
10528
  );
9779
10529
  result.getWeight = accessor;
9780
- scales.weight = {
10530
+ scales.weight = updateTriggers.getWeight = {
9781
10531
  field: weightField,
9782
10532
  type: "identity",
9783
10533
  ...domainAndRangeFromScale(scale2)
@@ -9798,6 +10548,12 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9798
10548
  { fallbackUrl: customMarkersUrl, maxIconSize, useMaskedIcons },
9799
10549
  data
9800
10550
  );
10551
+ updateTriggers.getIcon = {
10552
+ customMarkersUrl,
10553
+ customMarkersRange,
10554
+ maxIconSize,
10555
+ useMaskedIcons
10556
+ };
9801
10557
  result._subLayerProps = {
9802
10558
  "points-icon": {
9803
10559
  loadOptions: {
@@ -9814,9 +10570,11 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9814
10570
  };
9815
10571
  if (getFillColor && useMaskedIcons) {
9816
10572
  result.getIconColor = getFillColor;
10573
+ updateTriggers.getIconColor = updateTriggers.getFillColor;
9817
10574
  }
9818
10575
  if (getPointRadius) {
9819
10576
  result.getIconSize = getPointRadius;
10577
+ updateTriggers.getIconSize = updateTriggers.getPointRadius;
9820
10578
  }
9821
10579
  if (visualChannels.rotationField) {
9822
10580
  const { accessor } = getSizeAccessor(
@@ -9827,6 +10585,7 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9827
10585
  data
9828
10586
  );
9829
10587
  result.getIconAngle = negateAccessor(accessor);
10588
+ updateTriggers.getIconAngle = updateTriggers.getRotationField;
9830
10589
  }
9831
10590
  } else if (layerType === "tileset") {
9832
10591
  result.pointType = "circle";
@@ -9871,7 +10630,13 @@ function createChannelProps(id, layerType, config2, visualChannels, data, datase
9871
10630
  }
9872
10631
  };
9873
10632
  }
9874
- return { channelProps: result, scales };
10633
+ return {
10634
+ channelProps: {
10635
+ ...result,
10636
+ updateTriggers
10637
+ },
10638
+ scales
10639
+ };
9875
10640
  }
9876
10641
  function createLoadOptions(accessToken) {
9877
10642
  return {
@@ -10527,9 +11292,14 @@ function hashBuckets(initialCount) {
10527
11292
  WidgetSource,
10528
11293
  WidgetTableSource,
10529
11294
  WidgetTilesetSource,
11295
+ _ErrorCode,
10530
11296
  _buildFeatureFilter,
11297
+ _createVecExprEvaluator,
10531
11298
  _domainFromValues,
11299
+ _evaluateVecExpr,
10532
11300
  _getHexagonResolution,
11301
+ _getRasterTileLayerStyleProps,
11302
+ _validateVecExprSyntax,
10533
11303
  addFilter,
10534
11304
  aggregate,
10535
11305
  aggregationFunctions,
@@ -10542,9 +11312,11 @@ function hashBuckets(initialCount) {
10542
11312
  buildStatsUrl,
10543
11313
  calculateClusterRadius,
10544
11314
  calculateClusterTextFontSize,
11315
+ calculateLayerScale,
10545
11316
  clearDefaultRequestCache,
10546
11317
  clearFilters,
10547
11318
  configureSource,
11319
+ createColorScale,
10548
11320
  createPolygonSpatialFilter,
10549
11321
  createViewportSpatialFilter,
10550
11322
  fetchBasemapProps,
@@ -10559,6 +11331,7 @@ function hashBuckets(initialCount) {
10559
11331
  getDefaultAggregationExpColumnAliasForLayerType,
10560
11332
  getFilter,
10561
11333
  getIconUrlAccessor,
11334
+ getLayerDescriptor,
10562
11335
  getLayerProps,
10563
11336
  getMaxMarkerSize,
10564
11337
  getSizeAccessor,