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.
@@ -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;
@@ -57750,7 +58110,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57750
58110
  path: "search/address/reverse/json",
57751
58111
  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 }))
57752
58112
  };
57753
- return new Url((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)).get();
58113
+ return new Url(((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)) || urlOptions).get();
57754
58114
  };
57755
58115
  return NearbyGeographySearchService;
57756
58116
  }());
@@ -58954,8 +59314,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58954
59314
  _this.createMapKeyBindingInfo();
58955
59315
  _this.map.getMapContainer().setAttribute("role", "application");
58956
59316
  _this.map.getMapContainer().setAttribute("aria-label", "Map Application");
59317
+ _this.map.getCanvasContainer().setAttribute("aria-live", "polite");
59318
+ _this.map.getCanvasContainer().setAttribute("aria-describedby", "atlas-map-state atlas-map-style");
58957
59319
  _this.map.getCanvas().setAttribute("aria-label", "Interactive Map");
58958
- _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-state atlas-map-style atlas-map-shortcuts");
59320
+ _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-shortcuts");
58959
59321
  _this.map.getCanvas().setAttribute("alt", "Interactive Map");
58960
59322
  };
58961
59323
  this.removeFromMap = function () {
@@ -58977,10 +59339,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58977
59339
  delete _this.atlasMapStyleInfo;
58978
59340
  _this.map.getMapContainer().removeAttribute("role");
58979
59341
  _this.map.getMapContainer().removeAttribute("aria-label");
59342
+ _this.map.getCanvasContainer().removeAttribute("aria-live");
59343
+ _this.map.getCanvasContainer().removeAttribute("aria-describedby");
58980
59344
  _this.map.getCanvas().removeAttribute("aria-label");
58981
59345
  _this.map.getCanvas().removeAttribute("aria-describedby");
58982
59346
  _this.map.getCanvas().removeAttribute("alt");
58983
- _this.map.events.remove("styledata", _this.updateMapStyle);
59347
+ _this.map.events.remove("stylechanged", _this.updateMapStyle);
58984
59348
  };
58985
59349
  this.createMapKeyBindingInfo = function () {
58986
59350
  _this.atlasMapKeyBindings = document.createElement("div");
@@ -59005,7 +59369,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59005
59369
  "Jump focus to the map: Escape."
59006
59370
  ].join("\n");
59007
59371
  _this.map.getCanvasContainer().appendChild(_this.atlasMapKeyBindings);
59008
- _this.atlasMapKeyBindings.setAttribute("aria-live", "polite");
59009
59372
  var baseShortcutKeyCodes = [
59010
59373
  // - (zoom out)
59011
59374
  189,
@@ -59037,7 +59400,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59037
59400
  _this.atlasMapLiveStateInfo.id = "atlas-map-state";
59038
59401
  _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
59039
59402
  _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
59040
- _this.atlasMapLiveStateInfo.setAttribute("aria-live", "assertive");
59041
59403
  }
59042
59404
  };
59043
59405
  this.initializeMapStyleInfo = function () {
@@ -59046,10 +59408,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59046
59408
  _this.atlasMapStyleInfo.setAttribute("aria-hidden", "true");
59047
59409
  _this.atlasMapStyleInfo.id = "atlas-map-style";
59048
59410
  _this.atlasMapStyleInfo.classList.add("hidden-accessible-element");
59049
- _this.updateMapStyle();
59050
- _this.map.events.add("styledata", _this.updateMapStyle);
59411
+ _this.map.events.add("stylechanged", _this.updateMapStyle);
59051
59412
  _this.map.getCanvasContainer().appendChild(_this.atlasMapStyleInfo);
59052
- _this.atlasMapStyleInfo.setAttribute("aria-live", "polite");
59053
59413
  };
59054
59414
  this.updateMapStyle = function () {
59055
59415
  _this.atlasMapStyleInfo.innerHTML = "<p>Map style: " + _this.map.getStyle().style + ".</p>";
@@ -59347,15 +59707,106 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59347
59707
  _this.map.layers.add(_this.incidentLayer, "labels");
59348
59708
  }
59349
59709
  //Create a popup but leave it closed so we can update it and display it later.
