azure-maps-control 2.2.2 → 2.3.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.
@@ -77,7 +77,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
77
77
  }
78
78
 
79
79
  var azuremapsMaplibreGlUnminified = createCommonjsModule(function (module, exports) {
80
- /* The Azure Maps fork of MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v1.14.0-rc4/LICENSE.txt */
80
+ /* The Azure Maps fork of MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v1.16.0/LICENSE.txt */
81
81
  (function (global, factory) {
82
82
  module.exports = factory() ;
83
83
  }(commonjsGlobal, (function () {
@@ -109,7 +109,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
109
109
  return module = { exports: {} }, fn(module, module.exports), module.exports;
110
110
  }
111
111
 
112
- var version = "1.14.0-rc4";
112
+ var version = "1.16.0";
113
113
 
114
114
  var unitbezier = UnitBezier;
115
115
  function UnitBezier(p1x, p1y, p2x, p2y) {
@@ -2455,8 +2455,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
2455
2455
  "property-type": "data-driven"
2456
2456
  },
2457
2457
  "icon-padding": {
2458
- type: "number",
2459
- "default": 2,
2458
+ type: "padding",
2459
+ "default": [
2460
+ 2
2461
+ ],
2460
2462
  minimum: 0,
2461
2463
  units: "pixels",
2462
2464
  requires: [
@@ -2465,10 +2467,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
2465
2467
  expression: {
2466
2468
  interpolated: true,
2467
2469
  parameters: [
2468
- "zoom"
2470
+ "zoom",
2471
+ "feature"
2469
2472
  ]
2470
2473
  },
2471
- "property-type": "data-constant"
2474
+ "property-type": "data-driven"
2472
2475
  },
2473
2476
  "icon-keep-upright": {
2474
2477
  type: "boolean",
@@ -4674,6 +4677,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4674
4677
  var ErrorType = { kind: 'error' };
4675
4678
  var CollatorType = { kind: 'collator' };
4676
4679
  var FormattedType = { kind: 'formatted' };
4680
+ var PaddingType = { kind: 'padding' };
4677
4681
  var ResolvedImageType = { kind: 'resolvedImage' };
4678
4682
  function array(itemType, N) {
4679
4683
  return {
@@ -4699,6 +4703,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
4699
4703
  FormattedType,
4700
4704
  ObjectType,
4701
4705
  array(ValueType),
4706
+ PaddingType,
4702
4707
  ResolvedImageType
4703
4708
  ];
4704
4709
  function checkSubtype(expected, t) {
@@ -5897,6 +5902,65 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
5897
5902
  return serialized;
5898
5903
  };
5899
5904
 
5905
+ var Padding = function Padding(values) {
5906
+ this.values = values.slice();
5907
+ };
5908
+ Padding.parse = function parse(input) {
5909
+ if (input instanceof Padding) {
5910
+ return input;
5911
+ }
5912
+ if (typeof input === 'number') {
5913
+ return new Padding([
5914
+ input,
5915
+ input,
5916
+ input,
5917
+ input
5918
+ ]);
5919
+ }
5920
+ if (!Array.isArray(input)) {
5921
+ return undefined;
5922
+ }
5923
+ if (input.length < 1 || input.length > 4) {
5924
+ return undefined;
5925
+ }
5926
+ for (var i = 0, list = input; i < list.length; i += 1) {
5927
+ var val = list[i];
5928
+ if (typeof val !== 'number') {
5929
+ return undefined;
5930
+ }
5931
+ }
5932
+ switch (input.length) {
5933
+ case 1:
5934
+ input = [
5935
+ input[0],
5936
+ input[0],
5937
+ input[0],
5938
+ input[0]
5939
+ ];
5940
+ break;
5941
+ case 2:
5942
+ input = [
5943
+ input[0],
5944
+ input[1],
5945
+ input[0],
5946
+ input[1]
5947
+ ];
5948
+ break;
5949
+ case 3:
5950
+ input = [
5951
+ input[0],
5952
+ input[1],
5953
+ input[2],
5954
+ input[1]
5955
+ ];
5956
+ break;
5957
+ }
5958
+ return new Padding(input);
5959
+ };
5960
+ Padding.prototype.toString = function toString() {
5961
+ return JSON.stringify(this.values);
5962
+ };
5963
+
5900
5964
  var ResolvedImage = function ResolvedImage(options) {
5901
5965
  this.name = options.name;
5902
5966
  this.available = options.available;
@@ -5959,6 +6023,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
5959
6023
  return true;
5960
6024
  } else if (mixed instanceof Formatted) {
5961
6025
  return true;
6026
+ } else if (mixed instanceof Padding) {
6027
+ return true;
5962
6028
  } else if (mixed instanceof ResolvedImage) {
5963
6029
  return true;
5964
6030
  } else if (Array.isArray(mixed)) {
@@ -5995,6 +6061,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
5995
6061
  return CollatorType;
5996
6062
  } else if (value instanceof Formatted) {
5997
6063
  return FormattedType;
6064
+ } else if (value instanceof Padding) {
6065
+ return PaddingType;
5998
6066
  } else if (value instanceof ResolvedImage) {
5999
6067
  return ResolvedImageType;
6000
6068
  } else if (Array.isArray(value)) {
@@ -6023,7 +6091,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
6023
6091
  return '';
6024
6092
  } else if (type === 'string' || type === 'number' || type === 'boolean') {
6025
6093
  return String(value);
6026
- } else if (value instanceof Color || value instanceof Formatted || value instanceof ResolvedImage) {
6094
+ } else if (value instanceof Color || value instanceof Formatted || value instanceof Padding || value instanceof ResolvedImage) {
6027
6095
  return value.toString();
6028
6096
  } else {
6029
6097
  return JSON.stringify(value);
@@ -6373,11 +6441,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
6373
6441
  }
6374
6442
  }
6375
6443
  throw new RuntimeError(error || 'Could not parse color from value \'' + (typeof input === 'string' ? input : String(JSON.stringify(input))) + '\'');
6376
- } else if (this.type.kind === 'number') {
6377
- var value = null;
6444
+ } else if (this.type.kind === 'padding') {
6445
+ var input$1;
6378
6446
  for (var i$1 = 0, list$1 = this.args; i$1 < list$1.length; i$1 += 1) {
6379
6447
  var arg$1 = list$1[i$1];
6380
- value = arg$1.evaluate(ctx);
6448
+ input$1 = arg$1.evaluate(ctx);
6449
+ var pad = Padding.parse(input$1);
6450
+ if (pad) {
6451
+ return pad;
6452
+ }
6453
+ }
6454
+ throw new RuntimeError('Could not parse padding from value \'' + (typeof input$1 === 'string' ? input$1 : JSON.stringify(input$1)) + '\'');
6455
+ } else if (this.type.kind === 'number') {
6456
+ var value = null;
6457
+ for (var i$2 = 0, list$2 = this.args; i$2 < list$2.length; i$2 += 1) {
6458
+ var arg$2 = list$2[i$2];
6459
+ value = arg$2.evaluate(ctx);
6381
6460
  if (value === null) {
6382
6461
  return 0;
6383
6462
  }
@@ -7129,6 +7208,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
7129
7208
  parsed = annotate(parsed, expected, options.typeAnnotation || 'assert');
7130
7209
  } else if ((expected.kind === 'color' || expected.kind === 'formatted' || expected.kind === 'resolvedImage') && (actual.kind === 'value' || actual.kind === 'string')) {
7131
7210
  parsed = annotate(parsed, expected, options.typeAnnotation || 'coerce');
7211
+ } else if (expected.kind === 'padding' && (actual.kind === 'value' || actual.kind === 'number' || actual.kind === 'array')) {
7212
+ parsed = annotate(parsed, expected, options.typeAnnotation || 'coerce');
7132
7213
  } else if (this.checkSubtype(expected, actual)) {
7133
7214
  return null;
7134
7215
  }
@@ -7335,12 +7416,23 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
7335
7416
  return number(d, to[i], t);
7336
7417
  });
7337
7418
  }
7419
+ function padding(from, to, t) {
7420
+ var fromVal = from.values;
7421
+ var toVal = to.values;
7422
+ return new Padding([
7423
+ number(fromVal[0], toVal[0], t),
7424
+ number(fromVal[1], toVal[1], t),
7425
+ number(fromVal[2], toVal[2], t),
7426
+ number(fromVal[3], toVal[3], t)
7427
+ ]);
7428
+ }
7338
7429
 
7339
7430
  var interpolate = /*#__PURE__*/Object.freeze({
7340
7431
  __proto__: null,
7341
7432
  number: number,
7342
7433
  color: color,
7343
- array: array$1
7434
+ array: array$1,
7435
+ padding: padding
7344
7436
  });
7345
7437
 
7346
7438
  var Xn = 0.95047, Yn = 1, Zn = 1.08883, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1, deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI;
@@ -7531,7 +7623,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
7531
7623
  parsed
7532
7624
  ]);
7533
7625
  }
7534
- if (outputType.kind !== 'number' && outputType.kind !== 'color' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {
7626
+ if (outputType.kind !== 'number' && outputType.kind !== 'color' && outputType.kind !== 'padding' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {
7535
7627
  return context.error('Type ' + toString(outputType) + ' is not interpolatable.');
7536
7628
  }
7537
7629
  return new Interpolate(outputType, operator, interpolation, input, stops);
@@ -9281,20 +9373,21 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
9281
9373
  var featureDependent = zoomAndFeatureDependent || parameters.property !== undefined;
9282
9374
  var zoomDependent = zoomAndFeatureDependent || !featureDependent;
9283
9375
  var type = parameters.type || (supportsInterpolation(propertySpec) ? 'exponential' : 'interval');
9284
- if (isColor) {
9376
+ if (isColor || propertySpec.type === 'padding') {
9377
+ var parseFn = isColor ? Color.parse : Padding.parse;
9285
9378
  parameters = extend$1({}, parameters);
9286
9379
  if (parameters.stops) {
9287
9380
  parameters.stops = parameters.stops.map(function (stop) {
9288
9381
  return [
9289
9382
  stop[0],
9290
- Color.parse(stop[1])
9383
+ parseFn(stop[1])
9291
9384
  ];
9292
9385
  });
9293
9386
  }
9294
9387
  if (parameters.default) {
9295
- parameters.default = Color.parse(parameters.default);
9388
+ parameters.default = parseFn(parameters.default);
9296
9389
  } else {
9297
- parameters.default = Color.parse(propertySpec.default);
9390
+ parameters.default = parseFn(propertySpec.default);
9298
9391
  }
9299
9392
  }
9300
9393
  if (parameters.colorSpace && parameters.colorSpace !== 'rgb' && !colorSpaces[parameters.colorSpace]) {
@@ -9475,14 +9568,23 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
9475
9568
  return interp(outputLower, outputUpper, t);
9476
9569
  }
9477
9570
  function evaluateIdentityFunction(parameters, propertySpec, input) {
9478
- if (propertySpec.type === 'color') {
9571
+ switch (propertySpec.type) {
9572
+ case 'color':
9479
9573
  input = Color.parse(input);
9480
- } else if (propertySpec.type === 'formatted') {
9574
+ break;
9575
+ case 'formatted':
9481
9576
  input = Formatted.fromString(input.toString());
9482
- } else if (propertySpec.type === 'resolvedImage') {
9577
+ break;
9578
+ case 'resolvedImage':
9483
9579
  input = ResolvedImage.fromString(input.toString());
9484
- } else if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
9485
- input = undefined;
9580
+ break;
9581
+ case 'padding':
9582
+ input = Padding.parse(input);
9583
+ break;
9584
+ default:
9585
+ if (getType(input) !== propertySpec.type && (propertySpec.type !== 'enum' || !propertySpec.values[input])) {
9586
+ input = undefined;
9587
+ }
9486
9588
  }
9487
9589
  return coalesce(input, parameters.default, propertySpec.default);
9488
9590
  }
@@ -9639,8 +9741,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
9639
9741
  return expression.value;
9640
9742
  } else {
9641
9743
  var constant = value;
9642
- if (typeof value === 'string' && specification.type === 'color') {
9744
+ if (specification.type === 'color' && typeof value === 'string') {
9643
9745
  constant = Color.parse(value);
9746
+ } else if (specification.type === 'padding' && (typeof value === 'number' || Array.isArray(value))) {
9747
+ constant = Padding.parse(value);
9644
9748
  }
9645
9749
  return {
9646
9750
  kind: 'constant',
@@ -9688,6 +9792,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
9688
9792
  enum: StringType,
9689
9793
  boolean: BooleanType,
9690
9794
  formatted: FormattedType,
9795
+ padding: PaddingType,
9691
9796
  resolvedImage: ResolvedImageType
9692
9797
  };
9693
9798
  if (spec.type === 'array') {
@@ -9700,6 +9805,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
9700
9805
  return new Color(0, 0, 0, 0);
9701
9806
  } else if (spec.type === 'color') {
9702
9807
  return Color.parse(spec.default) || null;
9808
+ } else if (spec.type === 'padding') {
9809
+ return Padding.parse(spec.default) || null;
9703
9810
  } else if (spec.default === undefined) {
9704
9811
  return null;
9705
9812
  } else {
@@ -10698,6 +10805,33 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10698
10805
  return validateExpression(options);
10699
10806
  }
10700
10807
 
10808
+ function validatePadding(options) {
10809
+ var key = options.key;
10810
+ var value = options.value;
10811
+ var type = getType(value);
10812
+ if (type === 'array') {
10813
+ if (value.length < 1 || value.length > 4) {
10814
+ return [new ValidationError(key, value, 'padding requires 1 to 4 values; ' + value.length + ' values found')];
10815
+ }
10816
+ var arrayElementSpec = { type: 'number' };
10817
+ var errors = [];
10818
+ for (var i = 0; i < value.length; i++) {
10819
+ errors = errors.concat(validate({
10820
+ key: key + '[' + i + ']',
10821
+ value: value[i],
10822
+ valueSpec: arrayElementSpec
10823
+ }));
10824
+ }
10825
+ return errors;
10826
+ } else {
10827
+ return validateNumber({
10828
+ key: key,
10829
+ value: value,
10830
+ valueSpec: {}
10831
+ });
10832
+ }
10833
+ }
10834
+
10701
10835
  var VALIDATORS = {
10702
10836
  '*': function _() {
10703
10837
  return [];
@@ -10716,7 +10850,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
10716
10850
  'light': validateLight,
10717
10851
  'string': validateString,
10718
10852
  'formatted': validateFormatted,
10719
- 'resolvedImage': validateImage
10853
+ 'resolvedImage': validateImage,
10854
+ 'padding': validatePadding
10720
10855
  };
10721
10856
  function validate(options) {
10722
10857
  var value = options.value;
@@ -15088,7 +15223,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15088
15223
  out[7] = a13 * c - a03 * s;
15089
15224
  return out;
15090
15225
  }
15091
- function perspective(out, fovy, aspect, near, far) {
15226
+ function perspectiveNO(out, fovy, aspect, near, far) {
15092
15227
  var f = 1 / Math.tan(fovy / 2), nf;
15093
15228
  out[0] = f / aspect;
15094
15229
  out[1] = 0;
@@ -15114,7 +15249,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15114
15249
  }
15115
15250
  return out;
15116
15251
  }
15117
- function ortho(out, left, right, bottom, top, near, far) {
15252
+ var perspective = perspectiveNO;
15253
+ function orthoNO(out, left, right, bottom, top, near, far) {
15118
15254
  var lr = 1 / (left - right);
15119
15255
  var bt = 1 / (bottom - top);
15120
15256
  var nf = 1 / (near - far);
@@ -15136,6 +15272,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15136
15272
  out[15] = 1;
15137
15273
  return out;
15138
15274
  }
15275
+ var ortho = orthoNO;
15139
15276
  var mul = multiply;
15140
15277
 
15141
15278
  function create$3() {
@@ -15659,9 +15796,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15659
15796
  }
15660
15797
  }
15661
15798
  invSize = Math.max(maxX - minX, maxY - minY);
15662
- invSize = invSize !== 0 ? 1 / invSize : 0;
15799
+ invSize = invSize !== 0 ? 32767 / invSize : 0;
15663
15800
  }
15664
- earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
15801
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
15665
15802
  return triangles;
15666
15803
  }
15667
15804
  function linkedList(data, start, end, dim, clockwise) {
@@ -15716,9 +15853,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15716
15853
  prev = ear.prev;
15717
15854
  next = ear.next;
15718
15855
  if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
15719
- triangles.push(prev.i / dim);
15720
- triangles.push(ear.i / dim);
15721
- triangles.push(next.i / dim);
15856
+ triangles.push(prev.i / dim | 0);
15857
+ triangles.push(ear.i / dim | 0);
15858
+ triangles.push(next.i / dim | 0);
15722
15859
  removeNode(ear);
15723
15860
  ear = next.next;
15724
15861
  stop = next.next;
@@ -15743,9 +15880,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15743
15880
  if (area(a, b, c) >= 0) {
15744
15881
  return false;
15745
15882
  }
15746
- var p = ear.next.next;
15747
- while (p !== ear.prev) {
15748
- if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) {
15883
+ var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
15884
+ var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
15885
+ var p = c.next;
15886
+ while (p !== a) {
15887
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) {
15749
15888
  return false;
15750
15889
  }
15751
15890
  p = p.next;
@@ -15757,27 +15896,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15757
15896
  if (area(a, b, c) >= 0) {
15758
15897
  return false;
15759
15898
  }
15760
- var minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x, minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y;
15761
- var minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
15899
+ var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;
15900
+ var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx, y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy, x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx, y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
15901
+ var minZ = zOrder(x0, y0, minX, minY, invSize), maxZ = zOrder(x1, y1, minX, minY, invSize);
15762
15902
  var p = ear.prevZ, n = ear.nextZ;
15763
15903
  while (p && p.z >= minZ && n && n.z <= maxZ) {
15764
- if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) {
15904
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) {
15765
15905
  return false;
15766
15906
  }
15767
15907
  p = p.prevZ;
15768
- if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) {
15908
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) {
15769
15909
  return false;
15770
15910
  }
15771
15911
  n = n.nextZ;
15772
15912
  }
15773
15913
  while (p && p.z >= minZ) {
15774
- if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) {
15914
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) {
15775
15915
  return false;
15776
15916
  }
15777
15917
  p = p.prevZ;
15778
15918
  }
15779
15919
  while (n && n.z <= maxZ) {
15780
- if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) {
15920
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) {
15781
15921
  return false;
15782
15922
  }
15783
15923
  n = n.nextZ;
@@ -15789,9 +15929,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15789
15929
  do {
15790
15930
  var a = p.prev, b = p.next.next;
15791
15931
  if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
15792
- triangles.push(a.i / dim);
15793
- triangles.push(p.i / dim);
15794
- triangles.push(b.i / dim);
15932
+ triangles.push(a.i / dim | 0);
15933
+ triangles.push(p.i / dim | 0);
15934
+ triangles.push(b.i / dim | 0);
15795
15935
  removeNode(p);
15796
15936
  removeNode(p.next);
15797
15937
  p = start = b;
@@ -15809,8 +15949,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15809
15949
  var c = splitPolygon(a, b);
15810
15950
  a = filterPoints(a, a.next);
15811
15951
  c = filterPoints(c, c.next);
15812
- earcutLinked(a, triangles, dim, minX, minY, invSize);
15813
- earcutLinked(c, triangles, dim, minX, minY, invSize);
15952
+ earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
15953
+ earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
15814
15954
  return;
15815
15955
  }
15816
15956
  b = b.next;
@@ -15832,7 +15972,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15832
15972
  queue.sort(compareX);
15833
15973
  for (i = 0; i < queue.length; i++) {
15834
15974
  outerNode = eliminateHole(queue[i], outerNode);
15835
- outerNode = filterPoints(outerNode, outerNode.next);
15836
15975
  }
15837
15976
  return outerNode;
15838
15977
  }
@@ -15845,9 +15984,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15845
15984
  return outerNode;
15846
15985
  }
15847
15986
  var bridgeReverse = splitPolygon(bridge, hole);
15848
- var filteredBridge = filterPoints(bridge, bridge.next);
15849
15987
  filterPoints(bridgeReverse, bridgeReverse.next);
15850
- return outerNode === bridge ? filteredBridge : outerNode;
15988
+ return filterPoints(bridge, bridge.next);
15851
15989
  }
15852
15990
  function findHoleBridge(hole, outerNode) {
15853
15991
  var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;
@@ -15856,15 +15994,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15856
15994
  var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
15857
15995
  if (x <= hx && x > qx) {
15858
15996
  qx = x;
15997
+ m = p.x < p.next.x ? p : p.next;
15859
15998
  if (x === hx) {
15860
- if (hy === p.y) {
15861
- return p;
15862
- }
15863
- if (hy === p.next.y) {
15864
- return p.next;
15865
- }
15999
+ return m;
15866
16000
  }
15867
- m = p.x < p.next.x ? p : p.next;
15868
16001
  }
15869
16002
  }
15870
16003
  p = p.next;
@@ -15872,9 +16005,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15872
16005
  if (!m) {
15873
16006
  return null;
15874
16007
  }
15875
- if (hx === qx) {
15876
- return m;
15877
- }
15878
16008
  var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan;
15879
16009
  p = m;
15880
16010
  do {
@@ -15895,7 +16025,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15895
16025
  function indexCurve(start, minX, minY, invSize) {
15896
16026
  var p = start;
15897
16027
  do {
15898
- if (p.z === null) {
16028
+ if (p.z === 0) {
15899
16029
  p.z = zOrder(p.x, p.y, minX, minY, invSize);
15900
16030
  }
15901
16031
  p.prevZ = p.prev;
@@ -15951,8 +16081,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15951
16081
  return list;
15952
16082
  }
15953
16083
  function zOrder(x, y, minX, minY, invSize) {
15954
- x = 32767 * (x - minX) * invSize;
15955
- y = 32767 * (y - minY) * invSize;
16084
+ x = (x - minX) * invSize | 0;
16085
+ y = (y - minY) * invSize | 0;
15956
16086
  x = (x | x << 8) & 16711935;
15957
16087
  x = (x | x << 4) & 252645135;
15958
16088
  x = (x | x << 2) & 858993459;
@@ -15974,7 +16104,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15974
16104
  return leftmost;
15975
16105
  }
15976
16106
  function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
15977
- return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
16107
+ return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
15978
16108
  }
15979
16109
  function isValidDiagonal(a, b) {
15980
16110
  return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0);
@@ -16077,7 +16207,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
16077
16207
  this.y = y;
16078
16208
  this.prev = null;
16079
16209
  this.next = null;
16080
- this.z = null;
16210
+ this.z = 0;
16081
16211
  this.prevZ = null;
16082
16212
  this.nextZ = null;
16083
16213
  this.steiner = false;
@@ -19078,12 +19208,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19078
19208
  var stretchX = ref.stretchX;
19079
19209
  var stretchY = ref.stretchY;
19080
19210
  var content = ref.content;
19211
+ var contentMatch = ref.contentMatch;
19081
19212
  this.paddedRect = paddedRect;
19082
19213
  this.pixelRatio = pixelRatio;
19083
19214
  this.stretchX = stretchX;
19084
19215
  this.stretchY = stretchY;
19085
19216
  this.content = content;
19086
19217
  this.version = version;
19218
+ this.contentMatch = contentMatch;
19087
19219
  };
19088
19220
  var prototypeAccessors = {
19089
19221
  tl: { configurable: true },
@@ -19759,6 +19891,36 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19759
19891
  right: x2
19760
19892
  };
19761
19893
  }
19894
+ function applyContentMatch(shapedIcon) {
19895
+ var iconLeft = shapedIcon.left;
19896
+ var iconTop = shapedIcon.top;
19897
+ var iconWidth = shapedIcon.right - iconLeft;
19898
+ var iconHeight = shapedIcon.bottom - iconTop;
19899
+ var contentWidth = shapedIcon.image.content[2] - shapedIcon.image.content[0];
19900
+ var contentHeight = shapedIcon.image.content[3] - shapedIcon.image.content[1];
19901
+ if (contentHeight !== 0 && iconWidth !== 0 && iconHeight !== 0) {
19902
+ var contentAspectRatio = contentWidth / contentHeight;
19903
+ if (shapedIcon.image.contentMatch === 'height') {
19904
+ if (iconWidth / iconHeight < contentAspectRatio) {
19905
+ var newIconWidth = iconHeight * contentAspectRatio;
19906
+ iconLeft *= newIconWidth / iconWidth;
19907
+ iconWidth = newIconWidth;
19908
+ }
19909
+ } else if (shapedIcon.image.contentMatch === 'width') {
19910
+ if (contentAspectRatio !== 0 && iconWidth / iconHeight > contentAspectRatio) {
19911
+ var newIconHeight = iconWidth / contentAspectRatio;
19912
+ iconTop *= newIconHeight / newIconHeight;
19913
+ iconHeight = newIconHeight;
19914
+ }
19915
+ }
19916
+ }
19917
+ return {
19918
+ x1: iconLeft,
19919
+ y1: iconTop,
19920
+ x2: iconLeft + iconWidth,
19921
+ y2: iconTop + iconHeight
19922
+ };
19923
+ }
19762
19924
  function fitIconToText(shapedIcon, shapedText, textFit, padding, iconOffset, fontScale) {
19763
19925
  var image = shapedIcon.image;
19764
19926
  var collisionPadding;
@@ -20079,8 +20241,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20079
20241
  var pixelRatio = image.pixelRatio;
20080
20242
  var imageWidth = image.paddedRect.w - 2 * border$1;
20081
20243
  var imageHeight = image.paddedRect.h - 2 * border$1;
20082
- var iconWidth = shapedIcon.right - shapedIcon.left;
20083
- var iconHeight = shapedIcon.bottom - shapedIcon.top;
20244
+ var icon = {
20245
+ x1: shapedIcon.left,
20246
+ y1: shapedIcon.top,
20247
+ x2: shapedIcon.right,
20248
+ y2: shapedIcon.bottom
20249
+ };
20084
20250
  var stretchX = image.stretchX || [[
20085
20251
  0,
20086
20252
  imageWidth
@@ -20106,23 +20272,32 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20106
20272
  var fixedContentHeight = fixedHeight;
20107
20273
  if (image.content && hasIconTextFit) {
20108
20274
  var content = image.content;
20275
+ var contentWidth = content[2] - content[0];
20276
+ var contentHeight = content[3] - content[1];
20277
+ if (image.contentMatch && image.content) {
20278
+ icon = applyContentMatch(shapedIcon);
20279
+ }
20109
20280
  stretchOffsetX = sumWithinRange(stretchX, 0, content[0]);
20110
20281
  stretchOffsetY = sumWithinRange(stretchY, 0, content[1]);
20111
20282
  stretchContentWidth = sumWithinRange(stretchX, content[0], content[2]);
20112
20283
  stretchContentHeight = sumWithinRange(stretchY, content[1], content[3]);
20113
20284
  fixedOffsetX = content[0] - stretchOffsetX;
20114
20285
  fixedOffsetY = content[1] - stretchOffsetY;
20115
- fixedContentWidth = content[2] - content[0] - stretchContentWidth;
20116
- fixedContentHeight = content[3] - content[1] - stretchContentHeight;
20286
+ fixedContentWidth = contentWidth - stretchContentWidth;
20287
+ fixedContentHeight = contentHeight - stretchContentHeight;
20117
20288
  }
20289
+ var iconLeft = icon.x1;
20290
+ var iconTop = icon.y1;
20291
+ var iconWidth = icon.x2 - iconLeft;
20292
+ var iconHeight = icon.y2 - iconTop;
20118
20293
  var makeBox = function (left, top, right, bottom) {
20119
- var leftEm = getEmOffset(left.stretch - stretchOffsetX, stretchContentWidth, iconWidth, shapedIcon.left);
20294
+ var leftEm = getEmOffset(left.stretch - stretchOffsetX, stretchContentWidth, iconWidth, iconLeft);
20120
20295
  var leftPx = getPxOffset(left.fixed - fixedOffsetX, fixedContentWidth, left.stretch, stretchWidth);
20121
- var topEm = getEmOffset(top.stretch - stretchOffsetY, stretchContentHeight, iconHeight, shapedIcon.top);
20296
+ var topEm = getEmOffset(top.stretch - stretchOffsetY, stretchContentHeight, iconHeight, iconTop);
20122
20297
  var topPx = getPxOffset(top.fixed - fixedOffsetY, fixedContentHeight, top.stretch, stretchHeight);
20123
- var rightEm = getEmOffset(right.stretch - stretchOffsetX, stretchContentWidth, iconWidth, shapedIcon.left);
20298
+ var rightEm = getEmOffset(right.stretch - stretchOffsetX, stretchContentWidth, iconWidth, iconLeft);
20124
20299
  var rightPx = getPxOffset(right.fixed - fixedOffsetX, fixedContentWidth, right.stretch, stretchWidth);
20125
- var bottomEm = getEmOffset(bottom.stretch - stretchOffsetY, stretchContentHeight, iconHeight, shapedIcon.top);
20300
+ var bottomEm = getEmOffset(bottom.stretch - stretchOffsetY, stretchContentHeight, iconHeight, iconTop);
20126
20301
  var bottomPx = getPxOffset(bottom.fixed - fixedOffsetY, fixedContentHeight, bottom.stretch, stretchHeight);
20127
20302
  var tl = new pointGeometry(leftEm, topEm);
20128
20303
  var tr = new pointGeometry(rightEm, topEm);
@@ -20368,33 +20543,39 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20368
20543
  this.circleDiameter = height;
20369
20544
  }
20370
20545
  } else {
20371
- var y1 = shaped.top * boxScale - padding;
20372
- var y2 = shaped.bottom * boxScale + padding;
20373
- var x1 = shaped.left * boxScale - padding;
20374
- var x2 = shaped.right * boxScale + padding;
20546
+ var icon = shaped.image && shaped.image.contentMatch && shaped.image.content ? applyContentMatch(shaped) : {
20547
+ x1: shaped.left,
20548
+ y1: shaped.top,
20549
+ x2: shaped.right,
20550
+ y2: shaped.bottom
20551
+ };
20552
+ icon.y1 = icon.y1 * boxScale - padding[0];
20553
+ icon.x2 = icon.x2 * boxScale + padding[1];
20554
+ icon.y2 = icon.y2 * boxScale + padding[2];
20555
+ icon.x1 = icon.x1 * boxScale - padding[3];
20375
20556
  var collisionPadding$1 = shaped.collisionPadding;
20376
20557
  if (collisionPadding$1) {
20377
- x1 -= collisionPadding$1[0] * boxScale;
20378
- y1 -= collisionPadding$1[1] * boxScale;
20379
- x2 += collisionPadding$1[2] * boxScale;
20380
- y2 += collisionPadding$1[3] * boxScale;
20558
+ icon.x1 -= collisionPadding$1[0] * boxScale;
20559
+ icon.y1 -= collisionPadding$1[1] * boxScale;
20560
+ icon.x2 += collisionPadding$1[2] * boxScale;
20561
+ icon.y2 += collisionPadding$1[3] * boxScale;
20381
20562
  }
20382
20563
  if (rotate) {
20383
- var tl = new pointGeometry(x1, y1);
20384
- var tr = new pointGeometry(x2, y1);
20385
- var bl = new pointGeometry(x1, y2);
20386
- var br = new pointGeometry(x2, y2);
20564
+ var tl = new pointGeometry(icon.x1, icon.y1);
20565
+ var tr = new pointGeometry(icon.x2, icon.y1);
20566
+ var bl = new pointGeometry(icon.x1, icon.y2);
20567
+ var br = new pointGeometry(icon.x2, icon.y2);
20387
20568
  var rotateRadians = rotate * Math.PI / 180;
20388
20569
  tl._rotate(rotateRadians);
20389
20570
  tr._rotate(rotateRadians);
20390
20571
  bl._rotate(rotateRadians);
20391
20572
  br._rotate(rotateRadians);
20392
- x1 = Math.min(tl.x, tr.x, bl.x, br.x);
20393
- x2 = Math.max(tl.x, tr.x, bl.x, br.x);
20394
- y1 = Math.min(tl.y, tr.y, bl.y, br.y);
20395
- y2 = Math.max(tl.y, tr.y, bl.y, br.y);
20573
+ icon.x1 = Math.min(tl.x, tr.x, bl.x, br.x);
20574
+ icon.x2 = Math.max(tl.x, tr.x, bl.x, br.x);
20575
+ icon.y1 = Math.min(tl.y, tr.y, bl.y, br.y);
20576
+ icon.y2 = Math.max(tl.y, tr.y, bl.y, br.y);
20396
20577
  }
20397
- collisionBoxArray.emplaceBack(anchor.x, anchor.y, x1, y1, x2, y2, featureIndex, sourceLayerIndex, bucketIndex);
20578
+ collisionBoxArray.emplaceBack(anchor.x, anchor.y, icon.x1, icon.y1, icon.x2, icon.y2, featureIndex, sourceLayerIndex, bucketIndex);
20398
20579
  }
20399
20580
  this.boxEndIndex = collisionBoxArray.length;
20400
20581
  };
@@ -20822,7 +21003,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20822
21003
  var layout = bucket.layers[0].layout;
20823
21004
  var iconOffset = layout.get('icon-offset').evaluate(feature, {}, canonical);
20824
21005
  var defaultHorizontalShaping = getDefaultHorizontalShaping(shapedTextOrientations.horizontal);
20825
- var glyphSize = 24, fontScale = layoutTextSize / glyphSize, textBoxScale = bucket.tilePixelRatio * fontScale, textMaxBoxScale = bucket.tilePixelRatio * textMaxSize / glyphSize, iconBoxScale = bucket.tilePixelRatio * layoutIconSize, symbolMinDistance = bucket.tilePixelRatio * layout.get('symbol-spacing'), textPadding = layout.get('text-padding') * bucket.tilePixelRatio, iconPadding = layout.get('icon-padding') * bucket.tilePixelRatio, textMaxAngle = layout.get('text-max-angle') / 180 * Math.PI, textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point', iconAlongLine = layout.get('icon-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point', symbolPlacement = layout.get('symbol-placement'), textRepeatDistance = symbolMinDistance / 2;
21006
+ var glyphSize = 24, fontScale = layoutTextSize / glyphSize, textBoxScale = bucket.tilePixelRatio * fontScale, textMaxBoxScale = bucket.tilePixelRatio * textMaxSize / glyphSize, iconBoxScale = bucket.tilePixelRatio * layoutIconSize, symbolMinDistance = bucket.tilePixelRatio * layout.get('symbol-spacing'), textPadding = layout.get('text-padding') * bucket.tilePixelRatio, iconPadding = getIconPadding(layout, feature, canonical, bucket.tilePixelRatio), textMaxAngle = layout.get('text-max-angle') / 180 * Math.PI, textAlongLine = layout.get('text-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point', iconAlongLine = layout.get('icon-rotation-alignment') === 'map' && layout.get('symbol-placement') !== 'point', symbolPlacement = layout.get('symbol-placement'), textRepeatDistance = symbolMinDistance / 2;
20826
21007
  var iconTextFit = layout.get('icon-text-fit');
20827
21008
  var verticallyShapedIcon;
20828
21009
  if (shapedIcon && iconTextFit !== 'none') {
@@ -20837,7 +21018,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20837
21018
  if (anchor.x < 0 || anchor.x >= EXTENT$1 || anchor.y < 0 || anchor.y >= EXTENT$1) {
20838
21019
  return;
20839
21020
  }
20840
- addSymbol(bucket, anchor, line, shapedTextOrientations, shapedIcon, imageMap, verticallyShapedIcon, bucket.layers[0], bucket.collisionBoxArray, feature.index, feature.sourceLayerIndex, bucket.index, textBoxScale, textPadding, textAlongLine, textOffset, iconBoxScale, iconPadding, iconAlongLine, iconOffset, feature, sizes, isSDFIcon, canonical, layoutTextSize);
21021
+ addSymbol(bucket, anchor, line, shapedTextOrientations, shapedIcon, imageMap, verticallyShapedIcon, bucket.layers[0], bucket.collisionBoxArray, feature.index, feature.sourceLayerIndex, bucket.index, textBoxScale, [
21022
+ textPadding,
21023
+ textPadding,
21024
+ textPadding,
21025
+ textPadding
21026
+ ], textAlongLine, textOffset, iconBoxScale, iconPadding, iconAlongLine, iconOffset, feature, sizes, isSDFIcon, canonical, layoutTextSize);
20841
21027
  };
20842
21028
  if (symbolPlacement === 'line') {
20843
21029
  for (var i$1 = 0, list$1 = clipLine(feature.geometry, 0, 0, EXTENT$1, EXTENT$1); i$1 < list$1.length; i$1 += 1) {
@@ -21638,7 +21824,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21638
21824
  'icon-text-fit-padding': new DataConstantProperty(spec['layout_symbol']['icon-text-fit-padding']),
21639
21825
  'icon-image': new DataDrivenProperty(spec['layout_symbol']['icon-image']),
21640
21826
  'icon-rotate': new DataDrivenProperty(spec['layout_symbol']['icon-rotate']),
21641
- 'icon-padding': new DataConstantProperty(spec['layout_symbol']['icon-padding']),
21827
+ 'icon-padding': new DataDrivenProperty(spec['layout_symbol']['icon-padding']),
21642
21828
  'icon-keep-upright': new DataConstantProperty(spec['layout_symbol']['icon-keep-upright']),
21643
21829
  'icon-offset': new DataDrivenProperty(spec['layout_symbol']['icon-offset']),
21644
21830
  'icon-anchor': new DataDrivenProperty(spec['layout_symbol']['icon-anchor']),
@@ -21851,6 +22037,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21851
22037
  };
21852
22038
  return SymbolStyleLayer;
21853
22039
  }(StyleLayer);
22040
+ function getIconPadding(layout, feature, canonical, pixelRatio) {
22041
+ if (pixelRatio === void 0)
22042
+ pixelRatio = 1;
22043
+ var result = layout.get('icon-padding').evaluate(feature, {}, canonical);
22044
+ var values = result && result.values;
22045
+ return [
22046
+ values[0] * pixelRatio,
22047
+ values[1] * pixelRatio,
22048
+ values[2] * pixelRatio,
22049
+ values[3] * pixelRatio
22050
+ ];
22051
+ }
21854
22052
 
21855
22053
  var paint$8 = new Properties({
21856
22054
  'background-color': new DataConstantProperty(spec['paint_background']['background-color']),
@@ -23970,6 +24168,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
23970
24168
  }
23971
24169
  workerTile.vectorTile = response.vectorTile;
23972
24170
  workerTile.parse(response.vectorTile, this$1.layerIndex, this$1.availableImages, this$1.actor, function (err, result) {
24171
+ var reloadCallback = workerTile.reloadCallback;
24172
+ if (workerTile.reloadCallback) {
24173
+ delete workerTile.reloadCallback;
24174
+ workerTile.parse(workerTile.vectorTile, this$1.layerIndex, this$1.availableImages, this$1.actor, reloadCallback);
24175
+ }
23973
24176
  if (err || !result) {
23974
24177
  return callback(err);
23975
24178
  }
@@ -24758,7 +24961,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
24758
24961
  }
24759
24962
  };
24760
24963
  Supercluster.prototype._limitZoom = function _limitZoom(z) {
24761
- return Math.max(this.options.minZoom, Math.min(+z, this.options.maxZoom + 1));
24964
+ return Math.max(this.options.minZoom, Math.min(Math.floor(+z), this.options.maxZoom + 1));
24762
24965
  };
24763
24966
  Supercluster.prototype._cluster = function _cluster(points, zoom) {
24764
24967
  var clusters = [];
@@ -24785,7 +24988,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
24785
24988
  numPoints += b.numPoints || 1;
24786
24989
  }
24787
24990
  }
24788
- if (numPoints >= minPoints) {
24991
+ if (numPoints > numPointsOrigin && numPoints >= minPoints) {
24789
24992
  var wx = p.x * numPointsOrigin;
24790
24993
  var wy = p.y * numPointsOrigin;
24791
24994
  var clusterProperties = reduce && numPointsOrigin > 1 ? this._map(p, true) : null;
@@ -26321,6 +26524,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
26321
26524
  var stretchX = ref.stretchX;
26322
26525
  var stretchY = ref.stretchY;
26323
26526
  var content = ref.content;
26527
+ var contentMatch = ref.contentMatch;
26324
26528
  var data = new performance.RGBAImage({
26325
26529
  width: width,
26326
26530
  height: height
@@ -26341,7 +26545,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
26341
26545
  sdf: sdf,
26342
26546
  stretchX: stretchX,
26343
26547
  stretchY: stretchY,
26344
- content: content
26548
+ content: content,
26549
+ contentMatch: contentMatch
26345
26550
  };
26346
26551
  }
26347
26552
  callback(null, result);
@@ -26529,6 +26734,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
26529
26734
  stretchX: image.stretchX,
26530
26735
  stretchY: image.stretchY,
26531
26736
  content: image.content,
26737
+ contentMatch: image.contentMatch,
26532
26738
  hasRenderCallback: Boolean(image.userImage && image.userImage.render)
26533
26739
  };
26534
26740
  } else {
@@ -32918,7 +33124,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
32918
33124
  Style.__proto__ = Evented;
32919
33125
  Style.prototype = Object.create(Evented && Evented.prototype);
32920
33126
  Style.prototype.constructor = Style;
32921
- Style.prototype.loadURL = function loadURL(url, options) {
33127
+ Style.prototype.loadURL = function loadURL(url, options, previousStyle) {
32922
33128
  var this$1 = this;
32923
33129
  if (options === void 0)
32924
33130
  options = {};
@@ -32931,11 +33137,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
32931
33137
  if (error) {
32932
33138
  this$1.fire(new performance.ErrorEvent(error));
32933
33139
  } else if (json) {
32934
- this$1._load(json, options);
33140
+ this$1._load(json, options, previousStyle);
32935
33141
  }
32936
33142
  });
32937
33143
  };
32938
- Style.prototype.loadJSON = function loadJSON(json, options) {
33144
+ Style.prototype.loadJSON = function loadJSON(json, options, previousStyle) {
32939
33145
  var this$1 = this;
32940
33146
  if (options === void 0)
32941
33147
  options = {};
@@ -32943,34 +33149,29 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
32943
33149
  this._request = performance.browser.frame(function () {
32944
33150
  this$1._request = null;
32945
33151
  options.validate = options.validate !== false;
32946
- this$1._load(json, options);
33152
+ this$1._load(json, options, previousStyle);
32947
33153
  });
32948
33154
  };
32949
33155
  Style.prototype.loadEmpty = function loadEmpty() {
32950
33156
  this.fire(new performance.Event('dataloading', { dataType: 'style' }));
32951
33157
  this._load(empty, { validate: false });
32952
33158
  };
32953
- Style.prototype._load = function _load(json, options) {
32954
- var this$1 = this;
32955
- if (options.validate && emitValidationErrors(this, performance.validateStyle(json))) {
33159
+ Style.prototype._load = function _load(json, options, previousStyle) {
33160
+ var nextState = options.transformStyle ? options.transformStyle(previousStyle, json) : json;
33161
+ if (options.validate && emitValidationErrors(this, performance.validateStyle(nextState))) {
32956
33162
  return;
32957
33163
  }
32958
- var patchOperations = [];
32959
- if (options.stylePatch) {
32960
- patchOperations = this._buildStylePatch(json, options);
32961
- this.sourceCaches = {};
32962
- }
32963
33164
  this._loaded = true;
32964
- this.stylesheet = json;
32965
- for (var id in json.sources) {
32966
- this.addSource(id, json.sources[id], { validate: false });
33165
+ this.stylesheet = nextState;
33166
+ for (var id in nextState.sources) {
33167
+ this.addSource(id, nextState.sources[id], { validate: false });
32967
33168
  }
32968
- if (json.sprite) {
32969
- this._loadSprite(json.sprite);
33169
+ if (nextState.sprite) {
33170
+ this._loadSprite(nextState.sprite);
32970
33171
  } else {
32971
33172
  this.imageManager.setLoaded(true);
32972
33173
  }
32973
- this.glyphManager.setURL(json.glyphs);
33174
+ this.glyphManager.setURL(nextState.glyphs);
32974
33175
  var layers = derefLayers(this.stylesheet.layers);
32975
33176
  this._order = layers.map(function (layer) {
32976
33177
  return layer.id;
@@ -32986,11 +33187,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
32986
33187
  }
32987
33188
  this.dispatcher.broadcast('setLayers', this._serializeLayers(this._order));
32988
33189
  this.light = new Light(this.stylesheet.light);
32989
- patchOperations.filter(function (op) {
32990
- return op.command !== operations.moveLayer;
32991
- }).forEach(function (op) {
32992
- this$1[op.command].apply(this$1, op.args);
32993
- });
32994
33190
  this.fire(new performance.Event('data', { dataType: 'style' }));
32995
33191
  this.fire(new performance.Event('style.load'));
32996
33192
  };
@@ -33165,33 +33361,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
33165
33361
  if (emitValidationErrors(this, performance.validateStyle(nextState))) {
33166
33362
  return false;
33167
33363
  }
33168
- nextState = performance.clone$1(nextState);
33364
+ nextState = options.transformStyle ? options.transformStyle(this.serialize(), nextState) : nextState;
33169
33365
  nextState.layers = derefLayers(nextState.layers);
33170
- var patchOperations = [];
33171
- var preservedLayers = {};
33172
- var preservedSources = {};
33173
- if (options.stylePatch) {
33174
- patchOperations = this._buildStylePatch(nextState, options);
33175
- }
33176
- patchOperations = patchOperations.filter(function (op) {
33177
- if (op.command === operations.addLayer && this$1._serializedLayers.hasOwnProperty(op.args[0].id)) {
33178
- preservedLayers[op.args[0].id] = true;
33179
- return false;
33180
- }
33181
- if (op.command === operations.moveLayer && this$1._serializedLayers.hasOwnProperty(op.args[0])) {
33182
- preservedLayers[op.args[0]] = true;
33183
- return true;
33184
- }
33185
- if (op.command === operations.addSource && this$1.sourceCaches.hasOwnProperty(op.args[0])) {
33186
- preservedSources[op.args[0]] = true;
33187
- return false;
33188
- }
33189
- return true;
33190
- });
33191
33366
  var changes = diffStyles(this.serialize(), nextState).filter(function (op) {
33192
33367
  return !(op.command in ignoredDiffOperations);
33193
33368
  });
33194
- changes = changes.concat(patchOperations);
33195
33369
  if (changes.length === 0) {
33196
33370
  return false;
33197
33371
  }
@@ -33207,12 +33381,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
33207
33381
  if (op.command === 'setTransition') {
33208
33382
  return;
33209
33383
  }
33210
- if (op.command === operations.removeLayer && preservedLayers.hasOwnProperty(op.args[0])) {
33211
- return;
33212
- }
33213
- if ((op.command === operations.addSource || op.command === operations.removeSource) && preservedSources.hasOwnProperty(op.args[0])) {
33214
- return;
33215
- }
33216
33384
  this$1[op.command].apply(this$1, op.args);
33217
33385
  });
33218
33386
  this.stylesheet = nextState;
@@ -33603,109 +33771,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
33603
33771
  return empty;
33604
33772
  }
33605
33773
  };
33606
- Style.prototype._buildStylePatch = function _buildStylePatch(next, options) {
33607
- var this$1 = this;
33608
- var patchOperations = [];
33609
- var preservedSources = [];
33610
- var preservedLayers = [];
33611
- var nextLayerIndex = next.layers.reduce(function (p, c) {
33612
- p[c.id] = c;
33613
- return p;
33614
- }, {});
33615
- var preserveLayer = function (layerId, before) {
33616
- if (this$1.hasLayer(layerId)) {
33617
- var preservedLayer = this$1._serializedLayers[layerId];
33618
- if (!next.sources.hasOwnProperty(preservedLayer.source) && !preservedSources.includes(preservedLayer.source)) {
33619
- patchOperations.push({
33620
- command: 'addSource',
33621
- args: [
33622
- preservedLayer.source,
33623
- this$1.sourceCaches[preservedLayer.source].serialize(),
33624
- { validate: false }
33625
- ]
33626
- });
33627
- preservedSources.push(preservedLayer.source);
33628
- }
33629
- if (nextLayerIndex.hasOwnProperty(layerId)) {
33630
- patchOperations.push({
33631
- command: 'removeLayer',
33632
- args: [layerId]
33633
- });
33634
- }
33635
- before = nextLayerIndex.hasOwnProperty(before) || preservedLayers.find(function (l) {
33636
- return l.id === before;
33637
- }) ? before : undefined;
33638
- patchOperations.push({
33639
- command: 'moveLayer',
33640
- args: [
33641
- preservedLayer.id,
33642
- before,
33643
- { validate: true }
33644
- ]
33645
- });
33646
- patchOperations.push({
33647
- command: 'addLayer',
33648
- args: [
33649
- preservedLayer,
33650
- before,
33651
- { validate: true }
33652
- ]
33653
- });
33654
- preservedLayers.push(layerId);
33655
- } else {
33656
- performance.warnOnce('Cannot preserve layer ' + layerId + ' that is not in the previous style.');
33657
- }
33658
- };
33659
- var updatePaintProperty = function (layerId, name, value) {
33660
- if (nextLayerIndex.hasOwnProperty(layerId) || preservedLayers.includes(layerId)) {
33661
- patchOperations.push({
33662
- command: 'setPaintProperty',
33663
- args: [
33664
- layerId,
33665
- name,
33666
- value,
33667
- { validate: true }
33668
- ]
33669
- });
33670
- } else {
33671
- performance.warnOnce('Cannot update paint property on layer ' + layerId + ' that is not in the next style.');
33672
- }
33673
- };
33674
- var updateLayoutProperty = function (layerId, name, value) {
33675
- if (nextLayerIndex.hasOwnProperty(layerId) || preservedLayers.includes(layerId)) {
33676
- patchOperations.push({
33677
- command: 'setLayoutProperty',
33678
- args: [
33679
- layerId,
33680
- name,
33681
- value,
33682
- { validate: true }
33683
- ]
33684
- });
33685
- } else {
33686
- performance.warnOnce('Cannot update layout property on layer ' + layerId + ' that is not in the next style.');
33687
- }
33688
- };
33689
- var updateFilter = function (layerId, name, value) {
33690
- if (nextLayerIndex.hasOwnProperty(layerId) || preservedLayers.includes(layerId)) {
33691
- patchOperations.push({
33692
- command: 'setFilter',
33693
- args: [
33694
- layerId,
33695
- name,
33696
- value,
33697
- { validate: true }
33698
- ]
33699
- });
33700
- } else {
33701
- performance.warnOnce('Cannot update filter on layer ' + layerId + ' that is not in the next style.');
33702
- }
33703
- };
33704
- if (options.stylePatch) {
33705
- options.stylePatch(this.serialize(), next, preserveLayer.bind(this), updatePaintProperty.bind(this), updateLayoutProperty.bind(this), updateFilter.bind(this));
33706
- }
33707
- return patchOperations;
33708
- };
33709
33774
  Style.prototype._updateLayer = function _updateLayer(layer) {
33710
33775
  this._updatedLayers[layer.id] = true;
33711
33776
  if (layer.source && !this._updatedSources[layer.source] && this.sourceCaches[layer.source].getSource().type !== 'raster') {
@@ -40988,33 +41053,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
40988
41053
  return str;
40989
41054
  };
40990
41055
  Map.prototype._updateStyle = function _updateStyle(style, options) {
41056
+ var this$1 = this;
40991
41057
  if (options === void 0)
40992
41058
  options = {};
40993
- if (!options.stylePatch) {
40994
- if (this.style) {
40995
- this.style.setEventedParent(null);
40996
- this.style._remove();
40997
- }
40998
- if (!style) {
40999
- delete this.style;
41000
- return this;
41001
- } else {
41002
- this.style = new Style(this, options);
41003
- }
41004
- this.style.setEventedParent(this, { style: this.style });
41005
- } else {
41006
- if (!style) {
41007
- style = emptyStyle();
41008
- }
41059
+ if (options.transformStyle && this.style && !this.style._loaded) {
41060
+ this.style.once('style.load', function () {
41061
+ return this$1._updateStyle(style, options);
41062
+ });
41063
+ return;
41009
41064
  }
41010
- if (!this.style) {
41065
+ var previousStyle = this.style && options.transformStyle ? this.style.serialize() : undefined;
41066
+ if (this.style) {
41067
+ this.style.setEventedParent(null);
41068
+ this.style._remove();
41069
+ }
41070
+ if (!style) {
41071
+ delete this.style;
41072
+ return this;
41073
+ } else {
41011
41074
  this.style = new Style(this, options);
41012
- this.style.setEventedParent(this, { style: this.style });
41013
41075
  }
41076
+ this.style.setEventedParent(this, { style: this.style });
41014
41077
  if (typeof style === 'string') {
41015
- this.style.loadURL(style, options);
41078
+ this.style.loadURL(style, options, previousStyle);
41016
41079
  } else {
41017
- this.style.loadJSON(style, options);
41080
+ this.style.loadJSON(style, options, previousStyle);
41018
41081
  }
41019
41082
  return this;
41020
41083
  };
@@ -41116,6 +41179,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
41116
41179
  var stretchX = ref.stretchX;
41117
41180
  var stretchY = ref.stretchY;
41118
41181
  var content = ref.content;
41182
+ var contentMatch = ref.contentMatch;
41119
41183
  this._lazyInitEmptyStyle();
41120
41184
  var version = 0;
41121
41185
  if (image instanceof HTMLImageElement || ImageBitmap && image instanceof ImageBitmap) {
@@ -41132,6 +41196,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
41132
41196
  stretchX: stretchX,
41133
41197
  stretchY: stretchY,
41134
41198
  content: content,
41199
+ contentMatch: contentMatch,
41135
41200
  sdf: sdf,
41136
41201
  version: version
41137
41202
  });
@@ -41151,6 +41216,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
41151
41216
  stretchX: stretchX,
41152
41217
  stretchY: stretchY,
41153
41218
  content: content,
41219
+ contentMatch: contentMatch,
41154
41220
  sdf: sdf,
41155
41221
  version: version,
41156
41222
  userImage: userImage
@@ -43410,7 +43476,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43410
43476
  return Url;
43411
43477
  }());
43412
43478
 
43413
- var version = "2.2.2";
43479
+ var version = "2.3.0";
43414
43480
 
43415
43481
  /**
43416
43482
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -43451,27 +43517,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43451
43517
  var tooltipContent = document.createElement("span");
43452
43518
  tooltipContent.innerText = name;
43453
43519
  tooltipContent.classList.add('tooltiptext');
43454
- // mimics default edge tooltip theming
43455
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
43456
- tooltipContent.classList.add('dark');
43457
- }
43458
- var themeQuery = window.matchMedia('(prefers-color-scheme: dark)');
43459
- var onThemeChange = function (e) {
43460
- var isDark = e.matches;
43461
- if (isDark && !tooltipContent.classList.contains('dark')) {
43462
- tooltipContent.classList.add('dark');
43463
- }
43464
- else if (!isDark && tooltipContent.classList.contains('dark')) {
43465
- tooltipContent.classList.remove('dark');
43466
- }
43467
- };
43468
- // compensate for browsers where MediaQueryList is not derived from EventTarget (pre iOS13 Safari)
43469
- if (typeof themeQuery.addEventListener === 'function') {
43470
- themeQuery.addEventListener('change', function (e) { return onThemeChange(e); });
43471
- }
43472
- else if (typeof themeQuery.addListener === 'function') {
43473
- themeQuery.addListener(function (e) { return onThemeChange(e); });
43474
- }
43475
43520
  if (navigator.userAgent.indexOf('Edg') != -1) {
43476
43521
  tooltipContent.classList.add('edge');
43477
43522
  }
@@ -43811,7 +43856,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43811
43856
  * Build the outermost container for the control, applies styling including any listeners for auto styling.
43812
43857
  */
43813
43858
  ControlBase.prototype.buildContainer = function (map, style, ariaLabel, tagName) {
43814
- var _this = this;
43815
43859
  this._map = map;
43816
43860
  this._container = document.createElement(tagName || "div");
43817
43861
  this._container.classList.add("azure-maps-control-container");
@@ -43820,11 +43864,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43820
43864
  }
43821
43865
  // Set the style or add the auto listener.
43822
43866
  if (style.toLowerCase() === exports.ControlStyle.auto) {
43823
- this._map.styles.definitions().then(function (definitions) {
43824
- if (_this._map) {
43825
- _this._map.events.add("stylechanged", _this._onStyleChange);
43826
- }
43827
- });
43867
+ if (this._map) {
43868
+ this._map.events.add("stylechanged", this._onStyleChange);
43869
+ }
43828
43870
  }
43829
43871
  else {
43830
43872
  this._container.classList.add(style);
@@ -47584,6 +47626,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47584
47626
  _this.hasFocus = false;
47585
47627
  _this.styleButtons = new Dictionary();
47586
47628
  _this.styleIcons = new Dictionary();
47629
+ // we need to rely on this to avoid potentially redundant thumbnail requests and .blob calls
47630
+ _this.thumbnailCache = {
47631
+ assumedConfiguration: undefined,
47632
+ response: new Dictionary(),
47633
+ blob: new Dictionary()
47634
+ };
47587
47635
  /**
47588
47636
  * Callback handler for the style changing.
47589
47637
  */
@@ -47597,6 +47645,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47597
47645
  if (!_this.styleOpsGrid) {
47598
47646
  return;
47599
47647
  }
47648
+ // do not recreate the styleOpsGrid if it is initialized and configuration object reference has not changed
47649
+ if (_this.styleOpsGrid.children.length > 0 && _this.thumbnailCache.assumedConfiguration === definitions) {
47650
+ return;
47651
+ }
47652
+ _this.thumbnailCache.assumedConfiguration = definitions;
47600
47653
  Array.from(_this.styleOpsGrid.children).forEach(function (element) { return element.remove(); });
47601
47654
  _this.styleButtons.clear();
47602
47655
  _this.populateOpsGridFromDefinitions(definitions);
@@ -47641,6 +47694,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47641
47694
  }
47642
47695
  });
47643
47696
  container.addEventListener("focusout", function (event) {
47697
+ if (event.target === currStyleButton) {
47698
+ // on focusout from reveal button -> reset the tabIndex on the styleOpsGrid elements that could have been set to -1 on esc key press
47699
+ Array.from(styleOpsGrid.children).forEach(function (e) { return e.removeAttribute('tabIndex'); });
47700
+ }
47644
47701
  if (!(event.relatedTarget instanceof Node && container.contains(event.relatedTarget))) {
47645
47702
  _this.hasFocus = false;
47646
47703
  if (!_this.hasMouse) {
@@ -47655,6 +47712,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47655
47712
  if (event.keyCode === 27) {
47656
47713
  event.stopPropagation();
47657
47714
  currStyleButton.focus();
47715
+ Array.from(styleOpsGrid.children).forEach(function (e) { return e.setAttribute('tabIndex', "-1"); });
47658
47716
  if (container.classList.contains(StyleControl.Css.inUse)) {
47659
47717
  container.classList.remove(StyleControl.Css.inUse);
47660
47718
  styleOpsGrid.classList.add("hidden-accessible-element");
@@ -47697,6 +47755,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47697
47755
  _super.prototype.onRemove.call(this);
47698
47756
  this.styleOpsGrid = null;
47699
47757
  this.styleButtons.clear();
47758
+ this.thumbnailCache.response.clear();
47759
+ this.thumbnailCache.blob.clear();
47760
+ this.thumbnailCache.assumedConfiguration = undefined;
47700
47761
  this.map.events.remove("stylechanged", this.onStyleChange);
47701
47762
  this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
47702
47763
  };
@@ -47756,7 +47817,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47756
47817
  styleOptionButton.setAttribute("type", "button");
47757
47818
  var styleIconImage = new Image();
47758
47819
  fetchIconPromise
47759
- .then(function (response) { return response.blob(); })
47820
+ .then(function (response) {
47821
+ if (_this.thumbnailCache.blob.has(response.url)) {
47822
+ return _this.thumbnailCache.blob.get(response.url);
47823
+ }
47824
+ else {
47825
+ // we need the response.clone() to allow reading over body multiple times since response objects are cached
47826
+ // and can be reused across multiple invocations
47827
+ var blobPromise = response.clone().blob();
47828
+ _this.thumbnailCache.blob.set(response.url, blobPromise);
47829
+ return blobPromise;
47830
+ }
47831
+ })
47760
47832
  .then(function (blob) {
47761
47833
  var iconUrl = URL.createObjectURL(blob);
47762
47834
  styleIconImage.src = iconUrl;
@@ -47864,7 +47936,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47864
47936
  if (mapServiceOptions.transformRequest) {
47865
47937
  merge_1(requestParams, mapServiceOptions.transformRequest(requestParams.url, "Thumbnail"));
47866
47938
  }
47867
- var fetchThumbnailPromise = fetch(requestParams.url, { headers: requestParams.headers });
47939
+ var fetchThumbnailPromise;
47940
+ if (_this.thumbnailCache.response.has(requestParams.url)) {
47941
+ fetchThumbnailPromise = Promise.resolve(_this.thumbnailCache.response.get(requestParams.url));
47942
+ }
47943
+ else {
47944
+ fetchThumbnailPromise = fetch(requestParams.url, { headers: requestParams.headers });
47945
+ _this.thumbnailCache.response.set(requestParams.url, fetchThumbnailPromise);
47946
+ }
47868
47947
  // Add button for each style
47869
47948
  var styleOptionButton = _this.buildSelectStyleBtn(style.name, definitions, fetchThumbnailPromise);
47870
47949
  _this.styleOpsGrid.appendChild(styleOptionButton);
@@ -53142,7 +53221,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
53142
53221
  };
53143
53222
  ZoomControl.prototype.updateZoomButtonsState = function () {
53144
53223
  var zoomInDisabled = this.map.getCamera().zoom >= this.map._getMap().getMaxZoom();
53145
- // small values need special handling, since depending on the height of the map view
53224
+ // small values need special handling, since depending on the height of the map view
53146
53225
  // the actual zoom we can zoom out to can be above or below 0 when the entire map fits the height into the view
53147
53226
  // use web mercator bounds to check if entire latitude range is visible
53148
53227
  var reachedLatitudeBoundaries = BoundingBox.getSouth(this.map.getCamera().bounds) <= -WEBMERCATOR_MAXLAT
@@ -53154,7 +53233,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
53154
53233
  }
53155
53234
  if (this.zoomOutButton && this.zoomOutButton.disabled != zoomOutDisabled) {
53156
53235
  this.zoomOutButton.disabled = zoomOutDisabled;
53157
- this.zoomInButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
53236
+ this.zoomOutButton.setAttribute("aria-label", zoomInDisabled ? "Zoom Out disabled" : "Zoom Out");
53158
53237
  }
53159
53238
  };
53160
53239
  ZoomControl.prototype.constructZoomInButton = function (map) {
@@ -53247,6 +53326,72 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
53247
53326
 
53248
53327
  var cloneDeepWith_1 = cloneDeepWith;
53249
53328
 
53329
+ /**
53330
+ * A hidden HTML element that is used to provide accessibility to shapes such as bubble.
53331
+ */
53332
+ var AccessibleIndicator = /** @class */ (function () {
53333
+ /**
53334
+ * Constructs an AccessibleIndicator object by initializing a hidden `div` element.
53335
+ * @internal
53336
+ */
53337
+ function AccessibleIndicator(options) {
53338
+ var _this = this;
53339
+ /**
53340
+ * Attaches the indicator to the HTML document in a hidden style.
53341
+ * @param map The map.
53342
+ */
53343
+ this.attach = function (map) {
53344
+ // If attaching to a different map, remove popup on current map
53345
+ if (_this.map !== map) {
53346
+ // If map was defined the indicator was attached to another map.
53347
+ if (_this.map) {
53348
+ _this.detachFromCurrentMap();
53349
+ }
53350
+ _this.map = map;
53351
+ _this.map.indicators._getCollectionDiv().appendChild(_this.element);
53352
+ _this.map.indicators.add(_this);
53353
+ }
53354
+ };
53355
+ /**
53356
+ * Removes the indicator from the map and the HTML document.
53357
+ */
53358
+ this.remove = function () {
53359
+ _this.detachFromCurrentMap();
53360
+ _this.element.remove();
53361
+ };
53362
+ /**
53363
+ * Get the DOM element of the indicator.
53364
+ * @returns The DOM element of the indicator.
53365
+ */
53366
+ this.getElement = function () {
53367
+ return _this.element;
53368
+ };
53369
+ this.detachFromCurrentMap = function () {
53370
+ if (_this.map) {
53371
+ _this.map.indicators.remove(_this);
53372
+ delete _this.map;
53373
+ }
53374
+ };
53375
+ this.element = document.createElement("div");
53376
+ // Set tabindex to 0 to make the element focusable.
53377
+ this.element.setAttribute("tabindex", "0");
53378
+ // Set the role to option, and it's container to listbox so the reader will read the listbox as a list.
53379
+ // For example, NVDA will read "data point, {posinset} of {setsize}" when the indicator is focused.
53380
+ this.element.setAttribute("role", "option");
53381
+ if (options === null || options === void 0 ? void 0 : options.setSize)
53382
+ this.element.setAttribute("aria-setsize", options.setSize.toString());
53383
+ if (options === null || options === void 0 ? void 0 : options.positionInSet)
53384
+ this.element.setAttribute("aria-posinset", options.positionInSet.toString());
53385
+ this.element.setAttribute("aria-label", "data point");
53386
+ this.element.classList.add(AccessibleIndicator.Css.hidden);
53387
+ }
53388
+ // CSS class names.
53389
+ AccessibleIndicator.Css = {
53390
+ hidden: "hidden-accessible-element"
53391
+ };
53392
+ return AccessibleIndicator;
53393
+ }());
53394
+
53250
53395
  var __extends$k = (window && window.__extends) || (function () {
53251
53396
  var extendStatics = function (d, b) {
53252
53397
  extendStatics = Object.setPrototypeOf ||
@@ -53360,19 +53505,24 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
53360
53505
  * Get reference to Mapbox Map
53361
53506
  * @internal
53362
53507
  */
53363
- Source.prototype._setMap = function (map) {
53508
+ Source.prototype._setMap = function (map, shouldInvokeEvent) {
53509
+ if (shouldInvokeEvent === void 0) { shouldInvokeEvent = true; }
53364
53510
  if (map == null || map === undefined) {
53365
53511
  var temp = this.map;
53366
53512
  delete this.map;
53367
- this._invokeEvent("sourceremoved", this);
53368
- if (temp) {
53369
- temp.events.invoke("sourceremoved", this);
53513
+ if (shouldInvokeEvent) {
53514
+ this._invokeEvent("sourceremoved", this);
53515
+ if (temp) {
53516
+ temp.events.invoke("sourceremoved", this);
53517
+ }
53370
53518
  }
53371
53519
  }
53372
53520
  else {
53373
53521
  this.map = map;
53374
- this._invokeEvent("sourceadded", this);
53375
- this.map.events.invoke("sourceadded", this);
53522
+ if (shouldInvokeEvent) {
53523
+ this._invokeEvent("sourceadded", this);
53524
+ this.map.events.invoke("sourceadded", this);
53525
+ }
53376
53526
  }
53377
53527
  };
53378
53528
  return Source;
@@ -53693,6 +53843,27 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
53693
53843
  }
53694
53844
  return geoJsonSource;
53695
53845
  };
53846
+ DataSource.prototype._isDeepEqual = function (other) {
53847
+ if (this.constructor !== other.constructor) {
53848
+ return false;
53849
+ }
53850
+ var source = this._buildSource();
53851
+ var otherSource = other._buildSource();
53852
+ return source.type === otherSource.type &&
53853
+ // no data comparison since it is costly and not needed. If geojson data is different, but other source properties are same, we treat it as an update.
53854
+ //source.data === otherSource.data &&
53855
+ source.maxzoom === otherSource.maxzoom &&
53856
+ source.cluster === otherSource.cluster &&
53857
+ source.clusterRadius === otherSource.clusterRadius &&
53858
+ source.tolerance === otherSource.tolerance &&
53859
+ source.lineMetrics === otherSource.lineMetrics &&
53860
+ JSON.stringify(source.clusterProperties) === JSON.stringify(otherSource.clusterProperties) &&
53861
+ source.buffer === otherSource.buffer &&
53862
+ source.clusterMinPoints === otherSource.clusterMinPoints &&
53863
+ source.generateId === otherSource.generateId &&
53864
+ source.promoteId === otherSource.promoteId &&
53865
+ source.filter === otherSource.filter;
53866
+ };
53696
53867
  /**
53697
53868
  * @internal
53698
53869
  */
@@ -53974,6 +54145,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
53974
54145
  }
53975
54146
  return vectorSource;
53976
54147
  };
54148
+ /**
54149
+ * @internal
54150
+ */
54151
+ VectorTileSource.prototype._isDeepEqual = function (other) {
54152
+ if (this.constructor !== other.constructor) {
54153
+ return false;
54154
+ }
54155
+ var source = this._buildSource();
54156
+ var otherSource = other._buildSource();
54157
+ return source.type === otherSource.type &&
54158
+ source.url === otherSource.url &&
54159
+ ((source.tiles === undefined && otherSource.tiles === undefined) ||
54160
+ (source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; }))) &&
54161
+ source.minzoom === otherSource.minzoom &&
54162
+ source.maxzoom === otherSource.maxzoom &&
54163
+ source.bounds === otherSource.bounds &&
54164
+ source.attribution === otherSource.attribution &&
54165
+ source.promoteId === otherSource.promoteId &&
54166
+ source.scheme === otherSource.scheme;
54167
+ };
53977
54168
  return VectorTileSource;
53978
54169
  }(Source));
53979
54170
 
@@ -54105,7 +54296,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54105
54296
  // and can be used to determine which events are ours vs Mapbox's.
54106
54297
  Layer.LayerEvents = {
54107
54298
  layeradded: undefined,
54108
- layerremoved: undefined
54299
+ layerremoved: undefined,
54300
+ focusin: undefined,
54301
+ focusout: undefined,
54109
54302
  };
54110
54303
  return Layer;
54111
54304
  }(EventEmitter));
@@ -54260,6 +54453,44 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54260
54453
  * @default 8
54261
54454
  */
54262
54455
  _this.radius = 8;
54456
+ /**
54457
+ * @internal
54458
+ * Specifies whether to create focusable indicators for the bubbles.
54459
+ * The default highlighting style is provided if the source is DataSource with Shape:
54460
+ * ```ts
54461
+ * const datasource = new DataSource('bubble-source');
54462
+ * datasource.setShapes([new Shape(new Point([-122.335, 47.62]))]);
54463
+ * this.map.sources.add(datasource);
54464
+ * const layer = new BubbleLayer(datasource, 'bubble', {
54465
+ * radius: 10,
54466
+ * color: 'cyan',
54467
+ * createIndicators: true,
54468
+ * });
54469
+ * ```
54470
+ *
54471
+ * For other sources, you can provide the accessibilityIdKey option to specify the property name of the feature to use as the accessibility id.
54472
+ * ```ts
54473
+ * const vtSource = new VectorTileSource("indoorTiles", { tiles, // provide your tile urls });
54474
+ * this.map.sources.add(vtSource);
54475
+ * const layer = new BubbleLayer(vtSource, 'bubble', {
54476
+ * createIndicators: true,
54477
+ * accessibilityIdKey: '{add your ID here}'
54478
+ * });
54479
+ * ```
54480
+ *
54481
+ * If you want to customize the highlighting style, you can use the focusin/focusout events to change the style of the bubble.
54482
+ * ```ts
54483
+ * this.map.events.add('focusin', 'bubble', (e) => { handle the style highlight });
54484
+ * ```
54485
+ *
54486
+ * Note: We treat this as an internal option for now because we hadn't fully decided the default styling for the indicators.
54487
+ * Once we decide, we will make this a public option or remove it.
54488
+ */
54489
+ _this.createIndicators = false;
54490
+ /**
54491
+ * @internal
54492
+ */
54493
+ _this.accessibilityIdKey = undefined;
54263
54494
  return _this;
54264
54495
  }
54265
54496
  return BubbleLayerOptions;
@@ -54280,6 +54511,63 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54280
54511
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
54281
54512
  };
54282
54513
  })();
