azure-maps-control 2.1.16 → 2.2.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.
package/dist/atlas.js CHANGED
@@ -43209,7 +43209,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43209
43209
  domain: "atlas.microsoft.com",
43210
43210
  staticAssetsDomain: "atlas.microsoft.com",
43211
43211
  stylePath: "styling",
43212
- styleDefinitionsVersion: "2021-02-01",
43212
+ styleDefinitionsVersion: "2022-08-05",
43213
43213
  appInsightsKey: "e96cb745-c6f5-409c-a775-c4313e468c1d",
43214
43214
  aadInstance: "https://login.microsoftonline.com/"
43215
43215
  };
@@ -43217,6 +43217,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43217
43217
  apiVersionQueryParameter: "api-version",
43218
43218
  authorizationHeaderName: "Authorization",
43219
43219
  authorizationTokenPrefix: "Bearer ",
43220
+ jwtSasPrefix: "jwt-sas ",
43220
43221
  domainPlaceHolder: "{{azMapsDomain}}",
43221
43222
  legacyDomainPlaceHolder: "{azMapsDomain}",
43222
43223
  viewPlaceHolder: "{{azMapsView}}",
@@ -43487,7 +43488,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43487
43488
  return Url;
43488
43489
  }());
43489
43490
 
43490
- var version = "2.1.16";
43491
+ var version = "2.2.0";
43491
43492
 
43492
43493
  /**
43493
43494
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -43845,7 +43846,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43845
43846
  delete this._container;
43846
43847
  }
43847
43848
  if (this._map) {
43848
- this._map.events.remove("styledata", this._onStyleChange);
43849
+ this._map.events.remove("stylechanged", this._onStyleChange);
43849
43850
  delete this._map;
43850
43851
  }
43851
43852
  if (this._observer) {
@@ -43869,7 +43870,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43869
43870
  if (style.toLowerCase() === exports.ControlStyle.auto) {
43870
43871
  this._map.styles.definitions().then(function (definitions) {
43871
43872
  if (_this._map) {
43872
- _this._map.events.add("styledata", _this._onStyleChange);
43873
+ _this._map.events.add("stylechanged", _this._onStyleChange);
43873
43874
  }
43874
43875
  });
43875
43876
  }
@@ -43982,6 +43983,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43982
43983
  }
43983
43984
  }
43984
43985
  });
43986
+ // Keep the focus on this control when esc key is pressed on the grid
43987
+ grid.addEventListener("keydown", function (event) {
43988
+ if (event.key === "Escape" || event.key === "Esc") {
43989
+ event.stopPropagation();
43990
+ rotationButton.focus();
43991
+ container.classList.remove("in-use");
43992
+ grid.classList.add("hidden-accessible-element");
43993
+ }
43994
+ });
43985
43995
  // If the control's position will require inverting the element order
43986
43996
  // add them in the opposite order to preserve tabindex.
43987
43997
  if (options && CompassControl.InvertOrderPositions.includes(options.position)) {
@@ -44129,6 +44139,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44129
44139
  var _this = _super.call(this) || this;
44130
44140
  _this.container = null;
44131
44141
  _this.map = null;
44142
+ _this.pitchButton = null;
44132
44143
  _this.pitchIncrementButton = null;
44133
44144
  _this.pitchDecrementButton = null;
44134
44145
  _this.hasMouse = false;
@@ -44137,6 +44148,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44137
44148
  _this.updatePitchButtonsState = function () {
44138
44149
  var minPitchReached = _this.map.getCamera().pitch <= 0;
44139
44150
  var maxPitchReached = _this.map.getCamera().pitch >= 60;
44151
+ // Keep the focus on this control when max/min pitch is reached
44152
+ if (_this.hasFocus && _this.pitchButton && (minPitchReached || maxPitchReached)) {
44153
+ _this.pitchButton.focus();
44154
+ }
44140
44155
  if (_this.options.inverted) {
44141
44156
  if (_this.pitchIncrementButton && _this.pitchIncrementButton.disabled != minPitchReached) {
44142
44157
  _this.pitchIncrementButton.disabled = minPitchReached;
@@ -44199,6 +44214,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44199
44214
  }
44200
44215
  }
44201
44216
  });
44217
+ // Keep the focus on this control when esc key is pressed on the grid
44218
+ grid.addEventListener("keydown", function (event) {
44219
+ if (event.key === "Escape" || event.key === "Esc") {
44220
+ event.stopPropagation();
44221
+ pitchButton.focus();
44222
+ container.classList.remove("in-use");
44223
+ grid.classList.add("hidden-accessible-element");
44224
+ }
44225
+ });
44202
44226
  // If the control's position will require inverting the element order
44203
44227
  // add them in the opposite order to preserve tabindex.
44204
44228
  if (options && PitchControl.INVERT_ORDER_POSITIONS.includes(options.position)) {
@@ -44215,6 +44239,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44215
44239
  }
44216
44240
  this.map = map;
44217
44241
  this.container = container;
44242
+ this.pitchButton = pitchButton;
44218
44243
  map.events.add('pitch', this.pitchChanged);
44219
44244
  this.updatePitchButtonsState();
44220
44245
  return container;
@@ -44223,6 +44248,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
44223
44248
  if (this.container) {
44224
44249
  this.container.remove();
44225
44250
  this.container = null;
44251
+ this.pitchButton = null;
44226
44252
  this.pitchIncrementButton = null;
44227
44253
  this.pitchDecrementButton = null;
44228
44254
  }
@@ -47473,7 +47499,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47473
47499
  _this.setSelectedStyle(newStyle);
47474
47500
  }
47475
47501
  };
47476
- _this.onStylesetChange = function (definitions) {
47502
+ _this.onMapConfigurationChange = function (definitions) {
47477
47503
  if (!_this.styleOpsGrid) {
47478
47504
  return;
47479
47505
  }
@@ -47481,8 +47507,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47481
47507
  _this.styleButtons.clear();
47482
47508
  _this.populateOpsGridFromDefinitions(definitions);
47483
47509
  };
47484
- _this.mapToFriendlyStyleName = function (name, styleset) {
47485
- var style = styleset.styles.find(function (style) { return style.name === name; });
47510
+ _this.mapToFriendlyStyleName = function (name, mapConfiguration) {
47511
+ var style = mapConfiguration.configurations.find(function (style) { return style.name === name; });
47486
47512
  return (style === null || style === void 0 ? void 0 : style.displayName) || name;
47487
47513
  };
47488
47514
  _this.options = new StyleControlOptions().merge(cloneDeep_1(options));
@@ -47577,8 +47603,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47577
47603
  _super.prototype.onRemove.call(this);
47578
47604
  this.styleOpsGrid = null;
47579
47605
  this.styleButtons.clear();
47580
- this.map.events.remove("styledata", this.onStyleChange);
47581
- this.map.events.remove("stylesetchanged", this.onStylesetChange);
47606
+ this.map.events.remove("stylechanged", this.onStyleChange);
47607
+ this.map.events.remove("mapconfigurationchanged", this.onMapConfigurationChange);
47582
47608
  };
47583
47609
  /**
47584
47610
  * Set the style that need to be displayed as currently selected.
@@ -47597,8 +47623,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47597
47623
  var _b = __read(_a, 2), buttonStyleName = _b[0], button = _b[1];
47598
47624
  return button.setAttribute('aria-current', buttonStyleName === styleName ? 'true' : 'false');
47599
47625
  });
47600
- this.map.styles.definitions().then(function (styleset) {
47601
- var newAlt = _this.mapToFriendlyStyleName(styleName, styleset);
47626
+ this.map.styles.definitions().then(function (mapConfiguration) {
47627
+ var newAlt = _this.mapToFriendlyStyleName(styleName, mapConfiguration);
47602
47628
  if (image_1.alt !== newAlt) {
47603
47629
  image_1.alt = newAlt;
47604
47630
  }
@@ -47628,11 +47654,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47628
47654
  styleButton.removeAttribute("disabled");
47629
47655
  }
47630
47656
  };
47631
- StyleControl.prototype.buildSelectStyleBtn = function (name, styleset, fetchIconPromise) {
47657
+ StyleControl.prototype.buildSelectStyleBtn = function (name, mapConfiguration, fetchIconPromise) {
47632
47658
  var _this = this;
47633
47659
  var styleOptionButton = document.createElement("button");
47634
- var friendlyName = this.mapToFriendlyStyleName(name, styleset);
47635
- styleOptionButton.setAttribute("alt", friendlyName);
47660
+ var friendlyName = this.mapToFriendlyStyleName(name, mapConfiguration);
47661
+ styleOptionButton.setAttribute("aria-label", friendlyName);
47636
47662
  styleOptionButton.setAttribute("type", "button");
47637
47663
  var styleIconImage = new Image();
47638
47664
  fetchIconPromise
@@ -47652,9 +47678,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47652
47678
  }
47653
47679
  _this.styleIcons.set(name, iconUrl);
47654
47680
  });
47655
- if (this.options.layout === "icons") {
47656
- styleIconImage.alt = friendlyName;
47657
- }
47681
+ styleIconImage.setAttribute("aria-hidden", "true");
47658
47682
  styleOptionButton.appendChild(styleIconImage);
47659
47683
  if (this.options.layout === "icons") {
47660
47684
  styleOptionButton.classList.add(StyleControl.Css.button);
@@ -47694,7 +47718,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47694
47718
  }
47695
47719
  selectCurrButton.classList.add(StyleControl.Css.currentStyle);
47696
47720
  selectCurrButton.setAttribute("aria-label", "Select Style");
47697
- selectCurrButton.setAttribute("alt", "Select Style");
47698
47721
  selectCurrButton.setAttribute("tabindex", "-1");
47699
47722
  this.currStyleImage = new Image();
47700
47723
  selectCurrButton.appendChild(this.currStyleImage);
@@ -47719,12 +47742,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47719
47742
  // If a style is one of those to be shown by the style picker also create it's element.
47720
47743
  this.map.styles.definitions().then(function (definitions) { return __awaiter(_this, void 0, void 0, function () {
47721
47744
  return __generator(this, function (_a) {
47722
- this.onStylesetChange(definitions);
47723
- this.map.events.add("styledata", this.onStyleChange);
47745
+ this.onMapConfigurationChange(definitions);
47746
+ this.map.events.add("stylechanged", this.onStyleChange);
47724
47747
  return [2 /*return*/];