59350
- _this.popup = new Popup({
59710
+ _this.clickPopup = new Popup({
59351
59711
  position: [0, 0],
59352
59712
  pixelOffset: [0, -18]
59353
59713
  });
59354
59714
  _this.map.addEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
59355
59715
  _this.map.addEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
59356
59716
  _this.map.addEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
59717
+ _this.map.events.addOnce('idle', _this.setAccessiblePopups);
59718
+ _this.map.events.add('moveend', _this.setAccessiblePopups);
59357
59719
  };
59720
+ this.accessiblePopups = [];
59721
+ this.setAccessiblePopups = function () { return __awaiter(_this, void 0, void 0, function () {
59722
+ var features, localizedStrings, createPopup, insertHiddenBefore, insertHiddenInFront, addHidden;
59723
+ var _this = this;
59724
+ return __generator(this, function (_a) {
59725
+ switch (_a.label) {
59726
+ case 0:
59727
+ this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
59728
+ this.accessiblePopups = [];
59729
+ features = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this.incidentLayer);
59730
+ return [4 /*yield*/, this.map._getLocalizedStrings()];
59731
+ case 1:
59732
+ localizedStrings = _a.sent();
59733
+ createPopup = function (features, idx) {
59734
+ var incidentFeature = features[idx];
59735
+ var incidentPosition = incidentFeature.geometry.coordinates;
59736
+ var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
59737
+ var incident = new Incident(incidentFeature.properties, point, localizedStrings);
59738
+ var popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
59739
+ var element = popup.getPopupContainer();
59740
+ element.addEventListener('focusin', function (event) {
59741
+ // side effects: clear other managed popups
59742
+ _this.clickPopup.remove();
59743
+ _this.accessiblePopups.filter(function (p) { return p !== popup; }).forEach(function (popup) { return popup.remove(); });
59744
+ // insert previous and next popups
59745
+ if (idx - 1 >= 0) {
59746
+ insertHiddenBefore(popup, createPopup(features, idx - 1));
59747
+ }
59748
+ if (idx + 1 < features.length) {
59749
+ addHidden(createPopup(features, idx + 1));
59750
+ }
59751
+ // if we are on boundaries: add the first / last popup
59752
+ // to maintain popups on full page navigation cycle
59753
+ if (idx >= 2 && idx == features.length - 1) {
59754
+ insertHiddenInFront(createPopup(features, 0));
59755
+ }
59756
+ if (idx == 0 && features.length >= 2) {
59757
+ addHidden(createPopup(features, features.length - 1));
59758
+ }
59759
+ });
59760
+ if (idx == features.length - 1) {
59761
+ element.addEventListener('focusout', function (event) {
59762
+ // close the popup if we detect the focus moving away from the page (relatedTarget === null)
59763
+ // (will remain open otherwise)
59764
+ if (event.relatedTarget === null) {
59765
+ popup.close();
59766
+ }
59767
+ });
59768
+ }
59769
+ _this.accessiblePopups.push(popup);
59770
+ return popup;
59771
+ };
59772
+ insertHiddenBefore = function (base, toInsert) {
59773
+ toInsert.open(_this.map);
59774
+ toInsert.close();
59775
+ var containerToSwapIn = toInsert.getPopupContainer();
59776
+ var baseContainer = base.getPopupContainer();
59777
+ baseContainer.parentElement.insertBefore(containerToSwapIn, baseContainer);
59778
+ };
59779
+ insertHiddenInFront = function (toInsert) {
59780
+ toInsert.open(_this.map);
59781
+ toInsert.close();
59782
+ var containerToSwapIn = toInsert.getPopupContainer();
59783
+ var parent = containerToSwapIn.parentElement;
59784
+ parent.insertBefore(containerToSwapIn, parent.firstElementChild);
59785
+ };
59786
+ addHidden = function (popup) {
59787
+ popup.open(_this.map);
59788
+ popup.close();
59789
+ };
59790
+ if (features.length > 0) {
59791
+ addHidden(createPopup(features, 0));
59792
+ }
59793
+ if (features.length > 1) {
59794
+ addHidden(createPopup(features, features.length - 1));
59795
+ }
59796
+ return [2 /*return*/];
59797
+ }
59798
+ });
59799
+ }); };
59358
59800
  this.removeFromMap = function () {
59801
+ var _a;
59802
+ _this.map.removeEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
59803
+ _this.map.removeEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
59804
+ _this.map.removeEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
59805
+ _this.map.events.remove('idle', _this.setAccessiblePopups);
59806
+ _this.map.events.remove('moveend', _this.setAccessiblePopups);
59807
+ _this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
59808
+ _this.accessiblePopups = [];
59809
+ (_a = _this.clickPopup) === null || _a === void 0 ? void 0 : _a.remove();
59359
59810
  if (_this.map.layers.getLayerById(_this.incidentLayerName) != null) {
59360
59811
  _this.map.layers.remove(_this.incidentLayerName);
59361
59812
  }
@@ -59370,14 +59821,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59370
59821
  _this.map.getCanvas().style.cursor = "";
59371
59822
  };
59372
59823
  this.openIncidentPopup = function (data) {
59373
- _this.popup.remove();
59824
+ _this.clickPopup.remove();
59825
+ _this.accessiblePopups.forEach(function (popup) { return popup.close(); });
59374
59826
  var incidentPosition = data.position;
59375
59827
  var incidentFeature = data.features[0];
59376
59828
  _this.map._getLocalizedStrings().then(function (localizedStrings) {
59377
59829
  var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
59378
59830
  var incident = new Incident(incidentFeature.properties, point, localizedStrings);
59379
- _this.popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
59380
- _this.popup.open(_this.map);
59831
+ _this.clickPopup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
59832
+ _this.clickPopup.open(_this.map);
59833
+ var element = _this.clickPopup.getPopupContainer();
59834
+ // ensures popup is closed on tabbing when the focus is moved away from the window
59835
+ element.addEventListener('focusout', function (event) {
59836
+ if (event.relatedTarget === null) {
59837
+ _this.clickPopup.close();
59838
+ }
59839
+ });
59381
59840
  });
59382
59841
  };
59383
59842
  this.map = map;
@@ -65085,17 +65544,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65085
65544
  * Triggers the user provided function to fetch the token and stores it.
65086
65545
  * @internal
65087
65546
  */
65088
- this._triggerTokenFetch = function () {
65547
+ this._triggerTokenFetch = function (isAnonymousAuth) {
65548
+ if (isAnonymousAuth === void 0) { isAnonymousAuth = false; }
65089
65549
  return new Promise(function (resolve, reject) {
65550
+ if (typeof _this.options.getToken !== "function") {
65551
+ reject(new Error("Token cannot be " + (isAnonymousAuth ? 'fetched' : 'renewed') + " because getToken was not set or is not a function."));
65552
+ return;
65553
+ }
65090
65554
  _this.options.getToken(function (token) {
65091
65555
  try {
65092
65556
  // Try to get the timeout first as this will guarantee the token is correctly formatted.
65093
65557
  var timeout = _this._getTokenExpiry(token) - AuthenticationManager.constants.tokenRefreshClockSkew;
65094
- _this._storeAccessToken(token);
65095
- clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
65096
- // @ts-ignore
65097
- // tslint:disable-next-line: no-string-based-set-timeout
65098
- _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, timeout * 1000);
65558
+ _this._storeToken(token);
65559
+ _this._setTimeoutTokenFetch(timeout);
65099
65560
  resolve();
65100
65561
  }
65101
65562
  catch (_a) {
@@ -65106,6 +65567,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65106
65567
  }, _this.map);
65107
65568
  });
65108
65569
  };
65570
+ /**
65571
+ * Create a timer to trigger the user provided function to fetch the token.
65572
+ * @param seconds delay in seconds
65573
+ * @internal
65574
+ */
65575
+ this._setTimeoutTokenFetch = function (seconds) {
65576
+ clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
65577
+ // @ts-ignore
65578
+ // tslint:disable-next-line: no-string-based-set-timeout
65579
+ _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, Math.min(seconds * 1000, 0x7fffffff) // setTimeout will fire immediately if the delay is greater than 2^31-1.
65580
+ );
65581
+ };
65109
65582
  var serviceOptions = map.getServiceOptions();