54514
+ var __awaiter$1 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
54515
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
54516
+ return new (P || (P = Promise))(function (resolve, reject) {
54517
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
54518
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
54519
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
54520
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
54521
+ });
54522
+ };
54523
+ var __generator$1 = (window && window.__generator) || function (thisArg, body) {
54524
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
54525
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
54526
+ function verb(n) { return function (v) { return step([n, v]); }; }
54527
+ function step(op) {
54528
+ if (f) throw new TypeError("Generator is already executing.");
54529
+ while (_) try {
54530
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
54531
+ if (y = 0, t) op = [op[0] & 2, t.value];
54532
+ switch (op[0]) {
54533
+ case 0: case 1: t = op; break;
54534
+ case 4: _.label++; return { value: op[1], done: false };
54535
+ case 5: _.label++; y = op[1]; op = [0]; continue;
54536
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
54537
+ default:
54538
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
54539
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54540
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
54541
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
54542
+ if (t[2]) _.ops.pop();
54543
+ _.trys.pop(); continue;
54544
+ }
54545
+ op = body.call(thisArg, _);
54546
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
54547
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
54548
+ }
54549
+ };
54550
+ var __read$3 = (window && window.__read) || function (o, n) {
54551
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
54552
+ if (!m) return o;
54553
+ var i = m.call(o), r, ar = [], e;
54554
+ try {
54555
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
54556
+ }
54557
+ catch (error) { e = { error: error }; }
54558
+ finally {
54559
+ try {
54560
+ if (r && !r.done && (m = i["return"])) m.call(i);
54561
+ }
54562
+ finally { if (e) throw e.error; }
54563
+ }
54564
+ return ar;
54565
+ };
54566
+ var __spreadArray = (window && window.__spreadArray) || function (to, from) {
54567
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
54568
+ to[j] = from[i];
54569
+ return to;
54570
+ };
54283
54571
  /**
54284
54572
  * Renders Point objects as scalable circles (bubbles).
54285
54573
  */
@@ -54293,6 +54581,93 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54293
54581
  */
54294
54582
  function BubbleLayer(source, id, options) {
54295
54583
  var _this = _super.call(this, id) || this;
54584
+ _this.accessibleIndicator = [];
54585
+ /** @internal */
54586
+ _this._setAccessibleIndicator = function () { return __awaiter$1(_this, void 0, void 0, function () {
54587
+ var renderedShapes, accessibilityIdKey, createIndicator, insertHiddenBefore, insertHiddenInFront, attach;
54588
+ var _this = this;
54589
+ return __generator$1(this, function (_a) {
54590
+ this.accessibleIndicator.forEach(function (indicator) { return indicator.remove(); });
54591
+ this.accessibleIndicator = [];
54592
+ renderedShapes = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this);
54593
+ accessibilityIdKey = this.options.accessibilityIdKey || (this._getDataSource() ? Shape._shapeIdPropName : undefined);
54594
+ createIndicator = function (renderedShapes, idx) {
54595
+ var curRenderedShape = renderedShapes[idx];
54596
+ var bubbleFeature = curRenderedShape instanceof Shape ? curRenderedShape.toJson() : curRenderedShape;
54597
+ var indicator = new AccessibleIndicator({ positionInSet: idx + 1, setSize: renderedShapes.length });
54598
+ var element = indicator.getElement();
54599
+ var _a = __read$3(_this.map.positionsToPixels([_this.getFirstCoordinate(bubbleFeature.geometry.coordinates)]), 1), pixel = _a[0];
54600
+ element.addEventListener('focusin', function (event) {
54601
+ _this.accessibleIndicator.filter(function (i) { return i !== indicator; }).forEach(function (indicator) { return indicator.remove(); });
54602
+ // insert previous and next popups
54603
+ if (idx - 1 >= 0) {
54604
+ insertHiddenBefore(indicator, createIndicator(renderedShapes, idx - 1));
54605
+ }
54606
+ if (idx + 1 < renderedShapes.length) {
54607
+ attach(createIndicator(renderedShapes, idx + 1));
54608
+ }
54609
+ // if we are on boundaries: add the first / last indicator
54610
+ // to maintain indicators on full page navigation cycle
54611
+ if (idx >= 2 && idx == renderedShapes.length - 1) {
54612
+ insertHiddenInFront(createIndicator(renderedShapes, 0));
54613
+ }
54614
+ if (idx == 0 && renderedShapes.length >= 2) {
54615
+ attach(createIndicator(renderedShapes, renderedShapes.length - 1));
54616
+ }
54617
+ if (accessibilityIdKey !== undefined) {
54618
+ _this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], '#000000', _this.options.strokeColor]);
54619
+ }
54620
+ var focusEvent = {
54621
+ target: element,
54622
+ type: 'focusin',
54623
+ map: _this.map,
54624
+ shape: curRenderedShape,
54625
+ originalEvent: event,
54626
+ pixel: pixel
54627
+ };
54628
+ _this._invokeEvent('focusin', focusEvent);
54629
+ });
54630
+ element.addEventListener('focusout', function (event) {
54631
+ if (accessibilityIdKey !== undefined) {
54632
+ _this.map._getMap().setPaintProperty(_this.id, 'circle-stroke-color', ['case', ['==', ['get', accessibilityIdKey], bubbleFeature.properties[accessibilityIdKey]], _this.options.strokeColor, _this.options.strokeColor]);
54633
+ }
54634
+ var focusEvent = {
54635
+ target: element,
54636
+ type: 'focusout',
54637
+ map: _this.map,
54638
+ shape: curRenderedShape,
54639
+ originalEvent: event,
54640
+ pixel: pixel
54641
+ };
54642
+ _this._invokeEvent('focusout', focusEvent);
54643
+ });
54644
+ _this.accessibleIndicator.push(indicator);
54645
+ return indicator;
54646
+ };
54647
+ insertHiddenBefore = function (base, toInsert) {
54648
+ toInsert.attach(_this.map);
54649
+ var elementToSwapIn = toInsert.getElement();
54650
+ var baseElement = base.getElement();
54651
+ baseElement.parentElement.insertBefore(elementToSwapIn, baseElement);
54652
+ };
54653
+ insertHiddenInFront = function (toInsert) {
54654
+ toInsert.attach(_this.map);
54655
+ var elementToSwapIn = toInsert.getElement();
54656
+ var parent = elementToSwapIn.parentElement;
54657
+ parent.insertBefore(elementToSwapIn, parent.firstElementChild);
54658
+ };
54659
+ attach = function (popup) {
54660
+ popup.attach(_this.map);
54661
+ };
54662
+ if (renderedShapes.length > 0) {
54663
+ attach(createIndicator(renderedShapes, 0));
54664
+ }
54665
+ if (renderedShapes.length > 1) {
54666
+ attach(createIndicator(renderedShapes, renderedShapes.length - 1));
54667
+ }
54668
+ return [2 /*return*/];
54669
+ });
54670
+ }); };
54296
54671
  _this.options = new BubbleLayerOptions().merge(cloneDeepWith_1(options, BubbleLayerOptions._cloneCustomizer));
