@mappedin/react-sdk 6.0.1-beta.10 → 6.0.1-beta.12

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.
@@ -356,6 +356,11 @@ declare module '@mappedin/react-sdk/mappedin-js/src' {
356
356
  */
357
357
  autoRenderBeauty?: boolean;
358
358
  };
359
+ /**
360
+ * @interface
361
+ * Options for the watermark.
362
+ */
363
+ export type TWatermarkOptions = Omit<WatermarkOptions, 'visible'>;
359
364
  /**
360
365
  * Options for showing a 3D map.
361
366
  *
@@ -429,18 +434,22 @@ declare module '@mappedin/react-sdk/mappedin-js/src' {
429
434
  *
430
435
  * @hidden
431
436
  */
432
- watermark?: WatermarkOptions;
437
+ watermark?: TWatermarkOptions;
433
438
  /**
434
439
  * Options for the attribution control.
435
440
  *
436
441
  * @hidden
437
442
  */
438
443
  attribution?: {
444
+ /**
445
+ * Custom attribution content.
446
+ */
447
+ custom?: string[];
439
448
  /**
440
449
  * Attribution position.
441
450
  * @default 'bottom-right'
442
451
  */
443
- position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
452
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
444
453
  };
445
454
  /**
446
455
  * First floor to be rendered.
@@ -737,7 +746,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data' {
737
746
  /**
738
747
  * Changes the language of the map data.
739
748
  *
740
- * @param localeCode The ISO 639-1 language code to change to (e.g., 'en' for English, 'fr' for French). Check venue.languages for available languages
749
+ * @param localeCode The ISO 639-1 language code to change to (e.g., 'en' for English, 'fr' for French). Check ({@link EnterpriseVenue.languages}) for available languages
741
750
  * @returns A promise that resolves when the language change is complete.
742
751
  * @throws An error if the language change fails.
743
752
  * @example
@@ -1081,7 +1090,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects' {
1081
1090
  }
1082
1091
 
1083
1092
  declare module '@mappedin/react-sdk/mappedin-js/src/map-view' {
1084
- import type { RendererCore, WatermarkOptions } from '@mappedin/core-sdk';
1093
+ import type { RendererCore, WatermarkUpdateOptions } from '@mappedin/core-sdk';
1085
1094
  import { PubSub } from '@packages/internal/common';
1086
1095
  import { type TEvents, type TShow3DMapOptions } from '@mappedin/react-sdk/mappedin-js/src';
1087
1096
  import type { Navigation } from '@mappedin/react-sdk/mappedin-js/src/navigation';
@@ -1216,7 +1225,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-view' {
1216
1225
  * @param options {WatermarkOptions}
1217
1226
  * @hidden
1218
1227
  */
1219
- updateWatermark(options: Omit<WatermarkOptions, 'onClick'>): void;
1228
+ updateWatermark(options: WatermarkUpdateOptions): void;
1220
1229
  getState<T extends Space | MapObject | Label | Marker | Image | string>(target: T): TGetState<T> | undefined;
1221
1230
  setHoverColor(c: string): void;
1222
1231
  getHoverColor(): string | undefined;