47725
47748
  });
47726
47749
  }); });
47727
- this.map.events.add("stylesetchanged", this.onStylesetChange);
47750
+ this.map.events.add("mapconfigurationchanged", this.onMapConfigurationChange);
47728
47751
  return styleOpsGrid;
47729
47752
  };
47730
47753
  StyleControl.prototype.populateOpsGridFromDefinitions = function (definitions) {
@@ -47732,7 +47755,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47732
47755
  if (!this.styleOpsGrid) {
47733
47756
  return;
47734
47757
  }
47735
- var styles = definitions.styles;
47758
+ var styles = definitions.configurations;
47736
47759
  if (Array.isArray(this.options.mapStyles)) {
47737
47760
  styles = styles.filter(function (style) { return _this.options.mapStyles.includes(style.name.split("_indoor")[0]); });
47738
47761
  }
@@ -47970,6 +47993,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47970
47993
  _this.table = ["Fast",
47971
47994
  ["green", "yellow", "red", "dark-red"],
47972
47995
  "Slow"];
47996
+ _this.map = null;
47997
+ _this.syncHiddenState = null;
47973
47998
  return _this;
47974
47999
  }
47975
48000
  /**
@@ -47979,11 +48004,21 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47979
48004
  * @return An HTMLElement to be placed on the map for the control.
47980
48005
  */
47981
48006
  TrafficLegendControl.prototype.onAdd = function (map) {
48007
+ this.map = map;
47982
48008
  var container = this.buildContainer(map, exports.ControlStyle.auto, "Traffic Legend");
47983
48009
  var TrafficLegendDiv = this.buildTrafficLegendDiv(map);
48010
+ container.setAttribute("role", "definition");
47984
48011
  container.appendChild(TrafficLegendDiv);
47985
48012
  return container;
47986
48013
  };
48014
+ TrafficLegendControl.prototype.onRemove = function () {
48015
+ _super.prototype.onRemove.call(this);
48016
+ if (this.syncHiddenState) {
48017
+ this.map.events.remove('styledata', this.syncHiddenState);
48018
+ this.syncHiddenState = null;
48019
+ }
48020
+ this.map = null;
48021
+ };
47987
48022
  TrafficLegendControl.prototype.buildTrafficLegendDiv = function (map) {
47988
48023
  var e_1, _a, e_2, _b;
47989
48024
  var trafficLegend = document.createElement("div");
@@ -48048,8 +48083,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48048
48083
  }
48049
48084
  trafficLegendTable.appendChild(tr2);
48050
48085
  trafficLegend.appendChild(trafficLegendTable);
48051
- // display legend when the traffic flow is shown, hide it otherwise
48052
- map.events.add("styledata", function (eventData) {
48086
+ this.syncHiddenState = function (eventData) {
48053
48087
  if (eventData.dataType === "style") {
48054
48088
  var trafficOptions = map.getTraffic();
48055
48089
  if (trafficOptions.flow && trafficOptions.flow !== "none") {
@@ -48059,7 +48093,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
48059
48093
  trafficLegend.classList.add("hidden");
48060
48094
  }
48061
48095
  }
48062
- });
48096
+ };
48097
+ // display legend when the traffic flow is shown, hide it otherwise
48098
+ this.syncHiddenState({ dataType: 'style' });
48099
+ map.events.add("styledata", this.syncHiddenState);
48063
48100
  return trafficLegend;
48064
48101
  };
48065
48102
  return TrafficLegendControl;
@@ -52185,6 +52222,151 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
52185
52222
  return MultiPolygon;
52186
52223
  }());
52187
52224
 
52225
+ //Based on: https://github.com/mapbox/mapbox-gl-js/blob/main/src/geo/mercator_coordinate.js
52226
+ /**
52227
+ * A `MercatorPoint` object represents a projected three dimensional position.
52228
+ *
52229
+ * `MercatorPoint` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
52230
+ * - the size of 1 unit is the width of the projected world instead of the "mercator meter"
52231
+ * - the origin of the coordinate space is at the north-west corner instead of the middle.
52232
+ *
52233
+ * For example, `MercatorPoint(0, 0, 0)` is the north-west corner of the mercator world and
52234
+ * `MercatorPoint(1, 1, 0)` is the south-east corner. If you are familiar with
52235
+ * [vector tiles](https://github.com/mapbox/vector-tile-spec) it may be helpful to think
52236
+ * of the coordinate space as the `0/0/0` tile with an extent of `1`.
52237
+ *
52238
+ * The `z` dimension of `MercatorPoint` is conformal. A cube in the mercator coordinate space would be rendered as a cube.
52239
+ */
52240
+ var MercatorPoint = /** @class */ (function (_super) {
52241
+ __extends(MercatorPoint, _super);
52242
+ /**
52243
+ * Constructs a MercatorPoint.
52244
+ * @param x A points x position in mercator units.
52245
+ * @param y A points y position in mercator units.
52246
+ * @param z A points z position in mercator units.
52247
+ */
52248
+ function MercatorPoint(x, y, z) {
52249
+ return _super.call(this, x, y, z ? z : 0) || this;
52250
+ }
52251
+ /***********************************
52252
+ * Public static functions
52253
+ ***********************************/
52254
+ /**
52255
+ * Converts a position into a mercator point.
52256
+ * @param position Position to convert.
52257
+ * @returns A mercator point.
52258
+ */
52259
+ MercatorPoint.fromPosition = function (position) {
52260
+ if (position.length >= 2) {
52261
+ return new MercatorPoint((180 + position[0]) / 360, MercatorPoint._latToMercatorY(position[1]), position.length >= 3 ? MercatorPoint._altitudeToMercatorZ(position[2], position[1]) : 0);
52262
+ }
52263
+ return [0, 0, 0];
52264
+ };
52265
+ /**
52266
+ * Converts an array of positions into an array of mercator points.
52267
+ * @param positions Array of positions to convert.
52268
+ * @returns An array of mercator points.
52269
+ */
52270
+ MercatorPoint.fromPositions = function (positions) {
52271
+ var mercators = [];
52272
+ for (var i = 0, len = positions.length; i < len; i++) {
52273
+ mercators.push(this.fromPosition(positions[i]));
52274
+ }
52275
+ return mercators;
52276
+ };
52277
+ /**
52278
+ * Converts an array of positions into a Float32Array of mercator xyz values.
52279
+ * @param positions Array of positions to convert.
52280
+ * @returns A Float32Array of mercator xyz values.
52281
+ */
52282
+ MercatorPoint.toFloat32Array = function (positions) {
52283
+ var arr = new Float32Array(positions.length * 3);
52284
+ for (var i = 0, len = positions.length; i < len; i++) {
52285
+ var idx = i * 3;
52286
+ var p = positions[i];
52287
+ //x
52288
+ arr[idx] = (180 + p[0]) / 360;
52289
+ //y
52290
+ arr[idx + 1] = MercatorPoint._latToMercatorY(p[1]);
52291
+ //z
52292
+ arr[idx + 2] = p.length >= 3 ? MercatorPoint._altitudeToMercatorZ(p[2], p[1]) : 0;
52293
+ }
52294
+ return arr;
52295
+ };
52296
+ /**
52297
+ * Converts a mercator point into a map position.
52298
+ * @param mercator Mercator point to convert.
52299
+ * @returns A map position.
52300
+ */
52301
+ MercatorPoint.toPosition = function (mercator) {
52302
+ if (mercator.length >= 2) {
52303
+ var lat = (360 / Math.PI) * Math.atan(Math.exp(((180 - mercator[1] * 360) * Math.PI) / 180)) - 90;
52304
+ return new Position(mercator[0] * 360 - 180, lat, mercator.length >= 3 ? MercatorPoint._mercatorZToAltitude(mercator[2], mercator[1]) : 0);
52305
+ }
52306
+ return [0, 0, 0];
52307
+ };
52308
+ /**
52309
+ * Converts an array of mercator points into an array of map positions.
52310
+ * @param mercators Mercator points to convert.
52311
+ * @returns An array of map positions.
52312
+ */
52313
+ MercatorPoint.toPositions = function (mercators) {
52314
+ var positions = [];
52315
+ for (var i = 0, len = mercators.length; i < len; i++) {
52316
+ positions.push(this.toPosition(mercators[i]));
52317
+ }
52318
+ return positions;
52319
+ };
52320
+ /**
52321
+ * Determine the Mercator scale factor for a given latitude, see
52322
+ * https://en.wikipedia.org/wiki/Mercator_projection#Scale_factor
52323
+ *
52324
+ * At the equator the scale factor will be 1, which increases at higher latitudes.
52325
+ *
52326
+ * @param latitude Latitude
52327
+ * @returns The mercator scale factor.
52328
+ */
52329
+ MercatorPoint.mercatorScale = function (latitude) {
52330
+ return 1 / Math.cos((latitude * Math.PI) / 180);
52331
+ };
52332
+ /**
52333
+ * Returns the distance of 1 meter in `MercatorPoint` units at this latitude.
52334
+ *
52335
+ * For coordinates in real world units using meters, this naturally provides the scale
52336
+ * to transform into `MercatorPoint`s.
52337
+ *
52338
+ * @returns {number} Distance of 1 meter in `MercatorPoint` units.
52339
+ */
52340
+ MercatorPoint.meterInMercatorUnits = function (latitude) {
52341
+ // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
52342
+ return ((1 / MercatorPoint.earthCircumference) *
52343
+ MercatorPoint.mercatorScale(MercatorPoint._latToMercatorY(latitude)));
52344
+ };
52345
+ /***********************************
52346
+ * Private static functions
52347
+ ***********************************/
52348
+ /*
52349
+ * The circumference at a line of latitude in meters.
52350
+ */
52351
+ MercatorPoint._circumferenceAtLatitude = function (latitude) {
52352
+ return MercatorPoint.earthCircumference * Math.cos((latitude * Math.PI) / 180);
52353
+ };
52354
+ MercatorPoint._altitudeToMercatorZ = function (altitude, latitude) {
52355
+ return altitude / MercatorPoint._circumferenceAtLatitude(latitude);
52356
+ };
52357
+ MercatorPoint._mercatorZToAltitude = function (zoom, y) {
52358
+ return zoom * MercatorPoint._circumferenceAtLatitude(MercatorPoint._latToMercatorY(y));
52359
+ };
52360
+ MercatorPoint._latToMercatorY = function (y) {
52361
+ return (180 - (180 / Math.PI) * Math.log(Math.tan(Math.PI / 4 + (y * Math.PI) / 360))) / 360;
52362
+ };
52363
+ /*
52364
+ * The average circumference of the world in meters.
52365
+ */
52366
+ MercatorPoint.earthCircumference = 2 * Math.PI * getEarthRadius(); // meters
52367
+ return MercatorPoint;
52368
+ }(Array));
52369
+
52188
52370
 