54297
54672
  _this.options.source = source || _this.options.source;
54298
54673
  return _this;
@@ -54340,6 +54715,73 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54340
54715
  }
54341
54716
  this.options = newOptions;
54342
54717
  };
54718
+ BubbleLayer.prototype.onAdd = function (map) {
54719
+ var _this = this;
54720
+ _super.prototype.onAdd.call(this, map);
54721
+ if (this.options.createIndicators) {
54722
+ // Wait for map idle for the first time to ensure `layer.getRenderedShapes` return correct shapes.
54723
+ map.events.addOnce('idle', this._setAccessibleIndicator);
54724
+ // The rendered shapes may be changed when map is moved. Update the indicators when map is moved.
54725
+ map.events.add('moveend', this._setAccessibleIndicator);
54726
+ var dataSource = this._getDataSource();
54727
+ if (dataSource) {
54728
+ // The rendered shapes may be changed when data is added. Update the indicators when data is added.
54729
+ map.events.add('dataadded', dataSource, function () {
54730
+ // Wait for map idle to ensure `layer.getRenderedShapes` return correct shapes.
54731
+ map.events.addOnce('idle', _this._setAccessibleIndicator);
54732
+ });
54733
+ }
54734
+ else {
54735
+ var sourceId_1 = typeof this.options.source === 'string' ? this.options.source : this.options.source.getId();
54736
+ map.events.add('sourcedata', function (mapDataEvent) {
54737
+ var _a;
54738
+ // There's chances that mapDataEvent.isSourceLoaded doesn't update correctly when using flyTo, thus we check by using map.isSourceLoaded.
54739
+ if (((_a = mapDataEvent.source) === null || _a === void 0 ? void 0 : _a.getId()) === sourceId_1 && map._getMap().isSourceLoaded(sourceId_1)) {
54740
+ // Source event will be fired multiple times, and we are only interested when the source is loaded.
54741
+ // Thus design a cache key that only changed when camera & style properties are changed.
54742
+ var curCacheKey = _this._getSourceDataEventCacheKey();
54743
+ if (curCacheKey !== _this.sourceDataEventCacheKey) {
54744
+ _this._setAccessibleIndicator();
54745
+ _this.sourceDataEventCacheKey = curCacheKey;
54746
+ }
54747
+ }
54748
+ });
54749
+ }
54750
+ }
54751
+ };
54752
+ BubbleLayer.prototype.onRemove = function () {
54753
+ if (this.options.createIndicators) {
54754
+ this.map.events.remove('idle', this._setAccessibleIndicator);
54755
+ this.map.events.remove('moveend', this._setAccessibleIndicator);
54756
+ var dataSource = this._getDataSource();
54757
+ if (dataSource) {
54758
+ this.map.events.remove('dataadded', dataSource, this._setAccessibleIndicator);
54759
+ }
54760
+ else {
54761
+ this.map.events.remove('sourcedata', this._setAccessibleIndicator);
54762
+ }
54763
+ }
54764
+ _super.prototype.onRemove.call(this);
54765
+ };
54766
+ BubbleLayer.prototype._getSourceDataEventCacheKey = function () {
54767
+ if (!this.map) {
54768
+ return undefined;
54769
+ }
54770
+ var mapConfiguration = this.map.getServiceOptions().mapConfiguration;
54771
+ return __spreadArray(__spreadArray([], __read$3(this.map.getCamera().bounds)), [
54772
+ this.map.getCamera().zoom,
54773
+ this.map.getCamera().pitch,
54774
+ this.map.getStyle().style,
54775
+ mapConfiguration instanceof Object ? mapConfiguration.id : mapConfiguration
54776
+ ]).join(',');
54777
+ };
54778
+ BubbleLayer.prototype._getDataSource = function () {
54779
+ var source = typeof this.options.source === 'string' ? this.map.sources.getById(this.options.source) : this.options.source;
54780
+ if (source instanceof DataSource) {
54781
+ return source;
54782
+ }
54783
+ return undefined;
54784
+ };
54343
54785
  /**
54344
54786
  * @internal
54345
54787
  */
