venue-js 1.4.0-next.18 → 1.4.0-next.19

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/index.js CHANGED
@@ -495,6 +495,19 @@ var findContainingUnit = (poi, units) => {
495
495
  );
496
496
  return unit;
497
497
  };
498
+ var findContainingUnitAtPoint = (point2, levelId, units) => {
499
+ const unit = units.find(
500
+ (unit2) => {
501
+ try {
502
+ return unit2.properties.level_id === levelId && (0, import_boolean_point_in_polygon.booleanPointInPolygon)(point2, unit2);
503
+ } catch (e) {
504
+ console.log(`Cannot find containing unit of (point: ${point2}, levelId: ${levelId}):`, e.message);
505
+ return false;
506
+ }
507
+ }
508
+ );
509
+ return unit;
510
+ };
498
511
 
499
512
  // src/data/populator/index.ts
500
513
  var createPopulator = ({
@@ -667,6 +680,19 @@ var createPopulator = ({
667
680
  }
668
681
  };
669
682
  };
683
+ const populateSection = async (section) => {
684
+ const venue = await internalFindById(section.properties.venue_id);
685
+ const level = await internalFindById(section.properties.level_id);
686
+ return {
687
+ ...section,
688
+ properties: {
689
+ ...section.properties,
690
+ venue,
691
+ level: await populateLevel(level),
692
+ ordinal: level.properties.ordinal
693
+ }
694
+ };
695
+ };
670
696
  const populateRelationship = async (relationship) => {
671
697
  const originId = relationship.properties.origin?.id;
672
698
  const destinationId = relationship.properties.destination?.id;
@@ -684,19 +710,6 @@ var createPopulator = ({
684
710
  }
685
711
  };
686
712
  };
687
- const populateSection = async (section) => {
688
- const venue = await internalFindById(section.properties.venue_id);
689
- const level = await internalFindById(section.properties.level_id);
690
- return {
691
- ...section,
692
- properties: {
693
- ...section.properties,
694
- venue,
695
- level: await populateLevel(level),
696
- ordinal: level.properties.ordinal
697
- }
698
- };
699
- };
700
713
  const populateUnit = async (unit) => {
701
714
  const venue = await internalFindById(unit.properties.venue_id);
702
715
  const level = await internalFindById(unit.properties.level_id);
@@ -773,1366 +786,1649 @@ var createPopulator = ({
773
786
  };
774
787
  };
775
788
 
776
- // ../../node_modules/fuse.js/dist/fuse.mjs
777
- function isArray(value) {
778
- return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value);
779
- }
780
- var INFINITY = 1 / 0;
781
- function baseToString(value) {
782
- if (typeof value == "string") {
783
- return value;
784
- }
785
- let result = value + "";
786
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
787
- }
788
- function toString(value) {
789
- return value == null ? "" : baseToString(value);
790
- }
791
- function isString(value) {
792
- return typeof value === "string";
793
- }
794
- function isNumber(value) {
795
- return typeof value === "number";
796
- }
797
- function isBoolean(value) {
798
- return value === true || value === false || isObjectLike(value) && getTag(value) == "[object Boolean]";
799
- }
800
- function isObject(value) {
801
- return typeof value === "object";
802
- }
803
- function isObjectLike(value) {
804
- return isObject(value) && value !== null;
805
- }
806
- function isDefined(value) {
807
- return value !== void 0 && value !== null;
808
- }
809
- function isBlank(value) {
810
- return !value.trim().length;
811
- }
812
- function getTag(value) {
813
- return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value);
814
- }
815
- var INCORRECT_INDEX_TYPE = "Incorrect 'index' type";
816
- var LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key) => `Invalid value for key ${key}`;
817
- var PATTERN_LENGTH_TOO_LARGE = (max2) => `Pattern length exceeds max of ${max2}.`;
818
- var MISSING_KEY_PROPERTY = (name) => `Missing ${name} property in key`;
819
- var INVALID_KEY_WEIGHT_VALUE = (key) => `Property 'weight' in key '${key}' must be a positive integer`;
820
- var hasOwn = Object.prototype.hasOwnProperty;
821
- var KeyStore = class {
822
- constructor(keys) {
823
- this._keys = [];
824
- this._keyMap = {};
825
- let totalWeight = 0;
826
- keys.forEach((key) => {
827
- let obj = createKey(key);
828
- this._keys.push(obj);
829
- this._keyMap[obj.id] = obj;
830
- totalWeight += obj.weight;
831
- });
832
- this._keys.forEach((key) => {
833
- key.weight /= totalWeight;
834
- });
835
- }
836
- get(keyId) {
837
- return this._keyMap[keyId];
838
- }
839
- keys() {
840
- return this._keys;
841
- }
842
- toJSON() {
843
- return JSON.stringify(this._keys);
844
- }
789
+ // src/data/search/getSearchClient.ts
790
+ var import_fuse = __toESM(require("fuse.js"));
791
+
792
+ // src/data/search/utils/sanitizeInput.ts
793
+ var sanitizeInput = (str) => str.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g, "").replace(/[\-–—_./()]+/g, "").normalize("NFC").trim();
794
+
795
+ // src/data/search/getSearchClient.ts
796
+ var getSearchClient = ({ occupants, amenities }) => {
797
+ const fuseAmenities = new import_fuse.default(amenities, {
798
+ threshold: 0.2,
799
+ keys: [
800
+ { name: "properties.name", "weight": 1, getFn: (obj) => Object.values(obj.properties.name || {}) },
801
+ { name: "properties.category", "weight": 1 }
802
+ ]
803
+ });
804
+ const fuseOccupants = new import_fuse.default(occupants, {
805
+ threshold: 0.25,
806
+ // 0.2 is too strict (can't find Mo-Mo Paradise with "momo" search string)
807
+ includeScore: true,
808
+ shouldSort: true,
809
+ keys: [
810
+ { name: "properties.name", "weight": 4, getFn: (obj) => Object.values(obj.properties.name || {}) },
811
+ { name: "properties.keywords", "weight": 0.5 },
812
+ { name: "properties.category", "weight": 0.25 },
813
+ { name: "properties.local_category_names", "weight": 0.25 },
814
+ { name: "properties.description", "weight": 0.25, getFn: (occ) => Object.values(occ.properties.description || {}) },
815
+ { name: "properties.unit_name", "weight": 0.25 },
816
+ { name: "properties.kiosk_name", "weight": 0.25 }
817
+ ]
818
+ });
819
+ const search = (value) => {
820
+ const sanitizedValue = sanitizeInput(value);
821
+ const matchedAmenities = fuseAmenities.search(sanitizedValue);
822
+ const matchedOccupants = fuseOccupants.search(sanitizedValue);
823
+ return [...matchedAmenities, ...matchedOccupants];
824
+ };
825
+ return {
826
+ search
827
+ };
845
828
  };
