azure-maps-control 2.1.16 → 2.1.17

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.
@@ -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.1.17";
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
  }
@@ -47577,7 +47603,7 @@ 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);
47606
+ this.map.events.remove("stylechanged", this.onStyleChange);
47581
47607
  this.map.events.remove("stylesetchanged", this.onStylesetChange);
47582
47608
  };
47583
47609
  /**
@@ -47632,7 +47658,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47632
47658
  var _this = this;
47633
47659
  var styleOptionButton = document.createElement("button");
47634
47660
  var friendlyName = this.mapToFriendlyStyleName(name, styleset);
47635
- styleOptionButton.setAttribute("alt", friendlyName);
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);
@@ -47720,7 +47743,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
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
47745
  this.onStylesetChange(definitions);
47723
- this.map.events.add("styledata", this.onStyleChange);
47746
+ this.map.events.add("stylechanged", this.onStyleChange);
47724
47747
  return [2 /*return*/];
47725
47748
  });
47726
47749
  }); });
@@ -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;
@@ -55890,6 +55927,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
55890
55927
  // They must use setOptions(...).
55891
55928
  return cloneDeepWith_1(this.options, PopupOptions._cloneCustomizer);
55892
55929
  };
55930
+ /**
55931
+ * Returns popup container element.
55932
+ */
55933
+ Popup.prototype.getPopupContainer = function () {
55934
+ return this.containerDiv;
55935
+ };
55893
55936
  /**
55894
55937
  * Drags the popup to the specified pixel.
55895
55938
  * Accounts for the pixel offset when dragging started.
@@ -56919,6 +56962,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56919
56962
  * Literal value `"anonymous"`
56920
56963
  */
56921
56964
  AuthenticationType["anonymous"] = "anonymous";
56965
+ /**
56966
+ * The shared access signature authentication mechanism. Allows a callback responsible for acquiring a token to be provided on requests.
56967
+ * Literal value `"sas"`.
56968
+ */
56969
+ AuthenticationType["sas"] = "sas";
56922
56970
  })(exports.AuthenticationType || (exports.AuthenticationType = {}));
56923
56971
  /**
56924
56972
  * Options for specifying how the map control should authenticate with the Azure Maps services.
@@ -56958,11 +57006,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56958
57006
  */
56959
57007
  _this.aadInstance = undefined;
56960
57008
  /**
56961
- * A callback to use with the anonymous authentication mechanism.
57009
+ * A callback to use with the anonymous/sas authentication mechanism.
56962
57010
  * This callback will be responsible for resolving to a authentication token.
56963
57011
  * E.g. fetching a CORS protected token from an endpoint.
56964
57012
  */
56965
57013
  _this.getToken = undefined;