@@ -54391,6 +54833,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
54391
54833
  ids.add(this.options.source);
54392
54834
  return ids;
54393
54835
  };
54836
+ /**
54837
+ * The coordinates can be nested, so we need to get the first coordinate.
54838
+ * @param coordinates The property from the Geometry. Can be Position, Position[], Position[][], etc.
54839
+ * @returns
54840
+ */
54841
+ BubbleLayer.prototype.getFirstCoordinate = function (coordinates) {
54842
+ if (!Array.isArray(coordinates[0])) {
54843
+ return coordinates;
54844
+ }
54845
+ return this.getFirstCoordinate(coordinates[0]);
54846
+ };
54394
54847
  return BubbleLayer;
54395
54848
  }(Layer));
54396
54849
 
@@ -55458,7 +55911,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55458
55911
  };
55459
55912
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
55460
55913
  };
55461
- var __read$3 = (window && window.__read) || function (o, n) {
55914
+ var __read$4 = (window && window.__read) || function (o, n) {
55462
55915
  var m = typeof Symbol === "function" && o[Symbol.iterator];
55463
55916
  if (!m) return o;
55464
55917
  var i = m.call(o), r, ar = [], e;
@@ -55474,7 +55927,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55474
55927
  }
55475
55928
  return ar;
55476
55929
  };