52189
52371
 
52190
52372
  var index$1 = /*#__PURE__*/Object.freeze({
@@ -52196,6 +52378,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
52196
52378
  Polygon: Polygon,
52197
52379
  Position: Position,
52198
52380
  BoundingBox: BoundingBox,
52381
+ MercatorPoint: MercatorPoint,
52199
52382
  MultiLineString: MultiLineString,
52200
52383
  MultiPoint: MultiPoint,
52201
52384
  MultiPolygon: MultiPolygon,
@@ -52612,6 +52795,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
52612
52795
  return this.container;
52613
52796
  };
52614
52797
  ZoomControl.prototype.onRemove = function () {
52798
+ _super.prototype.onRemove.call(this);
52615
52799
  if (this.map) {
52616
52800
  this.map.events.remove('zoom', this.zoomChanged);
52617
52801
  this.map.events.remove('minzoomchanged', this.minZoomChanged);
@@ -55479,6 +55663,155 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55479
55663
  return TileLayer;
55480
55664
  }(SourceBuildingLayer));
55481
55665
 
55666
+ /**
55667
+ * Options used to render graphics in a WebGLLayer.
55668
+ */
55669
+ var WebGLLayerOptions = /** @class */ (function (_super) {
55670
+ __extends(WebGLLayerOptions, _super);
55671
+ function WebGLLayerOptions() {
55672
+ var _this = _super !== null && _super.apply(this, arguments) || this;
55673
+ /**
55674
+ * An object that contains the rendering logic.
55675
+ */
55676
+ _this.renderer = undefined;
55677
+ return _this;
55678
+ }
55679
+ return WebGLLayerOptions;
55680
+ }(LayerOptions));
55681
+
55682
+ /**
55683
+ * Enables custom rendering logic with access to the WebGL context of the map.
55684
+ */
55685
+ var WebGLLayer = /** @class */ (function (_super) {
55686
+ __extends(WebGLLayer, _super);
55687
+ /**
55688
+ * Constructs a new WebGLLayer.
55689
+ * @param id The id of the layer. If not specified a random one will be generated.
55690
+ * @param options The options of the WebGL layer.
55691
+ */
55692
+ function WebGLLayer(id, options) {
55693
+ var _this = _super.call(this, id) || this;
55694
+ /**
55695
+ * Make sure the layer is available after a style change.
55696
+ * @internal
55697
+ */
55698
+ _this._onStyleChange = function () {
55699
+ var _a;
55700
+ // Custom layers cannot be serialized and preserved by mapbox.
55701
+ // Add this layer again if the layer was removed by mapbox after a style change.
55702
+ if (!_this.map._getMap().getLayer(_this.id)) {
55703
+ var map = _this.map;
55704
+ var before_1 = (_a = _this.map.layers._getUserLayers().find(function (l) { return l.layer.getId() == _this.id; })) === null || _a === void 0 ? void 0 : _a.before;
55705
+ map.layers.remove(_this);
55706
+ map.layers.add(_this, before_1);
55707
+ }
55708
+ };
55709
+ _this.options = new WebGLLayerOptions().merge(cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
55710
+ _this.source = new DataSource();
55711
+ return _this;
55712
+ }
55713
+ /**
55714
+ * Gets the options of the WebGL layer.
55715
+ */
55716
+ WebGLLayer.prototype.getOptions = function () {
55717
+ // Copy the options so the user can't directly change options.
55718
+ // They must use setOptions(...).
55719
+ return cloneDeepWith_1(this.options, WebGLLayerOptions._cloneCustomizer);
55720
+ };
55721
+ /**
55722
+ * Sets the options of the WebGL layer.
55723
+ * @param options The new options of the WebGL layer.
55724
+ */
55725
+ WebGLLayer.prototype.setOptions = function (options) {
55726
+ var newOptions = new WebGLLayerOptions().merge(this.options, cloneDeepWith_1(options, WebGLLayerOptions._cloneCustomizer));
55727
+ // Trigger a repaint of the map if the layer options have changed.
55728
+ if (this.map) {
55729
+ this.map.triggerRepaint();
55730
+ }
55731
+ this.options = newOptions;
55732
+ };
55733
+ WebGLLayer.prototype.onAdd = function (map) {
55734
+ var _a, _b;
55735
+ _super.prototype.onAdd.call(this, map);
55736
+ // Make sure the layer is available after a style change.
55737
+ this.map.events.add("stylechanged", this._onStyleChange);
55738
+ // Notify the renderer this layer has been added to the map.
55739
+ if (this.options.renderer && this.glContext) {
55740
+ (_b = (_a = this.options.renderer).onAdd) === null || _b === void 0 ? void 0 : _b.call(_a, map, this.glContext);
55741
+ }
55742
+ };
55743
+ WebGLLayer.prototype.onRemove = function () {
55744
+ var _a, _b;
55745
+ // Notify the renderer this layer has been removed from the map.
55746
+ if (this.options.renderer && this.glContext) {
55747
+ (_b = (_a = this.options.renderer).onRemove) === null || _b === void 0 ? void 0 : _b.call(_a, this.map, this.glContext);
55748
+ }
55749
+ // Cleanup
55750
+ this.map.events.remove("stylechanged", this._onStyleChange);
55751
+ this.glContext = null;
55752
+ _super.prototype.onRemove.call(this);
55753
+ };
55754
+ /**
55755
+ * @internal
55756
+ */
55757
+ WebGLLayer.prototype._buildLayers = function () {
55758
+ var _this = this;
55759
+ if (!this.options.renderer) {
55760
+ throw new Error("Cannot build the WebGL layer because renderer was not set.");
55761
+ }
55762
+ return [
55763
+ {
55764
+ id: this.id,
55765
+ type: "custom",
55766
+ renderingMode: this.options.renderer.renderingMode,
55767
+ onAdd: function (m, gl) {
55768
+ // Capture the GL context to reuse it later.
55769
+ // renderer.onAdd will be called in the onAdd callback of this layer.
55770
+ _this.glContext = gl;
55771
+ },
55772
+ onRemove: function (m, gl) {
55773
+ // renderer.onRemove will be called in the onRemove callback of this layer.
55774
+ },
55775
+ prerender: function (gl, matrix) {
55776
+ var _a, _b;
55777
+ if (_this._shouldRender()) {
55778
+ (_b = (_a = _this.options.renderer).prerender) === null || _b === void 0 ? void 0 : _b.call(_a, gl, matrix);
55779
+ }
55780
+ },
55781
+ render: function (gl, matrix) {
55782
+ if (_this._shouldRender()) {
55783
+ _this.options.renderer.render(gl, matrix);
55784
+ }
55785
+ }
55786
+ }
55787
+ ];
55788
+ };
55789
+ /**
55790
+ * @internal
55791
+ */
55792
+ WebGLLayer.prototype._getLayerIds = function () {
55793
+ return [this.id];
55794
+ };
55795
+ /**
55796
+ * @internal
55797
+ */
55798
+ WebGLLayer.prototype._getSourceIds = function () {
55799
+ return new Set().add(this.source.getId());
55800
+ };
55801
+ /**
55802
+ * Returns true if the next frame should be rendered
55803
+ * @internal
55804
+ */
55805
+ WebGLLayer.prototype._shouldRender = function () {
55806
+ if (this.map) {
55807
+ var zoom = this.map.getCamera().zoom;
55808
+ return this.options.visible && this.options.minZoom <= zoom && this.options.maxZoom > zoom;
55809
+ }
55810
+ return false;
55811
+ };
55812
+ return WebGLLayer;
55813
+ }(Layer));
55814
+
55482
55815
 
55483
55816
 
55484
55817
  var index$5 = /*#__PURE__*/Object.freeze({
@@ -55491,7 +55824,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55491
55824
  SymbolLayer: SymbolLayer,
55492
55825
  TileLayer: TileLayer,
55493
55826
  HeatMapLayer: HeatMapLayer,
55494
- ImageLayer: ImageLayer
55827
+ ImageLayer: ImageLayer,
55828
+ WebGLLayer: WebGLLayer
55495
55829
  });
55496
55830
 
55497
55831
  var Html = /** @class */ (function () {
@@ -55890,6 +56224,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55890
56224
  // They must use setOptions(...).
55891
56225
  return cloneDeepWith_1(this.options, PopupOptions._cloneCustomizer);
55892
56226
  };
56227
+ /**
56228
+ * Returns popup container element.
56229
+ */
56230
+ Popup.prototype.getPopupContainer = function () {
56231
+ return this.containerDiv;
56232
+ };
55893
56233
  /**
55894
56234
  * Drags the popup to the specified pixel.
55895
56235
  * Accounts for the pixel offset when dragging started.
@@ -56919,6 +57259,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56919
57259
  * Literal value `"anonymous"`
56920
57260
  */
56921
57261
  AuthenticationType["anonymous"] = "anonymous";
57262
+ /**
57263
+ * The shared access signature authentication mechanism. Allows a callback responsible for acquiring a token to be provided on requests.
57264
+ * Literal value `"sas"`.
57265
+ */
57266
+ AuthenticationType["sas"] = "sas";
56922
57267
  })(exports.AuthenticationType || (exports.AuthenticationType = {}));
56923
57268
  /**
56924
57269
  * Options for specifying how the map control should authenticate with the Azure Maps services.
@@ -56958,11 +57303,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56958
57303
  */
56959
57304
  _this.aadInstance = undefined;
56960
57305
  /**
56961
- * A callback to use with the anonymous authentication mechanism.
57306
+ * A callback to use with the anonymous/sas authentication mechanism.
56962
57307
  * This callback will be responsible for resolving to a authentication token.
56963
57308
  * E.g. fetching a CORS protected token from an endpoint.
56964
57309
  */
56965
57310
  _this.getToken = undefined;
57311
+ /**
57312
+ * Optionally provide an initial token for sas authentication.
57313
+ */
57314
+ _this.sasToken = undefined;
56966
57315
  /**
56967
57316
  * Optionally provide an existing `AuthenticationContext` from the ADAL.js library.
56968
57317
  * This authentication context will be used to acquire the AAD token.
@@ -57005,6 +57354,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57005
57354
  this.authType = exports.AuthenticationType.anonymous;
57006
57355
  this.getToken = getTokenCallback;
57007
57356
  };
57357
+ /**
57358
+ * Sets the required options to configure the sas authentication method.
57359
+ * @param getTokenCallback Callback function responsible for resolving to an authentication token.
57360
+ */
57361
+ AuthenticationOptions.prototype.setSasCallbackFunction = function (getTokenCallback) {
57362
+ this.authType = exports.AuthenticationType.sas;
57363
+ this.getToken = getTokenCallback;
57364
+ };
57008
57365
  /**
57009
57366
  * Override the standard merge behavior to handle mutually exclusive options.
57010
57367
  * @internal
@@ -57024,6 +57381,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57024
57381
  else if (merged.authType === exports.AuthenticationType.anonymous) {
57025
57382
  merged.subscriptionKey = merged.authContext = merged.aadAppId = undefined;
57026
57383
  }
57384
+ else if (merged.authType === exports.AuthenticationType.sas) {
57385
+ merged.authContext = merged.subscriptionKey = merged.aadAppId = undefined;
57386
+ }
57027
57387
  return merged;
57028
57388
  };
57029
57389
  return AuthenticationOptions;
@@ -67931,7 +68291,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
67931
68291
  path: "search/address/reverse/json",
67932
68292
  queryParams: __assign({ "api-version": "1.0", "language": options.style.language, "limit": 1, "query": normalizeLatitude(options.position[1]) + "," + normalizeLongitude(options.position[0]) }, (options.style.view && { view: options.style.view }))
67933
68293
  };
67934
- return new Url((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)).get();
68294
+ return new Url(((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)) || urlOptions).get();
67935
68295
  };
67936
68296
  return NearbyGeographySearchService;
67937
68297
  }());
@@ -69135,8 +69495,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69135
69495
  _this.createMapKeyBindingInfo();
69136
69496
  _this.map.getMapContainer().setAttribute("role", "application");
69137
69497
  _this.map.getMapContainer().setAttribute("aria-label", "Map Application");
69498
+ _this.map.getCanvasContainer().setAttribute("aria-live", "polite");
69499
+ _this.map.getCanvasContainer().setAttribute("aria-describedby", "atlas-map-state atlas-map-style");
69138
69500
  _this.map.getCanvas().setAttribute("aria-label", "Interactive Map");
69139
- _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-state atlas-map-style atlas-map-shortcuts");
69501
+ _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-shortcuts");
69140
69502
  _this.map.getCanvas().setAttribute("alt", "Interactive Map");
69141
69503
  };
69142
69504
  this.removeFromMap = function () {
@@ -69158,10 +69520,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69158
69520
  delete _this.atlasMapStyleInfo;
69159
69521
  _this.map.getMapContainer().removeAttribute("role");
69160
69522
  _this.map.getMapContainer().removeAttribute("aria-label");
69523
+ _this.map.getCanvasContainer().removeAttribute("aria-live");
69524
+ _this.map.getCanvasContainer().removeAttribute("aria-describedby");
69161
69525
  _this.map.getCanvas().removeAttribute("aria-label");
69162
69526
  _this.map.getCanvas().removeAttribute("aria-describedby");
69163
69527
  _this.map.getCanvas().removeAttribute("alt");
69164
- _this.map.events.remove("styledata", _this.updateMapStyle);
69528
+ _this.map.events.remove("stylechanged", _this.updateMapStyle);
69165
69529
  };
69166
69530
  this.createMapKeyBindingInfo = function () {
69167
69531
  _this.atlasMapKeyBindings = document.createElement("div");
@@ -69186,7 +69550,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69186
69550
  "Jump focus to the map: Escape."
69187
69551
  ].join("\n");
69188
69552
  _this.map.getCanvasContainer().appendChild(_this.atlasMapKeyBindings);
69189
- _this.atlasMapKeyBindings.setAttribute("aria-live", "polite");
69190
69553
  var baseShortcutKeyCodes = [
69191
69554
  // - (zoom out)
69192
69555
  189,
@@ -69218,7 +69581,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69218
69581
  _this.atlasMapLiveStateInfo.id = "atlas-map-state";
69219
69582
  _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
69220
69583
  _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
69221
- _this.atlasMapLiveStateInfo.setAttribute("aria-live", "assertive");
69222
69584
  }
69223
69585
  };
69224
69586
  this.initializeMapStyleInfo = function () {
@@ -69227,10 +69589,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69227
69589
  _this.atlasMapStyleInfo.setAttribute("aria-hidden", "true");
69228
69590
  _this.atlasMapStyleInfo.id = "atlas-map-style";
69229
69591
  _this.atlasMapStyleInfo.classList.add("hidden-accessible-element");
69230
- _this.updateMapStyle();
69231
- _this.map.events.add("styledata", _this.updateMapStyle);
69592
+ _this.map.events.add("stylechanged", _this.updateMapStyle);
69232
69593
  _this.map.getCanvasContainer().appendChild(_this.atlasMapStyleInfo);
69233
- _this.atlasMapStyleInfo.setAttribute("aria-live", "polite");
69234
69594
  };
69235
69595
  this.updateMapStyle = function () {
69236
69596
  _this.atlasMapStyleInfo.innerHTML = "<p>Map style: " + _this.map.getStyle().style + ".</p>";
@@ -69528,15 +69888,106 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69528
69888
  _this.map.layers.add(_this.incidentLayer, "labels");
69529
69889
  }
69530
69890
  //Create a popup but leave it closed so we can update it and display it later.
69531
- _this.popup = new Popup({
69891
+ _this.clickPopup = new Popup({
69532
69892
  position: [0, 0],
69533
69893
  pixelOffset: [0, -18]
69534
69894
  });
69535
69895
  _this.map.addEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
69536
69896
  _this.map.addEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
69537
69897
  _this.map.addEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
69898
+ _this.map.events.addOnce('idle', _this.setAccessiblePopups);
69899
+ _this.map.events.add('moveend', _this.setAccessiblePopups);
69538
69900
  };
69901
+ this.accessiblePopups = [];
69902
+ this.setAccessiblePopups = function () { return __awaiter(_this, void 0, void 0, function () {
69903
+ var features, localizedStrings, createPopup, insertHiddenBefore, insertHiddenInFront, addHidden;
69904
+ var _this = this;
69905
+ return __generator(this, function (_a) {
69906
+ switch (_a.label) {
69907
+ case 0:
69908
+ this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
69909
+ this.accessiblePopups = [];
69910
+ features = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this.incidentLayer);
69911
+ return [4 /*yield*/, this.map._getLocalizedStrings()];
69912
+ case 1:
69913
+ localizedStrings = _a.sent();
69914
+ createPopup = function (features, idx) {
69915
+ var incidentFeature = features[idx];
69916
+ var incidentPosition = incidentFeature.geometry.coordinates;
69917
+ var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
69918
+ var incident = new Incident(incidentFeature.properties, point, localizedStrings);
69919
+ var popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
69920
+ var element = popup.getPopupContainer();
69921
+ element.addEventListener('focusin', function (event) {
69922
+ // side effects: clear other managed popups
69923
+ _this.clickPopup.remove();
69924
+ _this.accessiblePopups.filter(function (p) { return p !== popup; }).forEach(function (popup) { return popup.remove(); });
69925
+ // insert previous and next popups
69926
+ if (idx - 1 >= 0) {
69927
+ insertHiddenBefore(popup, createPopup(features, idx - 1));
69928
+ }
69929
+ if (idx + 1 < features.length) {
69930
+ addHidden(createPopup(features, idx + 1));
69931
+ }
69932
+ // if we are on boundaries: add the first / last popup
69933
+ // to maintain popups on full page navigation cycle
69934
+ if (idx >= 2 && idx == features.length - 1) {
69935
+ insertHiddenInFront(createPopup(features, 0));
69936
+ }
69937
+ if (idx == 0 && features.length >= 2) {
69938
+ addHidden(createPopup(features, features.length - 1));
69939
+ }
69940
+ });
69941
+ if (idx == features.length - 1) {
69942
+ element.addEventListener('focusout', function (event) {
69943
+ // close the popup if we detect the focus moving away from the page (relatedTarget === null)
69944
+ // (will remain open otherwise)
69945
+ if (event.relatedTarget === null) {
69946
+ popup.close();
69947
+ }
69948
+ });
69949
+ }
69950
+ _this.accessiblePopups.push(popup);
69951
+ return popup;
69952
+ };
69953
+ insertHiddenBefore = function (base, toInsert) {
69954
+ toInsert.open(_this.map);
69955
+ toInsert.close();
69956
+ var containerToSwapIn = toInsert.getPopupContainer();
69957
+ var baseContainer = base.getPopupContainer();
69958
+ baseContainer.parentElement.insertBefore(containerToSwapIn, baseContainer);
69959
+ };
69960
+ insertHiddenInFront = function (toInsert) {
69961
+ toInsert.open(_this.map);
69962
+ toInsert.close();
69963
+ var containerToSwapIn = toInsert.getPopupContainer();
69964
+ var parent = containerToSwapIn.parentElement;
69965
+ parent.insertBefore(containerToSwapIn, parent.firstElementChild);
69966
+ };
69967
+ addHidden = function (popup) {
69968
+ popup.open(_this.map);
69969
+ popup.close();
69970
+ };
69971
+ if (features.length > 0) {
69972
+ addHidden(createPopup(features, 0));
69973
+ }
69974
+ if (features.length > 1) {
69975
+ addHidden(createPopup(features, features.length - 1));
69976
+ }
69977
+ return [2 /*return*/];
69978
+ }
69979
+ });
69980
+ }); };
69539
69981
  this.removeFromMap = function () {
69982
+ var _a;
69983
+ _this.map.removeEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
69984
+ _this.map.removeEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
69985
+ _this.map.removeEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
69986
+ _this.map.events.remove('idle', _this.setAccessiblePopups);
69987
+ _this.map.events.remove('moveend', _this.setAccessiblePopups);
69988
+ _this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
69989
+ _this.accessiblePopups = [];
69990
+ (_a = _this.clickPopup) === null || _a === void 0 ? void 0 : _a.remove();
69540
69991
  if (_this.map.layers.getLayerById(_this.incidentLayerName) != null) {
69541
69992
  _this.map.layers.remove(_this.incidentLayerName);
69542
69993
  }
@@ -69551,14 +70002,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69551
70002
  _this.map.getCanvas().style.cursor = "";
69552
70003
  };