846
- function createKey(key) {
847
- let path = null;
848
- let id = null;
849
- let src = null;
850
- let weight = 1;
851
- let getFn = null;
852
- if (isString(key) || isArray(key)) {
853
- src = key;
854
- path = createKeyPath(key);
855
- id = createKeyId(key);
856
- } else {
857
- if (!hasOwn.call(key, "name")) {
858
- throw new Error(MISSING_KEY_PROPERTY("name"));
859
- }
860
- const name = key.name;
861
- src = name;
862
- if (hasOwn.call(key, "weight")) {
863
- weight = key.weight;
864
- if (weight <= 0) {
865
- throw new Error(INVALID_KEY_WEIGHT_VALUE(name));
866
- }
829
+
830
+ // src/data/navigate/getNavigateClient.ts
831
+ var import_boolean_point_in_polygon4 = require("@turf/boolean-point-in-polygon");
832
+
833
+ // src/data/navigate/graph/prepare.ts
834
+ var import_lodash10 = __toESM(require("lodash"));
835
+ var import_node_dijkstra = __toESM(require("node-dijkstra"));
836
+ var import_distance3 = require("@turf/distance");
837
+ var import_center5 = require("@turf/center");
838
+
839
+ // src/data/navigate/graph/nodemap/createTraversalNodeMap.ts
840
+ var import_distance = require("@turf/distance");
841
+ var import_center3 = require("@turf/center");
842
+ var import_lodash3 = __toESM(require("lodash"));
843
+
844
+ // src/data/navigate/graph/constants.ts
845
+ var ROOM_BASEDISTANCE = 1e3;
846
+ var TERRACE_BASEDISTANCE = 1e3;
847
+ var ESCALATOR_BASEDISTANCE = 200;
848
+ var RAMP_BASEDISTANCE = 200;
849
+ var ELEVATOR_BASEDISTANCE = 500;
850
+ var STAIR_BASEDISTANCE = 1e5;
851
+ var BASE_POI_BASEDISTANCE = 9999999;
852
+ var DEFAULT_UNIT_BASEDISTANCE_OPTIONS = {
853
+ default: { baseDistance: 0 },
854
+ byCategory: {
855
+ room: { baseDistance: ROOM_BASEDISTANCE },
856
+ terrace: { baseDistance: TERRACE_BASEDISTANCE },
857
+ escalator: { baseDistance: ESCALATOR_BASEDISTANCE, scaleDistanceByLevel: false },
858
+ ramp: { baseDistance: RAMP_BASEDISTANCE, scaleDistanceByLevel: false },
859
+ elevator: { baseDistance: ELEVATOR_BASEDISTANCE, scaleDistanceByLevel: false },
860
+ stairs: {
861
+ baseDistance: STAIR_BASEDISTANCE,
862
+ scaleDistanceByLevel: true
863
+ },
864
+ "stairs.emergencyexit": {
865
+ baseDistance: STAIR_BASEDISTANCE,
866
+ scaleDistanceByLevel: true
867
867
  }
868
- path = createKeyPath(name);
869
- id = createKeyId(name);
870
- getFn = key.getFn;
871
868
  }
872
- return { path, id, weight, src, getFn };
873
- }
874
- function createKeyPath(key) {
875
- return isArray(key) ? key : key.split(".");
876
- }
877
- function createKeyId(key) {
878
- return isArray(key) ? key.join(".") : key;
879
- }
880
- function get(obj, path) {
881
- let list = [];
882
- let arr = false;
883
- const deepGet = (obj2, path2, index) => {
884
- if (!isDefined(obj2)) {
885
- return;
886
- }
887
- if (!path2[index]) {
888
- list.push(obj2);
889
- } else {
890
- let key = path2[index];
891
- const value = obj2[key];
892
- if (!isDefined(value)) {
893
- return;
894
- }
895
- if (index === path2.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) {
896
- list.push(toString(value));
897
- } else if (isArray(value)) {
898
- arr = true;
899
- for (let i = 0, len = value.length; i < len; i += 1) {
900
- deepGet(value[i], path2, index + 1);
901
- }
902
- } else if (path2.length) {
903
- deepGet(value, path2, index + 1);
904
- }
905
- }
906
- };
907
- deepGet(obj, isString(path) ? path.split(".") : path, 0);
908
- return arr ? list : list[0];
909
- }
910
- var MatchOptions = {
911
- // Whether the matches should be included in the result set. When `true`, each record in the result
912
- // set will include the indices of the matched characters.
913
- // These can consequently be used for highlighting purposes.
914
- includeMatches: false,
915
- // When `true`, the matching function will continue to the end of a search pattern even if
916
- // a perfect match has already been located in the string.
917
- findAllMatches: false,
918
- // Minimum number of characters that must be matched before a result is considered a match
919
- minMatchCharLength: 1
920
869
  };
921
- var BasicOptions = {
922
- // When `true`, the algorithm continues searching to the end of the input even if a perfect
923
- // match is found before the end of the same input.
924
- isCaseSensitive: false,
925
- // When `true`, the algorithm will ignore diacritics (accents) in comparisons
926
- ignoreDiacritics: false,
927
- // When true, the matching function will continue to the end of a search pattern even if
928
- includeScore: false,
929
- // List of properties that will be searched. This also supports nested properties.
930
- keys: [],
931
- // Whether to sort the result list, by score
932
- shouldSort: true,
933
- // Default sort function: sort by ascending score, ascending index
934
- sortFn: (a, b) => a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1
935
- };
936
- var FuzzyOptions = {
937
- // Approximately where in the text is the pattern expected to be found?
938
- location: 0,
939
- // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
940
- // (of both letters and location), a threshold of '1.0' would match anything.
941
- threshold: 0.6,
942
- // Determines how close the match must be to the fuzzy location (specified above).
943
- // An exact letter match which is 'distance' characters away from the fuzzy location
944
- // would score as a complete mismatch. A distance of '0' requires the match be at
945
- // the exact location specified, a threshold of '1000' would require a perfect match
946
- // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
947
- distance: 100
948
- };
949
- var AdvancedOptions = {
950
- // When `true`, it enables the use of unix-like search commands
951
- useExtendedSearch: false,
952
- // The get function to use when fetching an object's properties.
953
- // The default will search nested paths *ie foo.bar.baz*
954
- getFn: get,
955
- // When `true`, search will ignore `location` and `distance`, so it won't matter
956
- // where in the string the pattern appears.
957
- // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
958
- ignoreLocation: false,
959
- // When `true`, the calculation for the relevance score (used for sorting) will
960
- // ignore the field-length norm.
961
- // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
962
- ignoreFieldNorm: false,
963
- // The weight to determine how much field length norm effects scoring.
964
- fieldNormWeight: 1
870
+
871
+ // src/data/navigate/graph/utils/getDistanceOption.ts
872
+ var getDistanceOptions = (options, category) => {
873
+ if (!options) return DEFAULT_UNIT_BASEDISTANCE_OPTIONS.byCategory[category];
874
+ return (category && options.byCategory?.[category]) ?? DEFAULT_UNIT_BASEDISTANCE_OPTIONS.byCategory[category] ?? options?.default ?? DEFAULT_UNIT_BASEDISTANCE_OPTIONS.default;
965
875
  };
966
- var Config = {
967
- ...BasicOptions,
968
- ...MatchOptions,
969
- ...FuzzyOptions,
970
- ...AdvancedOptions
876
+
877
+ // src/data/utils/trace.ts
878
+ var trace = (namespace, text, ms, color) => {
879
+ console.log(`[${namespace}] %c${text.padEnd(90)} ${ms !== void 0 ? `${ms.toFixed(1).padStart(6)} ms` : ``}`, color ? `color: ${color}` : void 0);
971
880
  };
972
- var SPACE = /[^ ]+/g;
973
- function norm(weight = 1, mantissa = 3) {
974
- const cache = /* @__PURE__ */ new Map();
975
- const m = Math.pow(10, mantissa);
976
- return {
977
- get(value) {
978
- const numTokens = value.match(SPACE).length;
979
- if (cache.has(numTokens)) {
980
- return cache.get(numTokens);
881
+
882
+ // src/data/navigate/graph/nodemap/createTraversalNodeMap.ts
883
+ var createTraversalNodeMap = (unitOpenings, options) => {
884
+ const { units } = options.data;
885
+ let counter = 0;
886
+ const calculateFeatureDistanceWithinUnit = (features, distanceOptions) => {
887
+ let relationshipGraph = {};
888
+ for (let currentIndex = 0; currentIndex < features.length; currentIndex++) {
889
+ const isLastItem = currentIndex + 1 === features.length;
890
+ if (isLastItem) break;
891
+ for (let j = currentIndex + 1; j < features.length; j++) {
892
+ const opening = features[currentIndex];
893
+ const feature2 = features[j];
894
+ try {
895
+ const distance5 = (0, import_distance.distance)(
896
+ (0, import_center3.center)(opening.geometry),
897
+ (0, import_center3.center)(feature2.geometry),
898
+ { units: "meters" }
899
+ ) + (distanceOptions?.baseDistance ?? 0);
900
+ if (opening.id === feature2.id) continue;
901
+ import_lodash3.default.set(relationshipGraph, `${opening.id}.${feature2.id}`, distance5);
902
+ import_lodash3.default.set(relationshipGraph, `${feature2.id}.${opening.id}`, distance5);
903
+ counter++;
904
+ } catch (error) {
905
+ continue;
906
+ }
981
907
  }
982
- const norm2 = 1 / Math.pow(numTokens, 0.5 * weight);
983
- const n = parseFloat(Math.round(norm2 * m) / m);
984
- cache.set(numTokens, n);
985
- return n;
986
- },
987
- clear() {
988
- cache.clear();
989
908
  }
909
+ return relationshipGraph;
990
910
  };
991
- }
992
- var FuseIndex = class {
993
- constructor({
994
- getFn = Config.getFn,
995
- fieldNormWeight = Config.fieldNormWeight
996
- } = {}) {
997
- this.norm = norm(fieldNormWeight, 3);
998
- this.getFn = getFn;
999
- this.isCreated = false;
1000
- this.setIndexRecords();
1001
- }
1002
- setSources(docs = []) {
1003
- this.docs = docs;
1004
- }
1005
- setIndexRecords(records = []) {
1006
- this.records = records;
1007
- }
1008
- setKeys(keys = []) {
1009
- this.keys = keys;
1010
- this._keysMap = {};
1011
- keys.forEach((key, idx) => {
1012
- this._keysMap[key.id] = idx;
1013
- });
1014
- }
1015
- create() {
1016
- if (this.isCreated || !this.docs.length) {
1017
- return;
1018
- }
1019
- this.isCreated = true;
1020
- if (isString(this.docs[0])) {
1021
- this.docs.forEach((doc, docIndex) => {
1022
- this._addString(doc, docIndex);
1023
- });
1024
- } else {
1025
- this.docs.forEach((doc, docIndex) => {
1026
- this._addObject(doc, docIndex);
911
+ const t0 = performance.now();
912
+ const nodeMap = import_lodash3.default.reduce(
913
+ unitOpenings,
914
+ (acc, openings, unitId) => {
915
+ const unit = units.find((unit2) => unit2.id === unitId);
916
+ const unitDistanceOption = getDistanceOptions(options.unitDistanceOptions, unit.properties.category);
917
+ return import_lodash3.default.merge(
918
+ acc,
919
+ calculateFeatureDistanceWithinUnit(openings, unitDistanceOption)
920
+ );
921
+ },
922
+ {}
923
+ );
924
+ const t1 = performance.now();
925
+ trace("nav", ` \u2502 \u251C\u2500 add ${counter} traversal relationships`, t1 - t0);
926
+ return nodeMap;
927
+ };
928
+
929
+ // src/data/navigate/graph/nodemap/createElevatorNodeMap.ts
930
+ var import_lodash4 = __toESM(require("lodash"));
931
+ var createElevatorNodeMap = (elevatorLikeRelationships, unitOpenings, options) => {
932
+ const t0 = performance.now();
933
+ const { levels, units } = options.data;
934
+ const distanceOptions = getDistanceOptions(options.unitDistanceOptions, "elevator");
935
+ const {
936
+ baseDistance = ELEVATOR_BASEDISTANCE,
937
+ scaleDistanceByLevel = false
938
+ } = distanceOptions;
939
+ let elevatorNodeMap = {};
940
+ let counter = 0;
941
+ for (const relationship of elevatorLikeRelationships) {
942
+ try {
943
+ const {
944
+ origin: originTypeAndId,
945
+ intermediary,
946
+ destination: destinationTypeAndId
947
+ } = relationship.properties;
948
+ const origin = units.find((unit) => unit.id === originTypeAndId.id);
949
+ if (!origin) return;
950
+ const originOpenings = compact(unitOpenings[origin.id]);
951
+ const originLevel = levels.find((level) => level.id === origin.properties.level_id);
952
+ const destination = units.find((unit) => unit.id === destinationTypeAndId.id);
953
+ const destinationOpenings = unitOpenings[destination.id];
954
+ const destinationOpeningAndLevels = destinationOpenings.map((opening) => {
955
+ const level = levels.find((level2) => level2.id === destination.properties.level_id);
956
+ return { opening, level };
1027
957
  });
1028
- }
1029
- this.norm.clear();
1030
- }
1031
- // Adds a doc to the end of the index
1032
- add(doc) {
1033
- const idx = this.size();
1034
- if (isString(doc)) {
1035
- this._addString(doc, idx);
1036
- } else {
1037
- this._addObject(doc, idx);
1038
- }
1039
- }
1040
- // Removes the doc at the specified index of the index
1041
- removeAt(idx) {
1042
- this.records.splice(idx, 1);
1043
- for (let i = idx, len = this.size(); i < len; i += 1) {
1044
- this.records[i].i -= 1;
1045
- }
1046
- }
1047
- getValueForItemAtKeyId(item, keyId) {
1048
- return item[this._keysMap[keyId]];
1049
- }
1050
- size() {
1051
- return this.records.length;
1052
- }
1053
- _addString(doc, docIndex) {
1054
- if (!isDefined(doc) || isBlank(doc)) {
1055
- return;
1056
- }
1057
- let record = {
1058
- v: doc,
1059
- i: docIndex,
1060
- n: this.norm.get(doc)
1061
- };
1062
- this.records.push(record);
1063
- }
1064
- _addObject(doc, docIndex) {
1065
- let record = { i: docIndex, $: {} };
1066
- this.keys.forEach((key, keyIndex) => {
1067
- let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);
1068
- if (!isDefined(value)) {
1069
- return;
1070
- }
1071
- if (isArray(value)) {
1072
- let subRecords = [];
1073
- const stack = [{ nestedArrIndex: -1, value }];
1074
- while (stack.length) {
1075
- const { nestedArrIndex, value: value2 } = stack.pop();
1076
- if (!isDefined(value2)) {
1077
- continue;
958
+ const intermediaryOpeningAndLevels = intermediary.map((unitTypeAndId) => {
959
+ const openings = unitOpenings[unitTypeAndId.id];
960
+ const unit = units.find((unit2) => unit2.id === unitTypeAndId.id);
961
+ const level = levels.find((level2) => level2.id === unit.properties.level_id);
962
+ return openings.map((opening) => ({ opening, level }));
963
+ }).flat();
964
+ const connections = compact([...intermediaryOpeningAndLevels, ...destinationOpeningAndLevels]);
965
+ if (!originOpenings || originOpenings.length === 0) return;
966
+ for (const originOpening of originOpenings) {
967
+ for (const connection of connections) {
968
+ const { opening, level } = connection;
969
+ let distance5 = baseDistance;
970
+ if (scaleDistanceByLevel) {
971
+ const originOrdinal = originLevel.properties.ordinal;
972
+ const connectionOrdinal = level.properties.ordinal;
973
+ const levelDifference = Math.abs(originOrdinal - connectionOrdinal);
974
+ if (levelDifference > 0) distance5 *= levelDifference;
1078
975
  }
1079
- if (isString(value2) && !isBlank(value2)) {
1080
- let subRecord = {
1081
- v: value2,
1082
- i: nestedArrIndex,
1083
- n: this.norm.get(value2)
1084
- };
1085
- subRecords.push(subRecord);
1086
- } else if (isArray(value2)) {
1087
- value2.forEach((item, k) => {
1088
- stack.push({
1089
- nestedArrIndex: k,
1090
- value: item
1091
- });
1092
- });
1093
- } else ;
976
+ import_lodash4.default.set(elevatorNodeMap, `${originOpening.id}.${opening.id}`, distance5);
977
+ import_lodash4.default.set(elevatorNodeMap, `${opening.id}.${originOpening.id}`, distance5);
978
+ counter++;
1094
979
  }
1095
- record.$[keyIndex] = subRecords;
1096
- } else if (isString(value) && !isBlank(value)) {
1097
- let subRecord = {
1098
- v: value,
1099
- n: this.norm.get(value)
1100
- };
1101
- record.$[keyIndex] = subRecord;
1102
980
  }
1103
- });
1104
- this.records.push(record);
1105
- }
1106
- toJSON() {
1107
- return {
1108
- keys: this.keys,
1109
- records: this.records
1110
- };
981
+ } catch (err) {
982
+ console.log(err);
983
+ console.log("cannot create elevatorNodeMap for ", { relationship });
984
+ }
1111
985
  }
986
+ const t1 = performance.now();
987
+ trace("nav", ` \u2502 \u251C\u2500 add ${counter} escalator relationships`, t1 - t0);
988
+ return elevatorNodeMap;
1112
989
  };
1113
- function createIndex(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
1114
- const myIndex = new FuseIndex({ getFn, fieldNormWeight });
1115
- myIndex.setKeys(keys.map(createKey));
1116
- myIndex.setSources(docs);
1117
- myIndex.create();
1118
- return myIndex;
1119
- }
1120
- function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) {
1121
- const { keys, records } = data;
1122
- const myIndex = new FuseIndex({ getFn, fieldNormWeight });
1123
- myIndex.setKeys(keys);
1124
- myIndex.setIndexRecords(records);
1125
- return myIndex;
1126
- }
1127
- function computeScore$1(pattern, {
1128
- errors = 0,
1129
- currentLocation = 0,
1130
- expectedLocation = 0,
1131
- distance = Config.distance,
1132
- ignoreLocation = Config.ignoreLocation
1133
- } = {}) {
1134
- const accuracy = errors / pattern.length;
1135
- if (ignoreLocation) {
1136
- return accuracy;
1137
- }
1138
- const proximity = Math.abs(expectedLocation - currentLocation);
1139
- if (!distance) {
1140
- return proximity ? 1 : accuracy;
1141
- }
1142
- return accuracy + proximity / distance;
1143
- }
1144
- function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) {
1145
- let indices = [];
1146
- let start = -1;
1147
- let end = -1;
1148
- let i = 0;
1149
- for (let len = matchmask.length; i < len; i += 1) {
1150
- let match = matchmask[i];
1151
- if (match && start === -1) {
1152
- start = i;
1153
- } else if (!match && start !== -1) {
1154
- end = i - 1;
1155
- if (end - start + 1 >= minMatchCharLength) {
1156
- indices.push([start, end]);
1157
- }
1158
- start = -1;
990
+
991
+ // src/data/navigate/graph/nodemap/createEscalatorNodeMap.ts
992
+ var import_set = __toESM(require("lodash/set"));
993
+ var createEscalatorNodeMap = (relationships, options) => {
994
+ const t0 = performance.now();
995
+ const distanceOptions = getDistanceOptions(options.unitDistanceOptions, "escalator");
996
+ let counter = 0;
997
+ let nodeMap = {};
998
+ for (const relationship of relationships) {
999
+ const {
1000
+ properties: { direction, origin, destination }
1001
+ } = relationship;
1002
+ (0, import_set.default)(nodeMap, `${origin.id}.${destination.id}`, distanceOptions.baseDistance);
1003
+ if (direction === "undirected") {
1004
+ (0, import_set.default)(nodeMap, `${destination.id}.${origin.id}`, distanceOptions.baseDistance);
1159
1005
  }
1006
+ counter++;
1160
1007
  }
1161
- if (matchmask[i - 1] && i - start >= minMatchCharLength) {
1162
- indices.push([start, i - 1]);
1163
- }
1164
- return indices;
1165
- }
1166
- var MAX_BITS = 32;
1167
- function search(text, pattern, patternAlphabet, {
1168
- location = Config.location,
1169
- distance = Config.distance,
1170
- threshold = Config.threshold,
1171
- findAllMatches = Config.findAllMatches,
1172
- minMatchCharLength = Config.minMatchCharLength,
1173
- includeMatches = Config.includeMatches,
1174
- ignoreLocation = Config.ignoreLocation
1175
- } = {}) {
1176
- if (pattern.length > MAX_BITS) {
1177
- throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS));
1178
- }
1179
- const patternLen = pattern.length;
1180
- const textLen = text.length;
1181
- const expectedLocation = Math.max(0, Math.min(location, textLen));
1182
- let currentThreshold = threshold;
1183
- let bestLocation = expectedLocation;
1184
- const computeMatches = minMatchCharLength > 1 || includeMatches;
1185
- const matchMask = computeMatches ? Array(textLen) : [];
1186
- let index;
1187
- while ((index = text.indexOf(pattern, bestLocation)) > -1) {
1188
- let score = computeScore$1(pattern, {
1189
- currentLocation: index,
1190
- expectedLocation,
1191
- distance,
1192
- ignoreLocation
1193
- });
1194
- currentThreshold = Math.min(score, currentThreshold);
1195
- bestLocation = index + patternLen;
1196
- if (computeMatches) {
1197
- let i = 0;
1198
- while (i < patternLen) {
1199
- matchMask[index + i] = 1;
1200
- i += 1;
1008
+ const t1 = performance.now();
1009
+ trace("nav", ` \u2502 \u251C\u2500 add ${counter} escalator relationships`, t1 - t0);
1010
+ return nodeMap;
1011
+ };
1012
+
1013
+ // src/data/navigate/graph/nodemap/createRampNodeMap.ts
1014
+ var import_set2 = __toESM(require("lodash/set"));
1015
+ var createRampNodeMap = (relationships, options) => {
1016
+ const t0 = performance.now();
1017
+ const distanceOptions = getDistanceOptions(options.unitDistanceOptions, "ramp");
1018
+ let counter = 0;
1019
+ let nodeMap = {};
1020
+ relationships.forEach((relationship) => {
1021
+ const {
1022
+ properties: { origin, destination }
1023
+ } = relationship;
1024
+ (0, import_set2.default)(nodeMap, `${origin.id}.${destination.id}`, distanceOptions.baseDistance);
1025
+ (0, import_set2.default)(nodeMap, `${destination.id}.${origin.id}`, distanceOptions.baseDistance);
1026
+ counter++;
1027
+ });
1028
+ const t1 = performance.now();
1029
+ trace("nav", ` \u2502 \u251C\u2500 add ${counter} ramp relationships`, t1 - t0);
1030
+ return nodeMap;
1031
+ };
1032
+
1033
+ // src/data/navigate/graph/nodemap/createStairNodeMap.ts
1034
+ var import_lodash6 = __toESM(require("lodash"));
1035
+ var createStairNodeMap = (elevatorLikeRelationships, unitOpenings, options) => {
1036
+ const t0 = performance.now();
1037
+ const { levels = [], openings = [], units = [] } = options.data;
1038
+ const { baseDistance, scaleDistanceByLevel } = getDistanceOptions(options.unitDistanceOptions, "stairs");
1039
+ let elevatorNodeMap = {};
1040
+ let counter = 0;
1041
+ for (const relationship of elevatorLikeRelationships) {
1042
+ try {
1043
+ const {
1044
+ origin: { id: originId },
1045
+ intermediary,
1046
+ destination: { id: destinationId }
1047
+ } = relationship.properties;
1048
+ const origin = openings.find((opening) => opening.id === originId);
1049
+ if (!origin) return;
1050
+ const originLevel = levels.find((level) => level.id === origin.properties.level_id);
1051
+ const destination = openings.find((opening) => opening.id === destinationId);
1052
+ const destinationOpeningAndLevel = {
1053
+ opening: destination,
1054
+ level: levels.find((level) => level.id === destination.properties.level_id)
1055
+ };
1056
+ const intermediaryOpeningAndLevels = intermediary.map((unitTypeAndId) => {
1057
+ const openings2 = unitOpenings[unitTypeAndId.id];
1058
+ const unit = units.find((unit2) => unit2.id === unitTypeAndId.id);
1059
+ const level = levels.find((level2) => level2.id === unit.properties.level_id);
1060
+ return openings2.map((opening) => ({ opening, level }));
1061
+ }).flat();
1062
+ const connections = [...intermediaryOpeningAndLevels, destinationOpeningAndLevel];
1063
+ if (!origin) return;
1064
+ for (const connection of connections) {
1065
+ const { opening, level } = connection;
1066
+ let distance5 = baseDistance;
1067
+ if (scaleDistanceByLevel) {
1068
+ const originOrdinal = originLevel.properties.ordinal;
1069
+ const connectionOrdinal = level.properties.ordinal;
1070
+ const levelDifference = Math.abs(originOrdinal - connectionOrdinal);
1071
+ if (levelDifference > 0) distance5 *= levelDifference;
1072
+ }
1073
+ import_lodash6.default.set(elevatorNodeMap, `${origin.id}.${opening.id}`, distance5);
1074
+ import_lodash6.default.set(elevatorNodeMap, `${opening.id}.${origin.id}`, distance5);
1075
+ counter++;
1201
1076
  }
1077
+ } catch (err) {
1078
+ console.warn(
1079
+ "Failed to create stairNodeMap",
1080
+ {
1081
+ relationshipId: relationship.id,
1082
+ featureType: relationship.feature_type,
1083
+ error: err instanceof Error ? err.message : err,
1084
+ stack: err instanceof Error ? err.stack : void 0
1085
+ }
1086
+ );
1202
1087
  }
1203
1088
  }
1204
- bestLocation = -1;
1205
- let lastBitArr = [];
1206
- let finalScore = 1;
1207
- let binMax = patternLen + textLen;
1208
- const mask = 1 << patternLen - 1;
1209
- for (let i = 0; i < patternLen; i += 1) {
1210
- let binMin = 0;
1211
- let binMid = binMax;
1212
- while (binMin < binMid) {
1213
- const score2 = computeScore$1(pattern, {
1214
- errors: i,
1215
- currentLocation: expectedLocation + binMid,
1216
- expectedLocation,
1217
- distance,
1218
- ignoreLocation
1219
- });
1220
- if (score2 <= currentThreshold) {
1221
- binMin = binMid;
1222
- } else {
1223
- binMax = binMid;
1224
- }
1225
- binMid = Math.floor((binMax - binMin) / 2 + binMin);
1089
+ const t1 = performance.now();
1090
+ trace("nav", ` \u2502 \u251C\u2500 add ${counter} stairs relationships`, t1 - t0);
1091
+ return elevatorNodeMap;
1092
+ };
1093
+
1094
+ // src/data/navigate/graph/nodemap/createOccupantNodeMap.ts
1095
+ var import_lodash7 = __toESM(require("lodash"));
1096
+ var createOccupantNodeMap = (occupants) => {
1097
+ const t0 = performance.now();
1098
+ let nodeMap = {};
1099
+ let counter = 0;
1100
+ occupants.forEach((occupant) => {
1101
+ const { unit_id, unit_ids = [], kiosk_id, kiosk_ids = [] } = occupant.properties;
1102
+ const occupantRoomIds = compact([unit_id, ...unit_ids]);
1103
+ const occupantKioskIds = compact([kiosk_id, ...kiosk_ids]);
1104
+ for (const roomId of occupantRoomIds) {
1105
+ import_lodash7.default.set(nodeMap, `${roomId}.${occupant.id}`, 1e-3);
1106
+ import_lodash7.default.set(nodeMap, `${occupant.id}.${roomId}`, 1e-3);
1107
+ counter++;
1226
1108
  }
1227
- binMax = binMid;
1228
- let start = Math.max(1, expectedLocation - binMid + 1);
1229
- let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;
1230
- let bitArr = Array(finish + 2);
1231
- bitArr[finish + 1] = (1 << i) - 1;
1232
- for (let j = finish; j >= start; j -= 1) {
1233
- let currentLocation = j - 1;
1234
- let charMatch = patternAlphabet[text.charAt(currentLocation)];
1235
- if (computeMatches) {
1236
- matchMask[currentLocation] = +!!charMatch;
1237
- }
1238
- bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;
1239
- if (i) {
1240
- bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
1241
- }
1242
- if (bitArr[j] & mask) {
1243
- finalScore = computeScore$1(pattern, {
1244
- errors: i,
1245
- currentLocation,
1246
- expectedLocation,
1247
- distance,
1248
- ignoreLocation
1249
- });
1250
- if (finalScore <= currentThreshold) {
1251
- currentThreshold = finalScore;
1252
- bestLocation = currentLocation;
1253
- if (bestLocation <= expectedLocation) {
1254
- break;
1255
- }
1256
- start = Math.max(1, 2 * expectedLocation - bestLocation);
1109
+ for (const kioskId of occupantKioskIds) {
1110
+ import_lodash7.default.set(nodeMap, `${kioskId}.${occupant.id}`, 1e-3);
1111
+ import_lodash7.default.set(nodeMap, `${occupant.id}.${kioskId}`, 1e-3);
1112
+ counter++;
1113
+ }
1114
+ });
1115
+ const t1 = performance.now();
1116
+ trace("nav", ` \u2502 \u251C\u2500 add ${counter} occupants relationships`, t1 - t0);
1117
+ return nodeMap;
1118
+ };
1119
+
1120
+ // src/data/navigate/graph/nodemap/createPOINodeMaps.ts
1121
+ var import_center4 = require("@turf/center");
1122
+ var import_distance2 = require("@turf/distance");
1123
+ var import_lodash9 = __toESM(require("lodash"));
1124
+ var createPOINodeMap = (features, getFeatureUnit, unitOpenings) => {
1125
+ const t0 = performance.now();
1126
+ let nodeMap = {};
1127
+ let counter = 0;
1128
+ features.forEach((feat) => {
1129
+ try {
1130
+ const locatedOnUnitId = getFeatureUnit(feat);
1131
+ const openings = unitOpenings[locatedOnUnitId];
1132
+ const center8 = (0, import_center4.center)(feat);
1133
+ for (const opening of openings) {
1134
+ try {
1135
+ const openingCenter = (0, import_center4.center)(opening);
1136
+ const dis = (0, import_distance2.distance)(center8, openingCenter, { units: "meters" }) + BASE_POI_BASEDISTANCE;
1137
+ import_lodash9.default.set(nodeMap, `${opening.id}.${feat.id}`, dis);
1138
+ import_lodash9.default.set(nodeMap, `${feat.id}.${opening.id}`, dis);
1139
+ counter++;
1140
+ } catch (err) {
1141
+ console.log(err, opening);
1257
1142
  }
1258
1143
  }
1144
+ } catch (err) {
1145
+ console.log(err);
1146
+ console.log(`cannot connect poi to openings`, err.message, { feat });
1259
1147
  }
1260
- const score = computeScore$1(pattern, {
1261
- errors: i + 1,
1262
- currentLocation: expectedLocation,
1263
- expectedLocation,
1264
- distance,
1265
- ignoreLocation
1266
- });
1267
- if (score > currentThreshold) {
1268
- break;
1269
- }
1270
- lastBitArr = bitArr;
1271
- }
1272
- const result = {
1273
- isMatch: bestLocation >= 0,
1274
- // Count exact matches (those with a score of 0) to be "almost" exact
1275
- score: Math.max(1e-3, finalScore)
1276
- };
1277
- if (computeMatches) {
1278
- const indices = convertMaskToIndices(matchMask, minMatchCharLength);
1279
- if (!indices.length) {
1280
- result.isMatch = false;
1281
- } else if (includeMatches) {
1282
- result.indices = indices;
1148
+ });
1149
+ const type = features.length > 0 ? features[0].feature_type : "-";
1150
+ const t1 = performance.now();
1151
+ trace("nav", ` \u2502 \u251C\u2500 add ${counter} ${type} relationships`, t1 - t0);
1152
+ return nodeMap;
1153
+ };
1154
+
1155
+ // src/data/navigate/graph/utils/mergeNodeMap.ts
1156
+ var mergeNodeMap = (nodeMaps) => {
1157
+ const out = {};
1158
+ for (const nodeMap of nodeMaps) {
1159
+ for (const from in nodeMap) {
1160
+ out[from] = {
1161
+ ...out[from] ?? {},
1162
+ ...nodeMap[from]
1163
+ };
1283
1164
  }
1284
1165
  }
1285
- return result;
1286
- }
1287
- function createPatternAlphabet(pattern) {
1288
- let mask = {};
1289
- for (let i = 0, len = pattern.length; i < len; i += 1) {
1290
- const char = pattern.charAt(i);
1291
- mask[char] = (mask[char] || 0) | 1 << len - i - 1;
1292
- }
1293
- return mask;
1294
- }
1295
- var stripDiacritics = String.prototype.normalize ? ((str) => str.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "")) : ((str) => str);
1296
- var BitapSearch = class {
1297
- constructor(pattern, {
1298
- location = Config.location,
1299
- threshold = Config.threshold,
1300
- distance = Config.distance,
1301
- includeMatches = Config.includeMatches,
1302
- findAllMatches = Config.findAllMatches,
1303
- minMatchCharLength = Config.minMatchCharLength,
1304
- isCaseSensitive = Config.isCaseSensitive,
1305
- ignoreDiacritics = Config.ignoreDiacritics,
1306
- ignoreLocation = Config.ignoreLocation
1307
- } = {}) {
1308
- this.options = {
1309
- location,
1310
- threshold,
1311
- distance,
1312
- includeMatches,
1313
- findAllMatches,
1314
- minMatchCharLength,
1315
- isCaseSensitive,
1316
- ignoreDiacritics,
1317
- ignoreLocation
1318
- };
1319
- pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
1320
- pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
1321
- this.pattern = pattern;
1322
- this.chunks = [];
1323
- if (!this.pattern.length) {
1324
- return;
1166
+ return out;
1167
+ };
1168
+
1169
+ // src/data/navigate/graph/utils/createUnitOpenings.ts
1170
+ var import_uniqBy = __toESM(require("lodash/uniqBy"));
1171
+ var createUnitOpenings = (relationships, units, openings) => {
1172
+ const openingConnections = {};
1173
+ const relationshipMap = /* @__PURE__ */ new Map();
1174
+ relationships.forEach((relationship) => {
1175
+ const originId = relationship.properties.origin?.id || null;
1176
+ const destinationId = relationship.properties.destination?.id || null;
1177
+ if (!relationshipMap.has(originId)) {
1178
+ relationshipMap.set(originId, []);
1325
1179
  }
1326
- const addChunk = (pattern2, startIndex) => {
1327
- this.chunks.push({
1328
- pattern: pattern2,
1329
- alphabet: createPatternAlphabet(pattern2),
1330
- startIndex
1331
- });
1332
- };
1333
- const len = this.pattern.length;
1334
- if (len > MAX_BITS) {
1335
- let i = 0;
1336
- const remainder = len % MAX_BITS;
1337
- const end = len - remainder;
1338
- while (i < end) {
1339
- addChunk(this.pattern.substr(i, MAX_BITS), i);
1340
- i += MAX_BITS;
1341
- }
1342
- if (remainder) {
1343
- const startIndex = len - MAX_BITS;
1344
- addChunk(this.pattern.substr(startIndex), startIndex);
1345
- }
1346
- } else {
1347
- addChunk(this.pattern, 0);
1180
+ if (!relationshipMap.has(destinationId)) {
1181
+ relationshipMap.set(destinationId, []);
1348
1182
  }
1349
- }
1350
- searchIn(text) {
1351
- const { isCaseSensitive, ignoreDiacritics, includeMatches } = this.options;
1352
- text = isCaseSensitive ? text : text.toLowerCase();
1353
- text = ignoreDiacritics ? stripDiacritics(text) : text;
1354
- if (this.pattern === text) {
1355
- let result2 = {
1356
- isMatch: true,
1357
- score: 0
1358
- };
1359
- if (includeMatches) {
1360
- result2.indices = [[0, text.length - 1]];
1361
- }
1362
- return result2;
1183
+ relationshipMap.get(originId).push(relationship);
1184
+ relationshipMap.get(destinationId).push(relationship);
1185
+ });
1186
+ units.forEach((unit) => {
1187
+ const unitId = unit.id;
1188
+ const connectedRelationshop = relationshipMap.get(unitId) || [];
1189
+ const relationshipIntermediaryTypeAndId = connectedRelationshop.map(
1190
+ (relationship) => relationship.properties.intermediary[0]
1191
+ // Assuming intermediary is always an array
1192
+ );
1193
+ const relationshipIntermediary = relationshipIntermediaryTypeAndId.map(({ id }) => {
1194
+ return openings.find((opening) => opening.id === id);
1195
+ });
1196
+ openingConnections[unitId] = (0, import_uniqBy.default)(
1197
+ [...openingConnections[unitId] || [], ...relationshipIntermediary],
1198
+ "id"
1199
+ );
1200
+ });
1201
+ return openingConnections;
1202
+ };
1203
+
1204
+ // src/data/navigate/parsers.ts
1205
+ var parseOrdinalCoordinate = (id) => {
1206
+ return id.slice(0, -1).split(",").map(Number);
1207
+ };
1208
+
1209
+ // src/data/navigate/graph/prepare.ts
1210
+ var prepareGraph = (options) => {
1211
+ const {
1212
+ data: {
1213
+ amenities = [],
1214
+ anchors = [],
1215
+ occupants = [],
1216
+ relationships = [],
1217
+ openings = [],
1218
+ units = [],
1219
+ kiosks = [],
1220
+ levels = []
1363
1221
  }
1364
- const {
1365
- location,
1366
- distance,
1367
- threshold,
1368
- findAllMatches,
1369
- minMatchCharLength,
1370
- ignoreLocation
1371
- } = this.options;
1372
- let allIndices = [];
1373
- let totalScore = 0;
1374
- let hasMatches = false;
1375
- this.chunks.forEach(({ pattern, alphabet, startIndex }) => {
1376
- const { isMatch, score, indices } = search(text, pattern, alphabet, {
1377
- location: location + startIndex,
1378
- distance,
1379
- threshold,
1380
- findAllMatches,
1381
- minMatchCharLength,
1382
- includeMatches,
1383
- ignoreLocation
1384
- });
1385
- if (isMatch) {
1386
- hasMatches = true;
1387
- }
1388
- totalScore += score;
1389
- if (isMatch && indices) {
1390
- allIndices = [...allIndices, ...indices];
1222
+ } = options;
1223
+ const {
1224
+ traversal: traversalRelationships = [],
1225
+ escalator: escalatorRelationships = [],
1226
+ ramp: rampRelationships = [],
1227
+ elevator: elevatorRelationships = [],
1228
+ stairs: stairsRelationships = []
1229
+ } = import_lodash10.default.groupBy(relationships, "properties.category");
1230
+ const unitOpenings = createUnitOpenings(traversalRelationships, units, openings);
1231
+ const traversalNodeMap = createTraversalNodeMap(unitOpenings, options);
1232
+ const escalatorNodeMap = createEscalatorNodeMap(escalatorRelationships, options);
1233
+ const rampNodeMap = createRampNodeMap(rampRelationships, options);
1234
+ const elevatorNodeMap = createElevatorNodeMap(
1235
+ elevatorRelationships,
1236
+ unitOpenings,
1237
+ options
1238
+ );
1239
+ const stairNodeMap = createStairNodeMap(
1240
+ stairsRelationships,
1241
+ unitOpenings,
1242
+ options
1243
+ );
1244
+ const amenityNodeMap = createPOINodeMap(amenities, (amenity) => amenity.properties.unit_ids[0], unitOpenings);
1245
+ const anchorsNodeMap = createPOINodeMap(anchors, (anchor) => anchor.properties.unit_id, unitOpenings);
1246
+ const walkwayUnits = units.filter((unit) => unit.properties.category === "walkway");
1247
+ const kioskNodeMap = createPOINodeMap(kiosks, (kiosk) => findContainingUnit(kiosk, walkwayUnits)?.id, unitOpenings);
1248
+ const unitNodeMap = createPOINodeMap(units, (unit) => unit.id, unitOpenings);
1249
+ const occupantNodeMap = createOccupantNodeMap(occupants);
1250
+ const defaultGraph = new import_node_dijkstra.default(mergeNodeMap([
1251
+ traversalNodeMap,
1252
+ escalatorNodeMap,
1253
+ rampNodeMap,
1254
+ elevatorNodeMap,
1255
+ stairNodeMap,
1256
+ amenityNodeMap,
1257
+ anchorsNodeMap,
1258
+ kioskNodeMap,
1259
+ unitNodeMap,
1260
+ occupantNodeMap
1261
+ ]));
1262
+ const accessibleGraph = new import_node_dijkstra.default(mergeNodeMap([
1263
+ traversalNodeMap,
1264
+ rampNodeMap,
1265
+ elevatorNodeMap,
1266
+ amenityNodeMap,
1267
+ anchorsNodeMap,
1268
+ kioskNodeMap,
1269
+ unitNodeMap,
1270
+ occupantNodeMap
1271
+ ]));
1272
+ const addCoordinateOrdinalNode = (params, locatedOnUnit) => {
1273
+ const [lat, lng, ordinal] = parseOrdinalCoordinate(params);
1274
+ if (locatedOnUnit) {
1275
+ const openings2 = unitOpenings[locatedOnUnit.id];
1276
+ for (const opening of openings2) {
1277
+ const openingCenter = (0, import_center5.center)(opening);
1278
+ const dis = (0, import_distance3.distance)([lat, lng], openingCenter, { units: "meters" });
1279
+ defaultGraph.addNode(params, { [opening.id]: dis }).addNode(opening.id, { [params]: dis });
1280
+ accessibleGraph.addNode(params, { [opening.id]: dis }).addNode(opening.id, { [params]: dis });
1391
1281
  }
1392
- });
1393
- let result = {
1394
- isMatch: hasMatches,
1395
- score: hasMatches ? totalScore / this.chunks.length : 1
1396
- };
1397
- if (hasMatches && includeMatches) {
1398
- result.indices = allIndices;
1399
1282
  }
1400
- return result;
1401
- }
1283
+ };
1284
+ return { defaultGraph, accessibleGraph, unitOpenings, addCoordinateOrdinalNode };
1402
1285
  };
1403
- var BaseMatch = class {
1404
- constructor(pattern) {
1405
- this.pattern = pattern;
1406
- }
1407
- static isMultiMatch(pattern) {
1408
- return getMatch(pattern, this.multiRegex);
1409
- }
1410
- static isSingleMatch(pattern) {
1411
- return getMatch(pattern, this.singleRegex);
1412
- }
1413
- search() {
1414
- }
1415
- };
1416
- function getMatch(pattern, exp) {
1417
- const matches = pattern.match(exp);
1418
- return matches ? matches[1] : null;
1419
- }
1420
- var ExactMatch = class extends BaseMatch {
1421
- constructor(pattern) {
1422
- super(pattern);
1423
- }
1424
- static get type() {
1425
- return "exact";
1426
- }
1427
- static get multiRegex() {
1428
- return /^="(.*)"$/;
1429
- }
1430
- static get singleRegex() {
1431
- return /^=(.*)$/;
1432
- }
1433
- search(text) {
1434
- const isMatch = text === this.pattern;
1435
- return {
1436
- isMatch,
1437
- score: isMatch ? 0 : 1,
1438
- indices: [0, this.pattern.length - 1]
1439
- };
1440
- }
1286
+
1287
+ // src/data/navigate/steps/createStepUtils.ts
1288
+ var import_lodash12 = require("lodash");
1289
+ var import_intersectionBy = __toESM(require("lodash/intersectionBy"));
1290
+ var import_center9 = require("@turf/center");
1291
+
1292
+ // src/data/navigate/description/describe.ts
1293
+ var t = (template, locale, options) => {
1294
+ return template.replace(`{{intermediary}}`, options.intermediary ?? "").replace(`{{toward}}`, options.toward?.[locale] ?? "").replace(`{{landmark}}`, options.landmark?.[locale] ?? "");
1441
1295
  };
1442
- var InverseExactMatch = class extends BaseMatch {
1443
- constructor(pattern) {
1444
- super(pattern);
1445
- }
1446
- static get type() {
1447
- return "inverse-exact";
1448
- }
1449
- static get multiRegex() {
1450
- return /^!"(.*)"$/;
1451
- }
1452
- static get singleRegex() {
1453
- return /^!(.*)$/;
1454
- }
1455
- search(text) {
1456
- const index = text.indexOf(this.pattern);
1457
- const isMatch = index === -1;
1458
- return {
1459
- isMatch,
1460
- score: isMatch ? 0 : 1,
1461
- indices: [0, text.length - 1]
1462
- };
1463
- }
1296
+ var describeVerticalStep = (fromLevel, toLevel, intermediary) => {
1297
+ const dir = fromLevel.properties.ordinal < toLevel.properties.ordinal ? "up" : "down";
1298
+ const template = `Take the {{intermediary}} ${dir} to {{toward}}`;
1299
+ return {
1300
+ template,
1301
+ text: t(template, "en", { intermediary, toward: toLevel.properties.name })
1302
+ };
1464
1303
  };
1465
- var PrefixExactMatch = class extends BaseMatch {
1466
- constructor(pattern) {
1467
- super(pattern);
1468
- }
1469
- static get type() {
1470
- return "prefix-exact";
1471
- }
1472
- static get multiRegex() {
1473
- return /^\^"(.*)"$/;
1474
- }
1475
- static get singleRegex() {
1476
- return /^\^(.*)$/;
1477
- }
1478
- search(text) {
1479
- const isMatch = text.startsWith(this.pattern);
1480
- return {
1481
- isMatch,
1482
- score: isMatch ? 0 : 1,
1483
- indices: [0, this.pattern.length - 1]
1484
- };
1485
- }
1304
+ var describeHorizontalStep = (intermediary, toward, landmark) => {
1305
+ const template = `Follow the path ${intermediary === "walkway" ? `along the walkway` : `through {{intermediary}}`} ${toward ? `toward {{toward}}` : ``} ${landmark ? `near {{landmark}}` : ``}`.trim();
1306
+ return {
1307
+ text: t(template, "en", { intermediary, toward, landmark }),
1308
+ template
1309
+ };
1486
1310
  };
1487
- var InversePrefixExactMatch = class extends BaseMatch {
1488
- constructor(pattern) {
1489
- super(pattern);
1490
- }
1491
- static get type() {
1492
- return "inverse-prefix-exact";
1493
- }
1494
- static get multiRegex() {
1495
- return /^!\^"(.*)"$/;
1496
- }
1497
- static get singleRegex() {
1498
- return /^!\^(.*)$/;
1499
- }
1500
- search(text) {
1501
- const isMatch = !text.startsWith(this.pattern);
1502
- return {
1503
- isMatch,
1504
- score: isMatch ? 0 : 1,
1505
- indices: [0, text.length - 1]
1506
- };
1507
- }
1311
+
1312
+ // src/data/navigate/steps/path/index.ts
1313
+ var import_lodash11 = __toESM(require("lodash"));
1314
+
1315
+ // src/data/navigate/constants.ts
1316
+ var OBSTACLE_FEATURE_TYPES = [
1317
+ "kiosk"
1318
+ /* , "fixture" */
1319
+ ];
1320
+ var OBSTACLE_CATEGORIES = [
1321
+ "fixture.water",
1322
+ "fixture.stage",
1323
+ "nonpublic",
1324
+ "opentobelow",
1325
+ "elevator",
1326
+ "escalator",
1327
+ "stairs",
1328
+ "stairs.emergencyexit",
1329
+ "room",
1330
+ "unspecified",
1331
+ "structure",
1332
+ "brick",
1333
+ "concrete",
1334
+ "drywall",
1335
+ "glass",
1336
+ "wood",
1337
+ "column"
1338
+ ];
1339
+ var WALKABLE_CATEGORY = [
1340
+ "walkway",
1341
+ "parking",
1342
+ "room",
1343
+ "terrace",
1344
+ "unenclosedarea",
1345
+ "vegetation",
1346
+ "unspecified"
1347
+ ];
1348
+
1349
+ // node_modules/@turf/helpers/dist/esm/index.js
1350
+ var earthRadius = 63710088e-1;
1351
+ var factors = {
1352
+ centimeters: earthRadius * 100,
1353
+ centimetres: earthRadius * 100,
1354
+ degrees: 360 / (2 * Math.PI),
1355
+ feet: earthRadius * 3.28084,
1356
+ inches: earthRadius * 39.37,
1357
+ kilometers: earthRadius / 1e3,
1358
+ kilometres: earthRadius / 1e3,
1359
+ meters: earthRadius,
1360
+ metres: earthRadius,
1361
+ miles: earthRadius / 1609.344,
1362
+ millimeters: earthRadius * 1e3,
1363
+ millimetres: earthRadius * 1e3,
1364
+ nauticalmiles: earthRadius / 1852,
1365
+ radians: 1,
1366
+ yards: earthRadius * 1.0936
1508
1367
  };
1509
- var SuffixExactMatch = class extends BaseMatch {
1510
- constructor(pattern) {
1511
- super(pattern);
1368
+ function feature(geom, properties, options = {}) {
1369
+ const feat = { type: "Feature" };
1370
+ if (options.id === 0 || options.id) {
1371
+ feat.id = options.id;
1512
1372
  }
1513
- static get type() {
1514
- return "suffix-exact";
1373
+ if (options.bbox) {
1374
+ feat.bbox = options.bbox;
1515
1375
  }
1516
- static get multiRegex() {
1517
- return /^"(.*)"\$$/;
1376
+ feat.properties = properties || {};
1377
+ feat.geometry = geom;
1378
+ return feat;
1379
+ }
1380
+ function point(coordinates, properties, options = {}) {
1381
+ if (!coordinates) {
1382
+ throw new Error("coordinates is required");
1518
1383
  }
1519
- static get singleRegex() {
1520
- return /^(.*)\$$/;
1384
+ if (!Array.isArray(coordinates)) {
1385
+ throw new Error("coordinates must be an Array");
1521
1386
  }
1522
- search(text) {
1523
- const isMatch = text.endsWith(this.pattern);
1524
- return {
1525
- isMatch,
1526
- score: isMatch ? 0 : 1,
1527
- indices: [text.length - this.pattern.length, text.length - 1]
1528
- };
1387
+ if (coordinates.length < 2) {
1388
+ throw new Error("coordinates must be at least 2 numbers long");
1529
1389
  }
1530
- };
1531
- var InverseSuffixExactMatch = class extends BaseMatch {
1532
- constructor(pattern) {
1533
- super(pattern);
1390
+ if (!isNumber(coordinates[0]) || !isNumber(coordinates[1])) {
1391
+ throw new Error("coordinates must contain numbers");
1534
1392
  }
1535
- static get type() {
1536
- return "inverse-suffix-exact";
1393
+ const geom = {
1394
+ type: "Point",
1395
+ coordinates
1396
+ };
1397
+ return feature(geom, properties, options);
1398
+ }
1399
+ function polygon(coordinates, properties, options = {}) {
1400
+ for (const ring of coordinates) {
1401
+ if (ring.length < 4) {
1402
+ throw new Error(
1403
+ "Each LinearRing of a Polygon must have 4 or more Positions."
1404
+ );
1405
+ }
1406
+ if (ring[ring.length - 1].length !== ring[0].length) {
1407
+ throw new Error("First and last Position are not equivalent.");
1408
+ }
1409
+ for (let j = 0; j < ring[ring.length - 1].length; j++) {
1410
+ if (ring[ring.length - 1][j] !== ring[0][j]) {
1411
+ throw new Error("First and last Position are not equivalent.");
1412
+ }
1413
+ }
1537
1414
  }
1538
- static get multiRegex() {
1539
- return /^!"(.*)"\$$/;
1415
+ const geom = {
1416
+ type: "Polygon",
1417
+ coordinates
1418
+ };
1419
+ return feature(geom, properties, options);
1420
+ }
1421
+ function lineString(coordinates, properties, options = {}) {
1422
+ if (coordinates.length < 2) {
1423
+ throw new Error("coordinates must be an array of two or more positions");
1540
1424
  }
1541
- static get singleRegex() {
1542
- return /^!(.*)\$$/;
1425
+ const geom = {
1426
+ type: "LineString",
1427
+ coordinates
1428
+ };
1429
+ return feature(geom, properties, options);
1430
+ }
1431
+ function featureCollection(features, options = {}) {
1432
+ const fc = { type: "FeatureCollection" };
1433
+ if (options.id) {
1434
+ fc.id = options.id;
1543
1435
  }
1544
- search(text) {
1545
- const isMatch = !text.endsWith(this.pattern);
1546
- return {
1547
- isMatch,
1548
- score: isMatch ? 0 : 1,
1549
- indices: [0, text.length - 1]
1550
- };
1436
+ if (options.bbox) {
1437
+ fc.bbox = options.bbox;
1551
1438
  }
1552
- };
1553
- var FuzzyMatch = class extends BaseMatch {
1554
- constructor(pattern, {
1555
- location = Config.location,
1556
- threshold = Config.threshold,
1557
- distance = Config.distance,
1558
- includeMatches = Config.includeMatches,
1559
- findAllMatches = Config.findAllMatches,
1560
- minMatchCharLength = Config.minMatchCharLength,
1561
- isCaseSensitive = Config.isCaseSensitive,
1562
- ignoreDiacritics = Config.ignoreDiacritics,
1563
- ignoreLocation = Config.ignoreLocation
1564
- } = {}) {
1565
- super(pattern);
1566
- this._bitapSearch = new BitapSearch(pattern, {
1567
- location,
1568
- threshold,
1569
- distance,
1570
- includeMatches,
1571
- findAllMatches,
1572
- minMatchCharLength,
1573
- isCaseSensitive,
1574
- ignoreDiacritics,
1575
- ignoreLocation
1576
- });
1439
+ fc.features = features;
1440
+ return fc;
1441
+ }
1442
+ function multiPoint(coordinates, properties, options = {}) {
1443
+ const geom = {
1444
+ type: "MultiPoint",
1445
+ coordinates
1446
+ };
1447
+ return feature(geom, properties, options);
1448
+ }
1449
+ function isNumber(num) {
1450
+ return !isNaN(num) && num !== null && !Array.isArray(num);
1451
+ }
1452
+ function isObject(input) {
1453
+ return input !== null && typeof input === "object" && !Array.isArray(input);
1454
+ }
1455
+
1456
+ // node_modules/@turf/invariant/dist/esm/index.js
1457
+ function getCoord(coord) {
1458
+ if (!coord) {
1459
+ throw new Error("coord is required");
1460
+ }
1461
+ if (!Array.isArray(coord)) {
1462
+ if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
1463
+ return [...coord.geometry.coordinates];
1464
+ }
1465
+ if (coord.type === "Point") {
1466
+ return [...coord.coordinates];
1467
+ }
1577
1468
  }
1578
- static get type() {
1579
- return "fuzzy";
1469
+ if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
1470
+ return [...coord];
1580
1471
  }
1581
- static get multiRegex() {
1582
- return /^"(.*)"$/;
1472
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
1473
+ }
1474
+ function getGeom(geojson) {
1475
+ if (geojson.type === "Feature") {
1476
+ return geojson.geometry;
1583
1477
  }
1584
- static get singleRegex() {
1585
- return /^(.*)$/;
1478
+ return geojson;
1479
+ }
1480
+ function getType(geojson, _name) {
1481
+ if (geojson.type === "FeatureCollection") {
1482
+ return "FeatureCollection";
1586
1483
  }
1587
- search(text) {
1588
- return this._bitapSearch.searchIn(text);
1484
+ if (geojson.type === "GeometryCollection") {
1485
+ return "GeometryCollection";
1589
1486
  }
1590
- };
1591
- var IncludeMatch = class extends BaseMatch {
1592
- constructor(pattern) {
1593
- super(pattern);
1594
- }
1595
- static get type() {
1596
- return "include";
1597
- }
1598
- static get multiRegex() {
1599
- return /^'"(.*)"$/;
1600
- }
1601
- static get singleRegex() {
1602
- return /^'(.*)$/;
1603
- }
1604
- search(text) {
1605
- let location = 0;
1606
- let index;
1607
- const indices = [];
1608
- const patternLen = this.pattern.length;
1609
- while ((index = text.indexOf(this.pattern, location)) > -1) {
1610
- location = index + patternLen;
1611
- indices.push([index, location - 1]);
1612
- }
1613
- const isMatch = !!indices.length;
1614
- return {
1615
- isMatch,
1616
- score: isMatch ? 0 : 1,
1617
- indices
1618
- };
1487
+ if (geojson.type === "Feature" && geojson.geometry !== null) {
1488
+ return geojson.geometry.type;
1619
1489
  }
1620
- };
1621
- var searchers = [
1622
- ExactMatch,
1623
- IncludeMatch,
1624
- PrefixExactMatch,
1625
- InversePrefixExactMatch,
1626
- InverseSuffixExactMatch,
1627
- SuffixExactMatch,
1628
- InverseExactMatch,
1629
- FuzzyMatch
1630
- ];
1631
- var searchersLen = searchers.length;
1632
- var SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;
1633
- var OR_TOKEN = "|";
1634
- function parseQuery(pattern, options = {}) {
1635
- return pattern.split(OR_TOKEN).map((item) => {
1636
- let query = item.trim().split(SPACE_RE).filter((item2) => item2 && !!item2.trim());
1637
- let results = [];
1638
- for (let i = 0, len = query.length; i < len; i += 1) {
1639
- const queryItem = query[i];
1640
- let found = false;
1641
- let idx = -1;
1642
- while (!found && ++idx < searchersLen) {
1643
- const searcher = searchers[idx];
1644
- let token = searcher.isMultiMatch(queryItem);
1645
- if (token) {
1646
- results.push(new searcher(token, options));
1647
- found = true;
1648
- }
1649
- }
1650
- if (found) {
1651
- continue;
1652
- }
1653
- idx = -1;
1654
- while (++idx < searchersLen) {
1655
- const searcher = searchers[idx];
1656
- let token = searcher.isSingleMatch(queryItem);
1657
- if (token) {
1658
- results.push(new searcher(token, options));
1659
- break;
1660
- }
1661
- }
1662
- }
1663
- return results;
1664
- });
1490
+ return geojson.type;
1665
1491
  }
1666
- var MultiMatchSet = /* @__PURE__ */ new Set([FuzzyMatch.type, IncludeMatch.type]);
1667
- var ExtendedSearch = class {
1668
- constructor(pattern, {
1669
- isCaseSensitive = Config.isCaseSensitive,
1670
- ignoreDiacritics = Config.ignoreDiacritics,
1671
- includeMatches = Config.includeMatches,
1672
- minMatchCharLength = Config.minMatchCharLength,
1673
- ignoreLocation = Config.ignoreLocation,
1674
- findAllMatches = Config.findAllMatches,
1675
- location = Config.location,
1676
- threshold = Config.threshold,
1677
- distance = Config.distance
1678
- } = {}) {
1679
- this.query = null;
1680
- this.options = {
1681
- isCaseSensitive,
1682
- ignoreDiacritics,
1683
- includeMatches,
1684
- minMatchCharLength,
1685
- findAllMatches,
1686
- ignoreLocation,
1687
- location,
1688
- threshold,
1689
- distance
1690
- };
1691
- pattern = isCaseSensitive ? pattern : pattern.toLowerCase();
1692
- pattern = ignoreDiacritics ? stripDiacritics(pattern) : pattern;
1693
- this.pattern = pattern;
1694
- this.query = parseQuery(this.pattern, this.options);
1695
- }
1696
- static condition(_6, options) {
1697
- return options.useExtendedSearch;
1698
- }
1699
- searchIn(text) {
1700
- const query = this.query;
1701
- if (!query) {
1702
- return {
1703
- isMatch: false,
1704
- score: 1
1705
- };
1706
- }
1707
- const { includeMatches, isCaseSensitive, ignoreDiacritics } = this.options;
1708
- text = isCaseSensitive ? text : text.toLowerCase();
1709
- text = ignoreDiacritics ? stripDiacritics(text) : text;
1710
- let numMatches = 0;
1711
- let allIndices = [];
1712
- let totalScore = 0;
1713
- for (let i = 0, qLen = query.length; i < qLen; i += 1) {
1714
- const searchers2 = query[i];
1715
- allIndices.length = 0;
1716
- numMatches = 0;
1717
- for (let j = 0, pLen = searchers2.length; j < pLen; j += 1) {
1718
- const searcher = searchers2[j];
1719
- const { isMatch, indices, score } = searcher.search(text);
1720
- if (isMatch) {
1721
- numMatches += 1;
1722
- totalScore += score;
1723
- if (includeMatches) {
1724
- const type = searcher.constructor.type;
1725
- if (MultiMatchSet.has(type)) {
1726
- allIndices = [...allIndices, ...indices];
1727
- } else {
1728
- allIndices.push(indices);
1492
+
1493
+ // src/data/navigate/steps/path/index.ts
1494
+ var import_difference = __toESM(require("@turf/difference"));
1495
+ var import_envelope = __toESM(require("@turf/envelope"));
1496
+ var import_boolean_overlap = __toESM(require("@turf/boolean-overlap"));
1497
+ var import_boolean_intersects = __toESM(require("@turf/boolean-intersects"));
1498
+
1499
+ // ../../node_modules/@turf/meta/dist/esm/index.js
1500
+ function coordEach(geojson, callback, excludeWrapCoord) {
1501
+ if (geojson === null) return;
1502
+ var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
1503
+ for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
1504
+ geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
1505
+ isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
1506
+ stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
1507
+ for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
1508
+ var multiFeatureIndex = 0;
1509
+ var geometryIndex = 0;
1510
+ geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
1511
+ if (geometry === null) continue;
1512
+ coords = geometry.coordinates;
1513
+ var geomType = geometry.type;
1514
+ wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
1515
+ switch (geomType) {
1516
+ case null:
1517
+ break;
1518
+ case "Point":
1519
+ if (callback(
1520
+ coords,
1521
+ coordIndex,
1522
+ featureIndex,
1523
+ multiFeatureIndex,
1524
+ geometryIndex
1525
+ ) === false)
1526
+ return false;
1527
+ coordIndex++;
1528
+ multiFeatureIndex++;
1529
+ break;
1530
+ case "LineString":
1531
+ case "MultiPoint":
1532
+ for (j = 0; j < coords.length; j++) {
1533
+ if (callback(
1534
+ coords[j],
1535
+ coordIndex,
1536
+ featureIndex,
1537
+ multiFeatureIndex,
1538
+ geometryIndex
1539
+ ) === false)
1540
+ return false;
1541
+ coordIndex++;
1542
+ if (geomType === "MultiPoint") multiFeatureIndex++;
1543
+ }
1544
+ if (geomType === "LineString") multiFeatureIndex++;
1545
+ break;
1546
+ case "Polygon":
1547
+ case "MultiLineString":
1548
+ for (j = 0; j < coords.length; j++) {
1549
+ for (k = 0; k < coords[j].length - wrapShrink; k++) {
1550
+ if (callback(
1551
+ coords[j][k],
1552
+ coordIndex,
1553
+ featureIndex,
1554
+ multiFeatureIndex,
1555
+ geometryIndex
1556
+ ) === false)
1557
+ return false;
1558
+ coordIndex++;
1559
+ }
1560
+ if (geomType === "MultiLineString") multiFeatureIndex++;
1561
+ if (geomType === "Polygon") geometryIndex++;
1562
+ }
1563
+ if (geomType === "Polygon") multiFeatureIndex++;
1564
+ break;
1565
+ case "MultiPolygon":
1566
+ for (j = 0; j < coords.length; j++) {
1567
+ geometryIndex = 0;
1568
+ for (k = 0; k < coords[j].length; k++) {
1569
+ for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
1570
+ if (callback(
1571
+ coords[j][k][l],
1572
+ coordIndex,
1573
+ featureIndex,
1574
+ multiFeatureIndex,
1575
+ geometryIndex
1576
+ ) === false)
1577
+ return false;
1578
+ coordIndex++;
1579
+ }
1580
+ geometryIndex++;
1729
1581
  }
1582
+ multiFeatureIndex++;
1730
1583
  }
1731
- } else {
1732
- totalScore = 0;
1733
- numMatches = 0;
1734
- allIndices.length = 0;
1735
1584
  break;
1736
- }
1737
- }
1738
- if (numMatches) {
1739
- let result = {
1740
- isMatch: true,
1741
- score: totalScore / numMatches
1742
- };
1743
- if (includeMatches) {
1744
- result.indices = allIndices;
1745
- }
1746
- return result;
1585
+ case "GeometryCollection":
1586
+ for (j = 0; j < geometry.geometries.length; j++)
1587
+ if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
1588
+ return false;
1589
+ break;
1590
+ default:
1591
+ throw new Error("Unknown Geometry Type");
1747
1592
  }
1748
1593
  }
1749
- return {
1750
- isMatch: false,
1751
- score: 1
1752
- };
1753
1594
  }
1754
- };
1755
- var registeredSearchers = [];
1756
- function register(...args) {
1757
- registeredSearchers.push(...args);
1758
1595
  }
1759
- function createSearcher(pattern, options) {
1760
- for (let i = 0, len = registeredSearchers.length; i < len; i += 1) {
1761
- let searcherClass = registeredSearchers[i];
1762
- if (searcherClass.condition(pattern, options)) {
1763
- return new searcherClass(pattern, options);
1764
- }
1596
+
1597
+ // ../../node_modules/@turf/bbox/dist/esm/index.js
1598
+ function bbox(geojson, options = {}) {
1599
+ if (geojson.bbox != null && true !== options.recompute) {
1600
+ return geojson.bbox;
1765
1601
  }
1766
- return new BitapSearch(pattern, options);
1767
- }
1768
- var LogicalOperator = {
1769
- AND: "$and",
1770
- OR: "$or"
1771
- };
1772
- var KeyType = {
1773
- PATH: "$path",
1774
- PATTERN: "$val"
1775
- };
1776
- var isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]);
1777
- var isPath = (query) => !!query[KeyType.PATH];
1778
- var isLeaf = (query) => !isArray(query) && isObject(query) && !isExpression(query);
1779
- var convertToExplicit = (query) => ({
1780
- [LogicalOperator.AND]: Object.keys(query).map((key) => ({
1781
- [key]: query[key]
1782
- }))
1783
- });
1784
- function parse(query, options, { auto = true } = {}) {
1785
- const next = (query2) => {
1786
- let keys = Object.keys(query2);
1787
- const isQueryPath = isPath(query2);
1788
- if (!isQueryPath && keys.length > 1 && !isExpression(query2)) {
1789
- return next(convertToExplicit(query2));
1602
+ const result = [Infinity, Infinity, -Infinity, -Infinity];
1603
+ coordEach(geojson, (coord) => {
1604
+ if (result[0] > coord[0]) {
1605
+ result[0] = coord[0];
1790
1606
  }
1791
- if (isLeaf(query2)) {
1792
- const key = isQueryPath ? query2[KeyType.PATH] : keys[0];
1793
- const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key];
1794
- if (!isString(pattern)) {
1795
- throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key));
1796
- }
1797
- const obj = {
1798
- keyId: createKeyId(key),
1799
- pattern
1800
- };
1801
- if (auto) {
1802
- obj.searcher = createSearcher(pattern, options);
1803
- }
1804
- return obj;
1607
+ if (result[1] > coord[1]) {
1608
+ result[1] = coord[1];
1609
+ }
1610
+ if (result[2] < coord[0]) {
1611
+ result[2] = coord[0];
1612
+ }
1613
+ if (result[3] < coord[1]) {
1614
+ result[3] = coord[1];
1805
1615
  }
1806
- let node = {
1807
- children: [],
1808
- operator: keys[0]
1809
- };
1810
- keys.forEach((key) => {
1811
- const value = query2[key];
1812
- if (isArray(value)) {
1813
- value.forEach((item) => {
1814
- node.children.push(next(item));
1815
- });
1816
- }
1817
- });
1818
- return node;
1819
- };
1820
- if (!isExpression(query)) {
1821
- query = convertToExplicit(query);
1822
- }
1823
- return next(query);
1824
- }
1825
- function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
1826
- results.forEach((result) => {
1827
- let totalScore = 1;
1828
- result.matches.forEach(({ key, norm: norm2, score }) => {
1829
- const weight = key ? key.weight : null;
1830
- totalScore *= Math.pow(
1831
- score === 0 && weight ? Number.EPSILON : score,
1832
- (weight || 1) * (ignoreFieldNorm ? 1 : norm2)
1833
- );
1834
- });
1835
- result.score = totalScore;
1836
1616
  });
1617
+ return result;
1837
1618
  }
1838
- function transformMatches(result, data) {
1839
- const matches = result.matches;
1840
- data.matches = [];
1841
- if (!isDefined(matches)) {
1842
- return;
1843
- }
1844
- matches.forEach((match) => {
1845
- if (!isDefined(match.indices) || !match.indices.length) {
1846
- return;
1847
- }
1848
- const { indices, value } = match;
1849
- let obj = {
1850
- indices,
1851
- value
1852
- };
1853
- if (match.key) {
1854
- obj.key = match.key.src;
1619
+ var index_default = bbox;
1620
+
1621
+ // src/data/navigate/steps/path/turf/shortestPath.ts
1622
+ var import_boolean_point_in_polygon3 = __toESM(require("@turf/boolean-point-in-polygon"));
1623
+ var import_distance4 = __toESM(require("@turf/distance"));
1624
+ var import_transform_scale = __toESM(require("@turf/transform-scale"));
1625
+ var import_union = __toESM(require("@turf/union"));
1626
+ var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
1627
+ var import_clean_coords = require("@turf/clean-coords");
1628
+ var import_pathfinding = __toESM(require("pathfinding"));
1629
+ var import_set3 = __toESM(require("lodash/set"));
1630
+
1631
+ // src/data/navigate/steps/path/turf/stringPull.ts
1632
+ function stringPull(grid, path) {
1633
+ const isWalkable = (x, y) => grid.isInside(x, y) && grid.isWalkableAt(x, y);
1634
+ function hasLOS(a, b) {
1635
+ let x0 = a[0], y0 = a[1];
1636
+ const x1 = b[0], y1 = b[1];
1637
+ if (!isWalkable(x0, y0) || !isWalkable(x1, y1)) return false;
1638
+ const dx = Math.abs(x1 - x0);
1639
+ const dy = Math.abs(y1 - y0);
1640
+ const sx = x0 < x1 ? 1 : -1;
1641
+ const sy = y0 < y1 ? 1 : -1;
1642
+ let err = dx - dy;
1643
+ while (true) {
1644
+ if (!isWalkable(x0, y0)) return false;
1645
+ if (x0 === x1 && y0 === y1) break;
1646
+ const e2 = err * 2;
1647
+ let nx = x0;
1648
+ let ny = y0;
1649
+ let movedX = false;
1650
+ let movedY = false;
1651
+ if (e2 > -dy) {
1652
+ err -= dy;
1653
+ nx += sx;
1654
+ movedX = true;
1655
+ }
1656
+ if (e2 < dx) {
1657
+ err += dx;
1658
+ ny += sy;
1659
+ movedY = true;
1660
+ }
1661
+ if (movedX && movedY) {
1662
+ if (!isWalkable(nx, y0) || !isWalkable(x0, ny)) return false;
1663
+ }
1664
+ x0 = nx;
1665
+ y0 = ny;
1855
1666
  }
1856
- if (match.idx > -1) {
1857
- obj.refIndex = match.idx;
1667
+ return true;
1668
+ }
1669
+ if (path.length <= 2) return path;
1670
+ const out = [path[0]];
1671
+ let i = 0;
1672
+ while (i < path.length - 1) {
1673
+ let best = i + 1;
1674
+ for (let j = i + 2; j < path.length; j++) {
1675
+ if (hasLOS(path[i], path[j])) best = j;
1676
+ else break;
1858
1677
  }
1859
- data.matches.push(obj);
1860
- });
1678
+ out.push(path[best]);
1679
+ i = best;
1680
+ }
1681
+ return out;
1861
1682
  }
1862
- function transformScore(result, data) {
1863
- data.score = result.score;
1683
+
1684
+ // src/data/navigate/steps/path/turf/pruneSmallAngle.ts
1685
+ function pruneSmallAngles(path, minDeg = 10) {
1686
+ if (path.length <= 2) return path;
1687
+ const out = [path[0]];
1688
+ for (let i = 1; i < path.length - 1; i++) {
1689
+ const a = out[out.length - 1];
1690
+ const b = path[i];
1691
+ const c = path[i + 1];
1692
+ const abx = b[0] - a[0], aby = b[1] - a[1];
1693
+ const bcx = c[0] - b[0], bcy = c[1] - b[1];
1694
+ const dot = abx * bcx + aby * bcy;
1695
+ const ab = Math.hypot(abx, aby);
1696
+ const bc = Math.hypot(bcx, bcy);
1697
+ const angle = Math.acos(dot / (ab * bc)) * 180 / Math.PI;
1698
+ if (angle > minDeg) out.push(b);
1699
+ }
1700
+ out.push(path[path.length - 1]);
1701
+ return out;
1864
1702
  }
1865
- function format(results, docs, {
1866
- includeMatches = Config.includeMatches,
1867
- includeScore = Config.includeScore
1868
- } = {}) {
1869
- const transformers = [];
1870
- if (includeMatches) transformers.push(transformMatches);
1871
- if (includeScore) transformers.push(transformScore);
1872
- return results.map((result) => {
1873
- const { idx } = result;
1874
- const data = {
1875
- item: docs[idx],
1876
- refIndex: idx
1877
- };
1878
- if (transformers.length) {
1879
- transformers.forEach((transformer) => {
1880
- transformer(result, data);
1881
- });
1703
+
1704
+ // src/data/navigate/steps/path/turf/pruneShortSegments.ts
1705
+ function pruneShortSegments(path, minLen = 5) {
1706
+ const out = [path[0]];
1707
+ for (let i = 1; i < path.length; i++) {
1708
+ const [x0, y0] = out[out.length - 1];
1709
+ const [x1, y1] = path[i];
1710
+ if (Math.hypot(x1 - x0, y1 - y0) >= minLen) {
1711
+ out.push(path[i]);
1882
1712
  }
1883
- return data;
1884
- });
1713
+ }
1714
+ return out;
1885
1715
  }
1886
- var Fuse = class {
1887
- constructor(docs, options = {}, index) {
1888
- this.options = { ...Config, ...options };
1889
- if (this.options.useExtendedSearch && false) {
1890
- throw new Error(EXTENDED_SEARCH_UNAVAILABLE);
1716
+
1717
+ // src/data/navigate/steps/path/turf/clearance.ts
1718
+ function buildClearanceGrid(matrix) {
1719
+ const h = matrix.length;
1720
+ const w = matrix[0].length;
1721
+ const INF = 1e9;
1722
+ const dist = Array.from({ length: h }, () => Array(w).fill(INF));
1723
+ const q = [];
1724
+ for (let y = 0; y < h; y++) {
1725
+ for (let x = 0; x < w; x++) {
1726
+ if (matrix[y][x] === 1) {
1727
+ dist[y][x] = 0;
1728
+ q.push([x, y]);
1729
+ }
1891
1730
  }
1892
- this._keyStore = new KeyStore(this.options.keys);
1893
- this.setCollection(docs, index);
1894
1731
  }
1895
- setCollection(docs, index) {
1896
- this._docs = docs;
1897
- if (index && !(index instanceof FuseIndex)) {
1898
- throw new Error(INCORRECT_INDEX_TYPE);
1732
+ const dirs = [
1733
+ [1, 0],
1734
+ [-1, 0],
1735
+ [0, 1],
1736
+ [0, -1],
1737
+ [1, 1],
1738
+ [1, -1],
1739
+ [-1, 1],
1740
+ [-1, -1]
1741
+ ];
1742
+ let qi = 0;
1743
+ while (qi < q.length) {
1744
+ const [x, y] = q[qi++];
1745
+ const d0 = dist[y][x];
1746
+ for (const [dx, dy] of dirs) {
1747
+ const nx = x + dx, ny = y + dy;
1748
+ if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
1749
+ const nd = d0 + 1;
1750
+ if (nd < dist[ny][nx]) {
1751
+ dist[ny][nx] = nd;
1752
+ q.push([nx, ny]);
1753
+ }
1899
1754
  }
1900
- this._myIndex = index || createIndex(this.options.keys, this._docs, {
1901
- getFn: this.options.getFn,
1902
- fieldNormWeight: this.options.fieldNormWeight
1903
- });
1904
1755
  }
1905
- add(doc) {
1906
- if (!isDefined(doc)) {
1907
- return;
1908
- }
1909
- this._docs.push(doc);
1910
- this._myIndex.add(doc);
1911
- }
1912
- remove(predicate = () => false) {
1913
- const results = [];
1914
- for (let i = 0, len = this._docs.length; i < len; i += 1) {
1915
- const doc = this._docs[i];
1916
- if (predicate(doc, i)) {
1917
- this.removeAt(i);
1918
- i -= 1;
1919
- len -= 1;
1920
- results.push(doc);
1756
+ return dist;
1757
+ }
1758
+ function snapPointToClearancePeak(p, clearance, isWalkableCell, radius = 4) {
1759
+ const [px, py] = p;
1760
+ let best = p;
1761
+ let bestScore = clearance[py]?.[px] ?? -Infinity;
1762
+ for (let dy = -radius; dy <= radius; dy++) {
1763
+ for (let dx = -radius; dx <= radius; dx++) {
1764
+ const x = px + dx;
1765
+ const y = py + dy;
1766
+ if (!isWalkableCell(x, y)) continue;
1767
+ const score = clearance[y][x];
1768
+ const penalty = Math.hypot(dx, dy) * 5e-3;
1769
+ const finalScore = score - penalty;
1770
+ if (finalScore > bestScore) {
1771
+ bestScore = finalScore;
1772
+ best = [x, y];
1921
1773
  }
1922
1774
  }
1923
- return results;
1924
1775
  }
1925
- removeAt(idx) {
1926
- this._docs.splice(idx, 1);
1927
- this._myIndex.removeAt(idx);
1928
- }
1929
- getIndex() {
1930
- return this._myIndex;
1776
+ return best;
1777
+ }
1778
+ function centerlineSnapPath(path, clearance, isWalkableCell, radius = 4) {
1779
+ const snapped = path.map((p) => snapPointToClearancePeak(p, clearance, isWalkableCell, radius));
1780
+ return snapped;
1781
+ }
1782
+
1783
+ // src/data/navigate/steps/path/turf/shortestPath.ts
1784
+ function shortestPath(start, end, options) {
1785
+ options = options || {};
1786
+ if (!isObject(options)) throw new Error("options is invalid");
1787
+ let resolution = options.resolution;
1788
+ const smoothenPath = options.smoothenPath;
1789
+ let obstacles = options.obstacles || featureCollection([]);
1790
+ if (!start) throw new Error("start is required");
1791
+ if (!end) throw new Error("end is required");
1792
+ if (resolution && !isNumber(resolution) || resolution <= 0)
1793
+ throw new Error("options.resolution must be a number, greater than 0");
1794
+ const startCoord = getCoord(start);
1795
+ const endCoord = getCoord(end);
1796
+ start = point(startCoord);
1797
+ end = point(endCoord);
1798
+ switch (getType(obstacles)) {
1799
+ case "FeatureCollection":
1800
+ if (obstacles.features.length === 0)
1801
+ return lineString([startCoord, endCoord]);
1802
+ break;
1803
+ case "Polygon":
1804
+ obstacles = featureCollection([feature(getGeom(obstacles))]);
1805
+ break;
1806
+ default:
1807
+ throw new Error("invalid obstacles");
1808
+ }
1809
+ const collection = obstacles;
1810
+ collection.features.push(start, end);
1811
+ const box = index_default((0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(collection)), 1.15));
1812
+ if (!resolution) {
1813
+ const width = (0, import_distance4.default)([box[0], box[1]], [box[2], box[1]], options);
1814
+ resolution = width / 100;
1815
+ }
1816
+ collection.features.pop();
1817
+ collection.features.pop();
1818
+ const [west, south, east, north] = box;
1819
+ const xFraction = resolution / (0, import_distance4.default)([west, south], [east, south], options);
1820
+ const cellWidth = xFraction * (east - west);
1821
+ const yFraction = resolution / (0, import_distance4.default)([west, south], [west, north], options);
1822
+ const cellHeight = yFraction * (north - south);
1823
+ const bboxHorizontalSide = east - west;
1824
+ const bboxVerticalSide = north - south;
1825
+ const columns = Math.floor(bboxHorizontalSide / cellWidth);
1826
+ const rows = Math.floor(bboxVerticalSide / cellHeight);
1827
+ const deltaX = (bboxHorizontalSide - columns * cellWidth) / 2;
1828
+ const deltaY = (bboxVerticalSide - rows * cellHeight) / 2;
1829
+ let closestToStart = null, closestToEnd = null, minDistStart = Infinity, minDistEnd = Infinity, currentY = north - deltaY, currentX = west + deltaX, row = 0, column = 0, distStart, distEnd, pt, isInsideObstacle;
1830
+ const roundLoopY = Math.ceil((currentY - south) / cellHeight);
1831
+ const roundLoopX = Math.ceil((east - currentX) / cellWidth);
1832
+ let totalRounds = roundLoopX * roundLoopY;
1833
+ const pointMatrix = [];
1834
+ const matrix = [];
1835
+ const obstacleTotal = collection.features.length;
1836
+ const obstacleFeatures = collection.features;
1837
+ let combinedObstacle = obstacleFeatures[0];
1838
+ let obstacleIndex = 0;
1839
+ for (obstacleIndex = 0; obstacleIndex < obstacleTotal; obstacleIndex++) {
1840
+ const nextObstacleFeature = obstacleFeatures[obstacleIndex + 1];
1841
+ if (!nextObstacleFeature) continue;
1842
+ try {
1843
+ combinedObstacle = (0, import_union.default)(
1844
+ featureCollection([combinedObstacle, nextObstacleFeature])
1845
+ );
1846
+ } catch (e) {
1847
+ console.log(e);
1848
+ }
1931
1849
  }
1932
- search(query, { limit = -1 } = {}) {
1933
- const {
1934
- includeMatches,
1935
- includeScore,
1936
- shouldSort,
1937
- sortFn,
1938
- ignoreFieldNorm
1939
- } = this.options;
1940
- let results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query);
1941
- computeScore(results, { ignoreFieldNorm });
1942
- if (shouldSort) {
1943
- results.sort(sortFn);
1850
+ while (totalRounds--) {
1851
+ pt = point([currentX, currentY]);
1852
+ isInsideObstacle = (0, import_boolean_point_in_polygon3.default)(pt, combinedObstacle);
1853
+ (0, import_set3.default)(matrix, `[${row}][${column}]`, isInsideObstacle ? 1 : 0);
1854
+ (0, import_set3.default)(pointMatrix, `[${row}][${column}]`, `${currentX}|${currentY}`);
1855
+ distStart = (0, import_distance4.default)(pt, start);
1856
+ if (!isInsideObstacle && distStart < minDistStart) {
1857
+ minDistStart = distStart;
1858
+ closestToStart = { x: column, y: row };
1944
1859
  }
1945
- if (isNumber(limit) && limit > -1) {
1946
- results = results.slice(0, limit);
1860
+ distEnd = (0, import_distance4.default)(pt, end);
1861
+ if (!isInsideObstacle && distEnd < minDistEnd) {
1862
+ minDistEnd = distEnd;
1863
+ closestToEnd = { x: column, y: row };
1864
+ }
1865
+ if (column < roundLoopX) {
1866
+ currentX += cellWidth;
1867
+ column++;
1868
+ continue;
1869
+ }
1870
+ if (row < roundLoopY) {
1871
+ currentY -= cellHeight;
1872
+ currentX = west + deltaX;
1873
+ column = 0;
1874
+ row++;
1947
1875
  }
1948
- return format(results, this._docs, {
1949
- includeMatches,
1950
- includeScore
1951
- });
1952
1876
  }
1953
- _searchStringList(query) {
1954
- const searcher = createSearcher(query, this.options);
1955
- const { records } = this._myIndex;
1956
- const results = [];
1957
- records.forEach(({ v: text, i: idx, n: norm2 }) => {
1958
- if (!isDefined(text)) {
1959
- return;
1960
- }
1961
- const { isMatch, score, indices } = searcher.searchIn(text);
1962
- if (isMatch) {
1963
- results.push({
1964
- item: text,
1965
- idx,
1966
- matches: [{ score, value: text, norm: norm2, indices }]
1967
- });
1968
- }
1877
+ const finder = new import_pathfinding.default.AStarFinder({
1878
+ allowDiagonal: true,
1879
+ dontCrossCorners: true,
1880
+ heuristic: import_pathfinding.default.Heuristic.euclidean
1881
+ });
1882
+ const grid = new import_pathfinding.default.Grid(matrix);
1883
+ const startOnMatrix = [closestToStart.x, closestToStart.y];
1884
+ const endOnMatrix = [closestToEnd.x, closestToEnd.y];
1885
+ let result = finder.findPath(...startOnMatrix, ...endOnMatrix, grid);
1886
+ if (result.length > 0) {
1887
+ result = stringPull(grid, result);
1888
+ const clearanceGrid = buildClearanceGrid(matrix);
1889
+ const isWalkable = (x, y) => grid.isInside(x, y) && grid.isWalkableAt(x, y);
1890
+ result = centerlineSnapPath(result, clearanceGrid, isWalkable);
1891
+ result = stringPull(grid, result);
1892
+ result = pruneSmallAngles(result);
1893
+ result = pruneShortSegments(result);
1894
+ }
1895
+ result.pop();
1896
+ result.shift();
1897
+ const path = [startCoord];
1898
+ result.forEach((coord) => {
1899
+ const coords = pointMatrix[coord[1]][coord[0]].split("|");
1900
+ path.push([+coords[0], +coords[1]]);
1901
+ });
1902
+ path.push(endCoord);
1903
+ return (0, import_clean_coords.cleanCoords)(lineString(path));
1904
+ }
1905
+ var shortestPath_default = shortestPath;
1906
+
1907
+ // src/data/navigate/steps/path/index.ts
1908
+ var createStepPathUtils = (options) => {
1909
+ const resolution = options.resolution ?? 88e-5;
1910
+ const { units, kiosks, fixtures } = options.data;
1911
+ const possibleObstacleFeatures = [...units, ...kiosks, ...fixtures];
1912
+ const filterObstaclesByOrdinal = (levelId) => {
1913
+ return possibleObstacleFeatures.filter(({ feature_type, properties, geometry }) => {
1914
+ return properties.level_id === levelId && ["Polygon", "MultiPolygon"].includes(geometry.type) && (OBSTACLE_FEATURE_TYPES.includes(feature_type) || "category" in properties && OBSTACLE_CATEGORIES.includes(properties.category));
1969
1915
  });
1970
- return results;
1971
- }
1972
- _searchLogical(query) {
1973
- const expression = parse(query, this.options);
1974
- const evaluate = (node, item, idx) => {
1975
- if (!node.children) {
1976
- const { keyId, searcher } = node;
1977
- const matches = this._findMatches({
1978
- key: this._keyStore.get(keyId),
1979
- value: this._myIndex.getValueForItemAtKeyId(item, keyId),
1980
- searcher
1981
- });
1982
- if (matches && matches.length) {
1983
- return [
1984
- {
1985
- idx,
1986
- item,
1987
- matches
1988
- }
1989
- ];
1990
- }
1991
- return [];
1992
- }
1993
- const res = [];
1994
- for (let i = 0, len = node.children.length; i < len; i += 1) {
1995
- const child = node.children[i];
1996
- const result = evaluate(child, item, idx);
1997
- if (result.length) {
1998
- res.push(...result);
1999
- } else if (node.operator === LogicalOperator.AND) {
2000
- return [];
2001
- }
2002
- }
2003
- return res;
2004
- };
2005
- const records = this._myIndex.records;
2006
- const resultMap = {};
2007
- const results = [];
2008
- records.forEach(({ $: item, i: idx }) => {
2009
- if (isDefined(item)) {
2010
- let expResults = evaluate(expression, item, idx);
2011
- if (expResults.length) {
2012
- if (!resultMap[idx]) {
2013
- resultMap[idx] = { idx, item, matches: [] };
2014
- results.push(resultMap[idx]);
2015
- }
2016
- expResults.forEach(({ matches }) => {
2017
- resultMap[idx].matches.push(...matches);
2018
- });
1916
+ };
1917
+ const findObstaclesFromWalkway = (intermediaryUnit, exceptionIds = []) => {
1918
+ const result = featureCollection([]);
1919
+ if (!intermediaryUnit) return result;
1920
+ const walkwayLevelId = intermediaryUnit.properties.level_id;
1921
+ const obstacleOnLevel = filterObstaclesByOrdinal(walkwayLevelId).filter(
1922
+ (obstacle) => !exceptionIds.includes(obstacle.id)
1923
+ );
1924
+ const relatedObstacleWithIntermediary = obstacleOnLevel.reduce(
1925
+ (obstacles, feature2) => {
1926
+ if (
1927
+ // Prevent detecting itself as an obstacle
1928
+ // Ex. Unable to draw a line to amenity located with in a room as room is also consider as obstacle
1929
+ feature2.id !== intermediaryUnit.id && ((0, import_boolean_overlap.default)(intermediaryUnit, feature2) || (0, import_boolean_intersects.default)(intermediaryUnit, feature2))
1930
+ ) {
1931
+ const polygons = getType(feature2) === "Polygon" ? [polygon(feature2.geometry.coordinates, { id: feature2.id })] : feature2.geometry.coordinates.map((ring) => polygon(ring, { id: feature2.id }));
1932
+ obstacles.push(...polygons);
2019
1933
  }
2020
- }
1934
+ return obstacles;
1935
+ },
1936
+ []
1937
+ );
1938
+ const intermediaryExtends = (0, import_envelope.default)(intermediaryUnit);
1939
+ const walkwayPerimeter = (0, import_difference.default)(
1940
+ featureCollection([intermediaryExtends, intermediaryUnit])
1941
+ );
1942
+ result.features.push(...relatedObstacleWithIntermediary, walkwayPerimeter);
1943
+ return result;
1944
+ };
1945
+ const findPathOnArea = (originPoint, destinationPoint, options2) => {
1946
+ const { obstacles = featureCollection([]), resolution: resolution2, properties } = options2 || {};
1947
+ const stepPath = shortestPath_default(originPoint, destinationPoint, {
1948
+ obstacles,
1949
+ smoothenPath: false,
1950
+ resolution: resolution2
2021
1951
  });
2022
- return results;
2023
- }
2024
- _searchObjectList(query) {
2025
- const searcher = createSearcher(query, this.options);
2026
- const { keys, records } = this._myIndex;
2027
- const results = [];
2028
- records.forEach(({ $: item, i: idx }) => {
2029
- if (!isDefined(item)) {
2030
- return;
2031
- }
2032
- let matches = [];
2033
- keys.forEach((key, keyIndex) => {
2034
- matches.push(
2035
- ...this._findMatches({
2036
- key,
2037
- value: item[keyIndex],
2038
- searcher
2039
- })
2040
- );
2041
- });
2042
- if (matches.length) {
2043
- results.push({
2044
- idx,
2045
- item,
2046
- matches
2047
- });
2048
- }
1952
+ stepPath.properties = properties;
1953
+ return stepPath;
1954
+ };
1955
+ const findStepPath = (from, to, intermediaries) => {
1956
+ const t0 = performance.now();
1957
+ const relatedWalkablePlatform = intermediaries.find(
1958
+ (feature2) => WALKABLE_CATEGORY.includes(feature2.properties.category)
1959
+ );
1960
+ const exceptionFeatureIds = [];
1961
+ const obstacles = findObstaclesFromWalkway(
1962
+ relatedWalkablePlatform,
1963
+ import_lodash11.default.compact(exceptionFeatureIds)
1964
+ );
1965
+ const line = findPathOnArea(from, to, {
1966
+ resolution,
1967
+ obstacles
2049
1968
  });
2050
- return results;
1969
+ return line.geometry.coordinates;
1970
+ };
1971
+ return {
1972
+ findStepPath
1973
+ };
1974
+ };
1975
+
1976
+ // src/data/navigate/landmark/createLandmarkUtils.ts
1977
+ var import_center6 = require("@turf/center");
1978
+ var import_distance5 = __toESM(require("@turf/distance"));
1979
+ var NEARBY_DISTANCE = 30;
1980
+ var createLandmarkUtils = (options) => {
1981
+ const { data, findByIdSync } = options;
1982
+ const { occupants } = data;
1983
+ const occupantToLandmark = (occupant) => {
1984
+ const locationType = occupant.properties.unit_id ? "unit" : "kiosk";
1985
+ const locationId = locationType === "unit" ? occupant.properties.unit_id : occupant.properties.kiosk_id;
1986
+ const location = locationType === "unit" ? findByIdSync(locationId) : findByIdSync(locationId);
1987
+ const level = findByIdSync(location.properties.level_id);
1988
+ return {
1989
+ name: occupant.properties.name,
1990
+ point: (0, import_center6.center)(location.geometry).geometry.coordinates,
1991
+ level_id: location.properties.level_id,
1992
+ is_priority: occupant.properties.is_landmark,
1993
+ ordinal: level.properties.ordinal
1994
+ };
1995
+ };
1996
+ const landmarks = [
1997
+ ...occupants.map(occupantToLandmark)
1998
+ ];
1999
+ const findNearbyLandmarks = (point2, levelId) => {
2000
+ if (point2 === null || levelId === null) return [];
2001
+ return landmarks.map((landmark) => {
2002
+ const landmarkAndDistance = {
2003
+ landmark,
2004
+ d: (0, import_distance5.default)(point2, landmark.point, { units: "meters" })
2005
+ };
2006
+ return landmarkAndDistance;
2007
+ }).filter(({ landmark, d }) => d <= NEARBY_DISTANCE && landmark.level_id === levelId).sort((a, b) => {
2008
+ const aPriority = a.landmark.is_priority ? 0 : 1;
2009
+ const bPriority = b.landmark.is_priority ? 0 : 1;
2010
+ if (aPriority !== bPriority) return aPriority - bPriority;
2011
+ return a.d - b.d;
2012
+ }).map(({ landmark }) => landmark);
2013
+ };
2014
+ const findNearestLandmark = (point2, levelId) => {
2015
+ const nearbyLandmarks = findNearbyLandmarks(point2, levelId);
2016
+ const nearestLandmark = nearbyLandmarks.length > 0 ? nearbyLandmarks[0] : null;
2017
+ return nearestLandmark;
2018
+ };
2019
+ return { findNearbyLandmarks, findNearestLandmark };
2020
+ };
2021
+
2022
+ // src/data/navigate/steps/utils/extractStartPoint.ts
2023
+ var import_center7 = require("@turf/center");
2024
+
2025
+ // src/data/navigate/steps/utils/featureIdGuard.ts
2026
+ var isOccupant = (id) => !!id && id.startsWith("occupant-");
2027
+ var isUnit = (id) => !!id && id.startsWith("unit-");
2028
+ var isKiosk = (id) => !!id && id.startsWith("kiosk-");
2029
+ var isOpening = (id) => !!id && id.startsWith("opening-");
2030
+
2031
+ // src/data/navigate/type-guard.ts
2032
+ function isCoordinateOrdinalString(id) {
2033
+ return /^-?\d+(\.\d+)?,-?\d+(\.\d+)?,-?\d+(\.\d+)?o$/.test(id);
2034
+ }
2035
+
2036
+ // src/data/navigate/steps/utils/extractStartPoint.ts
2037
+ var extractStartPoint = (path, options) => {
2038
+ const { findByIdSync } = options;
2039
+ const [a, b, c] = path;
2040
+ if (isOccupant(a) && isUnit(b) && isOpening(c)) {
2041
+ const occ = findByIdSync(a);
2042
+ const opening = findByIdSync(c);
2043
+ const level = findByIdSync(opening.properties.level_id);
2044
+ return [
2045
+ {
2046
+ id: occ.id,
2047
+ type: "start",
2048
+ name: occ.properties.name,
2049
+ point: (0, import_center7.center)(opening).geometry.coordinates,
2050
+ levelId: opening.properties.level_id,
2051
+ ordinal: level.properties.ordinal,
2052
+ source: { type: "opening", id: opening.id }
2053
+ },
2054
+ path.slice(3)
2055
+ ];
2051
2056
  }
2052
- _findMatches({ key, value, searcher }) {
2053
- if (!isDefined(value)) {
2054
- return [];
2057
+ if (isOccupant(a) && isKiosk(b)) {
2058
+ const occ = findByIdSync(a);
2059
+ const kiosk = findByIdSync(c);
2060
+ const level = findByIdSync(kiosk.properties.level_id);
2061
+ return [
2062
+ {
2063
+ id: occ.id,
2064
+ type: "start",
2065
+ name: occ.properties.name,
2066
+ point: (0, import_center7.center)(kiosk).geometry.coordinates,
2067
+ levelId: kiosk.properties.level_id,
2068
+ ordinal: level.properties.ordinal,
2069
+ source: { type: "kiosk", id: kiosk.id }
2070
+ },
2071
+ path.slice(2)
2072
+ ];
2073
+ }
2074
+ if (isCoordinateOrdinalString(a) && isOpening(b)) {
2075
+ const [lat, lng, ordinal] = parseOrdinalCoordinate(a);
2076
+ const opening = findByIdSync(b);
2077
+ return [
2078
+ {
2079
+ id: a,
2080
+ type: "start",
2081
+ name: { en: `Your location` },
2082
+ point: [lng, lat],
2083
+ levelId: opening.properties.level_id,
2084
+ ordinal,
2085
+ source: { type: "opening", id: opening.id }
2086
+ },
2087
+ path.slice(1)
2088
+ ];
2089
+ }
2090
+ return [null, path];
2091
+ };
2092
+
2093
+ // src/data/navigate/steps/utils/extractEndPint.ts
2094
+ var import_center8 = require("@turf/center");
2095
+ var extractEndPoint = (path, options) => {
2096
+ const { findByIdSync } = options;
2097
+ const [c, b, a] = path.slice(-3);
2098
+ if (isOccupant(a) && isUnit(b) && isOpening(c)) {
2099
+ const occ = findByIdSync(a);
2100
+ const opening = findByIdSync(c);
2101
+ const level = findByIdSync(opening.properties.level_id);
2102
+ return [
2103
+ {
2104
+ id: occ.id,
2105
+ type: "end",
2106
+ name: occ.properties.name,
2107
+ point: (0, import_center8.center)(opening).geometry.coordinates,
2108
+ levelId: opening.properties.level_id,
2109
+ ordinal: level.properties.ordinal,
2110
+ source: { type: "opening", id: opening.id }
2111
+ },
2112
+ path.slice(0, -3)
2113
+ ];
2114
+ }
2115
+ if (isOccupant(a) && isKiosk(b)) {
2116
+ const occ = findByIdSync(a);
2117
+ const kiosk = findByIdSync(c);
2118
+ const level = findByIdSync(kiosk.properties.level_id);
2119
+ return [
2120
+ {
2121
+ id: occ.id,
2122
+ type: "end",
2123
+ name: occ.properties.name,
2124
+ point: (0, import_center8.center)(kiosk).geometry.coordinates,
2125
+ levelId: kiosk.properties.level_id,
2126
+ ordinal: level.properties.ordinal,
2127
+ source: { type: "kiosk", id: kiosk.id }
2128
+ },
2129
+ path.slice(0, -2)
2130
+ ];
2131
+ }
2132
+ if (isCoordinateOrdinalString(a)) {
2133
+ const [lat, lng, ordinal] = parseOrdinalCoordinate(a);
2134
+ const opening = findByIdSync(b);
2135
+ return [
2136
+ {
2137
+ id: a,
2138
+ type: "end",
2139
+ name: { en: `Your location` },
2140
+ point: [lng, lat],
2141
+ levelId: opening.properties.level_id,
2142
+ ordinal,
2143
+ source: { type: "opening", id: opening.id }
2144
+ },
2145
+ path.slice(0, -2)
2146
+ ];
2147
+ }
2148
+ return [null, path];
2149
+ };
2150
+
2151
+ // src/data/navigate/steps/utils/combineWalkwaySteps.ts
2152
+ var import_uniq = __toESM(require("lodash/uniq"));
2153
+ var combineWalkwaySteps = (steps) => {
2154
+ let result = [];
2155
+ for (let i = 0; i < steps.length; i++) {
2156
+ const thisStep = steps[i];
2157
+ if (i === steps.length - 1) {
2158
+ result.push(thisStep);
2159
+ continue;
2055
2160
  }
2056
- let matches = [];
2057
- if (isArray(value)) {
2058
- value.forEach(({ v: text, i: idx, n: norm2 }) => {
2059
- if (!isDefined(text)) {
2060
- return;
2061
- }
2062
- const { isMatch, score, indices } = searcher.searchIn(text);
2063
- if (isMatch) {
2064
- matches.push({
2065
- score,
2066
- key,
2067
- value: text,
2068
- idx,
2069
- norm: norm2,
2070
- indices
2071
- });
2072
- }
2161
+ const nextStep = steps[i + 1];
2162
+ if (thisStep.intermediaryCategory === "walkway" && nextStep.intermediaryCategory === "walkway" && thisStep.from.source.type === "opening" && nextStep.from.source.type === "opening") {
2163
+ console.log({ i, len: steps.length, thisStep, nextStep });
2164
+ result.push({
2165
+ from: thisStep.from,
2166
+ to: nextStep.to,
2167
+ levelIds: (0, import_uniq.default)([...thisStep.levelIds, ...nextStep.levelIds]),
2168
+ ordinals: (0, import_uniq.default)([...thisStep.ordinals, ...nextStep.ordinals]),
2169
+ intermediaryCategory: "walkway",
2170
+ description: nextStep.description,
2171
+ path: [
2172
+ ...thisStep.path,
2173
+ ...nextStep.path
2174
+ ]
2073
2175
  });
2176
+ i++;
2074
2177
  } else {
2075
- const { v: text, n: norm2 } = value;
2076
- const { isMatch, score, indices } = searcher.searchIn(text);
2077
- if (isMatch) {
2078
- matches.push({ score, key, value: text, norm: norm2, indices });
2079
- }
2178
+ result.push(thisStep);
2080
2179
  }
2081
- return matches;
2082
2180
  }
2181
+ return result;
2083
2182
  };
2084
- Fuse.version = "7.1.0";
2085
- Fuse.createIndex = createIndex;
2086
- Fuse.parseIndex = parseIndex;
2087
- Fuse.config = Config;
2088
- {
2089
- Fuse.parseQuery = parse;
2090
- }
2091
- {
2092
- register(ExtendedSearch);
2093
- }
2094
2183
 
2095
- // src/data/search/utils/sanitizeInput.ts
2096
- var sanitizeInput = (str) => str.replace(/[\u200E\u200F\u202A-\u202E\u2066-\u2069]/g, "").replace(/[\-–—_./()]+/g, "").normalize("NFC").trim();
2184
+ // src/data/navigate/steps/createStepUtils.ts
2185
+ var createStepUtils = (options) => {
2186
+ const { data: { units, relationships }, findByIdSync } = options;
2187
+ const landmarkUtils = createLandmarkUtils(options);
2188
+ const stepPathUtils = createStepPathUtils({ ...options, resolution: 88e-5 });
2189
+ const findUnitBetweenOpenings = (originId, destinationId) => {
2190
+ const origin = findByIdSync(originId);
2191
+ const destination = findByIdSync(destinationId);
2192
+ const matchedOne = relationships.find((rel) => rel.properties.intermediary.map((int) => int.id).includes(origin.id));
2193
+ const matchOneUnits = [matchedOne.properties.origin, matchedOne.properties.destination];
2194
+ const matchedTwo = relationships.find((rel) => rel.properties.intermediary.map((int) => int.id).includes(destination.id));
2195
+ const matchTwoUnits = [matchedTwo.properties.origin, matchedTwo.properties.destination];
2196
+ const unitIds = (0, import_intersectionBy.default)(matchOneUnits, matchTwoUnits, "id");
2197
+ return unitIds.map(({ id }) => findByIdSync(id));
2198
+ };
2199
+ const findHorizontalIntermediary = (from, to) => {
2200
+ if (from.source.type !== "opening") {
2201
+ const unit = findContainingUnitAtPoint(from.point, from.levelId, units);
2202
+ return unit ? [unit] : [];
2203
+ }
2204
+ if (to.source.type !== "opening") {
2205
+ const unit = findContainingUnitAtPoint(to.point, to.levelId, units);
2206
+ return unit ? [unit] : [];
2207
+ }
2208
+ return findUnitBetweenOpenings(from.source.id, to.source.id);
2209
+ };
2210
+ const findVerticalIntermediary = (from, to) => {
2211
+ const firstOpeningId = from.source.id;
2212
+ const secondOpeningId = to.source.id;
2213
+ const relationship = relationships.find((rel) => {
2214
+ return rel.properties.origin?.id === firstOpeningId && rel.properties.destination?.id === secondOpeningId || rel.properties.origin?.id === secondOpeningId && rel.properties.destination?.id === firstOpeningId;
2215
+ });
2216
+ const intermediaryTypeAndId = relationship.properties.intermediary;
2217
+ return intermediaryTypeAndId.map(({ id }) => findByIdSync(id));
2218
+ };
2219
+ const formatCategoryLabel = (category) => {
2220
+ return (0, import_lodash12.capitalize)(category);
2221
+ };
2222
+ const getToward = (from, to, intermediary) => {
2223
+ if (to.type === "end") return to.name;
2224
+ const intermediaryIds = intermediary.map((int) => int.id);
2225
+ const relationship = relationships.find((rel) => rel.properties.intermediary.map((int) => int.id).includes(to.source.id));
2226
+ if (!relationship) return to.name;
2227
+ const candidates = [relationship.properties.origin.id, relationship.properties.destination.id];
2228
+ const nextUnitId = candidates.filter((id) => !intermediaryIds.includes(id))[0];
2229
+ if (!nextUnitId) return to.name;
2230
+ const nextUnit = findByIdSync(nextUnitId);
2231
+ return { en: formatCategoryLabel(`${nextUnit.properties.category}`) };
2232
+ };
2233
+ const toWaypoints = (path) => {
2234
+ const [startPoint, middleAndEndPoints] = extractStartPoint(path, options);
2235
+ const [endPoint, middlePoints] = extractEndPoint(middleAndEndPoints, options);
2236
+ const waypoints = middlePoints.map((openingId) => {
2237
+ const opening = findByIdSync(openingId);
2238
+ const level = findByIdSync(opening.properties.level_id);
2239
+ const coordinates = (0, import_center9.center)(opening).geometry.coordinates;
2240
+ const landmark = landmarkUtils.findNearestLandmark(coordinates, opening.properties.level_id);
2241
+ return {
2242
+ id: `${opening.properties.level_id}:${openingId}`,
2243
+ type: "between",
2244
+ point: coordinates,
2245
+ name: null,
2246
+ levelId: opening.properties.level_id,
2247
+ ordinal: level.properties.ordinal,
2248
+ hint: landmark ? { kind: "landmark", name: landmark.name } : void 0,
2249
+ source: { type: "opening", id: opening.id }
2250
+ };
2251
+ });
2252
+ return [startPoint, ...waypoints, endPoint];
2253
+ };
2254
+ const createHorizontalStep = (from, to) => {
2255
+ const intermediary = findHorizontalIntermediary(from, to);
2256
+ const intermediaryCategories = intermediary.map((unit) => unit.properties.category);
2257
+ const intermediaryCategory = intermediaryCategories.length > 0 ? intermediaryCategories[0] : "unspecified";
2258
+ const toward = getToward(from, to, intermediary);
2259
+ const landmark = to.hint?.kind === "landmark" ? to.hint.name : null;
2260
+ const path = stepPathUtils.findStepPath(from.point, to.point, intermediary);
2261
+ const step = {
2262
+ from,
2263
+ to,
2264
+ levelIds: [from.levelId],
2265
+ ordinals: [from.ordinal],
2266
+ intermediaryCategory,
2267
+ description: describeHorizontalStep(intermediaryCategory, toward, landmark),
2268
+ path: path.map((coord) => [...coord, from.ordinal * 9])
2269
+ };
2270
+ return step;
2271
+ };
2272
+ const createVerticalStep = (from, to) => {
2273
+ const intermediary = findVerticalIntermediary(from, to);
2274
+ const intermediaryCategories = intermediary.map((unit) => unit.properties.category);
2275
+ const intermediaryCategory = intermediaryCategories.length > 0 ? intermediaryCategories[0] : "unspecified";
2276
+ const fromLevel = findByIdSync(from.levelId);
2277
+ const toLevel = findByIdSync(to.levelId);
2278
+ return {
2279
+ from,
2280
+ to,
2281
+ levelIds: [from.levelId, to.levelId],
2282
+ ordinals: [from.ordinal, to.ordinal],
2283
+ intermediaryCategory,
2284
+ description: describeVerticalStep(fromLevel, toLevel, intermediaryCategory),
2285
+ path: [
2286
+ [...from.point, from.ordinal * 9],
2287
+ [...to.point, to.ordinal * 9]
2288
+ ]
2289
+ };
2290
+ };
2291
+ const isVertical = (from, to) => {
2292
+ const fromLevel = findByIdSync(from.levelId);
2293
+ const toLevel = findByIdSync(to.levelId);
2294
+ return !!fromLevel && !!toLevel && fromLevel.properties.ordinal !== toLevel.properties.ordinal;
2295
+ };
2296
+ const toSteps = (waypoints) => {
2297
+ let steps = [];
2298
+ const t0_allSteps = performance.now();
2299
+ for (let i = 0; i < waypoints.length - 1; i++) {
2300
+ const from = waypoints[i];
2301
+ const to = waypoints[i + 1];
2302
+ const t0 = performance.now();
2303
+ const step = isVertical(from, to) ? createVerticalStep(from, to) : createHorizontalStep(from, to);
2304
+ steps.push(step);
2305
+ const t1 = performance.now();
2306
+ trace("nav", ` \u2502 \u251C\u2500 #${i} ${from.id.padEnd(25)} \u2192 ${`(${step.intermediaryCategory})`.padEnd(12)} \u2192 ${to.id}`, t1 - t0);
2307
+ trace("nav", ` \u2502 \u2502 ${step.description.text}`, void 0, "#bada55");
2308
+ }
2309
+ const simplifySteps = combineWalkwaySteps(steps);
2310
+ const t1_allSteps = performance.now();
2311
+ trace("nav", " \u2502 \u2514\u2500 Total ", t1_allSteps - t0_allSteps);
2312
+ return simplifySteps;
2313
+ };
2314
+ return {
2315
+ // createSteps,
2316
+ toWaypoints,
2317
+ toSteps
2318
+ };
2319
+ };
2097
2320
 
2098
- // src/data/search/getSearchClient.ts
2099
- var getSearchClient = ({ occupants, amenities }) => {
2100
- const fuseAmenities = new Fuse(amenities, {
2101
- threshold: 0.2,
2102
- keys: [
2103
- { name: "properties.name", "weight": 1, getFn: (obj) => Object.values(obj.properties.name || {}) },
2104
- { name: "properties.category", "weight": 1 }
2105
- ]
2106
- });
2107
- const fuseOccupants = new Fuse(occupants, {
2108
- threshold: 0.25,
2109
- // 0.2 is too strict (can't find Mo-Mo Paradise with "momo" search string)
2110
- includeScore: true,
2111
- shouldSort: true,
2112
- keys: [
2113
- { name: "properties.name", "weight": 4, getFn: (obj) => Object.values(obj.properties.name || {}) },
2114
- { name: "properties.keywords", "weight": 0.5 },
2115
- { name: "properties.category", "weight": 0.25 },
2116
- { name: "properties.local_category_names", "weight": 0.25 },
2117
- { name: "properties.description", "weight": 0.25, getFn: (occ) => Object.values(occ.properties.description || {}) },
2118
- { name: "properties.unit_name", "weight": 0.25 },
2119
- { name: "properties.kiosk_name", "weight": 0.25 }
2120
- ]
2121
- });
2122
- const search2 = (value) => {
2123
- const sanitizedValue = sanitizeInput(value);
2124
- const matchedAmenities = fuseAmenities.search(sanitizedValue);
2125
- const matchedOccupants = fuseOccupants.search(sanitizedValue);
2126
- return [...matchedAmenities, ...matchedOccupants];
2321
+ // src/data/navigate/utils/timeDistance.ts
2322
+ var import_length = __toESM(require("@turf/length"));
2323
+ var WALKING_SPEED = 1.4;
2324
+ var calculatePathLength = (feature2) => (0, import_length.default)(feature2, { units: "kilometers" }) * 1e3;
2325
+ var calculateTravelingDuration = (distance5) => {
2326
+ const duration = distance5 / WALKING_SPEED;
2327
+ const minutes = Math.round(duration / 60);
2328
+ return minutes > 0 ? minutes : 1;
2329
+ };
2330
+ var calculateTotalDistance = (steps = []) => {
2331
+ return steps.reduce((acc, { path }) => acc + calculatePathLength(lineString(path)), 0);
2332
+ };
2333
+ var calculateRoundedDistance = (distance5) => {
2334
+ return Math.round(distance5 - distance5 % 25);
2335
+ };
2336
+
2337
+ // src/data/navigate/utils/createFindByIdSync.ts
2338
+ var createFindByIdSync = (data) => {
2339
+ const { amenities = [], anchors = [], fixtures = [], levels = [], kiosks = [], relationships = [], occupants = [], openings = [], units } = data;
2340
+ const featureById = /* @__PURE__ */ new Map();
2341
+ const entries = [
2342
+ ...amenities,
2343
+ ...anchors,
2344
+ ...fixtures,
2345
+ ...levels,
2346
+ ...kiosks,
2347
+ ...relationships,
2348
+ ...occupants,
2349
+ ...openings,
2350
+ ...units
2351
+ ];
2352
+ for (const f of entries) featureById.set(f.id, f);
2353
+ const findByIdSync = (id) => {
2354
+ return featureById.get(id);
2355
+ };
2356
+ return { findByIdSync };
2357
+ };
2358
+
2359
+ // src/data/navigate/getNavigateClient.ts
2360
+ var getNavigateClient = (options) => {
2361
+ const { data } = options;
2362
+ const { levels, units } = data;
2363
+ trace("nav", "\u2713 prepare");
2364
+ const t0 = performance.now();
2365
+ trace("nav", " \u251C\u2500 createGraph (dijkstra)");
2366
+ const { defaultGraph, accessibleGraph, addCoordinateOrdinalNode } = prepareGraph({ data });
2367
+ const t1 = performance.now();
2368
+ trace("nav", " \u2502 \u2514\u2500 Total ", t1 - t0);
2369
+ const t2 = performance.now();
2370
+ const { findByIdSync } = createFindByIdSync(data);
2371
+ const t3 = performance.now();
2372
+ trace("nav", " \u2514\u2500 findByIdSync", t3 - t2);
2373
+ const findCoordinateOrdinalUnit = (params) => {
2374
+ const [lat, lng, ordinal] = parseOrdinalCoordinate(params);
2375
+ const levelIdsWithOrdinal = levels.filter((level) => level.properties.ordinal === ordinal).map((level) => level.id);
2376
+ const unit = units.find((unit2) => levelIdsWithOrdinal.includes(unit2.properties.level_id) && (0, import_boolean_point_in_polygon4.booleanPointInPolygon)([lat, lng], unit2));
2377
+ return unit;
2378
+ };
2379
+ const stepUtils = createStepUtils({ ...options, findByIdSync });
2380
+ const findRoute = async (routeOriginParam, routeDestinationParam, options2) => {
2381
+ if (!routeOriginParam || !routeDestinationParam) return null;
2382
+ const graph = options2?.mode === "accessible" ? accessibleGraph : defaultGraph;
2383
+ if (isCoordinateOrdinalString(routeOriginParam)) {
2384
+ const walkwayUnit = findCoordinateOrdinalUnit(routeOriginParam);
2385
+ addCoordinateOrdinalNode(routeOriginParam, walkwayUnit);
2386
+ }
2387
+ if (isCoordinateOrdinalString(routeDestinationParam)) {
2388
+ const walkwayUnit = findCoordinateOrdinalUnit(routeDestinationParam);
2389
+ addCoordinateOrdinalNode(routeDestinationParam, walkwayUnit);
2390
+ }
2391
+ try {
2392
+ trace("nav", "\u2713 findRoute", 0);
2393
+ const t02 = performance.now();
2394
+ const path = graph.path(routeOriginParam, routeDestinationParam);
2395
+ const t12 = performance.now();
2396
+ trace("nav", " \u251C\u2500 path (dijkstra)", t12 - t02);
2397
+ const waypoints = stepUtils.toWaypoints(path);
2398
+ console.log({ waypoints });
2399
+ const t22 = performance.now();
2400
+ trace("nav", " \u251C\u2500 toWaypoints", t22 - t12);
2401
+ trace("nav", " \u251C\u2500 toSteps", 0);
2402
+ const steps = stepUtils.toSteps(waypoints);
2403
+ const t32 = performance.now();
2404
+ const totalDistance = calculateTotalDistance(steps);
2405
+ const roundedDistance = calculateRoundedDistance(totalDistance);
2406
+ const duration = calculateTravelingDuration(totalDistance);
2407
+ const t4 = performance.now();
2408
+ trace("nav", " \u2514\u2500 postProcess", t4 - t32);
2409
+ return {
2410
+ // origin: routeOrigin,
2411
+ // destination: routeDestination,
2412
+ description: null,
2413
+ distance: roundedDistance,
2414
+ duration,
2415
+ steps
2416
+ };
2417
+ } catch (error) {
2418
+ console.log(error);
2419
+ throw error;
2420
+ }
2127
2421
  };
2128
2422
  return {
2129
- search: search2
2423
+ findRoute,
2424
+ findByIdSync
2130
2425
  };
2131
2426
  };
2132
2427
 
2133
2428
  // src/data/getDataClient.ts
2134
2429
  var getDataClient = (options) => {
2135
2430
  let searchClient;
2431
+ let navigateClient;
2136
2432
  const observers = /* @__PURE__ */ new Map();
2137
2433
  const queryClient = options.queryClient ?? new import_query_core.QueryClient();
2138
2434
  const { mode = "delivery", projectId, apiKey, baseUrl, previewToken } = options;
@@ -2255,6 +2551,24 @@ var getDataClient = (options) => {
2255
2551
  }
2256
2552
  return searchClient.search(txt);
2257
2553
  };
2554
+ const navigateFn = async (origin, destination) => {
2555
+ if (!navigateClient) {
2556
+ const [levels, occupants, openings, relationships, units, fixtures, kiosks, amenities, anchors] = await Promise.all([
2557
+ filterByType("level"),
2558
+ filterByType("occupant"),
2559
+ filterByType("opening"),
2560
+ filterByType("relationship"),
2561
+ filterByType("unit"),
2562
+ filterByType("fixture"),
2563
+ filterByType("kiosk"),
2564
+ filterByType("amenity"),
2565
+ filterByType("anchor")
2566
+ ]);
2567
+ const haystack = { levels, occupants, openings, relationships, units, fixtures, kiosks, amenities, anchors };
2568
+ navigateClient = getNavigateClient({ data: haystack });
2569
+ }
2570
+ return navigateClient.findRoute(origin, destination);
2571
+ };
2258
2572
  return {
2259
2573
  projectId,
2260
2574
  queryClient,
@@ -2266,7 +2580,8 @@ var getDataClient = (options) => {
2266
2580
  _internalFindById: internalFindById,
2267
2581
  filterByType,
2268
2582
  findById,
2269
- search: searchFn
2583
+ search: searchFn,
2584
+ navigate: navigateFn
2270
2585
  };
2271
2586
  };
2272
2587
 
@@ -2274,115 +2589,9 @@ var getDataClient = (options) => {
2274
2589
  var import_maptalks_gl = require("maptalks-gl");
2275
2590
  var import_transcoders = require("@maptalks/transcoders.draco");
2276
2591
  var import_tween = __toESM(require("@tweenjs/tween.js"));
2277
- var import_lodash10 = __toESM(require("lodash"));
2278
-
2279
- // node_modules/@turf/helpers/dist/esm/index.js
2280
- var earthRadius = 63710088e-1;
2281
- var factors = {
2282
- centimeters: earthRadius * 100,
2283
- centimetres: earthRadius * 100,
2284
- degrees: 360 / (2 * Math.PI),
2285
- feet: earthRadius * 3.28084,
2286
- inches: earthRadius * 39.37,
2287
- kilometers: earthRadius / 1e3,
2288
- kilometres: earthRadius / 1e3,
2289
- meters: earthRadius,
2290
- metres: earthRadius,
2291
- miles: earthRadius / 1609.344,
2292
- millimeters: earthRadius * 1e3,
2293
- millimetres: earthRadius * 1e3,
2294
- nauticalmiles: earthRadius / 1852,
2295
- radians: 1,
2296
- yards: earthRadius * 1.0936
2297
- };
2298
- function feature(geom, properties, options = {}) {
2299
- const feat = { type: "Feature" };
2300
- if (options.id === 0 || options.id) {
2301
- feat.id = options.id;
2302
- }
2303
- if (options.bbox) {
2304
- feat.bbox = options.bbox;
2305
- }
2306
- feat.properties = properties || {};
2307
- feat.geometry = geom;
2308
- return feat;
2309
- }
2310
- function point(coordinates, properties, options = {}) {
2311
- if (!coordinates) {
2312
- throw new Error("coordinates is required");
2313
- }
2314
- if (!Array.isArray(coordinates)) {
2315
- throw new Error("coordinates must be an Array");
2316
- }
2317
- if (coordinates.length < 2) {
2318
- throw new Error("coordinates must be at least 2 numbers long");
2319
- }
2320
- if (!isNumber2(coordinates[0]) || !isNumber2(coordinates[1])) {
2321
- throw new Error("coordinates must contain numbers");
2322
- }
2323
- const geom = {
2324
- type: "Point",
2325
- coordinates
2326
- };
2327
- return feature(geom, properties, options);
2328
- }
2329
- function polygon(coordinates, properties, options = {}) {
2330
- for (const ring of coordinates) {
2331
- if (ring.length < 4) {
2332
- throw new Error(
2333
- "Each LinearRing of a Polygon must have 4 or more Positions."
2334
- );
2335
- }
2336
- if (ring[ring.length - 1].length !== ring[0].length) {
2337
- throw new Error("First and last Position are not equivalent.");
2338
- }
2339
- for (let j = 0; j < ring[ring.length - 1].length; j++) {
2340
- if (ring[ring.length - 1][j] !== ring[0][j]) {
2341
- throw new Error("First and last Position are not equivalent.");
2342
- }
2343
- }
2344
- }
2345
- const geom = {
2346
- type: "Polygon",
2347
- coordinates
2348
- };
2349
- return feature(geom, properties, options);
2350
- }
2351
- function lineString(coordinates, properties, options = {}) {
2352
- if (coordinates.length < 2) {
2353
- throw new Error("coordinates must be an array of two or more positions");
2354
- }
2355
- const geom = {
2356
- type: "LineString",
2357
- coordinates
2358
- };
2359
- return feature(geom, properties, options);
2360
- }
2361
- function featureCollection(features, options = {}) {
2362
- const fc = { type: "FeatureCollection" };
2363
- if (options.id) {
2364
- fc.id = options.id;
2365
- }
2366
- if (options.bbox) {
2367
- fc.bbox = options.bbox;
2368
- }
2369
- fc.features = features;
2370
- return fc;
2371
- }
2372
- function multiPoint(coordinates, properties, options = {}) {
2373
- const geom = {
2374
- type: "MultiPoint",
2375
- coordinates
2376
- };
2377
- return feature(geom, properties, options);
2378
- }
2379
- function isNumber2(num) {
2380
- return !isNaN(num) && num !== null && !Array.isArray(num);
2381
- }
2382
-
2383
- // src/IndoorMap/IndoorMap.ts
2384
- var import_distance = __toESM(require("@turf/distance"));
2385
- var import_center6 = __toESM(require("@turf/center"));
2592
+ var import_lodash20 = __toESM(require("lodash"));
2593
+ var import_distance6 = __toESM(require("@turf/distance"));
2594
+ var import_center13 = __toESM(require("@turf/center"));
2386
2595
  var import_three6 = require("three");
2387
2596
  var import_maptalks10 = require("maptalks.three");
2388
2597
 
@@ -2461,9 +2670,9 @@ var VENUE_EVENTS = {
2461
2670
  };
2462
2671
 
2463
2672
  // src/IndoorMap/utils/createElements.js
2464
- var import_lodash6 = __toESM(require("lodash"));
2673
+ var import_lodash16 = __toESM(require("lodash"));
2465
2674
  var import_maptalks4 = require("maptalks");
2466
- var import_center4 = __toESM(require("@turf/center"));
2675
+ var import_center11 = __toESM(require("@turf/center"));
2467
2676
  var import_buffer = __toESM(require("@turf/buffer"));
2468
2677
  var import_three4 = require("three");
2469
2678
 
@@ -2471,7 +2680,7 @@ var import_three4 = require("three");
2471
2680
  var maptalks = __toESM(require("maptalks"));
2472
2681
  var import_maptalks = require("maptalks.three");
2473
2682
  var import_three = require("three");
2474
- var import_lodash3 = __toESM(require("lodash"));
2683
+ var import_lodash13 = __toESM(require("lodash"));
2475
2684
  var OPTIONS = {
2476
2685
  altitude: 25,
2477
2686
  scale: 15e-5,
@@ -2497,14 +2706,14 @@ var Billboard = class extends import_maptalks.BaseObject {
2497
2706
  this._initOptions(options);
2498
2707
  const {
2499
2708
  altitude = OPTIONS.altitude,
2500
- scale: scale2 = OPTIONS.scale,
2709
+ scale: scale3 = OPTIONS.scale,
2501
2710
  alphaTest = OPTIONS.alphaTest,
2502
2711
  legColor = OPTIONS.legColor,
2503
2712
  showLeg = OPTIONS.showLeg
2504
2713
  } = options;
2505
2714
  this.properties = { ...properties };
2506
2715
  this._createGroup();
2507
- const divider = import_lodash3.default.clamp(window.innerWidth / 375 / 1.75, 1, 1.7);
2716
+ const divider = import_lodash13.default.clamp(window.innerWidth / 375 / 1.75, 1, 1.7);
2508
2717
  if (showLeg) {
2509
2718
  const lineMaterial = new import_three.LineBasicMaterial({
2510
2719
  color: legColor,
@@ -2531,17 +2740,17 @@ var Billboard = class extends import_maptalks.BaseObject {
2531
2740
  const sprite = new import_three.Sprite(material);
2532
2741
  sprite.material.sizeAttenuation = false;
2533
2742
  sprite.scale.set(
2534
- scale2 * naturalWidth / divider,
2535
- scale2 * naturalHeight / divider,
2743
+ scale3 * naturalWidth / divider,
2744
+ scale3 * naturalHeight / divider,
2536
2745
  1
2537
2746
  );
2538
2747
  this.getObject3d().add(sprite);
2539
2748
  });
2540
2749
  const z = layer.altitudeToVector3(altitude, altitude).x;
2541
2750
  const position = layer.coordinateToVector3(coordinate, z);
2542
- import_lodash3.default.set(this.properties, "default.position", position);
2543
- import_lodash3.default.set(this.properties, "default.altitude", altitude);
2544
- import_lodash3.default.set(this.properties, "default.scale", scale2);
2751
+ import_lodash13.default.set(this.properties, "default.position", position);
2752
+ import_lodash13.default.set(this.properties, "default.altitude", altitude);
2753
+ import_lodash13.default.set(this.properties, "default.scale", scale3);
2545
2754
  this.getObject3d().position.copy(position);
2546
2755
  }
2547
2756
  setLineHeight(altitude) {
@@ -2557,7 +2766,7 @@ var Billboard = class extends import_maptalks.BaseObject {
2557
2766
  // src/IndoorMap/object3d/SpriteMarker.ts
2558
2767
  var import_maptalks2 = require("maptalks.three");
2559
2768
  var import_three2 = require("three");
2560
- var import_lodash4 = __toESM(require("lodash"));
2769
+ var import_lodash14 = __toESM(require("lodash"));
2561
2770
  var DEFAULT_SCALE = 0.05;
2562
2771
  var DEFAULT_ALTITUDE = 0;
2563
2772
  var DEFAULT_ALPHATEST = 0.3;
@@ -2581,23 +2790,23 @@ var SpriteMarker = class extends import_maptalks2.BaseObject {
2581
2790
  this._createGroup();
2582
2791
  const {
2583
2792
  altitude = DEFAULT_OPTIONS.altitude,
2584
- scale: scale2 = DEFAULT_OPTIONS.scale,
2793
+ scale: scale3 = DEFAULT_OPTIONS.scale,
2585
2794
  highlight = DEFAULT_OPTIONS.highlight,
2586
2795
  alphaTest = DEFAULT_OPTIONS.alphaTest
2587
2796
  } = options;
2588
2797
  this.properties = { ...properties };
2589
2798
  const modifiedAltitude = altitude + 2;
2590
- this.#default = { options: { scale: scale2, altitude: modifiedAltitude }, material };
2591
- this.#highlight = import_lodash4.default.merge({}, DEFAULT_OPTIONS.highlight, highlight);
2799
+ this.#default = { options: { scale: scale3, altitude: modifiedAltitude }, material };
2800
+ this.#highlight = import_lodash14.default.merge({}, DEFAULT_OPTIONS.highlight, highlight);
2592
2801
  if (material && material instanceof import_three2.SpriteMaterial)
2593
2802
  material.alphaTest = alphaTest;
2594
2803
  const sprite = new import_three2.Sprite(material);
2595
- sprite.scale.set(scale2, scale2, scale2);
2804
+ sprite.scale.set(scale3, scale3, scale3);
2596
2805
  const obj3d = this.getObject3d();
2597
2806
  obj3d.add(sprite);
2598
2807
  const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
2599
2808
  const position = layer.coordinateToVector3(coordinate, z);
2600
- import_lodash4.default.set(this.properties, "default.position", position);
2809
+ import_lodash14.default.set(this.properties, "default.position", position);
2601
2810
  this.getObject3d().position.copy(position);
2602
2811
  }
2603
2812
  // Different objects need to implement their own methods
@@ -2738,15 +2947,15 @@ var NavigationPath = class extends import_maptalks3.BaseObject {
2738
2947
  };
2739
2948
 
2740
2949
  // src/IndoorMap/utils/geometry.ts
2741
- var import_center3 = __toESM(require("@turf/center"));
2742
- var import_lodash5 = __toESM(require("lodash"));
2950
+ var import_center10 = __toESM(require("@turf/center"));
2951
+ var import_lodash15 = __toESM(require("lodash"));
2743
2952
  var import_line_offset = __toESM(require("@turf/line-offset"));
2744
2953
  var getCenterFromGeometry = (geometry) => {
2745
2954
  try {
2746
2955
  const { type = null, coordinates = null } = geometry;
2747
2956
  if (!type || !coordinates) return null;
2748
- const centerPoint = (0, import_center3.default)(geometry);
2749
- return import_lodash5.default.get(centerPoint, "geometry.coordinates");
2957
+ const centerPoint = (0, import_center10.default)(geometry);
2958
+ return import_lodash15.default.get(centerPoint, "geometry.coordinates");
2750
2959
  } catch (error) {
2751
2960
  return null;
2752
2961
  }
@@ -2792,8 +3001,8 @@ var createSVGPathFromMarkerSymbol = (style) => {
2792
3001
  markerFill,
2793
3002
  markerPath
2794
3003
  } = style;
2795
- const scale2 = markerWidth / 24;
2796
- return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${markerFill}"/>`;
3004
+ const scale3 = markerWidth / 24;
3005
+ return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale3})" fill="${markerFill}"/>`;
2797
3006
  };
2798
3007
 
2799
3008
  // src/IndoorMap/utils/createElements.js
@@ -2897,7 +3106,7 @@ var createWaterFixture = (feature2, style, options = {}) => {
2897
3106
  const { geometry, properties } = feature2;
2898
3107
  const { allowOverride, inheritFillColorToLine, zIndex } = options;
2899
3108
  const symbolStyle = { ...style };
2900
- if (allowOverride) import_lodash6.default.merge(symbolStyle, properties.style);
3109
+ if (allowOverride) import_lodash16.default.merge(symbolStyle, properties.style);
2901
3110
  if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
2902
3111
  return new GeometryType[geometry.type](geometry.coordinates, {
2903
3112
  properties: {
@@ -2913,7 +3122,7 @@ var createVegetationFixture = (feature2, style, options = {}) => {
2913
3122
  const { geometry, properties } = feature2;
2914
3123
  const { allowOverride, inheritFillColorToLine, zIndex } = options;
2915
3124
  const symbolStyle = { ...style };
2916
- if (allowOverride) import_lodash6.default.merge(symbolStyle, properties.style);
3125
+ if (allowOverride) import_lodash16.default.merge(symbolStyle, properties.style);
2917
3126
  if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
2918
3127
  return new GeometryType[geometry.type](geometry.coordinates, {
2919
3128
  properties: {
@@ -2930,8 +3139,8 @@ var createObstructionalFixture = (feature2, style = {}, options = {}) => {
2930
3139
  const { model3d } = properties;
2931
3140
  const { allowOverride, inheritFillColorToLine, zIndex } = options;
2932
3141
  const symbolStyle = { ...style };
2933
- if (!import_lodash6.default.isEmpty(model3d)) return;
2934
- if (allowOverride) import_lodash6.default.merge(symbolStyle, properties.style);
3142
+ if (!import_lodash16.default.isEmpty(model3d)) return;
3143
+ if (allowOverride) import_lodash16.default.merge(symbolStyle, properties.style);
2935
3144
  if (inheritFillColorToLine) symbolStyle.lineColor = symbolStyle.polygonFill;
2936
3145
  if (geometry.type === "LineString") {
2937
3146
  const polygon2 = createPolygonFromLineString(geometry);
@@ -3001,7 +3210,7 @@ var createPrincipalOpening = (feature2, style, options = {}) => {
3001
3210
  const { geometry, properties } = feature2;
3002
3211
  const { allowOverride, zIndex } = options;
3003
3212
  const symbolStyle = { ...style };
3004
- if (allowOverride) import_lodash6.default.merge(symbolStyle, properties.style);
3213
+ if (allowOverride) import_lodash16.default.merge(symbolStyle, properties.style);
3005
3214
  try {
3006
3215
  return new import_maptalks4.LineString(geometry.coordinates, {
3007
3216
  properties: {
@@ -3018,7 +3227,7 @@ var createEmergencyExitOpening = (feature2, style, options = {}) => {
3018
3227
  const { geometry, properties } = feature2;
3019
3228
  const { allowOverride, zIndex } = options;
3020
3229
  const symbolStyle = { ...style };
3021
- if (allowOverride) import_lodash6.default.merge(symbolStyle, properties.style);
3230
+ if (allowOverride) import_lodash16.default.merge(symbolStyle, properties.style);
3022
3231
  try {
3023
3232
  return new import_maptalks4.LineString(geometry.coordinates, {
3024
3233
  properties: {
@@ -3035,7 +3244,7 @@ var createPedestrianOpening = (feature2, style, options = {}) => {
3035
3244
  const { geometry, properties, id } = feature2;
3036
3245
  const { allowOverride, zIndex } = options;
3037
3246
  const symbolStyle = { ...style };
3038
- if (allowOverride) import_lodash6.default.merge(symbolStyle, properties.style);
3247
+ if (allowOverride) import_lodash16.default.merge(symbolStyle, properties.style);
3039
3248
  try {
3040
3249
  return new import_maptalks4.LineString(geometry.coordinates, {
3041
3250
  properties: {
@@ -3073,9 +3282,9 @@ var create3DMarker = (coordinates, options, material, threeLayer, markerProperti
3073
3282
  };
3074
3283
  var getExtrudeConfigByFeature = (baseExtrudeConfig, feature2 = {}) => {
3075
3284
  const { feature_type: featureType } = feature2;
3076
- const featureExtrudeConfig = import_lodash6.default.get(feature2, "properties.extrude");
3077
- const featureCategory = import_lodash6.default.get(feature2, "properties.category");
3078
- const baseFeatureExtrudeConfig = import_lodash6.default.get(
3285
+ const featureExtrudeConfig = import_lodash16.default.get(feature2, "properties.extrude");
3286
+ const featureCategory = import_lodash16.default.get(feature2, "properties.category");
3287
+ const baseFeatureExtrudeConfig = import_lodash16.default.get(
3079
3288
  baseExtrudeConfig,
3080
3289
  `${featureType}.${featureCategory || featureType}`
3081
3290
  );
@@ -3133,50 +3342,50 @@ var createStyledUIMarkerElement = ({
3133
3342
  var styledFeatureGenerator = (mapTheme) => {
3134
3343
  const getElementSymbol = (key) => {
3135
3344
  const [featureType] = key.split(".");
3136
- const featureTypeTheme = import_lodash6.default.get(mapTheme, `${featureType}.geometry.symbol`);
3345
+ const featureTypeTheme = import_lodash16.default.get(mapTheme, `${featureType}.geometry.symbol`);
3137
3346
  if (featureType === key) return featureTypeTheme;
3138
- const categoryTheme = import_lodash6.default.get(mapTheme, `${key}.geometry.symbol`);
3139
- return import_lodash6.default.merge({}, featureTypeTheme, categoryTheme);
3347
+ const categoryTheme = import_lodash16.default.get(mapTheme, `${key}.geometry.symbol`);
3348
+ return import_lodash16.default.merge({}, featureTypeTheme, categoryTheme);
3140
3349
  };
3141
3350
  const getLabelSymbol = (key) => {
3142
3351
  const [featureType] = key.split(".");
3143
- const featureTypeTheme = import_lodash6.default.get(mapTheme, `${featureType}.label`);
3144
- const categoryTheme = import_lodash6.default.get(mapTheme, `${key}.label`);
3145
- const mergedSymbol = import_lodash6.default.merge({}, featureTypeTheme, categoryTheme);
3146
- let symbols = import_lodash6.default.values(import_lodash6.default.map(mergedSymbol, "symbol"));
3352
+ const featureTypeTheme = import_lodash16.default.get(mapTheme, `${featureType}.label`);
3353
+ const categoryTheme = import_lodash16.default.get(mapTheme, `${key}.label`);
3354
+ const mergedSymbol = import_lodash16.default.merge({}, featureTypeTheme, categoryTheme);
3355
+ let symbols = import_lodash16.default.values(import_lodash16.default.map(mergedSymbol, "symbol"));
3147
3356
  const markerIndexToMove = symbols.findIndex(
3148
3357
  ({ elementType }) => elementType === "label.marker"
3149
3358
  );
3150
3359
  if (markerIndexToMove >= 0) {
3151
- const markerSymbolToMove = import_lodash6.default.pullAt(symbols, markerIndexToMove)[0];
3360
+ const markerSymbolToMove = import_lodash16.default.pullAt(symbols, markerIndexToMove)[0];
3152
3361
  symbols.push(markerSymbolToMove);
3153
3362
  }
3154
3363
  return symbols;
3155
3364
  };
3156
3365
  const getUIMarkerSymbol = (key) => {
3157
3366
  const [featureType] = key.split(".");
3158
- const featureTypeTheme = import_lodash6.default.get(mapTheme, `${featureType}.ui.marker`);
3159
- const categoryTheme = import_lodash6.default.get(mapTheme, `${key}.ui.marker`);
3160
- const mergedSymbol = import_lodash6.default.merge({}, featureTypeTheme, categoryTheme);
3161
- const symbol = import_lodash6.default.get(mergedSymbol, "symbol");
3367
+ const featureTypeTheme = import_lodash16.default.get(mapTheme, `${featureType}.ui.marker`);
3368
+ const categoryTheme = import_lodash16.default.get(mapTheme, `${key}.ui.marker`);
3369
+ const mergedSymbol = import_lodash16.default.merge({}, featureTypeTheme, categoryTheme);
3370
+ const symbol = import_lodash16.default.get(mergedSymbol, "symbol");
3162
3371
  return symbol;
3163
3372
  };
3164
3373
  const getUIMarkerOptions = (key) => {
3165
3374
  const [featureType] = key.split(".");
3166
- const featureTypeTheme = import_lodash6.default.get(mapTheme, `${featureType}.ui.marker`);
3167
- const categoryTheme = import_lodash6.default.get(mapTheme, `${key}.ui.marker`);
3168
- const mergedSymbol = import_lodash6.default.merge({}, featureTypeTheme, categoryTheme);
3169
- const options = import_lodash6.default.get(mergedSymbol, "options");
3375
+ const featureTypeTheme = import_lodash16.default.get(mapTheme, `${featureType}.ui.marker`);
3376
+ const categoryTheme = import_lodash16.default.get(mapTheme, `${key}.ui.marker`);
3377
+ const mergedSymbol = import_lodash16.default.merge({}, featureTypeTheme, categoryTheme);
3378
+ const options = import_lodash16.default.get(mergedSymbol, "options");
3170
3379
  return options;
3171
3380
  };
3172
3381
  const getLabelOptions = (key) => {
3173
3382
  const [featureType] = key.split(".");
3174
- const featureTypeSymbol = import_lodash6.default.get(mapTheme, `${featureType}.label`);
3175
- const categorySymbol = import_lodash6.default.get(mapTheme, `${key}.label`);
3176
- const mergedSymbol = import_lodash6.default.merge({}, featureTypeSymbol, categorySymbol);
3177
- return import_lodash6.default.reduce(
3383
+ const featureTypeSymbol = import_lodash16.default.get(mapTheme, `${featureType}.label`);
3384
+ const categorySymbol = import_lodash16.default.get(mapTheme, `${key}.label`);
3385
+ const mergedSymbol = import_lodash16.default.merge({}, featureTypeSymbol, categorySymbol);
3386
+ return import_lodash16.default.reduce(
3178
3387
  mergedSymbol,
3179
- (acc, symbol) => ({ ...acc, ...import_lodash6.default.get(symbol, "options", {}) }),
3388
+ (acc, symbol) => ({ ...acc, ...import_lodash16.default.get(symbol, "options", {}) }),
3180
3389
  {}
3181
3390
  );
3182
3391
  };
@@ -3191,13 +3400,13 @@ var styledFeatureGenerator = (mapTheme) => {
3191
3400
  };
3192
3401
  const generateSpriteHighlightMarkerOption = () => {
3193
3402
  return SPRITE_HIGHLIGHT_MARKER_FEATURE.reduce((acc, featCate) => {
3194
- const categoryKey = import_lodash6.default.last(featCate.split("-"));
3403
+ const categoryKey = import_lodash16.default.last(featCate.split("-"));
3195
3404
  const defaultLabelSymbol = getLabelSymbol(categoryKey);
3196
3405
  const highlightLabelSymbol = getLabelSymbol(featCate);
3197
3406
  const [defaultBase, defaultIcon] = defaultLabelSymbol;
3198
3407
  const [highlightBase, highlightIcon] = highlightLabelSymbol;
3199
- const base = import_lodash6.default.merge({}, defaultBase, highlightBase);
3200
- const icon = import_lodash6.default.merge({}, defaultIcon, highlightIcon);
3408
+ const base = import_lodash16.default.merge({}, defaultBase, highlightBase);
3409
+ const icon = import_lodash16.default.merge({}, defaultIcon, highlightIcon);
3201
3410
  const material = createSpriteMaterialByLabelSymbol([base, icon]);
3202
3411
  const options = getLabelOptions(featCate);
3203
3412
  return { ...acc, [featCate]: { material, options } };
@@ -3207,32 +3416,32 @@ var styledFeatureGenerator = (mapTheme) => {
3207
3416
  const spriteHighlightMarkerOptionObj = generateSpriteHighlightMarkerOption();
3208
3417
  const getElementOptions = (key) => {
3209
3418
  const [featureType] = key.split(".");
3210
- const featureTypeOptions = import_lodash6.default.get(
3419
+ const featureTypeOptions = import_lodash16.default.get(
3211
3420
  mapTheme,
3212
3421
  `${featureType}.geometry.options`
3213
3422
  );
3214
- const categoryOptions = import_lodash6.default.get(mapTheme, `${key}.geometry.options`);
3215
- return import_lodash6.default.merge({}, featureTypeOptions, categoryOptions);
3423
+ const categoryOptions = import_lodash16.default.get(mapTheme, `${key}.geometry.options`);
3424
+ return import_lodash16.default.merge({}, featureTypeOptions, categoryOptions);
3216
3425
  };
3217
3426
  const createOccupantMarker = (feature2, locatedFeature, mapConfig) => {
3218
3427
  const { textMarkerType, featureExtrudeConfig } = getFeatureMarkerConfig(
3219
3428
  feature2,
3220
3429
  mapConfig
3221
3430
  );
3222
- const markerHeight = import_lodash6.default.get(featureExtrudeConfig, "height", 0);
3431
+ const markerHeight = import_lodash16.default.get(featureExtrudeConfig, "height", 0);
3223
3432
  const { properties, id, feature_type } = feature2;
3224
3433
  if (!properties.anchor) return;
3225
- const mainLocationId = import_lodash6.default.get(properties, "unit.id") || import_lodash6.default.get(properties, "kiosk.id");
3434
+ const mainLocationId = import_lodash16.default.get(properties, "unit.id") || import_lodash16.default.get(properties, "kiosk.id");
3226
3435
  const isMainLocationFeature = mainLocationId === locatedFeature?.id;
3227
3436
  const { geometry: mainLocationGeometry } = properties?.anchor;
3228
- const geometry = isMainLocationFeature ? mainLocationGeometry : (0, import_center4.default)(locatedFeature)?.geometry;
3437
+ const geometry = isMainLocationFeature ? mainLocationGeometry : (0, import_center11.default)(locatedFeature)?.geometry;
3229
3438
  const baseProperties = {
3230
3439
  id,
3231
3440
  feature_type,
3232
3441
  category: properties.category,
3233
3442
  altitude: getAltitude(properties)
3234
3443
  };
3235
- const occupantName = import_lodash6.default.isEmpty(properties.short_name) ? properties.name : properties.short_name;
3444
+ const occupantName = import_lodash16.default.isEmpty(properties.short_name) ? properties.name : properties.short_name;
3236
3445
  if (locatedFeature) {
3237
3446
  const { feature_type: feature_type2, properties: properties2 } = locatedFeature;
3238
3447
  const { category } = properties2;
@@ -3246,21 +3455,21 @@ var styledFeatureGenerator = (mapTheme) => {
3246
3455
  }
3247
3456
  return requestedType;
3248
3457
  };
3249
- const logoUrl = import_lodash6.default.get(properties, "logo.url");
3250
- const requestedRenderType = import_lodash6.default.get(properties, "render_type", "Name");
3458
+ const logoUrl = import_lodash16.default.get(properties, "logo.url");
3459
+ const requestedRenderType = import_lodash16.default.get(properties, "render_type", "Name");
3251
3460
  const renderType = getValidatedRenderType(requestedRenderType, logoUrl);
3252
3461
  if (renderType === "Label") return null;
3253
3462
  const renderPriority = properties.render_priority || 3;
3254
- const labelSymbol = getLabelSymbol(`occupant-${import_lodash6.default.toLower(renderType)}`);
3255
- const markerSymbol = import_lodash6.default.last(labelSymbol);
3256
- const coordinates = import_lodash6.default.get(geometry, "coordinates");
3463
+ const labelSymbol = getLabelSymbol(`occupant-${import_lodash16.default.toLower(renderType)}`);
3464
+ const markerSymbol = import_lodash16.default.last(labelSymbol);
3465
+ const coordinates = import_lodash16.default.get(geometry, "coordinates");
3257
3466
  const priorityLabelSymbol = getLabelSymbol(
3258
- `occupant-${import_lodash6.default.toLower(renderType)}-${renderPriority}`
3467
+ `occupant-${import_lodash16.default.toLower(renderType)}-${renderPriority}`
3259
3468
  );
3260
- const priorityMarkerSymbol = import_lodash6.default.last(priorityLabelSymbol) || {};
3469
+ const priorityMarkerSymbol = import_lodash16.default.last(priorityLabelSymbol) || {};
3261
3470
  switch (renderType) {
3262
3471
  case "Logo":
3263
- import_lodash6.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
3472
+ import_lodash16.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
3264
3473
  return new import_maptalks4.Marker(coordinates, {
3265
3474
  properties: {
3266
3475
  altitude: getAltitude(properties) + markerHeight,
@@ -3321,13 +3530,13 @@ var styledFeatureGenerator = (mapTheme) => {
3321
3530
  });
3322
3531
  }
3323
3532
  const uiMarkerSymbol = getUIMarkerSymbol(
3324
- `occupant-${import_lodash6.default.toLower(renderType)}`
3533
+ `occupant-${import_lodash16.default.toLower(renderType)}`
3325
3534
  );
3326
3535
  const uiMarkerPrioritySymbol = getUIMarkerSymbol(
3327
- `occupant-${import_lodash6.default.toLower(renderType)}-${renderPriority}`
3536
+ `occupant-${import_lodash16.default.toLower(renderType)}-${renderPriority}`
3328
3537
  );
3329
3538
  const uiMarkerPriorityOptions = getUIMarkerOptions(
3330
- `occupant-${import_lodash6.default.toLower(renderType)}-${renderPriority}`
3539
+ `occupant-${import_lodash16.default.toLower(renderType)}-${renderPriority}`
3331
3540
  );
3332
3541
  const style = { ...uiMarkerSymbol, ...uiMarkerPrioritySymbol };
3333
3542
  return new import_maptalks4.ui.UIMarker(coordinates, {
@@ -3349,7 +3558,7 @@ var styledFeatureGenerator = (mapTheme) => {
3349
3558
  const { category, ordinal, style = {} } = properties;
3350
3559
  const elementStyle = getElementSymbol(`${feature_type}.${category}`);
3351
3560
  const { allowOverride } = getElementOptions(`${feature_type}.${category}`);
3352
- if (allowOverride) import_lodash6.default.merge(elementStyle, style);
3561
+ if (allowOverride) import_lodash16.default.merge(elementStyle, style);
3353
3562
  const { polygonFill: color } = elementStyle;
3354
3563
  const featureProperty = {
3355
3564
  id,
@@ -3438,9 +3647,9 @@ var styledFeatureGenerator = (mapTheme) => {
3438
3647
  feature2,
3439
3648
  mapConfig
3440
3649
  );
3441
- const markerHeight = import_lodash6.default.get(featureExtrudeConfig, "height");
3650
+ const markerHeight = import_lodash16.default.get(featureExtrudeConfig, "height");
3442
3651
  const { id, properties } = feature2;
3443
- const geometry = import_lodash6.default.get(feature2, "geometry") || import_lodash6.default.get(feature2, "properties.anchor.geometry");
3652
+ const geometry = import_lodash16.default.get(feature2, "geometry") || import_lodash16.default.get(feature2, "properties.anchor.geometry");
3444
3653
  const coordinates = getCenterFromGeometry(geometry);
3445
3654
  const symbol = getElementSymbol("pin-marker");
3446
3655
  try {
@@ -3460,10 +3669,10 @@ var styledFeatureGenerator = (mapTheme) => {
3460
3669
  feature2,
3461
3670
  mapConfig
3462
3671
  );
3463
- const markerHeight = import_lodash6.default.get(featureExtrudeConfig, "height", 0);
3672
+ const markerHeight = import_lodash16.default.get(featureExtrudeConfig, "height", 0);
3464
3673
  const { properties, id } = feature2;
3465
3674
  const { geometry } = properties.anchor;
3466
- const logoUrl = import_lodash6.default.get(properties, "logo.url");
3675
+ const logoUrl = import_lodash16.default.get(properties, "logo.url");
3467
3676
  const coordinates = getCenterFromGeometry(geometry);
3468
3677
  const [markerBase, markerLabel] = getLabelSymbol(
3469
3678
  "highlighted-logo-marker"
@@ -3533,7 +3742,7 @@ var styledFeatureGenerator = (mapTheme) => {
3533
3742
  feature2,
3534
3743
  mapConfig
3535
3744
  );
3536
- const markerHeight = import_lodash6.default.get(featureExtrudeConfig, "height");
3745
+ const markerHeight = import_lodash16.default.get(featureExtrudeConfig, "height");
3537
3746
  const { id, feature_type, properties } = feature2;
3538
3747
  if (!properties.anchor) return;
3539
3748
  const markerProperties = {
@@ -3543,8 +3752,8 @@ var styledFeatureGenerator = (mapTheme) => {
3543
3752
  altitude: getAltitude(properties) + markerHeight
3544
3753
  };
3545
3754
  const { geometry } = properties?.anchor;
3546
- const coordinates = import_lodash6.default.get(geometry, "coordinates");
3547
- const logoUrl = import_lodash6.default.get(properties, "logo.url");
3755
+ const coordinates = import_lodash16.default.get(geometry, "coordinates");
3756
+ const logoUrl = import_lodash16.default.get(properties, "logo.url");
3548
3757
  if (markerSymbol) {
3549
3758
  return new import_maptalks4.Marker(coordinates, {
3550
3759
  properties: markerProperties,
@@ -3559,8 +3768,8 @@ var styledFeatureGenerator = (mapTheme) => {
3559
3768
  });
3560
3769
  }
3561
3770
  const labelSymbol = getLabelSymbol("highlight-occupant-logo");
3562
- const priorityMarkerSymbol = import_lodash6.default.last(labelSymbol) || {};
3563
- import_lodash6.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
3771
+ const priorityMarkerSymbol = import_lodash16.default.last(labelSymbol) || {};
3772
+ import_lodash16.default.set(priorityMarkerSymbol, "markerFile", logoUrl);
3564
3773
  return new import_maptalks4.Marker(coordinates, {
3565
3774
  properties: markerProperties,
3566
3775
  symbol: labelSymbol
@@ -3568,14 +3777,14 @@ var styledFeatureGenerator = (mapTheme) => {
3568
3777
  },
3569
3778
  createHighlight2DAmenityMarkerFrom3DMarker: (feature2, mapConfig) => {
3570
3779
  const { coordinates, units, kiosk } = feature2;
3571
- const amenityLocatedUnit = import_lodash6.default.first(units);
3780
+ const amenityLocatedUnit = import_lodash16.default.first(units);
3572
3781
  const unitConfig = getExtrudeConfigByFeature(
3573
3782
  mapConfig,
3574
3783
  amenityLocatedUnit
3575
3784
  );
3576
- const unitHeight = import_lodash6.default.get(unitConfig, "height", 0);
3785
+ const unitHeight = import_lodash16.default.get(unitConfig, "height", 0);
3577
3786
  const kioskConfig = getExtrudeConfigByFeature(mapConfig, kiosk);
3578
- const kioskHeight = import_lodash6.default.get(kioskConfig, "height", 0);
3787
+ const kioskHeight = import_lodash16.default.get(kioskConfig, "height", 0);
3579
3788
  const markerHeight = unitHeight + kioskHeight;
3580
3789
  const symbol = getElementSymbol("highlight-amenity-marker");
3581
3790
  return new import_maptalks4.Marker(coordinates, {
@@ -3651,7 +3860,7 @@ var styledFeatureGenerator = (mapTheme) => {
3651
3860
  }
3652
3861
  },
3653
3862
  createLineStringFromGeometries: (geometries) => {
3654
- const mergedCoordinates = (0, import_lodash6.default)(geometries).map((geometry) => {
3863
+ const mergedCoordinates = (0, import_lodash16.default)(geometries).map((geometry) => {
3655
3864
  switch (geometry.type) {
3656
3865
  case "Point":
3657
3866
  return [
@@ -3729,7 +3938,7 @@ var styledFeatureGenerator = (mapTheme) => {
3729
3938
  const {
3730
3939
  logo,
3731
3940
  altitude,
3732
- scale: scale2,
3941
+ scale: scale3,
3733
3942
  alphaTest,
3734
3943
  legColor,
3735
3944
  showLeg,
@@ -3743,7 +3952,7 @@ var styledFeatureGenerator = (mapTheme) => {
3743
3952
  };
3744
3953
  const options = {
3745
3954
  altitude,
3746
- scale: scale2,
3955
+ scale: scale3,
3747
3956
  alphaTest,
3748
3957
  legColor,
3749
3958
  showLeg,
@@ -3760,29 +3969,29 @@ var styledFeatureGenerator = (mapTheme) => {
3760
3969
  create3DAmenityMarker: (feature2, threeLayer, config) => {
3761
3970
  const { geometry, properties, feature_type, id } = feature2;
3762
3971
  const { category, units, kiosk, is_clickable } = properties;
3763
- const amenityLocatedUnit = import_lodash6.default.first(units);
3764
- const isLocatedUnitModel3dAvailable = !import_lodash6.default.isEmpty(
3972
+ const amenityLocatedUnit = import_lodash16.default.first(units);
3973
+ const isLocatedUnitModel3dAvailable = !import_lodash16.default.isEmpty(
3765
3974
  amenityLocatedUnit?.properties?.model3d
3766
3975
  );
3767
- const isLocatedKioskModel3dAvailable = !import_lodash6.default.isEmpty(
3976
+ const isLocatedKioskModel3dAvailable = !import_lodash16.default.isEmpty(
3768
3977
  kiosk?.properties?.model3d
3769
3978
  );
3770
3979
  const unitConfig = getExtrudeConfigByFeature(config, amenityLocatedUnit);
3771
- const unitHeight = isLocatedUnitModel3dAvailable ? 0 : import_lodash6.default.get(unitConfig, "height", 0);
3980
+ const unitHeight = isLocatedUnitModel3dAvailable ? 0 : import_lodash16.default.get(unitConfig, "height", 0);
3772
3981
  const kioskConfig = getExtrudeConfigByFeature(config, kiosk);
3773
- const kioskHeight = isLocatedKioskModel3dAvailable ? 0 : import_lodash6.default.get(kioskConfig, "height", 0);
3774
- const coordinates = import_lodash6.default.get(geometry, "coordinates");
3982
+ const kioskHeight = isLocatedKioskModel3dAvailable ? 0 : import_lodash16.default.get(kioskConfig, "height", 0);
3983
+ const coordinates = import_lodash16.default.get(geometry, "coordinates");
3775
3984
  const markerProperties = {
3776
3985
  ...properties,
3777
3986
  coordinates,
3778
3987
  id,
3779
3988
  feature_type
3780
3989
  };
3781
- const material = import_lodash6.default.get(
3990
+ const material = import_lodash16.default.get(
3782
3991
  spriteMarkerMaterialObj,
3783
3992
  `${feature_type}.${category}`
3784
3993
  );
3785
- const highlightOptions = import_lodash6.default.get(
3994
+ const highlightOptions = import_lodash16.default.get(
3786
3995
  spriteHighlightMarkerOptionObj,
3787
3996
  `${PREFIX_HIGHLIGHTED_SYMBOL_KEY}-${feature_type}.${category}`
3788
3997
  );
@@ -3805,24 +4014,24 @@ var styledFeatureGenerator = (mapTheme) => {
3805
4014
  const { category, unit, kiosk } = properties;
3806
4015
  const amenityLocation = kiosk || unit;
3807
4016
  const locationConfig = getExtrudeConfigByFeature(config, amenityLocation);
3808
- const coordinates = import_lodash6.default.get(geometry, "coordinates");
4017
+ const coordinates = import_lodash16.default.get(geometry, "coordinates");
3809
4018
  const markerProperties = {
3810
4019
  ...properties,
3811
4020
  coordinates,
3812
4021
  id,
3813
4022
  feature_type
3814
4023
  };
3815
- const material = import_lodash6.default.get(
4024
+ const material = import_lodash16.default.get(
3816
4025
  spriteMarkerMaterialObj,
3817
4026
  `${feature_type}.${category}`
3818
4027
  );
3819
- const highlightOptions = import_lodash6.default.get(
4028
+ const highlightOptions = import_lodash16.default.get(
3820
4029
  spriteHighlightMarkerOptionObj,
3821
4030
  `${PREFIX_HIGHLIGHTED_SYMBOL_KEY}-${feature_type}.${category}`
3822
4031
  );
3823
4032
  const options = {
3824
4033
  scale: 0.05,
3825
- altitude: import_lodash6.default.get(locationConfig, "height", 0),
4034
+ altitude: import_lodash16.default.get(locationConfig, "height", 0),
3826
4035
  highlight: highlightOptions
3827
4036
  };
3828
4037
  return create3DMarker(
@@ -3838,24 +4047,24 @@ var styledFeatureGenerator = (mapTheme) => {
3838
4047
  const { category, unit, kiosk } = properties;
3839
4048
  const amenityLocation = kiosk || unit;
3840
4049
  const locationConfig = getExtrudeConfigByFeature(config, amenityLocation);
3841
- const coordinates = import_lodash6.default.get(geometry, "coordinates");
4050
+ const coordinates = import_lodash16.default.get(geometry, "coordinates");
3842
4051
  const markerProperties = {
3843
4052
  ...properties,
3844
4053
  coordinates,
3845
4054
  id,
3846
4055
  feature_type
3847
4056
  };
3848
- const material = import_lodash6.default.get(
4057
+ const material = import_lodash16.default.get(
3849
4058
  spriteMarkerMaterialObj,
3850
4059
  `${feature_type}.${category}`
3851
4060
  );
3852
- const highlightOptions = import_lodash6.default.get(
4061
+ const highlightOptions = import_lodash16.default.get(
3853
4062
  spriteHighlightMarkerOptionObj,
3854
4063
  `${PREFIX_HIGHLIGHTED_SYMBOL_KEY}-${feature_type}.${category}`
3855
4064
  );
3856
4065
  const options = {
3857
4066
  scale: 0.05,
3858
- altitude: import_lodash6.default.get(locationConfig, "height", 0),
4067
+ altitude: import_lodash16.default.get(locationConfig, "height", 0),
3859
4068
  highlight: highlightOptions
3860
4069
  };
3861
4070
  return create3DMarker(
@@ -3867,13 +4076,13 @@ var styledFeatureGenerator = (mapTheme) => {
3867
4076
  );
3868
4077
  },
3869
4078
  createExtrudedUnit: (unit, threeLayer, options) => {
3870
- const extrudeHeight = import_lodash6.default.get(options, "height");
4079
+ const extrudeHeight = import_lodash16.default.get(options, "height");
3871
4080
  if (!extrudeHeight) return;
3872
4081
  const unitProperty = getFeatureProperties(unit);
3873
4082
  const options3d = {
3874
4083
  // TODO: Move to extrude config later
3875
4084
  offset: -0.1,
3876
- altitude: import_lodash6.default.get(options, "altitude", 0)
4085
+ altitude: import_lodash16.default.get(options, "altitude", 0)
3877
4086
  };
3878
4087
  const color = unitProperty.defaultColor;
3879
4088
  if (color === "transparent") return;
@@ -3916,14 +4125,14 @@ var EXCEPT_AMENITY_LOCATION_CATEGORIES = [
3916
4125
  "unspecified"
3917
4126
  ];
3918
4127
  var getLocationByAmenity = (feature2) => {
3919
- const unit = import_lodash6.default.get(feature2, "properties.units[0]", null);
3920
- const unitCategory = import_lodash6.default.get(unit, "properties.category");
4128
+ const unit = import_lodash16.default.get(feature2, "properties.units[0]", null);
4129
+ const unitCategory = import_lodash16.default.get(unit, "properties.category");
3921
4130
  if (!unit) return feature2.id;
3922
4131
  return EXCEPT_AMENITY_LOCATION_CATEGORIES.includes(unitCategory) ? feature2 : unit;
3923
4132
  };
3924
4133
  var getLocationByOccupant = (feature2) => {
3925
- const kiosk = import_lodash6.default.get(feature2, "properties.kiosk", null);
3926
- const unit = import_lodash6.default.get(feature2, "properties.anchor.properties.unit", null);
4134
+ const kiosk = import_lodash16.default.get(feature2, "properties.kiosk", null);
4135
+ const unit = import_lodash16.default.get(feature2, "properties.anchor.properties.unit", null);
3927
4136
  return kiosk || unit;
3928
4137
  };
3929
4138
  var getLocationIdByFeature = (feature2) => {
@@ -3951,10 +4160,10 @@ var getFeatureByLocationId = (id, features = []) => {
3951
4160
  });
3952
4161
  };
3953
4162
  var isClickableFeature = (feature2) => {
3954
- const isClickable = import_lodash6.default.get(feature2, "properties.is_clickable");
4163
+ const isClickable = import_lodash16.default.get(feature2, "properties.is_clickable");
3955
4164
  switch (feature2?.feature_type) {
3956
4165
  case "amenity":
3957
- return import_lodash6.default.isNull(isClickable) ? true : isClickable;
4166
+ return import_lodash16.default.isNull(isClickable) ? true : isClickable;
3958
4167
  case "occupant":
3959
4168
  return true;
3960
4169
  default:
@@ -3972,15 +4181,15 @@ var getLocationByFeature = (feature2) => {
3972
4181
  }
3973
4182
  };
3974
4183
  var getRelatedLocationsByOccupant = (feature2) => {
3975
- const kiosks = import_lodash6.default.get(feature2, "properties.kiosks", []);
3976
- const units = import_lodash6.default.get(feature2, "properties.units", []);
4184
+ const kiosks = import_lodash16.default.get(feature2, "properties.kiosks", []);
4185
+ const units = import_lodash16.default.get(feature2, "properties.units", []);
3977
4186
  return [...kiosks, ...units];
3978
4187
  };
3979
4188
  var getRelatedLocationsByAmenity = (feature2) => {
3980
- const units = import_lodash6.default.get(feature2, "properties.units", []);
4189
+ const units = import_lodash16.default.get(feature2, "properties.units", []);
3981
4190
  if (units.length === 0) return [feature2];
3982
4191
  return units.filter((unit) => {
3983
- const unitCategory = import_lodash6.default.get(unit, "properties.category");
4192
+ const unitCategory = import_lodash16.default.get(unit, "properties.category");
3984
4193
  return !EXCEPT_AMENITY_LOCATION_CATEGORIES.includes(unitCategory);
3985
4194
  });
3986
4195
  };
@@ -4006,8 +4215,8 @@ var getRelatedLocationsByFeature = (feature2) => {
4006
4215
  };
4007
4216
  var getOrdinalByLocationId = (locationId, feature2) => {
4008
4217
  if (!feature2) return null;
4009
- const mainUnit = import_lodash6.default.get(feature2, "properties.unit");
4010
- const mainKiosk = import_lodash6.default.get(feature2, "properties.kiosk");
4218
+ const mainUnit = import_lodash16.default.get(feature2, "properties.unit");
4219
+ const mainKiosk = import_lodash16.default.get(feature2, "properties.kiosk");
4011
4220
  const relatedLocations = getRelatedLocationsByFeature(feature2);
4012
4221
  const allLocations = [mainUnit, mainKiosk, ...relatedLocations].filter(
4013
4222
  Boolean
@@ -4015,7 +4224,7 @@ var getOrdinalByLocationId = (locationId, feature2) => {
4015
4224
  const targetLocation = allLocations.find(
4016
4225
  (location) => location.id === locationId
4017
4226
  );
4018
- return targetLocation ? import_lodash6.default.get(targetLocation, "properties.level.properties.ordinal") || import_lodash6.default.get(targetLocation, "properties.ordinal") : null;
4227
+ return targetLocation ? import_lodash16.default.get(targetLocation, "properties.level.properties.ordinal") || import_lodash16.default.get(targetLocation, "properties.ordinal") : null;
4019
4228
  };
4020
4229
 
4021
4230
  // src/IndoorMap/utils/math.ts
@@ -4028,140 +4237,16 @@ var getBearingBetweenPoints = (origin, destination) => {
4028
4237
  return Math.floor(radToDegree(theta));
4029
4238
  };
4030
4239
  var getSuitablyValueBetweenBearings = (newBearing, currentBearing) => {
4031
- const difference = Math.abs(newBearing - currentBearing);
4032
- if (difference > 180)
4240
+ const difference2 = Math.abs(newBearing - currentBearing);
4241
+ if (difference2 > 180)
4033
4242
  return newBearing > 0 ? newBearing - 360 : newBearing + 360;
4034
4243
  return newBearing;
4035
4244
  };
4036
4245
 
4037
4246
  // src/IndoorMap/camera/CameraManager.ts
4038
4247
  var import_maptalks5 = require("maptalks");
4039
-
4040
- // ../../node_modules/@turf/meta/dist/esm/index.js
4041
- function coordEach(geojson, callback, excludeWrapCoord) {
4042
- if (geojson === null) return;
4043
- var j, k, l, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type = geojson.type, isFeatureCollection = type === "FeatureCollection", isFeature = type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
4044
- for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
4045
- geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
4046
- isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
4047
- stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
4048
- for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
4049
- var multiFeatureIndex = 0;
4050
- var geometryIndex = 0;
4051
- geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
4052
- if (geometry === null) continue;
4053
- coords = geometry.coordinates;
4054
- var geomType = geometry.type;
4055
- wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
4056
- switch (geomType) {
4057
- case null:
4058
- break;
4059
- case "Point":
4060
- if (callback(
4061
- coords,
4062
- coordIndex,
4063
- featureIndex,
4064
- multiFeatureIndex,
4065
- geometryIndex
4066
- ) === false)
4067
- return false;
4068
- coordIndex++;
4069
- multiFeatureIndex++;
4070
- break;
4071
- case "LineString":
4072
- case "MultiPoint":
4073
- for (j = 0; j < coords.length; j++) {
4074
- if (callback(
4075
- coords[j],
4076
- coordIndex,
4077
- featureIndex,
4078
- multiFeatureIndex,
4079
- geometryIndex
4080
- ) === false)
4081
- return false;
4082
- coordIndex++;
4083
- if (geomType === "MultiPoint") multiFeatureIndex++;
4084
- }
4085
- if (geomType === "LineString") multiFeatureIndex++;
4086
- break;
4087
- case "Polygon":
4088
- case "MultiLineString":
4089
- for (j = 0; j < coords.length; j++) {
4090
- for (k = 0; k < coords[j].length - wrapShrink; k++) {
4091
- if (callback(
4092
- coords[j][k],
4093
- coordIndex,
4094
- featureIndex,
4095
- multiFeatureIndex,
4096
- geometryIndex
4097
- ) === false)
4098
- return false;
4099
- coordIndex++;
4100
- }
4101
- if (geomType === "MultiLineString") multiFeatureIndex++;
4102
- if (geomType === "Polygon") geometryIndex++;
4103
- }
4104
- if (geomType === "Polygon") multiFeatureIndex++;
4105
- break;
4106
- case "MultiPolygon":
4107
- for (j = 0; j < coords.length; j++) {
4108
- geometryIndex = 0;
4109
- for (k = 0; k < coords[j].length; k++) {
4110
- for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
4111
- if (callback(
4112
- coords[j][k][l],
4113
- coordIndex,
4114
- featureIndex,
4115
- multiFeatureIndex,
4116
- geometryIndex
4117
- ) === false)
4118
- return false;
4119
- coordIndex++;
4120
- }
4121
- geometryIndex++;
4122
- }
4123
- multiFeatureIndex++;
4124
- }
4125
- break;
4126
- case "GeometryCollection":
4127
- for (j = 0; j < geometry.geometries.length; j++)
4128
- if (coordEach(geometry.geometries[j], callback, excludeWrapCoord) === false)
4129
- return false;
4130
- break;
4131
- default:
4132
- throw new Error("Unknown Geometry Type");
4133
- }
4134
- }
4135
- }
4136
- }
4137
-
4138
- // ../../node_modules/@turf/bbox/dist/esm/index.js
4139
- function bbox(geojson, options = {}) {
4140
- if (geojson.bbox != null && true !== options.recompute) {
4141
- return geojson.bbox;
4142
- }
4143
- const result = [Infinity, Infinity, -Infinity, -Infinity];
4144
- coordEach(geojson, (coord) => {
4145
- if (result[0] > coord[0]) {
4146
- result[0] = coord[0];
4147
- }
4148
- if (result[1] > coord[1]) {
4149
- result[1] = coord[1];
4150
- }
4151
- if (result[2] < coord[0]) {
4152
- result[2] = coord[0];
4153
- }
4154
- if (result[3] < coord[1]) {
4155
- result[3] = coord[1];
4156
- }
4157
- });
4158
- return result;
4159
- }
4160
- var index_default = bbox;
4161
-
4162
- // src/IndoorMap/camera/CameraManager.ts
4163
- var import_transform_scale = __toESM(require("@turf/transform-scale"));
4164
- var import_bbox_polygon = __toESM(require("@turf/bbox-polygon"));
4248
+ var import_transform_scale2 = __toESM(require("@turf/transform-scale"));
4249
+ var import_bbox_polygon2 = __toESM(require("@turf/bbox-polygon"));
4165
4250
  var CameraManager = class {
4166
4251
  map;
4167
4252
  constructor(map, options) {
@@ -4187,7 +4272,7 @@ var CameraManager = class {
4187
4272
  }
4188
4273
  getFeatureExtent = (feature2, scaleFactor = 1) => {
4189
4274
  const [minX, minY, maxX, maxY] = index_default(
4190
- (0, import_transform_scale.default)((0, import_bbox_polygon.default)(index_default(feature2)), scaleFactor)
4275
+ (0, import_transform_scale2.default)((0, import_bbox_polygon2.default)(index_default(feature2)), scaleFactor)
4191
4276
  );
4192
4277
  return new import_maptalks5.Extent(minX, minY, maxX, maxY);
4193
4278
  };
@@ -4224,8 +4309,8 @@ var CameraManager = class {
4224
4309
  };
4225
4310
 
4226
4311
  // src/IndoorMap/renderer/RendererManager.ts
4227
- var import_lodash9 = require("lodash");
4228
- var import_center5 = require("@turf/center");
4312
+ var import_lodash19 = require("lodash");
4313
+ var import_center12 = require("@turf/center");
4229
4314
  var THREE4 = __toESM(require("three"));
4230
4315
 
4231
4316
  // src/IndoorMap/renderer/3d/Element3DRenderer.ts
@@ -4233,10 +4318,10 @@ var maptalks4 = __toESM(require("maptalks-gl"));
4233
4318
  var THREE = __toESM(require("three"));
4234
4319
  var import_maptalks7 = require("maptalks.three");
4235
4320
  var import_buffer2 = __toESM(require("@turf/buffer"));
4236
- var import_clean_coords = require("@turf/clean-coords");
4321
+ var import_clean_coords2 = require("@turf/clean-coords");
4237
4322
  var import_polygon_to_line = require("@turf/polygon-to-line");
4238
4323
  var import_nearest_point_on_line = require("@turf/nearest-point-on-line");
4239
- var import_length = require("@turf/length");
4324
+ var import_length2 = require("@turf/length");
4240
4325
  var import_along = require("@turf/along");
4241
4326
  var import_point_to_line_distance = require("@turf/point-to-line-distance");
4242
4327
 
@@ -4245,7 +4330,7 @@ var maptalks3 = __toESM(require("maptalks-gl"));
4245
4330
  var import_maptalks6 = require("maptalks.three");
4246
4331
  var import_three5 = require("three");
4247
4332
  var import_d3plus_shape = require("d3plus-shape");
4248
- var import_lodash7 = require("lodash");
4333
+ var import_lodash17 = require("lodash");
4249
4334
  var OPTIONS3 = {
4250
4335
  // Allowing click through and prevent interaction
4251
4336
  interactive: false,
@@ -4263,9 +4348,9 @@ var defaultFlatLabelOptions = {
4263
4348
  textBaseline: "middle",
4264
4349
  fillStyle: "#000"
4265
4350
  };
4266
- var defaultRectAngleToCalc = (0, import_lodash7.range)(-90, 92, 2);
4351
+ var defaultRectAngleToCalc = (0, import_lodash17.range)(-90, 92, 2);
4267
4352
  var getMaterial = (text, flatLabelOptions) => {
4268
- const options = (0, import_lodash7.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
4353
+ const options = (0, import_lodash17.merge)({}, defaultFlatLabelOptions, flatLabelOptions);
4269
4354
  const {
4270
4355
  fontSize: initialFontSize,
4271
4356
  fontFamily,
@@ -4318,23 +4403,23 @@ var getMaterial = (text, flatLabelOptions) => {
4318
4403
  const maxWidth = SIZE - 2 * margin;
4319
4404
  texts = wrapText(ctx, text, maxWidth);
4320
4405
  }
4321
- let textWidth = (0, import_lodash7.max)(texts.map((text2) => ctx.measureText(text2).width));
4322
- let scale2 = 1;
4323
- while (scale2 > 0 && textWidth + 2 * margin > SIZE) {
4324
- scale2 -= scaleStep;
4325
- ctx.font = `${fontWeight} ${scale2 * fontSize}px "${fontFamily}", Arial`;
4326
- textWidth = (0, import_lodash7.max)(texts.map((text2) => ctx.measureText(text2).width));
4327
- }
4328
- const center4 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
4329
- if (scale2 > scaleMin) {
4330
- const totalHeight = texts.length * (fontSize * scale2 * lineHeight);
4331
- const startY = center4.y - totalHeight / 2 + fontSize * scale2 * lineHeight * 0.5;
4406
+ let textWidth = (0, import_lodash17.max)(texts.map((text2) => ctx.measureText(text2).width));
4407
+ let scale3 = 1;
4408
+ while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
4409
+ scale3 -= scaleStep;
4410
+ ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
4411
+ textWidth = (0, import_lodash17.max)(texts.map((text2) => ctx.measureText(text2).width));
4412
+ }
4413
+ const center8 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
4414
+ if (scale3 > scaleMin) {
4415
+ const totalHeight = texts.length * (fontSize * scale3 * lineHeight);
4416
+ const startY = center8.y - totalHeight / 2 + fontSize * scale3 * lineHeight * 0.5;
4332
4417
  texts.forEach((text2, index) => {
4333
- const yOffset = startY + index * (fontSize * scale2 * lineHeight);
4418
+ const yOffset = startY + index * (fontSize * scale3 * lineHeight);
4334
4419
  if (strokeStyle && lineWidth) {
4335
- ctx.strokeText(text2, center4.x, yOffset);
4420
+ ctx.strokeText(text2, center8.x, yOffset);
4336
4421
  }
4337
- ctx.fillText(text2, center4.x, yOffset);
4422
+ ctx.fillText(text2, center8.x, yOffset);
4338
4423
  });
4339
4424
  }
4340
4425
  const texture = new import_three5.Texture(canvas);
@@ -4391,7 +4476,7 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
4391
4476
  strokeStyle,
4392
4477
  lineWidth
4393
4478
  });
4394
- const rectAngles = (0, import_lodash7.isArray)(angle) ? angle : [angle];
4479
+ const rectAngles = (0, import_lodash17.isArray)(angle) ? angle : [angle];
4395
4480
  material.needsUpdate = true;
4396
4481
  const rect = (0, import_d3plus_shape.largestRect)(bound, {
4397
4482
  cache: true,
@@ -4411,8 +4496,8 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
4411
4496
  const basePosition = layer.coordinateToVector3([cx, cy], z);
4412
4497
  this.#originalPosition = basePosition.clone();
4413
4498
  const finalPosition = this.#calculateFinalPosition(basePosition);
4414
- const scale2 = width / 6456122659e-13;
4415
- const finalScale = maxFontScale && scale2 > maxFontScale ? maxFontScale : scale2;
4499
+ const scale3 = width / 6456122659e-13;
4500
+ const finalScale = maxFontScale && scale3 > maxFontScale ? maxFontScale : scale3;
4416
4501
  this.getObject3d().scale.set(finalScale, finalScale, finalScale);
4417
4502
  this.getObject3d().position.copy(finalPosition);
4418
4503
  this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
@@ -4464,32 +4549,32 @@ var GroundLabel = class extends import_maptalks6.BaseObject {
4464
4549
  return { x: this.#offsetX, y: this.#offsetY };
4465
4550
  }
4466
4551
  set offsetX(value) {
4467
- if ((0, import_lodash7.isNumber)(value)) {
4552
+ if ((0, import_lodash17.isNumber)(value)) {
4468
4553
  this.#offsetX = value;
4469
4554
  this.#updatePosition();
4470
4555
  }
4471
4556
  }
4472
4557
  set offsetY(value) {
4473
- if ((0, import_lodash7.isNumber)(value)) {
4558
+ if ((0, import_lodash17.isNumber)(value)) {
4474
4559
  this.#offsetY = value;
4475
4560
  this.#updatePosition();
4476
4561
  }
4477
4562
  }
4478
4563
  set angle(newAngle) {
4479
- if ((0, import_lodash7.isNumber)(newAngle)) {
4564
+ if ((0, import_lodash17.isNumber)(newAngle)) {
4480
4565
  this.#angle = newAngle;
4481
4566
  this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
4482
4567
  }
4483
4568
  }
4484
4569
  setOffset(offsetX, offsetY) {
4485
- if ((0, import_lodash7.isNumber)(offsetX) && (0, import_lodash7.isNumber)(offsetY)) {
4570
+ if ((0, import_lodash17.isNumber)(offsetX) && (0, import_lodash17.isNumber)(offsetY)) {
4486
4571
  this.#offsetX = offsetX;
4487
4572
  this.#offsetY = offsetY;
4488
4573
  this.#updatePosition();
4489
4574
  }
4490
4575
  }
4491
4576
  addOffset(deltaX, deltaY) {
4492
- if ((0, import_lodash7.isNumber)(deltaX) && (0, import_lodash7.isNumber)(deltaY)) {
4577
+ if ((0, import_lodash17.isNumber)(deltaX) && (0, import_lodash17.isNumber)(deltaY)) {
4493
4578
  this.#offsetX += deltaX;
4494
4579
  this.#offsetY += deltaY;
4495
4580
  this.#updatePosition();
@@ -4591,6 +4676,7 @@ var Element3DRenderer = class extends EventTarget {
4591
4676
  threeLayer;
4592
4677
  scene;
4593
4678
  lineMaterial;
4679
+ navigationLineMaterial;
4594
4680
  materialByColorMap;
4595
4681
  // Renderer is Ready
4596
4682
  isReady = false;
@@ -4602,6 +4688,7 @@ var Element3DRenderer = class extends EventTarget {
4602
4688
  this.threeLayer = groupLayer.getLayer("three");
4603
4689
  this.gltfLayer = groupLayer.getLayer("gltf");
4604
4690
  this.lineMaterial = new THREE.LineBasicMaterial({ color: "#000" });
4691
+ this.navigationLineMaterial = new THREE.LineBasicMaterial({ color: "#f00" });
4605
4692
  this.render();
4606
4693
  }
4607
4694
  animation() {
@@ -4717,7 +4804,7 @@ var Element3DRenderer = class extends EventTarget {
4717
4804
  const polygons = unit.geometry.type === "Polygon" ? [unit.geometry.coordinates] : unit.geometry.coordinates;
4718
4805
  return polygons.map((plg) => {
4719
4806
  return plg.map((ring) => {
4720
- const roomWall = (0, import_clean_coords.cleanCoords)((0, import_polygon_to_line.polygonToLine)(polygon([ring])));
4807
+ const roomWall = (0, import_clean_coords2.cleanCoords)((0, import_polygon_to_line.polygonToLine)(polygon([ring])));
4721
4808
  if (openings.length === 0) {
4722
4809
  const color = "#ababab";
4723
4810
  const material = this.getOrCreateMaterialByColor(color);
@@ -4745,7 +4832,7 @@ var Element3DRenderer = class extends EventTarget {
4745
4832
  try {
4746
4833
  const split = (0, import_line_split.default)(roomWall, multiPoint(openingPoints));
4747
4834
  const wallsOnly = split.features.filter((seg) => {
4748
- const mid = (0, import_along.along)(seg, (0, import_length.length)(seg, { units: "meters" }) / 2, { units: "meters" });
4835
+ const mid = (0, import_along.along)(seg, (0, import_length2.length)(seg, { units: "meters" }) / 2, { units: "meters" });
4749
4836
  for (const opening of openings) {
4750
4837
  const dist = (0, import_point_to_line_distance.pointToLineDistance)(mid, opening, { units: "meters" });
4751
4838
  if (dist < 0.05) return false;
@@ -4804,8 +4891,8 @@ var Element3DRenderer = class extends EventTarget {
4804
4891
  this.threeLayer.addMesh(groundLabel);
4805
4892
  return groundLabel;
4806
4893
  }
4807
- async createModel3d(center4, url) {
4808
- const marker = new maptalks4.GLTFMarker(center4, {
4894
+ async createModel3d(center8, url) {
4895
+ const marker = new maptalks4.GLTFMarker(center8, {
4809
4896
  symbol: {
4810
4897
  url
4811
4898
  }
@@ -4866,11 +4953,23 @@ var Element3DRenderer = class extends EventTarget {
4866
4953
  }
4867
4954
  }
4868
4955
  }
4956
+ drawNavigation = (route) => {
4957
+ const lines = [];
4958
+ route.steps.map((step) => {
4959
+ const lineString2 = new maptalks4.LineString(step.path);
4960
+ const line = this.threeLayer.toPath(lineString2, { altitude: 0.2, cornerRadius: 1, width: 1, asynchronous: true }, this.navigationLineMaterial);
4961
+ lines.push(line);
4962
+ });
4963
+ this.threeLayer.addMesh(lines);
4964
+ };
4869
4965
  render() {
4870
4966
  this.threeLayer._needsUpdate = !this.threeLayer._needsUpdate;
4871
4967
  if (this.threeLayer._needsUpdate) {
4872
4968
  this.threeLayer.redraw();
4873
4969
  }
4970
+ if (this.navigationLineMaterial?.map?.offset) {
4971
+ this.navigationLineMaterial.map.offset.x -= 2e-3;
4972
+ }
4874
4973
  requestAnimationFrame(this.render.bind(this));
4875
4974
  }
4876
4975
  };
@@ -5010,6 +5109,8 @@ var Element2DRenderer = class extends EventTarget {
5010
5109
  }
5011
5110
  };
5012
5111
  }
5112
+ drawNavigation(route) {
5113
+ }
5013
5114
  };
5014
5115
 
5015
5116
  // src/IndoorMap/renderer/2d/Marker2DRenderer.ts
@@ -5055,7 +5156,7 @@ var THREE3 = __toESM(require("three"));
5055
5156
  var import_maptalks8 = require("maptalks");
5056
5157
  var THREE2 = __toESM(require("three"));
5057
5158
  var import_maptalks9 = require("maptalks.three");
5058
- var import_lodash8 = require("lodash");
5159
+ var import_lodash18 = require("lodash");
5059
5160
 
5060
5161
  // src/IndoorMap/renderer/utils/interpolateStops.ts
5061
5162
  var interpolateStops = ({ stops }, zoom) => {
@@ -5065,8 +5166,8 @@ var interpolateStops = ({ stops }, zoom) => {
5065
5166
  const [z1, v1] = stops[i];
5066
5167
  const [z2, v2] = stops[i + 1];
5067
5168
  if (zoom >= z1 && zoom <= z2) {
5068
- const t = (zoom - z1) / (z2 - z1);
5069
- return v1 + t * (v2 - v1);
5169
+ const t2 = (zoom - z1) / (z2 - z1);
5170
+ return v1 + t2 * (v2 - v1);
5070
5171
  }
5071
5172
  }
5072
5173
  };
@@ -5150,7 +5251,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
5150
5251
  const paragraphs = String(text).split("\n");
5151
5252
  const wrappedLines = [];
5152
5253
  paragraphs.forEach((paragraph) => {
5153
- if ((0, import_lodash8.isNil)(maxWidth) || isNaN(maxWidth)) {
5254
+ if ((0, import_lodash18.isNil)(maxWidth) || isNaN(maxWidth)) {
5154
5255
  wrappedLines.push(paragraph);
5155
5256
  return;
5156
5257
  }
@@ -5211,7 +5312,7 @@ var TextSpriteMarker = class extends import_maptalks9.BaseObject {
5211
5312
  const altitude = (options.altitude || 0) + this.#altitudeOffset;
5212
5313
  const z = layer.altitudeToVector3(altitude, altitude).x;
5213
5314
  const position = layer.coordinateToVector3(this._coordinate, z);
5214
- (0, import_lodash8.set)(this.properties, "default.position", position);
5315
+ (0, import_lodash18.set)(this.properties, "default.position", position);
5215
5316
  this.getObject3d().position.copy(position);
5216
5317
  }
5217
5318
  _animation() {
@@ -5386,10 +5487,10 @@ var angleBetweenLineStrings = (line1, line2) => {
5386
5487
  };
5387
5488
 
5388
5489
  // src/IndoorMap/renderer/utils/findUnitOnPoint.ts
5389
- var import_boolean_point_in_polygon3 = require("@turf/boolean-point-in-polygon");
5490
+ var import_boolean_point_in_polygon5 = require("@turf/boolean-point-in-polygon");
5390
5491
  var findUnitOnPoint = (units, point2) => {
5391
5492
  try {
5392
- return units.find((unit) => (0, import_boolean_point_in_polygon3.booleanPointInPolygon)(point2, polygon(unit.geometry.coordinates)));
5493
+ return units.find((unit) => (0, import_boolean_point_in_polygon5.booleanPointInPolygon)(point2, polygon(unit.geometry.coordinates)));
5393
5494
  } catch (err) {
5394
5495
  return null;
5395
5496
  }
@@ -5476,6 +5577,7 @@ var RendererManager = class extends EventTarget {
5476
5577
  options.onRendererReady();
5477
5578
  }
5478
5579
  _this.#createElements();
5580
+ _this.elementRenderer.createModel3d([100.54724407, 13.72699081], "https://s3.venue.in.th/all_park_f95ac5be3c.gltf");
5479
5581
  setTimeout(() => {
5480
5582
  findBadMeshes(scene);
5481
5583
  }, 3e3);
@@ -5493,7 +5595,7 @@ var RendererManager = class extends EventTarget {
5493
5595
  if (this.#isClicked) return;
5494
5596
  this.#isClicked = true;
5495
5597
  const onClickElement = this.#onClickElement;
5496
- if (!(0, import_lodash9.isFunction)(onClickElement)) return;
5598
+ if (!(0, import_lodash19.isFunction)(onClickElement)) return;
5497
5599
  this.#onClickElement(e);
5498
5600
  this.#isClicked = false;
5499
5601
  };
@@ -5546,7 +5648,7 @@ var RendererManager = class extends EventTarget {
5546
5648
  });
5547
5649
  units.filter((u) => u.properties.category === "room").forEach((unit) => {
5548
5650
  const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
5549
- const roomOpenings = (0, import_lodash9.compact)(openingRelationships.map((rel) => {
5651
+ const roomOpenings = (0, import_lodash19.compact)(openingRelationships.map((rel) => {
5550
5652
  const openingId = rel?.properties.intermediary[0].id;
5551
5653
  return openings.find((o) => o.id === openingId);
5552
5654
  }));
@@ -5592,7 +5694,7 @@ var RendererManager = class extends EventTarget {
5592
5694
  const thatLevelOpening = bothOpenings.find((opening) => opening.properties.ordinal !== thisOrdinal);
5593
5695
  const angle = 180 * (1 / Math.PI) * angleBetweenLineStrings(thisLevelOpening.geometry.coordinates, thatLevelOpening.geometry.coordinates);
5594
5696
  const direction = thisOrdinal < thatLevelOpening.properties.ordinal ? "up" : "down";
5595
- const escalatorEntryPoint = (0, import_center5.center)(thisLevelOpening).geometry.coordinates;
5697
+ const escalatorEntryPoint = (0, import_center12.center)(thisLevelOpening).geometry.coordinates;
5596
5698
  const element = await this.elementRenderer.createEscalator(escalator, escalatorEntryPoint, { direction, angle });
5597
5699
  if (element) {
5598
5700
  const _elements = Array.isArray(element) ? element : [element];
@@ -5604,8 +5706,8 @@ var RendererManager = class extends EventTarget {
5604
5706
  }
5605
5707
  const groundLabels = await this.#dataClient.filterByType("label");
5606
5708
  for (const label of groundLabels) {
5607
- const center4 = (0, import_center5.center)(polygon(label.geometry.coordinates)).geometry.coordinates;
5608
- const unit = findUnitOnPoint(units, center4);
5709
+ const center8 = (0, import_center12.center)(polygon(label.geometry.coordinates)).geometry.coordinates;
5710
+ const unit = findUnitOnPoint(units, center8);
5609
5711
  if (unit) {
5610
5712
  const element = this.elementRenderer.createGroundLabel(label, unit);
5611
5713
  if (element) {
@@ -5628,7 +5730,7 @@ var RendererManager = class extends EventTarget {
5628
5730
  this.markerRenderer.showMarkers(markers, ordinal - baseOrdinal);
5629
5731
  }
5630
5732
  } else {
5631
- const baseOrdinal = Array.isArray(targetOrdinal) ? (0, import_lodash9.min)(targetOrdinal) : targetOrdinal;
5733
+ const baseOrdinal = Array.isArray(targetOrdinal) ? (0, import_lodash19.min)(targetOrdinal) : targetOrdinal;
5632
5734
  for (const [ordinal, elements] of this.elementsByOrdinal) {
5633
5735
  const inOrdinal = Array.isArray(targetOrdinal) ? targetOrdinal.includes(ordinal) : ordinal === targetOrdinal;
5634
5736
  if (inOrdinal) {
@@ -5655,7 +5757,7 @@ var RendererManager = class extends EventTarget {
5655
5757
  const elements = elemIds.map((id) => this.elementsMap.get(id)).flat();
5656
5758
  elements.forEach((element) => {
5657
5759
  const controller = this.elementRenderer.createHighlightController(element);
5658
- if (controller && (0, import_lodash9.isFunction)(controller.start)) {
5760
+ if (controller && (0, import_lodash19.isFunction)(controller.start)) {
5659
5761
  controller.start();
5660
5762
  this.highlightControllers.push(controller);
5661
5763
  }
@@ -5663,7 +5765,7 @@ var RendererManager = class extends EventTarget {
5663
5765
  };
5664
5766
  clearHighlightElements = () => {
5665
5767
  this.highlightControllers.forEach((controller) => {
5666
- if ((0, import_lodash9.isFunction)(controller?.clear)) controller.clear();
5768
+ if ((0, import_lodash19.isFunction)(controller?.clear)) controller.clear();
5667
5769
  });
5668
5770
  };
5669
5771
  /**
@@ -5698,6 +5800,9 @@ var RendererManager = class extends EventTarget {
5698
5800
  this.markerRenderer.removeMarker(marker);
5699
5801
  }
5700
5802
  }
5803
+ drawNavigation(route) {
5804
+ this.elementRenderer.drawNavigation(route);
5805
+ }
5701
5806
  };
5702
5807
 
5703
5808
  // src/IndoorMap/IndoorMap.ts
@@ -5775,7 +5880,7 @@ var IndoorMap = class extends EventTarget {
5775
5880
  };
5776
5881
  constructor(elementId, options) {
5777
5882
  super();
5778
- const combinedOptions = import_lodash10.default.merge({}, defaultOptions, options);
5883
+ const combinedOptions = import_lodash20.default.merge({}, defaultOptions, options);
5779
5884
  this.options = combinedOptions;
5780
5885
  const {
5781
5886
  onMapReady,
@@ -5822,7 +5927,7 @@ var IndoorMap = class extends EventTarget {
5822
5927
  this.dataClient = options.dataClient;
5823
5928
  }
5824
5929
  setOptions(options) {
5825
- const combinedOptions = import_lodash10.default.merge({}, defaultOptions, options);
5930
+ const combinedOptions = import_lodash20.default.merge({}, defaultOptions, options);
5826
5931
  this.options = combinedOptions;
5827
5932
  const maptalksOptions = parseMaptalksOptions(combinedOptions);
5828
5933
  this.map.setOptions(maptalksOptions);
@@ -5832,10 +5937,10 @@ var IndoorMap = class extends EventTarget {
5832
5937
  if (!this.options.camera?.defaultView?.center) {
5833
5938
  this.#dataClient.filterByType("venue").then((venues) => {
5834
5939
  this.#venues = venues;
5835
- const venueCenters = (0, import_center6.default)(featureCollection(venues));
5940
+ const venueCenters = (0, import_center13.default)(featureCollection(venues));
5836
5941
  const [x, y] = venueCenters.geometry.coordinates;
5837
- const center4 = new import_maptalks_gl.Coordinate(x, y);
5838
- this.camera.setView({ center: center4, pitch: 60, zoom: 19 });
5942
+ const center8 = new import_maptalks_gl.Coordinate(x, y);
5943
+ this.camera.setView({ center: center8, pitch: 60, zoom: 19 });
5839
5944
  });
5840
5945
  }
5841
5946
  }
@@ -5848,7 +5953,7 @@ var IndoorMap = class extends EventTarget {
5848
5953
  handleMapClick = ({ coordinate }) => {
5849
5954
  const { x, y } = coordinate;
5850
5955
  console.log(
5851
- `[Coordinates]: x: ${import_lodash10.default.round(x, 8)} y: ${import_lodash10.default.round(
5956
+ `[Coordinates]: x: ${import_lodash20.default.round(x, 8)} y: ${import_lodash20.default.round(
5852
5957
  y,
5853
5958
  8
5854
5959
  )}, [Bearing]: ${this.map.getBearing()}, [Pitch]: ${this.map.getPitch()}`
@@ -5934,7 +6039,7 @@ var IndoorMap = class extends EventTarget {
5934
6039
  if (this.#isClicked) return;
5935
6040
  this.#isClicked = true;
5936
6041
  const onClickElement = this.#onClickElement;
5937
- if (!import_lodash10.default.isFunction(onClickElement)) return;
6042
+ if (!import_lodash20.default.isFunction(onClickElement)) return;
5938
6043
  this.#onClickElement(e);
5939
6044
  this.#isClicked = false;
5940
6045
  };
@@ -5954,16 +6059,16 @@ var IndoorMap = class extends EventTarget {
5954
6059
  for (const feature2 of this.#features) {
5955
6060
  try {
5956
6061
  const { feature_type: featureType, properties, id } = feature2;
5957
- const layerName = import_lodash10.default.get(
6062
+ const layerName = import_lodash20.default.get(
5958
6063
  LAYER_FEATURE_TYPE_OBJ,
5959
6064
  featureType,
5960
6065
  featureType
5961
6066
  );
5962
6067
  const layer = this.map.getLayer(layerName);
5963
6068
  let geometry;
5964
- const category = import_lodash10.default.get(feature2, "properties.category");
5965
- const extrudeConfig = import_lodash10.default.get(this.#mapConfig, "extrude");
5966
- const textMarkerType = import_lodash10.default.get(
6069
+ const category = import_lodash20.default.get(feature2, "properties.category");
6070
+ const extrudeConfig = import_lodash20.default.get(this.#mapConfig, "extrude");
6071
+ const textMarkerType = import_lodash20.default.get(
5967
6072
  this.#mapConfig,
5968
6073
  "text_marker_type",
5969
6074
  "ui-marker"
@@ -5995,7 +6100,7 @@ var IndoorMap = class extends EventTarget {
5995
6100
  case "opening": {
5996
6101
  switch (category) {
5997
6102
  case "emergencyexit":
5998
- const { geometry: geometry2 } = (0, import_center6.default)(feature2);
6103
+ const { geometry: geometry2 } = (0, import_center13.default)(feature2);
5999
6104
  const markerFeature = {
6000
6105
  ...feature2,
6001
6106
  geometry: geometry2
@@ -6078,9 +6183,9 @@ var IndoorMap = class extends EventTarget {
6078
6183
  const mapCenter = this.map.getCenter();
6079
6184
  const result = this.#venues.reduce((closest, venue) => {
6080
6185
  const { display_point: displayPoint } = venue.properties;
6081
- const distance = (0, import_distance.default)(displayPoint, [mapCenter.x, mapCenter.y]);
6082
- if (!closest || distance < closest.distance) {
6083
- return { venueId: venue.id, distance };
6186
+ const distance5 = (0, import_distance6.default)(displayPoint, [mapCenter.x, mapCenter.y]);
6187
+ if (!closest || distance5 < closest.distance) {
6188
+ return { venueId: venue.id, distance: distance5 };
6084
6189
  }
6085
6190
  return closest;
6086
6191
  }, null);
@@ -6130,15 +6235,15 @@ var IndoorMap = class extends EventTarget {
6130
6235
  }
6131
6236
  }
6132
6237
  updateUserLocationSymbolByLocale(locale) {
6133
- const userLocationGeometry = import_lodash10.default.get(
6238
+ const userLocationGeometry = import_lodash20.default.get(
6134
6239
  this.#elements,
6135
6240
  `${USER_LOCATION_ELEMENT_ID}.geometry`
6136
6241
  );
6137
6242
  if (!userLocationGeometry) return;
6138
6243
  const currentSymbol = userLocationGeometry.getSymbol();
6139
6244
  const localeSymbolToUpdate = currentSymbol.map((symbol) => {
6140
- const localeSymbol = import_lodash10.default.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || import_lodash10.default.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
6141
- if (!import_lodash10.default.isPlainObject(localeSymbol)) return symbol;
6245
+ const localeSymbol = import_lodash20.default.get(symbol, `${LOCALE_SYMBOL_KEY}.${locale}`) || import_lodash20.default.get(symbol, `${LOCALE_SYMBOL_KEY}.default`);
6246
+ if (!import_lodash20.default.isPlainObject(localeSymbol)) return symbol;
6142
6247
  return {
6143
6248
  ...symbol,
6144
6249
  ...localeSymbol
@@ -6212,14 +6317,14 @@ var IndoorMap = class extends EventTarget {
6212
6317
  * END of User Location
6213
6318
  ****************************/
6214
6319
  showGeometryByElementId = (elementId) => {
6215
- const geometry = import_lodash10.default.get(
6320
+ const geometry = import_lodash20.default.get(
6216
6321
  this.#elements,
6217
6322
  `${elementId}.geometry`
6218
6323
  );
6219
6324
  if (geometry) geometry.show();
6220
6325
  };
6221
6326
  hideGeometryByElementId = (elementId) => {
6222
- const geometry = import_lodash10.default.get(this.#elements, `${elementId}.geometry`);
6327
+ const geometry = import_lodash20.default.get(this.#elements, `${elementId}.geometry`);
6223
6328
  if (geometry) geometry.hide();
6224
6329
  };
6225
6330
  setSpriteMarkersOpacity = (opacity = 1) => {
@@ -6258,7 +6363,7 @@ var IndoorMap = class extends EventTarget {
6258
6363
  * Navigation
6259
6364
  ****************************/
6260
6365
  combineNearbyLineStrings(lineStrings, options = { properties: {}, distance: 3e-4 }) {
6261
- const { properties = {}, distance = 3e-4 } = options || {};
6366
+ const { properties = {}, distance: distance5 = 3e-4 } = options || {};
6262
6367
  const combinedLineStrings = [];
6263
6368
  const accLine = [];
6264
6369
  if (lineStrings.length === 1) return lineStrings;
@@ -6266,14 +6371,14 @@ var IndoorMap = class extends EventTarget {
6266
6371
  const line = lineStrings[i];
6267
6372
  const coords = line.geometry.coordinates;
6268
6373
  const prevLine = lineStrings[i - 1];
6269
- const firstCoord = import_lodash10.default.first(coords);
6374
+ const firstCoord = import_lodash20.default.first(coords);
6270
6375
  const isFirstLine = i === 0;
6271
6376
  if (isFirstLine) {
6272
6377
  accLine.push(...coords);
6273
6378
  continue;
6274
6379
  }
6275
- const prevLastCoord = import_lodash10.default.last(prevLine.geometry.coordinates);
6276
- const isNearby = (0, import_distance.default)(point(firstCoord), point(prevLastCoord)) < distance;
6380
+ const prevLastCoord = import_lodash20.default.last(prevLine.geometry.coordinates);
6381
+ const isNearby = (0, import_distance6.default)(point(firstCoord), point(prevLastCoord)) < distance5;
6277
6382
  if (!isNearby) {
6278
6383
  const remainingLines = lineStrings.slice(i);
6279
6384
  const res = this.combineNearbyLineStrings(remainingLines, properties);
@@ -6293,8 +6398,8 @@ var IndoorMap = class extends EventTarget {
6293
6398
  create3DStepPath
6294
6399
  } = this.#styler;
6295
6400
  const routeMarkerLayer = this.map.getLayer(HIGHLIGHT_LAYER_NAME);
6296
- const linesByOrdinal = (0, import_lodash10.default)(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
6297
- const joinedLines = (0, import_lodash10.default)(linesByOrdinal).reduce((acc, lines, key) => {
6401
+ const linesByOrdinal = (0, import_lodash20.default)(stepGeometries).filter(({ geometry }) => geometry.type === "LineString").groupBy("properties.ordinal").value();
6402
+ const joinedLines = (0, import_lodash20.default)(linesByOrdinal).reduce((acc, lines, key) => {
6298
6403
  const joined = this.combineNearbyLineStrings(lines, {
6299
6404
  properties: { ordinal: +key }
6300
6405
  });
@@ -6322,14 +6427,14 @@ var IndoorMap = class extends EventTarget {
6322
6427
  stepElement = createOriginMarker(stepGeometry).addTo(routeMarkerLayer);
6323
6428
  break;
6324
6429
  case "destination-marker":
6325
- const extrudeConfig = import_lodash10.default.get(this.#mapConfig, "extrude");
6430
+ const extrudeConfig = import_lodash20.default.get(this.#mapConfig, "extrude");
6326
6431
  if (destinationFeature.feature_type === "occupant") {
6327
- const stepId = import_lodash10.default.get(stepGeometry, "id");
6432
+ const stepId = import_lodash20.default.get(stepGeometry, "id");
6328
6433
  const normalizedDestinationFeature = {
6329
6434
  ...destinationFeature,
6330
6435
  id: stepId
6331
6436
  };
6332
- const logoUrl = import_lodash10.default.get(
6437
+ const logoUrl = import_lodash20.default.get(
6333
6438
  normalizedDestinationFeature,
6334
6439
  "properties.logo.url"
6335
6440
  );
@@ -6374,15 +6479,15 @@ var IndoorMap = class extends EventTarget {
6374
6479
  const routeMarkerLayer = this.map.getLayer(
6375
6480
  HIGHLIGHT_LAYER_NAME
6376
6481
  );
6377
- const originMarkerGeometry = import_lodash10.default.get(
6482
+ const originMarkerGeometry = import_lodash20.default.get(
6378
6483
  this.#elements,
6379
6484
  `${ORIGIN_MARKER_ID}.geometry`
6380
6485
  );
6381
- const destinationMarkerGeometry = import_lodash10.default.get(
6486
+ const destinationMarkerGeometry = import_lodash20.default.get(
6382
6487
  this.#elements,
6383
6488
  `${DESTINATION_MARKER_ID}.geometry`
6384
6489
  );
6385
- const geometriesToRemove = import_lodash10.default.compact([
6490
+ const geometriesToRemove = import_lodash20.default.compact([
6386
6491
  originMarkerGeometry,
6387
6492
  destinationMarkerGeometry
6388
6493
  ]);
@@ -6393,7 +6498,7 @@ var IndoorMap = class extends EventTarget {
6393
6498
  (obj) => !(obj instanceof NavigationPath)
6394
6499
  );
6395
6500
  const objects = this.#navigationGeometries || {};
6396
- import_lodash10.default.forEach(objects, (obj) => {
6501
+ import_lodash20.default.forEach(objects, (obj) => {
6397
6502
  if (!obj) return;
6398
6503
  this.#navigationGeometries[obj.properties.id] = null;
6399
6504
  obj.remove();
@@ -6430,7 +6535,7 @@ var IndoorMap = class extends EventTarget {
6430
6535
  }
6431
6536
  if (this.threeLayer) {
6432
6537
  const currentView = this.camera.getView();
6433
- const objectOpacity = import_lodash10.default.clamp(38 - 2 * currentView.zoom, 0, 1);
6538
+ const objectOpacity = import_lodash20.default.clamp(38 - 2 * currentView.zoom, 0, 1);
6434
6539
  this.#objects.forEach((object) => {
6435
6540
  object.getObject3d().traverse((child) => {
6436
6541
  if (child.isMesh) child.material.opacity = objectOpacity;
@@ -6440,7 +6545,7 @@ var IndoorMap = class extends EventTarget {
6440
6545
  });
6441
6546
  if (this.#billboardObjects) {
6442
6547
  this.#billboardObjects.forEach((object) => {
6443
- const objectScale = import_lodash10.default.clamp(
6548
+ const objectScale = import_lodash20.default.clamp(
6444
6549
  20 - 1 * currentView.zoom,
6445
6550
  1,
6446
6551
  1.05
@@ -6449,7 +6554,7 @@ var IndoorMap = class extends EventTarget {
6449
6554
  });
6450
6555
  }
6451
6556
  if (this.#isLayersFadingOnZoom) {
6452
- const layerOpacity = import_lodash10.default.clamp(1 - objectOpacity, 0, 1);
6557
+ const layerOpacity = import_lodash20.default.clamp(1 - objectOpacity, 0, 1);
6453
6558
  LAYERS.forEach((layerKey) => {
6454
6559
  const layer = this.map.getLayer(layerKey);
6455
6560
  if (layer) layer.setOpacity(layerOpacity);