55477
- var __spreadArray = (window && window.__spreadArray) || function (to, from) {
55930
+ var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
55478
55931
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
55479
55932
  to[j] = from[i];
55480
55933
  return to;
@@ -55549,7 +56002,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55549
56002
  finally { if (e_1) throw e_1.error; }
55550
56003
  }
55551
56004
  // Then execute the standard merge behavior.
55552
- var merged = _super.prototype.merge.apply(this, __spreadArray([], __read$3(valueList)));
56005
+ var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$4(valueList)));
55553
56006
  if (isNewColorSet) {
55554
56007
  merged.fillPattern = undefined;
55555
56008
  }
@@ -56880,7 +57333,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56880
57333
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
56881
57334
  };
56882
57335
  })();
56883
- var __read$4 = (window && window.__read) || function (o, n) {
57336
+ var __read$5 = (window && window.__read) || function (o, n) {
56884
57337
  var m = typeof Symbol === "function" && o[Symbol.iterator];
56885
57338
  if (!m) return o;
56886
57339
  var i = m.call(o), r, ar = [], e;
@@ -56992,7 +57445,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56992
57445
  */
56993
57446
  _this._onDown = function (event) {
56994
57447
  _this.map.popups._addDraggedPopup(_this);
56995
- var _a = __read$4(_this.map.positionsToPixels([_this.options.position]), 1), anchorPixel = _a[0];
57448
+ var _a = __read$5(_this.map.positionsToPixels([_this.options.position]), 1), anchorPixel = _a[0];
56996
57449
  if (event.type === "mousedown") {
56997
57450
  event = event;
56998
57451
  _this.dragOffset = [
@@ -57156,7 +57609,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57156
57609
  pixel[0] + this.dragOffset[0],
57157
57610
  pixel[1] + this.dragOffset[1]
57158
57611
  ];
57159
- var _a = __read$4(this.map.pixelsToPositions([anchorPixel]), 1), anchorPos = _a[0];
57612
+ var _a = __read$5(this.map.pixelsToPositions([anchorPixel]), 1), anchorPos = _a[0];
57160
57613
  this.options.position = anchorPos;
57161
57614
  this.marker.setLngLat(this.options.position);
57162
57615
  this._invokeEvent("drag", { type: "drag", target: this });
@@ -57310,7 +57763,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57310
57763
  posY = pt.y;
57311
57764
  }
57312
57765
  else {
57313
- var _a = __read$4(map.positionsToPixels([options.position]), 1), _b = __read$4(_a[0], 2), x = _b[0], y = _b[1];
57766
+ var _a = __read$5(map.positionsToPixels([options.position]), 1), _b = __read$5(_a[0], 2), x = _b[0], y = _b[1];
57314
57767
  posX = x;
57315
57768
  posY = y;
57316
57769
  }
@@ -57799,6 +58252,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57799
58252
  defaultRegion: {
57800
58253
  code: "NGT",
57801
58254
  strings: "en/resource.json"
58255
+ },
58256
+ latn: {
58257
+ code: "NGT-Latn",
58258
+ strings: "en/resource.json"
57802
58259
  }
57803
58260
  },
57804
58261
  ar: {
@@ -57845,6 +58302,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57845
58302
  us: {
57846
58303
  code: "en-US",
57847
58304
  strings: "en/resource.json"
58305
+ },
58306
+ au: {
58307
+ code: "en-AU",
58308
+ strings: "en/resource.json"
58309
+ },
58310
+ gb: {
58311
+ code: "en-GB",
58312
+ strings: "en/resource.json"
58313
+ },
58314
+ nz: {
58315
+ code: "en-NZ",
58316
+ strings: "en/resource.json"
57848
58317
  }
57849
58318
  },
57850
58319
  es: {
@@ -57970,14 +58439,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57970
58439
  }
57971
58440
  },
57972
58441
  zh: {
58442
+ // per https://microsoft.sharepoint.com/sites/globalreadiness/SitePages/Language-fallback.aspx
58443
+ // Chinese - Neutral (zh) fallbacks to en-US
57973
58444
  defaultRegion: {
57974
- code: "zh-Hant",
57975
- strings: "zh-tw/resource.json"
58445
+ code: "zh",
58446
+ strings: "en/resource.json"
58447
+ }
58448
+ },
58449
+ "zh-hans": {
58450
+ defaultRegion: {
58451
+ code: "zh-Hans",
58452
+ strings: "zh-cn/resource.json"
58453
+ },
58454
+ cn: {
58455
+ code: "zh-Hans-CN",
58456
+ strings: "zh-cn/resource.json"
57976
58457
  }
57977
58458
  },
57978
58459
  "zh-hant": {
58460
+ // per discussion with global readiness team, we were explicitly asked to not fallback zh-hant to zh-tw
57979
58461
  defaultRegion: {
57980
58462
  code: "zh-Hant",
58463
+ strings: "en/resource.json"
58464
+ },
58465
+ tw: {
58466
+ code: "zh-Hant-TW",
57981
58467
  strings: "zh-tw/resource.json"
57982
58468
  }
57983
58469
  }
@@ -58194,7 +58680,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58194
58680
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
58195
58681
  };
58196
58682
  })();
58197
- var __read$5 = (window && window.__read) || function (o, n) {
58683
+ var __read$6 = (window && window.__read) || function (o, n) {
58198
58684
  var m = typeof Symbol === "function" && o[Symbol.iterator];
58199
58685
  if (!m) return o;
58200
58686
  var i = m.call(o), r, ar = [], e;
@@ -58210,7 +58696,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58210
58696
  }
58211
58697
  return ar;
58212
58698
  };
58213
- var __spreadArray$1 = (window && window.__spreadArray) || function (to, from) {
58699
+ var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
58214
58700
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
58215
58701
  to[j] = from[i];
58216
58702
  return to;
@@ -58347,7 +58833,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58347
58833
  for (var _i = 0; _i < arguments.length; _i++) {
58348
58834
  valueList[_i] = arguments[_i];
58349
58835
  }
58350
- var merged = _super.prototype.merge.apply(this, __spreadArray$1([], __read$5(valueList)));
58836
+ var merged = _super.prototype.merge.apply(this, __spreadArray$2([], __read$6(valueList)));
58351
58837
  if (merged.authType === exports.AuthenticationType.subscriptionKey) {
58352
58838
  merged.authContext = merged.aadAppId = merged.getToken = undefined;
58353
58839
  }
@@ -58606,7 +59092,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58606
59092
  /**
58607
59093
  * Specifies which set of geopolitically disputed borders and labels are displayed on the map. The View parameter (also referred to as “user region parameter”) is a 2-letter ISO-3166 Country Code that will show the correct maps for that country/region. Country/Regions that are not on the View list or if unspecified will default to the “Unified” View.
58608
59094
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews }.
58609
- * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
59095
+ * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country/region where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
58610
59096
  * @param view The new default view
58611
59097
  */
58612
59098
  function setView(view) {
@@ -59018,10 +59504,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59018
59504
  if (add) {
59019
59505
  this.logoAnchor = document.createElement("a");
59020
59506
  this.logoAnchor.className = "azure-map-logo";
59021
- this.logoAnchor.href = "https://microsoft.com";
59507
+ this.logoAnchor.href = "https://aka.ms/azuremaps";
59022
59508
  this.logoAnchor.setAttribute("aria-label", "Microsoft");
59509
+ this.logoAnchor.setAttribute("target", "_blank");
59023
59510
  this.container.appendChild(this.logoAnchor);
59024
- this.logoTooltip = buildAccessibleTooltip("Visit microsoft.com");
59511
+ this.logoTooltip = buildAccessibleTooltip("Visit azure.microsoft.com");
59025
59512
  this.container.appendChild(this.logoTooltip);
59026
59513
  positionTooltip(this.logoTooltip, this.logoAnchor);
59027
59514
  }
@@ -59046,7 +59533,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59046
59533
  return __assign$4.apply(this, arguments);
59047
59534
  };
59048
59535
 
59049
- var __awaiter$1 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
59536
+ var __awaiter$2 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
59050
59537
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59051
59538
  return new (P || (P = Promise))(function (resolve, reject) {
59052
59539
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -59055,7 +59542,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59055
59542
  step((generator = generator.apply(thisArg, _arguments || [])).next());
59056
59543
  });
59057
59544
  };
59058
- var __generator$1 = (window && window.__generator) || function (thisArg, body) {
59545
+ var __generator$2 = (window && window.__generator) || function (thisArg, body) {
59059
59546
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
59060
59547
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
59061
59548
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -59082,7 +59569,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59082
59569
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59083
59570
  }
59084
59571
  };
59085
- var __read$6 = (window && window.__read) || function (o, n) {
59572
+ var __read$7 = (window && window.__read) || function (o, n) {
59086
59573
  var m = typeof Symbol === "function" && o[Symbol.iterator];
59087
59574
  if (!m) return o;
59088
59575
  var i = m.call(o), r, ar = [], e;
@@ -59098,6 +59585,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59098
59585
  }
59099
59586
  return ar;
59100
59587
  };
59588
+ var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
59589
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
59590
+ to[j] = from[i];
59591
+ return to;
59592
+ };
59101
59593
 
