atriusmaps-node-sdk 3.3.898 → 3.3.900
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/nodesdk/nodeEntry.js +36 -58
- package/dist/cjs/package.json.js +8 -4
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +8 -6
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +50 -142
- package/dist/cjs/plugins/dynamicPois/src/processors.js +31 -53
- package/dist/cjs/plugins/flightStatus/src/flightDetailsMapper.js +47 -116
- package/dist/cjs/plugins/flightStatus/src/flightStatus.js +48 -82
- package/dist/cjs/plugins/flightStatus/src/utils.js +4 -14
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +77 -154
- package/dist/cjs/plugins/sdkServer/src/prepareSDKConfig.js +45 -76
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +70 -79
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +97 -147
- package/dist/cjs/plugins/searchService/src/flexsearchExports/lang.js +16 -190
- package/dist/cjs/plugins/searchService/src/flexsearchExports/simple.js +28 -35
- package/dist/cjs/plugins/searchService/src/poiSearch.js +10 -21
- package/dist/cjs/plugins/searchService/src/searchService.js +45 -147
- package/dist/cjs/plugins/searchService/src/searchTypeahead.js +17 -28
- package/dist/cjs/plugins/searchService/src/utils.js +9 -13
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +148 -304
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +47 -126
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +6 -73
- package/dist/cjs/plugins/wayfinder/src/minPriorityQueue.js +7 -27
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +78 -259
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +26 -57
- package/dist/cjs/plugins/wayfinder/src/segmentBadges.js +25 -25
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +50 -133
- package/dist/cjs/plugins/wayfinder/src/segmentCategories.js +29 -29
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +53 -145
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +105 -349
- package/dist/cjs/src/app.js +53 -91
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +34 -43
- package/dist/cjs/src/configs/postproc-stateTracking.js +1 -19
- package/dist/cjs/src/controller.js +4 -26
- package/dist/cjs/src/debugTools.js +55 -94
- package/dist/cjs/src/env.js +8 -19
- package/dist/cjs/src/extModules/bustle.js +15 -71
- package/dist/cjs/src/extModules/flexapi/src/help.js +7 -22
- package/dist/cjs/src/extModules/flexapi/src/index.js +15 -29
- package/dist/cjs/src/extModules/flexapi/src/validate.js +45 -93
- package/dist/cjs/src/extModules/geohasher.js +13 -31
- package/dist/cjs/src/extModules/log.js +18 -29
- package/dist/cjs/src/historyManager.js +4 -6
- package/dist/cjs/src/utils/bounds.js +2 -4
- package/dist/cjs/src/utils/buildStructureLookup.js +7 -7
- package/dist/cjs/src/utils/configUtils.js +7 -43
- package/dist/cjs/src/utils/date.js +5 -17
- package/dist/cjs/src/utils/distance.js +2 -2
- package/dist/cjs/src/utils/dom.js +9 -24
- package/dist/cjs/src/utils/funcs.js +15 -30
- package/dist/cjs/src/utils/geodesy.js +24 -39
- package/dist/cjs/src/utils/geom.js +32 -148
- package/dist/cjs/src/utils/i18n.js +39 -70
- package/dist/cjs/src/utils/isInitialState.js +7 -13
- package/dist/cjs/src/utils/location.js +10 -29
- package/dist/cjs/src/utils/observable.js +4 -29
- package/dist/cjs/src/utils/rand.js +9 -80
- package/dist/cjs/utils/constants.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/plugins/sdkServer/src/prepareSDKConfig.js +1 -1
- package/dist/src/utils/buildStructureLookup.js +1 -1
- package/dist/src/utils/date.js +1 -1
- package/package.json +1 -1
|
@@ -1,49 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const $ = (expr, container) =>
|
|
3
|
+
const $ = (expr, container) => typeof expr === "string" ? (container || document).querySelector(expr) : expr || null;
|
|
4
4
|
const $$ = (expr, container) => Array.prototype.slice.call((document).querySelectorAll(expr));
|
|
5
|
-
|
|
6
|
-
// adds an element (default: div) defined in eConf to parent element (default: body) - returns element
|
|
7
|
-
// i.e.
|
|
8
|
-
// const newDiv = ad() = creates a new div, adds to end of page and returns it
|
|
9
|
-
// const newDiv = ad({klass: "foo"}) = same as above with class of "foo"
|
|
10
|
-
// const newImg = ad({tag: "img", src: "test.png"}, "#top") = image at end of top
|
|
11
5
|
function ad(eConf, parent) {
|
|
12
6
|
const c = eConf || {};
|
|
13
|
-
parent = parent ?
|
|
14
|
-
|
|
15
|
-
let tag = 'div';
|
|
16
|
-
|
|
7
|
+
parent = parent ? typeof parent === "string" ? document.querySelector(parent) : parent : document.body;
|
|
8
|
+
let tag = "div";
|
|
17
9
|
if (c.tag) {
|
|
18
10
|
tag = c.tag;
|
|
19
11
|
}
|
|
20
|
-
|
|
21
12
|
const node = document.createElement(tag);
|
|
22
|
-
|
|
23
13
|
for (const cc in c) {
|
|
24
14
|
if (c[cc] != null) {
|
|
25
|
-
if (cc ===
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} else if (cc === 'tag') ; else if (cc === 'styles') {
|
|
15
|
+
if (cc === "klass") {
|
|
16
|
+
node.setAttribute("class", c.klass);
|
|
17
|
+
} else if (cc === "tag") ; else if (cc === "styles") {
|
|
29
18
|
setStyles(node, c.styles);
|
|
30
|
-
} else if (cc ===
|
|
19
|
+
} else if (cc === "text") {
|
|
31
20
|
node.textContent = c.text;
|
|
32
|
-
} else if (cc ===
|
|
21
|
+
} else if (cc === "html") {
|
|
33
22
|
node.innerHTML = c.html;
|
|
34
23
|
} else {
|
|
35
24
|
node.setAttribute(cc, c[cc]);
|
|
36
25
|
}
|
|
37
26
|
}
|
|
38
27
|
}
|
|
39
|
-
|
|
40
28
|
parent.appendChild(node);
|
|
41
|
-
|
|
42
29
|
return node;
|
|
43
30
|
}
|
|
44
|
-
|
|
45
|
-
const del = element => element?.parentNode?.removeChild(element);
|
|
46
|
-
|
|
31
|
+
const del = (element) => element?.parentNode?.removeChild(element);
|
|
47
32
|
const setStyles = (node, styles) => {
|
|
48
33
|
for (const style in styles) {
|
|
49
34
|
node.style[style] = styles[style];
|
|
@@ -3,47 +3,32 @@
|
|
|
3
3
|
require('ramda');
|
|
4
4
|
require('zousan');
|
|
5
5
|
|
|
6
|
-
// Ensures only a single asynchronous function wrapped in this function runs at a time.
|
|
7
6
|
let lastFn = null;
|
|
8
|
-
const singleFile = fn =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return lastFn;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* returns a copy of an object with any (top-level) properties that do not
|
|
21
|
-
* return truthy from the specified function stripped. So it works just like
|
|
22
|
-
* the Array.filter, but for objects.
|
|
23
|
-
* @param {function} fn A filter predicate - will be passed (key,object)
|
|
24
|
-
* @param {object} ob The object to filter (top level properties only)
|
|
25
|
-
* @returns (object) The newly created object with filtered properties
|
|
26
|
-
*/
|
|
7
|
+
const singleFile = (fn) => function(...args) {
|
|
8
|
+
if (lastFn) {
|
|
9
|
+
lastFn = lastFn.then(() => fn(...args));
|
|
10
|
+
} else {
|
|
11
|
+
lastFn = fn(...args);
|
|
12
|
+
}
|
|
13
|
+
return lastFn;
|
|
14
|
+
};
|
|
27
15
|
function filterOb(fn, ob) {
|
|
28
16
|
const ret = {};
|
|
29
|
-
Object.keys(ob).forEach(key => {
|
|
17
|
+
Object.keys(ob).forEach((key) => {
|
|
30
18
|
if (fn(key, ob[key])) {
|
|
31
19
|
ret[key] = ob[key];
|
|
32
20
|
}
|
|
33
21
|
});
|
|
34
22
|
return ret;
|
|
35
23
|
}
|
|
36
|
-
|
|
37
|
-
const b64DecodeUnicode = str =>
|
|
24
|
+
const b64DecodeUnicode = (str) => (
|
|
38
25
|
// Going backwards: from bytestream, to percent-encoding, to original string.
|
|
39
26
|
decodeURIComponent(
|
|
40
|
-
atob(str)
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.join(''),
|
|
46
|
-
);
|
|
27
|
+
atob(str).split("").map(function(c) {
|
|
28
|
+
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
|
|
29
|
+
}).join("")
|
|
30
|
+
)
|
|
31
|
+
);
|
|
47
32
|
|
|
48
33
|
exports.b64DecodeUnicode = b64DecodeUnicode;
|
|
49
34
|
exports.filterOb = filterOb;
|
|
@@ -1,51 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
This utility module contains a set of functions dealing with "Geodesy" - measurements of
|
|
5
|
-
the earth, its surface and related geometry.
|
|
6
|
-
|
|
7
|
-
For a more cohesive set of functions, see https://github.com/chrisveness/geodesy
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// degrees to radians
|
|
11
|
-
const toRadians = d => (d * Math.PI) / 180;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Haversine formula for finding distance between two lat/lng points.
|
|
15
|
-
* from https://www.movable-type.co.uk/scripts/latlong.html
|
|
16
|
-
* @param {float} lat1 latitutde of point 1
|
|
17
|
-
* @param {float} lng1 longitude of point 1
|
|
18
|
-
* @param {float} lat2 latitutde of point 2
|
|
19
|
-
* @param {float} lng2 longitude of point 2
|
|
20
|
-
* @returns number (in meters) between p1 and p2
|
|
21
|
-
*/
|
|
3
|
+
const toRadians = (d) => d * Math.PI / 180;
|
|
22
4
|
function distance(lat1, lng1, lat2, lng2) {
|
|
23
|
-
const R =
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) + Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
|
|
5
|
+
const R = 6371e3;
|
|
6
|
+
const \u03C61 = toRadians(lat1);
|
|
7
|
+
const \u03C62 = toRadians(lat2);
|
|
8
|
+
const \u0394\u03C6 = toRadians(lat2 - lat1);
|
|
9
|
+
const \u0394\u03BB = toRadians(lng2 - lng1);
|
|
10
|
+
const a = Math.sin(\u0394\u03C6 / 2) * Math.sin(\u0394\u03C6 / 2) + Math.cos(\u03C61) * Math.cos(\u03C62) * Math.sin(\u0394\u03BB / 2) * Math.sin(\u0394\u03BB / 2);
|
|
30
11
|
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
31
|
-
|
|
32
12
|
return R * c;
|
|
33
13
|
}
|
|
34
|
-
|
|
35
14
|
function bearingToDirection(deg, T) {
|
|
36
15
|
const names = [
|
|
37
|
-
T(
|
|
38
|
-
|
|
39
|
-
T(
|
|
40
|
-
|
|
41
|
-
T(
|
|
42
|
-
|
|
43
|
-
T(
|
|
44
|
-
|
|
16
|
+
T("wayfinder:north"),
|
|
17
|
+
// 0
|
|
18
|
+
T("wayfinder:northeast"),
|
|
19
|
+
// 45
|
|
20
|
+
T("wayfinder:east"),
|
|
21
|
+
// 90
|
|
22
|
+
T("wayfinder:southeast"),
|
|
23
|
+
// 135
|
|
24
|
+
T("wayfinder:south"),
|
|
25
|
+
// 180 / -180
|
|
26
|
+
T("wayfinder:southwest"),
|
|
27
|
+
// -135
|
|
28
|
+
T("wayfinder:west"),
|
|
29
|
+
// -90
|
|
30
|
+
T("wayfinder:northwest")
|
|
31
|
+
// -45
|
|
45
32
|
];
|
|
46
|
-
|
|
47
|
-
const d = ((deg + 180) % 360) - 180;
|
|
48
|
-
|
|
33
|
+
const d = (deg + 180) % 360 - 180;
|
|
49
34
|
const index = Math.round(d / 45);
|
|
50
35
|
return names[(index + 8) % 8];
|
|
51
36
|
}
|
|
@@ -26,234 +26,118 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
|
|
27
27
|
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
28
28
|
|
|
29
|
-
// https://stackoverflow.com/questions/22521982/check-if-point-inside-a-polygon
|
|
30
29
|
const pointInPolygon = (point, vs) => {
|
|
31
30
|
const x = point[0];
|
|
32
31
|
const y = point[1];
|
|
33
|
-
|
|
34
32
|
let inside = false;
|
|
35
33
|
for (let i = 0, j = vs.length - 1; i < vs.length; j = i++) {
|
|
36
34
|
const xi = vs[i][0];
|
|
37
35
|
const yi = vs[i][1];
|
|
38
36
|
const xj = vs[j][0];
|
|
39
37
|
const yj = vs[j][1];
|
|
40
|
-
const intersect = yi > y !== yj > y && x < (
|
|
38
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
41
39
|
if (intersect) {
|
|
42
40
|
inside = !inside;
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
return inside;
|
|
47
44
|
};
|
|
48
|
-
|
|
49
45
|
const bounds2Coords = ({ n, s, e, w }) => [
|
|
50
46
|
[n, e],
|
|
51
47
|
[n, w],
|
|
52
48
|
[s, w],
|
|
53
49
|
[s, e],
|
|
54
|
-
[n, e]
|
|
50
|
+
[n, e]
|
|
55
51
|
];
|
|
56
52
|
const NULL_STRUCTURE_AND_FLOOR = { structure: null, floor: null };
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Pass in a structures array and a lat,lng and ord, and this will return the structure and floor
|
|
60
|
-
* at that point or nulls if no structure exists at that point/ord. This runs very quickly as we very often
|
|
61
|
-
* can skip the slowest path (which runs pointInPolygon). Without preciseFlag we sometimes return
|
|
62
|
-
* a structure when the point falls outside it - but won't return a wrong structure. In some cases this
|
|
63
|
-
* is actually desired behavior anyway (such as structure selector)
|
|
64
|
-
* @param {object} structures the venue data structures
|
|
65
|
-
* @param {float} lat latitude of point to check
|
|
66
|
-
* @param {float} lng longitude of point to check
|
|
67
|
-
* @param {[float]} mapviewBBox the minx,miny,maxx,maxy lat lng values that define the viewable map (not req if preciseFlag === true)
|
|
68
|
-
* @param {boolean} preciseFlag if false, we provide a fuzzy reading, allowing for the map center to be "close enough" to a building/floor
|
|
69
|
-
* @returns {structure: object, floor: object} structure/building and floor that contains the point passed (or {structure:null,floor:null})
|
|
70
|
-
*/
|
|
71
53
|
function getStructureAndFloorAtPoint(structures, lat, lng, ord, mapviewBBox, preciseFlag = false) {
|
|
72
|
-
// Step 1 of logic flow
|
|
73
54
|
if (!R__namespace.length(structures)) {
|
|
74
55
|
return NULL_STRUCTURE_AND_FLOOR;
|
|
75
56
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const floorsToConsider = structures.map(structure => ({
|
|
57
|
+
structures = structures.filter((s) => s.shouldDisplay == null || s.shouldDisplay === true);
|
|
58
|
+
const floorsToConsider = structures.map((structure) => ({
|
|
80
59
|
structure,
|
|
81
|
-
floor: ordToFloor(structure, ord)
|
|
82
|
-
}));
|
|
83
|
-
|
|
60
|
+
floor: ordToFloor(structure, ord)
|
|
61
|
+
}));
|
|
84
62
|
return getStructureAndFloorWithinFloorsAtPoint(structures, floorsToConsider, lat, lng, mapviewBBox, preciseFlag);
|
|
85
63
|
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Given a list of candidate floors, and a lat,lng point, determine which
|
|
89
|
-
* @param {object} structures the venue data structures
|
|
90
|
-
* @param {[{structure, floor}]} floorsToConsider A list of "tuple" objects containing structure and floor (both can be null)
|
|
91
|
-
* @param {float} lat latitude of point to check
|
|
92
|
-
* @param {float} lng longitude of point to check
|
|
93
|
-
* @param {[float]} mapviewBBox the minx,miny,maxx,maxy lat lng values that define the viewable map (not req if preciseFlag === true)
|
|
94
|
-
* @param {boolean} preciseFlag if false, we provide a fuzzy reading, allowing for the map center to be "close enough" to a building/floor
|
|
95
|
-
* @returns {structure: object, floor: object} structure/building and floor that contains the point passed (or {structure:null,floor:null})
|
|
96
|
-
*/
|
|
97
64
|
function getStructureAndFloorWithinFloorsAtPoint(structures, floorsToConsider, lat, lng, mapviewBBox, preciseFlag) {
|
|
98
|
-
|
|
99
|
-
const pointWithinFloorsBBox = floorsToConsider
|
|
100
|
-
.filter(ftc => ftc.floor) // ignore structures with no floor on this ord
|
|
101
|
-
.filter(ftc => pointInPolygon([lat, lng], bounds2Coords(ftc.floor.bounds)));
|
|
102
|
-
|
|
103
|
-
//
|
|
104
|
-
// First, lets handle the simpler case, where preciseFlag is true.
|
|
105
|
-
// All preciseFlag=true cases are handled within this code block.
|
|
106
|
-
//
|
|
65
|
+
const pointWithinFloorsBBox = floorsToConsider.filter((ftc) => ftc.floor).filter((ftc) => pointInPolygon([lat, lng], bounds2Coords(ftc.floor.bounds)));
|
|
107
66
|
if (preciseFlag) {
|
|
108
|
-
// not within any floor's bounding box? return nulls
|
|
109
67
|
if (pointWithinFloorsBBox.length === 0) {
|
|
110
68
|
return NULL_STRUCTURE_AND_FLOOR;
|
|
111
69
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const floorsWithinBoundsPolygon = pointWithinFloorsBBox.filter(ftc =>
|
|
115
|
-
pointInPolygon([lat, lng], ftc.floor.boundsPolygon),
|
|
70
|
+
const floorsWithinBoundsPolygon = pointWithinFloorsBBox.filter(
|
|
71
|
+
(ftc) => pointInPolygon([lat, lng], ftc.floor.boundsPolygon)
|
|
116
72
|
);
|
|
117
|
-
|
|
118
|
-
// We should never be in MORE than one floor's bounding polygon, so return 1st one
|
|
119
|
-
// and in unlikely case we ARE in multiple, user will get first one...
|
|
120
73
|
if (floorsWithinBoundsPolygon.length >= 1) {
|
|
121
74
|
return R__namespace.head(floorsWithinBoundsPolygon);
|
|
122
75
|
}
|
|
123
|
-
|
|
124
|
-
// precise yet not within any floor polygon, "so you get nothing. you lose. good day sir!"
|
|
125
76
|
return NULL_STRUCTURE_AND_FLOOR;
|
|
126
77
|
}
|
|
127
|
-
|
|
128
|
-
//
|
|
129
|
-
// From here forward, we handle the non-precise case (more complicated)
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
// Step 3 (non-precise) - We are not within any *floor* bounding box..
|
|
133
78
|
if (pointWithinFloorsBBox.length === 0) {
|
|
134
|
-
|
|
135
|
-
const floorsWithinBuildingBoundingBox = structures
|
|
136
|
-
.filter(structure => pointInPolygon([lat, lng], bounds2Coords(structure.bounds)))
|
|
137
|
-
// .map(structure => ({ structure, floor: structure.levels[structure.defaultLevelId] }))
|
|
138
|
-
.map(structure => ({ structure, floor: null }));
|
|
139
|
-
|
|
79
|
+
const floorsWithinBuildingBoundingBox = structures.filter((structure) => pointInPolygon([lat, lng], bounds2Coords(structure.bounds))).map((structure) => ({ structure, floor: null }));
|
|
140
80
|
if (floorsWithinBuildingBoundingBox.length >= 1) {
|
|
141
81
|
return floorsWithinBuildingBoundingBox[0];
|
|
142
82
|
}
|
|
143
|
-
|
|
144
|
-
return NULL_STRUCTURE_AND_FLOOR; // user does not seem to be near ANYTHING!
|
|
83
|
+
return NULL_STRUCTURE_AND_FLOOR;
|
|
145
84
|
}
|
|
146
|
-
|
|
147
|
-
// Step 4 - If we are only in the bounding box of a single floor, return it
|
|
148
85
|
if (pointWithinFloorsBBox.length === 1) {
|
|
149
86
|
return pointWithinFloorsBBox[0];
|
|
150
87
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
// so how do we determine WHICH item to select...?
|
|
154
|
-
|
|
155
|
-
const floorsContainingPoint = pointWithinFloorsBBox.filter(ftc =>
|
|
156
|
-
pointInPolygon([lat, lng], ftc.floor.boundsPolygon),
|
|
88
|
+
const floorsContainingPoint = pointWithinFloorsBBox.filter(
|
|
89
|
+
(ftc) => pointInPolygon([lat, lng], ftc.floor.boundsPolygon)
|
|
157
90
|
);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const prominenceScores = pointWithinFloorsBBox.map(ftc =>
|
|
161
|
-
prominence(
|
|
91
|
+
const prominenceScores = pointWithinFloorsBBox.map(
|
|
92
|
+
(ftc) => prominence(
|
|
162
93
|
ftc,
|
|
163
94
|
mapviewBBox,
|
|
164
|
-
floorsContainingPoint.some(fcp => fcp.floor.id === ftc.floor.id)
|
|
165
|
-
)
|
|
95
|
+
floorsContainingPoint.some((fcp) => fcp.floor.id === ftc.floor.id)
|
|
96
|
+
)
|
|
166
97
|
);
|
|
167
98
|
const bestScore = Math.max.apply(null, prominenceScores);
|
|
168
|
-
|
|
169
99
|
return pointWithinFloorsBBox[prominenceScores.indexOf(bestScore)];
|
|
170
100
|
}
|
|
171
|
-
|
|
172
|
-
// Returns a prominenceScore from 0 to 100
|
|
173
|
-
// This is calculated by a % of screen taken by the
|
|
174
|
-
// floor polygon
|
|
175
101
|
function prominence({ floor }, mapviewBBox, pointWithinFloorPoly) {
|
|
176
|
-
// Take the polygon of the floor...
|
|
177
102
|
const floorPolygon = coords2Poly(floor.boundsPolygon);
|
|
178
|
-
|
|
179
|
-
// ...and the bounding box of the viewable map...
|
|
180
103
|
const mapviewBBoxPoly = bboxPolygon.bboxPolygon(mapviewBBox);
|
|
181
|
-
|
|
182
|
-
// ...and create a viewable floor polygone from the intercection.
|
|
183
104
|
const viewableFloorPoly = bboxClip.bboxClip(floorPolygon, mapviewBBox);
|
|
184
|
-
|
|
185
105
|
const floorArea = area.area(viewableFloorPoly);
|
|
186
106
|
const viewableMapArea = area.area(mapviewBBoxPoly);
|
|
187
|
-
|
|
188
|
-
// now the prominence is simply the ratio of viewable floor to viewable map (with 20% bonus if center within floor)
|
|
189
|
-
return (floorArea * (pointWithinFloorPoly ? 150 : 100)) / viewableMapArea;
|
|
107
|
+
return floorArea * (pointWithinFloorPoly ? 150 : 100) / viewableMapArea;
|
|
190
108
|
}
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const getFloor = (structures, selectedLevelId) =>
|
|
204
|
-
structures.reduce(
|
|
205
|
-
(fmatch, building) => Object.values(building.levels).find(floor => floor.id === selectedLevelId) || fmatch,
|
|
206
|
-
undefined,
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
// pass in the structures array and a floorId and this will return the structure
|
|
210
|
-
// that contains the floorId.
|
|
211
|
-
const getStructureForFloorId = (structures, floorId) =>
|
|
212
|
-
structures.reduce((sMatch, structure) => (buildContainsFloorWithId(structure, floorId) ? structure : sMatch), null);
|
|
213
|
-
|
|
214
|
-
// returns true if the building specified contains the floorId specified
|
|
215
|
-
const buildContainsFloorWithId = (building, floorId) =>
|
|
216
|
-
Object.values(building.levels).reduce((fmatch, floor) => (floor.id === floorId ? true : fmatch), false);
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Calculate the points for a bezier cubic curve
|
|
220
|
-
*
|
|
221
|
-
* @param {number} fromX - Starting point x
|
|
222
|
-
* @param {number} fromY - Starting point y
|
|
223
|
-
* @param {number} cpX - Control point x
|
|
224
|
-
* @param {number} cpY - Control point y
|
|
225
|
-
* @param {number} cpX2 - Second Control point x
|
|
226
|
-
* @param {number} cpY2 - Second Control point y
|
|
227
|
-
* @param {number} toX - Destination point x
|
|
228
|
-
* @param {number} toY - Destination point y
|
|
229
|
-
* @return {Object[]} Array of points of the curve
|
|
230
|
-
*/
|
|
109
|
+
const latLngSwap = (point) => [point[1], point[0]];
|
|
110
|
+
const coords2Poly = (coords) => helpers.polygon([coords.map(latLngSwap)]);
|
|
111
|
+
const ordToFloor = (building, ord) => Object.values(building.levels).find((floor) => floor.ordinal === ord);
|
|
112
|
+
const getFloor = (structures, selectedLevelId) => structures.reduce(
|
|
113
|
+
(fmatch, building) => Object.values(building.levels).find((floor) => floor.id === selectedLevelId) || fmatch,
|
|
114
|
+
void 0
|
|
115
|
+
);
|
|
116
|
+
const getStructureForFloorId = (structures, floorId) => structures.reduce(
|
|
117
|
+
(sMatch, structure) => buildContainsFloorWithId(structure, floorId) ? structure : sMatch,
|
|
118
|
+
null
|
|
119
|
+
);
|
|
120
|
+
const buildContainsFloorWithId = (building, floorId) => Object.values(building.levels).reduce((fmatch, floor) => floor.id === floorId ? true : fmatch, false);
|
|
231
121
|
function bezierCurveTo(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) {
|
|
232
|
-
const n = 20;
|
|
122
|
+
const n = 20;
|
|
233
123
|
let dt = 0;
|
|
234
124
|
let dt2 = 0;
|
|
235
125
|
let dt3 = 0;
|
|
236
126
|
let t2 = 0;
|
|
237
127
|
let t3 = 0;
|
|
238
|
-
|
|
239
128
|
const path = [{ x: fromX, y: fromY }];
|
|
240
|
-
|
|
241
129
|
for (let i = 1, j = 0; i <= n; ++i) {
|
|
242
130
|
j = i / n;
|
|
243
|
-
|
|
244
131
|
dt = 1 - j;
|
|
245
132
|
dt2 = dt * dt;
|
|
246
133
|
dt3 = dt2 * dt;
|
|
247
|
-
|
|
248
134
|
t2 = j * j;
|
|
249
135
|
t3 = t2 * j;
|
|
250
|
-
|
|
251
136
|
path.push({
|
|
252
137
|
x: dt3 * fromX + 3 * dt2 * j * cpX + 3 * dt * t2 * cpX2 + t3 * toX,
|
|
253
|
-
y: dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY
|
|
138
|
+
y: dt3 * fromY + 3 * dt2 * j * cpY + 3 * dt * t2 * cpY2 + t3 * toY
|
|
254
139
|
});
|
|
255
140
|
}
|
|
256
|
-
|
|
257
141
|
return path;
|
|
258
142
|
}
|
|
259
143
|
|
|
@@ -6,83 +6,52 @@ var i18next = require('i18next');
|
|
|
6
6
|
|
|
7
7
|
async function init(langOverride, { debugMode, fallbackLng } = {}) {
|
|
8
8
|
const i18n = i18next.createInstance();
|
|
9
|
-
return (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
en: {
|
|
22
|
-
translation: {
|
|
23
|
-
'Proceed xx minutes to_one': 'Proceed {{count}} minute to',
|
|
24
|
-
'Proceed xx minutes to_other': 'Proceed {{count}} minutes to',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
fallbackLng: fallbackLng === undefined ? 'en' : fallbackLng,
|
|
29
|
-
// ns: ['common', 'banner', 'common', 'directions', 'failure', 'flights', 'legal', 'navigation', 'poi', 'search', 'security', 'time', 'tooltip'],
|
|
30
|
-
// defaultNS: 'common',
|
|
31
|
-
lng: langOverride,
|
|
32
|
-
/* interpolation: {
|
|
33
|
-
escapeValue: true
|
|
34
|
-
}
|
|
35
|
-
postProcess: ['pseudoTrans'] */
|
|
36
|
-
})
|
|
37
|
-
.then(() => {
|
|
38
|
-
if (debugMode) {
|
|
39
|
-
i18n.on('missingKey', function (lngs, namespace, key) {
|
|
40
|
-
console.error(
|
|
41
|
-
'i18nNext: key not found. Language: ' +
|
|
42
|
-
i18n.language +
|
|
43
|
-
', Key: ' +
|
|
44
|
-
key +
|
|
45
|
-
', namespace: ' +
|
|
46
|
-
namespace +
|
|
47
|
-
', lngs: ',
|
|
48
|
-
lngs,
|
|
49
|
-
);
|
|
50
|
-
});
|
|
9
|
+
return i18n.init({
|
|
10
|
+
debug: debugMode,
|
|
11
|
+
interpolation: {
|
|
12
|
+
escapeValue: false
|
|
13
|
+
},
|
|
14
|
+
keySeparator: false,
|
|
15
|
+
nsSeparator: ":",
|
|
16
|
+
resources: {
|
|
17
|
+
en: {
|
|
18
|
+
translation: {
|
|
19
|
+
"Proceed xx minutes to_one": "Proceed {{count}} minute to",
|
|
20
|
+
"Proceed xx minutes to_other": "Proceed {{count}} minutes to"
|
|
51
21
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
fallbackLng: fallbackLng === void 0 ? "en" : fallbackLng,
|
|
25
|
+
// ns: ['common', 'banner', 'common', 'directions', 'failure', 'flights', 'legal', 'navigation', 'poi', 'search', 'security', 'time', 'tooltip'],
|
|
26
|
+
// defaultNS: 'common',
|
|
27
|
+
lng: langOverride
|
|
28
|
+
/* interpolation: {
|
|
29
|
+
escapeValue: true
|
|
30
|
+
}
|
|
31
|
+
postProcess: ['pseudoTrans'] */
|
|
32
|
+
}).then(() => {
|
|
33
|
+
if (debugMode) {
|
|
34
|
+
i18n.on("missingKey", function(lngs, namespace, key) {
|
|
35
|
+
console.error(
|
|
36
|
+
"i18nNext: key not found. Language: " + i18n.language + ", Key: " + key + ", namespace: " + namespace + ", lngs: ",
|
|
37
|
+
lngs
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return i18n;
|
|
42
|
+
});
|
|
59
43
|
}
|
|
60
|
-
|
|
61
|
-
// A postprocessor plugin for i18next that replaces all words with dashes - this helps identify untranslated strings
|
|
62
|
-
// const dashEmAll = {
|
|
63
|
-
// name: 'dashEmAll',
|
|
64
|
-
// type: 'postProcessor',
|
|
65
|
-
// process: (value, key, options, translator) => value.replace(/[^ .-_,]/g, '-')
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
// const pseudoTrans = {
|
|
69
|
-
// name: 'pseudoTrans',
|
|
70
|
-
// type: 'postProcessor',
|
|
71
|
-
// process: (value, key, options, translator) => toLang(value, translator.language)
|
|
72
|
-
// }
|
|
73
|
-
|
|
74
44
|
const loremIpsum = {
|
|
75
|
-
ar:
|
|
45
|
+
ar: `\u0628\u0627\u0644 \u0639\u0646 \u0623\u0645\u0627\u0645 \u0627\u0644\u0623\u062E\u0630 \u0627\u0644\u0628\u0631\u064A\u0629. \u062B\u0645 \u0643\u0645\u0627 \u0648\u0642\u0627\u0645 \u0634\u0627\u0633\u0639\u0629 \u0627\u0644\u062C\u0646\u0648\u0628\u064A, \u0623\u0645\u062F\u0647\u0627 \u0627\u0644\u0625\u0645\u062F\u0627\u062F \u0639\u0646 \u0627\u0646\u0647. \u0663\u0660 \u0641\u0643\u0627\u0646\u062A \u0648\u0627\u0644\u0643\u0633\u0627\u062F \u0627\u0646\u0647. \u0623\u0633\u0627\u0633\u064A \u0627\u0644\u0634\u0645\u0627\u0644 \u0627\u0644\u0625\u062A\u0641\u0627\u0642\u064A\u0629 \u0628\u0627\u0644 \u0623\u0645. \u0632\u0647\u0627\u0621 \u0627\u0644\u0645\u0624\u0644\u0651\u0641\u0629 \u062D\u064A\u0646 \u0639\u0644, \u0633\u0643\u0627\u0646 \u0642\u0631\u0631\u062A \u0647\u0630\u0647 \u0627\u0646, \u0634\u0639\u0627\u0631 \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0648\u0644\u0645 \u0645\u0639.
|
|
76
46
|
|
|
77
|
-
|
|
47
|
+
\u062F\u0648\u0644 \u0627\u0644\u0623\u0645\u0648\u0631 \u0627\u0644\u0635\u0641\u062D\u0629 \u0627\u0644\u0623\u0648\u0631\u0648\u0628\u064A\u0629 \u0642\u062F. \u062A\u0645 \u062D\u062F\u0649 \u0641\u0627\u062A\u0651\u0628\u0639 \u0627\u0644\u0647\u062C\u0648\u0645, \u0645\u0627 \u0623\u0648\u0633\u0639 \u0645\u0639\u0627\u0645\u0644\u0629 \u0641\u0639\u0644, \u062E\u0644\u0627\u0641 \u0627\u0644\u0623\u0648\u0631\u0648\u0628\u064A\u0629\u060C \u0625\u064A\u0648 \u0643\u0644. \u062A\u064F\u0635\u0628 \u0648\u0627\u0646\u062F\u0648\u0646\u064A\u0633\u064A\u0627\u060C \u062D\u064A\u0646 \u0642\u062F. \u0623\u064A \u062D\u0627\u0648\u0644 \u062D\u0642\u0648\u0644 \u0648\u0647\u0648\u0644\u0646\u062F\u0627\u060C \u0647\u0630\u0627, \u0628\u064A\u0646 \u0639\u0646 \u0644\u0647\u064A\u0645\u0646\u0629 \u0628\u0627\u0644\u0633\u064A\u0637\u0631\u0629.
|
|
78
48
|
|
|
79
|
-
|
|
49
|
+
\u0623\u0639\u0645\u0627\u0644 \u0627\u0644\u0625\u062A\u062D\u0627\u062F \u0627\u0644\u0639\u0645\u0644\u064A\u0627\u062A \u0645\u0646 \u0648\u0635\u0644. \u0648\u0642\u0648\u0639\u0647\u0627\u060C \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645 \u0642\u062F \u0623\u062E\u0631, \u0628\u0644 \u062D\u062A\u0649 \u0639\u0644\u0627\u0642\u0629 \u0627\u0644\u062A\u0628\u0631\u0639\u0627\u062A. \u0641\u0642\u062F \u0644\u0645 \u0627\u0644\u0623\u0631\u0636 \u0627\u0633\u062A\u0628\u062F\u0627\u0644. \u062D\u062A\u0649 \u0627\u0644\u062E\u0627\u0633\u0631 \u0627\u0642\u062A\u0635\u0627\u062F\u064A\u0629 \u0628\u0640. \u0623\u0635\u0642\u0627\u0639 \u0623\u0639\u0644\u0646\u062A \u0627\u062A\u0641\u0627\u0642\u064A\u0629 \u062A\u0644\u0643 \u0628\u0644, \u0643\u0627\u0646 \u0625\u0630 \u0628\u062D\u0634\u062F \u0623\u062E\u0631\u0649 \u0644\u064A\u0628\u064A\u0646. \u0627\u0644\u0634\u062A\u0627\u0621\u060C \u0627\u0644\u064A\u0627\u0628\u0627\u0646\u060C \u0645\u0643\u0646 \u0623\u0645, \u0628\u0647\u060C \u0642\u062F \u0627\u0644\u0639\u0627\u0644\u0645\u060C \u0623\u0648\u0631\u0627\u0642\u0647\u0645, \u0628\u0644 \u0644\u0639\u062F\u0645 \u0644\u063A\u0632\u0648 \u0623\u0648\u0627\u062E\u0631 \u0645\u0643\u0646.
|
|
80
50
|
`,
|
|
81
|
-
ja:
|
|
51
|
+
ja: "\u79C1\u306F\u5834\u5408\u3044\u3088\u3044\u3088\u3042\u308B\u6240\u6709\u3089\u3063\u3066\u306E\u306E\u672B\u304C\u3057\u305F\u305F\u3002\u7121\u8AD6\u7D50\u679C\u306B\u5727\u8FEB\u9854\u3082\u3088\u304F\u305D\u306E\u767A\u5C55\u306A\u3044\u3067\u3059\u307E\u3067\u3092\u6C7A\u3059\u308B\u3066\u307F\u308B\u3067\u3057\u3067\u3082\u767A\u5C55\u4E91\u3044\u307E\u305B\u305F\u304B\u3089\u3001\u305D\u3046\u306B\u306F\u63CF\u3044\u305F\u306A\u3044\u305F\u305F\u3002\u6A5F\u4F1A\u3078\u8F09\u3063\u306A\u3044\u65B9\u306F\u5225\u306B\u4ECA\u3092\u3072\u3087\u308D\u3072\u3087\u308D\u3067\u305A\u307E\u3057\u3002\u3080\u3057\u308D\u5609\u7D0D\u3055\u3093\u3092\u610F\u5473\u65B9\u9762\u305D\u3046\uFF03\u300C\u3092\u7A4D\u3093\u306A\u3044\u6A29\u529B\u3053\u306E\u81EA\u5206\u4F55\u304B\u8A18\u5FF5\u3092\u3068\u3044\u3046\u304A\u304A\u5C0B\u306D\u3060\u308D\u3067\u3067\u3067\u3059\u3067\u3001\u3042\u308B\u4ECA\u306F\u3053\u308C\u304B\u983C\u307F\u4F8B\u304C\u3042\u308B\u3067\u3001\u30CD\u30EB\u30BD\u30F3\u3055\u3093\u306E\u306E\u306E\u5F15\u8FBC\u306E\u3042\u306A\u305F\u306B\u3082\u3063\u3068\u3082\u304A\u52AA\u529B\u3068\u3044\u3068\u79C1\u8D64\u306B\u5B9F\u5EFA\u8A2D\u304C\u8D77\u3063\u3088\u3046\u306B\u3068\u3084\u304B\u304F\u3054\u9644\u968F\u3092\u63CF\u3044\u3067\u3059\u307E\u3057\u304B\u3089\u3001\u3069\u3046\u3082\u3068\u306B\u304B\u304F\u76F8\u9055\u306B\u4E91\u304A\u3067\u3066\u306A\u3089\u307E\u3059\u306E\u304C\u884C\u3063\u306A\u3044\u307E\u305B\u3002"
|
|
82
52
|
};
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
const repl = (str, r) => (str.length < r.length ? r.substring(0, str.length) : r);
|
|
53
|
+
const toLang = (str, lang) => lang === "en" ? str : repl(str, loremIpsum[lang]);
|
|
54
|
+
const repl = (str, r) => str.length < r.length ? r.substring(0, str.length) : r;
|
|
86
55
|
|
|
87
56
|
exports.default = init;
|
|
88
57
|
exports.toLang = toLang;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const callbacks = new Set();
|
|
4
|
-
|
|
3
|
+
const callbacks = /* @__PURE__ */ new Set();
|
|
5
4
|
let listenerStarted = false;
|
|
6
5
|
let userInteracted = false;
|
|
7
|
-
|
|
8
6
|
function userInteractionHandler() {
|
|
9
7
|
if (!userInteracted) {
|
|
10
8
|
userInteracted = true;
|
|
@@ -13,29 +11,25 @@ function userInteractionHandler() {
|
|
|
13
11
|
}
|
|
14
12
|
callbacks.clear();
|
|
15
13
|
}
|
|
16
|
-
document.body.removeEventListener(
|
|
17
|
-
document.body.removeEventListener(
|
|
14
|
+
document.body.removeEventListener("click", userInteractionHandler);
|
|
15
|
+
document.body.removeEventListener("keydown", userInteractionHandler);
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
function startInitialStateListener() {
|
|
21
18
|
if (listenerStarted) {
|
|
22
19
|
return;
|
|
23
20
|
}
|
|
24
21
|
listenerStarted = true;
|
|
25
|
-
|
|
26
|
-
if (typeof window === 'undefined' || window.document?.body == null) {
|
|
27
|
-
// If no document body, assume interaction has already happened
|
|
22
|
+
if (typeof window === "undefined" || window.document?.body == null) {
|
|
28
23
|
userInteracted = true;
|
|
29
24
|
return;
|
|
30
25
|
}
|
|
31
|
-
if (performance.now() >
|
|
32
|
-
// If more than 10s have passed since page load, assume interaction has already happened
|
|
26
|
+
if (performance.now() > 1e4) {
|
|
33
27
|
userInteracted = true;
|
|
34
28
|
return;
|
|
35
29
|
}
|
|
36
30
|
userInteracted = false;
|
|
37
|
-
document.body.addEventListener(
|
|
38
|
-
document.body.addEventListener(
|
|
31
|
+
document.body.addEventListener("click", userInteractionHandler);
|
|
32
|
+
document.body.addEventListener("keydown", userInteractionHandler);
|
|
39
33
|
}
|
|
40
34
|
|
|
41
35
|
exports.startInitialStateListener = startInitialStateListener;
|