69553
70004
  this.openIncidentPopup = function (data) {
69554
- _this.popup.remove();
70005
+ _this.clickPopup.remove();
70006
+ _this.accessiblePopups.forEach(function (popup) { return popup.close(); });
69555
70007
  var incidentPosition = data.position;
69556
70008
  var incidentFeature = data.features[0];
69557
70009
  _this.map._getLocalizedStrings().then(function (localizedStrings) {
69558
70010
  var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
69559
70011
  var incident = new Incident(incidentFeature.properties, point, localizedStrings);
69560
- _this.popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
69561
- _this.popup.open(_this.map);
70012
+ _this.clickPopup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
70013
+ _this.clickPopup.open(_this.map);
70014
+ var element = _this.clickPopup.getPopupContainer();
70015
+ // ensures popup is closed on tabbing when the focus is moved away from the window
70016
+ element.addEventListener('focusout', function (event) {
70017
+ if (event.relatedTarget === null) {
70018
+ _this.clickPopup.close();
70019
+ }
70020
+ });
69562
70021
  });
69563
70022
  };
69564
70023
  this.map = map;
@@ -75266,17 +75725,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75266
75725
  * Triggers the user provided function to fetch the token and stores it.
75267
75726
  * @internal
75268
75727
  */
75269
- this._triggerTokenFetch = function () {
75728
+ this._triggerTokenFetch = function (isAnonymousAuth) {
75729
+ if (isAnonymousAuth === void 0) { isAnonymousAuth = false; }
75270
75730
  return new Promise(function (resolve, reject) {
75731
+ if (typeof _this.options.getToken !== "function") {
75732
+ reject(new Error("Token cannot be " + (isAnonymousAuth ? 'fetched' : 'renewed') + " because getToken was not set or is not a function."));
75733
+ return;
75734
+ }
75271
75735
  _this.options.getToken(function (token) {
75272
75736
  try {
75273
75737
  // Try to get the timeout first as this will guarantee the token is correctly formatted.
75274
75738
  var timeout = _this._getTokenExpiry(token) - AuthenticationManager.constants.tokenRefreshClockSkew;
75275
- _this._storeAccessToken(token);
75276
- clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
75277
- // @ts-ignore
75278
- // tslint:disable-next-line: no-string-based-set-timeout
75279
- _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, timeout * 1000);
75739
+ _this._storeToken(token);
75740
+ _this._setTimeoutTokenFetch(timeout);
75280
75741
  resolve();
75281
75742
  }
75282
75743
  catch (_a) {
@@ -75287,6 +75748,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75287
75748
  }, _this.map);
75288
75749
  });
75289
75750
  };
75751
+ /**
75752
+ * Create a timer to trigger the user provided function to fetch the token.
75753
+ * @param seconds delay in seconds
75754
+ * @internal
75755
+ */
75756
+ this._setTimeoutTokenFetch = function (seconds) {
75757
+ clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
75758
+ // @ts-ignore
75759
+ // tslint:disable-next-line: no-string-based-set-timeout
75760
+ _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, Math.min(seconds * 1000, 0x7fffffff) // setTimeout will fire immediately if the delay is greater than 2^31-1.
75761
+ );
75762
+ };
75290
75763
  var serviceOptions = map.getServiceOptions();