59102
59594
  /**
59103
59595
  * @private
@@ -59234,14 +59726,17 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59234
59726
  var trafficOptions = _this.map.getTraffic();
59235
59727
  if (trafficOptions.flow !== "none") {
59236
59728
  var trafficFlowComponent = _this.map.layers.getLayerById("traffic_" + trafficOptions.flow);
59729
+ if (!trafficFlowComponent && ['absolute', 'relative-delay'].includes(trafficOptions.flow)) {
59730
+ // Fallback to relative if deprecated flow type is used
59731
+ trafficFlowComponent = _this.map.layers.getLayerById("traffic_relative");
59732
+ }
59237
59733
  if (trafficFlowComponent) {
59238
- _this.lastFlowMode = trafficOptions.flow;
59734
+ _this.lastFlowMode = trafficFlowComponent.getId().replace("traffic_", "");
59239
59735
  trafficFlowComponent._updateLayoutProperty("visibility", "visible", "none");
59240
59736
  }
59241
59737
  }
59242
59738
  };
59243
59739
  this.removeFromMap = function () {
59244
- var trafficOptions = _this.map.getTraffic();
59245
59740
  if (_this.lastFlowMode != "none") {
59246
59741
  var trafficFlowComponent = _this.map.layers.getLayerById("traffic_" + _this.lastFlowMode);
59247
59742
  if (trafficFlowComponent) {
@@ -59975,7 +60470,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59975
60470
  };
59976
60471
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
59977
60472
  };
59978
- var __read$7 = (window && window.__read) || function (o, n) {
60473
+ var __read$8 = (window && window.__read) || function (o, n) {
59979
60474
  var m = typeof Symbol === "function" && o[Symbol.iterator];
59980
60475
  if (!m) return o;
59981
60476
  var i = m.call(o), r, ar = [], e;
@@ -60173,7 +60668,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60173
60668
  var callbacks = new Dictionary(this.mapCallbackHandler.getEventCallbacks(eventType, layer));
60174
60669
  if (callbacks) {
60175
60670
  callbacks.forEach(function (_a, callback) {
60176
- var _b = __read$7(_a, 2), _ = _b[0], once = _b[1];
60671
+ var _b = __read$8(_a, 2), _ = _b[0], once = _b[1];
60177
60672
  // Invoking a listener this way circumvents the fire once logic in the modified callback.
60178
60673
  // So we check if the callback was added as a fire once and if so remove it here.
60179
60674
  if (once) {
@@ -60202,7 +60697,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60202
60697
  this._removeListener(eventType, target, callback);
60203
60698
  }
60204
60699
  else {
60205
- target._removeEventListener(eventType, callback);
60700
+ target === null || target === void 0 ? void 0 : target._removeEventListener(eventType, callback);
60206
60701
  }
60207
60702
  }
60208
60703
  }
@@ -60281,7 +60776,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60281
60776
  eventDict.forEach(function (callbackDict, eventType) {
60282
60777
  callbackDict.forEach(function (_a) {
60283
60778
  var e_6, _b;
60284
- var _c = __read$7(_a, 1), modifiedCallback = _c[0];
60779
+ var _c = __read$8(_a, 1), modifiedCallback = _c[0];
60285
60780
  try {
60286
60781
  for (var _d = __values$a(layer._getLayerIds()), _e = _d.next(); !_e.done; _e = _d.next()) {
60287
60782
  var mbLayerId = _e.value;
@@ -60314,7 +60809,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60314
60809
  eventDict.forEach(function (callbackDict, eventType) {
60315
60810
  callbackDict.forEach(function (_a) {
60316
60811
  var e_7, _b;
60317
- var _c = __read$7(_a, 1), modifiedCallback = _c[0];
60812
+ var _c = __read$8(_a, 1), modifiedCallback = _c[0];
60318
60813
  try {
60319
60814
  for (var _d = __values$a(layer._getLayerIds()), _e = _d.next(); !_e.done; _e = _d.next()) {
60320
60815
  var mbLayerId = _e.value;
@@ -60692,10 +61187,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60692
61187
  return ids;
60693
61188
  };
60694
61189
  FundamentalMapLayer.prototype._updateLayoutProperty = function (name, newValue, oldValue, subValue) {
60695
- var _this = this;
61190
+ if (isEqual_1(newValue, oldValue))
61191
+ return;
61192
+ var map = this.map._getMap();
60696
61193
  this.layers.forEach(function (layer) {
60697
- if (!(isEqual_1(newValue, oldValue))) {
60698
- _this.map._getMap().setLayoutProperty(layer.id, name, subValue || newValue);
61194
+ if (map.getLayer(layer.id)) {
61195
+ map.setLayoutProperty(layer.id, name, subValue || newValue);
61196
+ }
61197
+ else {
61198
+ console.warn("Could not update layout property " + name + " for layer " + layer.id + " to " + (subValue || newValue));
60699
61199
  }
60700
61200
  });
60701
61201
  };
@@ -60713,7 +61213,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60713
61213
  };
60714
61214
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
60715
61215
  };
60716
- var __read$8 = (window && window.__read) || function (o, n) {
61216
+ var __read$9 = (window && window.__read) || function (o, n) {
60717
61217
  var m = typeof Symbol === "function" && o[Symbol.iterator];
60718
61218
  if (!m) return o;
60719
61219
  var i = m.call(o), r, ar = [], e;
@@ -60729,7 +61229,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60729
61229
  }
60730
61230
  return ar;
60731
61231
  };
60732
- var __spreadArray$2 = (window && window.__spreadArray) || function (to, from) {
61232
+ var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
60733
61233
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
60734
61234
  to[j] = from[i];
60735
61235
  return to;
@@ -60790,10 +61290,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60790
61290
  // Place the new layer behind the specified before layer.
60791
61291
  var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layer.getId(); });
60792
61292
  var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layer.getId(); });
60793
- var tempLayer = this.layerIndex[layerIndex];
60794
61293
  this._removeMapboxLayers(layer);
60795
61294
  this._addMapboxLayers(layer, before);
60796
- this.map.events._disableLayerEvents(tempLayer);
61295
+ var tempLayer = this.layerIndex[layerIndex];
61296
+ if (tempLayer) {
61297
+ this.map.events._disableLayerEvents(tempLayer);
61298
+ }
60797
61299
  this.map.events._enableLayerEvents(layer);
60798
61300
  this.layerIndex.splice(layerIndex, 1);
60799
61301
  var beforeIndex = this.layerIndex.findIndex(function (l) { return l.getId() === before; });
@@ -60801,7 +61303,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
60801
61303
  if (!(layer instanceof FundamentalMapLayer)) {
60802
61304
  this.userLayers[userLayerIndex] = { layer: layer, before: before };
60803
61305
  }
60804
- tempLayer.onRemove();
61306
+ if (tempLayer) {
61307
+ tempLayer.onRemove();
61308
+ }
60805
61309
  layer.onAdd(this.map);
60806
61310
  }
60807
61311
  else {
@@ -61012,9 +61516,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61012
61516
  LayerManager.prototype.clear = function () {
61013
61517
  for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
61014
61518
  var tempLayer = this.layerIndex[layerIndexIndex];
61015
- this._removeMapboxLayers(tempLayer, true);
61016
- this.layerIndex.splice(layerIndexIndex, 1);
61017
- tempLayer.onRemove();
61519
+ if (tempLayer) {
61520
+ this._removeMapboxLayers(tempLayer, true);
61521
+ this.layerIndex.splice(layerIndexIndex, 1);
61522
+ tempLayer.onRemove();
61523
+ }
61018
61524
  }
61019
61525
  this.userLayers = [];
61020
61526
  };
@@ -61165,7 +61671,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61165
61671
  // If a specified layer hasn't been added to the map throw an error.
61166
61672
  var index = this_1.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
61167
61673
  if (index > -1) {
61168
- layerIds.push.apply(layerIds, __spreadArray$2([], __read$8(this_1.layerIndex[index]._getLayerIds()
61674
+ layerIds.push.apply(layerIds, __spreadArray$4([], __read$9(this_1.layerIndex[index]._getLayerIds()
61169
61675
  .filter(function (id) { return !!_this.map._getMap().getLayer(id); }))));
61170
61676
  }
61171
61677
  else {
@@ -61454,6 +61960,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61454
61960
  FundamentalMapSource.prototype._buildSource = function () {
61455
61961
  return this.source;
61456
61962
  };
61963
+ /**
61964
+ * @internal
61965
+ */
61966
+ FundamentalMapSource.prototype._isDeepEqual = function (other) {
61967
+ if (this.constructor !== other.constructor) {
61968
+ return false;
61969
+ }
61970
+ var source = this.source;
61971
+ var otherSource = other.source;
61972
+ var baseEqual = source.type === otherSource.type &&
61973
+ source.url === otherSource.url
61974
+ && ((source.tiles === undefined && otherSource.tiles === undefined) ||
61975
+ (source.tiles && otherSource.tiles && source.tiles.length === otherSource.tiles.length && source.tiles.every(function (value, idx) { return value === otherSource.tiles[idx]; })))
61976
+ && source.minzoom === otherSource.minzoom
61977
+ && source.maxzoom === otherSource.maxzoom
61978
+ && source.bounds === otherSource.bounds
61979
+ && source.attribution === otherSource.attribution;
61980
+ var rasterEqual = source.type !== "raster" || (source.type === "raster"
61981
+ && source.type === otherSource.type
61982
+ && source.tileSize === otherSource.tileSize
61983
+ && source.scheme === otherSource.scheme);
61984
+ var rasterDemEqual = source.type !== "raster-dem" || (source.type === "raster-dem"
61985
+ && source.type === otherSource.type
61986
+ && source.tileSize === otherSource.tileSize
61987
+ && source.encoding === otherSource.encoding);
61988
+ var vectorEqual = source.type !== "vector" || (source.type === "vector"
61989
+ && source.type === otherSource.type
61990
+ && source.promoteId === otherSource.promoteId
61991
+ && source.scheme === otherSource.scheme);
61992
+ return baseEqual && rasterEqual && rasterDemEqual && vectorEqual;
61993
+ };
61457
61994
  /**
61458
61995
  * Updates the source info to convert the tiles to url strings.
61459
61996
  * @param sourceDef The original source info.
@@ -61750,39 +62287,52 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61750
62287
  var _this = this;
61751
62288
  if (sources) {
61752
62289
  Object.keys(sources).forEach(function (sourceId) {
62290
+ var sourceToAdd = sources[sourceId];
62291
+ var newSource;
62292
+ if (sourceToAdd.type === "vector") {
62293
+ newSource = new FundamentalMapSource(sourceId, {
62294
+ name: sourceId,
62295
+ tiles: sourceToAdd.tiles,
62296
+ type: "vector",
62297
+ url: sourceToAdd.url
62298
+ });
62299
+ }
62300
+ else if (sourceToAdd.type === "raster") {
62301
+ newSource = new FundamentalMapSource(sourceId, {
62302
+ name: sourceId,
62303
+ tiles: sourceToAdd.tiles,
62304
+ type: "raster",
62305
+ url: sourceToAdd.url
62306
+ });
62307
+ }
62308
+ else {
62309
+ // Do not throw for the source of unknown type.
62310
+ // throw new Error(`Unable to construct source with ID ${sourceId}.`);
62311
+ // no other handling for the source we don't sync into the state here
62312
+ return;
62313
+ }
61753
62314
  if (!_this.sources.has(sourceId)) {
61754
- var sourceToAdd = sources[sourceId];
61755
- if (sourceToAdd.type === "vector") {
61756
- var newSource = new FundamentalMapSource(sourceId, {
61757
- name: sourceId,
61758
- tiles: sourceToAdd.tiles,
61759
- type: "vector",
61760
- url: sourceToAdd.url
61761
- });
61762
- _this.sources.set(sourceId, newSource);
61763
- newSource._setMap(_this.map);
61764
- }
61765
- else if (sourceToAdd.type === "raster") {
61766
- var newSource = new FundamentalMapSource(sourceId, {
61767
- name: sourceId,
61768
- tiles: sourceToAdd.tiles,
61769
- type: "raster",
61770
- url: sourceToAdd.url
61771
- });
61772
- _this.sources.set(sourceId, newSource);
61773
- newSource._setMap(_this.map);
61774
- }
61775
- else {
61776
- throw new Error("Unable to construct source with ID " + sourceId + ".");
61777
- }
62315
+ _this.sources.set(sourceId, newSource);
62316
+ newSource._setMap(_this.map);
61778
62317
  }
61779
- });
61780
- Object.keys(this.sources).forEach(function (sourceId) {
61781
- if (!sources.hasOwnProperty(sourceId)) {
61782
- _this.sources.get(sourceId)._setMap(null);
61783
- _this.sources.delete(sourceId);
62318
+ else if (_this.sources.has(sourceId) && !_this.sources.get(sourceId)._isDeepEqual(newSource)) {
62319
+ // source with same id but different properties: update
62320
+ _this.sources.set(sourceId, newSource);
62321
+ newSource._setMap(_this.map, false);
61784
62322
  }
61785
62323
  });
62324
+ // counter-intuitive: below is a bug and will do nothing since Object.keys(this.sources) will always return [], it should rather be:
62325
+ // Array.from(this.sources.keys()).forEach(sourceId => {
62326
+ // however, we have seen the first party users are compensating for this with their code containing explicit azm.sources.remove but not containing the check for existing
62327
+ // such removal will cause the exception, since the source would already be removed
62328
+ //
62329
+ // given this bug was here historically, we keep the removal unfixed here (already fixed in v3) to make sure we don't cause any unintented side effects for existing users
62330
+ // Object.keys(this.sources).forEach(sourceId => {
62331
+ // if (!sources.hasOwnProperty(sourceId)) {
62332
+ // this.sources.get(sourceId)._setMap(null);
62333
+ // this.sources.delete(sourceId);
62334
+ // }
62335
+ // });
61786
62336
  }
61787
62337
  };
61788
62338
  return SourceManager;
@@ -61908,7 +62458,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61908
62458
  };
61909
62459
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
61910
62460
  };
61911
- var __read$9 = (window && window.__read) || function (o, n) {
62461
+ var __read$a = (window && window.__read) || function (o, n) {
61912
62462
  var m = typeof Symbol === "function" && o[Symbol.iterator];
61913
62463
  if (!m) return o;
61914
62464
  var i = m.call(o), r, ar = [], e;
@@ -61924,7 +62474,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61924
62474
  }
61925
62475
  return ar;
61926
62476
  };
61927
- var __spreadArray$3 = (window && window.__spreadArray) || function (to, from) {
62477
+ var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
61928
62478
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
61929
62479
  to[j] = from[i];
61930
62480
  return to;
@@ -61999,7 +62549,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
61999
62549
  }
62000
62550
  finally { if (e_1) throw e_1.error; }
62001
62551
  }
62002
- return _super.prototype.merge.apply(this, __spreadArray$3([], __read$9(valuesList)));
62552
+ return _super.prototype.merge.apply(this, __spreadArray$5([], __read$a(valuesList)));
62003
62553
  };
62004
62554
  return CameraBoundsOptions;
62005
62555
  }(Options));
@@ -62472,7 +63022,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62472
63022
  };
62473
63023
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
62474
63024
  };
62475
- var __read$a = (window && window.__read) || function (o, n) {
63025
+ var __read$b = (window && window.__read) || function (o, n) {
62476
63026
  var m = typeof Symbol === "function" && o[Symbol.iterator];
62477
63027
  if (!m) return o;
62478
63028
  var i = m.call(o), r, ar = [], e;
@@ -62488,7 +63038,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62488
63038
  }
62489
63039
  return ar;
62490
63040
  };
62491
- var __spreadArray$4 = (window && window.__spreadArray) || function (to, from) {
63041
+ var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
62492
63042
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
62493
63043
  to[j] = from[i];
62494
63044
  return to;
@@ -62599,7 +63149,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62599
63149
  /**
62600
63150
  * Specifies which set of geopolitically disputed borders and labels are displayed on the map. The View parameter (also referred to as “user region parameter”) is a 2-letter ISO-3166 Country Code that will show the correct maps for that country/region. Country/Regions that are not on the View list or if unspecified will default to the “Unified” View.
62601
63151
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews}
62602
- * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
63152
+ * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country/region where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
62603
63153
  * default: `undefined`
62604
63154
  * @default undefined
62605
63155
  */
@@ -62608,6 +63158,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62608
63158
  * @deprecated use `view` instead.
62609
63159
  */
62610
63160
  _this.userRegion = _this.view;
63161
+ /**
63162
+ * allows substituting a default MapControl's style transformer with custom one
63163
+ * Default style transformer is meant to update the incoming fetched style to desired state, as well as to synchronize the SDK state with style state
63164
+ * and move additional layers over
63165
+ * @internal
63166
+ */
63167
+ _this.customStyleTransform = undefined;
62611
63168
  return _this;
62612
63169
  }
62613
63170
  /**
@@ -62647,7 +63204,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62647
63204
  finally { if (e_1) throw e_1.error; }
62648
63205
  }
62649
63206
  // Then execute the standard merge behavior.
62650
- return _super.prototype.merge.apply(this, __spreadArray$4([], __read$a(valueList)));
63207
+ return _super.prototype.merge.apply(this, __spreadArray$6([], __read$b(valueList)));
62651
63208
  };
62652
63209
  return StyleOptions;
62653
63210
  }(Options));
@@ -62689,7 +63246,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62689
63246
  };
62690
63247
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
62691
63248
  };
62692
- var __read$b = (window && window.__read) || function (o, n) {
63249
+ var __read$c = (window && window.__read) || function (o, n) {
62693
63250
  var m = typeof Symbol === "function" && o[Symbol.iterator];
62694
63251
  if (!m) return o;
62695
63252
  var i = m.call(o), r, ar = [], e;
@@ -62705,7 +63262,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62705
63262
  }
62706
63263
  return ar;
62707
63264
  };
62708
- var __spreadArray$5 = (window && window.__spreadArray) || function (to, from) {
63265
+ var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
62709
63266
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
62710
63267
  to[j] = from[i];
62711
63268
  return to;
@@ -62940,10 +63497,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62940
63497
  // won't change default behavior in Options as usually that's what desired
62941
63498
  // instead capture it here and reassign.
62942
63499
  var currentTransforms = this._transformers;
62943
- var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$5(__spreadArray$5([], __read$b(flattened)), __read$b(value._transformers || [])); }, []) : [];
63500
+ var transformersToMerge = valueList ? valueList.filter(function (value) { return value !== undefined; }).reduce(function (flattened, value) { return __spreadArray$7(__spreadArray$7([], __read$c(flattened)), __read$c(value._transformers || [])); }, []) : [];
62944
63501
  // Then execute the standard merge behavior.
62945
63502
  // If subscription key auth method isn't being used then the subscription key property should be undefined.
62946
- var merged = _super.prototype.merge.apply(this, __spreadArray$5([], __read$b(valueList)));
63503
+ var merged = _super.prototype.merge.apply(this, __spreadArray$7([], __read$c(valueList)));
62947
63504
  if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
62948
63505
  merged["subscription-key"] = merged.subscriptionKey = undefined;
62949
63506
  }
@@ -62955,7 +63512,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
62955
63512
  if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
62956
63513
  merged.mapConfiguration = __assign$7(__assign$7({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
62957
63514
  }
62958
- this._transformers = __spreadArray$5(__spreadArray$5([], __read$b(currentTransforms || [])), __read$b(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
63515
+ this._transformers = __spreadArray$7(__spreadArray$7([], __read$c(currentTransforms || [])), __read$c(transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); })));
62959
63516
  if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
62960
63517
  this._transformers.push(this.transformRequest);
62961
63518
  }
@@ -63151,7 +63708,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63151
63708
  };
63152
63709
  return __assign$8.apply(this, arguments);
63153
63710
  };
63154
- var __awaiter$2 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
63711
+ var __awaiter$3 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
63155
63712
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
63156
63713
  return new (P || (P = Promise))(function (resolve, reject) {
63157
63714
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -63160,7 +63717,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63160
63717
  step((generator = generator.apply(thisArg, _arguments || [])).next());
63161
63718
  });
63162
63719
  };
63163
- var __generator$2 = (window && window.__generator) || function (thisArg, body) {
63720
+ var __generator$3 = (window && window.__generator) || function (thisArg, body) {
63164
63721
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
63165
63722
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
63166
63723
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -63187,7 +63744,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63187
63744
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
63188
63745
  }
63189
63746
  };
63190
- var __read$c = (window && window.__read) || function (o, n) {
63747
+ var __read$d = (window && window.__read) || function (o, n) {
63191
63748
  var m = typeof Symbol === "function" && o[Symbol.iterator];
63192
63749
  if (!m) return o;
63193
63750
  var i = m.call(o), r, ar = [], e;
@@ -63203,7 +63760,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63203
63760
  }
63204
63761
  return ar;
63205
63762
  };
63206
- var __spreadArray$6 = (window && window.__spreadArray) || function (to, from) {
63763
+ var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
63207
63764
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
63208
63765
  to[j] = from[i];
63209
63766
  return to;
@@ -63230,6 +63787,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63230
63787
  * Preserve the map configuration that was used before the indoor map configuration was set
63231
63788
  */
63232
63789
  this.preservedPreindoorMapConfiguration = undefined;