57014
+ /**
57015
+ * Optionally provide an initial token for sas authentication.
57016
+ */
57017
+ _this.sasToken = undefined;
56966
57018
  /**
56967
57019
  * Optionally provide an existing `AuthenticationContext` from the ADAL.js library.
56968
57020
  * This authentication context will be used to acquire the AAD token.
@@ -57005,6 +57057,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57005
57057
  this.authType = exports.AuthenticationType.anonymous;
57006
57058
  this.getToken = getTokenCallback;
57007
57059
  };
57060
+ /**
57061
+ * Sets the required options to configure the sas authentication method.
57062
+ * @param getTokenCallback Callback function responsible for resolving to an authentication token.
57063
+ */
57064
+ AuthenticationOptions.prototype.setSasCallbackFunction = function (getTokenCallback) {
57065
+ this.authType = exports.AuthenticationType.sas;
57066
+ this.getToken = getTokenCallback;
57067
+ };
57008
57068
  /**
57009
57069
  * Override the standard merge behavior to handle mutually exclusive options.
57010
57070
  * @internal
@@ -57024,6 +57084,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57024
57084
  else if (merged.authType === exports.AuthenticationType.anonymous) {
57025
57085
  merged.subscriptionKey = merged.authContext = merged.aadAppId = undefined;
57026
57086
  }
57087
+ else if (merged.authType === exports.AuthenticationType.sas) {
57088
+ merged.authContext = merged.subscriptionKey = merged.aadAppId = undefined;
57089
+ }
57027
57090
  return merged;
57028
57091
  };
57029
57092
  return AuthenticationOptions;
@@ -57750,7 +57813,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
57750
57813
  path: "search/address/reverse/json",
57751
57814
  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
57815
  };
57753
- return new Url((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)).get();
57816
+ return new Url(((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(urlOptions)) || urlOptions).get();
57754
57817
  };
57755
57818
  return NearbyGeographySearchService;
57756
57819
  }());
@@ -58954,8 +59017,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58954
59017
  _this.createMapKeyBindingInfo();
58955
59018
  _this.map.getMapContainer().setAttribute("role", "application");
58956
59019
  _this.map.getMapContainer().setAttribute("aria-label", "Map Application");
59020
+ _this.map.getCanvasContainer().setAttribute("aria-live", "polite");
59021
+ _this.map.getCanvasContainer().setAttribute("aria-describedby", "atlas-map-state atlas-map-style");
58957
59022
  _this.map.getCanvas().setAttribute("aria-label", "Interactive Map");
58958
- _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-state atlas-map-style atlas-map-shortcuts");
59023
+ _this.map.getCanvas().setAttribute("aria-describedby", "atlas-map-shortcuts");
58959
59024
  _this.map.getCanvas().setAttribute("alt", "Interactive Map");
58960
59025
  };
58961
59026
  this.removeFromMap = function () {
@@ -58977,10 +59042,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
58977
59042
  delete _this.atlasMapStyleInfo;
58978
59043
  _this.map.getMapContainer().removeAttribute("role");
58979
59044
  _this.map.getMapContainer().removeAttribute("aria-label");
59045
+ _this.map.getCanvasContainer().removeAttribute("aria-live");
59046
+ _this.map.getCanvasContainer().removeAttribute("aria-describedby");
58980
59047
  _this.map.getCanvas().removeAttribute("aria-label");
58981
59048
  _this.map.getCanvas().removeAttribute("aria-describedby");
58982
59049
  _this.map.getCanvas().removeAttribute("alt");
58983
- _this.map.events.remove("styledata", _this.updateMapStyle);
59050
+ _this.map.events.remove("stylechanged", _this.updateMapStyle);
58984
59051
  };
58985
59052
  this.createMapKeyBindingInfo = function () {
58986
59053
  _this.atlasMapKeyBindings = document.createElement("div");
@@ -59005,7 +59072,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59005
59072
  "Jump focus to the map: Escape."
59006
59073
  ].join("\n");
59007
59074
  _this.map.getCanvasContainer().appendChild(_this.atlasMapKeyBindings);
59008
- _this.atlasMapKeyBindings.setAttribute("aria-live", "polite");
59009
59075
  var baseShortcutKeyCodes = [
59010
59076
  // - (zoom out)
59011
59077
  189,
@@ -59037,7 +59103,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59037
59103
  _this.atlasMapLiveStateInfo.id = "atlas-map-state";
59038
59104
  _this.atlasMapLiveStateInfo.classList.add("hidden-accessible-element");
59039
59105
  _this.map.getCanvasContainer().appendChild(_this.atlasMapLiveStateInfo);
59040
- _this.atlasMapLiveStateInfo.setAttribute("aria-live", "assertive");
59041
59106
  }
59042
59107
  };
59043
59108
  this.initializeMapStyleInfo = function () {
@@ -59046,10 +59111,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59046
59111
  _this.atlasMapStyleInfo.setAttribute("aria-hidden", "true");
59047
59112
  _this.atlasMapStyleInfo.id = "atlas-map-style";
59048
59113
  _this.atlasMapStyleInfo.classList.add("hidden-accessible-element");
59049
- _this.updateMapStyle();
59050
- _this.map.events.add("styledata", _this.updateMapStyle);
59114
+ _this.map.events.add("stylechanged", _this.updateMapStyle);
59051
59115
  _this.map.getCanvasContainer().appendChild(_this.atlasMapStyleInfo);
59052
- _this.atlasMapStyleInfo.setAttribute("aria-live", "polite");
59053
59116
  };
59054
59117
  this.updateMapStyle = function () {
59055
59118
  _this.atlasMapStyleInfo.innerHTML = "<p>Map style: " + _this.map.getStyle().style + ".</p>";
@@ -59347,15 +59410,106 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59347
59410
  _this.map.layers.add(_this.incidentLayer, "labels");
59348
59411
  }
59349
59412
  //Create a popup but leave it closed so we can update it and display it later.
59350
- _this.popup = new Popup({
59413
+ _this.clickPopup = new Popup({
59351
59414
  position: [0, 0],
59352
59415
  pixelOffset: [0, -18]
59353
59416
  });
59354
59417
  _this.map.addEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
59355
59418
  _this.map.addEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
59356
59419
  _this.map.addEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
59420
+ _this.map.events.addOnce('idle', _this.setAccessiblePopups);
59421
+ _this.map.events.add('moveend', _this.setAccessiblePopups);
59357
59422
  };
59423
+ this.accessiblePopups = [];
59424
+ this.setAccessiblePopups = function () { return __awaiter(_this, void 0, void 0, function () {
59425
+ var features, localizedStrings, createPopup, insertHiddenBefore, insertHiddenInFront, addHidden;
59426
+ var _this = this;
59427
+ return __generator(this, function (_a) {
59428
+ switch (_a.label) {
59429
+ case 0:
59430
+ this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
59431
+ this.accessiblePopups = [];
59432
+ features = this.map.layers.getRenderedShapes(this.map.getCamera().bounds, this.incidentLayer);
59433
+ return [4 /*yield*/, this.map._getLocalizedStrings()];
59434
+ case 1:
59435
+ localizedStrings = _a.sent();
59436
+ createPopup = function (features, idx) {
59437
+ var incidentFeature = features[idx];
59438
+ var incidentPosition = incidentFeature.geometry.coordinates;
59439
+ var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
59440
+ var incident = new Incident(incidentFeature.properties, point, localizedStrings);
59441
+ var popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
59442
+ var element = popup.getPopupContainer();
59443
+ element.addEventListener('focusin', function (event) {
59444
+ // side effects: clear other managed popups
59445
+ _this.clickPopup.remove();
59446
+ _this.accessiblePopups.filter(function (p) { return p !== popup; }).forEach(function (popup) { return popup.remove(); });
59447
+ // insert previous and next popups
59448
+ if (idx - 1 >= 0) {
59449
+ insertHiddenBefore(popup, createPopup(features, idx - 1));
59450
+ }
59451
+ if (idx + 1 < features.length) {
59452
+ addHidden(createPopup(features, idx + 1));
59453
+ }
59454
+ // if we are on boundaries: add the first / last popup
59455
+ // to maintain popups on full page navigation cycle
59456
+ if (idx >= 2 && idx == features.length - 1) {
59457
+ insertHiddenInFront(createPopup(features, 0));
59458
+ }
59459
+ if (idx == 0 && features.length >= 2) {
59460
+ addHidden(createPopup(features, features.length - 1));
59461
+ }
59462
+ });
59463
+ if (idx == features.length - 1) {
59464
+ element.addEventListener('focusout', function (event) {
59465
+ // close the popup if we detect the focus moving away from the page (relatedTarget === null)
59466
+ // (will remain open otherwise)
59467
+ if (event.relatedTarget === null) {
59468
+ popup.close();
59469
+ }
59470
+ });
59471
+ }
59472
+ _this.accessiblePopups.push(popup);
59473
+ return popup;
59474
+ };
59475
+ insertHiddenBefore = function (base, toInsert) {
59476
+ toInsert.open(_this.map);
59477
+ toInsert.close();
59478
+ var containerToSwapIn = toInsert.getPopupContainer();
59479
+ var baseContainer = base.getPopupContainer();
59480
+ baseContainer.parentElement.insertBefore(containerToSwapIn, baseContainer);
59481
+ };
59482
+ insertHiddenInFront = function (toInsert) {
59483
+ toInsert.open(_this.map);
59484
+ toInsert.close();
59485
+ var containerToSwapIn = toInsert.getPopupContainer();
59486
+ var parent = containerToSwapIn.parentElement;
59487
+ parent.insertBefore(containerToSwapIn, parent.firstElementChild);
59488
+ };
59489
+ addHidden = function (popup) {
59490
+ popup.open(_this.map);
59491
+ popup.close();
59492
+ };
59493
+ if (features.length > 0) {
59494
+ addHidden(createPopup(features, 0));
59495
+ }
59496
+ if (features.length > 1) {
59497
+ addHidden(createPopup(features, features.length - 1));
59498
+ }
59499
+ return [2 /*return*/];
59500
+ }
59501
+ });
59502
+ }); };
59358
59503
  this.removeFromMap = function () {
59504
+ var _a;
59505
+ _this.map.removeEventListener("mouseover", _this.incidentLayerName, _this.cursorToPointer);
59506
+ _this.map.removeEventListener("mouseleave", _this.incidentLayerName, _this.cursorToDefault);
59507
+ _this.map.removeEventListener("click", _this.incidentLayerName, _this.openIncidentPopup);
59508
+ _this.map.events.remove('idle', _this.setAccessiblePopups);
59509
+ _this.map.events.remove('moveend', _this.setAccessiblePopups);
59510
+ _this.accessiblePopups.forEach(function (popup) { return popup.remove(); });
59511
+ _this.accessiblePopups = [];
59512
+ (_a = _this.clickPopup) === null || _a === void 0 ? void 0 : _a.remove();
59359
59513
  if (_this.map.layers.getLayerById(_this.incidentLayerName) != null) {
59360
59514
  _this.map.layers.remove(_this.incidentLayerName);
59361
59515
  }
@@ -59370,14 +59524,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
59370
59524
  _this.map.getCanvas().style.cursor = "";
59371
59525
  };