@@ -1341,7 +1350,7 @@ declare module '@mappedin/react-sdk/geojson/src' {
1341
1350
  export { mountSceneGraphVisualizer };
1342
1351
  export type { EntityId, EntityState, LineStyle, PaintStyle, ModelStyle, ModelProperties, Shading } from '@mappedin/react-sdk/geojson/src/types';
1343
1352
  export type * from 'geojson';
1344
- export type { WatermarkOptions, WatermarkPosition } from '@mappedin/react-sdk/geojson/src/systems/watermark/system';
1353
+ export type { WatermarkUpdateOptions, WatermarkOptions, WatermarkPosition } from '@mappedin/react-sdk/geojson/src/systems/watermark/system';
1345
1354
  export type { GLTFExportOptions } from '@mappedin/react-sdk/geojson/src/systems/exporter';
1346
1355
  export type { AttributionControlOptions, AttributionPosition } from '@mappedin/react-sdk/geojson/src/systems/html-controls/system';
1347
1356
  export { ATTRIBUTION_POSITIONS } from '@mappedin/react-sdk/geojson/src/systems/html-controls/system';
@@ -5506,7 +5515,7 @@ declare module '@mappedin/react-sdk/geojson/src/renderer' {
5506
5515
  import type { GeometryGroupState } from '@mappedin/react-sdk/geojson/src/entities/geometry-group';
5507
5516
  import { DOMResizeSystem } from '@mappedin/react-sdk/geojson/src/systems/dom-resize/system';
5508
5517
  import { Camera } from '@mappedin/react-sdk/geojson/src/camera';
5509
- import { type WatermarkOptions, WatermarkSystem } from '@mappedin/react-sdk/geojson/src/systems/watermark/system';
5518
+ import { type WatermarkUpdateOptions, WatermarkSystem } from '@mappedin/react-sdk/geojson/src/systems/watermark/system';
5510
5519
  import { PanBoundsSystem } from '@mappedin/react-sdk/geojson/src/systems/pan-bounds/system';
5511
5520
  import { HTMLControlsSystem } from '@mappedin/react-sdk/geojson/src/systems/html-controls/system';
5512
5521
  import { type CustomGeometryBuilder, type ShapeState } from '@mappedin/react-sdk/geojson/src/components/custom';
@@ -5640,9 +5649,9 @@ declare module '@mappedin/react-sdk/geojson/src/renderer' {
5640
5649
  /**
5641
5650
  * Updates the watermark on the map.
5642
5651
  *
5643
- * @param options {WatermarkOptions}
5652
+ * @param options {WatermarkUpdateOptions}
5644
5653
  */
5645
- updateWatermark(options: Omit<WatermarkOptions, 'onClick'>): void;
5654
+ updateWatermark(options: WatermarkUpdateOptions): void;
5646
5655
  /**
5647
5656
  * Remove an entity from the renderer and release associated resources.
5648
5657
  */
@@ -6172,6 +6181,7 @@ declare module '@mappedin/react-sdk/geojson/src/systems/watermark/system' {
6172
6181
  import { PubSub } from '@packages/internal/common';
6173
6182
  import type { Geometry2D } from '@mappedin/react-sdk/geojson/src/entities';
6174
6183
  import type { QuadTree } from '@packages/internal/quad-tree';
6184
+ import type { RendererState } from '@mappedin/react-sdk/geojson/src/renderer';
6175
6185
  export type WatermarkPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center' | 'top' | 'bottom' | 'left' | 'right';
6176
6186
  export type WatermarkOptions = {
6177
6187
  /**
@@ -6206,18 +6216,26 @@ declare module '@mappedin/react-sdk/geojson/src/systems/watermark/system' {
6206
6216
  scale?: number;
6207
6217
  /**
6208
6218
  * Callback when the watermark is clicked.
6219
+ * @hidden
6209
6220
  */
6210
6221
  onClick?: () => void;
6222
+ /**
6223
+ * Whether the watermark should be visible.
6224
+ * @hidden
6225
+ * @default true
6226
+ */
6227
+ visible?: boolean;
6211
6228
  };
6229
+ export type WatermarkUpdateOptions = Omit<WatermarkOptions, 'onClick' | 'visible'>;
6212
6230
  export class WatermarkSystem extends PubSub<{
6213
6231
  'texture-loaded': void;
6214
6232
  }> {
6215
6233
  #private;
6216
6234
  dirty: boolean;
6217
- get options(): WatermarkOptions;
6218
- set options(options: WatermarkOptions);
6235
+ get options(): Required<WatermarkOptions>;
6236
+ set options(options: WatermarkUpdateOptions);
6219
6237
  get icon(): string;
6220
- constructor(cameraObject: PerspectiveCamera, canvasWidth: number, canvasHeight: number, rendererState: any, options?: WatermarkOptions);
6238
+ constructor(cameraObject: PerspectiveCamera, rendererState: RendererState, options?: Partial<WatermarkOptions>);
6221
6239
  get width(): number;
6222
6240
  get height(): number;
6223
6241
  getPositionAlignedOffset(width: number, height: number): {
@@ -6239,6 +6257,7 @@ declare module '@mappedin/react-sdk/geojson/src/systems/watermark/system' {
6239
6257
  }>): void;
6240
6258
  resize(canvasWidth: number, canvasHeight: number): void;
6241
6259
  update(): void;
6260
+ destroy(): void;
6242
6261
  }
6243
6262
  }
6244
6263
 
@@ -6255,7 +6274,8 @@ declare module '@mappedin/react-sdk/geojson/src/systems/html-controls/system' {
6255
6274
  export const ATTRIBUTION_POSITIONS: readonly ["top-left", "top-right", "bottom-left", "bottom-right"];
6256
6275
  export type AttributionPosition = (typeof ATTRIBUTION_POSITIONS)[number];
6257
6276
  export type AttributionControlOptions = {
6258
- position: AttributionPosition;
6277
+ custom?: string[];
6278
+ position?: AttributionPosition;
6259
6279
  };
6260
6280
  export class HTMLControlsSystem {
6261
6281
  controlContainerEl: HTMLDivElement;
@@ -6266,6 +6286,7 @@ declare module '@mappedin/react-sdk/geojson/src/systems/html-controls/system' {
6266
6286
  attribButtonEl?: HTMLElement;
6267
6287
  feedbackLinkEl?: HTMLAnchorElement;
6268
6288
  attribHTML: string;
6289
+ customAttributions: string[];
6269
6290
  constructor(container: HTMLElement);
6270
6291
  addAttributionControl(options?: AttributionControlOptions): void;
6271
6292
  toggleAttribution: (e: MouseEvent) => void;
@@ -6449,6 +6470,10 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-view-objects/path' {
6449
6470
  * The label's id
6450
6471
  */
6451
6472
  id: string;
6473
+ /**
6474
+ * The promise that resolves when the current path animation is complete.
6475
+ */
6476
+ animation: Promise<void>;
6452
6477
  /**
6453
6478
  * @internal
6454
6479
  */
@@ -6456,7 +6481,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-view-objects/path' {
6456
6481
  /**
6457
6482
  * @internal
6458
6483
  */
6459
- constructor(id: string);
6484
+ constructor(id: string, drawAnimation: Promise<void>);
6460
6485
  }
6461
6486
  }
6462
6487
 
@@ -6499,7 +6524,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/map-object' {
6499
6524
  import type { Position, AddLabelOptions, RendererCore, PathState, MarkerState, LineStyle, PaintStyle, EntityId } from '@mappedin/core-sdk';
6500
6525
  import { FloorObject } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/floor-object';
6501
6526
  import type { Coordinate, TAddMarkerOptions, TAddPathOptions, TShow3DMapOptions } from '@mappedin/react-sdk/mappedin-js/src';
6502
- import type { GLTFExportOptions, TAnimationOptions, TAddModelOptions, TAddModel, TAddImageOptions, CancellablePromise } from '@mappedin/react-sdk/mappedin-js/src/types';
6527
+ import type { GLTFExportOptions, TAnimationOptions, TAddModelOptions, TAddModel, TAddImageOptions } from '@mappedin/react-sdk/mappedin-js/src/types';
6503
6528
  import { type AggregatedStyleMap } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/utils';
6504
6529
  import { StackedMaps } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/stacked-maps/stacked-maps';
6505
6530
  import type { TFloorChangeReason } from '@mappedin/react-sdk/mappedin-js/src/events';
@@ -6565,7 +6590,10 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/map-object' {
6565
6590
  removeAll: () => void;
6566
6591
  };
6567
6592
  Paths: {
6568
- add: (coordinates: Coordinate[], options?: TAddPathOptions) => CancellablePromise<EntityId<PathState>[]>;
6593
+ add: (coordinates: Coordinate[], options?: TAddPathOptions) => {
6594
+ paths: EntityId<PathState>[];
6595
+ animation: Promise<void>;
6596
+ };
6569
6597
  remove: (entityIds: string[]) => void;
6570
6598
  };
6571
6599
  constructor(id: string, mvf: any, styleMap: AggregatedStyleMap, options: TShow3DMapOptions | undefined, renderer: RendererCore);
@@ -6992,7 +7020,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/paths' {
6992
7020
  * // Add a red path to the map
6993
7021
  * map.Paths.add(coordinate, { color: '#ff0000' });
6994
7022
  */
6995
- add(coordinate: Coordinate[], options?: TAddPathOptions): Promise<Path>;
7023
+ add(coordinate: Coordinate[], options?: TAddPathOptions): Path;
6996
7024
  /**
6997
7025
  * Removes a specific path ({@link Path}) from the map.
6998
7026
  * @param path The path to be removed.
@@ -7080,9 +7108,9 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/directions' {
7080
7108
  /**
7081
7109
  * @hidden
7082
7110
  */
7083
- constructor({ nodes, obstructions, connections, groupBy, }: {
7111
+ constructor({ nodes, geojsonCollection, connections, groupBy, }: {
7084
7112
  nodes: ParsedMVF['node.geojson'];
7085
- obstructions: ParsedMVF['obstruction'];
7113
+ geojsonCollection: ParsedMVF['obstruction'] | ParsedMVF['space'];
7086
7114
  connections: ParsedMVF['connection.json'];
7087
7115
  groupBy?: string;
7088
7116
  });
@@ -8013,8 +8041,8 @@ declare module '@mappedin/react-sdk/geojson/src/entities' {
8013
8041
  declare module '@mappedin/react-sdk/geojson/src/types/options' {
8014
8042
  import type { Position } from '@mappedin/react-sdk/geojson/src/types/geometry';
8015
8043
  import type { Map as MapLibreMap } from '@mappedin/react-sdk/packages/outdoor-context-v4';
8016
- import type { WatermarkOptions } from '@mappedin/react-sdk/geojson/src/systems/watermark/system';
8017
8044
  import type { AttributionControlOptions } from '@mappedin/react-sdk/geojson/src/systems/html-controls/system';
8045
+ import type { WatermarkOptions } from '@mappedin/react-sdk/geojson/src';
8018
8046
  export type RendererCoreOptions = Partial<{
8019
8047
  center?: Position;
8020
8048
  zoomLevel?: number;
@@ -8146,7 +8174,7 @@ declare module '@mappedin/react-sdk/geojson/src/systems/collisions/system' {
8146
8174
  import { PubSub } from '@mappedin/react-sdk/packages/common/pubsub';
8147
8175
  import type { RendererState } from '@mappedin/react-sdk/geojson/src/renderer';
8148
8176
  import type { TSerializedCollider, TSerializedColliderResponse } from '@mappedin/react-sdk/geojson/src/systems/collisions/collider-processor';
8149
- import { WatermarkPosition } from '@mappedin/react-sdk/geojson/src/systems/watermark/system';
8177
+ import type { WatermarkPosition } from '@mappedin/react-sdk/geojson/src/systems/watermark/system';
8150
8178
  export type TMessageEvent = MessageEvent<{
8151
8179
  msgId: string;
8152
8180
  colliders: TSerializedColliderResponse[];
@@ -8879,6 +8907,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/utils' {
8879
8907
  import type { TDoorsState, TMarkerState, TWallsState } from '@mappedin/react-sdk/mappedin-js/src/types';
8880
8908
  import type { Image } from '@mappedin/react-sdk/mappedin-js/src/map-view-objects';
8881
8909
  import type { GeoJsonApi } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/api';
8910
+ import type TWEEN from '@tweenjs/tween.js';
8882
8911
  export function convertCoordinateToPosition(coord: Coordinate): Position;
8883
8912
  export function convertPositionToCoordinate(coord: Position): Coordinate;
8884
8913
  export const cutEntrancesFromLineStrings: (lineStrings: ObstructionCollection["features"], entranceCollection: EntranceCollection["features"]) => {
@@ -8906,6 +8935,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/utils' {
8906
8935
  export function groupGeometryByStyle(features: Feature<LineString | Polygon | Point, SpaceProperties | ObstructionProperties>[], styleMap: AggregatedStyleMap): Map<WithId<PolygonStyle> | WithId<LineStringStyle> | WithId<PointStyle>, Feature<Point | LineString | Polygon, WithPolygonImage<SpaceProperties> | WithPolygonImage<ObstructionProperties>>[]>;
8907
8936
  export function translateToCoreStyle(style: PolygonStyle | LineStringStyle, userOptions?: TShow3DMapOptions): PaintStyle | LineStyle;
8908
8937
  export const getTargetID: <T extends Space | MapObject | Label | Marker | Model | Image | string>(target: T, api: GeoJsonApi) => string | undefined;
8938
+ export function tweenToPromise(tween: TWEEN.Tween): Promise<void>;
8909
8939
  }
8910
8940
 
8911
8941
  declare module '@mappedin/react-sdk/geojson/src/components/style' {
@@ -17596,6 +17626,7 @@ declare module '@mappedin/react-sdk/packages/geojson-navigator/src/navigator/nav
17596
17626
  import type { Position, Feature, MultiPolygon, Polygon } from 'geojson';
17597
17627
  import type { NodeCollection, NodeFeature } from '@mappedin/react-sdk/packages/geojson-navigator/src/types/node';
17598
17628
  import type { ObstructionCollection } from '@mappedin/react-sdk/packages/geojson-navigator/src/types/obstruction';
17629
+ import type { SpaceCollection } from '@mappedin/react-sdk/packages/geojson-navigator/src/types/space';
17599
17630
  import type { DirectionsCollection } from '@mappedin/react-sdk/packages/geojson-navigator/src/types/directions';
17600
17631
  import type { CoordinateFeature } from '@mappedin/react-sdk/packages/geojson-navigator/src/types/coordinate';
17601
17632
  /**
@@ -17633,17 +17664,19 @@ declare module '@mappedin/react-sdk/packages/geojson-navigator/src/navigator/nav
17633
17664
  *
17634
17665
  * @param {NodeCollection} nodes - Collection of nodes for the navigation graph.
17635
17666
  * @param {ObstructionCollection} [obstructions] - Optional collection of obstructions that could block paths.
17667
+ * @param {SpaceCollection} [spaces] - Optional collection of spaces that could block paths.
17636
17668
  * @param {string} [groupBy] - Optional property name to group nodes and paths for differentiated processing.
17637
17669
  */
17638
- constructor({ nodes, obstructions, groupBy, }: {
17670
+ constructor({ nodes, geojsonCollection, groupBy, }: {
17639
17671
  nodes: NodeCollection;
17640
- obstructions?: ObstructionCollection;
17672
+ geojsonCollection?: ObstructionCollection | SpaceCollection;
17641
17673
  groupBy?: string;
17642
17674
  });
17643
17675
  findNearestNode: (feature: CoordinateFeature) => NodeFeature | null;
17644
17676
  /**
17645
17677
  * Calculates and returns a set of directions from origin nodes to destination nodes, including detailed properties.
17646
17678
  *
17679
+ * @param {DirectionsZone[]} zones - special zones for navigation operations.
17647
17680
  * @param {string[]} originIds - IDs of origin nodes.
17648
17681
  * @param {string[]} destinationNodeIds - IDs of destination nodes.
17649
17682
  * @param {string[]} [excludedNodeIds] - IDs of nodes to exclude from pathfinding.
@@ -17724,32 +17757,15 @@ declare module '@mappedin/react-sdk/packages/geojson-navigator/src/types/node' {
17724
17757
  }
17725
17758
 
17726
17759
  declare module '@mappedin/react-sdk/packages/geojson-navigator/src/types/obstruction' {
17727
- import type { LineString, FeatureCollection, Polygon, Feature } from 'geojson';
17760
+ import type { LineString, Polygon, Feature } from 'geojson';
17761
+ import type { ObstructionProperties, ObstructionCollection } from '@mappedin/mvf';
17728
17762
  /**
17729
- * Properties specific to obstruction features in a geospatial context.
17730
- * Includes a mandatory unique identifier and allows for any additional custom properties.
17731
- */
17732
- export type ObstructionProperties = {
17733
- /**
17734
- * Unique identifier for the obstruction.
17735
- */
17736
- id: string;
17737
- /**
17738
- * Additional property specific to the navigator based on the 'groupBy' option.
17739
- * */
17740
- [name: string]: any;
17741
- };
17742
- /**
17743
- * A GeoJSON feature collection that groups multiple obstruction features, which can be line strings or polygons.
17744
- * This is typically used to represent physical barriers or areas where access is restricted.
17745
- */
17746
- export type ObstructionCollection = FeatureCollection<LineString | Polygon, ObstructionProperties>;
17747
- /**
17748
- * A GeoJSON feature representing an obstruction, which can be either a line string or a polygon.
17749
- * This type is crucial for mapping and managing areas that impede or restrict movement, such as barriers or restricted zones.
17750
- *
17751
- */
17763
+ * A GeoJSON feature representing an obstruction, which can be either a line string or a polygon.
17764
+ * This type is crucial for mapping and managing areas that impede or restrict movement, such as barriers or restricted zones.
17765
+ *
17766
+ */
17752
17767
  export type ObstructionFeature = Feature<LineString | Polygon, ObstructionProperties>;
17768
+ export { ObstructionCollection, ObstructionProperties };
17753
17769
  }
17754
17770
 
17755
17771
  declare module '@mappedin/react-sdk/packages/geojson-navigator/src/types/directions' {
@@ -21384,6 +21400,18 @@ declare module '@mappedin/react-sdk/packages/outdoor-context-v4/ui/handler/tap_z
21384
21400
  }
21385
21401
  }
21386
21402
 
21403
+ declare module '@mappedin/react-sdk/packages/geojson-navigator/src/types/space' {
21404
+ import type { LineString, Polygon, Point, Feature } from 'geojson';
21405
+ import type { SpaceProperties, SpaceCollection } from '@mappedin/mvf';
21406
+ /**
21407
+ * A GeoJSON feature representing a space, which can be either a line string or a polygon.
21408
+ * This type is crucial for mapping and managing areas that impede or restrict movement, such as barriers or restricted zones.
21409
+ *
21410
+ */
21411
+ export type SpaceFeature = Feature<LineString | Polygon | Point, SpaceProperties>;
21412
+ export { SpaceCollection, SpaceProperties };
21413
+ }
21414
+
21387
21415
  declare module '@mappedin/react-sdk/geojson/src/systems/camera/helpers/input-set' {
21388
21416
  import type { Vector2 } from 'three';
21389
21417
  class InputSet {
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a as w,h as E,i as V,j as b}from"./chunk-TOAXR4PM.js";import"./chunk-CBWWQFNR.js";import"./chunk-X4O3T5J7.js";import"./chunk-A6QTJRY4.js";import"./chunk-TKFKQMTK.js";import{a as o,j as a}from"./chunk-GLHDHW4V.js";a();a();import{useContext as j,useEffect as W,useRef as H,useState as K}from"react";import{createPortal as _}from"react-dom";a();import{createContext as C,useContext as O}from"react";a();var N=class N extends Error{constructor(t){super("".concat(t," must be used within a MapView component."))}};o(N,"MapViewNullError");var m=N;var p=C({mapData:void 0,mapView:void 0});function R(){let{mapData:e,mapView:t}=O(p);if(!e||!t)throw new m("useMap");return{mapData:e,mapView:t}}o(R,"useMap");a();import{useEffect as k}from"react";function u(e,t){k(()=>{t!=null&&typeof e=="function"&&e(t)},[e,t])}o(u,"useOnLoad");var Re=o(e=>{let{mapView:t}=j(p),r=H(),[n,i]=K(null);return W(()=>{if(t==null)throw new m("Marker");return r.current=t.Markers.add(e.target,"",{...e.options,dynamicResize:!0}),i(r.current),()=>{t==null||r.current==null||t.Markers.remove(r.current)}},[t,e.target,e.options]),u(e.onLoad,n),t==null||n==null?null:_(e.children,n.contentEl,n.id)},"Marker");a();import{useContext as z,useEffect as I,useRef as U,useState as F}from"react";function Ie(e){let{mapView:t}=z(p),r=U(),[n,i]=F(void 0);return I(()=>{if(t==null)throw new m("Label");return r.current=t.Labels.add(e.target,e.text,e.options),i(r.current),()=>{t==null||r.current==null||t.Labels.remove(r.current)}},[t,e.target,e.text,e.options]),u(e.onLoad,n),null}o(Ie,"Label");a();import{useCallback as G,useContext as Y,useEffect as $}from"react";function Be(e,t){let{mapView:r}=Y(p),n=G(i=>t(i),[t]);$(()=>{if(r==null)throw new m("useEvent");return r.on(e,n),()=>{r!=null&&r.off(e,n)}},[r,e,t])}o(Be,"useEvent");a();import{useContext as q,useEffect as B,useRef as J,useState as Q}from"react";function at(e){let{mapView:t}=q(p),r=J(),[n,i]=Q(void 0);return B(()=>{if(t==null)throw new m("Path");let d=!1,f=t.Paths.add(e.coordinate,e.options);return f.then(s=>{d?t.Paths.remove(s):(r.current=s,i(s))}),()=>{d=!0,r.current?t.Paths.remove(r.current):f.then(s=>{t.Paths.remove(s)})}},[t,e.coordinate,e.options]),u(e.onLoad,n),null}o(at,"Path");a();import x,{useCallback as X,useEffect as Z,useMemo as ee,useRef as v,useState as A}from"react";var te={width:"100%",height:"100%",position:"relative"};function lt(e){let{mapData:t,options:r,style:n,fallback:i,children:d,...f}=e,s=v(!1),[c,h]=A(void 0),[y,M]=A(!0),P=v(null),L=ee(()=>r,[]),g=X(()=>{if(t&&(P!=null&&P.current)){if(c)return;V(P.current,t,L).then(S=>{h(S)}).catch(S=>{w.error("Failed to render MapView",S)}).finally(()=>{M(!1)})}},[t,P.current,L]);return Z(()=>{s.current||(s.current=!0,g())},[g]),u(e.onLoad,c),x.createElement(p.Provider,{value:{mapData:t,mapView:c}},x.createElement("div",{"data-testid":"mappedin-map",ref:P,style:{...te,...n},...f}),y?x.createElement(x.Fragment,null,i):d)}o(lt,"MapView");a();import{useContext as re,useEffect as D,useRef as ae,useState as oe}from"react";function wt(e){let{mapView:t}=re(p),[r,n]=oe(!1),i=ae(Promise.resolve());return D(()=>{if(t==null)throw new m("Navigation");let d=!1,f=o(()=>d?Promise.resolve():t.Navigation.draw(e.directions,e.options).then(()=>{d||n(!0)}),"navigationOperation");return i.current=i.current.then(f),()=>{d=!0,i.current=i.current.then(()=>{t.Navigation.clear()})}},[t,e.directions,e.options]),D(()=>{r!==!1&&typeof e.onLoad=="function"&&e.onLoad()},[e.onLoad,r]),null}o(wt,"Navigation");a();import{useContext as ne,useEffect as ie,useRef as pe,useState as me}from"react";function Et(e){let{mapView:t}=ne(p),r=pe(),[n,i]=me(void 0);return ie(()=>{if(t==null)throw new Error("MapView not initialized");return r.current=t.Shapes.add(e.geometry,e.style,e.floor),i(r.current),()=>{t==null||r.current==null||t.Shapes.remove(r.current)}},[t,e.geometry,e.style,e.floor]),u(e.onLoad,n),null}o(Et,"Shape");a();import{useContext as se,useEffect as ue,useRef as de,useState as le}from"react";function Rt(e){let{mapView:t}=se(p),r=de(),[n,i]=le(void 0);return ue(()=>{if(t==null)throw new m("Model");return r.current=t.Models.add(e.models,e.options),i(r.current),()=>{if(!(t==null||r.current==null))for(let d of r.current)t.Models.remove(d)}},[t,e.models,e.options]),u(e.onLoad,n),null}o(Rt,"Model");a();import{useCallback as fe,useEffect as ce,useMemo as Me,useRef as Pe,useState as T}from"react";function zt(e){let[t,r]=T(void 0),[n,i]=T(!0),[d,f]=T(void 0),s=Pe(0),c=Me(()=>e,[]),h=fe(()=>{let y=++s.current;i(!0),f(void 0),E(c).then(M=>{s.current===y&&r(M)}).catch(M=>{s.current===y&&(w.error("Failed to fetch MapData",M),f(M))}).finally(()=>{s.current===y&&i(!1)})},[c]);return ce(()=>{h()},[h]),{mapData:t,isLoading:n,error:d}}o(zt,"useMapData");var Gt=b;export{Ie as Label,lt as MapView,Re as Marker,Rt as Model,wt as Navigation,at as Path,Et as Shape,Gt as default,Be as useEvent,R as useMap,zt as useMapData};
1
+ import{a as w,h as E,i as V,j as b}from"./chunk-DMHXIEU4.js";import"./chunk-NLGPMWPZ.js";import"./chunk-G7WXEQJ3.js";import"./chunk-QKN6JD4F.js";import"./chunk-SQXYZZBW.js";import{a as o,j as a}from"./chunk-GZ7LZ5UP.js";a();a();import{useContext as j,useEffect as W,useRef as H,useState as K}from"react";import{createPortal as _}from"react-dom";a();import{createContext as O,useContext as C}from"react";a();var N=class N extends Error{constructor(t){super("".concat(t," must be used within a MapView component."))}};o(N,"MapViewNullError");var m=N;var p=O({mapData:void 0,mapView:void 0});function R(){let{mapData:e,mapView:t}=C(p);if(!e||!t)throw new m("useMap");return{mapData:e,mapView:t}}o(R,"useMap");a();import{useEffect as k}from"react";function s(e,t){k(()=>{t!=null&&typeof e=="function"&&e(t)},[e,t])}o(s,"useOnLoad");var Ce=o(e=>{let{mapView:t}=j(p),r=H(),[n,i]=K(null);return W(()=>{if(t==null)throw new m("Marker");return r.current=t.Markers.add(e.target,"",{...e.options,dynamicResize:!0}),i(r.current),()=>{t==null||r.current==null||t.Markers.remove(r.current)}},[t,e.target,e.options]),s(e.onLoad,n),t==null||n==null?null:_(e.children,n.contentEl,n.id)},"Marker");a();import{useContext as z,useEffect as I,useRef as U,useState as F}from"react";function ze(e){let{mapView:t}=z(p),r=U(),[n,i]=F(void 0);return I(()=>{if(t==null)throw new m("Label");return r.current=t.Labels.add(e.target,e.text,e.options),i(r.current),()=>{t==null||r.current==null||t.Labels.remove(r.current)}},[t,e.target,e.text,e.options]),s(e.onLoad,n),null}o(ze,"Label");a();import{useCallback as G,useContext as Y,useEffect as $}from"react";function qe(e,t){let{mapView:r}=Y(p),n=G(i=>t(i),[t]);$(()=>{if(r==null)throw new m("useEvent");return r.on(e,n),()=>{r!=null&&r.off(e,n)}},[r,e,t])}o(qe,"useEvent");a();import{useContext as q,useEffect as B,useRef as J,useState as Q}from"react";function rt(e){let{mapView:t}=q(p),r=J(),[n,i]=Q(void 0);return B(()=>{if(t==null)throw new m("Path");return r.current=t.Paths.add(e.coordinate,e.options),i(r.current),()=>{r.current&&t.Paths.remove(r.current)}},[t,e.coordinate,e.options]),s(e.onLoad,n),null}o(rt,"Path");a();import x,{useCallback as X,useEffect as Z,useMemo as ee,useRef as A,useState as v}from"react";var te={width:"100%",height:"100%",position:"relative"};function ut(e){let{mapData:t,options:r,style:n,fallback:i,children:M,...y}=e,u=A(!1),[l,h]=v(void 0),[P,f]=v(!0),c=A(null),L=ee(()=>r,[]),g=X(()=>{if(t&&(c!=null&&c.current)){if(l)return;V(c.current,t,L).then(S=>{h(S)}).catch(S=>{w.error("Failed to render MapView",S)}).finally(()=>{f(!1)})}},[t,c.current,L]);return Z(()=>{u.current||(u.current=!0,g())},[g]),s(e.onLoad,l),x.createElement(p.Provider,{value:{mapData:t,mapView:l}},x.createElement("div",{"data-testid":"mappedin-map",ref:c,style:{...te,...n},...y}),P?x.createElement(x.Fragment,null,i):M)}o(ut,"MapView");a();import{useContext as re,useEffect as D,useState as ae}from"react";function ht(e){let{mapView:t}=re(p),[r,n]=ae(!1);return D(()=>{if(t==null)throw new m("Navigation");return t.Navigation.draw(e.directions,e.options).then(()=>{n(!0)}),()=>{t.Navigation.clear()}},[t,e.directions,e.options]),D(()=>{r!==!1&&typeof e.onLoad=="function"&&e.onLoad()},[e.onLoad,r]),null}o(ht,"Navigation");a();import{useContext as oe,useEffect as ne,useRef as pe,useState as ie}from"react";function gt(e){let{mapView:t}=oe(p),r=pe(),[n,i]=ie(void 0);return ne(()=>{if(t==null)throw new Error("MapView not initialized");return r.current=t.Shapes.add(e.geometry,e.style,e.floor),i(r.current),()=>{t==null||r.current==null||t.Shapes.remove(r.current)}},[t,e.geometry,e.style,e.floor]),s(e.onLoad,n),null}o(gt,"Shape");a();import{useContext as me,useEffect as se,useRef as de,useState as ue}from"react";function Ct(e){let{mapView:t}=me(p),r=de(),[n,i]=ue(void 0);return se(()=>{if(t==null)throw new m("Model");return r.current=t.Models.add(e.models,e.options),i(r.current),()=>{if(!(t==null||r.current==null))for(let M of r.current)t.Models.remove(M)}},[t,e.models,e.options]),s(e.onLoad,n),null}o(Ct,"Model");a();import{useCallback as le,useEffect as fe,useMemo as ce,useRef as Me,useState as T}from"react";function _t(e){let[t,r]=T(void 0),[n,i]=T(!0),[M,y]=T(void 0),u=Me(0),l=ce(()=>e,[]),h=le(()=>{let P=++u.current;i(!0),y(void 0),E(l).then(f=>{u.current===P&&r(f)}).catch(f=>{u.current===P&&(w.error("Failed to fetch MapData",f),y(f))}).finally(()=>{u.current===P&&i(!1)})},[l]);return fe(()=>{h()},[h]),{mapData:t,isLoading:n,error:M}}o(_t,"useMapData");var Ft=b;export{ze as Label,ut as MapView,Ce as Marker,Ct as Model,ht as Navigation,rt as Path,gt as Shape,Ft as default,qe as useEvent,R as useMap,_t as useMapData};