75291
75764
  this.options = serviceOptions.authOptions;
75292
75765
  this.sessionId = serviceOptions.sessionId;
@@ -75328,6 +75801,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75328
75801
  }
75329
75802
  else if (_this.options.authType === exports.AuthenticationType.anonymous) {
75330
75803
  // Anonymous authentication, just call the users provided callback.
75804
+ resolve(_this._triggerTokenFetch(true));
75805
+ }
75806
+ else if (_this.options.authType === exports.AuthenticationType.sas) {
75807
+ if (_this.options.sasToken) {
75808
+ var expiresIn = -1;
75809
+ try {
75810
+ expiresIn = _this._getTokenExpiry(_this.options.sasToken);
75811
+ }
75812
+ catch (_a) {
75813
+ reject(new Error("An invalid sasToken was provided."));
75814
+ return;
75815
+ }
75816
+ if (expiresIn > AuthenticationManager.constants.tokenRefreshClockSkew) {
75817
+ // Save the initial token
75818
+ _this._storeToken(_this.options.sasToken);
75819
+ // Create a timer to refresh the token
75820
+ _this._setTimeoutTokenFetch(expiresIn - AuthenticationManager.constants.tokenRefreshClockSkew);
75821
+ resolve();
75822
+ return;
75823
+ }
75824
+ }
75825
+ // Call the users provided callback to fetch the token.
75331
75826
  resolve(_this._triggerTokenFetch());
75332
75827
  }
75333
75828
  else {
@@ -75453,8 +75948,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75453
75948
  }
75454
75949
  return token_1;
75455
75950
  }
75456
- else if (this.options.authType === exports.AuthenticationType.anonymous) {
75457
- var token = this._getItem(AuthenticationManager.constants.storage.accessTokenKey);
75951
+ else if (this.options.authType === exports.AuthenticationType.anonymous
75952
+ || this.options.authType === exports.AuthenticationType.sas) {
75953
+ var token = this._getItem(AuthenticationManager.constants.storage.tokenKey);
75458
75954
  if (!token) {
75459
75955
  // Cached Token not present, invoke the user provided callback function to fetch function
75460
75956
  this._triggerTokenFetch();
@@ -75469,7 +75965,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75469
75965
  }
75470
75966
  else if (expiresIn <= 0) {
75471
75967
  // token renew failed and dont have a token.
75472
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, "");
75968
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, "");
75473
75969
  throw new Error(AuthenticationManager.constants.errors.tokenExpired);
75474
75970
  }
75475
75971
  }
@@ -75498,9 +75994,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75498
75994
  * @param token token fetched from the user's server endpoint
75499
75995
  * @internal
75500
75996
  */
