atriusmaps-node-sdk 3.3.347 → 3.3.348
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 +4 -10
- package/dist/cjs/package.json.js +13 -14
- package/dist/cjs/plugins/clientAPI/src/clientAPI.js +0 -2
- package/dist/cjs/plugins/dynamicPois/src/dynamicPois.js +7 -12
- package/dist/cjs/plugins/poiDataManager/src/poiDataManager.js +10 -16
- package/dist/cjs/plugins/sdkServer/src/sdkHeadless.js +3 -6
- package/dist/cjs/plugins/sdkServer/src/sdkServer.js +1 -3
- package/dist/cjs/plugins/searchService/src/poiSearch.js +3 -4
- package/dist/cjs/plugins/searchService/src/searchService.js +5 -11
- package/dist/cjs/plugins/searchService/src/utils.js +1 -7
- package/dist/cjs/plugins/venueDataLoader/src/venueDataLoader.js +12 -18
- package/dist/cjs/plugins/venueDataLoader/src/venueLoadingUtils.js +4 -14
- package/dist/cjs/plugins/wayfinder/src/findRoute.js +3 -6
- package/dist/cjs/plugins/wayfinder/src/navGraph.js +0 -2
- package/dist/cjs/plugins/wayfinder/src/navGraphDebug.js +3 -6
- package/dist/cjs/plugins/wayfinder/src/segmentBuilder.js +3 -6
- package/dist/cjs/plugins/wayfinder/src/stepBuilder.js +1 -1
- package/dist/cjs/plugins/wayfinder/src/wayfinder.js +9 -15
- package/dist/cjs/src/app.js +11 -37
- package/dist/cjs/src/configs/postproc-mol-url-parms.js +0 -2
- package/dist/cjs/src/configs/postproc-stateTracking.js +3 -6
- package/dist/cjs/src/configs/sdkHeadless.json.js +1 -1
- package/dist/cjs/src/controller.js +5 -10
- package/dist/cjs/src/debugTools.js +3 -4
- package/dist/cjs/src/env.js +0 -2
- package/dist/cjs/src/extModules/bustle.js +5 -10
- package/dist/cjs/src/extModules/flexapi/src/help.js +0 -2
- package/dist/cjs/src/extModules/flexapi/src/index.js +1 -5
- package/dist/cjs/src/extModules/flexapi/src/validate.js +0 -2
- package/dist/cjs/src/extModules/geohasher.js +0 -2
- package/dist/cjs/src/extModules/log.js +0 -2
- package/dist/cjs/src/historyManager.js +0 -2
- package/dist/cjs/src/utils/bounds.js +0 -2
- package/dist/cjs/src/utils/buildStructureLookup.js +3 -6
- package/dist/cjs/src/utils/configUtils.js +0 -2
- package/dist/cjs/src/utils/dom.js +1 -3
- package/dist/cjs/src/utils/funcs.js +0 -2
- package/dist/cjs/src/utils/geodesy.js +0 -2
- package/dist/cjs/src/utils/geom.js +6 -56
- package/dist/cjs/src/utils/i18n.js +2 -6
- package/dist/cjs/src/utils/location.js +0 -2
- package/dist/cjs/src/utils/rand.js +0 -2
- package/dist/package.json.js +1 -1
- package/dist/plugins/poiDataManager/src/poiDataManager.js +1 -1
- package/dist/plugins/venueDataLoader/src/venueDataLoader.js +1 -1
- package/dist/plugins/venueDataLoader/src/venueLoadingUtils.js +1 -1
- package/dist/plugins/wayfinder/src/navGraph.js +1 -1
- package/dist/plugins/wayfinder/src/stepBuilder.js +1 -1
- package/dist/plugins/wayfinder/src/wayfinder.js +1 -1
- package/dist/src/controller.js +1 -1
- package/dist/src/utils/dom.js +1 -1
- package/dist/src/utils/geom.js +1 -1
- package/package.json +10 -8
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var R = require('ramda');
|
|
6
4
|
var Zousan = require('zousan');
|
|
7
5
|
var buildStructureLookup = require('../../../src/utils/buildStructureLookup.js');
|
|
@@ -11,10 +9,7 @@ var navGraph = require('./navGraph.js');
|
|
|
11
9
|
var navGraphDebug = require('./navGraphDebug.js');
|
|
12
10
|
var segmentBuilder = require('./segmentBuilder.js');
|
|
13
11
|
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function _interopNamespace(e) {
|
|
17
|
-
if (e && e.__esModule) return e;
|
|
12
|
+
function _interopNamespaceDefault(e) {
|
|
18
13
|
var n = Object.create(null);
|
|
19
14
|
if (e) {
|
|
20
15
|
Object.keys(e).forEach(function (k) {
|
|
@@ -27,12 +22,11 @@ function _interopNamespace(e) {
|
|
|
27
22
|
}
|
|
28
23
|
});
|
|
29
24
|
}
|
|
30
|
-
n
|
|
25
|
+
n.default = e;
|
|
31
26
|
return Object.freeze(n);
|
|
32
27
|
}
|
|
33
28
|
|
|
34
|
-
var R__namespace = /*#__PURE__*/
|
|
35
|
-
var Zousan__default = /*#__PURE__*/_interopDefaultLegacy(Zousan);
|
|
29
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
36
30
|
|
|
37
31
|
const DEFAULT_WALKING_SPEED_M_PER_MIN = 60;
|
|
38
32
|
|
|
@@ -81,7 +75,7 @@ function create (app, config) {
|
|
|
81
75
|
app.bus.send('venueData/loadNavGraph');
|
|
82
76
|
};
|
|
83
77
|
|
|
84
|
-
let graphLoadedProm = new
|
|
78
|
+
let graphLoadedProm = new Zousan();
|
|
85
79
|
|
|
86
80
|
/**
|
|
87
81
|
* Returns nav graph object for testing purposes.
|
|
@@ -234,7 +228,7 @@ function create (app, config) {
|
|
|
234
228
|
const isEndpoint = R__namespace.pipe(
|
|
235
229
|
R__namespace.pick(endpointProps),
|
|
236
230
|
R__namespace.keys,
|
|
237
|
-
R__namespace.propEq(
|
|
231
|
+
R__namespace.propEq(endpointProps.length, 'length'),
|
|
238
232
|
Boolean
|
|
239
233
|
);
|
|
240
234
|
|
|
@@ -276,9 +270,9 @@ function create (app, config) {
|
|
|
276
270
|
|
|
277
271
|
const queues = route.waypoints
|
|
278
272
|
.filter(node =>
|
|
279
|
-
R__namespace.pathEq(['securityLane', 'type'],
|
|
280
|
-
R__namespace.pathEq(['securityLane', 'type'],
|
|
281
|
-
const containsSecurityLaneType = type => Boolean(route.waypoints.find(R__namespace.pathEq(['securityLane', 'type']
|
|
273
|
+
R__namespace.pathEq(SecurityLaneType.SECURITY, ['securityLane', 'type'], node) ||
|
|
274
|
+
R__namespace.pathEq(SecurityLaneType.IMMIGRATION, ['securityLane', 'type'], node));
|
|
275
|
+
const containsSecurityLaneType = type => Boolean(route.waypoints.find(R__namespace.pathEq(type, ['securityLane', 'type'])));
|
|
282
276
|
return {
|
|
283
277
|
routeExists: true,
|
|
284
278
|
queues,
|
|
@@ -562,7 +556,7 @@ function create (app, config) {
|
|
|
562
556
|
* Resets plugin state
|
|
563
557
|
*/
|
|
564
558
|
app.bus.on('venueData/loadNewVenue', () => {
|
|
565
|
-
graphLoadedProm = new
|
|
559
|
+
graphLoadedProm = new Zousan();
|
|
566
560
|
init();
|
|
567
561
|
});
|
|
568
562
|
|
package/dist/cjs/src/app.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var IObject = require('IObject');
|
|
6
4
|
var queryString = require('query-string');
|
|
7
5
|
var R = require('ramda');
|
|
@@ -13,31 +11,7 @@ var bustle = require('./extModules/bustle.js');
|
|
|
13
11
|
var log = require('./extModules/log.js');
|
|
14
12
|
var i18n = require('./utils/i18n.js');
|
|
15
13
|
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, 'default': e }); }
|
|
19
|
-
|
|
20
|
-
function _interopNamespace(e) {
|
|
21
|
-
if (e && e.__esModule) return e;
|
|
22
|
-
var n = Object.create(null);
|
|
23
|
-
if (e) {
|
|
24
|
-
Object.keys(e).forEach(function (k) {
|
|
25
|
-
if (k !== 'default') {
|
|
26
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
27
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () { return e[k]; }
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
n["default"] = e;
|
|
35
|
-
return Object.freeze(n);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var IObject__default = /*#__PURE__*/_interopDefaultLegacy(IObject);
|
|
39
|
-
var queryString__default = /*#__PURE__*/_interopDefaultLegacy(queryString);
|
|
40
|
-
var Zousan__default = /*#__PURE__*/_interopDefaultLegacy(Zousan);
|
|
14
|
+
function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
|
|
41
15
|
|
|
42
16
|
const isBrowser = typeof window !== 'undefined';
|
|
43
17
|
const TRACE = false;
|
|
@@ -56,7 +30,7 @@ async function setupPlugin (app, id, config) {
|
|
|
56
30
|
}
|
|
57
31
|
}
|
|
58
32
|
|
|
59
|
-
return (
|
|
33
|
+
return import(`../plugins/${id}/src/${name}.js`)
|
|
60
34
|
.then(pluginModule => {
|
|
61
35
|
app.log.info(`Creating plugin ${id}`);
|
|
62
36
|
return pluginModule.create(app, config)
|
|
@@ -71,7 +45,7 @@ const getLang = config => {
|
|
|
71
45
|
const supportedLanguages = config.supportedLanguages || ['ar', 'de', 'en', 'es', 'fr', 'hi', 'is', 'it', 'ja', 'ko', 'pl', 'pt', 'zh-Hans', 'zh-Hant'];
|
|
72
46
|
|
|
73
47
|
if (typeof window !== 'undefined') { // if this is a browser...
|
|
74
|
-
const queryParms =
|
|
48
|
+
const queryParms = queryString.parse(location.search);
|
|
75
49
|
// eslint-disable-next-line no-constant-condition
|
|
76
50
|
let lang = queryParms.lang || (typeof navigator ? navigator.language : null);
|
|
77
51
|
while (lang)
|
|
@@ -86,8 +60,8 @@ const getLang = config => {
|
|
|
86
60
|
|
|
87
61
|
async function loadConfig (name) {
|
|
88
62
|
return isBrowser
|
|
89
|
-
? (
|
|
90
|
-
: (
|
|
63
|
+
? import(`./configs/${name}.json`)
|
|
64
|
+
: import(`./configs/${name}.json.js`) // bit of a hack - but supports all versions of node. See https://gitlab.com/locuslabspublic/node-sdk/-/merge_requests/1
|
|
91
65
|
}
|
|
92
66
|
|
|
93
67
|
async function extendConfig (config, extendsConfigs) {
|
|
@@ -105,12 +79,12 @@ async function extendConfig (config, extendsConfigs) {
|
|
|
105
79
|
// const isSimpleName = name => /^[-a-zA-Z0-9]+$/.test(name) // composed of only alphanumeric and dash
|
|
106
80
|
|
|
107
81
|
const createPostProcessor = name =>
|
|
108
|
-
config => (
|
|
82
|
+
config => import(`./configs/postproc-${name}.js`)
|
|
109
83
|
.then(pp => pp.process(config));
|
|
110
84
|
|
|
111
85
|
const handleConfigPostProcess = async config =>
|
|
112
86
|
config.configPostProc
|
|
113
|
-
?
|
|
87
|
+
? Zousan.series(config, ...config.configPostProc.map(createPostProcessor))
|
|
114
88
|
: config;
|
|
115
89
|
|
|
116
90
|
async function create (rawConfig) {
|
|
@@ -125,18 +99,18 @@ async function create (rawConfig) {
|
|
|
125
99
|
config = await handleConfigPostProcess(config);
|
|
126
100
|
|
|
127
101
|
const lang = getLang(config);
|
|
128
|
-
const i18n$1 = await i18n
|
|
102
|
+
const i18n$1 = await i18n.default(lang, { debug: config.debug });
|
|
129
103
|
appInstance.i18n = () => i18n$1;
|
|
130
104
|
appInstance.gt = () => i18n$1.t.bind(i18n$1); // get translation function - don't hold this, it is bound to current lang
|
|
131
105
|
appInstance.config = config;
|
|
132
106
|
|
|
133
|
-
appInstance.plugins = new
|
|
107
|
+
appInstance.plugins = new IObject();
|
|
134
108
|
const appLog = log.initLog('web-engine', { enabled: !!config.debug, isBrowser, color: 'cyan', logFilter: config.logFilter, truncateObjects: !isBrowser, trace: TRACE });
|
|
135
109
|
|
|
136
110
|
appInstance.log = appLog.sublog(config.name);
|
|
137
111
|
appInstance.bus = bustle.create({ showEvents: true, reportAllErrors: true, log: appLog });
|
|
138
112
|
|
|
139
|
-
appInstance.info = { wePkg: _package
|
|
113
|
+
appInstance.info = { wePkg: _package.default }; // web-engine package
|
|
140
114
|
|
|
141
115
|
if (typeof window !== 'undefined') { // Prepare for non-browser environments
|
|
142
116
|
if (config.debug) {
|
|
@@ -153,7 +127,7 @@ async function create (rawConfig) {
|
|
|
153
127
|
appInstance.env = env.buildEnv(appInstance);
|
|
154
128
|
|
|
155
129
|
if (config.theme) { // the following is only needed when UI is active - which requires a theme
|
|
156
|
-
await
|
|
130
|
+
await Zousan.evaluate(
|
|
157
131
|
{ name: 'ThemeManagerModule', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) },
|
|
158
132
|
{ name: 'HistoryManager', value: Promise.resolve().then(function () { return require('./historyManager.js'); }) },
|
|
159
133
|
{ name: 'LayerManager', value: Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); }) }
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
require('query-string');
|
|
6
4
|
var R = require('ramda');
|
|
7
5
|
require('zousan');
|
|
8
6
|
|
|
9
|
-
function
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
11
8
|
var n = Object.create(null);
|
|
12
9
|
if (e) {
|
|
13
10
|
Object.keys(e).forEach(function (k) {
|
|
@@ -20,11 +17,11 @@ function _interopNamespace(e) {
|
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
|
-
n
|
|
20
|
+
n.default = e;
|
|
24
21
|
return Object.freeze(n);
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
var R__namespace = /*#__PURE__*/
|
|
24
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
28
25
|
|
|
29
26
|
/**
|
|
30
27
|
* Given a state string (JSON representation of latestState above) this will
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var IObject = require('IObject');
|
|
6
4
|
var app = require('./app.js');
|
|
7
5
|
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var IObject__default = /*#__PURE__*/_interopDefaultLegacy(IObject);
|
|
11
|
-
|
|
12
6
|
/**
|
|
13
7
|
* This manages the creation and organization of your App instances.
|
|
14
8
|
* Each instance is created via the create function - passing in a configuration
|
|
15
9
|
* object, which extends any existing configuration template.
|
|
16
10
|
*/
|
|
17
11
|
|
|
12
|
+
|
|
18
13
|
// IObject.freeze = 'DEEP'
|
|
19
14
|
|
|
20
15
|
// This is a list of "instances" of your full app stack. Often this will be only one.
|
|
21
16
|
// If you wish to give it a name, use the appName property. Else one will be assigned.
|
|
22
|
-
let apps = new
|
|
17
|
+
let apps = new IObject();
|
|
23
18
|
|
|
24
19
|
// The configuration template is used as the base configurationx for all app
|
|
25
20
|
// instances. It can be set with setConfigTemplate
|
|
26
|
-
const configTemplate = new
|
|
21
|
+
const configTemplate = new IObject();
|
|
27
22
|
|
|
28
|
-
const sendAlert = msg => typeof window !== 'undefined' ? window.alert(msg) : console.error(msg);
|
|
23
|
+
const sendAlert = msg => typeof window !== 'undefined' && window.alert ? window.alert(msg) : console.error(msg);
|
|
29
24
|
|
|
30
25
|
/**
|
|
31
26
|
* Create a new instance of the engine. Pass in a configuration object which will
|
|
@@ -36,7 +31,7 @@ async function create (config) {
|
|
|
36
31
|
if (!config) { throw Error('Attempt to create App instance with no configuration') }
|
|
37
32
|
|
|
38
33
|
// Create a new immutable configuration based on the configuration template
|
|
39
|
-
let myConfig = new
|
|
34
|
+
let myConfig = new IObject(Object.assign({}, configTemplate, config));
|
|
40
35
|
|
|
41
36
|
// If no name was defined for this instance, create one.
|
|
42
37
|
const appName = myConfig.appName || 'Instance' + (Object.keys(apps).length + 1);
|
|
@@ -5,8 +5,7 @@ var navGraphDebug = require('../plugins/wayfinder/src/navGraphDebug.js');
|
|
|
5
5
|
var dom = require('./utils/dom.js');
|
|
6
6
|
var funcs = require('./utils/funcs.js');
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
if (e && e.__esModule) return e;
|
|
8
|
+
function _interopNamespaceDefault(e) {
|
|
10
9
|
var n = Object.create(null);
|
|
11
10
|
if (e) {
|
|
12
11
|
Object.keys(e).forEach(function (k) {
|
|
@@ -19,11 +18,11 @@ function _interopNamespace(e) {
|
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
20
|
}
|
|
22
|
-
n
|
|
21
|
+
n.default = e;
|
|
23
22
|
return Object.freeze(n);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
var R__namespace = /*#__PURE__*/
|
|
25
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
27
26
|
|
|
28
27
|
if (typeof window !== 'undefined')
|
|
29
28
|
window.R = R__namespace; // helps use Rambda in console... probably don't want to do this once we integrate with customer content
|
package/dist/cjs/src/env.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
function buildEnv (app) {
|
|
6
4
|
const desktopViewMinWidth = app.config.desktopViewMinWidth || 0; // default to desktop view for all sizes
|
|
7
5
|
const isBrowser = typeof window !== 'undefined';
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var Zousan = require('zousan');
|
|
6
4
|
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var Zousan__default = /*#__PURE__*/_interopDefaultLegacy(Zousan);
|
|
10
|
-
|
|
11
5
|
/**
|
|
12
6
|
* Bustle is a highly performant event bus that offers event order guarantees.
|
|
13
7
|
*/
|
|
14
8
|
|
|
9
|
+
|
|
15
10
|
const bustleResponseComparitor = (r1, r2) => {
|
|
16
11
|
if (r1.responseOrder == null) // null or undefined
|
|
17
12
|
return r2.responseOrder == null ? 0 : 1 // any order is higher pri than none
|
|
@@ -96,14 +91,14 @@ function create (opts = { }) {
|
|
|
96
91
|
if (opts.reportAllErrors)
|
|
97
92
|
log.error(err);
|
|
98
93
|
if (opts.rejectOnError)
|
|
99
|
-
res.push(
|
|
94
|
+
res.push(Zousan.reject(err)); // will cause the Zousan.all to reject the send
|
|
100
95
|
else
|
|
101
96
|
res.push(err);
|
|
102
97
|
}
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
100
|
|
|
106
|
-
const results =
|
|
101
|
+
const results = Zousan.all(res);
|
|
107
102
|
|
|
108
103
|
if (myMons) {
|
|
109
104
|
for (const listener of myMons) {
|
|
@@ -125,7 +120,7 @@ function create (opts = { }) {
|
|
|
125
120
|
// promise is rejected
|
|
126
121
|
const get = (ev, ob) =>
|
|
127
122
|
send(ev, ob).then(res => res.length !== 1
|
|
128
|
-
?
|
|
123
|
+
? Zousan.reject(`${ev} event did not return a single result, but ${res.length} results.`)
|
|
129
124
|
: res[0]);
|
|
130
125
|
|
|
131
126
|
// Allows for any number of listeners to exist - but extracts the first one
|
|
@@ -144,7 +139,7 @@ function create (opts = { }) {
|
|
|
144
139
|
} else
|
|
145
140
|
log.info('send with', ev, ' and ', ob);
|
|
146
141
|
}
|
|
147
|
-
return new
|
|
142
|
+
return new Zousan(resolve => Zousan.soon(serve(ev, ob, resolve)))
|
|
148
143
|
}
|
|
149
144
|
|
|
150
145
|
return { get, getFirst, moff, monitor, off, on, send }
|
|
@@ -4,10 +4,6 @@ var Zousan = require('zousan');
|
|
|
4
4
|
var help = require('./help.js');
|
|
5
5
|
var validate = require('./validate.js');
|
|
6
6
|
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var Zousan__default = /*#__PURE__*/_interopDefaultLegacy(Zousan);
|
|
10
|
-
|
|
11
7
|
const COMMAND_VALIDATION_REGEX = /^[-_.0-9a-zA-Z]+$/;
|
|
12
8
|
const JS = JSON.stringify;
|
|
13
9
|
|
|
@@ -37,7 +33,7 @@ function create () {
|
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
function execute (cob) {
|
|
40
|
-
return new
|
|
36
|
+
return new Zousan((resolve, reject) => {
|
|
41
37
|
if (!cob) { return reject(new Error(`No command specified in command object ${JS(cob)}`)) }
|
|
42
38
|
|
|
43
39
|
const commandMatches = library.commandDefsList
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var R = require('ramda');
|
|
6
4
|
|
|
7
|
-
function
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
9
6
|
var n = Object.create(null);
|
|
10
7
|
if (e) {
|
|
11
8
|
Object.keys(e).forEach(function (k) {
|
|
@@ -18,11 +15,11 @@ function _interopNamespace(e) {
|
|
|
18
15
|
}
|
|
19
16
|
});
|
|
20
17
|
}
|
|
21
|
-
n
|
|
18
|
+
n.default = e;
|
|
22
19
|
return Object.freeze(n);
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
var R__namespace = /*#__PURE__*/
|
|
22
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
26
23
|
|
|
27
24
|
const buildStructuresLookup = (structures) => {
|
|
28
25
|
const floors = R__namespace.mergeAll(structures.map(R__namespace.prop('levels')));
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
const $ = (expr, container) => typeof expr === 'string' ? (container || document).querySelector(expr) : expr || null;
|
|
6
|
-
const $$ = (expr, container) => Array.prototype.slice.call((
|
|
4
|
+
const $$ = (expr, container) => Array.prototype.slice.call((document).querySelectorAll(expr));
|
|
7
5
|
|
|
8
6
|
// adds an element (default: div) defined in eConf to parent element (default: body) - returns element
|
|
9
7
|
// i.e.
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var helpers = require('@turf/helpers');
|
|
6
|
-
var pointToLineDistance = require('@turf/point-to-line-distance');
|
|
3
|
+
require('@turf/helpers');
|
|
4
|
+
require('@turf/point-to-line-distance');
|
|
7
5
|
var R = require('ramda');
|
|
8
6
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function _interopNamespace(e) {
|
|
12
|
-
if (e && e.__esModule) return e;
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
13
8
|
var n = Object.create(null);
|
|
14
9
|
if (e) {
|
|
15
10
|
Object.keys(e).forEach(function (k) {
|
|
@@ -22,12 +17,11 @@ function _interopNamespace(e) {
|
|
|
22
17
|
}
|
|
23
18
|
});
|
|
24
19
|
}
|
|
25
|
-
n
|
|
20
|
+
n.default = e;
|
|
26
21
|
return Object.freeze(n);
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
var
|
|
30
|
-
var R__namespace = /*#__PURE__*/_interopNamespace(R);
|
|
24
|
+
var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
|
|
31
25
|
|
|
32
26
|
// https://stackoverflow.com/questions/22521982/check-if-point-inside-a-polygon
|
|
33
27
|
const pointInPolygon = (point, vs) => {
|
|
@@ -89,53 +83,9 @@ function getStructureAtPoint (buildings, lat, lng, preciseFlag) {
|
|
|
89
83
|
if (buildingsWithinBoundsPolygon.length)
|
|
90
84
|
return findBuildingWithMinArea(buildingsWithinBoundingBox)
|
|
91
85
|
|
|
92
|
-
|
|
93
|
-
return null
|
|
94
|
-
|
|
95
|
-
const distancesToBuildings = buildingsWithinBoundingBox.map(building => distanceFromPointToBuilding(lat, lng, building));
|
|
96
|
-
const shortestDistance = Math.min.apply(null, distancesToBuildings);
|
|
97
|
-
const closestBuilding = buildingsWithinBoundingBox[distancesToBuildings.indexOf(shortestDistance)];
|
|
98
|
-
|
|
99
|
-
return closestBuilding
|
|
86
|
+
return null
|
|
100
87
|
}
|
|
101
88
|
|
|
102
|
-
// a Turf linestring is a multi-edge line defined by a series of vertices
|
|
103
|
-
// (basiclly what we call a boundsPolygon - but we need to construct via the library)
|
|
104
|
-
const buildingToTurfLineString = building =>
|
|
105
|
-
helpers.lineString(building.boundsPolygon.map(v => swap(v))); // turf uses [lng,lat] so we need to swap em
|
|
106
|
-
|
|
107
|
-
const lineStrings = { }; // building id => lineString object
|
|
108
|
-
|
|
109
|
-
// this function constructs a lineString (https://turfjs.org/docs/#lineString) from a building
|
|
110
|
-
// boundsPolygon which can be used to work with the Turf library. There is some cost in generating it
|
|
111
|
-
// so we cache the object for future use.
|
|
112
|
-
const getLineString = building => {
|
|
113
|
-
let lineString = lineStrings[building.id];
|
|
114
|
-
if (!lineString) {
|
|
115
|
-
lineString = buildingToTurfLineString(building);
|
|
116
|
-
lineStrings[building.id] = lineString;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return lineString
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const distanceFromPointToBuilding = (lat, lng, building) => {
|
|
123
|
-
for (let i = 0; i < 99; i++)
|
|
124
|
-
distanceFromPointToBuildingImp(lat, lng, building);
|
|
125
|
-
|
|
126
|
-
return distanceFromPointToBuildingImp(lat, lng, building)
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const distanceFromPointToBuildingImp = (lat, lng, building) => {
|
|
130
|
-
// First, create an array of distances of the lat,lng to each edge in the polygon - then return the minimum value in the array
|
|
131
|
-
const pt = helpers.point([lng, lat]);
|
|
132
|
-
|
|
133
|
-
const lineString = getLineString(building);
|
|
134
|
-
return pointToLineDistance__default["default"](pt, lineString) // distance in kilometers
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const swap = ar => [ar[1], ar[0]];
|
|
138
|
-
|
|
139
89
|
const calcBuildingArea = currentBuilding => {
|
|
140
90
|
if (!currentBuilding.bounds) return 0
|
|
141
91
|
const { n, s, e, w } = currentBuilding.bounds;
|
|
@@ -4,12 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var i18next = require('i18next');
|
|
6
6
|
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
10
|
-
|
|
11
7
|
async function init (langOverride, { debugMode, fallbackLng } = {}) {
|
|
12
|
-
const i18n =
|
|
8
|
+
const i18n = i18next.createInstance();
|
|
13
9
|
return i18n
|
|
14
10
|
// .use(dashEmAll)
|
|
15
11
|
// .use(pseudoTrans)
|
|
@@ -74,5 +70,5 @@ const loremIpsum = {
|
|
|
74
70
|
const toLang = (str, lang) => lang === 'en' ? str : repl(str, loremIpsum[lang]);
|
|
75
71
|
const repl = (str, r) => str.length < r.length ? r.substring(0, str.length) : r;
|
|
76
72
|
|
|
77
|
-
exports
|
|
73
|
+
exports.default = init;
|
|
78
74
|
exports.toLang = toLang;
|