59372
59526
  this.openIncidentPopup = function (data) {
59373
- _this.popup.remove();
59527
+ _this.clickPopup.remove();
59528
+ _this.accessiblePopups.forEach(function (popup) { return popup.close(); });
59374
59529
  var incidentPosition = data.position;
59375
59530
  var incidentFeature = data.features[0];
59376
59531
  _this.map._getLocalizedStrings().then(function (localizedStrings) {
59377
59532
  var point = new Point(new Position(incidentPosition[0], incidentPosition[1]));
59378
59533
  var incident = new Incident(incidentFeature.properties, point, localizedStrings);
59379
- _this.popup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
59380
- _this.popup.open(_this.map);
59534
+ _this.clickPopup = IncidentPopupFactory.build(incident, _this.incidentLanguage);
59535
+ _this.clickPopup.open(_this.map);
59536
+ var element = _this.clickPopup.getPopupContainer();
59537
+ // ensures popup is closed on tabbing when the focus is moved away from the window
59538
+ element.addEventListener('focusout', function (event) {
59539
+ if (event.relatedTarget === null) {
59540
+ _this.clickPopup.close();
59541
+ }
59542
+ });
59381
59543
  });
59382
59544
  };
59383
59545
  this.map = map;
@@ -65085,17 +65247,19 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65085
65247
  * Triggers the user provided function to fetch the token and stores it.