75501
- AuthenticationManager.prototype._storeAccessToken = function (token) {
75997
+ AuthenticationManager.prototype._storeToken = function (token) {
75502
75998
  // Store the value
75503
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, token);
75999
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, token);
75504
76000
  var tokenEvent = {
75505
76001
  map: this.map,
75506
76002
  type: AuthenticationManager.constants.events.tokenAcquired
@@ -75589,7 +76085,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75589
76085
  }
75590
76086
  };
75591
76087
  /**
75592
- * Return the number of milliseconds since 1970/01/01
76088
+ * Return the number of seconds since 1970/01/01
75593
76089
  * @ignore
75594
76090
  */
75595
76091
  AuthenticationManager.prototype._getCurrentTime = function () {
@@ -75608,6 +76104,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75608
76104
  request.headers[constants.msClientIdHeaderName] = this.options.clientId;
75609
76105
  request.headers[constants.authorizationHeaderName] = constants.authorizationTokenPrefix + token;
75610
76106
  break;
76107
+ case exports.AuthenticationType.sas:
76108
+ request.headers[constants.authorizationHeaderName] = constants.jwtSasPrefix + token;
76109
+ break;
75611
76110
  case exports.AuthenticationType.subscriptionKey:
75612
76111
  request.headers["subscription-key"] = token;
75613
76112
  break;
@@ -75623,7 +76122,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
75623
76122
  // Enable localStorage for IE, as sessionStorage does not work for localhost.
75624
76123
  preferredCacheLocation: "localStorage",
75625
76124
  storage: {
75626
- accessTokenKey: "access.token.key",
76125
+ tokenKey: "access.token.key",
75627
76126
  testStorageKey: "testStorage"
75628
76127
  },
75629
76128
  events: {
@@ -76032,6 +76531,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
76032
76531
 
76033
76532
  // Disable unified signatures linter rule so we can generate separate docs for function overloads.
76034
76533
  // tslint:disable:unified-signatures
76534
+ var MAP_CLIENT_EVENTS = ['maxzoomchanged', 'minzoomchanged', 'mapconfigurationchanged'];
76035
76535
  /**
76036
76536
  * A manager for the map control's events.
76037
76537
  * Exposed through the events property of the atlas.Map class.
@@ -76143,6 +76643,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
76143
76643
  * @private
76144
76644
  */
76145
76645
  EventManager.prototype._addGlobalListener = function (eventType, callback, legacy, once) {
76646
+ // add our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
76647
+ if (MAP_CLIENT_EVENTS.includes(eventType)) {
76648
+ this.map._addEventListener(eventType, callback, once);
76649
+ return;
76650
+ }
76146
76651
  var oldModifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, "", callback);
76147
76652
  // Get a new modified callback.
76148
76653
  this.mapCallbackHandler.addCallback(eventType, "", callback, legacy, once);
@@ -76167,9 +76672,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
76167
76672
  setTimeout(function () { return modifiedCallback(readyData_1); });
76168
76673
  }
76169
76674
  }
76170
- else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
76171
- this.map._addEventListener(eventType, callback, once);
76172
- }
76173
76675
  else {
76174
76676
  // If a callback already exists disable it so the new one can replace it.
76175
76677
  if (oldModifiedCallback) {
@@ -76266,6 +76768,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
76266
76768
  */
76267
76769
  EventManager.prototype._removeListener = function (eventType, target, callback) {
76268
76770
  var e_5, _a;
76771
+ // remove our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
76772
+ if (MAP_CLIENT_EVENTS.includes(eventType)) {
76773
+ this.map._removeEventListener(eventType, callback);
76774
+ return;
76775
+ }
76269
76776
  var layerId = target instanceof Layer ? target.getId() : target;
76270
76777
  var modifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, layerId, callback);
76271
76778
  // If a callback already exists disable it so the new one can replace it.
@@ -77173,15 +77680,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
77173
77680
  */
77174
77681
  LayerManager.prototype._removeLayer = function (layer) {
77175
77682
  var layerId = layer instanceof Layer ? layer.getId() : layer;
77176
- if (!this.layerIndex.find(function (l) { return l.getId() === layerId; })) {
77683
+ var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
77684
+ if (layerIndex == -1) {
77177
77685
  throw new Error("The layer '" + layerId + "' has not been added to the map and cannot be removed.");
77178
77686
  }
77179
- var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
77180
77687
  var tempLayer = this.layerIndex[layerIndex];
77181
77688
  this._removeMapboxLayers(tempLayer);
77182
77689
  this.layerIndex.splice(layerIndex, 1);
77183
- var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === tempLayer.getId(); });
77184
- if (userLayerIndex >= 0) {
77690
+ var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layerId; });
77691
+ if (userLayerIndex != -1) {
77185
77692
  this.userLayers.splice(userLayerIndex, 1);
77186
77693
  }
77187
77694
  tempLayer.onRemove();
@@ -78157,6 +78664,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78157
78664
  __extends(StyleOptions, _super);
78158
78665
  function StyleOptions() {
78159
78666
  var _this = _super !== null && _super.apply(this, arguments) || this;
78667
+ /**
78668
+ * If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing WebGL layers.
78669
+ */
78670
+ _this.antialias = undefined;
78160
78671
  /**
78161
78672
  * If true the map will automatically resize whenever the window's size changes.
78162
78673
  * Otherwise map.resize() must be called.
@@ -78208,6 +78719,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78208
78719
  * @default true
78209
78720
  */
78210
78721
  _this.showLogo = true;
78722
+ /**
78723
+ * Specifies if the map should display labels
78724
+ * @default true
78725
+ */
78726
+ _this.showLabels = true;
78211
78727
  /**
78212
78728
  * Additional custom attribution appended to map attribution.
78213
78729
  * Default `undefined`
@@ -78348,10 +78864,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78348
78864
  */
78349
78865
  _this.styleAPIVersion = getStyleAPIVersion();
78350
78866
  /**
78351
- * The style set of the map. Determines which styles are available to be picked
78352
- * and what do they consist of (style names, thumbnails, URLs, etc). If passed
78353
- * as a string then the request will be made to resolve it. Use Style Set API
78354
- * for modifications of the style set for all your apps in the field.
78867
+ * The map configuration defines the set of styles available to the map.
78868
+ */
78869
+ _this.mapConfiguration = undefined;
78870
+ /**
78871
+ * @deprecated use mapConfiguration instead
78355
78872
  */
78356
78873
  _this.styleSet = undefined;
78357
78874
  /**
@@ -78522,6 +79039,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78522
79039
  if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
78523
79040
  merged["subscription-key"] = merged.subscriptionKey = undefined;
78524
79041
  }
79042
+ // if mapConfiguration is not set and legacy styleSet option is used, assign it to mapConfiguration
79043
+ if (merged.styleSet !== undefined && merged.mapConfiguration === undefined) {
79044
+ merged.mapConfiguration = merged.styleSet;
79045
+ }
79046
+ // reassign properties from legacy mapConfiguration to new structure if needed
79047
+ if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
79048
+ merged.mapConfiguration = __assign(__assign({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
79049
+ }
78525
79050
  this._transformers = __spread(currentTransforms || [], transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); }));
78526
79051
  if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
78527
79052
  this._transformers.push(this.transformRequest);
@@ -78726,9 +79251,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78726
79251
  */
78727
79252
  this.indoorState = undefined;
78728
79253
  /**
78729
- * Preserve the styleset that was used before the indoor styleset was set
79254
+ * Preserve the map configuration that was used before the indoor map configuration was set
78730
79255
  */
78731
- this.preservedPreindoorStyleset = undefined;
79256
+ this.preservedPreindoorMapConfiguration = undefined;
78732
79257
  this._onStyleData = function () {
78733
79258
  _this._lookUpAsync(_this.map.getStyle()).then(function (style) {
78734
79259
  _this.map.events.invoke("stylechanged", {
@@ -78751,11 +79276,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78751
79276
  return null;
78752
79277
  }
78753
79278
  else {
78754
- return definitions.styles.find(function (style) { return style.name === (options.style || definitions.defaultStyle); })
79279
+ return definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
78755
79280
  // retrieve default style definition unless option.style's one was found
78756
- || definitions.styles.find(function (style) { return style.name === definitions.defaultStyle; })
78757
- // no default style in the styleSet -> pick the first style
78758
- || definitions.styles[0];
79281
+ || definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
79282
+ // no default style in the mapConfiguration -> pick the first style
79283
+ || definitions.configurations[0];
78759
79284
  }
78760
79285
  };
78761
79286
  this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
@@ -78765,11 +79290,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78765
79290
  case 0: return [4 /*yield*/, this.definitions()];
78766
79291
  case 1:
78767
79292
  definitions = _a.sent();
78768
- result = definitions.styles.find(function (style) { return style.name === (options.style || definitions.defaultStyle); })
79293
+ result = definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
78769
79294
  // retrieve default style definition unless option.style's one was found
78770
- || definitions.styles.find(function (style) { return style.name === definitions.defaultStyle; })
78771
- // no default style in the styleSet -> pick the first style
78772
- || definitions.styles[0];
79295
+ || definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
79296
+ // no default style in the mapConfiguration -> pick the first style
79297
+ || definitions.configurations[0];
78773
79298
  return [2 /*return*/, result];
78774
79299
  }
78775
79300
  });
@@ -78779,39 +79304,42 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78779
79304
  }
78780
79305
  StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
78781
79306
  var _this = this;
78782
- var styleset = this.map.styles.getMapConfiguration();
78783
- if (styleset) {
78784
- this.preservedPreindoorStyleset = styleset;
79307
+ var _a;
79308
+ var mapConfiguration = this.map.styles.getMapConfiguration();
79309
+ if (mapConfiguration) {
79310
+ this.preservedPreindoorMapConfiguration = mapConfiguration;
78785
79311
  // tilesetId fallback
78786
79312
  // MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
78787
79313
  var desiredIndoorStyle = this.map.getStyle().style ? this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId : undefined;
78788
- this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, styleset === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
79314
+ this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, mapConfiguration === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
78789
79315
  }
78790
79316
  else {
79317
+ var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
78791
79318
  this.indoorState = {
78792
79319
  tilesetId: tilesetId,
78793
79320
  theme: theme
78794
79321
  };
78795
79322
  this.initStyleset();
78796
79323
  this.definitions().then(function (definitions) {
78797
- var currentStyle = (_this.map.getStyle().style || definitions.defaultStyle)
79324
+ var currentStyle = (_this.map.getStyle().style || definitions.defaultConfiguration)
78798
79325
  .replace('_indoor_dark', '')
78799
79326
  .replace('_indoor', '');
78800
79327
  // we cannot compose the precise style name for auto theme, search for prefix style name match
78801
79328
  var targetStylePrefix = currentStyle + "_indoor";
78802
- var candidateStyle = definitions.styles.find(function (style) { return style.name.startsWith(targetStylePrefix); });
79329
+ var candidateStyle = definitions.configurations.find(function (style) { return style.name.startsWith(targetStylePrefix); });
78803
79330
  if (candidateStyle) {
78804
- _this.map.setStyle({ style: candidateStyle.name });
79331
+ // force style reload if tileset id has changed to make sure the tiles will be re-requested with new tileset applied in indoor source placeholder
79332
+ _this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
78805
79333
  }
78806
79334
  });
78807
79335
  }
78808
79336
  };
78809
79337
  StyleManager.prototype.unsetIndoorState = function () {
78810
79338
  var _this = this;
78811
- var styleset = this.preservedPreindoorStyleset;
78812
- if (styleset) {
79339
+ var mapConfiguration = this.preservedPreindoorMapConfiguration;
79340
+ if (mapConfiguration) {
78813
79341
  // we need to revert to the styleset that was ap
78814
- this.map.styles.setMapConfiguration(styleset);
79342
+ this.map.styles.setMapConfiguration(mapConfiguration);
78815
79343
  }
78816
79344
  else {
78817
79345
  this.indoorState = undefined;
@@ -78838,11 +79366,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78838
79366
  var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
78839
79367
  return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
78840
79368
  };
78841
- if (!this.serviceOptions.styleSet) {
78842
- newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions").then(function (definitions) { return ({
79369
+ if (!this.serviceOptions.mapConfiguration) {
79370
+ newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
78843
79371
  version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
78844
- defaultStyle: definitions.defaultStyle,
78845
- styles: definitions.styles
79372
+ defaultConfiguration: definitions.defaultStyle,
79373
+ configurations: definitions.styles
78846
79374
  .filter(function (style) {
78847
79375
  if (!_this.indoorState) {
78848
79376
  return !style.name.includes('indoor');
@@ -78866,20 +79394,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78866
79394
  domain: _this.serviceOptions.staticAssetsDomain,
78867
79395
  path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
78868
79396
  queryParams: {
78869
- //[constants.apiVersionQueryParameter]: this.serviceOptions.styleDefinitionsVersion,
78870
- // thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
78871
- //language: styleOptions.language
79397
+ styleVersion: _this.serviceOptions.styleDefinitionsVersion,
78872
79398
  },
78873
79399
  protocol: "https"
78874
79400
  }).toString(),
78875
79401
  }); })
78876
79402
  }); }));
