@mapvx/web-js 1.1.0 → 1.1.2-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -2
- package/README.md +12 -9
- package/dist/cjs/assets/icons.js +6 -8
- package/dist/cjs/assets/icons.js.map +1 -1
- package/dist/cjs/controllers/routeController.js +19 -19
- package/dist/cjs/controllers/routeController.js.map +1 -1
- package/dist/cjs/domain/models/animation.js +2 -2
- package/dist/cjs/domain/models/categories.js +23 -10
- package/dist/cjs/domain/models/categories.js.map +1 -1
- package/dist/cjs/domain/models/circle.js +253 -0
- package/dist/cjs/domain/models/circle.js.map +1 -0
- package/dist/cjs/domain/models/mapConfig.js +10 -1
- package/dist/cjs/domain/models/mapConfig.js.map +1 -1
- package/dist/cjs/domain/models/marker.js +92 -80
- package/dist/cjs/domain/models/marker.js.map +1 -1
- package/dist/cjs/domain/models/routeConfiguration.js +3 -1
- package/dist/cjs/domain/models/routeConfiguration.js.map +1 -1
- package/dist/cjs/index.js +24 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger/logger.js +21 -9
- package/dist/cjs/logger/logger.js.map +1 -1
- package/dist/cjs/logger/rollbar.js +21 -8
- package/dist/cjs/logger/rollbar.js.map +1 -1
- package/dist/cjs/map/map.js +446 -28
- package/dist/cjs/map/map.js.map +1 -1
- package/dist/cjs/map/mapInteractionOptions.js +56 -0
- package/dist/cjs/map/mapInteractionOptions.js.map +1 -0
- package/dist/cjs/repository/repository.js +25 -26
- package/dist/cjs/repository/repository.js.map +1 -1
- package/dist/cjs/repository/requester.js +71 -91
- package/dist/cjs/repository/requester.js.map +1 -1
- package/dist/cjs/sdk.js +18 -1
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/cjs/utils/preconnect.js +131 -0
- package/dist/cjs/utils/preconnect.js.map +1 -0
- package/dist/cjs/utils/semaphore.js +143 -0
- package/dist/cjs/utils/semaphore.js.map +1 -0
- package/dist/es/assets/icons.d.ts +4 -4
- package/dist/es/assets/icons.d.ts.map +1 -1
- package/dist/es/assets/icons.js +6 -8
- package/dist/es/assets/icons.js.map +1 -1
- package/dist/es/controllers/routeController.d.ts.map +1 -1
- package/dist/es/controllers/routeController.js +19 -19
- package/dist/es/controllers/routeController.js.map +1 -1
- package/dist/es/domain/models/animation.d.ts +3 -3
- package/dist/es/domain/models/animation.js +2 -2
- package/dist/es/domain/models/categories.d.ts +34 -10
- package/dist/es/domain/models/categories.d.ts.map +1 -1
- package/dist/es/domain/models/categories.js +21 -9
- package/dist/es/domain/models/categories.js.map +1 -1
- package/dist/es/domain/models/circle.d.ts +222 -0
- package/dist/es/domain/models/circle.d.ts.map +1 -0
- package/dist/es/domain/models/circle.js +246 -0
- package/dist/es/domain/models/circle.js.map +1 -0
- package/dist/es/domain/models/configuration.d.ts +8 -0
- package/dist/es/domain/models/configuration.d.ts.map +1 -1
- package/dist/es/domain/models/mapConfig.d.ts +118 -3
- package/dist/es/domain/models/mapConfig.d.ts.map +1 -1
- package/dist/es/domain/models/mapConfig.js +9 -0
- package/dist/es/domain/models/mapConfig.js.map +1 -1
- package/dist/es/domain/models/marker.d.ts +16 -0
- package/dist/es/domain/models/marker.d.ts.map +1 -1
- package/dist/es/domain/models/marker.js +92 -80
- package/dist/es/domain/models/marker.js.map +1 -1
- package/dist/es/domain/models/routeConfiguration.d.ts +47 -0
- package/dist/es/domain/models/routeConfiguration.d.ts.map +1 -1
- package/dist/es/domain/models/routeConfiguration.js +3 -1
- package/dist/es/domain/models/routeConfiguration.js.map +1 -1
- package/dist/es/index.d.ts +15 -11
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +10 -5
- package/dist/es/index.js.map +1 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts.map +1 -1
- package/dist/es/logger/logger.d.ts.map +1 -1
- package/dist/es/logger/logger.js +21 -9
- package/dist/es/logger/logger.js.map +1 -1
- package/dist/es/logger/rollbar.d.ts.map +1 -1
- package/dist/es/logger/rollbar.js +21 -8
- package/dist/es/logger/rollbar.js.map +1 -1
- package/dist/es/map/map.d.ts +298 -0
- package/dist/es/map/map.d.ts.map +1 -1
- package/dist/es/map/map.js +447 -29
- package/dist/es/map/map.js.map +1 -1
- package/dist/es/map/mapInteractionOptions.d.ts +37 -0
- package/dist/es/map/mapInteractionOptions.d.ts.map +1 -0
- package/dist/es/map/mapInteractionOptions.js +51 -0
- package/dist/es/map/mapInteractionOptions.js.map +1 -0
- package/dist/es/repository/repository.d.ts +0 -1
- package/dist/es/repository/repository.d.ts.map +1 -1
- package/dist/es/repository/repository.js +25 -26
- package/dist/es/repository/repository.js.map +1 -1
- package/dist/es/repository/requester.d.ts +12 -2
- package/dist/es/repository/requester.d.ts.map +1 -1
- package/dist/es/repository/requester.js +71 -91
- package/dist/es/repository/requester.js.map +1 -1
- package/dist/es/sdk.d.ts +2 -0
- package/dist/es/sdk.d.ts.map +1 -1
- package/dist/es/sdk.js +18 -1
- package/dist/es/sdk.js.map +1 -1
- package/dist/es/utils/preconnect.d.ts +45 -0
- package/dist/es/utils/preconnect.d.ts.map +1 -0
- package/dist/es/utils/preconnect.js +127 -0
- package/dist/es/utils/preconnect.js.map +1 -0
- package/dist/es/utils/semaphore.d.ts +70 -0
- package/dist/es/utils/semaphore.d.ts.map +1 -0
- package/dist/es/utils/semaphore.js +139 -0
- package/dist/es/utils/semaphore.js.map +1 -0
- package/dist/umd/index.js +1968 -669
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/styles.css +32 -14
- package/dist/umd/styles.css.map +1 -1
- package/package.json +63 -49
- package/dist/cjs/assets/route_animation_icon.svg +0 -15
- package/dist/cjs/assets/user-dot-icon.svg +0 -3
- package/dist/es/assets/route_animation_icon.svg +0 -15
- package/dist/es/assets/user-dot-icon.svg +0 -3
package/dist/umd/index.js
CHANGED
|
@@ -5721,13 +5721,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5721
5721
|
__webpack_require__.d(__webpack_exports__, {
|
|
5722
5722
|
AnnounceFormat: () => (/* reexport */ AnnounceFormat),
|
|
5723
5723
|
Banner: () => (/* reexport */ Banner),
|
|
5724
|
+
CIRCLE_DEFAULTS: () => (/* reexport */ CIRCLE_DEFAULTS),
|
|
5724
5725
|
CacheManager: () => (/* reexport */ CacheManager),
|
|
5725
5726
|
CountlyLogger: () => (/* reexport */ CountlyLogger),
|
|
5726
5727
|
DEFAULT_CACHE_CONFIGS: () => (/* reexport */ DEFAULT_CACHE_CONFIGS),
|
|
5727
5728
|
DEFAULT_MAX_STORAGE_BYTES: () => (/* reexport */ DEFAULT_MAX_STORAGE_BYTES),
|
|
5729
|
+
DEFAULT_TILE_CACHE_CONFIG: () => (/* reexport */ DEFAULT_TILE_CACHE_CONFIG),
|
|
5728
5730
|
FetchHttpClient: () => (/* reexport */ FetchHttpClient),
|
|
5729
5731
|
Institution: () => (/* reexport */ Institution),
|
|
5730
5732
|
LRUCache: () => (/* reexport */ LRUCache),
|
|
5733
|
+
MAPLIBRE_MAX_TILE_CACHE_HARD_CAP: () => (/* reexport */ MAPLIBRE_MAX_TILE_CACHE_HARD_CAP),
|
|
5734
|
+
MAPVX_BRAND_COLOR: () => (/* reexport */ MAPVX_BRAND_COLOR),
|
|
5735
|
+
MAPVX_DEFAULT_PRECONNECT_HOSTS: () => (/* reexport */ MAPVX_DEFAULT_PRECONNECT_HOSTS),
|
|
5731
5736
|
MVXPlace: () => (/* reexport */ place_MVXPlace),
|
|
5732
5737
|
MVXRoute: () => (/* reexport */ MVXRoute),
|
|
5733
5738
|
MVXRouteLeg: () => (/* reexport */ MVXRouteLeg),
|
|
@@ -5738,17 +5743,119 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5738
5743
|
TextPosition: () => (/* reexport */ TextPosition),
|
|
5739
5744
|
TransportationMode: () => (/* reexport */ TransportationMode),
|
|
5740
5745
|
UnitSystem: () => (/* reexport */ UnitSystem),
|
|
5746
|
+
circleRing: () => (/* reexport */ circleRing),
|
|
5741
5747
|
createRouteAnimationIconDataUrl: () => (/* reexport */ createRouteAnimationIconDataUrl),
|
|
5742
5748
|
initializeSDK: () => (/* reexport */ initializeSDK),
|
|
5749
|
+
injectPreconnects: () => (/* reexport */ injectPreconnects),
|
|
5743
5750
|
isBasicWithIcon: () => (/* reexport */ isBasicWithIcon),
|
|
5751
|
+
isBasicWithImageUrl: () => (/* reexport */ isBasicWithImageUrl),
|
|
5744
5752
|
isBasicWithLogo: () => (/* reexport */ isBasicWithLogo),
|
|
5745
5753
|
isMapVxRequestHostname: () => (/* reexport */ isMapVxRequestHostname),
|
|
5754
|
+
isValidCircleConfig: () => (/* reexport */ isValidCircleConfig),
|
|
5746
5755
|
loadCustomization: () => (/* reexport */ loadCustomization),
|
|
5747
5756
|
loadStyles: () => (/* binding */ loadStyles)
|
|
5748
5757
|
});
|
|
5749
5758
|
|
|
5750
|
-
;// ./src/infrastructure/cache/
|
|
5759
|
+
;// ./src/infrastructure/cache/cacheConfig.ts
|
|
5751
5760
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5761
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5762
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5763
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5764
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
5765
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5766
|
+
/**
|
|
5767
|
+
* Cache configuration types and defaults
|
|
5768
|
+
* Defines the configuration options for the caching system
|
|
5769
|
+
* @module cacheConfig
|
|
5770
|
+
*/
|
|
5771
|
+
|
|
5772
|
+
/**
|
|
5773
|
+
* Cache types available in the SDK
|
|
5774
|
+
* @group Configuration
|
|
5775
|
+
*/
|
|
5776
|
+
|
|
5777
|
+
/**
|
|
5778
|
+
* Configuration for a single cache instance
|
|
5779
|
+
* @group Configuration
|
|
5780
|
+
*/
|
|
5781
|
+
|
|
5782
|
+
/**
|
|
5783
|
+
* Configuration for the CacheManager
|
|
5784
|
+
* @group Configuration
|
|
5785
|
+
*/
|
|
5786
|
+
|
|
5787
|
+
/**
|
|
5788
|
+
* Default maximum storage size: 5MB
|
|
5789
|
+
*/
|
|
5790
|
+
var DEFAULT_MAX_STORAGE_BYTES = 5 * 1024 * 1024;
|
|
5791
|
+
|
|
5792
|
+
/**
|
|
5793
|
+
* Default cache configurations per type
|
|
5794
|
+
* These values balance memory usage with performance
|
|
5795
|
+
*/
|
|
5796
|
+
var DEFAULT_CACHE_CONFIGS = {
|
|
5797
|
+
places: {
|
|
5798
|
+
maxItems: 500,
|
|
5799
|
+
ttlMs: 30 * 60 * 1000,
|
|
5800
|
+
// 30 minutes
|
|
5801
|
+
persistenceKey: "mvx_places"
|
|
5802
|
+
},
|
|
5803
|
+
routes: {
|
|
5804
|
+
maxItems: 100,
|
|
5805
|
+
ttlMs: 5 * 60 * 1000,
|
|
5806
|
+
// 5 minutes
|
|
5807
|
+
persistenceKey: "mvx_routes"
|
|
5808
|
+
},
|
|
5809
|
+
accessibleRoutes: {
|
|
5810
|
+
maxItems: 100,
|
|
5811
|
+
ttlMs: 5 * 60 * 1000,
|
|
5812
|
+
// 5 minutes
|
|
5813
|
+
persistenceKey: "mvx_accessible_routes"
|
|
5814
|
+
},
|
|
5815
|
+
configurations: {
|
|
5816
|
+
maxItems: 10,
|
|
5817
|
+
ttlMs: 60 * 60 * 1000,
|
|
5818
|
+
// 1 hour
|
|
5819
|
+
persistenceKey: "mvx_configurations"
|
|
5820
|
+
},
|
|
5821
|
+
categories: {
|
|
5822
|
+
maxItems: 20,
|
|
5823
|
+
ttlMs: 60 * 60 * 1000,
|
|
5824
|
+
// 1 hour
|
|
5825
|
+
persistenceKey: "mvx_categories"
|
|
5826
|
+
},
|
|
5827
|
+
vehicles: {
|
|
5828
|
+
maxItems: 50,
|
|
5829
|
+
ttlMs: 60 * 1000,
|
|
5830
|
+
// 1 minute
|
|
5831
|
+
persistenceKey: "mvx_vehicles"
|
|
5832
|
+
},
|
|
5833
|
+
stops: {
|
|
5834
|
+
maxItems: 100,
|
|
5835
|
+
ttlMs: 60 * 1000,
|
|
5836
|
+
// 1 minute
|
|
5837
|
+
persistenceKey: "mvx_stops"
|
|
5838
|
+
},
|
|
5839
|
+
subPlaces: {
|
|
5840
|
+
maxItems: 200,
|
|
5841
|
+
ttlMs: 15 * 60 * 1000,
|
|
5842
|
+
// 15 minutes
|
|
5843
|
+
persistenceKey: "mvx_subplaces"
|
|
5844
|
+
}
|
|
5845
|
+
};
|
|
5846
|
+
|
|
5847
|
+
/**
|
|
5848
|
+
* Merges user config with defaults for a specific cache type
|
|
5849
|
+
* @param cacheType - The type of cache
|
|
5850
|
+
* @param userConfig - Optional user-provided configuration
|
|
5851
|
+
* @returns Complete cache configuration
|
|
5852
|
+
*/
|
|
5853
|
+
function getCacheConfig(cacheType, userConfig) {
|
|
5854
|
+
var defaultConfig = DEFAULT_CACHE_CONFIGS[cacheType];
|
|
5855
|
+
return _objectSpread(_objectSpread({}, defaultConfig), userConfig);
|
|
5856
|
+
}
|
|
5857
|
+
;// ./src/infrastructure/cache/LRUCache.ts
|
|
5858
|
+
function LRUCache_typeof(o) { "@babel/helpers - typeof"; return LRUCache_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, LRUCache_typeof(o); }
|
|
5752
5859
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
5753
5860
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5754
5861
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
@@ -5757,11 +5864,11 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
5757
5864
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5758
5865
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5759
5866
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5760
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e,
|
|
5867
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, LRUCache_toPropertyKey(o.key), o); } }
|
|
5761
5868
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5762
|
-
function
|
|
5763
|
-
function
|
|
5764
|
-
function
|
|
5869
|
+
function LRUCache_defineProperty(e, r, t) { return (r = LRUCache_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5870
|
+
function LRUCache_toPropertyKey(t) { var i = LRUCache_toPrimitive(t, "string"); return "symbol" == LRUCache_typeof(i) ? i : i + ""; }
|
|
5871
|
+
function LRUCache_toPrimitive(t, r) { if ("object" != LRUCache_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != LRUCache_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5765
5872
|
/**
|
|
5766
5873
|
* Internal cache entry structure
|
|
5767
5874
|
*/
|
|
@@ -5788,10 +5895,10 @@ var LRUCache = /*#__PURE__*/function () {
|
|
|
5788
5895
|
function LRUCache(config) {
|
|
5789
5896
|
_classCallCheck(this, LRUCache);
|
|
5790
5897
|
// Hit rate tracking
|
|
5791
|
-
|
|
5792
|
-
|
|
5898
|
+
LRUCache_defineProperty(this, "hits", 0);
|
|
5899
|
+
LRUCache_defineProperty(this, "misses", 0);
|
|
5793
5900
|
// Monotonic counter for LRU ordering (avoids issues with same-millisecond operations)
|
|
5794
|
-
|
|
5901
|
+
LRUCache_defineProperty(this, "accessCounter", 0);
|
|
5795
5902
|
this.cache = new Map();
|
|
5796
5903
|
this.maxItems = config.maxItems;
|
|
5797
5904
|
this.ttlMs = config.ttlMs;
|
|
@@ -5959,104 +6066,6 @@ var LRUCache = /*#__PURE__*/function () {
|
|
|
5959
6066
|
}
|
|
5960
6067
|
}]);
|
|
5961
6068
|
}();
|
|
5962
|
-
;// ./src/infrastructure/cache/cacheConfig.ts
|
|
5963
|
-
function cacheConfig_typeof(o) { "@babel/helpers - typeof"; return cacheConfig_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, cacheConfig_typeof(o); }
|
|
5964
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5965
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { cacheConfig_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5966
|
-
function cacheConfig_defineProperty(e, r, t) { return (r = cacheConfig_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5967
|
-
function cacheConfig_toPropertyKey(t) { var i = cacheConfig_toPrimitive(t, "string"); return "symbol" == cacheConfig_typeof(i) ? i : i + ""; }
|
|
5968
|
-
function cacheConfig_toPrimitive(t, r) { if ("object" != cacheConfig_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != cacheConfig_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5969
|
-
/**
|
|
5970
|
-
* Cache configuration types and defaults
|
|
5971
|
-
* Defines the configuration options for the caching system
|
|
5972
|
-
* @module cacheConfig
|
|
5973
|
-
*/
|
|
5974
|
-
|
|
5975
|
-
/**
|
|
5976
|
-
* Cache types available in the SDK
|
|
5977
|
-
* @group Configuration
|
|
5978
|
-
*/
|
|
5979
|
-
|
|
5980
|
-
/**
|
|
5981
|
-
* Configuration for a single cache instance
|
|
5982
|
-
* @group Configuration
|
|
5983
|
-
*/
|
|
5984
|
-
|
|
5985
|
-
/**
|
|
5986
|
-
* Configuration for the CacheManager
|
|
5987
|
-
* @group Configuration
|
|
5988
|
-
*/
|
|
5989
|
-
|
|
5990
|
-
/**
|
|
5991
|
-
* Default maximum storage size: 5MB
|
|
5992
|
-
*/
|
|
5993
|
-
var DEFAULT_MAX_STORAGE_BYTES = 5 * 1024 * 1024;
|
|
5994
|
-
|
|
5995
|
-
/**
|
|
5996
|
-
* Default cache configurations per type
|
|
5997
|
-
* These values balance memory usage with performance
|
|
5998
|
-
*/
|
|
5999
|
-
var DEFAULT_CACHE_CONFIGS = {
|
|
6000
|
-
places: {
|
|
6001
|
-
maxItems: 500,
|
|
6002
|
-
ttlMs: 30 * 60 * 1000,
|
|
6003
|
-
// 30 minutes
|
|
6004
|
-
persistenceKey: "mvx_places"
|
|
6005
|
-
},
|
|
6006
|
-
routes: {
|
|
6007
|
-
maxItems: 100,
|
|
6008
|
-
ttlMs: 5 * 60 * 1000,
|
|
6009
|
-
// 5 minutes
|
|
6010
|
-
persistenceKey: "mvx_routes"
|
|
6011
|
-
},
|
|
6012
|
-
accessibleRoutes: {
|
|
6013
|
-
maxItems: 100,
|
|
6014
|
-
ttlMs: 5 * 60 * 1000,
|
|
6015
|
-
// 5 minutes
|
|
6016
|
-
persistenceKey: "mvx_accessible_routes"
|
|
6017
|
-
},
|
|
6018
|
-
configurations: {
|
|
6019
|
-
maxItems: 10,
|
|
6020
|
-
ttlMs: 60 * 60 * 1000,
|
|
6021
|
-
// 1 hour
|
|
6022
|
-
persistenceKey: "mvx_configurations"
|
|
6023
|
-
},
|
|
6024
|
-
categories: {
|
|
6025
|
-
maxItems: 20,
|
|
6026
|
-
ttlMs: 60 * 60 * 1000,
|
|
6027
|
-
// 1 hour
|
|
6028
|
-
persistenceKey: "mvx_categories"
|
|
6029
|
-
},
|
|
6030
|
-
vehicles: {
|
|
6031
|
-
maxItems: 50,
|
|
6032
|
-
ttlMs: 60 * 1000,
|
|
6033
|
-
// 1 minute
|
|
6034
|
-
persistenceKey: "mvx_vehicles"
|
|
6035
|
-
},
|
|
6036
|
-
stops: {
|
|
6037
|
-
maxItems: 100,
|
|
6038
|
-
ttlMs: 60 * 1000,
|
|
6039
|
-
// 1 minute
|
|
6040
|
-
persistenceKey: "mvx_stops"
|
|
6041
|
-
},
|
|
6042
|
-
subPlaces: {
|
|
6043
|
-
maxItems: 200,
|
|
6044
|
-
ttlMs: 15 * 60 * 1000,
|
|
6045
|
-
// 15 minutes
|
|
6046
|
-
persistenceKey: "mvx_subplaces"
|
|
6047
|
-
}
|
|
6048
|
-
};
|
|
6049
|
-
|
|
6050
|
-
/**
|
|
6051
|
-
* Merges user config with defaults for a specific cache type
|
|
6052
|
-
* @param cacheType - The type of cache
|
|
6053
|
-
* @param userConfig - Optional user-provided configuration
|
|
6054
|
-
* @returns Complete cache configuration
|
|
6055
|
-
*/
|
|
6056
|
-
function getCacheConfig(cacheType, userConfig) {
|
|
6057
|
-
var defaultConfig = DEFAULT_CACHE_CONFIGS[cacheType];
|
|
6058
|
-
return _objectSpread(_objectSpread({}, defaultConfig), userConfig);
|
|
6059
|
-
}
|
|
6060
6069
|
;// ./src/infrastructure/cache/PersistentCache.ts
|
|
6061
6070
|
function PersistentCache_typeof(o) { "@babel/helpers - typeof"; return PersistentCache_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, PersistentCache_typeof(o); }
|
|
6062
6071
|
function PersistentCache_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = PersistentCache_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -6784,18 +6793,29 @@ var countly_default = /*#__PURE__*/__webpack_require__.n(countly);
|
|
|
6784
6793
|
var rollbar_umd_min = __webpack_require__(916);
|
|
6785
6794
|
var rollbar_umd_min_default = /*#__PURE__*/__webpack_require__.n(rollbar_umd_min);
|
|
6786
6795
|
;// ./src/logger/rollbar.ts
|
|
6796
|
+
// VERSION and ROLLBAR_ACCESS_TOKEN are webpack DefinePlugin constants,
|
|
6797
|
+
// substituted only in the UMD bundle. The tsc-built ES/CJS outputs keep them
|
|
6798
|
+
// as bare globals, so the typeof guards make the lookup safe everywhere; the
|
|
6799
|
+
// version placeholder is replaced with the package version by
|
|
6800
|
+
// scripts/inject-build-defines.js. The access token falls back to the MapVX
|
|
6801
|
+
// SDK-web Rollbar project token when none is injected at build time.
|
|
6802
|
+
var SDK_VERSION = true ? "1.1.2-alpha.3" : 0;
|
|
6803
|
+
var ACCESS_TOKEN = false ? 0 : "28279d52df43411ebd138c2bee0ab1df";
|
|
6787
6804
|
var _rollbarConfig = {
|
|
6788
|
-
accessToken:
|
|
6789
|
-
|
|
6790
|
-
|
|
6805
|
+
accessToken: ACCESS_TOKEN,
|
|
6806
|
+
// Only report what the SDK logs explicitly via logError. Capturing every
|
|
6807
|
+
// uncaught error / unhandled rejection on the host page floods Rollbar
|
|
6808
|
+
// with items from third-party code (e.g. Countly, the host app itself)
|
|
6809
|
+
// that the SDK does not own.
|
|
6810
|
+
captureUncaught: false,
|
|
6811
|
+
captureUnhandledRejections: false,
|
|
6812
|
+
// Drop anything below error level (debug/info/warning).
|
|
6813
|
+
reportLevel: "error",
|
|
6791
6814
|
payload: {
|
|
6792
|
-
environment: "
|
|
6793
|
-
// context: 'rollbar/test'
|
|
6815
|
+
environment: "production",
|
|
6794
6816
|
client: {
|
|
6795
6817
|
javascript: {
|
|
6796
|
-
code_version:
|
|
6797
|
-
// source_map_enabled: true,
|
|
6798
|
-
// guess_uncaught_frames: true
|
|
6818
|
+
code_version: SDK_VERSION
|
|
6799
6819
|
}
|
|
6800
6820
|
}
|
|
6801
6821
|
}
|
|
@@ -6818,23 +6838,37 @@ function logger_toPrimitive(t, r) { if ("object" != logger_typeof(t) || !t) retu
|
|
|
6818
6838
|
|
|
6819
6839
|
|
|
6820
6840
|
|
|
6841
|
+
// DEBUG, VERSION and COUNTLY_KEY are webpack DefinePlugin constants,
|
|
6842
|
+
// substituted only in the UMD bundle. The tsc-built ES/CJS outputs keep them
|
|
6843
|
+
// as bare globals, so reading them directly throws ReferenceError in
|
|
6844
|
+
// consumers of those builds. The typeof guards make the lookup safe
|
|
6845
|
+
// everywhere; the version placeholder is replaced with the package version
|
|
6846
|
+
// by scripts/inject-build-defines.js. The Countly key falls back to the
|
|
6847
|
+
// MapVX key when none is injected at build time.
|
|
6848
|
+
var IS_DEBUG = true ? false : 0;
|
|
6849
|
+
var logger_SDK_VERSION = true ? "1.1.2-alpha.3" : 0;
|
|
6850
|
+
var COUNTLY_API_KEY = false ? 0 : "f0c8d3b96d336e857a8628f49dd1baf7d7add0e9";
|
|
6821
6851
|
var logger_countly = {
|
|
6822
|
-
apiKey:
|
|
6852
|
+
apiKey: COUNTLY_API_KEY,
|
|
6823
6853
|
url: "https://countly.lazarillo.app"
|
|
6824
6854
|
};
|
|
6825
6855
|
var Logger = /*#__PURE__*/function () {
|
|
6826
6856
|
function Logger() {
|
|
6827
6857
|
logger_classCallCheck(this, Logger);
|
|
6828
|
-
if (
|
|
6829
|
-
|
|
6858
|
+
if (IS_DEBUG) {
|
|
6859
|
+
console.log("Initializing Countly");
|
|
6860
|
+
this.countly = {
|
|
6861
|
+
q: []
|
|
6862
|
+
};
|
|
6863
|
+
} else {
|
|
6830
6864
|
var _Countly$q;
|
|
6831
6865
|
this.rollbar = new (rollbar_umd_min_default())(_rollbarConfig);
|
|
6832
6866
|
countly_default().init({
|
|
6833
6867
|
app_key: logger_countly.apiKey,
|
|
6834
6868
|
url: logger_countly.url,
|
|
6835
|
-
app_version:
|
|
6869
|
+
app_version: logger_SDK_VERSION,
|
|
6836
6870
|
session_update: 10,
|
|
6837
|
-
debug:
|
|
6871
|
+
debug: IS_DEBUG,
|
|
6838
6872
|
require_consent: false,
|
|
6839
6873
|
namespace: "SDK JS"
|
|
6840
6874
|
});
|
|
@@ -6846,8 +6880,9 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6846
6880
|
return logger_createClass(Logger, [{
|
|
6847
6881
|
key: "logEvent",
|
|
6848
6882
|
value: function logEvent(eventName, eventSegmentation) {
|
|
6849
|
-
if (
|
|
6850
|
-
|
|
6883
|
+
if (IS_DEBUG) {
|
|
6884
|
+
console.log(eventName, eventSegmentation);
|
|
6885
|
+
} else {
|
|
6851
6886
|
this.countly.q.push(["add_event", {
|
|
6852
6887
|
key: eventName,
|
|
6853
6888
|
segmentation: eventSegmentation
|
|
@@ -6857,14 +6892,18 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6857
6892
|
}, {
|
|
6858
6893
|
key: "logDebug",
|
|
6859
6894
|
value: function logDebug() {
|
|
6860
|
-
if (
|
|
6861
|
-
|
|
6895
|
+
if (IS_DEBUG) {
|
|
6896
|
+
var _console;
|
|
6897
|
+
(_console = console).log.apply(_console, arguments);
|
|
6898
|
+
}
|
|
6862
6899
|
}
|
|
6863
6900
|
}, {
|
|
6864
6901
|
key: "logWarning",
|
|
6865
6902
|
value: function logWarning() {
|
|
6866
|
-
if (
|
|
6867
|
-
|
|
6903
|
+
if (IS_DEBUG) {
|
|
6904
|
+
var _console2;
|
|
6905
|
+
(_console2 = console).warn.apply(_console2, arguments);
|
|
6906
|
+
}
|
|
6868
6907
|
}
|
|
6869
6908
|
}, {
|
|
6870
6909
|
key: "logError",
|
|
@@ -6872,8 +6911,10 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6872
6911
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6873
6912
|
args[_key] = arguments[_key];
|
|
6874
6913
|
}
|
|
6875
|
-
if (
|
|
6876
|
-
|
|
6914
|
+
if (IS_DEBUG) {
|
|
6915
|
+
var _console3;
|
|
6916
|
+
(_console3 = console).error.apply(_console3, args);
|
|
6917
|
+
} else {
|
|
6877
6918
|
var _this$rollbar;
|
|
6878
6919
|
(_this$rollbar = this.rollbar) === null || _this$rollbar === void 0 || _this$rollbar.error.apply(_this$rollbar, args);
|
|
6879
6920
|
}
|
|
@@ -6882,8 +6923,7 @@ var Logger = /*#__PURE__*/function () {
|
|
|
6882
6923
|
key: "debugLog",
|
|
6883
6924
|
value: function debugLog() {
|
|
6884
6925
|
var _console4;
|
|
6885
|
-
if (
|
|
6886
|
-
{}
|
|
6926
|
+
if (IS_DEBUG) (_console4 = console).log.apply(_console4, arguments);
|
|
6887
6927
|
}
|
|
6888
6928
|
}], [{
|
|
6889
6929
|
key: "getInstance",
|
|
@@ -7003,6 +7043,174 @@ var CountlyLogger = /*#__PURE__*/function () {
|
|
|
7003
7043
|
// EXTERNAL MODULE: ./node_modules/.pnpm/maplibre-gl@5.7.0/node_modules/maplibre-gl/dist/maplibre-gl.js
|
|
7004
7044
|
var maplibre_gl = __webpack_require__(997);
|
|
7005
7045
|
var maplibre_gl_default = /*#__PURE__*/__webpack_require__.n(maplibre_gl);
|
|
7046
|
+
;// ./src/utils/semaphore.ts
|
|
7047
|
+
function semaphore_typeof(o) { "@babel/helpers - typeof"; return semaphore_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, semaphore_typeof(o); }
|
|
7048
|
+
function semaphore_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7049
|
+
function semaphore_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, semaphore_toPropertyKey(o.key), o); } }
|
|
7050
|
+
function semaphore_createClass(e, r, t) { return r && semaphore_defineProperties(e.prototype, r), t && semaphore_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7051
|
+
function semaphore_defineProperty(e, r, t) { return (r = semaphore_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7052
|
+
function semaphore_toPropertyKey(t) { var i = semaphore_toPrimitive(t, "string"); return "symbol" == semaphore_typeof(i) ? i : i + ""; }
|
|
7053
|
+
function semaphore_toPrimitive(t, r) { if ("object" != semaphore_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != semaphore_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7054
|
+
/**
|
|
7055
|
+
* Lower bound (inclusive) for the semaphore concurrency limit.
|
|
7056
|
+
*
|
|
7057
|
+
* A value of 1 means at least one operation can run at a time, which keeps the
|
|
7058
|
+
* semaphore meaningful: zero or negative limits would deadlock every caller.
|
|
7059
|
+
*/
|
|
7060
|
+
var MIN_LIMIT = 1;
|
|
7061
|
+
|
|
7062
|
+
/**
|
|
7063
|
+
* Upper bound (inclusive) for the semaphore concurrency limit.
|
|
7064
|
+
*
|
|
7065
|
+
* 64 is high enough for any practical browser-side fan-out (network requests,
|
|
7066
|
+
* tile fetches, etc.) while still protecting downstream services from being
|
|
7067
|
+
* overwhelmed by misconfigured callers.
|
|
7068
|
+
*/
|
|
7069
|
+
var MAX_LIMIT = 64;
|
|
7070
|
+
|
|
7071
|
+
/**
|
|
7072
|
+
* Validate and normalize a candidate concurrency limit.
|
|
7073
|
+
*
|
|
7074
|
+
* @param limit - Candidate value to validate.
|
|
7075
|
+
* @returns The validated integer limit, or `null` if the value is invalid.
|
|
7076
|
+
*/
|
|
7077
|
+
function normalizeLimit(limit) {
|
|
7078
|
+
if (!Number.isFinite(limit)) return null;
|
|
7079
|
+
var floored = Math.floor(limit);
|
|
7080
|
+
if (floored < MIN_LIMIT || floored > MAX_LIMIT) return null;
|
|
7081
|
+
return floored;
|
|
7082
|
+
}
|
|
7083
|
+
|
|
7084
|
+
/**
|
|
7085
|
+
* Counting semaphore that caps the number of concurrent operations.
|
|
7086
|
+
*
|
|
7087
|
+
* Useful when calling APIs, CDNs, or other shared resources where unbounded
|
|
7088
|
+
* parallelism can trigger rate limiting, WAF blocks, or excessive memory use.
|
|
7089
|
+
* Waiters are released in FIFO order as slots become free.
|
|
7090
|
+
*
|
|
7091
|
+
* @example
|
|
7092
|
+
* ```typescript
|
|
7093
|
+
* const sem = new Semaphore(4);
|
|
7094
|
+
*
|
|
7095
|
+
* async function fetchTile(url: string) {
|
|
7096
|
+
* await sem.acquire();
|
|
7097
|
+
* try {
|
|
7098
|
+
* return await fetch(url);
|
|
7099
|
+
* } finally {
|
|
7100
|
+
* sem.release();
|
|
7101
|
+
* }
|
|
7102
|
+
* }
|
|
7103
|
+
* ```
|
|
7104
|
+
*
|
|
7105
|
+
* @group Utils
|
|
7106
|
+
*/
|
|
7107
|
+
var Semaphore = /*#__PURE__*/function () {
|
|
7108
|
+
/**
|
|
7109
|
+
* @param limit - Maximum number of concurrent slots. Must be a finite
|
|
7110
|
+
* integer in `[1, 64]`; invalid values fall back to `1`.
|
|
7111
|
+
*/
|
|
7112
|
+
function Semaphore() {
|
|
7113
|
+
var _normalizeLimit;
|
|
7114
|
+
var limit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MIN_LIMIT;
|
|
7115
|
+
semaphore_classCallCheck(this, Semaphore);
|
|
7116
|
+
semaphore_defineProperty(this, "waiters", []);
|
|
7117
|
+
semaphore_defineProperty(this, "slotsInUse", 0);
|
|
7118
|
+
this.slotLimit = (_normalizeLimit = normalizeLimit(limit)) !== null && _normalizeLimit !== void 0 ? _normalizeLimit : MIN_LIMIT;
|
|
7119
|
+
}
|
|
7120
|
+
|
|
7121
|
+
/**
|
|
7122
|
+
* Maximum number of slots that can be acquired concurrently.
|
|
7123
|
+
*/
|
|
7124
|
+
return semaphore_createClass(Semaphore, [{
|
|
7125
|
+
key: "limit",
|
|
7126
|
+
get: function get() {
|
|
7127
|
+
return this.slotLimit;
|
|
7128
|
+
}
|
|
7129
|
+
|
|
7130
|
+
/**
|
|
7131
|
+
* Number of slots currently held by callers (acquired but not released).
|
|
7132
|
+
*/
|
|
7133
|
+
}, {
|
|
7134
|
+
key: "inUse",
|
|
7135
|
+
get: function get() {
|
|
7136
|
+
return this.slotsInUse;
|
|
7137
|
+
}
|
|
7138
|
+
|
|
7139
|
+
/**
|
|
7140
|
+
* Number of callers currently waiting for a slot.
|
|
7141
|
+
*/
|
|
7142
|
+
}, {
|
|
7143
|
+
key: "waiting",
|
|
7144
|
+
get: function get() {
|
|
7145
|
+
return this.waiters.length;
|
|
7146
|
+
}
|
|
7147
|
+
|
|
7148
|
+
/**
|
|
7149
|
+
* Acquire one slot. Resolves immediately if a slot is free; otherwise waits
|
|
7150
|
+
* in FIFO order until `release()` is called.
|
|
7151
|
+
*
|
|
7152
|
+
* Every successful `acquire()` must be paired with exactly one `release()`,
|
|
7153
|
+
* typically from a `finally` block. If the promise rejects (e.g. the optional
|
|
7154
|
+
* `signal` aborts while queued) no slot was granted, so `release()` must NOT
|
|
7155
|
+
* be called.
|
|
7156
|
+
*
|
|
7157
|
+
* @param signal - Optional `AbortSignal`. If it aborts while the caller is
|
|
7158
|
+
* still queued, the waiter is removed from the queue and the promise rejects
|
|
7159
|
+
* with an `AbortError`, so cancelled work never occupies a slot.
|
|
7160
|
+
* @returns A promise that resolves once a slot has been granted.
|
|
7161
|
+
*/
|
|
7162
|
+
}, {
|
|
7163
|
+
key: "acquire",
|
|
7164
|
+
value: function acquire(signal) {
|
|
7165
|
+
var _this = this;
|
|
7166
|
+
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
7167
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
7168
|
+
}
|
|
7169
|
+
if (this.slotsInUse < this.slotLimit) {
|
|
7170
|
+
this.slotsInUse++;
|
|
7171
|
+
return Promise.resolve();
|
|
7172
|
+
}
|
|
7173
|
+
return new Promise(function (resolve, reject) {
|
|
7174
|
+
var waiter = function waiter() {
|
|
7175
|
+
_this.slotsInUse++;
|
|
7176
|
+
resolve();
|
|
7177
|
+
};
|
|
7178
|
+
_this.waiters.push(waiter);
|
|
7179
|
+
if (signal) {
|
|
7180
|
+
signal.addEventListener("abort", function () {
|
|
7181
|
+
var index = _this.waiters.indexOf(waiter);
|
|
7182
|
+
if (index !== -1) {
|
|
7183
|
+
_this.waiters.splice(index, 1);
|
|
7184
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
7185
|
+
}
|
|
7186
|
+
}, {
|
|
7187
|
+
once: true
|
|
7188
|
+
});
|
|
7189
|
+
}
|
|
7190
|
+
});
|
|
7191
|
+
}
|
|
7192
|
+
|
|
7193
|
+
/**
|
|
7194
|
+
* Release one slot, waking the next FIFO waiter only when a slot was actually
|
|
7195
|
+
* freed.
|
|
7196
|
+
*
|
|
7197
|
+
* Safe to call even when no slots are in use: it is a true no-op in that case,
|
|
7198
|
+
* so cleanup code in `finally` blocks is defensive against double-releases and
|
|
7199
|
+
* a stray release can never admit a waiter beyond {@link limit}.
|
|
7200
|
+
*/
|
|
7201
|
+
}, {
|
|
7202
|
+
key: "release",
|
|
7203
|
+
value: function release() {
|
|
7204
|
+
if (this.slotsInUse > 0) {
|
|
7205
|
+
this.slotsInUse--;
|
|
7206
|
+
var next = this.waiters.shift();
|
|
7207
|
+
if (next) {
|
|
7208
|
+
next();
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7211
|
+
}
|
|
7212
|
+
}]);
|
|
7213
|
+
}();
|
|
7006
7214
|
;// ./src/assets/icons.ts
|
|
7007
7215
|
var userLocationDataUrl = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20aria-hidden%3D%22false%22%20role%3D%22img%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%226%22%20fill%3D%22var(--icon-fill%2C%20%23007aff)%22%20stroke%3D%22var(--icon-stroke%2C%20%23ffffff)%22%20stroke-width%3D%222%22/%3E%3C/svg%3E";
|
|
7008
7216
|
|
|
@@ -7015,7 +7223,7 @@ var userLocationDataUrl = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w
|
|
|
7015
7223
|
* Generates a data URL for the route animation icon SVG with customizable appearance.
|
|
7016
7224
|
*
|
|
7017
7225
|
* @param config - Optional configuration for the icon appearance.
|
|
7018
|
-
* @param config.backgroundColor - The background color of the circle (default: "#
|
|
7226
|
+
* @param config.backgroundColor - The background color of the circle (default: "#276EF1").
|
|
7019
7227
|
* @param config.arrowColor - The color of the arrow (default: "#FFFFFF").
|
|
7020
7228
|
* @param config.arrowWidth - The stroke width of the arrow path in pixels (default: 0).
|
|
7021
7229
|
* @param config.borderWidth - The border width of the circle in pixels (default: 0).
|
|
@@ -7047,7 +7255,7 @@ var userLocationDataUrl = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w
|
|
|
7047
7255
|
*/
|
|
7048
7256
|
function createRouteAnimationIconDataUrl(config) {
|
|
7049
7257
|
var _config$backgroundCol, _config$arrowColor, _config$arrowWidth, _config$borderWidth, _config$borderColor, _config$blur;
|
|
7050
|
-
var backgroundColor = (_config$backgroundCol = config === null || config === void 0 ? void 0 : config.backgroundColor) !== null && _config$backgroundCol !== void 0 ? _config$backgroundCol : "#
|
|
7258
|
+
var backgroundColor = (_config$backgroundCol = config === null || config === void 0 ? void 0 : config.backgroundColor) !== null && _config$backgroundCol !== void 0 ? _config$backgroundCol : "#276EF1";
|
|
7051
7259
|
var arrowColor = (_config$arrowColor = config === null || config === void 0 ? void 0 : config.arrowColor) !== null && _config$arrowColor !== void 0 ? _config$arrowColor : "#FFFFFF";
|
|
7052
7260
|
var arrowWidth = (_config$arrowWidth = config === null || config === void 0 ? void 0 : config.arrowWidth) !== null && _config$arrowWidth !== void 0 ? _config$arrowWidth : 0;
|
|
7053
7261
|
var borderWidth = (_config$borderWidth = config === null || config === void 0 ? void 0 : config.borderWidth) !== null && _config$borderWidth !== void 0 ? _config$borderWidth : 0;
|
|
@@ -7066,7 +7274,7 @@ function createRouteAnimationIconDataUrl(config) {
|
|
|
7066
7274
|
var filterId = blur > 0 ? "blurFilter" : "";
|
|
7067
7275
|
var filterDef = blur > 0 ? "<defs><filter id=\"".concat(filterId, "\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"").concat(blur, "\"/></filter></defs>") : "";
|
|
7068
7276
|
var filterAttr = blur > 0 ? "filter=\"url(#".concat(filterId, ")\"") : "";
|
|
7069
|
-
var svg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0
|
|
7277
|
+
var svg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 30 30\" style=\"enable-background:new 0 0 30 30;\" xml:space=\"preserve\">\n".concat(filterDef, "\n<g ").concat(filterAttr, ">\n\t<circle cx=\"15\" cy=\"15\" r=\"15\" style=\"").concat(circleStyle).concat(circleStroke, "\"/>\n\t<path style=\"").concat(arrowStyle).concat(arrowStroke, "\" d=\"M16.4471 7.26386C16.2568 6.80696 15.808 6.51052 15.3131 6.51052C14.8181 6.51052 14.3693 6.80696 14.179 7.26386L8.52211 20.7533C8.29366 21.2972 8.48404 21.9227 8.97085 22.2518C9.45767 22.5809 10.1104 22.5156 10.5265 22.0995L15.3131 17.3129L20.0996 22.0995C20.5157 22.5156 21.1657 22.5782 21.6553 22.2518C22.1448 21.9254 22.3325 21.2972 22.104 20.7533L16.4471 7.26386Z\"/>\n</g>\n</svg>");
|
|
7070
7278
|
|
|
7071
7279
|
// Encode the SVG as a data URL
|
|
7072
7280
|
var encodedSvg = encodeURIComponent(svg);
|
|
@@ -7074,7 +7282,7 @@ function createRouteAnimationIconDataUrl(config) {
|
|
|
7074
7282
|
}
|
|
7075
7283
|
|
|
7076
7284
|
/**
|
|
7077
|
-
* Default route animation icon data URL with blue background (#
|
|
7285
|
+
* Default route animation icon data URL with blue background (#276EF1) and white arrow (#FFFFFF).
|
|
7078
7286
|
* This constant is maintained for backward compatibility.
|
|
7079
7287
|
*
|
|
7080
7288
|
* @example
|
|
@@ -7196,6 +7404,10 @@ function getBoundingBox(points) {
|
|
|
7196
7404
|
return [southwest, northeast];
|
|
7197
7405
|
}
|
|
7198
7406
|
;// ./src/domain/models/marker.ts
|
|
7407
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || marker_unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
7408
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7409
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
7410
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return marker_arrayLikeToArray(r); }
|
|
7199
7411
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7200
7412
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == marker_typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7201
7413
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
@@ -7204,6 +7416,9 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
7204
7416
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
7205
7417
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
7206
7418
|
function marker_typeof(o) { "@babel/helpers - typeof"; return marker_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, marker_typeof(o); }
|
|
7419
|
+
function marker_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = marker_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
7420
|
+
function marker_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return marker_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? marker_arrayLikeToArray(r, a) : void 0; } }
|
|
7421
|
+
function marker_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7207
7422
|
function marker_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7208
7423
|
function marker_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, marker_toPropertyKey(o.key), o); } }
|
|
7209
7424
|
function marker_createClass(e, r, t) { return r && marker_defineProperties(e.prototype, r), t && marker_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -7307,82 +7522,104 @@ var MarkerUtils = /*#__PURE__*/function () {
|
|
|
7307
7522
|
* ```
|
|
7308
7523
|
*/
|
|
7309
7524
|
function createMarkerElement(marker) {
|
|
7310
|
-
var _marker$iconPropertie, _marker$iconPropertie2, _marker$iconPropertie3, _marker$iconPropertie4;
|
|
7311
7525
|
var markerContainer = document.createElement("div");
|
|
7312
|
-
|
|
7313
|
-
// Configure specific marker dimensions
|
|
7314
|
-
var iconWidth = (_marker$iconPropertie = (_marker$iconPropertie2 = marker.iconProperties) === null || _marker$iconPropertie2 === void 0 ? void 0 : _marker$iconPropertie2.width) !== null && _marker$iconPropertie !== void 0 ? _marker$iconPropertie : 40;
|
|
7315
|
-
var iconHeight = (_marker$iconPropertie3 = (_marker$iconPropertie4 = marker.iconProperties) === null || _marker$iconPropertie4 === void 0 ? void 0 : _marker$iconPropertie4.height) !== null && _marker$iconPropertie3 !== void 0 ? _marker$iconPropertie3 : 40;
|
|
7316
|
-
|
|
7317
|
-
// Apply base class
|
|
7318
7526
|
markerContainer.className = "mapvx-marker";
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
markerContainer.classList.add("text-column");
|
|
7327
|
-
markerContainer.style.width = "".concat(Math.max(iconWidth, 200), "px");
|
|
7328
|
-
markerContainer.style.height = "auto";
|
|
7329
|
-
break;
|
|
7330
|
-
case TextPosition.left:
|
|
7331
|
-
case TextPosition.right:
|
|
7332
|
-
default:
|
|
7333
|
-
markerContainer.classList.add("text-row");
|
|
7334
|
-
markerContainer.style.width = "auto";
|
|
7335
|
-
markerContainer.style.height = "".concat(iconHeight, "px");
|
|
7336
|
-
break;
|
|
7527
|
+
this.applyContainerLayout(markerContainer, marker);
|
|
7528
|
+
var _iterator = marker_createForOfIteratorHelper(this.createMarkerChildren(marker)),
|
|
7529
|
+
_step;
|
|
7530
|
+
try {
|
|
7531
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
7532
|
+
var child = _step.value;
|
|
7533
|
+
markerContainer.appendChild(child);
|
|
7337
7534
|
}
|
|
7338
|
-
}
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
markerContainer.style.height = "".concat(iconHeight, "px");
|
|
7343
|
-
}
|
|
7344
|
-
markerContainer.addEventListener("click", function () {
|
|
7345
|
-
var _marker$onClick;
|
|
7346
|
-
(_marker$onClick = marker.onClick) === null || _marker$onClick === void 0 || _marker$onClick.call(marker);
|
|
7347
|
-
});
|
|
7348
|
-
if (marker.element) {
|
|
7349
|
-
markerContainer.appendChild(marker.element);
|
|
7350
|
-
return this.setAndCreateText(marker, markerContainer, "".concat(iconHeight, "px"), "".concat(iconWidth, "px"));
|
|
7535
|
+
} catch (err) {
|
|
7536
|
+
_iterator.e(err);
|
|
7537
|
+
} finally {
|
|
7538
|
+
_iterator.f();
|
|
7351
7539
|
}
|
|
7540
|
+
return markerContainer;
|
|
7541
|
+
}
|
|
7352
7542
|
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7543
|
+
/**
|
|
7544
|
+
* Applies the marker container's own classes and box size from a config.
|
|
7545
|
+
* Shared by {@link createMarkerElement} and {@link MarkerAttribute.updateIcon}
|
|
7546
|
+
* so create and update stay in sync (single source of truth for which state
|
|
7547
|
+
* classes exist and how the anchored box is sized). It is idempotent, so it
|
|
7548
|
+
* also resets stale state when reused to update an existing element.
|
|
7549
|
+
*
|
|
7550
|
+
* @param container - The `.mapvx-marker` element to configure
|
|
7551
|
+
* @param marker - Marker configuration
|
|
7552
|
+
*/
|
|
7553
|
+
}, {
|
|
7554
|
+
key: "applyContainerLayout",
|
|
7555
|
+
value: function applyContainerLayout(container, marker) {
|
|
7556
|
+
// Reset the state classes we own (no-op on a fresh element).
|
|
7557
|
+
container.classList.remove("no-text", "interactive");
|
|
7356
7558
|
|
|
7357
|
-
//
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7559
|
+
// The container box equals the icon box so the out-of-flow label never
|
|
7560
|
+
// displaces the icon from the coordinate MapLibre anchors. A caller-
|
|
7561
|
+
// provided `element` owns its own size, so we let the box size to it.
|
|
7562
|
+
if (marker.element) {
|
|
7563
|
+
container.style.width = "";
|
|
7564
|
+
container.style.height = "";
|
|
7361
7565
|
} else {
|
|
7362
|
-
|
|
7363
|
-
|
|
7566
|
+
var _marker$iconPropertie, _marker$iconPropertie2, _marker$iconPropertie3, _marker$iconPropertie4;
|
|
7567
|
+
var iconWidth = (_marker$iconPropertie = (_marker$iconPropertie2 = marker.iconProperties) === null || _marker$iconPropertie2 === void 0 ? void 0 : _marker$iconPropertie2.width) !== null && _marker$iconPropertie !== void 0 ? _marker$iconPropertie : 40;
|
|
7568
|
+
var iconHeight = (_marker$iconPropertie3 = (_marker$iconPropertie4 = marker.iconProperties) === null || _marker$iconPropertie4 === void 0 ? void 0 : _marker$iconPropertie4.height) !== null && _marker$iconPropertie3 !== void 0 ? _marker$iconPropertie3 : 40;
|
|
7569
|
+
container.style.width = "".concat(iconWidth, "px");
|
|
7570
|
+
container.style.height = "".concat(iconHeight, "px");
|
|
7571
|
+
}
|
|
7572
|
+
if (!marker.text) {
|
|
7573
|
+
container.classList.add("no-text");
|
|
7574
|
+
}
|
|
7575
|
+
|
|
7576
|
+
// Only flag the marker interactive when it actually handles clicks: this
|
|
7577
|
+
// flips the out-of-flow label's pointer-events to auto (see styles.css)
|
|
7578
|
+
// so the label is hit-testable, while non-clickable labels stay
|
|
7579
|
+
// click-through and never block the map.
|
|
7580
|
+
if (marker.onClick) {
|
|
7581
|
+
container.classList.add("interactive");
|
|
7364
7582
|
}
|
|
7365
|
-
return markerContainer;
|
|
7366
7583
|
}
|
|
7367
7584
|
|
|
7368
7585
|
/**
|
|
7369
|
-
*
|
|
7586
|
+
* Builds the in-order children for a marker container: the icon (or the
|
|
7587
|
+
* caller-provided element) followed by the optional out-of-flow label. DOM
|
|
7588
|
+
* order is irrelevant for placement — the .text-container position classes
|
|
7589
|
+
* (top/bottom/left/right) lay the label out around the icon.
|
|
7370
7590
|
*
|
|
7371
|
-
* @param
|
|
7372
|
-
* @
|
|
7373
|
-
* @param iconHeight - Height of the icon for positioning calculations
|
|
7374
|
-
* @param iconWidth - Width of the icon for positioning calculations
|
|
7375
|
-
* @returns Container element with properly positioned text
|
|
7591
|
+
* @param marker - Marker configuration
|
|
7592
|
+
* @returns The child elements to append to the container
|
|
7376
7593
|
*/
|
|
7377
7594
|
}, {
|
|
7378
|
-
key: "
|
|
7379
|
-
value: function
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7595
|
+
key: "createMarkerChildren",
|
|
7596
|
+
value: function createMarkerChildren(marker) {
|
|
7597
|
+
var children = [];
|
|
7598
|
+
if (marker.element) {
|
|
7599
|
+
children.push(marker.element);
|
|
7600
|
+
} else {
|
|
7601
|
+
var _marker$iconPropertie5, _marker$iconPropertie6, _marker$iconPropertie7, _marker$iconPropertie8;
|
|
7602
|
+
var iconWidth = (_marker$iconPropertie5 = (_marker$iconPropertie6 = marker.iconProperties) === null || _marker$iconPropertie6 === void 0 ? void 0 : _marker$iconPropertie6.width) !== null && _marker$iconPropertie5 !== void 0 ? _marker$iconPropertie5 : 40;
|
|
7603
|
+
var iconHeight = (_marker$iconPropertie7 = (_marker$iconPropertie8 = marker.iconProperties) === null || _marker$iconPropertie8 === void 0 ? void 0 : _marker$iconPropertie8.height) !== null && _marker$iconPropertie7 !== void 0 ? _marker$iconPropertie7 : 40;
|
|
7604
|
+
children.push(this.createIconElement(marker, iconWidth, iconHeight));
|
|
7605
|
+
}
|
|
7606
|
+
if (marker.text) {
|
|
7607
|
+
children.push(this.buildTextContainer(marker));
|
|
7384
7608
|
}
|
|
7385
|
-
return
|
|
7609
|
+
return children;
|
|
7610
|
+
}
|
|
7611
|
+
|
|
7612
|
+
/**
|
|
7613
|
+
* Builds the positioned label container for a marker.
|
|
7614
|
+
*
|
|
7615
|
+
* @param marker - Marker configuration; `text` is assumed to be set
|
|
7616
|
+
* @returns The `.text-container` element ready to append
|
|
7617
|
+
*/
|
|
7618
|
+
}, {
|
|
7619
|
+
key: "buildTextContainer",
|
|
7620
|
+
value: function buildTextContainer(marker) {
|
|
7621
|
+
var textElement = typeof marker.text === "string" ? this.createTextElement(marker.text, marker.textProperties) : marker.text;
|
|
7622
|
+
return this.createTextContainer(textElement, marker.textPosition);
|
|
7386
7623
|
}
|
|
7387
7624
|
|
|
7388
7625
|
/**
|
|
@@ -7416,7 +7653,8 @@ var MarkerUtils = /*#__PURE__*/function () {
|
|
|
7416
7653
|
|
|
7417
7654
|
/**
|
|
7418
7655
|
* Creates a text container with proper positioning using CSS classes.
|
|
7419
|
-
*
|
|
7656
|
+
* The container is absolutely positioned (out of flow) so the label
|
|
7657
|
+
* never grows the marker's anchored box.
|
|
7420
7658
|
*
|
|
7421
7659
|
* @param textElement - The text element to contain
|
|
7422
7660
|
* @param textPosition - Desired position relative to the icon
|
|
@@ -7468,11 +7706,11 @@ var MarkerUtils = /*#__PURE__*/function () {
|
|
|
7468
7706
|
}, {
|
|
7469
7707
|
key: "createIcon",
|
|
7470
7708
|
value: function createIcon(marker) {
|
|
7471
|
-
var _marker$
|
|
7709
|
+
var _marker$iconPropertie9, _marker$iconPropertie0, _marker$iconPropertie1, _marker$iconPropertie10;
|
|
7472
7710
|
var image = document.createElement("img");
|
|
7473
7711
|
image.src = typeof marker.icon == "string" ? marker.icon : "";
|
|
7474
|
-
image.width = (_marker$
|
|
7475
|
-
image.height = (_marker$
|
|
7712
|
+
image.width = (_marker$iconPropertie9 = (_marker$iconPropertie0 = marker.iconProperties) === null || _marker$iconPropertie0 === void 0 ? void 0 : _marker$iconPropertie0.width) !== null && _marker$iconPropertie9 !== void 0 ? _marker$iconPropertie9 : 40;
|
|
7713
|
+
image.height = (_marker$iconPropertie1 = (_marker$iconPropertie10 = marker.iconProperties) === null || _marker$iconPropertie10 === void 0 ? void 0 : _marker$iconPropertie10.height) !== null && _marker$iconPropertie1 !== void 0 ? _marker$iconPropertie1 : 40;
|
|
7476
7714
|
image.style.objectFit = "contain";
|
|
7477
7715
|
image.style.filter = "drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25))";
|
|
7478
7716
|
return image;
|
|
@@ -7541,6 +7779,12 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7541
7779
|
* Used for indoor navigation and floor-specific marker management.
|
|
7542
7780
|
*/
|
|
7543
7781
|
|
|
7782
|
+
/**
|
|
7783
|
+
* Current click handler for the marker. Stored on the instance (rather than
|
|
7784
|
+
* captured in the DOM listener's closure) so {@link updateIcon} can swap it
|
|
7785
|
+
* without leaving the original handler attached to MapLibre's element.
|
|
7786
|
+
*/
|
|
7787
|
+
|
|
7544
7788
|
/**
|
|
7545
7789
|
* Constructs a new `MarkerAttribute` object with the specified properties.
|
|
7546
7790
|
*
|
|
@@ -7566,9 +7810,20 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7566
7810
|
anchor: (_markerConfig$anchor = markerConfig.anchor) !== null && _markerConfig$anchor !== void 0 ? _markerConfig$anchor : "center",
|
|
7567
7811
|
offset: [0, 0]
|
|
7568
7812
|
}]);
|
|
7813
|
+
|
|
7814
|
+
// Route clicks through an instance-level handler so the latest onClick is
|
|
7815
|
+
// always invoked, even after updateIcon replaces the marker content.
|
|
7816
|
+
_this._userOnClick = markerConfig.onClick;
|
|
7817
|
+
_this._element.addEventListener("click", function () {
|
|
7818
|
+
var _this$_userOnClick, _this2;
|
|
7819
|
+
return (_this$_userOnClick = (_this2 = _this)._userOnClick) === null || _this$_userOnClick === void 0 ? void 0 : _this$_userOnClick.call(_this2);
|
|
7820
|
+
});
|
|
7569
7821
|
_this.setLngLat([markerConfig.coordinate.lng, markerConfig.coordinate.lat]);
|
|
7570
7822
|
_this.setRotationAlignment((_markerConfig$rotatio = markerConfig.rotationAlignment) !== null && _markerConfig$rotatio !== void 0 ? _markerConfig$rotatio : "viewport");
|
|
7571
7823
|
_this.setPitchAlignment("viewport");
|
|
7824
|
+
if (typeof markerConfig.rotation === "number") {
|
|
7825
|
+
_this.setRotation(markerConfig.rotation);
|
|
7826
|
+
}
|
|
7572
7827
|
_this.id = (_markerConfig$id = markerConfig.id) !== null && _markerConfig$id !== void 0 ? _markerConfig$id : generateHexadecimalKey();
|
|
7573
7828
|
_this.coordinate = markerConfig.coordinate;
|
|
7574
7829
|
_this.floorId = (_markerConfig$floorId = markerConfig.floorId) !== null && _markerConfig$floorId !== void 0 ? _markerConfig$floorId : "";
|
|
@@ -7610,21 +7865,21 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7610
7865
|
}, {
|
|
7611
7866
|
key: "updateIcon",
|
|
7612
7867
|
value: function updateIcon(marker) {
|
|
7613
|
-
var _marker$rotationAlign;
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
oldMarkerContent === null || oldMarkerContent === void 0 || (_oldMarkerContent$par = oldMarkerContent.parentElement) === null || _oldMarkerContent$par === void 0 || _oldMarkerContent$par.replaceChild(newMarkerContent, oldMarkerContent);
|
|
7624
|
-
}
|
|
7625
|
-
}
|
|
7868
|
+
var _this$_element, _marker$rotationAlign;
|
|
7869
|
+
// Reconfigure the element MapLibre already holds in place, rather than
|
|
7870
|
+
// building a throwaway element and grafting pieces of it. MapLibre owns the
|
|
7871
|
+
// element's other classes and inline styles (transform, position), which
|
|
7872
|
+
// must survive the update; we only reset our own classes/size and swap the
|
|
7873
|
+
// children. Both create and update go through the same MarkerUtils helpers,
|
|
7874
|
+
// so they cannot drift apart.
|
|
7875
|
+
MarkerUtils.applyContainerLayout(this._element, marker);
|
|
7876
|
+
(_this$_element = this._element).replaceChildren.apply(_this$_element, _toConsumableArray(MarkerUtils.createMarkerChildren(marker)));
|
|
7877
|
+
this._userOnClick = marker.onClick;
|
|
7626
7878
|
this.setRotationAlignment((_marker$rotationAlign = marker.rotationAlignment) !== null && _marker$rotationAlign !== void 0 ? _marker$rotationAlign : "viewport");
|
|
7627
7879
|
this.setPitchAlignment("viewport");
|
|
7880
|
+
if (typeof marker.rotation === "number") {
|
|
7881
|
+
this.setRotation(marker.rotation);
|
|
7882
|
+
}
|
|
7628
7883
|
}
|
|
7629
7884
|
|
|
7630
7885
|
/**
|
|
@@ -7698,9 +7953,55 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7698
7953
|
} else {
|
|
7699
7954
|
this.hide();
|
|
7700
7955
|
}
|
|
7701
|
-
}
|
|
7702
|
-
}]);
|
|
7703
|
-
}(maplibre_gl.Marker);
|
|
7956
|
+
}
|
|
7957
|
+
}]);
|
|
7958
|
+
}(maplibre_gl.Marker);
|
|
7959
|
+
;// ./src/domain/models/routeInstance.ts
|
|
7960
|
+
/**
|
|
7961
|
+
* Represents the conditions for the step animation.
|
|
7962
|
+
* @group Routes
|
|
7963
|
+
*/
|
|
7964
|
+
|
|
7965
|
+
/**
|
|
7966
|
+
* Represents a single route instance on the map with its own
|
|
7967
|
+
* MapLibre sources/layers, GeoJSON data, animation state, and marker.
|
|
7968
|
+
* @group Routes
|
|
7969
|
+
*/
|
|
7970
|
+
|
|
7971
|
+
/**
|
|
7972
|
+
* Creates a new RouteInstance from a route.
|
|
7973
|
+
* Each instance gets unique MapLibre source/layer IDs based on the route's UUID.
|
|
7974
|
+
* @param route The route to create an instance for.
|
|
7975
|
+
* @returns A new RouteInstance with initialized GeoJSON data structures.
|
|
7976
|
+
* @group Routes
|
|
7977
|
+
*/
|
|
7978
|
+
function createRouteInstance(route) {
|
|
7979
|
+
return {
|
|
7980
|
+
id: route.id,
|
|
7981
|
+
route: route,
|
|
7982
|
+
aheadId: "AHEAD_".concat(route.id),
|
|
7983
|
+
behindId: "BEHIND_".concat(route.id),
|
|
7984
|
+
currentId: "CURRENT_".concat(route.id),
|
|
7985
|
+
aheadSourceData: {
|
|
7986
|
+
type: "FeatureCollection",
|
|
7987
|
+
features: []
|
|
7988
|
+
},
|
|
7989
|
+
behindSourceData: {
|
|
7990
|
+
type: "FeatureCollection",
|
|
7991
|
+
features: []
|
|
7992
|
+
},
|
|
7993
|
+
currentSourceData: {
|
|
7994
|
+
type: "Feature",
|
|
7995
|
+
properties: {},
|
|
7996
|
+
geometry: {
|
|
7997
|
+
type: "LineString",
|
|
7998
|
+
coordinates: []
|
|
7999
|
+
}
|
|
8000
|
+
},
|
|
8001
|
+
animationStatus: "NO_ROUTE",
|
|
8002
|
+
stepAnimationStatus: "NO_ROUTE"
|
|
8003
|
+
};
|
|
8004
|
+
}
|
|
7704
8005
|
;// ./src/utils/nav-functions.ts
|
|
7705
8006
|
function nav_functions_typeof(o) { "@babel/helpers - typeof"; return nav_functions_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, nav_functions_typeof(o); }
|
|
7706
8007
|
function nav_functions_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -7880,60 +8181,14 @@ var NavFunctions = /*#__PURE__*/function () {
|
|
|
7880
8181
|
* The radius of the Earth in meters.
|
|
7881
8182
|
*/
|
|
7882
8183
|
nav_functions_defineProperty(NavFunctions, "EARTH_RADIUS", 6378000);
|
|
7883
|
-
;// ./src/domain/models/routeInstance.ts
|
|
7884
|
-
/**
|
|
7885
|
-
* Represents the conditions for the step animation.
|
|
7886
|
-
* @group Routes
|
|
7887
|
-
*/
|
|
7888
|
-
|
|
7889
|
-
/**
|
|
7890
|
-
* Represents a single route instance on the map with its own
|
|
7891
|
-
* MapLibre sources/layers, GeoJSON data, animation state, and marker.
|
|
7892
|
-
* @group Routes
|
|
7893
|
-
*/
|
|
7894
|
-
|
|
7895
|
-
/**
|
|
7896
|
-
* Creates a new RouteInstance from a route.
|
|
7897
|
-
* Each instance gets unique MapLibre source/layer IDs based on the route's UUID.
|
|
7898
|
-
* @param route The route to create an instance for.
|
|
7899
|
-
* @returns A new RouteInstance with initialized GeoJSON data structures.
|
|
7900
|
-
* @group Routes
|
|
7901
|
-
*/
|
|
7902
|
-
function createRouteInstance(route) {
|
|
7903
|
-
return {
|
|
7904
|
-
id: route.id,
|
|
7905
|
-
route: route,
|
|
7906
|
-
aheadId: "AHEAD_".concat(route.id),
|
|
7907
|
-
behindId: "BEHIND_".concat(route.id),
|
|
7908
|
-
currentId: "CURRENT_".concat(route.id),
|
|
7909
|
-
aheadSourceData: {
|
|
7910
|
-
type: "FeatureCollection",
|
|
7911
|
-
features: []
|
|
7912
|
-
},
|
|
7913
|
-
behindSourceData: {
|
|
7914
|
-
type: "FeatureCollection",
|
|
7915
|
-
features: []
|
|
7916
|
-
},
|
|
7917
|
-
currentSourceData: {
|
|
7918
|
-
type: "Feature",
|
|
7919
|
-
properties: {},
|
|
7920
|
-
geometry: {
|
|
7921
|
-
type: "LineString",
|
|
7922
|
-
coordinates: []
|
|
7923
|
-
}
|
|
7924
|
-
},
|
|
7925
|
-
animationStatus: "NO_ROUTE",
|
|
7926
|
-
stepAnimationStatus: "NO_ROUTE"
|
|
7927
|
-
};
|
|
7928
|
-
}
|
|
7929
8184
|
;// ./src/controllers/routeController.ts
|
|
7930
8185
|
function routeController_typeof(o) { "@babel/helpers - typeof"; return routeController_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, routeController_typeof(o); }
|
|
7931
8186
|
function routeController_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7932
8187
|
function routeController_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? routeController_ownKeys(Object(t), !0).forEach(function (r) { routeController_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : routeController_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7933
|
-
function
|
|
7934
|
-
function
|
|
7935
|
-
function
|
|
7936
|
-
function
|
|
8188
|
+
function routeController_toConsumableArray(r) { return routeController_arrayWithoutHoles(r) || routeController_iterableToArray(r) || routeController_unsupportedIterableToArray(r) || routeController_nonIterableSpread(); }
|
|
8189
|
+
function routeController_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8190
|
+
function routeController_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
8191
|
+
function routeController_arrayWithoutHoles(r) { if (Array.isArray(r)) return routeController_arrayLikeToArray(r); }
|
|
7937
8192
|
function routeController_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = routeController_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
7938
8193
|
function routeController_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return routeController_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? routeController_arrayLikeToArray(r, a) : void 0; } }
|
|
7939
8194
|
function routeController_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -8308,7 +8563,7 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
8308
8563
|
throw new Error("Error: position array has different length than colors array");
|
|
8309
8564
|
}
|
|
8310
8565
|
var stops = createStops(positionsToUse, colors);
|
|
8311
|
-
var gradient = ["interpolate", ["linear"], ["line-progress"]].concat(
|
|
8566
|
+
var gradient = ["interpolate", ["linear"], ["line-progress"]].concat(routeController_toConsumableArray(stops));
|
|
8312
8567
|
return {
|
|
8313
8568
|
"line-color": null,
|
|
8314
8569
|
"line-gradient": gradient,
|
|
@@ -8555,7 +8810,7 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
8555
8810
|
this.removeSourcesAndLayersForRoute(instance);
|
|
8556
8811
|
this.routes["delete"](instance.id);
|
|
8557
8812
|
if (this.lastAddedRouteId === instance.id) {
|
|
8558
|
-
var remaining =
|
|
8813
|
+
var remaining = routeController_toConsumableArray(this.routes.keys());
|
|
8559
8814
|
this.lastAddedRouteId = remaining.length > 0 ? remaining[remaining.length - 1] : undefined;
|
|
8560
8815
|
}
|
|
8561
8816
|
}
|
|
@@ -8590,7 +8845,7 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
8590
8845
|
}, {
|
|
8591
8846
|
key: "getRouteIds",
|
|
8592
8847
|
value: function getRouteIds() {
|
|
8593
|
-
return
|
|
8848
|
+
return routeController_toConsumableArray(this.routes.keys());
|
|
8594
8849
|
}
|
|
8595
8850
|
}, {
|
|
8596
8851
|
key: "internalPause",
|
|
@@ -9099,6 +9354,27 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
9099
9354
|
return;
|
|
9100
9355
|
}
|
|
9101
9356
|
}
|
|
9357
|
+
if (step.startInsideFloor !== step.endInsideFloor) {
|
|
9358
|
+
if (waitStartTime == null) {
|
|
9359
|
+
instance.conditions.waitStartTime = timestamp;
|
|
9360
|
+
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9361
|
+
return _this8.animateStep(time, instance);
|
|
9362
|
+
});
|
|
9363
|
+
return;
|
|
9364
|
+
}
|
|
9365
|
+
if (timestamp - waitStartTime < changeFloorTime * 1000) {
|
|
9366
|
+
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9367
|
+
return _this8.animateStep(time, instance);
|
|
9368
|
+
});
|
|
9369
|
+
return;
|
|
9370
|
+
} else {
|
|
9371
|
+
this.updatePlaceFloorForRouting(instance, step.endInsidePlace, step.endInsideFloor);
|
|
9372
|
+
this.setMarkerLngLat(instance, step.endLocation);
|
|
9373
|
+
instance.conditions.waitStartTime = undefined;
|
|
9374
|
+
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9375
|
+
return;
|
|
9376
|
+
}
|
|
9377
|
+
}
|
|
9102
9378
|
var distance = NavFunctions.distance(start, end);
|
|
9103
9379
|
var speed = Math.max(step.distance / stepTime, minimumSpeed !== null && minimumSpeed !== void 0 ? minimumSpeed : 0);
|
|
9104
9380
|
if (speed * progressInSeconds > distance) {
|
|
@@ -9124,26 +9400,6 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
9124
9400
|
return _this8.animateStep(time, instance);
|
|
9125
9401
|
});
|
|
9126
9402
|
return;
|
|
9127
|
-
} else if (step.startInsideFloor !== step.endInsideFloor) {
|
|
9128
|
-
if (waitStartTime == null) {
|
|
9129
|
-
instance.conditions.waitStartTime = timestamp;
|
|
9130
|
-
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9131
|
-
return _this8.animateStep(time, instance);
|
|
9132
|
-
});
|
|
9133
|
-
return;
|
|
9134
|
-
}
|
|
9135
|
-
if (timestamp - waitStartTime < changeFloorTime * 1000) {
|
|
9136
|
-
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9137
|
-
return _this8.animateStep(time, instance);
|
|
9138
|
-
});
|
|
9139
|
-
return;
|
|
9140
|
-
} else {
|
|
9141
|
-
this.updatePlaceFloorForRouting(instance, step.endInsidePlace, step.endInsideFloor);
|
|
9142
|
-
this.setMarkerLngLat(instance, step.endLocation);
|
|
9143
|
-
instance.conditions.waitStartTime = undefined;
|
|
9144
|
-
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9145
|
-
return;
|
|
9146
|
-
}
|
|
9147
9403
|
} else {
|
|
9148
9404
|
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9149
9405
|
return;
|
|
@@ -9277,9 +9533,10 @@ var InternalGetRouteConfiguration = /*#__PURE__*/routeConfiguration_createClass(
|
|
|
9277
9533
|
* @param language The language for the instructions.
|
|
9278
9534
|
* @param unitSystem The unit system used for the distance.
|
|
9279
9535
|
* @param announceFormat The format used to announce directions in the instructions.
|
|
9536
|
+
* @param userBearing The user's heading in degrees used as the reference direction for announcing turns.
|
|
9280
9537
|
*/
|
|
9281
9538
|
function InternalGetRouteConfiguration(config) {
|
|
9282
|
-
var _config$preferAccessi, _config$language, _config$unitSystem, _config$announceForma;
|
|
9539
|
+
var _config$preferAccessi, _config$language, _config$unitSystem, _config$announceForma, _config$userBearing;
|
|
9283
9540
|
routeConfiguration_classCallCheck(this, InternalGetRouteConfiguration);
|
|
9284
9541
|
this.initialLocation = config.initialLocation;
|
|
9285
9542
|
this.finalLocation = config.finalLocation;
|
|
@@ -9287,6 +9544,7 @@ function InternalGetRouteConfiguration(config) {
|
|
|
9287
9544
|
this.language = (_config$language = config.language) !== null && _config$language !== void 0 ? _config$language : "en";
|
|
9288
9545
|
this.unitSystem = (_config$unitSystem = config.unitSystem) !== null && _config$unitSystem !== void 0 ? _config$unitSystem : UnitSystem.metric;
|
|
9289
9546
|
this.announceFormat = (_config$announceForma = config.announceFormat) !== null && _config$announceForma !== void 0 ? _config$announceForma : AnnounceFormat.relative;
|
|
9547
|
+
this.userBearing = (_config$userBearing = config.userBearing) !== null && _config$userBearing !== void 0 ? _config$userBearing : 0;
|
|
9290
9548
|
});
|
|
9291
9549
|
|
|
9292
9550
|
/**
|
|
@@ -9317,6 +9575,16 @@ function InternalDrawRouteConfiguration(config) {
|
|
|
9317
9575
|
/**
|
|
9318
9576
|
* Interface that represent a place with their id.
|
|
9319
9577
|
* @group Routes
|
|
9578
|
+
* @example
|
|
9579
|
+
* ```typescript
|
|
9580
|
+
* // Resolve an internal alias that is reused across several malls by
|
|
9581
|
+
* // pinning the building (and, optionally, the floor) it belongs to.
|
|
9582
|
+
* const origin: IdLocation = {
|
|
9583
|
+
* id: "store-204", // integrator alias, may repeat across buildings
|
|
9584
|
+
* buildingId: "mall-santiago",
|
|
9585
|
+
* floorId: "level-2", // takes precedence over `level`
|
|
9586
|
+
* }
|
|
9587
|
+
* ```
|
|
9320
9588
|
*/
|
|
9321
9589
|
|
|
9322
9590
|
/**
|
|
@@ -9371,11 +9639,11 @@ var InternalAnimationDrawingConfig = /*#__PURE__*/function () {
|
|
|
9371
9639
|
animation_classCallCheck(this, InternalAnimationDrawingConfig);
|
|
9372
9640
|
this.aheadPathStyle = (_data$aheadPathStyle = data.aheadPathStyle) !== null && _data$aheadPathStyle !== void 0 ? _data$aheadPathStyle : {
|
|
9373
9641
|
type: "Solid",
|
|
9374
|
-
color: "#
|
|
9642
|
+
color: "#0C0C0C"
|
|
9375
9643
|
};
|
|
9376
9644
|
this.behindPathStyle = (_data$behindPathStyle = data.behindPathStyle) !== null && _data$behindPathStyle !== void 0 ? _data$behindPathStyle : {
|
|
9377
9645
|
type: "Solid",
|
|
9378
|
-
color: "#
|
|
9646
|
+
color: "#276EF1"
|
|
9379
9647
|
};
|
|
9380
9648
|
this.polylineWidth = (_data$polylineWidth = data.polylineWidth) !== null && _data$polylineWidth !== void 0 ? _data$polylineWidth : 10;
|
|
9381
9649
|
if (data.routeIcon != null) {
|
|
@@ -9529,7 +9797,8 @@ var Loggeable = /*#__PURE__*/function () {
|
|
|
9529
9797
|
* maxTiles: 500,
|
|
9530
9798
|
* ttlMs: 60 * 60 * 1000, // 1 hour
|
|
9531
9799
|
* persistToServiceWorker: true,
|
|
9532
|
-
* preloadAdjacentZooms: false
|
|
9800
|
+
* preloadAdjacentZooms: false,
|
|
9801
|
+
* maxConcurrentTileFetches: 6
|
|
9533
9802
|
* };
|
|
9534
9803
|
* ```
|
|
9535
9804
|
*
|
|
@@ -9546,9 +9815,19 @@ var DEFAULT_TILE_CACHE_CONFIG = {
|
|
|
9546
9815
|
ttlMs: 30 * 60 * 1000,
|
|
9547
9816
|
// 30 minutes
|
|
9548
9817
|
persistToServiceWorker: true,
|
|
9549
|
-
preloadAdjacentZooms: false
|
|
9818
|
+
preloadAdjacentZooms: false,
|
|
9819
|
+
maxConcurrentTileFetches: 6
|
|
9550
9820
|
};
|
|
9551
9821
|
|
|
9822
|
+
/**
|
|
9823
|
+
* Hard cap for {@link MapTileCacheConfig.maxTiles}.
|
|
9824
|
+
* Configurations above this (e.g. millions) are clamped to avoid memory pressure
|
|
9825
|
+
* and excessive interaction with the tile CDN / service worker.
|
|
9826
|
+
*
|
|
9827
|
+
* @internal
|
|
9828
|
+
*/
|
|
9829
|
+
var MAPLIBRE_MAX_TILE_CACHE_HARD_CAP = 100000;
|
|
9830
|
+
|
|
9552
9831
|
/**
|
|
9553
9832
|
* Basic configuration for the map.
|
|
9554
9833
|
* Provides essential settings for initializing and customizing map behavior.
|
|
@@ -9586,11 +9865,298 @@ var DEFAULT_TILE_CACHE_CONFIG = {
|
|
|
9586
9865
|
* @property showZoom - (Optional) Whether to display the zoom control.
|
|
9587
9866
|
* @property navigationPosition - (Optional) Position of the navigation controls on the map.
|
|
9588
9867
|
* @property bearingSnap - (Optional) The bearing snap threshold in degrees.
|
|
9868
|
+
* @property bearing - (Optional) Initial bearing (rotation) of the map in degrees, clockwise from north.
|
|
9869
|
+
* @property interactive - (Optional) Master switch for all user interaction (pan/zoom/rotate).
|
|
9870
|
+
* @property rotateEnabled - (Optional) Whether the user can rotate the map; keeps pinch-zoom when disabled.
|
|
9871
|
+
* @property dragPan - (Optional) Whether the user can pan by dragging/swiping.
|
|
9872
|
+
* @property scrollZoom - (Optional) Whether the scroll wheel/trackpad can zoom the map.
|
|
9873
|
+
* @property doubleClickZoom - (Optional) Whether double-click/double-tap zooms the map.
|
|
9874
|
+
* @property touchZoomRotate - (Optional) Whether pinch gestures can zoom the map on touch devices.
|
|
9875
|
+
* @property keyboard - (Optional) Whether keyboard shortcuts can pan/zoom/rotate the map.
|
|
9589
9876
|
* @property institutionId - (Optional) The institution identifier for map context. Required for loading map related data from Portal.
|
|
9590
9877
|
* @property authToken - (Optional) Authentication token for accessing protected map resources. Required for loading map related data from Portal.
|
|
9591
9878
|
* @property apiUrl - (Optional) Injected by SDK when creating map; base API URL for map requests.
|
|
9592
9879
|
* @property mapvxRequestContext - (Optional) Injected by SDK when creating map; context sent as headers to public-api.mapvx.com.
|
|
9593
9880
|
*/
|
|
9881
|
+
;// ./src/domain/models/circle.ts
|
|
9882
|
+
function circle_typeof(o) { "@babel/helpers - typeof"; return circle_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, circle_typeof(o); }
|
|
9883
|
+
function circle_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9884
|
+
function circle_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? circle_ownKeys(Object(t), !0).forEach(function (r) { circle_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : circle_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9885
|
+
function circle_defineProperty(e, r, t) { return (r = circle_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9886
|
+
function circle_toPropertyKey(t) { var i = circle_toPrimitive(t, "string"); return "symbol" == circle_typeof(i) ? i : i + ""; }
|
|
9887
|
+
function circle_toPrimitive(t, r) { if ("object" != circle_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != circle_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9888
|
+
|
|
9889
|
+
/**
|
|
9890
|
+
* MapVX brand color used as the default for circle styling and other
|
|
9891
|
+
* SDK-drawn overlays (colored places, borders).
|
|
9892
|
+
*
|
|
9893
|
+
* @group Circles
|
|
9894
|
+
*/
|
|
9895
|
+
var MAPVX_BRAND_COLOR = "#276EF1";
|
|
9896
|
+
|
|
9897
|
+
/**
|
|
9898
|
+
* Where a circle renders relative to the other map layers.
|
|
9899
|
+
*
|
|
9900
|
+
* - `"aboveBasemap"` (default): above every basemap geometry layer —
|
|
9901
|
+
* including indoor floor-plate and building polygons — but below the
|
|
9902
|
+
* labels that follow them. A circle is never occluded by basemap fills.
|
|
9903
|
+
* - `"belowLabels"`: below the first symbol (label) layer of the style.
|
|
9904
|
+
* On indoor styles, floor-plate polygons ordered after that layer will
|
|
9905
|
+
* paint over the circle.
|
|
9906
|
+
* - `"top"`: above everything, including labels and markers drawn in
|
|
9907
|
+
* style layers.
|
|
9908
|
+
*
|
|
9909
|
+
* @group Circles
|
|
9910
|
+
*/
|
|
9911
|
+
|
|
9912
|
+
/**
|
|
9913
|
+
* Valid values for {@link CircleRenderOrder}, in rendering order.
|
|
9914
|
+
* @internal
|
|
9915
|
+
*/
|
|
9916
|
+
var CIRCLE_RENDER_ORDERS = ["belowLabels", "aboveBasemap", "top"];
|
|
9917
|
+
|
|
9918
|
+
/**
|
|
9919
|
+
* Default styling values applied to a circle when the corresponding
|
|
9920
|
+
* {@link CircleConfig} fields are omitted.
|
|
9921
|
+
*
|
|
9922
|
+
* @group Circles
|
|
9923
|
+
*/
|
|
9924
|
+
var CIRCLE_DEFAULTS = {
|
|
9925
|
+
fillColor: MAPVX_BRAND_COLOR,
|
|
9926
|
+
fillOpacity: 0.14,
|
|
9927
|
+
strokeColor: MAPVX_BRAND_COLOR,
|
|
9928
|
+
strokeWidth: 2,
|
|
9929
|
+
strokeOpacity: 0.65,
|
|
9930
|
+
renderOrder: "aboveBasemap"
|
|
9931
|
+
};
|
|
9932
|
+
|
|
9933
|
+
/**
|
|
9934
|
+
* Represents the configuration for the creation of a metric radius circle on a map.
|
|
9935
|
+
* The radius is expressed in meters (geographic), so the drawn circle stays
|
|
9936
|
+
* metrically accurate at every zoom level.
|
|
9937
|
+
*
|
|
9938
|
+
* @example
|
|
9939
|
+
* ```typescript
|
|
9940
|
+
* const circleConfig: CircleConfig = {
|
|
9941
|
+
* id: "geofence-1",
|
|
9942
|
+
* coordinate: { lat: 40.7128, lng: -74.0060 },
|
|
9943
|
+
* radiusMeters: 150,
|
|
9944
|
+
* fillOpacity: 0.2,
|
|
9945
|
+
* };
|
|
9946
|
+
* ```
|
|
9947
|
+
*
|
|
9948
|
+
* @group Circles
|
|
9949
|
+
*/
|
|
9950
|
+
|
|
9951
|
+
/**
|
|
9952
|
+
* Internal resolved representation of a circle kept by the map.
|
|
9953
|
+
* Holds the full configuration with defaults applied, plus visibility state.
|
|
9954
|
+
*
|
|
9955
|
+
* Unlike markers, the hidden flag persists across floor changes and map
|
|
9956
|
+
* restyles: a circle hidden via `hideCircle` stays hidden until `showCircle`.
|
|
9957
|
+
*/
|
|
9958
|
+
|
|
9959
|
+
/**
|
|
9960
|
+
* Returns a deep copy of a {@link CircleRecord}, including the nested
|
|
9961
|
+
* coordinate. Used by the map accessors so callers can't mutate internal
|
|
9962
|
+
* circle state by writing to a returned record.
|
|
9963
|
+
*
|
|
9964
|
+
* @param record The circle record to clone.
|
|
9965
|
+
* @returns An independent copy of the record.
|
|
9966
|
+
*
|
|
9967
|
+
* @group Circles
|
|
9968
|
+
*/
|
|
9969
|
+
function cloneCircleRecord(record) {
|
|
9970
|
+
return circle_objectSpread(circle_objectSpread({}, record), {}, {
|
|
9971
|
+
coordinate: circle_objectSpread({}, record.coordinate)
|
|
9972
|
+
});
|
|
9973
|
+
}
|
|
9974
|
+
|
|
9975
|
+
/**
|
|
9976
|
+
* Validates that a radius in meters is positive and finite.
|
|
9977
|
+
* @param radius The radius value to validate.
|
|
9978
|
+
* @throws {Error} If radius is ≤ 0 or not finite (NaN/Infinity).
|
|
9979
|
+
* @internal
|
|
9980
|
+
*/
|
|
9981
|
+
function validateRadiusMeters(radius) {
|
|
9982
|
+
if (!Number.isFinite(radius) || radius <= 0) {
|
|
9983
|
+
throw new Error("Invalid radiusMeters: ".concat(radius, ". Must be a positive finite number."));
|
|
9984
|
+
}
|
|
9985
|
+
}
|
|
9986
|
+
|
|
9987
|
+
/**
|
|
9988
|
+
* Validates that a coordinate is within valid geographic bounds.
|
|
9989
|
+
* @param coord The coordinate to validate.
|
|
9990
|
+
* @throws {Error} If latitude is outside [-90, 90] or longitude outside [-180, 180], or not finite.
|
|
9991
|
+
* @internal
|
|
9992
|
+
*/
|
|
9993
|
+
function validateCoordinate(coord) {
|
|
9994
|
+
if (coord == null || circle_typeof(coord) !== "object") {
|
|
9995
|
+
throw new Error("Invalid coordinate: expected an object with lat and lng properties.");
|
|
9996
|
+
}
|
|
9997
|
+
if (!Number.isFinite(coord.lat) || !Number.isFinite(coord.lng) || coord.lat < -90 || coord.lat > 90 || coord.lng < -180 || coord.lng > 180) {
|
|
9998
|
+
throw new Error("Invalid coordinate: lat=".concat(coord.lat, ", lng=").concat(coord.lng, ". ") + "latitude must be in [-90, 90], longitude in [-180, 180], and both finite.");
|
|
9999
|
+
}
|
|
10000
|
+
}
|
|
10001
|
+
|
|
10002
|
+
/**
|
|
10003
|
+
* Clamps an opacity value to the valid range [0, 1].
|
|
10004
|
+
* @param opacity The opacity value to clamp.
|
|
10005
|
+
* @param defaultValue Value to use if opacity is not a finite number.
|
|
10006
|
+
* @returns The clamped opacity value.
|
|
10007
|
+
* @internal
|
|
10008
|
+
*/
|
|
10009
|
+
function clampOpacity(opacity, defaultValue) {
|
|
10010
|
+
if (!Number.isFinite(opacity)) return defaultValue;
|
|
10011
|
+
return Math.max(0, Math.min(1, opacity));
|
|
10012
|
+
}
|
|
10013
|
+
|
|
10014
|
+
/**
|
|
10015
|
+
* Type guard for validating circle configurations without throwing.
|
|
10016
|
+
* Returns true if the configuration is valid and can be added to the map.
|
|
10017
|
+
*
|
|
10018
|
+
* @param config Configuration to validate.
|
|
10019
|
+
* @returns True if config is a valid CircleConfig, false otherwise.
|
|
10020
|
+
*
|
|
10021
|
+
* @example
|
|
10022
|
+
* ```typescript
|
|
10023
|
+
* if (isValidCircleConfig(userInput)) {
|
|
10024
|
+
* map.addCircle(userInput);
|
|
10025
|
+
* } else {
|
|
10026
|
+
* console.error('Invalid circle configuration');
|
|
10027
|
+
* }
|
|
10028
|
+
* ```
|
|
10029
|
+
*
|
|
10030
|
+
* @group Circles
|
|
10031
|
+
*/
|
|
10032
|
+
function isValidCircleConfig(config) {
|
|
10033
|
+
if (config === null || config === undefined || circle_typeof(config) !== "object") {
|
|
10034
|
+
return false;
|
|
10035
|
+
}
|
|
10036
|
+
var c = config;
|
|
10037
|
+
if (circle_typeof(c.coordinate) !== "object" || c.coordinate === null) return false;
|
|
10038
|
+
var coord = c.coordinate;
|
|
10039
|
+
if (typeof coord.lat !== "number" || typeof coord.lng !== "number" || !Number.isFinite(coord.lat) || !Number.isFinite(coord.lng) || coord.lat < -90 || coord.lat > 90 || coord.lng < -180 || coord.lng > 180) {
|
|
10040
|
+
return false;
|
|
10041
|
+
}
|
|
10042
|
+
if (typeof c.radiusMeters !== "number" || !Number.isFinite(c.radiusMeters) || c.radiusMeters <= 0) {
|
|
10043
|
+
return false;
|
|
10044
|
+
}
|
|
10045
|
+
if (c.id !== undefined && typeof c.id !== "string") return false;
|
|
10046
|
+
if (c.fillColor !== undefined && typeof c.fillColor !== "string") return false;
|
|
10047
|
+
if (c.fillOpacity !== undefined) {
|
|
10048
|
+
if (typeof c.fillOpacity !== "number" || !Number.isFinite(c.fillOpacity)) return false;
|
|
10049
|
+
}
|
|
10050
|
+
if (c.strokeColor !== undefined && typeof c.strokeColor !== "string") return false;
|
|
10051
|
+
if (c.strokeWidth !== undefined) {
|
|
10052
|
+
if (typeof c.strokeWidth !== "number" || !Number.isFinite(c.strokeWidth)) return false;
|
|
10053
|
+
}
|
|
10054
|
+
if (c.strokeOpacity !== undefined) {
|
|
10055
|
+
if (typeof c.strokeOpacity !== "number" || !Number.isFinite(c.strokeOpacity)) return false;
|
|
10056
|
+
}
|
|
10057
|
+
if (c.floorId !== undefined && typeof c.floorId !== "string") return false;
|
|
10058
|
+
if (c.renderOrder !== undefined && !CIRCLE_RENDER_ORDERS.includes(c.renderOrder)) {
|
|
10059
|
+
return false;
|
|
10060
|
+
}
|
|
10061
|
+
return true;
|
|
10062
|
+
}
|
|
10063
|
+
|
|
10064
|
+
/**
|
|
10065
|
+
* Resolves a {@link CircleConfig} into a {@link CircleRecord}, applying
|
|
10066
|
+
* default styling, generating an id when one is not provided, and validating inputs.
|
|
10067
|
+
*
|
|
10068
|
+
* @param config Circle configuration provided by the SDK consumer.
|
|
10069
|
+
* @param hidden Initial hidden state, defaults to visible.
|
|
10070
|
+
* @returns The resolved circle record ready to be stored and rendered.
|
|
10071
|
+
* @throws {Error} If radiusMeters is ≤ 0, not finite, or coordinates are invalid.
|
|
10072
|
+
*
|
|
10073
|
+
* @group Circles
|
|
10074
|
+
*/
|
|
10075
|
+
function resolveCircleConfig(config) {
|
|
10076
|
+
var _config$id, _config$fillColor, _config$strokeColor, _config$strokeWidth, _config$renderOrder;
|
|
10077
|
+
var hidden = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
10078
|
+
validateRadiusMeters(config.radiusMeters);
|
|
10079
|
+
validateCoordinate(config.coordinate);
|
|
10080
|
+
if (config.renderOrder !== undefined && !CIRCLE_RENDER_ORDERS.includes(config.renderOrder)) {
|
|
10081
|
+
throw new Error("Invalid renderOrder: ".concat(String(config.renderOrder), ". ") + "Must be one of: ".concat(CIRCLE_RENDER_ORDERS.join(", "), "."));
|
|
10082
|
+
}
|
|
10083
|
+
return {
|
|
10084
|
+
id: (_config$id = config.id) !== null && _config$id !== void 0 ? _config$id : generateHexadecimalKey(),
|
|
10085
|
+
// Copy the coordinate so later mutations of the caller's object
|
|
10086
|
+
// can't change internal circle state
|
|
10087
|
+
coordinate: {
|
|
10088
|
+
lat: config.coordinate.lat,
|
|
10089
|
+
lng: config.coordinate.lng
|
|
10090
|
+
},
|
|
10091
|
+
radiusMeters: config.radiusMeters,
|
|
10092
|
+
fillColor: (_config$fillColor = config.fillColor) !== null && _config$fillColor !== void 0 ? _config$fillColor : CIRCLE_DEFAULTS.fillColor,
|
|
10093
|
+
fillOpacity: clampOpacity(config.fillOpacity, CIRCLE_DEFAULTS.fillOpacity),
|
|
10094
|
+
strokeColor: (_config$strokeColor = config.strokeColor) !== null && _config$strokeColor !== void 0 ? _config$strokeColor : CIRCLE_DEFAULTS.strokeColor,
|
|
10095
|
+
strokeWidth: (_config$strokeWidth = config.strokeWidth) !== null && _config$strokeWidth !== void 0 ? _config$strokeWidth : CIRCLE_DEFAULTS.strokeWidth,
|
|
10096
|
+
strokeOpacity: clampOpacity(config.strokeOpacity, CIRCLE_DEFAULTS.strokeOpacity),
|
|
10097
|
+
floorId: config.floorId,
|
|
10098
|
+
renderOrder: (_config$renderOrder = config.renderOrder) !== null && _config$renderOrder !== void 0 ? _config$renderOrder : CIRCLE_DEFAULTS.renderOrder,
|
|
10099
|
+
hidden: hidden
|
|
10100
|
+
};
|
|
10101
|
+
}
|
|
10102
|
+
|
|
10103
|
+
/**
|
|
10104
|
+
* Builds a closed GeoJSON polygon ring approximating a geographic circle.
|
|
10105
|
+
*
|
|
10106
|
+
* The ring is computed with an equirectangular approximation: meters are
|
|
10107
|
+
* converted to degrees independently per axis, with the longitude scale
|
|
10108
|
+
* corrected by the cosine of the latitude. For the radii the SDK works with
|
|
10109
|
+
* (tens to hundreds of meters) the metric error is negligible (≤1%) at any latitude
|
|
10110
|
+
* where the projection is defined. At extreme polar latitudes, the approximation
|
|
10111
|
+
* breaks down, so circles near poles (|lat| > 85°) should be used with caution.
|
|
10112
|
+
*
|
|
10113
|
+
* @param lng Longitude of the circle center in degrees.
|
|
10114
|
+
* @param lat Latitude of the circle center in degrees.
|
|
10115
|
+
* @param radiusMeters Radius of the circle in meters. Must be positive and finite.
|
|
10116
|
+
* @param points Number of segments in the ring. Defaults to 64. Non-integer
|
|
10117
|
+
* values are floored and the count is clamped to a minimum of 3,
|
|
10118
|
+
* the smallest valid GeoJSON linear ring; non-finite values fall
|
|
10119
|
+
* back to the default.
|
|
10120
|
+
* @returns A closed ring of `[lng, lat]` positions (first equals last).
|
|
10121
|
+
*
|
|
10122
|
+
* @example
|
|
10123
|
+
* ```typescript
|
|
10124
|
+
* import { circleRing } from '@mapvx/web-js';
|
|
10125
|
+
*
|
|
10126
|
+
* // Create a 150-meter radius circle ring
|
|
10127
|
+
* const ring = circleRing(-74.0060, 40.7128, 150);
|
|
10128
|
+
* const polygon = { type: "Polygon", coordinates: [ring] };
|
|
10129
|
+
*
|
|
10130
|
+
* // Custom segments (32 instead of 64) for lower resolution
|
|
10131
|
+
* const coarseRing = circleRing(-74.0060, 40.7128, 150, 32);
|
|
10132
|
+
* ```
|
|
10133
|
+
*
|
|
10134
|
+
* @note Equirectangular approximation is accurate for radii up to ~500 km and
|
|
10135
|
+
* latitudes between approximately ±80°. Beyond these limits, visual
|
|
10136
|
+
* distortion may occur near the poles.
|
|
10137
|
+
* @note Generated rings do not account for geographic obstacles, walls, or
|
|
10138
|
+
* buildings. For complex geofencing, consider server-side validation.
|
|
10139
|
+
*
|
|
10140
|
+
* @group Circles
|
|
10141
|
+
*/
|
|
10142
|
+
function circleRing(lng, lat, radiusMeters) {
|
|
10143
|
+
var points = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 64;
|
|
10144
|
+
// A linear ring needs at least 3 distinct positions to be valid GeoJSON
|
|
10145
|
+
var segments = Number.isFinite(points) ? Math.max(3, Math.floor(points)) : 64;
|
|
10146
|
+
var ring = [];
|
|
10147
|
+
var latRad = lat * Math.PI / 180;
|
|
10148
|
+
var metersPerDegLat = 110574;
|
|
10149
|
+
var metersPerDegLng = 111320 * Math.cos(latRad || 0.000001);
|
|
10150
|
+
var latR = radiusMeters / metersPerDegLat;
|
|
10151
|
+
var lngR = radiusMeters / (metersPerDegLng || 1);
|
|
10152
|
+
for (var i = 0; i < segments; i += 1) {
|
|
10153
|
+
var a = i / segments * Math.PI * 2;
|
|
10154
|
+
ring.push([lng + lngR * Math.cos(a), lat + latR * Math.sin(a)]);
|
|
10155
|
+
}
|
|
10156
|
+
// Close the ring with an exact copy of the first position, as GeoJSON requires
|
|
10157
|
+
ring.push([ring[0][0], ring[0][1]]);
|
|
10158
|
+
return ring;
|
|
10159
|
+
}
|
|
9594
10160
|
;// ./node_modules/.pnpm/@googlemaps+polyline-codec@1.0.28/node_modules/@googlemaps/polyline-codec/dist/index.esm.js
|
|
9595
10161
|
/**
|
|
9596
10162
|
* Copyright 2020 Google LLC
|
|
@@ -10788,11 +11354,9 @@ var Requester = /*#__PURE__*/function () {
|
|
|
10788
11354
|
// Ensure we have an absolute URL (required for new URL() in fetchFromUrl)
|
|
10789
11355
|
var withProtocol = apiUrl.startsWith("http://") || apiUrl.startsWith("https://") ? apiUrl : "https://".concat(apiUrl);
|
|
10790
11356
|
var cleanApiUrl = withProtocol.endsWith("/") ? withProtocol.slice(0, -1) : withProtocol;
|
|
10791
|
-
this.baseUrl = "".concat(cleanApiUrl, "/api/sdk/");
|
|
10792
|
-
this.baseUrlV2 = "".concat(cleanApiUrl, "/api/sdk/v2/");
|
|
10793
|
-
this.baseUrlApi = "".concat(cleanApiUrl, "/api/");
|
|
11357
|
+
this.baseUrl = "".concat(cleanApiUrl, "/api/sdk/v2/");
|
|
10794
11358
|
this.baseUrlPortal = "".concat(cleanApiUrl, "/api/portal/");
|
|
10795
|
-
this.baseUrlHealth = "https://api.mapvx.com/api/health
|
|
11359
|
+
this.baseUrlHealth = "https://api.mapvx.com/api/sdk/v2/health";
|
|
10796
11360
|
this.oldBaseUrl = "https://api.mapvx.com/api/sdk/";
|
|
10797
11361
|
this.routeBaseUrl = "https://api.mapvx.com/sdk/";
|
|
10798
11362
|
}
|
|
@@ -10885,11 +11449,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
10885
11449
|
options = {
|
|
10886
11450
|
method: "GET",
|
|
10887
11451
|
headers: {
|
|
10888
|
-
"content-type": "application/json"
|
|
11452
|
+
"content-type": "application/json",
|
|
11453
|
+
Authorization: "Bearer ".concat(token)
|
|
10889
11454
|
}
|
|
10890
11455
|
};
|
|
10891
11456
|
params = {
|
|
10892
|
-
token: token,
|
|
10893
11457
|
stopId: stopId,
|
|
10894
11458
|
lang: this.lang
|
|
10895
11459
|
};
|
|
@@ -10921,11 +11485,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
10921
11485
|
options = {
|
|
10922
11486
|
method: "GET",
|
|
10923
11487
|
headers: {
|
|
10924
|
-
"content-type": "application/json"
|
|
11488
|
+
"content-type": "application/json",
|
|
11489
|
+
Authorization: "Bearer ".concat(token)
|
|
10925
11490
|
}
|
|
10926
11491
|
};
|
|
10927
11492
|
params = {
|
|
10928
|
-
token: token,
|
|
10929
11493
|
stopId: stopId,
|
|
10930
11494
|
vehicleId: vehicleId,
|
|
10931
11495
|
lang: this.lang
|
|
@@ -10957,11 +11521,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
10957
11521
|
options = {
|
|
10958
11522
|
method: "GET",
|
|
10959
11523
|
headers: {
|
|
10960
|
-
"content-type": "application/json"
|
|
11524
|
+
"content-type": "application/json",
|
|
11525
|
+
Authorization: "Bearer ".concat(token)
|
|
10961
11526
|
}
|
|
10962
11527
|
};
|
|
10963
11528
|
params = {
|
|
10964
|
-
token: token,
|
|
10965
11529
|
lang: this.lang
|
|
10966
11530
|
};
|
|
10967
11531
|
if (placeId != null) {
|
|
@@ -11034,11 +11598,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11034
11598
|
options = {
|
|
11035
11599
|
method: "GET",
|
|
11036
11600
|
headers: {
|
|
11037
|
-
"content-type": "application/json"
|
|
11601
|
+
"content-type": "application/json",
|
|
11602
|
+
Authorization: "Bearer ".concat(token)
|
|
11038
11603
|
}
|
|
11039
11604
|
};
|
|
11040
11605
|
params = {
|
|
11041
|
-
token: token,
|
|
11042
11606
|
lang: this.lang
|
|
11043
11607
|
};
|
|
11044
11608
|
return _context6.a(2, this.fetchFromUrl(this.baseUrl + "availablePlaces", params, options));
|
|
@@ -11107,11 +11671,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11107
11671
|
options = {
|
|
11108
11672
|
method: "GET",
|
|
11109
11673
|
headers: {
|
|
11110
|
-
"content-type": "application/json"
|
|
11674
|
+
"content-type": "application/json",
|
|
11675
|
+
Authorization: "Bearer ".concat(token)
|
|
11111
11676
|
}
|
|
11112
11677
|
};
|
|
11113
11678
|
params = {
|
|
11114
|
-
token: token,
|
|
11115
11679
|
place_id: placeId,
|
|
11116
11680
|
lang: this.lang
|
|
11117
11681
|
};
|
|
@@ -11181,11 +11745,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11181
11745
|
options = {
|
|
11182
11746
|
method: "GET",
|
|
11183
11747
|
headers: {
|
|
11184
|
-
"content-type": "application/json"
|
|
11748
|
+
"content-type": "application/json",
|
|
11749
|
+
Authorization: "Bearer ".concat(token)
|
|
11185
11750
|
}
|
|
11186
11751
|
};
|
|
11187
11752
|
params = {
|
|
11188
|
-
token: token,
|
|
11189
11753
|
targetPlace: targetPlaceId,
|
|
11190
11754
|
lang: this.lang
|
|
11191
11755
|
};
|
|
@@ -11239,72 +11803,118 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11239
11803
|
}
|
|
11240
11804
|
return fetchAnySubPlaces;
|
|
11241
11805
|
}()
|
|
11806
|
+
/**
|
|
11807
|
+
* Build the cleaned query parameters for a route request.
|
|
11808
|
+
*
|
|
11809
|
+
* Resolves both the origin (`from*`) and destination (`to*`) sides of the route
|
|
11810
|
+
* from the provided configuration. For {@link IdLocation} endpoints this also
|
|
11811
|
+
* forwards the building (`fromBuilding`/`toBuilding`) and floor
|
|
11812
|
+
* (`fromFloor`/`toFloor`) so internal aliases that are reused across buildings
|
|
11813
|
+
* can be disambiguated. Parameters that resolve to `null`/`undefined` are dropped.
|
|
11814
|
+
* @param routeConfig The route configuration to translate into query params.
|
|
11815
|
+
* @returns The cleaned query parameters ready to be appended to the request URL.
|
|
11816
|
+
*/
|
|
11817
|
+
)
|
|
11818
|
+
}, {
|
|
11819
|
+
key: "buildRouteParams",
|
|
11820
|
+
value: function buildRouteParams(routeConfig) {
|
|
11821
|
+
var params = {
|
|
11822
|
+
fromLatLng: undefined,
|
|
11823
|
+
fromBuilding: undefined,
|
|
11824
|
+
fromFloor: undefined,
|
|
11825
|
+
toLatLng: undefined,
|
|
11826
|
+
toBuilding: undefined,
|
|
11827
|
+
toFloor: undefined,
|
|
11828
|
+
fromPlaceId: undefined,
|
|
11829
|
+
toPlaceId: undefined,
|
|
11830
|
+
travelMode: TransportationMode.walking,
|
|
11831
|
+
reducedMobility: routeConfig.preferAccessibleRoute ? 1 : 0,
|
|
11832
|
+
announceFormat: routeConfig.announceFormat,
|
|
11833
|
+
userBearing: routeConfig.userBearing,
|
|
11834
|
+
lang: this.lang,
|
|
11835
|
+
unitSystem: routeConfig.unitSystem
|
|
11836
|
+
};
|
|
11837
|
+
if ("id" in routeConfig.initialLocation) {
|
|
11838
|
+
var _routeConfig$initialL = routeConfig.initialLocation,
|
|
11839
|
+
id = _routeConfig$initialL.id,
|
|
11840
|
+
buildingId = _routeConfig$initialL.buildingId,
|
|
11841
|
+
floorId = _routeConfig$initialL.floorId,
|
|
11842
|
+
level = _routeConfig$initialL.level;
|
|
11843
|
+
params.fromPlaceId = id;
|
|
11844
|
+
if (buildingId !== undefined) {
|
|
11845
|
+
params.fromBuilding = buildingId;
|
|
11846
|
+
}
|
|
11847
|
+
if (floorId !== undefined) {
|
|
11848
|
+
params.fromFloor = floorId;
|
|
11849
|
+
} else if (level !== undefined) {
|
|
11850
|
+
params.fromFloor = level;
|
|
11851
|
+
}
|
|
11852
|
+
} else {
|
|
11853
|
+
var _routeConfig$initialL2 = routeConfig.initialLocation,
|
|
11854
|
+
lat = _routeConfig$initialL2.lat,
|
|
11855
|
+
lng = _routeConfig$initialL2.lng,
|
|
11856
|
+
_floorId = _routeConfig$initialL2.floorId,
|
|
11857
|
+
placeId = _routeConfig$initialL2.placeId;
|
|
11858
|
+
params.fromLatLng = "".concat(lat, ",").concat(lng);
|
|
11859
|
+
params.fromFloor = _floorId;
|
|
11860
|
+
params.fromBuilding = placeId;
|
|
11861
|
+
}
|
|
11862
|
+
if ("id" in routeConfig.finalLocation) {
|
|
11863
|
+
var _routeConfig$finalLoc = routeConfig.finalLocation,
|
|
11864
|
+
_id = _routeConfig$finalLoc.id,
|
|
11865
|
+
_buildingId = _routeConfig$finalLoc.buildingId,
|
|
11866
|
+
_floorId2 = _routeConfig$finalLoc.floorId,
|
|
11867
|
+
_level = _routeConfig$finalLoc.level;
|
|
11868
|
+
params.toPlaceId = _id;
|
|
11869
|
+
if (_buildingId !== undefined) {
|
|
11870
|
+
params.toBuilding = _buildingId;
|
|
11871
|
+
}
|
|
11872
|
+
if (_floorId2 !== undefined) {
|
|
11873
|
+
params.toFloor = _floorId2;
|
|
11874
|
+
} else if (_level !== undefined) {
|
|
11875
|
+
params.toFloor = _level;
|
|
11876
|
+
}
|
|
11877
|
+
} else {
|
|
11878
|
+
var _routeConfig$finalLoc2 = routeConfig.finalLocation,
|
|
11879
|
+
_lat = _routeConfig$finalLoc2.lat,
|
|
11880
|
+
_lng = _routeConfig$finalLoc2.lng,
|
|
11881
|
+
_floorId3 = _routeConfig$finalLoc2.floorId,
|
|
11882
|
+
_placeId = _routeConfig$finalLoc2.placeId;
|
|
11883
|
+
params.toLatLng = "".concat(_lat, ",").concat(_lng);
|
|
11884
|
+
params.toFloor = _floorId3;
|
|
11885
|
+
params.toBuilding = _placeId;
|
|
11886
|
+
}
|
|
11887
|
+
var cleanParams = {};
|
|
11888
|
+
for (var key in params) {
|
|
11889
|
+
var value = params[key];
|
|
11890
|
+
if (value != null) {
|
|
11891
|
+
cleanParams[key] = value;
|
|
11892
|
+
}
|
|
11893
|
+
}
|
|
11894
|
+
return cleanParams;
|
|
11895
|
+
}
|
|
11896
|
+
|
|
11242
11897
|
/**
|
|
11243
11898
|
* To obtain the route
|
|
11244
11899
|
* @param routeConfig
|
|
11245
11900
|
* @returns
|
|
11246
11901
|
*/
|
|
11247
|
-
)
|
|
11248
11902
|
}, {
|
|
11249
11903
|
key: "fetchRoute",
|
|
11250
11904
|
value: (function () {
|
|
11251
11905
|
var _fetchRoute = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee10(routeConfig, token) {
|
|
11252
|
-
var options,
|
|
11906
|
+
var options, cleanParams;
|
|
11253
11907
|
return requester_regenerator().w(function (_context10) {
|
|
11254
11908
|
while (1) switch (_context10.n) {
|
|
11255
11909
|
case 0:
|
|
11256
11910
|
options = {
|
|
11257
11911
|
method: "GET",
|
|
11258
11912
|
headers: {
|
|
11259
|
-
"content-type": "application/json"
|
|
11913
|
+
"content-type": "application/json",
|
|
11914
|
+
Authorization: "Bearer ".concat(token)
|
|
11260
11915
|
}
|
|
11261
11916
|
};
|
|
11262
|
-
|
|
11263
|
-
fromLatLng: undefined,
|
|
11264
|
-
fromBuilding: undefined,
|
|
11265
|
-
fromFloor: undefined,
|
|
11266
|
-
toLatLng: undefined,
|
|
11267
|
-
toBuilding: undefined,
|
|
11268
|
-
toFloor: undefined,
|
|
11269
|
-
fromPlaceId: undefined,
|
|
11270
|
-
toPlaceId: undefined,
|
|
11271
|
-
travelMode: TransportationMode.walking,
|
|
11272
|
-
reducedMobility: routeConfig.preferAccessibleRoute ? 1 : 0,
|
|
11273
|
-
announceFormat: routeConfig.announceFormat,
|
|
11274
|
-
userBearing: 0,
|
|
11275
|
-
lang: this.lang,
|
|
11276
|
-
unitSystem: routeConfig.unitSystem,
|
|
11277
|
-
token: token
|
|
11278
|
-
};
|
|
11279
|
-
if ("id" in routeConfig.initialLocation) {
|
|
11280
|
-
params.fromPlaceId = routeConfig.initialLocation.id;
|
|
11281
|
-
if (routeConfig.initialLocation.level !== undefined) {
|
|
11282
|
-
params.fromFloor = routeConfig.initialLocation.level;
|
|
11283
|
-
}
|
|
11284
|
-
} else {
|
|
11285
|
-
_routeConfig$initialL = routeConfig.initialLocation, lat = _routeConfig$initialL.lat, lng = _routeConfig$initialL.lng, floorId = _routeConfig$initialL.floorId, placeId = _routeConfig$initialL.placeId;
|
|
11286
|
-
params.fromLatLng = "".concat(lat, ",").concat(lng);
|
|
11287
|
-
params.fromFloor = floorId;
|
|
11288
|
-
params.fromBuilding = placeId;
|
|
11289
|
-
}
|
|
11290
|
-
if ("id" in routeConfig.finalLocation) {
|
|
11291
|
-
params.toPlaceId = routeConfig.finalLocation.id;
|
|
11292
|
-
if (routeConfig.finalLocation.level !== undefined) {
|
|
11293
|
-
params.toFloor = routeConfig.finalLocation.level;
|
|
11294
|
-
}
|
|
11295
|
-
} else {
|
|
11296
|
-
_routeConfig$finalLoc = routeConfig.finalLocation, _lat = _routeConfig$finalLoc.lat, _lng = _routeConfig$finalLoc.lng, _floorId = _routeConfig$finalLoc.floorId, _placeId = _routeConfig$finalLoc.placeId;
|
|
11297
|
-
params.toLatLng = "".concat(_lat, ",").concat(_lng);
|
|
11298
|
-
params.toFloor = _floorId;
|
|
11299
|
-
params.toBuilding = _placeId;
|
|
11300
|
-
}
|
|
11301
|
-
cleanParams = {};
|
|
11302
|
-
for (key in params) {
|
|
11303
|
-
value = params[key];
|
|
11304
|
-
if (value != null) {
|
|
11305
|
-
cleanParams[key] = value;
|
|
11306
|
-
}
|
|
11307
|
-
}
|
|
11917
|
+
cleanParams = this.buildRouteParams(routeConfig);
|
|
11308
11918
|
return _context10.a(2, this.fetchFromUrl(this.routeBaseUrl + "route", cleanParams, options));
|
|
11309
11919
|
}
|
|
11310
11920
|
}, _callee10, this);
|
|
@@ -11324,62 +11934,18 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11324
11934
|
key: "fetchRouteV2",
|
|
11325
11935
|
value: (function () {
|
|
11326
11936
|
var _fetchRouteV = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee11(routeConfig, token) {
|
|
11327
|
-
var options,
|
|
11937
|
+
var options, cleanParams;
|
|
11328
11938
|
return requester_regenerator().w(function (_context11) {
|
|
11329
11939
|
while (1) switch (_context11.n) {
|
|
11330
11940
|
case 0:
|
|
11331
11941
|
options = {
|
|
11332
11942
|
method: "GET",
|
|
11333
11943
|
headers: {
|
|
11334
|
-
"content-type": "application/json"
|
|
11944
|
+
"content-type": "application/json",
|
|
11945
|
+
Authorization: "Bearer ".concat(token)
|
|
11335
11946
|
}
|
|
11336
11947
|
};
|
|
11337
|
-
|
|
11338
|
-
fromLatLng: undefined,
|
|
11339
|
-
fromBuilding: undefined,
|
|
11340
|
-
fromFloor: undefined,
|
|
11341
|
-
toLatLng: undefined,
|
|
11342
|
-
toBuilding: undefined,
|
|
11343
|
-
toFloor: undefined,
|
|
11344
|
-
fromPlaceId: undefined,
|
|
11345
|
-
toPlaceId: undefined,
|
|
11346
|
-
travelMode: TransportationMode.walking,
|
|
11347
|
-
reducedMobility: routeConfig.preferAccessibleRoute ? 1 : 0,
|
|
11348
|
-
announceFormat: routeConfig.announceFormat,
|
|
11349
|
-
userBearing: 0,
|
|
11350
|
-
lang: this.lang,
|
|
11351
|
-
unitSystem: routeConfig.unitSystem,
|
|
11352
|
-
token: token
|
|
11353
|
-
};
|
|
11354
|
-
if ("id" in routeConfig.initialLocation) {
|
|
11355
|
-
params.fromPlaceId = routeConfig.initialLocation.id;
|
|
11356
|
-
if (routeConfig.initialLocation.level !== undefined) {
|
|
11357
|
-
params.fromFloor = routeConfig.initialLocation.level;
|
|
11358
|
-
}
|
|
11359
|
-
} else {
|
|
11360
|
-
_routeConfig$initialL2 = routeConfig.initialLocation, lat = _routeConfig$initialL2.lat, lng = _routeConfig$initialL2.lng, floorId = _routeConfig$initialL2.floorId, placeId = _routeConfig$initialL2.placeId;
|
|
11361
|
-
params.fromLatLng = "".concat(lat, ",").concat(lng);
|
|
11362
|
-
params.fromFloor = floorId;
|
|
11363
|
-
params.fromBuilding = placeId;
|
|
11364
|
-
}
|
|
11365
|
-
if ("id" in routeConfig.finalLocation) {
|
|
11366
|
-
params.toPlaceId = routeConfig.finalLocation.id;
|
|
11367
|
-
if (routeConfig.finalLocation.level !== undefined) {
|
|
11368
|
-
params.toFloor = routeConfig.finalLocation.level;
|
|
11369
|
-
}
|
|
11370
|
-
} else {
|
|
11371
|
-
_routeConfig$finalLoc2 = routeConfig.finalLocation, _lat2 = _routeConfig$finalLoc2.lat, _lng2 = _routeConfig$finalLoc2.lng, _floorId2 = _routeConfig$finalLoc2.floorId, _placeId2 = _routeConfig$finalLoc2.placeId;
|
|
11372
|
-
params.toLatLng = "".concat(_lat2, ",").concat(_lng2);
|
|
11373
|
-
params.toFloor = _floorId2;
|
|
11374
|
-
params.toBuilding = _placeId2;
|
|
11375
|
-
}
|
|
11376
|
-
cleanParams = {};
|
|
11377
|
-
for (key in params) {
|
|
11378
|
-
value = params[key];
|
|
11379
|
-
if (value != null) {
|
|
11380
|
-
cleanParams[key] = value;
|
|
11381
|
-
}
|
|
11382
|
-
}
|
|
11948
|
+
cleanParams = this.buildRouteParams(routeConfig);
|
|
11383
11949
|
return _context11.a(2, this.fetchFromUrl(this.routeBaseUrl + "v2/route", cleanParams, options));
|
|
11384
11950
|
}
|
|
11385
11951
|
}, _callee11, this);
|
|
@@ -11408,11 +11974,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11408
11974
|
options = {
|
|
11409
11975
|
method: "GET",
|
|
11410
11976
|
headers: {
|
|
11411
|
-
"content-type": "application/json"
|
|
11977
|
+
"content-type": "application/json",
|
|
11978
|
+
Authorization: "Bearer ".concat(token)
|
|
11412
11979
|
}
|
|
11413
11980
|
};
|
|
11414
11981
|
params = {
|
|
11415
|
-
token: token,
|
|
11416
11982
|
lang: this.lang
|
|
11417
11983
|
};
|
|
11418
11984
|
return _context12.a(2, this.fetchFromUrl(this.baseUrl + "institution", params, options));
|
|
@@ -11448,14 +12014,14 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11448
12014
|
options = {
|
|
11449
12015
|
method: "GET",
|
|
11450
12016
|
headers: {
|
|
11451
|
-
"content-type": "application/json"
|
|
12017
|
+
"content-type": "application/json",
|
|
12018
|
+
Authorization: "Bearer ".concat(token)
|
|
11452
12019
|
}
|
|
11453
12020
|
};
|
|
11454
12021
|
params = {
|
|
11455
12022
|
institution_id: institutionId,
|
|
11456
12023
|
input: input,
|
|
11457
|
-
lang: this.lang
|
|
11458
|
-
token: token
|
|
12024
|
+
lang: this.lang
|
|
11459
12025
|
};
|
|
11460
12026
|
if (parentIds) {
|
|
11461
12027
|
params.parentPlaces = requester_toConsumableArray(parentIds);
|
|
@@ -11508,7 +12074,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11508
12074
|
return requester_regenerator().w(function (_context14) {
|
|
11509
12075
|
while (1) switch (_context14.n) {
|
|
11510
12076
|
case 0:
|
|
11511
|
-
// The v2
|
|
12077
|
+
// The v2 endpoints authenticate via the Authorization header (Bearer),
|
|
11512
12078
|
// not via a `token` query parameter like the legacy /api/sdk/* routes.
|
|
11513
12079
|
options = {
|
|
11514
12080
|
method: "GET",
|
|
@@ -11540,7 +12106,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11540
12106
|
if (floor) {
|
|
11541
12107
|
params.floor = floor;
|
|
11542
12108
|
}
|
|
11543
|
-
return _context14.a(2, this.fetchFromUrl(this.
|
|
12109
|
+
return _context14.a(2, this.fetchFromUrl(this.baseUrl + "searchPlacesByTags", params, options));
|
|
11544
12110
|
}
|
|
11545
12111
|
}, _callee14, this);
|
|
11546
12112
|
}));
|
|
@@ -11560,16 +12126,16 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11560
12126
|
options = {
|
|
11561
12127
|
method: "GET",
|
|
11562
12128
|
headers: {
|
|
11563
|
-
"content-type": "application/json"
|
|
12129
|
+
"content-type": "application/json",
|
|
12130
|
+
Authorization: "Bearer ".concat(token)
|
|
11564
12131
|
}
|
|
11565
12132
|
};
|
|
11566
12133
|
params = {
|
|
11567
|
-
token: token,
|
|
11568
12134
|
lang: this.lang
|
|
11569
12135
|
};
|
|
11570
12136
|
if (place_id) params.place_id = place_id;
|
|
11571
12137
|
if (product) params.product = product;
|
|
11572
|
-
return _context15.a(2, this.fetchFromUrl(this.
|
|
12138
|
+
return _context15.a(2, this.fetchFromUrl(this.baseUrl + "configuration", params, options));
|
|
11573
12139
|
}
|
|
11574
12140
|
}, _callee15, this);
|
|
11575
12141
|
}));
|
|
@@ -11589,15 +12155,15 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11589
12155
|
options = {
|
|
11590
12156
|
method: "GET",
|
|
11591
12157
|
headers: {
|
|
11592
|
-
"content-type": "application/json"
|
|
12158
|
+
"content-type": "application/json",
|
|
12159
|
+
Authorization: "Bearer ".concat(token)
|
|
11593
12160
|
}
|
|
11594
12161
|
};
|
|
11595
12162
|
params = {
|
|
11596
|
-
token: token,
|
|
11597
12163
|
lang: this.lang
|
|
11598
12164
|
};
|
|
11599
12165
|
if (place_id) params.id = place_id;
|
|
11600
|
-
return _context16.a(2, this.fetchFromUrl(this.
|
|
12166
|
+
return _context16.a(2, this.fetchFromUrl(this.baseUrl + "category", params, options));
|
|
11601
12167
|
}
|
|
11602
12168
|
}, _callee16, this);
|
|
11603
12169
|
}));
|
|
@@ -11617,11 +12183,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11617
12183
|
options = {
|
|
11618
12184
|
method: "GET",
|
|
11619
12185
|
headers: {
|
|
11620
|
-
"content-type": "application/json"
|
|
12186
|
+
"content-type": "application/json",
|
|
12187
|
+
Authorization: "Bearer ".concat(token)
|
|
11621
12188
|
}
|
|
11622
12189
|
};
|
|
11623
12190
|
params = {
|
|
11624
|
-
token: token,
|
|
11625
12191
|
placeId: parentPlaceId,
|
|
11626
12192
|
fromPlace: fromPlaceId,
|
|
11627
12193
|
announceFormat: announceFormat,
|
|
@@ -11649,11 +12215,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11649
12215
|
options = {
|
|
11650
12216
|
method: "GET",
|
|
11651
12217
|
headers: {
|
|
11652
|
-
"content-type": "application/json"
|
|
12218
|
+
"content-type": "application/json",
|
|
12219
|
+
Authorization: "Bearer ".concat(token)
|
|
11653
12220
|
}
|
|
11654
12221
|
};
|
|
11655
12222
|
params = {
|
|
11656
|
-
token: token,
|
|
11657
12223
|
placeId: placeId
|
|
11658
12224
|
};
|
|
11659
12225
|
return _context18.a(2, this.fetchFromUrl(this.routeBaseUrl + "cache_timestamp", params, options));
|
|
@@ -11676,14 +12242,14 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11676
12242
|
options = {
|
|
11677
12243
|
method: "GET",
|
|
11678
12244
|
headers: {
|
|
11679
|
-
"content-type": "application/json"
|
|
12245
|
+
"content-type": "application/json",
|
|
12246
|
+
Authorization: "Bearer ".concat(token)
|
|
11680
12247
|
}
|
|
11681
12248
|
};
|
|
11682
12249
|
params = {
|
|
11683
|
-
token: token,
|
|
11684
12250
|
type: type
|
|
11685
12251
|
};
|
|
11686
|
-
return _context19.a(2, this.fetchFromUrl(this.
|
|
12252
|
+
return _context19.a(2, this.fetchFromUrl(this.baseUrl + "styles/customStyles", params, options));
|
|
11687
12253
|
}
|
|
11688
12254
|
}, _callee19, this);
|
|
11689
12255
|
}));
|
|
@@ -11706,14 +12272,13 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11706
12272
|
totemId: totemId,
|
|
11707
12273
|
status: status
|
|
11708
12274
|
});
|
|
11709
|
-
params = {
|
|
11710
|
-
token: token
|
|
11711
|
-
};
|
|
12275
|
+
params = {};
|
|
11712
12276
|
options = {
|
|
11713
12277
|
method: "POST",
|
|
11714
12278
|
headers: {
|
|
11715
12279
|
accept: "application/json",
|
|
11716
|
-
"Content-Type": "application/json"
|
|
12280
|
+
"Content-Type": "application/json",
|
|
12281
|
+
Authorization: "Bearer ".concat(token)
|
|
11717
12282
|
},
|
|
11718
12283
|
body: requestData
|
|
11719
12284
|
};
|
|
@@ -11793,7 +12358,6 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
11793
12358
|
_this.token = token;
|
|
11794
12359
|
_this.currentLang = lang;
|
|
11795
12360
|
_this.requester = new Requester(lang, apiUrl, mapvxRequestContext);
|
|
11796
|
-
_this.lang = lang;
|
|
11797
12361
|
_this.cache = cache !== null && cache !== void 0 ? cache : new CacheManager();
|
|
11798
12362
|
return _this;
|
|
11799
12363
|
}
|
|
@@ -12000,7 +12564,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12000
12564
|
while (1) switch (_context4.p = _context4.n) {
|
|
12001
12565
|
case 0:
|
|
12002
12566
|
_context4.p = 0;
|
|
12003
|
-
cachedPlace = this.cache.getPlace(placeId, this.
|
|
12567
|
+
cachedPlace = this.cache.getPlace(placeId, this.currentLang);
|
|
12004
12568
|
if (!(cachedPlace != null)) {
|
|
12005
12569
|
_context4.n = 1;
|
|
12006
12570
|
break;
|
|
@@ -12029,9 +12593,9 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12029
12593
|
case 5:
|
|
12030
12594
|
responseData = _context4.v;
|
|
12031
12595
|
place = new place_MVXPlace(responseData);
|
|
12032
|
-
this.cache.setPlace(place.mapvxId, place, this.
|
|
12596
|
+
this.cache.setPlace(place.mapvxId, place, this.currentLang);
|
|
12033
12597
|
if (place.clientId != null) {
|
|
12034
|
-
this.cache.setPlace(place.clientId, place, this.
|
|
12598
|
+
this.cache.setPlace(place.clientId, place, this.currentLang);
|
|
12035
12599
|
}
|
|
12036
12600
|
this.logEvent("fetchAndParsePlaceDetail", {
|
|
12037
12601
|
cached: "false"
|
|
@@ -12060,7 +12624,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12060
12624
|
while (1) switch (_context5.p = _context5.n) {
|
|
12061
12625
|
case 0:
|
|
12062
12626
|
_context5.p = 0;
|
|
12063
|
-
cachedPlace = this.cache.getPlace(placeId, this.
|
|
12627
|
+
cachedPlace = this.cache.getPlace(placeId, this.currentLang);
|
|
12064
12628
|
if (!(cachedPlace != null)) {
|
|
12065
12629
|
_context5.n = 1;
|
|
12066
12630
|
break;
|
|
@@ -12089,9 +12653,9 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12089
12653
|
case 5:
|
|
12090
12654
|
responseData = _context5.v;
|
|
12091
12655
|
place = new place_MVXPlace(responseData);
|
|
12092
|
-
this.cache.setPlace(place.mapvxId, place, this.
|
|
12656
|
+
this.cache.setPlace(place.mapvxId, place, this.currentLang);
|
|
12093
12657
|
if (place.clientId != null) {
|
|
12094
|
-
this.cache.setPlace(place.clientId, place, this.
|
|
12658
|
+
this.cache.setPlace(place.clientId, place, this.currentLang);
|
|
12095
12659
|
}
|
|
12096
12660
|
this.logEvent("fetchAndParseAnyPlaceDetail", {
|
|
12097
12661
|
cached: "false"
|
|
@@ -12216,11 +12780,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12216
12780
|
});
|
|
12217
12781
|
this.logEvent("fetchAndParseAnySubPlaces");
|
|
12218
12782
|
subPlaces.forEach(function (place) {
|
|
12219
|
-
if (!_this3.cache.hasPlace(place.mapvxId, _this3.
|
|
12220
|
-
_this3.cache.setPlace(place.mapvxId, place, _this3.
|
|
12783
|
+
if (!_this3.cache.hasPlace(place.mapvxId, _this3.currentLang)) {
|
|
12784
|
+
_this3.cache.setPlace(place.mapvxId, place, _this3.currentLang);
|
|
12221
12785
|
}
|
|
12222
|
-
if (place.clientId != null && !_this3.cache.hasPlace(place.clientId, _this3.
|
|
12223
|
-
_this3.cache.setPlace(place.clientId, place, _this3.
|
|
12786
|
+
if (place.clientId != null && !_this3.cache.hasPlace(place.clientId, _this3.currentLang)) {
|
|
12787
|
+
_this3.cache.setPlace(place.clientId, place, _this3.currentLang);
|
|
12224
12788
|
}
|
|
12225
12789
|
});
|
|
12226
12790
|
return _context7.a(2, subPlaces);
|
|
@@ -12271,11 +12835,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12271
12835
|
});
|
|
12272
12836
|
this.logEvent("fetchAndParseAvailablePlaces");
|
|
12273
12837
|
data.forEach(function (place) {
|
|
12274
|
-
if (!_this4.cache.hasPlace(place.mapvxId, _this4.
|
|
12275
|
-
_this4.cache.setPlace(place.mapvxId, place, _this4.
|
|
12838
|
+
if (!_this4.cache.hasPlace(place.mapvxId, _this4.currentLang)) {
|
|
12839
|
+
_this4.cache.setPlace(place.mapvxId, place, _this4.currentLang);
|
|
12276
12840
|
}
|
|
12277
|
-
if (place.clientId != null && !_this4.cache.hasPlace(place.clientId, _this4.
|
|
12278
|
-
_this4.cache.setPlace(place.clientId, place, _this4.
|
|
12841
|
+
if (place.clientId != null && !_this4.cache.hasPlace(place.clientId, _this4.currentLang)) {
|
|
12842
|
+
_this4.cache.setPlace(place.clientId, place, _this4.currentLang);
|
|
12279
12843
|
}
|
|
12280
12844
|
});
|
|
12281
12845
|
return _context8.a(2, data);
|
|
@@ -12329,11 +12893,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12329
12893
|
});
|
|
12330
12894
|
this.logEvent("fetchAndParsePlacesFromInstitution");
|
|
12331
12895
|
data.forEach(function (place) {
|
|
12332
|
-
if (!_this5.cache.hasPlace(place.mapvxId, _this5.
|
|
12333
|
-
_this5.cache.setPlace(place.mapvxId, place, _this5.
|
|
12896
|
+
if (!_this5.cache.hasPlace(place.mapvxId, _this5.currentLang)) {
|
|
12897
|
+
_this5.cache.setPlace(place.mapvxId, place, _this5.currentLang);
|
|
12334
12898
|
}
|
|
12335
|
-
if (place.clientId != null && !_this5.cache.hasPlace(place.clientId, _this5.
|
|
12336
|
-
_this5.cache.setPlace(place.clientId, place, _this5.
|
|
12899
|
+
if (place.clientId != null && !_this5.cache.hasPlace(place.clientId, _this5.currentLang)) {
|
|
12900
|
+
_this5.cache.setPlace(place.clientId, place, _this5.currentLang);
|
|
12337
12901
|
}
|
|
12338
12902
|
});
|
|
12339
12903
|
return _context9.a(2, data);
|
|
@@ -12360,7 +12924,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12360
12924
|
var _this6 = this;
|
|
12361
12925
|
var places = [];
|
|
12362
12926
|
ids.forEach(function (id) {
|
|
12363
|
-
var place = _this6.cache.getPlace(id, _this6.
|
|
12927
|
+
var place = _this6.cache.getPlace(id, _this6.currentLang);
|
|
12364
12928
|
if (place != null) {
|
|
12365
12929
|
places.push(place);
|
|
12366
12930
|
}
|
|
@@ -12509,8 +13073,8 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12509
13073
|
while (1) switch (_context10.p = _context10.n) {
|
|
12510
13074
|
case 0:
|
|
12511
13075
|
_context10.p = 0;
|
|
12512
|
-
cachedResponse = this.cache.getVehicle(stopId, this.
|
|
12513
|
-
if (!(cachedResponse != null && (Date.now() - cachedResponse.timestamp < 60 *
|
|
13076
|
+
cachedResponse = this.cache.getVehicle(stopId, this.currentLang);
|
|
13077
|
+
if (!(cachedResponse != null && (Date.now() - cachedResponse.timestamp < 60 * 1000 || cachedResponse.data.routes.length === 0))) {
|
|
12514
13078
|
_context10.n = 1;
|
|
12515
13079
|
break;
|
|
12516
13080
|
}
|
|
@@ -12561,7 +13125,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12561
13125
|
this.cache.setVehicle(stopId, {
|
|
12562
13126
|
timestamp: Date.now(),
|
|
12563
13127
|
data: transport
|
|
12564
|
-
}, this.
|
|
13128
|
+
}, this.currentLang);
|
|
12565
13129
|
this.logEvent("fetchAndParseTransport", {
|
|
12566
13130
|
cached: "false"
|
|
12567
13131
|
});
|
|
@@ -12569,7 +13133,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12569
13133
|
case 8:
|
|
12570
13134
|
_context10.p = 8;
|
|
12571
13135
|
_t10 = _context10.v;
|
|
12572
|
-
_cachedResponse = this.cache.getVehicle(stopId, this.
|
|
13136
|
+
_cachedResponse = this.cache.getVehicle(stopId, this.currentLang);
|
|
12573
13137
|
if (!(_cachedResponse != null)) {
|
|
12574
13138
|
_context10.n = 9;
|
|
12575
13139
|
break;
|
|
@@ -12603,7 +13167,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12603
13167
|
while (1) switch (_context11.p = _context11.n) {
|
|
12604
13168
|
case 0:
|
|
12605
13169
|
_context11.p = 0;
|
|
12606
|
-
cachedResponse = this.cache.getStops(stopId + vehicleId, this.
|
|
13170
|
+
cachedResponse = this.cache.getStops(stopId + vehicleId, this.currentLang);
|
|
12607
13171
|
if (!(cachedResponse != null && Date.now() - cachedResponse.timestamp < 60 * 1000)) {
|
|
12608
13172
|
_context11.n = 1;
|
|
12609
13173
|
break;
|
|
@@ -12640,7 +13204,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12640
13204
|
this.cache.setStops(stopId + vehicleId, {
|
|
12641
13205
|
timestamp: Date.now(),
|
|
12642
13206
|
data: data
|
|
12643
|
-
}, this.
|
|
13207
|
+
}, this.currentLang);
|
|
12644
13208
|
this.logEvent("fetchAndParseStops", {
|
|
12645
13209
|
cached: "false"
|
|
12646
13210
|
});
|
|
@@ -13147,17 +13711,69 @@ function extractStepCoordinates(step) {
|
|
|
13147
13711
|
}
|
|
13148
13712
|
return coords;
|
|
13149
13713
|
}
|
|
13714
|
+
;// ./src/map/mapInteractionOptions.ts
|
|
13715
|
+
/**
|
|
13716
|
+
* Subset of MapLibre {@link MapOptions} that can be derived from the interaction
|
|
13717
|
+
* restriction flags on {@link MapConfig}.
|
|
13718
|
+
*
|
|
13719
|
+
* @internal
|
|
13720
|
+
*/
|
|
13721
|
+
|
|
13722
|
+
/**
|
|
13723
|
+
* Translates the interaction/rotation flags from {@link MapConfig} into the
|
|
13724
|
+
* matching MapLibre constructor options.
|
|
13725
|
+
*
|
|
13726
|
+
* Only keys that were explicitly provided are returned, so MapLibre's defaults
|
|
13727
|
+
* (every interaction enabled) are preserved for any flag left `undefined`. This
|
|
13728
|
+
* deliberately avoids writing `undefined` into the options object, which would
|
|
13729
|
+
* otherwise override MapLibre defaults with `NaN`/`undefined`.
|
|
13730
|
+
*
|
|
13731
|
+
* `rotateEnabled: false` disables drag- and pitch-rotation up front. Touch
|
|
13732
|
+
* rotation cannot be turned off via the constructor without also killing
|
|
13733
|
+
* pinch-to-zoom, so it is handled separately after construction — see
|
|
13734
|
+
* {@link shouldDisableTouchRotation}.
|
|
13735
|
+
*
|
|
13736
|
+
* @internal
|
|
13737
|
+
*/
|
|
13738
|
+
function buildInteractionOptions(mapConfig) {
|
|
13739
|
+
var options = {};
|
|
13740
|
+
if (mapConfig.bearing !== undefined) options.bearing = mapConfig.bearing;
|
|
13741
|
+
if (mapConfig.interactive !== undefined) options.interactive = mapConfig.interactive;
|
|
13742
|
+
if (mapConfig.dragPan !== undefined) options.dragPan = mapConfig.dragPan;
|
|
13743
|
+
if (mapConfig.scrollZoom !== undefined) options.scrollZoom = mapConfig.scrollZoom;
|
|
13744
|
+
if (mapConfig.doubleClickZoom !== undefined) options.doubleClickZoom = mapConfig.doubleClickZoom;
|
|
13745
|
+
if (mapConfig.touchZoomRotate !== undefined) options.touchZoomRotate = mapConfig.touchZoomRotate;
|
|
13746
|
+
if (mapConfig.keyboard !== undefined) options.keyboard = mapConfig.keyboard;
|
|
13747
|
+
if (mapConfig.rotateEnabled === false) {
|
|
13748
|
+
options.dragRotate = false;
|
|
13749
|
+
options.pitchWithRotate = false;
|
|
13750
|
+
}
|
|
13751
|
+
return options;
|
|
13752
|
+
}
|
|
13753
|
+
|
|
13754
|
+
/**
|
|
13755
|
+
* Whether two-finger touch rotation must be disabled after the map is created.
|
|
13756
|
+
*
|
|
13757
|
+
* `rotateEnabled: false` should keep pinch-to-zoom working, so the touch
|
|
13758
|
+
* rotation is disabled via `map.touchZoomRotate.disableRotation()` once the map
|
|
13759
|
+
* instance exists rather than through the constructor.
|
|
13760
|
+
*
|
|
13761
|
+
* @internal
|
|
13762
|
+
*/
|
|
13763
|
+
function shouldDisableTouchRotation(mapConfig) {
|
|
13764
|
+
return mapConfig.rotateEnabled === false;
|
|
13765
|
+
}
|
|
13150
13766
|
;// ./src/map/map.ts
|
|
13151
13767
|
function map_typeof(o) { "@babel/helpers - typeof"; return map_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, map_typeof(o); }
|
|
13152
13768
|
function map_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return map_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (map_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, map_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, map_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), map_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", map_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), map_regeneratorDefine2(u), map_regeneratorDefine2(u, o, "Generator"), map_regeneratorDefine2(u, n, function () { return this; }), map_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (map_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
13153
13769
|
function map_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } map_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { map_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, map_regeneratorDefine2(e, r, n, t); }
|
|
13154
13770
|
function map_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
13155
13771
|
function map_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { map_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { map_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
13156
|
-
function map_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = map_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13157
13772
|
function map_slicedToArray(r, e) { return map_arrayWithHoles(r) || map_iterableToArrayLimit(r, e) || map_unsupportedIterableToArray(r, e) || map_nonIterableRest(); }
|
|
13158
13773
|
function map_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13159
13774
|
function map_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13160
13775
|
function map_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13776
|
+
function map_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = map_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13161
13777
|
function map_toConsumableArray(r) { return map_arrayWithoutHoles(r) || map_iterableToArray(r) || map_unsupportedIterableToArray(r) || map_nonIterableSpread(); }
|
|
13162
13778
|
function map_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13163
13779
|
function map_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return map_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? map_arrayLikeToArray(r, a) : void 0; } }
|
|
@@ -13181,6 +13797,38 @@ function map_toPropertyKey(t) { var i = map_toPrimitive(t, "string"); return "sy
|
|
|
13181
13797
|
function map_toPrimitive(t, r) { if ("object" != map_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != map_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13182
13798
|
|
|
13183
13799
|
|
|
13800
|
+
|
|
13801
|
+
/** Shared GeoJSON source holding every circle drawn through the circle API. */
|
|
13802
|
+
var CIRCLE_SOURCE_ID = "mapvx-circles";
|
|
13803
|
+
/** Fill layer rendering the translucent interior of the circles. */
|
|
13804
|
+
var CIRCLE_FILL_LAYER_ID = "mapvx-circles-fill";
|
|
13805
|
+
/** Line layer rendering the circle outlines. */
|
|
13806
|
+
var CIRCLE_LINE_LAYER_ID = "mapvx-circles-line";
|
|
13807
|
+
|
|
13808
|
+
/**
|
|
13809
|
+
* Layer-id suffix per circle render order. The default placement keeps the
|
|
13810
|
+
* unsuffixed ids so existing consumers referencing them keep working.
|
|
13811
|
+
*/
|
|
13812
|
+
var CIRCLE_LAYER_SUFFIXES = {
|
|
13813
|
+
aboveBasemap: "",
|
|
13814
|
+
belowLabels: "-below-labels",
|
|
13815
|
+
top: "-top"
|
|
13816
|
+
};
|
|
13817
|
+
|
|
13818
|
+
/** Fill/line layer ids for one circle render-order bucket. */
|
|
13819
|
+
function circleLayerIdsFor(order) {
|
|
13820
|
+
var suffix = CIRCLE_LAYER_SUFFIXES[order];
|
|
13821
|
+
return {
|
|
13822
|
+
fill: CIRCLE_FILL_LAYER_ID + suffix,
|
|
13823
|
+
line: CIRCLE_LINE_LAYER_ID + suffix
|
|
13824
|
+
};
|
|
13825
|
+
}
|
|
13826
|
+
|
|
13827
|
+
/** True for the layer ids owned by the circle API, regardless of bucket. */
|
|
13828
|
+
function isCircleLayerId(id) {
|
|
13829
|
+
return id.startsWith(CIRCLE_FILL_LAYER_ID) || id.startsWith(CIRCLE_LINE_LAYER_ID);
|
|
13830
|
+
}
|
|
13831
|
+
|
|
13184
13832
|
// Flag to track if cached-tile protocol has been registered
|
|
13185
13833
|
var cachedTileProtocolRegistered = false;
|
|
13186
13834
|
|
|
@@ -13203,23 +13851,40 @@ function deepClone(obj) {
|
|
|
13203
13851
|
/**
|
|
13204
13852
|
* Register a custom protocol for cached tiles that routes requests through the main thread.
|
|
13205
13853
|
* This allows the service worker to intercept and cache tile requests.
|
|
13854
|
+
*
|
|
13855
|
+
* Wraps fetches in a {@link Semaphore} so tile CDN / WAFs are not hit with
|
|
13856
|
+
* unbounded parallel requests (same host as the service worker cache). The
|
|
13857
|
+
* semaphore is created once with the limit from the first map's config; later
|
|
13858
|
+
* calls are no-ops because the protocol can only be registered once globally
|
|
13859
|
+
* on MapLibre.
|
|
13860
|
+
*
|
|
13861
|
+
* @param maxConcurrentFetches - Maximum number of in-flight tile fetches.
|
|
13206
13862
|
*/
|
|
13207
|
-
function registerCachedTileProtocol() {
|
|
13863
|
+
function registerCachedTileProtocol(maxConcurrentFetches) {
|
|
13208
13864
|
if (cachedTileProtocolRegistered) return;
|
|
13865
|
+
var semaphore = new Semaphore(maxConcurrentFetches);
|
|
13209
13866
|
maplibre_gl_default().addProtocol("cached-tile", function (params, abortController) {
|
|
13210
|
-
// Convert cached-tile:// URL back to https://
|
|
13211
13867
|
var url = params.url.replace("cached-tile://", "https://");
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
return
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13868
|
+
|
|
13869
|
+
// Pass the abort signal to acquire() so a request cancelled while still
|
|
13870
|
+
// queued (e.g. during rapid zoom) drops out of the FIFO queue instead of
|
|
13871
|
+
// waiting for a slot just to bail. release() runs only inside this chain,
|
|
13872
|
+
// i.e. only after a slot was actually granted.
|
|
13873
|
+
return semaphore.acquire(abortController.signal).then(function () {
|
|
13874
|
+
return fetch(url, {
|
|
13875
|
+
signal: abortController.signal
|
|
13876
|
+
}).then(function (response) {
|
|
13877
|
+
if (!response.ok) {
|
|
13878
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
13879
|
+
}
|
|
13880
|
+
return response.arrayBuffer();
|
|
13881
|
+
}).then(function (data) {
|
|
13882
|
+
return {
|
|
13883
|
+
data: data
|
|
13884
|
+
};
|
|
13885
|
+
})["finally"](function () {
|
|
13886
|
+
semaphore.release();
|
|
13887
|
+
});
|
|
13223
13888
|
});
|
|
13224
13889
|
});
|
|
13225
13890
|
cachedTileProtocolRegistered = true;
|
|
@@ -13294,6 +13959,8 @@ function convertPaddingToPixels(padding, containerWidth, containerHeight) {
|
|
|
13294
13959
|
|
|
13295
13960
|
|
|
13296
13961
|
|
|
13962
|
+
|
|
13963
|
+
|
|
13297
13964
|
/**
|
|
13298
13965
|
* @group Map
|
|
13299
13966
|
*/
|
|
@@ -13323,6 +13990,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13323
13990
|
map_defineProperty(_this, "currentFloor", "");
|
|
13324
13991
|
map_defineProperty(_this, "baseFilters", {});
|
|
13325
13992
|
map_defineProperty(_this, "markers", []);
|
|
13993
|
+
map_defineProperty(_this, "circles", []);
|
|
13326
13994
|
map_defineProperty(_this, "enableHover", false);
|
|
13327
13995
|
map_defineProperty(_this, "hoveredId", "unselected");
|
|
13328
13996
|
map_defineProperty(_this, "failedTiles", new Set());
|
|
@@ -13338,8 +14006,11 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13338
14006
|
_this.watchPositionID = undefined;
|
|
13339
14007
|
_this.onFloorChange = mapConfig.onFloorChange;
|
|
13340
14008
|
_this.onParentPlaceChange = mapConfig.onParentPlaceChange;
|
|
13341
|
-
|
|
13342
|
-
|
|
14009
|
+
_this.tileCacheConfig = function () {
|
|
14010
|
+
var merged = map_objectSpread(map_objectSpread({}, DEFAULT_TILE_CACHE_CONFIG), mapConfig.tileCache);
|
|
14011
|
+
merged.maxTiles = Math.min(merged.maxTiles, MAPLIBRE_MAX_TILE_CACHE_HARD_CAP);
|
|
14012
|
+
return merged;
|
|
14013
|
+
}();
|
|
13343
14014
|
if (mapConfig.parentPlaceId != null) {
|
|
13344
14015
|
_this.initialPlaceDetailSetUp(mapConfig.parentPlaceId, mapConfig.authToken);
|
|
13345
14016
|
}
|
|
@@ -13449,15 +14120,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13449
14120
|
_this6 = this;
|
|
13450
14121
|
// Determine if service worker caching should be enabled
|
|
13451
14122
|
var useServiceWorkerCaching = this.tileCacheConfig.enabled && this.tileCacheConfig.persistToServiceWorker;
|
|
13452
|
-
|
|
13453
|
-
// Register cached-tile protocol only if service worker caching is enabled
|
|
13454
14123
|
if (useServiceWorkerCaching) {
|
|
13455
|
-
registerCachedTileProtocol();
|
|
14124
|
+
registerCachedTileProtocol(this.tileCacheConfig.maxConcurrentTileFetches);
|
|
13456
14125
|
}
|
|
13457
14126
|
|
|
13458
14127
|
// Transform tile URLs only if service worker caching is enabled
|
|
13459
14128
|
var finalStyle = useServiceWorkerCaching ? this.transformStyleForCaching(style) : style;
|
|
13460
|
-
var mapOptions = {
|
|
14129
|
+
var mapOptions = map_objectSpread({
|
|
13461
14130
|
container: container,
|
|
13462
14131
|
style: finalStyle,
|
|
13463
14132
|
center: mapConfig.center,
|
|
@@ -13466,10 +14135,10 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13466
14135
|
attributionControl: false,
|
|
13467
14136
|
maplibreLogo: false,
|
|
13468
14137
|
bearingSnap: (_mapConfig$bearingSna = mapConfig.bearingSnap) !== null && _mapConfig$bearingSna !== void 0 ? _mapConfig$bearingSna : 0,
|
|
13469
|
-
cancelPendingTileRequestsWhileZooming:
|
|
14138
|
+
cancelPendingTileRequestsWhileZooming: true,
|
|
13470
14139
|
// Use configured maxTiles for MapLibre's memory cache
|
|
13471
14140
|
maxTileCacheSize: this.tileCacheConfig.maxTiles
|
|
13472
|
-
};
|
|
14141
|
+
}, buildInteractionOptions(mapConfig));
|
|
13473
14142
|
if (mapConfig.maxZoom) mapOptions.maxZoom = mapConfig.maxZoom;
|
|
13474
14143
|
if (mapConfig.minZoom) mapOptions.minZoom = mapConfig.minZoom;
|
|
13475
14144
|
if (mapConfig.maxBounds && mapConfig.maxBounds.length > 1) {
|
|
@@ -13477,6 +14146,12 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13477
14146
|
mapOptions.maxBounds = new maplibre_gl.LngLatBounds([boundingBox[0].lng, boundingBox[0].lat], [boundingBox[1].lng, boundingBox[1].lat]);
|
|
13478
14147
|
}
|
|
13479
14148
|
this.map = new maplibre_gl.Map(mapOptions);
|
|
14149
|
+
// When rotation is disabled we still want pinch-to-zoom to work, so the
|
|
14150
|
+
// two-finger rotation is turned off here instead of via the constructor.
|
|
14151
|
+
if (shouldDisableTouchRotation(mapConfig)) {
|
|
14152
|
+
var _this$map$touchZoomRo, _this$map$touchZoomRo2;
|
|
14153
|
+
(_this$map$touchZoomRo = this.map.touchZoomRotate) === null || _this$map$touchZoomRo === void 0 || (_this$map$touchZoomRo2 = _this$map$touchZoomRo.disableRotation) === null || _this$map$touchZoomRo2 === void 0 || _this$map$touchZoomRo2.call(_this$map$touchZoomRo);
|
|
14154
|
+
}
|
|
13480
14155
|
this.map.addControl(new maplibre_gl.NavigationControl({
|
|
13481
14156
|
showCompass: mapConfig.showCompass !== undefined ? mapConfig.showCompass : true,
|
|
13482
14157
|
showZoom: mapConfig.showZoom !== undefined ? mapConfig.showZoom : true
|
|
@@ -13489,6 +14164,11 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13489
14164
|
_this6.onHover();
|
|
13490
14165
|
_this6.subscribeToFailedTiles();
|
|
13491
14166
|
});
|
|
14167
|
+
// Self-healing for circles: a full style reload wipes custom sources and
|
|
14168
|
+
// layers, and not every restyle path goes through whenStyleUpdates.
|
|
14169
|
+
this.map.on("styledata", function () {
|
|
14170
|
+
if (_this6.circles.length > 0) _this6.ensureCircleLayers();
|
|
14171
|
+
});
|
|
13492
14172
|
this.map.on("zoomend", function () {
|
|
13493
14173
|
var _mapConfig$onZoomEnd;
|
|
13494
14174
|
(_mapConfig$onZoomEnd = mapConfig.onZoomEnd) === null || _mapConfig$onZoomEnd === void 0 || _mapConfig$onZoomEnd.call(mapConfig, _this6.getZoomLevel());
|
|
@@ -13586,6 +14266,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13586
14266
|
}, {
|
|
13587
14267
|
key: "destroyMap",
|
|
13588
14268
|
value: function destroyMap() {
|
|
14269
|
+
this.circles = [];
|
|
13589
14270
|
this.map.remove();
|
|
13590
14271
|
this.unsubscribeFromFailedTiles();
|
|
13591
14272
|
}
|
|
@@ -13694,7 +14375,22 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13694
14375
|
}, {
|
|
13695
14376
|
key: "setLang",
|
|
13696
14377
|
value: function setLang(lang) {
|
|
14378
|
+
var _this0 = this;
|
|
13697
14379
|
this.repository.setLang(lang);
|
|
14380
|
+
if (rtlLanguages.includes(lang)) {
|
|
14381
|
+
this.setRTLSupport();
|
|
14382
|
+
}
|
|
14383
|
+
// setLayersForLanguage reads this.map.getStyle()?.layers, which is empty
|
|
14384
|
+
// until the style finishes loading. If setLang is called right after
|
|
14385
|
+
// createMap (before the "load" event), apply it once the style is ready
|
|
14386
|
+
// so the language change is not silently dropped.
|
|
14387
|
+
if (this.map.isStyleLoaded()) {
|
|
14388
|
+
this.setLayersForLanguage(lang);
|
|
14389
|
+
} else {
|
|
14390
|
+
this.map.once("load", function () {
|
|
14391
|
+
return _this0.setLayersForLanguage(lang);
|
|
14392
|
+
});
|
|
14393
|
+
}
|
|
13698
14394
|
}
|
|
13699
14395
|
}, {
|
|
13700
14396
|
key: "setParentPlace",
|
|
@@ -13723,12 +14419,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13723
14419
|
this.setBaseFilters(newStyle);
|
|
13724
14420
|
}
|
|
13725
14421
|
this.routeController.addSourcesAndLayers();
|
|
14422
|
+
this.refreshCircles();
|
|
13726
14423
|
this.filterByFloorKey(this.currentFloor);
|
|
13727
14424
|
}
|
|
13728
14425
|
}, {
|
|
13729
14426
|
key: "addMarker",
|
|
13730
14427
|
value: function addMarker(marker) {
|
|
13731
|
-
var
|
|
14428
|
+
var _this1 = this;
|
|
13732
14429
|
try {
|
|
13733
14430
|
var _this$innerFloors$fin4, _this$innerFloors$fin5;
|
|
13734
14431
|
// Check if a marker with the same ID already exists and remove it
|
|
@@ -13748,7 +14445,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13748
14445
|
}
|
|
13749
14446
|
var markerCreated = new MarkerAttribute(marker);
|
|
13750
14447
|
var isOutdoor = !this.parentPlace || ((_this$innerFloors$fin4 = (_this$innerFloors$fin5 = this.innerFloors.find(function (floor) {
|
|
13751
|
-
return floor.key ===
|
|
14448
|
+
return floor.key === _this1.currentFloor;
|
|
13752
14449
|
})) === null || _this$innerFloors$fin5 === void 0 ? void 0 : _this$innerFloors$fin5.reachableFromGPS) !== null && _this$innerFloors$fin4 !== void 0 ? _this$innerFloors$fin4 : false);
|
|
13753
14450
|
markerCreated.changeFloor(this.currentFloor, this.map, isOutdoor);
|
|
13754
14451
|
this.markers.push(markerCreated);
|
|
@@ -13851,6 +14548,374 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13851
14548
|
throw new Error("Failed to remove all markers");
|
|
13852
14549
|
}
|
|
13853
14550
|
}
|
|
14551
|
+
}, {
|
|
14552
|
+
key: "addCircle",
|
|
14553
|
+
value: function addCircle(circle) {
|
|
14554
|
+
try {
|
|
14555
|
+
// Check if a circle with the same ID already exists and replace it
|
|
14556
|
+
if (circle.id) {
|
|
14557
|
+
this.circles = this.circles.filter(function (c) {
|
|
14558
|
+
return c.id !== circle.id;
|
|
14559
|
+
});
|
|
14560
|
+
}
|
|
14561
|
+
// resolveCircleConfig validates radiusMeters and coordinates
|
|
14562
|
+
var record = resolveCircleConfig(circle);
|
|
14563
|
+
this.circles.push(record);
|
|
14564
|
+
this.refreshCircles();
|
|
14565
|
+
this.logEvent("addCircle");
|
|
14566
|
+
return record.id;
|
|
14567
|
+
} catch (error) {
|
|
14568
|
+
throw new Error("Failed to add circle: ".concat(error instanceof Error ? error.message : String(error)));
|
|
14569
|
+
}
|
|
14570
|
+
}
|
|
14571
|
+
}, {
|
|
14572
|
+
key: "updateCircle",
|
|
14573
|
+
value: function updateCircle(circleConfig) {
|
|
14574
|
+
try {
|
|
14575
|
+
var index = this.circles.findIndex(function (c) {
|
|
14576
|
+
return c.id === circleConfig.id;
|
|
14577
|
+
});
|
|
14578
|
+
if (index === -1) return null;
|
|
14579
|
+
|
|
14580
|
+
// resolveCircleConfig validates radiusMeters and coordinates
|
|
14581
|
+
this.circles[index] = resolveCircleConfig(circleConfig, this.circles[index].hidden);
|
|
14582
|
+
this.refreshCircles();
|
|
14583
|
+
this.logEvent("updateCircle");
|
|
14584
|
+
return this.circles[index].id;
|
|
14585
|
+
} catch (error) {
|
|
14586
|
+
throw new Error("Failed to update circle: ".concat(error instanceof Error ? error.message : String(error)));
|
|
14587
|
+
}
|
|
14588
|
+
}
|
|
14589
|
+
}, {
|
|
14590
|
+
key: "getCircle",
|
|
14591
|
+
value: function getCircle(circleId) {
|
|
14592
|
+
var circle = this.circles.find(function (c) {
|
|
14593
|
+
return c.id === circleId;
|
|
14594
|
+
});
|
|
14595
|
+
return circle ? cloneCircleRecord(circle) : undefined;
|
|
14596
|
+
}
|
|
14597
|
+
}, {
|
|
14598
|
+
key: "getCircles",
|
|
14599
|
+
value: function getCircles() {
|
|
14600
|
+
return this.circles.map(cloneCircleRecord);
|
|
14601
|
+
}
|
|
14602
|
+
}, {
|
|
14603
|
+
key: "hasCircle",
|
|
14604
|
+
value: function hasCircle(circleId) {
|
|
14605
|
+
return this.circles.some(function (c) {
|
|
14606
|
+
return c.id === circleId;
|
|
14607
|
+
});
|
|
14608
|
+
}
|
|
14609
|
+
}, {
|
|
14610
|
+
key: "updateCirclePosition",
|
|
14611
|
+
value: function updateCirclePosition(circleId, center, radiusMeters) {
|
|
14612
|
+
try {
|
|
14613
|
+
var _circle = this.circles.find(function (c) {
|
|
14614
|
+
return c.id === circleId;
|
|
14615
|
+
});
|
|
14616
|
+
if (_circle === undefined) return false;
|
|
14617
|
+
|
|
14618
|
+
// Validate inputs before modifying
|
|
14619
|
+
if (!center) {
|
|
14620
|
+
throw new Error("Circle center is required");
|
|
14621
|
+
}
|
|
14622
|
+
var lat = center.lat,
|
|
14623
|
+
lng = center.lng;
|
|
14624
|
+
if (!Number.isFinite(lat) || lat < -90 || lat > 90) {
|
|
14625
|
+
throw new Error("Invalid latitude: ".concat(lat, ". Must be between -90 and 90."));
|
|
14626
|
+
}
|
|
14627
|
+
if (!Number.isFinite(lng) || lng < -180 || lng > 180) {
|
|
14628
|
+
throw new Error("Invalid longitude: ".concat(lng, ". Must be between -180 and 180."));
|
|
14629
|
+
}
|
|
14630
|
+
if (radiusMeters !== undefined) {
|
|
14631
|
+
if (!Number.isFinite(radiusMeters) || radiusMeters <= 0) {
|
|
14632
|
+
throw new Error("Invalid radiusMeters: ".concat(radiusMeters, ". Must be a positive finite number."));
|
|
14633
|
+
}
|
|
14634
|
+
}
|
|
14635
|
+
_circle.coordinate = {
|
|
14636
|
+
lat: center.lat,
|
|
14637
|
+
lng: center.lng
|
|
14638
|
+
};
|
|
14639
|
+
if (radiusMeters !== undefined) {
|
|
14640
|
+
_circle.radiusMeters = radiusMeters;
|
|
14641
|
+
}
|
|
14642
|
+
this.refreshCircles();
|
|
14643
|
+
this.logEvent("updateCirclePosition");
|
|
14644
|
+
return true;
|
|
14645
|
+
} catch (error) {
|
|
14646
|
+
throw new Error("Failed to update circle position: ".concat(error instanceof Error ? error.message : String(error)));
|
|
14647
|
+
}
|
|
14648
|
+
}
|
|
14649
|
+
}, {
|
|
14650
|
+
key: "updateCircleStyle",
|
|
14651
|
+
value: function updateCircleStyle(circleId, style) {
|
|
14652
|
+
try {
|
|
14653
|
+
var _circle2 = this.circles.find(function (c) {
|
|
14654
|
+
return c.id === circleId;
|
|
14655
|
+
});
|
|
14656
|
+
if (_circle2 === undefined) return false;
|
|
14657
|
+
|
|
14658
|
+
// Update only style properties, clamp opacities
|
|
14659
|
+
if (style.fillColor !== undefined) _circle2.fillColor = style.fillColor;
|
|
14660
|
+
if (style.fillOpacity !== undefined) _circle2.fillOpacity = Math.max(0, Math.min(1, style.fillOpacity));
|
|
14661
|
+
if (style.strokeColor !== undefined) _circle2.strokeColor = style.strokeColor;
|
|
14662
|
+
if (style.strokeWidth !== undefined) _circle2.strokeWidth = style.strokeWidth;
|
|
14663
|
+
if (style.strokeOpacity !== undefined) _circle2.strokeOpacity = Math.max(0, Math.min(1, style.strokeOpacity));
|
|
14664
|
+
this.refreshCircles();
|
|
14665
|
+
this.logEvent("updateCircleStyle");
|
|
14666
|
+
return true;
|
|
14667
|
+
} catch (error) {
|
|
14668
|
+
throw new Error("Failed to update circle style: ".concat(error instanceof Error ? error.message : String(error)));
|
|
14669
|
+
}
|
|
14670
|
+
}
|
|
14671
|
+
}, {
|
|
14672
|
+
key: "removeCircle",
|
|
14673
|
+
value: function removeCircle(circleId) {
|
|
14674
|
+
try {
|
|
14675
|
+
this.circles = this.circles.filter(function (c) {
|
|
14676
|
+
return c.id !== circleId;
|
|
14677
|
+
});
|
|
14678
|
+
this.refreshCircles();
|
|
14679
|
+
this.logEvent("removeCircle");
|
|
14680
|
+
} catch (error) {
|
|
14681
|
+
throw new Error("Failed to remove circle");
|
|
14682
|
+
}
|
|
14683
|
+
}
|
|
14684
|
+
}, {
|
|
14685
|
+
key: "removeAllCircles",
|
|
14686
|
+
value: function removeAllCircles() {
|
|
14687
|
+
try {
|
|
14688
|
+
this.circles = [];
|
|
14689
|
+
this.refreshCircles();
|
|
14690
|
+
this.logEvent("removeAllCircles");
|
|
14691
|
+
} catch (error) {
|
|
14692
|
+
throw new Error("Failed to remove all circles");
|
|
14693
|
+
}
|
|
14694
|
+
}
|
|
14695
|
+
}, {
|
|
14696
|
+
key: "showCircle",
|
|
14697
|
+
value: function showCircle(circleId) {
|
|
14698
|
+
try {
|
|
14699
|
+
var _circle3 = this.circles.find(function (c) {
|
|
14700
|
+
return c.id === circleId;
|
|
14701
|
+
});
|
|
14702
|
+
if (_circle3 === undefined) {
|
|
14703
|
+
return false;
|
|
14704
|
+
}
|
|
14705
|
+
_circle3.hidden = false;
|
|
14706
|
+
this.refreshCircles();
|
|
14707
|
+
this.logEvent("showCircle");
|
|
14708
|
+
return true;
|
|
14709
|
+
} catch (error) {
|
|
14710
|
+
return false;
|
|
14711
|
+
}
|
|
14712
|
+
}
|
|
14713
|
+
}, {
|
|
14714
|
+
key: "hideCircle",
|
|
14715
|
+
value: function hideCircle(circleId) {
|
|
14716
|
+
try {
|
|
14717
|
+
var _circle4 = this.circles.find(function (c) {
|
|
14718
|
+
return c.id === circleId;
|
|
14719
|
+
});
|
|
14720
|
+
if (_circle4 === undefined) {
|
|
14721
|
+
return false;
|
|
14722
|
+
}
|
|
14723
|
+
_circle4.hidden = true;
|
|
14724
|
+
this.refreshCircles();
|
|
14725
|
+
this.logEvent("hideCircle");
|
|
14726
|
+
return true;
|
|
14727
|
+
} catch (error) {
|
|
14728
|
+
return false;
|
|
14729
|
+
}
|
|
14730
|
+
}
|
|
14731
|
+
|
|
14732
|
+
/**
|
|
14733
|
+
* Builds the GeoJSON FeatureCollection for every currently visible circle.
|
|
14734
|
+
* Visibility mirrors marker semantics: a circle with a floor is shown only
|
|
14735
|
+
* while that floor is displayed, and a circle without a floor is shown only
|
|
14736
|
+
* in outdoor contexts. Hidden circles are always omitted.
|
|
14737
|
+
*/
|
|
14738
|
+
}, {
|
|
14739
|
+
key: "circleFeatureCollection",
|
|
14740
|
+
value: function circleFeatureCollection() {
|
|
14741
|
+
var _this$currentFloor3, _this$innerFloors$fin6, _this$innerFloors$fin7;
|
|
14742
|
+
var floorId = (_this$currentFloor3 = this.currentFloor) !== null && _this$currentFloor3 !== void 0 ? _this$currentFloor3 : "";
|
|
14743
|
+
var isOutdoor = !this.parentPlace || ((_this$innerFloors$fin6 = (_this$innerFloors$fin7 = this.innerFloors.find(function (floor) {
|
|
14744
|
+
return floor.key === floorId;
|
|
14745
|
+
})) === null || _this$innerFloors$fin7 === void 0 ? void 0 : _this$innerFloors$fin7.reachableFromGPS) !== null && _this$innerFloors$fin6 !== void 0 ? _this$innerFloors$fin6 : false);
|
|
14746
|
+
var features = this.circles.filter(function (circle) {
|
|
14747
|
+
var _circle$floorId;
|
|
14748
|
+
if (circle.hidden) return false;
|
|
14749
|
+
var circleFloor = (_circle$floorId = circle.floorId) !== null && _circle$floorId !== void 0 ? _circle$floorId : "";
|
|
14750
|
+
return circleFloor === floorId || isOutdoor && circleFloor === "";
|
|
14751
|
+
}).map(function (circle) {
|
|
14752
|
+
return {
|
|
14753
|
+
type: "Feature",
|
|
14754
|
+
properties: {
|
|
14755
|
+
id: circle.id,
|
|
14756
|
+
fillColor: circle.fillColor,
|
|
14757
|
+
fillOpacity: circle.fillOpacity,
|
|
14758
|
+
strokeColor: circle.strokeColor,
|
|
14759
|
+
strokeWidth: circle.strokeWidth,
|
|
14760
|
+
strokeOpacity: circle.strokeOpacity,
|
|
14761
|
+
renderOrder: circle.renderOrder
|
|
14762
|
+
},
|
|
14763
|
+
geometry: {
|
|
14764
|
+
type: "Polygon",
|
|
14765
|
+
coordinates: [circleRing(circle.coordinate.lng, circle.coordinate.lat, circle.radiusMeters)]
|
|
14766
|
+
}
|
|
14767
|
+
};
|
|
14768
|
+
});
|
|
14769
|
+
return {
|
|
14770
|
+
type: "FeatureCollection",
|
|
14771
|
+
features: features
|
|
14772
|
+
};
|
|
14773
|
+
}
|
|
14774
|
+
|
|
14775
|
+
/**
|
|
14776
|
+
* Idempotently adds the shared circle source and its fill/line layers.
|
|
14777
|
+
* Layers are inserted below the first symbol layer so place labels and
|
|
14778
|
+
* markers stay readable above the translucent fill. Safe to call at any
|
|
14779
|
+
* time: a style that is still loading simply rejects the calls, and the
|
|
14780
|
+
* styledata listener retries once the style is ready.
|
|
14781
|
+
*/
|
|
14782
|
+
/**
|
|
14783
|
+
* Resolves the layer id to insert circle layers before, for one render
|
|
14784
|
+
* order. `undefined` means "append on top".
|
|
14785
|
+
*
|
|
14786
|
+
* `aboveBasemap` finds the topmost non-symbol layer of the style and
|
|
14787
|
+
* inserts before the first symbol layer that follows it. On indoor styles
|
|
14788
|
+
* the floor-plate and building polygons are ordered after the first symbol
|
|
14789
|
+
* layer, so anchoring on the topmost geometry layer — instead of the first
|
|
14790
|
+
* symbol layer — guarantees circles are never occluded by basemap fills
|
|
14791
|
+
* while still rendering below the labels that follow them.
|
|
14792
|
+
*/
|
|
14793
|
+
}, {
|
|
14794
|
+
key: "circleBeforeIdFor",
|
|
14795
|
+
value: function circleBeforeIdFor(order) {
|
|
14796
|
+
var _this$map$getStyle$la2, _this$map$getStyle2, _layers$slice$find;
|
|
14797
|
+
if (order === "top") return undefined;
|
|
14798
|
+
var layers = ((_this$map$getStyle$la2 = (_this$map$getStyle2 = this.map.getStyle()) === null || _this$map$getStyle2 === void 0 ? void 0 : _this$map$getStyle2.layers) !== null && _this$map$getStyle$la2 !== void 0 ? _this$map$getStyle$la2 : []).filter(function (layer) {
|
|
14799
|
+
return !isCircleLayerId(layer.id);
|
|
14800
|
+
});
|
|
14801
|
+
if (order === "belowLabels") {
|
|
14802
|
+
var _layers$find;
|
|
14803
|
+
return (_layers$find = layers.find(function (layer) {
|
|
14804
|
+
return layer.type === "symbol";
|
|
14805
|
+
})) === null || _layers$find === void 0 ? void 0 : _layers$find.id;
|
|
14806
|
+
}
|
|
14807
|
+
|
|
14808
|
+
// aboveBasemap
|
|
14809
|
+
var lastNonSymbolIndex = -1;
|
|
14810
|
+
layers.forEach(function (layer, index) {
|
|
14811
|
+
if (layer.type !== "symbol") lastNonSymbolIndex = index;
|
|
14812
|
+
});
|
|
14813
|
+
return (_layers$slice$find = layers.slice(lastNonSymbolIndex + 1).find(function (layer) {
|
|
14814
|
+
return layer.type === "symbol";
|
|
14815
|
+
})) === null || _layers$slice$find === void 0 ? void 0 : _layers$slice$find.id;
|
|
14816
|
+
}
|
|
14817
|
+
|
|
14818
|
+
/**
|
|
14819
|
+
* Idempotently ensures the shared circle source and one fill/line layer
|
|
14820
|
+
* pair per render order in use, at the placement that order requires.
|
|
14821
|
+
* Placement is recomputed and re-asserted (via moveLayer) on every call,
|
|
14822
|
+
* so circles regain their correct z-order after any style reload or
|
|
14823
|
+
* floor/parent-place change. Safe to call at any time: a style that is
|
|
14824
|
+
* still loading simply rejects the calls, and the styledata listener
|
|
14825
|
+
* retries once the style is ready.
|
|
14826
|
+
*/
|
|
14827
|
+
}, {
|
|
14828
|
+
key: "ensureCircleLayers",
|
|
14829
|
+
value: function ensureCircleLayers() {
|
|
14830
|
+
if (!this.map) return;
|
|
14831
|
+
try {
|
|
14832
|
+
if (!this.map.getSource(CIRCLE_SOURCE_ID)) {
|
|
14833
|
+
this.map.addSource(CIRCLE_SOURCE_ID, {
|
|
14834
|
+
type: "geojson",
|
|
14835
|
+
data: this.circleFeatureCollection()
|
|
14836
|
+
});
|
|
14837
|
+
}
|
|
14838
|
+
var ordersInUse = new Set(this.circles.map(function (c) {
|
|
14839
|
+
return c.renderOrder;
|
|
14840
|
+
}));
|
|
14841
|
+
// Always keep the default bucket alive so an empty map still renders
|
|
14842
|
+
// newly added circles without a layer rebuild
|
|
14843
|
+
ordersInUse.add("aboveBasemap");
|
|
14844
|
+
|
|
14845
|
+
// Process buckets lowest-first (CIRCLE_RENDER_ORDERS is canonical):
|
|
14846
|
+
// when two buckets resolve to the same anchor, each addLayer/moveLayer
|
|
14847
|
+
// lands immediately before it, so a bucket processed later paints above
|
|
14848
|
+
// the ones processed earlier. Canonical order keeps
|
|
14849
|
+
// belowLabels < aboveBasemap < top regardless of circle insertion order.
|
|
14850
|
+
var _iterator = map_createForOfIteratorHelper(CIRCLE_RENDER_ORDERS),
|
|
14851
|
+
_step;
|
|
14852
|
+
try {
|
|
14853
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
14854
|
+
var order = _step.value;
|
|
14855
|
+
if (!ordersInUse.has(order)) continue;
|
|
14856
|
+
var ids = circleLayerIdsFor(order);
|
|
14857
|
+
var beforeId = this.circleBeforeIdFor(order);
|
|
14858
|
+
var orderFilter = ["==", ["get", "renderOrder"], order];
|
|
14859
|
+
if (!this.map.getLayer(ids.fill)) {
|
|
14860
|
+
var fillLayer = {
|
|
14861
|
+
id: ids.fill,
|
|
14862
|
+
type: "fill",
|
|
14863
|
+
source: CIRCLE_SOURCE_ID,
|
|
14864
|
+
filter: orderFilter,
|
|
14865
|
+
paint: {
|
|
14866
|
+
"fill-color": ["get", "fillColor"],
|
|
14867
|
+
"fill-opacity": ["get", "fillOpacity"]
|
|
14868
|
+
}
|
|
14869
|
+
};
|
|
14870
|
+
this.map.addLayer(fillLayer, beforeId);
|
|
14871
|
+
} else {
|
|
14872
|
+
this.map.moveLayer(ids.fill, beforeId);
|
|
14873
|
+
}
|
|
14874
|
+
if (!this.map.getLayer(ids.line)) {
|
|
14875
|
+
var lineLayer = {
|
|
14876
|
+
id: ids.line,
|
|
14877
|
+
type: "line",
|
|
14878
|
+
source: CIRCLE_SOURCE_ID,
|
|
14879
|
+
filter: orderFilter,
|
|
14880
|
+
paint: {
|
|
14881
|
+
"line-color": ["get", "strokeColor"],
|
|
14882
|
+
"line-width": ["get", "strokeWidth"],
|
|
14883
|
+
"line-opacity": ["get", "strokeOpacity"]
|
|
14884
|
+
}
|
|
14885
|
+
};
|
|
14886
|
+
this.map.addLayer(lineLayer, beforeId);
|
|
14887
|
+
} else {
|
|
14888
|
+
this.map.moveLayer(ids.line, beforeId);
|
|
14889
|
+
}
|
|
14890
|
+
}
|
|
14891
|
+
} catch (err) {
|
|
14892
|
+
_iterator.e(err);
|
|
14893
|
+
} finally {
|
|
14894
|
+
_iterator.f();
|
|
14895
|
+
}
|
|
14896
|
+
} catch (error) {
|
|
14897
|
+
// Style may not be loaded yet; the styledata listener re-adds the layers
|
|
14898
|
+
}
|
|
14899
|
+
}
|
|
14900
|
+
|
|
14901
|
+
/**
|
|
14902
|
+
* Re-renders all circles: ensures the source and layers exist, then pushes
|
|
14903
|
+
* the current FeatureCollection. Called after every mutation of the circle
|
|
14904
|
+
* list, on floor changes, and when the map style reloads.
|
|
14905
|
+
*/
|
|
14906
|
+
}, {
|
|
14907
|
+
key: "refreshCircles",
|
|
14908
|
+
value: function refreshCircles() {
|
|
14909
|
+
if (!this.map) return;
|
|
14910
|
+
if (this.circles.length === 0 && !this.map.getSource(CIRCLE_SOURCE_ID)) return;
|
|
14911
|
+
this.ensureCircleLayers();
|
|
14912
|
+
try {
|
|
14913
|
+
var source = this.map.getSource(CIRCLE_SOURCE_ID);
|
|
14914
|
+
source === null || source === void 0 || source.setData(this.circleFeatureCollection());
|
|
14915
|
+
} catch (error) {
|
|
14916
|
+
// Source may not exist while a new style is loading
|
|
14917
|
+
}
|
|
14918
|
+
}
|
|
13854
14919
|
|
|
13855
14920
|
/**
|
|
13856
14921
|
* Use it to change the current layer
|
|
@@ -13870,6 +14935,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13870
14935
|
}
|
|
13871
14936
|
this.updateFiltersTo(floorKeyString);
|
|
13872
14937
|
this.updateMarkersTo(floorKeyString);
|
|
14938
|
+
this.refreshCircles();
|
|
13873
14939
|
this.routeController.updateRouteLayers(floorKeyString);
|
|
13874
14940
|
this.routeController.updateRouteMarkerVisibility(floorKeyString);
|
|
13875
14941
|
}
|
|
@@ -13881,33 +14947,33 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13881
14947
|
}, {
|
|
13882
14948
|
key: "updateMarkersTo",
|
|
13883
14949
|
value: function updateMarkersTo(floorId) {
|
|
13884
|
-
var _this$innerFloors$
|
|
13885
|
-
_this$innerFloors$
|
|
13886
|
-
|
|
13887
|
-
var isOutdoor = !this.parentPlace || ((_this$innerFloors$
|
|
14950
|
+
var _this$innerFloors$fin8,
|
|
14951
|
+
_this$innerFloors$fin9,
|
|
14952
|
+
_this10 = this;
|
|
14953
|
+
var isOutdoor = !this.parentPlace || ((_this$innerFloors$fin8 = (_this$innerFloors$fin9 = this.innerFloors.find(function (floor) {
|
|
13888
14954
|
return floor.key === floorId;
|
|
13889
|
-
})) === null || _this$innerFloors$
|
|
14955
|
+
})) === null || _this$innerFloors$fin9 === void 0 ? void 0 : _this$innerFloors$fin9.reachableFromGPS) !== null && _this$innerFloors$fin8 !== void 0 ? _this$innerFloors$fin8 : false);
|
|
13890
14956
|
this.markers.forEach(function (e) {
|
|
13891
|
-
e.changeFloor(floorId,
|
|
14957
|
+
e.changeFloor(floorId, _this10.map, isOutdoor);
|
|
13892
14958
|
});
|
|
13893
14959
|
}
|
|
13894
14960
|
}, {
|
|
13895
14961
|
key: "updateFiltersTo",
|
|
13896
14962
|
value: function updateFiltersTo(floorId) {
|
|
13897
|
-
var _this$map$getStyle$
|
|
13898
|
-
_this$map$
|
|
13899
|
-
|
|
13900
|
-
_this$innerFloors$
|
|
14963
|
+
var _this$map$getStyle$la3,
|
|
14964
|
+
_this$map$getStyle3,
|
|
14965
|
+
_this11 = this,
|
|
14966
|
+
_this$innerFloors$fin0;
|
|
13901
14967
|
if (!this.map) return;
|
|
13902
|
-
var layers = (_this$map$getStyle$
|
|
14968
|
+
var layers = (_this$map$getStyle$la3 = (_this$map$getStyle3 = this.map.getStyle()) === null || _this$map$getStyle3 === void 0 ? void 0 : _this$map$getStyle3.layers) !== null && _this$map$getStyle$la3 !== void 0 ? _this$map$getStyle$la3 : [];
|
|
13903
14969
|
layers.filter(function (l) {
|
|
13904
14970
|
return l.id.startsWith("base-indoor-");
|
|
13905
14971
|
}).forEach(function (l) {
|
|
13906
|
-
|
|
14972
|
+
_this11.map.removeLayer(l.id);
|
|
13907
14973
|
});
|
|
13908
|
-
var baseFloorId = (_this$innerFloors$
|
|
14974
|
+
var baseFloorId = (_this$innerFloors$fin0 = this.innerFloors.find(function (floor) {
|
|
13909
14975
|
return floor.key === floorId;
|
|
13910
|
-
})) === null || _this$innerFloors$
|
|
14976
|
+
})) === null || _this$innerFloors$fin0 === void 0 ? void 0 : _this$innerFloors$fin0.baseFloor;
|
|
13911
14977
|
var indoorLayers = layers.filter(function (layer) {
|
|
13912
14978
|
return layer.id.startsWith("indoor-");
|
|
13913
14979
|
});
|
|
@@ -13919,13 +14985,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13919
14985
|
}).forEach(function (layer) {
|
|
13920
14986
|
var baseLayer = deepClone(layer);
|
|
13921
14987
|
baseLayer.id = "base-" + layer.id;
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
14988
|
+
_this11.baseFilters[baseLayer.id] = _this11.baseFilters[layer.id];
|
|
14989
|
+
_this11.map.addLayer(baseLayer, firstLayerId);
|
|
14990
|
+
_this11.applyLayerFilters(baseLayer, baseFloorId);
|
|
13925
14991
|
});
|
|
13926
14992
|
}
|
|
13927
14993
|
indoorLayers.forEach(function (layer) {
|
|
13928
|
-
|
|
14994
|
+
_this11.applyLayerFilters(layer, floorId);
|
|
13929
14995
|
});
|
|
13930
14996
|
}
|
|
13931
14997
|
}, {
|
|
@@ -13985,6 +15051,57 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13985
15051
|
this.map.setMinZoom(zoomLvl);
|
|
13986
15052
|
options === null || options === void 0 || (_options$onComplete3 = options.onComplete) === null || _options$onComplete3 === void 0 || _options$onComplete3.call(options);
|
|
13987
15053
|
}
|
|
15054
|
+
}, {
|
|
15055
|
+
key: "setBearing",
|
|
15056
|
+
value: function setBearing(degrees, options) {
|
|
15057
|
+
var _options$onComplete4;
|
|
15058
|
+
if (!Number.isFinite(degrees)) return;
|
|
15059
|
+
if (options !== null && options !== void 0 && options.animate) {
|
|
15060
|
+
if (options.onComplete) void this.map.once("moveend", options.onComplete);
|
|
15061
|
+
this.map.rotateTo(degrees, {
|
|
15062
|
+
duration: 600
|
|
15063
|
+
});
|
|
15064
|
+
return;
|
|
15065
|
+
}
|
|
15066
|
+
this.map.setBearing(degrees);
|
|
15067
|
+
options === null || options === void 0 || (_options$onComplete4 = options.onComplete) === null || _options$onComplete4 === void 0 || _options$onComplete4.call(options);
|
|
15068
|
+
}
|
|
15069
|
+
}, {
|
|
15070
|
+
key: "setRotationEnabled",
|
|
15071
|
+
value: function setRotationEnabled(enabled) {
|
|
15072
|
+
if (enabled) {
|
|
15073
|
+
var _this$map$dragRotate, _this$map$dragRotate$, _this$map$touchZoomRo3, _this$map$touchZoomRo4, _this$map$keyboard, _this$map$keyboard$en;
|
|
15074
|
+
(_this$map$dragRotate = this.map.dragRotate) === null || _this$map$dragRotate === void 0 || (_this$map$dragRotate$ = _this$map$dragRotate.enable) === null || _this$map$dragRotate$ === void 0 || _this$map$dragRotate$.call(_this$map$dragRotate);
|
|
15075
|
+
(_this$map$touchZoomRo3 = this.map.touchZoomRotate) === null || _this$map$touchZoomRo3 === void 0 || (_this$map$touchZoomRo4 = _this$map$touchZoomRo3.enableRotation) === null || _this$map$touchZoomRo4 === void 0 || _this$map$touchZoomRo4.call(_this$map$touchZoomRo3);
|
|
15076
|
+
(_this$map$keyboard = this.map.keyboard) === null || _this$map$keyboard === void 0 || (_this$map$keyboard$en = _this$map$keyboard.enable) === null || _this$map$keyboard$en === void 0 || _this$map$keyboard$en.call(_this$map$keyboard);
|
|
15077
|
+
} else {
|
|
15078
|
+
var _this$map$dragRotate2, _this$map$dragRotate3, _this$map$touchZoomRo5, _this$map$touchZoomRo6;
|
|
15079
|
+
(_this$map$dragRotate2 = this.map.dragRotate) === null || _this$map$dragRotate2 === void 0 || (_this$map$dragRotate3 = _this$map$dragRotate2.disable) === null || _this$map$dragRotate3 === void 0 || _this$map$dragRotate3.call(_this$map$dragRotate2);
|
|
15080
|
+
(_this$map$touchZoomRo5 = this.map.touchZoomRotate) === null || _this$map$touchZoomRo5 === void 0 || (_this$map$touchZoomRo6 = _this$map$touchZoomRo5.disableRotation) === null || _this$map$touchZoomRo6 === void 0 || _this$map$touchZoomRo6.call(_this$map$touchZoomRo5);
|
|
15081
|
+
}
|
|
15082
|
+
}
|
|
15083
|
+
}, {
|
|
15084
|
+
key: "setPanEnabled",
|
|
15085
|
+
value: function setPanEnabled(enabled) {
|
|
15086
|
+
if (enabled) {
|
|
15087
|
+
var _this$map$dragPan, _this$map$dragPan$ena;
|
|
15088
|
+
(_this$map$dragPan = this.map.dragPan) === null || _this$map$dragPan === void 0 || (_this$map$dragPan$ena = _this$map$dragPan.enable) === null || _this$map$dragPan$ena === void 0 || _this$map$dragPan$ena.call(_this$map$dragPan);
|
|
15089
|
+
} else {
|
|
15090
|
+
var _this$map$dragPan2, _this$map$dragPan2$di;
|
|
15091
|
+
(_this$map$dragPan2 = this.map.dragPan) === null || _this$map$dragPan2 === void 0 || (_this$map$dragPan2$di = _this$map$dragPan2.disable) === null || _this$map$dragPan2$di === void 0 || _this$map$dragPan2$di.call(_this$map$dragPan2);
|
|
15092
|
+
}
|
|
15093
|
+
}
|
|
15094
|
+
}, {
|
|
15095
|
+
key: "setScrollZoomEnabled",
|
|
15096
|
+
value: function setScrollZoomEnabled(enabled) {
|
|
15097
|
+
if (enabled) {
|
|
15098
|
+
var _this$map$scrollZoom, _this$map$scrollZoom$;
|
|
15099
|
+
(_this$map$scrollZoom = this.map.scrollZoom) === null || _this$map$scrollZoom === void 0 || (_this$map$scrollZoom$ = _this$map$scrollZoom.enable) === null || _this$map$scrollZoom$ === void 0 || _this$map$scrollZoom$.call(_this$map$scrollZoom);
|
|
15100
|
+
} else {
|
|
15101
|
+
var _this$map$scrollZoom2, _this$map$scrollZoom3;
|
|
15102
|
+
(_this$map$scrollZoom2 = this.map.scrollZoom) === null || _this$map$scrollZoom2 === void 0 || (_this$map$scrollZoom3 = _this$map$scrollZoom2.disable) === null || _this$map$scrollZoom3 === void 0 || _this$map$scrollZoom3.call(_this$map$scrollZoom2);
|
|
15103
|
+
}
|
|
15104
|
+
}
|
|
13988
15105
|
}, {
|
|
13989
15106
|
key: "isInsideBounds",
|
|
13990
15107
|
value: function isInsideBounds(point) {
|
|
@@ -13997,12 +15114,12 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13997
15114
|
}, {
|
|
13998
15115
|
key: "setMaxBounds",
|
|
13999
15116
|
value: function setMaxBounds(coordinates, options) {
|
|
14000
|
-
var _options$
|
|
15117
|
+
var _options$onComplete5;
|
|
14001
15118
|
if (coordinates.length > 1) {
|
|
14002
15119
|
var boundingBox = getBoundingBox(coordinates);
|
|
14003
15120
|
this.map.setMaxBounds(new maplibre_gl.LngLatBounds([boundingBox[0].lng, boundingBox[0].lat], [boundingBox[1].lng, boundingBox[1].lat]));
|
|
14004
15121
|
}
|
|
14005
|
-
options === null || options === void 0 || (_options$
|
|
15122
|
+
options === null || options === void 0 || (_options$onComplete5 = options.onComplete) === null || _options$onComplete5 === void 0 || _options$onComplete5.call(options);
|
|
14006
15123
|
}
|
|
14007
15124
|
}, {
|
|
14008
15125
|
key: "fitCoordinates",
|
|
@@ -14026,11 +15143,11 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14026
15143
|
var minLng;
|
|
14027
15144
|
var maxLat;
|
|
14028
15145
|
var maxLng;
|
|
14029
|
-
var
|
|
14030
|
-
|
|
15146
|
+
var _iterator2 = map_createForOfIteratorHelper(coordinates),
|
|
15147
|
+
_step2;
|
|
14031
15148
|
try {
|
|
14032
|
-
for (
|
|
14033
|
-
var _coord =
|
|
15149
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
15150
|
+
var _coord = _step2.value;
|
|
14034
15151
|
var lat = _coord.lat,
|
|
14035
15152
|
lng = _coord.lng;
|
|
14036
15153
|
minLat = minLat === undefined ? lat : Math.min(minLat, lat);
|
|
@@ -14039,9 +15156,9 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14039
15156
|
maxLng = maxLng === undefined ? lng : Math.max(maxLng, lng);
|
|
14040
15157
|
}
|
|
14041
15158
|
} catch (err) {
|
|
14042
|
-
|
|
15159
|
+
_iterator2.e(err);
|
|
14043
15160
|
} finally {
|
|
14044
|
-
|
|
15161
|
+
_iterator2.f();
|
|
14045
15162
|
}
|
|
14046
15163
|
var bounds = [minLng !== null && minLng !== void 0 ? minLng : 0, minLat !== null && minLat !== void 0 ? minLat : 0, maxLng !== null && maxLng !== void 0 ? maxLng : 0, maxLat !== null && maxLat !== void 0 ? maxLat : 0];
|
|
14047
15164
|
|
|
@@ -14093,13 +15210,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14093
15210
|
key: "updateFloor",
|
|
14094
15211
|
value: function updateFloor(floorId, options) {
|
|
14095
15212
|
try {
|
|
14096
|
-
var _this$onFloorChange2, _options$
|
|
15213
|
+
var _this$onFloorChange2, _options$onComplete6;
|
|
14097
15214
|
this.filterByFloorKey(floorId);
|
|
14098
15215
|
(_this$onFloorChange2 = this.onFloorChange) === null || _this$onFloorChange2 === void 0 || _this$onFloorChange2.call(this, floorId);
|
|
14099
15216
|
this.logEvent("updateFloor", {
|
|
14100
15217
|
floorId: floorId
|
|
14101
15218
|
});
|
|
14102
|
-
options === null || options === void 0 || (_options$
|
|
15219
|
+
options === null || options === void 0 || (_options$onComplete6 = options.onComplete) === null || _options$onComplete6 === void 0 || _options$onComplete6.call(options);
|
|
14103
15220
|
} catch (error) {
|
|
14104
15221
|
// Floor update may fail
|
|
14105
15222
|
}
|
|
@@ -14163,7 +15280,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14163
15280
|
value: function updateRouteProgress(routeId, position) {
|
|
14164
15281
|
var behindStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
14165
15282
|
type: "Solid",
|
|
14166
|
-
color: "#
|
|
15283
|
+
color: "#276EF1"
|
|
14167
15284
|
};
|
|
14168
15285
|
try {
|
|
14169
15286
|
var behindConfig = new InternalDrawRouteConfiguration({
|
|
@@ -14218,13 +15335,11 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14218
15335
|
return subplace.clientId === placeId || subplace.mapvxId === placeId;
|
|
14219
15336
|
});
|
|
14220
15337
|
if (pointedPlace !== undefined) {
|
|
14221
|
-
new (maplibre_gl_default()).Popup().setLngLat(pointedPlace.position).
|
|
15338
|
+
new (maplibre_gl_default()).Popup().setLngLat(pointedPlace.position).setText(pointedPlace.title).addTo(this.map);
|
|
14222
15339
|
}
|
|
14223
15340
|
}
|
|
14224
15341
|
return "";
|
|
14225
15342
|
}
|
|
14226
|
-
|
|
14227
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14228
15343
|
}, {
|
|
14229
15344
|
key: "removePopOver",
|
|
14230
15345
|
value: function removePopOver(id) {
|
|
@@ -14243,17 +15358,17 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14243
15358
|
}, {
|
|
14244
15359
|
key: "defaultClickListener",
|
|
14245
15360
|
value: function defaultClickListener() {
|
|
14246
|
-
var
|
|
15361
|
+
var _this12 = this;
|
|
14247
15362
|
this.map.on("click", /*#__PURE__*/function () {
|
|
14248
15363
|
var _ref4 = map_asyncToGenerator(/*#__PURE__*/map_regenerator().m(function _callee2(e) {
|
|
14249
|
-
var features, roomFeatures, touchedFeature, ref, _clickedPlace, _ref5, _clickedPlace$mapvxId, _clickedPlace2, _clickedPlace3, clickedPlace,
|
|
15364
|
+
var features, roomFeatures, touchedFeature, ref, _clickedPlace, _ref5, _clickedPlace$mapvxId, _clickedPlace2, _clickedPlace3, clickedPlace, _iterator3, _step3, potentialParentPlace, cachedSubPlaces, cachedPlaces, clickedPlaceId, _t2;
|
|
14250
15365
|
return map_regenerator().w(function (_context2) {
|
|
14251
15366
|
while (1) switch (_context2.p = _context2.n) {
|
|
14252
15367
|
case 0:
|
|
14253
|
-
features =
|
|
15368
|
+
features = _this12.map.queryRenderedFeatures(e.point); // Filter room features by current floor
|
|
14254
15369
|
roomFeatures = features.filter(function (feature) {
|
|
14255
15370
|
var _feature$properties;
|
|
14256
|
-
return feature.properties["class"] === "room" && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) ===
|
|
15371
|
+
return feature.properties["class"] === "room" && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) === _this12.currentFloor;
|
|
14257
15372
|
});
|
|
14258
15373
|
touchedFeature = roomFeatures[0];
|
|
14259
15374
|
ref = touchedFeature === null || touchedFeature === void 0 ? void 0 : touchedFeature.properties.ref;
|
|
@@ -14264,23 +15379,23 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14264
15379
|
console.log("touchedFeature", ref);
|
|
14265
15380
|
|
|
14266
15381
|
// First, search in current subPlaces
|
|
14267
|
-
clickedPlace =
|
|
15382
|
+
clickedPlace = _this12.subPlaces.find(function (subPlace) {
|
|
14268
15383
|
return subPlace.mapvxId === ref;
|
|
14269
15384
|
}); // If not found, search in subplaces of potential parent places
|
|
14270
15385
|
if (!(clickedPlace === undefined)) {
|
|
14271
15386
|
_context2.n = 7;
|
|
14272
15387
|
break;
|
|
14273
15388
|
}
|
|
14274
|
-
|
|
15389
|
+
_iterator3 = map_createForOfIteratorHelper(_this12.potentialParentPlaces);
|
|
14275
15390
|
_context2.p = 1;
|
|
14276
|
-
|
|
15391
|
+
_iterator3.s();
|
|
14277
15392
|
case 2:
|
|
14278
|
-
if ((
|
|
15393
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
14279
15394
|
_context2.n = 4;
|
|
14280
15395
|
break;
|
|
14281
15396
|
}
|
|
14282
|
-
potentialParentPlace =
|
|
14283
|
-
cachedSubPlaces =
|
|
15397
|
+
potentialParentPlace = _step3.value;
|
|
15398
|
+
cachedSubPlaces = _this12.repository.getCachedSubPlaces(potentialParentPlace.mapvxId);
|
|
14284
15399
|
if (!cachedSubPlaces) {
|
|
14285
15400
|
_context2.n = 3;
|
|
14286
15401
|
break;
|
|
@@ -14302,24 +15417,24 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14302
15417
|
case 5:
|
|
14303
15418
|
_context2.p = 5;
|
|
14304
15419
|
_t2 = _context2.v;
|
|
14305
|
-
|
|
15420
|
+
_iterator3.e(_t2);
|
|
14306
15421
|
case 6:
|
|
14307
15422
|
_context2.p = 6;
|
|
14308
|
-
|
|
15423
|
+
_iterator3.f();
|
|
14309
15424
|
return _context2.f(6);
|
|
14310
15425
|
case 7:
|
|
14311
15426
|
if (!(clickedPlace === undefined)) {
|
|
14312
15427
|
_context2.n = 10;
|
|
14313
15428
|
break;
|
|
14314
15429
|
}
|
|
14315
|
-
cachedPlaces =
|
|
15430
|
+
cachedPlaces = _this12.repository.getCachedPlaces([ref]);
|
|
14316
15431
|
if (!(cachedPlaces.length === 0)) {
|
|
14317
15432
|
_context2.n = 9;
|
|
14318
15433
|
break;
|
|
14319
15434
|
}
|
|
14320
15435
|
console.log("fetching place detail from server", ref);
|
|
14321
15436
|
_context2.n = 8;
|
|
14322
|
-
return
|
|
15437
|
+
return _this12.repository.fetchAndParsePlaceDetail(ref);
|
|
14323
15438
|
case 8:
|
|
14324
15439
|
clickedPlace = _context2.v;
|
|
14325
15440
|
_context2.n = 10;
|
|
@@ -14330,8 +15445,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14330
15445
|
case 10:
|
|
14331
15446
|
console.log("clickedPlace", (_clickedPlace = clickedPlace) === null || _clickedPlace === void 0 ? void 0 : _clickedPlace.title);
|
|
14332
15447
|
clickedPlaceId = (_ref5 = (_clickedPlace$mapvxId = (_clickedPlace2 = clickedPlace) === null || _clickedPlace2 === void 0 ? void 0 : _clickedPlace2.mapvxId) !== null && _clickedPlace$mapvxId !== void 0 ? _clickedPlace$mapvxId : (_clickedPlace3 = clickedPlace) === null || _clickedPlace3 === void 0 ? void 0 : _clickedPlace3.clientId) !== null && _ref5 !== void 0 ? _ref5 : "";
|
|
14333
|
-
if (clickedPlace !== undefined &&
|
|
14334
|
-
|
|
15448
|
+
if (clickedPlace !== undefined && _this12.clickCallback) {
|
|
15449
|
+
_this12.clickCallback(clickedPlaceId);
|
|
14335
15450
|
}
|
|
14336
15451
|
case 11:
|
|
14337
15452
|
return _context2.a(2);
|
|
@@ -14346,29 +15461,29 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14346
15461
|
}, {
|
|
14347
15462
|
key: "onHover",
|
|
14348
15463
|
value: function onHover() {
|
|
14349
|
-
var
|
|
15464
|
+
var _this13 = this;
|
|
14350
15465
|
if (!this.enableHover) return;
|
|
14351
15466
|
this.map.on("mousemove", "hoverable", function (e) {
|
|
14352
15467
|
var _e$features;
|
|
14353
15468
|
var feature = (_e$features = e.features) === null || _e$features === void 0 ? void 0 : _e$features.find(function (feature) {
|
|
14354
15469
|
var _feature$properties$r, _feature$properties2;
|
|
14355
|
-
return ((_feature$properties$r = feature.properties.ref) === null || _feature$properties$r === void 0 ? void 0 : _feature$properties$r.length) > 0 && ((_feature$properties2 = feature.properties) === null || _feature$properties2 === void 0 ? void 0 : _feature$properties2.floor_key) ===
|
|
15470
|
+
return ((_feature$properties$r = feature.properties.ref) === null || _feature$properties$r === void 0 ? void 0 : _feature$properties$r.length) > 0 && ((_feature$properties2 = feature.properties) === null || _feature$properties2 === void 0 ? void 0 : _feature$properties2.floor_key) === _this13.currentFloor;
|
|
14356
15471
|
});
|
|
14357
15472
|
var ref = feature === null || feature === void 0 ? void 0 : feature.properties.ref;
|
|
14358
15473
|
if (ref != null && typeof ref === "string" && ref.length > 0) {
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
} else if (ref === undefined &&
|
|
14362
|
-
|
|
14363
|
-
|
|
15474
|
+
_this13.hoveredId = ref;
|
|
15475
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
15476
|
+
} else if (ref === undefined && _this13.hoveredId !== "unselected") {
|
|
15477
|
+
_this13.hoveredId = "unselected";
|
|
15478
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
14364
15479
|
}
|
|
14365
15480
|
});
|
|
14366
15481
|
|
|
14367
15482
|
// When the mouse leaves the state-fill layer, update the feature state of the
|
|
14368
15483
|
// previously hovered feature.
|
|
14369
15484
|
this.map.on("mouseleave", "hoverable", function () {
|
|
14370
|
-
|
|
14371
|
-
|
|
15485
|
+
_this13.hoveredId = "unselected";
|
|
15486
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
14372
15487
|
});
|
|
14373
15488
|
}
|
|
14374
15489
|
}, {
|
|
@@ -14424,7 +15539,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14424
15539
|
filter: ["all", ["has", "ref"], ["==", ["get", "ref"], "unselected"]],
|
|
14425
15540
|
paint: {
|
|
14426
15541
|
"fill-extrusion-height": 2.5,
|
|
14427
|
-
"fill-extrusion-color":
|
|
15542
|
+
"fill-extrusion-color": MAPVX_BRAND_COLOR,
|
|
14428
15543
|
"fill-extrusion-opacity": 0.8
|
|
14429
15544
|
}
|
|
14430
15545
|
};
|
|
@@ -14437,7 +15552,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14437
15552
|
"source-layer": "area",
|
|
14438
15553
|
filter: ["all", ["has", "ref"], ["==", ["get", "ref"], "unselected"]],
|
|
14439
15554
|
paint: {
|
|
14440
|
-
"fill-color":
|
|
15555
|
+
"fill-color": MAPVX_BRAND_COLOR
|
|
14441
15556
|
}
|
|
14442
15557
|
};
|
|
14443
15558
|
this.map.addLayer(_layer);
|
|
@@ -14446,10 +15561,10 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14446
15561
|
}, {
|
|
14447
15562
|
key: "createBasicFilters",
|
|
14448
15563
|
value: function createBasicFilters() {
|
|
14449
|
-
var _this$parentPlaceId3, _this$
|
|
15564
|
+
var _this$parentPlaceId3, _this$currentFloor4;
|
|
14450
15565
|
var publicPlaceFilter = ["==", ["get", "public_place"], true];
|
|
14451
15566
|
var subPlaceFilter = ["!", ["in", (_this$parentPlaceId3 = this.parentPlaceId) !== null && _this$parentPlaceId3 !== void 0 ? _this$parentPlaceId3 : "noRef", ["get", "is_subplace"]]];
|
|
14452
|
-
var floorId = (_this$
|
|
15567
|
+
var floorId = (_this$currentFloor4 = this.currentFloor) !== null && _this$currentFloor4 !== void 0 ? _this$currentFloor4 : "noRef";
|
|
14453
15568
|
var floorFilter = ["in", floorId, ["get", "floor_key"]];
|
|
14454
15569
|
var showInFloorFilter = ["in", floorId, ["get", "show_in_floor"]];
|
|
14455
15570
|
var basicFilters = publicPlaceFilter;
|
|
@@ -14831,7 +15946,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14831
15946
|
"source-layer": "area",
|
|
14832
15947
|
filter: ["all", ["has", "ref"], ["==", ["get", "ref"], "unselected"]],
|
|
14833
15948
|
paint: {
|
|
14834
|
-
"line-color":
|
|
15949
|
+
"line-color": MAPVX_BRAND_COLOR,
|
|
14835
15950
|
"line-width": 4
|
|
14836
15951
|
}
|
|
14837
15952
|
};
|
|
@@ -14850,7 +15965,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14850
15965
|
key: "onWebGLContextLost",
|
|
14851
15966
|
value: function onWebGLContextLost(e) {
|
|
14852
15967
|
var _this$map,
|
|
14853
|
-
|
|
15968
|
+
_this14 = this;
|
|
14854
15969
|
e.originalEvent.preventDefault();
|
|
14855
15970
|
console.warn("Contexto WebGL perdido 😢");
|
|
14856
15971
|
|
|
@@ -14861,8 +15976,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14861
15976
|
var _ext$restoreContext;
|
|
14862
15977
|
canvas.addEventListener("webglcontextrestored", function () {
|
|
14863
15978
|
console.debug("Contexto WebGL restaurado, forzando re-render");
|
|
14864
|
-
|
|
14865
|
-
|
|
15979
|
+
_this14.map.triggerRepaint(); // forzar repaint
|
|
15980
|
+
_this14.failedTiles.clear();
|
|
14866
15981
|
}, {
|
|
14867
15982
|
once: true
|
|
14868
15983
|
});
|
|
@@ -14902,7 +16017,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14902
16017
|
}, {
|
|
14903
16018
|
key: "subscribeToFailedTiles",
|
|
14904
16019
|
value: function subscribeToFailedTiles() {
|
|
14905
|
-
var
|
|
16020
|
+
var _this15 = this;
|
|
14906
16021
|
if (this.retryTimer) return;
|
|
14907
16022
|
|
|
14908
16023
|
// Store bound functions for proper cleanup
|
|
@@ -14911,20 +16026,20 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14911
16026
|
this.boundOnWebGLContextLost = this.onWebGLContextLost.bind(this);
|
|
14912
16027
|
this.boundOnWebGLContextRestored = this.onWebGLContextRestored.bind(this);
|
|
14913
16028
|
this.retryTimer = setInterval(function () {
|
|
14914
|
-
if (!
|
|
14915
|
-
|
|
16029
|
+
if (!_this15.map.getSource("indoorequal")) {
|
|
16030
|
+
_this15.failedTiles.clear();
|
|
14916
16031
|
return;
|
|
14917
16032
|
}
|
|
14918
|
-
var source =
|
|
16033
|
+
var source = _this15.map.getSource("indoorequal");
|
|
14919
16034
|
if (!source || source.type !== "vector") {
|
|
14920
|
-
|
|
16035
|
+
_this15.failedTiles.clear();
|
|
14921
16036
|
return;
|
|
14922
16037
|
}
|
|
14923
16038
|
|
|
14924
16039
|
// Process tiles and remove invalid ones
|
|
14925
16040
|
var tilesToRetry = [];
|
|
14926
16041
|
var tilesToRemove = [];
|
|
14927
|
-
|
|
16042
|
+
_this15.failedTiles.forEach(function (tile) {
|
|
14928
16043
|
// Check if tile is still valid before attempting reload
|
|
14929
16044
|
if (!tile || tile.state === "unloaded" || tile.state === "loading") {
|
|
14930
16045
|
tilesToRemove.push(tile);
|
|
@@ -14942,7 +16057,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14942
16057
|
|
|
14943
16058
|
// Remove invalid tiles from the set
|
|
14944
16059
|
tilesToRemove.forEach(function (tile) {
|
|
14945
|
-
return
|
|
16060
|
+
return _this15.failedTiles["delete"](tile);
|
|
14946
16061
|
});
|
|
14947
16062
|
|
|
14948
16063
|
// Attempt to reload valid failed tiles
|
|
@@ -14954,7 +16069,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14954
16069
|
}
|
|
14955
16070
|
} catch (error) {
|
|
14956
16071
|
// If reload fails, remove tile from retry queue - this is expected
|
|
14957
|
-
|
|
16072
|
+
_this15.failedTiles["delete"](tile);
|
|
14958
16073
|
}
|
|
14959
16074
|
});
|
|
14960
16075
|
}, 1000);
|
|
@@ -15103,6 +16218,7 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15103
16218
|
var _this;
|
|
15104
16219
|
sdk_classCallCheck(this, InternalMapVXSDK);
|
|
15105
16220
|
_this = sdk_callSuper(this, InternalMapVXSDK);
|
|
16221
|
+
sdk_defineProperty(_this, "maps", []);
|
|
15106
16222
|
sdk_defineProperty(_this, "geoLocation", navigator.geolocation);
|
|
15107
16223
|
sdk_defineProperty(_this, "headingListeners", []);
|
|
15108
16224
|
_this.token = token;
|
|
@@ -15136,6 +16252,17 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15136
16252
|
value: function setSdkLang(lang) {
|
|
15137
16253
|
this.config.lang = lang;
|
|
15138
16254
|
this.repository.setLang(lang);
|
|
16255
|
+
this.maps.forEach(function (map) {
|
|
16256
|
+
return map.setLang(lang);
|
|
16257
|
+
});
|
|
16258
|
+
}
|
|
16259
|
+
}, {
|
|
16260
|
+
key: "unregisterMap",
|
|
16261
|
+
value: function unregisterMap(map) {
|
|
16262
|
+
var mapIndex = this.maps.indexOf(map);
|
|
16263
|
+
if (mapIndex >= 0) {
|
|
16264
|
+
this.maps.splice(mapIndex, 1);
|
|
16265
|
+
}
|
|
15139
16266
|
}
|
|
15140
16267
|
}, {
|
|
15141
16268
|
key: "getPlaceDetail",
|
|
@@ -15209,11 +16336,21 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15209
16336
|
}, {
|
|
15210
16337
|
key: "createMap",
|
|
15211
16338
|
value: function createMap(container, mapConfig) {
|
|
16339
|
+
var _this2 = this;
|
|
15212
16340
|
try {
|
|
15213
16341
|
mapConfig.lang = this.config.lang;
|
|
15214
16342
|
mapConfig.apiUrl = this.config.apiUrl;
|
|
15215
16343
|
mapConfig.mapvxRequestContext = this.config.mapvxRequestContext;
|
|
15216
16344
|
var map = new InternalMapVXMap(mapConfig, container, this.token);
|
|
16345
|
+
var originalDestroyMap = map.destroyMap.bind(map);
|
|
16346
|
+
map.destroyMap = function () {
|
|
16347
|
+
try {
|
|
16348
|
+
originalDestroyMap();
|
|
16349
|
+
} finally {
|
|
16350
|
+
_this2.unregisterMap(map);
|
|
16351
|
+
}
|
|
16352
|
+
};
|
|
16353
|
+
this.maps.push(map);
|
|
15217
16354
|
this.logEvent("createMap");
|
|
15218
16355
|
return map;
|
|
15219
16356
|
} catch (error) {
|
|
@@ -15610,7 +16747,7 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15610
16747
|
return _searchPlacesByTags.apply(this, arguments);
|
|
15611
16748
|
}
|
|
15612
16749
|
return searchPlacesByTags;
|
|
15613
|
-
}()
|
|
16750
|
+
}()
|
|
15614
16751
|
}, {
|
|
15615
16752
|
key: "getPlacesByCategory",
|
|
15616
16753
|
value: function () {
|
|
@@ -15646,14 +16783,14 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15646
16783
|
}, {
|
|
15647
16784
|
key: "getUserLocation",
|
|
15648
16785
|
value: function getUserLocation() {
|
|
15649
|
-
var
|
|
16786
|
+
var _this3 = this;
|
|
15650
16787
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
15651
16788
|
enableHighAccuracy: true,
|
|
15652
16789
|
timeout: 60 * 1000,
|
|
15653
16790
|
maximumAge: 10 * 1000
|
|
15654
16791
|
};
|
|
15655
16792
|
return new Promise(function (resolve, reject) {
|
|
15656
|
-
|
|
16793
|
+
_this3.geoLocation.getCurrentPosition(function (position) {
|
|
15657
16794
|
resolve(position);
|
|
15658
16795
|
}, function (error) {
|
|
15659
16796
|
reject(error);
|
|
@@ -15857,13 +16994,29 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15857
16994
|
* @group Utils
|
|
15858
16995
|
*/
|
|
15859
16996
|
|
|
16997
|
+
/**
|
|
16998
|
+
* Represents a category containing a image url.
|
|
16999
|
+
* @group Utils
|
|
17000
|
+
*/
|
|
17001
|
+
|
|
15860
17002
|
/**
|
|
15861
17003
|
* Represents a category containing an icon.
|
|
15862
17004
|
* @group Utils
|
|
15863
17005
|
*/
|
|
15864
17006
|
|
|
15865
17007
|
/**
|
|
15866
|
-
*
|
|
17008
|
+
* Holds the basic information of a category: its `id`, `name` and an optional `description`.
|
|
17009
|
+
*
|
|
17010
|
+
* A category may optionally carry a graphical representation, but it is not required.
|
|
17011
|
+
* Depending on the available asset, a `BasicCategory` can be one of:
|
|
17012
|
+
*
|
|
17013
|
+
* - {@link BasicWithLogo} — the category provides a logo image (URL).
|
|
17014
|
+
* - {@link BasicWithIcon} — the category provides a Font Awesome icon name (and optional style).
|
|
17015
|
+
* - {@link BasicWithImageUrl} — the category provides an image URL for its icon.
|
|
17016
|
+
* - {@link Basic} — the category carries no graphical information at all.
|
|
17017
|
+
*
|
|
17018
|
+
* Use the {@link isBasicWithLogo}, {@link isBasicWithIcon} and {@link isBasicWithImageUrl}
|
|
17019
|
+
* type guards to narrow a `BasicCategory` and safely access its graphical asset.
|
|
15867
17020
|
* @group Utils
|
|
15868
17021
|
*/
|
|
15869
17022
|
|
|
@@ -15917,132 +17070,36 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15917
17070
|
*/
|
|
15918
17071
|
|
|
15919
17072
|
/**
|
|
15920
|
-
* Checks if the category
|
|
15921
|
-
*
|
|
15922
|
-
* @param category
|
|
15923
|
-
* @returns
|
|
17073
|
+
* Checks if the category carries a logo image.
|
|
17074
|
+
* @group Utils
|
|
17075
|
+
* @param category - The category to inspect.
|
|
17076
|
+
* @returns `true` if the category exposes a non-empty `logo` URL, narrowing it to {@link BasicWithLogo}.
|
|
15924
17077
|
*/
|
|
15925
17078
|
function isBasicWithLogo(category) {
|
|
15926
|
-
|
|
17079
|
+
var input = category;
|
|
17080
|
+
return input.logo != null && input.logo !== "";
|
|
15927
17081
|
}
|
|
15928
17082
|
|
|
15929
17083
|
/**
|
|
15930
|
-
* Checks if the category
|
|
17084
|
+
* Checks if the category carries a Font Awesome icon.
|
|
15931
17085
|
* @group Utils
|
|
15932
|
-
* @param category
|
|
15933
|
-
* @returns
|
|
17086
|
+
* @param category - The category to inspect.
|
|
17087
|
+
* @returns `true` if the category exposes a non-empty `icon` name, narrowing it to {@link BasicWithIcon}.
|
|
15934
17088
|
*/
|
|
15935
17089
|
function isBasicWithIcon(category) {
|
|
15936
|
-
|
|
15937
|
-
|
|
15938
|
-
;// ./src/utils/update-css.ts
|
|
15939
|
-
function update_css_slicedToArray(r, e) { return update_css_arrayWithHoles(r) || update_css_iterableToArrayLimit(r, e) || update_css_unsupportedIterableToArray(r, e) || update_css_nonIterableRest(); }
|
|
15940
|
-
function update_css_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15941
|
-
function update_css_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return update_css_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? update_css_arrayLikeToArray(r, a) : void 0; } }
|
|
15942
|
-
function update_css_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15943
|
-
function update_css_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15944
|
-
function update_css_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15945
|
-
/**
|
|
15946
|
-
* Load a CSS customization of a project.
|
|
15947
|
-
*
|
|
15948
|
-
* This function create a new HTML Style Element and add it to the current document.
|
|
15949
|
-
* Also activate the customization adding the first theme name to the body of the document.
|
|
15950
|
-
*
|
|
15951
|
-
* @group Utils
|
|
15952
|
-
* @param data The CSS customization data.
|
|
15953
|
-
*/
|
|
15954
|
-
function loadCustomization(data) {
|
|
15955
|
-
var style = document.createElement("style");
|
|
15956
|
-
style.textContent = "";
|
|
15957
|
-
for (var _i = 0, _Object$entries = Object.entries(data); _i < _Object$entries.length; _i++) {
|
|
15958
|
-
var _Object$entries$_i = update_css_slicedToArray(_Object$entries[_i], 2),
|
|
15959
|
-
themeName = _Object$entries$_i[0],
|
|
15960
|
-
themeData = _Object$entries$_i[1];
|
|
15961
|
-
var cssClass = loadTheme(themeName, themeData);
|
|
15962
|
-
style.textContent += cssClass;
|
|
15963
|
-
}
|
|
15964
|
-
document.head.appendChild(style);
|
|
15965
|
-
var firstThemeName = Object.keys(data).at(0);
|
|
15966
|
-
if (firstThemeName != null) {
|
|
15967
|
-
document.body.classList.add(firstThemeName);
|
|
15968
|
-
}
|
|
17090
|
+
var input = category;
|
|
17091
|
+
return input.icon != null && input.icon !== "";
|
|
15969
17092
|
}
|
|
15970
17093
|
|
|
15971
17094
|
/**
|
|
15972
|
-
*
|
|
15973
|
-
*
|
|
15974
|
-
* @group Utils
|
|
15975
|
-
* @param themeName The name of the Theme.
|
|
15976
|
-
* @param themeData The data of the Theme.
|
|
15977
|
-
* @returns A string with the processed theme to use on a CSS file.
|
|
15978
|
-
*/
|
|
15979
|
-
function loadTheme(themeName, themeData) {
|
|
15980
|
-
var cssClass = ".".concat(themeName, " {\n");
|
|
15981
|
-
var definitions = themeData.definitions;
|
|
15982
|
-
if (definitions != null) {
|
|
15983
|
-
cssClass = loadDefinitions(definitions, cssClass);
|
|
15984
|
-
}
|
|
15985
|
-
for (var _i2 = 0, _Object$entries2 = Object.entries((_themeData$screens = themeData.screens) !== null && _themeData$screens !== void 0 ? _themeData$screens : {}); _i2 < _Object$entries2.length; _i2++) {
|
|
15986
|
-
var _themeData$screens;
|
|
15987
|
-
var _Object$entries2$_i = update_css_slicedToArray(_Object$entries2[_i2], 2),
|
|
15988
|
-
screenName = _Object$entries2$_i[0],
|
|
15989
|
-
screenData = _Object$entries2$_i[1];
|
|
15990
|
-
for (var _i3 = 0, _Object$entries3 = Object.entries(screenData); _i3 < _Object$entries3.length; _i3++) {
|
|
15991
|
-
var _Object$entries3$_i = update_css_slicedToArray(_Object$entries3[_i3], 2),
|
|
15992
|
-
componentName = _Object$entries3$_i[0],
|
|
15993
|
-
componentData = _Object$entries3$_i[1];
|
|
15994
|
-
for (var _i4 = 0, _Object$entries4 = Object.entries(componentData); _i4 < _Object$entries4.length; _i4++) {
|
|
15995
|
-
var _Object$entries4$_i = update_css_slicedToArray(_Object$entries4[_i4], 2),
|
|
15996
|
-
elementName = _Object$entries4$_i[0],
|
|
15997
|
-
elementData = _Object$entries4$_i[1];
|
|
15998
|
-
for (var _i5 = 0, _Object$entries5 = Object.entries(elementData); _i5 < _Object$entries5.length; _i5++) {
|
|
15999
|
-
var _Object$entries5$_i = update_css_slicedToArray(_Object$entries5[_i5], 2),
|
|
16000
|
-
propertyName = _Object$entries5$_i[0],
|
|
16001
|
-
propertyValue = _Object$entries5$_i[1];
|
|
16002
|
-
cssClass += " --".concat(screenName, "-").concat(componentName, "-").concat(elementName, "-").concat(propertyName, ": ").concat(propertyValue, ";\n");
|
|
16003
|
-
}
|
|
16004
|
-
}
|
|
16005
|
-
}
|
|
16006
|
-
}
|
|
16007
|
-
cssClass += "}\n";
|
|
16008
|
-
return cssClass;
|
|
16009
|
-
}
|
|
16010
|
-
/**
|
|
16011
|
-
* Process the definitions of a theme.
|
|
16012
|
-
*
|
|
17095
|
+
* Checks if the category carries an image URL.
|
|
16013
17096
|
* @group Utils
|
|
16014
|
-
* @param
|
|
16015
|
-
* @
|
|
16016
|
-
* @returns The cssClass string mutated with the processed definitions.
|
|
17097
|
+
* @param category - The category to inspect.
|
|
17098
|
+
* @returns `true` if the category exposes a non-empty `imageUrl`, narrowing it to {@link BasicWithImageUrl}.
|
|
16017
17099
|
*/
|
|
16018
|
-
function
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
var _Object$entries6$_i = update_css_slicedToArray(_Object$entries6[_i6], 2),
|
|
16022
|
-
colorName = _Object$entries6$_i[0],
|
|
16023
|
-
colorData = _Object$entries6$_i[1];
|
|
16024
|
-
for (var _i7 = 0, _Object$entries7 = Object.entries(colorData); _i7 < _Object$entries7.length; _i7++) {
|
|
16025
|
-
var _Object$entries7$_i = update_css_slicedToArray(_Object$entries7[_i7], 2),
|
|
16026
|
-
colorIntensity = _Object$entries7$_i[0],
|
|
16027
|
-
colorValue = _Object$entries7$_i[1];
|
|
16028
|
-
cssClass += " --definitions-colors-".concat(colorName, "-").concat(colorIntensity, ": ").concat(colorValue, ";\n");
|
|
16029
|
-
}
|
|
16030
|
-
}
|
|
16031
|
-
for (var _i8 = 0, _Object$entries8 = Object.entries((_definitions$shadows = definitions.shadows) !== null && _definitions$shadows !== void 0 ? _definitions$shadows : {}); _i8 < _Object$entries8.length; _i8++) {
|
|
16032
|
-
var _definitions$shadows;
|
|
16033
|
-
var _Object$entries8$_i = update_css_slicedToArray(_Object$entries8[_i8], 2),
|
|
16034
|
-
shadowName = _Object$entries8$_i[0],
|
|
16035
|
-
shadowValue = _Object$entries8$_i[1];
|
|
16036
|
-
cssClass += " --definitions-shadows-".concat(shadowName, ": ").concat(shadowValue, ";\n");
|
|
16037
|
-
}
|
|
16038
|
-
for (var _i9 = 0, _Object$entries9 = Object.entries((_definitions$textFont = definitions.textFonts) !== null && _definitions$textFont !== void 0 ? _definitions$textFont : {}); _i9 < _Object$entries9.length; _i9++) {
|
|
16039
|
-
var _definitions$textFont;
|
|
16040
|
-
var _Object$entries9$_i = update_css_slicedToArray(_Object$entries9[_i9], 2),
|
|
16041
|
-
fontName = _Object$entries9$_i[0],
|
|
16042
|
-
fontValue = _Object$entries9$_i[1];
|
|
16043
|
-
cssClass += " --definitions-textFonts-".concat(fontName, ": ").concat(fontValue, ";\n");
|
|
16044
|
-
}
|
|
16045
|
-
return cssClass;
|
|
17100
|
+
function isBasicWithImageUrl(category) {
|
|
17101
|
+
var input = category;
|
|
17102
|
+
return input.imageUrl != null && input.imageUrl !== "";
|
|
16046
17103
|
}
|
|
16047
17104
|
;// ./src/utils/opening-hours-helper.ts
|
|
16048
17105
|
function opening_hours_helper_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = opening_hours_helper_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -17054,6 +18111,245 @@ function is24Hours(openingTime) {
|
|
|
17054
18111
|
// Check if open is "00:00" and close is "24:00" or "00:00"
|
|
17055
18112
|
return open === "00:00" && close === "24:00" || open === "00:00" && close === "00:00";
|
|
17056
18113
|
}
|
|
18114
|
+
;// ./src/utils/preconnect.ts
|
|
18115
|
+
function preconnect_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = preconnect_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
18116
|
+
function preconnect_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return preconnect_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? preconnect_arrayLikeToArray(r, a) : void 0; } }
|
|
18117
|
+
function preconnect_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18118
|
+
/**
|
|
18119
|
+
* Hostnames that MapVX maps typically need to talk to during the first
|
|
18120
|
+
* paint: vector tiles, sprite, glyphs and indoor tile sources. Exposed so
|
|
18121
|
+
* that consumer apps can call `injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)`
|
|
18122
|
+
* without having to maintain the list themselves.
|
|
18123
|
+
*
|
|
18124
|
+
* @group Utils
|
|
18125
|
+
*/
|
|
18126
|
+
var MAPVX_DEFAULT_PRECONNECT_HOSTS = ["https://tiles.mapvx.com", "https://api.maptiler.com", "https://indoorequals.mapvx.com"];
|
|
18127
|
+
|
|
18128
|
+
/**
|
|
18129
|
+
* Injects `<link rel="preconnect">` (and a `<link rel="dns-prefetch">` fallback)
|
|
18130
|
+
* tags into `document.head` for the given origins, so the browser starts the
|
|
18131
|
+
* DNS + TLS handshake before MapLibre actually requests sprite/glyph/tile
|
|
18132
|
+
* resources.
|
|
18133
|
+
*
|
|
18134
|
+
* Call this as early as possible — ideally before {@link initializeSDK} — to
|
|
18135
|
+
* maximize the savings. In real captures this shaves ~150-300 ms off the
|
|
18136
|
+
* first-paint cascade.
|
|
18137
|
+
*
|
|
18138
|
+
* Idempotent: hosts that already have a `<link rel="preconnect" crossorigin>`
|
|
18139
|
+
* are skipped. If an existing `preconnect` link is missing `crossorigin`, it
|
|
18140
|
+
* is upgraded in place (added `crossorigin="anonymous"`) — without that
|
|
18141
|
+
* attribute the warmed socket can't be reused for the CORS tile/font/sprite
|
|
18142
|
+
* fetches MapLibre performs, so leaving the existing link untouched would
|
|
18143
|
+
* silently defeat the optimization. Existing `crossorigin="use-credentials"`
|
|
18144
|
+
* is respected and never overwritten.
|
|
18145
|
+
*
|
|
18146
|
+
* @param hosts - Origin URLs (`"https://tiles.mapvx.com"`) or bare hostnames
|
|
18147
|
+
* (`"tiles.mapvx.com"`, normalized to `https://`). Invalid entries are
|
|
18148
|
+
* silently ignored.
|
|
18149
|
+
* @returns The origins where the helper made a change — either a new link was
|
|
18150
|
+
* appended, or an existing one was upgraded with `crossorigin="anonymous"`.
|
|
18151
|
+
*
|
|
18152
|
+
* @example
|
|
18153
|
+
* ```ts
|
|
18154
|
+
* import { initializeSDK, injectPreconnects, MAPVX_DEFAULT_PRECONNECT_HOSTS } from "@mapvx/web-js"
|
|
18155
|
+
*
|
|
18156
|
+
* injectPreconnects(MAPVX_DEFAULT_PRECONNECT_HOSTS)
|
|
18157
|
+
* const sdk = initializeSDK(apiKey)
|
|
18158
|
+
* ```
|
|
18159
|
+
*
|
|
18160
|
+
* @group Utils
|
|
18161
|
+
*/
|
|
18162
|
+
function injectPreconnects(hosts) {
|
|
18163
|
+
if (typeof document === "undefined" || !document.head) return [];
|
|
18164
|
+
if (!Array.isArray(hosts) || hosts.length === 0) return [];
|
|
18165
|
+
var injected = [];
|
|
18166
|
+
var _iterator = preconnect_createForOfIteratorHelper(hosts),
|
|
18167
|
+
_step;
|
|
18168
|
+
try {
|
|
18169
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
18170
|
+
var raw = _step.value;
|
|
18171
|
+
if (typeof raw !== "string" || raw.length === 0) continue;
|
|
18172
|
+
var origin = normalizeOrigin(raw);
|
|
18173
|
+
if (origin === null) continue;
|
|
18174
|
+
|
|
18175
|
+
// Check what's already in <head>. We may need to UPGRADE an existing
|
|
18176
|
+
// preconnect — server-rendered or hand-authored hints frequently omit
|
|
18177
|
+
// `crossorigin`, and a warmed socket without it cannot be reused for
|
|
18178
|
+
// the CORS tile/font/sprite fetches that MapLibre performs. Without
|
|
18179
|
+
// this branch the optimization would silently no-op when the page
|
|
18180
|
+
// already had a partial hint.
|
|
18181
|
+
var existingPreconnect = findLinkForOrigin("preconnect", origin);
|
|
18182
|
+
var preconnectChanged = false;
|
|
18183
|
+
if (existingPreconnect) {
|
|
18184
|
+
if (!existingPreconnect.hasAttribute("crossorigin")) {
|
|
18185
|
+
existingPreconnect.crossOrigin = "anonymous";
|
|
18186
|
+
preconnectChanged = true;
|
|
18187
|
+
}
|
|
18188
|
+
// If the existing link already has any `crossorigin` value
|
|
18189
|
+
// (including `use-credentials`), respect the author's intent and
|
|
18190
|
+
// leave it alone.
|
|
18191
|
+
} else {
|
|
18192
|
+
var preconnect = document.createElement("link");
|
|
18193
|
+
preconnect.rel = "preconnect";
|
|
18194
|
+
preconnect.href = origin;
|
|
18195
|
+
preconnect.crossOrigin = "anonymous";
|
|
18196
|
+
document.head.appendChild(preconnect);
|
|
18197
|
+
preconnectChanged = true;
|
|
18198
|
+
}
|
|
18199
|
+
|
|
18200
|
+
// dns-prefetch is a fallback for older browsers that ignore preconnect.
|
|
18201
|
+
if (!findLinkForOrigin("dns-prefetch", origin)) {
|
|
18202
|
+
var dnsPrefetch = document.createElement("link");
|
|
18203
|
+
dnsPrefetch.rel = "dns-prefetch";
|
|
18204
|
+
dnsPrefetch.href = origin;
|
|
18205
|
+
document.head.appendChild(dnsPrefetch);
|
|
18206
|
+
}
|
|
18207
|
+
if (preconnectChanged) injected.push(origin);
|
|
18208
|
+
}
|
|
18209
|
+
} catch (err) {
|
|
18210
|
+
_iterator.e(err);
|
|
18211
|
+
} finally {
|
|
18212
|
+
_iterator.f();
|
|
18213
|
+
}
|
|
18214
|
+
return injected;
|
|
18215
|
+
}
|
|
18216
|
+
|
|
18217
|
+
/**
|
|
18218
|
+
* Returns the first `<link rel="${rel}">` in `<head>` whose resolved origin
|
|
18219
|
+
* matches `origin`, or null. We compare canonical URL origins instead of
|
|
18220
|
+
* the raw `href` attribute text — the same origin can be written as
|
|
18221
|
+
* `https://tiles.mapvx.com` or `https://tiles.mapvx.com/`, and a strict
|
|
18222
|
+
* attribute selector would miss the second form and inject a duplicate.
|
|
18223
|
+
*/
|
|
18224
|
+
function findLinkForOrigin(rel, origin) {
|
|
18225
|
+
var links = document.head.querySelectorAll("link[rel=\"".concat(rel, "\"]"));
|
|
18226
|
+
for (var i = 0; i < links.length; i++) {
|
|
18227
|
+
var link = links[i];
|
|
18228
|
+
try {
|
|
18229
|
+
if (new URL(link.href).origin === origin) return link;
|
|
18230
|
+
} catch (_unused) {
|
|
18231
|
+
// Malformed href — skip and keep scanning.
|
|
18232
|
+
}
|
|
18233
|
+
}
|
|
18234
|
+
return null;
|
|
18235
|
+
}
|
|
18236
|
+
function normalizeOrigin(raw) {
|
|
18237
|
+
try {
|
|
18238
|
+
var candidate = /^https?:\/\//i.test(raw) ? raw : "https://".concat(raw);
|
|
18239
|
+
return new URL(candidate).origin;
|
|
18240
|
+
} catch (_unused2) {
|
|
18241
|
+
return null;
|
|
18242
|
+
}
|
|
18243
|
+
}
|
|
18244
|
+
;// ./src/utils/update-css.ts
|
|
18245
|
+
function update_css_slicedToArray(r, e) { return update_css_arrayWithHoles(r) || update_css_iterableToArrayLimit(r, e) || update_css_unsupportedIterableToArray(r, e) || update_css_nonIterableRest(); }
|
|
18246
|
+
function update_css_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18247
|
+
function update_css_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return update_css_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? update_css_arrayLikeToArray(r, a) : void 0; } }
|
|
18248
|
+
function update_css_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18249
|
+
function update_css_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18250
|
+
function update_css_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18251
|
+
/**
|
|
18252
|
+
* Load a CSS customization of a project.
|
|
18253
|
+
*
|
|
18254
|
+
* This function create a new HTML Style Element and add it to the current document.
|
|
18255
|
+
* Also activate the customization adding the first theme name to the body of the document.
|
|
18256
|
+
*
|
|
18257
|
+
* @group Utils
|
|
18258
|
+
* @param data The CSS customization data.
|
|
18259
|
+
*/
|
|
18260
|
+
function loadCustomization(data) {
|
|
18261
|
+
var style = document.createElement("style");
|
|
18262
|
+
style.textContent = "";
|
|
18263
|
+
for (var _i = 0, _Object$entries = Object.entries(data); _i < _Object$entries.length; _i++) {
|
|
18264
|
+
var _Object$entries$_i = update_css_slicedToArray(_Object$entries[_i], 2),
|
|
18265
|
+
themeName = _Object$entries$_i[0],
|
|
18266
|
+
themeData = _Object$entries$_i[1];
|
|
18267
|
+
var cssClass = loadTheme(themeName, themeData);
|
|
18268
|
+
style.textContent += cssClass;
|
|
18269
|
+
}
|
|
18270
|
+
document.head.appendChild(style);
|
|
18271
|
+
var firstThemeName = Object.keys(data).at(0);
|
|
18272
|
+
if (firstThemeName != null) {
|
|
18273
|
+
document.body.classList.add(firstThemeName);
|
|
18274
|
+
}
|
|
18275
|
+
}
|
|
18276
|
+
|
|
18277
|
+
/**
|
|
18278
|
+
* Process a theme.
|
|
18279
|
+
*
|
|
18280
|
+
* @group Utils
|
|
18281
|
+
* @param themeName The name of the Theme.
|
|
18282
|
+
* @param themeData The data of the Theme.
|
|
18283
|
+
* @returns A string with the processed theme to use on a CSS file.
|
|
18284
|
+
*/
|
|
18285
|
+
function loadTheme(themeName, themeData) {
|
|
18286
|
+
var cssClass = ".".concat(themeName, " {\n");
|
|
18287
|
+
var definitions = themeData.definitions;
|
|
18288
|
+
if (definitions != null) {
|
|
18289
|
+
cssClass = loadDefinitions(definitions, cssClass);
|
|
18290
|
+
}
|
|
18291
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries((_themeData$screens = themeData.screens) !== null && _themeData$screens !== void 0 ? _themeData$screens : {}); _i2 < _Object$entries2.length; _i2++) {
|
|
18292
|
+
var _themeData$screens;
|
|
18293
|
+
var _Object$entries2$_i = update_css_slicedToArray(_Object$entries2[_i2], 2),
|
|
18294
|
+
screenName = _Object$entries2$_i[0],
|
|
18295
|
+
screenData = _Object$entries2$_i[1];
|
|
18296
|
+
for (var _i3 = 0, _Object$entries3 = Object.entries(screenData); _i3 < _Object$entries3.length; _i3++) {
|
|
18297
|
+
var _Object$entries3$_i = update_css_slicedToArray(_Object$entries3[_i3], 2),
|
|
18298
|
+
componentName = _Object$entries3$_i[0],
|
|
18299
|
+
componentData = _Object$entries3$_i[1];
|
|
18300
|
+
for (var _i4 = 0, _Object$entries4 = Object.entries(componentData); _i4 < _Object$entries4.length; _i4++) {
|
|
18301
|
+
var _Object$entries4$_i = update_css_slicedToArray(_Object$entries4[_i4], 2),
|
|
18302
|
+
elementName = _Object$entries4$_i[0],
|
|
18303
|
+
elementData = _Object$entries4$_i[1];
|
|
18304
|
+
for (var _i5 = 0, _Object$entries5 = Object.entries(elementData); _i5 < _Object$entries5.length; _i5++) {
|
|
18305
|
+
var _Object$entries5$_i = update_css_slicedToArray(_Object$entries5[_i5], 2),
|
|
18306
|
+
propertyName = _Object$entries5$_i[0],
|
|
18307
|
+
propertyValue = _Object$entries5$_i[1];
|
|
18308
|
+
cssClass += " --".concat(screenName, "-").concat(componentName, "-").concat(elementName, "-").concat(propertyName, ": ").concat(propertyValue, ";\n");
|
|
18309
|
+
}
|
|
18310
|
+
}
|
|
18311
|
+
}
|
|
18312
|
+
}
|
|
18313
|
+
cssClass += "}\n";
|
|
18314
|
+
return cssClass;
|
|
18315
|
+
}
|
|
18316
|
+
/**
|
|
18317
|
+
* Process the definitions of a theme.
|
|
18318
|
+
*
|
|
18319
|
+
* @group Utils
|
|
18320
|
+
* @param definitions The definitions of the theme.
|
|
18321
|
+
* @param cssClass The string object that will contain the processed theme
|
|
18322
|
+
* @returns The cssClass string mutated with the processed definitions.
|
|
18323
|
+
*/
|
|
18324
|
+
function loadDefinitions(definitions, cssClass) {
|
|
18325
|
+
for (var _i6 = 0, _Object$entries6 = Object.entries((_definitions$colors = definitions.colors) !== null && _definitions$colors !== void 0 ? _definitions$colors : {}); _i6 < _Object$entries6.length; _i6++) {
|
|
18326
|
+
var _definitions$colors;
|
|
18327
|
+
var _Object$entries6$_i = update_css_slicedToArray(_Object$entries6[_i6], 2),
|
|
18328
|
+
colorName = _Object$entries6$_i[0],
|
|
18329
|
+
colorData = _Object$entries6$_i[1];
|
|
18330
|
+
for (var _i7 = 0, _Object$entries7 = Object.entries(colorData); _i7 < _Object$entries7.length; _i7++) {
|
|
18331
|
+
var _Object$entries7$_i = update_css_slicedToArray(_Object$entries7[_i7], 2),
|
|
18332
|
+
colorIntensity = _Object$entries7$_i[0],
|
|
18333
|
+
colorValue = _Object$entries7$_i[1];
|
|
18334
|
+
cssClass += " --definitions-colors-".concat(colorName, "-").concat(colorIntensity, ": ").concat(colorValue, ";\n");
|
|
18335
|
+
}
|
|
18336
|
+
}
|
|
18337
|
+
for (var _i8 = 0, _Object$entries8 = Object.entries((_definitions$shadows = definitions.shadows) !== null && _definitions$shadows !== void 0 ? _definitions$shadows : {}); _i8 < _Object$entries8.length; _i8++) {
|
|
18338
|
+
var _definitions$shadows;
|
|
18339
|
+
var _Object$entries8$_i = update_css_slicedToArray(_Object$entries8[_i8], 2),
|
|
18340
|
+
shadowName = _Object$entries8$_i[0],
|
|
18341
|
+
shadowValue = _Object$entries8$_i[1];
|
|
18342
|
+
cssClass += " --definitions-shadows-".concat(shadowName, ": ").concat(shadowValue, ";\n");
|
|
18343
|
+
}
|
|
18344
|
+
for (var _i9 = 0, _Object$entries9 = Object.entries((_definitions$textFont = definitions.textFonts) !== null && _definitions$textFont !== void 0 ? _definitions$textFont : {}); _i9 < _Object$entries9.length; _i9++) {
|
|
18345
|
+
var _definitions$textFont;
|
|
18346
|
+
var _Object$entries9$_i = update_css_slicedToArray(_Object$entries9[_i9], 2),
|
|
18347
|
+
fontName = _Object$entries9$_i[0],
|
|
18348
|
+
fontValue = _Object$entries9$_i[1];
|
|
18349
|
+
cssClass += " --definitions-textFonts-".concat(fontName, ": ").concat(fontValue, ";\n");
|
|
18350
|
+
}
|
|
18351
|
+
return cssClass;
|
|
18352
|
+
}
|
|
17057
18353
|
;// ./src/index.ts
|
|
17058
18354
|
// ─── Domain Ports (interfaces) ───────────────────────────────────────────────
|
|
17059
18355
|
|
|
@@ -17085,6 +18381,8 @@ function is24Hours(openingTime) {
|
|
|
17085
18381
|
|
|
17086
18382
|
// ─── Domain Models: Categories ───────────────────────────────────────────────
|
|
17087
18383
|
|
|
18384
|
+
// ─── Domain Models: Circle ───────────────────────────────────────────────────
|
|
18385
|
+
|
|
17088
18386
|
|
|
17089
18387
|
// ─── Domain Models: City Filter ──────────────────────────────────────────────
|
|
17090
18388
|
|
|
@@ -17135,6 +18433,7 @@ function is24Hours(openingTime) {
|
|
|
17135
18433
|
|
|
17136
18434
|
|
|
17137
18435
|
|
|
18436
|
+
|
|
17138
18437
|
/**
|
|
17139
18438
|
* Function to load default styles
|
|
17140
18439
|
* @group Utils
|