65086
65248
  * @internal
65087
65249
  */
65088
- this._triggerTokenFetch = function () {
65250
+ this._triggerTokenFetch = function (isAnonymousAuth) {
65251
+ if (isAnonymousAuth === void 0) { isAnonymousAuth = false; }
65089
65252
  return new Promise(function (resolve, reject) {
65253
+ if (typeof _this.options.getToken !== "function") {
65254
+ reject(new Error("Token cannot be " + (isAnonymousAuth ? 'fetched' : 'renewed') + " because getToken was not set or is not a function."));
65255
+ return;
65256
+ }
65090
65257
  _this.options.getToken(function (token) {
65091
65258
  try {
65092
65259
  // Try to get the timeout first as this will guarantee the token is correctly formatted.
65093
65260
  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);
65261
+ _this._storeToken(token);
65262
+ _this._setTimeoutTokenFetch(timeout);
65099
65263
  resolve();
65100
65264
  }
65101
65265
  catch (_a) {
@@ -65106,6 +65270,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65106
65270
  }, _this.map);
65107
65271
  });
65108
65272
  };
65273
+ /**
65274
+ * Create a timer to trigger the user provided function to fetch the token.
65275
+ * @param seconds delay in seconds
65276
+ * @internal
65277
+ */
65278
+ this._setTimeoutTokenFetch = function (seconds) {
65279
+ clearTimeout(_this.tokenTimeOutHandle); // Clear the previous refresh timeout in case it hadn't triggered yet.
65280
+ // @ts-ignore
65281
+ // tslint:disable-next-line: no-string-based-set-timeout
65282
+ _this.tokenTimeOutHandle = setTimeout(_this._triggerTokenFetch, Math.min(seconds * 1000, 0x7fffffff) // setTimeout will fire immediately if the delay is greater than 2^31-1.
65283
+ );
65284
+ };
65109
65285
  var serviceOptions = map.getServiceOptions();
65110
65286
  this.options = serviceOptions.authOptions;
65111
65287
  this.sessionId = serviceOptions.sessionId;
@@ -65147,6 +65323,28 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65147
65323
  }