78877
79403
  }
78878
- else if (typeof this.serviceOptions.styleSet === 'string') {
78879
- newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.styleSet, "StyleDefinitions"));
79404
+ else if (typeof this.serviceOptions.mapConfiguration === 'string') {
79405
+ newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
79406
+ // reassign properties from legacy mapConfiguration to new structure if needed
79407
+ ).then(function (definitions) { return (__assign(__assign({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
78880
79408
  }
78881
79409
  else {
78882
- newPromise = HijackablePromise.resolve(this.serviceOptions.styleSet);
79410
+ newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
78883
79411
  }
78884
79412
  if (this.initPromise) {
78885
79413
  this.initPromise.switchWith(newPromise);
@@ -78889,7 +79417,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78889
79417
  this.initPromise = newPromise;
78890
79418
  }
78891
79419
  // propagate styleset change
78892
- this.initPromise.then(function (styleset) { return _this.map._invokeEvent("stylesetchanged", styleset); });
79420
+ this.initPromise.then(function (styleset) { return _this.map._invokeEvent("mapconfigurationchanged", styleset); });
78893
79421
  return this.initPromise;
78894
79422
  };
78895
79423
  /**
@@ -78912,10 +79440,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78912
79440
  /**
78913
79441
  * @internal
78914
79442
  */
78915
- StyleManager.prototype.setStyle = function (styleOptions) {
79443
+ StyleManager.prototype.setStyle = function (styleOptions, diff) {
79444
+ if (diff === void 0) { diff = true; }
78916
79445
  try {
78917
79446
  this.map._getMap().setStyle(this.getStyle(styleOptions), {
78918
- diff: true,
79447
+ diff: diff,
78919
79448
  stylePatch: this._stylePatch.bind(this),
78920
79449
  validate: this.serviceOptions.validateStyle
78921
79450
  });
@@ -78947,30 +79476,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78947
79476
  /**
78948
79477
  * Replaces the style set used. Very costly as it reloads all controls and resources.
78949
79478
  */
78950
- StyleManager.prototype.setMapConfiguration = function (styleSet, styleName) {
79479
+ StyleManager.prototype.setMapConfiguration = function (mapConfiguration, styleName) {
78951
79480
  var _this = this;
78952
- this.serviceOptions.styleSet = styleSet;
78953
- if (typeof styleSet === 'string') {
79481
+ this.serviceOptions.mapConfiguration = mapConfiguration;
79482
+ if (typeof mapConfiguration === 'string') {
78954
79483
  this.initStyleset();
78955
79484
  }
78956
79485
  else {
78957
79486
  if (this.initPromise) {
78958
- this.initPromise.hijackAndResolve(styleSet);
79487
+ this.initPromise.hijackAndResolve(mapConfiguration);
78959
79488
  }
78960
79489
  else {
78961
- this.initPromise = HijackablePromise.resolve(styleSet);
79490
+ this.initPromise = HijackablePromise.resolve(mapConfiguration);
78962
79491
  }
78963
79492
  }
78964
79493
  this.definitions().then(function (definitions) {
78965
- var targetStyleName = definitions.defaultStyle;
78966
- if (definitions.styles.find(function (s) { return s.name === styleName; })) {
79494
+ var targetStyleName = definitions.defaultConfiguration;
79495
+ if (definitions.configurations.find(function (s) { return s.name === styleName; })) {
78967
79496
  targetStyleName = styleName;
78968
79497
  }
78969
79498
  _this.map.setStyle({ style: targetStyleName });
78970
79499
  });
78971
79500
  };
78972
79501
  StyleManager.prototype.getMapConfiguration = function () {
78973
- return this.serviceOptions.styleSet;
79502
+ return this.serviceOptions.mapConfiguration;
78974
79503
  };
78975
79504
  // backward-compatibility: this method preserves the interface that azure-maps-indoor@2.0.6 assumes
78976
79505
  StyleManager.prototype.setStyleSet = function (styleSet) {
@@ -79018,52 +79547,59 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79018
79547
  // A FundamentalMapLayer (grouped layer) representation of the next style must be built.
79019
79548
  var previousLayers = this.map.layers.getLayers();
79020
79549
  var nextLayers = [];
79021
- var currentLayerGroupId = "";
79022
- var currentLayerGroupLayers = [];
79023
- var advanceLayerGroup = function (nextLayerGroup) {
79024
- nextLayers.push(_this._buildFundamentalLayerFrom(currentLayerGroupLayers, currentLayerGroupId));
79025
- currentLayerGroupId = nextLayerGroup;
79026
- currentLayerGroupLayers = [];
79027
- };
79550
+ var layerGroupLayers = {};
79028
79551
  nextStyle.layers.forEach(function (nextLayer) {
79029
- var _a, _b, _c;
79552
+ var _a, _b, _c, _d, _e;
79030
79553
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
79031
- currentLayerGroupId = currentLayerGroupId ? currentLayerGroupId : layerGroup;
79032
- // Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
79033
- if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
79034
- updateLayoutProperty(nextLayer.id, "visibility", "none");
79035
- nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
79036
- nextLayer.layout.visibility = "none";
79037
- }
79038
- else if (nextLayer.type === "fill-extrusion") {
79039
- updateLayoutProperty(nextLayer.id, "visibility", "visible");
79040
- nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
79041
- nextLayer.layout.visibility = "visible";
79042
- }
79043
- // Set visibility of traffic layers depending on traffic settings.
79044
- if (trafficOptions.flow !== "none" && layerGroup) {
79045
- if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
79554
+ if (layerGroup) {
79555
+ // Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
79556
+ if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
79557
+ updateLayoutProperty(nextLayer.id, "visibility", "none");
79558
+ nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
79559
+ nextLayer.layout.visibility = "none";
79560
+ }
79561
+ else if (nextLayer.type === "fill-extrusion") {
79046
79562
  updateLayoutProperty(nextLayer.id, "visibility", "visible");
79047
- nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
79563
+ nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
79048
79564
  nextLayer.layout.visibility = "visible";
79049
79565
  }
79050
- }
79051
- // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
79052
- // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
79053
- // waiting for a styledata.load event to trigger a sync in a different context.
79054
- if (layerGroup) {
79055
- if (currentLayerGroupLayers.length > 0 && layerGroup != currentLayerGroupId) {
79056
- advanceLayerGroup(layerGroup);
79566
+ // Set visibility of traffic layers depending on traffic settings.
79567
+ if (trafficOptions.flow !== "none" && layerGroup) {
79568
+ if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
79569
+ updateLayoutProperty(nextLayer.id, "visibility", "visible");
79570
+ nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
79571
+ nextLayer.layout.visibility = "visible";
79572
+ }
79573
+ }
79574
+ // Set visibility of labels
79575
+ var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
79576
+ if (isLabelLayerGroup && nextLayer.type === 'symbol') {
79577
+ if (styleOptions.showLabels) {
79578
+ updateLayoutProperty(nextLayer.id, "visibility", "visible");
79579
+ nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
79580
+ nextLayer.layout.visibility = "visible";
79581
+ }
79582
+ else {
79583
+ updateLayoutProperty(nextLayer.id, "visibility", "none");
79584
+ nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
79585
+ nextLayer.layout.visibility = "none";
79586
+ }
79587
+ }
79588
+ // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
79589
+ // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
79590
+ // waiting for a styledata.load event to trigger a sync in a different context.
79591
+ if (layerGroupLayers[layerGroup]) {
79592
+ layerGroupLayers[layerGroup].push(nextLayer);
79593
+ }
79594
+ else {
79595
+ layerGroupLayers[layerGroup] = [nextLayer];
79057
79596
  }
79058
- currentLayerGroupLayers.push(nextLayer);
79059
- }
79060
- else if (currentLayerGroupLayers.length > 0) {
79061
- advanceLayerGroup(layerGroup);
79062
79597
  }
79063
79598
  });
79064
- if (currentLayerGroupLayers.length > 0) {
79065
- advanceLayerGroup("");
79066
- }
79599
+ Object.entries(layerGroupLayers).forEach(function (_a) {
79600
+ var _b = __read(_a, 2), layerGroupId = _b[0], layerGroupMapboxLayers = _b[1];
79601
+ nextLayers.push(_this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupId));
79602
+ });
79067
79603
  // Update FundamentalMapLayers in LayerManager
79068
79604
  var userLayers = this.map.layers._getUserLayers();
79069
79605
  var firstUserLayer = userLayers[0];
@@ -79099,6 +79635,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79099
79635
  // Layers added to mapbox through this SDK since loading the last style should be
79100
79636
  // carried over to the next style.
79101
79637
  userLayers.forEach(function (userLayer) {
79638
+ if (userLayer.layer instanceof WebGLLayer) {
79639
+ // mapbox custom layers cannot be serialized and preserved,
79640
+ // return to continue to the next user layer.
79641
+ return;
79642
+ }
79102
79643
  var before = undefined;
79103
79644
  if (_this.map.layers.getLayerById(userLayer.before)) {
79104
79645
  var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
@@ -79110,7 +79651,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79110
79651
  // If there was a previous styledata change event attached, remove it.
79111
79652
  // When the sprite url changes between style changes then mapbox can't perform the diff
79112
79653
  // In such cases it recalculate the style again. Removing previous attached
79113
- // event listner makes sure that style changed event is not fired twice in these cases.
79654
+ // event listener makes sure that style changed event is not fired twice in these cases.
79114
79655
  this.map.events.remove("styledata", this._onStyleData);
79115
79656
  this.map.events.addOnce("styledata", this._onStyleData);
79116
79657
  };
@@ -79139,8 +79680,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79139
79680
  if (url.includes(constants.styleResourcePlaceholder)) {
79140
79681
  params.url = params.url.replace(constants.styleResourcePlaceholder, constants.styleResourcePath);
79141
79682
  }
79142
- params.url = params.url + ("" + (url.includes('?') ? '&' : '?') + constants.apiVersionQueryParameter + "=" + this.serviceOptions.styleAPIVersion);
79143
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
79683
+ if (params.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase()) ||
79684
+ params.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase())) {
79685
+ // Only add API version param for Azure maps domain requests
79686
+ var targetUrl = new URL(params.url);
79687
+ if (!targetUrl.searchParams.get(constants.apiVersionQueryParameter)) {
79688
+ targetUrl.searchParams.set(constants.apiVersionQueryParameter, this.serviceOptions.styleAPIVersion);
79689
+ params.url = targetUrl.href;
79690
+ }
79691
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
79692
+ }
79144
79693
  };
79145
79694
  /**
79146
79695
  * Fetches a json resource at the specified domain and path.
@@ -79252,6 +79801,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79252
79801
  }
79253
79802
  else {
79254
79803
  var mapboxMapOptions = {
79804
+ antialias: _this.styleOptions.antialias,
79255
79805
  attributionControl: false,
79256
79806
  container: container,
79257
79807
  fadeDuration: _this.serviceOptions.fadeDuration,
@@ -79548,8 +80098,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79548
80098
  /**
79549
80099
  * Set the map control's style options. Any options not specified will default to their current values.
79550
80100
  * @param options The options for setting the style of the map control.
80101
+ * @param diff [true] If false, forces a 'full' style update, removing the current style and building the given one instead of attempting a diff-based update. Defaults to true.
79551
80102
  */
79552
- Map.prototype.setStyle = function (options) {
80103
+ Map.prototype.setStyle = function (options, diff) {
80104
+ if (diff === void 0) { diff = true; }
79553
80105
  // This option may only be set when initializing the map.
79554
80106
  // The delete operation will handle non-exist property.
79555
80107
  delete options.preserveDrawingBuffer;
@@ -79587,7 +80139,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
79587
80139
  // if the language is changed, then either those delegates need changed
79588
80140
  // or the styledata event manually invoked.
79589
80141
  this.styleOptions = newOptions;
79590
- this._setStyleComponents(newOptions);
80142
+ this._setStyleComponents(newOptions, diff);
79591
80143
  };
79592
80144
  /**
79593
80145
  * Returns the map control's current style settings.
@@ -80240,6 +80792,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80240
80792
  Map.prototype.stop = function () {
80241
80793
  this.map.stop();
80242
80794
  };
80795
+ /**
80796
+ * Trigger the rendering of a single frame.
80797
+ * Use this method with WebGL layers to repaint the map when the layer's
80798
+ * properties or properties associated with the layer's source change.
80799
+ * Calling this multiple times before the next frame is rendered will still
80800
+ * result in only a single frame being rendered.
80801
+ */
80802
+ Map.prototype.triggerRepaint = function () {
80803
+ this.map.triggerRepaint();
80804
+ };
80243
80805
  /**
80244
80806
  * @internal
80245
80807
  */
@@ -80249,10 +80811,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80249
80811
  /**
80250
80812
  * @internal
80251
80813
  */
80252
- Map.prototype._rebuildStyle = function () {
80814
+ Map.prototype._rebuildStyle = function (diff) {
80815
+ if (diff === void 0) { diff = true; }
80253
80816
  return __awaiter(this, void 0, void 0, function () {
80254
80817
  return __generator(this, function (_a) {
80255
- this.styles.setStyle(this.styleOptions);
80818
+ this.styles.setStyle(this.styleOptions, diff);
80256
80819
  this.imageSprite._restoreImages();
80257
80820
  return [2 /*return*/];
80258
80821
  });
@@ -80363,18 +80926,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80363
80926
  * Removes sources and layers that aren't used by the new style or any remaining layers.
80364
80927
  * @private
80365
80928
  */
80366
- Map.prototype._setStyleComponents = function (styleOptions) {
80929
+ Map.prototype._setStyleComponents = function (styleOptions, diff) {
80367
80930
  var _this = this;
80931
+ if (diff === void 0) { diff = true; }
80368
80932
  if (this.removed) {
80369
80933
  return;
80370
80934
  }
80371
80935
  // Check if the default style is set by the client and if it exists in the current style set
80372
- this.styles.definitions().then(function (styleSet) {
80373
- if (!_this.styleOptions.style || !styleSet.styles.map(function (styleSetStyle) { return styleSetStyle.name; }).includes(_this.styleOptions.style)) {
80374
- _this.styleOptions.style = styleSet.defaultStyle;
80936
+ this.styles.definitions().then(function (mapConfiguration) {
80937
+ if (!_this.styleOptions.style || !mapConfiguration.configurations.map(function (mapConfigurationStyle) { return mapConfigurationStyle.name; }).includes(_this.styleOptions.style)) {
80938
+ _this.styleOptions.style = mapConfiguration.defaultConfiguration;
80375
80939
  }
80376
80940
  _this.styleOptions = styleOptions;
80377
- _this._rebuildStyle();
80941
+ _this._rebuildStyle(diff);
80378
80942
  });
80379
80943
  return;
80380
80944
  };
@@ -80420,7 +80984,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
80420
80984
  var w = BoundingBox.getWest(bounds);
80421
80985
  var n = BoundingBox.getNorth(bounds);
80422
80986
  var e = BoundingBox.getEast(bounds);
80423
- if (isNaN(s) || isNaN(w) || isNaN(n) || isNaN(e)) {
80987
+ if (!isFinite(s) || !isFinite(w) || !isFinite(n) || !isFinite(e)) {
80424
80988
  throw new Error("The bounds specified are invalid: [" + bounds + "]");
80425
80989
  }
80426
80990
  while (w > e) {