65110
65583
  this.options = serviceOptions.authOptions;
65111
65584
  this.sessionId = serviceOptions.sessionId;
@@ -65147,6 +65620,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65147
65620
  }
65148
65621
  else if (_this.options.authType === exports.AuthenticationType.anonymous) {
65149
65622
  // Anonymous authentication, just call the users provided callback.
65623
+ resolve(_this._triggerTokenFetch(true));
65624
+ }
65625
+ else if (_this.options.authType === exports.AuthenticationType.sas) {
65626
+ if (_this.options.sasToken) {
65627
+ var expiresIn = -1;
65628
+ try {
65629
+ expiresIn = _this._getTokenExpiry(_this.options.sasToken);
65630
+ }
65631
+ catch (_a) {
65632
+ reject(new Error("An invalid sasToken was provided."));
65633
+ return;
65634
+ }
65635
+ if (expiresIn > AuthenticationManager.constants.tokenRefreshClockSkew) {
65636
+ // Save the initial token
65637
+ _this._storeToken(_this.options.sasToken);
65638
+ // Create a timer to refresh the token
65639
+ _this._setTimeoutTokenFetch(expiresIn - AuthenticationManager.constants.tokenRefreshClockSkew);
65640
+ resolve();
65641
+ return;
65642
+ }
65643
+ }
65644
+ // Call the users provided callback to fetch the token.
65150
65645
  resolve(_this._triggerTokenFetch());
65151
65646
  }
65152
65647
  else {
@@ -65272,8 +65767,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65272
65767
  }
65273
65768
  return token_1;
65274
65769
  }
65275
- else if (this.options.authType === exports.AuthenticationType.anonymous) {
65276
- var token = this._getItem(AuthenticationManager.constants.storage.accessTokenKey);
65770
+ else if (this.options.authType === exports.AuthenticationType.anonymous
65771
+ || this.options.authType === exports.AuthenticationType.sas) {
65772
+ var token = this._getItem(AuthenticationManager.constants.storage.tokenKey);
65277
65773
  if (!token) {
65278
65774
  // Cached Token not present, invoke the user provided callback function to fetch function
65279
65775
  this._triggerTokenFetch();
@@ -65288,7 +65784,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65288
65784
  }
65289
65785
  else if (expiresIn <= 0) {
65290
65786
  // token renew failed and dont have a token.
65291
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, "");
65787
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, "");
65292
65788
  throw new Error(AuthenticationManager.constants.errors.tokenExpired);
65293
65789
  }
65294
65790
  }
@@ -65317,9 +65813,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65317
65813
  * @param token token fetched from the user's server endpoint
65318
65814
  * @internal
65319
65815
  */
65320
- AuthenticationManager.prototype._storeAccessToken = function (token) {
65816
+ AuthenticationManager.prototype._storeToken = function (token) {
65321
65817
  // Store the value
65322
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, token);
65818
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, token);
65323
65819
  var tokenEvent = {
65324
65820
  map: this.map,
65325
65821
  type: AuthenticationManager.constants.events.tokenAcquired
@@ -65408,7 +65904,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65408
65904
  }
65409
65905
  };
65410
65906
  /**
65411
- * Return the number of milliseconds since 1970/01/01
65907
+ * Return the number of seconds since 1970/01/01
65412
65908
  * @ignore
65413
65909
  */
65414
65910
  AuthenticationManager.prototype._getCurrentTime = function () {
@@ -65427,6 +65923,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65427
65923
  request.headers[constants.msClientIdHeaderName] = this.options.clientId;
65428
65924
  request.headers[constants.authorizationHeaderName] = constants.authorizationTokenPrefix + token;
65429
65925
  break;
65926
+ case exports.AuthenticationType.sas:
65927
+ request.headers[constants.authorizationHeaderName] = constants.jwtSasPrefix + token;
65928
+ break;
65430
65929
  case exports.AuthenticationType.subscriptionKey:
65431
65930
  request.headers["subscription-key"] = token;
65432
65931
  break;
@@ -65442,7 +65941,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65442
65941
  // Enable localStorage for IE, as sessionStorage does not work for localhost.
65443
65942
  preferredCacheLocation: "localStorage",
65444
65943
  storage: {
65445
- accessTokenKey: "access.token.key",
65944
+ tokenKey: "access.token.key",
65446
65945
  testStorageKey: "testStorage"
65447
65946
  },
65448
65947
  events: {
@@ -65851,6 +66350,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65851
66350
 
65852
66351
  // Disable unified signatures linter rule so we can generate separate docs for function overloads.
65853
66352
  // tslint:disable:unified-signatures
66353
+ var MAP_CLIENT_EVENTS = ['maxzoomchanged', 'minzoomchanged', 'mapconfigurationchanged'];
65854
66354
  /**
65855
66355
  * A manager for the map control's events.
65856
66356
  * Exposed through the events property of the atlas.Map class.
@@ -65962,6 +66462,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65962
66462
  * @private
65963
66463
  */
65964
66464
  EventManager.prototype._addGlobalListener = function (eventType, callback, legacy, once) {
66465
+ // add our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
66466
+ if (MAP_CLIENT_EVENTS.includes(eventType)) {
66467
+ this.map._addEventListener(eventType, callback, once);
66468
+ return;
66469
+ }
65965
66470
  var oldModifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, "", callback);
65966
66471
  // Get a new modified callback.
65967
66472
  this.mapCallbackHandler.addCallback(eventType, "", callback, legacy, once);
@@ -65986,9 +66491,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65986
66491
  setTimeout(function () { return modifiedCallback(readyData_1); });
65987
66492
  }
65988
66493
  }