65148
65324
  else if (_this.options.authType === exports.AuthenticationType.anonymous) {
65149
65325
  // Anonymous authentication, just call the users provided callback.
65326
+ resolve(_this._triggerTokenFetch(true));
65327
+ }
65328
+ else if (_this.options.authType === exports.AuthenticationType.sas) {
65329
+ if (_this.options.sasToken) {
65330
+ var expiresIn = -1;
65331
+ try {
65332
+ expiresIn = _this._getTokenExpiry(_this.options.sasToken);
65333
+ }
65334
+ catch (_a) {
65335
+ reject(new Error("An invalid sasToken was provided."));
65336
+ return;
65337
+ }
65338
+ if (expiresIn > AuthenticationManager.constants.tokenRefreshClockSkew) {
65339
+ // Save the initial token
65340
+ _this._storeToken(_this.options.sasToken);
65341
+ // Create a timer to refresh the token
65342
+ _this._setTimeoutTokenFetch(expiresIn - AuthenticationManager.constants.tokenRefreshClockSkew);
65343
+ resolve();
65344
+ return;
65345
+ }
65346
+ }
65347
+ // Call the users provided callback to fetch the token.
65150
65348
  resolve(_this._triggerTokenFetch());
65151
65349
  }
65152
65350
  else {
@@ -65272,8 +65470,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65272
65470
  }
65273
65471
  return token_1;
65274
65472
  }
65275
- else if (this.options.authType === exports.AuthenticationType.anonymous) {
65276
- var token = this._getItem(AuthenticationManager.constants.storage.accessTokenKey);
65473
+ else if (this.options.authType === exports.AuthenticationType.anonymous
65474
+ || this.options.authType === exports.AuthenticationType.sas) {
65475
+ var token = this._getItem(AuthenticationManager.constants.storage.tokenKey);
65277
65476
  if (!token) {
65278
65477
  // Cached Token not present, invoke the user provided callback function to fetch function
65279
65478
  this._triggerTokenFetch();
@@ -65288,7 +65487,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65288
65487
  }
65289
65488
  else if (expiresIn <= 0) {
65290
65489
  // token renew failed and dont have a token.
65291
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, "");
65490
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, "");
65292
65491
  throw new Error(AuthenticationManager.constants.errors.tokenExpired);
65293
65492
  }
