@mappedin/react-sdk 6.0.1-beta.17 → 6.0.1-beta.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.
@@ -1 +1 @@
1
- import{M as B,N as y,q as w,r as x,s as b}from"./chunk-5T2PAGNC.js";import{a as g,j as A}from"./chunk-OANQFXHV.js";A();function R(o,l=!1){let r=o[0].index!==null,f=new Set(Object.keys(o[0].attributes)),i=new Set(Object.keys(o[0].morphAttributes)),c={},e={},h=o[0].morphTargetsRelative,u=new y,d=0;for(let t=0;t<o.length;++t){let s=o[t],a=0;if(r!==(s.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let n in s.attributes){if(!f.has(n))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+'. All geometries must have compatible attributes; make sure "'+n+'" attribute exists among all geometries, or in none of them.'),null;c[n]===void 0&&(c[n]=[]),c[n].push(s.attributes[n]),a++}if(a!==f.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". Make sure all geometries have the same number of attributes."),null;if(h!==s.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let n in s.morphAttributes){if(!i.has(n))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphAttributes must be consistent throughout all geometries."),null;e[n]===void 0&&(e[n]=[]),e[n].push(s.morphAttributes[n])}if(l){let n;if(r)n=s.index.count;else if(s.attributes.position!==void 0)n=s.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". The geometry must have either an index or a position attribute"),null;u.addGroup(d,n,t),d+=n}}if(r){let t=0,s=[];for(let a=0;a<o.length;++a){let n=o[a].index;for(let m=0;m<n.count;++m)s.push(n.getX(m)+t);t+=o[a].attributes.position.count}u.setIndex(s)}for(let t in c){let s=T(c[t]);if(!s)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;u.setAttribute(t,s)}for(let t in e){let s=e[t][0].length;if(s===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[t]=[];for(let a=0;a<s;++a){let n=[];for(let p=0;p<e[t].length;++p)n.push(e[t][p][a]);let m=T(n);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" morphAttribute."),null;u.morphAttributes[t].push(m)}}return u}g(R,"mergeGeometries");function T(o){let l,r,f,i=-1,c=0;for(let d=0;d<o.length;++d){let t=o[d];if(l===void 0&&(l=t.array.constructor),l!==t.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(r===void 0&&(r=t.itemSize),r!==t.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(f===void 0&&(f=t.normalized),f!==t.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=t.gpuType),i!==t.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;c+=t.count*r}let e=new l(c),h=new B(e,r,f),u=0;for(let d=0;d<o.length;++d){let t=o[d];if(t.isInterleavedBufferAttribute){let s=u/r;for(let a=0,n=t.count;a<n;a++)for(let m=0;m<r;m++){let p=t.getComponent(a,m);h.setComponent(a+s,m,p)}}else e.set(t.array,u);u+=t.count*r}return i!==void 0&&(h.gpuType=i),h}g(T,"mergeAttributes");function X(o,l){if(l===w)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(l===b||l===x){let r=o.getIndex();if(r===null){let e=[],h=o.getAttribute("position");if(h!==void 0){for(let u=0;u<h.count;u++)e.push(u);o.setIndex(e),r=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}let f=r.count-2,i=[];if(l===b)for(let e=1;e<=f;e++)i.push(r.getX(0)),i.push(r.getX(e)),i.push(r.getX(e+1));else for(let e=0;e<f;e++)e%2===0?(i.push(r.getX(e)),i.push(r.getX(e+1)),i.push(r.getX(e+2))):(i.push(r.getX(e+2)),i.push(r.getX(e+1)),i.push(r.getX(e)));i.length/3!==f&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let c=o.clone();return c.setIndex(i),c.clearGroups(),c}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",l),o}g(X,"toTrianglesDrawMode");export{R as a,X as b};
1
+ import{M as B,N as y,q as w,r as x,s as b}from"./chunk-VT2X5G75.js";import{a as g,j as A}from"./chunk-OQLRRFPP.js";A();function R(o,l=!1){let r=o[0].index!==null,f=new Set(Object.keys(o[0].attributes)),i=new Set(Object.keys(o[0].morphAttributes)),c={},e={},h=o[0].morphTargetsRelative,u=new y,d=0;for(let t=0;t<o.length;++t){let s=o[t],a=0;if(r!==(s.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let n in s.attributes){if(!f.has(n))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+'. All geometries must have compatible attributes; make sure "'+n+'" attribute exists among all geometries, or in none of them.'),null;c[n]===void 0&&(c[n]=[]),c[n].push(s.attributes[n]),a++}if(a!==f.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". Make sure all geometries have the same number of attributes."),null;if(h!==s.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let n in s.morphAttributes){if(!i.has(n))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphAttributes must be consistent throughout all geometries."),null;e[n]===void 0&&(e[n]=[]),e[n].push(s.morphAttributes[n])}if(l){let n;if(r)n=s.index.count;else if(s.attributes.position!==void 0)n=s.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". The geometry must have either an index or a position attribute"),null;u.addGroup(d,n,t),d+=n}}if(r){let t=0,s=[];for(let a=0;a<o.length;++a){let n=o[a].index;for(let m=0;m<n.count;++m)s.push(n.getX(m)+t);t+=o[a].attributes.position.count}u.setIndex(s)}for(let t in c){let s=T(c[t]);if(!s)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;u.setAttribute(t,s)}for(let t in e){let s=e[t][0].length;if(s===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[t]=[];for(let a=0;a<s;++a){let n=[];for(let p=0;p<e[t].length;++p)n.push(e[t][p][a]);let m=T(n);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" morphAttribute."),null;u.morphAttributes[t].push(m)}}return u}g(R,"mergeGeometries");function T(o){let l,r,f,i=-1,c=0;for(let d=0;d<o.length;++d){let t=o[d];if(l===void 0&&(l=t.array.constructor),l!==t.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(r===void 0&&(r=t.itemSize),r!==t.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(f===void 0&&(f=t.normalized),f!==t.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=t.gpuType),i!==t.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;c+=t.count*r}let e=new l(c),h=new B(e,r,f),u=0;for(let d=0;d<o.length;++d){let t=o[d];if(t.isInterleavedBufferAttribute){let s=u/r;for(let a=0,n=t.count;a<n;a++)for(let m=0;m<r;m++){let p=t.getComponent(a,m);h.setComponent(a+s,m,p)}}else e.set(t.array,u);u+=t.count*r}return i!==void 0&&(h.gpuType=i),h}g(T,"mergeAttributes");function X(o,l){if(l===w)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(l===b||l===x){let r=o.getIndex();if(r===null){let e=[],h=o.getAttribute("position");if(h!==void 0){for(let u=0;u<h.count;u++)e.push(u);o.setIndex(e),r=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}let f=r.count-2,i=[];if(l===b)for(let e=1;e<=f;e++)i.push(r.getX(0)),i.push(r.getX(e)),i.push(r.getX(e+1));else for(let e=0;e<f;e++)e%2===0?(i.push(r.getX(e)),i.push(r.getX(e+1)),i.push(r.getX(e+2))):(i.push(r.getX(e+2)),i.push(r.getX(e+1)),i.push(r.getX(e)));i.length/3!==f&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let c=o.clone();return c.setIndex(i),c.clearGroups(),c}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",l),o}g(X,"toTrianglesDrawMode");export{R as a,X as b};
@@ -1,12 +1,12 @@
1
1
  // Generated by dts-bundle v0.7.3
2
2
  // Dependencies for this module:
3
+ // ../react/react
3
4
  // ../react/@packages/internal/mvf-utils
4
5
  // ../react/@mappedin/mvf
5
6
  // ../react/@packages/internal/common/pubsub
6
7
  // ../react/@packages/internal/mvf-utils/mvf-utils
7
8
  // ../react/@packages/internal/common/Mappedin.Logger
8
9
  // ../react/geojson
9
- // ../react/react
10
10
  // ../react/@mappedin/mappedin-js
11
11
  // ../react/@packages/internal/common
12
12
  // ../react/@mappedin/core-sdk
@@ -15,6 +15,7 @@
15
15
  // ../react/three
16
16
  // ../react/zod
17
17
  // ../react/@packages/internal/shave-text/shave-text
18
+ // ../react/@tweenjs/tween.js
18
19
  // ../react/@turf/turf
19
20
  // ../react/@packages/internal/quad-tree
20
21
  // ../react/@packages/internal/outdoor-context-v4
@@ -22,7 +23,6 @@
22
23
  // ../react/three/addons/loaders/GLTFLoader.js
23
24
  // ../react/@mapbox/point-geometry
24
25
  // ../react/@maplibre/maplibre-gl-style-spec
25
- // ../react/@tweenjs/tween.js
26
26
  // ../react/gl-matrix
27
27
  // ../react/@mapbox/vector-tile
28
28
  // ../react/potpack
@@ -33,18 +33,25 @@
33
33
 
34
34
  declare module '@mappedin/react-sdk' {
35
35
  import * as Mappedin from '@mappedin/react-sdk/mappedin-js/src';
36
- export * from '@mappedin/react-sdk/react-sdk/src/Marker';
37
- export * from '@mappedin/react-sdk/react-sdk/src/Label';
38
- export * from '@mappedin/react-sdk/react-sdk/src/useEvent';
39
- export * from '@mappedin/react-sdk/react-sdk/src/Path';
40
- export * from '@mappedin/react-sdk/react-sdk/src/MapView';
41
- export * from '@mappedin/react-sdk/react-sdk/src/Navigation';
42
- export * from '@mappedin/react-sdk/react-sdk/src/Shape';
43
- export * from '@mappedin/react-sdk/react-sdk/src/Model';
44
- export * from '@mappedin/react-sdk/react-sdk/src/useMapData';
45
- export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
46
- export type { UseMapProps } from '@mappedin/react-sdk/react-sdk/src/useMap';
47
36
  export default Mappedin;
37
+ export { Marker, AnimatedMarker } from '@mappedin/react-sdk/react-sdk/src/Marker';
38
+ export type { MarkerProps } from '@mappedin/react-sdk/react-sdk/src/Marker';
39
+ export { Label } from '@mappedin/react-sdk/react-sdk/src/Label';
40
+ export type { LabelProps } from '@mappedin/react-sdk/react-sdk/src/Label';
41
+ export { useEvent } from '@mappedin/react-sdk/react-sdk/src/useEvent';
42
+ export { Path } from '@mappedin/react-sdk/react-sdk/src/Path';
43
+ export type { PathProps } from '@mappedin/react-sdk/react-sdk/src/Path';
44
+ export { MapView } from '@mappedin/react-sdk/react-sdk/src/MapView';
45
+ export type { MapViewProps } from '@mappedin/react-sdk/react-sdk/src/MapView';
46
+ export { Navigation } from '@mappedin/react-sdk/react-sdk/src/Navigation';
47
+ export type { NavigationProps } from '@mappedin/react-sdk/react-sdk/src/Navigation';
48
+ export { Shape } from '@mappedin/react-sdk/react-sdk/src/Shape';
49
+ export type { ShapeProps } from '@mappedin/react-sdk/react-sdk/src/Shape';
50
+ export { Model } from '@mappedin/react-sdk/react-sdk/src/Model';
51
+ export type { ModelProps } from '@mappedin/react-sdk/react-sdk/src/Model';
52
+ export { useMapData } from '@mappedin/react-sdk/react-sdk/src/useMapData';
53
+ export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
54
+ export type { DetailedHTMLProps, HTMLAttributes, ClassAttributes } from 'react';
48
55
  }
49
56
 
50
57
  declare module '@mappedin/react-sdk/mappedin-js/src' {
@@ -403,11 +410,11 @@ declare module '@mappedin/react-sdk/react-sdk/src/Marker' {
403
410
  children?: ReactNode | ReactElement;
404
411
  onLoad?: (marker: Mappedin.Marker) => void;
405
412
  }, 'contentHtml'>;
406
- export type AnimatedMarkerProps = {
407
- duration?: number;
408
- };
409
413
  /**
410
- * Marker component
414
+ * Marker component.
415
+ *
416
+ * A Marker is a 2D component anchored to a position on the map.
417
+ * To animate the Marker when its target changes, see {@link AnimatedMarker}.
411
418
  *
412
419
  * @example
413
420
  * ```tsx
@@ -418,10 +425,14 @@ declare module '@mappedin/react-sdk/react-sdk/src/Marker' {
418
425
  *
419
426
  * @category Components
420
427
  */
421
- export const Marker: (props: MarkerProps) => ReactElement | null;
428
+ export function Marker(props: MarkerProps): React.ReactPortal | null;
422
429
  /**
423
- * AnimatedMarker component - animates a marker as the target changes
430
+ * AnimatedMarker component.
431
+ * @experimental
432
+ *
433
+ * A {@link Marker} component that animates between positions when its target changes.
424
434
  *
435
+ * @example
425
436
  * ```tsx
426
437
  * <AnimatedMarker target={mapData.getByType('space')[0]} duration={1000}>
427
438
  * <div>Hello, world!</div>
@@ -430,7 +441,7 @@ declare module '@mappedin/react-sdk/react-sdk/src/Marker' {
430
441
  *
431
442
  * @category Components
432
443
  */
433
- export const AnimatedMarker: (props: MarkerProps & TAnimationOptions) => React.JSX.Element;
444
+ export function AnimatedMarker(props: MarkerProps & TAnimationOptions): React.JSX.Element;
434
445
  export {};
435
446
  }
436
447
 
@@ -446,23 +457,43 @@ declare module '@mappedin/react-sdk/react-sdk/src/Label' {
446
457
  onLoad?: (label: Mappedin.Label) => void;
447
458
  };
448
459
  /**
449
- * Label component
460
+ * Label component.
461
+ *
462
+ * A Label is a 2D text label anchored to a position on the map.
450
463
  *
451
464
  * @category Components
465
+ *
466
+ * @example
467
+ * ```tsx
468
+ * <Label target={mapData.getByType('space')[0]} text={"Hello, world!"} />
469
+ * ```
452
470
  */
453
471
  export function Label(props: LabelProps): null;
454
472
  export {};
455
473
  }
456
474
 
457
475
  declare module '@mappedin/react-sdk/react-sdk/src/useEvent' {
458
- import type Mappedin from '@mappedin/react-sdk/react-sdk/src';
476
+ import type { TEvents } from '@mappedin/mappedin-js';
459
477
  /**
460
- * @interface
478
+ * Hook to subscribe to an event on the {@link default.MapView | MapView}.
479
+ *
480
+ * @param event - The event to listen for.
481
+ * @param callback - The callback to call when the event is triggered.
482
+ *
483
+ * @category Hooks
484
+ *
485
+ * @example
486
+ * ```tsx
487
+ * useEvent('click', event => {
488
+ * const { coordinate } = event;
489
+ * const { latitude, longitude } = coordinate;
490
+ * console.log(`Map was clicked at ${latitude}, ${longitude}`);
491
+ * });
492
+ * ```
461
493
  */
462
- export type SDK_EVENTS = Omit<Mappedin.TEvents, 'outdoor-view-loaded'>;
463
- export function useEvent<T extends keyof SDK_EVENTS>(event: T, callback: (payload: SDK_EVENTS[T] extends {
494
+ export function useEvent<T extends keyof TEvents>(event: T, callback: (payload: TEvents[T] extends {
464
495
  data: null;
465
- } ? SDK_EVENTS[T]['data'] : SDK_EVENTS[T]) => void): void;
496
+ } ? TEvents[T]['data'] : TEvents[T]) => void): void;
466
497
  }
467
498
 
468
499
  declare module '@mappedin/react-sdk/react-sdk/src/Path' {
@@ -478,9 +509,20 @@ declare module '@mappedin/react-sdk/react-sdk/src/Path' {
478
509
  onDrawComplete?: () => void;
479
510
  };
480
511
  /**
481
- * Path component
512
+ * Path component.
513
+ *
514
+ * A Path indicates a route on the map.
482
515
  *
483
516
  * @category Components
517
+ *
518
+ * @example
519
+ * ```tsx
520
+ * const space1 = mapData.getByType('space')[0];
521
+ * const space2 = mapData.getByType('space')[1];
522
+ * const directions = mapView.getDirections(space1, space2);
523
+ *
524
+ * return directions ? <Path coordinate={directions.coordinates} options={{ color: 'blue' }} /> : null;
525
+ * ```
484
526
  */
485
527
  export function Path(props: PathProps): null;
486
528
  export {};
@@ -499,18 +541,27 @@ declare module '@mappedin/react-sdk/react-sdk/src/MapView' {
499
541
  */
500
542
  export type MapViewProps = Omit<TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {
501
543
  children?: ReactNode;
544
+ /**
545
+ * The fallback content to render while the map is loading.
546
+ */
502
547
  fallback?: ReactNode;
503
548
  onLoad?: (mapView: Mappedin.MapView) => void;
504
549
  }, 'el'>;
505
550
  /**
506
- * MapView component
551
+ * MapView component.
552
+ *
553
+ * The root component which renders the map and provides context to the hooks and child components.
507
554
  *
508
555
  * @category Components
509
556
  *
510
557
  * @example
511
- * ```tsx *
558
+ * ```tsx
512
559
  * const { mapData } = useMapData({ key: '...', secret: '...', mapId: '...' });
513
- * return <MapView mapData={mapData} />
560
+ * return (
561
+ * <MapView mapData={mapData}>
562
+ * <Marker target={...} />
563
+ * </MapView>
564
+ * )
514
565
  * ```
515
566
  */
516
567
  export function MapView(props: MapViewProps & DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>): React.JSX.Element;
@@ -530,9 +581,20 @@ declare module '@mappedin/react-sdk/react-sdk/src/Navigation' {
530
581
  onDrawComplete?: () => void;
531
582
  };
532
583
  /**
533
- * Navigation component
584
+ * Navigation component.
585
+ *
586
+ * Navigation draws a route on the map with pre-defined Markers for connections and the start and end points.
534
587
  *
535
588
  * @category Components
589
+ *
590
+ * @example
591
+ * ```tsx
592
+ * const space1 = mapData.getByType('space')[0];
593
+ * const space2 = mapData.getByType('space')[1];
594
+ * const directions = mapView.getDirections(space1, space2);
595
+ *
596
+ * return directions ? <Navigation directions={directions} /> : null;
597
+ * ```
536
598
  */
537
599
  export function Navigation(props: NavigationProps): null;
538
600
  export {};
@@ -546,15 +608,22 @@ declare module '@mappedin/react-sdk/react-sdk/src/Shape' {
546
608
  /**
547
609
  * @interface
548
610
  */
549
- export type ShapesProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {
611
+ export type ShapeProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {
550
612
  onLoad?: (shape: Mappedin.Shape) => void;
551
613
  };
552
614
  /**
553
- * Shape component
615
+ * Shape component.
616
+ *
617
+ * A Shape is a custom geometry on the map created from a GeoJSON feature collection.
554
618
  *
555
619
  * @category Components
620
+ *
621
+ * @example
622
+ * ```tsx
623
+ * <Shape geometry={geojson} style={{ color: 'blue', height: 2 }} />
624
+ * ```
556
625
  */
557
- export function Shape(props: ShapesProps): null;
626
+ export function Shape(props: ShapeProps): null;
558
627
  export {};
559
628
  }
560
629
 
@@ -570,9 +639,26 @@ declare module '@mappedin/react-sdk/react-sdk/src/Model' {
570
639
  onLoad?: (models: Mappedin.Model[]) => void;
571
640
  };
572
641
  /**
573
- * Model component
642
+ * Model component.
643
+ *
644
+ * A Model is a 3D model in GLTF or GLB format anchored to a position on the map.
574
645
  *
575
646
  * @category Components
647
+ *
648
+ * @example
649
+ * ```tsx
650
+ * <Model
651
+ * models={mapData.getByType('space').map(space => ({
652
+ * target: space,
653
+ * scale: [0.01, 0.01, 0.01],
654
+ * rotation: [90, 0, 0],
655
+ * opacity: 0.5,
656
+ * }))}
657
+ * options={{
658
+ * url: '...',
659
+ * }}
660
+ * />
661
+ * ```
576
662
  */
577
663
  export function Model(props: ModelProps): null;
578
664
  export {};
@@ -580,6 +666,16 @@ declare module '@mappedin/react-sdk/react-sdk/src/Model' {
580
666
 
581
667
  declare module '@mappedin/react-sdk/react-sdk/src/useMapData' {
582
668
  import type Mappedin from '@mappedin/react-sdk/react-sdk/src';
669
+ /**
670
+ * Hook to perform the fetch of the {@link default.MapData | MapData} and handle loading and error states.
671
+ *
672
+ * @category Hooks
673
+ *
674
+ * @example
675
+ * ```tsx
676
+ * const { mapData, isLoading, error } = useMapData(options);
677
+ * ```
678
+ */
583
679
  export function useMapData(options: Mappedin.TGetMapDataOptions): {
584
680
  mapData?: Mappedin.MapData;
585
681
  isLoading: boolean;
@@ -593,11 +689,20 @@ declare module '@mappedin/react-sdk/react-sdk/src/useMap' {
593
689
  mapData?: Mappedin.MapData;
594
690
  mapView?: Mappedin.MapView;
595
691
  }>;
596
- export type UseMapProps = {
692
+ /**
693
+ * Hook to get the {@link default.MapData | MapData} and {@link default.MapView | MapView}.
694
+ *
695
+ * @category Hooks
696
+ *
697
+ * @example
698
+ * ```tsx
699
+ * const { mapData, mapView } = useMap();
700
+ * ```
701
+ */
702
+ export function useMap(): {
597
703
  mapData: Mappedin.MapData;
598
704
  mapView: Mappedin.MapView;
599
705
  };
600
- export function useMap(): UseMapProps;
601
706
  }
602
707
 
603
708
  declare module '@mappedin/react-sdk/mappedin-js/src/map-data' {
@@ -2674,7 +2779,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/blue-dot/blue-do
2674
2779
  */
2675
2780
  elevation?: number;
2676
2781
  /**
2677
- * @default POSITION_ANIMATION_DURATION
2782
+ * @default 1000
2678
2783
  */
2679
2784
  duration?: number;
2680
2785
  /**
@@ -2811,8 +2916,9 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-view-objects' {
2811
2916
 
2812
2917
  declare module '@mappedin/react-sdk/mappedin-js/src/navigation' {
2813
2918
  import { type TDirectionInstruction } from '@mappedin/react-sdk/mappedin-js/src';
2814
- import type { Directions } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
2919
+ import type { Directions, GeoJsonApi } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
2815
2920
  import type { GeojsonApiMapObject } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/map-object';
2921
+ import type { FloorStack } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
2816
2922
  import { Path, Marker } from '@mappedin/react-sdk/mappedin-js/src/map-view-objects';
2817
2923
  import type { RendererCore } from '@mappedin/core-sdk';
2818
2924
  /**
@@ -2965,7 +3071,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation' {
2965
3071
  /**
2966
3072
  * @internal
2967
3073
  */
2968
- constructor(core: RendererCore, currentMapGetter: CurrentMapGetter);
3074
+ constructor(core: RendererCore, geoJSONApi: GeoJsonApi, currentMapGetter: CurrentMapGetter);
2969
3075
  /**
2970
3076
  * @internal
2971
3077
  */
@@ -2992,6 +3098,10 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation' {
2992
3098
  * The currently active path.
2993
3099
  */
2994
3100
  get activePath(): Path | undefined;
3101
+ /**
3102
+ * The current list of floor stacks along the navigation paths.
3103
+ */
3104
+ get floorStacks(): FloorStack[];
2995
3105
  /**
2996
3106
  * Sets the active path by index.
2997
3107
  */
@@ -3059,18 +3169,25 @@ declare module '@mappedin/react-sdk/react-sdk/src/type-utils' {
3059
3169
 
3060
3170
  declare module '@mappedin/react-sdk/react-sdk/src' {
3061
3171
  import * as Mappedin from '@mappedin/react-sdk/mappedin-js/src';
3062
- export * from '@mappedin/react-sdk/react-sdk/src/Marker';
3063
- export * from '@mappedin/react-sdk/react-sdk/src/Label';
3064
- export * from '@mappedin/react-sdk/react-sdk/src/useEvent';
3065
- export * from '@mappedin/react-sdk/react-sdk/src/Path';
3066
- export * from '@mappedin/react-sdk/react-sdk/src/MapView';
3067
- export * from '@mappedin/react-sdk/react-sdk/src/Navigation';
3068
- export * from '@mappedin/react-sdk/react-sdk/src/Shape';
3069
- export * from '@mappedin/react-sdk/react-sdk/src/Model';
3070
- export * from '@mappedin/react-sdk/react-sdk/src/useMapData';
3071
- export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
3072
- export type { UseMapProps } from '@mappedin/react-sdk/react-sdk/src/useMap';
3073
3172
  export default Mappedin;
3173
+ export { Marker, AnimatedMarker } from '@mappedin/react-sdk/react-sdk/src/Marker';
3174
+ export type { MarkerProps } from '@mappedin/react-sdk/react-sdk/src/Marker';
3175
+ export { Label } from '@mappedin/react-sdk/react-sdk/src/Label';
3176
+ export type { LabelProps } from '@mappedin/react-sdk/react-sdk/src/Label';
3177
+ export { useEvent } from '@mappedin/react-sdk/react-sdk/src/useEvent';
3178
+ export { Path } from '@mappedin/react-sdk/react-sdk/src/Path';
3179
+ export type { PathProps } from '@mappedin/react-sdk/react-sdk/src/Path';
3180
+ export { MapView } from '@mappedin/react-sdk/react-sdk/src/MapView';
3181
+ export type { MapViewProps } from '@mappedin/react-sdk/react-sdk/src/MapView';
3182
+ export { Navigation } from '@mappedin/react-sdk/react-sdk/src/Navigation';
3183
+ export type { NavigationProps } from '@mappedin/react-sdk/react-sdk/src/Navigation';
3184
+ export { Shape } from '@mappedin/react-sdk/react-sdk/src/Shape';
3185
+ export type { ShapeProps } from '@mappedin/react-sdk/react-sdk/src/Shape';
3186
+ export { Model } from '@mappedin/react-sdk/react-sdk/src/Model';
3187
+ export type { ModelProps } from '@mappedin/react-sdk/react-sdk/src/Model';
3188
+ export { useMapData } from '@mappedin/react-sdk/react-sdk/src/useMapData';
3189
+ export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
3190
+ export type { DetailedHTMLProps, HTMLAttributes, ClassAttributes } from 'react';
3074
3191
  }
3075
3192
 
3076
3193
  declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/category' {
@@ -5725,6 +5842,7 @@ declare module '@mappedin/react-sdk/geojson/src/types' {
5725
5842
  import type { ImageState } from '@mappedin/react-sdk/geojson/src/components/image';
5726
5843
  import type { ShapeState } from '@mappedin/react-sdk/geojson/src/components/custom';
5727
5844
  import type { Geometry3D } from '@mappedin/react-sdk/geojson/src/entities';
5845
+ import type { Group as TweenGroup } from '@tweenjs/tween.js';
5728
5846
  /**
5729
5847
  * The state of an entity, which can be a geometry, geometry group, group container, path, model, label, or marker.
5730
5848
  */
@@ -6010,6 +6128,8 @@ declare module '@mappedin/react-sdk/geojson/src/types' {
6010
6128
  pixelRatio: number;
6011
6129
  canvasWidth: number;
6012
6130
  canvasHeight: number;
6131
+ /** Global group for all tweens */
6132
+ tweenGroup: TweenGroup;
6013
6133
  };
6014
6134
  }
6015
6135
 
@@ -6520,6 +6640,7 @@ declare module '@mappedin/react-sdk/geojson/src/renderer' {
6520
6640
  import { MeshModificationSystem } from '@mappedin/react-sdk/geojson/src/systems/mesh-modification/system';
6521
6641
  import { PreRenderSystem } from '@mappedin/react-sdk/geojson/src/systems/pre-render/system';
6522
6642
  import { PolygonLabelSystem } from '@mappedin/react-sdk/geojson/src/systems/polygon-label/system';
6643
+ import { Group as TweenGroup } from '@tweenjs/tween.js';
6523
6644
  export type * from '@mappedin/react-sdk/geojson/src/types';
6524
6645
  export const raycaster: Raycaster;
6525
6646
  /**
@@ -6778,6 +6899,7 @@ declare module '@mappedin/react-sdk/geojson/src/renderer' {
6778
6899
  * @internal for testing
6779
6900
  */
6780
6901
  getInternalState(): RendererState;
6902
+ getTweenGroup(): TweenGroup;
6781
6903
  /**
6782
6904
  * Subscribe a function to an event.
6783
6905
  *
@@ -6849,10 +6971,10 @@ declare module '@mappedin/react-sdk/geojson/src/camera' {
6849
6971
  elevation?: number;
6850
6972
  };
6851
6973
  export const ANIMATION_TWEENS: {
6852
- linear: any;
6853
- 'ease-in': any;
6854
- 'ease-out': any;
6855
- 'ease-in-out': any;
6974
+ linear: (amount: number) => number;
6975
+ 'ease-in': (amount: number) => number;
6976
+ 'ease-out': (amount: number) => number;
6977
+ 'ease-in-out': (amount: number) => number;
6856
6978
  };
6857
6979
  export class Camera {
6858
6980
  #private;
@@ -6879,7 +7001,7 @@ declare module '@mappedin/react-sdk/geojson/src/camera' {
6879
7001
  /**
6880
7002
  * Whether the camera is animating.
6881
7003
  */
6882
- get isAnimating(): any;
7004
+ get isAnimating(): boolean;
6883
7005
  /**
6884
7006
  * Cancel the last animation.
6885
7007
  */
@@ -8092,8 +8214,9 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/paths' {
8092
8214
 
8093
8215
  declare module '@mappedin/react-sdk/mappedin-js/src/navigation/index' {
8094
8216
  import { type TDirectionInstruction } from '@mappedin/react-sdk/mappedin-js/src';
8095
- import type { Directions } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
8217
+ import type { Directions, GeoJsonApi } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
8096
8218
  import type { GeojsonApiMapObject } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/map-object';
8219
+ import type { FloorStack } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
8097
8220
  import { Path, Marker } from '@mappedin/react-sdk/mappedin-js/src/map-view-objects';
8098
8221
  import type { RendererCore } from '@mappedin/core-sdk';
8099
8222
  /**
@@ -8246,7 +8369,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation/index' {
8246
8369
  /**
8247
8370
  * @internal
8248
8371
  */
8249
- constructor(core: RendererCore, currentMapGetter: CurrentMapGetter);
8372
+ constructor(core: RendererCore, geoJSONApi: GeoJsonApi, currentMapGetter: CurrentMapGetter);
8250
8373
  /**
8251
8374
  * @internal
8252
8375
  */
@@ -8273,6 +8396,10 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation/index' {
8273
8396
  * The currently active path.
8274
8397
  */
8275
8398
  get activePath(): Path | undefined;
8399
+ /**
8400
+ * The current list of floor stacks along the navigation paths.
8401
+ */
8402
+ get floorStacks(): FloorStack[];
8276
8403
  /**
8277
8404
  * Sets the active path by index.
8278
8405
  */
@@ -10232,7 +10359,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/utils' {
10232
10359
  import type { TDoorsState, TMarkerState, TWallsState } from '@mappedin/react-sdk/mappedin-js/src/types';
10233
10360
  import type { Image, Shape } from '@mappedin/react-sdk/mappedin-js/src/map-view-objects';
10234
10361
  import type { GeoJsonApi } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/api';
10235
- import type TWEEN from '@tweenjs/tween.js';
10362
+ import type { Tween } from '@tweenjs/tween.js';
10236
10363
  export function convertCoordinateToPosition(coord: Coordinate): Position;
10237
10364
  export function convertPositionToCoordinate(coord: Position): Coordinate;
10238
10365
  export const cutEntrancesFromLineStrings: (lineStrings: ObstructionCollection["features"], entranceCollection: EntranceCollection["features"]) => {
@@ -10260,7 +10387,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/utils' {
10260
10387
  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>>[]>;
10261
10388
  export function translateToCoreStyle(style: PolygonStyle | LineStringStyle, userOptions?: TShow3DMapOptions): PaintStyle | LineStyle;
10262
10389
  export const getTargetID: <T extends Space | Shape | MapObject | Label | Marker | Model | Image | string>(target: T, api: GeoJsonApi) => string | undefined;
10263
- export function tweenToPromise(tween: TWEEN.Tween): Promise<void>;
10390
+ export function tweenToPromise(tween: Tween): Promise<void>;
10264
10391
  }
10265
10392
 
10266
10393
  declare module '@mappedin/react-sdk/geojson/src/components/style' {
@@ -10720,7 +10847,7 @@ declare module '@mappedin/react-sdk/geojson/src/systems/camera/system' {
10720
10847
  * Returns true if the camera is currently animating.
10721
10848
  * @return {Boolean} True if the camera is animating, false otherwise.
10722
10849
  */
10723
- get isAnimating(): any;
10850
+ get isAnimating(): boolean;
10724
10851
  /**
10725
10852
  * Returns true if the camera is currently moving (it's animating, the user is manipulating it).
10726
10853
  *
@@ -10924,7 +11051,6 @@ declare module '@mappedin/react-sdk/geojson/src/systems/camera/types' {
10924
11051
  import type { Vector2, Vector3 } from 'three';
10925
11052
  import type { TouchAnchor, InputSet } from '@mappedin/react-sdk/geojson/src/systems/camera/helpers';
10926
11053
  import type { InsetPadding, RendererCore } from '@mappedin/react-sdk/geojson/src';
10927
- import type { Easing } from '@tweenjs/tween.js';
10928
11054
  type AnimateCameraTarget = {
10929
11055
  position?: {
10930
11056
  x?: number;
@@ -11031,7 +11157,7 @@ declare module '@mappedin/react-sdk/geojson/src/systems/camera/types' {
11031
11157
  /**
11032
11158
  * The animation curve to use for zooming in. Uses the animateCamera one by default.
11033
11159
  */
11034
- curve?: typeof Easing;
11160
+ curve?: (n: number) => number;
11035
11161
  /**
11036
11162
  * Camera tilt between 0 (top-down) to 1 (from the side)
11037
11163
  */
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a as x,d as V,n as A,o as D,p as v}from"./chunk-TTBNS32H.js";import"./chunk-KUVUAM5C.js";import"./chunk-S5HIMMDM.js";import"./chunk-5T2PAGNC.js";import{a as n,j as a}from"./chunk-OANQFXHV.js";a();a();import z,{useCallback as F,useMemo as U}from"react";import{useContext as C,useEffect as T,useRef as L,useState as k}from"react";import{createPortal as G}from"react-dom";a();import{createContext as H,useContext as I}from"react";a();var g=class g extends Error{constructor(t){super("".concat(t," must be used within a MapView component."))}};n(g,"MapViewNullError");var m=g;var p=H({mapData:void 0,mapView:void 0});function K(){let{mapData:e,mapView:t}=I(p);if(!e||!t)throw new m("useMap");return{mapData:e,mapView:t}}n(K,"useMap");a();import{useEffect as _}from"react";function d(e,t){_(()=>{t!=null&&typeof e=="function"&&e(t)},[e,t])}n(d,"useOnLoad");var Y=n(e=>{let{mapView:t}=C(p),r=L(),[o,i]=k(null);return T(()=>{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]),T(()=>{o&&(t==null||t.updateState(o,{...e.options}))},[e.options]),d(e.onLoad,o),t==null||o==null?null:G(e.children,o.contentEl,o.id)},"Marker"),Ke=n(e=>{let{mapView:t}=C(p),[r,o]=k(null),i=L(V()),u=L(e.target),f=F(l=>{var M;o(l),(M=e.onLoad)==null||M.call(e,l)},[e.onLoad]);T(()=>{if(t==null)throw new m("Marker");if(r&&r.target!==e.target){let{duration:l=300,easing:M="linear"}=e;t.Markers.animateTo(r,e.target,{duration:l,easing:M})}},[t,e.target,r]);let c=U(()=>({...e,duration:void 0,easing:void 0}),[e.duration,e.easing]);return z.createElement(Y,{...c,key:i.current,target:u.current,onLoad:f})},"AnimatedMarker");a();import{useContext as $,useEffect as O,useRef as q,useState as B}from"react";function qe(e){let{mapView:t}=$(p),r=q(),[o,i]=B(void 0);return O(()=>{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]),O(()=>{r.current&&(t==null||t.updateState(r.current,{text:e.text,...e.options}))},[e.text,e.options]),d(e.onLoad,o),null}n(qe,"Label");a();import{useCallback as J,useContext as Q,useEffect as X}from"react";function tt(e,t){let{mapView:r}=Q(p),o=J(i=>t(i),[t]);X(()=>{if(r==null)throw new m("useEvent");return r.on(e,o),()=>{r!=null&&r.off(e,o)}},[r,e,t])}n(tt,"useEvent");a();import{useContext as Z,useEffect as ee,useRef as te,useState as re}from"react";function dt(e){let{mapView:t}=Z(p),r=te(),[o,i]=re(void 0);return ee(()=>{if(t==null)throw new m("Path");let u=t.Paths.add(e.coordinate,e.options);return u.animation.then(()=>{var f;(f=e.onDrawComplete)==null||f.call(e)}),i(u),r.current=u,()=>{r.current&&t.Paths.remove(r.current)}},[t,e.coordinate,e.options]),d(e.onLoad,o),null}n(dt,"Path");a();import w,{useCallback as ae,useEffect as oe,useMemo as ne,useRef as R,useState as j}from"react";var ie={width:"100%",height:"100%",position:"relative"};function ht(e){let{mapData:t,options:r,style:o,fallback:i,children:u,...f}=e,c=R(!1),[l,M]=j(void 0),[h,y]=j(!0),P=R(null),E=ne(()=>r,[]),b=ae(()=>{if(t&&(P!=null&&P.current)){if(l)return;D(P.current,t,E).then(S=>{M(S)}).catch(S=>{x.error("Failed to render MapView",S)}).finally(()=>{y(!1)})}},[t,P.current,E]);return oe(()=>{c.current||(c.current=!0,b())},[b]),d(e.onLoad,l),w.createElement(p.Provider,{value:{mapData:t,mapView:l}},w.createElement("div",{"data-testid":"mappedin-map",ref:P,style:{...ie,...o},...f}),h?w.createElement(w.Fragment,null,i):u)}n(ht,"MapView");a();import{useContext as pe,useEffect as W,useState as me}from"react";function Nt(e){let{mapView:t}=pe(p),[r,o]=me(!1);return W(()=>{if(t==null)throw new m("Navigation");return t.Navigation.draw(e.directions,e.options).then(()=>{var i;o(!0),(i=e.onDrawComplete)==null||i.call(e)}),()=>{t.Navigation.clear()}},[t,e.directions,e.options]),W(()=>{r!==!1&&typeof e.onLoad=="function"&&e.onLoad()},[e.onLoad,r]),null}n(Nt,"Navigation");a();import{useContext as de,useEffect as se,useRef as ue,useState as le}from"react";function Ct(e){let{mapView:t}=de(p),r=ue(),[o,i]=le(void 0);return se(()=>{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]),d(e.onLoad,o),null}n(Ct,"Shape");a();import{useContext as fe,useEffect as ce,useRef as Me,useState as ye}from"react";function Kt(e){let{mapView:t}=fe(p),r=Me(),[o,i]=ye(void 0);return ce(()=>{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 u of r.current)t.Models.remove(u)}},[t,e.models,e.options]),d(e.onLoad,o),null}n(Kt,"Model");a();import{useCallback as Pe,useEffect as he,useMemo as xe,useRef as we,useState as N}from"react";function $t(e){let[t,r]=N(void 0),[o,i]=N(!0),[u,f]=N(void 0),c=we(0),l=xe(()=>e,[]),M=Pe(()=>{let h=++c.current;i(!0),f(void 0),A(l).then(y=>{c.current===h&&r(y)}).catch(y=>{c.current===h&&(x.error("Failed to fetch MapData",y),f(y))}).finally(()=>{c.current===h&&i(!1)})},[l]);return he(()=>{M()},[M]),{mapData:t,isLoading:o,error:u}}n($t,"useMapData");var Qt=v;export{Ke as AnimatedMarker,qe as Label,ht as MapView,Y as Marker,Kt as Model,Nt as Navigation,dt as Path,Ct as Shape,Qt as default,tt as useEvent,K as useMap,$t as useMapData};
1
+ import{a as x,d as A,n as V,o as E,p as k}from"./chunk-NPRXXUN6.js";import"./chunk-QQ53JNBN.js";import"./chunk-Z7MNFX3S.js";import"./chunk-VT2X5G75.js";import{a as n,j as a}from"./chunk-OQLRRFPP.js";a();a();import U,{useCallback as Y,useMemo as $}from"react";import{useContext as C,useEffect as T,useRef as S,useState as D}from"react";import{createPortal as q}from"react-dom";a();import{createContext as I,useContext as z}from"react";a();var L=class L extends Error{constructor(t){super("".concat(t," must be used within a MapView component."))}};n(L,"MapViewNullError");var m=L;var p=I({mapData:void 0,mapView:void 0});function F(){let{mapData:e,mapView:t}=z(p);if(!e||!t)throw new m("useMap");return{mapData:e,mapView:t}}n(F,"useMap");a();import{useEffect as G}from"react";function s(e,t){G(()=>{t!=null&&typeof e=="function"&&e(t)},[e,t])}n(s,"useOnLoad");function O(e){let{mapView:t}=C(p),r=S(),[o,i]=D(null);return T(()=>{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]),T(()=>{o&&(t==null||t.updateState(o,{...e.options}))},[e.options]),s(e.onLoad,o),t==null||o==null?null:q(e.children,o.contentEl,o.id)}n(O,"Marker");function B(e){let{mapView:t}=C(p),[r,o]=D(null),i=S(A()),u=S(e.target),f=Y(l=>{var M;o(l),(M=e.onLoad)==null||M.call(e,l)},[e.onLoad]);T(()=>{if(t==null)throw new m("Marker");if(r&&r.target!==e.target){let{duration:l=300,easing:M="linear"}=e;t.Markers.animateTo(r,e.target,{duration:l,easing:M})}},[t,e.target,r]);let c=$(()=>({...e,duration:void 0,easing:void 0}),[e.duration,e.easing]);return U.createElement(O,{...c,key:i.current,target:u.current,onLoad:f})}n(B,"AnimatedMarker");a();import{useContext as J,useEffect as R,useRef as K,useState as Q}from"react";function X(e){let{mapView:t}=J(p),r=K(),[o,i]=Q(void 0);return R(()=>{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]),R(()=>{r.current&&(t==null||t.updateState(r.current,{text:e.text,...e.options}))},[e.text,e.options]),s(e.onLoad,o),null}n(X,"Label");a();import{useCallback as Z,useContext as _,useEffect as ee}from"react";function te(e,t){let{mapView:r}=_(p),o=Z(i=>t(i),[t]);ee(()=>{if(r==null)throw new m("useEvent");return r.on(e,o),()=>{r!=null&&r.off(e,o)}},[r,e,t])}n(te,"useEvent");a();import{useContext as re,useEffect as ae,useRef as oe,useState as ne}from"react";function ie(e){let{mapView:t}=re(p),r=oe(),[o,i]=ne(void 0);return ae(()=>{if(t==null)throw new m("Path");let u=t.Paths.add(e.coordinate,e.options);return u.animation.then(()=>{var f;(f=e.onDrawComplete)==null||f.call(e)}),i(u),r.current=u,()=>{r.current&&t.Paths.remove(r.current)}},[t,e.coordinate,e.options]),s(e.onLoad,o),null}n(ie,"Path");a();import w,{useCallback as pe,useEffect as me,useMemo as se,useRef as j,useState as W}from"react";var de={width:"100%",height:"100%",position:"relative"};function ue(e){let{mapData:t,options:r,style:o,fallback:i,children:u,...f}=e,c=j(!1),[l,M]=W(void 0),[h,P]=W(!0),y=j(null),b=se(()=>r,[]),v=pe(()=>{if(t&&(y!=null&&y.current)){if(l)return;E(y.current,t,b).then(g=>{M(g)}).catch(g=>{x.error("Failed to render MapView",g)}).finally(()=>{P(!1)})}},[t,y.current,b]);return me(()=>{c.current||(c.current=!0,v())},[v]),s(e.onLoad,l),w.createElement(p.Provider,{value:{mapData:t,mapView:l}},w.createElement("div",{"data-testid":"mappedin-map",ref:y,style:{...de,...o},...f}),h?w.createElement(w.Fragment,null,i):u)}n(ue,"MapView");a();import{useContext as le,useEffect as H,useState as fe}from"react";function ce(e){let{mapView:t}=le(p),[r,o]=fe(!1);return H(()=>{if(t==null)throw new m("Navigation");return t.Navigation.draw(e.directions,e.options).then(()=>{var i;o(!0),(i=e.onDrawComplete)==null||i.call(e)}),()=>{t.Navigation.clear()}},[t,e.directions,e.options]),H(()=>{r!==!1&&typeof e.onLoad=="function"&&e.onLoad()},[e.onLoad,r]),null}n(ce,"Navigation");a();import{useContext as Me,useEffect as Pe,useRef as ye,useState as he}from"react";function xe(e){let{mapView:t}=Me(p),r=ye(),[o,i]=he(void 0);return Pe(()=>{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,o),null}n(xe,"Shape");a();import{useContext as we,useEffect as ge,useRef as Le,useState as Te}from"react";function Se(e){let{mapView:t}=we(p),r=Le(),[o,i]=Te(void 0);return ge(()=>{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 u of r.current)t.Models.remove(u)}},[t,e.models,e.options]),s(e.onLoad,o),null}n(Se,"Model");a();import{useCallback as Ne,useEffect as be,useMemo as ve,useRef as Ae,useState as N}from"react";function Ve(e){let[t,r]=N(void 0),[o,i]=N(!0),[u,f]=N(void 0),c=Ae(0),l=ve(()=>e,[]),M=Ne(()=>{let h=++c.current;i(!0),f(void 0),V(l).then(P=>{c.current===h&&r(P)}).catch(P=>{c.current===h&&(x.error("Failed to fetch MapData",P),f(P))}).finally(()=>{c.current===h&&i(!1)})},[l]);return be(()=>{M()},[M]),{mapData:t,isLoading:o,error:u}}n(Ve,"useMapData");var Xt=k;export{B as AnimatedMarker,X as Label,ue as MapView,O as Marker,Se as Model,ce as Navigation,ie as Path,xe as Shape,Xt as default,te as useEvent,F as useMap,Ve as useMapData};