65989
- else if (["minzoomchanged", "maxzoomchanged", "stylesetchanged"].includes(eventType)) {
65990
- this.map._addEventListener(eventType, callback, once);
65991
- }
65992
66494
  else {
65993
66495
  // If a callback already exists disable it so the new one can replace it.
65994
66496
  if (oldModifiedCallback) {
@@ -66085,6 +66587,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
66085
66587
  */
66086
66588
  EventManager.prototype._removeListener = function (eventType, target, callback) {
66087
66589
  var e_5, _a;
66590
+ // remove our custom events emitted by Map client to the map (note: they don't utilize modifiedCallback)
66591
+ if (MAP_CLIENT_EVENTS.includes(eventType)) {
66592
+ this.map._removeEventListener(eventType, callback);
66593
+ return;
66594
+ }
66088
66595
  var layerId = target instanceof Layer ? target.getId() : target;
66089
66596
  var modifiedCallback = this.mapCallbackHandler.getModifiedCallback(eventType, layerId, callback);
66090
66597
  // If a callback already exists disable it so the new one can replace it.
@@ -66992,15 +67499,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
66992
67499
  */
66993
67500
  LayerManager.prototype._removeLayer = function (layer) {
66994
67501
  var layerId = layer instanceof Layer ? layer.getId() : layer;
66995
- if (!this.layerIndex.find(function (l) { return l.getId() === layerId; })) {
67502
+ var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
67503
+ if (layerIndex == -1) {
66996
67504
  throw new Error("The layer '" + layerId + "' has not been added to the map and cannot be removed.");
66997
67505
  }
66998
- var layerIndex = this.layerIndex.findIndex(function (l) { return l.getId() === layerId; });
66999
67506
  var tempLayer = this.layerIndex[layerIndex];
67000
67507
  this._removeMapboxLayers(tempLayer);
67001
67508
  this.layerIndex.splice(layerIndex, 1);
67002
- var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === tempLayer.getId(); });
67003
- if (userLayerIndex >= 0) {
67509
+ var userLayerIndex = this.userLayers.findIndex(function (ul) { return ul.layer.getId() === layerId; });
67510
+ if (userLayerIndex != -1) {
67004
67511
  this.userLayers.splice(userLayerIndex, 1);
67005
67512
  }
67006
67513
  tempLayer.onRemove();
@@ -67976,6 +68483,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
67976
68483
  __extends(StyleOptions, _super);
67977
68484
  function StyleOptions() {
67978
68485
  var _this = _super !== null && _super.apply(this, arguments) || this;
68486
+ /**
68487
+ * If true, the gl context will be created with MSAA antialiasing, which can be useful for antialiasing WebGL layers.
68488
+ */
68489
+ _this.antialias = undefined;
67979
68490
  /**
67980
68491
  * If true the map will automatically resize whenever the window's size changes.
67981
68492
  * Otherwise map.resize() must be called.
@@ -68027,6 +68538,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68027
68538
  * @default true
68028
68539
  */
68029
68540
  _this.showLogo = true;
68541
+ /**
68542
+ * Specifies if the map should display labels
68543
+ * @default true
68544
+ */
68545
+ _this.showLabels = true;
68030
68546
  /**
68031
68547
  * Additional custom attribution appended to map attribution.
68032
68548
  * Default `undefined`
@@ -68167,10 +68683,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68167
68683
  */
68168
68684
  _this.styleAPIVersion = getStyleAPIVersion();
68169
68685
  /**
68170
- * The style set of the map. Determines which styles are available to be picked
68171
- * and what do they consist of (style names, thumbnails, URLs, etc). If passed
68172
- * as a string then the request will be made to resolve it. Use Style Set API
68173
- * for modifications of the style set for all your apps in the field.
68686
+ * The map configuration defines the set of styles available to the map.
68687
+ */
68688
+ _this.mapConfiguration = undefined;
68689
+ /**
68690
+ * @deprecated use mapConfiguration instead
68174
68691
  */
68175
68692
  _this.styleSet = undefined;
68176
68693
  /**
@@ -68341,6 +68858,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68341
68858
  if (merged.authOptions.authType !== exports.AuthenticationType.subscriptionKey) {
68342
68859
  merged["subscription-key"] = merged.subscriptionKey = undefined;
68343
68860
  }
68861
+ // if mapConfiguration is not set and legacy styleSet option is used, assign it to mapConfiguration
68862
+ if (merged.styleSet !== undefined && merged.mapConfiguration === undefined) {
68863
+ merged.mapConfiguration = merged.styleSet;
68864
+ }
68865
+ // reassign properties from legacy mapConfiguration to new structure if needed
68866
+ if (merged.mapConfiguration && typeof merged.mapConfiguration !== 'string') {
68867
+ merged.mapConfiguration = __assign(__assign({}, merged.mapConfiguration), { defaultConfiguration: merged.mapConfiguration.defaultConfiguration || merged.mapConfiguration['defaultStyle'], configurations: merged.mapConfiguration.configurations || merged.mapConfiguration['styles'] });
68868
+ }
68344
68869
  this._transformers = __spread(currentTransforms || [], transformersToMerge.filter(function (toMerge) { return !currentTransforms.includes(toMerge); }));
68345
68870
  if (this.transformRequest && !this._transformers.includes(this.transformRequest)) {
68346
68871
  this._transformers.push(this.transformRequest);
@@ -68545,9 +69070,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68545
69070
  */
68546
69071
  this.indoorState = undefined;
68547
69072
  /**
68548
- * Preserve the styleset that was used before the indoor styleset was set
69073
+ * Preserve the map configuration that was used before the indoor map configuration was set
68549
69074
  */
68550
- this.preservedPreindoorStyleset = undefined;
69075
+ this.preservedPreindoorMapConfiguration = undefined;
68551
69076
  this._onStyleData = function () {
68552
69077
  _this._lookUpAsync(_this.map.getStyle()).then(function (style) {
68553
69078
  _this.map.events.invoke("stylechanged", {
@@ -68570,11 +69095,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68570
69095
  return null;
68571
69096
  }
68572
69097
  else {
68573
- return definitions.styles.find(function (style) { return style.name === (options.style || definitions.defaultStyle); })
69098
+ return definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
68574
69099
  // retrieve default style definition unless option.style's one was found
68575
- || definitions.styles.find(function (style) { return style.name === definitions.defaultStyle; })
68576
- // no default style in the styleSet -> pick the first style
68577
- || definitions.styles[0];
69100
+ || definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
69101
+ // no default style in the mapConfiguration -> pick the first style
69102
+ || definitions.configurations[0];
68578
69103
  }
68579
69104
  };
68580
69105
  this._lookUpAsync = function (options) { return __awaiter(_this, void 0, void 0, function () {
@@ -68584,11 +69109,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68584
69109
  case 0: return [4 /*yield*/, this.definitions()];
68585
69110
  case 1:
68586
69111
  definitions = _a.sent();
68587
- result = definitions.styles.find(function (style) { return style.name === (options.style || definitions.defaultStyle); })
69112
+ result = definitions.configurations.find(function (style) { return style.name === (options.style || definitions.defaultConfiguration); })
68588
69113
  // retrieve default style definition unless option.style's one was found
68589
- || definitions.styles.find(function (style) { return style.name === definitions.defaultStyle; })
68590
- // no default style in the styleSet -> pick the first style
68591
- || definitions.styles[0];
69114
+ || definitions.configurations.find(function (style) { return style.name === definitions.defaultConfiguration; })
69115
+ // no default style in the mapConfiguration -> pick the first style
69116
+ || definitions.configurations[0];
68592
69117
  return [2 /*return*/, result];
68593
69118
  }
68594
69119
  });
@@ -68598,39 +69123,42 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68598
69123
  }
68599
69124
  StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
68600
69125
  var _this = this;
68601
- var styleset = this.map.styles.getMapConfiguration();
68602
- if (styleset) {
68603
- this.preservedPreindoorStyleset = styleset;
69126
+ var _a;
69127
+ var mapConfiguration = this.map.styles.getMapConfiguration();
69128
+ if (mapConfiguration) {
69129
+ this.preservedPreindoorMapConfiguration = mapConfiguration;
68604
69130
  // tilesetId fallback
68605
69131
  // MAGIC: if we are on a default style set - match existing style to the one in the default indoor style set
68606
69132
  var desiredIndoorStyle = this.map.getStyle().style ? this.map.getStyle().style + "_indoor" + (theme === 'dark' ? '_dark' : '') + "_tileset_" + tilesetId : undefined;
68607
- this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, styleset === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
69133
+ this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, mapConfiguration === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
68608
69134
  }
68609
69135
  else {
69136
+ var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
68610
69137
  this.indoorState = {
68611
69138
  tilesetId: tilesetId,
68612
69139
  theme: theme
68613
69140
  };
68614
69141
  this.initStyleset();
68615
69142
  this.definitions().then(function (definitions) {
68616
- var currentStyle = (_this.map.getStyle().style || definitions.defaultStyle)
69143
+ var currentStyle = (_this.map.getStyle().style || definitions.defaultConfiguration)
68617
69144
  .replace('_indoor_dark', '')
68618
69145
  .replace('_indoor', '');
68619
69146
  // we cannot compose the precise style name for auto theme, search for prefix style name match
68620
69147
  var targetStylePrefix = currentStyle + "_indoor";
68621
- var candidateStyle = definitions.styles.find(function (style) { return style.name.startsWith(targetStylePrefix); });
69148
+ var candidateStyle = definitions.configurations.find(function (style) { return style.name.startsWith(targetStylePrefix); });
68622
69149
  if (candidateStyle) {
68623
- _this.map.setStyle({ style: candidateStyle.name });
69150
+ // 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
69151
+ _this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
68624
69152
  }
68625
69153
  });
68626
69154
  }
68627
69155
  };
68628
69156
  StyleManager.prototype.unsetIndoorState = function () {
68629
69157
  var _this = this;
68630
- var styleset = this.preservedPreindoorStyleset;
68631
- if (styleset) {
69158
+ var mapConfiguration = this.preservedPreindoorMapConfiguration;
69159
+ if (mapConfiguration) {
68632
69160
  // we need to revert to the styleset that was ap
68633
- this.map.styles.setMapConfiguration(styleset);
69161
+ this.map.styles.setMapConfiguration(mapConfiguration);
68634
69162
  }
68635
69163
  else {
68636
69164
  this.indoorState = undefined;
@@ -68657,11 +69185,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68657
69185
  var baseName = _this.indoorState && styleName.includes('_indoor') ? styleName.split('_indoor')[0] : styleName;
68658
69186
  return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
68659
69187
  };
68660
- if (!this.serviceOptions.styleSet) {
68661
- newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions").then(function (definitions) { return ({
69188
+ if (!this.serviceOptions.mapConfiguration) {
69189
+ newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
68662
69190
  version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
68663
- defaultStyle: definitions.defaultStyle,
68664
- styles: definitions.styles
69191
+ defaultConfiguration: definitions.defaultStyle,
69192
+ configurations: definitions.styles
68665
69193
  .filter(function (style) {
68666
69194
  if (!_this.indoorState) {
68667
69195
  return !style.name.includes('indoor');
@@ -68685,20 +69213,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68685
69213
  domain: _this.serviceOptions.staticAssetsDomain,
68686
69214
  path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
68687
69215
  queryParams: {
68688
- //[constants.apiVersionQueryParameter]: this.serviceOptions.styleDefinitionsVersion,
68689
- // thus far we don't need to differentiate based on parameter here, as stylePatch will be called on cached styles as well
68690
- //language: styleOptions.language
69216
+ styleVersion: _this.serviceOptions.styleDefinitionsVersion,
68691
69217
  },
68692
69218
  protocol: "https"
68693
69219
  }).toString(),
68694
69220
  }); })
68695
69221
  }); }));
68696
69222
  }
68697
- else if (typeof this.serviceOptions.styleSet === 'string') {
68698
- newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.styleSet, "StyleDefinitions"));
69223
+ else if (typeof this.serviceOptions.mapConfiguration === 'string') {
69224
+ newPromise = new HijackablePromise(this._request(this.serviceOptions.domain, constants.styleResourcePath + "/mapconfigurations/metadata/" + this.serviceOptions.mapConfiguration, "StyleDefinitions"
69225
+ // reassign properties from legacy mapConfiguration to new structure if needed
69226
+ ).then(function (definitions) { return (__assign(__assign({}, definitions), { defaultConfiguration: definitions.defaultConfiguration || definitions['defaultStyle'], configurations: definitions.configurations || definitions['styles'] })); }));
68699
69227
  }
68700
69228
  else {
68701
- newPromise = HijackablePromise.resolve(this.serviceOptions.styleSet);
69229
+ newPromise = HijackablePromise.resolve(this.serviceOptions.mapConfiguration);
68702
69230
  }
68703
69231
  if (this.initPromise) {
68704
69232
  this.initPromise.switchWith(newPromise);
@@ -68708,7 +69236,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68708
69236
  this.initPromise = newPromise;
68709
69237
  }
68710
69238
  // propagate styleset change
68711
- this.initPromise.then(function (styleset) { return _this.map._invokeEvent("stylesetchanged", styleset); });
69239
+ this.initPromise.then(function (styleset) { return _this.map._invokeEvent("mapconfigurationchanged", styleset); });
68712
69240
  return this.initPromise;
68713
69241
  };