63790
+ /**
63791
+ * The state of the progressive loading
63792
+ */
63793
+ this._progressiveLoadingState = {
63794
+ mapStyle: undefined,
63795
+ pendingVisibilityChange: undefined,
63796
+ };
63233
63797
  this._deferLayerGroupVisibilities = function (layerGroupLayers, initLayerGroups) {
63234
63798
  var validInitLayerGroups = initLayerGroups.filter(function (groupName) { return groupName in layerGroupLayers; });
63235
63799
  // If the initial layer groups are invalid, skip the progressive loading.
@@ -63237,11 +63801,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63237
63801
  return;
63238
63802
  var map = _this.map._getMap();
63239
63803
  var currentZoomLevel = map.getZoom();
63240
- // Select the layers to be deferred
63804
+ var currentMapStyle = _this.map.getStyle().style;
63805
+ // Cancel and release previous pending callback, if any.
63806
+ if (_this._progressiveLoadingState.pendingVisibilityChange) {
63807
+ _this.map.events.remove('load', _this._progressiveLoadingState.pendingVisibilityChange);
63808
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
63809
+ }
63810
+ // Keep the current map style for future comparison.
63811
+ _this._progressiveLoadingState.mapStyle = currentMapStyle;
63812
+ // Select deferrable layers
63241
63813
  var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
63242
- var _b = __read$c(_a, 2), groupName = _b[0], layers = _b[1];
63814
+ var _b = __read$d(_a, 2), groupName = _b[0], layers = _b[1];
63243
63815
  var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
63244
- return __spreadArray$6(__spreadArray$6([], __read$c(deferred)), __read$c(layers.filter(function (layer) {
63816
+ return __spreadArray$8(__spreadArray$8([], __read$d(deferred)), __read$d(layers.filter(function (layer) {
63245
63817
  var _a;
63246
63818
  // Exclude custom layers
63247
63819
  if (layer.type === 'custom')
@@ -63264,30 +63836,40 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63264
63836
  return false;
63265
63837
  }
63266
63838
  }
63267
- // Defer visible layers only.
63839
+ // Select visible layers only.
63268
63840
  return ((_a = layer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
63269
63841
  })));
63270
63842
  }, []);
63271
- // Hide the deferred layers at initial load, therefore we can save the render time.
63843
+ // Hide the deferrable layers at initial load, therefore we can save the render time.
63272
63844
  deferredLayers.forEach(function (layer) {
63845
+ // Since this happens before sending style object into the map rendering,
63846
+ // we only need to update the style object, but not necessary to update maplibre's layout properties.
63273
63847
  layer.layout = layer.layout || {};
63274
63848
  layer.layout.visibility = 'none';
63275
63849
  });
63276
- // Make the deferred layers visible once the map instance is fully loaded
63277
- _this.map.events.addOnce('load', function () {
63850
+ // Make the deferred layers visible once the map instance is fully loaded.
63851
+ _this._progressiveLoadingState.pendingVisibilityChange = function () {
63852
+ // Release the callback.
63853
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
63854
+ // Bail out the callback once map style has changed.
63855
+ var nextMapStyle = _this.map.getStyle().style;
63856
+ if (currentMapStyle !== nextMapStyle)
63857
+ return;
63858
+ // Make deferred layers visible
63278
63859
  deferredLayers.forEach(function (layer) {
63860
+ // This happens after the map rendering; Therefore, we need to update
63861
+ // both the style object and the maplibre's layout properties.
63279
63862
  layer.layout.visibility = 'visible';
63280
63863
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
63281
63864
  });
63282
- });
63865
+ };
63866
+ _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
63283
63867
  };
63284
- this._onStyleData = function () {
63285
- _this._lookUpAsync(_this.map.getStyle()).then(function (style) {
63286
- _this.map.events.invoke("stylechanged", {
63287
- style: style.name,
63288
- map: _this.map,
63289
- type: "stylechanged"
63290
- });
63868
+ this._onStyleData = function (definition) {
63869
+ _this.map.events.invoke("stylechanged", {
63870
+ style: definition.name,
63871
+ map: _this.map,
63872
+ type: "stylechanged"
63291
63873
  });
63292
63874
  };
63293
63875
  /**
@@ -63310,9 +63892,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63310
63892
  || definitions.configurations[0];
63311
63893
  }
63312
63894
  };
63313
- this._lookUpAsync = function (options) { return __awaiter$2(_this, void 0, void 0, function () {
63895
+ this._lookUpAsync = function (options) { return __awaiter$3(_this, void 0, void 0, function () {
63314
63896
  var definitions, result;
63315
- return __generator$2(this, function (_a) {
63897
+ return __generator$3(this, function (_a) {
63316
63898
  switch (_a.label) {
63317
63899
  case 0: return [4 /*yield*/, this.definitions()];
63318
63900
  case 1:
@@ -63394,7 +63976,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63394
63976
  return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
63395
63977
  };
63396
63978
  if (!this.serviceOptions.mapConfiguration) {
63397
- newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
63979
+ var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
63980
+ newPromise = new HijackablePromise(ensureAuthentication.then(function () { return _this._request(_this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: _this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
63398
63981
  version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
63399
63982
  defaultConfiguration: definitions.defaultStyle,
63400
63983
  configurations: definitions.styles
@@ -63421,19 +64004,25 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63421
64004
  domain: _this.serviceOptions.staticAssetsDomain,
63422
64005
  path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
63423
64006
  queryParams: {
63424
- styleVersion: _this.serviceOptions.styleDefinitionsVersion,
64007
+ // Use the style version from the API response if it's available,
64008
+ // otherwise fallback to the version specified in the serviceOptions.
64009
+ // This is needed for flight testing the 2023-01-01 style version.
64010
+ styleVersion: definitions.version !== undefined && definitions.version !== null
64011
+ ? definitions.version
64012
+ : _this.serviceOptions.styleDefinitionsVersion
63425
64013
  // thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
63426
64014
  //language: styleOptions.language
63427
64015
  },
63428
64016
  protocol: "https"
63429
64017
  }).toString(),
63430
64018
  }); })
63431
- }); }));
64019
+ }); }); }));
63432
64020
  }
63433
64021
  else if (typeof this.serviceOptions.mapConfiguration === 'string') {
63434
- newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
64022
+ var ensureAuthentication = this.map.authentication ? this.map.authentication.initialize() : Promise.resolve();
64023
+ newPromise = new HijackablePromise(ensureAuthentication.then(function () { return _this._request(_this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + _this.serviceOptions.mapConfiguration, "StyleDefinitions"
63435
64024
  // reassign properties from legacy mapConfiguration to new structure if needed
63436
- ).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
64025
+ ).then(function (definitions) { return (__assign$8(__assign$8({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }); }));
63437
64026
  }
63438
64027
  else {
63439
64028
  newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
@@ -63464,23 +64053,183 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63464
64053
  if (styleDefinition.style) {
63465
64054
  return styleDefinition.style;
63466
64055
  }
63467
- throw Error("Style definition does not contain neither URL nor style object.");
64056
+ throw Error("Style definition neither contains URL nor style object.");
64057
+ };
64058
+ StyleManager.prototype.deriveNewStyleAndLayerGroups = function (previousStyle, nextStyle) {
64059
+ var _a, _b, _c, _d, _e, _f;
64060
+ // Layers in the next style with default properties that do not align with current StyleOptions
64061
+ // should be modified before they are applied to the map.
64062
+ var styleOptions = this.map.getStyle();
64063
+ var trafficOptions = this.map.getTraffic();
64064
+ var layersGroups = {};
64065
+ for (var i = 0; i < nextStyle.layers.length; i++) {
64066
+ var nextLayer = nextStyle.layers[i];
64067
+ var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
64068
+ if (!layerGroup) {
64069
+ layersGroups[nextLayer.id] = [nextLayer];
64070
+ continue;
64071
+ }
64072
+ if (!layersGroups[layerGroup]) {
64073
+ layersGroups[layerGroup] = [];
64074
+ }
64075
+ var layerGroupLayers = layersGroups[layerGroup];
64076
+ layerGroupLayers.push(nextLayer);
64077
+ // 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
64078
+ if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
64079
+ nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
64080
+ nextLayer.layout.visibility = "none";
64081
+ }
64082
+ else if (nextLayer.type === "fill-extrusion") {
64083
+ nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
64084
+ nextLayer.layout.visibility = "visible";
64085
+ }
64086
+ // 2. Set visibility of traffic layers depending on traffic settings.
64087
+ if (trafficOptions.flow !== "none" && layerGroup) {
64088
+ if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
64089
+ nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
64090
+ nextLayer.layout.visibility = "visible";
64091
+ }
64092
+ }
64093
+ // 3. Set visibility of labels
64094
+ var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
64095
+ if (isLabelLayerGroup && nextLayer.type === 'symbol') {
64096
+ if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
64097
+ nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
64098
+ nextLayer.layout.visibility = "visible";
64099
+ }
64100
+ else {
64101
+ nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
64102
+ nextLayer.layout.visibility = "none";
64103
+ }
64104
+ }
64105
+ }
64106
+ return [nextStyle, layersGroups];
64107
+ };
64108
+ StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
64109
+ // Custom layers added to mapbox through this SDK should be carried over to the next style.
64110
+ return !previousStyle
64111
+ ? nextStyle
64112
+ : this.map.layers._getUserLayers().reduce(function (style, userLayer) {
64113
+ if (userLayer.layer instanceof WebGLLayer) {
64114
+ // mapbox custom layers cannot be serialized and preserved,
64115
+ // return to continue to the next user layer.
64116
+ return style;
64117
+ }
64118
+ var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
64119
+ ? layerGroupLayers[userLayer.before][0]
64120
+ : undefined;
64121
+ var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
64122
+ // when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
64123
+ var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
64124
+ if (existingLayerIdx > -1) {
64125
+ nextStyle.layers.splice(existingLayerIdx, 1);
64126
+ }
64127
+ if (layer) {
64128
+ var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
64129
+ .map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
64130
+ .filter(function (source) { return source !== undefined; }));
64131
+ var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
64132
+ if (insertIdx > -1) {
64133
+ style.layers.splice(insertIdx, 0, layer);
64134
+ }
64135
+ else {
64136
+ style.layers.push(layer);
64137
+ }
64138
+ sourcesToCopy.forEach(function (_a) {
64139
+ var source = _a.source, id = _a.id;
64140
+ style.sources[id] = source;
64141
+ });
64142
+ }
64143
+ return style;
64144
+ }, __assign$8({}, nextStyle));
63468
64145
  };
63469
64146
  /**
63470
64147
  * @internal
63471
64148
  */
63472
64149
  StyleManager.prototype.setStyle = function (styleOptions, diff) {
64150
+ var _this = this;
63473
64151
  if (diff === void 0) { diff = true; }
63474
- try {
63475
- this.map._getMap().setStyle(this.getStyle(styleOptions), {
63476
- diff: diff,
63477
- stylePatch: this._stylePatch.bind(this),
63478
- validate: this.serviceOptions.validateStyle
63479
- });
64152
+ var transformStyleFunc;
64153
+ var targetDefinition = this._lookUp(styleOptions);
64154
+ if (!targetDefinition) {
64155
+ throw Error("Style definition " + styleOptions.style + " is not available.");
64156
+ }
64157
+ if (!targetDefinition.url && !targetDefinition.style) {
64158
+ throw Error("Style definition neither contains URL nor style object.");
64159
+ }
64160
+ var styleDataCallback = function () { return _this._onStyleData(targetDefinition); };
64161
+ var patchStyleEvent = function () {
64162
+ // FIXME: below diffing will be soon fixed on the maplibre side
64163
+ // If there was a previous styledata change event attached, remove it.
64164
+ // When the sprite url changes between style changes then maplibre can't perform the diff
64165
+ // In such cases it recalculate the style again. Removing previous attached
64166
+ // event listener makes sure that style changed event is not fired twice in these cases.
64167
+ _this.map.events.remove("styledata", styleDataCallback);
64168
+ _this.map.events.addOnce("styledata", styleDataCallback);
64169
+ };
64170
+ if (styleOptions && styleOptions.customStyleTransform) {
64171
+ transformStyleFunc = function (prev, next) {
64172
+ var target = styleOptions.customStyleTransform(prev, next);
64173
+ patchStyleEvent();
64174
+ return target;
64175
+ };
63480
64176
  }
63481
- catch (e) {
63482
- throw e;
64177
+ else {
64178
+ transformStyleFunc = function (previousStyle, style) {
64179
+ // make sure we always have a shallow clone to prevent mutating explicit json(rather then url) styles being set
64180
+ var nextStyle = __assign$8(__assign$8({}, style), { layers: __spreadArray$8([], __read$d(style.layers)), sources: __assign$8({}, style.sources) });
64181
+ var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
64182
+ // The feature only effective at the initial load.
64183
+ !_this.map._isLoaded());
64184
+ // Shallow-clone the style object and duplicate layer.layout properties to avoid side-effects.
64185
+ if (shouldProgressiveLoading && Array.isArray(style === null || style === void 0 ? void 0 : style.layers)) {
64186
+ nextStyle = __assign$8({}, style);
64187
+ nextStyle.layers = nextStyle.layers.map(function (layer) {
64188
+ var nextLayer = __assign$8({}, layer);
64189
+ if (layer.layout) {
64190
+ nextLayer.layout = __assign$8({}, layer.layout);
64191
+ }
64192
+ return nextLayer;
64193
+ });
64194
+ }
64195
+ // 1. derive the base new style (without user layers) and layer groups
64196
+ var _a = __read$d(_this.deriveNewStyleAndLayerGroups(previousStyle, nextStyle), 2), targetStyle = _a[0], layerGroupLayers = _a[1];
64197
+ // 2. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
64198
+ if (shouldProgressiveLoading) {
64199
+ var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
64200
+ if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
64201
+ _this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
64202
+ }
64203
+ }
64204
+ // 3. copy user layers and sources from previous style into new one
64205
+ var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, targetStyle, layerGroupLayers);
64206
+ // 4. side effects: sync our control's LayerManager and SourceManager
64207
+ var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
64208
+ var _b = __read$d(_a, 2), layerGroupId = _b[0], layers = _b[1];
64209
+ return _this._buildFundamentalLayerFrom(layers, layerGroupId);
64210
+ });
64211
+ var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
64212
+ var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
64213
+ if (layerInsertIndex > -1) {
64214
+ layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
64215
+ }
64216
+ else {
64217
+ layerIndex.push(userLayer.layer);
64218
+ }
64219
+ return layerIndex;
64220
+ }, nextFundamentalLayers);
64221
+ _this.map.layers['layerIndex'] = layerIndex;
64222
+ _this.map.sources._syncSources(targetStyleWithUserLayers.sources);
64223
+ // 5. temporarily patch style data event
64224
+ patchStyleEvent();
64225
+ return targetStyleWithUserLayers;
64226
+ };
63483
64227
  }
64228
+ this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
64229
+ diff: diff,
64230
+ validate: this.serviceOptions.validateStyle,
64231
+ transformStyle: transformStyleFunc
64232
+ });
63484
64233
  };
63485
64234
  /**
63486
64235
  * Gets the color theme (light/dark) for the style type specified by the style options.
@@ -63493,8 +64242,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63493
64242
  return style.theme.toLowerCase();
63494
64243
  };
63495
64244
  StyleManager.prototype.getThemeAsync = function (styleOptions) {
63496
- return __awaiter$2(this, void 0, void 0, function () {
63497
- return __generator$2(this, function (_a) {
64245
+ return __awaiter$3(this, void 0, void 0, function () {
64246
+ return __generator$3(this, function (_a) {
63498
64247
  switch (_a.label) {
63499
64248
  case 0: return [4 /*yield*/, this._lookUpAsync(styleOptions)];
63500
64249
  case 1: return [2 /*return*/, (_a.sent()).theme];
@@ -63545,145 +64294,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63545
64294
  StyleManager.prototype.clearStyleSet = function () {
63546
64295
  this.unsetIndoorState();
63547
64296
  };
63548
- /**
63549
- * Function invoked by mapbox after a style is fetched but before it is committed to the map state.
63550
- *
63551
- * @param previousStyle The current style.
63552
- * @param nextStyle The next style which is to be applied.
63553
- * @param preserveLayer Preserve a layer from the previous style in the next style.
63554
- * @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
63555
- * @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
63556
- * @param updateFilter Modify filter property of a layer in the next style before the style is applied.
63557
- */
63558
- StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
63559
- var _this = this;
63560
- // Layers in the next style with default properties that do not align with current StyleOptions
63561
- // should be modified before they are applied to the map.
63562
- var styleOptions = this.map.getStyle();
63563
- var trafficOptions = this.map.getTraffic();
63564
- // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
63565
- nextStyle.sources = Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
63566
- var _b = __read$c(_a, 2), sourceKey = _b[0], source = _b[1];
63567
- var newSource = __assign$8({}, source);
63568
- if ('url' in newSource && typeof newSource.url === 'string') {
63569
- if (newSource.url.includes(constants.languagePlaceHolder)) {
63570
- newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
63571
- }
63572
- }
63573
- newSources[sourceKey] = newSource;
63574
- return newSources;
63575
- }, {});
63576
- var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
63577
- // The feature only effective at the initial load.
63578
- !this.map._isLoaded());
63579
- var setLayerVisibility = function (layer, visibility) {
63580
- var _a;
63581
- if (!shouldProgressiveLoading) {
63582
- // No need to apply the visibility change to maplibre while progressive loading is enabled.
63583
- // This can save a lot of CPU time.
63584
- updateLayoutProperty(layer.id, 'visibility', visibility);
63585
- }
63586
- layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
63587
- layer.layout.visibility = visibility;
63588
- };
63589
- var layerGroupLayers = {};
63590
- nextStyle.layers.forEach(function (nextLayer) {
63591
- var _a;
63592
- var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
63593
- if (layerGroup) {
63594
- // Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
63595
- if (nextLayer.type === 'fill-extrusion') {
63596
- setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
63597
- }
63598
- // Set visibility of traffic layers depending on traffic settings.
63599
- if (trafficOptions.flow !== 'none' &&
63600
- layerGroup === "traffic_" + trafficOptions.flow &&
63601
- nextLayer.type == 'line') {
63602
- setLayerVisibility(nextLayer, 'visible');
63603
- }
63604
- // Set visibility of labels
63605
- var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
63606
- if (isLabelLayerGroup && nextLayer.type === 'symbol') {
63607
- var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
63608
- setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
63609
- }
63610
- // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
63611
- // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
63612
- // waiting for a styledata.load event to trigger a sync in a different context.
63613
- if (layerGroupLayers[layerGroup]) {
63614
- layerGroupLayers[layerGroup].push(nextLayer);
63615
- }
63616
- else {
63617
- layerGroupLayers[layerGroup] = [nextLayer];
63618
- }
63619
- }
63620
- });
63621
- if (shouldProgressiveLoading) {
63622
- var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
63623
- if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
63624
- this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
63625
- }
63626
- }
63627
- // A FundamentalMapLayer (grouped layer) representation of the next style must be built.
63628
- var previousLayers = this.map.layers.getLayers();
63629
- var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
63630
- var _b = __read$c(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
63631
- return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
63632
- });
63633
- // Update FundamentalMapLayers in LayerManager
63634
- var userLayers = this.map.layers._getUserLayers();
63635
- var layersToRemove = previousLayers.filter(function (c) {
63636
- return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
63637
- userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
63638
- });
63639
- var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
63640
- var ePrevNextIntersection = prevNextIntersection.entries();
63641
- var replace = ePrevNextIntersection.next();
63642
- nextLayers.forEach(function (newFundamentalLayer) {
63643
- if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
63644
- // Replace the existing layer with this ID with the new one.
63645
- var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
63646
- _this.map.layers.remove(newFundamentalLayer.getId());
63647
- _this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
63648
- replace = ePrevNextIntersection.next();
63649
- }
63650
- else {
63651
- if (replace.value) {
63652
- // Insert new layer before the next common layer.
63653
- _this.map.layers.add(newFundamentalLayer, replace.value[1]);
63654
- }
63655
- else {
63656
- _this.map.layers.add(newFundamentalLayer);
63657
- }
63658
- }
63659
- });
63660
- layersToRemove.forEach(function (layer) {
63661
- _this.map.layers.remove(layer);
63662
- });
63663
- // Layers added to mapbox through this SDK since loading the last style should be
63664
- // carried over to the next style.
63665
- userLayers.forEach(function (userLayer) {
63666
- if (userLayer.layer instanceof WebGLLayer) {
63667
- // mapbox custom layers cannot be serialized and preserved,
63668
- // return to continue to the next user layer.
63669
- return;
63670
- }
63671
- var before = undefined;
63672
- if (_this.map.layers.getLayerById(userLayer.before)) {
63673
- var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
63674
- before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
63675
- }
63676
- preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
63677
- _this.map.layers.move(userLayer.layer, userLayer.before);
63678
- });
63679
- this.map.sources._syncSources(nextStyle.sources);
63680
- // If there was a previous styledata change event attached, remove it.
63681
- // When the sprite url changes between style changes then mapbox can't perform the diff
63682
- // In such cases it recalculate the style again. Removing previous attached
63683
- // event listener makes sure that style changed event is not fired twice in these cases.
63684
- this.map.events.remove("styledata", this._onStyleData);
63685
- this.map.events.addOnce("styledata", this._onStyleData);
63686
- };
63687
64297
  StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
