@mapvx/web-js 1.2.1 → 1.2.2
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/README.md +2 -0
- package/dist/cjs/controllers/routeController.js +19 -19
- package/dist/cjs/controllers/routeController.js.map +1 -1
- package/dist/cjs/domain/models/mapConfig.js +10 -1
- package/dist/cjs/domain/models/mapConfig.js.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/logger/logger.js +13 -8
- package/dist/cjs/logger/logger.js.map +1 -1
- package/dist/cjs/logger/rollbar.js +11 -6
- package/dist/cjs/logger/rollbar.js.map +1 -1
- package/dist/cjs/map/map.js +101 -24
- 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 +24 -27
- package/dist/cjs/repository/requester.js.map +1 -1
- package/dist/cjs/sdk.js +18 -0
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/cjs/utils/semaphore.js +143 -0
- package/dist/cjs/utils/semaphore.js.map +1 -0
- 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/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/index.d.ts +1 -0
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +2 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/logger/logger.d.ts.map +1 -1
- package/dist/es/logger/logger.js +13 -8
- 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 +11 -6
- package/dist/es/logger/rollbar.js.map +1 -1
- package/dist/es/map/map.d.ts +79 -0
- package/dist/es/map/map.d.ts.map +1 -1
- package/dist/es/map/map.js +103 -26
- 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 +0 -2
- package/dist/es/repository/requester.d.ts.map +1 -1
- package/dist/es/repository/requester.js +24 -27
- 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 -0
- package/dist/es/sdk.js.map +1 -1
- 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 +589 -223
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/umd/index.js
CHANGED
|
@@ -5726,9 +5726,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
5726
5726
|
CountlyLogger: () => (/* reexport */ CountlyLogger),
|
|
5727
5727
|
DEFAULT_CACHE_CONFIGS: () => (/* reexport */ DEFAULT_CACHE_CONFIGS),
|
|
5728
5728
|
DEFAULT_MAX_STORAGE_BYTES: () => (/* reexport */ DEFAULT_MAX_STORAGE_BYTES),
|
|
5729
|
+
DEFAULT_TILE_CACHE_CONFIG: () => (/* reexport */ DEFAULT_TILE_CACHE_CONFIG),
|
|
5729
5730
|
FetchHttpClient: () => (/* reexport */ FetchHttpClient),
|
|
5730
5731
|
Institution: () => (/* reexport */ Institution),
|
|
5731
5732
|
LRUCache: () => (/* reexport */ LRUCache),
|
|
5733
|
+
MAPLIBRE_MAX_TILE_CACHE_HARD_CAP: () => (/* reexport */ MAPLIBRE_MAX_TILE_CACHE_HARD_CAP),
|
|
5732
5734
|
MAPVX_BRAND_COLOR: () => (/* reexport */ MAPVX_BRAND_COLOR),
|
|
5733
5735
|
MAPVX_DEFAULT_PRECONNECT_HOSTS: () => (/* reexport */ MAPVX_DEFAULT_PRECONNECT_HOSTS),
|
|
5734
5736
|
MVXPlace: () => (/* reexport */ place_MVXPlace),
|
|
@@ -6790,13 +6792,16 @@ var countly_default = /*#__PURE__*/__webpack_require__.n(countly);
|
|
|
6790
6792
|
var rollbar_umd_min = __webpack_require__(916);
|
|
6791
6793
|
var rollbar_umd_min_default = /*#__PURE__*/__webpack_require__.n(rollbar_umd_min);
|
|
6792
6794
|
;// ./src/logger/rollbar.ts
|
|
6793
|
-
// VERSION
|
|
6794
|
-
// bundle. The tsc-built ES/CJS outputs keep
|
|
6795
|
-
// typeof
|
|
6796
|
-
// replaced with the package version by
|
|
6797
|
-
|
|
6795
|
+
// VERSION and ROLLBAR_ACCESS_TOKEN are webpack DefinePlugin constants,
|
|
6796
|
+
// substituted only in the UMD bundle. The tsc-built ES/CJS outputs keep them
|
|
6797
|
+
// as bare globals, so the typeof guards make the lookup safe everywhere; the
|
|
6798
|
+
// version placeholder is replaced with the package version by
|
|
6799
|
+
// scripts/inject-build-defines.js. The access token falls back to the MapVX
|
|
6800
|
+
// SDK-web Rollbar project token when none is injected at build time.
|
|
6801
|
+
var SDK_VERSION = true ? "1.2.2" : 0;
|
|
6802
|
+
var ACCESS_TOKEN = false ? 0 : "28279d52df43411ebd138c2bee0ab1df";
|
|
6798
6803
|
var _rollbarConfig = {
|
|
6799
|
-
accessToken:
|
|
6804
|
+
accessToken: ACCESS_TOKEN,
|
|
6800
6805
|
// Only report what the SDK logs explicitly via logError. Capturing every
|
|
6801
6806
|
// uncaught error / unhandled rejection on the host page floods Rollbar
|
|
6802
6807
|
// with items from third-party code (e.g. Countly, the host app itself)
|
|
@@ -6832,17 +6837,20 @@ function logger_toPrimitive(t, r) { if ("object" != logger_typeof(t) || !t) retu
|
|
|
6832
6837
|
|
|
6833
6838
|
|
|
6834
6839
|
|
|
6840
|
+
// DEBUG, VERSION and COUNTLY_KEY are webpack DefinePlugin constants,
|
|
6841
|
+
// substituted only in the UMD bundle. The tsc-built ES/CJS outputs keep them
|
|
6842
|
+
// as bare globals, so reading them directly throws ReferenceError in
|
|
6843
|
+
// consumers of those builds. The typeof guards make the lookup safe
|
|
6844
|
+
// everywhere; the version placeholder is replaced with the package version
|
|
6845
|
+
// by scripts/inject-build-defines.js. The Countly key falls back to the
|
|
6846
|
+
// MapVX key when none is injected at build time.
|
|
6847
|
+
var IS_DEBUG = true ? false : 0;
|
|
6848
|
+
var logger_SDK_VERSION = true ? "1.2.2" : 0;
|
|
6849
|
+
var COUNTLY_API_KEY = false ? 0 : "f0c8d3b96d336e857a8628f49dd1baf7d7add0e9";
|
|
6835
6850
|
var logger_countly = {
|
|
6836
|
-
apiKey:
|
|
6851
|
+
apiKey: COUNTLY_API_KEY,
|
|
6837
6852
|
url: "https://countly.lazarillo.app"
|
|
6838
6853
|
};
|
|
6839
|
-
// DEBUG and VERSION are webpack DefinePlugin constants, substituted only in
|
|
6840
|
-
// the UMD bundle. The tsc-built ES/CJS outputs keep them as bare globals, so
|
|
6841
|
-
// reading them directly throws ReferenceError in consumers of those builds.
|
|
6842
|
-
// The typeof guards make the lookup safe everywhere; the version placeholder
|
|
6843
|
-
// is replaced with the package version by scripts/inject-build-defines.js.
|
|
6844
|
-
var IS_DEBUG = true ? false : 0;
|
|
6845
|
-
var logger_SDK_VERSION = true ? "1.2.1" : 0;
|
|
6846
6854
|
var Logger = /*#__PURE__*/function () {
|
|
6847
6855
|
function Logger() {
|
|
6848
6856
|
logger_classCallCheck(this, Logger);
|
|
@@ -7034,6 +7042,174 @@ var CountlyLogger = /*#__PURE__*/function () {
|
|
|
7034
7042
|
// EXTERNAL MODULE: ./node_modules/.pnpm/maplibre-gl@5.7.0/node_modules/maplibre-gl/dist/maplibre-gl.js
|
|
7035
7043
|
var maplibre_gl = __webpack_require__(997);
|
|
7036
7044
|
var maplibre_gl_default = /*#__PURE__*/__webpack_require__.n(maplibre_gl);
|
|
7045
|
+
;// ./src/utils/semaphore.ts
|
|
7046
|
+
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); }
|
|
7047
|
+
function semaphore_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7048
|
+
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); } }
|
|
7049
|
+
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; }
|
|
7050
|
+
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; }
|
|
7051
|
+
function semaphore_toPropertyKey(t) { var i = semaphore_toPrimitive(t, "string"); return "symbol" == semaphore_typeof(i) ? i : i + ""; }
|
|
7052
|
+
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); }
|
|
7053
|
+
/**
|
|
7054
|
+
* Lower bound (inclusive) for the semaphore concurrency limit.
|
|
7055
|
+
*
|
|
7056
|
+
* A value of 1 means at least one operation can run at a time, which keeps the
|
|
7057
|
+
* semaphore meaningful: zero or negative limits would deadlock every caller.
|
|
7058
|
+
*/
|
|
7059
|
+
var MIN_LIMIT = 1;
|
|
7060
|
+
|
|
7061
|
+
/**
|
|
7062
|
+
* Upper bound (inclusive) for the semaphore concurrency limit.
|
|
7063
|
+
*
|
|
7064
|
+
* 64 is high enough for any practical browser-side fan-out (network requests,
|
|
7065
|
+
* tile fetches, etc.) while still protecting downstream services from being
|
|
7066
|
+
* overwhelmed by misconfigured callers.
|
|
7067
|
+
*/
|
|
7068
|
+
var MAX_LIMIT = 64;
|
|
7069
|
+
|
|
7070
|
+
/**
|
|
7071
|
+
* Validate and normalize a candidate concurrency limit.
|
|
7072
|
+
*
|
|
7073
|
+
* @param limit - Candidate value to validate.
|
|
7074
|
+
* @returns The validated integer limit, or `null` if the value is invalid.
|
|
7075
|
+
*/
|
|
7076
|
+
function normalizeLimit(limit) {
|
|
7077
|
+
if (!Number.isFinite(limit)) return null;
|
|
7078
|
+
var floored = Math.floor(limit);
|
|
7079
|
+
if (floored < MIN_LIMIT || floored > MAX_LIMIT) return null;
|
|
7080
|
+
return floored;
|
|
7081
|
+
}
|
|
7082
|
+
|
|
7083
|
+
/**
|
|
7084
|
+
* Counting semaphore that caps the number of concurrent operations.
|
|
7085
|
+
*
|
|
7086
|
+
* Useful when calling APIs, CDNs, or other shared resources where unbounded
|
|
7087
|
+
* parallelism can trigger rate limiting, WAF blocks, or excessive memory use.
|
|
7088
|
+
* Waiters are released in FIFO order as slots become free.
|
|
7089
|
+
*
|
|
7090
|
+
* @example
|
|
7091
|
+
* ```typescript
|
|
7092
|
+
* const sem = new Semaphore(4);
|
|
7093
|
+
*
|
|
7094
|
+
* async function fetchTile(url: string) {
|
|
7095
|
+
* await sem.acquire();
|
|
7096
|
+
* try {
|
|
7097
|
+
* return await fetch(url);
|
|
7098
|
+
* } finally {
|
|
7099
|
+
* sem.release();
|
|
7100
|
+
* }
|
|
7101
|
+
* }
|
|
7102
|
+
* ```
|
|
7103
|
+
*
|
|
7104
|
+
* @group Utils
|
|
7105
|
+
*/
|
|
7106
|
+
var Semaphore = /*#__PURE__*/function () {
|
|
7107
|
+
/**
|
|
7108
|
+
* @param limit - Maximum number of concurrent slots. Must be a finite
|
|
7109
|
+
* integer in `[1, 64]`; invalid values fall back to `1`.
|
|
7110
|
+
*/
|
|
7111
|
+
function Semaphore() {
|
|
7112
|
+
var _normalizeLimit;
|
|
7113
|
+
var limit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MIN_LIMIT;
|
|
7114
|
+
semaphore_classCallCheck(this, Semaphore);
|
|
7115
|
+
semaphore_defineProperty(this, "waiters", []);
|
|
7116
|
+
semaphore_defineProperty(this, "slotsInUse", 0);
|
|
7117
|
+
this.slotLimit = (_normalizeLimit = normalizeLimit(limit)) !== null && _normalizeLimit !== void 0 ? _normalizeLimit : MIN_LIMIT;
|
|
7118
|
+
}
|
|
7119
|
+
|
|
7120
|
+
/**
|
|
7121
|
+
* Maximum number of slots that can be acquired concurrently.
|
|
7122
|
+
*/
|
|
7123
|
+
return semaphore_createClass(Semaphore, [{
|
|
7124
|
+
key: "limit",
|
|
7125
|
+
get: function get() {
|
|
7126
|
+
return this.slotLimit;
|
|
7127
|
+
}
|
|
7128
|
+
|
|
7129
|
+
/**
|
|
7130
|
+
* Number of slots currently held by callers (acquired but not released).
|
|
7131
|
+
*/
|
|
7132
|
+
}, {
|
|
7133
|
+
key: "inUse",
|
|
7134
|
+
get: function get() {
|
|
7135
|
+
return this.slotsInUse;
|
|
7136
|
+
}
|
|
7137
|
+
|
|
7138
|
+
/**
|
|
7139
|
+
* Number of callers currently waiting for a slot.
|
|
7140
|
+
*/
|
|
7141
|
+
}, {
|
|
7142
|
+
key: "waiting",
|
|
7143
|
+
get: function get() {
|
|
7144
|
+
return this.waiters.length;
|
|
7145
|
+
}
|
|
7146
|
+
|
|
7147
|
+
/**
|
|
7148
|
+
* Acquire one slot. Resolves immediately if a slot is free; otherwise waits
|
|
7149
|
+
* in FIFO order until `release()` is called.
|
|
7150
|
+
*
|
|
7151
|
+
* Every successful `acquire()` must be paired with exactly one `release()`,
|
|
7152
|
+
* typically from a `finally` block. If the promise rejects (e.g. the optional
|
|
7153
|
+
* `signal` aborts while queued) no slot was granted, so `release()` must NOT
|
|
7154
|
+
* be called.
|
|
7155
|
+
*
|
|
7156
|
+
* @param signal - Optional `AbortSignal`. If it aborts while the caller is
|
|
7157
|
+
* still queued, the waiter is removed from the queue and the promise rejects
|
|
7158
|
+
* with an `AbortError`, so cancelled work never occupies a slot.
|
|
7159
|
+
* @returns A promise that resolves once a slot has been granted.
|
|
7160
|
+
*/
|
|
7161
|
+
}, {
|
|
7162
|
+
key: "acquire",
|
|
7163
|
+
value: function acquire(signal) {
|
|
7164
|
+
var _this = this;
|
|
7165
|
+
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
7166
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
7167
|
+
}
|
|
7168
|
+
if (this.slotsInUse < this.slotLimit) {
|
|
7169
|
+
this.slotsInUse++;
|
|
7170
|
+
return Promise.resolve();
|
|
7171
|
+
}
|
|
7172
|
+
return new Promise(function (resolve, reject) {
|
|
7173
|
+
var waiter = function waiter() {
|
|
7174
|
+
_this.slotsInUse++;
|
|
7175
|
+
resolve();
|
|
7176
|
+
};
|
|
7177
|
+
_this.waiters.push(waiter);
|
|
7178
|
+
if (signal) {
|
|
7179
|
+
signal.addEventListener("abort", function () {
|
|
7180
|
+
var index = _this.waiters.indexOf(waiter);
|
|
7181
|
+
if (index !== -1) {
|
|
7182
|
+
_this.waiters.splice(index, 1);
|
|
7183
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
7184
|
+
}
|
|
7185
|
+
}, {
|
|
7186
|
+
once: true
|
|
7187
|
+
});
|
|
7188
|
+
}
|
|
7189
|
+
});
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
/**
|
|
7193
|
+
* Release one slot, waking the next FIFO waiter only when a slot was actually
|
|
7194
|
+
* freed.
|
|
7195
|
+
*
|
|
7196
|
+
* Safe to call even when no slots are in use: it is a true no-op in that case,
|
|
7197
|
+
* so cleanup code in `finally` blocks is defensive against double-releases and
|
|
7198
|
+
* a stray release can never admit a waiter beyond {@link limit}.
|
|
7199
|
+
*/
|
|
7200
|
+
}, {
|
|
7201
|
+
key: "release",
|
|
7202
|
+
value: function release() {
|
|
7203
|
+
if (this.slotsInUse > 0) {
|
|
7204
|
+
this.slotsInUse--;
|
|
7205
|
+
var next = this.waiters.shift();
|
|
7206
|
+
if (next) {
|
|
7207
|
+
next();
|
|
7208
|
+
}
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7211
|
+
}]);
|
|
7212
|
+
}();
|
|
7037
7213
|
;// ./src/assets/icons.ts
|
|
7038
7214
|
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";
|
|
7039
7215
|
|
|
@@ -7738,6 +7914,52 @@ var MarkerAttribute = /*#__PURE__*/function (_Marker) {
|
|
|
7738
7914
|
}
|
|
7739
7915
|
}]);
|
|
7740
7916
|
}(maplibre_gl.Marker);
|
|
7917
|
+
;// ./src/domain/models/routeInstance.ts
|
|
7918
|
+
/**
|
|
7919
|
+
* Represents the conditions for the step animation.
|
|
7920
|
+
* @group Routes
|
|
7921
|
+
*/
|
|
7922
|
+
|
|
7923
|
+
/**
|
|
7924
|
+
* Represents a single route instance on the map with its own
|
|
7925
|
+
* MapLibre sources/layers, GeoJSON data, animation state, and marker.
|
|
7926
|
+
* @group Routes
|
|
7927
|
+
*/
|
|
7928
|
+
|
|
7929
|
+
/**
|
|
7930
|
+
* Creates a new RouteInstance from a route.
|
|
7931
|
+
* Each instance gets unique MapLibre source/layer IDs based on the route's UUID.
|
|
7932
|
+
* @param route The route to create an instance for.
|
|
7933
|
+
* @returns A new RouteInstance with initialized GeoJSON data structures.
|
|
7934
|
+
* @group Routes
|
|
7935
|
+
*/
|
|
7936
|
+
function createRouteInstance(route) {
|
|
7937
|
+
return {
|
|
7938
|
+
id: route.id,
|
|
7939
|
+
route: route,
|
|
7940
|
+
aheadId: "AHEAD_".concat(route.id),
|
|
7941
|
+
behindId: "BEHIND_".concat(route.id),
|
|
7942
|
+
currentId: "CURRENT_".concat(route.id),
|
|
7943
|
+
aheadSourceData: {
|
|
7944
|
+
type: "FeatureCollection",
|
|
7945
|
+
features: []
|
|
7946
|
+
},
|
|
7947
|
+
behindSourceData: {
|
|
7948
|
+
type: "FeatureCollection",
|
|
7949
|
+
features: []
|
|
7950
|
+
},
|
|
7951
|
+
currentSourceData: {
|
|
7952
|
+
type: "Feature",
|
|
7953
|
+
properties: {},
|
|
7954
|
+
geometry: {
|
|
7955
|
+
type: "LineString",
|
|
7956
|
+
coordinates: []
|
|
7957
|
+
}
|
|
7958
|
+
},
|
|
7959
|
+
animationStatus: "NO_ROUTE",
|
|
7960
|
+
stepAnimationStatus: "NO_ROUTE"
|
|
7961
|
+
};
|
|
7962
|
+
}
|
|
7741
7963
|
;// ./src/utils/nav-functions.ts
|
|
7742
7964
|
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); }
|
|
7743
7965
|
function nav_functions_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -7917,52 +8139,6 @@ var NavFunctions = /*#__PURE__*/function () {
|
|
|
7917
8139
|
* The radius of the Earth in meters.
|
|
7918
8140
|
*/
|
|
7919
8141
|
nav_functions_defineProperty(NavFunctions, "EARTH_RADIUS", 6378000);
|
|
7920
|
-
;// ./src/domain/models/routeInstance.ts
|
|
7921
|
-
/**
|
|
7922
|
-
* Represents the conditions for the step animation.
|
|
7923
|
-
* @group Routes
|
|
7924
|
-
*/
|
|
7925
|
-
|
|
7926
|
-
/**
|
|
7927
|
-
* Represents a single route instance on the map with its own
|
|
7928
|
-
* MapLibre sources/layers, GeoJSON data, animation state, and marker.
|
|
7929
|
-
* @group Routes
|
|
7930
|
-
*/
|
|
7931
|
-
|
|
7932
|
-
/**
|
|
7933
|
-
* Creates a new RouteInstance from a route.
|
|
7934
|
-
* Each instance gets unique MapLibre source/layer IDs based on the route's UUID.
|
|
7935
|
-
* @param route The route to create an instance for.
|
|
7936
|
-
* @returns A new RouteInstance with initialized GeoJSON data structures.
|
|
7937
|
-
* @group Routes
|
|
7938
|
-
*/
|
|
7939
|
-
function createRouteInstance(route) {
|
|
7940
|
-
return {
|
|
7941
|
-
id: route.id,
|
|
7942
|
-
route: route,
|
|
7943
|
-
aheadId: "AHEAD_".concat(route.id),
|
|
7944
|
-
behindId: "BEHIND_".concat(route.id),
|
|
7945
|
-
currentId: "CURRENT_".concat(route.id),
|
|
7946
|
-
aheadSourceData: {
|
|
7947
|
-
type: "FeatureCollection",
|
|
7948
|
-
features: []
|
|
7949
|
-
},
|
|
7950
|
-
behindSourceData: {
|
|
7951
|
-
type: "FeatureCollection",
|
|
7952
|
-
features: []
|
|
7953
|
-
},
|
|
7954
|
-
currentSourceData: {
|
|
7955
|
-
type: "Feature",
|
|
7956
|
-
properties: {},
|
|
7957
|
-
geometry: {
|
|
7958
|
-
type: "LineString",
|
|
7959
|
-
coordinates: []
|
|
7960
|
-
}
|
|
7961
|
-
},
|
|
7962
|
-
animationStatus: "NO_ROUTE",
|
|
7963
|
-
stepAnimationStatus: "NO_ROUTE"
|
|
7964
|
-
};
|
|
7965
|
-
}
|
|
7966
8142
|
;// ./src/controllers/routeController.ts
|
|
7967
8143
|
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); }
|
|
7968
8144
|
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; }
|
|
@@ -9136,6 +9312,27 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
9136
9312
|
return;
|
|
9137
9313
|
}
|
|
9138
9314
|
}
|
|
9315
|
+
if (step.startInsideFloor !== step.endInsideFloor) {
|
|
9316
|
+
if (waitStartTime == null) {
|
|
9317
|
+
instance.conditions.waitStartTime = timestamp;
|
|
9318
|
+
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9319
|
+
return _this8.animateStep(time, instance);
|
|
9320
|
+
});
|
|
9321
|
+
return;
|
|
9322
|
+
}
|
|
9323
|
+
if (timestamp - waitStartTime < changeFloorTime * 1000) {
|
|
9324
|
+
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9325
|
+
return _this8.animateStep(time, instance);
|
|
9326
|
+
});
|
|
9327
|
+
return;
|
|
9328
|
+
} else {
|
|
9329
|
+
this.updatePlaceFloorForRouting(instance, step.endInsidePlace, step.endInsideFloor);
|
|
9330
|
+
this.setMarkerLngLat(instance, step.endLocation);
|
|
9331
|
+
instance.conditions.waitStartTime = undefined;
|
|
9332
|
+
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9333
|
+
return;
|
|
9334
|
+
}
|
|
9335
|
+
}
|
|
9139
9336
|
var distance = NavFunctions.distance(start, end);
|
|
9140
9337
|
var speed = Math.max(step.distance / stepTime, minimumSpeed !== null && minimumSpeed !== void 0 ? minimumSpeed : 0);
|
|
9141
9338
|
if (speed * progressInSeconds > distance) {
|
|
@@ -9161,26 +9358,6 @@ var RouteController = /*#__PURE__*/function () {
|
|
|
9161
9358
|
return _this8.animateStep(time, instance);
|
|
9162
9359
|
});
|
|
9163
9360
|
return;
|
|
9164
|
-
} else if (step.startInsideFloor !== step.endInsideFloor) {
|
|
9165
|
-
if (waitStartTime == null) {
|
|
9166
|
-
instance.conditions.waitStartTime = timestamp;
|
|
9167
|
-
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9168
|
-
return _this8.animateStep(time, instance);
|
|
9169
|
-
});
|
|
9170
|
-
return;
|
|
9171
|
-
}
|
|
9172
|
-
if (timestamp - waitStartTime < changeFloorTime * 1000) {
|
|
9173
|
-
instance.conditions.animationId = requestAnimationFrame(function (time) {
|
|
9174
|
-
return _this8.animateStep(time, instance);
|
|
9175
|
-
});
|
|
9176
|
-
return;
|
|
9177
|
-
} else {
|
|
9178
|
-
this.updatePlaceFloorForRouting(instance, step.endInsidePlace, step.endInsideFloor);
|
|
9179
|
-
this.setMarkerLngLat(instance, step.endLocation);
|
|
9180
|
-
instance.conditions.waitStartTime = undefined;
|
|
9181
|
-
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9182
|
-
return;
|
|
9183
|
-
}
|
|
9184
9361
|
} else {
|
|
9185
9362
|
onFinish === null || onFinish === void 0 || onFinish(timestamp);
|
|
9186
9363
|
return;
|
|
@@ -9566,7 +9743,8 @@ var Loggeable = /*#__PURE__*/function () {
|
|
|
9566
9743
|
* maxTiles: 500,
|
|
9567
9744
|
* ttlMs: 60 * 60 * 1000, // 1 hour
|
|
9568
9745
|
* persistToServiceWorker: true,
|
|
9569
|
-
* preloadAdjacentZooms: false
|
|
9746
|
+
* preloadAdjacentZooms: false,
|
|
9747
|
+
* maxConcurrentTileFetches: 6
|
|
9570
9748
|
* };
|
|
9571
9749
|
* ```
|
|
9572
9750
|
*
|
|
@@ -9583,9 +9761,19 @@ var DEFAULT_TILE_CACHE_CONFIG = {
|
|
|
9583
9761
|
ttlMs: 30 * 60 * 1000,
|
|
9584
9762
|
// 30 minutes
|
|
9585
9763
|
persistToServiceWorker: true,
|
|
9586
|
-
preloadAdjacentZooms: false
|
|
9764
|
+
preloadAdjacentZooms: false,
|
|
9765
|
+
maxConcurrentTileFetches: 6
|
|
9587
9766
|
};
|
|
9588
9767
|
|
|
9768
|
+
/**
|
|
9769
|
+
* Hard cap for {@link MapTileCacheConfig.maxTiles}.
|
|
9770
|
+
* Configurations above this (e.g. millions) are clamped to avoid memory pressure
|
|
9771
|
+
* and excessive interaction with the tile CDN / service worker.
|
|
9772
|
+
*
|
|
9773
|
+
* @internal
|
|
9774
|
+
*/
|
|
9775
|
+
var MAPLIBRE_MAX_TILE_CACHE_HARD_CAP = 100000;
|
|
9776
|
+
|
|
9589
9777
|
/**
|
|
9590
9778
|
* Basic configuration for the map.
|
|
9591
9779
|
* Provides essential settings for initializing and customizing map behavior.
|
|
@@ -9623,6 +9811,14 @@ var DEFAULT_TILE_CACHE_CONFIG = {
|
|
|
9623
9811
|
* @property showZoom - (Optional) Whether to display the zoom control.
|
|
9624
9812
|
* @property navigationPosition - (Optional) Position of the navigation controls on the map.
|
|
9625
9813
|
* @property bearingSnap - (Optional) The bearing snap threshold in degrees.
|
|
9814
|
+
* @property bearing - (Optional) Initial bearing (rotation) of the map in degrees, clockwise from north.
|
|
9815
|
+
* @property interactive - (Optional) Master switch for all user interaction (pan/zoom/rotate).
|
|
9816
|
+
* @property rotateEnabled - (Optional) Whether the user can rotate the map; keeps pinch-zoom when disabled.
|
|
9817
|
+
* @property dragPan - (Optional) Whether the user can pan by dragging/swiping.
|
|
9818
|
+
* @property scrollZoom - (Optional) Whether the scroll wheel/trackpad can zoom the map.
|
|
9819
|
+
* @property doubleClickZoom - (Optional) Whether double-click/double-tap zooms the map.
|
|
9820
|
+
* @property touchZoomRotate - (Optional) Whether pinch gestures can zoom the map on touch devices.
|
|
9821
|
+
* @property keyboard - (Optional) Whether keyboard shortcuts can pan/zoom/rotate the map.
|
|
9626
9822
|
* @property institutionId - (Optional) The institution identifier for map context. Required for loading map related data from Portal.
|
|
9627
9823
|
* @property authToken - (Optional) Authentication token for accessing protected map resources. Required for loading map related data from Portal.
|
|
9628
9824
|
* @property apiUrl - (Optional) Injected by SDK when creating map; base API URL for map requests.
|
|
@@ -11104,11 +11300,9 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11104
11300
|
// Ensure we have an absolute URL (required for new URL() in fetchFromUrl)
|
|
11105
11301
|
var withProtocol = apiUrl.startsWith("http://") || apiUrl.startsWith("https://") ? apiUrl : "https://".concat(apiUrl);
|
|
11106
11302
|
var cleanApiUrl = withProtocol.endsWith("/") ? withProtocol.slice(0, -1) : withProtocol;
|
|
11107
|
-
this.baseUrl = "".concat(cleanApiUrl, "/api/sdk/");
|
|
11108
|
-
this.baseUrlV2 = "".concat(cleanApiUrl, "/api/sdk/v2/");
|
|
11109
|
-
this.baseUrlApi = "".concat(cleanApiUrl, "/api/");
|
|
11303
|
+
this.baseUrl = "".concat(cleanApiUrl, "/api/sdk/v2/");
|
|
11110
11304
|
this.baseUrlPortal = "".concat(cleanApiUrl, "/api/portal/");
|
|
11111
|
-
this.baseUrlHealth = "https://api.mapvx.com/api/health
|
|
11305
|
+
this.baseUrlHealth = "https://api.mapvx.com/api/sdk/v2/health";
|
|
11112
11306
|
this.oldBaseUrl = "https://api.mapvx.com/api/sdk/";
|
|
11113
11307
|
this.routeBaseUrl = "https://api.mapvx.com/sdk/";
|
|
11114
11308
|
}
|
|
@@ -11201,11 +11395,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11201
11395
|
options = {
|
|
11202
11396
|
method: "GET",
|
|
11203
11397
|
headers: {
|
|
11204
|
-
"content-type": "application/json"
|
|
11398
|
+
"content-type": "application/json",
|
|
11399
|
+
Authorization: "Bearer ".concat(token)
|
|
11205
11400
|
}
|
|
11206
11401
|
};
|
|
11207
11402
|
params = {
|
|
11208
|
-
token: token,
|
|
11209
11403
|
stopId: stopId,
|
|
11210
11404
|
lang: this.lang
|
|
11211
11405
|
};
|
|
@@ -11237,11 +11431,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11237
11431
|
options = {
|
|
11238
11432
|
method: "GET",
|
|
11239
11433
|
headers: {
|
|
11240
|
-
"content-type": "application/json"
|
|
11434
|
+
"content-type": "application/json",
|
|
11435
|
+
Authorization: "Bearer ".concat(token)
|
|
11241
11436
|
}
|
|
11242
11437
|
};
|
|
11243
11438
|
params = {
|
|
11244
|
-
token: token,
|
|
11245
11439
|
stopId: stopId,
|
|
11246
11440
|
vehicleId: vehicleId,
|
|
11247
11441
|
lang: this.lang
|
|
@@ -11273,11 +11467,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11273
11467
|
options = {
|
|
11274
11468
|
method: "GET",
|
|
11275
11469
|
headers: {
|
|
11276
|
-
"content-type": "application/json"
|
|
11470
|
+
"content-type": "application/json",
|
|
11471
|
+
Authorization: "Bearer ".concat(token)
|
|
11277
11472
|
}
|
|
11278
11473
|
};
|
|
11279
11474
|
params = {
|
|
11280
|
-
token: token,
|
|
11281
11475
|
lang: this.lang
|
|
11282
11476
|
};
|
|
11283
11477
|
if (placeId != null) {
|
|
@@ -11350,11 +11544,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11350
11544
|
options = {
|
|
11351
11545
|
method: "GET",
|
|
11352
11546
|
headers: {
|
|
11353
|
-
"content-type": "application/json"
|
|
11547
|
+
"content-type": "application/json",
|
|
11548
|
+
Authorization: "Bearer ".concat(token)
|
|
11354
11549
|
}
|
|
11355
11550
|
};
|
|
11356
11551
|
params = {
|
|
11357
|
-
token: token,
|
|
11358
11552
|
lang: this.lang
|
|
11359
11553
|
};
|
|
11360
11554
|
return _context6.a(2, this.fetchFromUrl(this.baseUrl + "availablePlaces", params, options));
|
|
@@ -11423,11 +11617,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11423
11617
|
options = {
|
|
11424
11618
|
method: "GET",
|
|
11425
11619
|
headers: {
|
|
11426
|
-
"content-type": "application/json"
|
|
11620
|
+
"content-type": "application/json",
|
|
11621
|
+
Authorization: "Bearer ".concat(token)
|
|
11427
11622
|
}
|
|
11428
11623
|
};
|
|
11429
11624
|
params = {
|
|
11430
|
-
token: token,
|
|
11431
11625
|
place_id: placeId,
|
|
11432
11626
|
lang: this.lang
|
|
11433
11627
|
};
|
|
@@ -11497,11 +11691,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11497
11691
|
options = {
|
|
11498
11692
|
method: "GET",
|
|
11499
11693
|
headers: {
|
|
11500
|
-
"content-type": "application/json"
|
|
11694
|
+
"content-type": "application/json",
|
|
11695
|
+
Authorization: "Bearer ".concat(token)
|
|
11501
11696
|
}
|
|
11502
11697
|
};
|
|
11503
11698
|
params = {
|
|
11504
|
-
token: token,
|
|
11505
11699
|
targetPlace: targetPlaceId,
|
|
11506
11700
|
lang: this.lang
|
|
11507
11701
|
};
|
|
@@ -11572,7 +11766,8 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11572
11766
|
options = {
|
|
11573
11767
|
method: "GET",
|
|
11574
11768
|
headers: {
|
|
11575
|
-
"content-type": "application/json"
|
|
11769
|
+
"content-type": "application/json",
|
|
11770
|
+
Authorization: "Bearer ".concat(token)
|
|
11576
11771
|
}
|
|
11577
11772
|
};
|
|
11578
11773
|
params = {
|
|
@@ -11589,8 +11784,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11589
11784
|
announceFormat: routeConfig.announceFormat,
|
|
11590
11785
|
userBearing: 0,
|
|
11591
11786
|
lang: this.lang,
|
|
11592
|
-
unitSystem: routeConfig.unitSystem
|
|
11593
|
-
token: token
|
|
11787
|
+
unitSystem: routeConfig.unitSystem
|
|
11594
11788
|
};
|
|
11595
11789
|
if ("id" in routeConfig.initialLocation) {
|
|
11596
11790
|
params.fromPlaceId = routeConfig.initialLocation.id;
|
|
@@ -11647,7 +11841,8 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11647
11841
|
options = {
|
|
11648
11842
|
method: "GET",
|
|
11649
11843
|
headers: {
|
|
11650
|
-
"content-type": "application/json"
|
|
11844
|
+
"content-type": "application/json",
|
|
11845
|
+
Authorization: "Bearer ".concat(token)
|
|
11651
11846
|
}
|
|
11652
11847
|
};
|
|
11653
11848
|
params = {
|
|
@@ -11664,8 +11859,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11664
11859
|
announceFormat: routeConfig.announceFormat,
|
|
11665
11860
|
userBearing: 0,
|
|
11666
11861
|
lang: this.lang,
|
|
11667
|
-
unitSystem: routeConfig.unitSystem
|
|
11668
|
-
token: token
|
|
11862
|
+
unitSystem: routeConfig.unitSystem
|
|
11669
11863
|
};
|
|
11670
11864
|
if ("id" in routeConfig.initialLocation) {
|
|
11671
11865
|
params.fromPlaceId = routeConfig.initialLocation.id;
|
|
@@ -11724,11 +11918,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11724
11918
|
options = {
|
|
11725
11919
|
method: "GET",
|
|
11726
11920
|
headers: {
|
|
11727
|
-
"content-type": "application/json"
|
|
11921
|
+
"content-type": "application/json",
|
|
11922
|
+
Authorization: "Bearer ".concat(token)
|
|
11728
11923
|
}
|
|
11729
11924
|
};
|
|
11730
11925
|
params = {
|
|
11731
|
-
token: token,
|
|
11732
11926
|
lang: this.lang
|
|
11733
11927
|
};
|
|
11734
11928
|
return _context12.a(2, this.fetchFromUrl(this.baseUrl + "institution", params, options));
|
|
@@ -11764,14 +11958,14 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11764
11958
|
options = {
|
|
11765
11959
|
method: "GET",
|
|
11766
11960
|
headers: {
|
|
11767
|
-
"content-type": "application/json"
|
|
11961
|
+
"content-type": "application/json",
|
|
11962
|
+
Authorization: "Bearer ".concat(token)
|
|
11768
11963
|
}
|
|
11769
11964
|
};
|
|
11770
11965
|
params = {
|
|
11771
11966
|
institution_id: institutionId,
|
|
11772
11967
|
input: input,
|
|
11773
|
-
lang: this.lang
|
|
11774
|
-
token: token
|
|
11968
|
+
lang: this.lang
|
|
11775
11969
|
};
|
|
11776
11970
|
if (parentIds) {
|
|
11777
11971
|
params.parentPlaces = requester_toConsumableArray(parentIds);
|
|
@@ -11824,7 +12018,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11824
12018
|
return requester_regenerator().w(function (_context14) {
|
|
11825
12019
|
while (1) switch (_context14.n) {
|
|
11826
12020
|
case 0:
|
|
11827
|
-
// The v2
|
|
12021
|
+
// The v2 endpoints authenticate via the Authorization header (Bearer),
|
|
11828
12022
|
// not via a `token` query parameter like the legacy /api/sdk/* routes.
|
|
11829
12023
|
options = {
|
|
11830
12024
|
method: "GET",
|
|
@@ -11856,7 +12050,7 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11856
12050
|
if (floor) {
|
|
11857
12051
|
params.floor = floor;
|
|
11858
12052
|
}
|
|
11859
|
-
return _context14.a(2, this.fetchFromUrl(this.
|
|
12053
|
+
return _context14.a(2, this.fetchFromUrl(this.baseUrl + "searchPlacesByTags", params, options));
|
|
11860
12054
|
}
|
|
11861
12055
|
}, _callee14, this);
|
|
11862
12056
|
}));
|
|
@@ -11876,16 +12070,16 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11876
12070
|
options = {
|
|
11877
12071
|
method: "GET",
|
|
11878
12072
|
headers: {
|
|
11879
|
-
"content-type": "application/json"
|
|
12073
|
+
"content-type": "application/json",
|
|
12074
|
+
Authorization: "Bearer ".concat(token)
|
|
11880
12075
|
}
|
|
11881
12076
|
};
|
|
11882
12077
|
params = {
|
|
11883
|
-
token: token,
|
|
11884
12078
|
lang: this.lang
|
|
11885
12079
|
};
|
|
11886
12080
|
if (place_id) params.place_id = place_id;
|
|
11887
12081
|
if (product) params.product = product;
|
|
11888
|
-
return _context15.a(2, this.fetchFromUrl(this.
|
|
12082
|
+
return _context15.a(2, this.fetchFromUrl(this.baseUrl + "configuration", params, options));
|
|
11889
12083
|
}
|
|
11890
12084
|
}, _callee15, this);
|
|
11891
12085
|
}));
|
|
@@ -11905,15 +12099,15 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11905
12099
|
options = {
|
|
11906
12100
|
method: "GET",
|
|
11907
12101
|
headers: {
|
|
11908
|
-
"content-type": "application/json"
|
|
12102
|
+
"content-type": "application/json",
|
|
12103
|
+
Authorization: "Bearer ".concat(token)
|
|
11909
12104
|
}
|
|
11910
12105
|
};
|
|
11911
12106
|
params = {
|
|
11912
|
-
token: token,
|
|
11913
12107
|
lang: this.lang
|
|
11914
12108
|
};
|
|
11915
12109
|
if (place_id) params.id = place_id;
|
|
11916
|
-
return _context16.a(2, this.fetchFromUrl(this.
|
|
12110
|
+
return _context16.a(2, this.fetchFromUrl(this.baseUrl + "category", params, options));
|
|
11917
12111
|
}
|
|
11918
12112
|
}, _callee16, this);
|
|
11919
12113
|
}));
|
|
@@ -11933,11 +12127,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11933
12127
|
options = {
|
|
11934
12128
|
method: "GET",
|
|
11935
12129
|
headers: {
|
|
11936
|
-
"content-type": "application/json"
|
|
12130
|
+
"content-type": "application/json",
|
|
12131
|
+
Authorization: "Bearer ".concat(token)
|
|
11937
12132
|
}
|
|
11938
12133
|
};
|
|
11939
12134
|
params = {
|
|
11940
|
-
token: token,
|
|
11941
12135
|
placeId: parentPlaceId,
|
|
11942
12136
|
fromPlace: fromPlaceId,
|
|
11943
12137
|
announceFormat: announceFormat,
|
|
@@ -11965,11 +12159,11 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11965
12159
|
options = {
|
|
11966
12160
|
method: "GET",
|
|
11967
12161
|
headers: {
|
|
11968
|
-
"content-type": "application/json"
|
|
12162
|
+
"content-type": "application/json",
|
|
12163
|
+
Authorization: "Bearer ".concat(token)
|
|
11969
12164
|
}
|
|
11970
12165
|
};
|
|
11971
12166
|
params = {
|
|
11972
|
-
token: token,
|
|
11973
12167
|
placeId: placeId
|
|
11974
12168
|
};
|
|
11975
12169
|
return _context18.a(2, this.fetchFromUrl(this.routeBaseUrl + "cache_timestamp", params, options));
|
|
@@ -11992,14 +12186,14 @@ var Requester = /*#__PURE__*/function () {
|
|
|
11992
12186
|
options = {
|
|
11993
12187
|
method: "GET",
|
|
11994
12188
|
headers: {
|
|
11995
|
-
"content-type": "application/json"
|
|
12189
|
+
"content-type": "application/json",
|
|
12190
|
+
Authorization: "Bearer ".concat(token)
|
|
11996
12191
|
}
|
|
11997
12192
|
};
|
|
11998
12193
|
params = {
|
|
11999
|
-
token: token,
|
|
12000
12194
|
type: type
|
|
12001
12195
|
};
|
|
12002
|
-
return _context19.a(2, this.fetchFromUrl(this.
|
|
12196
|
+
return _context19.a(2, this.fetchFromUrl(this.baseUrl + "styles/customStyles", params, options));
|
|
12003
12197
|
}
|
|
12004
12198
|
}, _callee19, this);
|
|
12005
12199
|
}));
|
|
@@ -12022,14 +12216,13 @@ var Requester = /*#__PURE__*/function () {
|
|
|
12022
12216
|
totemId: totemId,
|
|
12023
12217
|
status: status
|
|
12024
12218
|
});
|
|
12025
|
-
params = {
|
|
12026
|
-
token: token
|
|
12027
|
-
};
|
|
12219
|
+
params = {};
|
|
12028
12220
|
options = {
|
|
12029
12221
|
method: "POST",
|
|
12030
12222
|
headers: {
|
|
12031
12223
|
accept: "application/json",
|
|
12032
|
-
"Content-Type": "application/json"
|
|
12224
|
+
"Content-Type": "application/json",
|
|
12225
|
+
Authorization: "Bearer ".concat(token)
|
|
12033
12226
|
},
|
|
12034
12227
|
body: requestData
|
|
12035
12228
|
};
|
|
@@ -12109,7 +12302,6 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12109
12302
|
_this.token = token;
|
|
12110
12303
|
_this.currentLang = lang;
|
|
12111
12304
|
_this.requester = new Requester(lang, apiUrl, mapvxRequestContext);
|
|
12112
|
-
_this.lang = lang;
|
|
12113
12305
|
_this.cache = cache !== null && cache !== void 0 ? cache : new CacheManager();
|
|
12114
12306
|
return _this;
|
|
12115
12307
|
}
|
|
@@ -12316,7 +12508,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12316
12508
|
while (1) switch (_context4.p = _context4.n) {
|
|
12317
12509
|
case 0:
|
|
12318
12510
|
_context4.p = 0;
|
|
12319
|
-
cachedPlace = this.cache.getPlace(placeId, this.
|
|
12511
|
+
cachedPlace = this.cache.getPlace(placeId, this.currentLang);
|
|
12320
12512
|
if (!(cachedPlace != null)) {
|
|
12321
12513
|
_context4.n = 1;
|
|
12322
12514
|
break;
|
|
@@ -12345,9 +12537,9 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12345
12537
|
case 5:
|
|
12346
12538
|
responseData = _context4.v;
|
|
12347
12539
|
place = new place_MVXPlace(responseData);
|
|
12348
|
-
this.cache.setPlace(place.mapvxId, place, this.
|
|
12540
|
+
this.cache.setPlace(place.mapvxId, place, this.currentLang);
|
|
12349
12541
|
if (place.clientId != null) {
|
|
12350
|
-
this.cache.setPlace(place.clientId, place, this.
|
|
12542
|
+
this.cache.setPlace(place.clientId, place, this.currentLang);
|
|
12351
12543
|
}
|
|
12352
12544
|
this.logEvent("fetchAndParsePlaceDetail", {
|
|
12353
12545
|
cached: "false"
|
|
@@ -12376,7 +12568,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12376
12568
|
while (1) switch (_context5.p = _context5.n) {
|
|
12377
12569
|
case 0:
|
|
12378
12570
|
_context5.p = 0;
|
|
12379
|
-
cachedPlace = this.cache.getPlace(placeId, this.
|
|
12571
|
+
cachedPlace = this.cache.getPlace(placeId, this.currentLang);
|
|
12380
12572
|
if (!(cachedPlace != null)) {
|
|
12381
12573
|
_context5.n = 1;
|
|
12382
12574
|
break;
|
|
@@ -12405,9 +12597,9 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12405
12597
|
case 5:
|
|
12406
12598
|
responseData = _context5.v;
|
|
12407
12599
|
place = new place_MVXPlace(responseData);
|
|
12408
|
-
this.cache.setPlace(place.mapvxId, place, this.
|
|
12600
|
+
this.cache.setPlace(place.mapvxId, place, this.currentLang);
|
|
12409
12601
|
if (place.clientId != null) {
|
|
12410
|
-
this.cache.setPlace(place.clientId, place, this.
|
|
12602
|
+
this.cache.setPlace(place.clientId, place, this.currentLang);
|
|
12411
12603
|
}
|
|
12412
12604
|
this.logEvent("fetchAndParseAnyPlaceDetail", {
|
|
12413
12605
|
cached: "false"
|
|
@@ -12532,11 +12724,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12532
12724
|
});
|
|
12533
12725
|
this.logEvent("fetchAndParseAnySubPlaces");
|
|
12534
12726
|
subPlaces.forEach(function (place) {
|
|
12535
|
-
if (!_this3.cache.hasPlace(place.mapvxId, _this3.
|
|
12536
|
-
_this3.cache.setPlace(place.mapvxId, place, _this3.
|
|
12727
|
+
if (!_this3.cache.hasPlace(place.mapvxId, _this3.currentLang)) {
|
|
12728
|
+
_this3.cache.setPlace(place.mapvxId, place, _this3.currentLang);
|
|
12537
12729
|
}
|
|
12538
|
-
if (place.clientId != null && !_this3.cache.hasPlace(place.clientId, _this3.
|
|
12539
|
-
_this3.cache.setPlace(place.clientId, place, _this3.
|
|
12730
|
+
if (place.clientId != null && !_this3.cache.hasPlace(place.clientId, _this3.currentLang)) {
|
|
12731
|
+
_this3.cache.setPlace(place.clientId, place, _this3.currentLang);
|
|
12540
12732
|
}
|
|
12541
12733
|
});
|
|
12542
12734
|
return _context7.a(2, subPlaces);
|
|
@@ -12587,11 +12779,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12587
12779
|
});
|
|
12588
12780
|
this.logEvent("fetchAndParseAvailablePlaces");
|
|
12589
12781
|
data.forEach(function (place) {
|
|
12590
|
-
if (!_this4.cache.hasPlace(place.mapvxId, _this4.
|
|
12591
|
-
_this4.cache.setPlace(place.mapvxId, place, _this4.
|
|
12782
|
+
if (!_this4.cache.hasPlace(place.mapvxId, _this4.currentLang)) {
|
|
12783
|
+
_this4.cache.setPlace(place.mapvxId, place, _this4.currentLang);
|
|
12592
12784
|
}
|
|
12593
|
-
if (place.clientId != null && !_this4.cache.hasPlace(place.clientId, _this4.
|
|
12594
|
-
_this4.cache.setPlace(place.clientId, place, _this4.
|
|
12785
|
+
if (place.clientId != null && !_this4.cache.hasPlace(place.clientId, _this4.currentLang)) {
|
|
12786
|
+
_this4.cache.setPlace(place.clientId, place, _this4.currentLang);
|
|
12595
12787
|
}
|
|
12596
12788
|
});
|
|
12597
12789
|
return _context8.a(2, data);
|
|
@@ -12645,11 +12837,11 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12645
12837
|
});
|
|
12646
12838
|
this.logEvent("fetchAndParsePlacesFromInstitution");
|
|
12647
12839
|
data.forEach(function (place) {
|
|
12648
|
-
if (!_this5.cache.hasPlace(place.mapvxId, _this5.
|
|
12649
|
-
_this5.cache.setPlace(place.mapvxId, place, _this5.
|
|
12840
|
+
if (!_this5.cache.hasPlace(place.mapvxId, _this5.currentLang)) {
|
|
12841
|
+
_this5.cache.setPlace(place.mapvxId, place, _this5.currentLang);
|
|
12650
12842
|
}
|
|
12651
|
-
if (place.clientId != null && !_this5.cache.hasPlace(place.clientId, _this5.
|
|
12652
|
-
_this5.cache.setPlace(place.clientId, place, _this5.
|
|
12843
|
+
if (place.clientId != null && !_this5.cache.hasPlace(place.clientId, _this5.currentLang)) {
|
|
12844
|
+
_this5.cache.setPlace(place.clientId, place, _this5.currentLang);
|
|
12653
12845
|
}
|
|
12654
12846
|
});
|
|
12655
12847
|
return _context9.a(2, data);
|
|
@@ -12676,7 +12868,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12676
12868
|
var _this6 = this;
|
|
12677
12869
|
var places = [];
|
|
12678
12870
|
ids.forEach(function (id) {
|
|
12679
|
-
var place = _this6.cache.getPlace(id, _this6.
|
|
12871
|
+
var place = _this6.cache.getPlace(id, _this6.currentLang);
|
|
12680
12872
|
if (place != null) {
|
|
12681
12873
|
places.push(place);
|
|
12682
12874
|
}
|
|
@@ -12825,8 +13017,8 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12825
13017
|
while (1) switch (_context10.p = _context10.n) {
|
|
12826
13018
|
case 0:
|
|
12827
13019
|
_context10.p = 0;
|
|
12828
|
-
cachedResponse = this.cache.getVehicle(stopId, this.
|
|
12829
|
-
if (!(cachedResponse != null && (Date.now() - cachedResponse.timestamp < 60 *
|
|
13020
|
+
cachedResponse = this.cache.getVehicle(stopId, this.currentLang);
|
|
13021
|
+
if (!(cachedResponse != null && (Date.now() - cachedResponse.timestamp < 60 * 1000 || cachedResponse.data.routes.length === 0))) {
|
|
12830
13022
|
_context10.n = 1;
|
|
12831
13023
|
break;
|
|
12832
13024
|
}
|
|
@@ -12877,7 +13069,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12877
13069
|
this.cache.setVehicle(stopId, {
|
|
12878
13070
|
timestamp: Date.now(),
|
|
12879
13071
|
data: transport
|
|
12880
|
-
}, this.
|
|
13072
|
+
}, this.currentLang);
|
|
12881
13073
|
this.logEvent("fetchAndParseTransport", {
|
|
12882
13074
|
cached: "false"
|
|
12883
13075
|
});
|
|
@@ -12885,7 +13077,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12885
13077
|
case 8:
|
|
12886
13078
|
_context10.p = 8;
|
|
12887
13079
|
_t10 = _context10.v;
|
|
12888
|
-
_cachedResponse = this.cache.getVehicle(stopId, this.
|
|
13080
|
+
_cachedResponse = this.cache.getVehicle(stopId, this.currentLang);
|
|
12889
13081
|
if (!(_cachedResponse != null)) {
|
|
12890
13082
|
_context10.n = 9;
|
|
12891
13083
|
break;
|
|
@@ -12919,7 +13111,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12919
13111
|
while (1) switch (_context11.p = _context11.n) {
|
|
12920
13112
|
case 0:
|
|
12921
13113
|
_context11.p = 0;
|
|
12922
|
-
cachedResponse = this.cache.getStops(stopId + vehicleId, this.
|
|
13114
|
+
cachedResponse = this.cache.getStops(stopId + vehicleId, this.currentLang);
|
|
12923
13115
|
if (!(cachedResponse != null && Date.now() - cachedResponse.timestamp < 60 * 1000)) {
|
|
12924
13116
|
_context11.n = 1;
|
|
12925
13117
|
break;
|
|
@@ -12956,7 +13148,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
|
|
|
12956
13148
|
this.cache.setStops(stopId + vehicleId, {
|
|
12957
13149
|
timestamp: Date.now(),
|
|
12958
13150
|
data: data
|
|
12959
|
-
}, this.
|
|
13151
|
+
}, this.currentLang);
|
|
12960
13152
|
this.logEvent("fetchAndParseStops", {
|
|
12961
13153
|
cached: "false"
|
|
12962
13154
|
});
|
|
@@ -13463,6 +13655,58 @@ function extractStepCoordinates(step) {
|
|
|
13463
13655
|
}
|
|
13464
13656
|
return coords;
|
|
13465
13657
|
}
|
|
13658
|
+
;// ./src/map/mapInteractionOptions.ts
|
|
13659
|
+
/**
|
|
13660
|
+
* Subset of MapLibre {@link MapOptions} that can be derived from the interaction
|
|
13661
|
+
* restriction flags on {@link MapConfig}.
|
|
13662
|
+
*
|
|
13663
|
+
* @internal
|
|
13664
|
+
*/
|
|
13665
|
+
|
|
13666
|
+
/**
|
|
13667
|
+
* Translates the interaction/rotation flags from {@link MapConfig} into the
|
|
13668
|
+
* matching MapLibre constructor options.
|
|
13669
|
+
*
|
|
13670
|
+
* Only keys that were explicitly provided are returned, so MapLibre's defaults
|
|
13671
|
+
* (every interaction enabled) are preserved for any flag left `undefined`. This
|
|
13672
|
+
* deliberately avoids writing `undefined` into the options object, which would
|
|
13673
|
+
* otherwise override MapLibre defaults with `NaN`/`undefined`.
|
|
13674
|
+
*
|
|
13675
|
+
* `rotateEnabled: false` disables drag- and pitch-rotation up front. Touch
|
|
13676
|
+
* rotation cannot be turned off via the constructor without also killing
|
|
13677
|
+
* pinch-to-zoom, so it is handled separately after construction — see
|
|
13678
|
+
* {@link shouldDisableTouchRotation}.
|
|
13679
|
+
*
|
|
13680
|
+
* @internal
|
|
13681
|
+
*/
|
|
13682
|
+
function buildInteractionOptions(mapConfig) {
|
|
13683
|
+
var options = {};
|
|
13684
|
+
if (mapConfig.bearing !== undefined) options.bearing = mapConfig.bearing;
|
|
13685
|
+
if (mapConfig.interactive !== undefined) options.interactive = mapConfig.interactive;
|
|
13686
|
+
if (mapConfig.dragPan !== undefined) options.dragPan = mapConfig.dragPan;
|
|
13687
|
+
if (mapConfig.scrollZoom !== undefined) options.scrollZoom = mapConfig.scrollZoom;
|
|
13688
|
+
if (mapConfig.doubleClickZoom !== undefined) options.doubleClickZoom = mapConfig.doubleClickZoom;
|
|
13689
|
+
if (mapConfig.touchZoomRotate !== undefined) options.touchZoomRotate = mapConfig.touchZoomRotate;
|
|
13690
|
+
if (mapConfig.keyboard !== undefined) options.keyboard = mapConfig.keyboard;
|
|
13691
|
+
if (mapConfig.rotateEnabled === false) {
|
|
13692
|
+
options.dragRotate = false;
|
|
13693
|
+
options.pitchWithRotate = false;
|
|
13694
|
+
}
|
|
13695
|
+
return options;
|
|
13696
|
+
}
|
|
13697
|
+
|
|
13698
|
+
/**
|
|
13699
|
+
* Whether two-finger touch rotation must be disabled after the map is created.
|
|
13700
|
+
*
|
|
13701
|
+
* `rotateEnabled: false` should keep pinch-to-zoom working, so the touch
|
|
13702
|
+
* rotation is disabled via `map.touchZoomRotate.disableRotation()` once the map
|
|
13703
|
+
* instance exists rather than through the constructor.
|
|
13704
|
+
*
|
|
13705
|
+
* @internal
|
|
13706
|
+
*/
|
|
13707
|
+
function shouldDisableTouchRotation(mapConfig) {
|
|
13708
|
+
return mapConfig.rotateEnabled === false;
|
|
13709
|
+
}
|
|
13466
13710
|
;// ./src/map/map.ts
|
|
13467
13711
|
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); }
|
|
13468
13712
|
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 }; })(); }
|
|
@@ -13496,6 +13740,8 @@ function map_defineProperty(e, r, t) { return (r = map_toPropertyKey(r)) in e ?
|
|
|
13496
13740
|
function map_toPropertyKey(t) { var i = map_toPrimitive(t, "string"); return "symbol" == map_typeof(i) ? i : i + ""; }
|
|
13497
13741
|
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); }
|
|
13498
13742
|
|
|
13743
|
+
|
|
13744
|
+
|
|
13499
13745
|
/** Shared GeoJSON source holding every circle drawn through the circle API. */
|
|
13500
13746
|
var CIRCLE_SOURCE_ID = "mapvx-circles";
|
|
13501
13747
|
/** Fill layer rendering the translucent interior of the circles. */
|
|
@@ -13549,23 +13795,40 @@ function deepClone(obj) {
|
|
|
13549
13795
|
/**
|
|
13550
13796
|
* Register a custom protocol for cached tiles that routes requests through the main thread.
|
|
13551
13797
|
* This allows the service worker to intercept and cache tile requests.
|
|
13798
|
+
*
|
|
13799
|
+
* Wraps fetches in a {@link Semaphore} so tile CDN / WAFs are not hit with
|
|
13800
|
+
* unbounded parallel requests (same host as the service worker cache). The
|
|
13801
|
+
* semaphore is created once with the limit from the first map's config; later
|
|
13802
|
+
* calls are no-ops because the protocol can only be registered once globally
|
|
13803
|
+
* on MapLibre.
|
|
13804
|
+
*
|
|
13805
|
+
* @param maxConcurrentFetches - Maximum number of in-flight tile fetches.
|
|
13552
13806
|
*/
|
|
13553
|
-
function registerCachedTileProtocol() {
|
|
13807
|
+
function registerCachedTileProtocol(maxConcurrentFetches) {
|
|
13554
13808
|
if (cachedTileProtocolRegistered) return;
|
|
13809
|
+
var semaphore = new Semaphore(maxConcurrentFetches);
|
|
13555
13810
|
maplibre_gl_default().addProtocol("cached-tile", function (params, abortController) {
|
|
13556
|
-
// Convert cached-tile:// URL back to https://
|
|
13557
13811
|
var url = params.url.replace("cached-tile://", "https://");
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
return
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
|
|
13812
|
+
|
|
13813
|
+
// Pass the abort signal to acquire() so a request cancelled while still
|
|
13814
|
+
// queued (e.g. during rapid zoom) drops out of the FIFO queue instead of
|
|
13815
|
+
// waiting for a slot just to bail. release() runs only inside this chain,
|
|
13816
|
+
// i.e. only after a slot was actually granted.
|
|
13817
|
+
return semaphore.acquire(abortController.signal).then(function () {
|
|
13818
|
+
return fetch(url, {
|
|
13819
|
+
signal: abortController.signal
|
|
13820
|
+
}).then(function (response) {
|
|
13821
|
+
if (!response.ok) {
|
|
13822
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
13823
|
+
}
|
|
13824
|
+
return response.arrayBuffer();
|
|
13825
|
+
}).then(function (data) {
|
|
13826
|
+
return {
|
|
13827
|
+
data: data
|
|
13828
|
+
};
|
|
13829
|
+
})["finally"](function () {
|
|
13830
|
+
semaphore.release();
|
|
13831
|
+
});
|
|
13569
13832
|
});
|
|
13570
13833
|
});
|
|
13571
13834
|
cachedTileProtocolRegistered = true;
|
|
@@ -13641,6 +13904,7 @@ function convertPaddingToPixels(padding, containerWidth, containerHeight) {
|
|
|
13641
13904
|
|
|
13642
13905
|
|
|
13643
13906
|
|
|
13907
|
+
|
|
13644
13908
|
/**
|
|
13645
13909
|
* @group Map
|
|
13646
13910
|
*/
|
|
@@ -13686,8 +13950,11 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13686
13950
|
_this.watchPositionID = undefined;
|
|
13687
13951
|
_this.onFloorChange = mapConfig.onFloorChange;
|
|
13688
13952
|
_this.onParentPlaceChange = mapConfig.onParentPlaceChange;
|
|
13689
|
-
|
|
13690
|
-
|
|
13953
|
+
_this.tileCacheConfig = function () {
|
|
13954
|
+
var merged = map_objectSpread(map_objectSpread({}, DEFAULT_TILE_CACHE_CONFIG), mapConfig.tileCache);
|
|
13955
|
+
merged.maxTiles = Math.min(merged.maxTiles, MAPLIBRE_MAX_TILE_CACHE_HARD_CAP);
|
|
13956
|
+
return merged;
|
|
13957
|
+
}();
|
|
13691
13958
|
if (mapConfig.parentPlaceId != null) {
|
|
13692
13959
|
_this.initialPlaceDetailSetUp(mapConfig.parentPlaceId, mapConfig.authToken);
|
|
13693
13960
|
}
|
|
@@ -13797,15 +14064,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13797
14064
|
_this6 = this;
|
|
13798
14065
|
// Determine if service worker caching should be enabled
|
|
13799
14066
|
var useServiceWorkerCaching = this.tileCacheConfig.enabled && this.tileCacheConfig.persistToServiceWorker;
|
|
13800
|
-
|
|
13801
|
-
// Register cached-tile protocol only if service worker caching is enabled
|
|
13802
14067
|
if (useServiceWorkerCaching) {
|
|
13803
|
-
registerCachedTileProtocol();
|
|
14068
|
+
registerCachedTileProtocol(this.tileCacheConfig.maxConcurrentTileFetches);
|
|
13804
14069
|
}
|
|
13805
14070
|
|
|
13806
14071
|
// Transform tile URLs only if service worker caching is enabled
|
|
13807
14072
|
var finalStyle = useServiceWorkerCaching ? this.transformStyleForCaching(style) : style;
|
|
13808
|
-
var mapOptions = {
|
|
14073
|
+
var mapOptions = map_objectSpread({
|
|
13809
14074
|
container: container,
|
|
13810
14075
|
style: finalStyle,
|
|
13811
14076
|
center: mapConfig.center,
|
|
@@ -13814,10 +14079,10 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13814
14079
|
attributionControl: false,
|
|
13815
14080
|
maplibreLogo: false,
|
|
13816
14081
|
bearingSnap: (_mapConfig$bearingSna = mapConfig.bearingSnap) !== null && _mapConfig$bearingSna !== void 0 ? _mapConfig$bearingSna : 0,
|
|
13817
|
-
cancelPendingTileRequestsWhileZooming:
|
|
14082
|
+
cancelPendingTileRequestsWhileZooming: true,
|
|
13818
14083
|
// Use configured maxTiles for MapLibre's memory cache
|
|
13819
14084
|
maxTileCacheSize: this.tileCacheConfig.maxTiles
|
|
13820
|
-
};
|
|
14085
|
+
}, buildInteractionOptions(mapConfig));
|
|
13821
14086
|
if (mapConfig.maxZoom) mapOptions.maxZoom = mapConfig.maxZoom;
|
|
13822
14087
|
if (mapConfig.minZoom) mapOptions.minZoom = mapConfig.minZoom;
|
|
13823
14088
|
if (mapConfig.maxBounds && mapConfig.maxBounds.length > 1) {
|
|
@@ -13825,6 +14090,12 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
13825
14090
|
mapOptions.maxBounds = new maplibre_gl.LngLatBounds([boundingBox[0].lng, boundingBox[0].lat], [boundingBox[1].lng, boundingBox[1].lat]);
|
|
13826
14091
|
}
|
|
13827
14092
|
this.map = new maplibre_gl.Map(mapOptions);
|
|
14093
|
+
// When rotation is disabled we still want pinch-to-zoom to work, so the
|
|
14094
|
+
// two-finger rotation is turned off here instead of via the constructor.
|
|
14095
|
+
if (shouldDisableTouchRotation(mapConfig)) {
|
|
14096
|
+
var _this$map$touchZoomRo, _this$map$touchZoomRo2;
|
|
14097
|
+
(_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);
|
|
14098
|
+
}
|
|
13828
14099
|
this.map.addControl(new maplibre_gl.NavigationControl({
|
|
13829
14100
|
showCompass: mapConfig.showCompass !== undefined ? mapConfig.showCompass : true,
|
|
13830
14101
|
showZoom: mapConfig.showZoom !== undefined ? mapConfig.showZoom : true
|
|
@@ -14048,7 +14319,22 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14048
14319
|
}, {
|
|
14049
14320
|
key: "setLang",
|
|
14050
14321
|
value: function setLang(lang) {
|
|
14322
|
+
var _this0 = this;
|
|
14051
14323
|
this.repository.setLang(lang);
|
|
14324
|
+
if (rtlLanguages.includes(lang)) {
|
|
14325
|
+
this.setRTLSupport();
|
|
14326
|
+
}
|
|
14327
|
+
// setLayersForLanguage reads this.map.getStyle()?.layers, which is empty
|
|
14328
|
+
// until the style finishes loading. If setLang is called right after
|
|
14329
|
+
// createMap (before the "load" event), apply it once the style is ready
|
|
14330
|
+
// so the language change is not silently dropped.
|
|
14331
|
+
if (this.map.isStyleLoaded()) {
|
|
14332
|
+
this.setLayersForLanguage(lang);
|
|
14333
|
+
} else {
|
|
14334
|
+
this.map.once("load", function () {
|
|
14335
|
+
return _this0.setLayersForLanguage(lang);
|
|
14336
|
+
});
|
|
14337
|
+
}
|
|
14052
14338
|
}
|
|
14053
14339
|
}, {
|
|
14054
14340
|
key: "setParentPlace",
|
|
@@ -14083,7 +14369,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14083
14369
|
}, {
|
|
14084
14370
|
key: "addMarker",
|
|
14085
14371
|
value: function addMarker(marker) {
|
|
14086
|
-
var
|
|
14372
|
+
var _this1 = this;
|
|
14087
14373
|
try {
|
|
14088
14374
|
var _this$innerFloors$fin4, _this$innerFloors$fin5;
|
|
14089
14375
|
// Check if a marker with the same ID already exists and remove it
|
|
@@ -14103,7 +14389,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14103
14389
|
}
|
|
14104
14390
|
var markerCreated = new MarkerAttribute(marker);
|
|
14105
14391
|
var isOutdoor = !this.parentPlace || ((_this$innerFloors$fin4 = (_this$innerFloors$fin5 = this.innerFloors.find(function (floor) {
|
|
14106
|
-
return floor.key ===
|
|
14392
|
+
return floor.key === _this1.currentFloor;
|
|
14107
14393
|
})) === null || _this$innerFloors$fin5 === void 0 ? void 0 : _this$innerFloors$fin5.reachableFromGPS) !== null && _this$innerFloors$fin4 !== void 0 ? _this$innerFloors$fin4 : false);
|
|
14108
14394
|
markerCreated.changeFloor(this.currentFloor, this.map, isOutdoor);
|
|
14109
14395
|
this.markers.push(markerCreated);
|
|
@@ -14499,11 +14785,18 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14499
14785
|
// Always keep the default bucket alive so an empty map still renders
|
|
14500
14786
|
// newly added circles without a layer rebuild
|
|
14501
14787
|
ordersInUse.add("aboveBasemap");
|
|
14502
|
-
|
|
14788
|
+
|
|
14789
|
+
// Process buckets lowest-first (CIRCLE_RENDER_ORDERS is canonical):
|
|
14790
|
+
// when two buckets resolve to the same anchor, each addLayer/moveLayer
|
|
14791
|
+
// lands immediately before it, so a bucket processed later paints above
|
|
14792
|
+
// the ones processed earlier. Canonical order keeps
|
|
14793
|
+
// belowLabels < aboveBasemap < top regardless of circle insertion order.
|
|
14794
|
+
var _iterator = map_createForOfIteratorHelper(CIRCLE_RENDER_ORDERS),
|
|
14503
14795
|
_step;
|
|
14504
14796
|
try {
|
|
14505
14797
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
14506
14798
|
var order = _step.value;
|
|
14799
|
+
if (!ordersInUse.has(order)) continue;
|
|
14507
14800
|
var ids = circleLayerIdsFor(order);
|
|
14508
14801
|
var beforeId = this.circleBeforeIdFor(order);
|
|
14509
14802
|
var orderFilter = ["==", ["get", "renderOrder"], order];
|
|
@@ -14600,12 +14893,12 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14600
14893
|
value: function updateMarkersTo(floorId) {
|
|
14601
14894
|
var _this$innerFloors$fin8,
|
|
14602
14895
|
_this$innerFloors$fin9,
|
|
14603
|
-
|
|
14896
|
+
_this10 = this;
|
|
14604
14897
|
var isOutdoor = !this.parentPlace || ((_this$innerFloors$fin8 = (_this$innerFloors$fin9 = this.innerFloors.find(function (floor) {
|
|
14605
14898
|
return floor.key === floorId;
|
|
14606
14899
|
})) === null || _this$innerFloors$fin9 === void 0 ? void 0 : _this$innerFloors$fin9.reachableFromGPS) !== null && _this$innerFloors$fin8 !== void 0 ? _this$innerFloors$fin8 : false);
|
|
14607
14900
|
this.markers.forEach(function (e) {
|
|
14608
|
-
e.changeFloor(floorId,
|
|
14901
|
+
e.changeFloor(floorId, _this10.map, isOutdoor);
|
|
14609
14902
|
});
|
|
14610
14903
|
}
|
|
14611
14904
|
}, {
|
|
@@ -14613,14 +14906,14 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14613
14906
|
value: function updateFiltersTo(floorId) {
|
|
14614
14907
|
var _this$map$getStyle$la3,
|
|
14615
14908
|
_this$map$getStyle3,
|
|
14616
|
-
|
|
14909
|
+
_this11 = this,
|
|
14617
14910
|
_this$innerFloors$fin0;
|
|
14618
14911
|
if (!this.map) return;
|
|
14619
14912
|
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 : [];
|
|
14620
14913
|
layers.filter(function (l) {
|
|
14621
14914
|
return l.id.startsWith("base-indoor-");
|
|
14622
14915
|
}).forEach(function (l) {
|
|
14623
|
-
|
|
14916
|
+
_this11.map.removeLayer(l.id);
|
|
14624
14917
|
});
|
|
14625
14918
|
var baseFloorId = (_this$innerFloors$fin0 = this.innerFloors.find(function (floor) {
|
|
14626
14919
|
return floor.key === floorId;
|
|
@@ -14636,13 +14929,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14636
14929
|
}).forEach(function (layer) {
|
|
14637
14930
|
var baseLayer = deepClone(layer);
|
|
14638
14931
|
baseLayer.id = "base-" + layer.id;
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14932
|
+
_this11.baseFilters[baseLayer.id] = _this11.baseFilters[layer.id];
|
|
14933
|
+
_this11.map.addLayer(baseLayer, firstLayerId);
|
|
14934
|
+
_this11.applyLayerFilters(baseLayer, baseFloorId);
|
|
14642
14935
|
});
|
|
14643
14936
|
}
|
|
14644
14937
|
indoorLayers.forEach(function (layer) {
|
|
14645
|
-
|
|
14938
|
+
_this11.applyLayerFilters(layer, floorId);
|
|
14646
14939
|
});
|
|
14647
14940
|
}
|
|
14648
14941
|
}, {
|
|
@@ -14702,6 +14995,57 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14702
14995
|
this.map.setMinZoom(zoomLvl);
|
|
14703
14996
|
options === null || options === void 0 || (_options$onComplete3 = options.onComplete) === null || _options$onComplete3 === void 0 || _options$onComplete3.call(options);
|
|
14704
14997
|
}
|
|
14998
|
+
}, {
|
|
14999
|
+
key: "setBearing",
|
|
15000
|
+
value: function setBearing(degrees, options) {
|
|
15001
|
+
var _options$onComplete4;
|
|
15002
|
+
if (!Number.isFinite(degrees)) return;
|
|
15003
|
+
if (options !== null && options !== void 0 && options.animate) {
|
|
15004
|
+
if (options.onComplete) void this.map.once("moveend", options.onComplete);
|
|
15005
|
+
this.map.rotateTo(degrees, {
|
|
15006
|
+
duration: 600
|
|
15007
|
+
});
|
|
15008
|
+
return;
|
|
15009
|
+
}
|
|
15010
|
+
this.map.setBearing(degrees);
|
|
15011
|
+
options === null || options === void 0 || (_options$onComplete4 = options.onComplete) === null || _options$onComplete4 === void 0 || _options$onComplete4.call(options);
|
|
15012
|
+
}
|
|
15013
|
+
}, {
|
|
15014
|
+
key: "setRotationEnabled",
|
|
15015
|
+
value: function setRotationEnabled(enabled) {
|
|
15016
|
+
if (enabled) {
|
|
15017
|
+
var _this$map$dragRotate, _this$map$dragRotate$, _this$map$touchZoomRo3, _this$map$touchZoomRo4, _this$map$keyboard, _this$map$keyboard$en;
|
|
15018
|
+
(_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);
|
|
15019
|
+
(_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);
|
|
15020
|
+
(_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);
|
|
15021
|
+
} else {
|
|
15022
|
+
var _this$map$dragRotate2, _this$map$dragRotate3, _this$map$touchZoomRo5, _this$map$touchZoomRo6;
|
|
15023
|
+
(_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);
|
|
15024
|
+
(_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);
|
|
15025
|
+
}
|
|
15026
|
+
}
|
|
15027
|
+
}, {
|
|
15028
|
+
key: "setPanEnabled",
|
|
15029
|
+
value: function setPanEnabled(enabled) {
|
|
15030
|
+
if (enabled) {
|
|
15031
|
+
var _this$map$dragPan, _this$map$dragPan$ena;
|
|
15032
|
+
(_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);
|
|
15033
|
+
} else {
|
|
15034
|
+
var _this$map$dragPan2, _this$map$dragPan2$di;
|
|
15035
|
+
(_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);
|
|
15036
|
+
}
|
|
15037
|
+
}
|
|
15038
|
+
}, {
|
|
15039
|
+
key: "setScrollZoomEnabled",
|
|
15040
|
+
value: function setScrollZoomEnabled(enabled) {
|
|
15041
|
+
if (enabled) {
|
|
15042
|
+
var _this$map$scrollZoom, _this$map$scrollZoom$;
|
|
15043
|
+
(_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);
|
|
15044
|
+
} else {
|
|
15045
|
+
var _this$map$scrollZoom2, _this$map$scrollZoom3;
|
|
15046
|
+
(_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);
|
|
15047
|
+
}
|
|
15048
|
+
}
|
|
14705
15049
|
}, {
|
|
14706
15050
|
key: "isInsideBounds",
|
|
14707
15051
|
value: function isInsideBounds(point) {
|
|
@@ -14714,12 +15058,12 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14714
15058
|
}, {
|
|
14715
15059
|
key: "setMaxBounds",
|
|
14716
15060
|
value: function setMaxBounds(coordinates, options) {
|
|
14717
|
-
var _options$
|
|
15061
|
+
var _options$onComplete5;
|
|
14718
15062
|
if (coordinates.length > 1) {
|
|
14719
15063
|
var boundingBox = getBoundingBox(coordinates);
|
|
14720
15064
|
this.map.setMaxBounds(new maplibre_gl.LngLatBounds([boundingBox[0].lng, boundingBox[0].lat], [boundingBox[1].lng, boundingBox[1].lat]));
|
|
14721
15065
|
}
|
|
14722
|
-
options === null || options === void 0 || (_options$
|
|
15066
|
+
options === null || options === void 0 || (_options$onComplete5 = options.onComplete) === null || _options$onComplete5 === void 0 || _options$onComplete5.call(options);
|
|
14723
15067
|
}
|
|
14724
15068
|
}, {
|
|
14725
15069
|
key: "fitCoordinates",
|
|
@@ -14810,13 +15154,13 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14810
15154
|
key: "updateFloor",
|
|
14811
15155
|
value: function updateFloor(floorId, options) {
|
|
14812
15156
|
try {
|
|
14813
|
-
var _this$onFloorChange2, _options$
|
|
15157
|
+
var _this$onFloorChange2, _options$onComplete6;
|
|
14814
15158
|
this.filterByFloorKey(floorId);
|
|
14815
15159
|
(_this$onFloorChange2 = this.onFloorChange) === null || _this$onFloorChange2 === void 0 || _this$onFloorChange2.call(this, floorId);
|
|
14816
15160
|
this.logEvent("updateFloor", {
|
|
14817
15161
|
floorId: floorId
|
|
14818
15162
|
});
|
|
14819
|
-
options === null || options === void 0 || (_options$
|
|
15163
|
+
options === null || options === void 0 || (_options$onComplete6 = options.onComplete) === null || _options$onComplete6 === void 0 || _options$onComplete6.call(options);
|
|
14820
15164
|
} catch (error) {
|
|
14821
15165
|
// Floor update may fail
|
|
14822
15166
|
}
|
|
@@ -14935,7 +15279,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14935
15279
|
return subplace.clientId === placeId || subplace.mapvxId === placeId;
|
|
14936
15280
|
});
|
|
14937
15281
|
if (pointedPlace !== undefined) {
|
|
14938
|
-
new (maplibre_gl_default()).Popup().setLngLat(pointedPlace.position).
|
|
15282
|
+
new (maplibre_gl_default()).Popup().setLngLat(pointedPlace.position).setText(pointedPlace.title).addTo(this.map);
|
|
14939
15283
|
}
|
|
14940
15284
|
}
|
|
14941
15285
|
return "";
|
|
@@ -14960,17 +15304,17 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14960
15304
|
}, {
|
|
14961
15305
|
key: "defaultClickListener",
|
|
14962
15306
|
value: function defaultClickListener() {
|
|
14963
|
-
var
|
|
15307
|
+
var _this12 = this;
|
|
14964
15308
|
this.map.on("click", /*#__PURE__*/function () {
|
|
14965
15309
|
var _ref4 = map_asyncToGenerator(/*#__PURE__*/map_regenerator().m(function _callee2(e) {
|
|
14966
15310
|
var features, roomFeatures, touchedFeature, ref, _clickedPlace, _ref5, _clickedPlace$mapvxId, _clickedPlace2, _clickedPlace3, clickedPlace, _iterator3, _step3, potentialParentPlace, cachedSubPlaces, cachedPlaces, clickedPlaceId, _t2;
|
|
14967
15311
|
return map_regenerator().w(function (_context2) {
|
|
14968
15312
|
while (1) switch (_context2.p = _context2.n) {
|
|
14969
15313
|
case 0:
|
|
14970
|
-
features =
|
|
15314
|
+
features = _this12.map.queryRenderedFeatures(e.point); // Filter room features by current floor
|
|
14971
15315
|
roomFeatures = features.filter(function (feature) {
|
|
14972
15316
|
var _feature$properties;
|
|
14973
|
-
return feature.properties["class"] === "room" && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) ===
|
|
15317
|
+
return feature.properties["class"] === "room" && ((_feature$properties = feature.properties) === null || _feature$properties === void 0 ? void 0 : _feature$properties.floor_key) === _this12.currentFloor;
|
|
14974
15318
|
});
|
|
14975
15319
|
touchedFeature = roomFeatures[0];
|
|
14976
15320
|
ref = touchedFeature === null || touchedFeature === void 0 ? void 0 : touchedFeature.properties.ref;
|
|
@@ -14981,14 +15325,14 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14981
15325
|
console.log("touchedFeature", ref);
|
|
14982
15326
|
|
|
14983
15327
|
// First, search in current subPlaces
|
|
14984
|
-
clickedPlace =
|
|
15328
|
+
clickedPlace = _this12.subPlaces.find(function (subPlace) {
|
|
14985
15329
|
return subPlace.mapvxId === ref;
|
|
14986
15330
|
}); // If not found, search in subplaces of potential parent places
|
|
14987
15331
|
if (!(clickedPlace === undefined)) {
|
|
14988
15332
|
_context2.n = 7;
|
|
14989
15333
|
break;
|
|
14990
15334
|
}
|
|
14991
|
-
_iterator3 = map_createForOfIteratorHelper(
|
|
15335
|
+
_iterator3 = map_createForOfIteratorHelper(_this12.potentialParentPlaces);
|
|
14992
15336
|
_context2.p = 1;
|
|
14993
15337
|
_iterator3.s();
|
|
14994
15338
|
case 2:
|
|
@@ -14997,7 +15341,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
14997
15341
|
break;
|
|
14998
15342
|
}
|
|
14999
15343
|
potentialParentPlace = _step3.value;
|
|
15000
|
-
cachedSubPlaces =
|
|
15344
|
+
cachedSubPlaces = _this12.repository.getCachedSubPlaces(potentialParentPlace.mapvxId);
|
|
15001
15345
|
if (!cachedSubPlaces) {
|
|
15002
15346
|
_context2.n = 3;
|
|
15003
15347
|
break;
|
|
@@ -15029,14 +15373,14 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15029
15373
|
_context2.n = 10;
|
|
15030
15374
|
break;
|
|
15031
15375
|
}
|
|
15032
|
-
cachedPlaces =
|
|
15376
|
+
cachedPlaces = _this12.repository.getCachedPlaces([ref]);
|
|
15033
15377
|
if (!(cachedPlaces.length === 0)) {
|
|
15034
15378
|
_context2.n = 9;
|
|
15035
15379
|
break;
|
|
15036
15380
|
}
|
|
15037
15381
|
console.log("fetching place detail from server", ref);
|
|
15038
15382
|
_context2.n = 8;
|
|
15039
|
-
return
|
|
15383
|
+
return _this12.repository.fetchAndParsePlaceDetail(ref);
|
|
15040
15384
|
case 8:
|
|
15041
15385
|
clickedPlace = _context2.v;
|
|
15042
15386
|
_context2.n = 10;
|
|
@@ -15047,8 +15391,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15047
15391
|
case 10:
|
|
15048
15392
|
console.log("clickedPlace", (_clickedPlace = clickedPlace) === null || _clickedPlace === void 0 ? void 0 : _clickedPlace.title);
|
|
15049
15393
|
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 : "";
|
|
15050
|
-
if (clickedPlace !== undefined &&
|
|
15051
|
-
|
|
15394
|
+
if (clickedPlace !== undefined && _this12.clickCallback) {
|
|
15395
|
+
_this12.clickCallback(clickedPlaceId);
|
|
15052
15396
|
}
|
|
15053
15397
|
case 11:
|
|
15054
15398
|
return _context2.a(2);
|
|
@@ -15063,29 +15407,29 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15063
15407
|
}, {
|
|
15064
15408
|
key: "onHover",
|
|
15065
15409
|
value: function onHover() {
|
|
15066
|
-
var
|
|
15410
|
+
var _this13 = this;
|
|
15067
15411
|
if (!this.enableHover) return;
|
|
15068
15412
|
this.map.on("mousemove", "hoverable", function (e) {
|
|
15069
15413
|
var _e$features;
|
|
15070
15414
|
var feature = (_e$features = e.features) === null || _e$features === void 0 ? void 0 : _e$features.find(function (feature) {
|
|
15071
15415
|
var _feature$properties$r, _feature$properties2;
|
|
15072
|
-
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) ===
|
|
15416
|
+
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;
|
|
15073
15417
|
});
|
|
15074
15418
|
var ref = feature === null || feature === void 0 ? void 0 : feature.properties.ref;
|
|
15075
15419
|
if (ref != null && typeof ref === "string" && ref.length > 0) {
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
} else if (ref === undefined &&
|
|
15079
|
-
|
|
15080
|
-
|
|
15420
|
+
_this13.hoveredId = ref;
|
|
15421
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
15422
|
+
} else if (ref === undefined && _this13.hoveredId !== "unselected") {
|
|
15423
|
+
_this13.hoveredId = "unselected";
|
|
15424
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
15081
15425
|
}
|
|
15082
15426
|
});
|
|
15083
15427
|
|
|
15084
15428
|
// When the mouse leaves the state-fill layer, update the feature state of the
|
|
15085
15429
|
// previously hovered feature.
|
|
15086
15430
|
this.map.on("mouseleave", "hoverable", function () {
|
|
15087
|
-
|
|
15088
|
-
|
|
15431
|
+
_this13.hoveredId = "unselected";
|
|
15432
|
+
_this13.updateFiltersTo(_this13.currentFloor);
|
|
15089
15433
|
});
|
|
15090
15434
|
}
|
|
15091
15435
|
}, {
|
|
@@ -15567,7 +15911,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15567
15911
|
key: "onWebGLContextLost",
|
|
15568
15912
|
value: function onWebGLContextLost(e) {
|
|
15569
15913
|
var _this$map,
|
|
15570
|
-
|
|
15914
|
+
_this14 = this;
|
|
15571
15915
|
e.originalEvent.preventDefault();
|
|
15572
15916
|
console.warn("Contexto WebGL perdido 😢");
|
|
15573
15917
|
|
|
@@ -15578,8 +15922,8 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15578
15922
|
var _ext$restoreContext;
|
|
15579
15923
|
canvas.addEventListener("webglcontextrestored", function () {
|
|
15580
15924
|
console.debug("Contexto WebGL restaurado, forzando re-render");
|
|
15581
|
-
|
|
15582
|
-
|
|
15925
|
+
_this14.map.triggerRepaint(); // forzar repaint
|
|
15926
|
+
_this14.failedTiles.clear();
|
|
15583
15927
|
}, {
|
|
15584
15928
|
once: true
|
|
15585
15929
|
});
|
|
@@ -15619,7 +15963,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15619
15963
|
}, {
|
|
15620
15964
|
key: "subscribeToFailedTiles",
|
|
15621
15965
|
value: function subscribeToFailedTiles() {
|
|
15622
|
-
var
|
|
15966
|
+
var _this15 = this;
|
|
15623
15967
|
if (this.retryTimer) return;
|
|
15624
15968
|
|
|
15625
15969
|
// Store bound functions for proper cleanup
|
|
@@ -15628,20 +15972,20 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15628
15972
|
this.boundOnWebGLContextLost = this.onWebGLContextLost.bind(this);
|
|
15629
15973
|
this.boundOnWebGLContextRestored = this.onWebGLContextRestored.bind(this);
|
|
15630
15974
|
this.retryTimer = setInterval(function () {
|
|
15631
|
-
if (!
|
|
15632
|
-
|
|
15975
|
+
if (!_this15.map.getSource("indoorequal")) {
|
|
15976
|
+
_this15.failedTiles.clear();
|
|
15633
15977
|
return;
|
|
15634
15978
|
}
|
|
15635
|
-
var source =
|
|
15979
|
+
var source = _this15.map.getSource("indoorequal");
|
|
15636
15980
|
if (!source || source.type !== "vector") {
|
|
15637
|
-
|
|
15981
|
+
_this15.failedTiles.clear();
|
|
15638
15982
|
return;
|
|
15639
15983
|
}
|
|
15640
15984
|
|
|
15641
15985
|
// Process tiles and remove invalid ones
|
|
15642
15986
|
var tilesToRetry = [];
|
|
15643
15987
|
var tilesToRemove = [];
|
|
15644
|
-
|
|
15988
|
+
_this15.failedTiles.forEach(function (tile) {
|
|
15645
15989
|
// Check if tile is still valid before attempting reload
|
|
15646
15990
|
if (!tile || tile.state === "unloaded" || tile.state === "loading") {
|
|
15647
15991
|
tilesToRemove.push(tile);
|
|
@@ -15659,7 +16003,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15659
16003
|
|
|
15660
16004
|
// Remove invalid tiles from the set
|
|
15661
16005
|
tilesToRemove.forEach(function (tile) {
|
|
15662
|
-
return
|
|
16006
|
+
return _this15.failedTiles["delete"](tile);
|
|
15663
16007
|
});
|
|
15664
16008
|
|
|
15665
16009
|
// Attempt to reload valid failed tiles
|
|
@@ -15671,7 +16015,7 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
|
|
|
15671
16015
|
}
|
|
15672
16016
|
} catch (error) {
|
|
15673
16017
|
// If reload fails, remove tile from retry queue - this is expected
|
|
15674
|
-
|
|
16018
|
+
_this15.failedTiles["delete"](tile);
|
|
15675
16019
|
}
|
|
15676
16020
|
});
|
|
15677
16021
|
}, 1000);
|
|
@@ -15820,6 +16164,7 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15820
16164
|
var _this;
|
|
15821
16165
|
sdk_classCallCheck(this, InternalMapVXSDK);
|
|
15822
16166
|
_this = sdk_callSuper(this, InternalMapVXSDK);
|
|
16167
|
+
sdk_defineProperty(_this, "maps", []);
|
|
15823
16168
|
sdk_defineProperty(_this, "geoLocation", navigator.geolocation);
|
|
15824
16169
|
sdk_defineProperty(_this, "headingListeners", []);
|
|
15825
16170
|
_this.token = token;
|
|
@@ -15853,6 +16198,17 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15853
16198
|
value: function setSdkLang(lang) {
|
|
15854
16199
|
this.config.lang = lang;
|
|
15855
16200
|
this.repository.setLang(lang);
|
|
16201
|
+
this.maps.forEach(function (map) {
|
|
16202
|
+
return map.setLang(lang);
|
|
16203
|
+
});
|
|
16204
|
+
}
|
|
16205
|
+
}, {
|
|
16206
|
+
key: "unregisterMap",
|
|
16207
|
+
value: function unregisterMap(map) {
|
|
16208
|
+
var mapIndex = this.maps.indexOf(map);
|
|
16209
|
+
if (mapIndex >= 0) {
|
|
16210
|
+
this.maps.splice(mapIndex, 1);
|
|
16211
|
+
}
|
|
15856
16212
|
}
|
|
15857
16213
|
}, {
|
|
15858
16214
|
key: "getPlaceDetail",
|
|
@@ -15926,11 +16282,21 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
15926
16282
|
}, {
|
|
15927
16283
|
key: "createMap",
|
|
15928
16284
|
value: function createMap(container, mapConfig) {
|
|
16285
|
+
var _this2 = this;
|
|
15929
16286
|
try {
|
|
15930
16287
|
mapConfig.lang = this.config.lang;
|
|
15931
16288
|
mapConfig.apiUrl = this.config.apiUrl;
|
|
15932
16289
|
mapConfig.mapvxRequestContext = this.config.mapvxRequestContext;
|
|
15933
16290
|
var map = new InternalMapVXMap(mapConfig, container, this.token);
|
|
16291
|
+
var originalDestroyMap = map.destroyMap.bind(map);
|
|
16292
|
+
map.destroyMap = function () {
|
|
16293
|
+
try {
|
|
16294
|
+
originalDestroyMap();
|
|
16295
|
+
} finally {
|
|
16296
|
+
_this2.unregisterMap(map);
|
|
16297
|
+
}
|
|
16298
|
+
};
|
|
16299
|
+
this.maps.push(map);
|
|
15934
16300
|
this.logEvent("createMap");
|
|
15935
16301
|
return map;
|
|
15936
16302
|
} catch (error) {
|
|
@@ -16363,14 +16729,14 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
|
|
|
16363
16729
|
}, {
|
|
16364
16730
|
key: "getUserLocation",
|
|
16365
16731
|
value: function getUserLocation() {
|
|
16366
|
-
var
|
|
16732
|
+
var _this3 = this;
|
|
16367
16733
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
16368
16734
|
enableHighAccuracy: true,
|
|
16369
16735
|
timeout: 60 * 1000,
|
|
16370
16736
|
maximumAge: 10 * 1000
|
|
16371
16737
|
};
|
|
16372
16738
|
return new Promise(function (resolve, reject) {
|
|
16373
|
-
|
|
16739
|
+
_this3.geoLocation.getCurrentPosition(function (position) {
|
|
16374
16740
|
resolve(position);
|
|
16375
16741
|
}, function (error) {
|
|
16376
16742
|
reject(error);
|