68714
69242
  /**
@@ -68731,10 +69259,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68731
69259
  /**
68732
69260
  * @internal
68733
69261
  */
68734
- StyleManager.prototype.setStyle = function (styleOptions) {
69262
+ StyleManager.prototype.setStyle = function (styleOptions, diff) {
69263
+ if (diff === void 0) { diff = true; }
68735
69264
  try {
68736
69265
  this.map._getMap().setStyle(this.getStyle(styleOptions), {
68737
- diff: true,
69266
+ diff: diff,
68738
69267
  stylePatch: this._stylePatch.bind(this),
68739
69268
  validate: this.serviceOptions.validateStyle
68740
69269
  });
@@ -68766,30 +69295,30 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68766
69295
  /**
68767
69296
  * Replaces the style set used. Very costly as it reloads all controls and resources.
68768
69297
  */
68769
- StyleManager.prototype.setMapConfiguration = function (styleSet, styleName) {
69298
+ StyleManager.prototype.setMapConfiguration = function (mapConfiguration, styleName) {
68770
69299
  var _this = this;
68771
- this.serviceOptions.styleSet = styleSet;
68772
- if (typeof styleSet === 'string') {
69300
+ this.serviceOptions.mapConfiguration = mapConfiguration;
69301
+ if (typeof mapConfiguration === 'string') {
68773
69302
  this.initStyleset();
68774
69303
  }
68775
69304
  else {
68776
69305
  if (this.initPromise) {
68777
- this.initPromise.hijackAndResolve(styleSet);
69306
+ this.initPromise.hijackAndResolve(mapConfiguration);
68778
69307
  }
68779
69308
  else {
68780
- this.initPromise = HijackablePromise.resolve(styleSet);
69309
+ this.initPromise = HijackablePromise.resolve(mapConfiguration);
68781
69310
  }
68782
69311
  }
68783
69312
  this.definitions().then(function (definitions) {
68784
- var targetStyleName = definitions.defaultStyle;
68785
- if (definitions.styles.find(function (s) { return s.name === styleName; })) {
69313
+ var targetStyleName = definitions.defaultConfiguration;
69314
+ if (definitions.configurations.find(function (s) { return s.name === styleName; })) {
68786
69315
  targetStyleName = styleName;
68787
69316
  }
68788
69317
  _this.map.setStyle({ style: targetStyleName });
68789
69318
  });
68790
69319
  };
68791
69320
  StyleManager.prototype.getMapConfiguration = function () {
68792
- return this.serviceOptions.styleSet;
69321
+ return this.serviceOptions.mapConfiguration;
68793
69322
  };
68794
69323
  // backward-compatibility: this method preserves the interface that azure-maps-indoor@2.0.6 assumes
68795
69324
  StyleManager.prototype.setStyleSet = function (styleSet) {
@@ -68837,52 +69366,59 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68837
69366
  // A FundamentalMapLayer (grouped layer) representation of the next style must be built.
68838
69367
  var previousLayers = this.map.layers.getLayers();
68839
69368
  var nextLayers = [];
68840
- var currentLayerGroupId = "";
68841
- var currentLayerGroupLayers = [];
68842
- var advanceLayerGroup = function (nextLayerGroup) {
68843
- nextLayers.push(_this._buildFundamentalLayerFrom(currentLayerGroupLayers, currentLayerGroupId));
68844
- currentLayerGroupId = nextLayerGroup;
68845
- currentLayerGroupLayers = [];
68846
- };
69369
+ var layerGroupLayers = {};
68847
69370
  nextStyle.layers.forEach(function (nextLayer) {
68848
- var _a, _b, _c;
69371
+ var _a, _b, _c, _d, _e;
68849
69372
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
68850
- currentLayerGroupId = currentLayerGroupId ? currentLayerGroupId : layerGroup;
68851
- // Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
68852
- if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
68853
- updateLayoutProperty(nextLayer.id, "visibility", "none");
68854
- nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
68855
- nextLayer.layout.visibility = "none";
68856
- }
68857
- else if (nextLayer.type === "fill-extrusion") {
68858
- updateLayoutProperty(nextLayer.id, "visibility", "visible");
68859
- nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
68860
- nextLayer.layout.visibility = "visible";
68861
- }
68862
- // Set visibility of traffic layers depending on traffic settings.
68863
- if (trafficOptions.flow !== "none" && layerGroup) {
68864
- if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
69373
+ if (layerGroup) {
69374
+ // Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
69375
+ if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
69376
+ updateLayoutProperty(nextLayer.id, "visibility", "none");
69377
+ nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
69378
+ nextLayer.layout.visibility = "none";
69379
+ }
69380
+ else if (nextLayer.type === "fill-extrusion") {
68865
69381
  updateLayoutProperty(nextLayer.id, "visibility", "visible");
68866
- nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
69382
+ nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
68867
69383
  nextLayer.layout.visibility = "visible";
68868
69384
  }
68869
- }
68870
- // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
68871
- // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
68872
- // waiting for a styledata.load event to trigger a sync in a different context.
68873
- if (layerGroup) {
68874
- if (currentLayerGroupLayers.length > 0 && layerGroup != currentLayerGroupId) {
68875
- advanceLayerGroup(layerGroup);
69385
+ // Set visibility of traffic layers depending on traffic settings.
69386
+ if (trafficOptions.flow !== "none" && layerGroup) {
69387
+ if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
69388
+ updateLayoutProperty(nextLayer.id, "visibility", "visible");
69389
+ nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
69390
+ nextLayer.layout.visibility = "visible";
69391
+ }
69392
+ }
69393
+ // Set visibility of labels
69394
+ var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
69395
+ if (isLabelLayerGroup && nextLayer.type === 'symbol') {
69396
+ if (styleOptions.showLabels) {
69397
+ updateLayoutProperty(nextLayer.id, "visibility", "visible");
69398
+ nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
69399
+ nextLayer.layout.visibility = "visible";
69400
+ }
69401
+ else {
69402
+ updateLayoutProperty(nextLayer.id, "visibility", "none");
69403
+ nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
69404
+ nextLayer.layout.visibility = "none";
69405
+ }
69406
+ }
69407
+ // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
69408
+ // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
69409
+ // waiting for a styledata.load event to trigger a sync in a different context.
69410
+ if (layerGroupLayers[layerGroup]) {
69411
+ layerGroupLayers[layerGroup].push(nextLayer);
69412
+ }
69413
+ else {
69414
+ layerGroupLayers[layerGroup] = [nextLayer];
68876
69415
  }
68877
- currentLayerGroupLayers.push(nextLayer);
68878
- }
68879
- else if (currentLayerGroupLayers.length > 0) {
68880
- advanceLayerGroup(layerGroup);
68881
69416
  }
68882
69417
  });
68883
- if (currentLayerGroupLayers.length > 0) {
68884
- advanceLayerGroup("");
68885
- }
69418
+ Object.entries(layerGroupLayers).forEach(function (_a) {
69419
+ var _b = __read(_a, 2), layerGroupId = _b[0], layerGroupMapboxLayers = _b[1];
69420
+ nextLayers.push(_this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupId));
69421
+ });
68886
69422
  // Update FundamentalMapLayers in LayerManager
68887
69423
  var userLayers = this.map.layers._getUserLayers();
68888
69424
  var firstUserLayer = userLayers[0];
@@ -68918,6 +69454,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68918
69454
  // Layers added to mapbox through this SDK since loading the last style should be
68919
69455
  // carried over to the next style.
68920
69456
  userLayers.forEach(function (userLayer) {
69457
+ if (userLayer.layer instanceof WebGLLayer) {
69458
+ // mapbox custom layers cannot be serialized and preserved,
69459
+ // return to continue to the next user layer.
69460
+ return;
69461
+ }
68921
69462
  var before = undefined;
68922
69463
  if (_this.map.layers.getLayerById(userLayer.before)) {
68923
69464
  var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
@@ -68929,7 +69470,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68929
69470
  // If there was a previous styledata change event attached, remove it.
68930
69471
  // When the sprite url changes between style changes then mapbox can't perform the diff
68931
69472
  // In such cases it recalculate the style again. Removing previous attached
68932
- // event listner makes sure that style changed event is not fired twice in these cases.
69473
+ // event listener makes sure that style changed event is not fired twice in these cases.
68933
69474
  this.map.events.remove("styledata", this._onStyleData);
68934
69475
  this.map.events.addOnce("styledata", this._onStyleData);
68935
69476
  };
@@ -68958,8 +69499,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68958
69499
  if (url.includes(constants.styleResourcePlaceholder)) {
68959
69500
  params.url = params.url.replace(constants.styleResourcePlaceholder, constants.styleResourcePath);
68960
69501
  }
68961
- params.url = params.url + ("" + (url.includes('?') ? '&' : '?') + constants.apiVersionQueryParameter + "=" + this.serviceOptions.styleAPIVersion);
68962
- (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
69502
+ if (params.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase()) ||
69503
+ params.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase())) {
69504
+ // Only add API version param for Azure maps domain requests
69505
+ var targetUrl = new URL(params.url);
69506
+ if (!targetUrl.searchParams.get(constants.apiVersionQueryParameter)) {
69507
+ targetUrl.searchParams.set(constants.apiVersionQueryParameter, this.serviceOptions.styleAPIVersion);
69508
+ params.url = targetUrl.href;
69509
+ }
69510
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
69511
+ }
68963
69512
  };
68964
69513
  /**
68965
69514
  * Fetches a json resource at the specified domain and path.
@@ -69068,6 +69617,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69068
69617
  }
69069
69618
  else {
69070
69619
  var mapboxMapOptions = {
69620
+ antialias: _this.styleOptions.antialias,
69071
69621
  attributionControl: false,
69072
69622
  container: container,
69073
69623
  fadeDuration: _this.serviceOptions.fadeDuration,
@@ -69364,8 +69914,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69364
69914
  /**
69365
69915
  * Set the map control's style options. Any options not specified will default to their current values.
69366
69916
  * @param options The options for setting the style of the map control.
69917
+ * @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.
69367
69918
  */
69368
- Map.prototype.setStyle = function (options) {
69919
+ Map.prototype.setStyle = function (options, diff) {
69920
+ if (diff === void 0) { diff = true; }
69369
69921
  // This option may only be set when initializing the map.
69370
69922
  // The delete operation will handle non-exist property.
69371
69923
  delete options.preserveDrawingBuffer;
@@ -69403,7 +69955,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69403
69955
  // if the language is changed, then either those delegates need changed
69404
69956
  // or the styledata event manually invoked.
69405
69957
  this.styleOptions = newOptions;
69406
- this._setStyleComponents(newOptions);
69958
+ this._setStyleComponents(newOptions, diff);
69407
69959
  };
69408
69960
  /**
69409
69961
  * Returns the map control's current style settings.
@@ -70056,6 +70608,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70056
70608
  Map.prototype.stop = function () {
70057
70609
  this.map.stop();
70058
70610
  };
70611
+ /**
70612
+ * Trigger the rendering of a single frame.
70613
+ * Use this method with WebGL layers to repaint the map when the layer's
70614
+ * properties or properties associated with the layer's source change.
70615
+ * Calling this multiple times before the next frame is rendered will still
70616
+ * result in only a single frame being rendered.
70617
+ */
70618
+ Map.prototype.triggerRepaint = function () {
70619
+ this.map.triggerRepaint();
70620
+ };
70059
70621
  /**
70060
70622
  * @internal
70061
70623
  */
@@ -70065,10 +70627,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70065
70627
  /**
70066
70628
  * @internal
70067
70629
  */
70068
- Map.prototype._rebuildStyle = function () {
70630
+ Map.prototype._rebuildStyle = function (diff) {
70631
+ if (diff === void 0) { diff = true; }
70069
70632
  return __awaiter(this, void 0, void 0, function () {
70070
70633
  return __generator(this, function (_a) {
70071
- this.styles.setStyle(this.styleOptions);
70634
+ this.styles.setStyle(this.styleOptions, diff);
70072
70635
  this.imageSprite._restoreImages();
70073
70636
  return [2 /*return*/];
70074
70637
  });
@@ -70179,18 +70742,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70179
70742
  * Removes sources and layers that aren't used by the new style or any remaining layers.
70180
70743
  * @private
70181
70744
  */
70182
- Map.prototype._setStyleComponents = function (styleOptions) {
70745
+ Map.prototype._setStyleComponents = function (styleOptions, diff) {
70183
70746
  var _this = this;
70747
+ if (diff === void 0) { diff = true; }
70184
70748
  if (this.removed) {
70185
70749
  return;
70186
70750
  }
70187
70751
  // Check if the default style is set by the client and if it exists in the current style set
70188
- this.styles.definitions().then(function (styleSet) {
70189
- if (!_this.styleOptions.style || !styleSet.styles.map(function (styleSetStyle) { return styleSetStyle.name; }).includes(_this.styleOptions.style)) {
70190
- _this.styleOptions.style = styleSet.defaultStyle;
70752
+ this.styles.definitions().then(function (mapConfiguration) {
70753
+ if (!_this.styleOptions.style || !mapConfiguration.configurations.map(function (mapConfigurationStyle) { return mapConfigurationStyle.name; }).includes(_this.styleOptions.style)) {
70754
+ _this.styleOptions.style = mapConfiguration.defaultConfiguration;
70191
70755
  }
70192
70756
  _this.styleOptions = styleOptions;
70193
- _this._rebuildStyle();
70757
+ _this._rebuildStyle(diff);
70194
70758
  });
70195
70759
  return;
70196
70760
  };
@@ -70236,7 +70800,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70236
70800
  var w = BoundingBox.getWest(bounds);
70237
70801
  var n = BoundingBox.getNorth(bounds);
70238
70802
  var e = BoundingBox.getEast(bounds);
70239
- if (isNaN(s) || isNaN(w) || isNaN(n) || isNaN(e)) {
70803
+ if (!isFinite(s) || !isFinite(w) || !isFinite(n) || !isFinite(e)) {
70240
70804
  throw new Error("The bounds specified are invalid: [" + bounds + "]");
70241
70805
  }
70242
70806
  while (w > e) {