63688
64298
  if (layers && layers.length > 0) {
63689
64299
  var newLayer = new FundamentalMapLayer(layers, id);
@@ -63724,27 +64334,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63724
64334
  * Fetches a json resource at the specified domain and path.
63725
64335
  */
63726
64336
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
63727
- var _a;
64337
+ var _a, _b;
63728
64338
  if (customQueryParams === void 0) { customQueryParams = {}; }
63729
- return __awaiter$2(this, void 0, void 0, function () {
64339
+ return __awaiter$3(this, void 0, void 0, function () {
63730
64340
  var requestParams, fetchOptions;
63731
- var _b;
63732
- return __generator$2(this, function (_c) {
63733
- switch (_c.label) {
64341
+ var _c;
64342
+ return __generator$3(this, function (_d) {
64343
+ switch (_d.label) {
63734
64344
  case 0:
63735
64345
  requestParams = {
63736
64346
  url: new Url({
63737
64347
  protocol: "https",
63738
64348
  domain: domain,
63739
64349
  path: path,
63740
- queryParams: __assign$8((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
64350
+ queryParams: __assign$8((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
64351
+ // Generate a hash code to avoid cache conflict
64352
+ // TODO: Remove this once style version 2023-01-01 is publicly available
64353
+ _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
63741
64354
  }).toString()
63742
64355
  };
63743
64356
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
63744
64357
  // If a transformRequest(...) was specified use it.
63745
64358
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
63746
64359
  }
63747
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
64360
+ (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
63748
64361
  fetchOptions = {
63749
64362
  method: "GET",
63750
64363
  mode: "cors",
@@ -63761,11 +64374,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63761
64374
  throw new Error("HTTP " + response.status + ": " + response.statusText + " ");
63762
64375
  }
63763
64376
  })];
63764
- case 1: return [2 /*return*/, _c.sent()];
64377
+ case 1: return [2 /*return*/, _d.sent()];
63765
64378
  }
63766
64379
  });
63767
64380
  });
63768
64381
  };
64382
+ /**
64383
+ * A basic helper function to generate a hash from an input string.
64384
+ */
64385
+ StyleManager._hashCode = function (str) {
64386
+ if (str === void 0) { str = ""; }
64387
+ var chr, hash = 0;
64388
+ if (!str)
64389
+ return hash;
64390
+ for (var i = 0; i < str.length; i++) {
64391
+ chr = str.charCodeAt(i);
64392
+ hash = (hash << 5) - hash + chr;
64393
+ hash |= 0; // Convert to 32bit integer
64394
+ }
64395
+ return hash;
64396
+ };
63769
64397
  return StyleManager;
63770
64398
  }());
63771
64399
 
@@ -63774,6 +64402,123 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63774
64402
  */
63775
64403
  var isHMREnabled = function () { return 'ENVIRONMENT' in window && !!window['ENVIRONMENT']['hmr']; };
63776
64404
 
64405
+ var __values$j = (window && window.__values) || function(o) {
64406
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
64407
+ if (m) return m.call(o);
64408
+ if (o && typeof o.length === "number") return {
64409
+ next: function () {
64410
+ if (o && i >= o.length) o = void 0;
64411
+ return { value: o && o[i++], done: !o };
64412
+ }
64413
+ };
64414
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
64415
+ };
64416
+ /**
64417
+ * @internal
64418
+ * A manager for the map control's hidden indicators.
64419
+ * Exposed through the `indicators` property of the `atlas.Map` class.
64420
+ * Cannot be instantiated by the user.
64421
+ */
64422
+ var AccessibleIndicatorManager = /** @class */ (function () {
64423
+ /**
64424
+ * Constructs the indicator manager to be exposed only through the `indicators` property of the `Map` class.
64425
+ * @param map The map whose indicators are being managed by this.
64426
+ * @internal
64427
+ */
64428
+ function AccessibleIndicatorManager(map) {
64429
+ this.map = map;
64430
+ this.indicators = new Set();
64431
+ }
64432
+ /**
64433
+ * Adds an indicator to the map
64434
+ * @param indicator The indicator(s) to add.
64435
+ */
64436
+ AccessibleIndicatorManager.prototype.add = function (indicator) {
64437
+ var e_1, _a;
64438
+ indicator = Array.isArray(indicator) ? indicator : [indicator];
64439
+ try {
64440
+ for (var indicator_1 = __values$j(indicator), indicator_1_1 = indicator_1.next(); !indicator_1_1.done; indicator_1_1 = indicator_1.next()) {
64441
+ var i = indicator_1_1.value;
64442
+ if (!this.indicators.has(i)) {
64443
+ this.indicators.add(i);
64444
+ i.attach(this.map);
64445
+ }
64446
+ }
64447
+ }
64448
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
64449
+ finally {
64450
+ try {
64451
+ if (indicator_1_1 && !indicator_1_1.done && (_a = indicator_1.return)) _a.call(indicator_1);
64452
+ }
64453
+ finally { if (e_1) throw e_1.error; }
64454
+ }
64455
+ };
64456
+ /**
64457
+ * Removes all indicators from the map.
64458
+ */
64459
+ AccessibleIndicatorManager.prototype.clear = function () {
64460
+ var _this = this;
64461
+ this.indicators.forEach(function (indicator) {
64462
+ _this.indicators.delete(indicator);
64463
+ indicator.remove();
64464
+ });
64465
+ };
64466
+ /**
64467
+ * Removes an indicator from the map
64468
+ * @param indicator The indicator(s) to remove.
64469
+ */
64470
+ AccessibleIndicatorManager.prototype.remove = function (indicator) {
64471
+ var e_2, _a;
64472
+ indicator = Array.isArray(indicator) ? indicator : [indicator];
64473
+ try {
64474
+ for (var indicator_2 = __values$j(indicator), indicator_2_1 = indicator_2.next(); !indicator_2_1.done; indicator_2_1 = indicator_2.next()) {
64475
+ var i = indicator_2_1.value;
64476
+ if (this.indicators.has(i)) {
64477
+ this.indicators.delete(i);
64478
+ i.remove();
64479
+ }
64480
+ }
64481
+ }
64482
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
64483
+ finally {
64484
+ try {
64485
+ if (indicator_2_1 && !indicator_2_1.done && (_a = indicator_2.return)) _a.call(indicator_2);
64486
+ }
64487
+ finally { if (e_2) throw e_2.error; }
64488
+ }
64489
+ };
64490
+ /**
64491
+ * Returns the indicators currently attached to the map.
64492
+ */
64493
+ AccessibleIndicatorManager.prototype.getIndicators = function () {
64494
+ return Array.from(this.indicators);
64495
+ };
64496
+ /**
64497
+ * Returns the div element that should contain all the indicator containers.
64498
+ * Creates it if it doesn't already exist.
64499
+ * @internal
64500
+ */
64501
+ AccessibleIndicatorManager.prototype._getCollectionDiv = function () {
64502
+ var collection = this.map.getMapContainer()
64503
+ .querySelector("." + AccessibleIndicatorManager.Css.collection);
64504
+ if (!collection) {
64505
+ // If the collection div doesn't exist create it.
64506
+ collection = document.createElement("div");
64507
+ collection.setAttribute("aria-label", "map data");
64508
+ // Set the container role to listbox, and the descents' role to option, so the reader will read the listbox as a list.
64509
+ // For example, NVDA will read "data point, 1 of 1" when the indicator is focused.
64510
+ collection.setAttribute("role", "listbox");
64511
+ collection.classList.add(AccessibleIndicatorManager.Css.collection);
64512
+ this.map.getMapContainer().appendChild(collection);
64513
+ }
64514
+ return collection;
64515
+ };
64516
+ AccessibleIndicatorManager.Css = {
64517
+ collection: "accessible-indicator-collection-container"
64518
+ };
64519
+ return AccessibleIndicatorManager;
64520
+ }());
64521
+
63777
64522
  var __extends$18 = (window && window.__extends) || (function () {
63778
64523
  var extendStatics = function (d, b) {
63779
64524
  extendStatics = Object.setPrototypeOf ||
@@ -63800,7 +64545,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63800
64545
  };
63801
64546
  return __assign$9.apply(this, arguments);
63802
64547
  };
63803
- var __awaiter$3 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
64548
+ var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
63804
64549
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
63805
64550
  return new (P || (P = Promise))(function (resolve, reject) {
63806
64551
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -63809,7 +64554,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63809
64554
  step((generator = generator.apply(thisArg, _arguments || [])).next());
63810
64555
  });
63811
64556
  };
63812
- var __generator$3 = (window && window.__generator) || function (thisArg, body) {
64557
+ var __generator$4 = (window && window.__generator) || function (thisArg, body) {
63813
64558
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
63814
64559
  return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
63815
64560
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -63836,7 +64581,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63836
64581
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
63837
64582
  }
63838
64583
  };
63839
- var __read$d = (window && window.__read) || function (o, n) {
64584
+ var __read$e = (window && window.__read) || function (o, n) {
63840
64585
  var m = typeof Symbol === "function" && o[Symbol.iterator];
63841
64586
  if (!m) return o;
63842
64587
  var i = m.call(o), r, ar = [], e;
@@ -63852,12 +64597,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63852
64597
  }
63853
64598
  return ar;
63854
64599
  };
63855
- var __spreadArray$7 = (window && window.__spreadArray) || function (to, from) {
64600
+ var __spreadArray$9 = (window && window.__spreadArray) || function (to, from) {
63856
64601
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
63857
64602
  to[j] = from[i];
63858
64603
  return to;
63859
64604
  };
63860
- var __values$j = (window && window.__values) || function(o) {
64605
+ var __values$k = (window && window.__values) || function(o) {
63861
64606
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
63862
64607
  if (m) return m.call(o);
63863
64608
  if (o && typeof o.length === "number") return {
@@ -63963,6 +64708,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
63963
64708
  _this.markers = new HtmlMarkerManager(_this);
63964
64709
  _this.sources = new SourceManager(_this);
63965
64710
  _this.popups = new PopupManager(_this);
64711
+ _this.indicators = new AccessibleIndicatorManager(_this);
63966
64712
  // Add CSS classes and set attributes for DOM elements.
63967
64713
  _this.map.getContainer().classList.add(Map.Css.container);
63968
64714
  _this.map.getCanvasContainer().classList.add(Map.Css.canvasContainer);
@@ -64003,9 +64749,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64003
64749
  _this._setAutoResize(_this.styleOptions.autoResize);
64004
64750
  _this.map.showTileBoundaries = _this.styleOptions.showTileBoundaries;
64005
64751
  _this.localizedStringsPromise = Localizer.getStrings(_this.styleOptions.language);
64006
- var stylesInit = _this.styles.initStyleset();
64007
- Promise.all([authManInit, stylesInit]).then(function (_a) {
64008
- var _b = __read$d(_a, 2), _ = _b[0], definitions = _b[1];
64752
+ authManInit
64753
+ // reuses this.styles.initPromise if initStyleset is already called
64754
+ .then(function () { return _this.styles.definitions(); })
64755
+ .then(function (definitions) {
64009
64756
  // Check that the map hasn't been removed for any reason.
64010
64757
  // If so no need to finish styling the map.
64011
64758
  if (_this.removed) {
@@ -64035,7 +64782,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64035
64782
  _this.events.invoke("error", errorData);
64036
64783
  });
64037
64784
  // --> Set initial camera state of map
64038
- _this.setCamera(__assign$9(__assign$9({}, options), { type: "jump", duration: 0 }));
64785
+ _this.setCamera(__assign$9(__assign$9({
64786
+ // Default minZoom to ensure the map doesn't zoom out to unsupported zoom levels.
64787
+ minZoom: 1 }, options), { type: "jump", duration: 0 }));
64039
64788
  _this.flowDelegate = new FlowServiceDelegate(_this);
64040
64789
  _this.accessibleMapDelegate = new AccessibleMapDelegate(_this);
64041
64790
  _this.userInteractionDelegate = new UserInteractionDelegate(_this, options);
@@ -64066,6 +64815,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64066
64815
  }
64067
64816
  return _this;
64068
64817
  }
64818
+ Object.defineProperty(Map.prototype, "isDisposed", {
64819
+ /**
64820
+ * Returns true if the map has been disposed.
64821
+ */
64822
+ get: function () {
64823
+ return this.removed;
64824
+ },
64825
+ enumerable: false,
64826
+ configurable: true
64827
+ });
64069
64828
  /**
64070
64829
  * Returns the HTMLCanvasElement that the map is drawn to.
64071
64830
  */
@@ -64102,6 +64861,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64102
64861
  else {
64103
64862
  this.accessibleMapDelegate.removeFromMap();
64104
64863
  }
64864
+ var shouldReloadStyle = this.styles.serviceOptions.mapConfiguration !== this.serviceOptions.mapConfiguration
64865
+ || this.styles.serviceOptions.staticAssetsDomain !== this.serviceOptions.staticAssetsDomain
64866
+ || this.styles.serviceOptions.styleDefinitionsVersion !== this.serviceOptions.styleDefinitionsVersion
64867
+ || this.styles.serviceOptions.domain !== this.serviceOptions.domain
64868
+ || this.styles.serviceOptions.styleAPIVersion !== this.serviceOptions.styleAPIVersion;
64869
+ // NOTE: only perform a reload when the style dependent properties are changed
64870
+ //|| this.styles.serviceOptions.validateStyle !== this.serviceOptions.validateStyle
64871
+ //|| this.styles.serviceOptions.transformRequest !== this.serviceOptions.transformRequest
64872
+ this.styles.serviceOptions = this.serviceOptions;
64873
+ if (shouldReloadStyle) {
64874
+ this.styles.initPromise = null;
64875
+ this.setStyle({});
64876
+ }
64105
64877
  };
64106
64878
  /**
64107
64879
  * Adds request transformer
@@ -64130,6 +64902,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64130
64902
  if (!mapboxCameraOptions) {
64131
64903
  throw new Error("The map cannot be fit to the current canvas with the given CameraBoundsOptions.");
64132
64904
  }
64905
+ if ('pitch' in options) {
64906
+ mapboxCameraOptions.pitch = options.pitch;
64907
+ }
64908
+ if ('bearing' in options) {
64909
+ mapboxCameraOptions.bearing = options.bearing;
64910
+ }
64133
64911
  this.map.setMaxZoom(cameraBoundsOptions.maxZoom);
64134
64912
  this._invokeEvent("maxzoomchanged", this.map.getMaxZoom());
64135
64913
  maxBounds = this._generateSafeBounds(cameraBoundsOptions.maxBounds);
@@ -64252,8 +65030,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64252
65030
  // If this function is restructured such that a styledata event won't always trigger
64253
65031
  // if the language is changed, then either those delegates need changed
64254
65032
  // or the styledata event manually invoked.
65033
+ var noDiffOnLanguageViewChange = diff && (this.styleOptions.language === newOptions.language && this.styleOptions.view === newOptions.view);
64255
65034
  this.styleOptions = newOptions;
64256
- this._setStyleComponents(newOptions, diff);
65035
+ this._setStyleComponents(newOptions, noDiffOnLanguageViewChange);
64257
65036
  };
64258
65037
  /**
64259
65038
  * Returns the map control's current style settings.
@@ -64644,7 +65423,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64644
65423
  urls = layer.getOptions().subdomains || [];
64645
65424
  }
64646
65425
  // Add the tile urls to the layer, but don't update the map yet.
64647
- urls.push.apply(urls, __spreadArray$7([], __read$d(tileSources)));
65426
+ urls.push.apply(urls, __spreadArray$9([], __read$e(tileSources)));
64648
65427
  layer._setOptionsNoUpdate({
64649
65428
  subdomains: urls
64650
65429
  });
@@ -64666,7 +65445,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64666
65445
  Map.prototype.removeLayers = function (layerNames) {
64667
65446
  var e_1, _a;
64668
65447
  try {
64669
- for (var layerNames_1 = __values$j(layerNames), layerNames_1_1 = layerNames_1.next(); !layerNames_1_1.done; layerNames_1_1 = layerNames_1.next()) {
65448
+ for (var layerNames_1 = __values$k(layerNames), layerNames_1_1 = layerNames_1.next(); !layerNames_1_1.done; layerNames_1_1 = layerNames_1.next()) {
64670
65449
  var layerName = layerNames_1_1.value;
64671
65450
  // Previously calling removeLayers for layers that didn't exist in the map just did nothing.
64672
65451
  // Now, LayerManager will throw an error, so we need to check if the layer exists before calling remove.
@@ -64808,14 +65587,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64808
65587
  this.layers.clear();
64809
65588
  this.sources.clear();
64810
65589
  this.markers.clear();
65590
+ this.indicators.clear();
64811
65591
  };
64812
65592
  /**
64813
65593
  * Clean up the map's resources. Map will not function correctly after calling this method.
64814
65594
  */
64815
65595
  Map.prototype.dispose = function () {
65596
+ var _a;
64816
65597
  this.clear();
64817
65598
  this.map.remove();
65599
+ (_a = this.authentication) === null || _a === void 0 ? void 0 : _a.dispose();
64818
65600
  this.removed = true;
65601
+ // Remove event listeners
65602
+ window.removeEventListener("resize", this._windowResizeCallback);
64819
65603
  while (this.getMapContainer().firstChild) {
64820
65604
  var currChild = this.getMapContainer().firstChild;
64821
65605
  this.getMapContainer().removeChild(currChild);
@@ -64856,7 +65640,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64856
65640
  var e_2, _a;
64857
65641
  var positions = [];
64858
65642
  try {
64859
- for (var pixels_1 = __values$j(pixels), pixels_1_1 = pixels_1.next(); !pixels_1_1.done; pixels_1_1 = pixels_1.next()) {
65643
+ for (var pixels_1 = __values$k(pixels), pixels_1_1 = pixels_1.next(); !pixels_1_1.done; pixels_1_1 = pixels_1.next()) {
64860
65644
  var pixel = pixels_1_1.value;
64861
65645
  var lngLat = this.map.unproject(pixel);
64862
65646
  positions.push(new Position(lngLat.lng, lngLat.lat));
@@ -64879,7 +65663,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64879
65663
  var e_3, _a;
64880
65664
  var pixels = [];
64881
65665
  try {
64882
- for (var positions_1 = __values$j(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
65666
+ for (var positions_1 = __values$k(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
64883
65667
  var position = positions_1_1.value;
64884
65668
  var point = this.map.project(position);
64885
65669
  pixels.push(new Pixel(point.x, point.y));
@@ -64927,8 +65711,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
64927
65711
  */
64928
65712
  Map.prototype._rebuildStyle = function (diff) {
64929
65713
  if (diff === void 0) { diff = true; }
64930
- return __awaiter$3(this, void 0, void 0, function () {
64931
- return __generator$3(this, function (_a) {
65714
+ return __awaiter$4(this, void 0, void 0, function () {
65715
+ return __generator$4(this, function (_a) {
64932
65716
  this.styles.setStyle(this.styleOptions, diff);
64933
65717
  this.imageSprite._restoreImages();
64934
65718
  return [2 /*return*/];
@@ -65144,7 +65928,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65144
65928
  return Map;
65145
65929
  }(EventEmitter));
65146
65930
 
65147
- var __read$e = (window && window.__read) || function (o, n) {
65931
+ var __read$f = (window && window.__read) || function (o, n) {
65148
65932
  var m = typeof Symbol === "function" && o[Symbol.iterator];
65149
65933
  if (!m) return o;
65150
65934
  var i = m.call(o), r, ar = [], e;
@@ -65160,7 +65944,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65160
65944
  }
65161
65945
  return ar;
65162
65946
  };
65163
- var __spreadArray$8 = (window && window.__spreadArray) || function (to, from) {
65947
+ var __spreadArray$a = (window && window.__spreadArray) || function (to, from) {
65164
65948
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
65165
65949
  to[j] = from[i];
65166
65950
  return to;
@@ -65306,7 +66090,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65306
66090
  lineLength = 50;
65307
66091
  }
65308
66092
  var lines = c.split(/<(tr|div|br|li|h[0-9]|p>)/);
65309
- longestStringLength = Math.max.apply(Math, __spreadArray$8([], __read$e((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
66093
+ longestStringLength = Math.max.apply(Math, __spreadArray$a([], __read$f((lines.map(function (el) { return el.replace(/<[a-zA-Z0-9\s=\/]+>/g, "").length; }))))) - 1;
65310
66094
  var w = Math.ceil(longestStringLength * 3.5);
65311
66095
  if (w < width) {
65312
66096
  width = w;