65294
65493
  }
@@ -65317,9 +65516,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65317
65516
  * @param token token fetched from the user's server endpoint
65318
65517
  * @internal
65319
65518
  */
65320
- AuthenticationManager.prototype._storeAccessToken = function (token) {
65519
+ AuthenticationManager.prototype._storeToken = function (token) {
65321
65520
  // Store the value
65322
- this._saveItem(AuthenticationManager.constants.storage.accessTokenKey, token);
65521
+ this._saveItem(AuthenticationManager.constants.storage.tokenKey, token);
65323
65522
  var tokenEvent = {
65324
65523
  map: this.map,
65325
65524
  type: AuthenticationManager.constants.events.tokenAcquired
@@ -65408,7 +65607,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65408
65607
  }
65409
65608
  };
65410
65609
  /**
65411
- * Return the number of milliseconds since 1970/01/01
65610
+ * Return the number of seconds since 1970/01/01
65412
65611
  * @ignore
65413
65612
  */
65414
65613
  AuthenticationManager.prototype._getCurrentTime = function () {
@@ -65427,6 +65626,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65427
65626
  request.headers[constants.msClientIdHeaderName] = this.options.clientId;
65428
65627
  request.headers[constants.authorizationHeaderName] = constants.authorizationTokenPrefix + token;
65429
65628
  break;
65629
+ case exports.AuthenticationType.sas:
65630
+ request.headers[constants.authorizationHeaderName] = constants.jwtSasPrefix + token;
65631
+ break;
65430
65632
  case exports.AuthenticationType.subscriptionKey:
65431
65633
  request.headers["subscription-key"] = token;
65432
65634
  break;
@@ -65442,7 +65644,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
65442
65644
  // Enable localStorage for IE, as sessionStorage does not work for localhost.
65443
65645
  preferredCacheLocation: "localStorage",
65444
65646
  storage: {
65445
- accessTokenKey: "access.token.key",
65647
+ tokenKey: "access.token.key",
65446
65648
  testStorageKey: "testStorage"
65447
65649
  },
65448
65650
  events: {
@@ -68027,6 +68229,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68027
68229
  * @default true
68028
68230
  */
68029
68231
  _this.showLogo = true;
68232
+ /**
68233
+ * Specifies if the map should display labels
68234
+ * @default true
68235
+ */
68236
+ _this.showLabels = true;
68030
68237
  /**
68031
68238
  * Additional custom attribution appended to map attribution.
68032
68239
  * Default `undefined`
@@ -68598,6 +68805,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68598
68805
  }
68599
68806
  StyleManager.prototype.updateIndoorState = function (theme, tilesetId) {
68600
68807
  var _this = this;
68808
+ var _a;
68601
68809
  var styleset = this.map.styles.getMapConfiguration();
68602
68810
  if (styleset) {
68603
68811
  this.preservedPreindoorStyleset = styleset;
@@ -68607,6 +68815,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68607
68815
  this.map.styles.setMapConfiguration("defaultIndoor_" + tilesetId, styleset === 'microsoft-maps:default' ? desiredIndoorStyle : undefined);
68608
68816
  }
68609
68817
  else {
68818
+ var didTilesetIdChange_1 = ((_a = this.indoorState) === null || _a === void 0 ? void 0 : _a.tilesetId) !== tilesetId;
68610
68819
  this.indoorState = {
68611
68820
  tilesetId: tilesetId,
68612
68821
  theme: theme
@@ -68620,7 +68829,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68620
68829
  var targetStylePrefix = currentStyle + "_indoor";
68621
68830
  var candidateStyle = definitions.styles.find(function (style) { return style.name.startsWith(targetStylePrefix); });
68622
68831
  if (candidateStyle) {
68623
- _this.map.setStyle({ style: candidateStyle.name });
68832
+ // 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
68833
+ _this.map.setStyle({ style: candidateStyle.name }, !didTilesetIdChange_1);
68624
68834
  }
68625
68835
  });
68626
68836
  }
@@ -68658,7 +68868,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68658
68868
  return baseName in styleNamesMap ? styleNamesMap[baseName] : baseName;
68659
68869
  };
68660
68870
  if (!this.serviceOptions.styleSet) {
68661
- newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions").then(function (definitions) { return ({
68871
+ newPromise = new HijackablePromise(this._request(this.serviceOptions.staticAssetsDomain, constants.stylePath + "/" + constants.styleResourcePath, "StyleDefinitions", { version: this.serviceOptions.styleDefinitionsVersion }).then(function (definitions) { return ({
68662
68872
  version: isNaN(definitions.version) ? 0 : parseFloat(definitions.version),
68663
68873
  defaultStyle: definitions.defaultStyle,
68664
68874
  styles: definitions.styles
@@ -68685,9 +68895,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68685
68895
  domain: _this.serviceOptions.staticAssetsDomain,
68686
68896
  path: constants.stylePath + "/" + constants.styleResourcePath + "/" + style.name,
68687
68897
  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
68898
+ styleVersion: _this.serviceOptions.styleDefinitionsVersion,
68691
68899
  },
68692
68900
  protocol: "https"
68693
68901
  }).toString(),
@@ -68731,10 +68939,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68731
68939
  /**
68732
68940
  * @internal
68733
68941
  */
68734
- StyleManager.prototype.setStyle = function (styleOptions) {
68942
+ StyleManager.prototype.setStyle = function (styleOptions, diff) {
68943
+ if (diff === void 0) { diff = true; }
68735
68944
  try {
68736
68945
  this.map._getMap().setStyle(this.getStyle(styleOptions), {
68737
- diff: true,
68946
+ diff: diff,
68738
68947
  stylePatch: this._stylePatch.bind(this),
68739
68948
  validate: this.serviceOptions.validateStyle
68740
68949
  });
@@ -68845,7 +69054,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68845
69054
  currentLayerGroupLayers = [];
68846
69055
  };
68847
69056
  nextStyle.layers.forEach(function (nextLayer) {
68848
- var _a, _b, _c;
69057
+ var _a, _b, _c, _d, _e;
68849
69058
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
68850
69059
  currentLayerGroupId = currentLayerGroupId ? currentLayerGroupId : layerGroup;
68851
69060
  // Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
@@ -68867,6 +69076,20 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68867
69076
  nextLayer.layout.visibility = "visible";
68868
69077
  }
68869
69078
  }
69079
+ // Set visibility of labels
69080
+ var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
69081
+ if (isLabelLayerGroup && nextLayer.type === 'symbol') {
69082
+ if (styleOptions.showLabels) {
69083
+ updateLayoutProperty(nextLayer.id, "visibility", "visible");
69084
+ nextLayer.layout = (_d = nextLayer.layout) !== null && _d !== void 0 ? _d : {};
69085
+ nextLayer.layout.visibility = "visible";
69086
+ }
69087
+ else {
69088
+ updateLayoutProperty(nextLayer.id, "visibility", "none");
69089
+ nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
69090
+ nextLayer.layout.visibility = "none";
69091
+ }
69092
+ }
68870
69093
  // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
68871
69094
  // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
68872
69095
  // waiting for a styledata.load event to trigger a sync in a different context.
@@ -68929,7 +69152,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68929
69152
  // If there was a previous styledata change event attached, remove it.
68930
69153
  // When the sprite url changes between style changes then mapbox can't perform the diff
68931
69154
  // 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.
69155
+ // event listener makes sure that style changed event is not fired twice in these cases.
68933
69156
  this.map.events.remove("styledata", this._onStyleData);
68934
69157
  this.map.events.addOnce("styledata", this._onStyleData);
68935
69158
  };
@@ -68958,8 +69181,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68958
69181
  if (url.includes(constants.styleResourcePlaceholder)) {
68959
69182
  params.url = params.url.replace(constants.styleResourcePlaceholder, constants.styleResourcePath);
68960
69183
  }
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);
69184
+ if (params.url.toLocaleLowerCase().includes(this.serviceOptions.domain.toLocaleLowerCase()) ||
69185
+ params.url.toLocaleLowerCase().includes(this.serviceOptions.staticAssetsDomain.toLocaleLowerCase())) {
69186
+ // Only add API version param for Azure maps domain requests
69187
+ var targetUrl = new URL(params.url);
69188
+ if (!targetUrl.searchParams.get(constants.apiVersionQueryParameter)) {
69189
+ targetUrl.searchParams.set(constants.apiVersionQueryParameter, this.serviceOptions.styleAPIVersion);
69190
+ params.url = targetUrl.href;
69191
+ }
69192
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
69193
+ }
68963
69194
  };
68964
69195
  /**
68965
69196
  * Fetches a json resource at the specified domain and path.
@@ -69364,8 +69595,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69364
69595
  /**
69365
69596
  * Set the map control's style options. Any options not specified will default to their current values.
69366
69597
  * @param options The options for setting the style of the map control.
69598
+ * @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
69599
  */
69368
- Map.prototype.setStyle = function (options) {
69600
+ Map.prototype.setStyle = function (options, diff) {
69601
+ if (diff === void 0) { diff = true; }
69369
69602
  // This option may only be set when initializing the map.
69370
69603
  // The delete operation will handle non-exist property.
69371
69604
  delete options.preserveDrawingBuffer;
@@ -69403,7 +69636,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
69403
69636
  // if the language is changed, then either those delegates need changed
69404
69637
  // or the styledata event manually invoked.
69405
69638
  this.styleOptions = newOptions;
69406
- this._setStyleComponents(newOptions);
69639
+ this._setStyleComponents(newOptions, diff);
69407
69640
  };
69408
69641
  /**
69409
69642
  * Returns the map control's current style settings.
@@ -70065,10 +70298,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70065
70298
  /**
70066
70299
  * @internal
70067
70300
  */
70068
- Map.prototype._rebuildStyle = function () {
70301
+ Map.prototype._rebuildStyle = function (diff) {
70302
+ if (diff === void 0) { diff = true; }
70069
70303
  return __awaiter(this, void 0, void 0, function () {
70070
70304
  return __generator(this, function (_a) {
70071
- this.styles.setStyle(this.styleOptions);
70305
+ this.styles.setStyle(this.styleOptions, diff);
70072
70306
  this.imageSprite._restoreImages();
70073
70307
  return [2 /*return*/];
70074
70308
  });
@@ -70179,8 +70413,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70179
70413
  * Removes sources and layers that aren't used by the new style or any remaining layers.
70180
70414
  * @private
70181
70415
  */
70182
- Map.prototype._setStyleComponents = function (styleOptions) {
70416
+ Map.prototype._setStyleComponents = function (styleOptions, diff) {
70183
70417
  var _this = this;
70418
+ if (diff === void 0) { diff = true; }
70184
70419
  if (this.removed) {
70185
70420
  return;
70186
70421
  }
@@ -70190,7 +70425,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70190
70425
  _this.styleOptions.style = styleSet.defaultStyle;
70191
70426
  }
70192
70427
  _this.styleOptions = styleOptions;
70193
- _this._rebuildStyle();
70428
+ _this._rebuildStyle(diff);
70194
70429
  });
70195
70430
  return;
70196
70431
  };
@@ -70236,7 +70471,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
70236
70471
  var w = BoundingBox.getWest(bounds);
70237
70472
  var n = BoundingBox.getNorth(bounds);
70238
70473
  var e = BoundingBox.getEast(bounds);
70239
- if (isNaN(s) || isNaN(w) || isNaN(n) || isNaN(e)) {
70474
+ if (!isFinite(s) || !isFinite(w) || !isFinite(n) || !isFinite(e)) {
70240
70475
  throw new Error("The bounds specified are invalid: [" + bounds + "]");
70241
70476
  }
70242
70477
  while (w > e) {